Memory Mapper Segment availability/allocation under MSXDOS/Nextor

I am sorry if this has been asked, but I could not find any material on forums and documentation.

How do I check for memory mapper segment availability under MSXDOS/Nextor?

I want to use the memory mapper without destroying the OS environment, so my application can quit safely to OS. I have seen that applications like MI120 properly detects OS' total usage of Memory Mapper Segments (although MI120 does not show which segments are being used). How do they do that?

Is there a set of MSXDOS BIOS calls to control Memory Mapper's segments availability/allocation?

Note that the mapper support routines are a MSX-DOS2 function, although there is a TSR (MU.COM) which can also add mapper support to DOS1.

Also note that it is your responsibility to restore the slot and mapper page configuration to its initial state when your program terminates, also when it terminates abnormally. Unfortunately DOS doesn’t do this automatically, and if you don’t do it yourself the memory environment can get messed up causing bugs for programs that are run afterwards. The only thing that DOS does for you automatically on program termination is to free the user segments that you’ve allocated, though I think it’s good practice to also free these manually (for MU.COM support this is also mandatory).

As an additional note, be aware that MSX-DOS2 can load directly to the primary mapper only. So when you want to transfer data from disk to a non-primary mapper slot using the DOS calls, always use a buffer in between.

@gdx I presume you mean when executing in the BIOS/BASIC environment? Or do you mean to say that even think when booting in "DOS1 mode", with a key pressed at start-up or booting from a DOS1-formatted disk, these mapper support routines are available? (That would be novel to me.)

@DarkSchneider You can call the Extended BIOS from the BIOS/BASIC environment just as well as from the DOS environment (just like the BDOS functions can be called from both environments)... Nowhere have I ever read that the extended BIOS mapper routines are only supposed to be used in the DOS2 runtime environment, and I don’t see why that would be so either…

I can’t find any documentation for accesing those features in the MSX standard way (not using direct ports).

You access it in exactly the same way in both environments, calling the "Get mapper support routine address" routine on the EXTBIO entry point. This entry point is standard and not dependent on the DOS runtime. The only coupling to MSX-DOS2 is that it is included as part of the DiskROM v2.0, otherwise it is a completely independent system.

@gdx I presume you mean when executing in the BIOS/BASIC environment? Or do you mean to say that even think when booting in "DOS1 mode", with a key pressed at start-up or booting from a DOS1-formatted disk, these mapper support routines are available? (That would be novel to me.)

Mapper function (Extended BIOS) is available in the BIOS/BASIC environment when booting with Disk-ROM v2.00 but not in "DOS1 mode". When we press [1] at boot the Disk-ROM v1.xx is set instead of the v2.xx.