Closed abekermsx closed 2 years ago
Thank you Abekermsx. MSX-DOS will be one of my next focus. I have to read more documentation about it and to create some sample programs.
In your example, you read the file by chunk of 128 bytes. So with a 128 bytes buffer, you could include in the reading loop the copy of that chunks to the VRAM.
Yeah I know, but the file contains a BASIC-header so the pixel data is not aligned to 128 bytes. I could work around that but I just wanted to create a minimal example.
I already have a working version with the random block read function. The current fcb struct is not ideal for this kind of operation (for example the file position has to be updated in some bytes in the reserved2 field). Ideally the fcb structure should specify more fields as documented at http://map.grauw.nl/resources/dos2_environment.php#c3_6 but it would be a breaking change (if anybody is using this DOS module).
Some fcb fields have multiple purposes depending on the type of operation (for CP/M compatibility, 128-byte block read/write and random block read/writes) which makes it a bit hard to design a proper struct. Maybe 2 kinds of structs are needed. Or you could just keep this module very low level (just a wrapper for DOS1/2 calls) and introduce a higher level File module.
Give me few days to read more documentation about disk interface and MSX-DOS and I'll comeback with a solution. Current FCB structure is incorrect and have been introduced recently ; I think it still time to fix it. :)
Ok I found out I need to add PUSH IX/POP IX in the functions because the BDOS calls overwrites IX.
I fixed the DOS1 functions so they can be actually used now.
I created a small sample to test, it loads and displays a .GE5 file. Of course, allocating 30375 bytes on the heap is not ideal :P I could work around that but it would be better to have at least read random block added to MSXgl. I'll try to add those myself.
include "msxgl.h"
include "dos.h"
include "memory.h"
fcb file; u8 *data;
void main() { VDP_SetMode(VDP_MODE_SCREEN5); VDP_SetColor(0);
}