New version of MSXDOS2.SYS

New version of MSXDOS2.SYS

by NYYRIKKI on 30-10-2017, 02:08
Topic: Software
Languages:

MSXDOS2.SYS is important part of MSX-DOS 2 operating system. Yet for some reason it has not been much revisited during the years. Now MRC regular NYYRIKKI has created a new MSXDOS2.SYS version 2.40 to replace the official version 2.30. This has all the same functionality.
Below some specs.

  • Japanese versions of error messages have been removed. COMMAND2.COM versions 2.4x are also English only, so this is in line with latest development.
  • The code has been revisited and reorganized (but not packed) to make it smaller and faster.
  • Some useless stuff which is only needed at boot time is no longer kept in TPA RAM afterwards.
  • The file size is reduced from 4870 bytes to 2565 bytes.
  • The amount of reserved TPA RAM has been reduced from 2566 bytes to 1922 bytes. How ever this memory consumption reduction can not be seen quite that straight forward since due to CP/M compatibility the MSXDOS2.SYS is always loaded to 256-byte boundary.

In this package there is small tool called TPAMEM.COM which you can use to compare the improvement of RAM usage on your setup.

When ever MSXDOS2.SYS gets interactive with you, it tends to raise blood pressure. "Insert COMMAND2.COM in drive A... Now, how on earth are you supposed to do that? Can't you see it's a hard disk!" or "Abort/Retry/Ignore... of which exactly none of these options takes me any further." Does this sound familiar?

Now in case of error it is possible to input an alternative drive to recover. Note that (like in 2.30) in this kind of error situation AUTOEXEC.BAT and REBOOT.BAT are skipped and they need to be manually executed if needed. Now also if you end up to error situation with no way out you can hit CTRL+B to jump start BASIC in order to fix the problem.

Sometimes you may also want to start BASIC instead of MSX-DOS2. Now, if you keep holding "B"-key down during boot time the computer will directly boot to BASIC and execute AUTOEXEC.BAS if it is present on boot drive. Please note: If you want to initialize DOS properly later you may need to start it with command CALL SYSTEM("A:\AUTOEXEC.BAT A:")

This version also implements a minor bug fix compared to version 2.31: If you load call extensions (such as ie. X-BASIC, SUPER-X or the MoonBlaster BASIC replayer), go to DOS, go back to BASIC and execute CALL-command the computer may crash. This has been fixed.

Relevant link: MSX-DOS2.SYS version 2.40 by NYYRIKKI

Comments (46)

By iamweasel2

Paladin (713)

iamweasel2's picture

30-10-2017, 03:28

This is really great ! It is nice to see such improvements to MSX-DOS2. Smile

Are you planning FAT16 native support to DOS2 in future versions as well?

By ToriHino

Paladin (858)

ToriHino's picture

30-10-2017, 07:31

Very nice to see these kind of improvements. One feature i would really like is the support for long filenames, although this might be more something for Command.com.

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

30-10-2017, 09:21

Native FAT16 support would require modification of DOS2 ROM... but if you plan to do that then it is better to update directly to Nextor that already has it among other new features... Naturally FAT16 driver (as any driver) could be build in to MSXDOS2.SYS just as well, but I think the current solution where it is as separate program is better since then user can optionally leave it out from AUTOEXEC.BAT if he has no need for it.

Pretty much same explanation goes for long filenames... It would require update both to COMMAND2.COM and to ROM. I guess update to ROM could be patched around like FAT16 driver does, but I see no task for MSXDOS2.SYS in this improvement either.

In general I have no plans to redesign DOS in any major way. I just updated this because I happened to take a look inside and realized that quite a lot of TPA memory could be saved without affecting compatibility negatively.

By gdx

Enlighted (6219)

gdx's picture

30-10-2017, 10:26

Can we use this with any Disk-ROM v2.xx or this is for MSX turbo R only?

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

30-10-2017, 10:36

gdx wrote:

