DOS-2 and mapper weird behaviour

صفحة 1/2
| 2

بواسطة mohai

Paladin (1001)

صورة mohai

25-01-2019, 20:23

Hello !
I am experiencing some problems with a file loader I wrote in assembler.
The program loads several files from disk (using FCB), after setting mapper page for page 2 (address 8000h), in order to load 1 file per mapper page.
My program is working in BASIC environment (DOS not active), with enabled BIOS (it is a BLOAD file).

If I run the program from a diskette (DOS 1), it works flawlessly. Mapper page switching works fine and every file is loaded correctly.

BUT, working from hard drive using DOS-2 diskrom (exactly same program, FCBs), after opening the file, DOS2 restores mapper pages to the boot-up state (FCh=3, FD=2, FE=1, FF=0), so some files are not correctly loaded. Question

Is it a normal behavior of DOS-2?
Can it be avoided or I will need to change my loading routines in order to avoid this "bug"?

I made a simple test from BASIC: after altering mapper registers, (i.e. OUT &HFE,4) and issue a FILES command, all registers are restored.

I tried in a 128K RAM MSX and a 256K MSX and both work the same.

Login أوregister لوضع تعليقاتك

بواسطة Grauw

Ascended (10706)

صورة Grauw

25-01-2019, 20:58

In DOS2 environment, you can not OUT to mapper registers directly. Always use the mapper support routines. Otherwise your program can not cooperate with other software which uses the mapper, such as DOS2 itself, causing segment restore issues such as these and worst case overwriting code or data causing crashes.

Quote:

A program can request a 16k RAM segment at any time by calling the "ALL_SEG" routine. This either returns an error if there are no free segments, or the segment number of a new segment which the program can use. A program must not use any segment which it has not explicitly allocated, except for the four segments which make up the basic 64k of RAM.

Quote:

Routines are provided to explicitly page a segment in, or to find out which segment is in a particular page. There are routines in which the page (0...3) is specified by the top two bits of an address in HL ("PUT_PH" and "GET_PH"). And there are also specific routines for accessing each page ("GET_Pn" and "PUT_Pn"). These routines are very fast so a program should not suffer in performance by using them.

Here is some example code. After determining the mapper support routines base address, it copies the jump table to a static location in the program code, so that I can call it easily.

For DOS1 support you could pre-populate the jump table with very simple implementations of those functions, so that if DOS2 is not found it will use those instead. Or you can ask users to run MU.COM before executing your program, this provides mapper support routines for DOS1.

بواسطة gdx

Enlighted (6103)

صورة gdx

26-01-2019, 01:57

This is extended Bios that provides these mapper support routines. Extended Bios is installed by Disk-ROM 2.xx (but can be installed too by another device). Extended bios routines are also available in Basic environement when Disk-Basic 2.xx in installed.
MU.COM is avalaible Here.

بواسطة mohai

Paladin (1001)

صورة mohai

27-01-2019, 14:37

Thank you everybody.
It seems that what started being a simple file loader would end up in a quite complicated program. LOL!
I will study the DOS2 mapper support routines and see if they suit my routines ...

بواسطة NYYRIKKI

Enlighted (6032)

صورة NYYRIKKI

27-01-2019, 15:10

As a work around there is MAP2-utility, but it does not work on all computers... If you plan to release your work as DOS2 compatible, I suggest you go with already mentioned standard solutions.

بواسطة ToriHino

Paladin (826)

صورة ToriHino

27-01-2019, 19:00

mohai wrote:

Thank you everybody.
It seems that what started being a simple file loader would end up in a quite complicated program. LOL!
I will study the DOS2 mapper support routines and see if they suit my routines ...

Using the DOS2 mapper routines as indicated by Grauw is not that complicated. In fact, it even provides good support to multiple mappers as well in various (sub)slots, without worrying about where they are located.

بواسطة DarkSchneider

Paladin (981)

صورة DarkSchneider

14-02-2019, 10:09

If you want to use extended memory in BASIC, I would recommend you to use NESTOR BASIC. No need to reinvent the wheel. It also includes Moonblaster re-player and more things.

بواسطة mohai

Paladin (1001)

صورة mohai

24-02-2019, 23:30

Thanks for the info.
I am starting to work with extended BIOS routines and getting positive results.

بواسطة aoineko

Paladin (887)

صورة aoineko

02-01-2023, 20:55

gdx wrote:

This is extended Bios that provides these mapper support routines. Extended Bios is installed by Disk-ROM 2.xx (but can be installed too by another device).

Does this mean that under MSX-DOS 2, we are 100% sure that the extended BIOS to handle Memory Mapper is available?

بواسطة Manuel

Ascended (19298)

صورة Manuel

02-01-2023, 21:43

MSX-DOS 2 implies diskROM 2.xx.

بواسطة aoineko

Paladin (887)

صورة aoineko

02-01-2023, 22:38

So, I don't understand why the documentation about MSX-DOS 2 asks to detect the presence of the extended BIOS before using the Memory Mapper handling routines. If there is no case where extended BIOS is not present under MSX-DOS 2 why bother to detect it?
For ex. : https://map.grauw.nl/resources/dos2_environment.php#c5

صفحة 1/2
| 2