Some Help with disk driver routines

By ronivon

Expert (74)

ronivon's picture

23-03-2023, 12:53

Hi everyone.
Need some help to try and definitely understand what happens inside the msx disk driver routines & msx boot.

I am overhauling my MSXPi disk driver, but I actually broke it and now when I boot the MSX, the MSX-DOS is loaded, but then it freezes with the "MXS-DOS 1.03" and "Microsoft copyright".
The never executes, and that is the erratic behaviour I see.

So far, I noticed that he MSX is switching slots and calling the disk driver from different slot configurations.
I know that because if I use a PRINT function (call $A2) it works in the INIHRD function, but does not in the DSKIO function.
When I change the PRINT to BDOS (call 5), it inverts the point of failure (does not work from INIHRD, works from DSKIO)

So, MSX is switching slots between calls to my driver and calling from different slot configurations - what do I need to know about the slots configuration inside the msx-dos 1 disk driver, specially when transferring and storing sectors in the area pointed by DE register in the DSKIO routine ?

Another short question about GETWRK: what's the size of working area returned in HL/IX ?

Login or register to post comments

By zeilemaker54

Champion (347)

zeilemaker54's picture

24-03-2023, 17:40

May be you should study my msxsyssrc project, especially the disk kernel ROM to get some knowledge of the driver routines. Also the driver template may be helpfull.
In general the drivers are low level routines, which should never output to screen. May be the only exception is INIHRD.
Never ever call BDOS from these routines, because BDOS may not be initialized. This will surely crash the system.
INIHRD, DRIVES and INIENV are called when the disk system is in intialization fase. In this fase main bios is on page 0. So BIOS calls can be made directly.
When other driver routines (e.g. DSKIO) are called, you can never assume BIOS on page 0. So BIOS calls cannot made directly.
The working area returned by GETWRK points to the driver working area and depends on the size used by the driver (as defined by MYSIZE), which may be a different value among drivers. In my msxsyssrc project you can study quite some drivers to see MYSIZE and also how driver routines are implemented. Hope this helps.