(C) KM SoftWare, 1997
EFFICIENT DRIVE
For some time TR-DOS already
anyone not satisfied: the slow,
full of glitches, miserable for all
parameters of the system ... Therefore,
all (or nearly all) of the new programs use direct appeal to
the VG93. I will not tell you how to do it (especially since
such information is already very many), but rather to give you
some useful programs.
But first, an example of the TR-DOS with full error trapping
(for some reason had REVIEW wrote about it ...) The program
consists of two parts: first - the driver itself, the second -
a program to handle errors.
NOTE: All addresses in the programs focus on TR-DOS
5.03/5.04t!!!
140.
ORG 25000
; Input: C-code operation (5 / 6)
; HL, DE, B-parameters
; Output: (23823), A, BC-error code
; Interrupt enabled
DRIVER DI
EXX
LD A, # C3
LD (# 5CC2), A
LD HL, ERROR
LD (# 5CC3), HL; now at
; # 5cc2: JP ERROR
LD DE, (23798)
LD D, 0
LD HL, 23802
ADD HL, DE
LD (HL), 8; fast speed
, Moving the head
140.
LD HL, 23752
ADD HL, DE
LD (HL), 131; drive type
LD (23836), SP
LD (STK +2), SP; saved SP
EXX
CALL 15635; in TR-DOS
STK DI; out of the driver
LD SP, 0
LD BC, (23,823)
LD B, 0; BC, A-code error
LD A, C
EI
RET; output
PDE DW 0
PHL DW 0
; Program error trapping TR-DOS
ERROR LD (PDE), DE
LD (PHL), HL
LD E, A
LD A, (23823)
AND A
JP NZ, NODSK; no disc
LD A, E
POP DE
LD HL, 8020
AND A
SBC HL, DE
JR Z, PRBREAK; check BREAK
LD HL, # 028E
AND A
SBC HL, DE
JR Z, OPRKEY; polled klava
LD HL, 16
AND A
SBC HL, DE
JR Z, PRRST16; something printed
TODOS LD DE, (PDE)
LD HL, (PHL)
RET; return to the TR-DOS
PRBREAK CALL 8020; program survey
; "BREAK". Output:
; Scf-not pressed
JP C, TODOS
LD A, 12
ERR LD (23823), A
JP STK
NODSK LD A, 6
JR ERR
BYTE DB 0, in the case of DISK ERROR
; It "D", READ ONLY
;-It "R"
FLAG DB 0, if <> 0, it has already been
, Error
; Checker error
; The call 15635 to C = 5 / 6 can be printed
; Only "DISK ERROR" or "READ ONLY" (we
; Already intercepted the "NO DISK". Define
; Error by byte you type: "D" - DISK
; ERROR, "R" - READ ONLY.
PRRST16 LD A, (FLAG)
AND A
JP NZ, TODOS
CP "D"
JR Z, DISKERR
CP "R"
JR Z, READONL
JP TODOS
DISKERR LD (BYTE), A
DERR LD A, 255
LD (FLAG), A
JP TODOS
READONL LD (BYTE), A
JR DERR
; PROGRAM POLL KEYBOARD
; Request occurs after the print messages
; DISK ERROR, READ ONLY (RETRY, ABORT, IGNORE)
And we already know what a mistake (from BYTE),
, So print a message and query
; Keyboard. Address of the program and press
; Survey is taken from a variable (ADRES).
; You can change it (at the output of A must
; Be the code: R-RETRY, A-ABORT, I-IGNORE.
OPRKEY LD HL, (ADRES)
LD DE, CONT
PUSH DE
JP (HL)
CONT CP "A"; answer "ABORT"?
JR Z, ABORT; if so, then the transition
POP DE
POP DE; restore stack
LD HL, 4199, and the address in ROM TR-DOS
PUSH HL
JP 15663
ABORT LD A, 7; error code
JR DERR
ADRES DW 0
2
As you can see, the program is a huge length: much more code
LOADER'ov slower they work, etc. So much more convenient to use
your driver, who could write / read from disk.
TURBO LOADER
But this remake of loader'a
ZX-REVIEW, 6 / 96. The program now
not only accelerated, but may
intercept all disk errors,
that is important in system software ...
140.
; Login: DE-trek/sektor
; HL-memory address
; B-number of sectors
In cell (BYTE +1) Record the number of repetitions needed for a
disk error (1-255). In cell (DRIVE) to Record Number
drive to work (0-3).
ORG 32768
LOADER DI
LD A, D
AND A
RRA
LD C, # 7F; desired track
CALL DOS
DW # 2A53
BYTE LD A, 3 units for repeat
LD (RETRY +1), A
XOR A
LD (BYTE1 +1), A
LD (ERR), A; no error
LD A, # 18, code "positioning"
M3 CALL DOS
DW # 2FC3; issued to SH
CALL DOS
DW # 3EF5; waiting for the command
LD A, (DRIVE)
OR # 3C; side 0
BIT 0, D
JR Z, MM1
M2 LD A, (DRIVE)
OR # 2C; side 1
MM1 CALL DOS
DW # 1FF3; enters the port # FF
M1 CALL 8020; opr.BREAK can remove
JR NC, M7
PUSH HL
PUSH BC
LD A, (# 5CD6)
PUSH AF
LD C, # 5F
LD A, E
INC A
CALL DOS; record in the port sector
DW # 2A53
LD BC, M5; address continuing
PUSH BC
LD BC, 7; address byte 1
PUSH BC
LD BC, # 2090; address bend TR-DOS
PUSH BC
LD BC, # 017F; port address. B = 1
JP 15663, the entrance to the TR-DOS
M5 DI; continued
LD HL, # 5CD6
POP AF
CP (HL); was a mistake?
JR Z, NORMA; if there was ...
LD (HL), A; restored address
BYTE1 LD A, 0; mistake was, we learn,
RETRY CP 0; published a number of repeats
JR Z, ERROR; rov.Esli came out, the transition
INC A; not work, increase
LD (BYTE1 +1), A; counter
NORMA POP BC; normal extension
POP HL; restore HL, BC
NORMA1 INC H; new address in memory
DEC B; all sectors considered?
JR Z, M6; if so, output
INC E; new sector
BIT 4, E; if <16, then go to
JR Z, M1; reading sector
LD E, 0; new track
INC D
BIT 0, D; if the side 1, then the conditions
JR NZ, M2; SETTING and reading
LD A, # 58; Code "step forward"
JR M3; in the cycle
M6 INC E; Prog exit.
BIT 4, E; We correct
JR Z, $ +5; sector / track.
LD E, 0
INC D
M7 EI; output
RET
ERROR PUSH DE; prog error handling
LD (# 5CD8), A
CALL DOS
DW # 2740; read port # 1F
LD A, (# 5CCD)
BIT 7, A; not cool?
JR NZ, NDSK; means no disc
DISKERR LD HL, (ADRES)
LD DE, CONT; call prog poll
PUSH DE; keypad (should
JP (HL); return to A code
; R-RETRY, A-ABORT
; I-IGNORE
CONT POP DE; recuperated registers
POP BC
POP HL
AND 223; capital letters
CP "A"
JR Z, ERR7; if ABORT, then the output
CP "I"; if IGNORE, then read
JR Z, LOADER; again ...
LD A, D; if RETRY, then re-
LD C, # 7F; overclock drive
SRL A
CALL DOS
DW # 2A53
LD A, # 18
CALL DOS
DW # 2FC3
XOR A; zero the counter
LD (BYTE1 +1), A
JR NORMA1; transition into the program
NDSK LD A, 6; error NO DRIVE
ER LD (ERR), A
EI
RET
ERR7 LD A, 7; error DISK ERROR
JR ER
ERR DB 0; error code
2
Oh and one more thing. Before calling
LOADER'a advisable to check
the presence of disk in the drive (as
written in the first program)
otherwise, firstly, there is a likelihood of freezing of the
program (up to insert the disk), and secondly, instead of an
error code 6 (NO DISK) will be given an error 7 (DISK ERROR),
as the situation arises from a mistake SH "sector not found"
with the included four beats in # 1F. The recommended number of
repetitions = 2-5, since not much well as the drive or
CD LOADER reads a sector not
the first time ...
TURBO SAVER
Listing not cite, it is similar TURBO LOADER'u except
program marks M1 to tags M5. Here's how it will look like:
140.
M1 CALL 8020
JR NC, M7
PUSH HL
PUSH BC
LD A, (# 5CD6)
PUSH AF
LD C, # 5F *
LD A, E
INC A
CALL DOS
DW # 2A53
LD BC, # 015F
PUSH BC
LD BC, # 2099
PUSH BC
LD BC, # 3FCA
PUSH BC
LD A, # A0
LD C, # 1F
CALL DOS
DW # 2A53
LD BC, # 017F
JP 15663
2
Fields marked line with
where change begins. AND
still need to tweak the program
ERROR, since even now can
included bits 6 and 5, port # 1F
- Protection of records and write error.
After the first positioning
desirable to take a break (as
PAUSE program in FREE FORMATTER'e).
TURBO DOS
Example of using TURBO
LOADER / SAVER. The program simulates the operation of several
functions TR-DOS'a, but makes it a lot
faster. The program has
in mind that LOADER / SAVER after
work shows the next track / sector in DE and (23,796).
Input: a label DOS.
number of functions in C:
0 - recovery;
1 - Select the drive from A;
2 - Transfer the file name to clipboard
of HL;
3 - Transfer the file name of the Buffet
RA in HL;
4 - Search the file name (the name of a bu
Fere);
5 - read the file (the name of the buffer)
if A = 0, the load address pregnancy
tsya from the catalog; A <> 0 - hell
res taken from HL;
6 - file record length of DE to hell
Rees HL;
7 - read the file name with the number
from A;
8 - write the file name with the number
from A.
(For functions 3,4,5,6,7,8 name
file should be in the buffer).
140.
; Input in DOS. Function in C.
DOS EI
LD (STK), SP; save registers
LD (PHL), HL
LD (PDE), DE
LD (PA), A
LD A, C
CP 9; feature number
RET NC; exceeded?
LD B, 0
LD HL, TABLE; address table
ADD A, A; multiplied by 2
LD C, A
ADD HL, BC
LD E, (HL)
INC HL
LD D, (HL)
PUSH DE; address the transition to
LD HL, (PHL); stack
LD DE, (PDE); restore
LD A, (PA); registers
DI; ban interrupt
RET; transition
; Transition table for DOS
TABLE DW WOST; recovery
DW SELDRV; change drive
DW RNAME; (HL) in a buffer named
DW SNAME; buffer name (HL)
DW FOUNDER; file search
DW READFIL; read the file
DW SAVEFIL; file entry
DW RNAME1; reading the file name
DW SNAME1; record filename
; Program exit DOS'a
EXIT DI
LD SP, (STK); restored stack
LD BC, (23823) error code
LD B, 0; BC
LD A, C; and A
EI; allowed to interrupt
RET; output
; Installation errors DISK ERROR
ERR7 LD A, 7
ERR LD (23823), A
JP EXIT
; Installation error NO DISK
ERR6 LD A, 6
JR ERR
; Transfer of the file name of HL in the buffer named
RNAME LD DE, NAME
LD BC, 16
LDIR
JP EXIT
; Opposite RNAME
SNAME LD DE, NAME
LD BC, 16
EX DE, HL
LDIR
JP EXIT
; Search for a file named. If the file does not exist, then
, In (23823) is 1 if there is, in 23838
, Will be his number in the 23,823 will be 0 in the buffer
; Name will be his full name.
FNDFILE LD B, 8, 8 sectors Catalog
LD DE, 0, track 0 sector 0
XOR A; file number 0
LD (23838), A
F1 PUSH BC; cycle by Sector
PUSH DE
LD HL, BUFER; reading sector
140. CALL LOADER
LD B, 16, 16, of file names
LD HL, BUFER; buffer address
F2 LD A, (HL); if the end
AND A; directory (byte 0)
JR Z, NOFND
PUSH BC; cycle by name
PUSH HL
CALL CPNAME; comparison name
POP HL
POP BC
JR C, FOUND; if found
LD DE, 16; increased address
ADD HL, DE; name
LD A, (23838) increased the number
INC A; file
LD (23838), A
DJNZ F2; in a cycle of names
POP DE
POP BC
INC E; increased the number
DJNZ F1; sector
NOFOUND LD A, 1 File not found
CODERR LD (23823), A; installation errors
RET
NOFND POP DE; file not found
POP BC
JR NOFOUND
FOUND LD DE, NAME; file found
LD BC, 16; name in the buffer name
LDIR
POP DE
POP BC
XOR A; no error
JR CODERR
; Program compares 9 symbols HL with DE
And if they are equal, then the SCF, if no-AND A
CPNAME LD B, 9
CP1 LD A, (DE)
CP (HL)
JR NZ, NCP
INC HL
INC DE
DJNZ CP1
YCP SCF
RET
NCP AND A
RET
And the function "search file"
FOUNDER CALL FNDFILE
JP EXIT
And the function "recovery"
WOST XOR A
CALL POSIT
JP EXIT
; Function "drive select"
SELDRV LD (23798), A
OR 60
CALL TOFF
JP WOST
; Positioning on a logical track from A
; Processed NO DISK.
POSIT PUSH AF; keep track
CALL NODISK; prog in F. FORMATTER 'e
JP C, ERR6; if there is no disc.
LD A,% 11000000; reading addresses
CALL TO1F
LD HL, BUFER; read the address of any
LD DE, 0; sector to test
LD C, # 7F; for TR-DOS
LD IX, 16357
CALL DOS
LD A, (BUFER +1); track 0?
AND A
JP NZ, ERR7
LD A, (BUFER +3); sector> 15?
CP 1916
JP NC, ERR7
LD A, (BUFER +4); length <> 256?
CP 1
JP NZ, ERR7
POP AF
PUSH AF
SRL A; divide the track / 2
CALL TO7F; in the data register
XOR A; head on 0 track
CALL TO3F; to the port track
LD A,% 00011000, "positioning"
CALL TO1F
LD IX, # 3EF5; waiting for execution
CALL DOS
POP AF; remembered track
RRA; bit 0 of flag C
LD A, (23798)
JR C, SIDE1; if side 1
SIDE0 OR # 3C; side 0
SIDE LD (23830), A; choice of
CALL TOFF; a system port
RET
SIDE1 OR # 2C; side 1
JR SIDE; choice
; Buffer for directory operations
BUFER DS 256
; Buffer file name
NAME DS 8; the name of 8 characters
TYPE DB 0; extension
START DW 0; address start
LENGHT DW 0; length in bytes
SEC DB 0; length in sectors
SECTOR DB 0; first sector
TRACK DB 0; first track
; System variables
PHL DW 0
PDE DW 0
PBC DW 0
PAF DW 0
PA DB 0
STK DW 0
; Login program TR-DOS
TOFF LD C, # FF; a system port
JR TOWG
TO3F LD C, # 3F; the port track
JR TOWG
TO7F LD C, # 7F; in data port
JR TOWG
TO1F LD C, # 1F; the port command
TOWG LD IX, # 2A53; entry into the port of C
DOS PUSH IX; call anywhere in the DOS
DI
JP 15663
; Reading program file name number A
RNAME1 LD C, A; design is needed to
XOR A; use of this
LD (RN), A; prog program
LD A, C; SNAME1
RNAME2 PUSH AF
RRA
RRA
RRA
RRA
AND% 00001111; sector number
LD E, A
LD D, 0
LD HL, BUFER
LD B, 1
LD (PDE), DE; remembered sector
; Directory
CALL LOADER; read Sector
LD A, (23823)
AND A
JP NZ, EXIT
POP AF
AND% 00001111; Item Number
LD HL, BUFER
LD DE, 16
LD B, A
AND A
JR Z, RN; calculation of the position
RN1 ADD HL, DE
DJNZ RN1
RN DB 0; if there RNAME 0
And if the call SNAME, then the
; # C9 (201) = RET
LD DE, NAME
LD BC, 16
LDIR; transfer the name to
JP EXIT; buffer and output
; Name record file number of the A
SNAME1 PUSH AF
LD A, # C9; install code
LD (RN), A; return
POP AF
CALL RNAME2; read sector.
LD DE, NAME; the name of the buffer
LD BC, 16; directory.
EX DE, HL
LDIR
LD DE, (PDE); remembered sector
LD HL, BUFER; Directory
LD B, 1
CALL SAVER; record sector
JP EXIT; directory and exit
; Program reading the file. The file name should
; Be in the buffer name.
READFIL LD (PHL), HL; saved address
AND A; taken from the catalog?
JR NZ, RF1; if not, the transition
LD HL, (START); taken from the catalog
LD (PHL), HL
RF1 XOR A; check TR-DOS and
CALL POSIT; NO DISK.
CALL FNDFILE; file search
LD A, (23823), we take the error code
AND A
JP NZ, EXIT; file not found
LD DE, (SECTOR)
LD A, (SEC)
LD B, A
LD HL, (PHL)
CALL LOADER; read the file
JP EXIT
; Program file record. File name bu; Fere name, address in HL,
the length of DE.
SAVEFIL LD (PHL), HL
LD (PDE), DE
XOR A
CALL POSIT; check
LD DE, 8
LD B, 1
LD HL, BUFER
CALL LOADER; reading log.sektora
LD A, (BUFER +228)
CP 127; file 128?
JP Z, EXIT; if so, output
LD C, A
LD A, (PDE +1); sectors in the file
LD E, A
LD A, (PDE)
AND A
JR Z, PRR; if the length does not
INC E; multiple of 256.
PRR LD A, E
LD (SCC +1), A; remember the size of
LD A, C
LD D, 0, length in sectors
LD HL, (BUFER +229)
AND A; there is a place on the disk?
SBC HL, DE
JP C, EXIT; if not, output
LD HL, (BUFER +225)
LD (PAF), HL; remember a track / sec.
INC A
PUSH AF; in A-position 1
RRA; empty space at the
RRA; directory
RRA
RRA
AND% 00001111
LD E, A; got room
LD D, 0; sector. Track 0
LD (PBC), DE; remember
LD HL, BUFER
CALL LOADER; read from the directory
POP AF
AND% 00001111; Item Number
LD HL, BUFER
LD DE, 16; search positions
LD B, A
AND A
JR Z, PR1; if position = 0
PR ADD HL, DE
DJNZ PR
PR1 PUSH HL; position found
SCC LD A, 0
LD (SEC), A; volume file
LD HL, (PDE); length of the file
LD (LENGHT), HL
LD HL, (PHL); start file
LD (START), HL
LD DE, (PAF); address of the file on disk
LD (SECTOR), DE
LD B, A
CALL SAVER; file entry
LD (PDE), DE; first track / sector
POP DE
LD A, (23823)
AND A
JP NZ, EXIT; if a write error
LD HL, NAME
LD BC, 16
LDIR; name in the directory
LD DE, (PBC); remember the address
LD HL, BUFER; Sector Directory
LD B, 1
CALL SAVER; directory entry
LD A, (23823)
AND A
JP NZ, EXIT; if the error
LD HL, BUFER; read log.sektor
LD DE, 8
LD B, 1
CALL LOADER
LD HL, (PDE); new first track /
LD (BUFER +225), HL; / Sector
LD HL, (BUFER +229)
LD DE, (SEC)
LD D, 0
AND A
SBC HL, DE; new count of freedoms
LD (BUFER +229), HL; different sectors
LD HL, BUFER +228
INC (HL); a new count of files
LD HL, BUFER
LD DE, 8
LD B, 1
CALL SAVER; record log. Sector
JP EXIT; output
2
FREE FORMATTER
If you make a cool toy, but still large, and
expect to get a good
profit from this case, the drive
It is desirable to cool to protect.
For this purpose discs
startup and non-standard
formats. The first topic I will miss there, and so everything
is clear, so that we will talk about non-standard
diskettes.
To obtain these disks
You can use programs such as
FREE FORMAT, but it's inconvenient, but
if you do a distribution copyist, then just do not.
The above program is FREE here
FORMATTER small in size, is called from native code and formats
tracks with sectors of the system of any complexity (although
everywhere there are limitations: do not exceed the physical
size of the track (7000 bytes) else: VG93 not
can format sector
numbers # F5-# F7. Incidentally, this
program is another plus: it does not
forms something called
"Index field 'so that the IBM
the drive is not read.
140.
ORG 32768
; Entrance into the program format
; A-number drive (0 ... 3)
; D-track, that starts the format
; E-number of formatted tracks
; Hl-address table
FORMAT DI
LD (DRIVE), A
PUSH DE
PUSH HL
OR 60
CALL TOFF; drive select
CALL NODISK; check availability
DI; drive
POP HL
POP DE
RET C; if the disc is not
XOR A
CALL TO3F; current track
LD A, D
LD (TRACK), A
LD (TBLADR), HL
LD (TABLADR), HL
LD A, (TRACK)
CALL POSIT; positioned
LD A, E
LD B, A
LOOP1 PUSH BC
CALL FILLTRK; shaped track
LD A, (SIDE)
AND A
JR Z, NOPOSIT
LD A, (TRACK); positioned and
CALL POSIT; hyped drive
NOPOSIT CALL PAUSE; pause
LD A, # F4
CALL TO1F; formatting
LD IX, # 3FBA
LD DE, 0
LD C, # 7F
LD HL, 49152
CALL DOS; track recording
POP BC
DEC B
RET Z; end format
INC B
PUSH BC
LD HL, (TBLADR); restored
LD (TABLADR), HL; address table
LD HL, TRACK; increased the number
INC (HL); track
POP BC
DJNZ LOOP1; cycle
RET
; Pause between the positioning and format;
rovaniem.Uspokaivayutsya drive heads
PAUSE LD B, 255
PAUS2 LD C, 255
PAUS1 DEC C
JR NZ, PAUS1
DJNZ PAUS2
RET
; Positioning on the track of a
POSIT PUSH DE
PUSH HL
PUSH AF
SRL A
CALL TO7F
LD A,% 00011000; positioning
CALL TO1F
LD IX, # 3EF5; awaiting execution
CALL DOS
DI
POP AF
POP HL
POP DE
RRA
JR C, SIDE1
SIDE0 LD A, (DRIVE); setting of 0
OR # 3C
CALL TOFF
XOR A
LD (SIDE), A
RET
SIDE1 LD A, (DRIVE); installation of a
OR # 2C
CALL TOFF
LD A, 1
LD (SIDE), A
RET
140.
; To check if the disc in the drive
, Output: SCF - no disk, AND A - is
NODISK LD A, # C3
LD (# 5CC2), A; specify the address
LD HL, DERR; program to intercept
LD (# 5CC3), HL; error
LD IX, 15789
CALL DOS; check
AND A; disc is
RET
DRIVE DB 0
STK DW 0
DERR POP DE
LD HL, 8020
AND A
SBC HL, DE
JR Z, PRBREAK; poll BREAK
ERR DI; oshibka.Net drive
LD SP, (STK)
SCF
RET
PRBREAK CALL 8020
JR NC, ERR; if BREAK pressed
RET
; Login program TR-DOS
TO7F LD C, # 7F
JR TOWG
TO3F LD C, # 3F
JR TOWG
TO5F LD C, # 5F
JR TOWG
TOFF LD C, # fF
JR TOWG
TO1F LD C, # 1F
TOWG LD IX, # 2A53
DOS LD (STK), SP
PUSH IX
JP 15663
; Program memory is full byte of D
FILL LD B, 1
FILL1 LD (IX +0), D
INC IX
DJNZ FILL1
RET
; System variables
TRACK DB 0; logical track number
SECTOR DB 0; physical sector number
SIDE DB 0; side of the disc
TABLADR DW 0; address in the table
TBLADR DW 0; address of the table
, Filling the single track
; TBLADR, TRACK, SIDE-installed
FILLTRK LD HL, (TBLADR)
LD IX, 49152, and the address data
LOOP LD A, (HL)
AND A
JR Z, DOP; shaped track
LD (SECTOR), A
PUSH HL
CALL FILLSEC; filled sector
POP HL
INC HL; increase the address in
INC HL; table
LD (TABLADR), HL
JR LOOP
DOP PUSH IX; track is formed,
POP DE; but if the sector
LD HL, 49152 8000; little, then you need
AND A; fill the remainder
SBC HL, DE; memory space.
RET C; Track formed
LD B, H
LD C, L; fill the remainder
LD H, D; track byte # 4E
LD L, E
INC DE
LD (HL), # 4E
LDIR
RET
, Filling the one sector
; IX-current address in the path
; TRACK, SECTOR, SIDE installed
; Program similar to the TR-DOS, but
, She immediately puts the data into the port VG93, and
, This forms the data into memory
FILLSEC LD B, 10
LD D, 78
CALL FILL1
LD B, 12
LD D, 0
CALL FILL1
LD B, 3
LD D, 245
CALL FILL1
LD D, 254
CALL FILL
LD A, (TRACK)
SRL A
LD D, A
CALL FILL; track
LD A, (SIDE)
LD D, A
CALL FILL; side
LD HL, (TABLADR)
LD A, (HL)
PUSH HL
LD D, A
CALL FILL; sector
POP HL
INC HL
LD A, (HL)
LD D, A
PUSH AF
CALL FILL; sector size
LD D, 247
CALL FILL
LD B, 22
LD D, 0
CALL FILL1
LD B, 3
LD D, 245
CALL FILL1
LD D, 251
CALL FILL
POP AF; buffers
AND A; depending
JR Z, RAZ128; the size of the
CP 2; sector
JR Z, RAZ512
CP 3
JR Z, RAZ1024
CONT1 LD B, 0
LD D, 0
CALL FILL1
CONT LD D, 247
CALL FILL
LD B, 50
LD D, 78
CALL FILL1
RET
RAZ128 LD B, 128
LD D, 0
CALL FILL1
JR CONT
RAZ1024 LD B, 0
LD D, 0
CALL FILL1
LD B, 0
LD D, 0
CALL FILL1
RAZ512 LD B, 0
LD D, 0
CALL FILL1
JR CONT1