How can I use DOS 3.3 to read and write sectors from machine code?
DOS 3.3 works like this: JSR $3E3 ;get address of RWTS IOB (low in Y, high in A) (you can either change the stuff that Y/A point to, or set up your own IOB and skip the call to $3E3) JSR $3D9 ;call RWTS (with IOB address in Y/A) The IOB (Input/Output Block) is small but non-trivial. Here’s what Beneath Apple DOS says: $00 table type (always $01) $01 slot *16 $02 drive (1 or 2) $03 volume expected ($00 for any) $04 track ($0-$22) $05 sector ($0-$0f) $06-07 address (lo/hi) of the Device Characteristics Table $08-09 address (lo/hi) of the 256 byte buffer for read/write $0A not used $0B byte count for partial sector ($00 for 256 bytes) $0C command code (0=seek, 1=read, 2=write, 4=format) $0D return code (carry set on error): $00 = no errors $08 = error during initialization $10 = write protect error $20 = volume mismatch error $40 = drive error $80 = read error (obsolete) $0E volume number of last access (must be initialized) $0F slot number of last access *16 (must be initialized) $10 dri