MSX-DOS 1 BDOS error codes?

By Sandy Brand

Master (153)

Sandy Brand's picture

14-04-2019, 17:50

Hello everyone,

While testing my project I am running into an error while doing chain-load testing.

For some odd reason, after having successfully loaded and ran an X amount of files, BDOS suddenly only loads roughly 800h bytes from a file and then exits with a fail. The BDOS call in question is _RDBLK

RANDOM BLOCK READ [FCB] (27H)
     Parameters:    C = 27H (_RDBLK)
                   DE = Pointer to opened FCB
                   HL = Number of records to read
     Results:       A = 01H if error (usually caused by end-of-file)
                      =  0  if no error
                   HL = Number of records actually read

I have ruled out the possibility of errors in setting up the FCB, and I am sure to avoid trying to load data in the memory range 4000h-7FFFh because of the the disk ROM being paged there. I have also installed a custom error handler at F323h, but that one is not even called by BDOS it seems.

The bug seems to be triggered when switching disks, but only after reading a couple of files from the new disk.

I am beginning to worry that maybe some of my programs are mutilating some memory beyond the designated TPA memory range.

Anyways, before I will start digging into that; is there a way to obtain any sensible error information from the BDOS calls when using MSX DOS 1?

I found a nice list of error codes for MSX DOS 2, but there seems to be nothing like that for MSX DOS 1?:

http://map.grauw.nl/resources/dos2_environment.php#c6_1

Login or register to post comments

By NYYRIKKI

Enlighted (5358)

NYYRIKKI's picture

15-04-2019, 07:19

Are you sure that it is not about FCB? I think the most common error is not to reset random block number (FCB+33 ... FCB+36) correctly.

By Sandy Brand

Master (153)

Sandy Brand's picture

15-04-2019, 22:33

Yup, before the call to _RDBLK, I set all bytes in the FCB field to 0, apart from the file name.

By NYYRIKKI

Enlighted (5358)

NYYRIKKI's picture

16-04-2019, 09:34

Sandy Brand wrote:

Yup, before the call to _RDBLK, I set all bytes in the FCB field to 0, apart from the file name.

Ah, there is your error!

AFTER opening the file you have to manually set a valid number to random block size (FCB+14 ... FCB+15) BEFORE you call that _RDBLK

By Sandy Brand

Master (153)

Sandy Brand's picture

16-04-2019, 20:20

Apologies, I meant _FOPEN, my mistake Smile

Yes, and after a successful _FOPEN I set the random block size to 1 as you suggest and read data.