Machine Code Track Reader

In order to write more advanced programs for the Zebra FDD disk drive system, we need to know more about it’s operating system. To write disk utilities we need to be able to see exactly what is on disk without a basic program using basic TOS (Timex Operating System) commands as intermediary. Since TOS is stored on the first four tracks of the disk and downloaded to controller RAM, we need disk reading and writing utilities to make any desired changes to TOS, or to develop utilities such as a program which would recover disk data after accidental erasure.

The following machine code program will read all the sectors of any given track on the disk and store the 4K bytes of disk track data in Home RAM at 7000 hex for access by a monitor disassembler machine code program. The track reader code resides at E000 to E050 hex. I have used both Zeus Monitor and HOT-Z AROS with it. In fact, I have used HOT-Z AROS in all 3 banks: home, dock, and exrom with 32K non-volatile memory board in the dock cartridge slot with this track reader program. The code can be readily modified to be used at some other location if you are using some other disassembler.

Zebra FDD 3000 disk drive
Zebra FDD 3000 disk drive
E000 00                       Storage space for drive #
E001 00                       Storage space for track #
E002 210070     LD HL, 7000   Beginning of home ram
                              storage for disk track
                              contents
E005 3A01E0     LD A,(E001)
E008 57         LD D,A        D contains track #
E009 3A00E0     LD A,(E000)
E00C 4F         LD C,A        C contains drive unit #
E00D FDE5       PUSH IY       Page in ZEBRA interface
E00F FD210000   LD IY,0000        rom/ram
E013 CD0800     CALL 0008
E016 FDE1       POP IY
E018 1E00       LD E,00       E will hold sector #
E01A 3E1B       LD A,1B       Disk command to read sector
                              contained in E of track in
                              D of drive in C
E01C 320021     LD (2100),A   Command buffer
E01F C5         PUSH BC       Save request parameters
E020 D5         PUSH DE
E021 E5         PUSH HL       Save current home ram
                              download address
E022 CD0806     CALL 0608     Calls command sending
                              routine
E025 CD2606     CALL 0626     This routine controls for
                              reply from disk
E028 3A0221     LD A,(2102)   This system variable holds
                              TOS error code
E02B A7         AND A         Test for error.
E02C 0600       LD B,00       If an error occurred return
E02E 4F         LD C,A            to basic with error
E02F 201C       JR NZ,E04D        reason in BC
E031 E1         POP HL        Restore home ram address and
E032 110020     LD DE,2000        download from ZEBRA ram
E035 EB         EX DE,HL          buffer to home
E036 010001     LD BC,0100
E039 EDB0       LDIR
E03B EB         EX DE,HL
E03C D1         POP DE        Restore sector/track
                              parameter
E03D 7B         LD A,E        Pick up next data sector of
E03E C607       ADD A,07          track
E040 E60F       AND 0F
E042 5F         LD E,A
E043 C1         POP BC        Restore drive parameter
E044 20D4       JR NZ,E01A    If all 16 sectors not read
                              then loop back for next one
E046 010000     LD BC,0000    If all 16 read set error
                              report code to 0
E049 CD0306     CALL 0603     Page out ZEBRA rom/ram
E04C C9         RET           Return to basic to call up
                              either monitor or error
                              message
E04D E1         POP HL        Clear stack and return to
E04E E1         POP HL        basic
E04F E1         POP HL
E050 18F7       JR E049

Relative addressing is used as much as possible within the machine code. The only absolute address calls are to a jump table in Zebra ROM, as described in Appendix F of the user manual, so all versions of the FDD should run this code. The only lines that need to be changed to relocate this code for use with another monitor/disassembler are lines 3, 4, and 6. You will need to change the absolute addresses used in those lines to match your memory layout.

A basic program is used to load the code from disk, poke the track and driver parameters, load your favorite monitor, run the code, and enter the monitor program to view the disk data. In the basic program you must replace lines 30 to 38 and 140 to 148 with your own monitor/disassembler loads and calls. I use one of the following depending on my system configuration.

ZEUS monitor:
          30 LOAD * "ZEUSMON.COD"CODE
         140 IF BC=0 THEN PRINT USR 62137
HOT-Z AROS:
Home:     30 LOAD * "HOT-Z2,5.COD"CODE
         140 IF BC=0 THEN RAND USR 32776

Dock:    140 IF BC=0 THEN OUT 255,0: OUT 244,
             240: RAND USR 32776

Exrom:   140 IF BC=0 THEN OUT 255,128: OUT 24
             4,240: RAND USR 32776

Mostly I keep HOT-Z in Exrom. There are several “bugs” in the FDD’s initiation routines when dock bank cartridges are present. I avoid these conflicts by keeping HOT-Z AROS in exrom from 8000 to DFFF hex.

Once you enter the monitor you shouldn’t need to return to basic. Parameters at E000 and E001 hex can be poked using utilities in the monitor program and both ZEUS and HOT-Z have code execution routines. For ZEUS, I use the DISASSEMBLE command to read code and the EDIT command to read data. The EDIT command is also used to change parameter values at E000 and E001. I use the GOTO command to rerun the code at E002. For HOT-Z, the normal read mode can disassemble code and the display switch (SS-G) will read data. I can enter the edit mode (SS-A) to input new parameter values and use the run command (CSS-RUN) to rerun the track reader code. HOT-Z has an advantage over ZEUS for reading files containing basic programs. ZEUS won’t display the characters corresponding to codes over 127.

   1 REM ZEBRA Disk Drive
Track Reader Utility
by Mike Finn
2 REM This utility requires a
monitor/disassembler
machine code program
3 REM Program allows for
monitor code to occupy
addresses from 8000
to DFFF Hex or from
E051 to FF57 hex
4 REM E000 to E050 is reserv-
ed for track reader m/c
5 REM 7000 to 7FFF is reserv-
ed for disk data
10 CLEAR 28671
20 LOAD *"TRACKRDR.COD"CODE
30 REM ***********************
32 REM
34 REM Replace this REM with
a LOAD * instruction to
load your favorite mon-
itor disassembler from
Disk
36 REM
38 REM ***********************
40 PRINT 'TAB 5;"DISK REVIEWING UTILITY"
50 INPUT "Source Drive (A TO D) ";D$
60 LET D=CODE D$
70 IF D>=97 AND D<=100 THEN LET D=D-32
80 LET D=D-65: IF D<0 OR D>3 THEN GO TO 50
90 POKE 57344,D
100 INPUT "Track (0 to 39) ";T
110 IF T<0 OR T>39 THEN GO TO 100
120 POKE 57345,T
130 LET BC=USR 57346
140 REM ***********************
142 REM
144 REM Replace this REM with
IF BC=0 THEN RAND USR
( monitor address )
146 REM
148 REM ***********************
150 PRINT "ERROR ";BC;"! Please see user manual."

For those whose monitors do not include an assembler, the following loader may be used to enter the code.

10 REM Machine code loader
15 RESTORE
20 FOR I= 57344 TO 57425
25 READ A: POKE I,A: NEXT I
30 DATA 000,000,033,000,112,058,001,224,087,058,000,224,079
35 DATA 253,229,253,033,000,000,205,008,000,253,225,030,000
40 DATA 062,027,050,000,033,197,213,229,205,008,006,205,038
45 DATA 006,058,002,033,167,006,000,079,032,028,225,017,000
50 DATA 032,235,001,000,001,237,176,235,209,123,198,007,230
55 DATA 015,095,193,032,212,001,000,000,205,003,006,201,225
60 DATA 225,225,024,247

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.