Can we use this with any Disk-ROM v2.xx or this is for MSX turbo R only?

It should work with any Disk-ROM v2.xx

By Pippo

Hero (521)

Pippo's picture

30-10-2017, 11:06

Wonderful, Nyyrikki!
You are always "The Great"! Smile

By KdL

Paragon (1452)

KdL's picture

30-10-2017, 14:13

An amazing update! Thank you so much!! Running Naked in a Field of Flowers

By tvalenca

Paladin (747)

tvalenca's picture

30-10-2017, 15:47

Loved that Qbert image!

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

30-10-2017, 15:55

tvalenca wrote:

Loved that Qbert image!

Indeed... Jelle over performed with that one Smile

By karloch

Prophet (2159)

karloch's picture

30-10-2017, 19:22

How nice! Just for me to understand: this is an upgrade to MSX-DOS 2 that do not require any new ROM, while NEXTOR does indeed need his own ROM. Am I correct?

By KdL

Paragon (1452)

KdL's picture

30-10-2017, 20:53

Hi NYYRIKKI, inside your MSXDOS2.SYS I found:

020E:   call   #f37d      
0211:   ret

I suppose you can put a jp #f37d , right?

A question over the opening info texts:

014A:   ld     de,#0aa8   
014D:   ld     c,#09      
014F:   call   #f37d      
0152:   call   #01bc      
0155:   ld     de,#0ae9   
0158:   ld     c,#09      
015A:   call   #f37d      
015D:   call   #024a      
0160:   ld     de,#0ae7   
0163:   ld     c,#09      
0165:   call   #f37d      

I would like a variant without these texts, could you propose a lite version in your MSXDOS2.SYS_V2.40.ZIP ? Nextor also has one! Wink Wink Wink

014A:   jr     #06    ; e.g. temporary patch 'mod-k1'
014A:   jr     #1c    ; e.g. temporary patch 'mod-k2'

By gdx

Enlighted (6219)

gdx's picture

30-10-2017, 23:26

When we remove the condition with 0002Dh in the Disk-ROM, the DOS2 works fine on MSX1 if a Memory Mapper is inserted. By cons the parameter of the MODE command is always taken into account when it exceeds 40. Do you know where to change to correct this little flaw on MSX1?
Is it in the ROM or COMMAND2.COM?

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

31-10-2017, 14:45

KdL wrote:

I suppose you can put a jp #f37d , right?

Right... I must say that I didn't try to optimize everything to the max outside of TPA block as I did put the effort to where it really counts. There are still some clock cycles and bytes that could still be saved, but practically the effect to end result is so close to 0 that I considered it irrelevant.

Quote:

I would like a variant without these texts, could you propose a lite version in your MSXDOS2.SYS_V2.40.ZIP ? Nextor also has one! Wink Wink Wink

Yes, if you want a version with no start texts, I can compile you one... Not right now though.

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

31-10-2017, 14:47

gdx wrote:

When we remove the condition with 0002Dh in the Disk-ROM, the DOS2 works fine on MSX1 if a Memory Mapper is inserted. By cons the parameter of the MODE command is always taken into account when it exceeds 40. Do you know where to change to correct this little flaw on MSX1?
Is it in the ROM or COMMAND2.COM?

MODE command is part of COMMAND2.COM... I suggest you to contact TNI.

By KdL

Paragon (1452)

KdL's picture

31-10-2017, 22:20

yes thanks, no hurry Wink

By Manuel

Ascended (19469)

Manuel's picture

31-10-2017, 23:38

Quote:

4870 bytes to 2565

How the heck did you almost halve that binary size!?

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

01-11-2017, 05:14

Manuel wrote:
Quote:

4870 bytes to 2565

How the heck did you almost halve that binary size!?

