lotus

previous page: 06.015 How long can a DOS 3.3 file name be and what characters can it include?
  
page up: Apple II Csa2 FAQs
  
next page: 06.017 How many 'official' versions of DOS 3.3 are there and how can I tell which is running?

06.016 How can I use DOS 3.3 to read and write sectors from machine code?




Description

This article is from the Apple II Csa2 FAQ, by Jeff Hurlburt with numerous contributions by others.

06.016 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  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.

________________

By:  Edhel Iaur, Esq.
    

 

Continue to:













TOP
previous page: 06.015 How long can a DOS 3.3 file name be and what characters can it include?
  
page up: Apple II Csa2 FAQs
  
next page: 06.017 How many 'official' versions of DOS 3.3 are there and how can I tell which is running?