Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!amdahl!amdahl!fadden From: fadden@uts.amdahl.com (Andy McFadden) Newsgroups: comp.sys.apple2 Subject: Re: DOS 3.3 RWTS question Message-ID: Date: 21 Mar 93 09:14:31 GMT References: Organization: Amdahl Corporation, Sunnyvale CA Lines: 59 In article ck21062@uxa.cso.uiuc.edu (Greymalkin ) writes: >I need to write a small routine in DOS3.3 that will read and write sectors from >disk except all my books and notes are at home. From what I remember, you jump >to the DOS RWTS routine which reads parameters from the IOB included just after >the jump. You're confusing DOS 3.3 with ProDOS. 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 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 drive number of last access (must be initialized) Device characteristics table: $00 device type (should be $00 for DiskII) $01 phases per track (should be $01 for DiskII) $02-03 motor on time count (should be $EFD8 for DiskII) NOTE: RWTS uses zero-page location $48, which is also used by the Apple monitor to hold the P-register value. Location $48 should be set to zero after each call to RWTS. I should also point out that JMP wouldn't work for the way you described; if you don't use JSR, then there's no way for the routine being called to determine where it was being called from. For DOS 3.3 RWTS, it doesn't matter, since the IOB is passed through the registers. -- fadden@uts.amdahl.com (Andy McFadden) [ Above opinions are mine, Amdahl has nothing to do with them, etc, etc. ]