BIOS Cassette Logic
Software Algorithms
Interrupt
15
The cassette routine will be called with the request type
in
AH
and
~
the address
of
the bytes to be read or written will be specified by
(ES):(BX) and the number of bytes to read/write will be specified by
(CX). The actual number of bytes read will be returned in (DX).
Read block and write block will automatically tum the motor on at the
start and off at the end. The requests are
as
follows:
(AH) = 0
Tum
the cassette motor on.
(AH) = 1
Tum
the cassette motor
off.
(AH) = 2 (Read Block ) Read
(CX)
bytes into
memory beginning at address (ES):(BX)
and return actual number of bytes read in
(DX). Return the cassette status
in
(AH).
(AH) = 3 (Write Block) Write
(CX)
bytes onto the
cassette beginning at address (DS):(BX).
Return the cassette status in (AH).
STATUS:
AH=OO
No
errors
AH=Ol
CRC-Error (Read Block)
AH=02
No
data transitions
AH=04
No
leader
AH=80
Invalid command
Note: The carry flag will be set on any error.
Cassette Write
The
WRITE
BLOCK routine writes a tape block on the cassette. The
tape block
is
described in
Data
Record Architecture page (3-10).
The
WRITE
BLOCK routine turns on the cassette motor and a syn-
chronization bit (0) and then writes 256 bytes
of
all ones, the leader,
to the tape. Next, one or more data blocks are written (depends on
number
in
CX). After each data block
of
256 bytes, a two byte
CRC
is
written. The data bytes are taken from the memory location
pointed at by ES.
The
WRITE
BYTE routine disassembles the byte and writes it a
bit at a time to the cassette. The method used is to set
TIMER
2 to
the period of the desired data bit. The timer
is
set to a period of
1.0 millisecond for a one bit and 0.5 millisecond for a zero bit.
3-8