i have a question now - imagine that we would create a floppy game on Pasmo (my goal is doing this on Boriel’s ZX-Basic Compiler later, but Pasmo would be just perfectly fine for now), and the main executable binary would be loaded only via autoexec.bas (no msxdos1 or msxdos2 at all), and this compiled code would access files on the floppy, whatever it is a msx 1, 2, 2+, turbo-r or whatever - how files are loaded via assembly routines, that would be have just like a bload from basic? or should we (a quite ludicrous situation, imho) always return to basic for loading “bloadable” files from floppies every time is needed? if it is related to bios routines, how are they accessed? and if they are i/o routines, how they would look like? thanks!
how can we load files from floppies in assembly?
Actually the routines work exactly like in DOS. You just need to replace BDOS entrypoint from 5 to #F37D
Wasn't it so that if you do not use any DOS or basic to load from the floppy you need to find out in which slot your diskrom is and get your diskrom in the right page first?
Wasn't it so that if you do not use any DOS or basic to load from the floppy you need to find out in which slot your diskrom is and get your diskrom in the right page first?
No. Just use call 0F37DH (the Disk Basic hook) instead of call 5. Like NYYRIKKI wrote.
Lot of technical info on http://www.konamiman.com/msx/msx2th/th-3.txt
I think the BIOS has functions for disk management. And use it to ensure compatibility. Never use directly the disk controller because each manufacturer can have its own.
PHYDIO (0144H)
Function: Physical input/output for disk devices
Input: A for the drive number (0 = A:, 1 = B:,...)
B for the number of sector to be read from or written to
C for the media ID
DE for the first sector number to be read rom or written to
HL for the startinga address of the RAM buffer to be
read from or written to specified sectors
CY set for sector writing; reset for sector reading
Output: CY set if failed
B for the number of sectors actually read or written
A for the error code (only if CY set):
0 = Write protected
2 = Not ready
4 = Data error
6 = Seek error
8 = Record not found
10 = Write error
12 = Bad parameter
14 = Out of memory
16 = Other error
Registers: all
ISFLIO (014AH) *1
Function: tests whether the device is active
Input: none
Output: A = 0 -> active
A <>0 -> inactive
Registers: AF
I can't recommend using PHYDIO for handling files in any case. It will be nightmare even if you don't plan to support any mass storage devices.
Yep, unless you have a table of "files" and data filled manually to use (positions and sizes ). Any case if available is much better to use system functions, as they have that purpose.
btw, i was looking for something “simple”, just like a register pair pointing to a filename somewhere in the memory, and perhaps some other registers pointing to where would be loaded and size, and then call the routine needed for loading the file - would be that possible? is that routine available on the bios somewhere? or should we need to create it somehow?
You have to create FCB that contains the filename. The OPEN function will fill in the size information, but after open you have to set manually the read block size (eg 1-byte). The load address can be set with SET DTA (#1A) command... After loading what you want to load, please CLOSE the file. All of this is actually explained quite a well in MSX-DOS2 manuals. See here: https://www.msx.org/wiki/MSX-DOS
Usage of Disk BASIC 2.0 with FIB is a bit more easy as you can usually just point to ASCIIZ string, but it limits the compatibility to machines with DOS2 ROM.
the information there seems incomplete or confusing, at least for me - and i'm really interested on using it on all machines, not restricting it to dos2 machines
I think DOS has the same functions, at least for floppy, and DOS doesn't requires anything special, it works on any MSX with 64KB, without any extra cartridge.