Microsoft wanted to be able to compile the binary in one go and keep it quite easy to modify it also in the future. This approach caused the binary to have both empty space and doubled data... Instead of this I have pretty messed up binary building process "ready to explode at any given time" that actually compiles the same part of code 3 times, LOL. It is not pretty, but it generates lots of smaller & faster end result. I have also used smaller, but more limited data tables. They are more memory efficient, but it also meant that I needed to put the routines to correct order in memory pretty much one by one. It is quite a puzzle to maintain it without breaking it, but it's the end result that counts. Smile

By gdx

Enlighted (6219)

gdx's picture

01-11-2017, 09:18

You have also added the display of the available RAM and the number of drives at start. Cool

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

01-11-2017, 09:35

gdx wrote:

You have also added the display of the available RAM and the number of drives at start. Cool

Yeah, well... I thought it would be more useful than displaying the MSXDOS2.SYS version number that has no use to anyone... I was also thinking about dropping directly to prompt (like KdL wanted it), but then I thought that it could be considered a bit too ascetic and in case of some weird error situation it would be harder to identify if even MSXDOS2.SYS was loaded or not.

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

01-11-2017, 11:19

karloch wrote:

How nice! Just for me to understand: this is an upgrade to MSX-DOS 2 that do not require any new ROM, while NEXTOR does indeed need his own ROM. Am I correct?

Yes

By edoz

Prophet (2482)

edoz's picture

01-11-2017, 21:20

You are my hero NYYRIKKI Big smile Big smile

By Manuel

Ascended (19469)

Manuel's picture

01-11-2017, 22:11

I'm now considering to start a NYYRIKKI fan club... who joins?

By meits

Scribe (6544)

meits's picture

01-11-2017, 22:34

Manuel wrote:

I'm now considering to start a NYYRIKKI fan club... who joins?

You can join mine

By ray2day

Paladin (743)

ray2day's picture

02-11-2017, 21:14

Quote:

I'm now considering to start a NYYRIKKI fan club... who joins?

Count me in! Cool Cool

By ARTRAG

Enlighted (6935)

ARTRAG's picture

03-11-2017, 17:10

I'm in!

By Louthrax

Prophet (2465)

Louthrax's picture

09-11-2017, 17:13

Just tested that with Novaxis SCSI interface and it works great. There's just a small bug: when you have a 4MB RAM expansion plugged, MSXDOS2.SYS mentions 4080KB of main RAM at welcome message (should be 4096?).

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

10-11-2017, 11:02

Louthrax wrote:

Just tested that with Novaxis SCSI interface and it works great. There's just a small bug: when you have a 4MB RAM expansion plugged, MSXDOS2.SYS mentions 4080KB of main RAM at welcome message (should be 4096?).

Actually it is not a bug... It does not display the physical amount of RAM, but amount of RAM that is available for DOS2 system & applications... If you have 4096KB memory mapper DOS2 can use only 4080KB out of it. This is DOS2 internal mechanism to prevent the "famous" counter overflow error.

By Louthrax

Prophet (2465)

Louthrax's picture

10-11-2017, 11:24

NYYRIKKI wrote:
Louthrax wrote:

Just tested that with Novaxis SCSI interface and it works great. There's just a small bug: when you have a 4MB RAM expansion plugged, MSXDOS2.SYS mentions 4080KB of main RAM at welcome message (should be 4096?).

Actually it is not a bug... It does not display the physical amount of RAM, but amount of RAM that is available for DOS2 system & applications... If you have 4096KB memory mapper DOS2 can use only 4080KB out of it. This is DOS2 internal mechanism to prevent the "famous" counter overflow error.

Aaaaaahhhh... was not aware of that! The "memory" command also displays 4080KB too (4177920 bytes). There are indeed issues with the 4MB extension on several MSX demos and softwares.

By msd

Paragon (1515)

msd's picture

10-11-2017, 13:05

In all th years i used 4MB only ur had problems this. The 'problem' is strongly exceturated.

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

10-11-2017, 13:19

Louthrax wrote:

There are indeed issues with the 4MB extension on several MSX demos and softwares.

I know that at least NOP's UR is suffering from this, but it would be nice to get some sort of list of problematic titles.

