[Coco] Disk subroutines for Assembly?
William Astle
lost at l-w.ca
Thu Feb 3 16:16:49 EST 2022
On 2022-02-03 14:00, Don Barber wrote:
> (https://colorcomputerarchive.com/repo/Documents/Manuals/Programming/Disk%20EDTASM%20%28Tandy%29.pdf)
> specifically Section IV which talks about DOS routines including open,
> write, read, and close functions for files. But its mixed up with
> talking about 'overlays' which sounds like its something edtasm injects
> into the assembled binary itself.
>
> Note: I'm not using edtasm; I've been using lwasm on my linux laptop to
> compile code into decb format and generally happy with it.
The only officially exposed entry point for Disk I/O is DSKCON which
only does sector I/O. That means anything using only published entry
points would have to implement its own file system handling, but it
wouldn't have to implement the low level driver.
That stuff in the Disk EDTASM manual is referring to that weird dos
thing that Disk EDTASM comes with. You don't want to use that.
It is possible to do simple sequential read or sequential write
(equivalent to OPEN "I" or OPEN "O") with some trickery which is not
straight forward at all. Mixing the two on the same file is not
possible. The random access file stuff works off fixed record sizes
which could be leveraged to implement truly bi-directional file
accesses, but that gets complicated.
The problem with using the various undocumented ROM calls is that there
are two different versions of the Disk ROM and the routines are at
different addresses between those two versions. You also need to find a
way to handle errors since those will drop back to Basic with the error
message. That's a large part of the trickery.
Of course, the how is not particularly obvious. I did solve it at some
level for modifications I made to Dungeons of Daggorath. You might be
able to work out what I did and how it works from the source for that,
which you can find at http://dod.projects.l-w.ca/hg-lw/.
More information about the Coco
mailing list