AERCO FD-68 Disc System

Author(s): Mowgli Assor
Pub Details: Time Designs Magazine v3 n6 (Volume 3, Issue 6)
Date: September/October 1987
Pages: 10

This article is mainly for those of you who like to tinker, and a knowledge of Z80 machine code is very helpful. It is also helpful if you have HOT-Z 2068, ZEUS Assembler, or some other assembler package.

The routines that are listed, took me about 3 weeks to perfect! This shows that doing the code to actually access the disc is VERY finicky. The routines have been tested on ROM revisions 8.8 through 8.9, so if you have these ROM revisions and the routines don’t work, the first thing that you should check is whether anything was mistyped.

Before actually accessing the routines, it always helps to actually turn on the drive! This is NOT done automatically. Calling 3542h will turn on drive A, 3547h will turn on drive B, etc.

When actually accessing the sector routines, you first need to set up certain registers with the drive parameters. The following parameters are required:

“` LD B,<Track number> LD C,<Sector number> LD HL,<Buffer address> “`

After loading up these parameters, and loading chunk 1 from the dock bank, you can CALL 3556h for read or CALL 3568h for write.

The following is a rough flowchart showing how a routine would read a sector off of disc. Following the flowchart is the routine in Z80 assembler code.

-----------------------------------------
              -- START --

            -- Do IN 244 --

       -- Save result for later --

       -- Do OUT 244 with chunks --
           -- 0 & 1 enabled --

    -- CALL 3542h to turn ON drive --

       -- LD registers B, C, & HL --
           -- with parameters --

     -- CALL 3556h to READ sector --

    -- CALL 3582h to turn OFF drive --

        -- RETurn to BASIC code --
-----------------------------------------

The Z80 assembly code goes something like this :

“` PUSH AF ; PUSH BC ; > Save stuff for PUSH HL ; / the return IN A,(F4h) PUSH AF ; Keep bank status for later OR 3 ; Make sure to set chunks 0 & 1 OUT (F4h),A ; Enable chunks

— If needed, the change side — — select routine goes here —

CALL 3542h ; Switch drive A ON LD BC,01 ; Load B = track, C = sector LD HL,5A00h ; Load HL = buffer address CALL 3556h ; Read 1 sector CALL 3582h ; Turn drive A OFF POP AF OUT (F4h),A ; Set things back to normal POP HL ; POP BC ; > Get stuff back POP AF ; / for RET RET “`

To use the above routine to write instead of read, change the “CALL 3556h” to “CALL 3568h”. The parameters should, of course, be set up exactly the same way. To use a different drive, change the “CALL 3542h” above to “CALL 3547h” for drive B, 354Ch for drive C, or 3551h for drive D.

The above routine works well for a single-sided drive, but what about side 2 (side 1, according to the AERCO I/F itself)? A little bit must be added to the above routine to account for changing sides.

This is the change side select routine:

“` LD A,1 ; LD A with ; side select ; 0 for side 1, ; 1 for side 2 LD (3FEBh),A ; Set it up “`

When this routine is executed, chunk 1 MUST be enabled, as otherwise you will be trying to write to ROM. 3FEBh translates into 16363 decimal, and you may wish to PUSH AF in the above routine and then reload the side select before you RETurn to BASIC.

In using the routines, I have found it the easiest to POKE the parameters into the machine code routines, and then RANDOMIZE the above routines.

Enjoy, and keep Timex-ing!