By Grauw

Ascended (10771)

Grauw's picture

10-11-2017, 14:17

NYYRIKKI wrote:

If you have 4096KB memory mapper DOS2 can use only 4080KB out of it. This is DOS2 internal mechanism to prevent the "famous" counter overflow error.

It’s simply that it must be able to represent 0 (as-in "no free segments"), so obviously it can’t represent a size larger than 255 without using a 16-bit value, and they chose to cap it at 4080K so they could keep the math and value storage 8-bit.

The 4 MB thing is a big myth imo, would be good if it wasn’t propagated over and over to scare people off producing & buying 4 MB extensions.

By Louthrax

Prophet (2465)

Louthrax's picture

10-11-2017, 15:39

The thing is commercial games were not using the memory mapper, and the MSX-DOS 2 tools should not suffer from the problem as they have to use the DOS 2 functions. So mainly demos, cracked ROM and MSX-DOS 1 tools should be impacted.

By msd

Paragon (1515)

msd's picture

11-11-2017, 02:55

They are only impacted when they try to count 256 pages with an 8bit counter. If is doesn't do that then there is no issue. So most if it almost althigs work fine also under dos1

By Louthrax

Prophet (2465)

Louthrax's picture

02-03-2019, 10:47

Hi NYYRIKKI,

I've maybe found a bug when using your MSXDOS2.SYS version on 128KB machines.

Steps to reproduce:

  • Copy your MSXDOS2.SYS on an SDCard...
  • ...along with COMMAND.COM version 2.31 (that version gives 1 more free segment as it has no auto-completion feature).
  • Boot your MSX machine, assuming it uses a Nextor kernel (MegaFlashROM SCC+ SD...).

Expected: The boot message should show "Primary RAM 32KB out of 128KB".
Observed: The boot message shows "Primary RAM 128KB out of 25248KB".

Not tested on machines not using Nextor but the standard MSX-DOS 2 kernel.

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

02-03-2019, 13:54

Louthrax wrote:

Hi NYYRIKKI,

I've maybe found a bug when using your MSXDOS2.SYS version on 128KB machines.

Steps to reproduce:

  • Copy your MSXDOS2.SYS on an SDCard...
  • ...along with COMMAND.COM version 2.31 (that version gives 1 more free segment as it has no auto-completion feature).
  • Boot your MSX machine, assuming it uses a Nextor kernel (MegaFlashROM SCC+ SD...).

I end up to BASIC since NEXTOR.SYS is missing... If I add it the MSXDOS2.SYS will be skipped.

Quote:

Expected: The boot message should show "Primary RAM 32KB out of 128KB".

No, the expected boot message should be "Primary RAM 128KB"

By Louthrax

Prophet (2465)

Louthrax's picture

02-03-2019, 15:32

Argl, sorry NYYRIKKI, I was in a coding rush this morning and definitively did not take time to check my message!

  • Your MSXDOS2.SYS needs to be renamed to NEXTOR.SYS so that Nextor can boot it.
  • The Primary RAM is indeed OK (128KB), only the "out of" part seems wrong.

Anyway, not a big issue, I was already surprised that this was booting and working when your MSXDOS2.SYS was not designed for Nextor.

By gdx

Enlighted (6219)

gdx's picture

02-03-2019, 15:57

I would like this version with the support of Japanese.

By konamiman

Paragon (1198)

konamiman's picture

04-03-2019, 09:51

Louthrax wrote:

I was already surprised that this was booting and working when your MSXDOS2.SYS was not designed for Nextor.

NEXTOR.SYS is just an extended version of MSXDOS2.SYS, so yes, renaming MSXDOS2.SYS to NEXTOR.SYS will work - although of course you won't be able to use the Nextor tools (MAPDRV.COM etc); you can still use the BASIC CALL equivalents, though.

Anyway, the next version of Nextor will fallback to booting with MSXDOS2.SYS if NEXTOR.SYS is not found. I got this suggested in GitHub and it's trivial to implement.

By Grauw

Ascended (10771)

Grauw's picture

04-03-2019, 10:04

Does MSX-DOS 2.31 work with NEXTOR.SYS renamed to MSXDOS2.SYS?

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

04-03-2019, 15:51

konamiman wrote:

Anyway, the next version of Nextor will fallback to booting with MSXDOS2.SYS if NEXTOR.SYS is not found. I got this suggested in GitHub and it's trivial to implement.

I would say this is definitely a step to right direction. For users I would suggest renaming NEXTOR.SYS to MSXDOS2.SYS after this change is implemented to avoid any unnecessary confusion... Other reasons include that it allows DOS loaders load TSR's above MSXDOS2.SYS (Without special Nextor support) and old tools that report stuff like MSX-DOS2.SYS version or location will then again talk about correct file.

By Louthrax

Prophet (2465)

Louthrax's picture

04-03-2019, 20:26

Hi Nestor,

The only interest I saw in using MSXDOS2.SYS instead of NEXTOR.SYS was the ability to boot COMMAND2.COM version 2.31, which uses less memory. Well, only one 16KB segment, but that segment allows SofaRun / SofaRunit / SofaROM to work on machines with only 128KB of RAM.

If I remember well, COMMAND2.COM version 2.31 was not booting with NEXTOR.SYS, not exactly sure why.

Maybe an interesting option in next Nextor would be to choose wether to allocate that 16KB segment (allowing TAB completion) or not? (the TAB complection is not really useful when you use SofaRun or MultiMente).

By gdx

Enlighted (6219)

gdx's picture

05-03-2019, 00:29

NYYRIKKI wrote:

I would say this is definitely a step to right direction. For users I would suggest renaming NEXTOR.SYS to MSXDOS2.SYS after this change is implemented to avoid any unnecessary confusion...

Back to its original name is not sufficient to avoid any confusion. Version number must be upper than 2.31. Currently it is 2.10, this is lower than the latest version of MSX-DOS2.

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

05-03-2019, 04:15

Louthrax wrote:

If I remember well, COMMAND2.COM version 2.31 was not booting with NEXTOR.SYS, not exactly sure why.

I think you must remember wrong... or at least one of us does. Smile

Quote:

Maybe an interesting option in next Nextor would be to choose wether to allocate that 16KB segment (allowing TAB completion) or not? (the TAB complection is not really useful when you use SofaRun or MultiMente).

This is not a Nextor feature, you have to talk to TNI about that... How ever I would be careful not to talk only about TAB completion, since in general there are ~100 new embedded command line commands, variables & functions in DOS 2.4x and the extra 16KB is shared with stuff like user defined aliases, command line history and such and has no really anything to do with TAB completion.

BTW already before DOS 2.40 was released, I made a program called DOS2TAB that adds the TAB completion feature to earlier versions of DOS2. It can be found from here, if someone needs it... It places it self to BASIC PLAY-command buffer IIRC: http://www.msxarchive.nl/pub/msx/utils/dos2/

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

05-03-2019, 17:25

BTW here is now a fixed version that should not have this memory count bug under Nextor... In the same package there is also the "silent"-version that KdL requested. (Sorry KdL, I totally forgot your request)

By KdL

Paragon (1452)

KdL's picture

05-03-2019, 18:48

NYYRIKKI wrote:

BTW here is now a fixed version that should not have this memory count bug under Nextor... In the same package there is also the "silent"-version that KdL requested. (Sorry KdL, I totally forgot your request)

I'm really happy. It's smaller (only 2,286 bytes) and fast as I thought. Thank you!

By Louthrax

Prophet (2465)

Louthrax's picture

05-03-2019, 19:26

NYYRIKKI wrote:

BTW here is now a fixed version that should not have this memory count bug under Nextor... In the same package there is also the "silent"-version that KdL requested. (Sorry KdL, I totally forgot your request)

Cool, thanks NYYRIKKI !