Вы находитесь на странице: 1из 472

INTERNALS

The authoritative insider's guide


By K. Gerits, L. Englisch, R. Bruckmann

A Data Becker Book


Published by

Abacus

Software

Third Printing, July 1986


Printed in U.S.A.
Copyright 1985
Copyright 1985

Data Becker GmbH


Merowingerstr.30
4000 Dusseldorf, West Germany
Abacus Software, Inc.
P.O. Box 7219
Grand Rapids, MI 49510

This book is copyrighted. No part of this book may be reproduced, stored


in a retrieval system, or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording or otherwise without the
prior written permission of Abacus Software or Data Becker, GmbH.
Every effort has been made to insure complete and accurate information
concerning the material presented in this book. However Abacus Software
can neither guarantee nor be held legally responsible for any mistakes in
printing or faulty instructions contained in this book. The authors will
always appreciate receiving notice of subsequent mistakes.
ATARI, 520ST, ST, TOS, ST BASIC and ST LOGO are trademarks or
registered trademarks of Atari Corp.
GEM, GEM Draw and GEM Write are trademarks or registered trademarks
of Digital Research Inc.
IBM is a registered trademark of International Business Machines.
ISBN

0-916439-46-1

Table of Contents
1

The Integerated Circuits

1.1
1.1.1
1.1.2
1.1.3

The 68000 Processor


The 68000 Registers
Exceptions on the 68000
The 68000 Connections

3
4
7
7

1.2

The Custom Chips

13

1.3
1.3.1
1.3.2
1.3.3

The WD 1772 Floppy Disk Controller


1772 Pins
1772 Registers
Programming the FDC

20
20
24
25

1.4
1.4.1
1.4.2

The MFP 68901


68901 Connections
The MFP Registers

28
28
32

1.5
1.5.1
1.5.2

The 6850 ACIAs


The Pins of the 6850
The Registers of the 6850

41
41
44

1.6
1.6.1
1.6.2

The YM-2149 Sound Generator


Sound Chip Pins
The 2149 Registers and their Functions

48
50
52

1.7

I/O Register Layout of the ST

55

The Interfaces

65

2.1
2.1.1
2.1.2

The Keyboard
The mouse
Keyboard commands

2.2

The Video Connection

85

2.3

The Centronics Interface

88

2.4

The RS-232 Interface

90

2.5

The MIDI Connections

93

67
71
74

2.6

The Cartridge Slot

96

2.7

The Floppy Disk Interface

97

2.8

The DMA Interface

99

The ST Operating System

101

3.1
3.1.1

The GEMDOS
GEMDOS error codes and their meaning

104
139

3.2

The BIOS Functions of the Atari ST

140

3.3

The XBIOS

155

3.4
3.4.1
3.4.2

The Graphics
An overview of the "line-A" variables
Examples for using line-A opcodes

206
226
229

3.5
3.5.1

The Exception Vectors


The interrupt structure of theST

234
236

3.6

The STVT52 Emulator

242

3.7

The ST System Variables

247

3.8
3.8.1
3.8.2

The 68000 Instruction Set


Addressing modes
The instructions

255
256
260

3.9

The BIOS listing

268

4
4.1
4.2

Appendix - The System Fonts


The System Fonts
Alpahbetical listing of GEMDOS functions

443
445
447

11

List of Figures
1.1-1
1.2-1
1.2-2
1.2-3
1.2-4
1.3-1
1.4-1
1.5-1
1.6-1
1.6-2
2.1-1
2.1 -2
2.1.1-1
2.1.1-2
2.1.2-1
2.2-1
2.2-2
2.3-1
2.3-2
2.4-1
2.5-1
2.6-1
2.7-1
2.8-1
2.8-2
3.4-1
3.4-2
3.4-3

68000 Registers
GLUE
MMU
SHIFTER
DMA
FDC1772
MFP 68901
ACIA6850
Sound Chip YM-2149
Envelopes of the PSG
6850 Interface to 68000
Block Diagram of Keyboard Circuit
The Mouse
Mouse control port
Atari ST Key Assignments
Diagram of Video Interface
Monitor Connector
Printer Port Pins
Centronics Connection
RS-232 Connection
MIDI System Connection
The Cartridge Slot
Disk Connection
DMA Port
DMA Connections
Lo-Res-Mode
Medium-Res-Mode
Hi-Res-Mode

111

5
14
16
17
19
21
29
42
49
53
68
70
72
74
84
86
87
88
89
92
95
96
98
100
100
208
210
212

Chapter One
The Integrated Circuits

1.1
1.1.1
1.1.2
1.1.3
1.2
1.3
1.3.1
1.3.2
1.3.3
1.4
1.4.1
1.4.2
1.5
1.5.1
1.5.2
1.6
1.6.1
1.6.2
1.7

The 68000 Processor


The 68000 Registers
Exceptions on the 68000
The 68000 Connections
The Custom Chips
The WD 1772 Floppy Disk Controller
1772 Pins
1772 Registers
Programming the FDC
The MFP 68901
68901 Connections
The MFP Registers
The 6850 ACIAs
The Pins of the 6850
The Registers of the 6850
The YM-2149 Sound Generator
Sound Chip Pins
The 2149 Registers and their Functions
I/O Register Layout of the ST

Abacus Software

Atari ST Internals

The Integrated Circuits


1.1 The 68000 Processor
The 68000 microprocessor is the heart of the entire Atari ST system. This
16-bit chip is in a class by itself; programmers and hardware designers alike
find the chip very easy to handle. From its initial development by Motorola
in 1977 to its appearance on the market in 1979, the chip was to be a
competitor to the INTEL 8086/8088 (the processor used in the IBM-PC and
its many clones). Before the Atari ST's arrival on the marketplace, there
were no affordable 68000 machines available to the home user. Now,
though, with 16-bit computers becoming more affordable to the common
man, the 8-bit machines won't be around much longer.
What does the 68000 have that's so special? Here's a very incomplete list
of features:
16 data bits
24 address bits (16-megabyte address range!!)
all signals directly accessible without multiplexer
hassle-free operation of "old" 8-bit peripherals
powerful machine language commands
easy-to-learn assembler syntax
14 different types of addressing
17 registers each having 32-bit widths
These specifications (and many yet to be mentioned here) make the 68000
an incredibly good microprocessor for home and personal computers. In
fact, as the price of memory drops, you'll soon be seeing 68000-based 64K
machines for the same price as present-day 8-bit computers with the same
amount of memory.

Abacus Software

Atari ST Internals

1.1.1 The 68000 Registers


Let's take a look at 68000 design. Figure 1.1-1 shows the 17 onboard
32-bit registers, the program counter and the status register.
The eight data registers can store and perform calculations, as well as the
normal addressing tasks. Eight-bit systems use the accumulators for this,
which limits the programmer to a total of 8 accumulators. Our 68000 data
registers are quite flexible; data can be handled in 1-, 8-, 16- and 32- bit
sizes. Even four-bit operations are possible (within the limits of Binary
Coded Decimal counting). When working with 32-bit data, all 32 bits can
be handled with a single operation. With 8- and 16-bit data, only the 8th or
16th bit of the data register can be accessed.
The address registers aren't as flexible for data access as are the data
registers. These registers are for addressing, not calculation. Processing
data is possible only with word (16-bit) and longword (32-bit) operations.
The address registers must be looked at as two distinct groups, the most
versatile being the registers AO-A6. Registers A7 and A7' fulfill a special
need. These registers are used as the stack pointer by the processor. Two
stack pointers are needed to allow the 68000 to run in USER MODE and
SUPERVISOR MODE. Register A7 declares whether the system is in
USER or SUPERVISOR mode. Note that the two registers work "under"
A7, but the register contents are only available to the respective operating
mode. We'll discuss these operating modes later.
The program counter is also considered a 32-bit register. It is theoretically
possible to handle an address range of over 4 gigabytes. But the address
bits A24-A31 aren't used, which "limits" us to 16 megabytes.
The 68000 status register comprises 16 bits, of which only 10 bits are used.
This status register is divided into two halves: The lower eight bite (bits 0
to 4 proper) is the "user byte". These bits, which act as flags most of the
time, show the results of arithmetical and comparative operations, and can
be used for program branches hinging on those results. We'll look at the
user byte in more detail later; for now, here is a brief list:
BIT 0 = Carry flag
BIT 2 = Zero flag
BIT 4 - extend flag

BIT 1 = Overflow flag


BIT 3 = Negative flag

Abacus Software

Atari ST Internals

Figure 1.1-1
31

16 15

68000 Registers

8 7

D 0

D 1
D 2

DATA
REGISTERS

D 3
D 4
D 5
D 6
.

D7

31
A1
A 2
A 3

ADDRESS
REGISTERS

A 4
A 5
A6-

31
System
User

Stack

Stack

Pointer

Pointer

SSP

OSP

A7

STACK

POINTER

31 24 23

L15
I Sys

PC
8 7
Byte I User Byte I gj>

PROGRAM
COUNTER
STATUS
REGISTER

Abacus Software

Atari ST Internals

Bits 8-10, 13 and 15 make up the status register's system byte. The
remaining bits are unused. Bit 15 works as a trace bit, which lets you do a
software controlled single-step execution of any program. Bit 13 is the
supervisor bit. When this bit is set, the 68000 is in supervisor mode. This
is the normal operating mode; all commands are executed in this mode. In
user mode, in which programs normally run, privileged instructions are
inoperative. A special hardware design allows access into the other memory
range while in user mode (e.g., important system variables, I/O registers).
The system byte of the status register can only be manipulated in supervisor
mode; but there's a simple method of switching between modes.
Bits 8 and 10 show the interrupt mask, and run in connection with pins
EPLO-IPL2.
The 68000 has great potential for handling interrupts. Seven different
interrupt priorities exist, the highest being the "non-maskable interrupt";
NMI. This interrupt recognizes when all three EPL pins simultaneously read
low (0). If, however, all three IPL pins read high, there is no interrupt, and
the system operates normally. The other six priorities can be masked by
appropriate setting of the system byte of the status register. For example, if
bit 12 of the interrupt mask is set, while 10 and II are off, only levels 7, 6
and 5 (000, 001 and 010) are recognized. All other combinations from
BPLO-IPL2 are ignored by the processor.

Abacas Software

Atari ST Internals

1.1.2 Exceptions on the 68000


We've spoken of interrupts as if the 68000 behaves like other
microprocessors. Interrupts, according to Motorola nomenclature, are an
external form of an exception (the machine can interrupt what it's doing,
do something else, and return to the interrupted task if needed). The 68000
distinguishes between normal operation and exception handling, rather than
between user and supervisor mode. One such set of exceptions is the
interrupts. Other things which cause exceptions are undefined opcodes, and
word or longword access to a prohibited address.
To make exception handling quicker and easier, the 68000 reserves the first
IK of memory (1024 bytes, $000000-$0003FF). The exception table is
located here. Exceptions are all coded as one of four bytes of a longword.
Encountering an exception triggers the 68000, and the address of the
corresponding table entry is output
A special exception occurs on reset, which requires 8 bytes (two
longwords); the first longword contains the standard initial value of the
supervisor stack pointer, while the second longword contains the address of
the reset routine itself. See Chapter 3.3 for the design and layout of the
exception table.

1.1.3 The 68000 Connections


The connections on the 68000 are divided into eight groups (see Figure
1.1-3 on page 11).
The first group combines data and address busses. The data bus consists of
pins DO-D15, and the address bus A1-A23. Address bit AO is not available
to the 68000. Memory can be communicated with words rather than bytes
(1 word=2 bytes=16 bits, as opposed to 1 byte=8 bits). Also, the 68000
can access data located on odd addresses as well as even addresses. The
signals will be dealt with later.
It's important to remember in connection with this, that by word access to
memory, the byte of the odd address is treated as the low byte, and the even

Abacus Software

Atari ST Internals

address is the high byte. Word access shouldn't stray from even addresses.
That means that opcodes (whether all words or a single word) must always
be located at an even addresses.
When the data and address bus are in "tri-state" condition, a third condition
(in addition to high and low) exists, in which the pins offer high resistance,
and thus are inactive on the bus. This is important in connection with Direct
Memory Access (DMA).
The second group of connections comprise the signals for asynchronous
bus control. This group has five signals, which we'll now look at
individually:
1) R/W (READ/WRITE)
The R/W signal is a familiar one to all microprocessors. This
indicates to memory and peripherals whether the processor is writing
to or reading data from the address on the bus.
2) AS (ADDRESS STROBE)
Every processor has a signal which it sends along the data lines
signaling whether the address is ready to be used. On the 68000, this
is known as the ADDRESS STROBE (low active).

3) UDS (UPPER DATA STROBE)


4) LDS (LOWER DATA STROBE)
If the 68000 could only process an entire memory word (two bytes)
simultanesouly, this signal wouldn't be necessary. However, for
individual access to the low-byte and high-byte of a word, the
processor must be able to distinguish between the two bytes. This is
the task performed by UDS and LDS. When a word is accessed,
both strobes are activated simultaneously (active=low). Accessing
the data at an odd address activates the Lower Data Strobe only, while
accessing data atan even address activates the Upper Data Strobe.
Bit AO from the address bus is used in this case. After every access
when the system must distinguish between three conditions (word,
even byte, odd byte), AO determines how to complete the access.
LDS and UDS are tri-state outputs.
8

Abacus Software

Atari ST Internals

5) DTACK
The above signals (with the exception of UDS and LDS) are needed
by an 8-bit processor. DTACK takes a different path; DTACK must
be low for any write or read access to take place. If the signal is not
low within a bus cycle, the address and data lines "freeze up" until
DTACK turns low. This can also occur in a WATT loop. This way,
the processor can slow down memory and peripheral chips while
performing other tasks. If no wait cycles are used on the ST, the
processor moves "at full tilt".
The third group of connections, the signals VMA, VPA and E are for
synchronous bus control. A computer is more than memory and a
microprocessor; interfaces to keyboard, screen, printer, etc. must be
available for communication. In most cases, interfacing is handled by
special ICs, but the 68000 has a huge selection of interfaces chips onboard.
For hardware designers we'll take a little time explaining these synchronous
bus signals.
The signal E (also known as <&2 or phi 2) represents the reference count for
peripherals. Users of 6800 and 6502 machines know this signal as the
system counter. Whereas most peripheral chips have a maximum frequency
of only 1 or 2 mHz, the 68000 has a working speed of 8 mHz, which can
increased to 10 by the E signal. The frequency of E in the ST is 800 kHz.
The E output is always active; it is not capable of a TRI- STATE condition.
The signal VPA (Valid Peripheral Address) sends data over the
synchronous bus, and delegates this transfer to specific sections of the chip.
Without this signal, data transfer is performed by the asynchronous bus.
VPA also plays a role in generating interrupts, as we'll soon see.
VMA (Valid Memory Address) works in conjunction with the VPA to
produce the CHIP-select signal for the synchronous bus.
The fourth group of 68000 signals allows simple DMA operation in the
68000 system. DMA (Direct Memory Access) directly accesses the DMA
controllers, which control computer memory, and which is the fastest
method of data transfer within a computer system.
To execute the DMA, the processor must be in an inactive state. But for the
processor to be signaled, it must be in a "sleep" state; the low BR signal

Abacus Software

Atari ST Internals

(Bus Request) accomplishes this. On recognizing the BR signal, the


68000's read/write cycle ends, and the BG signal (Bus Grant) is activated.
Now the DMA-requested chip waits until the signals AS, DTACK and
(when possible) BGACK are rendered inactive. As soon as this occurs, the
BGACK (Bus Grant Acknowledge) is activated by the requested chip, and
takes over the bus. All essential signals on the processor are made high; in
particular, the data, address and control busses are no longer influenced by
the processor. The DMA controller can then place the desired address on
the bus, and read or write data. When the DMA chip is finished with its
task, the BGACK signal returns to its inactive state, and the processor again
takes over the bus.
The fifth group of signals on the 68000 control interrupt generation. The
68000's "user's choice" interrupt concept is one of its most extraordinary
performing qualities; you have 199 (!) interrupt vectors from which to
choose. These interrupt vectors are divided into 7 non-auto-vectors and 192
auto-vectors, plus 7 different priority lines.
Interrupts are triggered by signals from the three lines IPLO to IPL2; these
three lines give you eight possible combinations. The combination
determines the priority of the interrupt. That is, if IPLO, IPL1 and IPL2 are
all set high, then the lowest priority is set ("no interrupt"). However, if all
three lines are low, then highest priority takes over, to execute a
non-maskable interrupt All the combinations in between affect special bite
in the 68000's status register; these, in turn, affect program control,
regardless of whether or not a chosen interrupt is allowable.
Wait -- what are auto-vectors and non-auto-vectors? What do these terms
mean?
If requesting an interrupt on IPLO-IPL2 while VPA is active (low), the
desired code is directly converted from the IPL pins into a vector number.
All seven interrupt codes on the IPL pins have their own vectors, though.
The auto-vector concept automatically gives the vector number of the IPL
interrupt code needed.
When DTACK, instead of VPA, is active on an interrupt request, the
interrupt is handled as a non-auto-vector. In this case, the vector number
from the triggered chip is produced by DTACK on the 8 lowest bits of the
data bus. Usually (though not important here), the vector number is placed
into the user-vector range ($40~$FF).

10

Abacus Software

Atari ST Internals

The sixth set of connections are the three "function code" outputs FCO to
FC2. These lines handle the status display of the processor. With the help
of these lines, the 68000 can expand to four times 16 megabytes (64
megabytes). This extension requires the MMU (Memory Management
Unit). This MMU does more than handle memory expansion on the ST; it
also recognizes whether access is made to memory in user or supervisor
mode. This information is conveyed to a memory range only accessible in
supervisor mode. Also, the interrupt verification uses this information on
the FC line. The figure below shows the possible combinations of
functions.

Figure 1.1-3
FC2
0
0
0
0
1
1
1
1

FC1
0
0
1
1

FCO
0
1

0
0

1
1

1
1
0
1

Status

unused
User-mode data access
User-mode program
unused
unused
Supervisor data access
Supervisor program
Interrupt verification

The seventh group contains system control signals. This group applies to
the input CLK and BERR, as well as the bidirectional lines RESET and
HALT.
The input CLK will generate the working frequency of the processor. The
68000 can operate at different speeds; but the operating frequency must be
specified (4, 6, 8, 10, or even 12.5 mHz). The ST has 8 mHz built in,
while the minimum operating frequency is 2 mHz. The ST's 8 mHz was
chosen as a "middle of the road" frequency to avoid losing data at higher
frequencies.
The RESET line is necessary to check for system power-up. The 68000's
data page distinguishes between two different reset conditions. On
power-up, RESET and HALT are switched low for at least 100
milliseconds, to set up a proper initialization. Every other initialization
requires a low impulse of at least 4 "beats" on the 68K.
Here is what RESET does in detail. The system byte of the status register is
loaded with the value $27. Once the processor is brought into supervisor

11

Abacus Software

Atari ST Internals

status, the Trace flag in the status register is cleared, and the interrupt level
is set to 7 (lowestpriority, all lines allowable). Additionally, the supervisor
stack pointer and program counter are loaded with the contents of the first 8
bytes of memory, whereby the value of the program counter is set to the
beginning of the reset routine.
However, since the RESET line is bi-directional, the processor can also
have RESET under program control during the time the line is low. The
RESET instruction serves this purpose, when the connection is low for 124
"beats". It's possible to re-initialize the peripheral ICs at any time, without
resetting the computer itself. RESET time puts the 68000 into a NOP state
-- a reset is unstoppable once it occurs.
The HALT pin is important to the RESET line's existence (as we mentioned
above), in order to initialize things properly. This pin has still more
functions: when the pin is low while RESET is high, the processor goes
into a halt state. This state causes the DMA pin to set the processor into the
tri-state condition. The HALT condition ends when HALT is high again.
This signal can be used in the design of single-step control.
HALT is also bi-directional. When the processor signals this line to become
low, it means that a major error has occurred (e.g., doubled bus and
address errors).
A low state on the BERR pin will call up exception handling, which runs
basically like an external interrupt. In an orderly system, every access to the
asynchronous bus quits with the DTACK signal. When DTACK is
outputting, however, the hardware can produce a BERR, which informs the
processor of any errors found. A further use for BERR is in connection
with the MMU, to test for proper memory access of a specific range; this
access is signaled by the FC pins. If protected memory is tried for in user
mode, a BERR will turn up.
When both BERR and HALT are low, the processor will "re-execute" the
instruction at which it stopped. If it doesn't run properly on the second
"go-round", then it's called a doubled bus error, and the processor halts.
The eighth group of connections are for voltage and ground.

12

Abacus Software

Atari ST Internals

1.2 The Custom Chips


The Atari ST has four specially developed ICs. These chips (GLUE,
MMU, DMA and SHIFTER) play a major role in the low price of the ST,
since each chip performs several hundred overlapping functions. The first
prototype of the ST was 5 X 50 X 30 cm. in size, mostly to handle all those
TTL ICs. Once multiple functions could be crammed into four ICs, the ST
became a saleable item. Then again, the present ST hasn't quite reached the
ultimate goal -- it still has eight TTLs.
Naturally, since these chips were specifically designed by Atari for the ST,
they haven't been publishing any spec sheets. Even without any data specs,
we can give you quite a bit of information on the workings of the ICs.
An interesting fact about these ICs is that they're designed to work in
concert with one another. For example, the DMA chip can't operate alone.
It hasn't an address counter, and is incapable of addressing memory on its
own (functions which are taken care of by the MMU). It's the same with
SHIFTER it controls video screen and color, but it can't address video
RAM. Again, MMU handles the addressing.
The system programmer can easily figure out which 1C has which register.
It is only essential to be able to recognize the address of the register, and
how to control it. We're going to spend some time in this chapter exploring
the pins of the individual ICs.
The most important 1C of the "foursome" is GLUE. Its title speaks for the
function a glue or paste. This 1C, with its 68 pins, literally holds the
entire system together, including decoding the address range and working
the peripheral ICs.
Furthermore, the DMA handshake signals BR, BG and BGACK are
produced/output by GLUE. The time point for DMA request is dictated by
GLUE by the signal from the DMA controller. GLUE also has a BG (Bus
Grant) input, as well as a BGO (Bus Grant Out).
The interrupt signal is produced by GLUE; in the ST, only EPL1 and BPL2
are used for this. Without other hardware, you can't use NMI (interrupt
level 7). The pins MFPINT and IACK are used for interrupt control.

13

Abacus Software

Atari ST Internals

Figure 1.2-1 GLUE

* n<N
"' * ^ t "^ n w* w> * t>

^ ^r i'i * i **

CMNNCMCMCMNHHHHHHHHHH

n nn nnnnnnnnnnn nnn
BGI*
RDY
VPA*
BEER*
DTACK*
IPL 1*
IPL 2*
8MHZ in
GND
BLANK*
HSYNC
VSYNC
DE
BR*
BGACK*
6850CS*
500HZ out

27 C

A21

28 C
29 C
30C
31 C
32 C
33 C
34 C
35 C
36 C
37 C
38 C
39 C
40 C
41C
42 C
43 C

D
D
D
D
D

8
7
6
5
4

A20
A19
A18
A17
A16
A15
A14
Vcc
A13
A12
All
A10
A9
A8
A7
A6

b 3

GLUE

II

D 68
D 67

D
D
D
D
D
D

U UU UUUUUUUUUUU UUU

CO
*
* U
H
*
& *
O*
MM
faOQQOH

*
to

ON*

SS^HI

' M O I rf

14

in

66
65
64
63
62
61

Abacus Software

Atari ST Internals

The function code pins are guided by GLUE, where memory access tasks
are performed (range testing and access authorization). Needless to say, the
BERR signal is also handled by this chip. VPA is particularly important to
the peripheral ICs and the appropriate select signals.
GLUE generates a timing frequency of 8 mHz. Frequencies between 2
mHz (sound chip's operating frequency) and 500 kHz (timing for keyboard
and MIDI interface) can be produced.
HSYNC, VSYNC, BLANK and DE (Display Enable) are generated by
GLUE for monitor operation. The synchronous timing can be switched on
and off, and external sync-signals sent to the monitor. This will allow you
to synchronize the ST's screen with a video camera.
The MMU also has a total of 68 pins. This 1C performs three vital tasks.
The most important task is coupling the multiplexed address bus of dynamic
RAM with the processor's bus (handled by address lines Al to A21). This
gives us an address range totaling 4 megabytes. Dynamic RAM is
controlled by RASO, RAS1, CASOL, CASOH, CAS1L and CAS1H, as
well as the multiplexed address bus on the MMU. DTACK, R/W, AS, LDS
and UDS are also controlled by MMU.
We've already mentioned another important function of the MMU: it works
with the SHIFTER to produce the video signal (the screen information is
addressed in RAM, and SHIFTER conveys the information). Counters are
incorporated in the MMU for this; a starting value is loaded, and within 500
nanoseconds, a word is addressed in memory and the information is sent
over DCYC. The starting value of the video counter (and the screen
memory position) can be shifted in 256-byte increments.
Another integrated counter in MMU, as mentioned earlier, is for addressing
memory using the DMA. This counter begins with every DMA access (disk
or hard disk), loading the address of the data being transferred. Every
transfer automatically increments the counter.
The SHIFTER converts the information in video RAM into impulses
readable on a monitor. Whether the ST is in 640 X 200 or 320 X 200
resolution, SHIFTER is involved.

15

Atari ST Internals

Abacus Software

Figure 1.2-2 MMU


00 P 3
Hd 0 0

D&Q

0
0
CO

nnnnnnnnnnnnnnnnn
GND*
CMPCS
DCYC*
RDAT*
DEV*

27
28
29
30
31

D
D
D
D
D
D

<C
C

AS

32 C

RAM*

33 C

R/W*
A15
A14
A13
A12
All
A10
A9
A8
A7

34
35
36
37 C
38 ^
39
40 C
41 C
42 C
43 L

MMU

1p
PD

D
D
D
D

U UUU UUUUUUUUUUUUU

16

9
8
7
6
5
4
3
2
1
68
67
66
65
64
63
62
61

LATCH
RASO
CASOLOW
CASOHIGH
16MHZ IN
D7
D6
D5
D4
D3
D2
Dl
DO
MAD 9
MAD 8
MAD 7
GND

Abacus Software

Atari ST Internals

Figure

XTL
XTL

1 32MHZ

0
in

D 0
D 1
D 2
D 3
D 4
D 5
D 6
D 7

i.:1-3

SHlKl't,R

e
c
cC
c
c
c CO
( SB
c H
c

LOAD*^

Hi

D 10

w
((

D 11

D 8
D 9

D 12
D 13
D 14
D 15
6ND

J Vc c
\Z out

) cs *
) D E

)A

1 5V.

)A

) A 4
) A 5
) R/W*

^ MONO

J R

)
) R

) G 0

c
c
c
c

). i
)

) B 0

). i

<

) B 2

17

Abacus Software

Atari ST Internals

The information from RAM is transferred to SHIFTER on the signal


LOAD. A resolution of 640 X 400 points sends the video signal over the
MONO connector. Since color is impossible in that mode, the RGB
connection is rendered inactive. The other two resolutions set MONO
output to inactive, since all screen information is being sent out the RGB
connection in those cases.
The third color connection works together with external equipment as a
digital/analog converter. Individual colors are sent out over different pins,
to give us color on our monitor. Pins Rl- R5 on the address bus make up
the "palette registers". These registers contain the color values, which are
placed in individual bit patterns. The 16 palette registers hold a total of 16
colors for 320 X 200 mode. Note, however, that since these are based on
the "primary" colors red, green and blue, these colors can be adjusted in 8
steps of brightness, bringing the color total to 512.
The DMA controller is like SHIFTER, only in a 40-pin housing; it is used
to oversee the floppy disk controller, the hard disk, and any other
peripherals that are likely to appear.
The speed of data transfer using the floppy disk drive offers no problems to
the processor. It's different with hard disks; data moves at such high speed
that the 68000 has to send a "pause" over the 8 mHz frequency. This pace
is made possible by the DMA.
The DMA is joined to the processor's data bus to help transfer data. Two
registers within the machine act as a bi-directional buffer for data through
the DMA port; we'll discuss these registers later. One interesting point:
The processor's 16-bit data bus is reduced to 8 bits for floppy/hard disk
work. Data transfer automatically transfers two bytes per word.
The signals CA1, CA2, CR/W, FDCS and FDRQ manage the floppy disk
controller. CA1 and CA2 are signals which the floppy disk controller
(FDC) uses to select registers. CR/W determine the direction of data
transfer from/to the FDC, and other peripherals connected to the DMA port.
The RDY signal communicated with GLUE (DMA-request) and MMU
(address counter). This signal tells the DMA to transfer a word.
As you can see, these ICs work in close harmony with one another, and
each would be almost useless on its own.

18

Abacus Software

Atari ST Internals

Figure 1.2-4 DMA

R/W*
A 1
FCS *
D 0
D 1
D 2

D 3
D 4
D 5
D 6
D 7
D 8
D 9

<[
C
C
C
C
C
C
C
C
C
C
C
C

D 10

D 11

C
C
C

D 12
D 13
D 14

D 15

C
C

6ND

a
g

) V CC
) CLK
) RD Y
) ACK*
) CD 0
) GDI
) CD 2
) CDS
) CD 4
CDS

] CD 6
) C D7
) GND
) C A2
) C Al
) CR/W*
) HDCS*
} HDRQ
) FDCS *

5
19

FDRQ

Abacus Software

Atari ST Internals

1.3 The WD 1772 Floppy Disk Controller

Although the 1772 from Western Digital has only 28 pins, this chip contains
a complete floppy disk controller (FDC) with capabilities matching 40-pin
controllers. This 1C is software-compatible with the 1790/2790 series.
Here are some of the 1772's features:
Simple 5-volt current
Built-in data separator
Built-in copy compensation logic
Single and double density
Built-in motor controls
Although the user has his/her choice of disk format, e.g. sector length,
number of sectors per track and number of tracks per diskette, the "normal"
format is the optimum one for data transfer. So, Apple or Commodore
diskettes can't be used.
Before going on to details of the FDC, let's take a moment to look at the 28
pins of this 1C.

1.3.1 1772 Pins


These pins can be placed in three categories. The first group consists of the
power connections.
Vcc:

+5 volts current.
GND:
Ground connection.
MR:
Master reset. FDC reinitializes when this is low.
The second set are processor interface pins. These pins carry data between
the processor and the FDC.
20

Abacus Software

Atari ST Internals

Figure 1.3-1 FDC 1772

cs *

(L
C
C
C
C
C
C
C
C
C
C
C
C
r~

~~\R

^I^^^^H

R/W*
AO
A1
DAL

DAL

DAL

DAL

DAL

DAL

DAL

DAL

MR*
6ND

CM

~")

DRQ

"^

DD *

~"\P *
~"\X

^
H

Q
w

D
"^

WD

"^

WG

"}

MO

"^

RD *

"^

CLK

""^

DIRC

~^

STEP

"^\c

21

T1 "Q V f \O

Abacus Software

Atari ST Internals

DO-D7:
Eight-bit bi-directional bus; data, commands and status
information go between FDC and system.
CS:

FDC can only access registers when this line is low.


R/W:

Read/Write. This pin states data direction. HIGH= read by FDC,


LOW=write from FDC.
AO,A1:
These bits determine which register is accessed (in conjunction
with R/W). The 1772 has a total of five registers which can both
read and write to some degree. Other registers can only read OR
write. Here is a table to show how the manufacturer designed
them:
Al

AO

0
0

1
1

R/W=1

Status Reg.
Track Reg.
Sector Reg.
Data Reg .

R/W=0

Command Reg
Track Reg.
Sector Reg .
Data Reg.

DRQ:

Data Request When this output is high, either the data register is
full (from reading), and must be "dumped", or the data register is
empty (writing), and can be refilled. This connection aids the
DMA operation of the FDC.
CLK:

Clock. The clock signal counts only to the processor bus. An


input frequency of 8 mHz must be on, for the FDC's internal
timing to work.
The third group of signals make up the floppy interface.
STEP:
Sends an impulse for every step of the head motor.
DIRC:

Direction. This connection decides the direction of the head; high


moves the head towards center of the diskette.
22

Abacus Software

Atari ST Internals

RD:

Read Data. Reads data from the diskette. This information


contains both timing and data impulses it is sent to the internal
data separator for division.

MO:
Motor On. Controls the disk drive motor, which is automatically
started during read/write/whatever operations.

WG:
Write Gate. WG will be low before writing to diskette. Write
logic would be impossible without this line.
WD:

Write Data. Sends serial data flow as data and timing impulses.
TROO:
Track 00. This moves read/write head to track 00. TROO would
be low in this case.
IP:

Index Pulse. The index pulses mark the physical beginnings of


every track on a diskette. When formatting a disk, the FDC
marks the start of each track before formatting the disk.
WPRT:
Write Protect. If the diskette is write-protected, this input will
react.
DDEN:
Double Density Enable. This signal is confined to floppy disk
control; it allows you to switch between single-density and
double-density formats.

23

Abacus Software

Atari ST Internals

1.3.2 1772 Registers


CR (Command Register):
Commands are written in this 8-bit register. Commands should
only be written in CR when no other command is under
execution. Although the FDC only understands 11 commands,
we actually have a large number of possibilities for these
commands (we'll talk about those later).
STR (Status Register):
Gives different conditions of the FDC, coded into individual bits.
Command writing depends on the meaning of each bit. The
status register can only be read.
TR (Track Register):
Contains the current position of the read/write head. Every
movement of the head raises or lowers the value of TR
appropriately. Some commands will read the contents of TR,
along with information read from the disk. The result affects the
Status Register. TR can be read/written.
SR (Sector Register):
SR contains the number of sectors desired from read/write
operations. Like TR, it can be used for either operation.
DR (Data Register):
DR is used for writing data to/ reading data from diskette.

24

Abacus Software

Atari ST Internals

1.3.3 Programming the FDC


Programming this chip is no big deal for a system programmer. Direct (and
in most cases, unnecessary) programming is made somewhat harder AND
drastically simpler by the DMA chip. The 11 FDC commands are divided
into four types.
Type
1
1
1
1
1
2
2
3
3
3
4

Function
Restore, look for track 00
Seek, look for a track
Step, a track in previous direction
Step In, move head one track in (toward disk hub)
Step Out, move head one track out (toward edge of disk)
Read Sector
Write Sector
Read Address, read ID
Read Track, read entire track
Write Track, write entire track (format)
Force Interrupt

Type 1 Commands
These commands position the read/write head. The bit patterns of these five
commands look like this:
BIT

Restore
Seek
Step
Step In
Step Out

0
0
0
0
0

0
0
0
1
1

0 0
0 1
1 U
0 U
1 U

H
H
H
H
H

V
V
V
V
V

Rl RO
Rl RO
Rl RO
Rl RO
Rl RO

25

Abacus Software

Atari ST Internals

All five commands have several variable bits; bits RO and Rl give the time
between two step impulses. The possible combinations are:
Rl

RO

0
0
1
1

0
1
0
1

STEP RATE

2
3
5
6

milliseconds
milliseconds
milliseconds
milliseconds

These bits must be set by the command bytes to the disk drive. The V-bit is
the so-called "verify flag". When set, the drive performs an automatic
verify after every head movement. The H-bit contains the spin-up
sequence. The system delays disk access until the disk motor has reached
300 rpm. If the H-bit is cleared, the FDC checks for activation of the
motor-on pins. When the motor is off, this pin will be set high (motor on),
and the FDC waits for 6 index impulses before executing the command. If
the motor is already running, then there will be no waiting time.
The three different step commands have bit 4 designated a U- bit. Every
step and change of the head appears here.
Type 2 Commands
These commands deal with reading and writing sectors. They also have
individual bits with special meanings.
B I T
7 6 5 4 3 2 1 0
Read Sector 1 0 0 M H E O O
Write Sector 1 0 1 M H E P A O
The H-bit is the previously described start-up bit. When the E-bit is set, the
FDC waits 30 milliseconds before starting the command. This delay is
important for some disk drives, since it takes time for the head to change
tracks. When the E-bit reads null, the command will run immediately.
The M-bit determines whether one or several sectors are read one after
another. On a null reading, only one sector will be read from/written to.
Multi-sector reading sets the bit, and the FDC increments the counter at each
new sector read.
Bits 0 and 1 must be cleared for sector reading. Writing has its own special
meaning: the AO bit conveys to bit 0 whether a cleared or normal data
26

Abacus Software

Atari ST Internals

address mark is to be written. Most operating systems don't use this option
(a normal data address mark is written).
The P-bit (bit 1) dictates whether pre-compensation for writing data is
turned on or off. Pre-compensation is normally set on; it supplies a higher
degree of protection to the inner tracks of a diskette.
Tvoe 3 Commands
Read Address gives program information about the next ID field on the
diskette. This ID field describes track, sector, disk side and sector length.
Read Track gives all bytes written to a formatted diskette, and the data
"between sectors". Write Track formats a track for data storage. Here are
the bit patterns for these commands:
BIT
Read Address
Read Track
Write Track

7 6 5 4 3 2 1
1 1 0 0 H E O
1 1 1 0 H E O
1 1 1 1 H E P

0
O
O
O

The H- and E-bits also belong to the Type 2 command set (spin-up and
head-settle time). The P-bit has the same function as in writing sectors.
Type 4 Commands
There's only one command in this set: Force Interrupt. This command can
work with individual bits during another FDC command. When this
command comes into play, whatever command was currently running is
ended.
B I T
7
Force Interrupt 1

6
1

5
0

4
1

3 2 1 0
13 12 II 10

Bits 10-13 present the conditions under which the interrupt is pressed. 10
and II have no meaning to the 1772, and remain low. If 12 is set, an
interrupt will be produced with every index impulse. This allows for
software controlled disk rotation. If 13 is set, an interrupt is forced
immediately, and the currently-running command ends. When all bits are
null, the command ends without interruption.

27

Abacus Software

Atari ST Internals

1.4 The MFP 68901


MFP is the abbreviation for Multi-Function Peripheral. This name is no
exaggeration; wait until you see what it can do! Here's a brief list of the
most noteworthy features:
8-bit parallel port
Data direction of every port bit is individually programmable
Port bits usable as interrupt input
16 possible interrupt sources
Four universal timers
Built-in serial interface

1.4.1 The 68901 Connections


The 48 pins of the MFP are set apart in function groups. The first function
group is the power connection set:
GND, Vcc, CLK:
Vcc and GND carry voltage to and from the MFP. CLK is the
clock input; this clock signal must not interfere with the system
timer of the processor. The ST's MFP operates at a frequency of
4mHz.
Communication with the data bus of the processor is maintained with
DO-D7, DTACK, RS1-RS5 and RESET.
DO-D7:
These bi-directional pins normally work with the 8 lowest data
bits of the 68000. It is also possible to connect with D8 through
D15, but it's impossible to produce non-auto interrupts. Thus,
interrupt vectors travel along the low order 8 data bits.

28

Abacus Software

Atari ST Internals

Figure 1.4-1 MFP 68901


R / W*

A 1

c
c

A 2
A 3
A 4
A 5
T C
S 0
S Z
R C
Vc c
NC .
TA

TB

TC

TD

XTAZ.1
XTAX.2

TA

TB

RESET

I 0
Z 1
Z2

(T

c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c

CO

vo

c
29

D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D

CS *
D S *

DTACK*
I ACK*
D

Vs s
C LK
I EI *
I EO *

INTR*
RR *
TR*
I 7
Z 6
Z 5
Z 4
Z3

Abacus Software

Atari ST Internals

CS (Chip Select):
This line is necessary to communication with the MFP. CS is
active when low.
DS (Data Strobe):
This pin works with either LDS or UDS on the processor.
Depending on the signal, MFP will operate either the lower or
upper half of the data bus.
DTACK (Data Transfer ACKnoledge):
This signal shows the status of the bus cycle of the processor
(read or write).
RS1-RS5 (Register Select):
These pins normally connect with to the bottom five address lines
of the processor, and serve to choose from the 24 internal
registers.
RESET:
If this pin is low for at least 2 microseconds, the MFP initializes.
This occurs on power-up and a system.reset.
The next group of signals cover interrupt connections (IRQ, IACK, IEI and
ffiO).
IRQ (Interrupt ReQuest):
IRQ will be low when an interrupt is triggered in the MFP. This
informs the processor of interrupts.
IACK (Interrupt ACKnowledge):
On an interrupt (IRQ and DEI), the MFP sends a low signal over
IACK and DS on the data lines. Since 16 different interrupt
sources are available, this makes handling interrupts much
simpler.
IEI, IEO (Interrupt Enable In/ Out):
These two lines permit daisy-chaining of several MFPs, and
determine MFP priority by their positioning in this chain. IEI
would work through the MFP with the highest priority. IEO of
the second MFP would remain unswitched. On an interrupt, a
signal is sent over IACK, and the first MFP in the chain will
acknowledge with a high IEO.

30

Abacus Software

Atari ST Internals

Next, we'll look at the eight I/O lines.


IOO-7 (Input/Output):
These pins use one or all normal I/O lines. The data direction of
each port bit is set up in a data direction register of its own. In
addition, though, every port bit can be programmed to be an
interrupt input.
The timer pins make up yet another group of connections:
XTAL1,2 (Timer Clock Crystal):
A quartz crystal can be connected to these lines to deliver a
working frequency for the four timers.
TAI,TBI (Timer Input):
Timers A and B can not only be used as real counters differently
from timers C and D with the frequency from XTAL1 and 2, but
can also be set up for event counting and impulse width
measurement. In both these cases, an external signal (Timer
Input) must be used.
TAO,TBO,TCO,TDO (Timer Output):
Every timer can send out its status on each peg (from 01 to 00).
Each impulse is equal to 01.
The second-to-last set of signals are the connections to the universal serial
interface. The built-in full duplex of the MFP can be run synchronously or
asynchronously, and in different sending and receiving baud rates.
SI (Serial Input):
An incoming bit current will go up the SI input
SO (Serial Output):
Outgoing bit voltage (reverse of SI).
RC (Receiver Clock):
Transfer speed of incoming data is determined by the frequency
of this input; the source of this signal can, for example, be one of
the four timers.
TC (Transmitter Clock):
Similar to RC, but for adjusting the baud-rate of data being
transmitted

31

Abacus Software

Atari ST Internals

The final group of signals aren't used in the Atari ST. They are necessary
when the serial interface is operated by the DMA.
RR (Receiver Ready):
This pin gives the status of the receiving data registers. If a
character is completely received, this pin sends current
TR (Transmitter Ready):
This line performs a similar function for the sender section of the
serial interface. Low tells the DMA controller that a new
character in the MFP must be sent

1.4.2 The MFP Registers


As we've already mentioned, the 68901 has a total of 24 different registers.
This large number, together with the logical arrangement, makes
programming the MFP much easier.
Reg 1 GPIP, General Purpose I/O Interrupt Port
This is the data register for the 8-bit ports, where data from the
port bits is sent and read.
Reg 2 AER, Active Edge Register
When port bits are used for input, this register dictates whether
the interrupt will be a low-high- or high-low conversion. Zero is
used in the high-low change, one for low-high.
Reg 3 DDR, Data Direction Register
We've already said that the data direction of individual port bits
can be fixed by the user. When a DDR bit equals 0, the
corresponding pin becomes an input, and 1 makes it an output.
Port bit positions are influenced by AER and DDR bits.

32

Abacus Software

Atari ST Internals

Reg 4,5 IERA,IERB, Interrupt Enable Register


Every interrupt source of the MFP can be separately switched on
and off. With a total of 16 sources, two 8-bit registers are
needed to control them. If a 1 has been written to IERA or
IERB, the corresponding channel is enabled (turned on).
Conversely, a zero disables the channel. If it comes upon a
closed channel caused by an interrupt, the MFP will completely
ignore it. The following table shows which bit is coordinated
with which interrupt occurrence:
IERA
Bit 7:
Bit 6:
Bit 5:
Bit 4:
Bit 3:
Bit 2:
Bit 1:
Bit 0:

I/O port bit 7 (highest priority)


I/O port bit 6
Timer A
Receive buffer full
Receive error
Sender buffer empty
Sender error
Timer B

IERB
Bit 7:
Bit 6:
Bit 5:
Bit 4:
Bit 3:
Bit 2:
Bit 1:
Bit 0:

I/O port
I/O port
Timer C
Timer D
I/O port
I/O port
I/O port
I/O port

bit 5
bit 4
bit
bit
bit
bit

3
2
1
0, lowest priority

This arrangement applies to the IP-, IM- and IS-registers discussed below.
Reg 6,7 IPRA,IPRB, Interrupt Pending Register
When an interrupt occurs on an open channel, the appropriate bit
in the Interrupt Pending Register is set to 1. When working with
a system that allows vector creation, this bit will be automatically
cleared when the MFP puts the vector number on the data bus. If
this possibility doesn't exist, the IPR must be cleared using
software. To clear a bit, a byte in the MFP will show the location
of the specific bit.
The bit arrangement of the IPR is shown in the table for registers
4 and 5 (see above).
33

Abacus Software

Atari ST Internals

Reg 8,9 ISRA,ISRB,Interrupt In-Serviee Register


The function of these registers is somewhat complicated, and
depends upon bit 3 of register 12. This bit is an S-bit, which
determines whether the 68901 is working in "Software End-ofInterrupt" mode (SEI) or in "Automatic End-of-Interrupt" mode
(AEI). AEI mode clears the IPR (Interrupt Pending Bit), when
the processor gets the vector number from the MFP during an
IACK cycle. The appropriate In-Service bit is cleared at the same
time. Now a new interrupt can occur, even when the previous
interrupt hasn't finished its work.
SEI mode sets the corresponding ISR-bit when the vector
number of the interrupt is requested by the processor. At the
interrupt routine's end, the bit designated within the MFP must
be cleared. As long as the Interrupt In-Service bit is set, all
interrupts of lower priority are masked out by the MFP. Once the
Pending-bit of the active channel is cleared, the same sort of
interrupt can occur a second time, and interrupts of lesser priority
can occur as well.
Reg 10,11 IMRA,IMRB Interrupt Mask Register
Individual interrupt sources switched on by IER can be masked
with the help of this register. That means that the interrupt is
recognized from within and is signalled in the IPR, even if the
IRQ line remains high.
Reg 12 VR Vector Register
In the cases of interrupts, the 68901 can generate a vector number
corresponding to the interrupt source requested by the processor
during an Interrupt Acknowledge Cycle. All 16 interrupt
channels have their own vectors, with their priorities coded into
the bottom four bits of the vector number (the upper four bits of
the vector are copied from the vector register). These bits must
be set into VR, therefore.
Bit 3 of VR is the previously mentioned S-bit. If this bit is set
(like in the ST), then the MFP operates in "Software End-ofInterrupt" mode; a cleared bit puts the system into "Automatic
End-of-Interrupt" mode.

34

Abacus Software

Atari ST Internals

Reg 13,14 TACR,TBCR Timer A/B Control Register


Before proceeding with these registers, we should talk for a
0
moment about the timer. Timers A and B are both identical.
Every timer consists of a data register, a programmable feature
and an 8-bit count-down counter. Contents of the counters will
decrease by one every impulse. When the counter stands at 01,
the next impulse changes the corresponding timer to the output of
its pins. At the same time, the value of the timer data register is
loaded into the timer. If this channel is set by the IER bit, the
interrupt will be requested. The source of the timer beats will
usually be those quartz frequencies from XTAL1 and 2. This
operating mode is called delay mode, and is available to timers C
andD.
Timers A and B can also be fed external impulses using timer
inputs TAI and TBI (in event count mode). The maximum
frequency on timer inputs should not surpass 1/4 of the MFP's
operating frequency (that is, 1 mHz).
Another peculiarity of this operating mode is the fact that the
timer inputs for the interrupts are I/O pins 13 and 14. By
programming the corresponding bits in the AER, a pin-jump can
be used by the timer inputs to request an interrupt. TAI is joined
with pin 13, TBI by pin 14. Pins 13 and 14 can also be used as
I/O lines without interrupt capability.
Timers A and B have yet a third operating mode (pulse-length
measurement). This is similar to Delay Mode, with the difference
that the timer can be turned on and off with TAI and TBI. Also,
when pins 13 and 14 are used, the AER-bits can determine
whether the timer inputs are high or low. If, say, AER-bit 4 is
set, the counter works when TAI is high. When TAI changes to
low, an interrupt is created.
Now we come to TACR and TBCR. Both registers only use the
fifth through eighth bits. Bits 0 to 3 determine the operating
mode of each timer:

35

Abacus Software

BIT 3 2 1 0
0 0 0
0 0 0
0 0 1
0 0 1
0 0 1
0 1 0
0 1 0
0 1 1
0 1 1
100
1 00
101
101
110
1 10

Atari ST Internals

Function

0 Timer stop, no function executed

Delay mode, subdivider divides by 4

0 Delay mode, subdivider divides by 10

1
1

1
0

1
0

1
0

1 11

1
0

1
0

1 1 11

Delay
Delay
Delay
Delay
Delay
Delay
Event
Pulse
Pulse
Pulse
Pulse
Pulse
Pulse
Pulse

mode, subdivider divides by 16


mode, subdivider divides by 16
mode, subdivider divides by 50
mode, subdivider divides by 64
mode, subdivider divides by 100
mode, subdivider divides by 200
Count Mode
extension mode, subdivider divides by
extension mode, subdivider divides by
extension mode, subdivider divides by
extension mode, subdivider divides by
extension mode, subdivider divides by
extension mode, subdivider divides by
extension mode, subdivider divides by

4
10
16
50
64
100
200

Bit 4 of the Tinier Control Register has a particular function.


This bit can produce a low reading for the timer being used with
it at any time. However, it will immediately go high when the
timer runs.
Reg 15 TCDCR Timers C and D Control Register
Timers C and D are available only in delay mode; thus, one byte
controls both timers. The control information is programmed
into the lower three bits of the nibbles (four- bit halves). Bits 0
and 2 arrange Timer D, Timer C is influenced by bits 4 and 6.
Bits 3 and 7 in this register have no function.
Bit
Bit

210
654
000
001
010
011
100
101
110
111

Function - Timer D
Function - Timer C
Timer Stop
Delay Mode, division
Delay Mode, division
Delay Mode, division
Delay Mode, division
Delay Mode, division
Delay Mode, division
Delay Mode, division

36

by
by
by
by
by
by
by

4
10
16
50
64
100
200

Abacus Software

Atari ST Internals

Reg 16-19 TADR,TBDR,TCDR,TDDR Timer Data Registers


The four Timer Data Registers are loaded with a value from the
counter. When a condition of 01 is reached, an impulse occurs.
A continuous countdown will stem from this value.
Reg 20 SCR Synchronous Character Register
A value will be written to this register by synchronous data
transfer, so that the receiver of the data will be alerted. When
synchronous mode is chosen, all characters received will be
stored in the SCR, after first being put into the receive buffer.
Reg 21 UCR,USART Control Register
USART is short for Universal Synchronous/Asynchronous
Receiver/Transmitter. The UCR allows you to set all the
operating parameters for the interfaces. Parameters can also be
coded in with the timers.
Bit 0
Bit 1

: unused
: 0=0dd parity
l=Even parity

Bit 2

: 0=No parity (bit 1 is ignored)


l=Parity according to bit 1

Bits 3,4
Bit

: These bis control the number of


start- and stopbits and the
format desired.
4 3 Start Stop Format
0 0 0
0 Synchronous
O i l
1 Asynchronous
10
1
1,5 Asynchronous
1 1 1
2 Asynchronous

Bits 5,6
Bits 6
0
0
1
1

: These bits give the


"wordlength" of the data bits
to be transferred.
5 Word length
0 8 bits
1 7 bits
0 6 bits
1 5 bits

37

Abacus Software

Bit 7

Atari ST Internals

: Q=Frequency from TC and RC


directly used as transfer
frequency (used only for
synchronous transfer)
l=Frequency in TC and RC
internally divided by 16.

Reg 22 RSR Receiver Status Register


The RSR gives information concerning the conditions of all
receivers. Again, the different conditions are coded into
individual bits.
Bit 0 Receiver Enable Bit
When this bit is cleared, receipt is immediately turned off.
All flags in RSR are automatically cleared. A set bit means
that the receiver is behaving normally.
Bit 1 Synchronous Strip Enable
This bit allows synchronous data transfer to determine
whether or not a character in the SCR is identical to a
character in the receive buffer.
Bit 2 Match/Character in Progress
When in synchronous transfer format, this bit signals that a
character identical with the SCR byte would be received.
In asynchronous mode, this bit is set as soon as the startbit
is recognized. A stopbit automatically clears this bit.
Bit 3 Found - Search/Break Detected
This bit is set in synchronous transfer format, when a
character received coincides with one stored in the SCR.
This condition can be treated as an interrupt over the
receiver's error channel. Asynchronous mode will cause
the bit to set when a BREAK is received. The break
condition is fulfilled when only zeroes are received
following a startbit. To distinguish between a BREAK
from a "real" null, this line should be low.
Bit 4 Frame Error
A frame error occurs when a byte received is not a null, but
the stopbit of the byte IS a null.

38

Abacus Software

Atari ST Internals

Bit 5 Parity Error


The condition of this bit gives information as to whether
parity on the last received character was correct. If the
parity test is off, the PE bit is untouched.
Bit 6 Overrun Error
This bit will be set when a complete character is in the
receiver floating range but not read into the receive buffer.
This error can be operated as an interrupt.
Bit 7 Buffer Full
This bit is set when a character is transferred from the
floating register to the receive buffer. As soon as the
processor reads the byte, the bit is cleared.
Reg 23 TSR Transmitter Status Register
Whereas the RSR sends receiver information, the TSR handles
transmission information.
Bit 0 Transmitter Enable
The sending section is completely shut off when this bit is
cleared. At the same time the End-bit is cleared and the UEbit is set (see below). The output to the receiver is set in
the corresponding H- and L-bits.
Bits 1,2 High- and Low-bit
These bits let the programmer decide which mode of output
the switched-off transmitter will take on. If both bits are
clearedjthe output is high. High-bit only will create high
output; low-bit, low output. Both bits on will switch on
loop-back-mode. This state loops the output from the
transmitter with receiver input. The output itself is on the
high-pin.
Bit 3 Break
The break-bit has no function in synchronous data transfer.
In asynchronous mode, though, a break condition is sent
when the bit is set

39

Abacus Software

Atari ST Internals

Bit 4 End of Transmission


If the sender is switched off during running transmission,
the end-bit will be set as soon as the current character has
been sent in its entirety. When no character is sent, the bit
is immediately set.
Bit 5 Auto Turnaround
When this bit is set, the receiver is automatically switched
on when the transmitter is off, and a character will
eventually be sent.
Bit 6 Underrun Error
This bit is switched on when a character in the sender
floating register will be sent, before a new character is
written into the send buffer.
Bit 7 Buffer Empty
This bit will be set when a character from the send buffer
will be transferred to the floating register. The bit is
cleared when new data is written to the send buffer.
Reg 24 UDR, USART Data Register
Send/receive data is sent over this register. Writing sends data in
the send buffer, reading gives you the contents of the receive
buffer.

40

Abacus Software

Atari ST Internals

1.5 The 6850 ACIAs

ACIA is short for "Asynchronous Communications Interface Adapter".


This 24-pin 1C has all the components necessary for operating a serial
interface, as well as error-recognizing and data-formatting capabilities.
Originally for 6800-based computers, this chip can be easily tailored for
6502 and 68000 systems. The ST has two of these chips. One of them
communicates with the keyboard, mouse, joystick ports, and runs the
clock. Keyboard data travels over a serial interface to the 68000 chip. The
second ACIA is used for operating the MIDI interface.
Parameter changes in the keyboard ACIA are not recommended: The
connection between keyboard and ST can be easily disrupted. The MIDI
interface is another story, though -- we can create all sorts of practical
applications. Incidentally, nowhere else has it been mentioned that the
MIDI connections can be used for other purposes. One idea would be to
use the MIDI interfaces of several STs to link them together (for schools or
offices, for example).

1.5.1 The Pins of the 6850


For those of you readers who aren't very well-acquainted with the
principles of serial data transfer, we've included some fairly detailed
descriptions in the pin layout which follows.
Vss

This connection is the "ground wire" of the 1C.


RX DATA Receive Data
This pin receives data; a start-bit must precede the least significant
data-bit before receipt.

41

Abacus Software

Atari ST Internals

Figure 1.5-1 ACIA 6850

RX

DATA (

RX

CLK

f"

TX

CLK

~"

RTS

TX

DATA f"

IRQ

CS
CS
CS
RS
Vcc

o
in
00
vo
.

C
C

,. c
1

H
U

C
c
r~

D
D
D
D
D

uuu

(T

Vss

D
^

42

CTS*
DCD*1

E
R/W*

Abacus Software

Atari ST Internals

RX CLK Receive Clock


This pin signal determines baud-rate (speed at which the data is
received), and is synchronize to the incoming data. The
frequency of RX CLK is patterned after the desired transfer
speed and after the internally programmed division rate.
TX CLK Transmitter Clock
Like RX CLK, only used for transmission speed.
RTS Request To Send
This output signals the processor whether the 6850 is low or
high; mostly used for controlling data transfer. A low output
will, for example, signal a modem that the computer is ready to
transmit.
TX DATA Transmitter Data
This pin sends data bit-wise (serially) from the computer.
IRQ Interrupt Request
Different circumstances set this pin low, signaling the 68000
processor. Possible conditions include completed transmission
or receipt of a character.
CS 0,1,2 Chip Select
These three lines are needed for ACIA selection. The relatively
high number of CS signals help minimize the amount of
hardware needed for address decoding, particularly in smaller
computer systems.
RS Register Select
This signal communicates with internal registers, and works
closely with the R/W signal. We shall talk about these registers
later.
Vce Voltage
This pin is required of all ICs this pin gets an operating voltage
of 5V.
R/W Read/Write
This tells the processor the "direction" of data traveling through
the ACIA. A high signal tells the processor to read data, and low
writes data in the 6850.

43

Abacus Software

Atari ST Internals

E Enable
The E-signal determines the time of reading/writing.
read/write processes with this signal must be synchronous.

All

DO - D7 Data
These data lines are connected to those of the 68000. Until the
ACIA is accessed, these bidirectional lines are all high.
DCD Data Carrier Detect
A modem control signal, which detects incoming data. When
DCD is high, serial data cannot be received.

CIS Clear To Send


CTS answers the computer on the signal RTS. Data transmission
is possible only when this pin is low.

1.5.2 The Registers of the 6850


The 6850 has four different registers. Two of these are read only. Two of
them are write only. These registers are distinguished by R/W and RS,
after the table below:
R/W
0
0
1
1

RS
0
1
0
1

Register
Control Register
Sender Register
Status Register
Receive Register

Access
write
write
read
read

The sender/receiver registers (also known as the RX- and TX- buffers) are
for data transfer. When receiving is possible, the incoming bits are put in a
shift register. Once the specified number of bits has arrived, the contents of
the shift register are transferred to the TX buffer. The sender works in
much the same way, only in the reverse direction (RX buffer to sender shift
register).

44

Abacus Software

Atari ST Internals

The Control Register


The eight-bit control register determines internal operations. To solve the
problem of controlling diverse functions with one byte, single bits are set up
as below:

CR 0,1
These bits determine by which factor the transmitter and receiver
clock will be divided. These bits also are joined with a master
reset function. The 6850 has no separate reset line, so it must be
accomplished through software.
CR1
0
0
1
1

CRO
0
1
0
1

RXCLK/TXCLK without division


RXCLK/TXCLK by 16 (for MIDI)
RXCLK/TXCLK by 64 (for keyboard)
Master RESET

CR 2,3,4
These so-called Word Select bits tell whether 7 or 8 data-bits are
involved; whether 1 or 2 stop-bits are transferred; and the type of
parity.
CR4
0
0
0
0
1
1
1
1

CR3
0
0
1
1
0
0
1
1

CR2
0
1
0
1
0
1
0
1

7 databits. 2 stopbits. even parity

7 databits. 2 stopbits. odd

parity

7 databits. 1 stopbit.
7 databits. 1 stopbit.

even parity
odd

parity

8 databits. 2 stopbit.

no
no

parity

8 databits. 1 stopbit.
8 databits. 1 stopbit.
8 databits. 1 stopbit.

parity

even parity
odd parity

CR6,5
These Transmitter Control bits set the RTS output pin, and allow
or prevent an interrupt through the ACIA when the send register
is emptied. Also, BREAK signals can be sent over the serial
output by this line. A BREAK signal is nothing more than a long
sequence of null bits.

45

Abacus Software

Atari ST Internals

CR6

CR5

0
0
1

0
1
0

RTS low, transmitter IRQ disabled


RTS low, transmitter IRQ enabled
RTS high, transmitter IRQ disabled

RTS low, transmitter IRQ disabled, BREAK


sent

CR7
The Receiver Interrupt Enable bit determines whether the receiver
interrupt will be on. An interrupt can be caused by the DCD line
changing from low to high, or by the receiver data buffer filling.
Besides that, an interrupt can occur from an OVERRUN (a
received character isn't properly read from the processor).
CR7

0
1

Interrupt disabled
Interrupt enabled

The Status Register


The Status Register gives information about the status of the chip. It also
has its information coded into individual bytes.

SRO
When this bit is high, the RX data register is full. The byte must
be read before a new character can be received (otherwise an
OVERRUN happens).

SRI
This bit reflects the status of the TX data buffer. An empty
register sets the bit.
SR2

A low-high change on pin DCD sets SR2. If the receiver


interrupt is allowable, the IRQ will be cancelled. The bit is
cleared when the status register and the receiver register are read.
This also cancels the IRQ. SR2 register remains high if the
signal on the DCD pin is still high; SR2 registers low if DCD
becomes low.

46

Abacus Software

Atari ST Internals

SR3
This line shows the status of CTS. This signal cannot be altered
by a master reset, or by ACIA programming.
SR4
Shows "Frame errors". Frame errors are when no stop-bit is
recognized in receiver switching. It can be set with every new
character.
SR5
This bit displays the previously mentioned OVERRUN
condition. SR5 is reset when the RX buffer is read.
SR6
This bit recognizes whether the parity of a received character is
correct. The bit is set on an error.
SR 7
This signals the state of the IRQ pins; this bit makes it possible to
switch several IRQ lines on one interrupt input. In cases where
an interrupt is program-generated, SR7 can tell which 1C cut off
the interrupt.
The ACIAs in the ST
The ACIAs have lots of extras unnecessary to the ST. In fact, CTS, DCD
and RTS are not connected.
The keyboard ACIA lies at the addresses $FFFCOO and $FFFC02. Built-in
parameters are: 8-bit word, 1 stopbit, no parity, 7812.5 baud (500
kHz/64).
The parameters are the same for the MIDI chip, EXCEPT for the baud rate,
which runs at 31250 baud (500 kHz/16).

47

Abacus Software

Atari ST Internals

1.6 The YM-2149 Sound Generator

The Yamaha YM-2149, a PSG (programmable sound generator) in the same


family as the General Instruments AY-3-8190, is a first-class sound
synthesis chip. It was developed to produce sound for arcade games. The
PSG also has remarkable capabilities for generating/altering sounds.
Additionally, the PSG can be easily controlled by joysticks, the computer
keyboard, or external keyboard switching. The PSG has two bidirectional
8-bit parallel ports. Here's some general data on the YM-2149:
three independently programmable tone generators
a programmable noise generator
complete software-controlled analog output
programmable mixer for tone/noise
15 logarithmically raised volume levels
programmable envelopes (ASDR)
two bidirectional 8-bit data ports
TTL-compatible
simple 5-volt power
The YM-2149 has a total of 16 registers. All sound capabilities are
controlled by these registers.
The PSG has several "functional blocks" each with its own job. The tone
generator block produces a square-wave sound by means of a time signal.
The noise generator block produces a frequency-modulated square-wave
signal, whose pulse-width simulates a noise generator. The mixer couples
the three tone generators' output with the noise signal. The channels may
be coupled by programming.
The amplitude control block controls the output volume of the three
channels with the volume registers; or creates envelopes (Attack, Decay,
Sustain, Release, or ADSR), which controls the volume and alters the
sound quality.
The D/A converter translates the volume and envelope information into
digital form, for external use. Finally one function block controls the two
I/O ports.

48

Abacus Software

Atari ST Internals

Figure 1.6- 1 Sound chip YM-2149

Vs s

(*

J Vc c

NC .

^ TEST

ANALOG

B f

J ANALOG

ANALOG

A f

) DA 0

NC .

) DA

) DA 2

IOB7
I OB6

Kj

J DA

I OB5 (

) DA 4

I O B 4 ([
I O B 3 ([
I O B 2 ([

N>
M

) DA

DA

) DA

7
1

IOB1

.yn^

) BC

I OBO (

vo

) BC 2

I OA7 (

) BD I R

XOA6 (

J TEST

IOA5 Q

) AS

IOA4 Q

) A9 *

IOA3 (

J RESET*

IOA2 (

J CLOCK

IOA1

J IOAO

(]

49

Abacus Software

Atari ST Internals

1.6.1 Sound Chip Pins


Vss:
This is the PSG ground connection.

NC.:
Not used.
ANALOG B:
This is the channel B output Maximum output voltage is 1 vss.
ANALOG A:
Works like pin 3, but for channel A.

NC.:

Not used.

IOB7 - 0:
The IOB connections make up one of the two 8-bit ports on the
chip. These pins can be used for either input or output. Mixed
operation (input and output combined) is impossible within one
port, however both ports are independent of one another.
IOA7 - 0:
Like IOB, but for port A.

CLOCK:
All tone frequencies are divided by this signal. This signal
operates at a frequency between 1 and 2 mHz.
RESET:
A low signal from this pin resets all internal registers. Without a
reset, random numbers exist in all registers, the result being a
rather unmusical "racket".

A9:
This pin acts as a chip select-signal. When it is low, the PSG
registers are ready for communication.

50

Abacus Software

Atari ST Internals

AS:

Similar to A9, only it is active when high.


TEST2:
Test2 is used for testing in the factory, and is unused in normal
operation.
BDIR & BC1,2:
The BDIR (Bus DIRection), BC1 and BC2 (Bus Control) pins
control the PSG's register access.
BDIR BC2 BC1
0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

0
1
0
1
0

PSG function
Inactive
Latch address
Inactive
Read from PSG
Latch address
Inactive
Write to PSG
Latch address

Only four of these combinations are of any use to us; those with a
5+ voltage running over BC2. So, here's what we have left:
BDIR
0
0
1
1

BC1
0
1
0
1

Function
Inactive, PSG data bus high
Read PSG registers
Write PSG registers
Latch, write register number(s)

DAO - 7:

These pins connect the sound chip to the processor, through the
data bus. The identifier DA means that both data and (register)
addresses can be sent over these lines.
ANALOG C:
Works with channel C (see ANALOG B, above).
TEST1:
See TEST2.
Vcc:

+5 volt pin.

51

Abacus Software

Atari ST Internals

1.6.2 The 2149 Registers and their Functions

Now let's look at the functions of the individual registers. One point of
interest: the contents of the address register remain unaltered until
reprogrammed. You can use the same data over and over, without having
to send that data again.

Reg 0,1:
These register determine the period length, and the pitch of
ANALOG A. Not all 16 bits are used here; the eight bits of
register 0 (set frequency) and the four lowest bits of register 1
(control step size). The lower the 12-bit value in the register, the
higher the tone.

Reg 2,3:
Same as registers 0 and 1, only for channel B.

Reg 4,5:
Same as registers 0 and 1, only for channel C.

Reg 6:
The five lowest bits of this register control the noise generator.
Again, the smaller the value, the higher the noise "pitch".

Reg 7:
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit

0:Channel A tone on/off


1:Channel B tone on/off
2:Channel C tone on/off
3:Channel A noise on/off
4:Channel B noise on/off
5:Channel C noise on/off
6:Port A in/output
7:Port B in/output

52

0=on
0=on
0=on
0=on
0=on
0=on
0=in
0=in

/l=off
/l=off
/l=off
/l=off
/l=off
/l=off
/l=out
/l=out

Abacus Software

Atari ST Internals

Figure 1.6-2 Envelopes of the PSG


B3

KBQ 15
B2
Bl
BO

C
O
N
T
X
N

H
O
L
D

/I

NKNKNNKKN

NJ

XI
53

Abacus Software

Atari ST Internals

Reg 8:
Bits 0-3 of this register contrrol the signal volume of channel A.
When bit 4 is set, the envelope register is being used and the
contents of bits 0-3 are ignored
Reg 9:

Same as register 8, but for channel B.

Reg 10:
Same as register 8, but for channel C.
Reg 11,12:
The contents of register 11 are the low-byte and the contents of
register 12 are the high-byte of the sustain.

Reg 13:
Bits 0-3 determine the waveform of the envelope generator. The
possible envelopes are pictured in Figure 1.6-2.
Reg 14,15:
These registers comprise the two 8-bit ports. Register 14 is
connected to Port A and register 15 is connected to Port B. If
these ports are programmed as output (bits 7 and 8 of register 7)
then values may be sent through these registers.

54

Abacus Software

Atari ST Internals

1.7 I/O Register Layout in the ST

The entire I/O range (all peripheral ICs and other registers) is controlled by a
32K address register -- $FF8000 - $FFFFFF. Below is a complete table of
the different registers. CAUTION: The I/O section can be accessed only in
supervisor mode. Any access in user mode results in a bus-error.
$FF8000
$FF8200
$FF8400
$FF8600
$FF8800
$FFFAOO
$FFFCOO

Memory configuration
Video display register
Reserved
DMA/disk controller
Sound chip
MFP 68901
ACIAs for MIDI and keyboard

The addresses given refer only to the start of each register, and supply no
hint as to the size of each. More detailed information follows.
SFF8000

Memory Configuration

There is a single 8-bit register at $FF8001 in which the memory


configuration is set up (four lowest bits). The MMU-IC is designed for
maximum versatility within the ST. It lets you use three different types of
memory expansion chips: 64K, 256K, and the 1M chips. Since all of these
ICs are bit-oriented instead of by te-oriented, 16 memory chips of each type
are required for memory expansion. The identifier for 16 such chips
(regardless of memory capacity) is BANK. So, expansion is possible to
128 Kbyte, 512 Kbyte or even 2 Megabytes.
MMU can control two banks at once, using the RAS- and CAS- signals.
The table on the next page shows the possible combinations:

55

Abacus Software
SFF8001

Atari ST Internals

Bit
3-0
0000
0001
0010
0011
0100
0101
0100
0100
1000
1001
1010
1011

Memory conficruration
Bank 0
Bank 1
128K
128K
128K
512K
128K
2 M
reserved
512K
128K
512K
512K
512K
2 M, normally reserved
reserved
2M
128K
512K
2M
2M
2M
reserved

11XX

reserved

The memory configuration can be read from or written to.


SFF8200

Video Display Register

This register is the storage area that determines the resolution and the color
palette of the video display.
$FF8201
$FF8203

8-bit
8-bit

Screen memory position (high-byte)


Screen memory position (low-byte)

These two read/write registers are located at the beginning of the 32K video
RAM.
In order to relocate video RAM, another register is used. This register is
three bytes long and is located at $FF8205. Video RAM can be relocated in
256-byte incremeents. Normally the starting address of video RAM is
$78000.
$FF8205
$FF8207
$FF8209

8-bit
8-bit
8-bit

Video address pointer (high-byte)


Video address pointer (mid-byte)
Video address pointer (low-byte)

These three registers are read ONLY. Every three microseconds, the
contents of these registers are incremented by 2.

56

Abacus Software

Atari ST Internals

$FF820A BIT
Synchronization mode
1 0
: : 0=internal,l=external synchronization
:
0=60 Hz, l=50Hz screen frequency
The bottom two bits of this register control synchronization mode; the
remaining bits are unused. If bit 0 is set, the HSync and VSync impulses
are shut off, which allows for screen synchronization from external sources
(monitor jack). This offers new realm of possibilities in video,
synchronization of your ST and a video camera, for example.
Bit 1 of the sync-mode register handles the screen frequency. This bit is
useful only in the two "lowest" resolutions. High-res operation puts the ST
at a 70 Hz screen frequency.
Sync mode can be read/written.
$FF8240
$FF8242

16-bit
16-bit
*

*
*

$FF825C
$FF825E

Color palette register 0


Color palette register 1

16-bit
16-bit

Color palette registers 2-13

Color palette register 14


Color palette register 15

Although the ST has a total of 512 colors, only 16 different colors can be
displayed on the screen at one time. The reason for this is that the user has
16 color pens on screen, and each can be one of 512 colors. The color
palette registers represent these pens. All 16 registers contain 9 bits which
affect the color:
FEDCBA9876543210
XXX.XXX.XXX
The bits marked X control the registers. Bits 0-2 adjust the shade of blue
desired; 4-6, green hue; and 8-A, red. The higher the value in these three
bits, the more intense the resulting color.
Middle resolution (640 X 200 points) offers four different colors; colors 4
through 15 are ignored by the palette registers.

When you want the maximum of 16 colors, it's best to zero-out the contents
of the palette registers.
57

Abacus Software

Atari ST Internals

High-res (640 X 400 points) gives you a choice on only one "color"; bit 0
of palette register 0 is set to the background color. If the bit is cleared, then
the text is black on a light background. A set bit reverses the screen (light
characters, black background). The color register is a read/write register.
$FF8260

Bit Resolution
1 0
0 0 320 X 200 points, four focal planes
0 1 640 X 200 points, two focal planes
1 0 640 X 400 points, one focal planes

This register sets up the appropriate hardware for the graphic resolution
desired.
SFF8600

DMA/Disk Controller

$FF8600
$FF8602
$FF8604

reserved
reserved
16-bit

FDC access/sector count

The lowest 8 bits access the FDC registers. The upper 8 bits contain no
information, and consistently read 1. Which register of the FDC is used
depends upon the information in the DMA mode control register at
$FF8606. The FDC can also be accessed indirectly.
The sector count-register under $FF8604 can be accessed when the
appropriate bit in the DMA control register is set. The contents of these
addresses are both read/write.
$FF8606

16-bit

DMA mode/status

When this register is read, the DMA status is found in the lower three bits of
the register.
Bit 0
Bit 1
Bit 2

0=no error, 1=DMA error


0=sector count = null, l=sector countonull
Condition of FDC DATA REQUEST signal

Write access to this address controls the DMA mode register.

58

Atari ST Internals

Abacus Software

Bit 0
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Bit 8
$FF8609
$FF860B
$FF860D

unused
0=pin AO is low
l=pin AO is high
0=pin Al is low
l=pin Al is high
0=FDC access
1=HDC access
0=access to FDC register
l=access to sector count register
0, reserved
0=DMA on
l=no DMA
0=hard disk controller access (HOC)
1=FDC access
0=read FDC/HDC registers
l=write to FDC/HDC registers
8-bit
8-bit
8-bit

DMA basis and counter high-byte


DMA basis and counter mid-byte
DMA basis and counter low-byte

DMA transfer will tell the hardware at which address the data is to be
moved. The initialization of the three registers must begin with the low-byte
of the address, then mid-byte, then high-byte.
SFF8800 Sound Chin
The YM-2149 has 16 internal registers which can't be directly addressed.
Instead, the number for the desired register is loaded into the select register.
The chosen registers can be read/write, until a new register number is
written to the PSG.
$FF8800

8-bit

Read data/Register select

Reading this address gives you the last register used (normally port A), by
which disk drive is selected. This can be accomplished with write-protect
signals, although these protected contents can be accessed by another
register. Port A is used for multiple control functions, while port B is the
printer data port.

59

Abacus Software

Atari ST Internals

PORT A

Bit 0
Bit
Bit
Bit
Bit
Bit
Bit
Bit

1
2
3
4
5
6
7

Page-choice signal for double-sided


floppy drive
Drive select signal floppy drive 0
Drive select signal floppy drive 1
RS-232 RTS-output
RS-232 DTR output
Centronics strobe
Freely usable output (monitor jack)
reserved

When $FF8800 is written to, the select register of the PSG is alerted. The
information in the bottom four bits are then considered as register numbers.
The necessary four-bit number serves for writing to the PSG.
$FF8802

8-bit

Write data

Attempting to read this address after writing to it will give you $FF only,
while BDIR and BC1 are nulls.
Writing register numbers and data can be performed with a single MOVEP
instruction.
SFFFAOO

MFP 68901

The MFP's 24 registers are found at uneven addresses from


$FFFA01-$FFFA2F:
$FFFA01
$FFFA03
$FFFA05
$FFFA07
$FFFA09
$FFFAOB
$FFFAOD
$FFFAOF
$FFFA11
$FFFA13
$FFFA15
$FFFA17

8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit

Parallel port
Active Edge register
Data direction
Interrupt enable A
Interrupt enable B
Interrupt pending A
Interrupt pending B
Interrupt in-service A
Interrupt in-service B
Interrupt mask A
Interrupt mask B
Vector register

$FFFA19

8-bit

Timer A control

$FFFA1B

8-bit

Timer B control

60

Abacus Software

$FFFA1D
$FFFA1F
$FFFA21
$FFFA23
$FFFA25
$FFFA27
$FFFA29
$FFFA2B
$FFFA2D
$FFFA2F

8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit
8-bit

Atari ST Internals

Timer C & D control


Timer A data
Timer B data
Timer C data
Timer D data
Sync character
USART control
Receiver status
Transmitter status
USART data

See the chapter on the MFP for details on the individual registers.
I/O
Bit
Bit
Bit
Bit
Bit
Bit
Bit
Bit

Port
0
1
2
3
4
5
6
7

Centronics busy
RS-232 data carrier detect - input
RS-232 clear to send - input
reserved
keyboard and MIDI interrupt
FDC and HDC interrupt
RS-232 ring indicator
Monochrome monitor detect

Timers A and B each have an input which can be used by external timer
control, or send a time impulse from an external source. Timer A is unused
in the ST, which means that the input is always available, but it isn't
connected to the user port, so the Centronics busy pin is connected instead.
You can use it for your own purposes.
Timer B is used for counting screen lines in conjunction with DE (Display
Enable).
The timer outputs in A-C are unused. Timer D, on the other hand, sends
the timing signal for the MFP's built-in serial interface.

61

Abacus Software

SFFFCOO

Atari ST Internals

Keyboard and MIDI ACIAs

The communications between the ST, the keyboard, and musical


instruments are handled by two registers in the ACIAs.
$FFFCOO
$FFFC02
$FFFC04
$FFFC06

8-bit
8-bit
8-bit
8-bit

Keyboard ACIA control


Keyboard ACIA data
MIDI ACIA control
MIDI ACIA data

Figure 1.7-1 I/O Assignments

SFFFCOO
SFFFAOO

2 ACIA's 6580
MFP 68901

SOUND AY-3-8910
SFF8800
IFF8600

DMA / WD1770
RESERVED

SFF8400

VIDEO CONTROLLER
SFF8200

DATA CONFIGURATION
JFF800Q

62

Abacus Software

Atari ST Internals

Figure 1.7-2 Memory Map of the ATARI ST


$FF FCOO

16776192

I/O - Area
$FF FROG

16775680

$FF 8800
8600
8400
8200
$FF 8000

16746496
16745984
16745472
16744960
16744448

I/O - Area

$FE FFFF

16711679

192 K
System ROM
$FC 0000

16515072

128 K ROM
Expansion Cartridge
$FR 0000

16384000

$07 FFFF

524287

512 K RAM

$00 0000

63

Chapter Two
The Interfaces

2.1
2.1.1
2.1.2
2.2
2.3
2.4
2.5
2.6
2.7
2.8

The Keyboard
The Mouse
Keyboard commands
The Video Connection
The Centronics Interface
The RS-232 Interface
The MIDI Connections
The Cartridge Slot
The Floppy Disk Interface
The DMA Interface

Abacus Software

Atari ST Internals

The Interfaces
2.1 The Keyboard
Do you think it's really necessary to give a detailed report on something as
trivial as the keyboard, since keyboards all function the same way? Actually
the title should read "Keyboard Systems" or something similar. The
keyboard is controlled by its own processor. You will soon see how this
affects the assembly language programmer.
The keyboard processor is single-chip computer (controller) from the 6800
family, the 6301. Single chip means mat everything needed for operation is
found on a single 1C. In actuality, there are some passive components in the
keyboard circuit along with the 6301.
The 6301 has ROM, RAM, some I/O lines, and even a serial interface on
the chip. The serial interface handles the traffic to and from the main board.
The advantage of this design is easy to see. The main computer is not
burdened by having to continually poll the keyboard. Instead it can dedicate
itself completely to processing your programs. The keyboard processor
notifies the system if an event occurs that the operating system should be
aware of.
The 6301 is not only responsible for the relatively boring task of reading the
keyboard, however. It also takes care of the rather complicated tasks
required in connection with the mouse. The main processor is then fed
simply the new X and Y coordinates when the mouse is moved. Naturally,
anything to do with the joysticks is also taken care of by the keyboard
controller.
In addition, this controller contains a real-time clock which counts in
one-second increments.

67

Abacus Software

Atari ST Internals

Figure 2.1-1 6850 Interface to 68000

in i
HI H
W M

CO
O

VO
HI

CM
""J

HI
<!

in
oo
vo

IO

o
in

Q
I

68

Abacus Software

Atari ST Internals

In Figure 2.1-1 is an overview of the interface to the 68000. As you see, the
main processors is burdened as little as possible. The ACIA 6850 ensures
that it is disturbed only when a byte has actually been completely received
from the keyboard. The ACIA, by the way, can be accessed at addresses
SFFFCOO (control register) and $FFFC02 (data register). The individual
connection to the keyboard takes place over lines K14 and K15. K indicates
the plug connection by which the keyboard is connected to the main board
The signal that the ACIA has received a byte is first sent over line 14 to the
MFP 68901 which then generates an interrupt to the 68000. The clock
frequency of 500KHz comes from GLUE. From this results the "odd"
transfer rate of 7812.5 baud.
In case you were surprised that data can also be sent to the keyboard
processor, you will find the solution to the puzzle in Chapter 2.1.2.
The block diagram of the keyboard circuit is found in Figure 2.1-2. The
function is as simple as the figure is easy to read. The processor has 4K of
ROM available. The 128 bytes of RAM is comparitively small, but it is used
only as a buffer and for storing pointers and counters.
The lines designated with K are again the plug connections assigned to the
main board. With few exceptions, the connections for the joystick and
mouse are also put through. K16 is the reset line from the 68000. K15
carries the send data from the 6850, K14 the send data from the 6301.
The I/O ports 1(0-7), 3(1-7), and 4(0-7) are responsible for reading the
keyboard matrix. One line from ports 3 and 4 is pulled low in a cycle. The
state of port 1 is the checked, if a key is pressed, the low signal comes
through on port 1.
Each key can be identified from the combination of value placed on ports 3
and 4 and the value read from port 1.
If none of the lines of Port 3 and 4 are placed low and a bit of port 1 still
equals zero, a joystick is active on the outer connecter 1. The data from
outer connector 0, to which a mouse or a joystick can be connected, does
not come through by chance since it must first be switched through the
NAND gate with port 2 (bit 0). The buttons on the mouse or the joystick
then arrive at port 2 (1 and 2).

69

Atari ST Internals

Abacus Software

Figure 2.1-2 Block Diagram of Keyboard Circuit

V
A

niJJJI

v>

m <*

H > t-

H H

M
H

O
H

70

00 f-

Abacus Software

Atari ST Internals

The assignments of the K lines to the signal names on the outer connecter
are found in the next section.
The processor 6301 is completely independent, but it can also be configured
so that it works with an external ROM. Some of the port lines are then
reconfigured to act as address lines. The configuration the processor
assumes (one of eight possibilities) depends on the logical signal placed on
port 2 (bits 0-2) during the reset cycle. All three lines high puts the
processor in mode 7, the right one for the task intended here. But bits 1 and
2 depend on the buttons on the mouse. If you leave the mouse alone while
powering-up, everything will be in order. If you hold the two buttons
down, however, the processors enters mode 1 and makes a magnificent
belly-flop, since the hardware for this operating mode is not provided. You
notice this by the fact that the mouse cursor does not move on the screen if
you move the mouse. Only the reset button will restore the processor.

2.1.1 The Mouse


The construction of this little device is quite simple, but effective.
Essentially, it consists of four light barriers, two encoder wheels, and a
drive mechanism.
The task of the mouse is to give the computer information about its
movements. This information consists of the components: direction on the
X-axis, direction on the Y-axis, and the path traveled on each axis.
In order to do this, the rubber-covered ball visible from the outside drives
two encoder wheels whose drive axes are at angle of 90 degrees to each
other. The one or the other axis rotates more or less, forwards or
backwards, depending on the direction the mouse is moved.
It is no problem to determine the absolute movement on each axis. The
encoder wheels alternately interrupt the light barriers. One need only count
the pulses from each wheel to be informed about the path traveled on each
axis.

71

Atari ST Internals

Abacus Software

Figure 2.1.1-1 The Mouse

XA

OP

2 1 3 4

72

Abacus Software

Atari ST Internals

It is more difficult when the direction of movement is also required. The


designers of the mouse used a convenient trick for this. There are not one,
but two light barriers on each encoder wheel. They are arranged such that
they are not shielded by the wheel at precisely the same time, but one
shortly after the other. This arrangement may not be so clear in Figure
2.1.1-1, so we'll explain it in more detail The direction can be determined
by noticing which of the two light barriers is interrupted first. This is why
the pulses from both light barriers are sent out, making a total of four.
Corresponding to their significance they carry the names XA, XB, YA, YB.
The two contacts which you see on the picture represent the two buttons.
The large box on the picture is a quad operational amplifier which converts
the rather rough light-barrier pulses into square wave signals.
In Figure 2.1.1-2 is the layout of the control port on the computer, as you
see it when you look at it from the outside. The designation behind the slash
applies when a joystick is connected and the number in parentheses is the
pin number of the keyboard connector.
PortO
1
2
3
4
6
7
8
9

XB/UP
XA/DOWN
YA/LEFT
YB/RIGHT
LEFT BUTTON/FIRE
+5V
GND
RIGHT BUTTON

(K12)
(K10)
(K9)
(K8)
(Kll)
(K13)
(Kl)
(K6)

UP
DOWN
LEFT
RIGHT
PortO enable
FIRE
+5V
GND

(K7)
(K5)
(K4)
(K3)
(K17)
(K6)
(K13)
(Kl)

Portl
1
2
3
4
5
6
7
8

73

Abacas Software

Atari ST Internals

Figure 2.1.1-2 Mouse control port

\m
2.1.2 Keyboard commands
The keyboard processor "understands" some commands pertaining to such
things as how the mouse is to be handled, etc. You can set the clock time,
read the internal memory, and so on. You can find an application example in
the assembly language listing on page 80 (after command $21).
The "normal" action of the processor consists of keeping an eye on the
keyboard and announcing each keypress. This is done by outputting the
number of the key when the key is pressed. When the key is released the
number is set again, but with bit 7 set. The result of this is that no key
numbers greater than 127 are possible. You can find the assignment of the
key numbers to the keys at the end of this section in figure 2.1.2-1. In
reality these numbers only go up to 117 because values from $F6 up are
reserved for other purposes. There must be a way to pass more information
than just key numbers to the main processor, information such as the clock
time or the current position of the mouse. This cannot be handled in a single
byte but only in something called a package, so the bytes at $F6 signal the
start of a package. Which header comes before which package is explained
along with the individual commands.
A command to the keyboard processor consists of the command code (a
byte) and any parameters required. The following description is sorted
according to command bytes.
$07
Returns the result of pressing one of the two mouse buttons. A parameter
byte with the following format is required:
74

Abacus Software

Atari ST Internals

Bit 0

=1: The absolute position is returned when a


mouse button is pressed. Bit 2 must =0.
Bit 1 =1: The absolute position is returned when a
mouse button is released. Bit 2 must =0.
Bit 2 =1: The mouse buttons are treated like
normal keys. The left button is key
number $74, the right is $75.
Bits 3-7
must always be zero.

$08
Returns the relative mouse position from now on. This command tells the
keyboard processor to automatically return the relative position (the distance
from the previous position) whenever the mouse is moved. A movement is
given when the number of encoder wheel pulses has reached a given
threshold. See also $OB. A relative mouse package looks like this:
1 byte
1 byte
1 byte

Header in range $F8-$FB. The two lowest


bits of the header indicate the condition
of the two mouse buttons.
Relative X-position (signed!)
Relative Y-position (signed!)

If the relative position changes substantially between two packages so that


the distance can no longer be expressed in one byte, another package is
automatically created which makes up for the remainder.

$09
Returns the absolute mouse position from now on. This command also sets
the coordinate maximums. The internal coordinate pointers are at the same
time set to zero. The following parameters are required:
1 word
1 word

Maximum X-coordinate
Maximum Y-coordinate

Mouse movements under the zero point or over the maximums are not
returned.

$OA
With this command it is possible to get the key numbers of the cursor keys
instead of the coordinates. A mouse movement then appears to the operating
system as if the corresponding cursor keys had been pressed. These
parameters are necessary:

75

Abacus Software

1 byte Number
number
sent.
1 byte Number
number

Atari ST Internals

of pulses (X) after which the key


for cursor left (or right) will be
of pulses (Y) after which the key
for cursor up (or down) will be sent.

$OB
This command sets the trigger threshold, above which movements will be
announced. A certain number of encoder pulses elapse before a package is
sent. This functions only in the relative operating mode. The following are
the parameters:
1 byte
1 byte

Threshold in X-direction
Threshold in Y-direction

$oc

Scale mouse. Here is determined how many encoder pulses will go by


before the coordinate counter is changed by 1. This command is valid only
in the absolute. The following parameters are required:
1 byte
1 byte

X scaling
Y scaling

$OD
Read absolute mouse position. No parameters are required, but a package of
the following form is sent:
1 byte
Header = $F7
1 byte
Button status
Bit 0 = 1 : Right button was pressed since the
last read
Bit 1 = 1: Right button was not pressed
Bit 2 = 1: Left button was pressed since the
last read
Bit 3 = 1 : Left button was not pressed

From this strange arrangement you can determine that the state of a button
has changed since the last read if the two bits pertaining to it are zero.
1 word Absolute X-coordinate
1 word Absolute Y-coordinate

76

Abacus Software

Atari ST Internals

$OE

Set the internal coordinate counter. The following parameters are required:
1 byte
1 word
1 word

=0 as fill byte
X-coordinate
Y-coordinate

$OF
Set the origin for the Y-axis is down (next to the user).

$10
Set the origin for the Y-axis is up.
$11
The data transfer to the main processor is permitted again (see $13).
Any command other than $13 will also restart the transfer.

$12
Turn mouse off. Any mouse-mode command ($08, $09, $OA) turns the
mouse back on. If the mouse is in mode $OA, this command has no effect.

$13
Stop data transfer to main processor.
NOTE: Mouse movements and key presses will be stored as long as the
small buffer of the 6301 allows. Actions beyond the capacity of the buffer
will be lost.

$14
Every joystick movement is automatically returned. The packages sent have
the following format:
1 byte
1 byte

Header = $FE or $FF for joystick 0/1


Bits 0-3 for the position (a bit for each
direction), bit 7 for the button

$15
End the automatic-return mode for the joystick. When needed, a package
must be requested with $16.
$16
Read joystick. After this command the keyboard sends a package as
described above.

77

Abacus Software

Atari ST Internals

$17
Joystick duration message. One parameter is required.
1 byte

Time between two messages in 1/100 sec.

From this point on, packages of the following form are sent continuously
(as long as no other mode is selected):
1 byte
1 byte

Bit 0 for the button on joystick 1, bit 1


for that of joystick 0
Bits 0-3 for the position of joystick I,
bits 4-7 for the position of joystick 0

NOTE: The read interval should not be shorter than the transfer channel
needs to send the two bytes of the package.

$18
Fire button duration message. The condition of the button in joystick 1 (!) is
continually tested and the result packed into a byte. This means that a
message byte contains 8 such tests, whereby bit 7 is the most recent. The
keyboard controller determines the time between byte fetches by the main
processor. This time is divided into eight equal intervals in which the button
is polled. The polling then takes place as regularly as possible. This mode
remains active until another command is received.

$19
Cursor key simulation mode for joystick 0 (!). The current position of the
joystick is sent to the main processor as if the corresponding cursor keys
had been pressed (as often as necessary). To avoid having to explain the
same things for the following parameters, here are the most important: All
times are assumed to be in tenths of seconds. R indicates the time, when
reached, cursor clicks will be sent in intervals of T. After this the interval is
V. If R=0, only V is responsible for the interval. Naturally, this mechanism
comes into play only when the joystick is held in the same position for
longer than T or R.
1 byte

RX

1 byte
1 byte

RY
TX

1 byte
1 byte
1 byte

TY
VX
VY

78

Abacus Software

Atari ST Internals

$1A
Turn off joysticks. Any other joystick command turns them on again.

$1B
Set clock time. This command sets the internal real-time clock in the
keyboard processor. The values are passed in packed BCD, meaning a digit
0-9 for each half byte, yielding a two-digit decimal number per byte. The
following parameters are necessary:
1 byte
1 byte
1 byte

Year, two digit (85, 86, etc.)


Month, two digit (12, 01, etc.)
Day, two digit (31,01,02, etc.)

1 byte

Hours, two digit

1 byte
1 byte

Minutes, two digit


Seconds, two digit

Any half byte which does not contain a valid BCD digit (such as F) is
ignored. This makes it possible to change just part of the date or clock time.

$1C
Read clock time. After receiving this command the keyboard processor
returns a package having the same format as the one described above. A
header is added to the package, however, having the value $FC.

$20
Load memory. The internal memory of the keyboard processor (naturally
only the RAM in the range $80 to $FF makes sense) can be written with this
command. It is not clear to us of what use this is since according to our
investigations (we have disassembled the operating system of the 6301), no
RAM is available to be used as desired. Perhaps certain parameters can be
changed in this manner which are not accessible through "legal" means.
Here are the parameters:
1 word
Start address
1 byte
Number of bytes (max. 128)
Data bytes (corresponding to the number)
The interval at which the data bytes will be sent must be less than 20 msec.

79

Abacus Software

Atari ST Internals

$21
Read memoiy. This command is the opposite of $20. These parameters are
required:

1 word

Address at which to read

A package having the following format is returned:


1 byte

Header 1 =$F6. This is the status header


which precedes all packages containing any
operating conditions of the keyboard
processor. We will come to the general
status messages shortly.
1 byte
Header 2 =$20 as indicator that this
package carries the memory contents.
6 bytes Memory contents starting with the address
given in the command.

Here is a small program which we used to read the ROM in the 6301 and
output it to a printer. Here you also see how the status packages arrive from
the keyboard. These are normally thrown away by the 68000 operating
system. Section 3.1 contains information about the GEMDOS and XBIOS
calls used.

i
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

prt
chout
gemdos
bios
xbios
stvec
rdm
wrkbd
kbdvec
term
start :
00000000
00000004
00000006
00000008
OOOOOOOE
00000014
0000001A
00000022

equ
equ
equ
equ
equ
equ
equ
equ
equ
equ

0
3
1
13
14
12
$21
25
34
0

move . w #kb
#kbdvec,-(a7)
trap
#xb
#xbios
addq . 1 #2,a7
#2,

3F3C0022
4E4E
548F
41F900000000
43F9000000D6

23C000000104
23FOOOOC00000100
2189000C

80

lea

0,a
0,aO

lea
move . 1
move . 1
move.1

key
keyin,al
dO,
dO,savea
StVi
stvec(aO,dO)
, save
al,stvec(aO,dO)

Atari ST Internals

Abacus Software

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

move . w #$fOOO,d4

00000026 383CFOOO
loop:

move . w d4,tbuf+l
keyout
bsr

0000002A 33C40000010A
00000030 61000084
wait:
00000034
0000003C
0000003E
00000042
00000044
00000046
0000004A
0000004C

cmpi.b
beq
move . w
bsr

#0,rbuf
wait
#6,d6
bufout
addq . w #6,d4
cmpi . w #$ffff,d4
bit
loop
exit
bra

OC390000000000F8
67F6
3C3C0006
610A
5C44
OC44FFFF
6DDE
6052
bufout :

lea

0000004E 49F9000000F9

rbuf+l,a4

bytout :
00000054
00000056
00000058
0000005A
0000005C

move . b (a4)+,dO
hexout
bsr
subq.b #l.d6
bne
bytout

101C
6106
5306
66F8
4E75

rts
hexout :

0000005E
00000060
00000062
00000068
0000006E
00000072
00000074
00000076
0000007C
00000080
00000082
00000084
00000086
00000088
0000008A
0000008C

3240
E808
02800000000F
47F9000000E8
14330000
E14A
3009
02800000000F
14330000
3002
3F02
E048
6108
301F
6104
103C0020

00000090
00000092
00000096
0000009A
0000009C
0000009E

3FOO
3F3COOOO
3F3C0003
4E4D
5C8F
4E75

movea . wdO,al
Isr.b
#4,dO
andi . 1 #15, dO
table, a3
lea
move . b 0(a3,dO),d2
Isl.w
#8,d2
move . w al,dO
andi . 1 #15, dO
move . b 0(a3,dO) ,
d2
move . w d2,dO
move . w d2,-(a7)
Isr .w
#8,dO
bsr
chrout
move . w (a7)+,dO
bsr
chrout
move . b #" ",dO
chrout :

65

move . w dO,-(a7)
move . w #prt,-(a7)
move . w #chout,-(a7)
trap
#bios
addq . 1 #6,a7
rts
exit:

66 OOOOOOAO 307900000104

movea

81

savea, aO

Abacus Software

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
88
89
90
91
92
93
94
95

OOOOOOA6
OOOOOOAC
OOOOOOBO
OOOOOOB4

203900000100
2140000C
3F3COOOO
4E41

OOOOOOB6
OOOOOOBE
OOOOOOC4
OOOOOOC8
OOOOOOCC
OOOOOOCE
OOOOOOD4

13FCOOOOOOOOOOF8
487900000109
3F3C0002
3F3C0019
4E4E
DFFC00000008
4E75

Atari ST Internals

move . 1
move . 1
move . w
trap

save/dO
dO,stvec(aO)
fterm, -<a7)
tgemdos

keyout :
move . b #0,rbuf

pea
move . w
move . w
trap
adda . 1

tbuf
#2,-(a7)
#wrkbd, -(a7)
txbios
#8,a7

rts
keyin:
move . b 18, dO
rbuf ,al
lea

OOOOOOD6 103C0008
OOOOOODA 43F9000000F8
repin :
OOOOOOEO
OOOOOOE2
OOOOOOE4
OOOOOOE6

move . b (aO)+, (al) +


subq.b #l,dO

12D8
5300
66FA
4E75

bne
rts

repin

dc.b

"0123456789ABCDEF"

table:
OOOOOOE8 3031323334353637
OOOOOOFO 3839414243444546
OOOOOOF8
00000100
00000104
00000108
00000109 21
0000010A
0000010C

rbuf:
save
savea
dummy
tbuf

ds.b
ds . 1
ds . 1
ds.b
dc.b

ds.b
.end

82

8
1
1
1

rdm
2

Abacus Software

Atari ST Internals

$22
Execute routine. With this command you can execute a subroutine in the
6301. Naturally, you must know exactly what it does and where it is
located, so long as you have not transferred it yourself to RAM with $20
(assuming you found some free space). The only required parameters are:
1 word

Start address

Status messages
You can at any time read the operating parameters of the keyboard by
simply adding $80 to the command byte with which you would to set the
operating mode (whose parameters you want to know). You then get a
status package back (header=$F6), whose format corresponds exactly to
those which would be necessary for setting the operating mode.
An example makes it clearer: you want to know how the mouse is scaled.
So you send as the command the value $8C (since $OC sets the scaling).
You get the following back:
1 byte Status header =$F6
1 byte X-scaling
1 byte Y-scaling
This is the same format which would be necessary for the command $OC.
For commands which do not require parameters, you get the evoked
command back as such. For example, say you want to know what operating
mode the joystick is in ($14 or $15). You send the value $94 (or $95, it
makes no difference). As status package you receive, in addition to the
header, either $14 or $15 depending on the operating mode of the joystick
handler.
Allowed status checks are: $87, $88, $89, $8A, $8B, $8C, $8F, $90, $92,
$94, $99, and $9A.
In conclusion we have a tip for those for whom the functions of the
keyboard are too meager and who want to give it more "intelligence". The
processor 6301 is also available in "piggy-back" version, the 63P01
(Hitachi). This model does not have ROM built in, but has a socket on the
top for an EPROM of type 2732 or 2764 (8K!). You can then realize your
own ideas and, for example, use the two joystick connections as universal
4-bit I/O ports, for which you can also extend the command set in order to
access the new functions from the XBIOS as well.

83

Atari ST Internals

Abacus Software

Figure 2.1.2-1 ATARI ST Key Assignments


to
H

O
4

0
H

h"
O

to

D
Id
09

A
O

to
to

H
H

!-
H

H
"I

O
Id
0

to
M

to

M
O

H
W

to

10

fl

!-
M

0
H
(II

10
Id

*O

Id

~a

t-
Id

id
Id

0
UI

10
*

09

O
*O

tn
^a

to
UI
U

t-

to
m

CO

Id

>

>

O
H

to

to
^J

Id

in

t-
>

to

D
O
0
O

a
U

to

l-

(D

O
O

pa
10

UI
U

Ot

Ol

01
M

01

01
09

0.
*

Oi

0,

at

at

ID

UI

ft.

at
at

-4
O

-J

td

-J

to

at

84

Abacus Software

Atari ST Internals

2.2 The Video Connection


Without this, nothing would be displayed. You would be tapping in the
dark in the truest sense of the word. Conspicuous are the many pins on the
connection. Naturally more lines are required for hooking up an RGB
monitor than for a monochrome screen, but seven would be enough. There
is also something special about the remaining lines. In Figure 2.2-1 you
find a block diagram in which you can see how the video connection is tied
to the system. The numbering of the pins is given on the figure on the next
page, as you can see, when you look at the connector from the outside.
Here is the pin layout:
1 AUDIO OUT. This connection comes from the amplifier
connected to the output of the sound chip. A high-impedance
earphone can be attached here if you do not use the original
monitor.
2 Not used
3 GPO, General Purpose Output. This connection is available for
your use. The line has TTL levels and comes from I/O port A bit 6
of the sound chip.
4 MONOCHROME DETECT. If this line, which leads to the 17
input of the MFP 68901, is low, the computer enters the
high-resolution monochrome mode. If the state of the line changes
during operation, a cold start is generated.
5 AUDIO IN leads to the input of the amplifier described in 1 and is
there mixed with the output of the sound chip.
6 GREEN is the analog green output of the video shifter.
7 RED. Red output.
8 GROUND.
9 HORIZONTAL SYNC is responsible for the horizontal beam
return of the monitor.

85

Atari ST Internals

Abacus Software

Figure 2.2-1 Diagram of Video Interface


16MHz
+ 5V

-DCYC
-CMPCS

R/-W
SHIFT

Al-5
10

DO-15

32MHz

11

-BLANK
3

GP O

AUDIO

OUT-

HSYNC

VSYNC

12
4
5

AUDIO

IN

-MONOMON

86

Abacus Software

Atari ST Internals

10 BLUE is the analog blue output of the video shifter.


11 MONOCHROME provides a monochrome monitor with the
intensity signal.
12 VERTICAL SYNC takes care of the beam return at the end of the
screen.
13 GROUND.
A tip for the hardware hobbyist:
A plug to fit this connector is not available. If you want to make a plug for
connecting other monitors, simply use a piece of perf board in which you
have soldered pins, since the pins are fortunately organized in a 1/10" array.
Pin 13 is out of order, but it is not needed since pin 8 is also available for
ground.

Figure 2.2-2 Monitor Connector

4
3

12

13

87

Abacus Software

Atari ST Internals

2.3 The Centronics Interface


A standard Centronics parallel printer can be connected to this interface,
provided that you have the proper cable. As you can see in Figure 2.3-2, the
connection to the system is somewhat unusual. The data lines and the strobe
of the universal port of the sound chip are used. So you find these too on
the picture, in which the other lines, which will not be described in the
section, will not disturb you. They belong to the disk drive and RS-232
interface and are handled there.
Here is the pin description:
I

-STROBE indicates the validity of the byte on the data lines


to the connected device by a low pulse.

2-9

DATA

I1

BUSY is always placed high by the printer when it is not


able to receive additional data. This can have various causes.
Usually the buffer is full or the device is off line.

18-15

GROUND.

All other pins are unused.


A tip for making a cable. Get flat-cable solderless connectors. You need a
type D25-subminiature, a Cinch 36-pin (3M,AMP) and the appropriate
length of 25-conductor flat ribbon cable. You squeeze the connectors on the
cable so that pins 1 match up on both sides (they are connected together).
The other connections then match automatically. Note that there will
naturally be some pins free on the printer side.

Figure 2.3-1 Printer Port Pins


13

\5

14

Abacus Software

Atari ST Internals

Figure 2.3-2 Centronics Connection


R/-W

-SNDCS

Al

SOUND

2 MHz

-RESET
11

D8-15

IO/TA1
GPO

DRIVEO
DRIVE1
SIDEO
RTS

DTR

AUDIO

AUDIO OUT

IN

89

Abacus Software

Atari ST Internals

2.4 The RS-232 Interface


This interface usually serves for communication with other computers and
modems. You can also connect a printer here. Note the description of pin 5!
Figure 2.4-1 shows the connection to the system. Normally you don't have
to do any special programming to use this interface. It is taken care of by the
operating system. Here the control of the interface is not controlled by a
special 1C (UART) as is usually the case, but the lines are serviced more or
less "by hand." The shift register in the MFP is used for this purpose. The
handshake lines however come from a wide variety of sources. Note this in
the following pin description:
1

CHASSIS GROUND (shield)


This is seldom used.

TxD
Send data

RxD
Receive data

RTS
Ready to send comes from I/O port A bit 3 of the sound
chip and is always high when the computer is ready to
receive a byte. On the Atari, this signal is first placed low
after receiving a byte and is kept low until the byte has
been processed.

CTS
Clear to send of a connected device is read at interrupt
input 12 of the MFP. At the present time this signal is
handled improperly by the operating system. Therefore it
is possible to connect only devices which "rattle" the line
after every received byte (like the 520ST with RTS). The
signal goes to input 12 of the MFP, but unfortunately is
tested only for the signal edge. You will not have any luck
connecting a printer because they usually hold the CTS
signal high as long as the buffer is not full. There is no
signal edge after each byte, which means that only the
first byte of a text is transmitted, and then nothing.
90

Abacus Software

Atari ST Internals

GND
Signal ground.

BCD
Carrier signal detected. This line, which goes to interrupt
input II of the MFP, is normally serviced by a modem,
which tells the computer that connection has been made
with the other party.

20

DTR
Device ready. This line signals to a device that the
computer is turned on and the interface will be serviced as
required. It comes from I/O port A bit 4 of the sound
chip.

22

RI
Ring indicator is a rather important interrupt on 16 of the
MFP and is used by a modem to tell the computer that
another party wishes connection, that is, someone called.

91

Abacus Software

Atari ST Internals

Figure 2.4-1 RS-232 Connection


2

so

I/OA4

20

I/OA3

SI

I
II

16

12

22

II

13

7
25

14
92

Abacus Software

Atari ST Internals

2.5 The MIDI Connections


The term MIDI is probably unknown to many of you. It is an abbreviation
and stands for Musical Instrument Digital Interface, an interface for musical
instruments.
It is certainly clear that we can't simply hook up a flute to this port. So first
a little history. Music professionals (more precisely: keyboardists,
musicians who play the synthesizer) demanded agreement between the
various manufacturers to interface computers to musical instruments. They
found it absurd to connect complicated set-ups with masses of wire. The
idea was to service several synthesizers from one keyboard.
The tone created was basically analog (and still is, to a degree), so that the
manafacturers agreed that a control voltage difference of IV corresponded to
a difference in tone of 1 octave. This way one could play several devices
under "remote control," but not service them.
This changed substantially when the change was made to digital tone
creation. Here one didn't have to turn a bunch of knobs, there were buttons
to press, whereby the basis for digital control was created.
Some manufacturers got together and designed a digital interface, the basic
commands of which would be the same throughout, but which would still
support the additional features of a given device.
The device is based on the teletype, the current-loop principle, which is not
very susceptible to noise, but significantly faster. The transfer rate is 31250
baud (bits per second). The data format is set at one start bit, eight data bits,
and one stop bit
An 1C can therefore be used for control which would otherwise be used for
RS-232 purposes. You see the connection to the system in figure 2.5-1.
Logically, MIDI is multi-channel system, meaning that 16 devices can be
serviced by one master, or a device with 16 voices. These devices are all
connected to the same line (bus principle). To identify which device or
which voice is intended, each data packet is preceded by the channel
number. The device which recognizes mis number as its own then executes
the desired action.

93

Abacus Software

Atari ST Internals

You may wonder what such an interface is doing in a computer. A computer


can provide an entire arsenal of synthesizers with settings or complete
melodies (sequencer) because of its high speed and memory capacity. It can
also be used to record and store input from a synthesizer keyboard.
For this purpose the ST has the interfaces MIDI-ESf and MIDI-OUT. The
interfaces are even supported by the XBIOS so you don't have to worry
about their actual operation.
The current loop travels on pins 4 and 5, out through pin 4 (+) of
MIDI-OUT and in at 5, when a device is connected.
For MIDI-IN the situation is reversed because the current flows in through
pin 4 and back out through pin 5. It goes though something called an
optocoupler which electrically isolates the computer from the sender.
The receive data are looped back to MEDI-OUT (pins 1 and 3), which
implements the MIDI-THRU function, although not entirely according to
the standard.

94

Abacus Software

Atari ST Internals

Figure 2.5-1 MIDI System Connection

+5V

14

95

Atari ST Internals

Abacus Software

2.6 The Cartridge Slot

The cartridge slot can be used exclusively for inserting ROM cartridges. Up
to 128K in the address space $FAOOOO to $FBFFFF can be addressed. The
reason we stressed the exclusivity of the read access is the following. We
thought it would be practical to outfit a cartridge with RAM and then load
programs into it after the system start which would still remain after a reset
In order to try this we brought the R/-W signal to the outside. The
experience taught us, however, that a write access to these addresses creates
a bus error. The GLUE takes care of this. As you see, nothing is left to
chance in the Atari.

Figure 2.6-1 The Cartridge Slot


4HD
D
D
D
D

5 V
5 V
14
15
12
13
1O

D 11
D8
D9
D6
D7
D4
D5
D2
D3
DO
Dl
A 13
A 16

2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3 0
31
3 2
33
3 4
3 5
3 6
3 7
38
3 9
4 0

2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18
19
2 0

A 8
A 14
A 7
A 9
A 6
A 10
A 5
A 12
All
A 4
-ROM3
A 3
- ROM4
A 2
-DOS
A 1
- LDS
G N D
G N D
G ND

Posit.ion :
1

20

21

40

96

Abacus Software

Atari ST Internals

2.7 The Floppy Disk Interface

The interface for floppy disk drives is conspicuous because of the unusual
connector, a 14-pin DIN connector. All of the signals required for the
operation of two disk drives are available on it.
You know most of the signals from the description of the disk controller
1772, since nine of the available connections are directly or via a buffer
connected to the controller. Only the drive select 1 and drive select 2 signals
and the side 0 select are not derived from the disk controller. These signals
come from port A of the sound chip.
Pinout of the disk connector:
1
2
3
4
5
6
7

READ DATA
SIDE 0 SELECT
GND
INDEX
DRIVE 0 SELECT
DRIVE 1 SELECT
GND

8
9
10
11
12
13
14

97

MOTOR ON
DIRECTION IN
STEP
WRITE DATA
WRITE GATE
TRACK 00
WRITE PROTECT

Abacus Software

Atari ST Internals

Figure 2.7-1 Disk Connection


CDO-7

YSS/S/SSA

CA2
CA1

FDC
CR/-W
10
-FDCS

-RESET

8
8MHz

4
1

I/OA2

I/OA1

I/OAO

10

FDRQ
INTR

98

Abacus Software

Atari ST Internals

2.8 The DMA Interface


Up to 8 external devices can be connected to this 19-pin subminiature D
connector. Such devices include hard disks, networks, and also
coprocessors. The communication between the external devices and the ST
runs at speeds up to 1 million bytes per second. Unfortunately, no
experiments with DMA devices could be performed at the time this was
printed. For this reason we cannot make the following statements with one
hundred percent certainty.
The RESET line on pin 12 permits devices to be reset by the Atari. If this
pin is low, as is the case when the Atari is turned on or when executing a
RESET command, external devices are placed in a defined power-up state,
without having to individually turn each device off and then on again.
Since most of the external devices will use a controller 1C, the signal CS,
Chip Select on pin 9, must also be available. The signal Al is also to be
seen in connection with this, because it is then important if the controller has
more than just one register. This signal can distinguish between two
registers.
The data transfer takes place over the bidirectional data bus on pins 1 to 8.
The R/W line on the DMA bus determines the direction of the data transfer.
The DMA chip can either write data to the bus (R/W is high), or read data
from the bus (R/W is low). Data can be read or written only on the request
of the external device. The release of a transfer is signaled by the signal
DRQ (pin 19).
The ACK signal on pin 14 appears to be a purely hardware-dependent
confirmation of the DRQ signal. The actual significance could not be
checked however.
The last signal on the DMA port is the INT input. A low on this connection
can generate an interrupt The hard disk, for example, signals the end of the
command through a low. The interrupt uses the same interrupt input on the
MFP as the disk controller. This is input I/O 5. This means the at the floppy
disk drive and the hard disk cannot transfer data together. The DMA is also
not in such a position since it has only one DMA channel available.
The interrupt of this input is disabled in the MFP internally because the
floppy as well as the hard disk routines check the port bit in a loop in order
99

Abacus Software

Atari ST Internals

to determine the end of the command. This simplifies the implementation of


the time out, which is always generated when the floppy or hard disk has
not reacted to the command within a certain length of time.

Figure 2.8-1 DMA Port


10
i
11

19

Figure 2.8-2 DMA Connections

-RESET

15
INTR

100

Chapter 3
f

f*.

3.1
3.1.1
3.2
3.3
3.4
3.4.1
3.4.2
3.5
3.5.1
3.6
3.7
3.8
3.8.1
3.8.2
3.9

The ST Operating System

The GEMDOS
GEMDOS error codes and their meaning
The BIOS Functions
The XBIOS
The Graphics
An overview of the line-A variables
Examples for using the line-A opcodes
The Exception Vectors
The interrupt structure of the ST
The ST VT52 Emulator
The ST System Variables
The 68000 Instruction Set
Addressing modes
The instructions
The BIOS listing

Abacus Software

Atari ST Internals

The ST Operating System


GEMDOSwhat is it? Is it in the ST? The operating system is supposed to
be TOS, though. Or CP/M 68K? Or what?
This question can be answered with few words. The operating system in the
ST is named TOSTramiel Operating System-after the head of Atari. This
TOS, in contrast to earlier information has nothing to do with CP/M 68K
from Digital Research. At the start of development of the ST, CP/M 68K
was implemented on it, but this was later changed because CP/M 68K is not
exactly a model of speed and efficiency. A 68000 running at 8MHz and
provided with DMA would be slowed considerably by the operating
system.
At the beginning of 1985, Digital Research began developing a new
operating system for 68000 computers, which would include a user-level
interface. This operating system was named GEMDOS. It is exactly this
GEMDOS which makes up the hardware-independent part of TOS. Like
CP/M, TOS consists of a hardware-dependent and a hardware-independent
part. The hardware-dependent part is the BIOS and the XBIOS, while the
hardware-independent part is called GEMDOS. A large number of functions
are built into GEMDOS, through which the programmer can control the
actual input/output functions of the computer. Functions for keyboard input,
text output on the screen or printer, and the operation of the various other
interfaces are all present. Another quite important group contains the
functions for file handling and for logical file and disk management

103

Abacus Software

Atari ST Internals

3.1 The GEMDOS


When you look at the functions available under GEMDOS, you will
eventually come to the conclusion that the whole thing is not really new. All
the functions in GEMDOS are very similar to the functions of the MS-DOS
operating system. Even the functions numbers used correspond to those of
MS-DOS. But not all MS-DOS functions are implemented in GEMDOS.
Especially in the area of file management, only the UNIX compatible
functions are implemented in GEMDOS. The "old" block-oriented
functions which are included in MS-DOS to maintain compatibility with
CP/M are missing from GEMDOS. Also, special functions relating to the
hardware of MS-DOS computers (8088 processor) are missing.
Another essential difference between MS-DOS and GEMDOS is that for
GEMDOS calls as well as for the BIOS and XBIOS, the function number,
the number of the desired GEMDOS routine, and the required parameters
are placed on the stack and are not passed in the registers. The 68000 is
particularly suited to this type of parameters passing. GEMDOS is called
with TRAP # 1 and the function is executed according to the contents of
the parameter list After the call, the programmer must put the stack back in
order himself, by clearing the parameters from memory.
The basic call of GEMDOS functions differs from the BIOS and XBIOS
calls only in the trap number.
In regard to all GEMDOS calls, it must be noted that registers DO and AO
are changed in all cases. If a value is returned, it is returned in DO, or DO
may contain an error number, and after the call AO (usually) points to the
stack address of the function number. Any parameters required in DO or AO
must be placed there before GEMDOS is called.
The remainder of this section describes the individual GEMDOS functions.

104

Abacus Software

Atari ST Internals

$00 TERM
Calling GEMDOS with function number 0 ends the running program and
returns to the program from which it was started. For applications,
programs started from the desktop, program control is returned to the
desktop. If the program was called from a different program, execution is
passed back to the calling program. This point is important for chaining
program segments.

CLR.W
TRAP

-(SP)

$01 CONIN
CONIN fetches a single character from the keyboard. The routine waits
until a character is available. The result, the character read from the
keyboard, is returned in the DO register. The ASCII code of the pressed key
is returned in the low byte of the low word, while the low byte of the high
word of the register contains the scan code returned from the keyboard.
This is important when reading keys which have no ASCII code. This
applies to the 10 function keys or the keys of the cursor block, for example.
These keys return the ASCII value zero when pressed.
If needed, the scan code can be used to determine if the digits on the keypad
or the main keyboard were pressed, since these keys have identical ASCII
codes, but return different scan codes.

MOVE.W #1,-(SP)
TRAP
#1
ADDQ.L #2,SP

* Function number on the stack


* Call GEMDOS
* Correct stack

105

Abacus Software

Atari ST Internals

$02 CONOUT
CONOUT represents the simplest and most primitive character output of
GEMDOS. With this function only one character is printed on the screen.
The character to be displayed is placed on the stack as the first word. The
ASCII value of the character to be printed must be in the low byte of the
word and the high byte should be zero.
The character printed by CONOUT is outputted to device number 2, the
normal console output. Control characters and escape sequences are
interpreted normally.

MOVE.W
MOVE.W
TRAP
ADDQ.L

#'A',-(SP)
#2,-{SP)
#1
#4,SP

*
*
*
*

Output an A
CONOUT
Call GEMDOS
Correct stack

$03 AUXILLIARY INPUT


Under the designation "auxilliary port" is the RS-232 interface of the ST.
A character can be read from the interface with the function CAUXIN. The
function returns when a character has been completely received. The
character is returned in the lower eight bits of register DO.

$04 AUXILLIARY OUTPUT


Similar to the input of characters via the serial interface, a character can be
sent with this function. With this function the programmer should clear the
upper eight bits of the word and pass the character to be sent in the lower
eight bits.

106

Abacus Software

Atari ST Internals

$05 PRINTER OUTPUT


PRINTER OUTPUT is the simplest method of operating a printer connected
to the Centronics interface. One character is printed with each call.
An important part of PRINTER OUTPUT is the return value in DO. If the
character was sent to the printer, the value -1 ($FFFFFFFF) is returned in
DO. If, after 30 seconds, the printer was unable to accept the character (not
turned on, OFF LINE, no paper, etc.), GEMDOS returns a time out to the
program. DO then contains a zero.

MOVE.W
MOVE.W
TRAP
ADDQ.L
TST.W
BEQ

#'A',-(SP) *
#5,-(SP)
*
#1
*
#4,SP
*
DO
*
printererror

Output an A
Function number
Call GEMDOS, output character
Correct stack
Affect flags

$06 RAWCONIO
RAWCONIO is a somewhat unusual mixture of keyboard input and screen
output and receives a parameter on the stack.
With a function value of $FF the keyboard is tested. If a character is
present, the ASCII code and scan code are passed in DO as described for
CONIN. But if no key value is present, the value zero is passed as both the
ASCII code and the scan code in DO. The call to RAWCONIO with
parameter $FF is comparable to the BASIC BSTKEYS function.
If a value other than $FF is passed to the function, the value is interpreted as
a character to be printed and it is output at the current cursor position. This
output also interprets the control characters and escape sequences properly.

107

Atari ST Internals

Abacus Software

START:
MOVE.W
MOVE.W
TRAP
ADDQ.L
TST.W
BEQ
CMP.B
BEQ
MOVE
MOVE
TRAP
ADDQ.L
BRA

#$FF,-(SP)
#6,-<SP)
#1
#4,SP
DO
START
#3, DO
END
DO,-(SP)
#6,-<SP)
fl
#4,SP
START

*
*
*
*
*
*
*

Function value test keyboard


Function number
Call GEMDOS, test keyboard
Correct stack
Character arrived?
Not yet
AC selected as the end marker

*
*
*
*
*

Character for output on the stack


Function number
Call GEMDOS, test keyboard
Correct stack
Get new character

$07 DIRECT CONIN WITHOUT ECHO


The function $07 differs from $01 only in that the character received from
the keyboard is not displayed on the screen. It waits for a key just as does
CONIN.

$08 CONIN WITHOUT ECHO


Function $08 does not differ from function $07. Both function calls have
exactly the same effect The reason for this seemingly nonsensical behavior
lies in the mentioned compatibility to MS-DOS. Under MS-DOS the two
functions are different in that with $08, certain keys not present on the
ATARI are evaluated correctly, while this evaluation does not take place
with function $07.

108

Abacus Software

Atari ST Internals

$09 PRINT LINE


You have already become familiar with functions to output individual
characters on the screen with CONOUT and RAWCONIO. PRINT LINE
offers you an easy way to output text. An entire string can be printed at the
current cursor position with this function. To do this, the address of the
string is placed on the stack as a parameter. The string itself is concluded
with a zero byte. Escape sequences and control characters can also be
evaluated with this function.
After the call, DO contains the number of characters which were printed.
The length of the string is not limited.

MOVE.L
MOVE
TRAP
ADDQ.L

#text,-(SP)
#$09,-(SP)
#1
#6,SP

*
*
*
*

Address of the string on the stack


Function number PRT LINE
Call GEMDOS
"Clean up" the stack

text

.DC.B 'This is the string to be printed',$OD,$OA,0

$OA HEADLINE
HEADLINE is a very easy-to-use function for reading characters from the
keyboard. In contrast to the "simpler" character-oriented input functions, an
entire input line can be fetched from the keyboard with HEADLINE. The
characters entered are displayed on the screen at the same time.
The address of an input buffer is passed to the function as the parameter.
The value of the first byte of the input buffer determines the maximum
length of the input line and must be initialized before the call. At the end of
the routine, the second byte of the buffer contains the number of characters
entered. The characters themselves start with the third byte.
The routine used by HEADLINE for keyboard input is quite different from
the character-oriented console inputs. Escape sequences are not interpreted
during the output. Only control characters like control-H (backspace) and
control-I (TAB) are recognized and handled appropriately. The following
control characters are possible:

109

Abacus Software
AC
AH
AI

AJ
AM
AR
A

U
X

Atari ST Internals

Ends input AND program (!)


Backspace one position
TAB
Linefeed, end input
CR, end input
Entered line is printed in new line
Don't count line, start new line
Clear line, cursor at start of line

A function like AH, deleting a character entered, is useful, but for large
programs you should write your own input routine because AC is very
"dangerous." Unlike CP/M, the program will be ended even if the cursor is
not at the very start of the input line.
If more characters are entered than were indicated in the first byte of the
buffer at the initialization, the input is automatically terminated. If the input
is terminated by ENTER, AJ, or AM, the terminating character will not be
put in the buffer.
After the input, DO contains the number of characters entered, excluding
ENTER, which can be found at buffer+1.

$OB CONSTAT
All key presses are first stored in a buffer in the operating system. This
buffer is 64 bytes in length. The key values stored there are taken from the
buffer when a call to a GEMDOS output routine is made.
CONSTAT can be used to check if characters are stored in the keyboard
buffer. After the call, DO contains the value zero or $FFFF. A zero in DO
indicates that no characters are available.

$OE SETDRV
The current drive can be determined with the function SETDRV. A 16-bit
parameter containing the drive specification is pased to the routine. Drive A
is addressed with the number 0 and drive B with the number 1.
After the call, DO contains the number of the drive active before the call.

110

Abacus Software

Atari ST Internals

$10 CONOUT STAT


CONOUT STAT returns the status of the console in DO. If the value $FFFF
is returned, a character can be displayed on the screen. If the returned value
is zero, however, no character output is possible on the screen at that time.
Incidently, all attempts to create a not-ready status at the console failed. The
only imaginable possibility for the not-ready status would be if the output of
the individual bit pattern of a character was interrupted and the interrupt
routine itself tried to output a character. This case could not, however, be
created.

$11 PRTOUT STAT


This function returns the status, the condition of the Centronics interface. If
no printer is connected (or turned off, or off line), DO contains the value
zero after the call to indicate "printer not available." If, however, the printer
is ready to receive, DO contains the value $FFFF.

$12 AUXIN STAT


By calling AUXIN STAT you can determine if a character is available from
the receiver of the serial interface ($FFFF) or not ($0000). As with all other
functions, the value is returned in DO.

$13 AUXOUT STAT


AUXpUT STAT gives information about the state of the serial bus. A value
of $FFFF indicates that the serial interface can send a character, while zero
indicates that no characters can be sent at this time.

$19 CURRENT DISK


For many applications it is necessary to know which drive is currently
active. The current drive can be determined by the function $19. After the
call, DO contains the number of the drive. The significance of the drive
numbers is the same as for $OE, SET DRIVE (0=A, 1=B).

Ill

Abacus Software

Atari ST Internals

$1A SET DISK TRANSFER ADDRESS


The disk transfer address is the address of a 44-byte buffer required for
various disk operations (especially directory operations). Along with the
GEMDOS functions SEARCH FIRST and SEARCH NEXT are examples
for using the DTA.

MOVE.L
MOVE.W
TRAP
ADDQ.L

#DTADDRESS,-(SP)
#$1A,-(SP)
#1
#6,SP

*
*
*
*

Address of the 44-byte DTA buffer


Function number SET DTA
Set DTA
Clean up the stack

$20 SUPER
This function is especially interesting for programmers who want to access
the peripheral components or system variables available only in the
supervisor mode while running a program in the user mode. After calling
this function from the user mode, the 68000 is placed in the supervisor
mode. In contrast to the XBIOS routine for enabling the supervisor mode,
additional GEMDOS, BIOS, and XBIOS calls can be made after a
successful SUPER call.
First we will look at the case in which the SUPER function is called from a
program in the user mode with a value of zero on the stack. In this case the
program finds itself in the supervisor mode after the call. The supervisor
stack pointer is set to the value of the user stack pointer and the original
value of the supervisor stack pointer is returned in DO. This value should be
stored by the program in order to get back into the user mode later.
If a value other than zero is passed to the SUPER function the first time it is
called, this value is interpreted as the desired value of the supervisor stack
pointer. In this case as well, DO contains the original value of the supervisor
stack pointer, which the program should save.
Before a program ends, the user mode should be reenabled. This change of
operating modes requires the address acquired the first time the routine was
called in order to set the supervisor stack pointer back to its original value.

112

Abacus Software

Atari ST Internals

The SUPER function differs from all other GEMDOS functions in one very
important respect Under certain circumstances, this call can also change the
contents of Al and Dl. If you store important values in these registers, you
must save the values somewhere before calling the SUPER function.

CLR.L -(SP)
MOVE.W #$20,-(SP)
TRAP
#1
ADD.L $6,SP
MOVE.L DO,_SAVE_SSP

*
*
*
*
*
*
*

The 6800 is in the user mode


User stack becomes supervisor stack
Call SUPER
The supervisor mode is active
after the TRAP
DO = old supervisor stack
Save value

Here processing can be done in the supervisor mode

MOVE.L
MOVE.W
TRAP
ADD.L

_SAVE_SSP,-(SP) * Old supervisor stack pointer


#$20f-(SP)
* Call SUPER
#1
* Now we are back in the user mode
#6,SP

$2A GET DATE


You have no doubt experimented with the status field at one time or another.
In addition to various other functions, the status field contains a clock with
clock time and date. It can be useful for some applications to have the data
available. The date can be easily determined by the GET DATE function.
This function call requires no parameters and makes the date available in the
low word of register DO. It is rather thoroughly encoded, though, so that
the result in DO must be prepared in order to get the correct date.
The day in the range 1 to 31 is coded in the lower five bits. Bits 5 to 8
contain the month in the value range 1 to 12, and the year is contained in
113

Abacus Software

Atari ST Internals

bits 9 to 15. The value range in these "year bits" goes from 0 to 119. The
value of these bits must be added to the value 1980 in order to get the actual
year. The date 12/12/1992, for example, would result in $198C in DO. This
can be represented in binary as %0001100.1100.01100. The lengths of the
three fields are marked with periods.

$2B SET DATE


The clock time and date can also be set from application programs. This is
particularly interesting for programs which use the date and/or clock time.
An example of this would be invoice processing in which the current date is
inserted in the invoice. Such programs can then ask the user to enter the
date. This avoids the problems that occur if the user forgets to set the date
and clock time on the status field beforehand.
The date must be passed to the function SET DATE in the same format as it
is received from GET DATE, bits 0-4 = day, bits 5-8 = month, bits 9-15 =
year-1980.

MOVE.W
MOVE.W
TRAP
ADDQ.L

#%101101011001,-(SP)
i$2B,-(SP)
fl
#6,SP

*
*
*
*

Set date to 10/25/1985


Function number of SET DATE
Set date
Repair stack

$2C GET TIME


The function GET TIME returns the current (read: set) time from the
GEMDOS clock. Similar to the date, the clock time is coded in a special
pattern in individual bits of the register DO after the call. The seconds are
represented in bits 0-4. But since only values from 0 to 31 can be
represented in 5 bits, the internal clock runs in two second increments. In
order to get the correct seconds-result the contents of these five bits must be
multiplied by two. The number of minutes is contained in bits 5 to 10, while
the remaining bits 11-15 give information about the hour (in 24-hour
format).

114

Abacus Software

Atari ST Internals

$2D SET TIME


It is also possible to set the clock time under GEMDOS. The function SET
TIME expects a 16-bit value (word) on the stack, in which the time is coded
in the same form as that in which GET TIME returns the clock time.

MOVE.W
MOVE.W
TRAP
ADDQ.L

#%1000101010111101,-(SP)
f$2D,-<SP)
#1
f6,SP

*
*
*
*

Clock time 17:21:58


Function # of GET TIME
Set date
Repair stack

$2F GET DTA


The function $2F is the counterpart of function $1 A, SET DTA. A call to
this function returns the address of the current disk transfer buffer in DO.
An exact explanation of this buffer is found together with the functions
SEARCH FIRST and SEARCH NEXT.

$30 GET VERSION NUMBER


Calling this function returns in DO the version number of GEMDOS. In the
version of GEMDOS currently in release, this question is always answered
with $ODOO, corresponding to version 13.00. Official Atari documentation
claims that a value of $0100 should be returned for this version, though
perhaps the value should indicate that the present GEMDOS version is the
$D = diskette version.

$31 KEEP PROCESS


This function is comparable to the GEMDOS function TERM $00. The
program is also ended after a call to this function. $31 does differ from $00
in several important points.
After processing TRAP #1, like TERM, control is passed back to the
program which started the program just ended. In contrast to TERM, a
termination condition can be communicated to the caller. While TERM

115

Abacus Software

Atari ST Internals

returns the termination value zero (no error), zero or one may be selected as
the termination value for $31. A value other than zero means that an error
occurred during program processing.
Another essential point lies in the memory management of GEMDOS. When
a program is started, the entire available memory space is made available to
it. If the program is ended with TERM, the memory space is released and
made available to GEMDOS. The entire area of memory released is also
cleared, filled with zeros. The program actually physically disappears from
the memory. With function $31, however, an area of memory can be
protected at the start address of the program. This memory area is not
released when the program is ended and it is also not cleared. The program
could be restarted without having to load it in again.
KEPP PROCESS is called with two parameters. The example programs
shows the parameter passing.

MOVE.W
MOVE.L
MOVE.W
TRAP

#0,-(SP)
#$1000,-<SP)
#$31,-(SP)
#1

* Error code no error, else 1


* Protect $1000 bytes at program start
* Function number, end program
*
now

$36 GET DISK FREE SPACE


It can be very important for disk-oriented programs to determine the amount
of free space on the diskette. Then you have the ability to request that the
user change disks at the appropriate time. "Disk full" messages or even data
loss can then be avoided.
Function $36 returns exactly this information. The number of the desired
disk drive and the address of a 16-byte buffer must be passed to the
function. If the value 0 is passed as the drive number, the information is
fetched from the active drive, a 1 takes the information from drive A, and a
2 from drive B.
The information passed in the buffer is divided into four long words. The
first long word contains the number of free allocation units. Each file, even
if it is only eight bytes long, requires at least one such allocation unit

116

Abacus Software

Atari ST Internals

The second long word gives information about the number of allocation
units present on the disk, regardless of whether they are already used or are
still free. For the "small," single-sided diskettes this value is $15C or 351,
while the double-sided disks have $2C7 = 711 allocation units. The third
long word contains the size of a disk sector in bytes. For the Atari this is
always 512 bytes ($200 bytes).
In the last word is the number physical sectors belonging to an allocation
unit. This is normally 2. Two sectors form one allocation unit.
The number of available bytes of disk space can easily be calculated from
this information.

MOVE.W
MOVE.L
MOVE
TRAP
ADDQ.L

#0,-<SP)
#BUFFER,-(SP)
#$36,-(SP)
fl
#8,SP

.bss
BUFFER:
f real : .ds .1
total: .ds .1
bps:
.ds .1
pspal: .ds .1

1
1
1
1

* Information from the active drive


* Address of the 16-byte buffer
* Function number
* Clean up stack

*
*
*
*

Free allocation units


Total allocation units
Bytes /physical sector
Phys . sectors/alloc. unit

$39 MKDIR
A subdirectory can be created from the desktop with the menu option "NEW
FOLDER". Such a subdirectory can also be created from an application
program with a call to $39.
In order to create a new folder, the function $39 is given the address of the
folder name, also called the pathname. This name may consist of 8
characters and a three-character extension. The same limitations apply to
pathnames as do to filenames. The pathname must be terminated with a zero
byte when calling MKDIR.
117

Abacus Software

Atari ST Internals

After the call, DO indicates whether the operation was performed


successfully. If DO contains a zero, the call was successful. Errors are
indicated through a negative number in DO. At the end of this chapter you
will find an overview of all of the error messages occurring on connection
with GEMDOS functions.

MOVE.L
MOVE
TRAP
ADDQ.L
TST.W
BNE

^pathname
#$39,-(SP)
#1
#6,SP
DO
error

pathname:
.dc.b

* Address of the pathname


* Function number
* Repair stack
* Error occurred?
* Apparently

'private.dat',0

$3A RMDIR
A subdirectory created with MKDIR can be removed again with $3A. As
before, the pathname, terminated with a zero, is passed to RMDER. The
error messages also correspond to those for MKDIR, with zero for success
or a negative value for errors. An important error message should be
mentioned at this point. It is the message -36 ($FFFFFFCA). This is the
error message you get when the subdirectory you are trying to remove
contains files.
Only empty subdirectories can be removed with RMDIR. In the event of the
described error message, one must first erase all of the files in the directory
with UNLINK ($41) and then call RMDIR again.

118

Abacus Software

Atari ST Internals

$3B CHDIR
The system of subdirectories available under GEMDOS is exactly the same
form available under UNIX. This system is now running on systems with
diskette drives, but its advantages become noticeable first when a large mass
storage device such as a hard disk with several megabytes of storage
capacity is connected to the system. After a while, most of the time would
probably be spent looking for files in the directory.
To better organize the data, subdirectories can be placed within
subdirectories. It can therefore become necessary to specify several
subdirectories until one has the directory in which the desired file is stored.
An example might be:
/hugos.dat/cflies.s/csorts.s/cqsort.s
Translated this would mean: load the file cqsort. s from the subdirectory
csorts . s. This subdirectory csorts . s is found in the subdirectory
cf lies . s, which in turn is a subdirectory of hugos . dat. If the whole
expression is given as a filename, the desired file will actually be loaded
(assuming that the file and all of the subdirectories are present). If you want
to access another file via the same path (do you understand the term
pathname?), the entire path must be entered again. But you can also make
the subdirectory specified in the path into the current directory, by calling
CHDIR with the specification of the desired path. After this, all of the files
in the selected subdirectory can be accessed just by the filenames. The path
is set by the function.

MOVE.L
MOVE.W
TRAP
ADDQ.L
TST.W
BNE

#path,-(SP)
#$3B,-(SP)
#1
#6,SP
DO
error

* Address of the path


* Function number
* Repair stack
* Error occurred?
* Apparently

path:
.dc.b

'/hugos.dat/private.dat/', 0

119

Abacus Software

Atari ST Internals

$3C CREATE
In all operating systems, the files are accessed through the sequence of
opening the file, accessing the data, (reading or writing), and then closing
the file. This "trinity" also exists under GEMDOS, although there is an
exception. Under CP/M, for example, a non-existing file can also be
opened. When a file which does not exist is opened, it is created. Under
GEMDOS, the file must first be created. The call $3C, CREATE, is used
for this purpose. Two parameters are passed to this GEMDOS function: the
address of the desired filename, and an attribute word.
If a zero is passed as the attribute word, a normal file is created, a file which
can be written to as well as read from. If the value 1 is passed as the
attribute, the file will only be able to be read after it is closed. This is a type
of software write-protect (which naturally cannot prevent the file from
disappearing if the disk is formatted).
Other possible attributes are $02, $04, and $08. Attribute $02 creates a
"hidden" file and attribute $02 a "hidden" system file. Attribute $08 creates
a file with a "volume label." The volume label is the (optional) name which
a disk can be given when it is formatted. The disk name is then created from
the maximum of 11 characters in the name and the extension. Files with one
of the last three attributes are excluded from the normal directory search. On
the ST, however, they do appear in the directory.
When the function CREATE is ended, a file descriptor, also called a file
handle, is returned in DO. All additional accesses to the file take place over
this file handle (a numerical value bewteen 6 and 45). The handle must be
given when reading, writing, or closing files. A total of $28 = 40 files can
be opened at the same time.
If CREATE is called and a file with this name already exists, it is cut off at
zero length. This is equivalent to the sequence delete the old file and create a
new file with the same name, but it goes much faster.
If after calling CREATE you get a handle number back in DO, the file need
not be opened again with $3D OPEN.

120

Atari ST Internals

Abacus Software

MOVE.W
MOVE.L
MOVE.W
TRAP
ADDQ.L
TST
BMI
MOVE

#$0,-(SP)
#filename,-(SP)
#$3C,-(SP)
#1
#8,SP
DO
error
DO,handle

filename:
.dc.b

*
*
*
*
*
*
*
*

File should have R/W status


Address of the filename on stack
Function number
Call GEMDOS
Clean up stack
Error occurred?
It appears so
Save file handle

* Don't forget zero byte


'myfile.dat',0

handle:

. ds. w

$3D OPEN
You can create only new files with CREATE, or shorten existing files to
length zero. But you must be able to process existing files further as well.
To do this, such files must be opened with the OPEN function.
The first parameter of the OPEN function is the mode word. With a zero in
the mode word, the opened file can only be read, with one it can only be
written. With a value of 2, the file can be read as well as written. The
filename, terminated with zero byte in the usual manner, is passed as the
second parameter.
The OPEN function returns the handle number in DO as the result if the file
is present and the desired access mode is possible. Otherwise DO contains
an error number. See the end of the chapter for a list of the error numbers.

121

Abacus Software

MOVE.W
MOVE.L
MOVE.W
TRAP
ADDQ.L
TST.W
BMI
MOVE

Atari ST Internals

#$2,-(SP)
ffilename
#$3D,-(SP)
#1
#8,SP
DO
error
DO, handle

filename:
.dc.b

*
*
*
*
*
*
*
*

File read and write


Address of the filename on the stack
Function number
Call GEMDOS
Clean up the stack
Error occurred?
Apparently
Save file handle for later accesses

* Don't forget zero byte!


'myfile.dat',0

handle:
.ds .w

$3E CLOSE
Every opened file should be closed when it will no longer be accessed
within a program, or when the program itself is ended. Especially when
writing, files must absolutely be closed before the program ends or data
may be lost.
Files are closed by a call to CLOSE, to which the handle number is passed
as a parameter. The return value will be zero if the file was closed correctly.

MOVE.W
MOVE.W
TRAP
ADDQ.L
BMI

handle,-(SP)
#$3E,-(SP)
#1
#4,SP
error

*
*
*
*
*

Handle number
Function number
Call GEMDOS
Error occurred?
Apparently

handle:
.ds.w

122

Abacus Software

Atari ST Internals

$3F READ
Opening and closing files is naturally only half of the matter. Data must be
stored and the retrieved later. Reading such files can be done in a very
elegant manner with the function READ. READ expects three parameters:
first the address of a buffer in which the data is to be read, then the number
of bytes to be read from the file, and finally the handle number of the file.
This number you have (hopefully) saved from the previous OPEN.
We mentioned the possible handle numbers in conjunction with CREATE.
What we didn't mention, however, is why the first handle number is six.
The cause of this is that things called devices, like the keyboard, the screen,
the printer, and the serial interface, are also accessed via handle numbers for
READ and WRITE operations. The device assignments are:
0 = Console input
1 = Console output
2 = RS-232
3 = Printer

Numbers 4 and 5 also function as console input and output. When using
these handle numbers, the system sometimes returns "invalid handle
number". The correct programming and the exact purpose of these two
numbers is not known.
As return value, DO contains either an error number (hopefully not) or the
number of bytes read without error. No message regarding the end of the
file is returned. This is not necessary, however, since the size of the file is
contained in the directory entry (see SEARCH FIRST/SEARCH NEXT). If
the file is read past the logical end, no message is given. The reading will be
interrupted at the end of the last occupied allocation unit of the file. The
number of bytes read in this case is always divisible by $400.

123

Abacus Software

MOVE.L
MOVE.L
MOVE.W
MOVE.W
TRAP
ADD.L
TST.L
BMI

Atari ST Internals

#buffer,-(SP)
f$100,-(SP)
handle,-(SP)
#$3F,-{SP)
#1
#12,SP
DO
error

*
*
*
*

Address of the data buffer


Read 256 bytes
Space for the handle number
Function number

* Did an error occur


* Apparently

handle:

. ds. w

Space for the handle number

buffer:
.ds.b

$100

* Suffices in our example

$40 WRITE
Writing to a file is just as simple as reading from it The parameters required
are also the same as those required for reading. The file descriptors from
OPEN and CREATE calls can be used as the handle, but the device
numbers listed for READ can also be used. The output of a program can be
sent to the screen, the printer, or in a file just by changing the handle
number.

$41 UNLINK
Files which are no longer needed can be deleted with UNLINK. To do this,
the address of the filename or, if necessary, the complete pathname must be
passed to the function. If the DO register contains a zero after the call, the
file has been deleted. Otherwise DO will contain an error number.

124

Abacus Software

MOVE.L
MOVE.W
TRAP
ADD.L
TST.W
BMI

Atari ST Internals

pathname,-(SP)
#$41,-(SP)
fl
#6,SP
DO
error

pathname:
-de.b

* Address of the data buffer


* Function number

* Did an error occur?


* Apparently

'/rolli/private/pacman.prg1,0

$42 LSEEK
Up to now we have become acquainted only with sequential data accesses.
We can read through any file from the beginning until we come the desired
information. An internal file pointer which points to the next byte to be read
goes along with each read. We can only move this pointer continuously in
the direction of the end of file by reading. A few bytes forward or
backward, setting the pointer as desired, is not something we can do. This
is required for many applications, however.
LSEEK offers an extraordinarily easy-to-use method of setting the file
pointer to any desired byte within the file and to read or write at this
point.This UNIX-compatible option of GEMDOS is much easier to use that
the methods available under CP/M for relative file management, for
instance.
A total of three parameters are passed to the LSEEK function. The first
parameter specifies the number of bytes by which the pointer should be
moved. An additional parameter is the handle number of the file. The last
parameter is a mode word which describes how the file is to be moved. A
zero as the mode moves the pointer to the start of the file and from there the
given number of bytes toward the end of the file. Only positive values may
be used as the number. With a mode value of 1, the pointer is moved the
desired positive or negative amount from the current position, and a 2 as the
mode value means the distance specified is from the end of the file. Only
negative values are allowed in this mode.

125

Abacus Software

Atari ST Internals

After the call, DO contains the absolute position of the pointer from the start
of the file, or an error message.

MOVE.W #1,-(SP)

* Relative from the current file ptr

MOVE.W
MOVE.L
MOVE.W
TRAP
ADD.L
TST.W
BMI

* File handle
* 32 bytes back
* Function number

handle,-(SP)
#$-20,-(SP)
#$42,-(SP)
#1
#10,SP
DO
error

* Did an error occur?


* Apparently

handle:
.ds.w

* Space for the handle number

$43 CHANGE MODE (CHMOD)


With the CREATE function a file can be assigned a specific attribute. This
attribute can be determined and subsequently changed only with the function
CHANGE MODE. The name of the file must be known because the address
of the name or the complete pathname must be passed to CHMOD. Another
parameter word specifies whether the file attribute is to be read or set.
Moreover, a word must be passed which contains the new attribute. When
reading the attribute of a file this word is not necessary, but should be
passed to the routine as a dummy value. We indicated the possible file
attributes in our discussion of the function CREATE, but here they are again
in a table:
$00
$01
$02
$04
$08
$10
$20

=
=
=
=
=
=
=

normal file status, read/write possible


File is READ ONLY
"hidden" file
system file
file is a volume label, contains disk name
file is a subdirectory
file is written and closed correctly

Attributes $10 and $20 cannot be specified when the file is created. Attribute
$20 is granted by the operating system, while the GEMDOS function

126

Abacus Software

Atari ST Internals

MKDIR is used to create a subdirectory. The MKDIR function creates not


only the directory entry with the appropriate attribute, it also arranges the
subdirectory on the disk physically.
After the call, DO will contain the current attribute value, which will be the
new value after setting the attribute, or, as with all other function calls, a
negative error number.

First example:
MOVE.W
MOVE.W
MOVE.L
MOVE.W
TRAP
ADD.L
TST.W
BMI

#1,-(SP)
#1,-(SP)
fpathname,-(SP)
#$43,-(SP)
#1
#10,SP
DO
error

pathname:
.dc.b

*
*
*
*

Give file READ ONLY attribute


Set attribute
We also need the pathname
Function number

* Did an ,error occur?


* Apparently

* Don't forget zero byte at end!


'killme.not',0

Second example:
MOVE.W
MOVE.W
MOVE.L
MOVE.W
TRAP
ADD.L
TST.W
BMI

#0,-(SP)
#0,-(SP)
#pathname,-(SP)
#$43,-(SP)
#1
#10,SP
DO
error

pathname:
.dc.b

*
*
*
*

Dummy value, not actually required


Read attribute
and the pathname
Function number

* Did an error occur?


* Apparently

* Don't forget zero byte at the end!


'whatam.i',0

127

Abacus Software

Atari ST Internals

$45 DUP
As mentioned in connection with the functions READ and WRITE, the
devices console, line printer, and RS-232 are also available to the
programmer. This permits input and output to be redirected to these devices.
One of the devices can be assigned a file handle number with the DUP
function. After the call the next free handle number is returned.

$46 FORCE
The FORCE function allows further manipulation of the handle numbers. If
in a program the console input and output are used exclusively via the
READ and WRITE functions with the handle numbers 0 and 1, the input or
output can be redirected with a call to this function. Screen outputs are
written to a file, inputs are not taken from the keyboard, but from a
previously-opened file.

$47 GETDIR
A given subdirectory can be made into the current directory with the
function $37. All file accesses with a pathname then run only in the set
subdirectory. Under certain presumptions it can be possible to determine the
pathname to the current subdirectory. This is accomplished by the function
call GETDIR, $47. This call requires the designation of the desired disk
drive (0=current drive, l=drive A, 2=drive B, etc.) and a pointer to a
64-byte buffer. The complete pathname to the current directory will be
placed in this buffer. The pathname will be terminated by a zero byte. If the
function is called when the main directory is active, no pathname will be
returned. In this case, the first byte in the buffer will contain zero. After the
call, DO must contain the value zero. If the value is negative, an error
occurred, for example if an incorrect drive number was passed.

128

Abacus Software

MOVE.W
MOVE.L
MOVE.W
TRAP
ADDQ.L
TST.L
BNE

Atari ST Internals

#0,-(SP)
* Get pathname of the current drive
#buffer,-(SP) * Address of the 64-byte buffer
#$47,-(SP)
* Function number
#1
#8,SP
DO
* Error?
error
* D0<>0 if error

buffer:
.ds.b

64

* Buffer for pathname

$48 MALLOC
The MALLOC function and the two that follow it, MFREE and
SETBLOCK, are concerned with the memory organization of GEMDOS.
As already mentioned in conjunction with function $31, KEEP PROCESS,
a program is assigned all of the entire memory space available after it is
loaded. This is uncritical in many cases, because only a single program is
running. But there are applications under GEMDOS in which such
organization is not sensible. An accessory such as the VT-52 emulator may
be called from within a program, for example. Such a program also requires
memory space, but the memory might not be available. No further program
modules can be loaded if the entire memory is occupied. For this reason,
each program should reserve only the space which it actually needs for the
program and data. The memory not required can be given back to
GEMDOS.
If the program should need some of the memory it gave back, it can request
memory from GEMDOS via the function MALLOC (memory allocate). The
number of bytes required is passed to MALLOC. After the call, DO contains
the starting address of the memory area reserved by the call or an error
message if an attempt is made to reserve more memory than is actually
available.
If -1L is passed as the number of bytes to be allocated, the number of bytes
available is returned in DO.

129

Abacus Software

Atari ST Internals

First example:
MOVE.L
MOVE.W
TRAP
ADDQ.L

#-l,-(SP)
#$48,-(SP)
#1
#6,SP

* Determine number of free bytes


* Function number
* Number of free bytes in DO

Second example:
MOVE.L
MOVE.W
TRAP
ADDQ.L
TST.W
BMI
MOVE.L

#$1000,-(SP)
#$48,-(SP)
#1
#6,SP
DO
error
D0,mstart

* Get hex 1000 bytes for the program


* Function number

* Error or address of memory?


* Negative long word = error!
* Else start addr of the reserved area

mstart:
.ds.l

$49 MFREE
An area of memory reserved with MALLOC can be released at any time
with MFREE. To do this, GEMDOS is passed the address of the memory
to be released. The value will usually be the address returned by MALLOC.
If a value of zero is returned in DO, the memory was released by GEMDOS
without error. A negative values indicates errors.

130

Atari ST Internals

Abacus Software

MOVE.L
MOVE.W
TRAP
ADDQ.L
TST.L
BNE

mstart,-(SP)
#$49,-(SP)
#1
#6,SP
DO
error

* Addr of a previously allocated area


* Function number
* Number of free bytes in DO
* Error?
* DOOO is error!

mstart:
.ds.l

$4A SETBLOCK
In contrast to the MALLOC function, a specific area of memory can be
reserved with the function SETBLOCK. The memory beginning at the
specified address is returned to GEMDOS, even if it was reserved before.
This function can be used to reserve the actual memory requirements of a
program and release the remaining memory.
The parameters the function requires are the starting address and the length
of the area to be reserved. The area specified with these parameters is then
reserved by GEMDOS and is not released again until the end of the program
or after calling the MFREE function.
Usually programs will begin with the following command sequence or
something similar. After the call, DO must contain zero, otherwise an error
occurred.

131

Abacus Software

MOVE.L A7,A5
MOVE.L #USTCK,A7
MOVE.L 4(A5),A5
MOVE.L $C(A5),DO
ADD.L $14(A5),DO
ADD.L

$1C(A5),DO

ADD.L #$100,DO
MOVE.L DO,-(SP)
MOVE.L A5,-(SP)
MOVE.W
MOVE.W
TRAP
ADD.L
TST.L
BNE

*0,-<SP)
f$4A,-(SP)
#1
#12,SP
DO
error

Atari ST Internals

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

Save stack pointer in A5


Set up stack for the program
A5 now points to the base-page start
exactly $100 bytes below the prg start
$C(A5) contains length of the prg area
$14 (A5) cohtaing the length of the
initialized data area
$1C(A5) contains length of the
uninitialized data area
Reserve $100 bytes base page
DO contains the length of the area
to be reserved
A5 contains the start of the area
to be reserved
Meaningless word, but still necessary!
Function number

*
*
*
*

Clean up the stack as usual


Did an error occur?
Stop
Here the program continues...

$4B EXEC
The EXEC function permits loading and chaining programs. If desired, the
program loaded can be automatically started. In addition to the function
number, the addresses of three strings and a mode word are expected on the
stack.
The first address is a pointer to something called an "environment" string, a
string which describes the "environment." If the environment is not set, the
address of a null string, the address of a zero byte, will suffice.
The second pointer contains a command line for the program being called. A
command line is comparable to the line which may be entered from the
command mode when you have selected the point "TOS -takes parameters"
from the option "Options".

132

Atari ST Internals

Abacus Software

The third pointer points to the filename or pathname of the file. All three
strings must be terminated with a zero byte or consist of only a zero byte.
The mode word can be either zero or three. The standard value zero starts
the loaded program automatically, while a three loads the program without
automatically executing it. In this last case, either the address of the base
page or an error message is returned in DO.

MOVE.L
MOVE.L
MOVE.L
MOVE.W
MOVE.W
TRAP
ADD.L

#env,-(SP)
#com,-(SP)
tfil,-(SP)
#0,-(SP)
#$4B,-(SP)
#1
#14,SP

fil:
.dc.b

com:
.dc.b

env:
.dc.b

*
*
*
*
*

Environment
Command line
Filename
Load and start, please
Function number

* Here we come to the end of the


* chained program or postloaded module

* Load sort routine


"qsort.prg1,0
* Sort the file in ascending order
'up data.asc",0
* No environment
0

$4C TERM
TERM $4C represents the third method, after TERM $00 and TERM $31,
of ending a program. TERM $4C automatically makes the memory used by
the program available to GEMDOS again. Different from TERM $00,
however, a programmer-defined return value other than zero can be returned
to the caller. This allows a short message to be passed back to the calling
program.

133

Abacus Software

Atari ST Internals

MOVE.W #37,-<SP)
MOVE.W #$4C,-(SP)
TRAP
#1

* Any 2-byte value


* End program
*
now
* We never get here

$ 4E SFIRST
The SFIRST function can be used to check to see if a file with the given
name is present in the directory. If a file with the same name is found, the
filename, the file attribute, data and time of creation, and the size of the file
in bytes is returned. This information is placed in the DTA buffer, whose
address is set with the SETDTA function, by GEMDOS.
One feature of this function is that the filename need not be specified in its
entirety. Individual characters in the filename can be exchanged for a
question mark "?", but entire groups of letters can also be replaced by a "*".
Li the extreme form a filename would be reduced to the string "*.*". In this
case the first file in the directory would satisfy the conditions and the
filename would appear in the DTA buffer along with the other information.
In addition to the filename, the SFIRST function must also be given a
search attribute. The possible parameters of the search attribute correspond
to the attributes which can be specified in CHMOD function:
$00
$01
$02
$04
$08

=
=
=
=
=

Normal
Normal
Hidden
Hidden
Volume

access, read/write possible


access, write protected
entry (ignored by the ST desktop)
system file (ignored like $02)
label, diskette name

$10 = Subdirectory

$20 = File will be written and closed


The following rules apply when searching for files:
If the attribute word is zero, only normal files are recognized.
System files or subdirectories are not recognized.
System files, hidden files, and subdirectories are found when
the corresponding attribute bits are set. Volume labels are not
recognized, however.

134

Atari ST Internals

Abacus Software

In order to get the volume label, this option must be expressly


set in the attribute word. All other files are then ignored.
After the call, DO contains the value zero if a corresponding file
has been found. In this case the 44-byte DTA buffer is
constructed as follows:
Bytes
Byte
Bytes
Bytes
Bytes
Bytes

0-20

21
22-23
24-25
26-29
30-43

Reserved for GEMDOS


File attribute
Clock time of file creation
Date of file creation
File size in bytes (long)

Name and extension of the file

If, however, no file is found which corresponds to the specified search


string, the error message -33, file not found, is returned.

MOVE.L
MOVE.W
TRAP
ADDQ.L
MOVE.W
MOVE.L
MOVE.W
TRAP .
ADDQ.L
TST
BNE

#dta,-(SP)
#1A,-(SP)
#1
f6,SP
#attrib,-(SP)
#filnam,-(SP)
#$4E,-(SP)
#1
#8,SP
DO
not found

* Set up DTA buffer


* Function number SETDTA

* Attribute value
* Name of file to search for
* Function number

* File found?
* Apparently not

attrib:
.dc.b

* Search for normal files only

.dc.b

'*.*',0

* Search for the 1st possible file

.ds.b

44

f ilnam:

dta:
* Space for the DTA buffer

135

Abacus Software

Atari ST Internals

$4F SNEXT
The SNEXT function (Search next) can be used to see if there are other files
on the disk which match the filename given. To do this, only the function
number need be passed; SNEXT does not require any parameters. All of the
parameters are set from the SFERST call.
If the search string is very global, as in the previous example, all of the files
on a diskette can be determined and displayed one after the other with
SFIRST and SNEXT. This makes it rather easy to display a directory
within a program. The SNEXT function is called repeatedly and the
contents of DO are check afterwards. If DO contains a value other than zero,
either an error occurred, or all of the directory entries have been searched.

$56 RENAME
A RENAME function is found in almost every disk-oriented operating
system in one form or another, since renaming files is required fairly often.
Under GEMDOS, files are renamed with the RENAME function, which
requires two pointer to file or pathnames. The first pointer points to the new
name, with the specification of the pathname of the file if necessary, and
the second pointer points to the previous name. A 2-byte parameter is
required in addition to the two pointers. We were not able to determine the
significance of the additional word parameter. Different values had no
(recognizable) effect
As a return value, DO contains either zero, meaning that the name was
changed correctly, or an error code.

136

Atari ST Internals

Abacus Software

MOVE.L
MOVE.L
MOVE.W
MOVE.W
TRAP
ADD.L
TST.L

tnewnam,-(SP)
#oldname,-(SP)
#Q,-(SP)
i$56,-(SP)
fl
#12,SP
DO

oldnam:

*
*
*
*

New filename
File to rename
Dummy?
Function number

* Test for error

.dc.b

* Don't forget zero byte at end!


'oldfile.dat',0

.dc.b

'newname.dat',0

newnam:

$57 GSDTOF
If the directory is displayed as text rather than icons on the desktop, the date
and time of file creation as well as the size of the file in bytes is shown. The
time and date can either be set or read with function $57. To do this it is
necessary that the file be already opened with OPEN or CREATE. The
handle number obtained at the opening must be passed to the function.
Additional parameters are a word which acts as a flag as to whether the time
and data are to be set (0) or read (1), and a pointer to a 4-byte buffer which
either contains the result data or will be provided with the required data
before the call.
This date buffer contains the time in the first two byes and the date in the
last two. The format of the data is identical to that of the functions for
setting/reading the time and date.

137

Abacus Software

Atari ST Internals

Example 1:
MOVE.W
MOVE.W
MOVE.L
MOVE.W
TRAP
ADD.L

#1,-(SP)
#handle,-(SP)
#buff,-(SP)
f$57,-(SP)
#1
#10, SP

*
*
*
*

Read time and date


File must first be opened
4 byte buffer
Function number

handle:

. ds . b 2
buff:
.ds.b

Example 2:
MOVE.W
MOVE.W
MOVE.L
MOVE.W
TRAP

#0,-(SP)
fhandle,-(SP)
fbuff,-(SP)
#$57,-(SP)
#1

ADD.L

#10,SP

*
*
*
*

Set time and date


File must first be opened
4 byte buffer
Function number

handle:
-ds.b

.ds.b

buff:

138

Abacus Software

Atari ST Internals

3.1.1 GEMDOS error codes and their meaning


The GEMDOS functions return a value giving information about whether or
not an error occurred during the execution of the function. A value of zero
means no error; negative values have the following meanings:
-32
-33
-34
-35
-36
-37
-39
-40
-46
-49

Invalid function number


File not found
Pathname not found
Too many files open (no more handles left)
Access not possible
Invalid handle number
Not enough memory
Invalid memory block address
Invalid drive specification
No more files

In addition to these error messages, the BIOS error messages may occur.
These error messages have numbers -1 to -31 and are described in section
3.3

139

Abacus Software

Atari ST Internals

3.2 The BIOS Functions

The software interface between the GEMDOS and the hardware of the
computer is the BIOS (Basic Input Output System). The BIOS, as the name
suggests, is concerned with the fundamental input/output functions. This
includes screen output, keyboard input, printer output, as well as the
RS-232 interface and, of course, input/output to the disk.
The BIOS functions are also available to user programs. The TRAP
instruction of the 68000 processor is used to call them. Any data required is
passed through the stack and the result of the function is returned in the DO
register. The machine language programmer should be aware that the
contents of DO-D2 and AO-A2 are changed when calling BIOS functions;
the remaining registers remain unchanged.
BIOS function calls are even simpler if you program in C. Here you can use
simple function calls with the corresponding parameter lists. The function
calls are stored as macros in an include file. In the examples, the definition
of the function and its parameters in C will be shown. For assembly
language programmers, the use is described in an example.
TRAP f 13 is reserved for the BIOS functions.

140

Abacus Software

0 getmpb

Atari ST Internals

get memory parameter block

C: void getmpb(pointer)
long pointer;

Assembler:
move.l
move.w
trap
addq.l

pointer,-(SP)
#0,-(SP)
#13
#6,sp

This function fills a 12-byte block whose address is contained in pointer


with the memory parameter block. This block contains three pointers itself:
long
long
long

mfl
mal
rover

Memory free list


Memory allocated list
Roving pointer

The structures to which each pointer points are constructed as follows:


long
long
long
long

link
start
length
own

Pointer to next block


Start address of the block
Length of the block in bytes
Process descriptor

#bufferf-(sp)
#0,-(sp)
#13
#6,sp

Buffer for MPB


getmpb
Call BIOS
Stack correction

Example:
move.l
move.w
trap
addq.l

We get the values $48E, 0, and $48E. The following data are at address
$48E:
link
start
length
own

0
$3B900
$3C700
0

No additional block
Start address of the free memory
Length of the free memory
No process descriptor

141

Abacus Software

Atari ST Internals

1 bconstat

return input device status

C: int bconstat(dev)
int dev;

Assembler:
move.w
move.w
trap
addq.l

dev,-(sp)
#l,-(sp)
#13
#4,sp

This function returns the status of an input device which is defined as


follows:
Status 0
Status -1

No characters ready
(at least) one character ready

The parameter dev specifies the input device:


dev
0
1
2
3
4

Input
PRT:,
AUX:,
CON:,
MIDI,
IKBD,

device
Centronics interface
RS-232 interface
Keyboard and screen
MIDI interface
Keyboard port

The following table lists the allowed accesses to these devices:


Operation
Input status
Input
Output status
Output

PRT:
no
yes
yes
yes

AUX:
yes
yes
yes
yes

CON:
yes
yes
yes
yes

MIDI
yes
yes
yes
yes

IKBD
no
yes
yes
yes

This example waits until a character from the RS-232 interface is ready.
wait move.w
move.w
trap
addq.l
tst
beq

#l,-(sp)
fl,-(sp)
#13
#4,sp
dO
wait

RS-232
bconstat

character available?
no, wait

142

Abacus Software

2 COnin

Atari ST Internals

read character from device

C: long conin(dev)
int dev;

Assembler:
move.w
move.w
trap
addq.l

dev,-(sp)
#2,-(sp)
#13
#4,sp

This function fetches a character from an input device. The parameter dev
has the same meaning as in the previous function. The function does not
return until a character is ready.
The character received is in the lowest byte of the result. If the input device
was the keyboard (con, 2), the key scan code is also returned in the lower
byte of the upper word (see description of the keyboard processor).
Example:
move.w
move.w
trap
addq.l

#2,(sp)
#2,-(sp)
#13
#4,sp

con
bconin

143

Abacus Software

3 bconoilt

Atari ST Internals

write character to device

C: void bconout(dev, c)
int dev, c;

Assembler:
move.w
move.w
move.w
trap
addq.l

c,-(sp)
dev,-(sp)
#3,-{sp)
#13
#6,sp

This function serves to output a character "c" to the output device dev
(meaning is the same as for the previous function). The function returns
when the character has been outputted.
Example:
move.w
move.w
move.w
trap
addq.l

#*A',-(sp)
#0,-(sp)
#3,-(sp)
#13
#6,sp

PRT:
bconout

The example outputs the letter "A" to the printer.

144

Abacus Software

4 FWabs

Atari ST Internals

read and write disk sector

C: long rwabs(rwflag, buffer, number, recno,dev)


long buffer;
int rwflag, number, recno, dev;

Assembler:
move.w
move.w
move.w
move.l
move.w
move.w
trap
add.l

dev,-(sp)
recno,-(sp)
number,-(sp)
buffer,-(sp)
rwflag,(sp)
#4,-(sp)
#13
#14,sp

This function serves to read and write sectors on the disk. The parameters
have the following meaning:
rwflag
0
1
2
3

Meaning
Read sector
Write sector
Read sector, ignore disk change
Write sector, ignore disk change

The parameter buffer is the address of a buffer into which the data will be
read from the disk or from which the data will be written to the disk. The
buffer should begin at an even address, or the transfer will run very slowly.
The parameter number specifies how many sectors should be read or written
during the call. The parameter recno specifies which logical sector the
process will start with.
The parameter dev determines which disk drive will be used:
dev
0
1
2

Drive
Drive A
Drive B
Hard disk

145

Abacus Software

Atari ST Internals

The function returns an error code as the result. If this value is zero, the
operation was performed without error. The returned value will be negative
if an error occurred. The error code has the following meaning:
0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17

OK, no error
General error
Drive not ready
Unknown command
CRC error
Bad request, invalid command
Seek error, track not found
Unknown media (invalid boot sector)
Sector not found
(No paper)
Write error
Read error
General error
Diskette write protected
Diskette was changed
Unknown device
Bad sector (during verify)
Insert diskette (for connected drive)

Example:
move.w
move.w
move.w
move.l
move.w
move.w
trap
add.l
buffer

#0,-(sp)
#10,-(sp)
#2,-(sp)
fbuffer,-(sp)
#0,-(sp)
#4,-(sp)
#13
#14,sp
ds.b

Drive A
Start at logical sector 10
Read 2 sectors
Buffer address
Read sectors
rwabs

2*512

146

Abacus Software

5 Sfitexec

Atari ST Internals

set exception vectors

C: long setexec(number, vector)


int number;
long vector;

Assembler:
move.l
move.w
move.w
trap
addq.l

vector,-(sp)
number,-(sp)
#5,-(sp)
#13
#8,sp

The function set exec allows one of the exception vectors of the 68000
processor to be changed. The number of the vector must be passed in
number and the address of the routine pertaining to it in vector. The
function returns the old vector as the result. If you just want to read the
vector, pass the value -1 as the new address. The 256 processor vectors as
well as 8 vectors for GEM, which numbers $100 to $107 (address $400 to
$41C) can be changed with this function.
Example:
move.l
move.w
move.w
trap
addq.l

fbuserror,-(sp)
#2,-(sp)
#5,-(sp)
#13
#8,sp

buserror

147

Abacus Software

6 tickcal

Atari ST Internals

return millisecond per tick

C: long tickcal {)
Assembler:
move.w #6,-{sp)
trap
#13
addq.l #2,sp

This function returns the number of milliseconds between two system timer
calls.
Example:
move.w #6,-(sp)
trap
#13
addq.l #2,sp

Result: 20 ms

148

Abacus Software

Atari ST Internals

7 getbpb

get BIOS parameter block

C: long getbpb(dev)
int dev;

Assembler:
move.w
move.w
trap
addq.l

dev,-(sp)
#7,-(sp)
#13
#4,sp

This function returns a pointer to the BIOS Parameter Block of the drive
dev (0=drive A, l=drive B).
The BPB (BIOS Parameter Block) is constructed as follows:
int
int
int
int
int
int
int
int
int

recsiz
clsiz
clsizb
rdlen
fsiz
fatrec
datrec
numcl
bflags

Sector size in bytes


Cluster size in sectors
Cluster size in bytes
Directory length in sectors
FAT size in sectors
Sector number of the second FAT
Sector number of the first data cluster
Number of data clusters on the disk
Misc. flags

The function returns the address $3E3E for drive A and the address $3E5E
for drive B. An address of zero indicates an error.
Example:
move.w
move.w
trap
addq.l

#0,-(sp)
#7,-(sp)
#13
#4,sp

Drive A
getbpb

149

Abacus Software

Atari ST Internals

Here are the BPB data for 80 track single and double-sided disk drives:
Parameter
recsiz
clsiz
clsizb
rdlen
fsiz
fatrec
datrec
numcl

80 track SS
512
2
1024
7
5
6
18
351

80 track DS
512
2
1024
7
5
6
18
711

150

Abacus Software

8 bcostat

Atari ST Internals

return output device status

C: long bcostat(dev)
int dev;

Assembler:
move.w
move.w
trap
addq.l

dev,-(sp)
#8,.-(sp)
#13
#4,sp

This function tests to see if the output device specified by dev is ready to
output the next character, dev can accept the values which are described in
function one. The result of this function is either -1 if the output device is
ready, or zero if it must wait
Example:
move.w
move.w
trap
addq.l

#0,-{sp)
#8,-(sp)
#13
#4,sp

Printer ready?
bcostat

151

Abacus Software

9 Itiediach

Atari ST Internals

inquire media change

C: long mediach(dev)
int dev;

Assembler:
move.w
move.w
trap
addq.1

dev,-(sp)
#9,-(sp)
#13
# 4, sp

This function determined if the disk was changed in the meantime. The
parameter dev, the drive number (0=drive A, l=drive B), must be passed to
the routine. One of three values can occur as the result:
0
1
2

Diskette was definitely not changed


Diskette may have been changed
Diskette was definitely changed

Example:
move.w
move.w
trap
addq.l

#l,-(sp)
#9,-(sp)
#13
#4,sp

Drive B
mediach

152

Abacus Software
10 drvmap

Atari ST Internals
inquire drive status

C: long drvmap < )

Assembler:
move.w #10,-(sp)
trap
#13
addq.l #2,sp

This function returns a bit vector which contains the connected drives. The
bit number n is set if drive n is available (0 means A, etc.). Even if only one
drive is connected, %11 is still returned, since two logical drives are
assumed.
Example:
move.w #10,-(sp)
trap
#13
addq.1 #2 , sp

drvmap

153

Abacus Software
11 kbshift

Atari ST Internals
inquire/change keyboard status

C: long kbshift(mode)
int mode;

Assembler:
move.w
mode.w
trap
addq.l

mode,-(sp)
#11,-(sp)
#13
#4,sp

With this function you can change or determine the status of the special keys
on the keyboard. If mode is -1, you get the status, a positive value is
accepted as the status. The status is a bit vector which is constructed as
follows:
Bit
0
1
2
3
4
5
6
7

Meaning
Right shift key
Left shift key
Control key
ALT key
Caps Lock on
Right mouse button (CLR/HOME)
Left mouse button (INSERT)
Unused

Example:
move.w
move.w
trap
addq.l

#-l,-(sp)
#11,-(sp)
#13
#4,sp

Read shift status


kbshift

154

.^$^

fjf-%

Abacus Software

Atari ST Internals

3.3 The XBIOS


To support the special hardware features of the Atari ST, there are extended
BIOS functions, which are called via a TRAP 114 instruction. The
functions, like the normal BIOS functions, can be called from assembly
language as well as from C. When calling from C, a small TRAP handler in
machine language is again necessary, which can look like this:
trap!4:
move.l
trap
move.l
rts

.bss
retsave ds.l

(sp)+, ret save Save return address


#14
Call XBIOS
retsave,-(sp) Restore return address

Space for the return address

Macro functions can be used in C which allow the extended BIOS functions
(extended BIOS, XBIOS) to be called by name. The appropriate function
number and TRAP call will be created when the macro is expanded.
When working in assembly language, the function number of the XBIOS
routine need simply be passed on the stack. The XBIOS has 40 different
functions whose signficance and use are described on the following pages.

155

Abacus Software

0 initmous

Atari ST Internals

initialize mouse

C: void initmous(type, parameter, vector)


int type;
long parameter, vector;

Assembler:
move.l
move.l
move.w
move.w
trap
add.l

vector,-(sp)
parameter,-(sp)
type,(sp)
fO,(-sp)
#14
#12,sp

This XBIOS function initializes the routines for mouse processing. The
parameter vector is the address of a routine which will be executed
following a mouse-report from the keyboard processor. The parameter type
selects from among the following alternatives:
type
0
1
2
3
4

Disable mouse
Enable mouse, relative mode
Enable mouse, absolute mode
unused
Enable mouse, keyboard mode

This allows you to select if mouse movements are to be reported and in


what manner this will occur.
The parameter parameter points to a parameter block, which is constructed
as follows:
char
char
char
char

topmode
buttons
xparam
yparam

The parameter topmode determines the layout of the coordinate system. A 0


means that Y=0 lies in the lower corner, 1 means that Y=0 lies in the upper
corner.

156

Abacus Software

Atari ST Internals

The parameter buttons is a parameter for the command "set mouse


buttons" of the keyboard processor (see description of the IKBD, intelligent
keyboard).
The parameters xparam and yparam are scaling factors for the mouse
movement. If you have selected 2 as the type, the absolute mode, the
parameter block determines four more parameters:
int
int
int
int

xmax
ymax
xstart
ystart

These are the X and Y-coordinates of the maximal value which the mouse
position can assume, as well as the start value to which the mouse will be
set.
Example:
move.l
move.l
move.w
move.w
trap
add.l

tvector,-(sp)
tparameter,-(sp)
#l,-(sp)
#0,-(sp)
#14
#12,sp

Address of the mouse position


Address of the parameter block
Enable relative mouse mode
Init mouse

parameter dc.b
vector

...

Mouse interrupt routine

157

Abacus Software
1 SSbrk

Atari ST Internals
save memory space

C: long ssbrk(number)
int number;

Assembler:
move.w
move.w
trap
addq.l

number,-(sp)
#l,-(sp)
#14
#4,sp

This function reserves memory space. The number of bytes must be passed
in number. The memory space is prepared at the upper end of memory. The
function returns the address of the reserved memory area as the result. This
function must be called before initializing the operating system, meaning
that is must be called from the boot ROM, before the operating system is
loaded.
Example:
move.w
move.w
trap
addq.l

#$400,-(sp)
#l,-(sp)
#14
#4,sp

Reserve IK
ssbrk

158

Abacus Software
2 physbase

Atari ST Internals
return screen RAM base address

C: long physbase()

Assembler:
move
#2,-(sp)
trap
#14
addq.l #2,sp

This function returns the base of the physical screen RAM. The physical
screen RAM is the area of memory which is displayed by the video shifter.
The result is a long word.
Example:
$78000, base address of the screen for 512K RAM

159

Abacus Software

3 logbd.se

Atari ST Internals

set logical screen base

C: long logbase()

Assembler:
move
#3,-(sp)
trap
#14
addq.l #2,sp

The logical screen base is the address which is used for all output functions
as the screen base. If the physical and logical screen bases are different, one
screen will be displayed while another picture is being constructed in a
different area of RAM, which will be displayed later. The result of this
function call is again a longword.
Example:
$78000, base address of the screen for 512K RAM

160

Abacus Software

4 getrez

Atari ST Internals

return screen resolution

C: int getrez()

Assembler:
move.w #4,-(sp)
trap
#14
addq.l #2,sp

This function call returns the screen resolution:


0 := Low resolution, 320*200 pixels, 16 colors
1 := Medium resultion, 640*200 pixels, 4 colors
2 := High resolution, 640*400, pixels, monochrome

Example:
2 r monochrome

161

Abacus Software

5 SCtSCreen

Atari ST Internals

set screen parameters

C: void setscreen(logadr, physadr, res)


long logadr, physadr;
int res;

Assembler:
move.w
move.1
move.1
move.w
trap
add.l

res,-(sp)
physadr,-(sp)
logadr,-(sp)
#5,-(sp)
#14
#12,sp

This function changes the screen parameters which can be read with the
previous three functions. If a parameter should not be set, a negative value
must be passed. The parameters are set in the next VBL routine so that no
disturbances appear on the screen.
Example:
Set the physical and the logical screen address to $70000, retain the
resolution.
move.w
move.l
move.l
move.w
trap
add.l

#-l,-(sp)
#$70000,-(sp)
#$70000,-(sp)
#5,-(sp)
#14
#12,sp

Retain resolution
Physical base
Logical base
setscreen

162

Abacus Software

Atari ST Internals

6 setpalette

set color palette

C: void setpalette(paletteptr)
long paletteptr;

Assembler:
move.l
move.w
trap
addq.l

paletteptr,-(sp)
#6,-(sp)
#14
#6fsp

A new color palette can be loaded with this function. The parameter
paletteptr must be a pointer to a table with 16 colors (each a word). The
address of the table must be even. The colors will be loaded at the start of
the next VBL. Example:
move.l
move.w
trap
addq.1
palette

#palette,-(sp)
#6,-(sp)
#14
# 6,sp
dc.w

Address of the new color palette


set palette

$777,$700,$070,$007,$111,$222,$333,$444,
$555,$000,$001,$010,$100,$200,$020,$002,
$123,$456

163

Abacus Software

7 setcolor

Atari ST Internals

set color

C: int setcolor(colornum, color)


int colornum, color

Assembler:
move.w
move.w
move.w
trap
addq.1

color,-(sp)
colornum,-(sp)
#7,-(sp)
#14
# 6,sp

This function allows just one color to be changed. The color number (0-15)
and the color belonging to it (0-$777) must be specified. If-1 is given as the
color, the color is not set but the previous color is returned.
Example:
move.w
move.w
move.w
trap
addq.l

#$777,-(sp)
#l,-(sp)
#7,-(sp)
#14
#6,sp

Color white
As color number 1

164

Abacus Software

Atari ST Internals

floprd

read diskette sector

C: int floprd(buffer, filler, dev, sector, track, side,


count)
long buffer, filler;
int dev, sector, track, side, count;

Assembler:
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l

count,-(sp)
side,-(sp)
track,-(sp)
sector,-(sp)
dev,-(sp)
-(sp)
buffer,-(sp)
#8,-(sp)
#14
#20,sp

This function reads one or more sectors in from the diskette. The parameters
have the following meaning:
count: Specifies how many sectors are to be read. Values between
one and nine (number of sectors per track) are possible.
side:

Selects the diskette side, zero for single-sided drives and


zero or one for double-sided drives.

track: Determines the track number (0-79 for 80-traek drives or


0-39 for 40-track drives).
sector: The sector number of the first sector to be read (0-9).
dev:

Determine drive number, 0 for drive A and 1 for drive B.

filler: Unused long word.


buffer: Buffer in which the diskette data should be written. The
buffer must begin on a word boundary and be large enough
for the data to be read (512 bytes times the number of
sectors).

165

Abacus Software

Atari ST Internals

The function returns an error code which has the following meaning:
0
-1
-2
3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17

OK, no error
General error
Drive not ready
Unknown command
CRC error
Bad request, invalid command
Seek error, track not found
Unknown media (invalid boot sector)
Sector not found
(No paper)
Write error
Read error
General error
Diskette write protected
Diskette was changed
Unknown device
Bad sector (during verify)
Insert diskette (for connected drive)

Example:
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l
tst
bmi
buffer

#l,-(sp)
#0,-(sp)
#0,-(sp)
#l,-(sp)
#l,-(sp)
-(sp)
fbuffer,-(sp)
f8,-(sp)
#14
#20,sp
dO
error

ds.b 512

Read a sector
Page zero
Track zero
Sector one
Drive B

floprd

Did error occur?


yes
Buffer for a sector

166

Abacus Software
9 flopwr

Atari ST Internals
write diskette sector

C: int floprd(buffer, filler, dev, sector, track, side,


count)
long buffer, filler;
int dev,sector,track,side,count;

Assembler:
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l

count,-(sp)
side,-(sp)
track,-(sp)
sector,-(sp)
dev,-(sp)
-(sp)
buffer,-(sp)
#9,-(sp)
#14
#20,sp

One or more sectors can be written to disk with this XBIOS function. The
parameters have the same meaning as for the function & floprd. The function
returns an error code which also has the same meaning as for reading
sectors. Example:
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l
tst
bmi
buffer

#3,-(sp)
#0,-(sp)
#7,-(sp)
#l,-(sp)
#0,-(sp)
-(sp)
#buffer,-(sp)
#9,-(sp)
#14
#20,sp
dO
error

ds.b 3*512

Write three sectors


Side zero
Track seven
Sector one
Drive A
Address of the buffer
flopwr

Did an error occur?


yes
Buffer for three sectors

167

Abacus Software

10

flopfmt

Atari ST Internals

format diskette

C: int flopfmt(buffer, filler, dev, spt, track, side,


interleave, magic, virgin)
long buffer, filler, magic;
int dev, spt, track, side, interleave, virgin;

Assembler:
move.w
move.l
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l

virgin,-(sp)
magic,-(sp)
interleave,-(sp)
side,-(sp)
track,-(sp)
spt,-(sp)
dev,-(sp)
-(sp)
buffer,-(sp)
#10,-(sp)
#14
#26,sp

This routine serves to fonnat a track on the diskette. The parameters have
the following meanings:
virgin:

The sectors are formatted with this value. The


standard value is $E5E5. The high nibble of each byte
may not contain the value $F.

magic:

The constant $87654321 must be used as magic or


formatting will be stopped.

interleave: Determines in which order the sectors on the disk will


be written, usually one.
side:

Selects the disk side (0 or 1).

track:

The number of the track to be formatted (0-79).

spt:

Sectors per track, normally 9.

dev:

The drive, 0 for A and 1 for B.


168

Abacus Software

Atari ST Internals

filler:

Unused long word.

buffer:

Buffer for the track data; for 9 sectors per track the
buffer mst be at least 8K large.

The function returns an error code as its result. The value -16, bad sectors,
means that data in some sectors could not be read back correctly. In this
case the buffer contains a list of bad sectors (word data, terminated by
zero). You can format these again or mark the sectors as bad.
Example:
move.w
move.l
move.w
move.w
move.w
move.w
move.w
clr.l
move.w
move.w
trap
add.l
tst
bmi
buffer

f$E5E5,-(sp)
#$87654321,-(sp)
#l,-(sp)
#0,-(sp)
#79,-(sp)
#9,-(sp)
#0,-(sp)
-(sp)
#buffer,-(sp)
#10,-(sp)
#14
#26,sp
dO
error
ds.b

$2000

Initial data
magic
interleave
side 0
track 79
9 sector per track
drive A

flopfmt

8K buffer

11 unused

169

Abacus Software

12 midiws

Atari ST Internals

write string to MIDI interface

C: void midiws(count, ptr)


int count;
long ptr;

Assembler:
move.l
move.w
move.w
trap
addq.l

ptr,-(sp)
count,-(sp)
#12,-(sp)
#14
#8,sp

With this function it is possible to output a string to the MIDI interface


(MIDI OUT). The parameter ptr must point to a string, count must contain
the number of characters to be sent minus 1.
Example:
move.l
move.w
move.w
trap
addq.l

#string,-(sp)
Address of the string
#stringend-string-l,-(sp) Length
#12,-(sp)
midiws
#14
#8,sp

string
dc.b 'MIDI data"
stringend equ *

170

Abacus Software

13 mfpint

Atari ST Internals

initialize MFP format

C: void mfpint(number, vector)


int number;
long vector;

Assembler:
move.l
move.w
move.w
trap
addq.l

vector,-(sp)
number,-(sp)
#13,-(sp)
#14
#8,sp

This function initializes an interrupt routine in the MFP. The number of the
MFP interrupt is in number while vector contains the address of the
corresponding interrupt routine. The old interrupt vector is overwritten.
Example:
move.l
move.w
move.w
trap
addq.l

#busy,-(sp)
#0,-(sp)
#13,-(sp)
#14
#8,sp

Busy interrupt routine


Vector number 0
mfpint

* * *

busy:

171

Abacus Software

Atari ST Internals

14 iorec

return record buffer

C: long iorec(dev)
int dev;

Assembler:
move.w
move.w
trap
addq.l

dev,-(sp)
#14,-(sp)
#14
#4,sp

This function fetches a pointer to a buffer data record for an input device.
The following input devices can be specified:
dev
0
1
2

Input device
RS-232
Keyboard
MIDI

The buffer record for an input device has the following layout:
long
int
int
int
int
int

ibuf
ibufsize
ibufhd
ibuftl
ibuflow
ibufhi

Pointer to an input buffer


Size of the input buffer
Head index
Tail index
Low water mark
High water mark

The input buffer is a circular buffer; the head index specifies the next write
position (the buffer is filled by an interrupt routine) and the tail index
specifies from where the buffer can be read. If the head and tail indices are
the same, the buffer is empty. The low and high marks are used in
connection with the communications status for the RS-232 (XON/XOFF or
RTS/CTS). If the input buffer is filled up to the high water mark, the
sender is informed via XON or CTS that the computer cannot receive any
more data. When data received by the computer can be processed again, so
that the buffer contents sink below the low water mark, the transfer is
resumed.
There is an identically-constructed buffer record for the RS-232 output
which is located directly behind the input record.

172

Atari ST Internals

Abacus Software

Example:
move.w
move.w
trap
addq.l

#1,(sp)
#14,-(sp)
#14
#4,sp

Buffer record for keyboard


iorec

Result: $9F2
The following table contains the data for all devices:
RS-232 input
Address
$9DO
Buffer address
$6DO
Buffer length
$100
Head index
0
Tail index
0
Low water mark
$40
High water mark
$CO

RS-232 output
($9DE)
$7DO
$100
0
0
$40
$CO

Keyboard
$942
$8DO
$80
0
0
$20
$20

MIDI
$AOO
$950
$80
0
0
$20
$20

Head and tail indices are naturally dependent on the current operating mode.
High and low water marks are set at 3/4 and 1/4 of the buffer size. They
have significance only for XON/XOFF or RTS/CTS in connection with
RS-232.

173

Abacus Software

15 rsconf

Atari ST Internals

set RS-232 configuration

C: void rsconf(baud, ctrl f ucr, rsr, tsr,


int baud, Ctrl, ucr, rsr, tsr, scr;

scr)

Assembler:
move.w
move.w
move.w
move.w
move.w
move.w
move.w
trap
add.l

scr,(sp)
tsr,-(sp)
rsr,-(sp)
ucr,-(sp)
ctrl,-(sp)
baud,-(sp)
#15,-(sp)
#14
#14,sp

This XBIOS function serves to configure the RS-232 interface. The


parameters have the following signifcance:
scr:
tsr:
rsr:
ucr:
Ctrl:
baud:

Synchronous Character Register in the MFP


Transmitter Status Register in the MFP
Receiver Status Register in the MFP
USART Control Register in the MFP
Communications parameters
Baud rate

See the section on the MFP 68901 for information on the MFP registers. If
one of the parameters is -1, the previous value is retained. The handshake
mode can be selected with the ctrl parameter:
Ctrl
0
1
2
3

Meaning
No handshake, default after power-up
XON/XOFF
RTS/CTS
XON/XOFF and RTS/CTS (not useful)

174

Abacus Software

Atari ST Internals

The baud parameter contains an indicator for the baud rate:


baud
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Baud rate
19200
9600
4800
3600
2400
2000
1800
1200
600
300
200
150
134
110
75
50

Example:
move.w
move.w
move.w
move.w
move.w
move.w
move.w
trap
add.l

#-l,-(sp)
#-l,-(sp)
#-l,-(sp)
#-l,-(sp)
#l,-(sp)
#9,-(sp)
#15,-{sp)
#14
#14,sp

Don't change MFP registers

XON/XOFF
300 baud
rsconf

175

Abacus Software
16 keytbl

Atari ST Internals
set keyboard table

C: long keytbl(unshift, shift, capslock)


long unshift, shift, capslock;

Assembler:
move.l
move.l
move.l
move.w
trap
addi.l

capslock,-<sp)
shift,-(sp)
unshift,-(sp)
#16,-(sp)
#14
#14,sp

With this function it is possible to create a new keyboard layout. To do this


you must pass the address of the new tables which contain the key codes for
normal keys (without shift), shifted keys, and keys with caps lock. The
function returns the address of the vector table in which the three keyboard
table pointers are located. If a table should remain unchanged, -1 must be
passed as the address. A keyboard table must be 128 bytes long. It is
addressed via the key scan code and returns the ASCII code of the given
key.
Example:
move.l
move.l
move.l
move.w
trap
addi.l

#-l,-(sp)
Don't change caps lock
#shift,-(sp)
Shift table
#unshift,-(sp) Table without shift
#16,-(sp)
#14
#14,sp

shift:
...
unshift: ...

176

Abacus Software

17 random

Atari ST Internals

return random number

C: long random()

Assembler:
move.w #17,-(sp)
trap
#14
addq.l #2,sp

This function returns a 24-bit random number. Bits 24-31 are zero. With
each call you receive a different result. After turning on the computer a
different seed is created.
Example:
move.w #17,-(sp)
trap
#14
addq.l #2,sp

random

177

Abacus Software

Atari ST Internals

18 protobt

produce boot sector

C: void protobt(buffer, serialno,disktype, execflag)


long buffer, serialno;
int disktype, execflag;

Assembler:
move.w
move.w
move.l
move.1
move.w
trap
add.l

execflag,-(sp)
disktype,-(sp)
serialno,-(sp)
buffer,-(sp)
#18,-(sp)
#14
#14,sp

This function serves to create a boot sector. A boot setor is located on track
0, sector 1 on side 0 of a diskette and gives the DOS information about the
disk type. If the boot sector is executable, it can be be used to load the
operating system. With this function you can create a new boot sector, for a
different disk format or to change an existing boot sector. The parameters:
execflag: determines if the boot sector is executable.
0 not executable
1 executable
-1 boot sector remains as it was

The disk type can assume the following values:


0
1
2
3
-1

40 track,
40 track,
80 track,
80 track,
Disk type

single sided (180


double sided (360
single sided (360
double sided (720
remains unchanged

K)
K)
K)
K)

The parameter serialno is a 24-bit serial number which is written in the


boot sector. If the serial number is greater than 24 bits ($01000000), a
random serial number is created (with the above function). A value of -1
means that the serial number will not be changed.
The parameter buffer is the address of a 512-byte buffer which contains
the boot sector or in which the boot sector will be created.

178

Abacus Software

Atari ST Internals

A boot sector has the following construction:


Address 40 track SS

0- 1
2- 7
8-10
11-12
13
14-15
16
17-18
19-20
21
22-23
24-25
26-27
28-29
510-511

40 track DS

80 track SS

80 track DS

Branch instruction to boot program if executab:


'Loader'
24-bit serial number
512
512
EPS
512
512
2
2
SPC
1
2
1
1
1
RES
1
2
2
FAT
2
2
112
112
DIR
64
112
1440
720
SEC
360
720
248
249
MEDIA 252
253
5
2
5
SPF
2
9
SPT
9
9
9
2
1
SIDE
1
2
0
HID
0
0
0
CHECKSUM

The abbreviations have the following meanings:


EPS :

Bytes per sector. The sector size is 512 bytes for all formats

SPC :

Sectors per cluster. The number of sectors which are combined


into one block by the DOS, 2 sectors equals IK.

RES :

Number of reserved sectors at the start of the disk including the


boot sector.

FAT :

The number of file allocation tables on the disk.

DIR :

The maximum number of directory entries.

SEC :

The total number of sectors on the disk.

MEDIA : Media descriptor byte, not used by the ST-BIOS.


SPF :

Number of sectors in each FAT.

SPT :

Number of sectors per track.

179

Atari ST Internals

Abacus Software

s IDE : Number of sides of the diskette.


HID :

Number of hidden sectors on the disk.

The boot sector is compatible with MS-DOS 2.x. This is why all 16-bit
words are stored in 8086 format (first low byte, then high byte).
If the checksum of the whole boot sector is $1234, the sector is executable.
In this case the boot program is located at address 30. Example:
move.w
move.w
move.l
move.l
move.w
trap
add.l

#-l,-(sp)
#3,-(sp)
#-l,-(sp)
#buffer,-(sp)
#18,-(sp)
#14
#14,sp

Don't change executability


80 tracks DS
Don't change serial number
protobt

buffer ds.b 512

This example program can be used to adapt an existing boot sector for 80
tracks, double sided.

180

Abacus Software
19

Atari ST Internals

flopver

verify diskette sector

C: int flopver(buffer, filler, dev, sector, track, side,


count)
long buffer, filler;
int dev, sector, track, side, count;

Assembler:
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l

count,-<sp)
side,-(sp)
track,-(sp)
sector,-<sp)
dev,-<sp)
-(sp)
buffer,-(sp)
#19,-(sp)
#14
#16,sp

This function serves to verify one or more sectors on the disk. The sectors
are read from the disk and compared with the buffer contents in memory.
The parameters have the same meaning as for reading and writing sectors. If
the sector and buffer contents agree, the result of the function will be zero.
If an error occurs, the error number will be returned in DO that has the
following meaning:
0
-1
-2
-3
-4
-5
-6
-7
8
-9
-10
-11
-12
-13
-14
-15

OK, no error
General error
Drive not ready
Unknown command
CRC error
Bad request, invalid command
Seek error, track not found
Unknown media (invalid boot sector)
Sector not found
(No paper)
Write error
Read error
General error
Diskette write protected
Diskette was changed
Unknown device

181

Abacus Software

Atari ST Internals

-16 Bad sector (during verify)


-17 Insert diskette (for connected drive)

In the case of an error, the buffer will contain a list of erroneous sectors
(16-bit values), terminated by a zero word. If the BIOS function 4 rwabs
was used to write the sectors and if the variable /verify ($444) is set, the
sectors will automatically be verified after they are written.
Example:
move.w
move.w
move.w
move.w
move.w
clr.l
move.l
move.w
trap
add.l
tst
bmi

#l,-(sp)
#0,-(sp)
#39,-(sp)
#l,-(sp)
#0,-(sp)
-(sp)
#buffer,-(sp)
#19,-(sp)
#14
#16,sp
dO
error

A sector
Side zero
Track 39
Sector 1
Drive A
Buffer address
flopver

Error?

182

Abacus Software
20 SCrdmp

Atari ST Internals
output screen dump

C: void scrdmpO
Assembler:
move.w #20,-(sp)
trap
#14
addq.1 #2,sp

This function outputs a hardcopy of the screen to a connected printer. The


previously-set printer parameters ("desktop Printer setup") are used. You
can also perform this function by simultaneously pressing the ALT and
HELP keys or from the desktop through "Print Screen" from the "Options"
menu.
Example:
move.w #20,-(sp)
trap
#14
addq.l #2,sp

Hardcopy
Call XBIOS

183

Abacus Software

Atari ST Internals

21 CUFSCOnf

set cursor configuration

C: int cursconf(function,
int function, rate;

rate)

Assembler:
move.w
move.w
move.w
trap
addq. 1

rate,-(sp)
function,-(sp)
#21,-(sp)
#14
# 6,sp

This XBIOS function serves to set the cursor function. The parameter
function can have a value from 0-5, which have the following meanings:
function
0
1
2
3
4
5

Meaning
Disable cursor
Enable cursor
Flash cursor
Steady cursor
Set cursor flash rate
Get cursor flash rate

You can use this function to set whether the cursor is visible, and whether it
is flashing or steady. Thie XBIOS function returns a result only if you fetch
the old baud rate. The unit of the flash frequency is dependent on the screen
frequency: It is 70 Hz for a monochrome monitor or 50 Hz for a color
monitor. You can set a new flash rate with function number 5. You need
only use the parameter rate if you want to pass a new flash rate.
Example:
move.w
move.w
move.w
trap
addq.1

#20,-(sp)
#4,-(sp)
#21,-(sp)
#14
# 6,sp

20/70 seconds
Set flash rate
cursconf

184

Abacus Software
22 settime

Atari ST Internals
set clock time and date

C: void settime(time)
long time;

Assembler:
move.l
move.w
trap
add.l

time,-(sp)
#22,-(sp)
#14
#6,sp

This function is used to set the clock time and date. The time is passed in the
lower word of time and the date in the upper word. The time and date are
coded as follows:
bits 0- 4 Seconds in two-second increments
bits 5-10 Minutes
bits 11-15 Hours
bits 16-20 Day 1-31
bits 21-24 Month 1-12
bits 25-31 Year (minus offset 1980)

Example:
move.l
move.w
trap
addq.l

#%1011Q01100000100000000000000,-(sp)
#22,-(sp)
settime
#14
#6,sp

This call sets the date to the 16th of September, 1985, and the clock time to
8 o'clock.

185

Abacus Software

Atari ST Internals

23 gettime

return clock time and date

C: long gettime()
Assembler:
move.w #23,-(sp)
trap
#14
addq.l #2,sp

This function returns the current date and the clock time in the following
format:
bits 0- 4
bits 5-10
bits 11-15

Seconds in two-second increments


Minutes
Hours

bits 16-20
bits 21-24
bits 25-31

Day 1-31
Month 1-12
Year (minus offset 1980)

Example:
move.w
trap
addq.l
move.l

#23,-(sp)
#14
#2,sp
dO,time

gettime

Save time and date

186

Abacus Software
24 bioskeys

Atari ST Internals
restore keyboard table

C: void bioskeys <)


Assembler:
move.w #24,-(sp)
trap
#14
addq.l #2,sp

If you have selected a new keyboard layout with the XBIOS function 16,
keytbl, this function will restore the standard BIOS keyboard layout. You
can call this function, for example, before exiting a program of your own
which changed the keyboard layout.
Example:
move.w #24,-(sp)
trap
#14
addq.l #2,sp

bioskeys

187

Abacus Software

Atari ST Internals

25 ikbdws

intelligent keyboard send

C: void ikbdws(number, pointer)


int number;
long pointer;

Assembler:
move.l
move.w
move.w
trap
addq.l

pointer,-(sp)
number,-(sp)
#25,-(sp)
#14
#8,sp

This XBIOS function serves to transmit commands to the keyboard


processor (intelligent keyboard). The parameter pointer is the address of a
string to be sent, number is the length of a string minus 1.
Example:
move.l
move.w
move.w
trap
addq.l
string
strend

#string,-(sp)
#strend-string-l,-(sp)
#25,-(sp)
#14
#8,sp
dc.b
equ

$80,1
*

188

Address of the string


Length minus 1
ikbdws

Abacus Software

26 jdisint

Atari ST Internals

disable interrupts on MFP

C: void jdisint(number)
int number;

Assembler:
move.w
move.w
trap
addq.l

number,-(sp)
#26,-(sp)
#14
#4,sp

This function makes it possible to selectively disable interrupts on the MFP


68901. The parameter is the MFP interrupt number (0-15). The significance
of the individual interrupts is described in the section on interrupts.
Example:
move.w
move.w
trap
addq.l

#10,-(sp)
#26,-(sp)
#14
#4,sp

Disable RS-232 transmitter interrupt


Disable interrupt

189

Abacus Software

Atari ST Internals

27 jenabint

enable interrupts on MFP

C: void jenabint(number)
int number;

Assembler:
move.w
move.w
trap
addq.l

number,-(sp)
#27,-(sp)
#14
#4,sp

This function can be used to re-enable an interrupt on the MFP. The


parameter is again the number of the interrupt, 0-15.
Example:
move.w
move.w
trap
addq.l

#12,-(sp)
#27,-(sp)
#14
#4,sp

Enable RS-232 receiver interrupt


Enable interrupt

190

Abacus Software

28 giaccess

Atari ST Internals

access GI sound chip

C: char giaccess(data, register)


char data;
int register;

Assembler:
move.w
move.w
move.w
trap
addq.1

#register,-(sp)
#data,-(sp)
#28,-(sp)
#14
# 6,sp

This function allows access to the registers of the GI sound chip.


register must contain the register number of the sound chip (0-15). The
meaning of the individual registers is given in the hardware description of
the sound chip. Bit 7 of the register number determines whether the
specified register will be written or read:
Bit 7

0: Read
1: Write

When writing, an 8-bit value is passed in data; when reading, the function
returns the contents of the corresponding register.
Example:
move.w
move.w
move.w
trap
addq.l

#$80+3,-(sp)
#$50,-(sp)
#28,-(sp)
#14
#6,sp

Write register 3
Value to write

191

Abacus Software

29 offgibit

Atari ST Internals

reset Port A GI sound chip

C: void offgibit(bitnumber)
int bitnumber;

Assembler:
move.w
move.w
trap
addq.l

#bitnumber,-<sp)
#29,-(sp)
#14
#4,sp

A bit of port A of the sound chip can be selectively set with this function
call. Port A is an 8-bit output port in which the individual bits have the
following funtion:
Bit 0:

Select disk side 0/side 1

Bit
Bit
Bit
Bit
Bit
Bit

Select drive A
Select drive B
RS-232 RTS (Request To Send)
RS-232 DTR (Data Terminal Ready)
Centronics strobe
General Purpose Output

1:
2:
3:
4:
5:
6:

Bit 7:

unused

Example:
move.w
move.w
trap
addq.l

#4,-(sp)
#29,-(sp)
*14
#4,sp

DTR bit
offgibit

192

Abacus Software

30 ongibit

Atari ST Internals

clear Port A of GI sound chip

C: void ongibit(bitnumber)
int bitnumber;

Assembler:
move.w
move.w
trap
addq.l

fbitnumber,-(sp)
#30,-(sp)
#14
#4,sp

This function is the counterpart of the previous function. With this it is


possible to clear a bit of port A in the sound chip.
Example:
move.w
move.w
trap
addq.l

#4,-(sp)
#30,-(sp)
#14
#4,sp

DTR bit
ongibit

193

Abacus Software

Atari ST Internals

31 xbtimer

start MFP timer

C: void xbtimer(timer, control, data, vector)


int timer, control, data;
long vector;

Assembler:
move.l
move.w
move.w
move.w
move.w
trap
add.l

vector,-(sp)
data,-(sp)
control,-(sp)
timer,-(sp)
#31,-(sp)
#14
#12,sp

This function allows you to start a timer in the MFP 68901 and assign an
interrupt routine to it. timer is the number of the timer in the MFP:
Timer
Timer
Timer
Timer

A
B
C
D

:0
:1
:2
:3

The parameters data and control are the values which are placed in the
corresponding control and data registers of the timer. We refer you to the
hardware description of the MFP 68901.
The parameter vector is the address of the interrupt routine which will be
executed when the timer runs out. The four timers in the MFP are already
partly used by the operating system:
Timer
Timer
Timer
Timer

A:
B:
C:
D:

Reserved for the end user


Horizontal blank counter
200 Hz system timer
RS-232 baud rate generator
(the interrupt vector is free)

194

Abacus Software

.Atari ST Internals

Example:
move.l
move.w
move.w
move.w
move.w
trap
add.l

#vector,-(sp)
data,-(sp)
control,-(sp)
#0,-(sp)
#31,-(sp)
#14
#12,sp

Interrupt routine
Data and
Control registers
Timer A
xbtimer

195

Abacus Software

32 dosound

Atari ST Internals

set sound parameters

C: void dosound(pointer)
long pointer;

Assembler:
move.l
move.w
trap
addq.l

pointer,-(sp)
#32,-(sp)
#14
#6,sp

This function allows for easy sound processing. The parameter pointer
must point to a string of sound commands. The following commands can be
used:
Commands: $00-$OF
These commands are interpreted as register numbers of the sound
chip. A byte following this is loaded into the corresponding register.
Command $80
An argument follows this command which will be loaded into a
temporary register.
Command $81
Three arguments must follow this command. The first argument is the
number of the register in the sound chip in which the contents of the
temporary register will be loaded. The second argument is a
two's-complement value which will be added to the temporary
register. The third argument contains an end criterium. The end is
reached when the content of the temporary register is equal to the end
criterium.
Commands $82-$FF
One argument follows each of these commands. If this argument is
zero, the sound processing is halted. Otherwise this argument
specifies the number of timer ticks (20ms, 50Hz) until the next sound
processing.

196

Abacus Software

Atari ST Internals

Example:
move.l
move.w
trap
addq.l
pointer

tpointer,-(sp)
#32,-(sp)
#14
#6,sp

Pointer to sound command


dosound

dc.b 0,10,1,50,...

197

Abacus Software

Atari ST Internals

33 setprt

set printer configuration

C: void setptr(config)
int config;

Assembler:
move.w
move.w
trap
addq.l

config,-(sp)
#33,-(sp)
#14
#4,sp

This function allows the printer configuration to be read or changed. If


config contains the value -1, the current value is returned, otherwise the
value is accepted as the new printer configuration. The printer configuration
is a bit vector with the following meaning:
Bit number
0
1
2
3
4
5
6-14

15

matrix printer
monochrome printer
Atari printer
Test mode
Centronics port
Continuous paper
reserved

daisy-wheel
color printer
Epson printer
Quality mode
RS-232 port
Single-sheet

always 0

Example:
move.w
move.w
trap
addq.l

#%OOQ100,-(sp)
#33,-(sp)
#14
#4,sp

Epson printer
setprt

198

Abacus Software

34 kbdvbase

Atari ST Internals

return keyboard vector table

C: long kbdvbase()

Assembler:
move.w f34,-(sp)
trap
#14
addq.l #2,sp

This XBIOS function returns a pointer to a vector table which contains the
address of routines which process the data from the keyboard processor.
The table is constructed as follows:
long
long
long
long
long
long
long

midivec
vkbderr
vmiderr
statvec
mousevec
clockvec
joyvec

MIDI input
Keyboard error
MIDI error
IKBD status
Mouse routines
Clock time routine
Joystick routines

The parameter midivec points to a routine which writes data received from
the MIDI input (byte in DO) to the MIDI buffer.
The parameters vkbderr and vmiderr are called when an overflow is
signaled by the keyboard or MIDI ACIA.
The remaining four routines statvec, mousevec, clockvec, and joyvec
process the corresponding data packages which come from the keyboard
ACIA. A pointer to the packaged received is passed to these routines in DO.
The mouse vector is used by GEM. If you want to use your own routine,
you must terminate it with RTS and it may not require more than one
millisecond of processing time.
Example:
move.w #34,-<sp)
trap
#14
addq.l #2,sp

kbdvbase

199

Abacus Software

Atari ST Internals

We get $AOE as the result The vector field contains the following values:
AOE
A12
A16
A1A
A1E
A22
A26
A2A
A2E

midivec
vkbderr
vmiderr
statvec
mousevec
clockvec
joyvec
MIDI
keyboard

200

$79C6
$759C
$759C
'$7034
$15296
$6A46
$7034
$7556
$7568

Abacus Software

35 kbrate

Atari ST Internals

set keyboard repeat rate

C: int kbrate(delay, repeat)


int delay, repeat;

Assembler:
move.w
move.w
move.w
trap
addq.1

repeat,-(sp)
delay,(sp)
#35,-(sp)
#14
# 6, sp

The keyboard repeat can be controlled with this function. The parameter
delay specifies the delay time after a key is pressed before the key will
automatically be repeated. The parameter repeat determines the time span
after which the key will be repeated again. These values can be changed
from the desktop by means of the two slide controllers on the control panel.
The times are based on the 50 Hz system clock. If -1 is specified for one of
the parameters, the corresponding value is not set. The function returns the
previous values as the result; bits 0-7 contain the repeat value and bits
8-15 the value of delay.
Example:
move.w
move.w
move.w
trap
addq.l

#-l,-(sp)
#-l,-(sp)
#35,-(sp)
#14
#6,sp

Read old values


kbrate

Result: DO = $OB03

201

Abacus Software

Atari ST Internals

36 prtblk

output block to printer

C: void prtblk(parameter)
long parameter;

Assembler:
move.l
move.w
trap
addq.1

parameter,-(sp)
#36,-(sp)
#14
# 6, sp

This function resembles the function scrdmp(2Q) and is used by it. The
function expects a parameter list, however, whose address is passed to it.
This list is constructed as follows:
long
int
int
int
int
int
int
int
long
int
int
long

blkprt
offset
width
height
left
right
scrres
dstres
colpal
type
port
masks

Address of the screen RAM


Screen width
Screen height

Screen resolution (0, 1, or 2)


Printer resultion (0 or 1)
Address of the color palette
Printer type (0-3)
Printer port (0=Centronics, 1=RS232)
Pointer to half-tone mask

Assembler:
move.l
move.w
trap
addq.1

^parameter,-(sp)
#36,-(sp)
#14
# 6, sp

Address of the parameter block


prtblk

parameter dc.1 ...

202

Abacus Software

37 WVbl

Atari ST Internals

wait for video

C: void wvbl()

Assembler:
move.w #36,-(sp)
trap
#14
addq.l #2,sp

This function waits for the next picture return. It can be used to synchronize
graphic outputs with the beam return, for example.
Example:
move.w #36,-(sp)
trap
#14
addq.l #2,sp

wait for wvbl

203

Abacus Software

38 SUpexec

Atari ST Internals

set supervisor execution

C: void supexec(address)
long address;

Assembler:
move.1
move.w
trap
addq.1

address,-(sp)
#38,-(sp)
#14
# 6,sp

If a routine is to be executed in the supervisor mode of the 68000 processor,


you can accomplish this with this function. Simply pass the address of the
routine to the function. Example:
move.1
move.w
trap
addq.1
address

#address,-(sp)
#38,-(sp)
#14
# 6,sp
move.l $400,00

204

Abacus Software

39 puntaes

Atari ST Internals

disable AES

C: void puntaes()

Assembler:
move.w #39,-(sp)
trap
#14
addq.l #2,sp

The AES can be disabled with this function, provided it is not in ROM.
Example:
move.w #39,-(sp)
trap
#14
addq.l #2,sp

205

Abacus Software

Atari ST Internals

3.4 The Graphics

Next to the high processing speed and the large memory available, the
graphics capability is certainly the most fascinating aspect of the ST. With
the standard monochrome monitor and the resolution of 640x400 points, it
creates a whole new price/performance class for itself. But also in the color
resoultion the ST can display 16 colors with 320x200 screen points.
In this chapter we want to explain how the graphics are organized and how
you can create fast and effective graphics without using the GEM graphics
package, which is rather complicated for beginners. The ST offers the
programmer (assembler and C) very useful routines, with whose help
graphics programming isn't quite child's play, but they can take away a
good deal of the programming work. Unfortunately, some of these
functions are so comprehensive that a detailed description would exceed the
scope of this book. We have therefore had to limit ourselves to the simpler,
but no less interesting functions.
These graphics routines are called in a very elegant manner. The software
developers have made use of the fact that there are two groups of opcodes in
the 68000 which the 68000 does not "understand" and which generate a
trap, or software interrupt, when they are encountered in a program. These
are the two groups of opcodes which begin with $Axxx and $Fxxx. In the
ST, the $Axxx opcode trap is used in order to access the graphics routines.
The trap handler, the program called by the trap, checks the lowest byte of
the "command" to see what value it has. Values between zero and $E are
permissable here. This gives a total of 14 graphics routines, which should
first be presented in an overview. Later we will talk about the actual
commands in detail.
$AOOO
$A001
$A002
$A003
$A004
$A005
$A006
$A007

Determine address of required variable range


Set point on the screen
Determine color of a screen point
Draw a line on the screen
Draw a horizontal line (very fast!)
Fill rectangle with color
Fill polygon line by line
Bit block transfer

$A008 Text block transfer


$A009 Enable mouse cursor
$AOOA Disable mouse cursor

206

Abacus Software

$AOOB
$AOOC
$AOOD
$AOOE

Atari ST Internals

Change mouse cursor form


Clear sprite
Enable sprite
Copy raster form

These routines are the ground work for the hardware-dependent part of
GEM. All GEM graphic and text output is performed by the routines of the
$Axxx opcodes. The set of A-opcodes are very useful in games. In games
windows are needed only in the rarest cases. Another important point is the
speed of the A-instructions. Using the graphic routines directly is clearly
faster than if the output is handled by GEM. Before we describe the
individual commands in detail, we will take a brief look at the construction
of graphics in the various graphic modes of the ST.
Immediately after turning the ST on, an area of 32K bytes is initialized at the
upper memory border as the video RAM. In normal operation this results in
addresses $78000 to $7FFFF acting as the screen RAM. This video RAM
can be viewed as a window in the ST. We will start with the simplest mode,
the 640x400 mode. In this case each 80 bytes, or better, each 40 words
forms one screen line. The word with the lowest address is displayed on the
left edge of the screen, the additional words are displayed in order from left
to right. Within a word, the highest-order bit lies at the left and the
lowest-order bit at the right
With this data, any point on the screen can be easily controlled or read. For
example, to set the first screen point, the value $8000 must be written into
memory location $78000. Therefore you might store $8000 into memory
location $78000. But this isn't recommended.
You might recall that the screen RAM in the ST can be moved quite easily.
Then the absolute address of $78000 is no longer correct, of course. For
this reason, it is usually more advantageous to set the the point with the "A"
function $A001. Function $A001 assumes an X-Y coordinate system with
origin in the upper left-hand corner, and determines the position of the video
RAM itself in order to set the point at the proper screen location.
In this resolution mode, each screen point is represented by a bit. If the bit
is set, the point appears dark, or bright if the die inverse display mode is
selected in color palette register 0. The screen consists of only one bit plane.
Different colors cannot be represented with just one plane, however. This is
why when the resolution increases in the color modes, the number of
displayable colors decreases.

207

Atari ST Internals

Abacus Software

Figure 3.4-1 LO-RES-MODE (0)

319

VIDEO

COLOR

NUMBER

SCREEN

U .UJ

1.1.Li I

VIDEO-RAM

208

Abacus Software

Atari ST Internals

Four colors possible in the 640x200 resolution mode. In this mode, two
contiguous memory words form a single logical entity. The color of a point
is determined by the value of the two corresponding bits in the two words.
If both bits are zero, the background color results. Therefore two sequential
words are used together for pixel representation. For the colors, however,
all odd words belong to a plane. The second plane is made up of the even
words. In this mode, there are two planes available.
Things become quite colorful in the mode with "only" 320x200 points. In
this operating mode, 4 contiguous memory words form one entity which
detemines the color of the 16 pixels. To stick to the example we used
before: in order to set the point in the upper left-hand corner, the topmost
bits of words $78000, $78002, $78004, and $78006 must be manipulated.
The desired color results from the bit pattern in the words. It naturally
requires some computer time to set a point in the desired color, independent
of the mode. All of this work is handled by the $A001 routine, however.
This routine sets all of the pertaining bits for the desired color in the current
resolution. Naturally, all four planes are present in this mode. The first
plane, keeping to our example, made up of the words at address $7FOOO,
$7F008, $7F010, ..., and the other planes are composed of the other
addresses correspondingly.
Another point to be clarified concerns the fonts or character sets. Since the
ST does not have a text mode, only a graphics mode, the text output is
created in high-resolution graphics. There are three different fonts built into
the ST. You can load additional fonts from disk. Each font has a header
which contains important information about the displayable characters.
Since the important data are contained in the font header, there are unusually
few limits for display. The characters can be arbitrarily high or wide. The
age of the 8x8 matrix for character output is over. Genuine proportional
type on the screen (!) is even possible.
The three built-in fonts use relatively few of the many possibilities which
GEM allows for character generation. All three fonts are mono-spaced
fonts, meaning they have a fixed defined size in pixels and a defined pitch.
The smallest font has a matrix of 6x6. With a resolution of 640x400 points,
66 lines of 106 characters each can be displayed. This font is only
accessible for output under GEM, not for output under TOS, and is used in
the output of the directory in the icon form, for example. The next-largest
type is composed of 8x8 points. This type is used when a color monitor is
connected to the ST, while the third and largest font is used for the normal
black-and-white mode. This font uses a matrix of 8x16 points.

209

Abacus Software

Atari ST Internals

Figure 3.4-2 MEDIUM-RES-MODE (1)


639

0 1 2

VIDEO

COLOR

SCREEN

NUMBER

VIDEO-RAM

210

Abacus Software

Atari ST Internals

The exact layout of the font header is found under command $AQ08, which
represents a very versatile text output which goes far beyond what is
possible with the routine of the BIOS and GEMDOS.
Finally, we must clarify some of the terms which will come up often in the
following descriptions, whose meaning may not be so clear. These are the
terms CONTRL array, INTIN array, INTOUT array, PTSIN array and
PTSOUT array. These arrays are mainly used by GEM to pass parameters
to individual GEM functions or to store results from these functions. But
line-A functions use parts of these arrays to pass parameters also. The
arrays are defined in memory as data areas, whereby each element in the
array consists of 2 bytes.
For GEM functions, the CONTRL array always contains the number
desired in the first element (CONTRL(0)). This parameter is not used by the
line-A commands, however. CONTRL(l) contains the number of XY
coordinates required for the function. These coordinates must be placed in
the PTSIN array before the call. The element CONTRL(2) is not supplied
before the call. After the call it contains the number of XY coordinates in the
PTSOUT array. CONTRL(3) specifies how many parameters will be
passed to the function in the INTIN array, while CONTRL(4) contains the
number of parameters in the INTOUT array after the call. The additional
parameters of the CONTRL array are not relevant for users of the line A.
Unfortunately, not all of the parameters for the A opcodes can be in these
arrays. For this reason there is another memory area which used as a
variable area for (almost) all graphic outputs. The function and use of these
over 50 variables is found in a table at the end of this chapter. Important
variables are also explained in conjunction with the functions which require
them.
By the way, you should be aware that registers DO to D2 and AO to A2 are
changed by calling the functions. Important values contained in these
registers should be saved before a call.

211

Abacus Software

Atari ST Internals

Figure 3.4-3 HI-RES-MODE (2)


0 1 2

639

VIDEO

COLOR

SCREEN

NUMBER

VIDEO-RAM

212

Abacus Software

Atari ST Internals

$AOOO Initialize
Initialize is really the wrong expression for this function. After the call, the
addresses of the more important data areas are returned in registers DO and
AO to A2. This function does not require input parameters.
The program is informed of the starting address of the line-A variables in
DO and AO. After the call, Al points to a table with three addresses. These
three addresses are the starting address of the three system font headers.
Register A2 points to a table with the starting addresses of the 15 line-A
routines.
This opcode destroys (at least) the contents of registers DO to D2 and AO to
A2. Important values should be saved before the call.

$A001 PUT PIXEL


This opcode sets a point at the coordinates specified by the coordinates in
P T S I N ( O ) and PTSIN(!) . The color is passed in I N T I N < O ) . P T S I N ( O )
contains X-coordinate, PTSIN(I) the Y-coordinate.
The coordinate system used has its origin in the upper left corner. The
possible range of the X and Y coordinates is naturally set according to the
graphic mode enabled. Overflows in the X range are not handled as errors.
Instead, the Y coordinate is simply incremented by the appropriate amount.
No output is made if the Y range is exceeded.
The color in INT IN (0) is dependent on the mode used. When driving the
monochrome monitor, only bit zero of the value of INT IN < o) is evaluated.

$A002 GET PIXEL


The color of a pixel can be determined with this opcode. As with $A001,
the XY coordinates are passed in PTSIN {o) and PTSIN (i); the color value
is returned in the DO register.

213

Abacus Software

Atari ST Internals

$A003 LINE
With the LINE opcode a line can be drawn bewteen the points with
coordinates xl,yl and x2,y2. The parameters for this function are not
passed via the parameter arrays, but must be transferred to the line-A
variables before the call. The variables used are:
_X1
_Y1
_X2
_Y2
_FG_BP_1
_FG_BP_2
_FG_BP_3
_FG_BP_4
_LN_MASK

=
=
=
=
=
=
=
=
=

xl coordinate
yl coordinate
x2 coordinate
yl coordinate
Plane 1 <all three modes)
Plane 2 (640x200, 320x200)
Plane 3 (only 320x200)
Plane 4 (only 320x200)
Bit pattern of the line
For example: $FFFF = filled
$CCCC = broken
_WRT_MOD = Determines the write mode
_LSTLIN = This variable should be set to -1 ($FFFF)

One point to be noted for some applications is the fact that when drawing a
line, the highest bit of the line bit pattern is always set on the left screen
edge. The line is always drawn from left to right and from top to bottom,
not from xl,yl to x2,y2.
Range overflows are handled as for PUT PIXEL. If an attempt is made to
draw a line from 0,0 to 650,50, a line is actually drawn from, 0,0 to
639,48. The "remainder" results in an additional line from 0,49 to 10,50.
A total of four different write modes, with values 0 to 3, are available for
drawing lines. With write mode zero, the original bit pattern "under" the line
is erased and the bit pattern determined by _LN_MASK is put in its place
(replace mode). In the transparent mode (_WRT_MOD=I), the background, the
old bit pattern, is ORed with the new line pattern so only additional points
are set. In the XOR mode (_WRT_MOD=2), the background and the line
pattern are exclusive-ored. The last mode (_WRT_MOD=S) is the so-called
"inverse transparent mode." As in the transparent mode, it involves an OR
combination of the foreground and background data, in which the
foreground data, the bit pattern determined by _LN_MASK, are inverted
before the OR operation.

214

Abacus Software

Atari ST Internals

$A004 HORIZONTAL LINE


This function draws a line from xl,yl to x2,y 1. Drawing a horizontal line is
significantly faster than when a line must be drawn diagonally. Diagonal
lines are also created with this function, in which the line is divided into
multiple horizontal lines segments. The parameters are entered directly into
the required variables.
_X1
_Y1
_X2
_FG_BP_1
_FG_BP_2
_FG_BP_3
_FG_BP_4
_WRT_MOD
_jpatptr
_patmsk

=
=
=
=
=
=
=
=
=
=

xl coordinate
yl coordinate
x2 coordinate
Plane 1 (all three modes)
Plane 2 (640x200, 320x200)
Plane 3 (only 320x200)
Plane 4 (only 320x200)
Determines the write mode
Pointer to the line pattern to use
"Mask" for the line pattern

The valid values in _WRT_MOD also lie between 0 and 3 for this call. The
contents of the variable _patptr is the address at which the desired line
pattern or fill pattern is located. The H-line function is very well-suited to
creating filled surfaces. The variable _patmsk plays an important role in
this. The number of 16-bit values at the address in _patptr is dependent
on the its value. If, for example, jpatmsk contains the value 5, six 16-bit
values should be located at the address in jpatptr as the line pattern. If a
horizontal line with the Y-coordinate value zero is to be drawn, the first bit
pattern is taken as the line pattern. The second word is taken as the pattern
for a line drawn at Y-coordinate 1, and so on. The pattern for a line with
Y-coordinate 6 is again determined by the first value in the bit table. In this
manner, very complex fill patterns can be created with relatively little effort.

215

Abacus Software

Atari ST Internals

$A005 FILLED RECTANGLE


The opcode $A005 represents an extension, or more exactly a special use,
of opcode $A004. It is used to created filled rectangles. The essential
parameters are the coordinates of the upper left and lower right corners of
the of the rectangle.
_X1
_Y1
_X2
_Y2
_FG_BP_1
_FG_BP_2
_FG_BP_3
_FG_BP_3
_WRT_MOD
_jpatptr
jpatmsk
_CLIP
_XMN_CLIP
_XMX_CLIP
_YMN_CLIP
_YMX_CLIP

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

xl coordinate, left upper


yl coordinate
x2 coordinate, right lower
y2 coordinate
Plane 1 (all three modes)
Plane 2 (640x200, 320x200)
Plane 3 (only 320x200)
Plane 4 (only 320x200)
Determines the write mode
Pointer to the fill pattern used
"Mask" for the fill pattern
Clipping flag
X minimum for clipping
X maximum for clipping
Y minimum for clipping
Y maximum for clipping

We have already explained all of the variables except the "clipping"


variables. What is clipping? Clipping creates extracts or clippings of the
total picture. If the clipping flag is set to one (or any value not equal to
zero), the rectangle, drawn by $A005, is displayed only in the area defined
by the clipping-area variables. An example may explain this behavior better:
The values 100,100 and 200,200 are specified as the coordinates. The clip
flag is 1 and the clip variables contain the values 150,150 for XMN_CLIP and
YMN CLIP as well as 300,300 for XMX_CLIP and YMX_CLIP. The value
$FFFF will be chosen as the fill value for all of the lines. With these values,
the rectangle will have the coordinate 150,150 as the upper left corner and
200,200 as the lower right. The "missing" area is not drawn because of the
clip specifications. Clearing the clip flag draws the rectangle in the originally
desired size.

216

Abacus Software

Atari ST Internals

$A006 FILLED POLYGON


$A006 is also an extension of $A004. Arbitrary surfaces can be filled with a
pattern with this function. The entire surface is not filled with the call: just
one raster line is filled, a horizontal line with a width of one point. The
result is that there are significantly more options for influencing the fill
pattern.
The necessary variables are:
PTSIN
CONTRL(l)
_Y1
_FG_BP_1
_FG_BP_2
_FG_BP_3
_FG_BP_3
_WRT_MOD
_patptr
_patmsk
_CLIP
_XMN_CLIP
_XMX_CLIP
_YMN_CLIP
_YMX_CLIP

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

Array with the XY coordinates


Number of coordinate pairs
yl coordinate
Plane 1 (all three modes)
Plane 2 (640x200, 320x200)
Plane 3 (only 320x200)
Plane 4 (only 320x200)
Determines the write mode
Pointer to the fill pattern used
"Mask" for the fill pattern
Clipping flag
X minimum for clipping
X maximum for clipping
Y minimum for clipping
Y maximum for clipping

Basically, all of the parameters here are to be set exactly as they might be for
a call to $A005. Only the first three coordinates are different. The XY
coordinates are stored in the PTSIN array. It is important you specify the
start coordinate again as the last coordinate as well. In order to fill a triangle,
you must, for example, enter the coordinates (320,100), (120,300),
(520,300), and (320,100). The number of effective coordinate pairs, three
in our example, must be placed in CONTRL (1), the second element of the
array. With a call to the $A006 function you must also specify the
Y-coordinate of the line to be drawn. Naturally you can fill all Y-coordinates
from 0 to 399 (0 to 199 in the color modes) in order. But it is faster to find
the largest and smallest of the XY values and call the funtion with only these
as the range.

217

Abacus Software

Atari ST Internals

$A007 BITBLT
The bit block transfer is used by the text block transfer, $AQ08, and copy
raster form, $AOOE. Register A6 must contain a pointer to a parameter table.
Unfortunately, the construction of this parameter table could not be
determined definitively. Our attempts led to classic system crashes about
70% of the time. For this reason, we cannot say much about the function.

$A008 TEXTBLT
A character from any desired text font can be printed at any graphic position
with the TEXT BLock Transfer function. In addition, the form of the
character can be changed. The character can be displayed in italics,
boldface, outlines, enlarged, or rotated. These things cannot be achieved
with the "normal" character outputs via the BIOS or GEMDOS. But to do
this, a large number of parameters must be set and controlled. A rather
complicated program must be written in order to output text with this
function. If the additional options are not absolutely necessary, it is
advisable not to use this function. But please decide for yourself.
Before we produce a character on the screen, we must first concern
ourselves with the organization of the fonts. We must take an especially
close look at the font header because the font is describe in detail by the
information contained in it
Basically, a font consists of four sets of data: font header, font data,
character offset table, and horizontal offset table. The font header contains
general data about the font, such as its name and size, the number of
characters it contains, and various other aspects. This information takes up a
total of 88 bytes. The font data contains the bit pattern of the existing,
displayable characters. These data are organized so as to save as much space
as possible.
In order to be able to better describe the organization, we will imagine a font
with only two characters, such as "A" and "B". These characters are to be
displayed in a 9x9 matrix. The font data are now in memory so that the bit
pattern of the top scan line of the "A" is stored starting at a word boundary.
Since our font is 9 pixels = 9 bits wide, one byte is completely used, but
only the top bit of the following byte. 7 bits must be wasted if the top scan
line of the "B" is also to begin on a word boundary. This is not so,
however, and the first scan line of the "B" starts with bit 6 of the second
218

Abacus Software

Atari ST Internals

byte of the font data. Only the data of the second and further scan lines
always start on a word boundary. In this manner, almost no bits are wasted
in the font Only the start of the scan lines of the first character actually
begin on a word boundary; all other scan lines can begin at any bit position.
Because of this space-saving storage, the position of each character within
the font must be calculated. The calculation of the scan-line positions is
possible through the character offset table. This table contains one entry for
each displayable character. For our example, such a table would contain the
entries $0000, $0009, $0012. Through the direction of this table, it is
possible to create true proportional type on the screen since the width of
each character can be calculated. One subtracts the entry of the character to
be displayed from the entry of the next character. The last entry is present so
that the width of the last character can also be determined, although it is not
assigned to a character.
In addition to the character offset table there is the horizontal offset table.
This table is not used by most of the fonts, however. The fonts present in
the ST do not use all the possibilities of this table either. If this table were
present, it would contain a positive or negative offset value for each
character, in order to shift the character to the right or left during output
At the end of the description of the font construction are the meanings of the
variables in the font header.
Bytes

0-1

Bytes

2- 3

Bytes 4-35
Bytes 36-37
Bytes 38-39
Bytes 40-49
Bytes 50-51
Bytes 52-53

Bytes 54-55

Font identifier. A number which describes the


font.
l=system font
Font size in points (point is a measure used
in type-setting).
The name of the font as an ASCII string.
The lowest ASCII value of the displayable
characters.
The highest ASCII value of the displayable
characters.
Relative distances of top, ascent, half,
descent, and bottom line from the base line.
Width of the broadest character in the font.
Width of the broadest character cell. The cell
is always at least one pixel wider than the
actual character so that two characters next
to each other are separated from each other.
: Linker offset.

219

Abacus Software

Atari ST Internals

Bytes 56-57 : Right offset. The two offset values are only
used for displaying the font in italics
(skewing).
Bytes 58-59 : Thickening. If a character is to be displayed
in boldface, the value of this variable is
used.
Bytes 60-61 : Underline. Contains the height of the
underline in pixels.
Bytes 62-63 : Lightening mask. "Light" characters are found
on the desktop when an option on a pull-down
menu is not available. This light grey
character consists of masking the bits with
the lightening mask. Usually the value is
$5555.
Bytes 64-65 : Skewing mask. As before, only for displaying
characters in italics.
Bytes 66-67 : Flag. Bit 0 is set if the font is a system
font.
Bit 1 must be set if the horizontal offset
table is present.
Bit 2 is the so-called byte-swap flag. If it
is set, the bytes in memory are in 68000
format (low byte-high byte). A cleared swap
flag signals that the data is in INTEL format,
reversed in memory. With this bit the fonts
from the IBM version of GEM can be used on the
ST and vice versa.
Bit 3 is set if the width of all characters in
the font is equal.
Bytes 68-71 : Pointer to the horizontal offset table or
zero.
Bytes 72-75 : Pointer to the character offset table.
Bytes 76-79 : Pointer to the font data.
Bytes 80-81 : Form width. This variable contains the sum of
widths of all the characters. The value
represents the length of the scan lines of all
of the characters and thereby the start of the
next line.
Bytes 82-83 : Form height. This variable contains the number
of scan lines for this font.
Bytes 84-87 : Contain a pointer to the next font.

220

Abacus Software

Atari ST Internals

After so much talk, we should now list the parameters which must be noted
or prepared for the $A008 opcode.
_WRT_MODE
_TEXT_FG
_TEXT_BG
_FBASE
_FWIDTH
_SOURCEX
_SOURCEY
_DESTX
JDESTY
_DELX
_DELY
_STYLE
_LITEMASK
_SKEWMASK
_WEIGHT
_R_OFF
_L_OFF
_SCALE
_XACC_DDA
_DDA_INC
_T_SCLSTS
_CHUP
_MONO_STATUS
_scrtchp
_scrpt2

Write mode
Text foreground color
Text background color
Pointer to the start of the font data
Width of the font
X-coordinate of the char in the font
Y-coordinate of the char in the font
X-coordinate of the char on the screen
Y-coordinate of the char on the screen
Width of the character in pixels
Height of the character in pixels
Bit-wise coded flag for special effects
Bit pattern used for "lightening"
Bit pattern used for skewing
Factor for character enlargement
Right offset of the char for skewing
Left offste of the char for skewing
Flag for scaling
Accumulator for scaling
Scaling factor
Scaling direction flag
Character rotation vector
Flag for monospaced type
Pointer to buffer for effects
Offset scaling buffer in _scrtchp

The five clip variables are also evaluated.


As you can see, an enormous number of variables are evaluated for the
output of graphic text. Here we can go into only the essential (and those we
explored) variables.
The write mode allows the output of characters in the four known modes,
replace, OR, XOR, and inverse OR. There are 16 other modes available
whose effects are not yet known. The variable _TEXT_FG is in connection
with first four write modes. They form the foreground color used for
display. The background color _TEXT_BG plays a role only with the 16
additional modes. It is clear that the additional modes are relevant only in
connection with a color screen.
221

Abacus Software

Atari ST Internals

The variables _FBASE and _FWIDTH are set according to the desired font.
You can find the start of the font data from the header of the desired font
(bytes 76-79 in the header). _FWIDTH must be loaded with the contents of
the bytes 80 and 81 of the header.
The parameter _SOURCEX determines which character you output. It should
contain the ASCII value of the desired character.
The parameter _SOURCEY is usually zero because the character is to be
generated from the top to the bottom scan line.
The parameter _DELX can be be calculated as the width of the character in
which the entry in the character offset table of the desired character is
subtracted from the next entry. The result is the width of the character in
pixels. _DELY must be loaded with the value of byte 82-83 of the header.
The _STYLE is something special. Here you can specify if characters should
be displayed normally or changed. The possible changes are boldface
(thicken, bit 0), shading (lighten, bit 1), italic (bit 2), and outline (bit 4).
The given change is enabled by setting the corresponding bit. Another
change is scaling. The size of a character can be changed through scaling.
Unfortunately, characters can only be enlarged on the ST.
If the scaling flag is cleared (zero), the character is displayed in its original
size. The _T_SCLSTS flag determines if the font is to be reduced or
enlarged. A value other than zero must be placed here for enlarging.
_DDA_INC should contain the value of the enlargement or reduction. An
enlargement could be produced only with a value of $FFFF.
Another interesting variable is _CHUP. With the help of this variable,
characters can be rotated on the screen. The angle must be given in the range
0 to 360 degrees in tenths of a degree. A restriction must also be made for
this function. Usuable results are obtainable only with rotations by 90
degrees. The values are $0000 for normal, $0384 for 90-degree rotation,
$0704 (upside-down type), and $OA8C for 270 degrees.
To work with the effects, _scrchp must contain a pointer to a buffer in
which TEXTBLT can store temporary values. The exact size of this buffer
is not known, but we always found a buffer of IK to be sufficient. Another
buffer must be specified for enlargement (_scrtpt2). An offset is passed as
a parameter which refers to the start of the _scrtchp buffer. A value of $40
proved to be sufficient here.
222

Abacus Software

Atari ST Internals

$A009 SHOW MOUSE


Calling this opcode enables the display of the mouse cursor. The cursor
follows the mouse when it is moved. If the mouse cursor is disabled, the
mouse can be used in programs which abandon the user interface GEM.
This option is particularly useful for games.
The parameters required are passed in the INT IN and CONTRL arrays.
CONTRL ( i) should be cleared before the call and CONTRL (3) set to one.
INT IN (o) has a special significance. The routine for managing the mouse
cursor counts the number of calls to remove and enable the cursor. If the
cursor is disabled twice, two calls must be made to re-enable it before it will
actually appear on the screen. This behavior can be changed by clearing
INTIN (o). With this parameter the cursor is immediately set independent of
the number of previous HIDE CURSOR calls. If the value in INTIN < o) is
not equal to zero the actually required number of $ AQ09 calls must be made
in order to make the cursor visible.

$AOOA HIDE CURSOR


This functions hides the cursor. If this function is called repeatedly, the
number is recorded by the operating system and determines the number of
calls of SHOW CURSOR before the cursor actually appears.

$AOOB TRANSFORM MOUSE


Is the arrow unsuited as a mouse cursor for games? Simply make your own
cursor. How would it be if a little car moved across the screen instead of an
arrow? The opcode $AOOB gives your fantasy free reign, at least as far as it
concerns the mouse cursor.
The parameters must be passed in the INTIN array. A total of 34 words are
necessary. The following table gives information about the use and possible
values:
INTIN(3) Mask color index, normally 0
INTIN(4) Data color index, normally 1
INTIN(5) to INTIN(20) contain 16 words of the cursor mask
INTIN(21) to INTIN (36) contain 16 words of cursor data

223

Abacus Software

Atari ST Internals

The form of the cursor is determined by the cursor data. Each 1 in the data
creates a point on the screen. If a cursor is placed over a letter or pattern on
the screen, the border between the cursor and the background cannot be
determined. The mask enters at this point. Each set bit in the mask clears the
background at the given location. This permits a light border to be drawn
around the cursor. Take a look at the normal arrow cursor in order to see the
operation of the mask.

$AOOC UNDRAW SPRITE


This opcode is related to $AOOD, DRAW SPRITE. The ST actually has no
hardware sprites in sense in which sprite is used on something like the
Commodore 64. The ST sprites are organized purely in software. Each
sprite is 16x16 pixels large. One example of an ST sprite is the mouse
cursor. It is created with this function.
In order to clear a previously-drawn sprite, the address of a buffer in which
the background was saved when the sprite was drawn is passed in register
A2. The opcode simply transfers the contents of the background buffer to
the right spot on the screen. The buffer itself must be 64 bytes large for each
plane. Another 10 bytes are used, independent of the number of planes. For
monochrome display, the buffer is a total of 74 bytes long, while in the
320x200 pixel resolution (for planes), it is 4x64+10=266 bytes large.

$AOOD DRAW SPRITE


This function draws the desired sprite on the screen. Parameters must be
passed in the DO, Dl, AO, and A2 registers.
DO and Dl contain the X and Y-coordinates of the position of the sprite on
the screen, called the hot spot. AO is a pointer to the so-called sprite
definition block and A2 contains the address of the sprite buffer in which
the backgroud will be saved for erasing the sprite later.
The sprite definition block must have the following construction:
Word
Word
Word
Word
Word

1
2
3
4
5

:
:
:
:
:

X offset to hot spot


Y offset to hot spot
Format flag 0=VDI format, 1=XOR format
Background color (bg)
Foreground color (fg)

224

Abacus Software

Atari ST Internals

Following this are 32 words which contain the sprite pattern. The pattern
must be in memory in the following order:
Word
Word
Word
Word
etc.

6
7
8
9

:
:
:
:

Background pattern
Foreground pattern
Background pattern
Foreground pattern

of
of
of
of

the
the
the
the

top line
top line
second line
second line

The information in the format flag has the following significance:


fg bg
0
0
0
1
1
0
1
1

VDI Format
Result
The background appears
The color in word 4 appears
The color in word 5 appears
The color in word 5 appears

XOR Format
Result
The background appears
The color in word 4 appears
The pixel on the screen is XORed with the fb
bit
1
The color in word 5 appears

fg bg
0
0
0
1
1
0
1

$AOOE COPY RASTER FORM


Arbitrary areas of the screen can be copied with the $AOOE opcode. Not
only areas within the screen, but also from the screen into free RAM, and
even more important, from the RAM to the screen. Even complete screen
pages can be copied very quickly with the COPY RASTER opcode. The
name RASTER FORM does express one limitation of the function,
however. Each raster form to be copied must begin on a word boundary and
must be a set of words.
The parameters are quite numerous and are passed in the CONTRL, PTSIN,
and INT IN arrays. In addition, two "memory fom definition" blocks must
be in memory for COPY RASTER. We will start with the MFD blocks.
Since a copy operation must always have a source and a destination, one
block describes the source memory range and the second describes the
destination. Each block consists of 10 words. The address of the memory
225

Abacus Software

Atari ST Internals

described by the block is contained in the first two words. The third word
specifies the height of the form in pixels. Word 4 determines the width of
the form in words. Word 6 should be set to 1 and word 7 specifies the
number of planes of which the form is composed. The remaining words
should be set to zero because they are reserved for future extensions.

3.4.1 An overview of the "line-A" variables


After the initialization $AOOO, DO and AO contain the address of a variable
area which contains more than 50 line-A variables. The essential variables
have been described along with the various calls, but not the location of the
variables within the variable block. We will present this list shortly. When
naming the variables we have remained with the names used in the official
Atari documentation.
Offset is the value which must be given to access the value register relative.
Variables supplied with a question mark could not be definitively explained.
Offset Name

0
2
4
8
12
16
20
24
26
28
28
32
34
36

38
40
42
44

v_jp lanes
v lin wr
CONTRL
INT IN
PTSIN
INTOUT
PTSOUT
_FG_BP_1
_FG_BP_2
_FG_BP_2
_FG_BP_2
_LSTLIN
_LN_MASK
WRT MODE

_X2
~Y2

Size

Function

word
word
long
long
long
long
long
word
word
word
word
word
word
word

Number of planes
Bytes per scan line
Pointer to the CONTRL array
Pointer to the INTIN array
Pointer to the PTSIN array
Pointer to the INTOUT array
Pointer to the PTSOUT array
Plane 0 color value
Plane 1 color value
Plane 2 color value
Plane 3 color value
Should be -1 <$FFFF) (?)
Line pattern for $A003
Write mode (0=write mode
l=t ransparent
2=XOR mode
3=Inverse trans.)
Xl-coordinate
Yl-coordinate
X2-coordinate
Y2-coordinate

word
word
word
word

226

Abacus Software

Atari ST Internals

46

_j>atptr

long

50

j>atmsk

word

52

multifill

word

54

_CLIP

word

56
58

_XMN_CLIP
_YMN_CLIP

word
word

60
62

_XMX_CLIP
_YMX_CLIP

word
word

64

_XACC_DDA

word

66

_DDA_INC

word

68

T SCLSTS

70

MONO STATUS word

72
74

_SOURCEX
SOURCEY

word

word
word

Pointer to the fill pattern


(see $A004)
Fill pattern "mask"
(see $A004)
0=fill pattern is only for
one plane
l=fill pattern is for multiplane
0=no clipping (see $A005)
not 0=clipping
and
define upper left corner of
the visible area for clipping
and
define lower right corner of
the visible area for clipping
Should be set to $8000 before
each call to TXTBLT (?)
Enlargement/reduction factor
$FFFF for enlargement,
reduction doesn't work (?)
0=reduction (?)
l=enlargement
l=not proportional font
0=proportional type or width
of character changed by bold
or italics
X-coordinate of char in font
Y-coord of char in font (0)

Note:
SOURCEX is the value of the character from the
horizontal
offset table (HOT) and can be
calculated witht he following formula:
SOURCEX = HOT-element (ASCII value minus FIRST
ADE)
The variable FIRST ADE is contained in bytes
36,37 of the font header (see example)

76
78
80
82

_DESTX
_DESTY
_DELX
DELY

word
word
word
word

X-position of char on screen


Y-position of char on screen
Width of the character
Height of the character

227

Abacus Software

Atari ST Internals

Note:
DELX can be calculated with this formula:
DELX = SOURCEX+1 minus SOURCEX
(see $A008)
DELY is the value FORM height from bytes 82,83 of
the font header.
84
88
90

_FBASE
_FWIDTH
_STYLE

long
long
word

Pointer to start of font data


Width of font form
Flags for special effects
(see $A008)

92
94
96

_LITEMASK
_SKEWMASK
_WEIGHT

word
word
word

_R_OFF
__L_OFF

word
word

Mask for shading


Mask for italic type
Number of bits by which the
character will be expanded
Offset for italic type
Offset for italic type

98
100

Note:
The above five variables should be loaded with
the corresponding values from the font header.
102

_SCALE

word

104

CHUP

word

106

_TEXT_FG

word

108

_scrtchp

long

112

_scrpt2

word

114
116

_TEXT_BG
COPYTRAN

word
word

0=no scaling
l=scaling (enlarge/reduce)
Angle for character rotation
0=normal char representation
$384=rotated 90 degrees
$708=rotated 180 degrees
$A8C=rotated 270 degrees
Foreground color for text
display
Address of buffer required
for creating special text
effects
Offset of the enlargement
buffer in the scrtchp buffer
Background color for text rep
(?)

228

Abacus Software

Atari ST Internals

3.4.2 Examples for using the line-A opcodes


In order to ease your first experiments with the line-A opcodes, we have
given a few examples which can serve as a starting-point for you. In the
first example, a point is set on the screen with $A001, and then the color of
the point is determined with $A002.
********************************************************

*
*

Demo of the $AOOO,$A001 and $A002 functions

rbr 09/28/85

intin
ptsin

equ
equ

8
12

init
setpix
getpix

equ
equ
equ

$aOOO
$a001
$a002

.dc.w
move . 1
move . 1

init
intin (aO) , a3

ptsin (aO) , a<3

* call $AOOO
* address of INTIN-arrays
* address of PTSIN-arrays

move
move

#300, (a4)
#100,2(a4)

* X coordinate
* Y coordinate

move

#1,(a3)

* color set, pixel set


0 erase pixel

.dc.w

setpix

* pixel set

move
move

#300,(a4)
#100,2(a4)

* X coordinate
* y coordinate

.dc.w

getpix

* get color value

start:

dO contains prersent color value

Only color values zero and one make sense for a monochrome monitor.
Other values can be entered when working in one of the color modes,
however.
229

Abacus Software

Atari ST Internals

The next example shows how a triangle can be drawn on the screen with the
function FILLED POLYGON.
*************************************************
*
*
*

a006 - filled pologyn

*************************************************
contrl
ptsin

equ
equ

4
12

fg_bpl
fg_bp2
fg_bp3
fg bp4
wrt mod

equ
equ
equ
equ
equ

24
26
28
30
36

yi

equ

40

patptr
patmsk
multifill
clip
xmn_clip
ymn clip
xmx_clip
ymx clip

equ
equ
equ
equ
equ
equ
equ
equ

46
50
52
54
56
58
60
62

init
polygon

equ
equ

SaOOO
$a006

.dc.w

init

* address of variable block


from AO

move.w
clr .w
clr .w
clr .w

#l,fg_bpl(aO)
fg_bp2(aO)
fg_bp3(aO)
fg_bp4(aO)

*set colors for monochrome

move.w

12,wrt mod(aO)

* replace mode

230

Atari ST Internals

Abacus Software
move . 1
move . w
clr .w
clr .w

#fill,patptr (aO)
#4,patmsk(aO)
multifill(aO)
clip(aO)

*
*
*
*

move . 1

contrl(aO) ,a6

addq . 1
move . w

#2,a6
#3, (a6)

* adddress of CONTRL array


from A6
* A6 > CONTRL (1)
* the XY pair in PTSIN

move . 1
move . 1
move . w
move . w
dbra

ptsin (aO) ,a6

move . w
move . w
move . 1

tlOO,d3
aO,-(sp)

* first scanline
* from Yl
* restore address variable block

dc.w

polygon

* fill scanline, AO destroyed

move . 1
addq . w
cmp.w
bne

(sp)+,aO
#l,d3
#301, d3
loopl

*
*
*
*

move . w
trap
addq . 1

#l,-(sp)

* Code CONIN wait for keypress

#1

* Call GEMDOS

#2,sp

* stack correction

loop

loopl

rts
move . w
trap

* address PTSIN array from A6


* table of coordinates
* recieve 8 coordinates

#tab,a5
#8,d3

<a5)+, (a6) +
d3,loop

d3,yl(aO)

* Call GEMDOS

dc.w

%1100110011001100
%0110110110110110
%0011001100110011
%1001100110011001

dc.w
dc.w
dc.w
dc.w

320,100
120,320
520,300
320,100

dc.w

AO restored
calculate next sacanline
last scan line?
no, next scanline

* subroutine all done


* terminate to desktop

#0,-(sp)
#1

fill:
dc.w
dc.w

pointer of the fill pattern


four fill patterns
for monochrome
no clipping

tab:

231

Abacus Software

Atari ST Internals

The next example shows how the mouse fonn can be manipulated and how
the mouse can be enabled. The example waits for a key press before
returning.
********************************************************
*
*
*
show mouse - transform mouse
*
*
********************************************************

intin

equ

init_a
show_mouse
transmouse

equ
equ
equ

$aOOO
$a009
$aOOb

.dc.w

init_a

* address INIT from A5

move.1
move
move

intin(aO),a5
#0,6(a5)
#l,8(a5)

* INTIN (3) = mask color value


* INTIN (4) = data color value

add.l

#10,a5

* a5 > INTIN (5)

lea
move

maus,a4
#16,dO

* data for new cursor


* 32 words = 16 longs

move.1
dbra

,(a5)+
dO,loop

* transfer INTIN array

.dc.w

transmouse

* and set form

.dc.w

init_a

move.1
clr .w

intin(aO),aO
(aO)

* Number Hide Cursor -ignore call

.dc.w

show mouse

* now the new cursor

start:

loop:

232

0000000000000000%
0000000000000000%
0000000110000000%
0000000110000000%
0000000110000000%
0000000110000000%
0000000110000000%
0000000110000000%
0000000110000000%
0110000110000110%
0110000110000110%
0000011001100000%
0000000110000000%
0000000000000000%
0000000000000000%
0000000000000000%
0000001111000000%
0000001111000000%
0000001111000000%
0000001111000000%
0000001111000000%
0000001111000000%

wopM'Op-

wopwopwop-

wop"

wopwopwopwop-

soawaa IT^D
oq.

1111001111001111%
1111001111001111%

M'Op"

0111111111111110%
0001111111111000%
0000011111100000%
0000000110000000%

M'Op*

wop"op-

wopM-OP"

1#
(ds)-'o#

K. ' BAOUI

suop
I-bppH

>[OBq.s

sssjdAe>( joj

SOQW33 11BD
NINOD 9POO

1#
(ds)-'-[f

snaeqy

Abacus Software

Atari ST Internals

3.5 The Exception Vectors


The first 1024 bytes of the 68000 processor are reserved for the exception
vectors. Routines which use exception handling store the addresses they
require in this range of memory.
A condition which leads to an exception can come either from the processor
itself or from the peripheral components and controls units connected to it
The interrupts, described in the next section, belong to the class of external
events. In addition, a so-called bus error can be created externally.
A bus error can be created by many circumstances. For one, certain memory
areas can be protected from unauthorized access by it. As you may already
know, the 68000 can run in one of two operating modes. The operating
system is driven at the first level, the supervisor mode. The user mode is
intended for user programs. In order that a user program not be able to
access important system variables as well as the system components in an
uncontrolled fashion, such an access in the user mode leads to a bus error.
If such an error occurs, the processor stops execution of the instruction,
saves the program counter and status register on the stack, and branches to a
routine, the address of which it fetches from the lowest 1024 bytes of
memory. In the case of the bus error, the address is at memory location 8
(one long word). What happens in this routine?
First the vector number of the interrupt is determined. In the case of a bus
error, this is 2. Mushroom clouds are then displayed on the screen. The
user can determine the vector number by counting the number of mushroom
pictures. Execution then returns to the GEM desktop.
The following table contains all of the exception vectors.

234

Atari ST Internals

Abacus Software
Vector number
0
1
2
3
4
5
6
7
8
9
10
11
12-14
15
16-23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48-63
64-255

Address
$000
$004
$008
$OOC
$010
$014
$018
$01C
$020
$024
$028
$02C
$030-$038
$03C
$040-$05C
$060
$064
$068
$06C
$070
$074
$078
$07C
$080
$084
$088
$08C
$090
$094
$098
$09C
$OAO
$OA4
$OA8
$OAC
$OBO
$OB4
$OB8
$OBC
$OCO-$OFC
$100-$3FC

Exception vector meaning


Stack pointer after reset
Program counter after reset
Bus error
Address error
Illegal instruction
Division by zero
CHK instruction
TRAPV instruction
Priviledge violation
Trace
Line A emulator
Line F emulator
reserved
Uninitialized interrupt
reserved
Spurious interrupt
Level 1 interrupt
Level 2 interrupt
Level 3 interrupt
Level 4 interrupt
Level 5 interrupt
Level 6 interrupt
Level 7 interrupt
TRAP #0 instruction
TRAP fl instruction
TRAP #2 instruction
TRAP #3 instruction
TRAP #4 instruction
TRAP #5 instruction
TRAP #6 instruction
TRAP #7 instruction
TRAP #8 instruction
TRAP 19 instruction
TRAP #10 instruction
TRAP #11 instruction
TRAP #12 instruction
TRAP #13 instruction
TRAP #14 instruction
TRAP #15 instruction
reserved
User interrupt vectors

235

Abacus Software

Atari ST Internals

The following vectors are used on the ST:


Line A emulator
Level 2 interrupt
Level 4 interrupt
TRAP #1 GEMDOS
TRAP #2 GEM
TRAP #13 BIOS
TRAP #14 XBIOS

$EB9A
$543C
$5452
$965E
$2A338
$556C
$5566

The vector for division by zero points to rte and returns directly to the
interrupted program. Vectors 64-79 are reserved for the MFP 68901
interrupts. All other vectors point to $5838 which outputs the vector number
and ends the program as described for the bus error.
All of the unused vectors can be used for your own purposes, such as the
line F emulator or the 12 unused traps.

3.5.1 The interrupt structure of the ST


The interrupt possibilities which the 6800 microprocessor offers are put to
good use in the ST. As you may have already gathered from the hardware
description of the processor, the processor has seven interrupt levels with
different priorities. The interrupt mask in the system byte of the status
register determines which levels can generate an interrupt. An interrupt can
only be generated by a level higher than the current contents of the mask in
the status register. A interrupt of a certain priority is communicated to the
processor by the three interrupt priority level inputs. The following
assignment results:
Level

IPL 2 1 0

7 (NMI)
6
5
4
3
2
1
0

0
0
0
O
1
1
1
1

236

0
0
1
i
0
0
1
1

0
1
0
l
0
1
0
1

Abacus Software

Atari ST Internals

If all three lines are 1 (interrupt level 0), no interrupt is present. Interrupt
level 7 is the NMI (non-maskable interrupt), which is executed even if the
interrupt mask in the status register contains seven. Which interrupt is
assigned which vector (that is, the address of the routine which will process
the interrupt) depends on the peripheral component which generates the
interrupt For auto-vectors, the processor itself derives the interrupt number
from the interrupt level. The following table is used in this process:
Level
IPL 1
IPL 2
IPL 3
IPL 4
IPL 5
IPL 6
IPL 7

Vector number
25
26
27
28
29
30
31

Vector address
$64
$68
$6C
$70
$74
$78
$7C

Only lines IPL 1 and IPL 2 are used on the Atari ST; Line IPL is
permanently set to a 1 level so that only levels 2,4 and 6 are available. The
results in the following assignment:
IPL 2
IPL 4
IPL 6

HBL, horizontal blank, line return


VBL, vertical blank, picture return
MFP 68901

The HPL interrupt is generated on each line return from the video section. It
is generated every 50 to 64 (JLS depending on the monitor connected
(monochrome or color). It occurs very often and is normally not permitted
by an interrupt mask of three. The standard HBL routine therefore only has
the task of setting the interrupt mask to three if it is zero and allows the HBL
interrupt so that no more HBL interrupts will occur. One use of the HBL
interrupt could be for special screen effects. With the help of this routine,
you know exactly which line of the screen has just been displayed. Of much
greater importance, however, is the VBL interrupt, which is generated on
each picture return. This occurs 50, 60, or 70 times per second depending
on the monitor.
The vertical blank interrupt (VBL) routine accomplishes a whole set of a
tasks which must be periodically executed or which concern the screen
display. When entering the routine, the frame counter f re lock ($466) is
first incremented. Next, a test is made to see if the VBL interrupt is
software-disabled. This is the case if vb Is em ($452) (vertical blank
semaphor) is zero or negative. In this case the routine is exited immediately
237

Abacus Software

Atari ST Internals

and execution returns to the interrupted program. Otherwise, all of the


registers are saved on the stack and the counter vbcloek ($462), which
counts the executed VBL routines, is incremented. Next, a check is made to
see if a different monitor has been connected in the meantime. If a change
was made from a monochrome to color monitor, the video shifter is
reprogrammed accordingly. This is necessary because the high screen
frequency of 70 Hz of the monochrome monitor could damage a color
monitor. The routine to flash the cursor is called next. If you load a new
color palette via the appropriate BIOS functions or want to change the
screen address, this happens here in the VBL routine. Since nothing is
displayed at this time, a change can be made here without disturbing
anything else. If colorptr ($45A) is not equal to zero, it is interpreted as
a pointer to a new color palette, and this is loaded into the video shifter. The
pointer is then cleared again. If screenptr is set, this value is used as the
new base address of the screen. This takes care of the screen specific
portions.
Now the floppy VBL routine is called, which with help the of the write
protect status, determines if a diskette was changed. An additional task of
this routine is to deselect the drives after the disk controller has turned the
drive motor off.
Now comes the most interesting part for the programmer, the processing of
the VBL queue. There is a way to tell the operating system to execute your
own routines within the VBL interrupt. The maximum number of routines
possible is in nvbls ($454). This value is normally initialized to 8, but it
can be increased if required. Address vblqueue ($456) contains a pointer
to a vector array which contains the (8) addresses of the VBL routines. Each
address is tested within the VBL routine and the corresponding routine
executed if the address is not zero.
If you want to install your own VBL routine, check the 8 entries until you
find one which contains a zero. At this address you can write a pointer to
your routine which from now on will be executed in every VBL interrupt.
In all 8 entries are already occupied, you can copy the entries into a free area
of memory, append the address of your routine, and redirect vblqueue to
point to the new vector array. Naturally, you must not forget to increment
vbls, the number of routines, correspondingly. Your routine may change
all registers with the exception of the USP.
As soon as the VBL routine is done, the dmpf lg ($4EE) is checked. If this
memory location is zero, a hardcopy of the screen is outputted. The flag is
set in the keyboard interrupt routine if the keys ALT and HELP are pressed
238

Abacus Software

Atari ST Internals

at the same time. Finally, the register contents are restored, vb Is em is


released and execution returns to the interrupted routine.
The MFP 68901 occupies interrupt level six in our previous table. This
component is in the position to create interrupt vectors on its own. These are
referred to non-auto vectors in contrast to the auto vectors used above,
because the processor does not generate the vector itself. In the Atari ST,
the MFP 68901 works as the interrupt controller. It manages the interrupt
requests of all peripheral components including its own.
The MFP can manage sixteen interrupts which are prioritized in reference to
each other, similar to the seven levels of the processor. All MFP interrupts
appear on level 6 to the 68000, therefore prioritized higher than HBL and
VBL interrupts. The following table contains the assignments within the
MFP.
Le ve 1
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0

As s ignment
Monochrome monitor detect
RS-232 ring indicator
System clock timer A
RS-232 receive buffer full
RS-232 receive error
RS-232 transmit buffer empty
RS-232 transmit error
Line return counter, timer B
Floppy controller and DMA
Keyboard and MIDI ACIAs
Timer C
RS-232 baud rate generator, timer D
unused
RS-232 CTS
RS-232 DCD
Centronics busy

Not all of these possible interrupt sources are enabled, however. Some
signals are processed through polling. The following is a description of the
interrupts which are used by the operating system.

239

Abacus Software

Atari ST Internals

Level 2, RS-232 CIS, Address $73CO


This interrupt is generated every time the RS-232 interface is informed via
the CTS line that a connected receiver is ready to receive additional data.
The routine then sends the next character from the RS-232 transmit buffer.
Level 5, Timer C, Address $7C5C
This timer runs at 200 Hz. The 200 Hz counter at $4B A is first incremented
in the interrupt routine. The next actions are performed only every fourth
call to the interrupt routine, that is, only every 20ms (50 Hz). First a routine
is called which handles the sound processing. Another task of this interrupt
is the keyboard repeat when a key is pressed and initial repeat. Finally, the
evt timer routine of GEM is called, which is accessed via vector $400.
Level 6, Keyboard and Midi, Address $752A
Two peripheral components are connected to this interrupt level of the MFP,
the two ACIAs which receive data from the keyboard and the MIDI
interface. In order to decide which of the two components has requested an
interrupt, the interrupt request bits in the status registers of the ACIAs are
tested and the received byte is fetched if required. If it comes from the
keyboard, the scan code is converted to the ASCII code by means of the
keyboard table and written into the receive buffer, which happens
immediately for MIDI data. Mouse and joystick data also come from the
keyboard ACIA and are also prepared accordingly.
Level 9, RS-232 transmit error, Address $7426
If an error occurs while sending RS-232 data, this interrupt routine is
activated. Here the transmitter status register is read and the status is saved
in the RS-232 parameter block.
Level 10, RS-232 transmit buffer empty, Address $7374
Each time the MFP has completely outputted a data byte via the RS-232
interface, it generates this interrupt. It is then ready to send the next byte. If
data is still in the transmit buffer, the next byte is written into the transmit
register, which can now be shifted out according to the selected baud rate.
240

Abacus Software

Atari ST Internals

Level 11, RS-232 receive error, Address $7408


If an error occurs when receiving RS-232 data, this interrupt routine is
activated. This may involve a parity error or an overflow. The routine only
clears the receiver status register and then returns.
Level 12, RS-232 receive buffer full, Address $72CO
If the MFP has received a complete byte, this interrupt occurs. Here the
character can be fetched and written into the receive buffer (if there is still
room). This routine takes into account the active handshake mode (sending
XON/XOFF or RTS/CTS).
The other interrupt possibilities of the MFP are not used, but they can be
used for your own routines. For example, interrupt level 0, Centronics
strobe, can be used for buffered printer output.

241

Abacus Software

Atari ST Internals

3.6 The Atari ST VT52 Emulator


There are two options for text output on the ST. You can work with the
GEMDOS functions by means of TRAP 11 or a direct BIOS call with
TRAP #13. The other possibility consists of using the VDI functions.
You have special possibilities for screen control with both variants. We will
first take a look at output using the normal DOS or BIOS calls. Here a
terminal of type VT52, which offers a wide variety of control functions, is
emulated for screen output. These control characters are prefixed with a
special character, the escape code. Escape, also shortened to ESC, has
ASCII code 27. Following the escape code is a letter which determines the
function, as well as additional parameters if required. The following list
contains all of the control codes and their significance.
ESC A Cursor up
This function moves the cursor up one line. If the cursor was already
on the top line, nothing happens.
ESC B Cursor down
This ESC sequence positions the cursor one line down. If the cursor
is already on the bottom line, nothing happens.
ESC C Cursor right
This sequence moves the cursor one column to the right.
ESC D Cursor left
Moves the cursor one position to the left This function is identical to
the control code backspace (BS, ASCII code 8). If the cursor is
already in the first column, nothing happens.
ESC E Clear Home
This control sequence clears the entire screen and positions the cursor
in the upper left corner of the screen (home position).

242

Abacus Software

Atari ST Internals

ESC H Cursor home


With this function you can place the cursor in the upper left corner of
the screen without erasing the contents of the screen.
ESC I Cursor up
This sequence moves the cursor one line towards the top. In contrast
to ESC A, however, if the cursor is already in the top line, a blank
line is inserted and the remainder of the screen is scrolled down a line
correspondingly. The column position of the cursor remains
unchanged.
ESC J Clear below cursor
By means of this function, the rest of the screen below the current
cursor position is cleared. The cursor position itself is not changed.
ESC K Clear remainder of line
This ESC sequence clears the rest of the line in which the cursor is
found. The cursor position itself is also cleared, but the position is
not changed.
ESC L Insert line
This makes it possible to insert a blank line at the current cursor
position. The remainder of the screen is shifted down; the lowest line
is then lost. The cursor is placed at the start of the new line after the
insertion.
ESC M Delete line
This function clears the line in which the cursor is found and moves
the rest of the screen up one line. The lowest screen line then
becomes free. After the deletion, the cursor is located in the first
column of the line moved up to take the place of the old one.

243

Abacus Software

Atari ST Internals

ESC Y Position cursor


This is the most important function. It allows the cursor to be
positioned at any place on the screen. The function needs the cursor
line and column as parameters, which are expected in this order with
an offset of 32. If you want to set the cursor to line 7, column 40,
you must output the sequence ESC Y CHR$(32+7) CHR$(32+40).
Lines and columns are counter starting at zero; for an 80x25 screen
the lines are numbered from 0 to 24 and the columns from 0 to 79.
The additional ESC sequences of the VT52 terminal start with a lower case
letter.
ESC b Select character color
With this function you can select the character color for further
output. With a monochrome monitor you have choice between just
0=white and l=black. For color display you can select from 4 or 16
colors depending on the mode. Only the lowest four bits of the
parameters are evaluated (mod 16). You can use the digit" 1" for the
color 1 as well as the letters "A" or "a" in addition to binary one.
ESC c Select background color
This function serves to select the background color in a similar
manner. If you choose the same color for character and background,
you will, of course, not be able to see text output any more.
ESC d Clear screen to cursor position
This sequence causes the screen to be erased starting at the top and
going to the current position of the cursor, inclusive. The position of
the cursor is not changed.
ESC e Enable cursor
Through this escape sequence the cursor becomes visible. The cursor
can, for example, be enabled when waiting for input from the user.
ESC f Disable cursor
Turns the cursor off again.

244

Abacus Software

Atari ST Internals

ESC j Save cursor position


If you want to save the current position of the cursor, you can use
this sequence to do so.
ESC k Set cursor to the saved position
This is the counterpart of the above function. It sets the cursor to the
position which was previously saved with ESC j.
ESC 1 Clear line
Clears the line in which the cursor is located. The remaining lines
remain unaffected. After the line is cleared, the cursor is located in the
first column of the line.
ESC o Clear from start
This clears the current cursor line from the start to the cursor position,
inclusive. The position of the cursor remains unchanged.
ESC p Reverse on
The reverse (inverted) output is enabled with this sequence. For all
further output, the character and background colors are exchanged.
With a monochrome monitor you get white type on a black
background.
ESC q Reverse off
This sequence serves to re-enable the normal character display mode.
ESC v Automatic overflow on
After executing this sequence, an attempted output beyond the end of
line will automatically start a new line.
ESC w Automatic overflow off
This deactivates the above sequence. An attempt to write beyond the
line will result in all following characters being written in the last
column.

245

Abacus Software

Atari ST Internals

Similar functions are available to you under VDI. The VDI escape functions
(opcode 5) serve this purpose. The appropriate screen function is selected
by choosing the proper function number. Note, however, that under VDI
the line and column numbering does not begin with zero but with one.
Under VDI there is also a function which outputs a string at specific screen
coordinates. If necessary, you can use the ESC functions of the VT52
emulation in addition.
The output of "unprintable" control characters
The three system fonts of the ST have also been supplied with characters for
the ASCII codes zero to 31, which are normally interpreted as control
codes. On the ST, only codes 7 (BEL), 8 (BS backspace), 9 (TAB), as well
as 10, 11, and 12 (LF linefeed, VT vertical tab, and FF form feed all
generate a linefeed) plus 13 (CR carriage return) have effect, in addition to
ESC. The remaining codes have no effect. How does one access the
characters below 32?
To do this, an additional device number is provided in the BIOS function 3
"conout". Normally number 2 "con" serves for output to the screen. If one
selects number 5, however, all the codes from, 0 to 255 are outputted as
printable characters, control codes are no longer taken into account.
In the appendix you find the three ST system fonts pictured.

246

Abacus Software

Atari ST Internals

3.7 The ST System Variables


The ST uses a set of system variables whose significance and addresses will
not change in future versions of the operating system. If you use other
variables, such as those from the BIOS listing which are not listed here, you
should always remember that these could have a different meaning in a new
version of the operating system. The system variables are in the lower RAM
area directly above the 68000 exception vectors, at address $400 to 1024.
The address range from 0 to $800 (2048) can be accessed only in the
supervisor mode. An access in the user mode of the 68000 leads to a bus
error.
In the following listing we will use the original names from Atari. In
addition to the address of the given variable, typical contents and the
significance will be described.
Address length name
$400

Sample contents

etv__timer

$F526

This is the event timer vector of the GEM. It takes care of the periodic
tasks of GEM.
$404

etv_critic

$5562

Critical error handler. Under GEM this pointer points to $2A156.


There an attempt is made to correct disk errors, such as if a another
disk is requested in a single-drive system.
$408

etv_term

$5328

This is the GEM vector for ending a program.


$40C

5L

etv_xtra

Here is space for 5 additional GEM vectors, which at the time are not
yet used.

247

Abacus Software
$420

Atari ST Internals

memvalid

$752019F3

If the memory location contains the given value, the configuration of


the memory controller is valid.
$424

memetrl

$0400

This is a copy of the configuration value in the memory controller.


The value given applies for a 512K machine.
$426

resvalid

$31415926

If the given value is located here, a jump is made at a reset via the
reset vector in address $42A.
$42 A

resvector

$FC0008

See above.
$42E

phystop

$80000

This is the physical end of the RAM memory; $80000 for a 512K
machine.
$432

_membot

$3B900

The user memory begins here (TPA, transient program area).


$436

_memtop

$78000

This is the upper end of the user memory.


$43A

memval2

$237698AA

This "magic" value together with "memvalid" declares the memory


configuration valid.
$43E

flock

If this variable contains a value other than zero, a disk access is in


progress and the VBL disk routine is disabled.

248

Abacus Software
$440

Atari ST Internals
seekrate

The seek rate (the time it takes to move the read/write head to the next
track) is determined according to the following table:
Seek rate
0
1
2
3
$442

_timer_ms

Time
6 ms
12 ms
2 ms
3 ms
$14, 20 ms

The time span between two timer calls, 20 ms corresponds to 50 Hz.


$444

_fverify

$FF

If this memory location contains a value other than zero, a verify is


performed after every disk write access.
$446

_bootdev

Contains the device number of the drive from the operating system
was loaded.
$448

palmode

If this variable contains a value other than zero, the system is in the
PAL mode (50 Hz); if the value is zero, it means the NTSC mode.
$44A

defshiftmod

If the Atari is switched from monochrome to color, it gets the new


resolution from here (0=low, 1 medium resolution).
$44C

sshiftmod

$200

Here is a copy of the register contents for the screen resolution.


0
1
2

320x200, low resolution


640x200, medium resolution
640x400, high resolution

249

Abacus Software

$44E

Atari ST Internals

_v_bas_ad

$78000

This variable contains a pointer to the video RAM (logical screen


base). The screen address must always begin on a 256 byte
boundary.
$452

vblsem

If this variable is zero, the vertical blank routine is not executed.


$454

nvbls

Number of vertical blank routines.


$456

_vblqueue

$4CE

Pointer to a list of nvbls routines which will be executed during the


VBL.
$45A

colorptr

If this value is not zero, it is interpreted as a pointer to a color palette


which will be loaded at the next VBL.
$45E

Xi

screenpt

This is a pointer to the start of the video RAM, which will be set
during the next VBL (zero if no new address is to be set).
$462

_vbclock

$2D26A

Counter for the number of VBL interrupts.


$466

X.

_frclock

$2D267

Number of VBL routines executed (not disabled by vblsem).


$46A

hdv_init

$5AE8

Vector for hard disk initialization.

250

Abacus Software
$46E

Atari ST Internals

swv_vec

$50 IE

Vector for changing the screen resolution. A branch is made via this
vector with the screen resolution is changed (default is reset).
$472

hdvjbpb

$5B6E

Vector to fetch the BIOS parameter block for a hard disk.


$476

hdv_rw

$5D88

Read/write routine for a hard disk.


$47A

hdvjboot

$60B2

Vector to a routine to reboot the hard disk.


$47E

hdvjmediach

$5D1E

Media change routine for hard disk.


$482

_comload

If this variable is set to a value other than zero by the boot program,
an attempt will be made to load a program called "COMMAND.PRG11
after the operating system is loaded.
$484

contemn

Attribute vector for console output


Bit
0
1
2
3

Meaning
Key click on/off
Key repeat on/off
Tone after CTRL G on/off
"kbshift" is retured in bits 24-31 for the
BIOS function "conin"

$485

unused, reserved

$486

trp!4ret

Return address for TRAP #14 call.

251

Abacus Software
$48A

Atari ST Internals
criticret

Return address of the critical error handler


$48E

4L

themd

Memory descriptor, filled out by the BIOS function getmpb.


$49E

2W

md

Space for additional memory descriptors.


$4A2

savptr

$5CE

Pointer to a save area for the processor registers after a BIOS call.
$4A6

_nflops

Number of connected floppy disk drives.


$4 AS

con__state

$8AEE

Vector for screen output; set by ESC functions to the appropriate


routine, for example.
$4 AC

save_row

Temporary storage for cursor line when positioning the cursor with
ESCY.
$4AE

sav_context

Pointer to a temporary areas for exception handling.


$4B2

2L

_bufl

$4F9E,

$4FB2

Pointer to two buffer list headers of GEMDOS. The first header is


responsible for data sectors, the second for the FAT (file allocation
table) and the directory. Each buffer control block (BCB) is
constructed as follows:

252

Abacus Software
long
int
int
int
int
long
long
$4BA

Atari ST Internals
BCB
drive
type
rec
dirty
DMD
buffer

$4F8A,
-1,
2
$41C
0
$2854
$4292

_hz_200

pointer to next BCB


drive number or -1
buffer type
record number in this buffer
dirty flag (buffer changed)
pointer to drive media descriptor
pointer to the buffer itself
$71280

Counter for 200 Hz system clock


$4BC

4B

the_env

Default environment string, four zero bytes.


$4C2

_drvbits

32-bit vector for connected drives. Bit 0 stands for drive A, bit 1 for
drive B, and so on.
$4C6

_dskbufp

$12BC

Pointer to a 1024-byte disk buffer. The buffer is used for GSX


graphic operations and should not be used by interrupt routines.
$4CA

_autopath

Pointer to autoexecute path.


$4CE

SL

_vbl_list

$15398,0,0...

List of the standard VBL routines.


$4EE

_dumpflg

$PPFP

This flag is incremented by one when the ALT and HELP keys are
pressed simultaneously. A value of one generates a hardcopy of the
screen on the printer. A hardcopy can be interrupted by pressing ALT
HELP again.

253

Abacus Software
$4FO

_j>rtabt

Atari ST Internals
0

Printer abort flag due to time-out.


$4F2

_sysbase

$5000

Pointer to start of the operating system.


$4F6

_shell_p

Global shell information.


$4FA

end_os

$3B900

Pointer to the end of the operating system in RAM, start of the TPA.
$4FE

exec_os

$1EBOO

Pointer to the start of the AES. Normally branched to after the


initialization of the BIOS.

254

Abacus Software

Atari ST Internals

3.8 The 68000 Instruction Set


If you are already familiar with the machine language of some 8-bit
processor: Forget everything you know. If you do, it will make it easier to
understand the following material!
The 68000 processor is fundamentally different in construction and
architecture from previous processors (including the 8086!). The essential
difference does not lie in the fact that the standard processing width is 16
and not 8 bits (which is sometimes a drawback and can lead to
programming errors), but in the fact that, with certain exceptions, the
internal registers are not assigned to a specific purpose, but can be viewed
as general-purpose registers, with which almost anything is possible.
In eariler processors, the accumulator was always the destination for
arithmetic operations, but it is completely absent in the 68000. There are
eight data registers (DO-D7) with a width of 32 bits, and as a general rule, at
least one of these is involved in an operation. There are also eight address
registers (AO-A7), each with 32 bits, which are usually used for generating
complex addresses. Register A7 has a set assignmentit serves as the stack
pointer. It is also present twice, once as the user stack pointer (USP) and
once as the supervisor stack pointer (SSP). The distinction is made because
there are also two operating modes, namely the user mode and the
supervisor mode.
These two are not only different in that they use different stack pointers, but
in that certain instructions are not legal in the user mode. These are the
so-called priviledged instructions (see also instruction description), with
whose help an unwary programmer can easily "crash" the system rather
spectacularly. This is why these instructions create an exception in the user
mode. An exception, by the way, is the only way to get from the user mode
to the supervisor mode.
In addition there is the status register, the upper half of which is designated
as the system byte because it contains such things as the interrupt mask,
things which do not concern the "normal" user, making access to this byte
also one of the priviledged instructions. The lower byte, the user byte,
contains the flags which are set or cleared based on the result of operations,
such as the carry flag, zero flag, etc. As a general rule, the programmer
works with these flags indirectly, such as when the execution of a branch is
made conditional on the state of a flag.
255

Abacus Software

Atari ST Internals

Two things should be mentioned yet: Multi-byte values (addresses or


operands) are not stored in memory as they are with 8-bit processors, in the
order low byte/high byte, but the other way around. Four-byte expressions
(long word) are stored in memory (and the registers of course) with the
highest-order byte first.
The second is that unsupported opcodes do not lead to a crash, but cause a
special exception, whose standard handling must naturally be performed by
the operating system.

3.8.1 Addressing modes


This is probably the most interesting theme of the 68000 because the
enormous capability first takes effect through the many various addressing
modes.
The effective address (the address which, sometimes composed of several
components, finally determines the operand) is fundamentally 32 bits wide,
even if one or more the components specified in the instruction is shorter.
These are always sign-extended to the full 32-bit width.
The charm of the addressing lies in the fact that almost all instructions
(naturally with exceptions), both the source and destination operands, can
be specified with one of the addressing modes. This means that even
memory operations do not necessarily have to use one of the registers;
memory-to-memory operations are possible.
In the assembler syntax, the source operand is given first, followed by the
destination operand (behind the comma).

256

Abacus Software

Atari ST Internals

Register Direct
The operand is located in a register. There are two kinds of register direct
addressing: data register direct and address register direct
In the first case, the operand may be bit, byte, word, or long word-oriented;
in the second case a word or long word is required, in case the address
register is the destination of the operation.
Example: ADD.B DO,D1 or ADDA.W DO,A2

Absolute Data Addressing


The operand is located in the address space of memory. This can also be a
peripheral component, naturally (see MOVEP). The address is specified in
absolute form.
This can have a width of a a long word, whereby the entire address space
can be accessed, or it can be only one word wide. In this case is
sign-extended (the sign being the highest-order bit) to 32 bits. For example,
the word $7FFF becomes the long word $00007FFF, while $FFFF
becomes $FFFFFFFF. Only the lower 32K and the upper 32K of the
address space can be accessed with the short form. This addressing mode is
often used in the operating system of the ST because important system
variables are stored low in memory and all peripheral components are
decoded at the top.
Example: MOVE.L $7FFF, $01234567

Instructions in which both operands are addressed with a long word are the
longest instructions in the set, consisting of 10 bytes.

257

Abacus Software

Atari ST Internals

Program Counter Relative Addressing


This addressing mode allows even constants to be addressed in a completely
relocatable program, since the base of the address calculation is the current
state of the program counter.
The are two variations. In the first, a 16-bit signed offset is added to the
program counter, and in the second, the contents of a register
(sign-extended if only one word is specified) are also added in, though here
the offset may be only 8 bits long.
Example: MOVE.B $1234 (PC) , $12 (PC,DO .W)
Register Indirect Addressing
There are several variations of this, and they will be discussed individually.
Register Indirect
Here the operand address is located in an address register.
Example: CLR.L (AO)
Postincrement Register Indirect
The operand is addressed as above, but the contents of the address register
are then incremented by the length of the operand, by 1 for xxx.B or 4 for
xxx.L.
Example: BSET.B #0, (A0)+ or BCLR.L |23, (Al) +
Predecrement Register Indirect
Here the address register is decrement by the length of the operand before
the addressing.
Example: EOR.L DO,$1234 (A4)

258

Abacus Software

Atari ST Internals

Indexed Register Indirect with Offset


As above, but the contents of another register (address or data) are also
added in, taking the sign into account. The offset may have a width of 8 bits
here, however.
Example: MOVE.W $12 (A5,A6.L) ,D1
Immediate Addressing
Here the operand is contained as such in the instruction itself. Naturally, an
operand specified in this manner can serve only as a source. The immediate
operands can, as a general rule, be any of the allowed widths.
Example: ADDI.W t$1234,D5
In the variant QUICK, the constant may be only 3 bits long, therefore
having a value from 0-7. An exception is the MOVE command, where the
constant may have 8 bits, but in which only a data register is allowed as the
destination.
Example: ADDQ.L #1,AO or MOVEQ f!23,Dl
Implied Register
This addressing mode is mentioned only for the sake of completeness and in
it, an operand address is already determined by the instruction itself. The
operands are either in the program counter, in the status register, or the
system stack pointer.
Example: MOVE SR,D6
Regarding the offsets, it should be noted that they are signed numbers in
two's complement. Their highest-order bit forms the sign. With an 8-bit
value, an offset of +127/-128 is possible, and about 32K with 16 bits.

259

Abacus Software

Atari ST Internals

3.8.2 The instructions


In the following instruction description, the individual bit patterns are not
listed since this would lead to far in this connection.-Additonal information
can be gathered from books like the M68000 16132-Bit Microprocessor
Programmer's Reference Manual (Motorola).
The instructions are also explained only in their base form and variations are
mentioned only in name. We will briefly explain what the individual
variations can look like here.
The variations are indicated by letter after the operand. This can be one of
the following:
A indicates that the destination of the operation is an address register.
Word operations are sign-extended to 32 bits.
I

indictaes an immediate operand as the source of the operation. I


operands may assume all widths as a general width.

Q means quick and represents a special form of immediate addressing.


Such an operand is usually three bits wide, corresponding to a value
range of 0 to 7. This limited range has the advantage that the operand
will fit into the opcode. Since there is no special command for
incrementing a register, something like ADDQ.L #1,AO works well in
its place. An exception is MOVEQ. Here the operand may have a value
of 0-255.
X indicates arithmetic operations which use the X flag. This flag has a
special significance. It is set equal to the carry flag for all arithmetic
operations. The carry flag, however, is also affected by transfer
operations while the X flag is not so that it remains available for further
calculations. This is especially useful for computations with higher
precision than the standard 32 bits, where temporary results must first
be saved, and where the carry flag can be changed as a result
All instructions have a suffix after the opcode of the form .B, .W, or .L.
This suffix indicates the processing width of the operation. Although a data
register, for example, has a width of 32 bits = 4 bytes = 1 long word, the
instruction CLR.B DO clears only the lowest-order byte of the register. For
registers, .W specifies the lower word. The higher-order word is not
260

Abacus Software

Atari ST Internals

explicitly addressable. If the operand is in memory, it is imporant to know


that .W and .L operands must begin on an even address. The same applies
for the opcode as such, which also always comprises one word.
If the destination of an operation is an address register, only operands of
type .W and .L are allowed, whereby the first is sign-extended to a long
word.
Some listings contain instructions of the form MOVE.L #27,DO. The
programmer then assumes that the assembler will produce #$0000001B
from #27.
Now to the individual instructions:
ABCD Add Decimal with Extend
There is one data format which we have not yet discussed: the BCD
format. This means nothing more than "Binary-Coded Decimal" and it
uses digits in the range 0-9. Since this information requires only 4 bits,
a byte can store a two-digit decimal number. The instruction ABCD can
then add two such numbers. The processing width is always 8 bits.
ADD Add Binary
This instruction simply adds two operands.
Variations are ADDA, ADDQ, ADDI, and ADDX.
AND Logical AND
Two operand are logically combined with each other according the
AND function.
Variation: ANDI
ASL Arithmetic Shift Left
The operand is shifted to the left byte by the number of positions given,
whereby the highest-order bit is copied into the C and X flags. A 0 is
shifted in at the right. If a data register is shifted, the processing width
can be any. The number of places to be shifted is either specified as an I
operand (3 bits) or is placed in an additional register. If a memory
location is shifted, the processing width is always one word. A counter
is then not given; it is always =1.
ASR Arithmetic Shift Right
The operand is shifted to the right, whereby the lowest bit is copied to
C and X. The sign bit is shifted over from the left. See ASL for
information about processing width and counter.

261

Abacus Software

Atari ST Internals

Bee Branch Conditionally


The branch destination is always a relative address which is either one
byte or one word long (signed!). Correspondingly, the branch can
jump over a range of +127/-128 bytes or +32K-1/-32K. The point of
reference is the address of the following instruction.
Whether or not this instruction is actually executed depends on the
required condition, which is verified by means of the flags. Here are the
variations and their conditions. A minus sign before a flag indicates that
it must be cleared to satisdy the condition. Logical operations are
indicated with "*" for AND and "/" for OR.
BRA
BCC
BCS
BEQ
BGE
BGT
BHI
BLE
BLS
BLT
BMI
BNE
BPL
BVC
BVS

Branch
Branch
Branch
Branch
Brangh
Branch
Branch
Branch
Branch
Branch
Branch
Branch
Branch
Branch
Branch

Always
Carry Clear
Carry Set
Equal
Greater or Equal
Greater Than
Higher
Less or Equal
Lower or Same
Less Than
Minus
Not Equal
Plus
Overflow Clear
Overflow Set

no condition
-C
C
Z
N*V/-N*-V
N*V*-Z/-N*-V*-Z
-C*-Z
Z/N*-V/-N*V
C/Z
N*-V/-N*V
N
-Z
-N
-V
V

BCHG Bit Test and Change


The specified bit of the operand will be inverted. The original state can
be determined from the Z flag. The operand is located either in memory
(width=.B) or in a data register (width=.L). The bit number is given
either as an I operand or is located in a data register.
BCLR Bit Test and Clear
The specified bit is cleared. Everything else is handled as per BCHG.
BSET Bit Test and Set
The specified bit is set. Boundary conditions are per BCHG.
BSR Branch to Subroutine
This is an unconditional branch to a subroutine. Branch distances as for
Bcc.

262

Abacus Software

Atari ST Internals

BTST Bit Test


The bit is only checked as to its condition. Everything else as per
BCHG.
CHK Check Register Against Boundaries
A data register is checked to see if its contents are less than zero or
greater than the operand. Should this be the case, the processor
executes an exception. The program is continued at the address in
memory location $18 (vector 6). Otherwise no action is taken. The
processing width is only word.
CLR Clear Operand
The specified operand is cleared (set to zero).
CMP Compare
The first operand is subtracted from the second without changing either
of the two operands. Only the flags are set, according to the result.
Variations: CMPA and CMPI
Both operands are addresses with the addressing mode (Ax)+ with the
variant CMPM.
DBce Test Condition, Decrement and Branch
A data register is decremented and the flags are checked for the
specified condition. A branch is performed if either the condition is
fulfilled or the register is -1. Branch conditions and ranges as per Bcc.
DIVS Divide Signed
The second operand is divided by the first operand, talcing the sign into
account Afterwards the second operand contains the integer quotient in
the lower word and the remainder in the upper word, which has the
same sign as the quotient. The data width of the first operand is set at
.W and at .L for the second.
DIVU Divide Unsigned
Operation as above, but the sign is ignored.
EOR Exclusive OR
The two operands are logically combined according to the rules of
EXOR.
Variations: EORI
EXG Exchange Registers
The two registers specified are exchanged with each other.

263

Abacus Software

Atari ST Internals

EXT Sign Extend


The operand is filled to the given processing width with its bit 7 (in the
case of .B) or bit 15 (.W).
JMPJump
Unconditional jump to the specified address. The difference between
this and BRA is that here the address is not relative but absolute, that is,
the actual jump destination.
JSR Jump to Subroutine
Jump to a subroutine. The difference from BSR is as above.
LEA Load Effective Address
This often-misunderstood instruction loads an address register not with
the contents of the specified operand address as is normal for the other
instructions, but with the address as suchl
LINK Link Stack
This instruction first places the given address register on the stack. The
contents of the stack pointer (A7) are then placed in this register and the
offset specified is added to the stack pointer.
With this practical instruction, data areas can be reserved for a
subroutine, without having to make room in the program itself, which
would also be impossible in programs which run in ROM. The
C-compiler makes extensive use of this capability for local variables.
LSL Logical Shift Left
Function and limitations as per ASL.
LSR Logical Shift Right
Function and limitations as per ASR, except here the sign is not shifted
in on the left, but a 0.
MOVE
The first operand is transferred to the second.
Variations: MOVEA, MOVEQ
MOVEM Move Mulitple Registers
Here an operand can consist of a list of registers. This can be used to
place all of the registers on the stack, for instance.
Example: MOVEM.L AO-A67DO-D7,-(A7)

264

Abacus Software

Atari ST Internals

MO YEP Move Peripheral Data


This speciality is made expressly for the operation of peripheral
components. As a general rule, these work only with an 8-bit data bus,
and are are then connected only to the upper or lower 8 bits of the
68000's data bus. If a word or long word is to be transferred, the bytes
must be passed over either the upper or lower byte of the data bus,
depending on whether the address is even or odd. The address is then
always incremented by two so that the transfer always continues on the
same half of the data bus on which it was begun. Corresponding to the
purpose of this instruction, one operand is always a data register, and
the other is always of type register indirect with offset.
MULS Multiply Signed
Signed multiplication of two operands.
MULU Multiply Unsigned
Multiplication of two operands, ignoring the sign.
NBCD Negate Decimal with Extend
A BCD operand is subjected to the operation 0-operand X.
NEG Negate Binary
The operand is subjected to the treatment 0-operand.
Variations: NEGX
NOP No Operation
As the name says, this instruction doesn't do anything.
NOT One's Complement
The operand is inverted.
OR Logical OR
The two operands are combined according to the rule for logical OR.
PEA Push Effective Address
The address itself, not its contents, is placed on the stack.
RESET Reset External Devices
The reset line on the 68000 is bidirectional. Not only can the processor
be externally reset, but it can also use this instruction to reset all of the
peripheral devices connected to the reset line.
This is a priviledged instruction!

265

Abacus Software

Atari ST Internals

ROL Rotate Left


The operand is shifted to the left, whereby the bit shifted out on the left
will be shifted back in on the right and the cany flag is affected.
Processing widths and shift counter as per ASL.
ROR Rotate Right
As above, but shift from left to right.
ROXL Rotate Left with Extend
As ROL, but the shifted bit is first placed in the X flag, the previous
value of which is shifted in on the right
ROXR Rotate Right with Extend
As above, but reversed shift direction.
RTE Return from Exception
Return from an exception routine to the location at which the exception
occurred.
RTS Return from Subroutine
Return froma subroutine to the location at which it was called.
RTR Return and Restore
As above, but the CC register (the one with the flags) is first fetched
from the stack (on which it must have first been placed, because
otherwise execution will not return to the proper address.
SBCD Subtract Decimal with Extend
The first operand is subtracted from the second. Refer to ABCD for
information on the data format
Sec Set Conditionally
The operand (only .B) is set to $FF if the condition is fulfilled.
Otherwise it is cleared. Refer to Bcc for the possible condition codes.
STOP
The processor is stopped and can only be called back to life through an
external interrupt.
This is a priviledged instruction!
SUB Subtract Binary

The first operand is subtracted from the second.


266

Abacus Software

Atari ST Internals

SWAP Swap Register Halves


The two halves of a data register are exchanged with each other.
TAS Test and Set Operand
The operand (only .B) is checked for sign and 0 (affecting the C and N
flags). Bit 7 is then set to 1.
TRAP
The applications programmer uses this instruction when he wants to call
functions of the operating systems. This instruction generates an
exception, which consists of continuing the program at the address
determined by the given vector number. See the chapter on the BIOS
and XBIOS for the use of this instruction.
TRAPV Trap on Overflow
If the V flag is set, an exception is generated by this instruction,
resulting in program execution continuing at the address in vector 7
TST Test
Action like TAS, but the operand is not changed.
UNLK Unlink
This instruction is the counterpart of LINK. The stack pointer (A7) is
loaded with the given address register: and this is supplied with the last
stack entry. In this manner the area reserved with LINK is released.
Addendum to the condition codes: The conditions listed under Bcc are not
complete, because the additional conditions do not make sense at that point.
But the instrutions DBcc and Sec have the additional variations T (DBT,
ST) and F (DBF, SF). T stands for true and means that the condition is
always fulfilled. F stands for false and is the opposite: the condition is never
fulfilled.

267

Abacus Software

Atari ST Internals

HH

-a
-o

4-1

en c id o
o 0

4-1 4-1
01 rl
CO id
rl
01 01 4-1

-H
CO

K
EH

rH

EH

01
4-1

c
o

id

-rt

4-1
01
CO

id

01

cu
A

in

Ed o

rH

rH

o
o o o o
m
m m
rH

rH
O
CM
O
O

X
-X

*
X
X

2
43

rH

rH

rH

rH

rH

01

o o o

o o o

43

rH

01

a o a o o o a a E E E
CM

CM

0
0

0
0

o o
o o
o o
H vo

*
-X
*

rH
0

CM

*
X
-X
X
X
X

X
X

01
rH

ti
01

O
O

rH

CU

rH

tn

01
CO

01

o
0

o
r-

o o
CM

CM

0
CJ
V*

=8=

[V,

rH
O

in 0
</>
0
o m

CO

CO
CO
01

rH

ft

id

in
O

rl

rl

-a
T)

rl

rl

rH

rH

CO O O
CO o CJ
O CU
0 H Ti 4-1
TJ id X
T> o 01

rH

m
rl

id
cu
rH

CJ

rH

CJ

CM
O4
CO O
Q CJ
Cu

c
id

c^T!
01

o
Q

1 JS
01 o

id
cu

rl

rl

rl

rH

rH

CJ

CJ

G
Ed

id id
cu CU T3

rH

cC
=tt=

01

0!

01

CU

4-1

01

o o

4-1

cu o

E E E E

01

10
o
H-

IO

rH

o m
Q

o
rH

Q
0

rH

cu
01 id 'H- 01 cu CU
id
o cu o 43 3 o o o
E

rH

CJ

n
o

f-,

CO

CU ^~

O E
E E G E O

0
0

CM
CO
f-,

CM CO
0 O

CM
0

(V,
fV,

o
O
o
o [V,
r- o Cd r- O
0 CJ 0 o o
o o o o o
o o o o o
CJ
PQ

CJ

CJ
03

fT,

O
gi
CM
CO

CM
O
O
O
CJ
fa

(V,

rv.

fT,

r-.
en
fc.

co o
CO r- co n

o
o
CJ
en
o

PM

0 rtl

CO

rH
rH

10

rH

ST

CO

\>

CO

LO in m m m in m m m m m in in in
o o o o o 0 0 o o o o o o o o 0 0 0 o
o o o o o o o O o o o o o o o o o o o

O
VJ3
O

\>
VD
O

IT)
O
O

in m m m in

4-1

rH

cu

rl

rH

en

en CO
un in CO
0 o rH fa
Ed o o Ed =31 m
rH
o o rH
00
o o *3* fv.
f^ o rH rv.
o o CJ O CQ en
[V,
m m en m en rH
CM o
u o o o rH o rH o o CJ en CJ en
rH
o o o O o o CM o fa fa
fa
o rH o o O o o \S3 o
n co rH
VD o o o O o o O o ^T CM CM ^r
o CM c1 CO CJ o *=r CO CJ Cd CM O v>
o o o o o rH rH rH rH rH CM CM co
0 o o o o O O o 0 O o O o
(T)

*
-X

ft
4-1
3
O

rH

01

rH

01

X
X
X
-X
X
X

4-1
M
T3
4-1 0
id
ft

01

rl

CQ

,w
,1
,1

*
X

rH

$19BF4

*
*
*
X

Ed

$19000

CO

End of the operating system variables

EH
CO

id

tn
tn
01

-rl

01
4-1
4J
0

Start of the operating system

PQ

01

O
CJ

# $ 5 0 0 0 , Al

CO
CO
01

4-1
CO

o
CO
01

,b

CO

id

CM

rl
rH

#$5FC,AO

4-1

4-1

,w

id

CO

End of the operating system

-rl

43
<d

,w

in

en

01
rH

Syncmode

CO

#2,$FFFF820A

E
01
4-1
CO

# $ 2 7 0 0 , SR
Supervisor mode, no interrupts
$501E,$42A
Load resvector
#$31415926, $ 4 2 6
Resmagic to resvalid
$FFFF8800,AO
Address of the sound chip

3.9 The BIOS Listings - Version 1

o
rH

rH
rH

o
rH

O O ^O

co
o

^J1
O

q*
O

<
qi
O

268

in m in
o o 0

CJ o
fa o
in o

CO
CJ

rH

CM

rH

^n <r)

0
Q CJ O o o CO
o O O
CJ
PQ o CM o o n
n n r- CO PQ

<

^31 ^D

fa

fT,

CO

^o
r- t
o O o (O
o
in in in m m m m
o o o o o o o
0 0 0 0 0 0 o

Cd o CM
[f^
r- CO CO
o o o O
in in m m
o o o o
o o o o

""1

43
3
1 CO

rH

43

<U

(U

0)

0)

O O
S E

rH

o
o
0
CO
M

i4j
EM
3
=?
CO

CM
a1
O

o
o

0
CM
CO
EM
CM
EM
CM
EM

CO
0
CM
CO
CM
EM
EM
CM
O

in

H-

H-

H-

CO

O 0 0 0 O

in ^p

0
Q

rH

O O rH
Q Q Q

rH

rH

rH

rH

(U

(U

rd

rH

< EM

CM

CM

CO

^p

<P

CO

"^
^^ ^
^^
0 0

o o
in in
*
rco

sS

j r~ CM rr3"
CO

0)
rH

< O

CO

CO

SP
Cft

pq m
EM m vo
CM EM t
PT, p-. CO
en rij o
O [^ o^

o o
{_) o
o o
CM

O O
CJ CJ
O o
CM CM CM

CO
<

<=c
fQ

CJ

rH

O
CM

w o

=r

CO

CJ

sp

s S </> in in

CO

EM"

pq CO ^O
< Q PQ
m in

* * *

rH
D
IT)

number of VBL routines

CM

to-

=P
<

CO

<f*

<n

co

rH

rH

rH

rH

rH

rH

rH

rH

rH

<S>

(U

(U

0)
K,

0)

(U

(U

|
O

* *

<u CD
o O

vo w

<

O sp CJ QI CJ =3" CJ
PQ CJ O CJ Q Q CM
O 0
O O O O

=r

sp

(Q
(U

CM

s
EM
fa
CM
EM

,-

CM
CO

O CO

CM

rH

rH

0)

CO

0)

CD

CO

sp

CM

"d1
0
CJ

a1

CM

w o

a1 pq
o
*?p CM =r o
o rH O in

m
o

=P

sm

CM

CM

CJ
CM

CM CO w
O o o
rH H H

in
=8=

IQ

o CO gi CO O CM
EM o o ^P o o EM
o 0 ^P o 0 EM
*p
o 0 o 0 0 0 0 EM
Q Q en o Q CJ CJ CJ
V)
vo
EM
w r0 pq pq pq
PQ PQ EM
f

*t

0
0
O

CO

EM

rH

\Q

CM

5 "t
<3< co <n =s=
*

w rt

vo CM
CM CM t> r~ r- r~
^i 31 ^i ^^ SP t"5P
*?p
0 0 0 0 0 0 o
O o CO CO
CM
(4
o o pq CO \0 rH
o o f^ Q PQ Q O
o o in m in m v^5
\o ngi 03 o o o o O
fyt o O o 0 o o O
EM o o o o o 0 O
EM o o o o o 0 o
31
CO CO CJ CJ CJ CJ
[*
O pr. [y^ pq f- p** f*.
PQ PQ
PQ
( rH CO CO
to 0- CM CM CM CM CM CM CM

m m
<

* m in 0 CJ
pjj sr ~ qi ra

PQ -~o w
EM

V*

<

in CJ w

in
ft,

CM

CO

CM
CO

CO

SP

vo
*

i~H
<0

IQ

CM
CM

<
<

in

Dskbufp to $12BC, disk buffer

<

m m

Clear dumpflg for hardcopy


Sysbase, start of the operating system

33

CO

1
I

rd

1 ft

Fverify, Floppy Verify after write


Seekrate for floppy to 3 ms

>

4-J
0
O

Nvbls,

0}
X

CM
CO

\O

cn

rH

31 ^p
O 0 O
Q Q U
[V]
CM* CO
CO CO CM
rH rH CO

o o 0 o o
in in in m m
0 o o o o
o 0 o 0 o

< w

0 ^p
0 o
Q CJ CO
U3 CM ^1
O rH PQ
CM cn CM

CJ

CO
0
G

<V

s
rH

d)
c
43

rH

m <ft- o
^
in
W in in
^ Q
o
O *^ o *>r *-* ~_ CM
CO H o EM o EM
CO
m
in
0 =r

*
</> <o *

0)

rd
CO

EM
EM
1EM
CM EM

CO

4-)
-H
C
-H

End os as memory bottom


Initialize stack pointer

CM S

CD

\5)

53

q
H

01
(U

i Hdv mediach

o x;

A
o

Clear screen

CO

CO

Atari ST Internals

($7FF+1)*16 = 32 K video RAM

a
o

CM
CO

Dbasel

0)

J203

As video address v bs ad
Dbaseh, video address for hardware

o
o

!201

Abacus Software

CO

^p

p-*

o
o
0
0

[pq

CO

CM

CO

CM

CO

w ^o

CJ

cn r^
rH rH rH CM
pq pq
w EM
CM
<^ CP
o O
O o O o o o o
o
o O O
H H H H H
in m in m m in m m in in in m in m m in m m in in in m m in m m in
o o o o o o o o o o o o o o o o 0 o 0 0 o 0 o 0 0 0 0
o o o o o o 0 o o o o o o o o o 0 o o 0 o 0 0 0 0 0 0

269

CJ
CM

CM

O
0

/>

01

(0
0)
rH

<

ca d, tr

01

rH

01

rH

Cl

Q
CO

to ==

rH

rH

<a

01

01

ta

rH

01

CO
o CO
r- vo in PQ PQ

o
o
/->

CB
01 Ti

EH

-H
4J
4-1

*Q

rH

CM
tH
<O

o
Q

ca

01

SH

0 T)

ta

m
in
to
rH
(0

>

CO
CM

rH

rH

i-H

01

01

01

01
>

^J1

CO

01

0)

01
J>
0

to

iO

f3*
"-T
O
CJ
fa

fa

vo

o
o

fa

CO
CM
CO

in
o CJ W
o fa Q
o o CO rH
o o o O
o CJ sC <s
p^ [^- fa fa
PQ PQ t CTl

0
0
0

IO
CO
CM
CM

(^C

VO

PQ CM
CJ r^
0 vo

o en CJ en
CJ fa
fa
fa
CO rH 0 0 n
a1 Q W CO CM Q
fa

CO

sp

=r

=r CO CJ vo CO o
3* *T
to m m

CO
rH

a*

a1

rH

rH

rH

rH

rH
0
CJ

CM CM

CJ
CO
rH

o
o
o
o
o

o o
0 0 Q
Q o 0 CO
VO CM o o
o o o o
f-1

to

fa
en

0 CO
0 o
0 0

rH

rH

CM
VO
rH

m to m m m m in in m
o O o o o O o o O
o O o o 0 o o 0 0

00

CJ

vo

PQ PQ

to

ar^
<H

VO

rH
10
O
0

m in m
o 0 o
o o o

|
|
0)

CJ

00
CM

S; to

to
to

CM f

G
4J
-H
PQ

to
S-l

ca

01
rH

in

fa tZ

CM

CM in
=st= to

in

rH

ca

01

r-l

&

01

01

^
0 H
O

ra

J_l
CO

ii

01
0

S-4
CO

^
p
CO

*^T

0
0
CJ

CM

0 VO
Q

0
a1
0
CM
VO

to
to
o CO
o o
0 ^r

w vo (
o m o

0
fa
0 0 0 o 0
o O Q CO CJ CO CO
c
"a1 co C3> o
PQ PQ rH CQ o CM rH
CM CM CM CM CM CM CM CM CM CM < CM co
to

w
r~

SH
01

vo

m
o
w to Q
CJ
o

rH

o O
o 0
ql CM CJ
vo
vo vo cn
rH in CO
O sp ^Jl
in m PQ
O m in
to m
vo o 0 o CO o o o 0
fa o o o CO o o o o
fa 0 o 0 o 0 o 0 ^p
0 o 0 o 0 o 0 o
fa
CO PQ CJ CJ PQ o CJ o o
O O p-. r- q* t t r- Q1
rH CO PQ PQ PQ PQ PQ PQ PQ

vo

<H rH

00

r- vo
o o
o 0

*^

a1

SH
rH

vo

o
o
o
CM

rH

CO
0

01

to

m o in < io
0

rH

to

rH

CO

rH

to

vo
vo en
in PQ
m
to
=8= =*>

00
CO

01 -H
4-1 rH

4-1
-rl

<

rH

1 1

to m m

rH

#$5562,

fa
m

to in

CM

e p
CO

,1

CJ CO

rH

rH

O
C!
H

01

O
4-1

Cart scan, test cartridge

en

0)

Next vector
Initialize MFP

0)

ffl
P

O
4-1

CO

As pointer to vblqueue
8 vectors

4-1

SH

Etv critic vector

4-1
O
01

5)

SH

P
G
0)

p
SH

1 LINE A vector

p 4-1
C -H

vo

rH

CM CO to w CO
o
CM
ro
fa
in in in CO fa rH CO
to to in m to to in
== to to
to CO

o
g

,Q

CO

S-l

01

1 TRAP #13 vector

to

CO
CM
CO

01

S-l
0!

(H
0!

#$556C,

fa

CO

Q.

rH

CO

G
-H

,1

to

S-l
01

#$543C,

CO
-H

U
0
SH

,1

CM

G
-H

1
1

io

CO

CO
P

-H

Next vector
'Division by zero 1 to rte
Vertical Blank Interrupt, IPL4
Horizontal Blank Interrupt, IPL2

cn

.a

CO
-H

#$10001

p
ra

Number of vectors
Set vector

S-l
O

CM

#$2000(

Ei

CM

\0000

CO

rH

|
|

|
|
|

|
|

|
|
|
|
|
to

Pointer to rte
Pointer to rts
Cartbase, Diagnostic cartrige inserted?
Yes, don't initialize vectors
Terminate process

CJ

fa
m
to
o

rH

Atari ST Internals

Abacus Software

VO
CO
rH

270

CM

pj.
rtj
rH

vo <
PQ PQ

w
ffl

VO

P3J
CM
rH
O
O

CM
Q
0 o CJ
O rH PQ

r-

VO

en

VO CO o o CM vo
CO en cn
rCJ O 0 CJ Q Q Q
rH H rH r^
rH H
H
rH rH rH rH rH rH rH rH rH rH rH
in in m in in in in
m m 10 m m in to IO in in to
0 o 0 0 0 0 0 0 0 O 0 o o o O O o o O
o o o o o o o O o o 0 o 0 o 0 O 0 o O
CO

^p
rH
Q
rH
O
O
rH

CM

4J
-rH
<0

tn

JJ
-H
(0
S

tt,

&

01 JJ
<H

!-4

P
(0

s; c 01
o a M
O
S
01
0) o cu o

0)
S Q EH

0 CJ

cu

01
-H

H
CU
01 fl
O JJ
>H

-H

jq

fc.

O
g
p
IH
> -H
W

C"

-H
-p
P
rH

H
g
3
CU

4J

rH

43

CU
<D
!H

m o
rH

0)

01

cu

m cu
O
rH

N
-H

rH

<B
-H

o E?i5
o c

Oi

01

cartridge

JJ

M 3
0.

H 0
G. 01

01
0]

a
<n

t cartridge

O
O

a tr>
cu g o

IH

X
01
-rl

rH

g
o

!>

M
0

rH

rH

43

-H

T)
g
jj C"

-H 0)
A A TS
PJ O 01 O
JJ PH
O IH
(U
M

rH

G. 0)

CO

ram shifter

o o rH
H-I MH o

Atari ST Internals

ect low resolution

r next picture return


r next picture return
ution to monochrome
monochrome detect
monitor ?

Abacus Software

o cu

M
K

rl
CU
O
Q

IH
43

rH

JJ
*.
fi

0)
CO 43

cu
jj
.
c
<a

<H
rH

0!
01
CO

Q
CU

T)

M
p
O

rH

-H

IS

o cu C OJ JJ C 01 -H o o
rH
01
J., rH
in ; o
JJ
JJ
o 43 -H eg en -H m c 01 g
O M CQ o M Q CJ
>
tJ

ti

r.

cs

p^

01

rH
g
jj a
0 0 P 0 <a o <3

rl

m
o

CU

CM

0)

o cu
cu s g
x: <3 m
0)

rH

0
IS

43 o rH
rH
<3
c p p
M < 1Z

Q
13
rf!
S

rH

O
U
~

CJ

rH
P

FFFAOl

CM
CO

3i
31
U")

EH
O PH
Q

m CM
==

(3n

VO

rt!

1O

in
P

O EH
CM
- CM
qi EH
00
fv) (jQ
gipr^O^PEH^TrH^1
< n - - Q r H E H C J O v K ^ C M E H V O i n -

CM

CJ

ft.
EH

,Q

43

O P

0)

CU O

> co cr > a P
O

^-,
m

JJ

43 g 43 43 g O

rH

43 43
43 43
- <u 0)

15

M > > a. cu Q>


rH O O g G O

CU

EH
PH
CM
CO

EH

o o
o o cj en
o o CO CO
O CO
rH O

CO

CJ

CQ

-sp CJ

Q Q W W W (4
rH

rH

rH

CM
CO

CM
O
o
O
o
O
O EH o
o
o
o
CJ CM
CO O o -a- CJ CO
O Q CM ffl CO o

rH

in
</>

m
w

CO

pq
31

en

*_<r

P-,
*f

Q
W

(3J

CM

CM

CN (<
iO ^-

^-K

Q r-

m m m
<o /> ^> 1

> </>

cr

CU

CD

O g g O 43 g - n g g 0 4 3 g g 4 3 4 3 4 3 - P 4 3 4 3 4 3 O , a

CM

PH
EH
EH
W

C
O
O
O

CM
VO
CM

PH
"*-"

>
> H SH
JJ O1
> IH
O l O O r H O l O O O l O l O l O l C U O l O l C U C U

EH

r< VO CM
VO VO O
(O CO O
O

o
p ) O O P 4 O O
E H C O Q p H t E H C M
C M C M - C M T C M C O

EH r< Q
. rH SP
rs rH
t m ^r CM m o o O r H i n P H P H ^ > r H o i n - y > r H i n e n m ^ p
u>
=8=
</> *#= t/> Q Q Q = S = < - > > * = * Q - = t 1 = = ( : - u > > < n - < ' >

rQ

w a)

PH
EH
EH
EH

pq

VQ

PH
PH
EH
FH
en
EH
CO

CO

EH
o
o
o
o

in
o
o
o
o o
m
o
oo
o o
o o

CM
CO

o co

VD =P O O
O CO CM* O
O CM O O

EH

O CM
O CJ
O EH

CO

rH VO
VO *3*

O O
O O O P~ rH O O
rH < I rH rH
VO "3* VO VO VO

en cj CJ

pq CO

O O
Q O

^ P)
VO EH
O VO

en in
en en

o o
o o
co oo o
o on co o o

r- r~ r~ vo
co co co CM

CM VO
VO
CM VO .<
CM
O O
CM CO KC
0
<h^ 0
*^ 0
v-/ riiH r*i
t Cv 1O
* C\' O
t C*' O
i C>.' O
I ^p **r ^" "^p ui
H CVN
M Cv^i
M C<.^i
M C( O
in
rH rH
in ui
m ut
m uf
rH rH . . . . . . C M C M C M C M C M C M C M C M C M C M C M C M C M C M C M C M f M C M C M C M C M

PH PH

m m in m in in m m i n m i n i n i n i n i n i n i n i n i n i n i n i n i n i n m i n i n i n i n i n i n i n
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
ooooooo oo
o o o o o o o o o o o o o o o o o o o o o o o

271

Abacus Software

Atari ST Internals

M
o

er

tfo

-H

3
G

0!

n
o
4-)
<0
O
-H

-H

tj^

!H
T3

n C
01 -H

01

A
4->

g
4
P

n g tn

<0 G
G -H
0) 0> H
4-> H 4J
(0 -H 01

01

G
01

(0
M

TS

is

tr>
0
M
ft

X
O
H (0
rH 4->
(0 10 0!
o O

>H

rH

> -H
O G
rH -H
-H 4J
. . G > 18
01 -O 01 01 O 4J
0)

4->

G 01
01

g e

(0
G

10
G

fc,

ft

O
01

0 1 > r H r H

x:
ta

O T 3 O O O < G C P P
!3 sC CJ CJ PQ - M W B B

0)
M
01
rH

o
a
<a
01

ej>
<a
ft
01

ra

1 1 (0

rH

a)

ftI

4-1
C
-H
O
ft

3 01

rH
1H

M
01

01

OT 0 X!
0 0!
M

W 0
O O

to

0)

o
0
01
W

CM

en

o
W W W CM ~ VO CM+
CM

01
r-l

(0

!H 01 ai
X! X) -H

t>

o
g

Q Q
a
w

ft

01

g e
o xi

CM

O CM

in

m m

(0

Q Q

~ vo

U o

CM

X!
01

01

> >

S- ^
Q
I

CQ

CM
O

CM

o m m m m

ff, in

01

o o

Pn

o o
_ ft

o -a
g X) g <a

0!

>

0!

01 01

H
CM

in o in

<o <o ra >

01

I
-

ft

<S "O
"O

01
>
O

01
01
> (0 >
O 01 O

ft ft ft g 4 - > i 0 5 g f t g

II
EH
t<

o
fa
fa PJ
v Q
o B
rH

m PIJ * o

01 01

ft

X! X! X)

> > (0 T! ft

O l O O M t J g O O O
-n TS *^3 "O
f t g e
CM

m
o
m
w

vo o in

o o o
Ci o < cj
m o fa r~
O
VO

rH
VO

rH CM
*3*
ro

CM VO <

VO
CM

VO
CM

VO
CM

VO
CM

n
CM
O
O
O CM
rH O

O vo
W

CM

a\o -5P cyi


31
CM

CM <!
rH VO

o
o
o
o
o
O
rH

31 vo co f=c

vo r~ c r- r~ t
CM

CM

CM

CM

CM

CM

m in in m in m in in m in
o o o o o o 0 0 0 0
o o o o o o o o o o

0
CO
rH

CO
CM

m
0
o

o
o
o

487900000502
4879000052ED
487A0059
3F3C0005
3F3C004B

VO CM

W vo o

005286
00528C
005292
005296
00529A

ft,

005280 D03C0041

CO

CM
(M O
O

H CM

fa o

=p in
o o
o o

in "31 PQ

CO O

o
o

o o
o o

-3"

o o o
o o o

CJOC^CflcO<OCJ

f a ^ * [ r ~ ~ o t coro
O rH CO fa CO fa fa
CM CM
CM "3* CO CO

o a fa
m ro fa

M O

CO O

fa

<H
"31

o
o o
o o
o
o o m in
<*
fa

C
CO

co
m CM
O

vo . . -' VO . W. . CM -3> CO
f S r t r i l C Q p q pPQc i Op qCJ
o cOj O O Q Q
CM C M C M C M C M C M C M C M C M C M C M C M C M C M C M
m inininininininminininininin
o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o

272

N>
-J

0052ED 000000

0052E4 4700
0052E6 47454D2E505247
dc.b

dc.b
0,0,0

'GEM.PRG'

7003
610A
20790000047A
4E90
4E75

moveq.l
bsr
move.l
jsr
rts

#3,DO
$52FE
$47A,AO
(AO)

****************************************************
0052FO
0052F2
0052F4
0052FA
0052FC

41F900FAOOOO
OC98ABCDEF42
661A
01280004
670E
48E7FFFE
20680004
4E90
4CDF7FFF
4A90
2050
66E6
4E75

lea
cmp.l
bne
btst
beq
movem.l
move.l
jsr
movem.l
tst.l
move.l
bne
rts

$FAOOOO,AO
#$ABCDEF42,(A0)+
$5326
DO,4(AO)
$5320
DO-D7/AO-A6,-(A7)
4(AO),AO
(AO)
(A7)+,DO-D7/AO-A6
(AO)
(AO),AO
$530C

*****************************************************
0052FE
005304
00530A
00530C
005310
005312
005316
00531A
00531C
005320
005322
005324
005326

rts

***************************************************
005328 4E75

add.l

D1,AO

****************************************************
00532A D1C1

Dskboot, boot from disk


Bit number 3
Test cartridge
Hdv boot, load boot vector
And start attempt

Test cartridge
Cartbase
User cartridge inserted ?
No
Initialization ?
No
Save registers
Address of the init routine
Perform initialization
Restore registers
Additional application in cartridge ?
Get link address
Initialization next application

Default vector

Memory test
Add offset to base address

a
to

00532C
00532E
005332
005334
005336
00533A
00533C
00533E

4240
43E801F8
B058
6608
D07CFA54
B3C8
66F4
4ED5

9BCD
OCAD752019F30420
6608
OCAD237698AA043A
4ED6

clr.w
lea
cmp.w
bne
add.w
cmp.l
bne
jmp

sub.l
cmp.l
bne
cmp.l
jmp

DO
$1F8(AO),
(AO)+,DO
$533E
#$FA54,DO
AO,A1
$5332
(A5)

A5,A5
#1965038067,$420(A5)
$5354
#594974890,$43A(A5)
(A6)

****************************************************
005340
005342
00534A
00534C
005354

00000000
00000000
00000000
00000000

******************************************************
005356
00535A
00535E
005362

1839FFFF8260
C87C0003
D844
B1FC00008000
6220
B1FCOOOOOOOO
6604
307B4086
4280

clr.l

move.b
and.w
add.w
cmp.l
bhi
cmp.l
bne
move.w

DO

$FFFF8260,D4
#3,D4
D4,D4
#$8000,AO
$539A
#0,AO
$5386
$530A(PC,D4.w) ,AO

*******************************************************
005366
00536C
005370
005372
005378
00537A
005380
005382
005386

Clear test pattern


End address of the test
Test memory contents
Unequal,' terminate
Create next test pattern
End address reached ?
No, continue test
Back to the calling address

Memvalid
Memval2

Shiftmd, Get video resolution


Isolate bits 0 and 1
Double value for word table

CO

rs

en

CM

It
a
**

ta
SP

N>

005388 1039FFFF8201
00538E E148
005390 1039FFFF8203
005396 E188
005398 D1CO
00539A 7EOF
00539C 3C3B4078
0053AO 3605
0053A2 2448
0053A4 D4FB406A
0053A8 1011
0053AA 4BFA0004
0053AE 6042
0053BO 3202
0053B2 10290001
0053B6 4BFA0004
0053BA 6036
0053BC 3011
0053BE 4EFB4002
0053C2 6004
0053C4 600C
0053C6 6014

move . b $FFFF8201,DO
#8, DO
Isl.w
move . b $FFFF8203,DO
#8, DO
lsl.1
DO,AO
add.l
moveq . 1#15,07
move . w $5416(PC,D4.w) ,D6
move . w D5,D3
move . 1 AO,A2
$5410(PC,D4.w),A2
add.w
move . b (A1),DO
$53BO(PC),A5
lea
$53F2
bra
move . w D2,D1
move . b 1(A1),DO
$53BC(PC),A5
lea
$53F2
bra
move . w (A1),DO
$53C2(PC,D4.w)
jmp
$53C8
bra
$5302
bra
$53DC
bra

0053C8 30CO
0053CA 30CO

move.w
move.w
bra

move.w
move.w

DO,(A0)+
DO,(A0)+
$53EO

DO,(A0)+
DO,(A0)+

*****************************************************

0053CC 30CO
0053CE 30CO
0053DO 600E

*****************************************************
0053D2 30C1
move.w D1,(AO)+

Dbaseh
Dbasel

Low resolution
Medium resolution
High resolution
Low resolution

Medium resolution

en
o

cn

5.

Abacus Software

Atari ST Internals

c
o

-H

rH
1H

rH
rH
10

ra

ca

,SR Restore carry flag

4-1

CO

X
*
*
X

rH
Q

CM

"
CM

Q Q

n")

rH

CM

CO

CO

CO

<

in o m
CO

Q Q Q

CM

VO

in

co

,-.

CO
a ' Q

CO
Q

O
3t=

r~ rH PS
=* =H= w

CM

1
X
X
X
X

cd
43

rH

-8a1

1 cd

CM

Q
rH

CO
CO

CM

<

,_|

D
==

in
CO
Q

CO
Q

in
co
rij

*
rH

&

move.

m
M

CM

CO

move,
move.

15

move.
move.
move.

IS

<

X
.
&

o
f)

rH

*r!

rH
>-<H

43
rH

move.

*
*
*
*
^
X

move.
movec
movec

o o o

i-H
X
O

rH

move.

*
*
-X

O
10

************

Cn
-H

10

0
0 t
n
S-t 1

O 0
(0 CO

O
CO

vo
Q

CO
Q
CO

^p
Q

co
m
o
o

sr

CJ 0
vo

*
*
X

<J
Q
CO

X
X
X
X

co
in in in
o 0 o
o o o

vo
CJ

^31

Ed
(=
P4
fa
fa
CM
fa
fa
VO CO 0 r- 0 r- CM fa CM ffi
rH CM 03 <j W c^ fa
03 m
o CJ O =p CJ ^p
O Q sp 0 0 rH Ed IO Q in O o Q
rjl
vo
0 o
o
Ed vo 31 vo CO 0 co VO co
CO CO m CM m in in
CM r-- t
Ed a1 Ed irr. Ed m CM sp
CO

ptj

[V|

PT-|

o
Q
CO

Ed
Q

3*

vo

^
Ed Ed Ed E
d
co CO CO CO CO

m m in in m m
* o 0 o 0 0 o
^
X

o 0 o
o o o -a o
0

CO

CO

CO

CO

^
o

CJ Ed
0 o
sp sp

*
X

CM

IS

*
*
X

-X
-X

CM

-X
X

*
-X

rH
CJ

X
*

*
*
X
*

-X
X
X
-X
X
X
-X
X

-X
CM CM vo
t CO o 0
o
* fvo vo
vo vo
* rH rH rH rH rH
*
*
*
X

o o o o o

vo CO <C CJ
Ed
fa
fa fa fa fa
CO
CO CO (O CO CO CO
m in m m in in in m
0 o 0 0 o 0 0 0
o o o o o o o o
o

O
fa
CO

CM
fa

qi

276

td o
fa

CO

3*

CM
0
^F

VO

CO
0

=?

in m in ^
m m

o 0 0 0
o o o o o
0

-X
-X
-X
X
-*
X
*
*
*
X

-X

*
X
X
X

^p

^p o o

CJ
'-C
^d o o
^
Ed E
CO

o o
o CM
rH
SP

rH
SP

in m m in m
*
-X
0 0 o 0 0
-X
o o o o o

Atari ST Internals

Abacus Software

CD

p
4-1

c: >^

<a

rH

<a
P.

CD CD
CD
a M tJ>
; i &
0
-P
B 1 ^j
c**
rH CD
CD
rH 3 CT> P O^ CD
O>
-H H -H
CD rH
S rP

0)

rl

-H TS
O g* CO

rH

G
CD
CD

o S

TS
(U

G
CD
CD
SH

cn

4J

r-;
tP

-H

S
O
rH

CD

CD

rH

>!

4J

4->

tyi 23*
-r) r)
r^

CD
CD
(0 SH
4-> &
G t
CD CD
O> 3

ca rH
g ,Q

4J y
O
O1 571 C{3
-H -H rH
4->

^ ^

it
it
*
*
it
*
u
it

o
CO

it

_ o o

<^

CM

*
it
*

o +
I r~ o
o
. rt; r* <a* co c^
o * <f> in -u> <;
Q CM *==

-iC
*
it
it

O
r- o O O r- c^ t in co co co CO [ rr- o [ r- 0 0 r- m ro co r- f^ CO CO r- 0
r- r~ O r o r- o in CO t co r- co i ro 0
ift- </> c/> </> -u> in </>
</> </> </> <*> -c/> t/> u>- 1ft
[

Q
X

Q
O

-it

S S S S

*
-it

0 0 0 0
TS TS TS TS

it
it

S IS

S S

0 0 O
TS TS TS

S S S S

S S S S 3 S s s

o
0 O , o.
.:. 0 ,- 0 O O 0 0 O
TS TS TS TS TS TS TS TS TS TS TS TS

0)
O

s s

>

CD

4J

S n

it
it
*
it
*
it
it
-*
it

CM
O
O
O

*
*
it
CM
O

it
-it
O

rH

in o o o
o o o o
o o o o
31
rH
SP

V<
rH
"a1

CO ff.
rH rH
"a1 *3*

in in in in
o o o o
o o o o

O O o [ [
r- o r~ r~ O O
r^ [^ o r O r
* o o o o o o
*
*
Jc U H o CM SJI vo
rH rH CM CM
CM CM
-it ^P ^p T =3* ^t ST
*
it m m in m m in
it o 0 o o o o
0 o o o o o
*

*
it
*

Er in CO CO CO
m CO CO
o m co r- CO
o o o o o
CO (3j O M o

CO
[
0

co
0

r~ O
r^ o
CO o
0 0 o

r-

vo CO
CM CM CM CM CO
co co
a* a1 <3* ^
a1
m m m m m tn m in in
o o 0 0 0 o o o o
o o o o o o o 0 o
CM
CO

277

^p
CO
^p

<J
CO
a1

m
o
o

o
o
CO
o

O
O

o ro o
O
O

n
CJ

fn O
CM C~

o o
CO
W

>
O

O
CM >

CO

CO

in in in in m m m
o o o o o o o
o o o o o o o

-X

X
*
*
X
*
*
-X
*
*
*

-X

*
*

*
-X

-X

-X
-X

X
-X
X

-X
X
-X

* O O o O o
* o o o o o
CM
LO

CO

CM
LO
*^T*
LO
CO
LO

tn en o r~ en Q t n c J C j o c n o c j v o c ^ c j Q C j C M O O O Q O O Q
o Ed pa O C O C O C O r H C O C M C O r H C O r H C M C O O O ' 3 ' C J V a C n O C J
pa

LO

^p

LO

pa

vo =r

LO
^p

m
CO

CM

CM
VO
C1
LO
VO

LO
LO

rH
CJ

(0

CD

in

in

43*
p

CO

en

LO

move.b $FFFF8260,DO
Load shiftmd
#3, DO
#2, DO
High resolution ?
bge
$548E
Yes
0007FFFFFA01
btst
#7,$FFFFFA01
Mfp gpip, monochrome detect
bne
$54B4
No color monitor
0002 move.b #2, DO
High resolution
bra
$54A4
0007FFFFFA01
btst
#7,$FFFFFA01
Mfp gpip, monochrome detect
beq
$54B4
Monochrome monitor ?
044A move.b $ 4 4 A ( A 5 ) , D O
Defshiftmd, get color resolution
0002
cmp.b
#2, DO
Monochrome ?
bit
$54A4
No
clr.b
DO
Else low resolution
044C move.b D O , $ 4 4 C ( A 5 )
Save sshiftmd
FFFF8260
move.b DO,$FFFF8260
Shiftmd, program shifter
046E move.l $ 4 6 E ( A 5 ) , A O
Vector for resolution change
jsr
( A O ) Execute routine
3B42
bsr
$8FF8
Flash cursor
sub.l
A5,A5
Clear A5
045A
tst.l
$45A(A5)
Colorptr, reload color palette ?

FFFF8260
0003
and.b
0002
cmp.b

X
X

Increment frclock
Vblsem
VBL interrupt disabled ?
DO-D7/AO-A6, - (A7)
Save registers
#1,$462
Increment vbclock erh\hen

*
*
*

bmi

-X
X

#1,$466
#1,$452

pa

addq.l
subq.w
$553C
movem.l
addq.l

3
M
M
0)
4-1
C
-H
J
4-1
O.

00000466
00000452
OODC
FFFE
00000462

O O O C J C O V O O O C O r - O O Q C M p q c O O E L l r H p a
r H C J P a V O O V O r H V O O V O r H P a V O r r H r H C M 1 ' V O C r v

278
Q

CJ W ' = P C O C J W V O C O C J E = J ' V Q C O C J O C M i a ' C O W C M ' = r C O <


vo vo v o t t [^ t c o c o c o c o c n c n c n i 3 ^ F C C i < ? r ^ C P Q 0 a p a ffl
1^1 ^p *=p ^p "c1 ^r ^i1 ^ *^P ^1 ^' ^p ^p ^1 ^s1 ^1 ^^ ^ ^1 ^p ^ ^

i n L O L O L O L O L O L O L O L O L O L O L O l O L O L O L O L O L O L O L O

LO

o o o o o o o o o o o o o o o o o o o o o
0

o o o o o o o o o o o o o o o o o o o o o

CO

m
vt

0!
43

tr

CO
rH

vo

LO
0

045A move.l $ 4 5 A ( A 5 ) , A O
Colorptr, address of the new palette
FFFF8240
lea
$FFFF8240,A1
ColorO, address in the video shifter
OOOF move.w #$F,DO
16 colors

Abacus Software
Atari ST Internals

Q en cj
VO fa CO
O CO O
CM SP CO

H 0

a1 <
U CJ O
IO LO LO

o
o
0 0
0 0

> -p

a K

O CD
CJ 13

rH

43
>

H
<0
<1)
rH

CJ

>

o o
S3

>

MO)
M
43 .
0) P. "0 4J
0) 43

fd

>1 01
QH> ,Q

O
CJ

<o

O
m

CD
T
C
m r H C M J S - H 3
CD
M
rH 0)
1
CD 4-1 G
0} VO 01 3
0 T3 1

(U
01

rH

0 43
<H

a
c
03

M O

4->

-p 01
C P
p cr

4-1

Q.

CO

rH

4J

O 4J

MO)
CU P

a
(X 1-3
o m

01

C O I O r H < O O

43

43

4->

O 4-1

!H

M 01 CU CD <D

0 1 T 3 0 1 T 3

4-1

01

! H 4 - l O O
O
4-J
4 J 4 J 0 1 O
- . U M O I C U

rH

i-3

>

43

>

>

>-l

T)

x er>
cu cu

4-1
0 CD

(0

4->

- H O - r ) O m > O O T 3 C U
> ( D E H f f l E H > 3 , 3 C J f < U

x m

CD (U CU t<
M P ^H G
3 0
CD 0 4-1 4-1 <fl

C*i

N Q

G
-r)

(0
10

Cr>
rH

registers
restore VBL again

M
O
H
O
CJ

!H
0

(0

hardcopy desired ?

a,

t vector

M
4-)

cu

-H
4->
01 p
(U O
-H M

routine
registers

(0

01

isters

cn

Atari ST Internals

ecute routine

C
-H
(0

, new video address ?

Abacus Software

-.

>i p

rH

P. -0
O

0)
M

CD
01

tr>
1-1

CD
X

01
CD

01
CD

CD
rH

ft.
e
j3

PS

EH

CJ

10

O
4J

CD

01

rH

H)

rH

CU

43

>H

cs cj

VO

CJ

Ho

in m

m
o

CO

w fa

in m

m
m

0
CM
CO

CM
CO

m
o

fa
fa

fa

W Q

^r CO O

CO

3t=

CM

t~-

VO

in m
m

r~
O
rH

$456, AO

-trH

$45E(A5),$4'

rH

i
rH

CM

O O

in
in

TO-

rH

4-1
rH

ol

4-1

g,

01
43

cu
o

rH

CD
>
O
S

H
01

rH

43

> j_,
01
rH

43

rH

io trcu s
5 43

>
p o
01

s"

rH

CU
0

ci,

O1

e cu
o 43

CU

in

rH

.1

rH

CD
M

.1

rH

Q
1

CJ
0

in- 0
Q
Q CM
m
in
in
fa
CO o fa
m m
w n VO fa
m
cH m < fa r~
rH
rin m

-V

0)
^
0)

-r-1

43'p ^
01

cu j_,

01

0]

4-1

43

CD
O

rH

e
01

cr
a
a
m

CD
4-1
SH

nq
o

H
a1
^

CJ <J

fa
fa
CO

CO

D O
CM

rH

o
w
m
^p
o

m m

^p =r
o 0
Q Q
|C

CM

m m 5P
w o <=r

^
r
H
<; rvo

[V]
vP
*J*

rS

VO

3*

CM

fa

O
CM
O
CM

fa
fa

[V,

Q Q CO 0
-3*
O
P4

o
rH

^r

rH
0
CM
CO

0
CM
CO
fa
fa

fa

CO

o
w "-*

^31

m
SJ1

,e
H
rH
<H
O
O
rH
VO

0
0
0

o
o
en
m
PJ
o

o
o
m
sp
o
o
0
o
o
0
0
o
o
o
o
0 r~ en CO CJ
CM CO t m
r- C^) 0 CM n
VO in CM CM CQ
CM ^ VO CJ w
O 0 O 0 o
in m in in m

o <c

O
CO
rH

CO
rH
O
fa

CO

CJ

=P

CO

<

CM

Q Q Q o Q M PJ w fa fa
*3< ^r a* 31 gl ^p ^p ^r =r

vP

CO

279

w
fa
fa
fa
o

fJ
^31

CM

fa fa
fa fa

CM
LO
"ST

O
0
0

in fa fa o
0 fa r- o

Q Q CJ 0 o fa cn ro
^ f) cn Q
O
O VO 0 0 fa Q rr- CO iy CJ rH 03 rfl VO rH n CJ CM W
vo a- ^p =P in en 0- VO VO n
in =r

rH

a* VO <c CJ o
CJ
rH rH rH rH CM
fa
KP
in m m m m
in in m 10 m m in in m m m m m in in m 10 in \n m in in in
o o o o o o o o o o o o 0 o 0 o 0 o o o o o o
o o o o o o o o o o o o o o o 0 o 0 0 0 0 0 o

CJ
"31

o
o
o
o

VO

<^p

VO pj; CJ o CO
u CM
sP
CM CM CM n CO
m m in in in in in in
m in
in in m in m
o o o 0 o 0 o o
o o o o o o o o

CM

move.w

and.w
move . 1
cmp.l
beq
move . w
rts

SR, -(A7)
#$F8FF,SR
$466,00
$466,00
$5550
(A7)+,SR

**************************************

40E7
027CF8FF
203900000466
BOB900000466
67F8
46DF
4E75

**********
005544
005546
00554A
005550
005556
005558
00555A

move.l $404,-(A7)
moveq.l #-l,DO
rts

****************************************************
00555C 2F3900000404
005562 70FP
005564 4E75

****************************************************
$55EC(PC),AO
lea
$5570
bra

005566 41FA0084
00556A 6004

41FA004C
2279000004A2
301F
3300
231F
48E11F1F
23C9000004A2
08000000
6602
4E6F
301F
B058
6C10

lea
move.l
move.w
move.w
move.l
movem.l
move.l
btst
bne
move.l
move.w
cmp.w
bge

$55BA(PC),AO
$4A2,A1
(A7)+,DO
DO,-(A1)
(A7)+,-(Al)
D3-D7/A3-A7,-(Al>
A1,$4A2
#13,00
$558E
USP,A7
(A7)+,DO
(AO)+,DO
$55A4

*****************************************************
00556C
005570
005576
005578
00557A
00557C
005580
005586
00558A
00558C
00558E
005590
005592

Wvbl, wait for next V-sync


Save status
IPL 0, allow interrupts
Load frclock
Frclock
Still equal ?
Restore status

Critical error handler


Etv critic

TRAP #14

Address of the TRAP #14 routines

TRAP #13
Address of the TRAP #13 routines
Savptr, pointer to save area
Status register to DO
Save in save area
Save PC
And save C register
Update savptr
Call from supervisor mode ?
Yes
Else use USP
Get function number from stack
Compare with maximal number
Too large, stop

M
O

e
X
en
o

(/>

65

5?

^n

Ac
imber of routines
, getmpb
, bconstat
, bconin
, bconout
, (indirect) rwabs
, setexec
, tickcal
7,, (indirect) getbpb
, bcostat
, (indirect) mediach
3 , drvmap

w
CJ

CM

M
<B
'1
O

r*

rH

4-1

01
4-1
QJ
U

EH

01
X
0

<u

01

0
G
O
01

c
o

M*

ra

sdate savptr

E-< pq w

v>

rH
=*=

sstore registers

) AO
.t 31 cleared ?
ise use address indirectly

Atari ST Internals

rH
rH
10
O

cecute routine

>nvert number ot long counter


it address of the routine

Abacus Software

M-i

On

tn ED

-P
rH

o
o

01
0!

4-1

01
01

0)

o
m

4-1
-H
01

tH

T<

z.

rH

CM

CO

LO

vo

CO

rH

rH

VO
rH

rH

LO

LO

rH

rH

*******************

1
CO

o
Q

Q r- r
1
ro

"?

o
o
CM
=tt=

s
i!
01
rH

o o

O
- LO
O LO

rn

<L>

CD

CM

CM
rH

rH

rH

LO

o O -torH

rt

rH
rH

(U

o &. o
g S ,Q g

0)
rH
01

01

r*

CD CD
o O
g g

Q)

CD
4-1
rH

X
X

o
o
o
o
o
0
0
CO

cn

CM

vo

r- vo vo vo
CM
rH

LO

LO

LO

LO

rH

rH

rH

rH

H-

vo

rH

CM
LO

r- rLO

LO

rH

rH

$472+$80000000

rH

o
0
0

o
o
o
o
CO

o
vo

LO

rH

rH

CJ

r-

o o O o
* o a a a a a o a a a a a
O

fQ vo
cn cn <J
vo vo vo
LO to LO
o o 0
o
o o 0
o o o o o
o o o o o
fQ U o ^1 CO
pq PQ O U CJ

vo

f,

[
"31
0

LO

*
-X

*
X
X
X
X
X
CM

LO

o
o
o
o
o O CM o
ro ^r o LO
o O <! o

CM

CM

^r

VO

< 0 W

LO
LO
O
0

LO
LO

LO
LO

CO
^J1

VO

CM

cn en cn cn

o
o

LO
LO

LO

LO
o o O
0 0 0

-X
*

CM

rt^
gi
o

ft
3*
O
O

CO
o
o
fr.
o CO
0
o (V,
0
Q o cn cn cn cn Ot CO
(_) ren
r^
rH
rH
O
Q
PQ (4 CM U f , Cn n w
cn 31 CM
CM CO CM ^r
o CM =r > W O CM CO
<C f f
m pq ca

LO
LO
O

LO
LO
O

LO

^
L
O
LO

LO
O 0

LO
LO
O

o o o o o

LO
LO
O
O

LO

LO
LO

LO
0 0

o o

X
X
X
X
X
-X
-X
X
X
X
-X
-X
-X
-X
-X
X
X
X

*3*

CM
[^
LO
0
0 0

10 LO
LO LO LO
0 0 O O 0
o o 0 0 0
LO

to

LO
LO

LO

281

o L-q vo CJ
rij t rH rH
vo ^i 1 rLO O LO 0 to LO
o
O o o o o O
o o O o o o 0 o
o o o o o o 0 o
CO o o CO o CO 0 o
CJ o 3 CO CJ o ^ CO
[
LO
O

CM
r-~
r~

CM
r^
^1

H H

LO
LO

LO
LO
O
0

LO
LO
O
0

LO

LO

LO

o
o

LO
O

to

o
o o

LO

lO

LO LO LO
O O O
o 0 o

00
NJ

0028
00007ACO
00005328
0000577A
0000578E
00005794
000057AO
000057EE
000057F6
000062D2
000063BO
00006468
00005B64
00006B74
00007138
00007440
00007468
00007BC6
00006062
0000614A
00006602
00005A4E
00009024
00006AAA
00006A90
00007BF2
00006CE6
00007162
0000719C
00007A30
00007A9A
dc.w
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
$7ACO
$5328
$577A
$578E
$5794
$57AO
$57EE
$57F6
$6202
$63BO
$6468
$5B64
$6B74
$7138
$7440
$7468
$7BC6
$6062
$614A
$6602
$5A4E
$9024
$6AAA
$6A90
$7BF2
$6CE6
$7162
$719C
$7A30
$7A9A

40

*****************************************************

0055EC
0055EE
0055F2
0055F6
0055FA
0055FE
005602
005606
00560A
00560E
005612
005616
00561A
00561E
005622
005626
00562A
00562E
005632
005636
00563A
00563E
005642
005646
00564A
00564E
005652
005656
00565A
00565E
005662

Addresses of the TRAP #14 calls


Number of routines
0, initmouse
1, rts
2, physbase
3, logbase
4, getrez
5, setscreen
6, setpalette
7, setcolor
8, floprd
9, flopwr
10, flopfmt
11, getdsb
12, midiws
13, mfpint
14, iorec
15, rsconf
16, keytrans
17, rand
18, protobt
19, flopver
20, dumpit
21, cursconf
22, settime
23, gettime
24, bioskeys
25, ikbdws
26, jdisint
27, jenabint
28, giaccess
29, offgibit

ff

65

sr

00
W

005666
00566A
00566E
005672
005676
00567A
00567E
005682
005686
00568A

00007A74
00007B8A
00007COC
00007C20
00007C54
00007C32
00007D92
00005544
0000568E
0000581C

dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l
dc.l

$7A74
$7B8A
$7COC
$7C20
$7C54
$7C32
$7092
$5544
$568E
$581C

move . 1 4(A7),AO
jmp
(AO)

***************************************************
00568E 206F0004
005692 4EDO

lea
bra

$56B6(PC),AO
$56AA

***************************************************
005694 41FA0020
005698 6010

lea
bra

$56CE(PC),AO
$56AA

***************************************************
00569A 41FA0032
00569E 600A

lea
bra

$56E6(PC),AO
$56AA

***************************************************
0056AO 41FA0044
0056A4 6004

lea

$56FE(PC),AO

****************************************************
0056A6 41FA0056

30,
31,
32,
33,
34,
35,
36,
37,
38,
39,

ongibit
xbtimer
dosound
setprt
ikbdvecs
kbrate
prtblk
wvbl
supexec
puntaes

supexec, routine in supervisor mode


Get address from stack
Execute routine in supervisor mode

bconstat, get input statis


Status table

bconin, input
Input table

bcostat, get output status


Status table

bconout, output

I>

302F0004
E548
20700000
4EDO

move.w 4(A7),DO
Isl.w
#2,DO
move.l 0(AO,DO.w),AO
jmp
(AO)

****************************************************
0056AA
0056AE
0056BO
0056B4

Conout
Get device number
Times 4
Get address of the routine
Execute routine
Input statis

dc.l
dc.l
dc.l
dc.l
dc.l
dc.l

$6C3C
$6C86
$6010
$6BA4
$5328
$5328

$5328
$6C70
$6CFA
$6B88
$5328
$5328

RTS
RTS

RTS
RTS

*****************************************************

00005328
00006C70
00006CFA
00006B88
00005328
00005328

dc.l
dc.l
dc.l
dc.l
dc.l
dc.l

Rts

0056B6
0056BA
0056BE
0056C2
0056C6
0056CA

00006C3C
00006C86
00006D10
00006BA4
00005328
00005328

dc.l
dc.l
dc.l
dc.l
dc.l
dc.l

$6C5C
$6C96
$6046
$6CBA
$6848
$5328

rts

Output status
Centronics status
RS 232 status
Console status
Keyboard status
MIDI status

Input
Parallel port
RS 232 input
Console input
MIDI input

RS 232 status
Console status
MIDI status

0056CE
0056D2
0056D6
0056DA
0056DE
0056E2

00006C5C
00006C96
00006D46
00006CBA
00006B48
00005328

*****************************************************
0056E6
0056EA
0056EE
0056F2
0056F6
0056FA

er
g

CO

ST

CO

II

aro

63

sr

00006BD4
00006CAE
00008ADE
00006B5A
00006CCC
00008AD2

dc.l
dc.l
dc.l
dc.l
dc.l

dc.l
$8ADE
$6B5A
$6CCC
$8AD2

$6BD4
$6CAE

******************************************************
0056FE
005702
005706
00570A
00570E
005712

move.l
rts

$4C2(A5),DO

******************************************************
005716 202D04C2
00571A 4E75

322F0004
6B04
1B410A5D
4E75

******************************************************
00571C 7000
moveq.l #0,DO
00571E 102DOA5D
move.b $A5D(A5),DO
move . w 4(A7),D1
bmi
$572C
move . b D1,$A5D(A5)
rts

005722
005726
005728
00572C

206F0004
43ED048E
2089
42A80004
21490008
4291
236D04320004
202D0436
90AD0432
23400008
42A9000C

move . 1
lea
move . 1
clr.l
move . 1
clr.l
move . 1
move . 1
sub.l
move . 1
clr.l

4(A7),AO
$48E(A5),A1
Al, (AO)
4(AO)
A1,8(AO)
(Al)
$432(A5),4(A1)
$436{A5),DO
$432(A5),DO
DO,8(A1)
12 (Al)

*******************************************************
00572E
005732
005736
005738
00573C
005740
005742
005748
00574C
005750
005754

Output
Centronics output
RS 232 output
Console output
MIDI output
Keyboard output
ASCII outout

Drvmap, get active floppies


Drvbits, get bit vector

Shift, keyboard status

Kshift, get shift status


Get parameters from stack
Negative, then set
Accept as kbshift

Getmpb, Memory Parameter Block


New MPB
Themd, Memory descriptor
Mp mfl = address of the MD
Mp mal = zero
Mp rover = address of the MD
Clear m link
Membot as mstart
Memtop
Minus membot
Length as m length
M own = zero

CA

sa

*
*
*
*
*
*
*
-X

rH

0
Q

p-

o o
Q
CM

rH

<D

a &

0
10

o
prm

rH

rH

05

^Q
P

ra
0)

rH

O)

rH

0)

o
g
^

0)

rH

rH

0)

0)
-r)

r*

rH

13

4-1
0)
W

rH
Q

51

id
Cn

O
^

g g 43

0}

O
^

4-1

m
t
W
31
CO

m
t
m
o
0

-X
-X

*
*
*
*
-X

m
CM
0

&
rH
_l
rH

<t>
01

0 4J

*
*
*
X

*
X

X
*

*
*
*
X

0
Q

*
X

*
*
-X
*
*
-X

4-1

31
O
O

o
fa
CM
O

00
^F

10

o
0
o
o
o
o
CO
o o fa
o fa rH CM

CM
O

rH
in
0 CM CQ
W en *r CM CM VQ
ri) W 0 CM IO CO U
-X
m in VQ 10 VQ IO vo
-X
r- r- f t p- r- rm m in IT) m m in
-*
X
o o o O 0 o 0
X
o 0 o 0 o 0 o

CO

rH
CO

0
CM

in
Pw

a o
vo r~
p- p-

m m
0

o o

*
*
*
*
-X
*
*
*
X
O
*
CO
X
CM
^31
*
X
* CM
X
r*
t* m
-*
X
0
X
o

*
*
*
*
*
*
*
*
X

(0

o
Q
0

*
er
0)

5J1

in
Pw
CO

p- p[ p~

m in
o o
0 o

286

X
X
^c

*
*
X

CO

1j

o ta

g g

CO

rH

^
0

i-H tn
tti 4-1
r-H t-t

X
X

*
X
*
X

o<0
a>

4-1
0)
U

o
Q

in
W

rH

(1)
o

01
4-1

-X
*

*
*
-X
rH
O
CM
CO
fa
fa
fa
fa

CO

o
CM
CO
fa
fa
fa
fa
Cf>
CO

*
*
X
-X
X
X

a\o CO
o
o o rH o
p- rH [y] rH

CO
CO
rH
W

fQ
p-

CO
^

O CM
CO

^T
CO

in
rW

CJ
CO

p* p~
* ( t
p- r
* in m 10 (m
in m
* o o o o 0 o
* 0 o o 0 o 0
*

-X
*
X
-X
X

*
X
-*
X
X
X

X
X
*

o
Q

o
=tt=
rH

O1
01

*
*
X
*
*
*
*
*
*
*
-X

-X

-X
*

*
*
X
*

O
Q

rH

*
*
*
X
CM
"31
^3*
O
Q
CM
O
CO

8
-H

Getrez, get video resolution

-H

U EH

4-1

a s

(U
Sn

o
o

**********************

(0

g
-rl

Logbase, logical video address

rl

0)

-r)

***********************

01

0)

0)

o
o
a)

Dbasel

4->
0)

M
0

$FFFF8203,DO

0)

O
4-1
O
(!)

q
-H

e.b

(U

Dbaseh

cr

(U

O
4-1

$FFFF8201,DO

(0

O
Q

Physbase, physical video address

rH

**********************

(0

Tickcal, timer value in

p
c

o
-o

4J
0)
CO

**********************

M
0)

Get address of the old vector

milliseconds

Atari ST Internals

e.b

W
4-1

01
VI
0)

0 ( A O , D O . w ) ,AO

*********************

Setexc,

set exception vector

Abacus Software

*
*
-X
*

E=3
3*
31

o
Q
CN
O
CM

W
CO

in
P*3
*3<
CM

cn
r^

m in
o 0
o o

X
X
X
X
^c

o
o
o

* ji
*
en
X
-X

*
X
o
0
*

oo
-J

$FFFF8260(A5),DO
#$3,DO

Load shiftmd
Isolate bits 0 and 1

move.b
and.b
rts

4(A7)
$57AC
4(A7),$44E(A5)
8(A7)
$57C2
9(A7),$FFFF8201
10(A7),$FFFF8203
12(A7)
$57EC
13(A7),$44C(A5)
$5544
$44C(A5),$FFFF8260
$452(A5)
$F6C4
#1,$452

005796 102D8260
00579A C03C0003
00579E 4E75

tst.l
bmi
move.l
tst.l
bmi
move.b
move.b
tst.w
bmi
move.b
bsr
move.b
clr.w
jsr
move.w
rts

*****************************************************

4AAF0004
6B06
2B6F0004044E
4AAF0008
6B10
13EF0009FFFF8201
13EFOOOAFFFF8203
4A6FOOOC
6B24
1B6FOOOD044C
6100FD74
13ED044CFFFF8260
426D0452
4EB90000F6C4
33FC000100000452
4E75

4 (A7) , $45A (A5)

Setcolor, set single color


Color number
Times 2
Limit to valid number
Address colorO
Get old color

Setpalette, load new color palette


Set colorptr (execution in VBL)

Setscreen, set screen address


Logical address
Negatice, don't set
Set v bs ad
Physical address
Negative, don't set
Dbaseh
Dbasel
Video resolution
Negative, don't set
Sshiftmd
Wvbl, wait for VBL
Sshiftmd to shiftmd
Vblsem, VBL disabled
Initialize screen output
Vblsem, permit VBL again

0057AO
0057A4
0057A6
0057AC
0057BO
0057B2
0057BA
0057C2
0057C6
0057C8
0057CE
0057D2
0057DA
0057DE
0057E4
0057EC

move.l
rts

*****************************************************
0057EE 2B6F0004045A
0057F4 4E75

******************************************************
0057F6 322F0004
move.w 4(A7),D1
0057FA D241
add.w D1,D1
0057FC C27C001F
and.w
#$1F,D1
005800 41F9FFFF8240
lea
$FFFF8240,AO
00580630301000
move.w 0(AO,Dl.w),DO

69
r
en
Cfl
O

I
rt

j>

to
QQ

00580A
00580E
005812
005814
00581A

C07C0777
4A6F0006
6B06
31AF00061000
4E75

rts

and.w
#$777,DO
tst.w 6(A7)
bird
$581A
move.w 6(A7),0(AO,Dl.w)

move.l $5014(PC),AO
cmp.l
#$87654321, (AO)
bne
$5836
cmp.l
$42E,AO
bge
$5836
clr.l (AO)
bra
$501E
rts

******************************************************
00581C 207AF7F6
005820 OC9087654321
005826 660E
005828 B1F90000042E
00582E 6C06
005830 4290
005832 6000F7EA
005836 4E75

6102
4E71
23DF000003C4
48F9FFFF00000384
4E68
23C8000003C8
303COOOF
41F9000003CC
224F
30D9
51C8FFFC
23FC1234567800000380
7200
1239000003C4
5341

$583C
move . 1 (A7)+,$3C4
movem . 1DO-D7/AO-A7 ,$384
move . 1 USP,AO
move . 1 AO,$3C8
move . w #$F,DO
$3CC,AO
lea
move . 1 A7,A1
move . w (Al)+, (A0)+
dbra
DO,$585E
move . 1 #$12345678, $380
moveq . 1#0,D1
move . b $3C4,D1
subq.w #1,D1

nop

bsr

******************************************************

005838
00583A
00583C
005842
00584A
00584C
005852
005856
00585C
00585E
005860
005864
00586E
005870
005876

Clear irrelevant bits


Test new color value
Negative, dont set
Set new color

Puntaes, clear AES and restart


os magic
Already there ?
No, done
In ROM ?
Yes, do nothing
Clear magic
To reset

Term, interrupt running program


PC on stack

Save PC including vector number


Save registers
USP
Save
16 words
Save area
Save word from stack

Get SP to Al
Next word

Magic for saved registers


Get vector number to Dl
Convert in dbra counter

Cft
O

en
H

B
to

CO

O
CO

o
Q
S
Ed
CJ3

3
4-1
0!

rH

=*= CO

IS

r
fa
rH 0

o
vo
CJ

W 0

CO CO CO CO
CO 03 CO CO CO

in m m in m in

o 0
o o o o o o
0 0 0 0

X
CU

o
o

CU
EH

o o
O3

CO

in m
m

IS

CO
!H

CJ

ifa

"

'

rH

'

0!
XI
4-1
O

(0

0!
G
-H

4-1
10 H
4-1 01
CO 4-1
0)

CO
cd
r-l

O
4-1
CO
01

01

CO
O

in

CM

vo
O

rH
0)

m g

CO

O
CM
CO

O
CM
CO

fafa
fafa

l<

CO

fa

C M C O O

CM

fao
fafa
o o o
o
fao
fafa
E o o
r^
cncjr-oc\cocncoop3f<cjrHcopq
( J L | M W C M O r H O r H O O C O C J ^ P ' = r i s C
r H C J Q ^ r H H r H W C M Q ' 3 ' C O C O C M C O
O V O f ^ C J W * 3

cf
o
a o

-o

faCO
faO

JC

01
rH

CU
XI
4-1

O C t J r H O C Q O c o O T i C U O O O O O
g C O C d O g r H g r H g C B c H g g g g g

VO
CM
CO

*
*
*
*

3:

CO

XI CU
CO
3

01

4-1
-H

10

CM CM
Q Q =S=

CU
0
0

O,

O I O I O I G I C U

10

01

rH

CU
-H

dbra
rts

Next destination address

rH
rH
CO

CU
4J

558E8 ( P C , D 7 . w ) ,A2

G
01

CD
G
-H

CU

V O O W O * 3

C O C J P

3 O ^

fa
fa
fa

Cfi
Q
CJ CJ
rH

m
vo

vo

rH
O
fa

in m Q
O

o
CM

6 51CEFFE4
A 4E75

r- r-

4J
Q)

Atari ST Internals

***************************^********************
Write 'mushrooms' on screen
,b $FFFF8260,D7
Shiftmd, get resolution
t
#3,D7
Isolate significant bits
t
D7,D7
Times 2 for word access
L
DO
,b $FFFF8201,DO
Dbaseh
*
#8, DO
,b $FFFF8203,DO
Dbasel
L
#8, DO
Screen address
.1 DO,AO
TO AO

$58DC(PC,D7.w) ,AO
Plus offset for middle of screen
$58EE(PC),A1
Address of bit pattern for "mushroom1
,w #$F,D6
16 raster lines
,w D1,D2
,1 AO,A2
.
Save pointer to start of line
,w $58E2 (PC,D7.w) ,D5
Number of words (screen planes)
,w ( A 1 ) , ( A O ) + Write a raster line

8
A
4
8

6116
bsr
23FC000005FC000004A2 move..1
3F3C0001
move.,w
42A7
clr.]L

$5890
Output appropriate # of
'mushrooms'
#$5FC,$4A2
Reset savptr for BIOS
#1,-(A7)
Return code for error
-(A7)
Terminate process

Abacus Software

c n c n c n c n c 7 i r 3 ! < f 3 ^ r 3 p Q P 3 c Q c Q P 3 c j ( j CJ CJ u Q Q Q Q
C O C O C O C O C O C O C Q C O C O C O C O C O C O C O C O C O CO CO CO 03 CO CO CO
i n m i n i n i n i n i n i n t n i n i n i n i n m i n i n m m m in m m m
o o o o o o o o o o o o o o o o 0 0 o 0 o O 0
o o o o o o o o o o o o o o o o o 0 0 0 0 O 0

289

Abacus Software

*
X
*
*

vo o

rH rH CO
X X
O 0 o
0 o
i-H rH CM

X
X

*
X

o a

*
X n
*

- o

X
X
X

"O

a a

X
X
X
X

*
X
X
X
X

X
X

* O o o
* CO CO CO
X la w w
* ro co n
-X
X 0 K) o
X Q Q W
CO

*
*
*
-X
*

CO CO

m m in
0 o o
* o o o

X
X

X
X
X

*
*

m rH 0
o O 0
* o O 0
* o o o
*
* CM 3* vo
X W W p)
* CO CO CO
* un in in
* o 0 o
* o 0 0
X
-X

X
X

o 0
vo vo

0 0

o a a

*
X

X
-X

*
*

rH

*
*
X
X
X

*
*
*
*
*
*
*
X
*
*

rH

rH

0
0

o
o
o o
1-1

rH

rH

L11100

i-H
rH
0
0

0 o 0
rH rH
0 0
rH rH o
rH

rH 0 rH rH 0
0 0 rH rH 0 0
rH 0
rH

o
o
o

0
0
0
0

o
o

o 0
o o o

o
o
o o


O
TS

O
TS

O o O 0 o o
rH 1-1 1-1 rH o 0
O 0 0 O 1-1 rH
0 0 0
0 0

rH 0 0 rH
0 0 0 0 0
0 rH
i-l 0 0
0 0
dp dP
dp dP dP
dP dP dP

0
0
0
0

rH
tH 0 0 o
0 0 0 0 0 0

(1

0 0
0 o
dP dP

o
o
o
o

0 0
0 o
dP dP

o O U O O
a a a a o a a a
O

*
*
X
*
X

*
*
X

-X

o
o

*
*

*
*
*
X
*
*
X
*
*
X

rH
rH

-X
-X
0
i-H CO

*
*
X
*

*
*
*

rH

*
-X
*
X
*

0 o
0
0 o
0
0 o 0 rH
0 0
0
o 1-1 rH rH

jj

-X
X

4, O
* T3
X
*
*
*
*
*
*
-X
*
X
*
-X
*
*

*
*
*

***** Bit pattern 'mushrooms'

Number of screen planes


Low resolution
Mid resolution
High resolution
*****

Low resolution
Mid resolution
High resolution

Screen center
Low resolution
Mid resolution
High resolution

*
*

000001

X
X

<D

G
-H
,-q

OOOOOC

X
X

r-H

OOOOOC

-X

OOOTOC

***

Atari ST Internals

0 0 0
P3J *3.
0 0 0
o
0

* CO
* W
X CO
X m
X o
* o

o
<3J

M
co

*
*
*
*
X
X

*
*

CO

in m
o o
o 0

r-

o
PT,
PT,

T1

w
w

O
p~.
CO CO

(3J vo O
^i* *3*
pT| pt* PM
cq r- r- cq fc. vo
m e cq CO Q vo
CM qi vo CO p o
CO
P-,

PT,

CO 0 o 0 0
0 o
CO CO 31
a1 CM CM CM
en a\
CM CM 3* <cr
0 O o 0 0 0
]

O CM 3*

0
PH 0 O
o\Oen
CO
X m in
m in in m in in in
* o o 0 o 0 0 o 0 o o o in
o
X o o o o o 0 o o 0 o 0 o

290

co
in

PM

CO

PT,

pM fc* &M
CO CO CO CO

vo
0
en
in
o
o

CO f O
0 0 o

en

in in m
o o o
o o o

NJ

00590E 1290

dc.w

%0001001010010000

****************************************************
005910 206F0004
move . 1 4(A7),AO
005914 226F0008
move . 1 8(A7),A1
005918 303C003F
move . w #$3F,DO
00591C 12D8
move.b (A0)+, (Al) +
00591E 12D8
move . b (AO)H-, (Al) +
005920 12D8
move . b (A0)+, (Al) +
005922 12D8
move . b (A0)+, (Al) +
005924 12D8
move . b (A0)+, (Al) +
005926 12D8
move . b (A0)+, (Al) +
005928 12D8
move . b (A0)+, (Al)+
00592A 12D8
move . b (AO)H-, (Al) +
DO,$591C
00592C 51C8FFEE
dbra
005930 4E75
rts
******************************************************
005932 2F390000046A
move . 1 $46A,-(A7)
005938 4E75
rts

dc.b
dc.b
dc.l

'1AUT011
'*.PRG',0
$12345678, $9ABCDEFO

******************************************************

00593A 5C4155544F5C
005940 2A2E50524700
005946 123456789ABCDEFO

*******************************************************
$543 (PC),AO
00594E 41FAFFEA
lea
$5940(PC),Al
005952 43FAFFEC
lea
005956 23DF000005FC
move.1 (A7)+,$5FC
A5,A5
00595C 9BCD
sub.l
00595E 2B480600
move.1 AO,$600(A5)
005962 2B490604
move.1 A1,$604(A5)

Fastcopy, copy disk sector


Source address
Destination address
(63+l)*8 = 512 bytes

Copy 8 bytes

Next 8 bytes

Hard disk initialization


Hdv init on stack
Jump to routine

Auto, start and execute a program


Address of pathname
Address of filename '*.PRG'
Return address
Clear A5
Pathname
Filename

en

65

cn
H
ii

B
i>*

L3

sr

01

Ol

4J

o o
g e

ft

4-1

O)

?*

<D

cr CB > %
> cO T3
<H
01
O
0 0 o o m T)
rH
5
g g g g 4J CB

X!

rH

0!
0
g

CO O CO
Q
rH

>
> > g ca T> ra
o 0 o 0 o o M T3 4-1
g g g g g s 4J cci H
0)

CM

CJ
O

VQ

cn

in
o
o

CJ

CO
CM
CO

m CQ
o a1
o o
o o

o
o

a cn

CM
O
CN

o
o
o

cn
[V,

O VO
O CO

fS, 03
fc, 0

CO

00

CO

rH

["T,

[V|

cn
m

C^

o o

CJ CJ rH
CO CO "3*
p4 fv.
w
CO CO ^31

o VQ -sr CM CM CM
< o CM T CO (=C CJ w
cn cn cn cn cn cn cn en
m in in m in in in m
o o 0 0 0 o o 0
o 0 o o o 0 0 o

CM

VQ

O
f-H
O
O
CJ
[-1

o
o
O
ql

o
w
Q
CM

03

a1 CQ
o

0
0

CJ
CO

CJ

r-

CQ
0

rH

CM

CM
VO

cn cn cn cn cn en
m m in m m in
o 0 0 0 0 o
o o o o o o

0
fH
O

o 0
O
o o
o CQ o CJ rH 0
o 0 CO CO ^ r^
fc,
t, (x3 r^l
[JM
CM OJ CO co ^ Q
CO < U o ^t1 VO
en cn cn cn cn cy\n
tn m in in Ln in
0 o 0 o o o
o o o o o o

292

'
rH

*
*
*
^c
*
*
*
*
*
n
*
-*

CO

VQ
"=p
*sF
O
O
O

*
*
*
*

in
r*
f"i
"a1
ff

to
o
w
cs

=*=

4-1
CQ

r-

0)

=4t= Q

rH

01
Q.
> fO 1
O
H TS O
g 4-1 cd g

cu
o

IM

CO O
O, rH
CQ

in

1
0

o o
o rH
rH
=*=

rH

0)
rH

io
s

^r O o
o o o
o rH 0

r- CJ

rH

OJ

c=3 CJ CO

*
*
-X
*

o
g

o>
4-1

rH

*
*

o
o

.a

O
CJ

4J
U

4-1
CO

CM
0
0

*
X

in
o

CO
U

O
CQ
CB

Base page address

r-

r-

rH

o
ca

-H
O
!X

4(A7),A5

CO

a,

0)

.1

,1
.1
,1

1 CQ
in

CM

-(A7)
#$20, - ( A 7 ) super, enter supervisor mode

0)
4J M
C 0)
-H 4-1
O

L
,w

CM

CM

Start auto exec program

CO

PC for auto exec program

Q4

i-H.

******************

d
o>
w

CB
0)
M
CJ

CB

#$4B,-(A7)
Exec, load program
#1
GEMDOS call
#$10, A7 Correct stack pointer

VQ

C7>
q
-H
M
4J
CO

,w

"8

to
en o

#$59AC,8(AO)

rH
Q

,1

0)
T> 01
>
O -H
Q
m Q

GEMDOS call
Correct stack

-H
4-1
U
tfl

#1
#$10, A7

01

Atari ST Internals

$59AA
No, done
$52ED(PC),AO
Pointer to null name
AO,-(A7)
Environment
A O , - ( A 7 ) Command tail
AO,-(A7)
Shell name

C"

,1

$4C2(A5),DO

Drvbits, vector with active drive

Abacus Software

fT|

0 0 0
Q CJ
CO

< CO^31 sr ^i vo
pn

(V,

fe.

sr co a1 m CM ^
OJ a1 CM
CJ W CM w VO 03 CJ o
CQ
CQ CQ CQ o
cn cn OS cn cn cn tyi cn

m m in m m
O 0
0 0

LO m m
o o o o o o
o o 0 o o o

Atari ST Internals

Abacus Software

01

<a
<u

0)
4J

r(
ffi
4J

rst
stack correction

0)
rH
-H
M-t

01
01

a,

T!
G

td

4J

B
0>

4-J
01

<d
en

4J

a a>

o
o to

4-!

rH

45
JJ
0)
to

O
S
W o
CD o

-H

C-

0)

CJ1

M
0

i-H

01

rH

~^ -H

X K

<U
W

gj
>i ^

CQ

4-1 S

(1) t=3
Q W CD

01

t} o

O
0)
M

0>

H
M

P,

U f-

tH

(d w id

ffi

0)

0)
B
-H
O
P,

-H

id A "" o <d to
c; U 01 id ^-> O

fc. 0)

01 O

-H M
^ O

0)
CO
0
Q

(0

B
3
0

(U

0)

<D

B
^3

0)

rH

O -H

ID O fa

fi

a> a>
S S <u
10 ta S

(U
S
B

O
.p
<d -H 3
PM fa <

fi

<8

M H a>

<d

O
O

HtH

(~-

rt I I

I r- ft,
* C "^
10

CM tH

O O

PM&,

CO <

- o <H
tH

tH VO

VO tH

r-

* * == Q

tH

<
o
en
to
o
o

tH

t o
o SP

CO
Q
CM

ft,

j^\6 I

ll".

CO
CJ

vo
m
m \n

CO

CM

vo

293

vo

CM
CM

CM

<

<

in 10
o o

0 0

vo
CM

005A2C <

CO

vo
vo
\n

t.
(
S>07900000600
J?47900000604
i.13F900000634
]
I
f
t.11F900000626
]
f
( 187AF8CD
187AF8C9
187900000634

0059F8
0059FA
0059FC
005A02
005A08
005AOE
005A10
005A12
005A14
005A1A
005A1C
005A1E

tj

0059EO
0059E4
0059E6
005 9EC
0059FO
0059F2
0059F4

tH

I
(
f
:3F3C0007
JF3900000600
:3F3C004E
I
<187900000608
:3F3C001A
i
{
(

CNJ

0059DO
0059D2
0059D4
0059D6

a ro

7 306SOO

0059C6 ;
0059C8 t
0059CA :3F3C004A

* *

Abacus Software

Atari ST Internals

3
rH

10

- o
O Q
CD s

X
W

W
C3

01
^

w
0)

O
CJ

>i
ffl

CO
CO
(U

1 a

4J
X
CU
C

0
!H

!H
CU
4-1
G
0) -H
rH
O
-H Q.
4-1

o
c

SH

-H

o o

m x (0
cu cu 4->
to s co

t
P

O
.J

dumpflg

X
0
(0

screen hardcopy

0
4-1

rH

p, hardcopy
A5
ad, screen output

G
O

t,

load program
S call
ct stack pointer
for stack pointer

>
4-1
H
10
4-1
CO

o o M
o (0
4-1 &H
O
CO
CO 35

-H
4 P
rH

(U

CO

CO

CU
M

0)
M

a
O
4-1

T3

CM 1H

CO

CU

p^
Q

rH
</>
=tt=

CM
=8=

pa

c1
rH
4t=
*

, |

|5 tr
. CU
T3

fa
</>

==

<

vo <q
W
Cn

CM
U
CO

</>

J5
.

cu a
cu
ra
o ^ a o o
e 4-) 10 g g

1
s

*
*
*
-X
*

CJ

fa

LO

rH

CO
^
Q

(0

cu

CU
> CO
O 4-1
g

r*

*
*
*
*
*
X
*
*
*
-X

*
*
-X
X
X

pa
sr

fa

rH

o
o
CM

CJ vo

co ^P fa O
fa W W w fa
CO

a1 Q r-

fV)

CM

^J1 00 f

<

CO
f

CM
f

n CO
f

CO
CO
(3^

CJ

m
o
o o
o o
0 o

c1

rH
O
O

o
o

rf^
CM
p-1
CO

rt^
0

0
CTi
fa
fa

vo ^r

w
CO

en in
ro r

fa M

CM

^T

0 VO
^J1
(5J

LO
LO
LO
LO
LO
LO
LO
^ m
^
O o o o o o o o
o o o o o o o o o

LO

**********

*********

r~

H
=p

o in<*

-X
-X

rH
1
=tt=

*
*
X

*
*
X
*

H vo
M (^
</>

LO

|5
.
^
rH

CU
M
CO
Q

tn
4-1

(V)

o
o
* pa
* M
o
* ^J1
0
* O
0
* O
fa
* o
fa
* 0
fa
* 0
fa
* CT1 f^C CJ m
* r- 0 fa [
* CM rH n [V]
^31 VO CO -=T
X
*
* W 51 vo fJ
LO
in in
*
*
<
<
* L^
O LO LO in
*
X
o O o o
o o o o
*

*
X
*
X
*
X
-x

SH

>H

-H

CO

CO

r4

t?

<
in
vo
o />

SP
LO
VO

0
Q

co-

<

LO

in in
<

LO
<

LO
ft,

CM
VO

Q Q

-H

M
M

Q<

10
CU4-1
H C U
J C 3

<

vo
vo
vo

K
o
LO

LO

^I1
CM
CO

rH

Q
*fc
LO

in

<

*-*
vo o ^p
in
~
~ ~
CJ <J} Q Q o 0 H o fa w U
M CO
, ^r m
^r K
< < < LO vo fa vo CO
vo vo vt vo <
m 31 vo o "31 0 o m
<rt </> Q <fl- Q Q <n- 0 vo </> </> =tt= </> v>
<V

rH
.

Q
P
U

*
*
*
*
*
*
*
X
*

rH

CU

o
g

|5

rH

rH

L^

fk

CO

0)

J>

o o
o g g

|5

T5 cd
-o (U
CO

rH

CU

0)

o o

}H
rH

rH

s
SH

vo
o
W CO
^* m
31 vo
o 0

Q Q Q
VO vo

pq pq
en CM

CM

o
vo

CO

CM
VO
(^

sP

vo

^ m i^
n
* m

Q1
^p
0
0 Q
*3* CM
CM 0
*3* rH

CJ
VO
^
L
O

o o o O
o o o o

294

W
VO
"5*
LO
O
O

in
o
o
P
fa

in
vo
o
o
o
o
o
o
r

rH
^P

CO

[^

CO
[^

r-

(^

j^

CM

vo
vo
o
o

"5T

5P

pa

CO

CM

vo

in
vo
o
vo
o
0
o
o
r-

P3 PQ

in in m LO
o o o o
o o o o

cu cu
H
o rH o
g o g

0
sp
CM
CO

w o fa
LO

vo
o
Q
vo
CM

Lt)

vo fa vo CO
vo o vo PJJ
o o o o
Q U Q Q
vo
vo CM
PQ

CM
^p

CM
^p

CM

CM

co

0 CO

CO

CO

en en en

LO

LO

LO

CJ CM CO
CO

rH

vo
vo
vo
o

<; CJ

^31

*
*
*

CO

in

CJ

in
vo

? ?
O
CM o o

P
M &
CU -H

CO
CD

-H
CU 0) rH
4-1
H
& > g 43 4-1 4-1 M-l T3 73
c o c f l - r H t O C U C U C L C T j r
C O l O E H H O C 3 t - 3 < < C

LO
<

(0

M n 4-i 1-1

*
*
*
*
*
*
X
*

( U O G C
N r H - H O
O O O
0
CJ OH
4-1
H
0 X CU
4_> 4J CO 4-1
45
10 C

m
<

r-

rH

c ,G 45

<4H

G
O
-H
4-1

CU

<U 4-> tT>


CUT>-rl
M -H CU
O S .C
CO
G C
M CU CU
O CU CU

4-1

4-1

CU
4J
4-1

CO
O.
4J

CU
<U
M
CJ
CO

rH
rH

<U
g M
CO
an <0 CO m
cu A
H-l
0 rH
to CJ > 0

rH

G
O
-H
- 1
3
rH

LO
O o
0 0

LO

o o o
o o o o
0

Abacus Software

nted

Atari ST Internals

o
o

ft
ft (U
O ft g 0
o >, o o

M
3

en

-H
MH

&*
0)

(0
-H

o
o
n

10 -H

73

4->

(0
A

M
<0
CD 4-> 45
4-> C

O -H

73

0!
E
fS
ft
QJ
45

<U
4J
S
>i O
ft
ft
O
O X
M

(0

(U

ft

a)

>-<

43

<0
4J

01

01
4J

73

-H

43
4J

> -H

'O

C
<D
-

d)

01

OJ

ft

CT>

10
O
01
H

CU
CD
43

not

H
10
f,

01
CU
EH

73

1o
CD
73
O

ft
o 1
o

43

C
O
-H

G
(U
CD

>1 4-J
01 <8
4J -H g
(0 <0

>!

4-> S

(U

-H

73 M

3=

n m

>i

flj

01 <o <o

g 73

(0 73

o
rH

o
o o
o

ff) O
G
0
01

EH

EH

ffl
.G

0) ~ 3
45 X
3 -H >.
M 01
Si 4J -H

4J

4J

,-
rH
0)

EH rf,

O
O

G C
O O
01 01

01
ft
ft
ft
ft W Eii] pc]

,
10
vo

if)

.-!!

CJ

O O O V O r H O V O

in

rH
Q

,_,

rH

=tt=

=t

Q </> Q =t =*f= Q

rH
Q

^
01
rH

o o
o

--

CM < m

4^: -t/>

-W-

CMP-

</> =fr

|5

CD

S3=

C
(0

O
g

O O W G O C O O O W T 3 4 - )

&

'

^5

3:

*
*
*
*
X
*
*
*
^c

0
qi
VD

0
0
CM

CM

CM

X
X

3 3
73

rH
O
0

o
cn Cj
qi rvss CM
W O

CM

<
m

<

*
X
*

\>
O

X
X

^P

VD
VO
0
rH
qi

CO
O V O O C M O I O O
<
O V O O O O V D C M
O
O O O r H O O f M
Q t t C Q O O O C Q O Q O P M L O

ffl

VO

<-)Or-oo*3'"=p

X
*

f r*^

X
X
X

C M O C O O C Q C M O r O C O ( H C O W
iVOL

*
X

CM o

^t r^~ ^ r** co O ^o o

n r o H Q c o O t i c O ' = i
pg

|V}

oj VQ

PI-| <NJ qp

O'=r

CJ Q CM

<^<^^<
inininmininininLninmin

m m
^ o o o o o o o o o o o o
o o o
o 0 o o o o o o o o o o o o o

X
*

X
*
X

-X
*
X
-X
X

*
*
*
*
-X
*
X

*
*

U U

X
*

f^j
V3

X
*
*
X

,_,
O

CM rH

CO

rH rH rH
1
1
1

*
*

-X
-X

*
*

****

0
Q

_Q ^3 Q 43 43 43 43 43

o o o o o o o o

73

73 73 73 73 73 73 73

*
X
X

0 o
CO en
CM rH

o o
o CO
CO CJ
CM o
0 o
0 CO
^1 CJ

f] 0
0 0
sp

CO
Q

* in m
* 0 o
X o 0
*

295

*
*
*
*
*
*
*
*
X
X
*
X
X

fo r*i F"I FTI


fe o r^i FTI r*i

*
X

O
CM rH
0 0 0

&4

X
*

CO

*
*

< < <

rH CM

W W W

w
<

01 in vo r~

m 10 m m in m in in
X
o o o o o o o o
*
*

0 0 0 0 O 0

O 0

Abacus Software

Atari ST Internals

01

M
0)
4J

CM
-X
O

-H
O
01
.G
4->

4J

01

<0
X

O
H

>

t3

<B

in

JS

-X

*
*
X
*
X

vo

in

-X

c
o

CM

CM

vo

tH

vo

H
(0
-P
CO

0 0 o O
Q Q Q Q

CO

in
PQ
in

X
*
-X
X

*
X

H
" ^
01
c > fl
-H O ^

X
X
X

X
*
X
-X

*
-*
X
-X
-X
-X
-X
-X
-X
-X

03

g g s

is >
$_i o
Jp g

&

M
Q

U CD
01

O
O

0!

M oi a>
o > n

Co

CM

f3?

3
QJ ' '
O

a
o
m

r*J
M

t>
^H

I
i
"*

O (Q M
O to Q

CM

"*

"

^ rH
^

rH

rH

rH

CO
CM
VO

Co
W

, 1
' '

^
o

rH

1^

rH
O

^
01
T~l

T3

0 CM 0

vo
H-

m
pq
m

rH
=tt=

fa
fa
fa
vo
m
W
CO

O
0
0
CJ
CO
CM

C O G
H
M

Co vo
CM
CJ

00

CM
1

CM

rH

CM
=tt=

o
pq
m vo

s g

rH

o o

TJ t5

*-ri

Q/

01

o
o
ffl

3
'1

SH
O

"*

o a
o g
o

^j
rH

45

rH

G
3

CM
CJ

>i "H

o *j 4n

3
* *
CO
>

CM
0
O
0

CJ

g co <$

CO

fa

CM
rH
O
O

4J CM N
G
-H
CO 4-> rH

O G
G

M -H O
M M C
M Q M T3

o r-

(1)

a .p jj

rvo o

rH
M-l

3
G

aG

in

*
*
*
-X

>
o

CO

G
-H

<B
M

vo

*
X

*
*
*
-X

,1

*
X

0!

SH 42

01 O

3
G

01
01
01

vo cn

CM

0
O
CO

.p

MH
O
-H

-H

#$3E2A,AO

4->

x o
0 O M
<a
oi

H
<B

i$4910,AO

CO

CO

<u0} a
O

a is<u

4J
G

M
0)

vo
rfj
<3i
0
0
0
0
0
0 0
^p
CM CO
31 CO

O VO

CM

rS^

cn
vo
^p
0 py]
0 fa

o
o

[V,

0 fa
0 0 W

o o

*3*

CO

CO

pJ
fa

^P
O

CO

CM
W
CO

co

tyi

W
fa
fa

[V,

0 [V,
0 fa
CJ H cn 0

i~

tr- trio io

fa
W

rf

CJ p]
CO O
CM 0
VO 0
0 0
O o
0 0
0 0
r~ en CJ

rH

vo CM co Q
CO <J a <<*

31

"O1

=P

SP

VO

CO

n3J
rH
PQ

CJ ty] CM ^P

o o

VO
CM

in

CM CM CM CM

CM

co

CM

^
C
M

PQ
W

vo

fa

a
o

rS^

cn
fa
fa
fa

[V]
[V]
0 0 *~H ,| (1 T1
fa fa
p f
(<J PQ PQ PQ PQ PQ ffl
PQ
PQ m PQ PQ (Q PQ PQ
in in m in in m in m m m m m in in m in in in m m
o o o 0 0 0 o o o o 0 0 0 o o o o o o o
o o o o o o 0 o o o o o o 0 0 0 0 0 o o

0
0

o
o

o
o cn
o fa cn rH f^
rH o VO CM
CO Q Q CO vo m
3* CO
o CM ^31 f
(^
CO CO CO a* IP QI
PQ PQ pq PQ pq pq m
in m m m m in in
o o o o o o o
0 0 0 0 0 0 o

o pq
o vo
fa o
CO

sP

31
O
O

fVj

CM
rH rH CM CM CM CM CO

296

V0

0
rH

o
o
o
o
co
0
o
o
o
o
o
o
en
03
o
o

CO

CJ

fa

^yt

w
fa
fa
fa

&3
fa
fa
fa

CM
O

CM

CJ

o
o
p}
W
vo vo f^
f^ m
m 0
^i CO
m m
PQ PQ
m m
o o
o o

VO

sr

W o
m vo
PQ PQ

m in

o o
o o

VO
>J

005B62 4E75

rts

*************************************************
link
005B64 4E56FFFC
A6,#-4
005B68 4280
clr.l
DO
unlk
A6
005B6A 4E5E
005B6C 4E75
rts
**************************************************
link
005B6E 4E56FFF4
A6,#-12
movem . 1D5-D7/A4-A5,-(A7)
005B72 48E7070C
cmp.w
005B76 OC6E00020008
#2,8(A6)
bit
$5B84
005B7C 6D06
clr.l
DO
005B7E 4280
005B80 60000192
bra
$5D14:lnl:fp5
move . w 8(A6),DO
005B84 302E0008
asl.w
#5, DO
005B88 EB40
ext.l
DO
005B8A 48CO
move . 1 DO,A5
005B8C 2A40
add.l
005B8E DBFC00003E3E
#$3E3E,A5
005B94 284D
move . 1 A5,A4
005B96 3EBC0001
move . w fl, (A7)
clr.w
-<A7)
005B9A 4267
-<A7)
005B9C 4267
clr.w
move . w #1,-(A7)
005B9E 3F3C0001
move . w 8(A6),-(A7)
005BA2 3F2E0008
clr.l
-(A7)
005BA6 42A7
move . 1 #$12BC,-(A7)
005BA8 2F3C000012BC
jsr
$62D2
005BAE 4EB9000062D2
add.l
#$10, A7
005BB4 DFFC00000010
move . 1 DO,-12(A6)
005BBA 2D40FFF4
tst.l
005BBE 4AAEFFF4
-12 (A6)

getdsb
Zero

getbpb, get BIOS parameter block

Save registers
Drive number
< 2, ok
Else zero
Drive number
Timers 32

Plus base address


Count, read a sector
Side 0
Track 0
Sector 1
Drive number
Filler
Sector buffer
Read sector
Correct stack pointer
Save error code
And test

>

l-t

5T

Abacus Software

Atari ST Internals

-p

+J

-H

O
O

O
0

CO

03
VO
0

error handler

CD

0)
t3
P
C
0)
P-

>

O
O

rH
IB

O
-H
4J
-H
^_l
CJ

^
O

-H H
M !H
^
O Q EJ

stack pointer

^1
o
p

ji

u
0)

C
-H
n)

J_J

CO

VO
CO

0) o

%0)

4J

CO

r(

) 4->
^

rH
rH
-t-

5^
0)

43

CU

M
o ^
<B
o to

fi

CO

Oi
0)
0
P
0
0)
CO

<a
0)
O
O
O

a>

H G
01 -H

O<

SJ
0) CO
> 01
C 4J

^^
jp

01
u-l
^ CJ)
fH -H J>
p CM <a

(3
O!

PQ

p CO

vo Q Q

CM

<: o

VO O

rH <C O VO rtj CM
I O CD EH
- CM rH PQ CM PQ
Q

C D C O d )

=tt= </>

< T O ) C P -

0
0

fr!
EH

cy o

IE

O ^Q 4-J

0010000

000555C

S 'f~ fd

CO

^
rH
Q

CO
M
O
P
0
01
CO

M VO
O CO
4J O
U CO

0)
CO

c*>^
cH
-|.4

CM" I
CM C
+ O

0)
M

0)

J->

01

01 -H <H
- N
0 01 M-I -H -H
01 rH P CM CO
M O CQ P MH

IH

IH
P
PQ

P
&

EH EH 0
0 H O

CM
rH
</>

*.

VO Q
CM
VO O

^ O

< CM

ft,

VO

rH*-~CMCMVOCO3Q

O CJ
CJ CM
in rH

O X!

3-

EH

CM
rH
0
O

EH

o H vo o
rH < CM
=r CM PQ PQ
o CO o
O W 0 fc. EH" ^ Q 0 o
o CM o
F^ vo
vo n CM O <3" in CM CM PQ vo f
sr vo
vo

0 ) > > ! > > - i ' O > > p H { T j J


t n O O O e o T J O O E c u c o
S

H O)
0) -P
ft C

0!

r-

VO

m N
in CM o r H < / > i n < - H i n o i n

EH

vo

^3

o o

Q
CQ
in

EH

rH

^1

U
0)
CO

vo

M
0!
P
CO
p

rO

en
CJ

CM
rH
OCJ

CM
rH
O

OVO

ova

oo

CM
O
PH

CM

PH

rH

CM
rH
CMO^PCO

o o w o

CO
0

o
o o o o o
O

VO O

w
]

c j o o p a c n v o c j v Q o o r - v Q c j o o CJ O
CQ o o c^ co co r*~ o co o co ^ CQ o ^CM
W r H W r - O c o o v o c M O C o e n M r H c n 0 CM
C M V O r O V O r H ^ p O V O ^ r V O C O f O C M V O C O co m
C M C O c j ( a o v o e o c j ( y o p v o < o a ' CO O

PQ
m in in in m m m m in in in in in
o o O 0 o o 0 0 o 0 o 0 0 0
0 0 0 0 0 0 o o o o o o o o

p q p q p q p q o c j O C J C J O C J C J O C J C J CJ CJ
i n i n i n m i n i n m i n i n i n i n i n i n i n m in in
o o o o o o o o o o o o o o o O 0
o o o o o o o o o o o o o o o o o

en EH
O CQ co

CM sr CO O W ^f vo <c W "=r vo < O


O U U CJ CJ Q Q Q Q P3 p-*)
CQ pq m ffl CQ CQ pq PQ PQ PQ CQ PQ PQ
]

E n E H E H E H O O O O O r H t H r H r H C M C M CM

298

CM

Abacus Software

-r)

O
0

0
O

0
CQ
VO

CO
V0

XI
N
N

-H

-H
CO

CO
rH

CO

en

CU
4J

G 4J

sp

N
-H
CO

CU
^1

t)

CU

-H
CO

CU
4-1

MH

G
O -H

CO
CO

MH

-H

rH
O rH G
-f.
o
0) U
tsi
03
o
t^
CU -H 01
CO
MH

CO CU
.p O
CU MH -H
<0 CO -H -H p CM
EH >H
P
rH

o
4-1

jj

rH

10

CU

CO

G
CU

G 4-1

rl

ai

CO

O
CO

4-1

jj

CU

G
0 Q
O
^
CO
CU
p
-rH rH
rl CO
CO rH MH
^
CO
4-1 P P CO MH -rH G
-H -H fd '1 rH -H P CM -H
Q >H MH PJ PM
PQ P

CM

rH

<^

co

T3
CO

CO
CJ)

CO

O
CU

-rl

CO

H MH

H-

T3
CU

r<

O^^
O Q ^ P Q - i < O
0
- . C J > O
rH ^^ "31 "31 CM ^0 Q
^ ^ T r t ^ K r H C M * .
O
Q CMQ=tt=<O-=tt=Q

^-> C

S S S r H

-H

rH

&

MH

^-*

a; a)

CM

CO
CU

O P O O c o w X - r l O O T j - a O O M P X - ^ O

<H
CO

<

sp
0

m
o
o

SH
CU

en
CO

<>

rH
CU
XI

E
P

4-1
M

U
rV
CO

&
CO o
CO a
CU
o CO a

G
O
O

0}

V0
CO

o
CO

G 4-1
rl
CU
CO
CM
H-

M
CO

C
0

G
CO

a
a

4-1
-H MH
-H CO rH MH
^
CO MH -r) O, CO g CO MH -H -H
G P CM CO G -H -H p CM *G
PQ P *O T3 EH >-l pq P

in
a1
Q
CM

10

rH
^/j.
=tt=

rH

CU

CU

CO

rl

>

CO

o o

Q Q

in

CM
CM

CO
Q
CM

s a

rH

io in

> Q

g e s e x ) < u c u ' O c a r a s s x i c u ' o e s XI g E

=r
O

0
4-1

G
0 -H

V0 CM
CM
V0 O

rH

>

H1^
CU

O
0
0
CO
V0

MH

G
-H

in

o] a;

> r H > > r | r H 4 J > > > - i 3 - t ! > > M X l 4 - l > >

CU
4-1

CT g

a vo o

?rH

CO

>

CO MH -rH
-H -H P CM
Q JH PQ P

CO

0 CO
4-1 O
O CO
CU

CO
0
CO

CU

O T
Q <
. " VD
x-^-O"
" T P r H CM
tC
* rH
Vt
Q r H V Q C O Q = B = < / > r H Q C M Q =

ai aj

005C2E 3940000A
005C32 3014
005C34 C1EC0002
005C38 39400004
005C3C 2EBC000012CD
005C42 61000622
005C46 EB40
005C48 48CO

a
j_,

-rl

o
4-1

4J
G
-H

CM

K - ~-~ <v rH
CM
10 o 0 C1 O </5> Q CM CM Q
*

rl
CO
XI

> CM
CM
*
VO O
</> Q

CO

E E

CO
r^

CO

E X! E

005C4C 39400006
005C50 302COOOA
005C54 D06C0006
005C58 D06C0008
005C5C 3940000C
005C60 2EBC000012CF
005C66 610005FE
005C6A 906COOOC
005C6E 48CO
005C70 81EC0002
005C74 3940000E
005C78 2EBC000012D6
005C7E 610005E6
005C82 3B400014
005C86 2EBC000012D4
005C8C 610005D8
005C90 3B400018
005C94 302D0014
005C98 C1ED0018
005C9C 3B400016
005CAO 2EBC000012D8
005CA6 610005BE
005CAA 3B40001A

cucococu

CU

c
o
o

i < - o < / > v 0 i r > O ( < o o ^ ~ - * O - W > V O C M O o

en

j^

H-

CO

. G O O - a *
Q
O s p - . Q Q c < ; Q ;
- . pM4
-*
-- ^ ^ - . ^ - C M C J V D T
-^-^ ^ 0 r t J ' 5 P < a 1 r H C M \ 0 r i 3
^ P ^ *-* fC, (,
. rH CM ~~*

CU
4-1

CO

G 4-1

vo

o o

T)

EH

rH

G CM

rH

0)

>

5
-H

rH

CU

aId

J8E

-H

CO

O
4-1

(^ vo
N

O
J_)

o
o

r track

O
4-1

>

CO

CO
VD

CO

n J
CO
o

JSg

-rH

hidden sectors

4-1

G
-H

IH c

4J
G
-H

sectors

directory entries

Atari ST Internals

299

Abacus Software

Atari ST Internals

CD
U-H

3
03

o
00

o
4-1

CD
CD

ft
o

-rl

CO

O
ft
to

O
CO

a
^,

4-J
rH

CD

43

c
o
o

^
-H

rH
</>

=w=

to

CU
T3
-H

-rl

-H

rH

4-J

fa

CD
4-J
C
O
CJ

rH

CD
4-J

o c

C -H 4-1 fd 4-1 CO
CD O C
G MH
3 CQ 3 MH
ft
O CM 0 3
0
0
CQ
4-J
rH
O ^
CD
ft
CO ft
to
ft
1-1
0 3 O 3
3 3 O rH O rH

e IH

r^

Pj

rH

<c

O
Q

O rQ Q

to

CD

4-1

x:

-H

O
g

4_1

;>,
jp

>.

4-J

ft

|5
.
M
rH

CJ o
Q <jj
^
O

m m

,_,

(U
<a >
^ o
43
g

CJ
rH O tH
<;
(^ rfj
fc.
^
[*- ,1 p^

<

. (1
CD

>
O TJ
g

-o

tn

^_^

rH

rH
<J
^

^/j.

CD

fd
4-J

CD
4-J

EH S3

o
.
r- r- vo vo
Q Q CJ
~ 0

rH

n m

4/j.

CO

o
a

CD
p>
O
g

(B

., rH

U>

\O
Vt

^^
^ CM

fQ
~^

rH

,
*
.

CO

*^
*. CM O *3<
^-^. O Q o
rH Q
Q

rtj

tr
a
a
(0

S
CD
ft

4J

rH

0 43 E

'*""

.
CD

rH

rH
B

CD

> a >
0 o 0
g <a s

s
rH

CD

> TJ
0
g

-o

(3

fH

rH
<

rH

in

<
CM

n
o

=ft= </> Q

rH
*

.
^31
p^

PQ
p<
CQ

to
3
4-J
fO
4-1
CO

.
^,

rij
,

4-J
H
CD
O

to

CM

to

rH

-H

4-1

rH

CO

CD
p
O
g

r^
V>

id

3
4-J
19
4-1
CO
ft

j>
CD
0 ti

tn
<d

CD
U
G

3
4-1

to

CD
CD
M

3
10
CO

rH

CD
>
O OJ
g 43

tr

CT
CD
P"
O

S
M

*fl
M

rH

S 43

rH

(U

CM
*.
rH
.. rH <C
rfj

f
.
.
^-^ CM
CO
O

vo

Q
.

o m

g
*
Q)

.H

<!

43

rH

CU
>

0)

>
-a
>
o O a O O
g e fd g g
>

005CAE 2EBC000012CF
005CB4 610005BO
005CB8 48CO
005CBA 81ED0016
005CBE 3B400012
005CC2 4 2 4 7
005CC4 6016
005CC6 204D
005CC8 3247
005CCA D1C9
005CCC 3247
005CCE D3FC000012BC
005CD4 11690008001C
005CDA 5247
005CDC BE7C0003
005CEO 6DE4
005CE2 207C00000676
005CE8 326E0008
005CEC D1C9
005CEE 227C00000674
005CF4 346E0008
005CF8 D3CA
005CFA 1091
005CFC 6704
005CFE 7001
005DOO 6002
005D02 4240
005D04 227C00003E2A
005DOA 346E0008
005DOE D3CA
005D10 1280
005D12 200D

CJ

>

4-1

00
CM

CO
rH

rH

CD
fa
O co
g 43

CM
CM

CD

rH

m
.. ~~
Q

^D
Vfl
CM
VO
</>

CD

>-3 a. o

eC

CM

c
o

CD

CM
3

r-

Pu
CJ

4-J

tH

s already ?

vo

er
ddress
er
r address
of the serial number

K
Ol
rH
HM

O
0

racks
zero

number of sectors on disk

J-J
C
-rH

300

Atari ST Internals

Abacus Software

0]
H
Q)
4-1
CO
-rH
&
01

-H

*:
o
<a

H
T3
(U

*
*
*
*
*
X
X
X
X

rQ
I
vo

X
rH

4-1

LO
I

w w

^r vo

<

CJ

rH
Q

rH
Q

rH

IO LO

LO

rH
Q
LO
O
0

O O O
0 0 0

vo

-X

*
X

*
*
X

rl

0
0
CM

^5

ft

W Q

^--

-H

ts

r-

Q
1

-H
rH

<

<C

rH

x Q r H Q <
CMLO
1 LO

KfO
.Q
" . Q V O r f l Q
*.PQ
^
[ < / > e M L O C M L O >
lOrHSf!^

a =ft=-a>^=</>co Q=*^=i^>=tt=</>=ft=o</>=*r</>Q
rH

CT

ft
g

4-1
r*
r H O

rH

rH CO

rH

s VO rH
rH />

&

&

- . r H 4 3

^3
r t

r*
O

1^
O

*^
T i

CJ1

CL,
fl)
^
S C O r

rH

43

-43

rH

*d
r^
4-1
CT
r*
1^
l O O l C B O O

rfl

VO

rH

3!

. . .
r*
O

rH

a
ts

ie^

rH rH

rH

C J C > \ i >

en
CJ
(0
Q

rH
rH
CM
CM

pl

V D O H O C M V O C O E i q C M Q < V O C O p | C M 9 C O H
C M C M C M C O C O f O C O f O S P ^ ' Q ' ^ P ^ P L O L O L O L O

o CM T
vo VO VO

VO

o 3* C M
0 o O
o to O
o o o
vo
N ^
LO

rH
Q
LO
O
O

CM
CM

CM
tt)

rvo

CO

PQ
icr

C O O C M
O
O
O
O O O

O O r H
O
O
O
O
O
O

o o o

O
O
O

o t ^ o o

T r H O L s 3 , > C J L O ^ r C M V O C J O 3

43
P
01

O Q O O W < P 3 O V O O O O < I > < O C M


O V O l ^ V O t O C O Q O V O l ^ V O C N J ^ V O r H C M t O

Q
rH
Q

H CO

o
o

r-H

g 043E43Sg5043S43e4-i43Eeg

CO

rH

. O

K J ; Q
K < L O
- . Q L O Q
C M - W - L O C M r C C O O W V O
..COKC
-rH
c o t O L O r ~ v o < p q < Q [ ^ , > o t o <<;

rH

**************************

move

tst.

X
-X
X

O
4-1
<d
rH

D3C9
D3FC00000678

vo

LO

rH

4CDF30CO

4A9F

V -

*
*

ff.

rH

LO

r5

X
*

rl

M CU
O >
H -H

$25F6,DO

ST
<

43

$5D7A

LO
<

r- r-

en

O
0!
G
> 0- X
-H CM G

(Q

rH

CO

vo

bge

c u p

cmp,, 1

4-1
U
(U

SCO 4

(U

BOB9000025F6

rl

( B O O )
T3 C 43

add,
add,

<U

(U
43

maxacctim

(U
4-1
01
-rH

H-

<o
u

0]

f)
VO

^31
1^

Q Q Q P Q D Q Q Q Q Q Q Q Q Q D Q Q Q Q Q Q Q Q Q
IO L O L O L O L O L O l O L O l O L O l O l O L O L O L O t O l O L O to 10 LO 10 LO LO IO
o o o o o o o o o o o o o o o o o o o 0 0 O 0 0 0
0 o o o o o o o o o o o o o o o o o o o o O o 0 0

301

005D76
005D78
005D7A
005D7C
005D7E
005D80
005D84
005D86

4240
6004
1015
4880
4A9F
4CDF2080
4E5E
4E75

4E56FFFC
48E70F04
OC6E00020012
6D06
70F1
6000010E
3C2E0012
OC6E00020008
6COOOOCE
3006
EB40
48CO
2A40
DBFC00003E3E
3E86
6100FF60
3EOO
BE7C0002
660A
70F2
600000DE

clr.w
bra
move.b
ext.w
tst.l
movem.l
unlk
rts

link
movem.1
cmp.w
bit
moveq.1
bra
move.w
cmp.w
bge
move.w
asl.w
ext.l
move.1
add.l
move.w
bsr
move.w
cmp.w
bne
moveq.1
bra

DO
$5D7E
(A5),DO
DO
(A7)+
(A7)+,D7/A5
A6

A6,#-4
D4-D7/A5,-(A7)
#2,18(A6)
$5D9E
#-15,DO
$5EAA
18(A6),D6
#2,8(A6)
$5E78
D6,DO
#5, DO
DO
DO,A5
#$3E3E,A5
D6,(A7)
$5D1E
DO,D7
#2,D7
$5DD2
#-14,DO
$5EAA

***************************************************
005D88
005D8C
005D90
005D96
005D98
005D9A
005D9E
005DA2
005DA8
005DAC
005DAE
005DBO
005DB2
005DB4
005DBA
005DBC
005DCO
005DC2
005DC6
005DC8
005DCA

Restore registers

rwabs, read/write sector(s)


Save registers
Drive number

< 2 ?
No, unknown device
Error branch
Save drive number
rwflag

Test media change


Save status
Disk changed ?
No
Media change error
Error branch

WJ
H

Atari ST Internals

Abacus Software

VI
<D
rH

o
Vl

4->
O
01

a
0}
en
c

01
4->

4J
01

<o a
u

o
4-1
0

(D

<0

.X

Vi
O

4->

(B
VI

O
0)

"O (1)
<a *O
0) -H

VI
O
VI
VI

0)
01 Vl
01 VI
IB O

pa

(X en E-I cn

t-

w
m

(0 0.
VI

o 43

Q
rH

rH

0)
0)

<

r-

>
o
g

rH

=s=

.
Vl Vl
rH

rH

a>
> >
o o
e g

CM
VO

0
rH
>

rH
rH

CD
VI
rH

>
O
e

Vl
01

<

o
vo

VO CJ C-

^p
I

rH

rH

(D

Q)

Q)

Q)

CT

<
o

O rH
< O

CM
Q
CM
VO
O O O C J O

CM

OOOEc*E4

f*j Q

VI
O
VI

Vl
O
Vi

</> in "3 in
=tt= > i -to

O,

Cj* 4-1

3
(0

g a) 01 en o vi
O 43 4-1 43 g 43

o
o
o
o
CJ

0)
CO ^

rH

Pn CM O

sp
m
rvo

vi <a
Vl
o 43

rH

O CO

" co pa o
O CM O
CJ O O

VO

CM

VO

vo sC o

CM

f^l

CM

CM

[V| fV] pj pJ jv^ fv] (V] pT"j f] pr"} pT"] pj p^ fv^

ininininininmininininininininintninininininmininininin
o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o

303

Ti
0)

< vo *r
Q < n

VO O
f
O

H H W p L , p t , ( i , O O O O O O r H r H r H r H C M

pa o CM

VO

CJ Q Q Q Q pa
Q

CJ

frt

o o o
o
o o o o
o
o
r- O
o r- o P3 vo vo
o
W CM CM Pu
vo pq vo

O
in
in
m
o
o
o
o

>H

pj

Q
-

> > > vi -a


o o o 01 -o o o
g g g -n <fl g g

CJ
IS
CM
CO

;
o ^- o

rH

a >
a o
g

Vl
VI

P^ H

P3 v m . in vo =p o m CM o
Q i Q > =* Q

*Q

rH

0)

<0
Q)

Q "

CJ

r <

r-

a o

CM cj

rH

0)

-rl
Q

Q
^

fi
O

rH

01

a
x
01

rW
m

id

H X
4-> O
"H (Q
Vl 4-1
O
CO

Vt

Vl
O (H
VI CO
VI 4J
-rH

CO

01
01

CO

0!

13
JS
O

G
(0

r- CJ
CM O
31 VO

in in
o o
o o

Abacus Software

Atari ST Internals

M
0)
1-1

3
C

tH

4)

19
-H

SH C"

value

M
O
4->

O
0)

(U

01 "O
(U
<U 4J
^ 01

(U

E
3
C

CO
M

rH

CD

id

<d
0)
JM

TJ (1)

sc co

O
Q
IS

CJ

CM

s o

CD
4->

OJ
03
4-1
>i

<D
4->

3 0!
C 3

43

"

T!
0)

(U
S3

<D
>
-H

a
o

id
4-1
O

r-H

0)
>

S-l
O

3
C

3
G

-H
M
Q

O
S3

o
a- n <

O CM

Q in

p4

3=

3=

CT

fl)

0)

0)

T3 g rH o Ti O T3

0000676

> > 4 J > 4 - i G . i T > i O


O O X O X E t U O M
E E a > E O ) 0 4 3 g 4 3

w
O
rH
O

r~

OinrHrH

'O'CMOO

coroco^r op^in
cocMCoo r-oo

co
o
o
o
o
o
r- 0 &3 vo O vo O
Q -a1

CM M Q

CM -a*

co (3

m m m m

w ty pq pq
o o o o o o o o o
o o o o o o o o o

CM W

43

S5

Q)

QJ

3
O
O

CT

Q>

^ fl) ^ *O M -M Q) J> (3
O G O " O < - H 0 1 G O H

rH

< vo
o -a1
vo o

O 0
h rH

0
CPl

O
rH

*3*

w vo

rH CM

m m m m m m in in in in m m m in in m
o o o o 0 0 o o 0 0 0 0 0 O 0 0
0 0 0 0 0 0 o o o o o o o o o o

304

o vo
CO G\O

ril

rH in CM ^r vo

* = * = rH Q

H 43 3
*

i m

r~ o f-. CM
< vo o 0
VO CO Q a" ^ vo r- vo
Q
CO Q
O CM * fiC o w o vo co W 0 CM
m vo vo vo vo vo r- tCO CO
&3 P3 W [) W pq W f*J pq ^ H PL]
pt!

0 rH CM CO

m m vo n

co

i m
=#= </>

O CO
CO Q CM

43

0]

0)

fi

S-l
0)

"is

rH

CM
rH
O
O
O

0) 45
M U
C
4-1 Id
O M

V}
=8=

(d

O 43

G.

id
Q,
E
O
U

V-1 "H
"O VJ

tr> o
c c

4->

*
O, 0>
E rH
O 43

0010008

1-1
O

0) X

00004A6

0)

0003E2A

4J

0000674

JH

iou

O"*
A
3
01

co
o
o
o
o
3i W
vo o vo
o PM in
o vo m
a1 C o
CO CO CO
W pq pq
m m m
o 0 O
o

0) Q)
> >
O O
g
g

o
o
o

pq vo
O
pq CM
co co
ff,

O IT
O\S

H W

m m
o o

0 O 0 0

Atari ST Internals

floprw, read/write sectors

Abacus Software

to

CD

(U

er>

M
0)

cd

C MH

-H

o
4-1
CO
(Si

Io

***************

CJ

in
-v

r-

vo vo

1
<*

r< +

< Co
vo o
rH

iH

(U

>

>

03

CO
o ^

.Q

a
a

cd

I
4-!
CO
4J

m
o

******:

0
<0
4J
CO

<
rH

.X

CO
C 4-!
3

1 rH

*
*
*
it
it

CO
0)
M

<s>

VO

1
*
vo

CM
Q

cd

3 CM
C ro
0)

CO

CO
(U

CO
3

7! -H
Q EH

O
Q
VO

Ed

in o

0
Q

vo in

=tt=

0 0
0
Q Q ==

CO
0)

Clear oddflag

4-1

ra
Buffer address not even 1

!H
(U

PM

, 13 (A6)

CO

PQ

-D7/A5,-(A7) Save registers

n
cu

4-1
C
-H
0

s
o

JJ
0)
CO

C
-H
rH

01

0)

0)
rd

(U
rd

4J
0)
01

CO

O
o a
CO

ts

a)
CO

CO
rH

>H

Ed

CO
Q

in

CM

in

CM

a
a 1
ryi
0
Q

in

a.
CO
a
o a
CO

CO

in

vo

Q CM

in

CM

Q CM CM

in a\H O o vo
Q Q

rH

rH

en

er>
rd

rH
*W

3
rH
CO

cd

01
4J
(U

o
a

cd

4-1
CO
4J

a>
c

.Q

tf

rd

H H
U X!

CD
>

3
4-1
CO
4-1

tr
>
0

3 3

0}

rd
j_i

vo

CO

Ed

.Q X)

-X

*
*
it
*
it

0
0
0

o < CO
rH o 0
O o o
O o o

fa Ed Ed o

CM

fa
o
vo
CTl
Ed

CM
fa
CM

CM
fa
O

rH
rH
VO

<c
en

Ed CM

o
o

0 fa

fa a\
fa
Q

it
it

<
o
o

=3*

0
Ed
O
CM
fa Pd in
Q m rO Ed Ed
a1 =r 5T

^r <=C O 0 CM
c\ <=C < < < m m
W
W Ed Ed Ed Ed Ed

in m in m m in m in m
o o o o o o 0 0 0
0 o o o o o o o o

*
it
it
it
*
*
*

*
it
*

-*
n
1C

Q
0
Cd O

ri^ ^i1 o
fa o rH
fa fa O
0
fa
vo r~ Ed o O o
m Ed CM <3* O *3*
0 m CO f^
*gi CO Ed ^p CM

Ed CO

a1

m
Ed

*
it
*
it

CO

y 0 CM gi

ffl

CQ

O O

td Ed Ed Fd

n o

0 0
0 0

o o
o o
0 Ed

tcp

fa CM o
pp CO vo
a o vo
vo o CM

o
Ed

Ed VO
fa f_J
fa o
fa o
o CM rH O o
53
CM

O
O
VO

O
O
r

*ji vo
O Q Q Q
Ed

CO
Q

f4
O
0

^I m
o

0 0

(3j 01 o o
a* vo o o *3* *>r
Q n3J vo o ffl
ffl
^1* vo r- ro ro
(^J Ed CM ^i vo
Q Q Ed Ed Ed
Ed Ed Ed {V]

f3J

o
o
0
vo
Ed

Ed Ed
Ed [V]

m m m in in in in m m m in m m m m m in m m
o o o o o 0 0 0 0 0 0 0 0 0 0 o o o o
o o o o o o o o o o o o o 0 0 0 0 0 o

305

Abacus Software

,1

T5
CD

T3
id

>[ ]
3

^
CD

J^

11

CD
01

>M
t-4
3

C31

<d

^
O

rH

^_^

CJ
O

m ^r

fa
m

CM
rH
W-

< o
CM
1

<rt =B=

LO
<J>

fl)

P.

rH
(JJ

01

-H
Q

4J

> a
-H M
3 T3

a m ,G
O

>1
jQ

4->
-H

CD
TJ O CD
0!
-H
<Q

O
O
CD

CD

rH
_|

o*

4->
P.

<a
4_>
^4

O
4-)

01

4J
CD

01

4->
G
3
0
U

[ 1

CD

O*

rH

<a <d
j_i H

4J

CD
-H (U O
-H
Q K CJ C3 03

TS

-H 3
03 ^
CO

S ^

^-* <~*

^
to
IO CO
<J CM
<I f^l
fc ^
*^ fa
tr VO CNJ =? "O1 CM ^ji <qi m
rH Q CM rH Q CM Q CM

to vo

1
rij
*. ~--'

o o
Q

IS

rH

IS

is

3
G

3
G

CD

JH

^4

O
4J
O
CD
01

tr
o
^4

CD
4J

<d
CD

^4

C5

as counter

43
g

M
(Q

O
Q

Q
^__^

o s o

Q Q

CD o>
43

H A
O jj
4-> H
U
CD ^
03 CD
M
0! (0
4-1 3
Q. f^
&
01 -H O

4-1
O CD
S 03

r equals counter

H
CD
,Q
g
3
G

C7*

01

-H

01

rH

vo ^

^H ^H

CD
CV!>IO
C D O U
,Qg,Q

-H

vo vo vo

fa

'I

<D

*.

<J
*

rH

Q Vi)

vo

O
0

M
O
4->
O
CD
01

a o
^, -H
O
^ H
o n.

01

-H

0
G
O
CD

tJ
Ti O CD
0 3 CO

0,

id

01

-P
0!
U

>,
o

01

CD
C"

-H

CD

H
CD
0.

r of sectors

01
01

X
0
(0
H
4->

ion as sector number

tor

number

elds track number


tor number

Atari ST Internals

01
r-t

4J
U
CD
01

UH
O
^4

0}
4J 3
O. G

CD

3
K

en
O

ra -H
*O S

H m i n v o c o n o i n o vo o m co o vo
c M Q < < l n Q i n < Q < r < Q tn <
fa * fa -fa ~ fa - fa
CM
CM

in

>

rH

in

'Q1
Q

rH

CM Q

>

rH

^
rH

C D C D C D ' O l O J i i O l C X "
> > > 4 J > > 4 J > t O ! X
O O O X - H O X - H S g
g g g C D ' O S C D ' O O l U

C D

? * . 3 4 J C 3 * r

( D * *

>

( O r * * Q P

C D '
< C O

> f

C D

Q n J r *

O 3 0 1 C D O r 4 O 3 g O > O 3 r 4 O
g o i 4 J 4 ) S 4 ) g o i O 4 3 g o i 4 3 g

CJ

pa

CM

o
o
o
o

fa

fa
fa
la

CO

U 31

vo o

CO

vo

CM

p
5P

o
o o
vo

w
fa fa fa
W w W
m in IO in

CM
fa

vo

CO

o o 0 0
o o o o

sC < w
o fa 0
o fa o
o fa o

w o w vo
CM
CM o
"531

O Q
CM CM

O co
CO 31

o
o
fa
to m in in
0
CO
0 0 0
fa fa fa
vp

o 0 0 0
o o o o

vo
rH
O
O

Q
W
Q
CO

w
o

vo

o
o
o
CM
CO
CO
CM
rH
fa

CO

CO
rH
0

rH
0
0

O
ql Q "31 Q 31 m
^r VO o
CJ
CO G\O CO CO CJ CM

vo
rH

m
w

rH

rH

31

3"
CO
rH
fa

M
fa
0 fa
o fa
rH Q
^p

,_t

co

CM

co

rH

rH

rH

CM CM CM CM CM CM

CO

CO

fa
fa
fa
fa
fa fa fa fa fa fa fa fa fa fa
m m m in m m in in in tn tn in
to to m
0 o o o o O o o 0 o 0 0 0 0 0 0
0

vo
rH CO Q ^1
CO Q
o O VO vo o O rH CM =P vo o CM
r- VO O O O o O VO
o fQ CO
vo ^> vo r- en ^
vo co
*p vo r- VO ro en
CM =r vo CO < w CM IT vo CO CJ w CM *3-

o o o o o o o o o o o o o

306

n co

10
0
0 0 0

fa
m
o
o

^P

CM
rH
O

^ *?
3"
VO
Cfl
CO

fa fa fa
in m IO
o o o
o o o

o CM
0 VO
vo co
< CJ
^i
fa fa
m tn
o o
o o

Atari ST Internals

[V]

JH

tr <1)

VO

CO

Q
r.

m
CO

0,0^1
o <D ro

r-

VO
1

o in

1I

Co

S o crH

vo

cr

0)
X!

cr
cu

0 X)

move,
move,

4-1

M
B
-n

1i
Q

rH

4-1
CQ

r1

<a

rH

VO

vo
VO
Q 5T Q

CQ o Q
ti
fa ^r
vo vo
O
=tt= Q Q <o
1

fa

rH

o
o

-n cd

U
CU

4.1 CU
CQ C
4-1 .Q

4-1 tr
to
4-1

0)
X!

i
n in

-H
H

rl

CU
3

0
4->
O

-H
fa

0)

rH

CO

MH

r-

r-

in
y O CU
O 4-1 >

0 > 0 3 -H (H
j2 n \f S
sectors
S to EH CO

r-

rH

H
rH
O

^
CU

(U

CO

buffer
r, verify sector

MH
-H

vo

Q
S

>
P.
O

CM

vo
vo
Q Q Q rH

CU

rH
Vt

i
(

H
rH

CM

o
vo
vo
</}

rH

tn

005F50 5244
005F52 4A6E0008
005F56 67000080
005F5A 202EFFFA
005F5E BOAEOOOA
005F62 6710
005F64 2EAEFFFA
005F68 2F2EOOOA
005F6C 4EB900005910
005F72 588F
005F74 3E83
005F76 3F05
005F78 3F06
005F7A 3F04
005F7C 3F2E0010
005F80 42A7
005F82 2F2EFFFA
005F86 4EB9000063BO
005F8C DFFCOOOOOOIO
005F92 2EOO
005F94 4A87
005F96 663E
005F98 4 A 7 9 0 0 0 0 0 4 4 4
005F9E 6736
005FAO 3E83
005FA2 3F05
005FA4 3F06
005FA6 3F04
005FA8 3F2E0010
005FAC 42A7
005FAE 2F3C000012BC
005FB4 4EB900006602

(3

O
<d
4-1 CU
CQ 'o
O
K 4-1 0

n
S H M M O
_ V O < D < D O : S < U H

co m vo a- vo

o m

So1

T3
Cti
0)
M

4J

move,

Q vo

CU
MH
MH
3
X)

4 - l S H . Q C U O 4 - l > ' H 4 - l Q . > H O C .


p CQ C Q M E T J C d O - r - l r H O O M r l
O CU r d O P - H U C U H - H C U r H O S H X
to Q M H C J S C O E H t O Q f a t O M H C J H O
H

o 0
Q

01

& U CU
O <fl CQ
O 4-1
CQ MH
O
>1 4-1

move,

y, verify required ?

address
ation address
CU G
O -H

CQ
rH

cu a

4-1

move,
move,
move,
move,
move,

ta

CQ
>H

fa a o

move,

^4

"O MH
0 W cd MH
C 01 CU 3
M EH P5 CQ

H
CU
M 4-1
O C
4-1 -H
O O

move,

&H

CD

M
O M
4-1 CU
O 4->
CU C
CQ -H
O

move,
move,
move,
move,
move,

pointer
buffer address

ent sector # (1st number


ead-write flag

Abacus Software

307

Abacus Software

Atari ST Internals

4J
C

-H
O
0
O
CO

o
4-1

!H
01
0!

c;

-rH

a
H

J<
o

10

CD
w T3
0
.JJ O

4J

01
J_)

J^)

01

C
-H

4-1

H
0)

4J

^
01

01

4-1
_|

JP

^
0
0-

S-t

.***!

4-1
O

0)

>
o
o

^
-rH

01 CM
3

u w o z, en

01
M
O
4J
U
0!

jj
03

-H

UH
IH

j^
O

ID
CO
O
CO

rH

o-

IH
O ^
O

4J
O

0)

0}

M
0

01
^
o

a; a o>

0)

*o O o
<0 01 (Q
pa en ffl

0) 4-1 M
H M O

-rl
01
01

0) T)

T3

IH <o <a
IH

IH
o

to

a
cu
!H

ta

4-1
O
0!

M 01
0 4-1
4J G
O -H
(U O

M 4-1
O C
4.) -H

0)

a o

a o
a -H

P.

<0

(0

4J
O]

4-1

4-1
w
<fl

SH
H
O

IH

4-1

a u
u 01

cu
o

X O O J f f l O H O )

4-1

EH

01
>
--H

M
O
H

)H
Q

r)
W

VD

--- c^
r-

CJ

> PQ
Q
fa

CM
rH

T)
<U

10

rH

o m

rH

0)

^
01
>
o

4J er

I
<s

O Q Q Q

1
Co

vo
rH

Co cM

V>
1

01

0)

01

01

01

o o o
g g g

O
g

0
g

rH
0

fa

r~ o

00

rH

la

-O

CM
Q
CM

O
rH
O

XD

CM O rfj

W
|<

O fci
I W

CO

CO
O

<0

O CM

r^ w en cj
<C CM pa fa
CM

fa

VD
1

rH

rH

rH

0)

01

tf

C
VO

O
rH

(U

01

0
VD
</>

> > <i tr > >


0 0 g 01 o o
g g O 43 g g

CO
CM
O

< Q
VD

> rH

t^
Q

15

rH

H TS 4-1 Ol
0) 13 01 CP
-n tfl I i _Q

o
rH

O O

fa O O
fa o o
fa o o

O
rH

o trH f
a\
m <=P
</> =*

ID CM
Q

H M

e -'-i

<

=*=

i >H -d

CJ

o
o
cj o
fa o

rH
</>

rH

CM
rH
CO CO
O
CTl
O CM
O O
CJ O
CQ O
rH

U3

1 <-*

o
o
o
o

<c ca o
rSI

"s

VD

H
01

> 4-1
O 01
g 4-1

Q Q

r- r~ r-

0 0
Q Q

o
o
o

en
< < o
o
o fa o
o

o
o

fa

P 3 C J O C J C J C J Q Q Q Q

o o o o o o o o o o
o o o o o o o o o o

o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o

308

00601C
00601E
006024
006026
006028
00602E
006032
006034
006036
006038

3FOO
4EB90000555C
548F
2EOO
BEBCOOOIOOOO
6700FF22
4A87
6C04
2007
601E

00603A 3003
00603C 48CO
00603E 7209
006040 E3AO
006042 D1AEOOOA
006046 D76EOOOE
00604A 976E0012
00604E 4A6E0012
006052 6600FE9E
006056 4280
006058 4A9F
00605A 4CDF20F8
00605E 4E5E
006060 4E75

move.w DO,-(A7)
$555C
jsr
addq , 1 #2,A7
move , 1 DO,D7
#$10000, D7
cmp.l
$5F52
beq
D7
tst.l
$603A
bge
move . 1 D7,DO
$6058

bra

rts

move . w D3,DO
DO
ext.l
moveq . 1#9,D1
D1,DO
asl.l
DO,10(A6)
add.l
D3,14(A6)
add.w
D3,18(A6)
sub.w
18 (A6)
tst.w
$5EF2
bne
DO
clr.l
(A7) +
tst.l
movem , 1 (A7)+,D3-D7/A5
A6
unlk

*************************************************
A6,#-4
006062 4E56FFFC
link
$25FA
006066 4AB9000025FA
tst.l
$6084
00606C 6616
bne
00606E 2039000004BA
move . 1 $4BA,DO
006074 7210
moveq . 1 #16, Dl

On stack
Critical error handler
Correct stack pointer
Get error code
Attempt again ?
Yes
Error code
OK
Error code as result

Sector counter
Times 512

Increment buffer address


Logical sector number plus counter
Decrement number of sectors to process
Sectors yet to read/write ?
Yes

OK
Restore registers

random, generate random number


Last random number
Not zero ?
200 Hz counter

65

I-H

23

I-!*
CD

B
5T1

0
CM

CO

CO

CO

CQ

rH
CM

.p
-H

iH

CM
vo
CM

en
rd in

p 01
CO

rH
*3*
rH
CO

a
*o

rfl
E
O -H JJ

CO

C
CO CM
M co

4-1
CO

(0

*
CM
CO

01

m
>

4J
CO
rj

CO
CM

rH

4-1
0. CO
5

O
4-1

03
1
rH
CO

CB

10

rH

4J
U 4-1
01 rH
}q P
^t CO
o 0)

rH

01

4-1

-H

CO

|
4-1 ^
-H ^i
pq CM

CO

CM

O
Q

^ CQ

m o
CM -sr
CQ

f=C o
fa Q

<
fa

in

o CM
Q
^

> CQ m

en

CO rH

fa

fa a fa
fa

K in
O

CM CO

006076
006078
00607E
006084
00608A
006090
006096
006098
00609A
0060AO

0803 9V0900

E3AO
80B9000004BA
23C0000025FA
2F3CBB40E62D
2F39000025FA
4EB9000094FA
508F
5280
23C0000025FA
2039000025FA

CM

0060A8 COBCOOFFFFFF
0060AE 4E5E
0060BO 4E75

< VO
fa PJ

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Je
*
*
*
*
*
*
*
*
*
*
*
*
*

o-

o
<u

ti T!

CO

<D

0)
4-J
CO
-H

G
O

en 4-1
(U
(U -H
G CO -H
-H P. M
0

<fl
tn

rH
MH

o
o

c^

10

rH

4-1

<u

-H
r<

o
o

H
P

O
U

CO
M
0

H
SH
Q

bootdev

rH
1
O

ffl
4-1
CO

(0

SH
(D
*Q

CO

0,
o

rH
10
CO G

1
O

*,
VO

o
vo m & vo

fQ

CM
Q CO VO
| en f
Q

CJ 0

rH

^s/*

G
-H
rH

s
01

H
CO

CO

w o r-

Q CJ Q Q VO
M. 0
h. *. rt.
rH vo CM o
^
</> =* </>
Q </>
rH

rH

tr

CT

tr
a

n 4-1 43

0)

(0

Jj;

01

(U

$446

JT{

CO
>H
ffl
4-1
G
-H

1C

4-1

4-1

CO
CU

bootload, load boot sector

<D
P
rH
<0
>

Atari ST Internals

***********

rH

0)
3
i1
CO
>

t multiplication

ro
I
vo

z counter

Abacus Software

4-1
4-1 0
<D 4-1
X
0
CO 0)
-H CO

<a
z, o
0

CJ

rH
rH
" rH
VO CM VO
> =**= </>

*.
, ]
=*=
(U

tu
o> o
& o
s

8" t

o
ra
rl

EH

rri^ (^
^-* ^^
I 1

5s

4-1
CO
4J

3=

s
M

rH

vo
c1
^ji
0

CM VO
CO <^
en a1

VO

gi
O

m o
o
o
o
o

0 0 o
O o o
O CO 0
O o 0

c en en
m pa CQ r- o o
w CO pa (^ r- o
a1 *T a1 ^r vo r~
VO

o
o

0
0

CM
O
O
VO

CM
O
O

o cyi
o

o
o
o
o

CM
O
0

310

o o
o 0

0
0

o
o

^S1 CTt

pa f3^ r^ CJ
r~ to SP vo o
o vo CO *3* CJ f-1 o VO CO
CM VO
CO PQ P^
CQ CJ o U CJ CJ CJ Q D Q
o o o 0 o o o 0 0 O o o
vo vo VO vo vo vo VO VO VO vo VD VO
0 o o 0 0 0
0 o 0 0 0 0

rH

n
CJ
vo
o

M
w

rvo

CO

CM
^P

CM

VO

VO
CM
SP
CO

pa pa

o O o o
vo VO vo vo
0 O o o o o

o
o o o

o o o

Atari ST Internals

Abacus Software

o
4-1

O
0!
CO
4-1
O
O
r)

M
CU

d>

i-J

4-1

O
4-1
O
W
CO

C
-H
O
ft

CU

T)

MH

0)

4-1

TJ
_

m <a us
p

Vl

CO
3
4-1

43
M
O

CU M S-l
t3 CU O

t5CU $O
W 43

43
<d
O

tJ

M
& ^

CO

M-l

O
CJ

g G
P -H
CO O
v; ft
O

J5 "u

ra
T)
O

rH

VO
^J1
^p

rH

CO-

CO CM
CM Q
rH CM
TO- VO
=N= TO-

<
o

O
rH
rH

rH

0 VO
Q TO

i
D

CJ
rH ^31 rH
rH f-^ rH
VO vo VQ
TO- TO TO

o o
Q
CO

31
rH
VO
TO-

<3CM
rH
VO
TO

r-

o o
Q =p
r^
Q

rH
VO
TO-

00000446

0001

g g

^
rH

rH

CU

T3

o w a
g -r-i m

4-1
CO
4-1

J5

rH

01
G

rH

43

n)
n
43

cj en r- cj en O
co ro <; co B Pu
pi fa
f'l f"l CM fa
n co CTCM -a- Q

43

cT

4-1
CO
4-1

<d
0
^
43 g 43
CU
G

-=r r- O

o\

o o o
VO

VO

VO

o o o
o o o

0
VO
0
0

fV,

0
VQ
0
0

rH
VQ
0
0

CO <3>
O CM
O O

CO O
CO O
< VQ CM O <. VO
3 VQ ^31 VO *3< VO r- vo

C &j CT vo cj CM 00 (< CJ W
O O O o o
W W fa
fV,

CU

cT

4-1
CO
4-1

CU

43

00000674

o o

rH
,

00000010

^
CU

000062D2

CU

rH
rH

000012BC

JG
(0 4-1
4-1 -H
CO

rH

CU

(Q
3

-r|

c*

4-1

O
G

O
^P
pq vo r- co W

Q
>
H-

4-1

(0

p
o

4-1
0
CU

<S
ft
rH
H g
<8 0 O
CJ O CJ

-H
i-H
(0

tr

r!

r-

CU
4-1
CO

4-1
CO
(U

rH rH
VQ VO
0 0
0 0

O VO
rH rH
rH rH rH rH
VO VO VO VO
O 0 0 O

o o o o

co ffC
rH
rH
VO
O
0

rH
rH
VO
O
0

^
(U
O

43

P*3*

3*
O

r- O

fS,

C-

0 O

rH

3" VO CO VO

CJ W O CM
rH rH CM CM
rH rH rH rH
VQ

VO

VO

VO

O O o o
0 0 0 0

311

0
0 CM
rH rH
TO TO=S=
*
jj

CU

<0
^1

CM CO
rH rH
TO- VO
=8= TO

rH

cu

CO rtj
CM
N
VO *sp
TO- =8=

rH

000012BC

CU

J^
j_!

0100

<

0)
CO

en
cu

O
CU

O
4-1
0
CU
</> 03

4J
CU

CO
y
O
0)

O
0
rH

r-

r-

CU
<H
t-(

J_)

T3

4-1
CO

VI

!-l

(U

CU

'<d

CU M

-a
o
o

&

tr
CO T5

43 <0

VO

rH
0
0

O 43

"31

0
CO

co

CM
rH
(k. CJ

o
o

O CJ
P3 ro o co rrH CO O
CO CM VQ m pq

CT O CM CT
O CT O
VO CM O 0
VQ CT VO

3CM
rH
VO
O
O

co <; cj w o CM

CO
CM
rH
VQ
O
O

M
CM
rH
VO
O

CM CT
CO CO
rH rH
VO VO
O O

fa

fa

o en Q

CO
rH
VO

o o o o

CO
rH
VO
O O O
o o 0

CO
rH
VO

CO
rH
VO

<

CT
rH
VQ
O
0

CJ

"SP
rH
VO
O
0

vo

M
C
3
M
P
IM

to c
W

LO

W
H

VO

T -a1
CO

vo vo

0 0
0 0

***********************************************
vo

VQ

En
En
En
VQ

* 0< ^p
* vo vo
* 0 0
* 0 0
E 48E70704 movem.l D5-D7/A5, - (A7) Save registers
-H
ft
IB

4J

3
U
0)

o
cu

G
X -H
rd

4J

01
EH

CO

4J
01

CM
IT)

<u

ffl -H
G

VO

r- o

rH
VQ

CD

ft

CM
tH
O
O

CJ

VQ
IO

VO VO
O
O

o
CO
T5

0
rH

r^

==
Vt

0)

o
o
o

W CJ

ffl
W

CO

10

o o

2F2E0008 move.l 8 ( A 6 ) , - ( A 7 )
Address of the sector b u f f e r
610000D4
bsr
$6236
Calculate checksum
588F
addq.l #4,A7
Correct stack pointer
B07C1234
cmp.w
#$1234, DO Equals checksum for boot sector?
6704
beq
$6170
Yes
4240
clr.w
DO
Not executable
6002
bra
$6172
7001
moveq.l #1,DO
Executable
3D400012 move.w DO,18(A6)
execflg to 1 = boot sector executable
4AAEOOOC
tst.l
12 (A6)
Serial number
6D3E
bit
$61BA
Negative, don't change
202EOOOC move.l 1 2 ( A 6 ) , D O Serial number
BOBCOOFFFFFF
cmp.l
#$FFFFFF,DO
> $FFFFFF ?
6F08
ble
$6190
No
6100FED8
bsr
$6062
rand, generate random number
2D40000C move.l D O , 1 2 ( A 6 )
Save
4247
clr.w
D7
Clear counter

-H

VD VD

CM
V O V Q V Q V Q V Q V O f r*-E^f^r"-COCOCOCOCF*
<1 t1 *t f~l l t1 t1 t1 t1 t1 *~H j-H t1 t1 t1 i1 iH
V O V O v O V O V O v O v O V O V O V D V O V O V O V O V D V O

O
0 0

o o o o o o o o o o o o o o o o

C
0
4
6
A
C
E
0
2
6
A
C
0
6
8
C
0

proto bt, generate boot sector

LO

312

&,

(!)

o
Q

Vt

ffl
vo

CO

o
CM
o
vo

vo
o o o o o o o o o o o o o o o o o

VQ

<

CM

cu
o
g

o
o

CM
0
CM

and.l
#$FF,DO
Bits 0-7
D7,A1
Pointer to next byte in buffer

en a\n

8 COBCOOOOOOFF
E 3247
move.w

Abacus Software
Atari ST Internals

4)

g
3
G

r-i

vo vo vo

o o
o o o

-H

Id

!H 01
0)
43

CD

4->

<D
3

4J

3
CD

o m

i i (a1 1

G
CD
g
g
CD O r-) O] (D
01 4J T)
M
0
P -H C
TS O
rH
M
Id G G G
05 M < H
PH
S
M

>!

<a 43

r-l CD

0!
T)

rH O
Q
< rH
v

>
Id

>i
43

1
CD
G

id
o

4J
0) G
N O
-H TS

0)

MH
O
01
01

CD
-H tr 4J
01
01 CD G
P
0) CD 0 CTl O
4J > 4J rH 0
4J -H 4->
CD 4J CD 01 H
O
X Id
01 bi
CD

CD

d)
0)
iH
JS O -r) 0) -H -(H
H IS Q S Q EH O

VO
Q

VO
<

VO
,, Q

, .

s~. v o o c M r - Q w
V O C O t < C Q r H Q
sOT
(,
* *-"
*.
".
*. CO rH

O
CM CO O
rH V.
CO Q
rH =tfc Q
4t= =S

\Q

CO

VO

^ FT3 fQ (T)
"^
"' fH ~ rH
VO VO
i-l >

VO
rH

</}

CM
rH

rH

CJ

CU

rH

CD CD

rH
-

|5

CD CJ*

T ) > > J H > T S Q , 4 J


O O O M O T S g r H
< d g g l d g l d 0 4 3

&
-P

-P

<H

-P .0

CD
>
0
g

3.

0}
rH

r-

VO

> Q

3
g

<d

rH

r-l

,5

Q)

TS
TS

P.
0

rH

<c o

rH

T!
^
O T)

4J
G

CD

rH

>i

e TI

rH

SH
in

<d

T)

CD

CD id
H CD
O H
G

!H
TS
TS

H-l
3

ca

H < IS

[
O
Q ro CJ
rH rH
rH </> VO
== == <0

.3
fi .p
g rH
O 43

cococj

on

co

rHCQ

O O O
O O O
OOO

O
O
O

O
O
O

rH
O
O

rHrH
OO
OO

O
O
O

OO
OO
OO

J5

^,
CD
13

co s

S X

P CD

1
^^
VO

i^C
-
VO

1
J5

<_)
rH

, , CM
VO O
CM
VO
CO <0

VO
0

^_^ Q
VO

ft

Co

~"

--

t VO
_^, 1

<p
I

*^3
1 ^^

^1

0 CM
Q
*

H
rH
*
5:
CJ1
CD
Q) CD
id r* > TS TS
^
O
O 0 TS TS
43
g <d <d

rH

CJ

O
Q

VO

^i

!H O
0 g

o
rQ

g.
S 35
rH ^

CD
cr* O*
0)
> T! > TS TS
O o O TS T!
<d g id id

CU

O T)

VO

s5

0 rH
0 rH
*. VO
rH
VO
VO , , Q
, rH rH
^
rij
*- VO
rH
1^
CO Q
*
*

J5

CD

o
*.
O ^-*

*
43 H

rH

CQ

ol PL,
to rq

M TS
CD id
4J
G 01
P 3

01
01
CD

"M
0

om buffer
cksum generation

CO

01
1H

ounter
>

-H
43

the prototype BPB

01

uals pointer to prototype BPB

-H

ounter
copied already ?

ddress
of serial number in buffer
(0

4J

Atari ST Internals

1
|

Abacus Software

PL,

fe
tty

RCCO

<O

rH
hjO
tn
fa
ft,
O
h O
fa
PufJH
O
feO
Pn
falii
i
Cd'<3'CMCO'3'cI'(^QVOCMC\lfc)^rrH'KI'=P|ijir)^i''r--ti5VOVOOVOrHVOS!;
C O ! r ) O O Q C M H Q < Q O Q C M O O r H C M C O r H C M r > a W Q C M Q O O O r H ' 3 '

Wowooi^Oi<WcoplcJr-vor^HvocJrHVor~o !rHPJWPt30iaia

r H r H r H r H r H r H r H r H r H r H r H

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

313

006202
006206
00620C
006210
006212
006216
00621A
00621E
006220
006224
006226
00622A
00622C
00622E
006232
006234

202E0008
DOBCOOOOOIFE
BOAEFFFC
62E2
303C1234
906EFFFA
226EFFFC
3280
4A6E0012
6606
206EFFFC
5250
4A9F
4CDF20CO
4E5E
4E75

move . 1 8(A6),DO
add.l
#$1FE,DO
cmp.l
-4(A6),DO
bhi
$61F4
move . w #$1234, DO
sub.w
-6(A6),DO
move . 1 -4(A6),A1
move . w DO, (Al)
tst.w
18 (A6)
bne
$622C
move . 1 -4 (A6) ,AO
addq . w #1, (AO)
(A7) +
tst.l
movem . 1(A7)+,D6-D7/A5
unlk
A6
rts

006236 4E560000
00623A 48E70300

clr.w

D7

link
A6,#0
movem.1 D6-D7,-(A7)

**************************************************

00623E 4247

$624E
8(A6),AO
(AO),DO
DO,D7
#2,8(A6)
12(A6),DO
#1,12{A6)
DO
$6242
D7,DO
(A7)+

600C
206E0008
3010
DE40
54AE0008
302EOOOC
536EOOOC
4A40
66E8
3007
4A9P

bra
move.l
move.w
add.w
addq.l
move.w
subq.w
tst.w
bne
move.w
tst.l

006240
006242
006246
006248
00624A
00624E
006252
006256
006258
00625A
00625C

Buffer address
Plus $1FE
Last word already

Checksum for boot sector


Subtract from previous value
Checksum in buffer
execflg
Boot sector executable ?

Increment checksum, not executable


Restore registers

Calculate checksum
Save registers
Clear sum

Address of the buffer


Get word
And sum
Pointer to next word
Number of words
Minus 1
All words added already ?
No
Result to dO

s.

M
vf

Atari ST Internals

0)
rH
01

CO

3
C
01
fl

r- O

0)

-H

01

CM

o
CO

******************

P
-tVO

rH

e"

01
rH CO
C 4J
3

rH

Ht
Ht
Ht

U
H
O

1
0

-rH
4->
-rH
CO CO

Ol

CO

-rH

0)

fl

CO

0>
f>

rH

MH

Q 4-1 4-1
T3 01 X
fH C5 w

-rH

VO

00

rH

io
s

i
co

3
G

CO
4-1

O!
4J

13

O Xi

O
S

CO jG
4-1 4-1
-H -H

rH

En
O
P

rH
P

rH
P
*s

VO
rH
rH

CO
CO

rH

4-1
X
01

G
<S

Ex
EM

rH
CO

(0

ios

X)

4-1

73

01

X
01

C
<0

P
VO

2=
rH

M
O

to

0
4-1

MH

rH

ffl
CO

0)
4-1

G
3

CO
4-1
rH

He
He
He
He
He

0)

-H e>
O
ft <
-

<8
4-1
K

01

>

f>

-H

rH
CO
X!
0! CO

CO

rH

MH O P

rH

ffl

rH

rH

3 3 3
01

CO O
M O

-H
M
TJ

"O

ft
o

X}

i3 4-1 4-1 O S

[~-

01
4-1

rH

G
-H

0)
X!

co fl a 0) x
M sn < o w

rH

m
rH

4J 0
-H
ft
O Q
0 X! 0
4-1
G
0! -rH co 3
0! 01
co o O 4-1 G
O 4-1
C CO 4-1 01 H C IB -H
01

ST
1

ini, initialize drive

0)
4-1
CO
-H

in
i

rH

0)

-H

******************

CO

ffl

01

x -o

rate
ult error number
k number to zero
lock, set parameters
ct drive and side

convert 8086 number to 68000 number

1
|

Abacus Software

X ffl
01 MH
0! 01
CO P

01
rH

0 ft fl)
10

rH

rH

rH

fl)

4-1
CO
0)

EH MH efl

rH

rH
rH
O
rH

CO
CJ
VO

CM

r
CM
rH

en
CM
VO

CJ
CJ

rH
rH

VO

=s=

CO
VO

CO

r- en
vo vo

o
o
EM

CO
VO

VO

=*

rH

ey
<0
01
rH

J
CO
4-1

tr
01

cfl
01
rH

>

CD
o

s s

rH

3
JS
rH
rH

w
CO
Q

rH

CO

X)

ty
rH

CO

>
o

X)

CO
rH
VO
0
0
0

vo
o

rH

Ed

He
He
He
He
He
He
He
He

*
H*
e
He
He
He
He
He
Ht
Ht

Ht
He
*
He
He
He

o
CO
O
O

EM
P
0

CM
VO

EM
[-!

w m
in r~
[V}

[V]

31

f] CM ^r

U CO

VO
CM
VO

VO
CM
VO

0 0
0 O 0

He
*
He
He
He
*
He
He
-3c
*
He
*

w
in VO
w o

CO

o O o
CO
CO
3*

CM

00
CM
O
rH

rt^
VO
CM
VO
O
0

E]
VO
CM
VO
O
O

<M

^I1

VO

VO
VO
CM
VO

fi.,
EM

rH

o O
o o
o o

r^

CM
VO

o
o

CJ

[
CM
VO
O
O

3*
rH
W
00
[-~
CM
VO

0
0

EM

o
o
o
rv]
VO
CM
CM

<J
[
CM
VO
O
O

0
O
rH
rH
CM
rH

rH
CO
CO
gl

pq o
r^ CO

O rH
CM
O

CM
VO

CM
VO

CM
CO
CM
VO

O
0

o
o

O
0

[V]

5T
O
CO

in

VO

CO
CO
CM
VO

CO
CM
VO

ia

m
H
(dj
CO
CM
VO

o o o
o

315

Ht
*
He
He
-}e
He
He
He
He
He
He
He
He
He
He
He

CM
0
O
O
O

O
CJ sr

CO
O
VO

VO

*T

o 0
o 0
o o
0 o
0 o
en en

o
o
o

CJ
O
0 0
0 0

en

o ffl
o
o o
en o
VO o

VO

en
vo
0
0

0
0
0
0
0
EM

Eu VO
EM
CJ
0
CM VO 0 EM ! EM
CO f r- n m o CM rH rH CO

*r

^p

CJ CM
CO en
CM CM
VO VO
0 o

o o

ro P^
VO CO w VO
<n en en fQ
vo

CM
VO

CM
VO

CM
VO

o o o
0

CM
VO
O
O

CO
*3*
CM
VO

O
0

VO

VO

CO

<=r

<;

CM"
ffl

CM
VO
O

CM
VO
0
0

CM
VO

CM
VO
0
0

CM
VO
O

VO

m ffl ffl
O

tr
cu

(0

X! XI

*
-X
-X

^
w

o t-iCO

CO

M
CO

rco
vo

vo"

<c

O
0

en
<*

en

cu
CO
>
c o o

CU

cu

>
o

X) XI E E E E E

IB
CO
K

Co

<

-H
4-1
CO
N
IB
-H
4-1
-H
C
M

Q
0
0
O
O

rH

%o

cu

O
CO

M
CO

CU

o
o

E XI E

CO

CO

CO

in
CO
vo
CO

4J
CO
4J
X)

er
cu

X)

Decrement timeout counter

M
O
4-1
O
CO
CO

Read multiple
wdiskctl, pass D7 to 1772

o
o

4-1
3
0

4-1
O

o
-H
EH

CJ
CO

vo

CO

$FFFF8609,$69D(A5)
dmahigh
$FFFF860B, $69E(A5)
dmamid
$FFFF860D,$69F(A5)
dmalow
$69C(A5),A2
Current DMA address equal edma?
$631A
No, continue to wait

CO

VO

IB

#l,D7

vo

EH

3
O
O

,b
,b
,b
L

XI X)

t-l
CO

CO

T*

^CO cuc

CO

IS
CU
rH

1H

cu
4-1

,1

CO

cu

re)

$ 6 9 2 ( A 5 ) , A 2 edma, destination address for DM.


#5,$FFFFFA01
mfp gpip, 1772 done ?

fa
en
vo

4-1
O
CU

rH

,1

CO

CM

-a

rr~

#$90, D7
$69C4

w o
o O
03
vo VO

CM
VO O Q
CO CM CO CO
VO VO vo
CO CO CO CO

CJ

-H

-H

4-1
CO
4-1
CO

CM

,w

H-l

CU

CO

#$90, (A6)
Data direction to READ
$68C(A5) ,$FFFF8604
ccount to dskctl, sector counter

rH

CU
tn
C
IB

G
IB

t-l
S-l
CO

,w
,w

cu ^
m

ni

4H
ft
O

4-1
CO
(U
4-1

#-l,$6A2 currerr to default error

o
ft
o

CO

,w

4-1
CO

oCO
-H

go2track, search for track

cu
n
o

.
,-H
^ -H

CO
-H

$68AE

o
c

cu
en
<a
O

Error number to read error


floplock, set parameters

t-l

t-l o
t-l !-l
cu H

Atari ST Internals

I.I #-11, DO
$6768

r*******************

floprd, read sector (s) from disk

Abacus Software

er

cu
cr cuo
ft
o o e
E E E u

XI

3 (U
CO X)

4J

tn
X!

-X

*
X
X

*
*
*
*
*
X
*

o
<^
in
0
o
o
vo
o
TI

CJ
CM
VQ
O
O

CJ CM

^J1

o
CO

in
o
o
o
o
vo
vo vo vo
t
a* VQ <^

m
o
o
o
o
vo

CJ

H
CJ CJ CJ

CM
VO

CM
VO

CM
VO

CO

o
0

VQ
O
O
O
f1

CM
VO

o
o o o
O O

-X
X
.

co

fV]
rH

O
[

* o in
* o fa
X
rH o
* VO
r
*
X
CM vo
X
O Q
X
-X

*
*

sp

CM
f
VO

CM
VO

CM
VO

03
^T
O
O
O
rH
VO
03
Q
CM
VO

p 0 o

VO

CJ

vo
o
o
o

m
o
o
o

rH
VO

rH
VO

CM
VO

CM
VO
0

Q CO

en
0
o
o
o
vo
vo
*gi
CO
CM
VO

o
0
o
o
o
fa

fa
fa
fa

0
CO
CO

fa

CO

fa
fa
fa
fa

CO CO CO CO

o *y

vo

VO VO VO VO
O O O O
O 0

CO CJ
CO fa fa fa fa
CM CM CM CM CM

o o

316

O
fa
O
fa
O
fa
O
fa
^P CM in
O en o
0 vo 0

en
vo
o
en
0
vo
CO

CO fa
en en
vo vo
o o

ea

vo
CO

Q
0

VO
CO

o vo
CJ
fa fa fa en
en pa
fa fa fa vo
0 vo
fa
fa
fa
o o o o o
fa fa fa o
O o CJ Q en 31 r^ ^r en en en Q *3*
r^ PO Q
CO o co vo CO CO CO CM r^
PO rH CO 3* CO r- CO
pa pa in PO
pa t
(
rH rH pa VO
CO CO VO CM CM o vo m VO
^p CO CJ O VO f^ CM ^ji vo CO O 03 o vr
o o o rH rH rH CM CM CM CM CO CO 31 ^r
CO CO CO CO CO CO CO CO CO CO CO CO CO CO
vo vo vo VO VO VO vo VO vo VO vo VO VO vo
o o o O O o o O o o o o o o
o o 0 O o o o O o o o o o o

o o o O o
en en en CO 03
0 rH 0 vo 0
o o o o o
CJ CJ CJ Q o
pq P3 H ca
pa
CJ CJ O CO o

CO

o O
o o
o o o o o o

rH
O
pjj

o
vo

CD

>H 0> T3
* CD CO -. Q, > to
e o r d r - H < B i < c o . - | - i - | f a O ! - l 4 - l

Q) M 4-)
CO 4J O

in
vo

CM
CO
CM

en n
vo VO

rt

VO
O>
CM

CMen
|

CD i ' Q) CJ) IS Q) Q) "(5 S2J ' 1 to Q) {3 (D (!) G O


P5 w w pi Q >H tfl M K I-l CD M E3 to M < 2

vo
r-

vo vo

<

en io

0
Q
O

vo
co
vo

o
Q

CO
0 Q CO
CO en

vo

0 CO
CO

vo vo

*
0)
rd > ^_i rd >
C^
O to O CO ^_) O
J3
JO X!
A
0)

CD

>

4-)
CO
4-J

O
.Q

tr
0)

CD
>
O

CM

vo O

CM
CO

a tr
c CD
rd A

^4
CO

fV

CJ

o
o

Q
CM CO
VO vo

co
vo vo

_l
CO

to
0)

in

CM

rvo

CD
G

i-l
CO

&

tr

>

,-\.

rd

^4
ffl A JQ

rror, take default error

o
3
O

error ?

&
i-i

c
a
o

.p
-H
^1

*******************

(D

ek, home and reseek


ycnt, decrement attempt counter
her attempt ?
flopfail

t, end transfer

^i
i-i
o

CO

CO

its, 1772 status in error number


e protect ?

Atari ST Internals

err to timeout
t, end transfer
t next attempt
ct DMA status register
status
rrror ?
try again
ct 1772 status register
kctl, read register
isolate checksum und lost data
ok, no error
its, determine error number
ycnt to second attempt ?

Abacus Software

&

CD

ra 4-1
0) CD

CO 0
(D CD
>t K

Q)
>H

PH
O

<H

Q
rH
rH
(3
^ 0 < Q O r t Q O r t
C O Q <
- Q <
^ Q < O
rH
.COCO
sCO'ST
sfOrtJ
I
VO VO I -31 VO I CO VO

tr

tr

tr

> a CD > co CD > m tr >


o - u q o p c o p CD O
g > f> A f t g >
rQ

CM
r
VO
0

vo

CM
I
VO
fS^

en

o
o CJ CJ o
o O r- o

H CJ

a
o

pLj

pE-t

ft|

o
o

CO (H O c^)
CO VO VO CO

i-H
VO

O
VO

vo
^p

fiC 0CM

O
0

o
CO
o
o

ia

o
CO

o
o
vo o CM CJ
rH o rH m o (O o
O CO r^ CJ .-H o t~
vo CJ vo
CO o vo

vo CO CJ
in m m m

CM 3*
VO VO
CO CO

CO

CJ o

rf.

r-)

CJ

vo f( en
vo o ^p
o o o
o CJ o

CM

eji

<F

r- lO f-~
vo
^P
o o &4 O
Q 3" o Q o o
VO o o VO o o
CJ vo j-H CO rf* o
o vo vo in vo vo

0
CO
t-t
xH
VO
sP

o
o

VO

EP

CJ

p=3

CM
CO
CO
VO

vo

vo vo r~ ( p- 1 p31 ^1
I/)
CO co
co co co CO CO
(0
ro CO CO CO CO CO CO
CO co
vo vo vo vo vo vo vo vo vo vo vo vo V0 vo vo vo VO
VO VO
o O O o o o O o o o o o o o o o o o o o
o o o o o o o o o o o 0 0 0 0 o o o o o
(O

fT)

317

*
*
*

vo
o
o

^p
o
o

n
o
o

o
<
vo

O
O
0
0
C O O 1 C O O C J C J O ' 3 ' Q
p t t O t - H f i ^ O O P ^ O O C M
C M C O V O C M C O V O C M C O r ~ C M

t o v o r ~ o v O r ~ o v o c o
WO-a'VOcocjWO'a'VO
coenenenenenen^ie^r^
cococococOfOcorOfOco
V O V O V O v O v O v O v O v O v O V O

o o o o o o o o o o
o o o o o o o o o o

VO

m
CM

vo
Q

s
0)

CO
11

-X
-X
-X
X
X

4-1
CD

CO

-H

id
S-l
CD

SH

4-1
Q)

G
CJ

CM
fa
VO

a
4->
CD
01
X
O
O

SH
fl>
G

O
CO

01

o
CD

co
ca a
SH

CO
O

-H
CO
O

in

in

o
CO

0)
0

d>
SH

p
in

I
1oid
2

0
4->

*,

-H
TJ 4->
<D 0)

CO

Q Q

t CO
vo vo

CO

a o

Q vo
CO

rH
=tt=

<

CO

Q Q CM
CO

vo vo vo

CM

VO

o
>M

C
-H

SH id
ca
CD
CO

X
o
id

SH
4J
CM
0
&

SH

CO

in
vo vo
CO

SH
0)

EH
(-H

er s
^
o 01 o j

CO

s.
-1

(U

c o

^
01

SH
CO

43 43

4-1

SH
0) CM
r~r~

rr-

CM

(U

rH

rH

CM

4-1
0]
-rl

cn

0) O
C SH 4-1
0
-H 4-1 r~

4->
01

tJ
CO

-H

CO
4-1

G
3
O
O

3
O
U

(U r4-1 rr- C rH
O CM O Q 3
f 4->
O
IK ro
0
-H
H
CO rH
4-1

01

tJ
X

w
tu

H
CO

4-> 4-1 <H


3 d) 01
O
G
<u
cd
SH
-rl 3 4J
4-> O
4-1

o
o
0)
1

1-H
(!)
4-1
SH
0)
01
O 4-1 01
-H
ca CO
"H <H 0) (1) 0 CO
0) SH
CA
Q
SH
Q CO 1
S 1EH S >H

rH
CJ

SH
O

CO
H

(D

ti

X
01
H

&

rH
0

vo
o
en
rH

vo
0

cn
in-

vo

M CO <u
0! G o o
43 43 s s

O
E

c
Q fa

vo

o rcn O O
vo

*
pH

43

O
4-1

01

rH

CD

o
a>

4J -H 43
CO

CD
CO

SH

Ci

a O
o tu

CO
VO

S-l

d)

rH

rH
HH

4-1

currerr to default error

SH O'
d) rH

t-l,$6A2(A5)

******************

01

id
M

CO

,w

3
CJ

Id

select, select drive and seide

0)
SH

X
o

$6948

SH

Atari ST Internals

(U

j.l i-10,DO Default error to write wrror

flopwr, write sector (s)

on disk

Abacus Software

Q
o
CO
rH

0 O

fa
O fa
o fa
o fa
0

cn a1
vo
in
"*> vt =*>
*
S

O r- CO M
rH Q o CM

cn

VO

rH

VQ vo

=*=
rH

(U

01 O*
CD SH
> SH > ^
o O CO O O CO o fl 1 0) 3 G 01
s S 43 s e 43 5 43 43 CO 43 43

*
X
X
X
*
*
*
X

CM
VO
0

*
X

CM
VO
0
rH
qi

*
-X
in

r^
W
CO ^r

cn

<
<5

X
X

*
X
*

-X

CO CO
VQ vo
0 o
0 o

X
X
X

rH
O
rtj
fa
O fa
0 fa
o fa
0 fa

o
ffl

0
VQ
0
O
0
rH
VO
O
ffl
CO
VQ
0
0

0
VQ

fa

o
fT

vo

CO
CO

CO

o Q o

0 CM 3*
rH 0 CO
VO

to m

VQ

< H

CQ

ra

1^1

^
C
O

vo vo

vo
o

ffl

CO CO to
VQ vo vo vo
O 0 o 0
0 0 0 0

CJ vo 03 W fa 0 0 0 cH o 0 o
^* in
en
CM 0 Q CO
m r- Q j-^
CJ o 0

vo in
o 0
o o

fa
O o fa
O 0 0
0 0
rH vo
VO vo co

r-)

t_j
0 O
{_) CJ
fp
CJ CJ
co CO

a vo CM
o
vo 0 0 0 0
m
o vo o rH rH
o
CO vo c VO VO
o =p 03 f O O =p CO CJ CM vo ,.;;
w &3
o CJ CJ o CJ Q Q Q Q
CO
CO CO to CO
CO co CO CO
vo vo vo VQ vo vo VO vo VQ VQ vo vo
o 0 o 0 o o O o O O o o
o 0 o o 0 0 O o O O o o

Q
VO
0
CO

318

o in rH o
o o O o
CJ o {_) o
co o P3 co
M ,i CJ ta
CO vo co to
CM vo <
w
fV) fa
fa fa
to CO CO CO
vo vo vo vo
o o o o
o o o o

vo
rH

in o o
If)
o o o
O
o O cn f^ r- CM o
0 to co o 03 fa
o
rH ta CO P- CO VO rH
VO CM 0 vo
vo VO
(a CM CO 0 CM q, VO
fa 0 o rH rH rH rH
CO "=T
CT
vo VO vo VO VO VO VO
o O o o O 0 0
o o o o O o O

Atari ST Internals

fd
4J

id
o

o o

VD

to

id
^
43

CO
ft

J-(
CO

g 43

4-1
CO
4-1

O!

0
0)

s
01

i!
s

43
0
G

43 43 43 id

G
-H
id

4-1
01

id

01
S-l
O
G
4-1 -H

to
0
W

0
0)
CO

CO

oG

3
G
S-l
O
4-1
O
0)
CO
rH
4-1
O
r-l
0)
CO

s
tf
tr
o a 43 tr
o 3 a>
,)

0)
C TS

43 (d id

CO

4-1
4->
M

X
Ol
01

id

01
CO

0)

4J
C
O)

to
U
CD

o o

4J~

4-1

4J
01

id
fi
o

0)
4-1

CO

n
G

0)
CO
CO
0)
to

>!

4J

id
4-1

in

in
CM

CM

s-i (d
CO

S-l

43 43 43

s
a

0)

S-l
CO

o 43 43

tr

43

3
CO

rH

a
43

rd

to

43

ra

,3; CJ
-1 "-1

O =r
CM CM

vo vo VO
0 0 o
o o o

vo
o

CM CJ
Q
0 CO o
o 0 o
0 0 O
o 0 CO
CO vo 0
0 VD CJ
CO
CM

o
CO o O vo ^3*
CO 0 CO O CM
vo o VD CO m

CM

0
CO

VD vo vo VD
O o o o
0 0 0 o

CM

r-

VD
O
rH
O
O

o
CM

CM
VO
t

N t-
VD en
EH CO

o 0 0 0 o
o
O o
Q Q 0 0 CJ Q ^i O Q 0
vo
vo 0 o
vo o O VD O
vo
rvo
co
rH o O
rH CO f
CM
vo m o in VD VO vo o vo VO m vo
T VD fS. CM VO < W 0 vo 03 O o
CO CO CO T T =p sp in m in m vo
vo vo vo vo VO vo VO vo vo vo vo vo
0 0 o 0 0 0 0 0 o o o o
o o o o o o o o 0 0 0 o
*3* Q

rH
VD

319

o
0
o
0
vo
*r
VD

VD
O
O

to
o
1-1

4J

id o

S-l
0)

3
G
U
-H

rH

n
<H

1-1

*
*
*
*
*

Ed

VD 03
CO
VD
rH
En
O o EH
^3*
o 0
CO PQ o O
o O rH rH
vo CO VO VO

X
CO
-H

id

vo
o
o
o
o

<s>

C"

CO

CM

in

3
0
O

CO to CO
r[ O <*C vo o o
o vo ^, vo w O CJ vo
in to CM tofc. o { a to m r- to Q 0
OD
CO en CO
CO CO
vo rH^ in rH VD VD VO rH VD VO rH vo VD
to * =8= =tt= to to to * to to * to to-

co

*
*
*
*
*
*
*
-X
-X
X
X
X

CM
CM
rH
CM

No, flopfail

flopfail, error

M
0
4-1
O
0)
CO

EH

Q 0 O
CO
VD VD vo t/>
to 3t= to ==

^t
CO

3
C

4J

Another attempt ?

errbits, calculate error number


Write protect ?
flopfail, no further attempt

CO
X
O
(D
fi
O

M o o

to
<D

CO
Q CO

en
to vo
^ to
U

0)

id

Default error number


floplock, set parameters
select, select drive and side
, $ 6 9 6 ( A 5 ) spt, sectors per track
,$698(A5)
interlv, interleave factor
,$69A(A5)
virgin, sector data for formatting

to
0)

-H
O

Write next sector without seek

|
(A6) Select 1772 status register
rdiskctl, read 1772 registers

rH

68E(A5) cdma, DMA address to next sector


C(A5)
ccount, decrement number of sectors
flopok, all sectors, then done

S-l
O)
4-1

4-1
CO
O

z,

|
1

|
|
|

|
|
|

Abacus Software

4J
CO
0)

oT
o>
G

id
o

^* ^.^

,
VD 0 CM Q CO CO r- r- rvo ^P f rfl *3*
r- o [V,
co CO a\o rH r- 01 '
VD vo *T o vo
to vo
1 to

to to
to rH CM CM
rH
rH

cf

cu

s
0!

^
0)

* a 01 S-l
S-l to
g C CO o CO CO o o
-X
* o 43 43 g 43 43 g g
X
X

|5

0)
O
g

*
*
X
* vo
* rH
-It o
X o
VD CO rtj
* rH
en en en
* CM
VD vo VD
X CO
*
0 0 0
fV]
X in
CJ
CJ CO W
X vo CO
O o rH rH
X r- CO [
0 O O
m
CM
X co o o
0 0 0 O O
X EH 0 0 pH 0 0
EH EH
o o EH 0 0 vo vo VD
*
X CJ VD rH 0 rH rH CP PQ CO
X o VD vo r- VD VO CO CO CO
-X CO o 3< 03 < W CM CO M
r- r- r- r- CO CO CO
X vo
C
X vo vo vo vo vo vo vo VD vo
-X 0 o 0 0 0 0 o o o
X o o o o o o 0 0 o

to

006494
006496
00649A
00649E
0064A2
0064A8
0064AE
0064BO
0064B4
0064BA
0064CO
0064C4
0064C8
0064CA
0064CE
0064D4

7002
61000592
610003CO
66000360
336D06860000
3B7CFFFF06A2
6128
6600034E
3B6D0696068C
3B7C00010688
6100015C
246D068E
4A52
67000342
3B7CFFF006A2
6000032A

3B7CFFF606AO
363C0001
246D068E
323C003B
103C004E
6100010A
3803
323COOOB
4200
610000FE
323C0002
103COOF5
610000F2
14FCOOFE

moveq . 1#2, DO
$6A2A
bsr
bsr
$685C
bne
$6800
move . w $686(A5),0(A1)
move . w t-l,$6A2(A5)
bsr
$64D8
$6800
bne
move . w $696(A5),$68C(A5)
move . w #1,$688(A5)
bsr
$661E
move . 1 $68E(A5) ,A2
tst.w
(A2)
$680E
beq
move . w #-16,$6A2(A5)
$6800
bra

move . w
move . w
move . 1
move , w
move . b
bsr
move . w
move . w
clr.b
bsr
move . w
move . b
bsr
move . b

$65FA
#2,D1
#$F5,DO
$65FA
#$FE, (A2)+

DO

t-10,$6AO(A5)
#1,D3
$68E(A5),A2
#$3B,D1
#$4E,DO
$65FA
D3,D4
#$B,D1

*****************************************************
0064D8
0064DE
0064E2
0064E6
0064EA
0064EE
0064F2
0064F4
0064F8
0064FA
0064FE
006502
006506
00650A

'changed1
Diskette changed
hseek, search for track
flopfail, not found
ctrack, write current track in DSB
currerr to default error
Format track
flopfail, error
spt sectors per track as ccount counter
csect, start with sector 1
verify, verify sector
cdma, list with bad sectors
Bad sector ?
No
currerr to 'Bad Sector1
flopfail, error

fmtrack, format track


deferror, default error number
Start with sector 1
cdma, buffer for track data
60 times
$4E, track header
wmult, write in buffer
Save sector number
12 times
0
wmult, write in buffer
3 times
$F5
wmult, write in buffer
$FE, address mark

o1

o
3?

)
1/3

Abacus Software

Atari ST Internals

<n
<U

CD

X!

XI
c

CM
tH
10

-H

a>

(U

-H
M
0>

X
O

0)

O O
4J 4J

M -H
EH W

CD <D
(O CO

<a -o o

e
CM a'
CM

Xi

^,
4J

-H

CM

id

o
,_!
id

O
O

fl> r)
4_) X)
-H
J_|

0]

K
(U

4J
H
-H
p 4J IO 3
[V,
g

3 CO 3:

V>

55

C
-H

o C
*H <l)
H-) 01 M
O
3
XI 4-1 4J
0
CD
01

{^J
4J

to
0)

-H C
4J -H

tn

s,

m
fa
</>

to
o
fl to

4-1

-H
C
-H

<d g

-H

VO
IO
CM

0)

d>
4J

-H
-P

H
O
ti

<U

01

4J

4J

<IJ

4J

to a>

0)

O1
<H

4J -H

Xi X! Xf
C U < U G } ( ] ) < D < D Q
<U
> > > > > > > M >
O O O O O O O 0 1 O

vo

fa vo

XI

f\M
01

CM

X!

X!
M
01

XJ

vo

c~
fa
Q =tt=

XI
<8

o
Q

io

fa CO
IO en

CM

vo vo
X!

rH

Q o

io
fa Q
vo

M o
(U
to o
X! id o Xi

00650E
006514
00651A
00651C
006520
006524
006528
00652C
006530
006534
006536
00653A
00653E
006542
006546
00654A
00654E
006552
006556
00655A
00655E
006562
006566
00656A
00656E

321

CO
Q

14F900000687
14F90000068B
14C4
14FC0002
14FCOOF7
323C0015
103C004E
610000CC
323COOOB
4200
610000C2
323C0002
103COOF5
610000B6
14FCOOFB
323COOFF
14ED069A
14ED069B
51C9FFF6
14FCOOF7
323C0027
103C004E
61000092
D86D0698
B86D0696

g g g g g g g X J g

0
Q

fa
fa
*

o
CO

fa

vo
CM

r10
vo
o
o

CO

on
vo

CM CO
fa rVO

10 ^P IO
vt </> vo
=t(= * -u>
S Xi

2
f>

a,

0)

rH
0 XI

<J
> M
O 01
X)

5243
B66D0698
6FOOFF76
323C0578
103C004E
6172

N
CM

4J

006574
006576
00657A
00657E
006582
006586

PQ
fa

=r
IO

$696 (A5)

CO VO -3"

fa
IO

4J
O
0)

to

Q Q

CO
VO

fa
IO

CD
OJ

- S

move,
move,
move,

tH
Q IO

$69A(A5)
$69B(A5)

co

V* V*

move ,,b
move,,b

F,

CM

Q P

-H
>

move,
move,

rH

move,
move,

CM

4}

< <

< <

(U
1-1

4J
G
3

CM CM

CM

ra

M
4-)

01
3
H
P.

- 4,

-H

(1)
C
O

move,

1-1

0
>

Abacus Software

691FFFF860D
690FFFF860B
68FFFFF8609

VQ

O
CM
rH

=tt=

CU

>c u >a j>c uM > >c uMo ) > c oo ) t4 - r> 4 5 ty


a ) ! H >c u c o
O O O C O O O C O O - P C U 3 C ! O - P
g E 4 5 g g 4 5 g 4 5 4 5 c o 4 5 4 } g r <

3 0)
CO

0)

<U

> >

g g

0)

C"

CM

in
0

t
rH rH

cu

cu 0)

0) CO
CO rH -H

Q >H CO

VO
O CO o CO
Q Q CO Q
in rH CM
0 VQ to- VO

=tt=

to- *

-rl

ra

4->

0)
M 0)
S K

i fa

CM m

< vo
0
Q

tT
0)
4) 45

CO

CO

45

rH
Q

45

**

0)

0)

5g

M T3 CO
03 C 4->
fQ *Q JH

0)

ID

O rQ
S "o

fa

o
en

ro co
rH

rH

CO CJ C J C J W r H C J W r H t a c o r ^ C O V O r H W W
rH CO C O C O C O V O f O f O V O C M O V O i n V O V O t ^T

co

CO
CO

O
CM

CO
CM

Q Q
W W

o<d

H
CO

0
0 fa
0 fa
0 fa
0 fa
0 O O f a C M O O V Q q ' i n
CO
CM C M C M r H r H C O f a O O O
IO
rH O r H O ' = l 1 r H O q ' O O
CO
O
C J C J C J O C J C J O C J C M C J r ^ C N O r H i n

o o o o o o o o o
o
a o
pq c Q C Q c o o p q c o o c o c o o c o f a o o r -

o o o

en

$638E errbits, calculate error number


#$44, DO
Test write protect and lost data

CJ

CO

rH

CO

0)
(!) 4->
CO
-H

#$190, (A6) Select DMA status


(A6),DO
Read status

0)

cu

4-1
CO
H

,w
,w

,w
,w
,w

move.,b
move,,b
move.,b

$691(A5),$FFFF860D
$690 (A5) ,$FFFF860B
$68F(A5) ,$FFFF8609

dmalow
dmamid
dmahigh

4J
CO

#$90, (A6)
#$190, (A6)
Data direction to WRITE
#$1F,D7
Sector counter to 31
$69C4
wdiskctl, D7 to 1772
,w #$180, (A6) Select 1772
,w #$FO,D7
Format track command
$69C4
wdiskctl, D7 to 1772
,1 #$40000,07
Timeout counter
#5,$FFFFFA01
mfp gpip, 1772 done ?
$65DC
Yes
, 1 #1,D7
Decrement timeout counter
$65C6
Not yet timed-out ?
$692E
reset, terminate
j.l #1,D7
Clear Z-bit, error

CO
3

Atari ST Internals

o
f3*

^ P O O O O - ^ C O C J O V O C t l O C M ^ C O r i ;

t<rt;r<pqpqpqcqcjcjcjCiQQQC>
ininininininminininininmin
VOVQVQVOVOVOVQVOVOVOVOVOVOVO
o o o o o o o o o o o o o o
o o o o o o o o o o o o o o

in in m m i n
vo vo vo VQ V Q
0 0 o o o
o o o o o

322

rH
0
O VQ
m rH

O
O
Q

in
vo
0
o

o
0
o
0
0
CO

03
rH
O
CJ

O ^P
G\1
Q 0
0 fa 0
0 0 O

CJ

fa
fa

ro

fa cq 0 o co
0
CJ rH rH O
VO VQ O
co o vo
0 CXI vo 03 O O O'
pq
W
fa
fa
m m if) m m m in
vo vo vo vo vo vo vo
0 0 o o o O 0
o o o 0 0 0 0

fa

in
pq

O CM

5T

rH

in

CO
fa

<
fa
m
vo

CJ
fa
m
vo

in
vo
o
o

CJ O

o o

0 0

tx>
W

006600 4E75

3B7CFFF506AO
246D068E
06AD00000200068E
3B7C00020672
3CBC0084
3E2D0688
61000384
13ED0691FFFF860D
13ED0690FFFF860B
13ED068FFFFF8609
3CBC0090
3CBC0190
3CBC0090
3E3C0001
61000358
3CBC0080
3E3C0080
6100034C
2E3C00040000

rts

move . w #-ll,$6AO(A5)
move . 1 $68E(A5),A2
add.l
#$200,$68E(A5)
move . w #2,$672(A5)
move . w #$84, (A6)
move . w $688(A5),D7
bsr
$69C4
move , b $691(A5),$FFFF860D
move , b $690(A5),$FFFF860B
move . b $68F(A5),$FFFF8609
move . w #$90, (A6)
move . w #$190, (A6)
move . w #$90, (A6)
move . w #1,D7
bsr
$69C4
move . w #$80, (A6)
move . w #$80, D7
$69C4
bsr
move . 1 #$40000,07

************************************************
006602 610003EE
$69F2
bsr
006606 70F5
moveq.l #-11, DO
006608 6100015E
$6768
bsr
00660C 6100033A
bsr
$6948
006610 6100029C
bsr
$68AE
006614 660001EA
bne
$6800
006618 6104
$661E
bsr
00661A 600001F2
$680E
bra

00661E
006624
006628
006630
006636
00663A
00663E
006642
00664A
006652
00665A
00665E
006662
006666
00666A
00666E
006672
006676
00667A

flopver, verfiy sector(s)


Change, test for disk change
"read error 1 , as default error
floplock, set parameters
Select
go2track, search for track
flopfail, error
verifyl, verify sectors
flopok, done

deferror to 'read error'


cdma, DMA buffer for bad sector list
cdma to next sector
retrycnt, 2 attempts
Select sector register
csect, sector number
wdiskctl,to disk controller
dmalow
dmamid
dmahigh
Clear DMA status

Data direction to READ


Sector counter to 1
wdiskctl
Select 1772 command register
Read sector command
wdiskctl
Timeout counter

ft

in

B
B3

Abacus Software

M CU

& 01 0 E
M-l

CU

FFFFFAOl

s x

CU

-rH

4J
CU
01
CU

ca

4-1
X

cu

vo
r-

</>

U>

CM
m
VO

CJ
VO
VQ
</>

to

cr
cu

s
3

to

o
en
</>
*
g.

,_,

4J
X)

o
cu
cu

CU
c

t-t a
to

X?

SH

ft

(U

ca

C 4 J
- r H C
ca
o i f - t n c
3
car~
4-1S-4

rH ca 4-1 o

CD

T S 3
4 - l C U E H
Q c a O C J c B t o C U O
CB rH fU
r) 4-1
M r - i c B O ^ ^ O O
U
X X 0) <U

r ~ ^

0
CO

vo

VQ
O

^
4)
CD

4 - 1 0 ] ^

K r 4 K

01S-)4-14-lO4-lpS
4-lCU
CU
O X - H
( - 1 4 - 1 G J 5 4-1
K C U 0 1 X ) 4 J O C J 3 4 - l c a
C

<

c u S c u c u T i r H C U r H o i e j c T )
K Q > H W ! H C U E H f 4 0 C J < O

vo

o
Q
0
, , Q
VO
f o
"" =tt=

CO

CJ

vo
vo

!/>

J.
.

>

o o

0
CO
</>

CO

en n
vo vo

=*. </>
g.

4-1

vo
vo
vo

M
CO

V*K,
rH

*
2
.

X)

cr
CO
cu o ^

E E X! X)

CO
CO

CJ CJ
rH
</>
*

4-1
CO

0
Q

o cu "
G

E X! Xi ca

X!

C3

</>
1^
rH
*

c
o
^
^
4-1

cu

CO

ca

0)
M

X!

.X
CU

cu
CQ

(U

rH

rH

CU

0) .C

0
CU
Q

4-1

0
G
<

> *

cu

IK

4J
CJ
CU
CQ
0

0
4-1
O

cu
CQ

4-1
CU

CM
<

in

in

CM

CM

in

vo vo <
</> Q r^
K vo CO
rH vo vo
</>

VO CM
</>
^ ^
VO
rH vo

CO
CO

CO
VQ

o o
n o
vo CM
vo </>

o
4-1
O
CO

(U

rH

fc.

CM
rfj
*-~

CN

PQ
vo

vo vo
co-

S
cu
M
ca
X) rH
01 3 a o
3

S
rH
^
O1
X) CU X) n
3 G 3 rH
Ol X)
CQ
0

K
Ol
4-1
rH

so

0)
G
X! X)

cf

rH

01

XI E X)

u
O

o
o
a
en

0
0

S
Q

CU

CO
VO

<.
fa
fa
fa
fa
fa
in
o

CO

<c

K ( D C 1 ) T 3 C Q C Q

c a O > i r H r H ^ f a G G

rH
0

er\

Q.

3 4 J 4 - 1 T J E O 4 - 1
4 - ! C Q r a G O ) 4 - l G C < .

G
-H

retrycnt

a M

CU
4-)
C
-H

attempt

4-1
CJ
CD
CO

nt

co ca cu

4-1
CO
O
H 4-1

attempt

M
M
0)

CO
3
4-1

ca

2ns

Cn
CU
M

t,

-rH

abschlie@en

r4

CU
01

Null

T>

mit

O
0

in

4-1

S-4

4 J r 4 H

4J

EH

</> en Q CO
K vo
K vo
in vo rH VQ

=tt=

j-H

cu

4-1
4-1

CO

CO
4-1
CB

68C(A5)

cu -a

3
C

CU
4-1
G

rH

list

register

cu o

CM
rr^

DMA

a
a

status

counter

r-

ut yet ?

CM

nt

timeout

cu
c
o
-a

M
CU
4-1

4J
CQ
-H

tor

n
M
CU
XI

Atari ST Internals

CM

f
0
(
VQ

oo

r
CO

n
m
<;
CO

CM
fa
VQ
VQ
Cj

CO
CO
VQ VQ VQ
VQ VO VQ
0 0 0
0 O 0

o
o
o
rH
VQ

VQ
(T)

vo

CM

VQ
O
O

VQ
O
0

co en
vo vo

o
en
o
o

CJ vo

pa

o
o
o
o
o
o
CO
o
pq
en
vo

CJ

rH
O

CO

VQ
0
0 0

en en
VQ vo
VO vo
O o

CM

qi CJ

m U
o n O
o o fa
< CJ o o
CN pa o o
r CJ rH rH
VQ n VQ VO
H o =r CO
en f ^q pjj
vo vo vo VO
vo vo vo VQ
o o 0 O
o 0 0 o
CO

CM

r~
vo

CN
O

U 31
rvo vo fa
0 o fa
CO
Q Q o
CJ
CO

rH
O
O

CO

CO

0
rH
O
0

o
o
0
o
Q

CN

vo vo o < m rCM n vo
CM
<3*
CJ vo m m vo 0
CJ o CM VO < w VO CO
< CQ CQ CQ pq CQ CJ O
vo vo VQ vo vo vo vo vo
vo vo VQ vo vo vo vo VQ
rH

o vo

o o

0 0

O
O

o o 0 o O
o o o o o

324

vo

CM

vo

CO

r^ vo 03
vo fa VO
o
o fa o
o a
o
VQ
o
n
^r
CJ
O
m vo m
w
<, o CM vo
U Q Q Q D Q
vo vo vo VO vo vo
vo vo vo vo vo vo
0 o o 0 0 o
o o O o o o
^
i-H
0
^r 0 Q
0 0 VO
vo rH
vo VO

^q

[-)

o
vo
CN

pq
vo

vo

N>
01

9BCD
4DF9FFFF8606
50ED0680
4A6D043E
6670
203900000466
1200
C23C0007
6638
3CBC0080
E608
C07C0001
41ED0674
DOCO
B079000004A6
6602
4240 .
5200
E308
OA000007
6100026C
3039FFFF8604
08000006
56DO
1002
6100025A
302D0674
816D0676
4A6D0682
6618
6100028C

sub.l
lea
st
tst .w
bne
move . 1
move , b
and.b
bne
move . w
Isr.b
and.w
lea
add.w
cmp.w
bne
clr.w
addq . b
Isl.b
eor.b
bsr
move . w
btst
sne
move.b
bsr
move . w
or .w
tst.w
bne
bsr
#1,DO
#1,DO
#7, DO
$6994
$FFFF8604 ,DO
#6, DO
(AO)
D2,DO
$6994
$674 (A5),DO
DO,$676(A5)
$682 (AS)
$6762
$6908

DO

$FFFF8606,A6
$680 (A5)
$43E(A5)
$6766
$466, DO
DO,D1
#7,D1
$673C
#$80, (A6)
#3, DO
#1,DO
$674 (A5>,AO
DO,AO
$4A6,DO
$671E

A5,A5

************************************************

0066E4
0066E6
0066EC
0066FO
0066F4
0066F6
0066FC
0066FE
006702
006704
006708
00670A
00670E
006712
006714
00671A
00671C
00671E
006720
006722
006726
00672A
006730
006734
006736
006738
00673C
006740
006744
006748
00674A

flopvbl, floppy vertical blank handler


Clear A5
Address of the floppy register
Set motoron flag
flock, disks busy ?
Yes, do nothing
frclock

Calculate mod 8
Not yet 8th interrupt ?
Select 1772 status register
Use bit 4 as drive number

wpstatus, write protect status table


Index with drive number
nflops, number of floppies

Drive select bit


Shift in position
Invert for hardware
Select drive
dskctl, read 1772 status
Test write rpotect bit
And save
Previous select status
Recreate
wpstatus
Write wplatch
deslflg, floppies already deselected?
Yes
Raed 1772 status register

Cfl
o

B>

5?

rJ

o <u o

JH

CU

CQ Q

01 rH
O

rH

en

M-)

^_^

-CM
m

Q vo

p-

VD
4J>

vo
</>

0)

jj c
43 45

43

IS

0)

^
01
43

*
*
*
*

.
^f
rH
O

rH

o cu CO P
o <: to a o

IH

*3>
f

(U

rH

01

4-1

*3 TJ
o u

cd

CD

r)

ta

p
o

0
0

cu
>-t

o
43
01

rH

CD -H 43
M 01
0 Q

o
u

rH

in
01

d>

-rH

EH

>_s

vo
</>

CO

01

5.

rH

r-t

<a

4-1

4->

CM

ss

CO
o =r VD
Q en o

en
vo
=tt= </>
^

t-l

m m m in in
m
.=q
vo
___ __^ ^ S a1 CO vo rt 0 ^^ rH
vo
rH
p0
f
fc.
<c
Q
rij
w CO CO CO CO CO in rfj.
m in m
f CO vo vo vo vo vo
M.
*,
M.
* 1
vo
' ~ ^ vo </>
^^
^^
^-^
* CO
o
{/> </> ** ^^ ^^
VD
vt **> *
* <
0 CM
m
m
CM in in
m
CO
*
co , [^
^c
q,
vo VD a1
pp- p-
X r~ in Pn
p- t^ p- (~- vo
o Q
o Q Q w
o
fn o <o < p- <l <c < < < CO T o
CO
*
X
CO
CO
o
o CO
VD CO o CM =r CM vo VD vo vo o vo CO rH vo
co m fcl vo o O rH
<*> =*= == </>
(fl- </> Q Q =^= CO rH rH CM CM CM
<ft </> </> </>
* Q
^
X
*
X
X

^__
in
o vo

CD

0)

ma, start DMA address

c
o

ount, number of sectors

43

trycnt

-rl

dress of the floppy register


t motoron flag
ferror
rrerr
ock, disable floppy-vbl routine

01

Atari ST Internals

oplock
gsave

CD

s, then don't deselect


th drives
select
t deslflg
ear motoron flag

Abacus Software

01
4-1

*
X

rH

cu .
43 ed
o
(U

.p

rH

01

f"*1

ta

s s s

&

rH

CD

CD

(0

(U

0
g

0
g

o o o o o 0 0
g g g g g g

(U

>

rH

s s

S S

on cu (U cu cu

G g

ca

0)
rH

.
4-1
01
4-1

i-H

cu cu

. . CD

FT1
\J

tr

cd

cu cu o o

43

r-H

g g

vo
o

vo

rH
01
rH

rH
01
rH

*
X
*
*
-X
-X

-X
*
X
-X

CM
CO

r~ <j
o CO
o CM

r^

vo
o

CO

rH
VO
VO

rH

rH 0
O CO
0 VQ
0 0 O
0
Q
0 p- VO
rH CQ CM
VO CO *3*

CM

5P

CO

o
o
o
o
CO

0
CM

m in in m

VO
pVO

o o 0 0 0 o
o o o o o o

i^C
vo

o
o

VO

0
0

vo vo

0
0 CO

fVj

td

^p

CO

vo rt^ 0 CM

co CO CO CO CO CO CO po1 vo vo vo vo vo vo vo
*
-X o
CO o
o o o o o 0 0 0
-X 03
o O CM rH CO o CM ql vo CO CM CO ^r
fe, o <
O o rH rH rH rH rH 0 o CO
b.
-X
CO
0 vo VO o 0 0 0 o o o o vo vo
*
[
r-. o o o o o o o o o o o 0 0
X
a\O O en en o o o P>4 pt, r Pu
pt. o Q Q
CT,

X
*
-X

SP

0 CM VQ

p- p- t p- Pvo vo vo vo vo

=3*

VO
PVO
O
O

*
*
*
*

-X
*
X
X

*>p

Cn

O
vo pp- pvo VO
0 o
o 0

CO

Q 0

3* m

s co co
CO

pq
p- pp- pvo vo
o o o
CM
ppVO

CO

0 0 0

CQ

CM
03
PVD
O
O

vo

T)

vo vo vo vo vo pCQ CQ CQ CQ CQ CQ CQ co

VD

CM

co

CO

CO

CM

CO

CO en
p- p- pVD vo vo
o o o
CO

r T,

0 0

326

co

co

^31 fQ 0
en rt^ (Q CQ

vo

0
Q
CM

tp Q
vo 0 w

o
o

^J1 vo

p- CO

p- co

M
CO

CO

pq 0 ^r vo
CQ o o

vo
r T|

P>4

rH
p)

co

r3J

CJ

0
Q

vo

0
CM
[V]

en
m f^
m
o o o o
p- p- p- p- p- p- p- p- p- p- p- p- p- pvo vo vo VD vo vo vo VD vo vo VD vo VD vo
o o o 0 0 0 0 o 0 0 o o o o
0 o o o o o o 0 o o o 0 0 0

ij
"*!

0067D2
0067D4
006708
0067DC
0067DE
0067E2
0067E6
0067EA
0067EC
0067EE
0067FO
0067F2
0067F6
0067F8
0067FE

D1C7
2B480692
4A690000
6A20
61000168
42690000
610000EC
6712
7EOA
6172
6606
610000EO
6706
337CFFOOOOOO
4E75

61000226
302D06A2
48CO
6002

add.l
D7,AO
move . 1 A0,$692 (A5)
tst.w
0(A1)
bpl
$67FE
$6948
bsr
clr.w
0(A1)
bsr
$6804
beq
$67FE
moveq . 1#10, D7
bsr
$6862
bne
$67F8
bsr
$6804
$67FE
beq
move . w #$FFOO, 0(A1)
rts

bsr
move.w
ext.1
bra

$6A2A
$6A2(A5),DO
DO
$6810

***************************************************
nneonn inni
mmr&n ^ 41 nn
006802
006806
00680A
00680C

4280
2FOO
3CBC0086
3E290000
610001A8
3C3C0010
610000C6
303900000684

***************************************************
DO
clr.l
move . 1 DO,-(A7)
move . w #$86, (A6)
move . w 0(A1),D7
bsr
$69C4
move . w #$10, D6
bsr
$68EA
move . w $684, DO
00680E
006810
006812
006816
00681A
00681E
006822
006826

Plus length of sector


edma, yields end DMA address
dcurtrack, current track
>= 0 ?
No, select
Set track to zero
Restore, head to track zero
OK ?

Seek track 10
Error ?
Restore
OK ?
Recalibrate, error

flopfail, error in floppy routine


Media change to 'unsure'
Set
currerr

flopok, error-free floppy routine

ok
Select 1772
Get track number
wdiskctl, send to disk controller
seek command
flopcms
cdev, drive number

10
NJ
00

00682C
00682E
006834
00683A
006842
006844
00684A
00684C
006854
00685A

E548
41F900000678
21AD04BAOOOO
OC790001000004A6
6606
216D04BA0004
201F
4CF978F8000006A4
42790000043E
4E75

3E3900000686
33FCFFFA000006A2
3CBC0086
61000154
3C3C0010
60000072

Isl.w
lea
move.l
cmp.w
bne
move.l
move.l
movem.l
clr.w
rts

move .w
move .w
move .w
bsr
move .w
bra

#2,DO
$678,AO
$4BA(A5),0(AO,DO.w)
#1,$4A6
$684A
$4BA(A5),4(AO)
(A7)+,DO
$6A4,D3-D7/A3-A6
$43E

$686,D7
t-10,$6A2
#$86, (A6)
$69C4
#$10,D6
$68EA

****************************************************
00685C
006862
00686A
00686E
006872
006876

33FCFFFA000006A2
6150
664C
42690000
3CBC0082
4247
61000132
3CBC0086
3E3C0005
61000126
3C3C0010
6144

move .w

bsr
bne
clr.w
move .w
clr.w

bsr

bsr

move .w
move .w
move .w

bsr

$69C4
#$86, (A6)
#5,D7
$69C4
#$10,D6
$68EA

D7

#-10, $6A2
$6804
$68D2
0(A1)
#$82, (A6)

*****************************************************
00687A
006882
006884
006886
00688A
00688E
006890
006894
006898
00689C
0068AO
0068A4

As index
acctim
200 Hz counter as last access time
nflops

20 Hz counter for other drives


Restore error number
regsave
Clear flock, release vbl routine

hseek, head to track


ctrack
currerr to 'seek error'
Pass track number
wdsikctl
Seek command
flopcmds
ressek, home and seek
currerr to 'seek error1
Restore
Error ?
Current track to zero
Select track register
Track zero
wdiskctl
Select data register
Track 5
wdiskctl
Seek command
flopcmds

o"

I
en

cn

N>
*

$6802
f5,0(Al)

clr.w

06

move.w
and.b
or.b
move.l
move.w
bsr

2(A1),DO
#$3,00
DO,06
#$40000,07
#$80,(A6)
$6908

flopcmds
Seek rate
Bits 0 and 1
OR in command word
Timeout counter
Select 1772 register
rdiskctl

restore, seek track zero


restore command
flopcmds
Error
Test track zero bit
Z-Flag invertieren
nicht Track Null ?
current Track auf Null

Test RNF, CRC lost data

Error
Track number to 5

bne
move.w

#-10,$6A2
#$86,(A6)
$686(A5),D7
$69C4
#$14,D6
$68EA
$6802
$686(A5),0(A1)
#$18,07

0068A6 662A
0068A8 337C00050000

move.w
move.w
move.w
tosr
moveq.l
bsr
bne
move.w
and.b
rts

***************************************************
33FCFFFA000006A2
3CBC0086
3E2D0686
61000104
7C14
6124
660A
336D06860000
CE3C0018
4E75

go2track, search for trak


currerr to 'seek error1
Select data register
ctrack, load track number
wdiskctl
Seek with verify command
flopcmds
Error
ctrack, Save track number

0068AE
0068B6
0068BA
0068BE
0068C2
0068C4
0068C6
0068C8
0068CE
0068D2

bsr
bne

rts

clr.w

bne

btst
eor.b

$68EA
$68E8
#2,07
#4,SR
$68E8
0(A1)

***************************************************

0068D4 4246
0068D6 6112
0068D8 660E
0068DA 08070002
0068DE OA3C0004
0068E2 6604
0068E4 42690000
0068E8 4E75

30290002
C03C0003
8COO
2E3C00040000
3CBC0080
61000008

*****************************************************
0068EA
0068EE
0068F2
0068F4
0068FA
0068FE

WJ

S3

E,

of

u>
u>
o

006928 6104
00692A 7C01
00692C 4E75

006924 4246
006926 4E75

00691E 66F2
006920 610000AC

006912 5387
006914 6712
006916 08390005FFFFFA01

00690E 610000AA

006908 2E3C00060000

006906 6606

006902 08000007

$692E
bsr
moveq . 1#1,D6
rts

clr.w
rts

bne
bsr

subq.l
beq
btst

bsr

move.l

bne

btst

D6

$6912
$69CE

II,D7
$6928
#5,$FFFFFA01

$69BA

-#$60000,07

$690E

#7,DO

3CBC0080
3E3COODO
6100008C
3E3COOOF
51CFFFFE
4E75

move.w

move . w
bsr
move . w
dbra
rts

f$80, (A6)
t$DO,D7
$69C4
#$F,D7
D7,$693E

***************************************************
00692E
006932
006936
00693A
00693E
006946

426D0682
302D0684
5200
E308
806D068A
OA000007
C03C0007

***************************************************
clr.w
$682(A5)
move.w $684(A5),DO
addq.b #1,DO
Isl.b
#1,DO
$68A(A5),DO
or .w
eor.b
#7,DO
#7,DO
and.b
006948
00694C
006950
006952
006954
006958
00695C

controller

Motor on ?
Yes
Else longer timeout
wdiskctl6, write command in D6
Decrement timeout counter
Timed-out ?
mfp gpip, 1772 done ?
No, wait
rdiskct!7
OK

Reset 1772
Error

Reset 1772, reset floppy


Select command register
Reset command
wdiskctl
Delay counter
Timed-out ? read status

select, select drive and side


Clear deslflg
cdev, drive number
Calculate bit number
cside, side in bit 0
Invert bits for hardware

8
S

en

I
3

006960
006962
006966
00696A
00696C
006970
006974
006978
00697A
006982
00698A
006992

40E7
007C0700
1239FFFF8800
1401
C23COOFA
8200
13C1FFFF8802
46DF
4E75

6132
3CBC0082
3E290000
6158
422D069C
3CBC0084
3E2D0688
614A
13ED0691FFFF860D
13ED0690FFFF860B
13ED068FFFFF8609
4E75

bsr

move . w
move . w
bsr
clr.b
move . w
move . w
bsr
move . b
move . b
move . b
rts

$6994
#$82,(A6)
0(A1),D7
$69C4
$69C(A5)
#$84,<A6)
$688(A5),D7
$69C4
$691(A5),$FFFF860D
$690(A5),$FFFF860B
$68F(A5),$FFFF8609

****************************************************
move.w SR, - (A7)
or.w
t$700,SR
move.b $FFFF8800,D1
move.b D1,D2
and.b
#$F8,D1
or.b
DO,D1
move.b D1,$FFFF8802
move.w (A7)+,SR
rts

006994
006996
0069A2
0069A8
0069AA
0069AE
0069BO
0069B6
0069B8

******************************************************
bsr
$69EO
move.w D6,$FFFF8604
bra
$69EO
0069BA 6124
0069BC 33C6FFFF8604
0069C2 601C

bsr
move.w

$69EO
D7,$FFFF8604

******************************************************
0069C4 611A
0069C6 33C7FFFF8604

Set bits in sound chip


Select track register
Get track number
wdskctl
tmpdma, clear bits 24-31
Select sector register
csect, get sector number
wdiskctl
dmalow
dmamid
dmahigh

setporta, set port A in sound chip


Save status
IPL 7
Read port A
And to D20069AA C23COOF8

Clear bits 0-2


Set new bits
Write result to port A
Restore status

wdiskcte
Delay loop for disk controller
dskctl
Delay loop for disk controller

wdiskctl
Delay loop for disk controller
dskctl

65

en

Cfl
o

I
Ml*

C/3

II

to

0069CC 6012

0069CE 6110
0069DO 3E39FFFF8604
0069D6 6008

6106
3039FFFF8604
40E7
3F07
3E3C0020
51CFFFFE
3E1F
46DF
4E75

bra

bsr
move.w
bra

bsr
move.w
move.w
move.w
move.w
dbra
move.w
move.w
rts

$69EO

$69EO
$FFFF8604,D7
$69EO

$FFFF8604,DO
SR, -(A7)
D7,-(A7)
#$20,D7
D7,$69E8
(A7)+,D7
(A7)+,SR

$69EO

******************************************************
0069D8
0069DA
0069EO
0069E2
0069E4
0069E8
0069EC
0069EE
0069FO

OC790001000004A6
662C
302F0010
B07900004692
671C
3FOO
3F3CFFEF
6100EB4C
584F
33FCFFFF00000676
33EF001000004692
426F0010
4E75

crnp.w
bne
move . w
cmp.w
beq
move . w
move . w
bsr
addq . w
move . w
move . w
clr.w
rts

16(A7) ,DO
$4692,00
$6A24
DO,-(A7)
#-17, -(A7)
$555C
#4,A7
#$FFFF,$676
16(A7),$4692
16 (A7)

#1,$4A6
$6A28

***************************************************
0069F2
0069FA
0069FC
006AOO
006A06
006A08
006AOA
006AOE
006A12
006A14
006A1C
006A24
006A28

Delay loop for disk controller

rdiskct7
Delay loop for disk controller
dskctl
Delay loop for disk controller

rdiskctl
Delay loop for disk controller
dskctl
Save status
Save D7
Counter
Delay loop
D7 back
Status back

change, tets disk change


nflops
None or 2 floppies, done
Drive number
Equals diskette number ?
Yes
Drive number
'insert disk'
Critical error handler
Correct stack pointer
wplatch, Status for both drives unsure
Save diskette number
Drive number to zero

Sfl
rt'

s.

WJ
O

>

3.
v>
H

re
3

3?"

W
W

41F900003E2A
1FOO
302D0684
119FOOOO
4E75

lea
move.b
move.w
move.b
rts

$3E2A,AO
DO,-(A7)
$684(A5),DO
(A7)+, 0 (AO,DO.w)

******************************************************

006A2A
006A30
006A32
006A36
006A3A

****************************************************
dc.b
%10101110
dc.b
%11010110
dc.b
%10001100
dc.b
%00010111
dc.b
%11111011
dc.b
%10000000
dc.b
%01101010
dc.b
%00101011
dc.b
%10100110
dc.b
0

006A3C AE
006A3D D6
006A3E 8C
006A3F 17
006A40 FB
006A41 80
006A42 6A
006A43 2B
006A44 A6
006A45 00

4BF900000000
41EDOA43
610000DE
04000050
1400
E982
610000D2
D400
EB82
610000CA
D400

lea
lea
bsr
sub.b
move . b
asl.l
bsr
add.b
asl.l
bsr
add.b

$0,A5
$A43(A5),AO
$6B30
#80, DO
DO,D2
#4,D2
$6B30
DO,D2
#5,D2
$6B30
DO,D2

***************************************************
006A46
006A4C
006A50
006A54
006A58
006A5A
006A5C
006A60
006A62
006A64
006A68

setdmode,
Disk mode
Save mode
cdev, get
Set drive

set drive change mode


table
drive number
mode

dskf, disk flags

jdostime, IKBD format in DOS format


Clear A5
Pointer to clock-time buffer
bcdbin
Subtract offset of 80
Year
Shift in position
bcdbin
Add month
And shift in position
bcdbin
Add day

R>

as

5?

006A6A
006A6C
006A70
006A72
006A74
006A78
006A7A
006A7C
006A80
006A82
006A84
006A88
006A8E

EB82
610000C2
D400
ED82
610000BA
D400
EB82
610000B2
E208
D400
2B420A4C
1B7COOOOOA8E
4E75

asl.l
bsr
add.b
asl.l
bsr
add.b
asl.l
bsr
Isr.b
add.b
move . 1
move . b
rts

#5,D2
$6B30
DO,D2
#6,D2
$6B30
DO,D2
#5,D2
$6B30
#1,DO
DO,D2
D2,$A4C(A5)
#$0,$A8E(A5)

move.b #-l,$A8E(A5)
move.b #$1C,D1
bsr
$6CDO
tst.b
$A8E(AS)
bne
$6A9E
move.1 $A4C(A5),DO
rts

***************************************************
1B7CFFFFOA8E
123C001C
61000234
4A2DOA8E
66FA
202DOA4C
4E75

And shift in position


bcdbin
Add hour
And shift in position
bcdbin
Add minute
And shift in position
bcdbin
2-second resolution
And add seconds
Save new time
Clear handshake flag

gettime, get current clock time and date


Request handshake flag for time
get time of day command
Send
New time arrived ?
No, wait
Get time in DO

settime, set clock time and date


Pass time

006A90
006A96
006A9A
006A9E
006AA2
006AA4
006AA8

**************************************************
move.l 4(A7),$A50(A5)

ikbdtime
Pointer to end of time buffer
Get time to convert
To dO
Isolate bits 0-4, seconds
2-second resolution
41F900000A5A
242DOA50
1002
0200001F
E300

006AAA 2B6F00040A50

**************************************************
$A5A,AO
lea
move.1 $A50(A5),D2
move.b D2,DO
#31,00
and.b
asl.b
#1,DO
006ABO
006AB6
006ABA
006ABC
006ACO

as
n

en
C/3

as

CO
4-1

4-1
-H
43

-r-1

43
4-1
f-l
CD
>
C
O
CJ

0)
0)
4J
3
G
-H
S

CO
H
0

CU

4_>
0)
>
G

01 O
H CJ

4-1
CO
,-H
0
01
M

CO
^
P
0

4-1

sr
1
o

c*>
i
o

01
4-1
-H

CO
4-J

CU
4-1
CO

CU

r1
0
CO

4J
-H

3
.p
In
CU

CU
c-\J

01

0)
4J

4-!

4-1

CO

<D

rH

r-H

G
O

>i

G
O
H CJ

CO

01

0 Q

G
0

o G ca

CO
M

d>

4-1 m g

<U

co

S-l M-l -H 4-1


(U O 6-1

M CO
CU CU

rQ

*O

Of Day command

1
o

et
Of Day command
IKBD
f bytes to send
of the parameter block

in
I

^H

IKBD

Atari ST Internals

Abacus Software

-H4-1
6-1
*O

*O

GTi4-l G S T ! G4J G
O ' C O J C U P ' O C U C U C U
M O < t O t O ! 3 , < t O C 3 t O
O

CU

01

CJ :M

o
O
O
O
O
Q
Q
<
Q
- - o n -o -o
C O C M O Q C O C M O Q C O C M O Q C O C M O Q C O C M O -CO
Q Q
. tH Q Q
- < - ) Q Q
- < H Q Q
- r H Q Q
O M Q Q - a ' p t j O Q
oa - ^ CO 03 N ^ t__f (O - ^ ,-ipa - - m P Q - - r ~ p a c o r - i c j -in o i-i CJ
vo m CM vo vo VO CM O vo in CM f O V O i n C M r - * V O ^ P C M < ' > - V O - U > < / > V Q i n i < vo 4/> vo
c/>
> 41= Q
u> * Q =tt> <o * Q = S = - U > = K = Q = W = - C Q - = t | = Q = t t ! l - = = = % > = * < O to

*
H

01

,f

43
CU

T3 !-t M
> M CO
^
CO
o CQ 4-1
C 01 01
co 43 H S c 0 4 3 ' - i e r 0 4 3 ' H e c a 4 3 c a g 4 3 e ' - l 43 e 43 T4

006AC2 6154
006AC4 EA8A
006AC6 1002
006AC8 0200003F
006ACC 614A
006ACE EC8A
006ADO 1002
006AD2 0200001F
006AD6 6140
006AD8 EA8A
006ADA 1002
006ADC 0200001F
006AEO 6136
006AE2 EA8A
006AE4 1002
006AE6 0200000F
006AEA 612C
006AEC E88A

J-l

G 01
CO 43

43

335

CM
0
O
<-H
W

w
<
vo
O
O

CM
CM
j-H
VO
^T
fe
<
VO

o
o

in
o
vo
tCM

o
ta
vo
0
o

45F900000A5
610001E4
123C001C
610001BC
4E75

01

CU

43
43
43
43
<H
43
H
43
43

D1
01
. CU
CD

o
cu
> T J M ^ J > T 3 M M > T J ? H t 3 > M i > c O
O G M c o O C O l o l O G c O ' t f O o l O e i )

006B04
006BOA
006BOE
006B12
006B16

CO

43
CU
> 0

43

006AF6 06100080
006AFA 123C001B
006AFE 610001DO

fM

43

006AFO 0200007F

43

ON

006B18
006B1A
006B1C
006B1E
006B20
006B22
006B24
006B28
006B2A
006B2C
006B2E

7200
760A
9003
6B04
5201
60F8
0600000A
E901
D001
1100
4E75

moveq . 1#0,D1
moveq . 1#10, D3
sub.b
D3,DO
bmi
$6B24
addq . b #1,D1
bra
$6B1C
#10,00
add.b
asl.b
#4,D1
add.b
D1,DO
move . b DO,-(AO)
rts

**************************************************
006B30 7000
moveq . 1#0,DO
006B32 1010
move . b (AO) ,DO
006B34 E808
Isr.b
#4, DO
006B36 E308
Isl.b #1,DO
006B38 1200
move . b DO,D1
006B3A E500
asl.b
#2, DO
006B3C D001
add.b
D1,DO
006B3E 1218
move . b (AO)+,D1
and.w #15, Dl
006B40 0241000F
add.w D1,DO
006B44 D041
006B46 4E75
rts

70FF
1439FFFFFC04
08020001
6602
7000

moveq.1 #-l,DO
move.b $FFFFFC04,D2
btst #1,D2
bne
$6B58
moveq.1 #0,DO

***************************************************

006B48
006B4A
006B50
006B54
006B56

binbcd, convert byte to BCD


Ten's counter
Load 10
Subtract 10
Increment ten's counter
Generate one's counter
Tens in upper nibble
And add ones
Write result in buffer

bcdbin, convert BCD to binary


BCD byte
Ten's place

Isolate one's place


Plus ten's place

midiost, MIDI output status


Default to OK
Read MIDI-ACIA status
And test

OK
Status not OK

er
g

WJ
O

65

5?

-rH

4-1

0)

4-1 4-1
CO -H
0) 10
EH S

CM
Q

0)
4-1

4-1
3
O,
4-1

Q
O

CM
rH
Q

X!

0)
M
4-)

-K
*
-K

<o

0)
O

X)

4-1
CO
4-1

cr

CD
X!

(U

CO
4-1

lO

r-

^
CO

m
CQ
vo
o
0

*
*
*
K
*
-K
-K
-*
K

-Jt
*
*
-X

tr

vo
3

CD

CD

4-1 4J
(U 3
U O

H-

CM pq
ft. VO

pq
vo
m
Q

<o

0)

^ M ^
O o O CO 1

e e X) a

o
O
CM
V> CM o
O CM o
O CM o
o CM o
ft, en en
CNJ CM CM
CM

to
pq
vo
o
o

o
CM
O
CO

vo
CM

CM
0
O
O
f-H
"31

CO
4-1

r- m
o vo iH 5P

vT

CO

[V}

O H CM

m VO vo vo vo rcq pq pq pq Pq pq

vo vo vo vo vo VD
o o o o o o
0

o o

o o

*
*
-X

o
in
o
0

rH

rH

10
O1 W
fl) O

rfl -H -H
0) (0 C
OS EH O

4-1

H-

rH
1
=tf

am
o

CM

<

vo

03

<u

rH

rH

-X
-X
-X

cu

^
O

o
Q

VO
-CO-

o
rH

tf

10

CM

rH

fO
CD

4-1

s s

10
CD

(fl
CD

rH

rH

Q^

CD

tr
cu

e c o
o XI

CO
4-1

*
-X

*
*
X

iH

m ^r

m ^p
<; w

t)
O
O

(U

-a n

0)

rH

0)

CO

C CO
-H
-H O 0 rti
g -H Cn O

4-1

r-

P.

CM

-X
-X
X
-X
X

"^

-)C

-K

T!
t)

<

*
X

G
0)
r3

w
4-1

-X
*

*
*
*
*
jc
*

-}C

X
X
X
X

*
*
X
*

-X

tr> M

*
>

0
4-1

co"

=r
pq
vo

01

CO
fi CO
4-1 0)

e Q

IH
O

IH

iH
CM

M
S

4-1

CO

-rH
T)
-H

3
O

O
M

4-1
CO

s default

-H
4-1
C
3

c for MIDI
ter to MIDI-ACIA

4J
CO

O
4->

C
M -H
4-1
tn co 4-1
CO
G
-H CD
1

C
-H

tat, MIDI receiver status

MIDI status

ter to MIDI-ACIA

G
M

$FFFFFC04,A1

rH
Q

O
4-1

******************

0)

e o

M
S

*******************

a 4-1
-H

$FFFFFC04,A1

we, output character to M:


character
-rl

Index
Index
terruptable test

Atari ST Internals

Abacus Software

<

a1 vo
O o
o o
o o

X
X
X
-X
X
X
X
X

o CM
o CM
vo VO
r- m
vo
* r- [^
*
X
pq PQ
vo vo
X
o o
*
-X
o o
SJ1

rM

CM
CM

CM

CM

<H
CM
<H

Q
rH
VO

vo
^s1

pq m
CJ
iH w
in

w o CM vo
r- co 03 03
pq PQ m pq PQ
vo VQ VO vo vo
0 0 0 o o
o o o 0 o
rt^
f^

337

X
X
X
-X
-X
-X
X
X
X
X
X
-X
X
-X
X
X
X
X

K
X
-X
X
-X

sr
o
U

o
o

CM
CM
p CM
o CM
Q
CM

vo

o
0
0
03

CO cq
CM
CM W
O in [ in
Q1 PQ
r~

rH
*3*

^P

CO

U CM

co CO
pq PQ

Cft

ffl
VO vo VO
0 o O
0

03
O
O

o m
o
vo 0
vo r- ^i
CM
0

(V)

CO u Cd o CM
en a\Qen
fC ft.
cq
pq pq pq pq
vo vo vo vo vo vo
o o o o o o
31

Abacus Software

Ti

CD

Oi

statu;

CO

rH

P
<d

CD

Q)

CO

TJ
-H -H

******************
*
*
*

f$
CO

CM
M

-H

4-1

T5
rd
CD

-rH

,d
p

G
10
JZ
4-1

CD

CD

rH

CD

-o o

(0

O
g 0 ]Z.

-X

CO

r-

-H
IB
fi

m
-rl

rH

C
-H

o
CD

re

CD
4-J
rd
U CD
C t-t
M C3

IB
O
CJ

Q
M
S

a
^
CD fO

O
4-1
4-1
rd

rH

-H

CD
1H

H-l
3

CD

CD

CD
C, 4->
-H R
(T> -rH
CD O

S3 pq CM

4-1
CD

CO

4-)
3
ft
4-1
3
O

Id

3
C

<a

u co

m
y>

U
0

3
O

+J
CO
CD
(X.

CO

I o
o

CO
CO

CQ
vo

CO

rH
Q

Q
O

03
O VO

Q > CO

VO

CO

Is

rH
Q

rH

o
Q
03
vo

rH
Q

rH
Q
rH

rH

U}

vo

CJ Q 0
03
VO O

rH

rH

S
CD
P CT

S (U

er

<D CD CD CD (U
CT
>
ft tr TS ft CO
^
CO CO 0! O
O g CD T) g o o 0 O 0 O
^
o
O
ffl
CJ
g
43 4J 43 E
43
43 g g g g

co
4-1

*
-X

*
*
*
*
*

-*
K

X
*
*

*
*
-X
X

*
*
*

.
*

*
*
*
*
*
*
*
*
*
K
*

o vo 00
o 0 o
r- o o
o o o

CO
3

-rl

CM

&

o f=C r~ CJ
Cd ^p r*t w
CM

CO
CM
CN

CO
VQ
CM

o o

o 0
o o

o
o
vo
rH

rH
qi

0
CO CM
vo O
CM in

0
CO

o
o vo

rH
rH
CO
O
rH

VQ
0
O
O
rH
^31
rH

in in
o
CO

!>
O

fc. m
Q r-

*
*

^1 CO jaj {J o CM 5P CO O O CM
03 PQ CQ 03 PQ CJ CJ CJ CJ O Q Q
<C rtC <;
CQ 03 CQ CQ
CQ ffl ffl CQ CQ
CQ CQ CQ CQ CQ CQ
vo vo vo vo vo vo vo vo vo vo vo vo vo vo vo vo vo

^
rt

<C t~- o o

C1
VO

VO
00

5J1
r^C

0
CJ
<2

n O3

t
VO

CM

m CQ vo

CN
r^

CM
CM

o o o o o o o o o o o o o o o o o
o o o o o 0 0 o 0 o 0 0 o 0 o 0 0

*
*
*
*
*
*
*
*
*

338

4-1
rO
4-1
CO
CO
4-1

S-l
CD
4-1
G

-H

O
O
CM

^
o

rd
4-1
CO

P
CO

CD
CO
CD

4)

<D

in
vo
0
o
m
CJ
U
vo o vo
Q

O CJ
O Pu

o PQ
rH vo

SB
jrj

ft
g

CO

CD

O 0

^i
CO

4-> CD
CO
G
ii n

CO

o
o o
^p

CM
CQ

O
ra
CD

*C3

rH

0 4-1
U CD
CD >i

CO

O -H 0
CM S

J>
0

4-1
O

CO
Q

o
o
vo

CO

Q 0
CM
Q

==

03
vo

rH
^jQ

3
CO

ft
g
0

P
rH
Q

f
r^
,i

f^

Q Q
CM
^ji
CM

co

CO
O

f>-

0}

[j!)

(3j

o
a)

4-1

3 SH
O
U P

C
-H O

O <q CM

1
-H
4-1

4J

4-1
CO
CD CD N
4-1 4-1 ES

CM
CM
Q

0)

CO

CQ

vo w

rH
VO

4-1

rH

*
*

CD
-r|

CM CM
Q Q

-jt
^p

3
4-1
q S CD O
3 G
O -H o CD
O rH

*
He

*
*
*
*
X
*
*
-X

CD

ft

r-

rH

$4BA(A5),D3

ra
o

!H
CD
C <M

CQ
-H

e.l

C"

X
CD

timeout
an 5 seconds ?

O
ra

-H

*******************

interrupts

CD

CD
N
-H
CO

charac

P"

g
o

to
&

r start again
I buffer
from buffer

SH
ra

character to Centronics

|
|
|

|
M
Q
M

|
|

Atari ST Internals

CO
j-H

CJ in

en o vo

pC

03
cp
o

CQ
o

Q
CM

CM O CO Q
p^ ^P rH CM
rH <; vo vo
VO ^i VO CM

CM

o
o
o
CM
CO
VO

CO
CO

CJ

CJ Q
cn o VO

CJ CM ^P CO < o r) CM *5P ^fj


|y, CTH
Q Q Q W w pq
w
CQ 03 CQ CQ 03 CQ CQ CQ CQ CQ CQ CQ

sp

CO

vo vo vo vo vo vo vo vo vo vo vo vo
o o o o o o o o o o o o
0 0 0 0 0 0 0 0 o 0 o o

vO

006BFC
006BFE
006C04
006C06
006C08
006COC
006COE
006C12
006C16
006C18
006C1C
006C1E
006C22
006C24
006C28
006C2A
006C2C
006C2E

7000
2B6D04BAOA80
4E75
40C3
007C0700
7207
61000E28
00000080
7287
61000E1E
46C3
302F0006
728F
61000E12
610C
6104
70FF
4E75

moveq . 1#0,DO
move . 1 $4BA(A5)
rts

rts

move . w SR, D3
or .w
#$700, SR
moveq. 1 #7,D1
bsr
$7A38
or .b
#$80, DO
moveq. 1 #$87, Dl
bsr
$7A38
move . w D3,SR
move . w 6(A7),DO
moveq. 1 #$8F,D1
bsr
$7A38
bsr
$6C36
bsr
$6C30
moveq . 1#-l,DO

moveq,1 #$20,D2
bra
$7A7A

***********************************************
006C30 7420
006C32 60000E46

moveq.1 #$DF,D2
bra
$7AAO

***********************************************
006C36 74DF
006C38 60000E66

7207
61000DF8
0200007F
7287

moveq, 1 #7,D1
bsr
$7A38
and.b
#$7F,DO
moveq. 1 #$87, Dl

***********************************************
006C3C
006C3E
006C42
006C46

Flag for time out


200 Hz center as last time-out time
Save status
IPL 7, no interrupts
Mixer
Select registers
Port B to output
Write enable
Restore status
Character to output
Write to port B
Strobe low
Strobe high
Flag for OK

Strobe high
Bit 5
Set
Strobe low
Bit 5
Clear

listin, Get character from parallel port


Mixer
Select register
Port B to input

5T

006C48
006C4C
006C4E
006C50
006C52
006C54
006C56
006C58
61000DEE
61E2
610C
4A40
66FA
61EO
720F
60000DDE

41F9FFFFFA01
70FF
082800000000
6702
7000
4E75

bsr
bsr
bsr
tst.w
bne
bsr
moveq.l
bra
$7A38
$6C30
$6C5C

DO
$6C4E
$6C36
#15,01
$7A38

$FFFFFA01,AO
lea
moveq . 1#-l,DO
btst
#0,0 (AO)
beq
$6C6E
moveq . 1#0,DO
rts

***********************************************
006C5C
006C62
006C64
006C6A
006C6C
006C6E

Strobe high = not busy


Get parallel port status

Wait until character arrives


Strobe low = busy
Select port B
Read byte from port

Default to ok

auxistat, RS232 input status


iorec for RS232

Istostat, parallel port status


Address of the MFP
Default to ok
Test busy
OK
Still busy

lea

6(AO),A2

moveq.l #-l,DO

***********************************************
006C70 41ED09DO

8(AO),A3

$9DO(A5),AO

006C74 70FF

lea

lea

cmpm.w (A3)+,(A2)+
bne
$6084
moveq.l #0,DO
rts

No, wait
rs232get, get character

auxin, get character RS-232


auxin, character ready ?

Head index
Tail Index
Buffer leer ?
No
No character there

006C76 45E80006
B54B
6602
7000
4E75

006C7A 47E80008

006C7E
006C80
006C82
006C84

61E8
4A40
67FA
610005D8

***********************************************
bsr
$6C70
tst.w
DO
beq
$6C86
bsr
$7266
006C86
006C88
006C8A
006C8C

006C90 024000FF
006C94 4E75

and.w
rts

lea
moveq.l
move.w
bsr
cmp.w
bne
moveq.l
rts

#$FF,DO

$9DO(A5),AO
#-l,DO
22(AO),D2
$751E
20(AO),D2
$6CAC
#0,DO

************************************************

41ED09DO
7 OFF
34280016
6100087C
B4680014
6602
7000
4E75

Isolate bits 0-7

auxostat, RS232 output status


iorec for RS232
Default to ok
Tail index
Test for wrap around
Compare with head index
Not equal
No more space in buffer

auxout, RS232 output routine


Get data byte
rs232put, and output
Try again

006C96
006C9A
006C9C
006CAO
006CA4
006CA8
006CAA
00 6CAC

************************************************
006CAE 322F0006
move.w
6(A7),D1
006CB2 61000556
bsr
$720A
006CB6 65F6
bcs
$6CAE
006CB8 4E75
rts

moveq.l #-l,DO
move.b $FFFFFCOO,D2
btst #1,D2
bne
$6CCA
moveq.l #0,DO
rts

************************************************
7OFF
1439FFFFFCOO
08020001
6602
7000
4E75

ikbdwc, send character to IKBD


Get byte
Address of the keyboard ACIA
Get status
Ready

ikbdost, IKBD output status


Default to ok
IKBD ACIA status
Test
OK
Not ready

006CBA
006CBC
006CC2
006CC6
006CC8
006CCA

*************************************************
006CCC 322F0006
move.w 6(A7),D1
006CDO 43F9FFFFFCOO
lea
$FFFFFCOO,A1
006CD6 14290000
move.b 0{A1),D2
006CDA 08020001
btst
#1,D2

CA
o

B9

t/3

63

Atari ST Internals

<a

3
O

CM
rH
Q

CD
> tn
O 4-1

>-i

*
-x
*

co

P-

01
IS

0
Q

n
vo

=B=

G
KC

CM

0!
O

H-

CM

Q
O

<C vo

0
vo

s
0)

>
O

01

X
-X
-X

01 0!

> >

!-i ra
0 O eo 45 4J
S 45 *O &H
> M

*
*
*
x
*
*
*
X
*
-x
*

(N
O
O

o
rH
^p

to
P-

CO
rH

W
T

frf

^31

Q
CJ
VO
0

[V]

U
CJ

VO

tu

r~

vo

*
*
X
*
*
*
*
*
-X

CJ
vo vo

*
X

0 0

X
X

o o o

^p
0

o
o
vo

o o
o 0

fc.

fT,

fV,

vo CO CJ
H H W
O CJ CJ

0 CM

<3<

CO

(%,

(V,

*
X
X
-X
X
-X

VQ
O
0

vo

o
0

vo
O

CJ
VO

O
VO

o o
o o o

O CJ
VO VO
0 0
0 O

1-4
3

O
CM

CM
LO

O
Q

-t-

O 0

CM

a\S

1
== VO CO

o
a
vo

tr
0)

> <a <d


0) 0 CD 01
^H

ft

0)

> 0}
0

45

4J

X
X
X

-X
*

rH

co

0 01
-H Q

r-f

-H
Q) (8
En

*
*
-X
*

CM r-l
rH VO

0)

X
*

sp
CM

vo rH Q O P-

G
-H -H

4-1
r-H
3

X
X

< CJ pa LO

CM
VO

O
0
(U

0)
0)

s 1

4-1

*
*
X

*
*
*
*
*
*
*
*
X

<;
1*-,
fv,

vo

X
*

o
o X X

CD

*
X

*
*

TS
Ol
W
CO
0)

ft
0)
4-1
-H
(fl

4J
(0
4-1
a>

o
vo

^_l
CO

43

0
Q

4-1
CO
4J

t-l
Q
vo

tr

Save status
IPL 7, disable interrupts

ft

0)

ft

4-1 4J

at
CD 45 O
M
T! 4J T)

45

SR, -(A7)
#$700, SR

0>
CO

<B

conin, get character from keyboard

<H 4-1
O

45

CT

X
0)

c-

e.w
w

vo
Q
CJ
vo

4-1

********************

0)
<B

ikbdws,

o
4J

******************

4-1
-H

No characters there

H)
SJ

4-1
0!

eq.l #0,DO

tJ

ra c
j-i -H q
(U M -H

*******************

M
0)

constat, keyboard input status

send string to keyboard

Abacus Software

>

0) O H
E

-H
rH
-H
CO
4-1

4-1
-H

0)

G
-H

aCO
CD

01

<g
0

rH

vo

CO

0)

>
o
e

CM
O
VO

3=
ft

tr

0)
O 45

*
*
*
*
*
X
X
X

vo CO
o o
0 o
o o

CM
EK

cn
o

Q &J CO CO PQ CM 0 LO
0 o pW pt, W W
.-I o LO r LO VO 0 [y]
*P ra1 CQ vo p- ^31

M 0 ^p CO < CJ [VI
i^
f T|
0 0 0 o o O
CJ CJ Q Q
Q Q Q
VO vo vo VO
vo VO VO

t.

o
o

0 0 0
0 0

o o

o o

342

O
0 0

*
X

*
*
X
-*
X

vo CO
o o 0
p- 0 o
o o o
P- O CO CO CJ
O

*
*
X
CO

t_j rtf
vo ^r

fen
pV0

CM

^i

Q
VO

Q
VO
O

^
O

jyi p. CM

vo

CM

CM

CJ

o o
VO
r-l
O

CO
(H
Q

rH
p-

n ea vo
CM

O a

CM
Q

vo VO VO VD vo VO
X
o
*
o o o o o o
X
o o o o o o 0 0

U)

006D26
006D28
006D2C
006D2E
006D30
006D34
006D36
006D3A
006D3E
006D40
006D42
006D44

5441
B2680004
6502
7200
22680000
7000
30311000
31410006
E188
E048
46DF
4E75
addq . w #2,D1
cmp.w
4(AO),D1
bcs
$6030
moveq . 1#0,D1
move . 1 0(AO),A1
moveq. 1 #0,DO
move . w 0(Al,Dl.w) ,DO
move . w D1,6(AO)
#8, DO
lsl.1
Isr.w
#8, DO
move . w (A7)+,SR
rts

moveq.1 #-l,DO
rts

***************************************************
006D46 70FF
006D48 4E75

***************************************************
006D4A 082D00020484
btst
#2,$484(A5)
006D50 670E
beq
$6D60
006D52 2B7C00007D5AOA86
move.l #$7D5A,$A86(A5)
006D5A 1B7COOOOOA8A
move.b #$0,$A8A(A5)
006D60 4E75
rts

Head index + 2
Greater than or equal buffer size ?
No
Buffer pointer back to start
Pointer to keyboard buffer

Get character and scan code


Save new head index
Scancode to bits 16-23
ASCII code to bits 0-7
Restore status

conoutst, console output status


Always OK

ringbel, tone after CTRL G


Tone enabled ?
No
Pointer to sound table for bell
Start sound timer

*****************************************************
Keyboard table, unshifted
$00,esc, 'I'/^Va1, '4', '5', '6'
006D62 001B313233343536
dc.b
006D6A 373839309E270809
dc.b
'7', '8', '9', 'O1, '(', "',bs ,tab
'q1,'w1,'e','r','t1,'z1,'u','i'
006D72 71776572747A7569
dc.b
006D7A 6F70812BOD006173
dc.b
'o1,'p','[',' + ',cr, $00,'a1,'s'
006D82 646667686A6B6C94
dc.b
']','#',$00,'l','y','x','c','v'
006D8A 8423007E79786376
dc.b
006D92 626E6D2C2E2DOOOO
dc.b
bS'n', 'm1,', ','.', '-',$00,$00

on

006D9A
006DA2
006DAA
006DB2
006DBA
006DC2
006DCA
006DD2
006DDA

001B2122DD242526
2F28293D3F600809
51574552545A5549
4F509A2AOD004153
444647484A5B4C99
8E5E007C59584356
424E4D3B3A5FOOOO
0020000000000000
0000000000000037
38002D3400362BOO
3200307FOOOOOOOO
0000000000000000
3E000028292F2A37
3839343536313233
302EODOOOOOOOOOO
0000000000000000

0020000000000000
0000000000000000
00002D0000002BOO
0000007FOOOOOOOO
0000000000000000
3C000028292F2A37
3839343536313233
302EODOOOOOOOOOO
0000000000000000

dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b

dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b

'B1,'N','M1,',',':', 'I1,$00, $00


$00,' ',$00,$00,$00,$00,$00,$00
$00,$00,$00,$00,$00,$00,$00, '7'
'8',$00,'-','4',$00, '6',' + ',$00
'2',$00,'0',del,$00,$00,$00,$00
$00,$00,$00,$00,$00,$00,$00,$00
>',$00,$00,'(',')1,I/',I*I,I7'
'8','9','4','5','6','I1,'2','3'
OS'.'jCr ,$00,$00,$00,$00,$00
$00,$00,$00,$00,$00,$00,$00,$00

$00,' ',$00,$00,$00,$00,$00,$00
$00,$00,$00,$00,$00,$00,$00,$00
$00,$00,'-',$00,$00,$00,'+',$00
$00,$00,$00,del,$00, $00,$00, $00
$00,$00,$00,$00,$00, $00,$00, $00
'<',$00,$00,'8',')','/','*','7'
'8','9','4','5','6', '!','2', '3'
O'/'.'/cr, $00,$00,$00,$00,$00
$00,$00,$00,$00,$00,$00,$00, $00

']','"

*****************************************************
Keyboard table, shifted
$00,esc, '!',"",'I1, '$', '%', 'S'
'/','(', ') ',' = ', 'T'/'ISbs, tab
'Q', 'W, 'E1, 'R1, 'T', 'Z1, 'U1, 'I'
'0','P1,'[','*',cr, $00,'A','S'

006DE2
006DEA
006DF2
006DFA
006E02
006EOA
006E12
006E1A
006E22
006E2A
006E32
006E3A
006E42
006E4A
006E52
006E5A

******************************************************
Keybaord table, Caps Lock
006E62 001B313233343536
dc.b
$00,esc,'1','2','3','4','5','6'
006E6A 373839309E270809
dc.b
'7','8','9','0','@',' " ,bs, tab
006E72 51574552545A5549
dc.b
'Q1,'W,'E1,'R1,'T1,'Z','U','I'

BS

C/5
O

I-*1

I1

>H

:+?

0 0 0
0 0 0

o o o
o o o

o o o o
o o o o

ft

o o o o
o o o o
in-

^ >
O -

o o o

fa

O Q

<fe

dc,

dc,

dc,

dc,

dc,

dc,

00000000000

00000000000

07FOOOOOOOO

00000000000

"^ o
W o
T CM
CM O
"51 O

D0000002BOO

fJ

dc,

07E59684356

00000000000

dc,

7484A4B4C99

f< CM
t CO
Cd W
VO VO

0 0
0 0

D2C2E2DOOOO

dc,

dc,

A2BOD004153

^r
*j" ^r

O
CO
CM
W
CO

T
vo
-a1

0
Vr

Vr

o O O o
o o o o

43 43 o o

en
o
in
fa

0)
73

</> -to J
0 0 o o o
0 0 o o o

=*= "Z

" ca

rH

0 0
0 0

" U
o S o o o

O4

0 0
O 0

o
o
o
o
o

o
o
o
o
o

< CMrfj
CO C5> en

pq c)
vo vo

fjQ

VO

- O
rH O

o
o

- O
VO O

o
o

If)

o o
O o

o
o
o ** SH 0
-

0
0
</>

en " o

CO

43
0

CO
CM
fa
CM

en

o
o

43

CM
CO
CM
O
CM 0 0 O co
O o o O en
O o o O CO
O o o CJ CO
O o o co co

o o
M o
o
o
co o

W CM

(rf

CM

u a

{V]
^

CM

(<

CM

(=C

CM
O

(Q

pa PQ O O Q a
w w
vo vo vo vo vo vo vo vo vo
en <2

o o o o o o o o o o

0 0 O

*-x

dc,

CJ

dc,

SH "O

00000000000

^4

o o o o o o

0 0 0 0
0 0 0 0

Z
PJ
f a
S

*
*
*
*
K
*
*
*
*
*
*
*

c timer D

C interrupt number

nt, install interrupt

t H

- H S H S H -H O
4-1 CD CD 4J Q)
-3< CM "H g
g -H rH
VO en G -H -H G fl)
-^ rH H EH EH -H CO

*
*
*
*
*
*
*
*
*
ir

S H O
(DO)
g rH
-H (!)
EH CO

alize timer and interrupt vector

set S-bi-

G <D-H
$H4JP4343
-H TJ -rH -H SH SH
(^ ' O G Q t C O O l
H < H
O> -H -H

sr 200 Hz

o o
O o

CM

ms to 20 milliseconds

dc,

43536313233

o -

o o
o o

: timer C

3-

:o vr
sn-autovektor # to $48,

vt </> -to

DOOOOOOOOOO

<~?

:o iera
:o isrb

0 0 O

o o
O o

initialize MFP 68901


3S of the MFP
ilize registers with zero

Ep,

o o o

(*C

^-* ^* m

.
rH
O
<
fa

* * * * * * * * * * * * * * * * * * *k * * * * * * * * i

0 0 0 0

co ^ > 0 0 0 0 o o o r- CO

C interrupt routine

Atari ST Internals

Abacus Software

^^ O CO *C
O < <C ~-~*-vf=C -W-CM
O O - CM . *3"
(^rtJOCMrH^P

fa Q o
fa

co -to co"
*

rH

-.^PrHO

faooooj--u>CMCMCD>r-r~in

CM
Q

.. O

CM
fiC
.
VO
gi
. rH

en in Q

CJ O

CJ

u>=S=QQQ=S=**=t===tt=-UJ--o>*
H

rH

<-H

O
Q
-

r- co
to *

rH

O - ' C X e ^ e i , * " - ^ ^ *
Q)<D<1)C])0)CD(1)(1)(D(D

o^
Q)

ef
M

0)
t^

f>*

01 O
M g g g g g g g g g g 4 3 M g 43 g
O J O O O O O O O O O ' O M C U O

rH
O

VO -sp CM
rH CO T

;
fa
f
f
f
f

a
a
a
a

o < *
o o o

O C O
O O r
O O
O O

O C O
H ^ T
O O
O O

r H * ? 1
r H r H
r H O
r H O

CJ
in

cj
r-

O P Q O
O t - O
O r H O
O O O

c n o c o c o c o c j O O C M O C J o e n m
faoooor~r~t-oincoofao
r H O r H r H r H r H P Q P q O C M - a ' r H i n O

CO
CM
CM
O
0 CO
0 0
rH 0

* 3 * r o o o r H c o c o t r - - c o v o ^ j ' r - vo rC M C O < ( a c M V O O C M C O r t ; O O ' ! I ' <


H p i q E i a b q f a f a f a O O O O r H r H r H

vovovovovovovovovovovovovovo

O 0
rH CM
fa
fa
VO VO

o o o o o o o o o o o o o o O O
o o o o o o o o o o o o o o O O

345

Atari ST Internals

CM
CO
CM
U)

J_(

CO ^-f
O

M
CD

id

MH
K

^_,
01

O
CU
M
O

-H rH
4J

rH
o

01

T>

P5

s-

M
O
0)
!H
O

^
O
1H

-rH

M 4J

o
^
o
O m
o
<u
VD -O N
4J
^ p
en
-H CO
(d
K
en
H
10 rH
3_i 43 td v> rH G G CU T3
-H
o
O O O 4-> .p
m o 4J ^ ol
C
o -H o
fd
K CO -H ^
31 VQ
G o O EH EH O 4J
a\t
M
vector
~x
EH Q Pi CM C/3 CO O

CO

H
Q

ft

M
S

O
G

CU

-t-l

4-1
CU -r-1

4-> H
P 0
0) 0 0 4-1
H H O
H
CD
Q ^4 H >
t-H
O O
S n rH 4J
M rH ft
B CU CU P
!H
fi
m 0 o M
4-1 4-> CU

n P

O
CD

O -H
0)
j^
o 0
^
f^ -H t-l
Pi
O id
0 +J 4->
(Q
ol 4_>
(U G M a
4J -H CU
>^
43 >i G S-H
ft -H <a
=p O O

4-1

-H

S
PJJ
pi
o

01

CU
M

01

<
M

CD
jj

O
rtl
1

rH
Q

CM

rH

CM
=tt=

rH
0
rH
O
00

vo

=tt=

rH

*.

rH

CM

o
Q

CO

r- vo
r-

jrj

CO

=tt=

.H

c1

o
CU

0!

in

VD
CO

o
O

CD
> M
O 01
g 43

CU

1s

rH
O
CM
f^

CM
O
*=T

CM
CM
fa
VO
0

=r

r-

CM
fa
VD
O
O

<:

o o
0 o

VD
O
0

VO
CM
fa

VO

CM
fa
VO

rH
01

43

(d <d
CU

CU

rH

rH

ra

id (d
0)

CU

rH

rH

CM

5F

fa

fa

vo CO CO
O m VO
en m in

fa

vt

t-0

O
Q Q

5T
CO
fa

VD

o o
o o

O
0

VO

CU

CU

O
g

rH

rH

rH

CU

CU

CU
[>

>
o

g g g

.p

<d

CU
ft
CU
^i
,
y
O
-H

O
CU

-H
H
<0

>

4-1

>

4-1
01

tJ 4J

id

rH

3 -H S
0 O -H
01 ft 4->

CU
>

M T3

(d

>i

<d

rH

0)

W Q

0!

P rH

o
fa m
fa
CO

en

c c a)

^
vo

=tt=

fH
0)

vt

CM

in

W vo
rH <H CM

vo

in in

CO

CO

CO

Q
O

O O O

Q Q

IO

o o
Q Q

43

43

H rH

rH

rH

43

fa fa

r^ c

O vo rfa fa r^
0 o

ss

346

rH

CJ 0 CM vo 0 o 0 (O m
Q o rH rH o 0 0 o OS
O 0
0 o 0 0 o
0 o 0 0 0 o 0 0 o
0 (_) 0 0 CJ o CJ CJ 0
0 CO S31 3*
fa fa
rH o PQ CQ oq
CO CO
VO CM CM CM CM CM CM rH rH

[V,

43

0) CU 0) CU CU CU 0 CU CU CU CU
>
> > > > > > > > >
O O O O 0 O O O O O o o
g g S g g s g
g s

W
CM
W 0"
0 CM CM 0 o
CM
o U
rt
o o 0 fa fa
0
qi vo ^J1
VD CO CO
O m vo fa fa CO 3* CO
en m in fa fa 31 (3* o

o vo CO 0 CM VO < CM
in in in m VD vo VO tfa
fa fa fa fa fa fa
vo VO VO vo VD vo vo vo VO VD vo VO
o o o O o o o o o O o 0
o o o o o o o o o O 0 o

U O vo 03 U
CO SJ1 SJ1 gi a1
fa fa fa fa fa

03
CO
fa
VO

^4
01

43

CU
J>

en
m

o
o

(I)
rH

rH

CU

o
m
o
r-

*-C H O 0

co
ffl
o

CO

CJ 0 0
W 0 o
o
0
m
o 0 0
o O 0
0 0 Q en rH 0 Q cy\ Q
U 0 0 M fa CM o [V]
0
rH rH rH rH CO 0 rH rH CO O
O VO VO
=r p- VO
T r^
CO

CM CM O

rH

m
o
r^
CM
O
O
CO

=*t=

rH
<

^p

VD

=8=

vo

f-H

rH
O
rH
00 00
VD en
rH o
O o
0
0 CO
rH o
VO CM

CO

vo
CO to

CM
rH

43

01

G
P

^N.

>
01
o o ^

g g

T-H

CU
>

rH

m in o
rt!

4J
-rH

0
0 X CU
0 >
>^ o >
M rH CU rH O
S
M O -n
M
Q

rH

ffl

m m
Q

ft
O

M 4-1
CU 01
4-1

4J 0
4J
G M M M c;
-H <a CD 0! -H
O 4-1 4-1
43
43 C G H
^
>i -H -H Q
ft
O CD O 0 M
rH U M CM CM S
(ft

43

bell enable

or vector
ine keyboard

Abacus Software

CM
CO
fa
VO

<,

CO
rfa
fa
vo
vo
0 O o
o 0 o

rfj
vo
vo rfl
0 o o rH <H CM
CO CO
0 0 0
<
0 o o O O O
O o
o o o o O o O 0 o
c r- co 1^1 ^*
o
[V]

m ffl o PQ co PQ o pq m

CM CM CM CM CM r- CM rH
CM CO O VO g? w CM =r CO
rt* pq CQ CQ
en en ff <
fa fa fa fa ^
fa fa fa fa fa
vo vo VO VO VO
vo vo VO vo
0 o O o o O o O o
o 0 0 0 o o 0 0 o
rH

Atari ST Internals

Abacus Software

VI
O
4-1

a
id
o
43

<U

4-1

3 .d

en

e .G

a>

EH

4-1

O
G

O
0>

O
4-1
O
0)

i-4
O

4-1

4-1
G, 01

S-4
O

S M

4-1

4-1
rd

01 4-1

4->

4J -H
>1

!B

4-1
-H

a;
a

jQ

>i

43

f-1

CO

PM
S

4-1 O
-H 4-1

3
0

<H

<u

-H

CJ

CM

CO

fa
fa
fa

43 43

VO

CM

tr

CM O

o
S

rH

< <;

0 0
VO
CJ

O
0

[%,

0 O

a1 ^r O r^

CQ pa

03
rH

CM
0
O

O
O
("""

pa

CM
fa

0)

01

_
> > -q

ro
0

cy* o
o o
Q en
fa fa
rH co

rH CM

rH
VO

O o

rH

^r co pq =p

VO

VO

VO

4-1
<D

a>

i-l

>H

0)
4-1 13
G 4-1
-H IB
T3

^4

CM

4-1

rH
rH

IB

ea

4-1

4-1 G
01 01 -H

a>

o
4-1

en

3 43 G
-H O
^i 3
4-1
4-1
G
-H

K,

4-1

CO 4.1
01

SH G 0) (D
O -H 4-1 4-1
4-1
CO O -H -H 43
EH 0) G O
CJ > -H P4 ^=r

CM

-H q >
01

to

>

-co-

3-

Q
O
O
t

q>

tr
>

^4

rH
VO

CJ

rH
VO

co co

m o

rH

tr
J>
O

CO

S 43

O CO

r- o
VO

tr
SH J>
CO O

t*
O

J-f
tO
CO 4-1

S 43 E 43 M

CO
O

ro
0 o en o
o o 0 0
o o 0 0
O

o vo o ovo co co o
Q
O Q sr o Q fa
rH r~
vo r- t
r~ <f>
3*= </> **>

0
CO
0

CM

O
O
0
O
0
rH rH 0 CM CO
0 0 0 CO r^P O vo m
CM CM O H

co CJ sC

< o

CO W CM
rH fa in

CM O
rH CO

ro o

en

VO O

CM O
rH O
O O
CM O CJ CO

rH

rH

in

in

O r H - a ' V O r H H

CM o fa r-

o o W o o H
rH

r- o

O O r H r H r H r H r H C M C M C M C M C O C O

o o o o o o o o o o o o o

VD

o o o o o o
o o o o o o

3
H

<

S S i a r a g 4 3

fa fa h fa b< fa
VO

>

CM
Q
CM ^ VO

pa o o o o a
VO

^)
0
4-1
O
(U

Q Q O, Q CO -a-

cr

0!

o o
o o

01

vo

IB
^) 4-1
CO
1^1 01
0)
C
g= -H
3
.
*o G
G
4-1
id >H G
O -H
M 4-14-1
Q O -H
rH 0! C
S > -H

o> o i b c o c o b b b b b b t i c Q b c o

CM

CO

0)

<v CO

6FFFFFCOO

s e 43 e

pa o

43

K
^
^
^ < rH
rH rH CTi CM C^

3FFFFFCOO

Q Q ==== o

a,

in
VI-

Q D

>

>
o

4-1 M

fa

o ra

o o

01

tj0)

4-1
A
3
>H
M
CD 0)
4-1 G
G -H
-H 4-1
3
rH O

o
o
o CJ
o fa
<
o

CO
HH

4-1 3
C rH

G,

JH
O

rl

g
0 IB
H 4J
M-l CO
G
^1 -H
O
*,
4J
0 4-1
0! G
J> -H
i)
4-1 -H
0) G
cs -H

4-1
0)

4-1

G,
3
M
H
0)
4-1
G
rH
rH

ft.

4-1

r3?

P3 O
03 CO

IB
4-1

H
0!

co o id

m ^- o
in

CO

rH

M 4-1
PH CO

~ -

(U

>

rH

>

Vl
0
M O
43
4-1
43
>, <:
0) 0
0! M O, 4-1 0)
y O O C
4-1

o id

IB

M
rd

0) -H

-H
4-1

-H

>i
(U

01
43
IB
4-1

o o o o o oo oo o o o o o o o o o o o o o
o o o o o oo oo o o o o o o o o o o o o o

347

00

007036 10D9
007038 51C8FFFC
00703C 4E75

move.b
dbra
rts

dc.b

(Al)+,(AO)+
DO,$7036

$80,$01,$12,$1A

************************************************
00703E 8001121A

000008DO
0080
0000
0000
0020
0060

dc.l
dc.w
dc.w
dc.w
dc.w
dc.w
32
96

0
0

$8DO
128

*********************************** *************

007042
007046
007048
00704A
00704C
00704E

00000950
0080
0000
0000
0020
0060

dc.l
dc.w
dc.w
dc.w
dc.w
dc.w

32
96

128
0
0

$950

*************************************************
007050
007054
007056
007058
00705A
00705C

000006DO
0100
0000
0000
0040
OOCO
000007DO
0100

dc.l
dc.w
dc.w
dc.w
dc.w
dc.w
dc.l
dc.w

$6DO
256
0
0
64
192
$7DO
256

*************************************************
00705E
007062
007064
007066
007068
00706A
00706C
007070

Block move
Next byte

Reset keyboard, disable mouse und joystick

iorec for keyboard


Keyboard buffer
Length of the keyboard buffer
Head index
Tail index
Low water mark, 1/4 buffer length
High water mark, 3/4 buffer length

iorec for MIDI


MIDI buffer
Length of the MIDI buffer
Head index
Tail index
Low water mark, 1/4 buffer length
High water mark, 3/4 buffer length

iorec for RS232


RS232 input buffer
Length of the input buffer
Head index
Tail index
Low water mark, 1/4 buffer length
High water mark, 3/4 buffer length
RS232 output buffer
Length of the output buffer

63

en

007072
007074
007076
007078
00707A
00707B
00707C
00707D
00707E
00707F

0000
0000
0040
OOCO
00
00
00
00
01
00

00007426
00007374
00007408
000072CO

dc.w
dc.w
dc.w
dc.w
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b

0
0
64
192
0
0
0
0
1
0

dc.l

dc.l
dc.l
dc.l

$72CO

$7426
$7374
$7408

***************************************************

007080
007084
007088
00708C

movem . 1DO-D4/AO-A3,-(A7)
move . 1 #$FFFFFA01,AO
move . 1 #$7124, A3
move . 1 #$7128, A2
$7102
bsr
move . 1 #$7118, A3
move . 1 #$7128, A2
$7102
bsr
move . 1 #$711C,A3
move . 1 #$7128, A2
$7102
bsr
move . 1 #$7120, A3
move . 1 #$7128, A2
$7102
bsr

***************************************************
007090 48E7F8FO
007094 207CFFFFFA01
00709A 267C00007124
0070AO 247C00007128
0070A6 615A
0070A8 267C00007118
0070AE 247C00007128
0070B4 614C
0070B6 267C0000711C
0070BC 247C00007128
0070C2 613E
0070C4 267C00007120
0070CA 247C00007128
0070DO 6130

Head index
Tail index
Low water mark, 1/4 buffer length
High water mark, 3/4 buffer length
rsrbyte, receiver status
tsrbyte, transmitter status
rxoff,
txoff
rsmode, XON/XOFF mode
filler

Interrupt vectors for MFP


#9, transmitter error
#10, transmitter interrupt
#11, receiver error
#12, receiver interrupt

setimer, initialize timer in MFP


Save registers
Address MFP

63

GO

63
5?

007102
007104
007106
007108

0070D2
0070D8
0070DE
0070EO
0070E2
0070E8
0070EA
0070EE
0070F2
0070F6
0070F8
0070FA
0070FC
007100

7600
D6CO
1613
D688
2643
D4CO
4E75

6106
1612
C713
4E75

267C0000712C
247C00007130
6122
C749
47F900007134
7600
16330000
11823000
B4303000
66F6
C749
8313
4CDFOF1F
4E75

rts

move . 1 #$712C,A3

00710A
00710C
00710E
007110
007112
007114
007116

dc.b
dc.b

rts
bsr

10,10,12,12

*************************************************
6 r erOf oo r oD

add.w
move . b
add.l
move . 1
add.w

moveq . 1#0,D3
DO, A3
(A3),D3
AO,D3
D3,A3
DO,A2

rts

move . b (A2),D3
and.b
D3, (A3)

$710A

movem . 1 (A7)+,DO-D4/AO-A3

bne
exg
or .b

move . 1 #$7130, A2
bsr
$7102
A3,A1
exg
lea
$7134, A3
moveq . 1#0,D3
move.b 0(A3,DO.w) ,D3
move . b D2,0(AO,D3 .w)
cmp.b
0(AO,D3.w) ,D2
$70EE
A3,A1
Dl, (A3)

007118 06060808
00711C OAOAOCOC

Write data in MFP


And compare
Until match

Restore registers

I3

DFFEDFEF
181A1C1C
00008FF8
1E202224

007120 OEOE1010
007124 12121414
dc.b
dc.b
dc.b
dc.b

dc.b
dc.b
$DF,$FE,$DF,$EF
$18,$1A,$1C,$1C
0,0,$8F,$F8
$1E,$20,$22,$24

14,14,16,16
18,18,20,20

007128
00712C
007130
007134

move.w
move.l
and.l

4(A7),DO
6(A7),A2
#15,00

*************************************************
007138 302F0004
00713C 246F0006
007140 02800000000F

mfpint, set MFP interrupt vector _


Interrupt number
Interrupt vector
Number 0-15, long word

initint, Set MFP interrupt vector


Save registers
Disable interrupts
Vector number
As index for long word
Plus base of the MFP vectors
Vector addres
Set new vector
Enable interrupts
Restore registers

48E7EOEO
6120
2400
E542
068200000100
2242
228A
614A
4CDF0707
4E75

**************************************************
movem.l DO-D2/AO-A2,-(A7)
$716C
bsr
move.1 DO,D2
asl.w
#2,D2
#$100,D2
add.l
move.1 D2,A1
move.1 A2,(Al)
$71A6
bsr
movem.l (A7) H-,DO-D2/AO-A2
rts

007146
00714A
00714C
00714E
007150
007156
007158
00715A
00715C
007160

4(A7),DO
#15,00
DO-D1/AO-A1,-(A7)
$FFFFFA01,AO
18(AO),A1
$71C6

**************************************************
302F0004
02800000000F
48E7COCO
41F9FFFFFA01
43E80012
614A

move.w
and.l
movem 1
lea
lea
bsr

disint, disable MFP interrupts


Get interrupt number
Convert to long word index
Save registers
Address the MFP
Address imra
Calculate bit number to clear
007162
007166
00716C
007170
007176
00717A

us

en
CA

5?

00717C
00717E
007182
007184
007186
00718A
00718C
00718E
007192
007194
007196
00719A

0391
43E80006
6142
0391
43E8000A
613A
0391
43E8000E
6132
0391
4CDF0303
4E75

302F0004
02800000000F
48E7COCO
41F9FFFFFA01
43E80006
6110
03D1
43E80012
6108
03D1
4CDF0303
4E75

rts

Dl, (Al)
bclr
6(AO),A1
lea
$71C6
bsr
Dl, (Al)
bclr
10(AO),A1
lea
bsr
$71C6
Dl, (Al)
bclr
14(AO),A1
lea
bsr
$71C6
Dl, (Al)
bclr
movem.l (A7)+,DO-D1/AO-A1

move.w
and.l
movem.l
lea
lea
bsr
bset
lea
bsr
bset
movem.l
rts

4(A7),DO
#15,DO
DO-D1/AO-A1,-(A7)
$FFFFFA01,AO
6(AO),A1
$71C6
Dl, (Al)
18(AO),A1
$71C6
Dl,(Al)
(A7)+,DO-D1/AO-A1

***************************************************
00719C
0071AO
0071A6
0071AA
0071BO
0071B4
0071B6
0071B8
0071BC
0071BE
0071CO
0071C4

move.b
cmp.b
bit

DO,D1
#8,DO
$71DO

**************************************************
0071C6 1200
0071C8 OC000008
0071CC 6D02

And clear bit


Address iera
Calculate bit number to clear
And clear bit
Address ipra
Calculate bit number to clear
And clear bit
Address isra
Calculate bit number to clear
And clear bit
Restore registers

jenabint, enable MFP interrupts


Vector number
In long word index
Restore registers
Address MFP
Address iera
Calculate bit number to set
And set bit
Address imra
Calculate bit number to set
And set bit
Restore registers

bselect, calculate bit and register number


Save interrupt number
Greater than 8 ?
No

63

en

I/I
H

(*1

r&
&3

5?

0071CE
0071DO
0071D4
0071D6
0071D8

5141
OC000008
6C02
5449
4E75

subq.w
cmp.b
bge
addq.w
rts

lea
lea
rts

#8,D1
#8,DO
$7108
#2,A1

$9DO,AO
$FFFFFA01,A1

***************************************************
0071DA 41F9000009DO
0071EO 43F9FFFFFA01
0071E6 4E75

082800010020
6704
61000862
4E75

34280008
36280006
B443
6204
D4680004
9443
4E75

rts

btst
beq
bsr

8(AO),D2
6(AO),D3
D3,D2
$71F8
4(AO),D2
D3,D2

#1,32(AO)
$7208
$7A68

r**** *******************

move.w
move.w
cmp.w
bhi
add.w
sub.w
rts

***************************************************
0071E8
0071EC
0071FO
0071F2
0071F4
0071F8
0071FA

0071FC
007202
007204
007208

40E7
007C0700
61C8
082800000020
6706

move.w
or.w
bsr
btst
beq

SR, -(A7)
#$700,SR
$71DA
#0,32(AO)
$7220

A**************************************************

00720A
00720C
007210
007212
007218

Else subtract offset


Greater than 8 ?
Yes
Pointer from a to b register

rs232ptr
Pointer to RS232 iorec
Pointer to MFP

rs232ibuf
Tail index
Head index
Head > tail 1
No
Add buffer size
Tail - head

rtschk
RTS/CTS mode
rtson

No

rs232put, RS232 output


Save status
IPL 7, disable interrupts
rs232ptr, get buffer pointer
XON/XOFF mode ?
No

ta
n

ta

CM
H

t-ft
*"

00721A
00721E
007220
007226
007228
00722C
007230
007232
007236
34280016
610002EO
B4680014
6716
2268000E
13812000
31420016
61A8
46DF
023COOFE
4E75

4A28001F
6618
08290007002C
6710
34280014
B4680016
6606
1341002E
601A

bsr
$71FC
move . w (A7)+,SR
or .b
#1,SR
rts

move . w 22(AO),D2
bsr
$751E
cmp.w
20 (AO) ,D2
beq
$725C
move . 1 14 (AO) ,A1
move . b D1,0(A1,D2 .w)
move . w D2,22(AO)
bsr
$71FC
move . w (A7)+,SR
and.b
#254, SR
rts

tst.b
bne
btst
beq
move . w
cmp.w
bne
move . b
bra

rtschk, set RTS ?


Restore status
Set carry flag, don't output char

Tail index
Test for wrap around
Compare with head index
Same, buffer full
Get current buffer address
Write character in buffer
Save new tail index
rtschk, set RTS ?
Restore status flag
Clear carry flag

XON active ?
Yes
Is MFP still sending ?
Yes
Head index
Tail index
Still characters in buffer?
Pass byte to MFP

#7,44(A1)
$7238
20 (AO) ,D2
22(AO),D2
$7238
D1,46(A1)
$7252

31 (AO)
$7238

007238
00723C
007240
007244
007246
00724A
00724E
007252
007254
007256
00725A
619E
46DF
003C0001
4E75

move.w

#$700,SR
$71DA
6(AO),D1

SR, -(A7)

rs232get, RS232 input


Save status
IPL 7, disable interrupts
rs232ptr, get RS232 pointer
Head index

00725C
00725E
007260
007264

007266 40E7

or.w
bsr
move.w

***************************************************

007268 007C0700
00726C 6100FF6C
007270 32280006

B9

CO

U)

Oi
Ui

007274
007278
00727A
00727E
007282
007284
007288
00728C
00728E
007292
46DF
003C0001
082800000020
671C
4A28001E
6716
6100FF3E
B468000A
660C
123C0011
6100FF52
4228001E
4E75

B2680008
671A
61000296
22680000
7000
10311000
31410006
46DF
023COOFE
6006

move . w
or .b
btst
beq
tst.b
beq
bsr
cmp.w
bne
move . b
bsr
clr.b
rts

move . 1
moveq.l
move . b
move . w
move . w
and.b
bra

beq
bsr

(A7)+,SR
#1,SR
#0,32(AO)
$72BE
30 (AO)
$72BE
$71E8
10(AO),D2
$72BE
#$11, Dl
$720A
30 (AO)

0(AO),A1
#0,DO
0{Al,Dl.w),DO
D1,6(AO)
(A7)+,SR
#254, SR
$729A

8(AO),D1
$7294
$7512

cmp.w

007294
007296
00729A
0072AO
0072A2
0072A6
0072A8
0072AC
0072BO
0072B2
0072B6
0072BA
0072BE

48E7FOEO
6100FF14
1169002A001C
08280007001C
67000092
082800010020

movem.l DO-D3/AO-A2,-(A7)
$71DA
bsr
move.b 42(A1),28(AO)
#7,28(AO)
btst
$7368
beq
#1,32(AO)
btst

**************************************************
0072CO
0072C4
0072C8
0072CE
0072D4
0072D8

Tail index
No character in buffer ?
Test for wrap around
Get buffer address

Get character from buffer


Set new head index
Restore status
Clear carry flag, OK

Restore status

Set carry flag, no character there


XON/XOFF mode ?
No
XON active?
No
Get input biffer length used
Equal low water mark ?
No
XON
Send
Clear XON flag

rcvint, RS232 receiver interrupt routine


Save registers
rs232ptr, get RS232 pointer
Read receiver status register
Interrupt through receiver buffer full ?
No
RTS/CTS mode ?

tt
n
en

MM*

t/5
H

E.
8?

Abacus Software

Atari ST Internals

M
<D
4-1

ol

T!
0)
Ol

-H

en
CD

M
0)

M
<B
IH

-H
CD
O
0)
in

tH

>

c-

M
IH

CD

o
10
4J
<0

4H
4H
O
01

4-1
H

a
a

(0
CD

01 3
Q) O
>H

C)
CM

VD
f=C

r- r-

<^
-~_<^Q

^_
,]

=r

M
10

<u
3
0 0 O rH
3 X 3 CJ

ta'
^i
rH
CO

r-

CM C*
CO rH
^ CO
O r-

<rt

Q
p^.
1-1

41=

vo
o
CO

cr M
QJ

O
E

0)

4-1
01
4-1

O1 a
(U E
43 O

G
j^|

<B
4-1
O
10
^
IS

en
<d

fa
fa
o

rH

^_(

fa

0)

fa
0

-H
0)

01

4-1

O 0)
3 (/}

01
C**

U
(U
M

, 1

o
a
<o

-H
10
4_)

>H

1-1

4-1
O
G

1H

X
0)

15

G
-H

O
tH

rH

4J

a M

0!
4_)
O

<a
j_l
10
e*

!H
CD

rH

10
3

tr

IH
p
43

0)

-H
19
EH

01 (0
CD (U
EH W

rH
Q

rH

CO

0 CO
<*

D^ _*s
G M
0! 10

0)

rH

G G
-H -H

M
0!
IH
IH

JH
CD

0)

rH

4-1 -H
10
45 4-1

3
43

a u

4-1

G
-H

0)

-H
(U

0)
G

rH

PL,

IS
JH

fc

^
. .

CO

vo

f^C
<^co

CO

CO

>

c/>
=tt=

a,
s
o

0)

f^'
*

VO

0)
IS

E 43

CM

CO

0)

Cn

0)

^q

10
(U

fa
fa
O
X

/)
EH

rH

>1

v^

rH
IS

v^.

pl-,-1

,_%

f^

CO

f3*
~r

-
O CO
fc.
^
fc O T-H
^

r> o Q Q

CO

-^--

rH

--

CM
rH

>

.J

43

tr
^ fi
CD

0)

0)

E 43

43

^_^

W rt^

rH

01

CM
Q

vo o

S
43

^
r^

10

(U

CM

,5

45

?'
o

iO
p-

C*'

PM

|^

4-1
10

3 -H

4-1
G
0)
01

C"

01 4-1 O
in 01 3
4-1 3
0) 0) 0) <0 0) O1 0 EH at o 0 O
>H IS K t/3 13 H 3 SH X S X

Q
CN
tH

O"

(U
^
01

u
o,

CM

*-

CO

CO

vo

rH
=t(=

0)

4-1
01
4-1

0!
G

IO
CO
f-*

CO

,~^

CM 0
CO an
, CO

<

r~ o

> CO

43
4-1
01
4-1

CT 4-1
0) 01
E c
0 43 43 43 43 43 4-1

O
O
O

cn

^?

CO

43

CM

o
o
o
o
o
o

0
Q
rH

0)
0! .>
C O

3
43

O
O
fa

CO
rH

fa

Q M TT1 M M f T i f~i T T i f~i F T T f~^


CMCMtMCMCMCNCMCMCMCMCO
0

<a
a,
<s

V.

O O C M C M C M C M r H O O l ^ V O

-rl

J_J

sroaicO'3'COCJOcotJCM

G
3
O

-H

O
CM
O

CM
O
O
CM H rH
CO CM O
[ ^ 0 0
0 0 0

rH
CO

43
4J
05
JJ

43

rH

43
(U

43

<

<=r *xr

fa
fa

HH
m
3

o^5
11

M
<D
<M

0
Q 0
__
,_) CM

M-l

-H
0)
O
(U

fa
fa
O
X

e;

rH

T!
(U

(fl

EH

10

0!
73

to

en

C"

M
(1)

o o o o o o o o o o o

o co u a1
o o r- 10
O
O

VO rH O
VO rH VO

VO
O

<
O

ro
ro
o

ro
r~
o
o

CO
O
O
O
CO
CM

CJ
o o o tq o
o o o w o
O rH O fa o

CO

fa

rH
O
O
O

VO

CO O

^r vo co

CO 00

rH

O
O

CM

o
o

o
o
o
o
o
o

rH

o
o
o

CO
CO
VO CM CM
VO CO

CO

CO

o
o
CO
CM

O CM
O rH

ro
ro
o

ro
ro
o

o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o

356

00734C
00734E
007354
007358
00735C
007362
007364
007368
00736E
007372

660E
117COOFF001E
123C0013
6100FEBO
082800010020
6704
61000702
08A90004000E
4CDF070F
4E73

bne
move.b
move.b
bsr
btst
beq
bsr
bclr
movem.1
rte

$735C
#$FF,30(AO)
#$13,Dl
$720A
#1,32(AO)
$7368
$7A68
#4,14{A1)
(A7)+,DO-D3/AO-A2

*****************************************************
007374 48E720EO
movem.1 D2/AO-A2,-(A7)
$71DA
bsr
007378 6100FE60
btst
#1,32(AO)
00737C 082800010020
bne
$73B4
007382 6630
#0,32(AO)
btst
007384 082800000020
beq
$7392
00738A 6706
tst.b
31(AO)
00738C 4A28001F
$73B4
bne
007390 6622
move.b 44(A1),29(AO)
007392 1169002C001D
move.w 20(AO),D2
007398 34280014
cmp.w
22(AO),D2
00739C B4680016
beq
$73B4
0073AO 6712
bsr
$751E
0073A2 6100017A
move.1 14(AO),A2
0073A6 2468000E
move.b 0(A2,D2.w),46(Al)
0073AA 13722000002E
move.w D2,20(AO)
0073BO 31420014
bclr
#2,14(A1)
0073B4 08A90002000E
movem.1 (A7)+,D2/AO-A2
0073BA 4CDF0704
rte
0073BE 4E73

Yes
Set flag for XOFF
XOFF
Send
RTS/CTS mode ?
No
rtson
Clear interrupt service bit
Restore registers

Save registers ?

txrint, transmitter buffer empty

rs232ptr, get RS232 pointer


RTS/CTS mode ?
Yes, then use this interrupt
XON/XOFF mode ?
No
XOFF active ?
Yes
Save transmitter status register
Head index
Compare with tail index
Send buffer empty
Test for wrap arround
Pointer to send buffer
Pass byte to MFP for sending
Save new head index
Clear interrupt service bit
Restore registers

ta
n

ff

2.

S3

re

3?

B
E>

00

LO
Ui

movem . 1D2/AO-A2,-(A7)
bsr
$71DA
btst
#1,32(AO)

beq

$73PA

$73D6

move . b 44(A1),29(AO)
btst
#7,29(AO)

$73FA

move . w 20(AO),D2
cmp.w
22(AO),D2
beq
$7406
bsr
$751E
move . 1 14 (AO),A2
move . b 0(A2,D2.w) ,46(A1)
move . w D2,20(AO)
bclr
#2,16(A1)
movem . 1 (A7)+,D2/AO-A2
rte

beq

0073CO
0073C4
0073C8
0073CE
0073DO
0073D6
0073DC
0073DE
0073E2
0073E6
0073E8
0073EC
0073FO
0073F6
0073FA
007400
007404

bra

48E720EO
6100FE14
082800010020
672A
1169002C001D
08280007001D
67F8
34280014
B4680016
671E
61000134
2468000E
13722000002E
31420014
08A900020010
4CDF0704
4E73

007406 60F2

48E780CO
6100FDCC
1169002A001C
1029002E
08A90003000E
4CDF0301
4E73

*****************************************************
movem.l DO/AO-A1,-(A7)
bsr
$71DA
move.b 42(Al),28(AO)
move.b 46(A1),DO
bclr
#3,14 {AD
movem.l (A7)+,DO/AO-A1
rte
007408
00740C
007410
007416
00741A
007420
007424

movem.l AO-A1,-(A7)

*****************************************************

007426 48E700CO

ctsint, CTS interrupt routine


Save registers
rs232ptr, get RS232 pointer
RTS/CTS mode ?
No, then ignore interrupt
Save transmitter status
Transmitter buffer empty ?
No, wait (must jump to $73DO!)
Head index
Compare with tail index
Transmit buffer empty
Test for wrap arround
Pointer to transmit buffer
Pass byte to MFP for sending
Save new head index
Clear interrupt service bit
Restore registers

Transmit buffer empty

rxerror, receive error


Save registers
rs232ptr, get RS232 pointer
Save receiver status
Read data register (clears status)
Clear interrupt service bit
Restore registers

txerror, transmit error


Save registers

B3
O

cn
o

sr
3

sr

^to o

J3 E

rH

(H

tH
Q c

P?
en

-H
EH

Q
CM

cf
* cu
X
o o
X

cu 3
o
O
M

rH

CO
CU

CO
10

.1
.w

rH

>

> to

O 4J

*
X

Q H
0
O

TH

O
O

W U
g CM

tH
O

o
o CO
o o
o en en fry. CO
o ^o < Q rtH tH CO CJ W
v) tH o
*=p
ts W =p f W

o
fT (

CM
C1

r-

O
O

CM
^P

CO
"C1

r-

CO CO
"C1 ^31

r^

0
0 (o
0 [O
0 0 0 0 0

*
*
*
*
*
X
X
X
X
-X

to
K

*
X
*
*
*

(H
Q
M
S

o CM O
o
Q
en cn

rH

X
-X

H.

rH

o o

O
TS TJ

^p

r-

0 0

o o

31 gi
r^ r* o 0
X

-1C

0
O

0 0

sp gi "31 *T *T
r- r- r- r~ ro o o o o o
o 0 o o o o

31 sp
f^ [^
O
0

X
X
X

-X
X
-X
X
X
X

o
Q
en
o
o
* o
-X
o
-X
o
*
-X
X
X
X

*
X

359

cu
c

4-1
rH

cu

rH

CO
to
-H

1
CU

cu

0]

O
CO

4-1

cu

en
4-1

n
cu

CO

-H
CU
O

!H

cu

0
3
CD

CO

C
ffl

X CU
M T3

4-1

CU

CU
rH

CO
-H
Q

en

rH

.Q
<0

o
o
c
cu

4-1
4-1
-H

cu
>

-H
4->
(0
tn
cu

r4

4-1
CU
co
<u

CO
CO
-H 0
Q S !Z K

ens
0

tH tH
<

o
co

CM
CO

W ~
co r-

CM

Q ^P

CM O O O
Q Q vo

vt r-

rH

3
M
O

a, cr

XI

i ig

CU

4-1 -H >
^<a
0 o o o to S 0

Xi

4J

X) E

*
*
*
*
*
*

X
X

gi

3
M

-X
-X

*
X
*
CJ

X
-X
X
X
-X

X
X

[~- o
X
o
CO
*
o
o o
rH
en tH CM Cs4 in
* o [V,
o
* o CM i
(J4 CO <o Q rW
* CM CM o o in in 0 VO H
-X r^ CO ^p o "3* w
* o CM VQ CO o CM ^P CO <
* 31 ^1* =3* *=p ^p in in m in

CM
CO
CM

rsconf, configure RS232

CO
CU

*********************

to

4-1
0)
U en

*
*

10
4-1

iorec table

>
o

*********************

CU
0
-H

to

C
rH

Get pointer to iorec


Restore status

3
C

o
3

0(A2,D1.1) ,DO
(A7)+,SR

X!

#$700, SR
$745C,A2

cu

IPL 7, disable interrupts


Base address of the table

$71DA

iorec, get pointer to table

cu
cu
o 4-1

*********************

$71DA
rs232ptr, get RS232 pointer
44 (Al) , 2 9 ( A O ) Save transmitter status
#1,14(A1)
Clear interrupt service bit
m.l (A7)+/AO-A1
Restore registers
.b
0!

CO

rs232ptr, get RS232 pointer

Atari ST Internals

Abacus Software

CM
fc

cn
o
o
o
o
o
0 o
in 10
3"
[^
O
O

rij
O
O

o
o
o
"=r
vo

^p sp
[^ r-

o o
o o

*
*
*
-X
*
X
*
X
*
X
X

-X
X

o O
vo
o
r~Q

o
U O
o
o tH
o VD
PT,

CO

CM

o
O
cn
sp

o
o

En o
O [^

CO CJ 0 *3*

10

f^

CJ

vo

<

1^3
O
0
O

CM CM
0 O
0 o
0 o
a1 ^Q
CO CO t*C
tH tH 531

t^
U>
31 sp ^p
[ C
[1 31
[^ r- r- f^
[ o o o 0
o
o o o o 0

rqi ^T
r^ r^
o 0

CM
O
O

ro
0
o
o vo
ffl

rH

CM
CO

-31
CO

sP

f^- (^
0 0
0 0 0

OJ
ON

00748A 7000
00748C 7400
00748E 4A6F0004
007492 6B20
007494 322F0004
007498 45F9000074F2
00749E 10321000
0074A2 45F900007502
0074A8 14321000
0074AC 2200
0074AE 7003
0074BO 6100FBDE
0074B4 4A6F0008
0074B8 6B06
0074BA 136F00090028
0074CO 4A6FOOOA
0074C4 6B06
0074C6 136FOOOB002A
0074CC 4A6FOOOC
0074DO 6B06
0074D2 136FOOOD002C
0074D8 4A6FOOOE
0074DC 6B06
0074DE 136FOOOF0026
0074E4 7001
0074E6 1340002A
0074EA 1340002C
0074EE 2007
0074FO 4E75

moveq.l #0,DO
moveq.l #0,D2
4(A7)
tst.w
$74B4
bmi
move . w 4(A7),D1
$74F2,A2
lea
move . b 0{A2,Dl.w),DO
$7502, A2
lea
move . b 0(A2,Dl.w),D2
move . 1 DO,D1
moveq , 1 #3, DO
$7090
bsr
8(A7)
tst.w
$74CO
bmi
move . b 9(A7) ,40 (Al)
10 (A7)
tst.w
$74CC
bmi
move . b 11(A7),42(A1)
12 (A7)
tst.w
$7408
bmi
move . b 13{A7),44(A1)
14 (A7)
tst.w
$74E4
bmi
move . b 15(A7),38(A1)
moveq . 1#1,DO
move . b DO,42(A1)
move . b DO, 44 (Al)
move . 1 D7,DO
rts

dc.b

1,1,1,1,1,1,1

**************************************************
0074F2 0101010101010101

Baud rate
Negativce, then don1 t change
Get baud rate number
Table for baud rate control
Get value from table
Table for baud rate data
Get value from table

Pointer to timer D
Set timer D for new baud rate
Set ucr ?

No
Set ucr
Set rsr ?

No
Set rsr
Set tsr ?

No
Set tsr
Set scr ?
Set scr

No

Enable receiver
Enable transmitter
Old value of the control register

Timer values for RS-232 baud rates


High byte

21

5?

63

ON
H-

5241
B2680004
6502
7200
4E75

0074FA 0101010101010202
007502 01020405080AOB10
00750B 204060808FAF4060

007512
007514
007518
00751A
00751C

5242
B4680012
6502
7400
4E75

dc.b
dc.b
dc.b

#1,D1
4(AO),D1
$751C
#0,D1

1,1,1,1,1,2,2
1,2,4,5,8,10,11,16
Low byte
32,64,96,128,143,175,64,96

#1,D2
18(AO),D2
$7528
#0,D2

midikey, keyboard + MIDI interrupt


Save registers
Clear A5
mbufrec, $7558
Interrupt from MIDI-ACIA ?
kbufrec, $7568
Interrupt vfromon Keyboard-ACIA ?
Still interrupt ?
Yes
Clear interrupt service bit
Restore registers

wrapout, test for wrap arround


Tail index + 1
Equals buffer size ?
No
Else start with zero again

wrapin, test for wrap arround


Head index + 1
Equal to buffer size ?
No
Else start with zero again

addq.w
cmp.w
bcs
moveq.l
rts

addq.w
cmp.w
bcs
moveq.l
rts

**************************************************
00751E
007520
007524
007526
007528

48E7FFFE
4BF900000000
246DOA2A
4E92
246DOA2E
4E92
08390004FFFFFA01
67EA
08B90006FFFFFA11
4CDF7FFF
4E73

************************** *************************
movem.l DO-D7/AO-A6,-(A7)
lea
$0,A5
move.l $A2A(A5),A2
jsr
(A2)
move.l $A2E(A5),A2
jsr
(A2)
btst
#4,$FFFFFA01
beq
$7534
bclr
#6,$FFFFFA11
movem.l (A7)+,DO-D7/AO-A6
rte

00752A
00752E
007534
007538
00753A
00753E
007540
007548
00754A
007552
007556

CP

en
W5
O

S?

OS

41EDOAOO
43F9FFFFFC04
246DOA16
600E

lea
lea
move.l
bra

$AOO(A5),AO
$FFFFFC04,A1
$A16(A5),A2
$7576

******** ********************************

007558
00755C
007562
007566
****************************************************
lea
$9F2(A5),AO
lea
$FFFFFCOO,A1
move.l $A12(A5),A2
move.b 0(A1),D2
btst
f7,D2
beq
$759C
btst
tO,D2
beq
$7590
movem.l D2/AO-A2,-(A7)
bsr
$759E
movem.l (A7)+,D2/AO-A2
and.b
#$20,D2
beq
$759C
move.b 2(A1),DO
jmp
(A2)
rts

007568 41ED09F2
00756C 43F9FFFFFCOO
007572 246DOA12
007576 14290000
00757A 08020007
00757E 671C
007580 08020000
007584 670A
007586 48E720EO
00758A 6112
00758C 4CDF0704
007590 02020020
007594 6706
007596 10290002
00759A 4ED2
00759C 4E75

*************************************************

$A32(A5)

$79CO

#$9F2,AO

bne

2(A1),DO

tst.b

cmp.l

0075A8 66000416

$7606
#$F6,DO

move.b

0075AC 4A2DOA32

bne
cmp.b

$76AC

00759E 10290002

0075BO 6654
0075B2 OCOOOOF6

bcs

0075A2 B1FC000009F2

0075B6 650000F4

MIDI interrupt
iorec for MIDI
Address of the MIDI ACIA
$759C, MIDI error routine

state

get byte from ACIA


from ACIA
ACIA ?

Keyboard interrupt
iorec for keyboard
Address of the keyboard-ACIA
$759C, Keyboard error routine
Get ACIA status
Interrupt request ?
No
Receiver buffer full ?
No
Save registers
arcvint, get byte
Restore registers
Mark bit tested
No error
Read data clear status
Execute error routine

arcvint,
Get data
Keyboard
No, MIDI
Keyboard

Keypress ?
Yes

SB

n
</i

ce
o

69

89

5T

o\*

Oi

0075BA
0075BE
0075C4
0075CA
0075DO
0075D6
0075DC
0075EO
0075E4
0075E6
0075EA
0075EC
0075FO

040000F6
0280000000FF
47F9000075F2
1B7300000A32
47F9000075FC
1B7300000A33
064000F6
OCOOOOF8
6DOA
OCOOOOFB
6E04
1B400A40
4E75

0075F2 01020303030304050607
0075FC 07050202020206020101

OC2D00060A32
64000084
45F900007656
7400
142DOA32
5302
E342
D42DOA32
5302
E542
20722000
22722004
24722008

Subtract offset

Pointer to IKBD code table


Save IKBD merken
Pointer to IKBD lengths table
IKBD index
Add offset again
Mouse position record ?

No
Mouse position record ?
Save mouse position

No

#$F6,DO
sub.b
#$FF,DO
and.l
lea
$75F2,A3
move.b 0(A3,DO.w),$A32(A5)
$75FC,A3
lea
move . b 0(A3,DO,w),$A33(A5)
#$F6,DO
add.w
#$F8,DO
cmp.b
bit
$75FO
#$FB,DO
cmp.b
$75FO
DO,$A40(A5)

bgt
rts

Times 4
IKBD record pointer
IKBD index base
IKBD interrupt routine

+ 1
1 - 5 => 0 - 4

Kstate
1 - 5 => 0 - 4
Times 2

Pointer to IKBD parameter table

Yes

Joystick record ?

IKBD parameter
Status codes
Lengths

move.b

#6,$A32(A5)
cmp.b
bcc
$7692
lea
$7656,A2
moveq . 1#0,D2
move . b $A32(A5),D2
subq.b #1,D2
asl.w
#1,D2
add.b
$A32 (A5) ,D2
subq.b #1,D2
asl.w
#2,D2
move . 1 0(A2,D2.w),AO
move . 1 4(A2,D2.w),Al
move . 1 8(A2,D2.w),A2

*****************************************************
007606
00760C
007610
007616
007618
00761C
00761E
007620
007624
007626
007628
00762C
007630

83

8T

007634
007636
007638
00763C
00763E
007640
007644
007648
00764A
00764C
00764E
007650
007654

2452
7400
142DOA33
93C2
1280
532DOA33
4A2DOA33
660A
2F08
4E92
584F
422DOA32
4E75
move , 1
moveq.l
move . b
sub.l
move . b
subq.b
tst.b
bne
move . 1
jsr

(A2),A2
#0,D2
$A33(A5) ,D2
D2,A1
DO, (Al)
#1,$A33{A5)
$A33 (A5)
$7654
AO,-(A7)
(A2)
$A32 (A5)

addq . w #4,A7
clr.b
rts

***********************************************
007656 OOOOOA34
$A34
dc.l
007 65A OOOOOA3B
$A3B
dc.l
$A1A
00765E OOOOOA1A
dc.l
007662 OOOOOA3B
$A3B
dc.l
007666 OOOOOA40
$A40
dc.l
00766A OOOOOA1E
$A1E
dc.l
$A40
00766E OOOOOA40
dc.l
$A43
007672 OOOOOA43
dc.l
007676 OOOOOA1E
$A1E
dc.l
00767A OOOOOA43
$A43
dc.l
00767E OOOOOA49
$A49
dc.l
$A22
007682 OOOOOA22
dc.l
$A49
007686 OOOOOA49
dc.l
00768A OOOOOA4B
$A4B
dc.l
$A26
00768E OOOOOA26
dc.l
*************************************************

Get IKBD index


Minus base

Get interrupt vector

CO

cr
as
n

IKBD index minus 1


Test index

Pass record pointer


Execute interrupt routine
Correct stack pointer
Clear IKBD state

Parameter table for IKBD

Atari ST Internals

Q m
*

1~3

CM

r^

F^

NCM*5PVO

rH

43

rH

43

Q)
CT 0) Q) Q)
> T S 4 3 > > > < 0 < d
T

4J
-H

Oj

Q->-U>

-H -H
01 45 45
01 01 01

S < a c o g g g r H 4 3

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

r3

1-3

01
rH

4->
45

4J
>M
-H

4J

^i
id

4->

45

er>

0)

<D 0
,-3 3

-H
K

rH

CJ

fQ

</> P-

p-<vo

rH P- </> C

G
43

CO M
43 43

a
>,

M
O
4-1

4J
-H

01

43

0)

4-1
-H

^J

rH

,j]
P^

43

rH

id

0)
rH
O

+J

>^

0)

Hq

O 0)
O 3 W

C^
EH
O

gH

v
O r H O
".OrHO
CO V O W Q n Q W Q O Q
p- ( Q v o ^ p - r H v o - p - e n
p- -C/5- p* O P- </> P~ CM E O>
O

G,

45

-rH O
53

Q)
M

-p- m vo > P- o
=%*

rH P-

43

0) CD id

J_(

EH
O

4-1
-H

^P

tf_4

VO

rH

j1

M
O

a)

>H
H
45

[ 1

O
13

4-1
45

J_l

43

4J

4J
-H
45
01

0
M-l

e-\1

43

0]

-*CJrHO
* C O r H O
Q r i C f f l Q f O r t J C J Q C O

mcMVo

-rH

0!
X

M
O
MH

45

01

0)

-rl

4-1
O 0)
3 CO

U-l
-H

leased ?

0!
4J
>H
0)

key released ?

-H

4-1

in o
<

fT)
0)
01

43

0 -O 4->
O <d 1H
M O O )

=tt=-=S=Q

rH

M
O

0)

>ri;vorHOra;^r~-

43

0)
H

4-1 4-1

di

m m

rtJCO

CO
01
<B
M
13
T)

CO

HH
O

O
-H
4-1
01
?*i
0

t!

-rH

d)

essed ?

-H

<U
X

key released ?

terrupt routine
joystick data

eived keyboard codes


status
key pressed ?

Abacus Software

(1) H

E G O
O 43 43 43

S G 01
O 43 43 43

ft, <!) H
" G O
O

43 43

43

fX (!)
S G
O 43

Q) id
01 s-i
43 43

*
*
*
*it
X
X

*
*
*
*

o
o
o
o
o o

CJ
CM
CM
CM

en
vo
o
o

o o

rH

CM
CM

O
Q

O Q Q
co vo M

Q in CM
CO

en
vo
po

CJ

en
vo
ro

CM -a1
O

CM VO

en
vo vo vo vb
p- r- r- Po o o o

0 0 0 0 0 0

X
*
-X
X
X
X

CM
O
O
O VD
O O
O VO
O VO

o
o
o

<
o
o

vo
o
O
Q
CM
Q
o
en
o
O
O
rH
o
o
O
O
o
o
o
o
o
o
o
o
o
vo
rH <O" O VO rH CO
CJ
VO rH O O VO
o
CJ P- O O CO VO o o c j i n o o c o i n o o o
o
CO O O V O C O O C J V O C O O C J V Q CO O CJ VO CO O CJ
o vo o v o o v o o v o o v o o v o o vo o vo o vo o

o ^

vo

< CJ O

PQ rn cq ca ca

vo
po
o

vo vo vo vo
P- p- p- po 0 0 0
o o o o

o
o
o

vo
po
o

CM VO CO O

CJ CJ CJ CJ CJ

vo
po
o

365

vo
Q Q Q Q Q f

vovovovovovovovovovo
p~p-p-p-p-p-p-p-p-ro o o o o o o o o o
o o o o o o o o o o

vo
po
o

CJ

vovovo
p-p-po o o
o o o

Abacus Software

Atari ST Internals

IB
4-1

0)

43

O 0)
S co

rH

rH
Q

rH

-H

rH

1H

CO

0
Q
O
CO CO

gi

0
Q
rH

=8=

JH

4-1

CO

U5=!*=

O
,)

rf~*
</>

,1 O
Q co

O 0! O
53 O 3

0
Q
- VO

in
<
^r
CO

CO
41= 4^

rH

i B C X C U t U i B Q - C U r H
rH
C O
E G O
S C
43 43 43 O 43 43 43 O

v>

VD rH CO o vo
O CO to o o
VO CO 0 CJ VO
VO O VD O VD

CO

m
o
O

CO
3

O
4-1

4-1

H
IB
4-1 G

8
o

CO

VO
CO

0
G
CU
IB

co

m
<

-~
m

<
<C

Q
m

CO
CO

CO

o
o
o

4!= 4t=

43

43

&, cu M tr
o G- 4 -- 41 C3 UE OE O4 U3 OE4r - H1

o
o

O
CO

4-1

CO
CO

C
3

4^ V* 4^

=r
CO
CO
O

-H
CO

^r CJ p- CO rH i<
< co </> CM D - Q <
r~ co p- *. pO
K
r^ </! [^ o r~ to- vt *y ii

0)

CM
O
O

4_)
CO

rJ

.p

G
O >i CO
U CU CO
4-1

^
<

o Q CO
VO
>* r- ro r
r- CM r- <n r- co r</> =8= vt 41=

-U>

^
U

CO
EH

4-1

"Z. CJ

CO
En

(U

pf,
CO
0

o
o
o

&

CO
3
4-1

CJ
O 4-1

CU
_C"I

CJ
o

>i
0!
X

(U

o
o

CD

01

>!

4J
-rH

r>1

IM

(U
H

M-l

-rH

rH

a,

7D780A86

4-)
-H

rH

CO
3
4-1
<B
4-1
CO

er>

0)

TS
01
co
IB
CU

CO
CO

CU

-H

Q)
M

released

-H
4-1
IB

C"

EH
U

T!
C
P
0
CO

IB id
rH

rH

CU

CU

>i >i
IB Id

rH

rH

CD CU CU IB 01 CU
>H 05 >H CO Q Q

01

01

rH

rH

01
X

4-1

IB
S

0 o

CD
T>
O
O

>1
01
CO

M rH
0) (U
4-1 4-1
G G
3 3
O O

<B

CO

Q<

CO

in
O

^^ CO

a TJ

rH CM

id <d

CJ CJ

in in
rf; <;

~
m m

CJ Q
PQ <C
p- -co-

CJ Q
P- p-

rtl

*.

m m > w
Q
-. r~ r- r~ p- P- pc^ r^ ri^ p- o <; f. P-

</> />
O

4^ < / > < / > < / > Q to-

4-1
CO
4J

CU
C

4-1
0)
CO C

43 43 4-1 43

43 43_

43_ 43_ 43
CU CU CD

CU

CU

o
o
o
o
o

o
o
o
o
o
o

0 0 0

O Q
p- po o
W Cn
P- p-

CO

o
o ^T Q
o o o m
o o o <
o o o o
0

w u

rH 0 O VO rH o o o Q
CJ rH rH
CJ CM o O CO CM O CM CM O pCO O CJ VO CO o O vo CO P- CO
O VO o vo o VD o vo o VO CM rH 0 rH

co m
ffl

O C M V O C O C J W C M ' 5 1 C O < W O ^ r V O C J E i 5 V O O O = 3 '


E n E n E n E n E n E n O O O O O r H r H r H r H r H C M C M C O C O

vo vo vo vo vo vo i p- p- p- [ f^ [^ [^ (^ p~ p [- p~ {
P-P-P-P-P-P-P-P-P-P-P*P-P-P-P-P-P-P-P-Po o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o

366

Po
o
o
o

o o

r~
<:
o
Q

ffl o o
P-

f=c o o

o o o

VO O

G\t

O C M C M r H T r ~ p - C O

covoi<vopqpqcQop3P3

o vo

VO

rH

rH

rH

VO rH

rH

V O r f S C J O C M V O W ^ O C O W

co co co ^ ^ ^ ^ m in m
p-p-r-r~p-p-p-r~r~pP-P-P-P-P-P-P-P-P-Po o o o o o o o o o
o o o o o o o o o o

rH

H-

X)

rH

tr

0)

CU

01

CD

0!

o o o

0)

T!
01
CO
CO
01

c
3
o
CO

ft

0 ^
4-1 -H >H

rH

-H
4-1
CO

CO

rH

o
!3 <

rH

0
01

01

01

p
id

rH

o
CO
c
o o

S3

CO
^i CO
01 0!
TS
0 T!
S3

ft.

in

o
0
r- Q
Q
03
- w
r- Q to to to r- CO CM m
- O r- Q
PQ CJ
r- t

pCO

O
=4t=

rH
Q

rH
Q

=*=

t/>

=*!

VO
03

in

<

ft.
n
=tt=

03

PQ to
en
o
=tt=

$77A8

$7792

$A7B(A5)

in m

IAS)

in
<

^- X! X) X!
01

0!

01

01
>

ft

tr ft
tr > > >
<p o o o o e 0! g
XI i ' X! e g e g CJ X) CJ
id 4J

M CO

01
G

4-1
CO

tr

CO

s s
0)
X)

0)
X)

O
S

r^*,

Dl

4-1

r
I

g g

#0,D1

C"

V ( A 5 ) Start sound

INSERT key released ?

Yes

HOME key released ?

Xi
id

Save iorec for keybaord

MH

No

$A5E(A5) ,AO

X)

CJ

Address of the CAPS LOCK keyboard table

DO,D1

rH

rH

$ A 6 6 ( A 5 ) ,AO

Scan code to

Address of the standard keyboard table

03
to
o
to

#$7D78,?

CJ
-H

$77C2

Atari ST Internals
1

Abacus Software

c>0!
-H
4-1
O

CJ
O
CO
PM
CJ

in
o Q
Q m

rto

to

p-

-o

0!
01
CO
01
M
ft

T!
0)
CO
CO
01

ft

0!
X

0)
X

-H
A
CO

-H
CO

en

-H

01

in

in

m
to

01

m
CJ
to w

to

rto

CM

rH

g S g id

4-1
CO

tr i

01
X!

O
g

CO

(U
Xi

4-1
CO
4-1

XI

tr

01
X)

VO
CO

ft,

PQ
rft.
o

PQ

CJ

Q H
CM

0
rH
O ^*

rH
^

rH
^31

Q
CM

VO

W o
c r- co

IT
CO

CO
CO

CO O
0 0

ft

r~~

CM

PQ

CQ

VO

-a*

PQ

CJ r- CJ

VQ

r-

(H

(H

rH

=T
VO

VO
VD

< U
VQ VO

W
VD

CMVO
r^- r~

ft.

03

ie
03

VO

CO

m
ft.
o

r- O
o O
o 0
o o
0 o

CM

0
0

O
O

r^

%r

o
o
CO CO fxl o
D m 0 CM o
o CM o CM o
o 0 o o 0

Q r-

r- r~ r- CJ
ft f <, o
o o o o

CM

CO

^r

w [V, ^r
m r- o
p o o

in

<c

VO
VO

ft,

o
o
o
o

in
<C
o

rH
O
O

VO

0 o 0
0 0
0
Q W U CJ CO 0 0 Q o D ^ Q Q CO Q ft,
CM o r- t o 0 0 VO ^1 CM O VO CM o CM rH
CO r- PQ PQ
fe CM CM O CM CO r- o CO VO CO
o VO CM rH CM t- rH CM 0 o VO CM O VO O VO

CM

o
o
r~
CO

en

03

ft.

Cn

CTt

CM

CO

<

<C

ft, O W

CM

VO

m PQ

CJ W CM O3 ft. 0
PQ CQ CJ O CJ Q

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

367

Abacus Software

o
O

Q CO
*. W

en plO p-

O
W

CD
X

a -p r^i
a 0) EH

T>

<o

-H
S-l

J "j

CD

M
01

O
(/>

T3

1 ~\

G
10 O O
CJ S3 CJ
^

O
S3

EH O T!
CJ 3 <

0
f-l
3
O
"^
P5

4->

-H
M
O

M
M

3
O

CD

EH
O

CD

J>

(_3

G
0
O
^

c
0
o

K
EH
CJ

O
Q

in
o

c-t
rH
io O Q
f_I
o
o
Q in
Q
Q
Q
Q
Q
Q
o ^ co ^ pq
_ CO
..
Q CO Q 0 CO *-*
O
* U
*
< CO Q CM Q o
. U .* Q en CM O </> in
*,
t-H
p0
CM
O C n p O i - H O Q C I Q C M
^
pVO f
.

o
CO
VD

LO

p- CM
=s=

=*

en
^- ^C
tft-

CO

CM
O =*t=

co

r_|
=tt=

^H
&

.p

to GSX standard

0)

IP.
CD
cH

to GSX standard

^,

M
(1

01
M

P-

43

ft. u
E O

a -M

0 43

n)

S-l

CD
>
0
g

^
0)

>
o
g

-p
M
^_>

43

43

cr
0)

P.
g
O

0
fl

==

CO
p~

^r
-

=w=

00
p-

cocn^rcoE

== -co

=tt=

=*=

~1
tr
43
43
t T t T 4 3
(TO*
43
CT

CUGJ

0)0)

CU
0) ^> O
o 1l pP., <CD D T 3 c a p , ( i j > > ( O p , c i ) > > < o p , a ) >
o <a" T S U S G O O S H g G O O S - l g G O
. g 43 U 43 f d 4 3 0 4 3 g g 4 3 0 4 3 g g 4 3 0 4 3 g

0077D2 OC00003B
0077D6 6510
0077D8 O C 0 0 0 0 4 4
0077DC 620A
0077DE 06410019
0077E2 7000
0077E4 600001B2
0077E8 206DOA62
0077EC 10300000
0077FO 082D00020A5D
0077F6 6760
0077F8 OCOOOOOD
0077FC 6604
0077FE 700A
007800 672A
007802 OC010047
007806 6608
007808 06410030
00780C 6000018A
007810 OC01004B
007814 6608
007816 7273
007818 7000
00781A 6000017C
00781E OC01004D

J5 tf
.
T! J>
o O
cd g

rH

CO
p*

o oo * CD o
Q en CM en Q
^ . c n ^ r c o t *. en co co

368

CO

VQ

\a

CM
CM
CO

po
o

7274
7000
6000016E
OC000032
6606
7000

fe

<a

*W *O
CD
0) M
Ti M
O CD
O S-l
O,

007824
007826
007828
00782C
007830
007832

-H
-P
0
C

CIJ

to GSX standard

G
O
-H
4-!
O
C
O 3

0)
P

E ?

c
o

(8
+J

to linefeed

CD

0!

return

0)

of the shift keyboard tab.

o-

et to GSX standard

C"

Atari ST Internals

Atari ST Internals

Abacus Software

C1-

(U
CO
o]
0)
m
(X

0)
CO
01
fi\
M

A
>,

>,
0)
X

<D
^

4-1

4->
>H
-H

1-1
-H
J5
01

A
01
(V.

4-1

,?

a>

-H

01
01

01

0)

^H

S
4J

;>,
0)
X

01

C"

0]

P M

$-1

4J O
10 ~v
4-1 T!
01 C

4-1

M-t

G
<0

<a

4J

4-1
lf_|

- -H
E-i
(-3 O O O <Sl fi (D O
i=C S3 - & - fO ^ 13

s ^

en va -=r
en o co
r- </> r^

Q
^ CO

o
Q
- CO

CM

<

CM

in

CO

rH

4-J

in

<-H

<

o in

Q ft

<-H

< co , o - CM CO K CO - . . ^ CM CO ^ 0 0 v O
enpqQQencqcncopqQ
|k< en <o en < CO OQ Q en o en
d m fa
en
CM co in en
en K en
en CM co in
CO
m
en to <n CM co in in
p* -to i^ n p- -to
*=C n r<o r*
K

CO

* <O =!t= -to

cr
>
O

CD

4J

43

45 ft
43

( D O ) '

45

01
_

><oT3(aoitra<u>>t!cr>
a
e c o
C O O C O J O
4-1 d)
O 45

<o

45 45

45

45 45
45

45

'
oj a>
a)
<op.a>>>iocr>

M g
4 5 g g i 0 4 5 E 4 5 0

0)

43

45
OJ
C

0)
>
O

g g < 0 4 5 g 4 5 0 4 3 g

007834
007838
00783C
00783E
007840
007844
007848
00784A
00784C
007850
007854
007858
00785E
007862
007866
007868
00786C
007870
007874
007878
00787C
007880
007884
007886
00788A
00788E
007892
007896
00789A
00789E
0078A2
0078A4

60000162
OC000036
6606
701E
60000156
OC00002D
6606
701F
6000014A
0240001F
60000142
082D00030A5D
67000138
OCOIOOIA
6618
103C0040
142DOA5D
02020003
67000122
103C005C
6000011A
OC010027
6618
103C005B
142DOA5D
02020003
67000104
103C007B
600000FC
OC010028
6618
103C005D

(B
C

CT

369

Abacus Software

Atari ST Internals

c-

co

CO

!H 0
ra -H
f\
O
MH

t-<
c-.

ra -x
4-1 tS
co

CM

H
W
^
EH

CM

a
*
in
CM

a
g
P

O H
4-1 ra
>

r^

0)

4-1

S CO

PS

o cu a>

(!)
G
O
Q

pq
CJ ^
Q en CM CJ to
r- en vo CO N
to r- 40 ^ tH
Q

43
<D
.
0 C
E ra

CD

P a
P

, ]

4J

ra

0)

CO
HH

!H

^1

(!)

3
M

CO

Hi EH >

0!

(!)

>H

rd

^_l
JH 4-1
O CO
*4 1 H

o-

G
P
O

IH

CO

4-1
X

P o
CJ

CM

^Q

> ra
O >-l
g 43

A,
O

IS

| t

(J_j

CO

a
,G

M
CD

-H

O 4J 4n
CD

$_|

4J

tf_|

0!

0)
i-H

(!)
G
O

*O

(U
>H CD

r>

X
-H

SH
0

CD -H G
CO f\H<8 co

CJ
CM
(SjJ

p.

to

CM
Q

&3
P3
en
r^

03

CM

a
n

CM
fQ
-^f
0

01

P.*

CO Q
CM
CM f-H Q
F
<O CO 0 O
. ^p en
A,
CO
CM to r 0 1

rH

tr cu
0) "O > rd
t! O in
rd E 43

er
ra
(U

0)

a tr
cu

43
fi

ra

43 1 O

o
o
o

H Ul
O fe
rH h
O PH
O <
O CJ
t <H

in
<
Q

m
(rf
=*>

Q =tt> to

rH

tr

4J
-H

4-1
(!)
CO

^
O

43 43 43
CD

io i

g
O

4-1

0>
-H

4J

M
O
4J ^x.
IH T3
-H G

0)
co 45

>H >H co

ca

4J

UH

-H
A
CO

M -M
O W
*W

ra

HH
4J
O 0 4J >H
G) (!) 0
P O
O 53 >H X U ^ S3

S3 ^
0

0
Q

Q Q en
m - en
< n P^
m =tt= <n- =s= v> =tt= to = =
,

co
IH
-H

fc

-f^*
r(^

ft
-H

-5P

4J
G 4->
-H CO
O 0)

0)

ti

0)
O
4-1
CO

T)

g cu

(U

in
o

CO

en
rH
HH

^
ra
O
43

CO

cursor left
cursor left
atus

o o
o cu

CO

cursor up
cursor up
atus

4-1
tH
-H
fl

0)
co
CO
(!)

ouse scancode table


s

>,

4J

o
cu

O
0)
co
03
CD
!H
Q,

o
Q
k.
n
==

CM

\o Q vo

o
<*

t
in

43

o tr
ra 43

t-H
1

pa

<qn

0
CM
<J ^31 en

f- m- r=tt=

43

43

0)
U

Q
.

0
41=

rH
Q
CO
1

in
rtj
*-*

Q 0

ii

o o

VB

in
(^J co rto
=*= -co
K

43 43 43

43
(8

CM

43

73 tr
O C
CD
ra 43

CJ
CM

<

n
in 0
< o
o o
Q

V>

O O
O O
o CJ

Q CM
CM O o
^r CM [^
rH O VD

pr]

CM

pc3

^p

Q
O

a1

Eu
O

O o
O
o
o t-H < Q P4 o
n o O o u> in o
o o CJ vo CM 0 0
-i VD o 5 m CM vo
=p CO O O CM 10 CO
ffl PQ m O o o o
03 co CO CO CO co CO
(-. i r~
f~- r [
(

CO O O
< <
CO CO 03
r~- r*- f^
o O 0 0 0 0 0 0 0 0
o o 0 0 0 0 0 0 0 0

r~
o
o
o
o
en CO
Ut o
in =p
=p r~
CJ
CJ
CO

CM
CM

n
CM

CO
31
O

rH
O

O
vo m o

w fo vo
o
in o o
rH
< o rH
EK o o O h 0
CJ o O Q o O O 0
t-H o n CM o o CO 0
VO CM ^p O CM r- ^p 0
vo rH i-H rH O vo i-H vo
^p VO < H CM vo < H
{*) W w H t< P4 CM PM
0 CO

o
o
o

Q m

&

ra

o CO
o h
<T
0
0 fe
0
0 En.
rH O
CJ
0 rH co fO
CJ VO ^p CM
O VO rH rH

n CJ
o a

S 0 0
0 0 0
Q 0 0
CM o o
O CM rrH O vo

^p CO CJ o
CM vo CO CJ O ^p CO
0 o o 0 rH rH rH
Q a Q Q W
CO CO CO CO CO 03 03 03 03 CO CO 03 CO CTl en en en en en en

CM

r- r- r- r- [ C
o o o o O o
o o o o o o

!
O
O

370

r- r~ r- r- ro o o o o
o o o o o

[ r^ r~ r- r r*
O 0 0 0 0 0
O 0 o o o o

r- r- ro o 0
o o o

00791C
007920
007924
007928
00792A
00792E
007932
007936
00793A
00793E
007942
007946
00794A
00794C
007950
007954
007958
00795C
007960
007964
007968
00796C
00796E
007972
007974
007978
00797A
00797E
007980
007984
007986
007988

123CFFFF
600000E4
OC01004D
661C
123C0008
143COOOO
102DOA5D
02000003
670000CA
123C0001
600000C2
OC010050
661C
123COOOO
143C0008
102DOA5D
02000003
670000A8
143C0001
600000AO
OC010002
650C
OCOIOOOD
6206
06010076
600C
OC000041
650A
OC00005A
6204
7000
600E

move . b #$-l,Dl
$7A06
bra
cmp.b
#$4D,D1
bne
$7946
move . b #8,D1
move . b #0,D2
move . b $A5D(A5),DO
and.b
#3, DO
$7A06
beq
move . b #1,D1
$7A06
bra
cmp.b
#$50, Dl
$7968
bne
move . b #0,D1
move . b #8,D2
move . b $A5D(A5),DO
and.b
#3, DO
$7A06
beq
move . b #1,D2
$7A06
bra
cmp.b
#2,D1
$797A
bcs
cmp.b
#$D,D1
bhi
$797A
add.b
#$76, Dl
$7986
bra
#$41, DO
cmp.b
bcs
$798A
#$5A,DO
cmp.b
$798A
bhi
moveq . 1#0,DO
$7998
bra

Only one pixels left with shift


Onl;

Cursor right ?
Cur
No
X ooffset for cursor right
Y ooffset for cursor right
status
, Shift
Shi
Left
Lef and/or right shift key pressed?
NO
No
Only one pixel right with shift
Onl;

Cursor
down ?
Cur
No
X ooffset for cursor down
offset for cursor down
Y o
Shift status
Shi
Left
Lef- and/or right shift key pressed?

Only
Onl one pixel down with shift

No

'!'
Not greater or equal
'='
Not less or equal

'A'
'Z'

co
I

E-

Abacus Software

4-1
0)
73
O

0)
T3
O
0

p.
0

ra u

-r-l
4-1

-rH

rH
-H

o en CD >d
en < C5 EH

a
CM

tn

4H
O

3 T!
H G
0, H

MH

,-H
rH

rH

-H 3
<d MH
4-1

!-i
H CD
<d MH
3

M-l

tr 3

j^

<a
01 c
0) -H

a ia

-rH

T!

id

S3

CQ

<V
G
-H
4-1
3
O
4-1 r4

X
0)
G

<d i-l

0)

0 -H
10
4-1

>H CQ

4-1 M
>, 0)
.Q 4-1
-H C

a -H0

-H
E

0)
S3

5s
rH

Q
^ CO
< cn

^
1-t

CO

ViO

cn
CO
vo cn r- cn cn
t/> r- m ( [^
=8=
== v> u>

t1 o -tQ
^
CO

Q
..
!-H

^Q

a
o

O
43

a -H
O J3

m
r-l

rH

TJ

CO

id

11
Q

rH
Q

^-, rH
O Q

-_s

O
*. f
^^ CM w^
CO =tt= ^r

r~ f
r32
~

,-H

&

>

CD
0

3
CD
O

J5

tr

a
o

id E E <d

rH

CM

CM

ft.

CJ

cn
r^
</>

rH
Q
fc

^_^

0
rf^

== vo

PT")

CQ
cn
r-

rH

tr

P.
0

ffl
CO
0

rH

.a s o

tr
CD

,_, ^ ~
0 O CO
rtj
*.
^
~-* O rH
o Q Q

cv to
0

*
*
X
JC

*
Je

CH

<u
4-1

3
O
(11

x
w

Ctl

o
r^
</>

. .
CM
*-^

ro
o
o
o CO o
o o o

CO

o
o
o

rH

(J m u
o vs o

CM
0
CM
<>

O
V0

^
rH
f|

<;

^p

<*Q

CO

CO

cn
ro
o

CO

cn
ro
o

o
cn
cn
ro
o

cn cn
cn en
r- r~
o o
0

cn
en
r-

o
o o

rH
"C1
O

Q
f
cn
cn
r~
o
o

u w

CM

0
0
CO
V0
CM

CO
^0

CM

m m cq

cn en
cn cn
r^ r~

o
o o
0

o
rH
^P
^P

CM

vo
o

CO
CM
CM

PM

in
o

*T

CM
O

in

o
o

*
*
-JC

CD
O

CM

CO

C
f

CJ

CO

O rH
CO sr

r =p
cq J CM n

O
<C
f^
cn cn
c^
n en cn
r~ rr^ t
0 o
o 0 t0
o 0 o o 0
31

o o CO
o o o
o 0 0
o rH 0

o va

0 CM

cq
cn
[
o

-H

rH

0!

JC
*

*
*
1C
*
-X
X
X

0)

CO
4-1
r-l

JC
*
JC

Je

in
r*3>

\r)
CQ

rf

cq
CQ CQ
cn cn cn o\
r- r^ ro o o o

0 0 0 0 0

*
*
JC
Je
-JC

(^

0
Q CM
Q

*
X
X
-X
X
X

*
X

CM

a1

X
X

>p
O

*
*
X

en cn
-JC
r- r~
o o
* o 0

X!
r-l
fl)
4-1

0)

iH

*
CO

rH
=&=

-*T

0)

O,

3 M-l

tr 3

M-I

<a

X5

O
S3

3 0) <U
CQ K

^i

,)

rH
Q

^-^

0
<J

M
rH

<a M-I

rH
Q

^-^
O
|C

cn
r^

vt ==

^_^

0
r3S
*-*

VD

IS

cn
f^

vt

rH

01

tr

rH
rH
P
M-l

1-1 <U
0)
M-l T3

rH
Q

C
H

U)
E MH

rH
-H
(0
4-1

tr

E* 0)

0)
0

tr

^r

*
*
*
*
*
JC

X
O
id t^-

1C

rH
O

372

*
*
*
X

Je

Lf}

X
X
X
Jfi
X

*
*
JC

*
*
*
Jfi
*

M-l
3
,Q

-n

rH

4-1
C

tn -H 0 73
>i id G C

1C

JC

<c

a
-H C
a -H

1C

*
*
Je

t-H
VO

X
0)

CM

in

O
4-1

MH

4-1

01 ,Q M
<D 0)
CD
MH TJ - 1-1 4-1
MH fd en in -H
O 3 0) 0) 3 SH
M

id

4J

er reached ?

-H

<u -a
n G
O

M-l

M-I

X
0)

MH
0--

4-1
fH

********

CO -r-t
4->
ft
-H
. 0
4J

MIDI interrupt handler

tn
-p

i-<
tu

********

co

ter back to buffer start

1
0

ointer

r~
LO
rH

er reached ?

Atari ST Internals

X
X
*
X

CO

"C1
0

o
o
o
CO
CM
CM

o
o
rH

CO

10

CM
O

o
o

vo
o
o
o
CO
VD

m CM CM rn m cq vo
CQ vo
VD rSl r_) o CM ^p CO
fj
u u
a Q Q Q
cn C3> cn cn cn cn en
r^ [ [
p^ r^ r^

o 0 0 t0
o o o
o O o o 0 o o
CM

CM

-J

0079DA
0079DE
0079E2
0079E6

24680000
15801000
31410008
4E75

7605
08010004
6702
7606
08010007
6706
07ADOA5D
6004
07EDOA5D
7200
7400

rnove.l 0(AO),A2
move.b DO,0(A2,Dl.w)
move.w D1,8(AO)
rts

D3,$A5D(A5)

$7A02
bra
bset
D3,$A5D(A5)
moveq . 1#0,D1
moveq . 1#0,D2

bclr

****************************************************
moveq.l #5,D3
btst
#4, Dl
$79F2
beq
moveq.l 16, D3
#7,D1
btst
beq
$79FE

0079E8
007 9EA
0079EE
0079FO
0079F2
0079F6
0079F8
0079FC
007 9FE
007A02
007A04

41EDOA5A
246DOA1E
4280
102DOA5D
EA08
060000F8
11400000
11410001
11420002
4E92
205F
4E75

lea
move . 1
clr.l
move . b
Isr.b
add.b
move . b
move . b
move . b
jsr
move . 1
rts

$A5D(A5) ,DO
#5, DO
#$F8,DO
DO,0(AO)
D1,1(AO)
D2,2(AO)
(A2)
(A7)+,AO

DO

$A5A(A5),AO
$A1E(A5),A2

***************************************************
007A06
007AOA
007AOE
007A10
007A14
007A16
007A1A
007A1E
007A22
007A26
007A28
007A2A

Buffer address
Write received byte in buffer
New tail index

keymausl
Accept right button

is right button ($47/$C7)


left button
Pressed or released ?
Pressed
Clear bit for key
Set bit for key

keymaus
Pointer to mouse-emulator buffer
Mouse interrupt vector

Get status of the "mouse" buttons


Bit for right button to bit 0
Plus relative mouse header
Byte in buffer
Store X value
Store Y value
Call mouse interrupt routine
Restore iorec for keyboard

n
S

M
ST

$47,$C7,$52,$D2

move . b (AO) ,DO


movem . 1 (A7)+,D1-D2/AO
move . w (A7)+,SR
rts

move . w SR, -(A7)


or .w
#$700, SR
movem . 1D1-D2/AO, -(A7)
$FFFF8800 ,AO
lea
move . b D1,D2
and.b
#15, Dl
move . b Dl, (AO)
asl.b
#1,D2
bcc
$7A58
move . b DO,2(AO)
moveq . 1#0,DO

move . w 4 (A7) ,DO

dc.b

***************************************************
302F0004
40E7
007C0700
48E76080
41F9FFFF8800
1401
0201000F
1081
E302
6404
11400002
7000
1010
4CDF0106
46DF
4E75

007A2C 47C7

007A30
007A38
007A3A
007A3E
007A42
007A48
007A4A
007A4E
007A50
007A52
007A54
007A58
007A5A
007A5C
007A60
007A62

***************************************************

muskeyl
Scan code mouse substitute

giaccess, read/write sound chip


Data
Save status
IPL 7, disable interrupts
Save registers
Address of the sound chip
Get register number
Registers 0-15
Select register
Test read/write bit
Read
Write data byte in sound chip register

Read byte from sound chip register


Restore registers
Restore status

rts off, disable RTS


Set bit in port A

moveq.l #8,D2
bra
$7A7A

007A64 7408
007A66 6012

Set bit in port A

dtr off, disable DTK

Clear bit in port A

rts on, enable RTS


moveq.l #$F7,D2
bra
$7AAO

***************************************************
007A68 74F7
007A6A 6034

moveq.l #16,02
bra
$7A7A

****************************************************
007A6C 7410
007A6E 600A

B9

n
y>

cn
o

1
n

n
a

ff

-J
01

moveq.l #-17,D2
bra
$7AAO

****************************************************
007A70 74EF
007A72 602C

7400
342F0004
48E7EOOO
40E7
007C0700
720E
2F02
61AE
241F
8002
728E
61A6
46DF
4CDF0007
4E75

move . 1 D2,-(A7)
bsr
$7A38
move . 1 (A7)+,D2
or .b
D2,DO
moveq . 1#$8E,D1
bsr
$7A38
move . w (A7)+,SR
movem. 1 (A7)+,DO-D2
rts

move . w 4(A7),D2
movem . 1DO-D2,-(A7)
move.w SR, -(A7)
or .w
#$700, SR
moveq . 1#14, Dl

moveq . 1#0,D2

****************************************************
007A74
007A76
007A7A
007A7E
007A80
007A84
007A86
007A88
007A8A
007A8C
007A8E
007A90
007A92
007A94
007A98

7400
342F0004
48E7EOOO
40E7
007C0700
720E
2F02
6188
241F

move . 1 D2,-(A7)
bsr
$7A38
move . 1 (A7)+,D2

moveq . 1#0,D2
move . w 4(A7),D2
movem . 1DO-D2,-(A7)
move . w SR, -(A7)
or .w
#$700, SR
moveq . 1#14,01

*********************** *********** -ki


007A9A
007A9C
007AAO
007AA4
007AA6
007AAA
007AAC
007AAE
007ABO

dtroff, enable DTK


Clear bit in port A

ongibit, set bit in sound chip port A

Get bit pattern


Save registers
Save status
IPL 7, disable interrupts
Port A
Save bit number
Select port A
Bit number back
Set bit(s)
Write to port A
Write new value
Restore status
Restore registers

offgibit, clear bit in sound chip port A

Get bit pattern


Save registers
Save status
IPL 7, disable interrupts
Port A
Save bit pattern
Select port A
Restore bit pattern

65

ta

B
Si

OJ

Clear bit(s)
Write to port A
Write new value
Restore status
Restore registers

and.b
D2,DO
moveq.l #$8E,D1
bsr
$7A38
move . w (A7)+,SR
movem . 1 (A7)+,DO-D2
rts

007AB2
007AB4
007AB6
007AB8
007ABA
007ABE

initmouse
Disable mouse ?
Yes disable mouse
Mouse interrupt vector
Address of the parameter block
Relative mouse ?
Yes
Absolute mouse ?
Yes
Keycode mouse ?
Yes
Error, invalid

C002
728E
6180
46DF
4CDF0007
4E75

*****************************************************
007ACO 4A6F0004
4(A7)
tst.w
$7AEC
007AC4 6726
beq
move , 1 10(A7),$A1E(A5)
007AC6 2B6FOOOAOA1E
007ACC 266F0006
move . 1 6(A7),A3
#1,4(A7)
007ADO OC6F00010004
cmp.w
007AD6 6724
beq
$7 AFC
#2,4(A7)
007AD8 OC6F00020004
cmp.w
$7B16
007ADE 6736
beq
#<3,4(A7)
007AEO OC6F00040004
cmp.w
beq
$7B58
007AE6 6770
moveq . 1#0,DO
007AE8 7000
rts
007AEA 4E75

Disable mouse
Disable mouse command
Send to IKBD
Mouse interrupt vector to RTS

Relative mouse
Transfer buffer pointer
Relative mouse
Relative mouse threshold x,
Set mouse parameters

***************************************************
moveq.l #$12,Dl
007AEC 7212
007AEE 6100F1EO
bsr
$6CDO
move.l #$7BCO,$A1E(A5)
007AF2 2B7C00007BCOOA1E
bra
$7B6C
007AFA 6070
***************************************************
lea
$A6A(A5),A2
007AFC 45EDOA6A
007BOO 14FC0008
move.b #$8, (A2) +
007B04 14FCOOOB
move.b #$B,(A2)+
bsr
$7B70
007B08 6166

007BOA
007BOC
007B10
007B14

7606
45EDOA6A
6100F1DE
6056

007B16 45EDOA6A
007B1A 14FC0009
007B1E 14EB0004
007B22 14EB0005
007B26 14EB0006
007B2A 14EB0007
007B2E 14FCOOOC
007B32 613C
007B34 14FCOOOE
007B38 14FCOOOO
007B3C 14EB0008
007B40 14EB0009
007B44 14EBOOOA
007B48 14EBOOOB
007B4C 7610
007B4E 45EDOA6A
007B52 6100F19C
007B56 6014
007B58 45EDOA6A
007B5C 14FCOOOA
007B60 610E
007B62 7605
007B64 45EDOA6A
007B68 6100F186
007B6C 70FF
007B6E 4E75

moveq.1
lea
bsr
bra

#6,D3
$A6A(A5),A2
$6CFO
$7B6C

**************************************
$A6A(A5),A2
#9, (A2)+
4 (A3), (A2)+
5 (A3), (A2)+
6 (A3), (A2) +
7 (A3), (A2)+
#$C, (A2)+
$7B70
#$E, (A2)+
#0, (A2)+
8 (A3), (A2)+
9(A3), (A2)+
10 (A3), (A2)+
11 (A3), (A2)+
moveq , 1 #16, D3

lea
move . b
move . b
move . b
move . b
move . b
move . b
bsr
move . b
move.b
move . b
move . b
move . b
move . b

$A6A(A5),A2
lea
$6CFO
bsr
$7B6C
bra
$A6A(A5),A2
lea
move . b #$A, (A2) +
bsr
$7B70
moveq . 1#5,D3
$A6A(A5),A2
lea
$6CFO
bsr
moveq . 1#-l,DO
rts

Length of the strings - 1


Transfer buffer pointer
Send string to IKBD

Absolute mouse
Transfer buffer pointer
Absolute mouse
xmax rnsb
xmax Isb
ymax msb
ymax Isb
Absolute mouse scale
Set mouse parameters
Initial absolute mouse position
Fill byte
Start position x msb
Start position x Isb
Start position y msb
Start position y Isb
String length -1
Transfer buffer pointer
Send string to IKBD

Transfer buffer pointer


Mouse keycode mode
Set mouse parameters
Length of the string -1
Transfer buffer pointer
Send string to IKBD
Flag for OK

sn

n
a

sr

**************************************************

2(A3),(A2)+
3(A3),(A2)+

sub.b

1(A3),(A2)+

Dl,(A2) +
#7,(A2)+

0(A3),D1

moveq.l #16,01

007B7A 922BOOOO

move.b
move.b

move.b
move.b

007B7E 14C1
007B80 14FC0007
rts

move.b

007B70 14EB0002
007B74 14EB0003

007B84 14EB0001

007B78 7210

007B88 4E75

7000
7200
7400
302F0004
322F0006
342F0008
6100F4F2
4AAFOOOA
6B1A
246FOOOA
7200
43F900007BC2
0280000000FF
10310000
6100F588
4E75

moveq . 1#0,DO
moveq . 1#0,D1
moveq . 1#0,D2
move . w 4(A7),DO
move . w 6(A7),D1
move . w 8(A7),D2
$7090
bsr
10 (A7)
tst.l
$7BCO
bmi
move . 1 10(A7),A2
moveq . 1#0,D1
$7BC2,A1
lea
#$FF,DO
and.l
move . b 0(Al,DO.w) ,DO
bsr
$7146
rts

**************************************************

007B8A
007B8C
007B8E
007B90
007B94
007B98
007B9C
007BAO
007BA4
007BA6
007BAA
007BAC
007BB2
007BB8
007BBC
007BCO

dc.b

13,8,5,4

*************************************************
007BC2 OD080504

setmouse, set mouse parameters


x threshold, scale, delta
y threshold, scale, delta
Top/bottom ?

xbtimer, initialize timer

Timer number (0-3 => A - D)


Value for control register
Value for data register
Set timer values
Interrupt vector
Not used ?
Interrupt vector

Table for determining interrupt number

Get interrupt number


initint, set MFP interrupt

Interrupt numbers of the MFP timers

B9

4-1
SH

fd

K 4-)
CO

CO

rd CU
M
j_l C
>,
CU c*t
M CJ

CO
CO

CU

rH

4-1

rH

TS

45
P
HH
O

4-1

CO
EM
O

cu
4-1
KH
O
CO
CO

cu

(U
4-1

CO
f

id
o

0 4J

i^

CU

CO
>!
CU

CO
CO
CO

Q)
O1
C

CD
rH

U
CU O

tH
-H

ts id

& <

4-1
4-4
-H
ft
CO

rs

<U

CO
fl)

en
M q

TS

T) <-;
< O

o *?3

CO

-H
O

rH

id

cu
0)
rH

rH
43

43

id

Id CU 4->
4J rH

43 X
TS id O
H 4-1 O
id
1-4

O 4J
q IH CO
id -H PM

CO
0

-H 4-1 43 <
43 CO CQ O

eu

a
a

3
O
CO
[)

CU

o O

3
O
CO

cu
4J

4-1
CU
CO
4-1

cu

CU
rH

43
id

4J

O
TS

4-1 TS

HH

co
CO

H.

TJ

<u c;
H

3
0

CO

<s ^j
CO 4->
Kj
H
^)
a
O^ S id
o cu cu 4-1

4-1 cu
-. JJ
3 cu c
-H H > -H
M id -H M

a >

4-1 4-1
<U <u

CO

CO

don't set
er configuration

id

4->

et/get printer configuration


er configuration

43

id

<u

0)

status

d>

rH

at

start sound

C1'

Atari ST Internals

set standard keyboard table

f the standard table

set keyboard table

Abacus Software

cs

-P

Q<

(Q
O^ 4-J

"Z

73 CO

CU

cu cu

<

in
<

m
<

E4

CM

vo
vo

^_^

^^^

*
*
It

*
*
*
*it
it
*
it
It
it

vo
<

m
<

*
*
it
*
*
*
X

<:

CO

<O

fQ

n
n

^_^

*
*it
it

fV)

rH

-H
CO

<u

rH

-H
CO
4-1

rH
. rH
CU

CO
4-1

-H

43

>
0

*n
It
CO
4J
M

*
s
*It
*
*
It
*
*
*it
it
*It
It

w
a1
o
o
o

"3*
O
O

<
o

03
O
O

CO

o
o
o o
o
* &4 vo Eu fc, vo En
0 vo
o vo
*
f, pq cq *^
It f^
*
=3I pq PQ
*3" vo CM a* vo CM
it
*
VO
O CM vo CO
It 0 ^
*
O O Q Q Q
it PQ pq CQ
CQ
r- c- r- r- r- r* o 0 o o o o
It 0 o o 0 0 o
it

VD
VO

CM
VO

m
o

f
O

w
m

o
o
o

o o
0 o
o o
EM vo fv, o
<^* o vo n
eg pq o
^
"a1 vo CM CM
H CM
Q W fy*j
pq pq PQ
IQ1

fQ

in
P*.
E"3
<cp
0

p,q
PQ eg
rr- r- ro o o o o
o o o o 0
[-X

CM
VO

CM
pc]

*
*
*
it

== =s=

rH

0)
>
O

rH

0) CU
> >
0 0

CO
4J

e s s M

*
it
*
It
*
* pt} CM VO
*it m vo vo
^ ^ ^-C
* O 0 0
it CM CM CM
*

CM
f^j

it
*
it
it
*

(=C
pr,

CM
O

^^

m
<

rH
Q

^^
vo in

*
*it
*
it
it
*
it

CU

-rl
g

43

KS

*
.
*
it
it
it

it
*
it

it
*

it
*

pq eg o o
r- r- r- rO 0 0 O
O O 0 0

379

it
*

^B^,

*
K
it

*
it
*

^^

it
*
It
*
*
*
it
*
it
it
*

CU

CO

0 rH 4-1
O M

*
it
*
it

m
(^
*^
o

CO
rtj

m
<

o
n
CJ
t
<
a' to
U

CO

*~*

f-*
(3J
Vrf

io

|5
P -H
CO
g

4_J

to
^

r<
~
"a1

>
0

43 g

*
It
*
it
*
H

it

*
*
it
*

*
n vo vo vo
*
it o o o
it o o o
0 0 0
It O 0 0
*
it O O CJ m
r*~ r- r-- r
* pq eg pq E^
*
n CM CM CM ^T
it
^t

^,

O
Q
*.

*
CO <
* ^ ^^ &3 <
* vo [-. rH <o <
* CO rtj CJ ^ CO
* ^C ~~*
rH <
* c/> a> CO Q to
*
*
* <H rH
H

. 43
it
*

CM
VO

it
*

lO

*.

VO 3 VO
Q Q M

o o

Q Q a
vo vo vo
*it *n- <t> v>

,-H ,j

cu
o

*
*
*
it

n </>>
*

CM ,-^ .^ W ^-^ r fQ t
r- Q r- r- Q r
w rfj m
(Q pq < rf* pq < ^
-- pq "^ ft.
* c
* rCM r- CM to3
*3* <o a1 CO <o CO rH to

rH

*
*
*it

S:
* W CM VO
* m vo vo
* <; rs, <

{O*
^ Q
^^

f~^

in in m

it
*

CJ

it

CO

rt

vo

vo a1
CO o
o
0
Q
CM
0
CM

0
CM
CM
CM

O O
O i-H
0 O

t- ro o

it
*

CO
0

CQ

vo

CO

^
C
O

o
1-1

0
Q

^4

CM
CM

PQ

*
It
ft
K

in
r-

^r

VO

a- a>
< W

rH

rH

rH

rH

0 CJ

CJ

t~-

CM

p- r- ro o o
0 0 0

*
it
*
it

CJ a1
CO 0
0
^
Q
CM
0

o
o
vo

0
0

o
o

VO [V|
O VD

pq pq
vo o

CO

^1
^

H
*
H
H

Q1 co <C
CM CM CM
O O CJ

*
*
It
it

r- r- r- ro o o o
o o 0 O

CM
CJ

007C30 4E75

302DOA7E
4A6F0004
6B16
322F0004
1B410A7E
4A6F0006
6B08
322F0006
1B410A7F
4E75

rts

rnove.w
tst.w
bmi
move.w
move.b
tst.w
bmi
move.w
move.b
rts

$A7E(A5),DO
4(A7)
$7C52
4(A7),D1
D1,$A7E(A5)
6(A7)
$7C52
6(A7),D1
D1,$A7F(A5)

***************************************************
007C32
007C36
007C3A
007C3C
007C40
007C44
007C48
007C4A
007C4E
007C52

move.1
rts

t$AOE,DO

****************************************************
007C54 203COOOOOAOE
007C5A 4E75

52B9000004BA
E7F900000A84
6A4E
48E7FFFE
4BF900000000
614C
082D00010484
672A
4A2DOA7B
6724
4A2DOA7C
6706
532DOA7C

addq.l
rol.w
bpl
movem.l
lea
bsr
btst
beq
tst.b
beq
tst.b
beq
subq.b

#1,$4BA
$A84
$7CB8
DO-D7/AO-A6,-(A7)
$0,A5
$7CC2
#1,$484(A5)
$7CA8
$A7B(A5)
$7CA8
$A7C(A5)
$7C90
#1,$A7C(A5)

********************** ******************************
007C5C
007C62
007C68
007C6A
007C6E
007C74
007C76
007C7C
007C7E
007C82
007C84
007C88
007C8A

kbrate, set/get keyboard repeat


Delay before key repeat
Test new value
Negative, don't set
Set new value
Repeat rate
Negative, don't set
Set new value

ikbdvecs, pointers to IKBD H- MIDI vectors


Address of the vector table

timercint, timer C interrupt

63

en
C/3

en

Increment 200 Hz counter


Rotate divisor bit
Not fourth interrupt, then done
Save registers
Clear A5
Process sound
Key repeat enabled ?
No

Key pressed ?

6S
5T

H
No
Counter for start delay
Not active
Decrement counter

Q
PCO

10 m 10

10 10

Q &j

F^

i^C tn cQ CM cr* os] o , t *. -too * C j r ^ r - i J M r - ^ p o o r- -.


r- rH r - r f ! ^ c ^ r ^ t ^ ^ r r f < M f 3 S i o
v> =>t= </> -o> </> /> -u>- -c/> -o> *' =&= =&=

*. *
U

QJ

*1 *1
CO

CD

O1 CD

Vt

0) 43 a > > > c a v i > > v i ' a > r H a )


C 3 G O O O J O J O O f f l T J O O - P
43 CQ 43 E *~~1 43 S 5 "r~* <0 E 43 ^-*

Q
rQ
r-

CO Q
rH <M

P5J
0
fafflCMCJCMO

o o o f a o o

fa
fa
fc,
fa
fa
fain

r^o

C M Q Q Q O Q Q O f a f a C n n
(-)VQCM(JiIOCMVOCrs^'QP3P-

VQ m VQ rn o ii ti fa c> p3 ^^ cj co M
VQ in V Q < - H i - H ' C 1 V Q f ^ C M ^ 1 i n ' = S ' O < 3 1
W o ^rVOOo^rcoOocM'3'COO
CO O\ cCJ
nc^cnsCsC'^C'^ICPCQCQfflO
O C J C J C J C J C J C J C J C J C J C J O
p- p- r ^ r ^ p - r ~ c ^ p - p - p - p - p - p - p -

o o o o o o o o o o o o o o
O

o o o o o o o o o o o o

(U
G

-rl

CM

3 4J
^H VI
10 <0
> 4J
VI

S G
-H 3
.p 0
to
TS
(0 Se
O CO
n3 S3

in

in

Q
""

0) -a

(D
3
.H
10

S<0
in

CO

a G

G O
< Q

3800

a
a> cu

Else decrement timer

3
0

C"

No sound active ?
Pointer to AO

T!

******
, -(A7)

sndirq, sound interrupt routine


Restore registers

.j
*

****************************j

Not run out ?


Decrement counter for repeat delay
Not run out
, $A7D(A5)
Reload counter
, DO
Key to repeat
,AO
Pointer to iorec keyboard
Key code in keyboard b u f f e r
,-(A7)
20 millseconds per call
,AO
Get event timer vector
Execute routine
Correct stack pointer
-D7/AO-A6
Restore registers
rAll Clear interrupt service bit
\5)
**

0)

Get sound command


Bit 7 set, then special command
Select register in sound chip
Register 7?
No
Data for register 7

Atari ST Internals

Abacus Software

2i

tH
^
Q

o
vo m (Z. rtS Q Q in

0
Q

</>

- CO CJ
p- o (Q P-

-a
O p-

CO Q
Vt

E
DEJ

CO

pM O

CO +

Q 0 ^

0 Q

^ * G 0
r- o r~~ r^ c33
> Q

* Q <0

rH

1
(U

0)
0)
tr > > cr
>
0 (U 0 0 0) 3 O
43 g E 43 a

43

*
dj
0

-H

>

C^

d)
CD >

e o S C O
43 e o 43 e

O vo
CO CO
0

CO
CO
CO
CO

o
o

* o 0
* p- Q 0 0
* M CM O =P
*
O P- 0
* CO
CM
* 5T CM VQ
* CM VQ ff pq
* CJ O 0 CJ
* O O O CJ
* pP- p- p* o O o o
* 0 o O 0

381

CO
0

Q co o

CM O
O prH VO
O

fa
fa
fa

CO

o vo

o ^31 p*
o n o
in H VO

^* VQ CO

Q Q Q Q Q
O CJ CJ O CJ
P- P- P- P- p-

O O O O O
O 0 o o o

ro
fa o

w o

CO
t_l CM

0
0

O O

o
f1

ra o OO

O CM

<
rH

CO
t-H

VQ CM
VQ rH

co o ea

Q M CT1 M M M
CJ CJ O O CJ O
p- p- p- p- p- pO
0

o o o o o
o o o o o

Abacus Software

01

10

H
0
W

a
K

fa
CO
</!

<U
4-1
>
X)

s * 3VI S
Vl

0)

01

-o

G
(0

G
10

</>

0
0
01
0)

O
01
4J

0
0

X!

01
*0

s ^ s s to

fa
fa
fa
fa

fa
fa
fa

fa
fa
fa

vt

fa

Q
VO ^ 0

Q
-3^ Q

<-H CM
CO Q

rH r- u> r~

3t> <fr 3t= V>

a > -d

003F

FFFF8800

c o c
E <a

rH d
O CO
CM O
O rH

X!

t-t
O

o
CJ
o
o
O t-H
O O
CM O
O CO

(U
^

(d

o ^

X?

o vo
CJ
CO

Q
0

!-H

VO

10

o ^1
S Xi

CO W
Q CJ
CO 0

1-1 vo

o vo CO W
o o o o
U U CJ U Q D Q Q
r- r- r~ r~ r- ro o o o o o o o
o o o o o o o o

O
fa

^
fa

< H
fa
fa

rH

01

co E

S1
A ^
o
a)
C
(0

E
0

P3

CJ

Q
O

CO

^
"^^

vt

if

O rH Q, 01
T! ft, S G 0

Vl

VO

CM -aQ

Wt r~

s X)

C
-H
0!
3
0! .-!
3 (0
H
0)
4-1
-M
R VI
>

<

Xi Xi

X! X!

O Xi

0!
O

S E

X!

10

CO

CO

o
o
o
o CM o vo co w
o CO o o in pa
CM
0 vo pa o
m vo 0 vo
o CM IT CO < w
fi rH t_4 f1 r~\1
Q
t
0 0
O O
Q
t

Q Q Q Q
r- r~
0 0 0 0
O O O O

CM

CO
O
O
O O C

fa

<a

fa
fa
fa
O C O

ti

3
0
W

0)

0)
10
01

o
c

4-1
01

**

<

m
<
*-*
<
CO

<

K
o o o + o
m rt m --* in

a
i^c r^~

^ Q

*3*

P*

*
s

0)

0
f^
h.

^ .
lO
rij
*-*
VO
CO
rf|

^v
rH

Q
1
O
Q
i^
+

o> *-*
fc.

r~

^C r~~ o o
< *^*
*

>

XJ

QJ

^
0 flJ
C
E Xi

s ._,
01

>
o o
s

<-\

>
O

CM
O
CO
CO
fa

CO
CO

-H
O

rH

X!
tr
> pH {y1 Xi <0
o S 0)
E 0 X) 01 X)

o o

PQ

^
</>

01
4-1

0)
3

^^

(0

ft.

4J

0)

fa
fa 0
</> Q

pa

a
a <n c
C 0) o
W >H w

O ^-^ ^^
Q in in
. fS^ ril
+ *
,.
P3
0 CO co

pa

0)

fa

0)

rH

fa

^-^

>1
10

>

0
</> Q
i^ CO
^
H- H- ri^
^-^ ^^ </>
o 0 ^.
ff
0
(^
*~"' *^ Q

a a> >
S

01

-H
4-1

CM
0
CO
CO

fa
fa
fa
fa

X)
(0
VI

C
3
O

S
<

Q
K.

01 4-1
O -H
0)
o? rH
01 0!
>H
W

O
O
CO
CO

CO
*3H
</>
ik.
-{- H
K
O

4-1
01

> -H -H

*
Xi

FFFF8802

>

Xi

FFFF8802

X!

_,

IM

0)

S0)

*
_Q

c-

CQ

W -t- W
O Q /> Q ^^ Q
K CJ o O
CJ
rH O
[
=t?= Q Q </> ^
^-" >

0
CO

-_s

fa
fa

01
cfl

0)
4-1

c-

m
-

O
CO
CO

fa

r-

CM
O
CO
CO

CM
O
CO
CO

O
Q

O)

o 3: K s

O
Q

T-H

ta

<d ra 0)

-H

VI

re registers

0)
X

-.H

P.
-H

>i
^H
4-1
O
0)
M
-H
T)

pointer back to same commam d

0)
4-1
(0
.H
O
01

01

alue reached ?

-H
X)

4-1
-H
XI

T>

ncrement-value

01

01
4-1

0)
4J
01
-H
&
0)
VI

sound command

r
I
vo

PH
-H
&
O

sound command

I
o

byte in sound chip register


ound command

Atari ST Internals

fa

pa

CO
<C
O
Q C O

fa
fa

pa pa

CO CO
CO
*C r
<J
O O
O
Q Q E i ] C O < C O s p

o vo co

O
O
O
O

CO
fS,
0
CO
531

O
rH
0
fa
Q

O V Q r H r H Q r H r H p a V O i n V O r H V O C O

CM

SP

O ^ P V O C J W C M ' = P C J O C M ' = P V a < C J


CM CM CM CM CM fO CO CO ^* ^P ^ *3* *3* "-3*
0 0 0 0 0 . 0 . 0 . 0 . 0 . 0 0 0 0 0

*P

ocMQi-HCMt-HWCMO^poinorOvoroorHOcoor-CTiopavoo

m cj

in in

t r - i r - r - t - r ~ r ~ r - r - r - r - r - r - r- r-

O O O O O O O O O O O O O O O O
O O O O O O O O O O O O O O O O

382

00

007D58 4E75

rts

*****************************************************
007D5A 0034
dc.b
0,$34
007D5C 0100
dc.b
1,0
007D5E 0200
dc.b
2,0
007D60 0300
3,0
dc.b
4,0
007D62 0400
dc.b
007D64 0500
dc.b
5,0
007D66 0600
dc.b
6,0
007D68 07FE
dc.b
7,$FE
007D6A 0810
dc.b
8, $10
9,0
007D6C 0900
dc.b
10,0
007D6E OAOO
dc.b
007D70 OBOO
11,0
dc.b
007D72 OC10
12, $10
dc.b
007D74 OD09
dc.b
13,9
$FF,0
007D76 FFOO
dc.b
*****************************************************
0,$3B
007D78 003B
dc.b
007D7A 0100
dc.b
1,0
2,0
007D7C 0200
dc.b
dc.b
3,0
007D7E 0300
007D80 0400
dc.b
4,0
5,0
007D82 0500
dc.b
6,0
007D84 0600
dc.b
7,$FE
007D86 07FE
dc.b
8, $10
007D88 0810
dc.b
13,3
007D8A OD03
dc.b
11, $80
007D8C OB80
dc.b
dc.b
12,1
007D8E OC01

bellsnd, tone after CTRL G

Envelope channel A

keyclk, key click

Envelope channel A
Envelope single attack

5?

Abacus Software

*
*
*
*
*
-K

*
*
*

XI
O

*
*
*
*
*
*

0
=!*=
VQ
rt

em.l
e.l
e.l
eq.l

*
*
*
*
*
*

c > > > >

-H

o o o

rH

m >

O H O

E ft

0)
0

1
(U
CO

TJ
0)

CO

CO
3

4J

4-1
0

(U

(X

53

CO

a
CO
o

0
Q

t
Q
*.

co
<
Q

=S= Q

to

o
a

CJ

Q
CM

CM

4-1

a
<a

CO

rH
M-l

4J
CO

4-1
(U
CO

a a

CO

4-1
CO

-r)

U
4-1

H
M

a
sx

c
o

(U
CJ

1= Centronics

Default mask

rH

CM
CM

A
II

CO

vo vo
CM

CM

XJ
3
CO

rH

4J 4J .p
M & CO
4J X) 4-1

(T
(U

0)

U a 0
Q
Q rH

j>
<u
^i o

rH

CO

CO

r- O rQ to

X!

rH

cf

si
O

CU

-H
S-l CU
PH

4J
0

-r)

to
CO
rH
VO
CM

CD
J>
O

O
4-1

(U

H
0

rH

*
CT

CO
rH

CD
p>
0

S
fB
SH

X) E X)

4-1
CO
4-1

cr
cu

X?

(d

rH

u X)

CM

eq.l #1,DO

-K

id

#$16D4C,DO

n
rd
P3

CO

e.l

sx
o
o
o

D5-D7/A4-A5,-(A7)
Save registers
8 ( A 6 ) , A 5 Address if the parameter block
#$2600, A4
Address of the working memory
#30,07
30 bytes
$7DAC
e.b
(A5)+, ( A 4 ) +
Put parameters in working memory

>

Atari ST Internals

to

CO
O

<
n

CM

r~
to

vo w

Q
X)

aj
P> P>
0 o

4-1
CO
4->

CU

c
X!

-X
*
-K
*
*
-K
*
-X

*
-Je
*

o
o
Pn

*
*
*
*
)c
*

En
O

en
Q
r~
o
o

*
*
*
*
*
*
*
*

rtj
rH
VO
CM
O

-}e
*

vo
O
O
0

CO

o o
r~ o
o o o
VQ r- w

LO

Ed
^r

W
CO

VQ
<J
CM

CM
0
O
O
0
CJ W sp

ie

CO fV]
CM f^

o CO
VQ rH

o
o
0
r- r- co en CO
a1 "sp fa m o
C"O (^ PS] rtj
r10 T VQ 31 vo

^P

VO CO

<

rH

**r
CM vo f^C W
en en en en
a Q Q Q
r- r- t r^
o o O o
o o O 0

rfS
Q
ro
o

**C
O
ro
o

Q
Q

c
Q
ro
o

rf^
o
ro
o

ril
a
r~
o
o

pq
Q
r*
o
o

<J
rH

VO
CM
0
O

Q VO

vo

rH
O
O

o
o
o
en vo CJ
CO

o o o
CM vo CM

H
CD ffl
Q Q Q
r- r- (
o o o
o 0 o

CJ W O VQ CO

rti
Q
ro
o

CJ

rH

CM
0
O
O
O
O
O

CO
rH
VO
CM
O
O
0
O
rH
O
O

%
o
o
0
o
CO o o
vo f vo
^r vo CO

o
en vo
r~

CJ
CM

vo

[y.
[V,

VO O
U CJ
Q a Q
o Q Q Q Q Q
r- r- r- 1^ F~
o o o 0 o
o o 0 O o

0
r~
O
O

384

CO
rH
VO
CM
O
0

o
o
en ^P
r- o
r rT vo

irj
CM

CO
O

vo
CM

O O
0 O

O CM
^P O
CM O
^T VO

o O
o O
o en
O o j
f^
o
[^ rH =p
rH

O CM < VO 00
Q W [y] pj
Q Q Q Q Q
t r- r^ r^ r^
O o o o O
o o 0 0 O

^
w w

O
O

CM

sp
VQ
VO

0 VO

p-.

Q Q

r- ro o
o o

Abacus Software

Atari ST Internals

C"

O
(U
CO
CO
0)

ft

-H
4-1
P
rH

4-1
(3

0!
4J

Ed

O
CO
(U
M

4-1

-H

4-1
ft

43 G O
t!) 4J
4-1
ft

4-1

a>

ft
JJ

G P c

o
CM
Ed

j_)

o o Ho

>-)

(< O
- Q
O

CM

-P
0) 3
ft

^ CPi

( SP [ CM ^C O
O CO
t/> Vt t/3- t/5- "*^ Q Q to-

0)

a> 0)

S-l

Ed

[V)

31
O
O

g fl)

o
vo

CM
O
O
0

CM

CM Q

Cd

rH

rH O

r-

=tt= Q

> 4t= -CO-

Cn

CO

er
g 43

o
vo

CO
cn o
o
P3 o
cq
o
o
0
00
co cn CM cn o o o o cnO VOfaO
CM r- rO C- rH CO CO 0 CQ ^ CO fa CO
O rtj
VO 0 0 CO Pd rH CM P r~- o o

VO ^p VO CM rH

sp co vo in

O
Q

VO CM
O VIVO
CM rH
-CO- =8=

fa

ft

cn co
<a
M-l

4-1

ft

to w

VO
CM

cn

co

to Ed

SP VO ( VO

C O < O C M C O < O P d C M C O < O E d


fafaOOOOOOrHrHrHi-lrH

QQWPdEdEdEdtdEdEdPdPdEd
r~-r-r~r-c-r-r-r-rr-r-r-ro o o o o o o o o o o o o
o o o o o o o o o o o o o

^4
rH

> 43
O 3

4-1 0) M
CO G rH

co 4-1 43

o
cn
n
n
SP

0
^p
CM 0
^P
CM
CM CM

r-

ft)
H

O 43

CO

vo
o

0 vo 0 0
^p O "31 0
rt* vo CM 0
SP vo ^P

n
m
f o
pr)

CM

SP

vo
vo
ft*)

n n
CM
Ed Pd Pd w W W Pd
r- r- r- rr- r00000
r 0 0

ooooooo

385

vo

Q o

CM

Ed rH cn
r- I oo

o r
CO
Q to- Q

CD B1

tr

43 <d -P 43

- vo

CM N <!

CM
< O

fa Q

4-1

n
0)

<a c

rH

ft
o

ft

o vo

T) 4-1
4-1 0)
> 4-1 >
C O C O O X O C O T ) C O S U O

4-1 43 g

CP (!)

O
0)
Q

en H

ft
O
4-1
CO

ft SH
4J O
p IM

(U
+J

0)

4-1
(U

0)

O
CO

jjo

CO

co
o
vo
to-

Ed O
O
Ed Ed VO o

(B
(U

ft
O
4-1

rl
0)
4J
C
-H

Q
I

=8=

to- =*t= -co-

ft

CO

tr
> m
O

r4

I 43 g 43

CO

cn
fa 0
r^ vo
0
o
O co o o
o vo r~ vo
< CM SP vo
n ^31 ^1 iqi
Pd
Pd W Pd
t~- rr~
0 0 o r
o
o oo0

Ed rH cn
CO

tf>

tr
ft

CO

S 'I
O 43

ooioooo;

ft
O
4-1
tfi
I

a; 43 t4'

4J

ooaoooo;

Cd

cu

0002606
0002606

CO

4-1
X

CO

o
cn vo
r- o
U n
O vo
f

O H
g 43

CM

^1

Pd
Pd [-^
I
O o

fa o
fa o
o o
r- vo
SP vo
m in
Pd
r- ro o

o o

Abacus Software

Atari ST Internals

G
O
-H
4J
3
^
O
en
<B
M

G
O
-H
4J
3
^H
O
01
01
H C-

C
0)
m
M
0
oj

G C
< D O
-H
M .p
O 3
en rH
O

A
O
.p
tJi e n

- i d
01
.H
o i n - i M
M
0
M

01

IH

<a
-H
HH M

E-I

to wr

o
vo

>

rt

CM

rH cn

CM
=8=

O
4J
Ci 0 1

P
M
0)

CM

ft

O
P M
(DM

en w

ffl
P
0)
en
m

CO

OM
JJM
Q M

< Q o
W <H en
P- 1 CO
</> =te />

G
O
-H
P
3
.H
O
en
0) C"
M
E
G
p G O
-H 0) -H
*O 0) P
( B M P
g O r H
coo
MO!

O
C -H
O .P
-H 3
+J ^H
3 0
rHOJ
O (1)
en M
fl)
M M
0>
,<S P
tP C
Q)
-H -H C- -O
,e M
O
P.OJS
M T !

>W

& M -H
< O O T 3
.-HMO)

M ,G
<3 O CP
^HM-H

O> M 4-1 -!
!3 4J 01 <S
,H C O <I) 3

CM
CO
fc.

vo w
Q o

R
O
-H
+J
3
*H
OC
01
0
M

P"
O
-H
.p
3
iH

S
00
,H
MM

-.
01 0)
CD M

O-i

OS
MO

Mi-3

en
0)

o - ( u
en M
a>

01 g

cu 3

hois

CO o
w vo
CO Q
o CO
vo
H
o pCM

o
vo
CM

tH

Q,
6

CO
rH

CJ

43

ft

43

if

ffl

01
rH

(U
>
O

43

g 43

cO
M

4J
01

tr
0)

+J 43

<0
M
O 43

rH

0)

p" o

ft

CM

tr

CO
Q

0)

rH

<o

43

o vo

CM

CQ Q
O CM PQ

O pQ

0)

<B

e s

ft

(T M IS
0) rH M
0 43 0 43

O1
CD

43
(U

o
vo
CM
O
O
O

CM

o
o
o
o

o
CO

CM
O
O
O

en
t^

o
CQ

VO

0
O ro
o vo

0
fe. 0
ft* O
0 0

r vo

CM

vo

[^

o
o
o
cn VO PC,
r~~ O f-i
O to o
o vo rCN
p"

CO
CM
CQ

o
0
o

o
vo

^* VO
p- P-

vo vo
in
W W M pq
p^ r~ t p-

vo
W H H H
r^ p~ P- P~

0
O

o o o o

0 0 0
0 O 0

CM
CO
PL*
^J1

0 0 0 0

CM

o
o
o
0
en 53* O
p- 0 ^r
rt p- CM
a1 vo SI< o CM
CO

CO

vo
CO

CO

H a a pt)
c~~ p" f^ r^ po 0 O 0 0
0 o o o o
[V]

CM
O

vo
Q

o
o
o

CO
CO
pt]
PO
0

S31

CO

er

(U
43

M
rH

<B
M

0 43

^r
o

0 0
rH

0 =P 0 0
[-^ CM 0 0

vo

3*
CO

en
a
ro

0 0

386

vo pcn
W
po
o

o cn
o p-

O
rH 0

VO
CM
O

o o
o o

o o
a1 O CM

Q rH

O CM
o O

vo
CO en
pt) W
{ po o

CM
O
O

w o

O
0

0 o
CM <H o en
0 0 o p0 0
U
VO p- H 0

4J
CO

o
vo

O (H

o
o

CO

U
U
H
p- o pQ vt

o
vo

o
vo

(H
VO
CM

43

43

- o >i
01 E .p
< B - H

cn-ae-io

if

(!)

fcoita

rH

ty

O
-H
4->
3
^H
O
en
Q)
M

O CM
0 ^ O
p- CM O
VD sr vo
*CJ*

fH
O

0 0
0 en ^r

o sa

en
H
po

o CM
O [V)
f PQ
H p&l w W W M
p~ p- p- p- p- po o o o o o

cn rt
0

0 O

0 CM

o p- o ^p O
o n rtj p- CM O
p- rH a1 vo a1 vo

0 0

o
o

S
PO
O

1
p- po o
0

CM
U
p)
PO
0

CJ

po
o

Atari ST Internals

Abacus Software

CO
4J

-H
M
O,
H

-H
i-l

C1-

13 SH
S CO
[ i (^
O -H
tj SH

(U
0) X
,C -H

a
X

-H
S-l

>i <a
M
-H

(8 0!
S -H

s a
rH
CQ co
co

G .C

-o <

O H
S <

En

to

rt

Q.

CO

p ft

o -o

vo
CM

tr
0)

H o
O Q

O
Q

t~-

=tt= Q

fO P
-H
Pn ft

EH
<

O,

C rH

vo
CM CM

=tt=

*W
CM r- o r- rH o

tr s
co a>

0!

O
Q

0"
CO
fc,
^

CO

0)

ia <
rH

ft
ps^

O* M

</>

CO r-t

r<o

tr .Q

IB

o1
IB

CO
W
W

rH
VO
CM
O
O
O

vo

O
O

rH
O

CM

W O
O O

r- o
o CM
o o
o o

sr o

o
o
o
o o

o
o
c^
r-

O CM
*3" O

VO

VO

VO
rH
VO
CM
O

rH

vo

CO

o
o

o
o
o
o

O CO

o o
o o
o o

o
o
o
o

<

o r - o ^ j i o o o r - o s j ' o o O CO O Pn O
c M o o o o r - c M o o co rtl r- o o

co o c CM o o co o r-

rH

t rH

CO CM

A
^Q
D1
*

CO
CO
P CJ1 -P CO t* *B K*
01 CO 01 H O !H O

> 4-> >

CO

CO

o
o

o
o

0
0

S ft

rCO

-H
O
J3

n Hn a
fo H fc, v

Q CO

Pu o

M
P-i

vo

O
FS

CM

co
vt

CD Q)

CO
^ ^ 4-1 &* ^

CO
.p

CO
-M
G
-H

o
Q
o
t< o ^r sp w Q o

co r- o r

ft

fc. < 3

VO
rH
VO
CM CO
O

EH

CO
(D

C4
0
01

&> 05

01
0>
>H

4J
0}

M - id

H ft

-H

O
Q

ao

o s
ft >1
H to

< o

0)

~X

<a
P5

CO

o
o

0
0

O
O

en cj en ^r rH co en
CO O

CO O

O CO

< r- < vo o o o

W <r vo o

W o CM

O O O Q Q Q Q Q W W W f e h f a f e O O O O O r H r H r H r H

rH CM CM CM CM CO CO

r^r- r-t t - r - c - r - ! ~ - ! ~ - r - p - r - r - c ~ - r - r ~ - [ ^ [ ~ r ~ r - r - r - t ~ o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o

o o o o o o o

387

O O O O O O O

Abacus Software

Atari ST Internals

M
Q>

4-1
3

M
CD
-U

O
01
0)
M

-5
!H

3
O

CO
G
-H

-H

rH

rH

rH

H
CO

as

CO

01
4J

01
4-1
G
-H
0
P,

P.

O
CM

jy ro

-H

4-1
t)

O -H

-H

vo
o
vo

CM
</>
. p)
CM H
CO VO O VO
,
fa
CM
fa

*3*

in

43

4-1
01
4-1

4-1

-rl

-rt

-rl

VO

rH

cn

VO
0
VO
CM

VO

fa

CM

. CM
0 CO
Q

0)

rH

rl
rH

>
0

U 43

cy PI 01
CD

43

3 3

<D

<0

O
g

a o
o TS
cfl

vo
0
vo
CM
CO

w
w

31

CM
CO
fa
xP
O

o
o o
0 0
0 0

0
CM

O
0

CJ

5P

rH

vo

vo

CM

0 tJ

0!

43

0 43

0 fa 0 o
o o en o en o ^j1
CO CM [ rH ^P CO r- t fa CM
r- CJ co CM 0 0 rH co O
^
p vo o vo 5P CO Q Q to VO

^
T3

T)
10

vo

-H

CD
4-1

rH

(0
3

rl

rHP.tr

M -H
O

rH

H CD 0
O
rH

<0

p.

rH

O
O

0)
4J
CO
CJ

0
0

S 33 >n CJ

&H
rl

0 -H
U

rH

<B

<U

o
vo

rH
rH

o
CO
rH
CO
tO-

CO

<0 M
P, 0

rrH

rH

VO

43

4-1
01
4J

0
03*

ift

""-"

CM
rH
VO
CM

0 CM*
Q

*
s

rH

CO

rrr- irt

r- co CM 0
Q m- m- Q
3

CO

!H

<0

rH

43

0 43

>

0
g

CO

^4

rH
0

3
T3
G
(0

vo

rH

er
o
a03

CM

CO
0

o
vo

CM
O CO

CM

o o
vo o

CM
0 0
0 CO
O D

Q
W
CM 0 *3*
0 0 0
0 CO 0
O CM O

0)

<0

r3

vtr~
r~

in=*!

in
rH
CO

3
P.
g
0

p^i

in in

tr
43

ai
0

vo

VO

01
>-!

o
o

03
p-

0 Q
Q
CM

rH

01 > rH rH
(0 (0 O O
S W O O

0)

VO
0

0
0
CO
CM
O

-H

10
rH

C"

rl 45

<a

s
T>

o
o

fa

0 CM
0 VO
vo CO CM
CO
o Q
0 O
*.
vo fa
U
O CM > O VO ^i
Q =s= </>
Q <*
*

rH

CM
O

P, 01
g rH

o o O o
o o o
0

O Q CJ

10
rl

CM

CJ O
0 O

o o en vo en
CO
CO

o
vo
vo

<qi
rH
0

m- =#* m

VO

o
o
o

fa a1 fa
r VQ r-

g.

vo

CM

CO

CO
G

VO

inCM
- CM
o cn o en

45
10
cy 01 co

04

O
o
vo

0!

01 4J
3 *D

rH

M
O
rH

4-1

3
rH
O

45

CO

CM 3 Ti

.
CD

e-j
O
"31

Q in- =tt=

_Q

^
r-;

4J

vo o
o
vo

-rl
rl

CO

r- co r- O CM

4J VO
ir;
CJI O

vo

!H

e-^

45

^*

4-1 O
45 CM

co
^

01
4->
-H

counter

-H
O
P,

p.

%
-rl

CO

O
Q

P.

01

rH

0)

tion ?

olution
ion ?

!H
0
01
C
-H

rH

vo

CO
Q

VO
CM
0
0

t
[~-

rH

VO
*$i CM
O O
O O
0 0
o 0

r~
^i
o
o
o
o
f.

r~
rH
rH o
rr~
o fa O O o O
O o
o
o
en (3j o en O en O en O r- o en o o CJ o en en
r- rH sp CO r- r- fa co O 3* O p. ^i rH t CJ CO PO CO CM O o rH co f% vo CM O O CM 0 0 to
O
O VO a1 co Q Q co w vo cp VO CM T co o co 10 0
r_J

<
m

r^
en

rH

3*
O
O
0
0

o
o en
0 co
r- 0
vo co

fafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafa
c r - r r - r - t r - r - r - c t ~ - r ~ r ~ r ~ r - r - r ~ r ~ t ~ - r - r - r - r ~ c ~ r - ( ~ r - r - i r - r - r o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o p o o o o o o o o o o o o o o o o o o o o o o o

388

Abacus Software

Atari ST Internals

r)

CO
4-1
C
-H
ft
X
-H
rH

rH

4-1

CD

0)

>

>

(U

O)
rH

ca

rH

rH

P
rH
,Q

!H
O

>
CD

4->
O

rH

CD

73

iH
C71

-O
*H
rH

0)rH
0)rH
< U O
0 ) > O < 1 ) > O < D > O
4 - l K J O 4 - l < Q O 4 - l f l 3

<B
>
<U

R 3 W

<tf
"d

CD
M

rH

O
rH

rH

H
O

(U

CO

rH

C O e Q r H
TJ

rH

i-3

1-HKCrP

M <

l<

rH
)

0 )
>>

C D C U
rH
rH

rH

CD

0!

*O
CD

C D O )
H
M

!3

O T S n J O T j f l J O T S ' S S
M G O
e o G O
C O C EH
<

C3

CM O

fiCO

U Q
L O ^

Q Q
M K

rH

*3*

<JrfJ

r3?

en
>

^
O -

r H
O
<

rH

rH

O
Q
-

rtj

rH

rH

Q
-

rfj

NrH
CJl=S

^,
OrH

o n r f S o o - ^ r f S o o ^ W c o o o w ^ p o o & i i
. ( < S P < ; C M O O W
.rHrHWrt;
O W QQ O O ^ CP Q Q */> O r H r i ^ ^ C t j e n r t ^ r t J H O Q f ^ Q ^ ' ^ ^ C E H O r f l r f l i J Q ~-~

r ^ o * 5 i ^ 3 i r ^ o ^ j i c o r ^ o ^ t i c o r ^ o </> *=P r~- o <^> *^ ^p co ^p co r* o </> *"-* c rH </> o


=tt=Q-=s===Q<n-=tt===Q>>Q<=*>-Qrt;=tt=o-u><n--j-cirt;=t(=OQsC==Q
g g

<D

0)

1515

(D

OJ

&

<D

(a

S I S r H I S

CD <D

CD

<D

CD

O J - C D C D C D - - C D

o > > ^ T J > > r ( - o > 4 - i c r > - o - d > > - o > > f i , < i ) > ! a > ' O > > > T ) ' O >
C O O m C O O t o q O e d C D O ' a ' O O O ' O O O g r H O M O T i O O O ' O T J O

n ) S S < o < t i g g < S < O g 4 - i 4 ) g < O n i g g ! a g g O 4 5 g 4 3 g < f l g g g ' O i O g

< <

CM <
CJ

m r
CO

^P

r~ o o
0 0 0
o o o
o o o

U o en

C-

CJ

CO

o to o
CJ

(0

CO

ro

0
0
0 CJ
31
CO

E
O

w o

Q PQ
W r~
3 a1

r0
o o
o
o o
o
o en o o

0 0
0 0

O CO T
CO O O
CO CO W

^p w
en CJ
vo r3 <3<
o O 'S'
0 0 rH
o O rH
o o o
o en o r~ co

O ^P

0
W
W

<

W en
W >
SP ^P

^!

0
0
0
0

0 CO
0 en

0
0
0
0

Q
H

*r

o o o
o o o
0

o
w

CJ
H
H

o
o
o
o

O CO

o en
C-

rH CM
Q CM

O
CO

CO

^p CJ
O
CO

r- co

W C M C O i a O ' < O C M 3 O C M > C O < O V O C O ( 3 ; O ' = P ! : O C M ^ P > e O p q c M


E

C^f^t

C~*r^-[^C^"E

H
^
o
o
o
o
en o o
O fa co

^3*
O O
O O

SP

co en tq
o co o
0 0 pL4 O O
to m \o co vo

en r~ CO CJ o en
PQ sp O r- co c

E~- O co o 31 O fa
O CO < r- 0 rH rH 0 0 rH CM
O CO sp > CO Q Q CO CO Q CM

<
Q
u

CO

O CM

CO

= r > O

r ^ - C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

389

Abacus Software

rH
0)
>
0)
rH
(1)
p
<H

Atari ST Internals

rH
<U
>
0)
rH

rH
Q)
>
(U
rH

T>
(1)

-O
(V

PS

o
rH

C
O O p i ]

o5 u

rH

<B
<-\
0) <B
> rH
0)
H G
(U
-GO)
(1) H

Q
B

rH

rH

rH

<C

(4!

rH

rH

STO

rH Q
Q
v rH
- , Q
-rH
J
<
O r <
C J r H O Q
k . O J C J r s l r s C O O & C l
K r H r H W r ^ ' 5 ' r H r H p i )
K r H O C S J

f = C r f ^ W O C J ^ O O t

(^C^WOrf^rflCtl

"-" c^

<J

ril

&3

^v O

ri|

CTlQ

V O O
^ T O ^ T r t i r H r H W

rij

ri^

</>

rfl

<J

(z]

I O > O O C O n C O O O t O - t r H < f l - O ^ r r - r H - < r H r H C O O C O < H O < 3 ' r ~ r H >


Qr=s;=s=o-l-><-QfS;=H=OQrt;=ft=Q>Qra;^t= * Q - Q - = = Q < O - Q < 4 t
rH

rH

'

"

IS

'

d ) - a } ( ] ) aj
< i } a j ( i j a } * * o ( u ( u - * ( ] j c r *

Q J ^ O J Q - H
> - a > > a a i > < ! i > T ! > > > T 3 T S > > > r t > ' O > ' O X ! j - > S H c a > > > > ' O - a
O ' O O O E r H O ! H O T 3 O O O T ) ' t ! O O O ' O ' O O " O 3 O i r H S H O O O O ' O T J
E < a E E 0 4 3 E 4 3 E i o s E S < a < 8 e s E < a f a E < a M 4 3 0 4 3 s e s e < a < a

O O M C M
H
U
O
W i n i n
^ P C O C O

o o o
o o o
o c o o
o c n o

o
o
o
o

O
W
W
^J1

o o
o o
oco
ocn

C J ' O ' C J
H
<
^
H
W
V
O
H
^ 1 * 3 ' ^ 3 '

o
o
o
o

o
o
o
o

o
o
o
o

s p f i C C J
c
n
Q
W
V O H f M
' S ' ^ ' ^ P

o
o
o
o

o
o
o
o

o
o
o
o

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C O C Q C O C O C O C O C O C O C O C O C O
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

390

Abacus Software

Atari ST Internals

^H

rH

<1)
>

rH

rH
<D

<B
>

rH
0!

rH

0)

0)

>

0)

0)

>

fl)

rH

>
(1)
rH

(!)
rH

>
0)
H

rH

<B
rH

>
0>
rH

3 T5

0)

a>

ai

0) 'O
(J

<1)

rH

Q
^
^^
rH
<

rH

Q Q
rH

rH

00

O
o

<

>

O TJ
E 10

rH

jf

0
CM
Q </> O rtj

CJ
rH
ft.

w
w

^p
^ 10
^
00 0 CO rH O CO r- rH
=8= Q
Q
Q *!

rH

3 3

3
43' .p
p
0! 43

3
(H

3 3. 3

tJ1

<d

rH

(U

0)

Q
^-,
rH

"*-*

*
rH
3.

rH

rH

T3

d)

a)

<B

t3

rH

rH
CM O
Q
O Q
.
IO
rH O
rt
CJ o CO SP 0 <
Q Q W
Q <o- ON a 0
o ^ ^ \Q v w
- - o o 00 rH 0
rH rH CO
sP
CM q

Q
=**= Q
<*> O <0

FT*

cf

# 4 3 4J

(d

o O T3 o O O 3 W rH
^ M O
s E s ^
S fd (3 g fd o) 43 u 43 E
O

<|)

0
Q
W

rH

0}

3.

0
Q
rH
Q
^
rH

O CM
Q O
^
^ 10 ^
rH co
r
Q Q
rH

rH

>

rH

T!

(U

o
ta

CM T
O ON
Q
IO VO
5i
sp
CO ^
0
0 0
o
0
o o
0 0
o
o
o 0
0 0
o
o 0
0
0 0
0
rH rH rH -3O CM
rH
O
ON r- ON O rH rH rH -ST O CM rH 0 W O CN rH i-H
rH ^
^P O ^P O o o CO ^P CJ p4 rH "531 ^T O ^ 0 0 O CO ^i co *3* rP
CM CM O
W CM O O CO O CM CO CO CM CM O W CM o o CO O IO CM co o
co IO <3N \O ^P \O r^ ro co co O Q co in ON vo a* \Q t co co ptj co &3 C3

CM

43

CM
Q CJ
W IO
CO
O o

O
W

<

O CO 0 at
6 E id S <3

0)

(0

CO
rH ON
VO
ft,
^ ^3*
rH
<
=*

^
~
s

rH

t5

T5

>
O

<d

^
<0

CO

0
0
C"~

o
Q

<d >
M

00

ON

E 43

S
^r
o
o

IO

o
o

Q
K
00 -=P
IO ON
rH tO

O CO *3*
Q o> u>

rH

O TS

rH

3.

3
*

5P

0
0

o
o
r- ON CJ

0
0
0 O ON
CJ fe CO ^P CO

CM

CO

CO

CO Q

CM

co

o o
3 CO

O O O O O O O O O O O O O O O O O O O O O O O r H r H r H r H r H r H r H r H r H

cococooooocooococococococococooocooooooococococooococococoooooco
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

391

Abacus Software

DI
C

O^
G

-H
4J
A

-H
4-i
A

-H

-rl

CO
3

Atari ST Internals

O^
G

fl)

^ ^
CO 01

Oi

-H
4J
fi

G
-H
rH

-rl

CO
3

4J M
G H
3 Id

o\

O
rO

rH

C5>
LO

rH
rH

CO
>

IH

-rl

rH

3 E

rH

s
3
g

<
Q
M
^P
O
O
O

rH
g

FM CO

rH

CM
CO

CM

rH
rH

rH

CM
CJ

rH

=t!=

a
a

<S

>

rH

Pu =3*
ro O
CJ Q

O 3
Q r H

rH

CO CO

VO

rH

rH
Q

CO

03

o o en
vo
Q

o o en

o i>
=tt=

CO

<

CJ

o o w

r- CM
Q O K
rH r^

CM
CO
fa

=tt=

CO

=tt= =>

==

=!t=

5P

fa1 O

cn Q
ti K
=*
rH

3
rH

ffl

rH

CJ rH
rH

O
Q =a=

Q
0
Q
rH
Q

C O O C J H
SH
O

o
O

J
l

-rl

CQ
O

, i

3 "O

<3

4-1
X

CU

S
-rl

T3

d o
a TS

*T

O
O
O

o
o
o
en CJ
o fa
CM ro
CO
CJ
W =r

CO 0
CM CM CM CM CO

va
o
o
rH
^P
O

CJ

CO
0"

03

rt;

IS

en

rH CM

CO CO
Q Q

CO ro

CJ

o fa

0 CM

S31

!H
rH

^3

a a"
o T3
(S

CO

o
0
o

U rfa ^p

CJ

o
a a

O
H
H
^
o

CM
O
U1
f)

m
o
o o o
CJ en u
rH

move,

w
rH

-rl

move,

s ==

c
O

rH

co

'
C

CO

M
W
C O C D

C M 4 - J O
C O O X M

O
CO
CM
O

CO

en
\o
a1
o
o
o
o
O

U fa

m
CM

fO

rH
Q

vo

en
vo
*r
0 [^
o O
o O
o o

IS

CJ

o 0
vo n

rH
Q

o
ro ro

rH
Q

<

sP

<

31

CO

fa pq

m m in in m m

r~

CO

31
O

CJ

03

-Sa1
(8

CO

Cl< 4-1
E rH

,3

4-1

4-1

<r >

CO O
,? E

CM
03

03
O
O

o
o o

r~

IS

CJ
M
H
=P
O
O

CO
O
rH
Q

CJ

, 1

a a
a a

CO

rH
Q

, 1

move,

E co E
-rl

,Q

move,
move,

C
C O

C1-

O l d r H - H
O ,
O 4-1

>1

> rH
o> rH

rH

M
C O

rH

O
rH

move,

rH
CO

move,
move,

o CO en
ro rH m

-O

CD
rH

0 - O S H G

move,

<#>

SH

o o

0
rH

O
O

^P

CM
H

fa

fa
^P
O
O
0
0

CJ o en
r- o co
rH o CM H Q <
Q ro in pa VO ^r
O CM vo 03 o 0
vo r~ r-. r- r- CO

fa pq

r-

VO
rH
r^

SP
O

VO
VO

03

vo vo VO
ro CO ^P
^J1 ^T
CO CO
rH i-H rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH
C O C O C O C 0 0 3 C O C O C O O 3 C O C O C O a 3 O 3 C O C 0 0 3 C O 0 3 0 3 C O C O C O C 0 0 3 C O C O C O C O C O C O C I 3
rH

rH

rH

rH

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

392

Abacus Software

Atari ST Internals

G
-H

p.
X
C
O

4->
Ifl

-H

4J

3
H

4->
O

O
>
<U

T3

&

0*

p
-H

+J
J3

K
O

s a

Q)

0)

4J
fi

t-i -H Q>

fi,0

ocooicrocMO

Cf

o 3 W M v o w o
K ^ ^ t H H ^ H

4->

r-

v ^ r - < H

^rM

^~o

r-Q
K[U

oo

o o o o

O O O 3 Q < / > T v H

[-

V O l O V O t ^

oo

Q Q Q Q

^ K > W

O O O C O ^ r O O O O O O ^ C O i H O O C M ^ P 0 3 C M C X 5 r H ' 3 1 O < C O O C M C i q O J i ^ r ' 5 P O ^ 3 1 ' 3 1


Q Q Q < / > < / > > = W = Q Q = t t = < * * = t t = - - = * t = > ^ l = V Q Q Q > > > > * Q><n-

3 S S
.

^-SISS

j y - - -

S S ?

>

S S
.

. r-l

S 3:

0 } m ( U

0 ) 0 ) 0 ) 0 }
( D ( ] ) 0 >
Q)
0 0 } * C Q Q ) * 0 ) > * ? * 0 ) 0 ) c n
> > > ( 8 4 - > D < > > > > < a > > > 4 - ! O ' > f a > > 4 - > > > M > ' O ' O r H H > > M
O O O i - l M < l > O O O O > H O O O M < l ) O M O O X - H O H O ' O T ) 3 O O 3

CM
W

pq

CJ5NO3
O M V O

VO
Q

O C O O
O 5 O

O) OJ
J K|

O
O

r- H Pn

O O O O
O O O Q

PoWr^r-sr^r

W
a1

pur-o
O'^PO

ooor000*3*

OOO
O O O
000
O O O

O
O
O
O

O O ^ r
O O O
000
O O O

i H O O C M O
O O O O
O O O O
O O O O

CJ
O

h
^r
CM
O
O
O

tHO
O O
00
O O

CJ
O

fci
^
O
O
O
O

< V O O C O
O O O V O

vovo>rCMCMCM^T
O
O
O
O

O
O
O
O

O
O
O
O

O
O
O
O

VOVDCM
CTCnU

VD3H
^r^-c'
OOO
O O O
000
O O O

O O O 3 C O C O G O C O C O C D C 0 0 3 C O C O C O C O C Q C Q C O C O C O G O C O C O G O C O C O C O C Q C O C O C O C O C O

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

393

Abacus Software

Atari ST Internals

G
-H
<8

to
to
(!)

p.

co
0)

PM

T3
TS

H
W

K
O
<D

-H
O

I
0) 01

01

/>
. VO
fa
0 CM <O
Q W- =ft=

$46B8

CO

00, DO

H
.p

4-J
0)
CO
M-l

.C
W

1-1

O O
Q

0
Q

*
O CM
Q >

^p o

CO

pa

5I1

CM
CO

<-

vo co

O
PJ

CO
CM
VO

r-

0
0

-H

S-l C .H
O < .Q

FFFFFFE,DO

rH
43

. M
(71 0)

0 VO
VO
K
VO CM
v CM en pa en 0 CM CO O CM CO O <H CO SP CO rH
Q < * > < / > < / > </> =**>
a y> -c/> Q

o o
Q Q

o
Q

vo co O CO O
o vo Q vo Q
vo r~~ > r- ..
CM -a1

o O
Q O

* pa o
co <r Q
pq vo >. 10

rH

rH

CP

T3

0)
>

4)
>

!<

rH

<
CM
CO
0

4240
303900002604
600A
4240
303900002604

<
o
vo
vo

00824C
00824E
008254
008256
008258

008226
00822C
008232
008238
00823E
008244

33C000003E80
203900002600
COBCFFFFFFFE
23C0000046B8
203900002600
BOB9000046B8

<a g g o

rtl

f""\

r~ CM

5P <H
O
O O VO O
O O rH O

CO
CM
VO
CO

O
W iH
rH O

VO CO

o vo
vo r~
CM *3"
o o
o o
o o
o o

CO

vo
t
o
o

co

VO

[1

pq Q

o o
o o

o o r- o r- o
o
o o
o o o o o o
o
o o
o o e n o c n o c j o en en co en co o o o en o fa
^ i C _ ? r ~ o t o f a * 3 * CO fa
pq O o
O C O C M O < 3 V O C O C M o o co o n co CM CO O
co o
T O' Q
O W o vo cj pq
m v o v o v o r - r - t - ' C o c o c o c n c n c n c T ! en cs\j (!3J <l ^J
CMCMCMCMCMfMCMCMCMCMCMCMCMCM

CM CM CM CM

CM CM

o o o o o o o o o o o o o o O O O O O O
o o o o o o o o o o o o o o o o o o o o

394

Abacus Software

CM

3s

B>
-H
<B

CJ
CM
Cfl
CO

CM

g TJ
O q

ra

IS
.

<1>

o
us

CM

CO

f CM CM
CM M O
Pfl CM M co

<D

(fl

>

rH

43

j.
U

!5

j.

CO
O

tr >

s
s

Q)

43
3

(0

rH

Ri

S -H
0)
co "O 43

43*
3
g a

S rH TO CO
M. Cfl
co CM *. cn
CO a1 rH ^ji
O
TO- QTO TO
TO
*

jj
3s
cu

M g
M H O

O
g 43

cfl
co

0
0

o
o

vo

CM
O
O
O
O

EM
o
o
o
en CJ
CO rCM

CM

CM \
rH 0
EM V0
^i CM
O O
O o
0 0
0 0
rH 0 cs
5T O CM
O CO CO

31
(1)
.
> iH
0 ^
g 0

CO

o ^
Cfl
vo CM
CM

rH
O
O
O

CM
CM*
fT~)

^31
O
O

CM
CM"
p)

a1

CO
0
VO

rtj CM

S
<0
M

43

sr
o
o
o
o

pq Q Q
W
^ji
o O

CM
CM rH
O O

o
Cfl
en
o
CM
O
o o o o
o
rH
O
o
o o 0 0
o
0
O
O o
o
o o 0 0
o
co o en en o o o os co en CJ O CS os o os r- o
o "a1 co r- ^p ^p ^a1 CM o co o ^ cor- CJ CM ^J1 o
O CM O o CO CM CO O t o O CM O o
CO CM o
*xp

O
O
Q rH
"a*
\O

rH

<a

O
g

Q CM

pfl
PQ

co r-

* ^
rH

rH

S
g

rH
Q

,_*
-. rH
O m CM
VD CO -31 f3j t) ^*
QTOTO ^-^

rH

(0

>

rH

0 43 g

g
O

cf S
> 43
0
g

3
W

Cfl

O
CO
OS

CJ
CM

vo

Cfl
0
CM

W TO- Q

> CM
0 0 co a1 03 O CM !)
Q O TO-TO- TO- TO Q TOTO

g.

g.

0 0 CM
Q Q Q

CM

CO

[v,
CO
CO

o CM*
VD CM
0
O CM
O CM
Q TO TO Q TOTO Q

Q TO
- .
rH
Q

Q Q

rH
CM

rH
Q

CM
*

f,

C,$47BE

rH
Q

vo

-P

Oi
-H
0)

C,$493C

-H

4-1

4J
TS
-H

&

4}
Ti

VO

Atari ST Internals

pa

rfj
rH

r^p
cfl o
o o
CM o
a* o
o CJ
o (O

CM 0 OS
*r 0 a1

Cfl

r~
*3*
0

CM
rH

CM

gi

o rH o
O
o O o
o
O
0
o O o
O
0
o o o
o
en o cn %o o cn o EM en
t CM CM T co t rH o t
CM
to CM 0 0 O CM CM

COCOCOOOCOCOOOOOCOO303COCOCOCOCOCOCOCOCOCOCOCOCOCOCOCX)COCOCQCOO!)

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

395

008344 E260
008346 C07C0001
00834A C1F900004FOE
008350 D17900004F1A
008356 54B9000047BE
00835C E1F900004FOE
008362 5 2 4 6
008364 BC7900004768
00836A 6DC8
00836C 4A3900004ED8
008372 6712
008374 4A7900004F1A
00837A 6708
00837C 423900003628
008382 603A
008384 601C
008386 307900004F1A
00838C D1C8
00838E D1FC00004EEC
008394 OC500008
008398 6708
00839A 423900003628
0083AO 601C
0083A2 303900004696
0083A8 E340
0083AA 48CO
0083AC D1B90000493C
0083B2 5247
0083B4 BE7900004ED2
0083BA 6DOOFF5C
0083BE 4A3900003628
0083C4 6736

Abacus Software

QrHCQ

^f c ,r-

m
< w

t?

O1

'

Atari ST Internals

c
o

co
CD

-H

at &

'

WT*rW>CO'3<CO5(<'=l'COracM<OH<rMCO|ia>O
O><0-OQ5nQCOrHCOOjmBi;<HKi;W <CMpqcnQ
h - itu
^r~nwco&nro>cocoli<
".^ - C O > C O V Q

>

<

O f i S

396
, > ~

o o
Q

^Tt C M C O C O O
40-QQt-HCMFt,
. ^ H r o v o c o

r
O

- S H r H ' S

Atari ST Internals

Abacus Software

M
4J

a
ra
o

<a

a. o

W 53

fc.

5P CM

O
Q

a
O co O
W
Q
(0

r- tQ Q

O
CM

O
Q

co o O O O
> CM

O
Q

CM
CO

CO
/>=%

r- o CM
Q

c- o
Q Q

O O

Q ==

<H

O
O

o o r- o

Q Q Q Q

n o
- Q
o o rQ Q Q
QJ

O O

CO

vo
o
o
o
o
en

o
o
o
o
a\- co

o
o
o
o
en

r-t

CO

<C

CM

o
o
o en

o m
CO H

O o
vo n
O

O O

CM

co co
O
O
O
O

O
O

^* en

CO

O
O
O
O

co
5 O
Q O
W o
ht o

o o
o o
o o

o o

en en o en en en fC, r- o
i r- o co P&4 CO o o o
r- o co
co
lf>

> co o

f"1 F*i

PM

PTi O

o
o

CM
o
o
o

O CM O O r -

co

O
O

o co

vo
co
H

co
o
o
o
o
o

o
Q

co

o
o

CO
C/5~

CM f^
Q
FT1

</>/>

CO

CM

^ r- co
o T co

a)

CO Q
W C"""
CO sp

o
o
o
o 0
o o o

o vo
o rt
o ^
0 0
en o

O C M P ^ O C O i H C O C O O C O i H C O C M O

iH cH rH *I t~i

%I rH CM CM CM CM CM CO CO CO CO ^*

oooooooooooooooooooooooooooooo
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

397

Abacus Software

Atari ST Internals

4J
G
-H

0)

ts

-rH

P,

CD
A
4J

10

CD

CU

4-1
-H

4-1
C
-H

rH

rH

G
O
-H
4-1

4-1
O*
S3
-H
H
VO 4->
01

X 4-1

rH

o
o

m
0)

En

O -H

<

K 33

o]
CU

W
W

P,
4-1

_l

s^
Jq

0)
SH
O

c*

1H

o w

cocncjCQDfClcor-

& Ed

I-H cn

4-1

CD

O)

(U

W C

4-1

CD

>

01 G

4-1^34-1^34-143

SH
.

4-1

rH

-H

rH

H
CU

g
M

CD

IO

ffl
g434-l

M
4-1

M
O

4-1
X

K
^]

}_l

O
W

fc.

*.

rtl

CO
CO

4-1

0)
>
O

cn

S 43

O
rH
SH

ft,
O
W

4-1
P

rH
rH

Ea

W O W

10
M
43

fH

CO

vo

*. <J

"3*
^O'rHCn
STrHCn
C O r H C O > C 3 O C O | C O
t/>^H/>^=</>Q</>=*^</>

?
10
rH

tP
Id
rH

O Q O

CQ </> cn vo pt.

SH
O

C M T W Q W

r"

4-1

O W

vo

4-1
01

X
-

"H

CO

0)
4-1
rH

P M
ft. O
4J M

tr

D"
CD

4-1

10

"rprHCn
O
03
I
CO
Q</>=te-U>

s
CT

rH

-rH

O Q O

pr,

CO

4-1

rH

CD
4J

O
4-1

Q M
VO

01
4-1
<0
G

O1 O
10 L4

0
rH

M
10
C O W W C M C O C M C O E ^ )

ft,

P,

O
4J
O

rH

rH

o,

CM

o
CM

pq vo h

pq

sr <-H cn

CO </> CO O CO
</> ^ < Q >

O1

0) > SH 4J O1 > (0
S G O 01 01 cu o SH
O 43 g 43 4-i 43 g 43
ft.

>

rH

43

v
I
=tt=
tT
CD

(U
10

tp

10

rH

4-1

CJ*

01

01

0)

43 4-1 43

CO
CO

cn o cn < CTl
r^ o n IO ro
CM o f^ r- <^
*r vo =r vo T
VQ o o vo CO
^P
IO in IO

0016D5E

0004F88

o o o

0004ED8

O
IO

00047CE

0004F88

Ed

CM cn
10 rvo <

VO
rH
VO

VO T VO

o
co
P=3
CM

W 0 vo CO
If! vo VD vo

o
o

vo
CM

rH
O
0
0

ro
vo
Q
vo
rH

CO

vo
tv")

O VO

vo
0

CO
IO
0
0
0
rH
VO

o vo
5T

vo r- vo

o 10
IO
oo
o
en
vo 0 o O VO Ed O
^
n [^ rH ffl o ^ o Pd 0
o O VO W rH ^ f^~ o o
vo o VO CM VO ^3, VO r~ vo

CM

3<

VO

C _ ) W V O C O i C M ^ r V Q C O

31 0 Eu 0
rtj r~ 0 0
CO

vo r- r^ r- r-

C O C O C O C O O 3 C O C O C O C O C O C O C O C O C O

o o o o o o o o o o o o o o
o o o o o o o o o o o o o o

(""r^oocococncncncyi

o o o o o o o o o
o o o o o o o o o

398

Q
VO
rH 00

o
o
o
a- O
t1
O

fi^
W

10
to
o
o o vo Pd
O
rH

^i
f3J

O pd
t
O

CO

CO

CO

vo CM vo .31 vo r~
co
O M
o

cn cn
CO

CO

CO

o o o o o o
o o o o o o

Abacus Software

<D

CD
C
-H
.H

CQ
4J

01.

C
H
0
P.

G
-H
O

Q,

en

o 4J
vo G
en -H

0)

cd
S

C
-H
H
^

+J
C!
-H
S-l

M
(U
4J

a M
a>

VO

-H
M
4->
<0

o
o

S-l

a
<a o
e P
0)
er>

-H

-H

4J

4J C
tH "H

~t~\Q

G
O

w S3 W

CQ

J3

CJ

CJ
O CO

w
H

o s

A
P

0)

<H
O

M -H
M

M
W

S-l
<-\l S-l

Xi

a>

C3

ta

CD

0) 0> X
P -P O

p.

0)

0)
M 4J

0)

a o

3
O

3
C

3
C

CQ

CQ
^
CQ
P.

4J

er

^
<U

er

c*.

P
<a
c

Atari ST Internals

+J

,S
4->

M
O

0)

S-l
O

3 H

S 3 ..

O
^ O O W

3 M
&, 0

t?i O

id H

s ra

0 H

ffl
G

9)
C3

G 3 H 0 H
O O H
W

o
Q
.

CO
CO

<

CO O
CO Q

O
Q

rt
o
Q

<H

vo
r~Q 03 Q

VO
Q

Q C J V O C J V O p t *

O
Q O

Q O
^rfj

en
co

co o o co o co

CO
-tO-CQ-^^O^iOQW-^-CO

0}
*
>
M -P T
O W <D
S ^1 4-* .Q

<D

4J
CO

CT
0)

>
O

<O Q

cr

0}
S> fO
O (H
S 43

-CO Q

0
J>
O

>

cr

M -P
03

QJ

CT
<U

r*
O

*^1
H

S ,Q -P J3 4 3

vo o o
O

<

if) i-i en
o co i co

Q O * -CO

XI
O

01

CQ 0)

e Xi jj xi

> ca
O M
S Xi

0)

4 DO

6D6D

o
o
o
o
vo

r~
Q
VO
rH

o
o
o
o

CO

CJ

o
o to
o
o
o 1O
o
o o
o
en co CJ VO CJ o O VO Fn O
to o CQ o en o
(=C r- o o
< r~ w o
CM

CO

VO

CM

CM CO

VO

^ VO f-

VO

W O CM

CO

CO

O O O O CJ Q Q

CQ
03
O

vo

CO

CO

CO

03

CO

CO

O3

o o o o o o o o o o
o o o o o o o o o o

W
co
o
o
o
o
en O
co
o co
avo CJ
Q Q
03
O
O

CO

o
o

VO [c,

w
to
w
Q

.H
vo
o
W

< r131 vo
^ vo
W

o o
t vo
CO *C
H W

o o o o o o o
o o o o o o o

399

CO
CO
H
co
o
o
o
en
o
ffl
o
o
o
o
en O O O O VO (k, O
co co co o -=r o h o
o co w IH <C r- o o
< to vo ^ vo r- vo
*3<

VO CO O

CM

o o o o o o o o
o o o o o o o o

o
o
o
o
iH

o
o
o

vo
o
m
CO
o
o

Atari ST Internals

Abacus Software

-H
<U

o
Q
W

r3?

co U CO W5
CQ M H rCM
<-H

CO
CO

vo 0 O CO fS. r~ r~
0 Q
r- r~ o
n < r~ ~ a Q O
w Q Q M1
** LO
10
LO
CO
CO CO r- co r- o </> r^
r- co r~
Q in Q fC * =tt= S S ^3*
Q m a I ^
CJ

o o
Q Q

O
P

0
Q

CO
0

CM 0

CM W

<
CM

O CM rH O O o r
Q in Q O Q in-

tr

ill

ft

(J CM

a ^H
w
^ h
-qi

o o
o o
o o
o o
O O O C O
CQCQW

101 CM
^p

-=T

iI

o o o o
O O O - a

o o o n
o o o o

-C1

o
O
o
o
M

CO<

CO

r-

OH
U>CM

CNi-H

CO

or~
O O
oo
oo

co
O

o
o

o
o

oo
O O
oo
oo

o
o
o

o
O
o
o

C M O O r H C M C M C t f Q C M O O r H i H O C M W Q C M O O C O C M C O O r ^ O O
W C O C M C O

cocococo

o o o o
o o o o

cococococococococococococococococococococococococococo
o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o

400

Atari ST Internals

Abacus Software

G
O
-H

O
4-1

to
0)
M

tP
-H
0)
ft

-H O
S3

OJ

CO

O
co
en

0 CM
Q Q Q
W
rtj
CO t^
CJ
en
o W w- Q
vo CM IK. &3
vo
o CM rH O ^31 r- co
Q </> </> Q Q Vt
O

,^
|
O

CD
o

3
CD

43*
p o
CO

o
< o

sP

en

O
Q

O
Q

rfj rH
-V> < / > * - * =**= CO

=*=

in r- o in
CO

g e

3
!-H

fO

rH

43

(U CD
O

e e

vo
p

v Q rH
O H
. Q CM
& - - . rH

W
O

fc. ra- M vo co o
</>

*. PC,

CD
>

cr 3

CU
>

CD

> 45

rH

o
p

co CM

VO CJ P CM

. [ in M vo

^l1

0!

p.

3 3 - 3 - 3 - 3
c Q - c y - C T -

43

PL, VQ VO O
31 CO CM
rfl
></></>"

M T S r H T S T S r H T ) O . 4 - J 4 - J (T4J
T J ' ^ C O ' O S r H C Q C D
< 3 c d r d r d O 4 3 4 - > 4 3

<n
e a e m
0 0 0 3

rH

43

(U

CU

O O

e g

en
o

CO

o
vo
CM
O

o
o
o
o en
^p ro
CM o
^P co
O

0
CM CJ
^
w Q Q
CM W w
rH qi ^p
O
O

o
o
en
r~
o
en

o
o
o
o
CJ

co
co

CM CO W

o o
fc. o

< o o

rH O

P=H o

o
o
o
o
en rfa *3*
ff) CM

CO

CM

<=p

VO

fa
o
o
o
O
O

co co co co en en <c
in in in in in m m

co co co oo oo co co
o o o o o o o
0 0 0 0 0 0 0

CO

en

K)

rH

CQ

o
O
rH O o o
o
O
O O o o
o
O
o o o o
o
o
o o o o
en o en vo o en o fa en ocj en en en
r~
co r*^
o
CQ
CM co ro CM o o O CM CM CM O rH rH
en
VO CM CO

CO
VO

o
o
o
o

CO

o
o
o
o
en vo en co en CM en cj
CJ co CM t^ O
r~
rH CM
P
vo ^p VO ^p VO
w m
*3* PC CM CJ W O vo co < o CM vo O CM CO f*l o vo CD H O vo
o
< cc co pa FQ o O U CJ Q Q Q Q Ed pq pq
m in m in m m in in in in in in m in in m m m in m vo vo
O
O
0
0

rH
O
0
0

O
O
0
0

vo
CM
o
o
o
o
en o
r~

rH

CM

rH

o o
co H
oo
vo vo

co co co co co co CO CO CO CO CO CO co co co co co co CO CO 00 CO CO CO
o o o o o o o o o o o o o o o o o o 000 000
o o o o oo o o o o o o oo o o o o o oo o oo

401

Abacus Software

Atari ST Internals

X
to

iH
<CO
CO
KVO
oco

a</>

a;

< rH
K <

< O
^<

< rH
^ ft

<
^

K C K C O
<
K
u
O O C O < r H C n
^ O O Q r f l r H H
fj;<;HrHB!;vO--v(<KSr-rH<CKl
K n f e ,
^'0'iH
^^^3-li!
SP
r-o-<=T!H>ra;r~o>-itH>

Q rt * rt * ~- Q r t ; = ! = > r i : *

a)

O T3 O

Q
ro
o
o
o

o c x i o r - o o v o
C O O C N C M C O C M O
qi VO ^i CO Q rH VO

< ft

CO

rH
fa

CO SP
O 0
0 0

o o
o o
t ^ c o O en en
fa t- O
O r H rH CM co
CO Q Q n a

CO

en
vo
^>
0
0

o
o
o

rH rfa <n SP
co o o
Q co co

31
Q

rfj
rH

t- fa

3* <P
0 O

o
w

M
SP

<

rH
VO
CM
0
O

o
o
o
o
o
o o
co o en en o rH en en rH r- co
O fa r- O fa in o fa en ^P O
o rH CM P) CO CM CM co o o o
Q 0 CO Q Q CO Q Q rH CO Q
0 0
0 0

sr <
rH

O
H
W

3* *3*
0 0
0 0

^
0
0

Q CO Q

CM
Q CO

r- fa

o o
o
o o
o
O en en O
fa r- O fa
rH CM co CO

rH
lf>

O C M ^ V O C O H O

C M S P V O C J C M T < ; C J W O V O O W ' V O C O H O e M S P < ; O C M C O

VOVOVOVOVDVDVO

V O v O V Q V O V O V O V O V O V O V O V O V O V O V O V D V D V O V O V O V O V O V O V D V O

o o o o o o o
o o o o o o o

o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o

402

Atari ST Internals

Abacus Software

C"

G.
X
!8

C
O
-H

O
01

o
ffl

O>
O -H

o,

ffl
0>

o
Q

O
CO

rH Q

en

^- VO O

<H en Q
f

vo

r- CM *r w Kg co <=C

Q O C O 03 Q 00
> W to r- r- iy r-

oocooooco

w
w

CO
CO

o
O

rH VO
O 0\

{MO
O rH
O O
O O
O O

VO

'?
O
O
O
O

O fe

<

CJ

CM

<>

\O

CM

CO

c- r~ oo co
VD

CO CO CO CO

CM
Q
W

W
O
j

CO

CO

w co

CO

O
[V]

CO
CO

o
o
o
o
o
o

o
o
o
o

T'I

O CM O
o
O O
CM
O O O Q O Q
o
O O O
00
O
o
O pt| O o o o
o o o
o
O CO
O
o
o en
o
o
O
pC4
O o o o
o o o
o
o
en r*- en o en o c n o r - o c n c n ^ r ^ c o O O O O O O COo o en
ffl T r- o co O C O O T O C O t C M - s P O r* co o C&i "sr 3* o fc. VO
co
o
o vo
C
<
;
V
O
C
M
O
C
M
|
<
V
Q
O
<
H
CM o co i-i co < r~
CM w Q <

<T)
O

CM CO
Q Q

O
co

p-

Q Q m- *

<
rH

lO

VO
CO </> CO

CO

CO

CO

>o ra

en en sC <I

rH VO O VO

VO VD VO VO
VO V O V D V O V O V O V O V O V O V O V O V O V O V O V O V O v o v o v o v o
CO CO CO CO C O C O C O G O C O C O C O C O C O C O C Q C O C O C O C O C O O O C O C O C O C O

o o o o o o o o o o o
o o o o o o o o o o o

o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o

403

Abacus Software

Atari ST Internals

r3?

rij

f3?

<C o
<; o
rfj
ooco<;i<oocof<rf;ooco<
? F H " r") f f H -w-p ro rtj ril M
*. K C O ^ p* *. "-co p* * K n
P-

<4t==*^-y>Q

</> CM CO P-

-t/> CO CO P-

<=#==te<*>Q

rfj

o
W

rt!

o
rfjo^r
rfl
o
;i<oooori;cM'O>ooocort;u
"** ro rfj rfl W "*"* *s* * 10 rtj rij H ^^' 10
P ~ *. *.co . P - < H P * *. ^ n * . t

</> VO CO I

<=H=4^>Q

</> P* CO */> CO P* O

<=5=H=>-=*t=<rt-Q

=r
-w-ofyoo
*. p] t rf ^
i n c d p * *. *.

V> n CO -O> ^ CO P"

<sfr=**5<O-=*^-0>->Q

<

^
S
3
4 3 3
,
$

rH^H^
*-J H S
- i H H S
- H H 3 :

-rH*H3:
-^5
" S
( ! }
( )
( ] } <
( ! )
0 }
O J * * *
0 } "
C D *
> T 3 T 3 Q , O 1 > T 3 T 3 Q . t J ' > ' O T 3 O , O ' > ' O ' O (ifl) > O ^ T S ' O (Xfl) > 4 J O i > ' B
O ' O ' O E a J O ' O ' O S C O O ' O T J S C U O ' O ' O g G O H O ' O ' t i E c - I O c a C U O ' a

g(0<Bo43g<o<ao43S<aiao43S<oiao43S43S<a<ao43e4J43S<3
o
<

<

<:

M
H
sr

<o

M
W
^p

CO

CO

COO

01
OCM

0
on

o
OVD

n
o
o r ^ - * H

n
o
o
o r o t - n o

0 0
O O
O O

0 0
O O
O O

0 0
O O
O O

0 0 0
O O O
O O O

O
O
O

CO

rtoo

CO

O
O
O

O
O
O

O
O
O

C O C O C O C O C O C O C O C O C O O O C O C O C O C 0 0 3 C O C O C O C O C O C O C O C O C O C O C O G O C O C O C O C O C O

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

404

Atari ST Internals

Abacus Software

o
Q

15

rQ
O O

W O

O Q
,
H f - O

Q -

i-)i-IOQOH<-IOO
Q Q Q .rHCQQ>tH

M<ijtr

ajo)-aj

O
O
O
O

-sr

-a-

HO
pqo
in o
no

OrH
O O
O O
O O

O
O
O
O

> O O
C O O C O
O O O
O O O

-=T
Q
r~
-a1

O
O
O
O

O
O
O
<>

Q -a1 > Q
->Q -

[=3

i H O O

O O O
O O O
O O O

O
O
O
O

O
O
O
O

<MO
O O
O O
O O

CO
O
O
O

C Q C O C O C O C O Q 3 C Q C O C O C O C O C Q C Q C O C O C O C O O D C Q G O C O C Q C O C O O O C O C O C O C O C Q C O C Q

o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

405

0087E4
0087E6
0087EC
0087EE
0087FO
0087F4
0087F6
0087F8
0087FA

6DBC
1039000035BE
4880
3E80
610001B8
4A40
6706
70FF
600001A4

beq
$884A
moveq . 1#-l,DO

bit
$87A2
move . b $35BE,DO
ext .w
DO
move . w DO, (A7)
bsr
$89AA
tst.w
DO
beq
$87FE
moveq . 1f-l,DO
bra
$89AO

beq
move . b
ext .w
move . w
bsr
tst.w

DO

DO, (A7)
$89AA

DO

bra
$880C
moveq . 1#1,DO
move . b DO,$4EEA
addq . w #1,D7
move . w $4FOC,DO
addq . w #4, DO
cmp.w
DO,D7
bit
$8790
tst.b
$47DO
beq
$884A
tst.b $4EEA
$884A
$35BE,DO

DO

$4EEA
$880A

4A3900004EEA
6704
4240
6002
7001
13C000004EEA
5247
303900004FOC
5840
BE40
6DOOFF70
4A39000047DO
6720
4A3900004EEA
6718
1039000035BE
4880
3E80
6100016C
4A40
6706
70FF

tst.b
beq
clr .w

0087FE
008804
008806
008808
00880A
00880C
008812
008814
00881A
00881C
00881E
008822
008828
00882A
008830
008832
008838
00883A
00883C
008840
008842
008844

Output

Error, terminate

Epson B/W dot-matrix printer ?


No

Output
OK ?
Yes
Set flag

=
I

Abacus Software

Atari ST Internals

H
<D

-H
O
(3
ft

-H

CO

ft

M
4-1
<D
-P

4-1
O

4-1
<0
5
-H

<a
c;
-H

g
m

S-l

0!
> 4-1

H
O

to
0)

n
n

>-l
M

o o >H to w

vo

c;
o

rH
CM

-H
4-1

H
O
O

rH
O
CO
Q)

5;
EH

O> to
O -H CD

to
W

CM
CMrH
rH
fa
O

fa &

O
Q

f > O C O O

O
Q

pij

"3>

C O O O
pq Q Q

CM -

CM rH

CO O

-^
fO

CO
CO

<

C O Q O

i<C
en

<o ** f"~ vo Q
. m co E *

CO
fa-

r H r H C O ' O ' r H O O * 3 1 r H r H C O C O </> CO O


CO I CO
=tt==S=--=tt=QQ-*>--=*=J-QJ-=*>

(3

O P . f l ) > r H 4 - l ' { 3 H ' O > P . 4 - l > > H 4 - l O ' > < a


' O g r H O t o X T S r H ' O O E r H - O t O W C D O

3=

43

cy
<S

O 43

</> rH </> pq CM CM ^ rtC


*.py.cMpqmQen

- S r H r H S ' - S :

0 . . . . t r < D *
E

en * *3J
corncn

ra o us E o 43 E

IT

ci)

43

O
Q

(O

rQ

t o o p q a p q a p q a c o i o vo
rH^1CO*5TCOtr)COrH'31CO
3V}V>V*V>3EV>3V}V>

&1
0)

o1

d 4-1
T)

to

(d 4-1

M G O
4J 43 S

O1
CU

<a '

O
g

(U
Q. 4-1 >

g G> O
O 43 g

CM
rH

CM
rH
Pw
SP

O
O
O
O
O fa
O O

o
o
o
o
vo
CO
CO

o
o

co
vo

r-

O
Q
W

co pq
co o
Pu r-

CM CO CO O
rH PJ PJ CM
F"l CM CM r~1

o
O O O O O C O Q H
O O O O O K C O r H
o
o o
o
O O O O O CJ O rH
o o
o
o o o o o fa O O
en en vo en o o e n c n c y i e n c n o o o o v o

^Ji

o o
o o
o
Pu O
[V|

.CM o
to o

o o
(

VO

^mioiovovovovor-r-r-cococococncncn
cocococococococococococococococococo
cocococococococococococococococococo
o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o

407

^31

o o
o o

co
Q
W
*r
O
o

o
o

CO
CO

fa
*=p
o
o
o
o
^r co CM rH en
O O O 0 t~~
vo o o o o

Q
V0
3*

rH

en o
pq o
fa o

en cj en
O O
co o co
o pq
<
pq cq
T vo <* vo r- vo r~ pq 10 CM
vo o
pq
O CM ^
en
pq PP ffl PQ pQ
co co co
co co
co CO CO
co co
o o o o o o o o o o
o o o o o o o o o o o

en
r~
CM
10
co
en
co
co
o

Atari ST Internals

spacing

Abacus Software

M
0)
4-1
C
-H
S-l

a,
o
D^

-H
S-l

id

G
-H
g
S-l
CD

S-4

4-1
CO

tr>
id

4-1

,-H

4-4

4-1

4-1
(U
CO

a
3

0>

S3* 4-1

4-1
N

S-l
O
S-l
S-l

id

4J

rH

IM

^1

CO

4-1

0)

0)
CO

S-l
S-l
M

a (v.
&4

i-3 O

O >H

CM

Q
- <
03 ,-t en

o 03

Q -co-

S
S-l

4J

G
-H

b.
en
co

(U
4-1
10

4-1

tT
tT >

(8

co co d) o s-i
43 4-i 43 g 43

G
O
-H
4J

rH

O
CO
CU

O
CO
(U

S-l
(U
4-1
G
-H
S-l

S-l
(U
4-1
-H
S-l

en

Ol

S
cT

0)
> s-i 4-1 (T > id
O CO CO 0) O S-l
g 43 4-1 43 S 43
0)

43

Sa 1co*(0

4-1

CM

o
Q

i-H

VO [n

fT|

ii <^ r~- o

a1 co < o H

o
o

O Q

o
o
O
03

o
o
o o
o ^

H .-I <
CO VO -31

CM

VO

VO

pLH

r~ o o
vo r- vo
W

CO

CM

r-

o
o
o
o
en

o vo o
o pq o
o fa o

4-1

(Q
G
-H
g

o,

4-1

o 4-1
en 3
w o

S-l
W

V4

r^

Q H
VO fc,

J>

i-H

h.

M-l

S-l

4-1

S-l
}_l
H

CO </> CO O
</> ^t= </> Q

(^J

01
CJ1 4-1

S-l O
O 43 S

r- H

0)

4J

O
3

0)
C/3

CM Q
CN
-

CO I CO
</> ^= </>

tr
0!

S-i 4-1 tT
CO co CJ
43 4-) 43

> id
O S-l
g 43

00

O P3
O O

o o

O
<

en ,-H en

Q
vo
<H

CO

VO
O

PH
H

o
o
o
O

r- o o
vo r^ vo

CM r

ur> &

CJ CJ O

Q Q Ci Q O W

CO

03

O3

CO

CO

CO

O3

CO

CO

CO

O3 CO CO CO CO CO
CO CO 00 CO CO CO

o o o o o
o o o o o

4-1 4-1 CT S-l


&i CO CD <-H

O M O

(!)

CU

o
o
o
o
en

4-1

en rH en

tr

a w

co
n

VO
O

co r-

CO

VO
I1
CM

0
.

03

S-l

C 4-1
-H 3
*.
O
^
fI 4J
aj C

t O O V O O C O O C M V O C O G O
W

,_|

O!

&4

4-1
G

f|

o
Q O
en
co
co o CD
</> Q </>

CO

G
O
-H
4-1
3

<u

a>

o o o o o o
o o o o o o

cocococococococoenencncncncncncncncn
COCO03C003COCOCOCOCOCO03COCOCX)03COCO

o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o

408

Abacus Software

Atari ST Internals

01
-H
O

<g
a

<u
G

4J

ft

4-1
3
O

i-H

ffl
G
S
M

Q)
61 4J
<B

a
4-1
3
ft

rH

IH vi

M
0

ll

O1
G
-H

c~-x
r^
i-H

O
T3

-H
G
-H

0
4-1

E
CM

I
4-1

J_)

4-1
CO
4-1

O
CO

J_)

3 JH O 0) H
O W a w w

4->
3

en

4J
3
Q,
4J
3

0!
4J

4-1

S
_)

-H
S-l
3

0)

o^ -p

IB
rH

_j

W 0 W

G
-H

o^
fi

S-l

0)

4-1
0)

VI
O
M
IM

a. oM
fa 3
iJ O

O
f-l

M O
W S3

r<

r-

o
Q

CO
>
O
S

<

CO

CO

O CO

^ p Q ^ P O Q O ^ o f a
m K^C
en ^ e n . . e n r H c n
cnrncn
C O C M C O r H O C O > C O O C O
I CO
-y>^=^>=*^ Q</5-=B=</>O^>=tt=>

en
co

tr
S-l 4->
CO CO
43 4J

T! .
T)

co

(0 4J

o
o

H
vo
o
o

\o

r- vo

< CM
O CO

o
o
o
pq
w

o o u>
O "5P O
t-l < I o o

o
Q
r^p
o
o
o
o
en

CM
tft

tr
a>
tr
>
(U o n
~

co
>o sa

>-i01 4-1CQ <Utr O> J-1

s 43 e o

43

4J 43

43

O
CO

CO GO CO CO CO GO

en rH en

CO O
=H= -CO Q

H 4-1

tr
tr >(U
tu o

CQ
a
g 43 4J 43
O

<-t

o
> CM

o
o
o
o
pq

o o
o o
o o

CM

o o O O
r- o o o
VO p

. . _

O O
CO Q

o
Q

CO I CO
</> =8= <*>

g 43

IQ

CQ O
.

^ C5

o o o o o o o o o o o o o
o o o o o o o o o o o 0 0

M
CM

rfj en

Q O

CO

e ffl

o o o o o o
o o o o o o

t>

CO

fa
rQ

en en en en en en

^P

< CJ
CM CM

f/>

>

tr &

vo r- vo
^3 ^O O pt) O CM
VO CO
co
CM
CO CO CO CO
m in m
en en en en c n c n c n c n c n c n c n c n c n c n

CM >
CM CM

*3<

t- pq > CM

CO CO CO CO C O C O C O C Q C O C O G Q C O C O C O

409

O
0

o -a1 fa co
*r o fa co
< r- o o

CO
<

CM ^P

VO

m m u> u> vo u>


en en en en en en
o o o o o o
o o o o o o

CO
H
co
o
o
o
o
en o o
CO T O
o co co
CO W -=P
CO K)

vo > t-

cn en en

oc? ^ oo

o o o
o o o

Abacus Software

o
rd
a

!>

CO

0>
4-1
01

en

s-i o
J-l

4J IM

G. en

cn o ft.
m a w
VO
^T

^ CM
CM t-H

</> r*i <^>


-. H

Q -y>

o o

'O
T3

P* 'O M
O 13 H

0)

J>
O

m e m o g

CM

CM t-H

<n

==

C3\M

t
Q
vo
Q

iH CO

a -H >

US 1

B
X)

rH to
O 4-1

O
g

C
-H

G
3

4-1
!-!

***
**
*
**
**
X

C"
CM
CO
CM

&4

co
co
co < o Q W
o p] r- vo (JM

Q Q

"~\ *. B. '

01

Q Q

a>
4J

4J

o o

VO

^
3

4J <a
3 H

CD

ffl

4J
3
P.
4J

0 T>
^
0 O
40 3

4J

.c
o

*******

CO

M
<8

-H

-H M

4J
3
fi.

acter

(U
C

-H

4J
CO
4J

fi

0)

-3ft!

(0

t-l

<g
J5
o

G
0)

O 4J

0) t

x:

4J

M
ra

u
q A
a)

4i
o wX ft

,
o o

s
<

i io

tr
CD o

*
*
*
*
*
*
(jq
*
*
fe,
*
*
CM
cn
* O 0
0
* [V, O
* p4 o
o
0
* [V, 0
* VO cn CM fjq
* in to CM CM
* M (^ r- 0
*
a1 vo f 1
*
* pi ) ^i vo
rt* <J m m
cn cn en cn
*
*
CO CO CO CO
0 o 0 o
*
o 0 o 0
*

X
0)

-*

q
3
3
<3J

4->

C?

CJ

1 CM
N ft

o o
cn Q Q cn Q Q
,Q

4J
3

E <tt

I
M

**t

Jj

m en <
CO
</>

0
3

01

M O 4J
CO
CD

o vo

CM

4J

O
<3

W CO

<,

-H
O

19
M o
H
0) .p X >

VO

o
<a

G
O
-H

M
0)
4J

ry

ntronics port

Atari ST Internals

co

<u
^f
^4

CO CM

H
O
M
M

C"

CO

a H

o
vo a ft

ft

</>

d>
CD
M
U-4
I

CO

h t=H
Q
cn i-t cn cn
CO

O ^>

31s

CO

CO

to </>

1-1

H
3
p <B
M "
CO o CO a
<o ^j Xi

tf

0)

n>

f!)

M
^3

^4
JQ

f T|

QI

CO

CM <

03

VO

W CM

VO
CM
O
O
O
O

ea w w

o o o
o o o
0 0 0
o
_ o
_ o
_

KG
pq
CM

co

CO

vo

O CJ t-H
O Q O
O CO O
O Pt4 O

O
O
O

cncncnocncnocjooc^E^E^in
CQcor^-srrof^ocpvo^cnQinr*-

r-IOt-ICMOOCMHi-ICMrtlCJfaW
C M C O H ^ V O C J C M V O O M O C M V O C O

c^r~r*-cocococncncncnrfj<s<Srf!
cn cn cn cn cn cn cn cn cn cn cn cn cn cn
C O C O C O C O C O C O C O C O C O C O C O C O C O C O
o o o o o o o o o o o o o o
o o o o o o o o o o o o o o

-J(

410

CJ
CM
ft

cn

0
0
0 0 pq
CO CO CM
CO W 0
a1 co f-f

CO

o
0
o
0
O o cn
CO

o m

co 1*4
^1 cn
^r
5_j pq CM T vo
f^
ffl CQ CQ CJ CJ O
en cn cn cn cn cn
CO CO CO CO CO CO
0 o 0 o o o
o 0 o 0 o o

(V,

O
1^1

^p

o Pu CM CM
vo O O O
vo r- VO VO
in
vo
o w o CM
CJ o Q Q Q Q
cn en cn cn cn cn
CO CO CO CO CO CO
o o o o o o
CO
*3*

ft
^gt

IQ

o o o o o

O089D8
Q089DC
O089DE
0089EO
0089E4
0089E6
0089E8
0089EE
0089FO
0089F2
Q089F4
0089F6
0089F8
0089FA
0089FC

102E0009
4880
3E80
102E0009
4880
3FOO
4EB900008A46
548F
4A40
6604
70FF
6002
4240
4E5E
4E75

move . b 9(A6),DO
ext. w
DO
move . w DO, (A7)
move . b 9(A6),DO
ext ,w
DO
move . w DO,-(A7)
$8A46
jsr
addq . 1 #2,A7
tst .w
DO
bne
$89F8
moveq . 1#-l,DO
$89FA
DO
A6

bra
clr .w
rts

unlk

move.1
cmp.b

link
A6,#-4
$8A1C
bra
move.1 8(A6),AO
move.b (AO),DO
ext .w
DO
move.w DO,(A7)
bsr
$89AA
addq.l #1,8 (AS)
t st. w DO
beq
$8A1C
moveq.1 #-l,DO
$8A28
bra
8(A6),AO
#$FF,(AO)

********************** **************************

0089FE 4E56FFFC
008A02 6018
008A04 206E0008
008A08 1010
008AOA 4880
008AOC 3E80
008AOE 619A
008A10 52AE0008
008A14 4A40
008A16 6704
008A18 70FF
008A1A 600C
008A1C 206E0008
008A20 OC1000FF

Character to output
Extend to word
And on stack
Character to output
Extend to word
And back on stack (?)
Output via RS-232
Correct stack pointer
OK ?
Set error flag

Yes

Output string to printer

Get string address


String character
Extend to word

Output character
Pointer to next character
Error-free output ?
Yes
Error
Terminate output
Pointer to string
$FF as end indicator

B
>
n

5?

to

008A24
008A26
008A28
008A2A

66DE
4240
4E5E
4E75

302F0006
48E71F1E
3FOO
3FOO
9BCD
6100E198
584F
4CDF78F8
4E75

bne
clr.w
unlk
rts

move.w
movem.l
move.w
rnove.w
sub.l
bsr
addq.w
movem.l
rts

S8A04
DO
A6

6(A7),DO
D3-D7/A3-A6,-(A7)
DO,-(A7)
DO,-(A7)
A5,A5
$6BD4
#4,A7
(A7)+,D3-D7/A3-A6

******************************************************
008A2C
008A30
008A34
008A36
008A38
008A3A
008A3E
008A40
008A44

302F0006
48E71F1E
3FOO
3FOO
9BCD
6100E258
584F
4CDF78F8
4E75

move.w
movem.l
move.w
move.w
sub.l
bsr
addq.w
movem.l
rts

6(A7),DO
D3-D7/A3-A6,-(A7)
DO,-(A7)
DO,-(A7)
A5,A5
$6CAE
#4,A7
(A7)+,D3-D7/A3-A6

******************************************************
008A46
008A4A
008A4E
008A50
008A52
008A54
008A58
008A5A
008A5E

207900002580
3028000A
B07C0013
6236

move.l
move.w
cmp.w
bhi

$2580,AO
10(AO),DO
#$13,DO
$8AA6

***************************************************
008A60
008A66
008A6A
008A6E

Next character
OK

Centronics output
Character to output
Save registers
Character to output

Clear A5
Output character to Centronics port
Correct stack pointer
Restore registers
RS232 output
Character to output
Save registers
Character to output

Clear A5
Output character via RS-232
Correct stack pointer
Restore registers
VDI ESCAPE functions
Pointer to CONTRL array
Function number
Greater than 19 ?

as
n

WJ

srs>

Atari ST Internals

0)
-rH
4-1

10
rH

dress

CO
CO
CU

o10
<uCO

(U
G
-H
4-1
O

(U

0)
!H

10 4-1

4-1
CD
O

<

CD
X
H

ex

4J

c
tr>
o ex o -H
CD

T3

<0
J2

O
CO

O
CO

rH

4-1

4-1

co cr -H
C

^,
0)
4-1

I1

pi)

CO

rH CM

CO

ex p p p p ex o 4-1
ra 0 0 O

CD

S-)
-H

M
O

rH

4J

4-1

4-1

raphic cursor at location


last graphic cursor

10
4-1

cu

rH

rsor left
ha cursor
end of alpha screen
o end of alpha text line
alpha cursor address
cursor addressable alpha text
video on
video off
current alpha cursor address
tablet status

addressable alpha character cells


ha mode

Abacus Software

(0
4-1
(0
T3
4-1
C
O

CD
N
-H
rH

cu cu CD CD ex 01
CO

CO

r4

O
tH

10
< D O P M r 4 - r H - H O d ) >
fd
0 ) c o C D e X C D ( D P P t 3 O o
4i!cucocEjr44-i>>crcrr-4<o e
ex ex ex r-He X OE < r3 Jr 4W- iQH OP CKI K) < rDHC HC <MO fr H^ cu
< ft, !B W
(0

<fl

rH

rH

<,

<

n SP m

(0
-;

vn

*OrHCMO<3'inVOr~03

01

a\H

0)

W
PJ

*
*

-^
-
r H C Q c M O

*
*

*
C J C J O C J C J C J C J U C J C J O C J C J C J C J O O C J C J U

O<^

O 3 C O C O a 3 C O C O C O C 0 0 3 C O C O C O C O C O C O C O C O C 0 0 3 C O

->:

f-i t

KO

-CO <O </> <O <O <O <O </> Vt

10
-H
4-1
-H
rH G
Q -H

CM
O
rH

<.

W C [ U

"^

Vt

Vt

Vt

Vt

Vt

Vt

Vt

Vt

Vt

Vt

Vt

C C C N C J V O ' O ' C O C M C J O C O s r p q c M C O C M C J ^ O W W
t i n C O C O O N i e C C J Q h P ^ C M C O r i J C J Q Q O C r H C M

* Q

< C O O

C J C J C J C J U U U C J C J C J Q Q Q Q Q Q p q O E d W

O f

00<O<

C O C O C O C O C O C O C O C O C O C O O O C O C O C O C 0 0 3 C O C O C 0 0 3

rHCOrHCTV

*
*

3:

O &

rH

|S

C O -

S S S S S S S S S S S s S S S : ? ? ? ? : ^ *

O T i g
gfO-n

O O O O O O O U O O O O O O O O O O O O
OT3Ti"O-aT!-aia-OT3-OT!TST3'OT3'a-OT5'O

* g C D g C D 4 J
*
O X ) U 4 3 ! H

>TSCX

*extrexcrco
*
*
*
*
*
*
*
*
*
*

<
CJ

03

ice o

in

VD pi)

VO

C J K C C J O I O

o o
o o

*
*

C P C J O

O 0 3 C M O C W C O C M > p i l K C ' 3 ' C O p q C O C M O C M ' 3 '

O r H W

O f e O O O O O O O O O r H r H r H r H r H r H O r H r H

mQT
CO

CO 00

o o o
o o o

o o o o o o o o o o o o o o o o o o o o

0 3 C O C O 0 3 C O C O C O C O C O O O C O C O C O C O C O C Q C O C Q C O C O

o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o

413

o
o

*T

o c^
o o

* O [ ^ O C ~ - p a

* pQt^pqvo*^
*
*

CO CO CO CO CO

* o o o o o
* o o o o o

bsr
move.l
move.w
mulu.w
move.w
bra

$8FOO
$2584,AO
(AO),DO
$257E,DO
DO,$255E
$8EEE

***************************************************
61000448
207900002584
3010
COF90000257E
33C00000255E
6000041E

VDI ESC 101


Cursor off
Pointer to INTIN array
Get paramaters
Times number of bytes per screen line

ascout
Get character from stack
Process only low byte
Output character

008AB6
008ABA
008ACO
008AC2
008AC8
008ACE
*****************************************************
008AD2 322F0006
move.w 6(A7),D1
008AD6 024100FF
and.w
#$FF,D1
008ADA 600005D2
bra
$90AE

conout
Get character from stack
Process only low byte
Get conout vector
And execute routine

#$20, Dl
$90AE
#$1B,D1
$8B08
#$8B4A,$4A8

*****************************************************
008ADE 322F0006
move.w 6(A7),D1
008AE2 024100FF
and.w
#$FF,D1
move.l $4A8,AO
008AE6 2079000004A8
jmp
(AO)
008AEC 4EDO

cmp.w
bge
cmp.b
bne
move.l
rts

*****************************************************
B27C0020
6C0005BA
B23C001B
660C
23FC00008B4A000004A8
4E75

Process CTRL codes


Less than 7 ?
Ingore, RTS
Greater than 13 ?
Ignore, RTS

Standard conout
Control code ?
No, output character
ESC ?
No, process other CTRL codes
Conout vector to ESC processing

008AEE
008AF2
008AF6
008AFA
008AFC
008B06

5F41
6B22
B27C0006
6E1C

*****************************************************
subq.w #7,D1
bmi
$8B2E
cmp.w
#6,D1
bgt
$8B2E
008B08
008BOA
008BOC
008B10

B3

rs

en

cn

S3

5T

rr*

o o
g id -[>

CM

^p

rH

rH

CO H
t| rH

CQ CQ CQ
CO CO CO
o o o

0 0 0

CQ

CO
0

rH

CO
rH

0 o 0 0 0 o
CO CO CO co CO
CQ m CQ CQ CQ CQ CQ

CO

CO

CO

CO
CO

* T!

CO

CO

CO

1 1

1 1
o o

CO

Q CO Q Q Q CJ

o
CO

IS

pq

CO

CO

CO

fa
CO

fa
CO

3 3

o 0 0 0 o o
a a a a a a

*
*
X
*

*
*
X
*
*
*

4-1
H

X
X
X

S-l

X!

*
X
X
X

*
*
X
*
X
* m
* r~
* f-*j
X
X
X
X

^p

-X
X
X

CO
0

pq
CM

* CQ

*
*
*
*
*
X
*
*
*
*
*
*
*
*
*
*

415

CJ

o
Q

o
vo
in
CM

3
(U
0

rri
\J

ts
IB

o
01
M

4-1
(U
0}
(U

rH

o CM CJ
Q

CM
CO

=*

CM

cn

*
cr
oIB

!>
O

^
6 X!

-)J

*
X
*
X
X
X
X
-X
CO
rH
CM

W
o

CM
^O

vo
in

CM
O CO
O
0
O

fa
fa
fa

cn o
* co *xp
X o CM
* CO O
*
* <3* *3
* CO CO
X CQ CQ
X CO CO
* o o
* 0 0
X

-X

0)

0)
H
0

er>

-H

C
0)
4-1
CO

p
-H

CO
CO
(U

rH

Q
rH

=*>

Q
CM

pq

CO

CJ
==

* 0 p
* s CO
*
* CO
* a:

r\

g
X!

X
X
X

o
o
vo
o
X CO
* PQ
* CO
X o

*
*
*

ca
o

X
X

X
X
X

o CJ <=p f f rf^ [V]


f en
o fS^ 0 t3^
o rH 0 ^31 ^J1
^ V *gi
o o 0 0 0
0 o
o CM c1 \o CO (^ CJ
CM CM CM CM CM CM CM
CQ
CQ CQ CQ CQ CQ
CO CO CO CO CO CO CO
o o o o o o 0
0 0 o o o o o

*
*

*
*

*
*
*

X
X

-X
X

n
0

rH

H
O
CQ
H
P
O

Process character after ESC


conout vector back to standrad

rH

CM

4-1
P
OH
4-1

CO

0)
G
-H

*********************
.1 I$8AEE,$4A8

en

Convert to number divisable by 8

EH

fa
fa

I$FFF8,DO

r3

0
CO

*
*

0
0

TAB

CO

o
CO
pq
CO
t3* o
o o
o o
rH o
cn pq CJ o
31
fa Q
( rH W
CO O
W CO Q "^

rH

*********************

pq CQ

CQ fa EH

BEL

w w

*********************

Jump table for control codes

4-1

*
-X
-X
X
-X
-X

01

<a
rH

0)

Atari ST Internals

*********************

*********************

w
.w
1

#1,D1
Bring to word processing
$8B20 (PC,Dl.w) ,AO
Get relative address from table
I$8B30,AO
Add base address to it
(AO)
And execute corresponding routine

Abacus Software

in

CM
0
O
0

^r
vo
ro 0
o cn o
^p CO 0
o CM 0
in co
o vo
w
CO
^*
CQ CQ CQ
CO CO CO
o o o
0 o o

o
0
* o
* o
X o
X w
* w
*
X
X
-X

CO
0 )

X
X

0
0
CJ

-X

o o o o

o ^r

O
O

o
0
o ^31 o
CJ
O
* fa r- Q cX CO CM PQ CM
X CM cn IQ pq
* >
X
sr CO
^
X m
m
* CQ CQ CQ CQ
X co CO CO CO
* o o o o

$8BBO
#$18, Dl
$8BA2
#$8B72,$4A8

To ESC table for capital letters


'Y1 for set cursor ?
No,test for lowercase letters
conout vector for ESC Y

6F50
ble
B27C0018
cmp.w
663C
tone
23FC00008B72000004A8 move.l
4E75
rts

#$20, Dl
D1,$4AC
#$8B88,$4A8

008B5E
008B60
008B64
008B66
008B70

sub.w
move.w
move.l
rts

******************************************************
927C0020
33C1000004AC
23FC00008B88000004A8
4E75

sub.w
move.w
move.w
move.l
bra

#$20,Dl
D1,DO
$4AC,D1
#$8AEE,$4A8
$92AC

bmi
cmp.w
ble
rts

sub.w

$8B2E
#$15,Dl
$8BBE

#$21,Dl

Isl.w

#1,D1

move.w $8COC(PC,Dl.w),AO
add.l
#$8B2E,AO
jmp
(AO)

ESC uppercase
Code times 2 for word acces
Get relative address from table
Add base address
And execute routine

Test for ESC lowercase


Subtract offset
Ignore lowercase 'b1
iwi
Less than or equal, process sequence

Process column after ESC Y


Subtract offset
Column value
And line
conout vector back to standard
And set cursor

Process line after ESC Y


Subtract offset
And save line value
Process conout vector to column

008B72
008B76
008B7C
008B86

927C0020
3001
3239000004AC
23FC00008AEE000004A8
6000070C

******************************************************
008B88
008B8C
008B8E
008B94
008B9E

927C0021
6B86
B27C0015
6F10
4E75

******************************************************
008BA2
008BA6
008BA8
008BAC
008BAE

E349
307B1058
D1FC00008B2E
4EDO

*****************************************************
008BBO
008BB2
008BB6
008BBC

sr
ta
n

CA

i
&I

3?

*
X
*
*
*
X

rH

0 CO
CO */}
</> =4fc

*^
^-

*
X

CM

S
S
01

rH

tu o
o o S

* i-H E
*
-X
*

-ii

X
-X

*
*
*
X
X
-x

w
CM

*
*
*
*
X

CO
O
'O O
0 0
rH 0
ffl
O
f^
fa
O rH

a1

cn
SJ1

0
Q

f*>
a
H o Q tp
M o ^ji

^J
CQ CJ CJ C

-X

*
X
*

m
m CO

CO

PQ

CO

ffl
CO
0

o 0 o
o o o o

*
-X

>
=&=
-X
*

* C^
O
* vt
-x =tt=
*

X
-X

X
*

*
X
*
-X

CO

01

*
* CO
* f^C
* ^i
* o
*
X
o
o
-X
x o
-X
o
CO
* Q
*
-X
CQ
*
-*
X
*
*
*
*
X
*
*
-X
x
*
*
-X

X
X

rH

05
4-1

to

*
X
-X
X
X
*
X
-X
X

*
-*
X
*
X

o
o
0
o
IO

p-.

CM

CJ
CJ

\&

ffl ffl
CO
0

*
*
X
X

CO

o
fa

.jt
*

-JC
*

X
X
-X
X

CO

*
X

rH

0)

o
g

O
CM
</5=ti=

|5

01

f1

H
CO

o -u>

X
X

(TJ

JQ

*
X

o
o
o
o

*
X
-X

*
*
*
-X

s
CO

o o
o CM
o O
o O
CJ

CO

O
p~CM
CM
W

ffl m

00

00

CM
&l
CM
O
O
0
O
10

IQ

CO

rH
O
O

w
ffl
CO

ffl

CO

o o o 0
0 o o o

CQ

*
X
X
X

*
-X
*
X
-*
X
*
X

*
*
*

*
*
*
X

CO
{/}
=**=

CD
t>
O

,3j o

CO
</5=4t=

W
4-1

CO
<J
a1

*
*
*

o
c
P
o
to
O
>
4-1
CO

=H=

rH
Q

rH

|5

*
*
*
X

CO

*
X
X

O
0
0

CO
CO
PE]
CO
</>

0
CO
fa
00

X
*

ffl

o
o
0
o

CJ 10

p4
CO
CM

[^
W
Vf

CJ
{-)

VO
f^J

01

X
JQ

*
*
*
^t
*

* fa t O
-X
*
n CM o

CM
O
O
O
O

*
X

-X

0 0
0 O

*
*

CO
ffl
CO

o
0

ffl m

CO

CQ
CO
V}

IS

w
o
w

w w

CM
ffl

CO

CO

CM

CM

IS

IS

1
CM

CM
ffl
CO

CM
ffl
CO

1
w M

CM CM
CQ CQ ffl CQ
CO O3 CO CO
4/>
</>
</> </>

S S

o o o o U
a a a o a

-X
.
-X
-X

^
C
O

CM

H H
CM CM

U Q

o
to
w

*
*
X

X
X

ffl
CJ CJ
CO w
H w

*
X

o o
o CM
* 0 0
X
o 0
*
CJ

-X
X
X
X
X
-X

(Tj

m ffl

co co

K*
>

r^
^ji
0
0

o
X
o
*
o
*
-*
X
H

417

CM
</>

X
-X

rH

*
*
*
X
-X
X
X

CO
<
^1

fa
CO
CM

*
*
*
-X

Standard conout vector


Subtract offset

o cj

to

*************

<a

| 4J

rH
Q

set background color

Set conout vector

IB

to

to
o
rH

**************

4-1
O

EE,$4A8
, Dl

ffl ^^

CD
4-1
O

ESC c

rH
Q

4-1
0)
01
tH

*************

0)
T5
0
O

o
o

r-H

F8,$4A8

-H

Set standrad conout vector

01
01

*************

CM

EE,$4A8

*************

ESC lowercase

to
o

set character color

o
3=

ESC b

^4

Set conout vector

*************

o
o

D8,$4A8

01
0)

6 (PC,D1 .w) ,AO


Get relative address from table
2E,AO
Add base address
And execute routine

01

Address table for ESC upper casi

Atari ST Internals

Abacus Software

rH

vo
10 CO
o o o
o O CJ
CM

CO CO
0 o
0 o

CO

o
0

X
*
X

*
*
*
X
*
*
-X
-X
X

*
X
*

vo i"3!
^o rrH
O

rH
O

vT
Q^
^

pq

ff

rH
O

CM
VO
rH
0

o CM 3*
o o rH rH rH
U CJ CJ CJ CJ
CJ

tyj

CO

CO

CO

CO

CO

o o o o o
* o o 0 0 o
*

Abacus Software

Atari ST Internals

0)
CO

ni
O
S-l
0)

o
r-1

O
CO

S-l

<d

to
4-1

4J

to
4->

en
4J -P

01
4->

03
4J

CQ
4-J

W
4-1

CQ
4->

CO
01

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

C M C M C M C M C M C M C M C M

it pa pa w pj w pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa
* CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM
it pq pq pq pq pq pq
cq m pa m pq CO
pq pq pq
pq pq pq pq pq pq CO
pq
it
CO CO

******

C J U C J O O O O O

f^rnrnrornf^rnm
C 0 0 3 C O O O O 3 0 3 O 3 C O
vtvtvtvtvtvtvtvt
I

M H W W W W W W
CMCMCMCMCMCMCMCM

cQpqnpqpqcqpqpq
vtvtvtvtvtvtvtvt

3 3 3 3 3 3 3 3
O

*
it
*
-it
*
*
*
*
*
it
it
*
it
*
it
*
it
-it
it
*
*
it
*
*
it
it
it
n

CO CO CO 03 CO CO CO CO CO CO CO CO
Vt vt
1
1
\a 1
1 1 1 I I I I 1

vt vt vt vt vt vt vt vt vt vt

pa
pa
CM CM

vt
1

03
CO CO CO CO CO
Vt Vt Vt vt Vt Vt Vt vt Vt
l l 1 l l l t l
t

pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa

CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM

pq pq pq
CO CO

pq pq pq pq pq pq pq pq pq pq pq pq pq pq pq pq
03 CO
CO CO CO CO CO CO CO 03 CO CO CO CO CO CO CO CO CO CO
in- vt vt vt vt vt vt vt vt vt Vt Vt vt vt vt vt in- vt vt vt vt vt
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
O O O O U O O O o O O O O O O O O o O O O O

o a a

a a a a o a a a a o a a a a a a a

w w 10
as pq vo

TJ

K
*
O O O O O & j C M C O
O O t H n t - l t H C O C O

o o o o o o o o
V O C O f i C O W O C M ' O '
rHtHrHiHi-JCMCSJCM

U U U U O U O C J
cocococococococo
o o o o o o o o
o o o o o o o o

*
*
*
*
it
*

CM CM 0 0
CO
o o
0 0 co CO CO o o
0 00O o o o

\
CM
CJ
*
it O3
* 0
* 0

CO
CM
CJ
03
O
0

o pa

o CM pa
o k, o
o CO sr
o o O
3* to CO

CO
CM
^P
O

oo
oo
oo
o pa

f%
f
o CM
CM CM CM CO CO CO CO CO CO CO CO
CJ CJ CJ O O
O O O
03 CO CO CO 03 CO CO 03 CO CO co
0O o o O o o o o o o
0000O o o o o o o

ooo

418

o o o o >
< *r
o
a\M
o o o 0 CO
en
CM o o o o ^r *?
O o O o o o 000
0 CM ^i V CO <J 0 pa o
^p =? ^i ^i "W "C
m
o 0 CJ CJ o O CJ o O
CO CO CO CO CO 03 CO co CO
00000000o
o o o o o 0000

o o vo

Q1

ST

VO

207900002580
317C00020008
20790000258C
303900002550
5240
31400002
303900002552
5240
v
3080
4E75

****************************************************
move . 1 $2580, AO
move . w #2,8(AO)
move . 1 $258C,AO
move . w $2550,00
addq . w #1,DO
move . w DO,2(AO)
move . w $2552,00
addq . w #1,DO
move . w DO, (AO)
rts

008C52
008C58
008C5E
008C64
008C6A
008C6C
008C70
008C76
008C78
008C7A

VDI ESC 1, get screen size


Pointer to CONTRL array
2 result values
Pointer to INTOUT array
Maximum cursor column (79)
Plus 1 equals number of columns
As second result
Maximum cursor line (24)
Plus 1 equals number of lines
As first result

***************************************************
$8C90
bsr
$8EBO
bra

008C82 548F
008C84 4E75

008C80 4E4E

008C7C 3F3C0014

addq.l
rts

trap

move.w

#2,A7

#14

#$14,-{A7)

VDI ESC 2, Exit alpha mode


ESC f, Cursor off

VDI ESC 3, Enter alpha mode


ESC E, Clear Home
ESC e, Cursor on

Put stack back in order

VDI ESC 17
Hardcopy

***************************************************

***************************************************

008C8C 61000272

ESC E, Clear Home


ESC H, Cursor Home
ESC J, Clear rest of screen
008C90 615E
008C92 6064

008C86 6108
008C88 60000226

****************************************************
bsr
$8CFO
$8CF8
bra

ESC A, Cursor up, VDI ESC 4


Cursor line
Zero, then done already

$8FOO

****************************************************
move.w $2562,01
$8C7A
beq

bsr

008C94 323900002562
008C9A 67DE

CD

5f

008C9C 5341
008C9E 303900002560
008CA4 60000606

323900002562
B27900002552
67C4
5241
303900002560
600005EC

subq.w
move.w
bra

move.w
cmp.w
beq
addq.w
move.w
bra

#1,D1
$2560,00
$92AC

$2562,01
$2552,01
$8C7A
#1,01
$2560,00
$92AC

****************************************************
008CA8
008CAE
008CB4
008CB6
008CB8
008CBE

Subtract one
Get cursor column
And set cursor

$2560,00
$2550,00

Increment by one
Get cursor line
And set cursor

ESC C, Cursor right, VDI ESC 6


Cursor column
Compare with maximum value (79)

ESC B, Cursor down, VDI ESC 5


Cursor line
Compare to maximum cursor line
Already in lowest line, done
Increment by one
Cursor column
Set cursor

move.w
cmp.w

$8C7A
#1,00
$2562,01
$92AC

***************************************************
008CC2 303900002560
008CC8 B07900002550

beq
addq.w
move.w
bra

beq
subq.w
move.w
bra

$8C7A
#1,00
$2562,01
$92AC

ESC H, Cursor Home, VDI ESC 8


Column
And line to zero
Set cursor

Cursor column
Already zero ?
Decrement by one
Cursor line
Set cursor

ESC 0, DEL, Cursor left, VDI ESC 7

67AA
5240
323900002562
60000502

008CCE
008CDO
008CD2
008CD8

6796
5340
323900002562
600005BE

***************************************************
008CDC 303900002560
move.w $2560,00
008CE2
008CE4
008CE6
008CEC

moveq.l #0,00
move.w 00,01
bra
$92AC

***************************************************
008CFO 7000
008CF2 3200
008CF4 600005B6

B9
n

e.

w
CO

en
H

I-M

CO

ST

612A
323900002562
B27900002552
6700FF72

02
$2550,02

#0,01
$2552,02

Maximum cursor column (79)

Maximum cursor line

ESC J, Clear rest of screen, VDI 9


ESC K, Clear rest of line
Cursor line
Compare with maximum cursor line

$9158

01

$8024
$2562,01
$2552,01
$8C7A
#1,01

bsr
move . w
cmp.w
beq
addq . w
swap
move . w
move . w
swap
move . w

Maximum cursor column

Cursor line

Compare with maximum value (79)


In last column, then output space
Space
Output
Cursor column

ESC K, Clear rest of line, VDI ESC 10


Clear flag for line overflow
Save old value
ESC f, Cursor off
ESC j, Save cursor position
Cursor column

bra

***************************************************

008CF8
008CFA
008DOO
008D06

008DOA 5241

343900002552
4842
343900002550
60000436

008DOC 4841
008DOE 323COOOO

008D12
008D18
008D1A
008D20

4841
323900002562
3401
4841
4842
343900002550

****************************************************
#3, $2576
008D24 08B9000300002576
bclr
move . w SR, -(A7)
008D2C 40E7
$8FOO
008D2E 610001DO
bsr
$8F20
008D32 610001EC
bsr
008D36 323900002560
move . w $2560,01
008D3C 08010000
#0,01
btst
$8058
008D40 6716
beq
cmp.w
$2550,01
008D42 B27900002550
008D48 673A
beq
$8084
008D4A 323C0020
move . w #$20,01
008D4E 6100035E
bsr
$90AE
008D52 323900002560
move . w $2560,01
swap
01
move . w $2562,01
move . w 01,02
swap
01
swap
02
move . w $2550,02
008D58
008D5A
008D60
008D62
008D64
008D66

cn
p

te
2.

=ft= -w> </>

>

00300002576

to O
43 g

beq
bset

rl

&^
CO

W CJ

m vo
rH

O
O fa
0
0 Q 0 fa 0
rH ^P [ CO rH
VO
vo "=r

vo o

O
0
0
0
VO

0 CM -ST CJ

CJ

o
co en

vo r~

r- co

Q Q rQ C
Q Q Q

CO

CO

CO

CO

o o o o
o o 0 0

M
CO

(u
M

43 43

rH

CO CO
0 0
0 O

O ^
CM CM

o o
o o

o o o

*
*
X
*
*
*
X
*
X
*
*

CJ

O CM

n oH
CM

rH

5P
CO

CO CJ
CO CO

n vo vo
Q Q Q

CO CO CO

0 O

4-1
0)

B
3

rH

CD -H
4-1 rH

0
01 U

-H 4-1 C 4-1
O fl) -rl W
P< CS & CS

- O

o
Q

CO -^ Q 0
IO 0
CM <!
<o * CM

en o
E rH
O CM
CM CO

Minus offset
Set cursor

to c

1H
0! >H

s s
O1 <B
3 0
CO g

43

<S

to 43

CM
0

0
IO

o
o

rH CO o o
T CM^P O

co o n
10 co IO
W ^P VO CO o
co en en en en
Q Q Q Q Q

VO

w
en
Q

CO CO CO CO CO CO
o o 0 0 o o

o o o o o o

422

0 0 0

* en co en H
* r- CM r- o
* o o o o
X
CM CO CM VO
*
* CM CO CJ CM
X

*
X

*3. ^

Q Q

< cq
D Q

CO CO CO CO
O 0 0 O
0 0 0 O

,w (AO)+,D1
Get pointer to Dl
n.l DO/AO,-(A7)
Restore registers
$8AE2
Output character in Dl
n.l ( A 7 ) + , D O / A O
Registers back
DO,$8DB4 Output next character

o < r-

CM 0 Q
CO- Ch CO

O
4-1

********************v******************* VDI ESC 12, Text outout


0002580
move,,1 $2580, AO Pointer to CONTRL array
006
move,,w 6 ( A O ) , D O Number of characters
0002584
move,,1 $2584, AO Pointer to INTIN array
$8DC2
bra

Q
- W O

#1,DO
$92AC

rH

M
EH

,w

4-1

move,
move,

<0

<X 3
CO O

!H

0002584

4-1

a> 3
o fx

******************** j*******************

VDI ESC 11, Set cursor

Atari ST Internals

,w

$9158
(A7)+,CCR
$8D7C
#3, $2576
$8F3C
$8EEE

Restore flag
Not set ?
Reset
ESC k, Restore cursor position
Re-enable cursor

Abacus Software

Q)
>
O
g

Q)
> M
O CO
g 43

d} CO
> H CO
O 43 4-1
g 3 M

0 VO rH O
CO CM O
fa
0 Q rH fa
CO p"| O
p&i

co r- o

p4 co to

<3* V)

rH W 0 Q CJ rCM CO tH O rH W
00 "^ \O ^p tO ^
rij

CVI ^O

cq cq pq pq CJ cj

Q Q Q Q Q Q
CO CO CQ CO CO CO

o o o o o o
o o o o o o

00

bset
rts

f4,$2576

************************************************

008DC8 08F9000400002576
008DDO 4E75

bclr
rts

#4,$2576

************************************************
008DD2 0889000400002576
008DDA 4E75

207900002580
317C00020008
20790000258C
303900002562
5240
3080
303900002560
5240
31400002
4E75

move.l $2580,AO
move.w #2,8(AO)
move.l $258C,AO
move.w $2562,00
addq.w #1,DO
move.w DO,(AO)
move.w $2560,00
addq.w #1,DO
move.w DO,2(AO)
rts

*************************** *********************

008DDC
008DE2
008DE8
008DEE
008DF4
008DF6
008DF8
008DFE
008EOO
008E04

***********************************************
008E06 207900002580
move.l $2580, AO
008EOC 317C00010008
move.w #1,8(AO)
008E12 20790000258C
move.l $258C,AO
008E18 30BC0001
move.w #1, (AO)
008E1C 4E75
rts

move.l
move.w
jmp

$2584, AO
#0, (AO)
$FF50

***********************************************
008E1E 207900002584
008E24 30BCOOOO
008E28 4EF90000FF50

ESC p, reverse on, VDI ESC 13


Set flag for reverse

ESC q, reverse off, VDI ESC 14


Clear flag for reverse

VDI ESC 15, Get cursor position


Pointer to CONTRL array
2 result values
Pointer to INTOUT array
Cursor line
Plus offset
As first result
Cursor column
Plus offset
As second result

VDI ESC 16, Inquire tablet status


Pointer to CONTRL array
A result value
Pointer to INTOUT array
Tablet available

Pointer to INTIN array


No result values
Set graphic cursor

c/>
H

S1
*+

fB

B
65
B1

CJ
CO

M
Q

CJ
CO

G
CU

cu
G
-H

to

0
(U

-rH
rH

rH

G
^ -H
01
rH 4J
3 O
CJ

CU
-rH.

rH

JLi
rH
CU

GO
G
J_4 M
3
.
O
,_p
CU

ca
CO

O
CO

o
cu

cu

N
O

01
0)

rH

ca
-H
rH
rH

0>
G fH
-H in
rH
o

rH

O
01
rH

3
CJ

CU
rH

o
01
M
3
O
4J
CU
CO

*
*
X

*
*
*
X
*
X
X

X
*

ft

*
X

He

X
X
X
*

*
He
-X
-X

*
*
X
*
X
X

*
*

*
X
X
X

CO CM
</>

j5

|5

CU

cu
> cu >
o G o
g 43 g

CO

to-

rn

01

43

|5

CU
>
0

rH

tr
cu
J>
o

g g

<8

43

*
X
*

*
*
X
*
-*
X
*
*
*
X

X
X
X

CM

rH
i
Q

CO
[

fa
fa

o
o
0
o
en
fa
W

^J1
H
CM

W
CO
0

X
*
*
*
*
X
*
He
*
X
X

*
X
X

*
*
X
X
X
X

*
-X
*
X
X

3
O

rH

O
01

-H
45
CO

rH
3

CJ

0)
rH

01

rH

CJ

3 -H
CJ rH

rH

43

3
O

s^

^
MH

3
O

4J
CU
CO

i
cu

rH

01

o
o

CM
VO

CO
CJ

CM
VO

CO
<ft

CM

en
</>

O CM
Q vt

fa in

X
*

J5

X
X
X
X
X
X

cu
>
0
g

rH

0)

43

S
rH
01

rH
rH

43

CJ

CM

cn
</>

CO
<0

CM
O
O
0
0

[5

cu
>
0

rH
01

<0
rH

43 43

o
vo
W
fa o
en 0 en
CO 0 co
CM vo fa
CO vo CO
a*
CO

fQ
CO

pel)

CO
0
0 rH 0
rH 0 CM
VO CO t

o
o
o
o
vo

vo

f^

fa

^T

CO

[V] H H w Ed
CO CD CO CO CO CO CO
0 0 0 0 0 0
0 0 0 0 0 0

o
o

vo
in

*
X
*

(U

,_)

Q
^

o
-X
m
X
fa m co w
CO CM en CO
*
X </> o> </> -co0 CM
0 VO

*
X
*
-X
X
X
He
X

0
CO

S
CU
rH

CO

43

CM
0 0
CO 0
o O
o O

in
CM
0
0

vo
sr
o a1
m
o
o o
o a\o o o en o
o
o ^r CO o
W

vo

^r
CO

o
o
o
o
o
vo

rH
VO

CM
CO

rH CM
VO

CM
CO

ptl

CM

CO

&3 a CO

CO

rH
VO

m in in in vo vo
W H a a W [V] M
co CO CO CO CO CO

o 0 0 0 0 0 0
o o o o o o o

424

X
X
X
-X
X
X
X
X
X
X
X

*
*
X
*
He
X

in

rH
CU
4->

ca
ca o rH
ca
rH
m K fZ
,G vo o
O rH
cu
4_) a >
(U 0 ca
CO g CO
O

>
o

M
01

ca
rH

43 43

X
*
X
He
X
X
He
X
X
X
X
X
*
X
X
X
He
X
*
X
X
*

CO

in

o m
Q
*.
PH4

o>

=*=
s

a
G

ca

SIK
o
Q

^
CU
> 01
0 4J
g M

He
*

*
*
*
X

X
X
X
X
X

*
X
*

ca
cu

X
X
X
X
X
He
He
He
He
X
X

*
CM
VO

CM

*
*
X
*
*
*
X

43

*
X
O
vo
^r

rH
CU

X
*

X
X

CM
O
O
0

IM

O
U

O
O

X
X

-X
X
X

*
X

in

01

O rH -rH.
CO CO 3 r;
H O CO

rH

-X

o
vo
m

O 4_>

rH

rH

ca
g cu
cu J>

rH

rH
O

M
O

X
*
rH
Q

*
.*x

CM
VO

rH

rH

-X
*

X
*

0)
C

o cu

rH
.p
t[ j

rH

*
X

*
*
X

CJ

rH

cu

G
G -H
-H rH

H
O
m m
rH

X
X
X

CM
=s= </>

-je
*

CM
VO

CO

0
CO

<d
g
cu

rH

*
He

X
*

fa
fa

-X
*

to

im

O CJ

w
o\J vo 5T
* in
m w rfQ

*
X

,_}

*
-X

3 -H
O rH
.
. rH

-X

rH
Q

cu

rH

C
t-H

*
X
*

*
-X
CO

^,
c^

X
-X

H
O
01

CU HH
G
-H O

inder of screen up

O
01
rH
3

cursor

3
O
.,

rH

inder of screen down


column 0

jq

rH

p.

rsor column

sor up, scroll if

Cft

Atari ST Internals

r column

, Clear graphic cursor

needed

Abacus Software

CM

vo
in
CM

CM
0 CO

cn o o
o o in
o 0 0
o a\O0
o
o

CM
CO

rH
VO

o
vo

0 O
vo

VO

<s

rH
VO

W pq W

03 CO CO CO
0 o o o

o o o o

X
*
*
X

*
X
*
X
X
X
X
X
X
X

CO

m
m
CM

fa o
o o
0 0
0 0
CJ o

m
r cj r0 co w

o
o

CO

(V|
CO

M W
co co

"a1

O VO
CO CO

o o o
0 0 0

and.w
move.w
rts
#$F,DO
DO,$2556

***************************************************
008E88 C07COOOF
008E8C 33C000002556
008E92 4E75

610000DE
343900002562
67F2
5342
4842
343900002550
7200
600002AA

bsr
move.w
beq
subq,w
swap
move.w
moveq.l
bra

$8F74
$2562,02
$8E92
#1,D2
D2
$2550,02
#0,01
$9158

**************************************************

008E94
008E98
008E9E
008EAO
008EA2
008EA4
008EAA
008EAC

bsr
bset
bset
rts

$8ECE
#1, (AO)
#2, (AO)

***************************************************
008EBO 4A7900002422
tst.w
$2422
008EB6 67DA
beq
$8E92
clr .w
008EB8 427900002422
$2422
008EBE 41F900002576
lea
$2576, AO
btst
#0, (AO)
008EC4 08100000
$8EE2
008EC8 6618
bne
008ECA 08000002
bset
#2, (AO)
008ECE 303900002560
move . w $2560,00
move . w $2562,01
008ED4 323900002562
008EDA 6100031C
bsr
$91F8
$931E
008EDE 6000043E
bra
008EE2 61EA
008EE4 08000001
008EE8 08000002
008EEC 4E75

Set background color


mod 16, 0..15
Save background color

ESC d, Clear screen to cursor


ESC o, Clear line to cursor
Cursor line
Already zero, done

Maximum cursor column

ESC e, Cursor on
Cursor already on ?
Yes, done
Flag for cursor on

Cursor column
Cursor line
Calculate cursor position
Invert character at cursor position

Invert character at cursor position

ta
n
S

C/5
O

ta

re
3

BB

Abacus Software

M m
O o

to

m
o
m
0 ^i
o
n CO

c>-

rH

(5
10

c
0)

to

>H

CO

M
3
CJ

Q)
>
O
43
<0

01
4-1

3
CJ

IH

^t
3
0

O>
(0

rH

^1
O
^M

O
CO

(V

<o

0)

>
a

CO
(0

CO

>H

rH

o
<a to
CD $^l
,|

En

tH

0)
0)
CO

to

>H

;>,

a(Q

>-l ,H
o |

r^

CJ1

P (U
CJ

^f

HH

<d

3
O MH
M
O

K m

-n

O
CO

rH

0)
G

O
O

-H

CO
CO

rl

0)

H
0

e> H
o c
rH o
En

<

to
J_(

CO
r(

3
O

rH

01

^t

CO
PJ

3 3
O O

*
*
it
*

CM
CM
*
*

*
it

<s- H

VO

in

KM

CM CO rH CO

i=C CM

o
rfl

o
W

<C

o\ cj cj
* pi . M . M

CM CM CO O
CO rH CO
-tO- =tfc * </> *

* is
** 4J
-K
it

CM

CM CM CM W
CM O1 </> CQ

*
*
*

-K
*

tr
43

CT
tj1 to
to 03 3 Q) 4J
4J 43 M 43 >H

81

l O r H t r O l C T r H C U l O
CJ 0) 4-> O CJ

fQ .O 43

it
*
it
it
it

it

*
*
*
*
*
*
*
it

CM
CM

CM

CM
CM

CM

CM

*
*
*
*

O
O
O
O

O
O
O
O

*
*
-it
-it

CM
i~<
'a'

o
01
t^
vo

*
it

H ^ vo o W
H P&H pt4 Pn En

-it

CO CO CO CO

01 o
r~ cj
co r~
in vo
W

m
r~
P]
<gi
PL|

00

* o o o o o
* o o o o o

CM
sr
CM
o
o
0
o

*
it
*
it

VO

rin
CM
o CM
o o
o o
o o

01 Ol

o
o
o
o
o
o
o
o o o voo o

CTi CO rH CQ Ol
CMrHOOC-COI O3VOH
i n T O V O O V O O V Q Q '

O V O C J O C M V O C O C J W
O O O r H r H r H r H r H r H
EnPnEnEnEnEnEnEnEn
C O C O C O C O O O C O C O C 3 O 3

o o o o o o o o o
o o o o o o o o o

426

*
*
*
*
*
*
*
X
*
*
*
*
*
-*
K
*
*

ta
n

to

3
O

CO

HI
iH

to

<a o

3
rH

0)

fi

O -H
O rH
H
O

^4

to

o
to

^1
3
U

a
a
<;

!H ^1 4J
3 3 (U
CJ O

K
*
-j^_^
O
VO

in

<
pj

V*

j_)

0)

<0

O
ff

K
K
O CM
vo VO

CM
CM
K a1 in
CM CM
</>

m
*

*
*
*
*
*
*
it
*

^^

0)

>

to 0> o
43 rH E

0)
>
O
g

CO
4J

p^
CM

o
o

PtJ
CM
0 ^P

o CM
vo VO
m in

CM CM
0

CM
0
O
0
0 0
ON o>

in

o
o

o
o o

0 0
0 0

a\n en m

CO
CM

fjQ sr
CM

CO

rtj

co

En En En En Pn
00
0
0

*
*
*
*
*
*
it
*

*
*
*
it
H

En En
CQ t
CO rH 0 O [V]
o 5P ro n *p
0
CM

*
*
it
*

*
it

in

03

CO

CO

*
*
*
it
it
it
it
*
-it
*
it
jt
H

CO

o o o o
0 0 o o

CM

:
o pa

Pn
^ O
m CO

*
*
it

vo

vo
rm

it
*

CM

to

*
H

*
*
*
X

*
*
*
*
*
it
*

IH
O

*
it

it

*
*
*
it

the temp, stroage

cursor position
rsor saved
the temp, storage

to
H

4-1

MH

or to saved position
position saved ?

Atari ST Internals

H
rH

er ra

0)
43 4}

vo
r^
in
CM
o
o

0)

rH

m rfj
o ^C

CM
^i
CM
O
O
0

f^*

^
(1)
>

O
S

rH
O
^^
O

f$*

o
CM

tn
</>

Et
m
J>

<o

!H

S 43

co
m
co
o
CO o 0
rH rH o
rH O CM o
ngi CO ro vo
CO w o CM
qt q! IO in
Cn En En En
CO CO CO CO
o 0 0 0
o 0 0 0

Q
Pn o
01 o en
cq o Pn
0
0

CO
0

H^_^
O

0
0

rvo

O 31
n ^i
En En
CO

*
*
*

CM
<=T
CM
t/>

CO

o o
o o

rH

o
CO
w

iw
_J
CO
W

J^

Vl
0

CO
Vl

-H

CO
VI

CJ

rH

o
p

cd

p
o

-*
X
X
X
X
X
rH

*
-X

CM in

X
X
-X
X
X
-X
X
X
X
Jfi

*
*
*
*
*
X
-X

*
X
*
X
-X
-X
X

CM

rH

CD

43

o
m in m

in

rH

rH

CM CM

CO

en

<0 Q Q Q Q -u> <o


IS IS

^1
CO

CM
Q

CM CM
0 VO Q
CO

*
*
*
*

- Vl

G
<D

IH "<~i o
m o

k.

(U

4-)
P

o a,
m -P

O U VI
CO CO P (U
IS 65 CJ ISI

a P

CO

CD
-H
rH

^i
o

K P

VI
0

4-1

Vi

CJ

CO G
H <

CO
Vl

CO

CJ

(U

o
<0

c^

*
*
*
X

X
X
-X
-X
X
X
-X
X

o
v>
65

T3

X
X
X
X

.
*

^
0

Restore cursor position


rn cursor back on

G
-H

0)

column

(U

<u

Clear line to cursor


Turn cursor off
Save cursor position
column

rH

in column zero

0)
4-1
CD

Atari ST Internals

m cursor column

CD
G
-H
rH

turn cursor off

Abacus Software

CD

> >
o o
g S

ft

IS

ft

65
CO

co-

|5

CD

(0

Vl

cfl

rH

r"
0

CO

0)

VI
M

ca
M

*
X
X
X
X
X
X
X

CM
CM
rH
Q
Q
Q
^
^
VO
CO
0 CM
CM rH
O O O 0 CM
vo Q
O CM VO CD Q en 0
VO Q
in
[V,
f-, pn irj fc,
rH
CM 0 in
en CM CM CM CM CM CM rH rH en
CO CO CM CO O CO
=4t= Q -CO Q Q Q Q <
to to -co <o =3^ <o =!(= <o
CM
Q

|5

*
X
*
X
-X
X

0!
CO

CO

43 43 g

cr
cu

^j
CO
^_)
Q

0)
G

in

CD

CD

O"1 A 0)
43 cd J>

S
Q) fX
<d cd Vi Vi

O S

o
vo
in
CM
o

CM
VO

^
O

Vi
CO

43

15

IS

01 co g

rH

O H
f*,

PL]
CM
CO </>
=4*=

CO
CO

<o

Vi
CO

nj
Vi

15

rH

S co co 0 43 43 43

CD

>
O

*
X
*
*

*
X
X
X

o
in
in

CM

vo

in

CM
0
0

CM

o ff p
o CJ pa]
o rH w
o
o o frVj
o
CO en rH rH rH CM en o o
p% CO O q* qi ^31 co o o
rH CM "=P O3 CM CO ^1 rH o
VD CO CO =r "=r "31 CO vo vo
vo CO 65 O CM "^ VO CJ o
m m m vo vo vo vo vo J
PM

CO

[V,
CO
0

fV,
CO
0

fVj

f-,

[V,

[V,

CO

CO

CO

CO

o
vo
in

*
X
-*
X

fv, Pu
CO CO

o o o o o o
o o o o o o 0 o

X
X
X
X
*
X
X

*
*
*
*
X

-}s

*
X

CM
0
0

o
o

r^ 03 en o
03 rS, co co
f1 f1 ^ f^
VO VO CO vo
=3"

VO

CO

fV)

t r^ r~ r^
p., f T] fT| fc
CO CO CO CO
o o o o

0
CM
O

o
o
o

CM
O
03
O

O
rH
VO
VO

O
03

t3*

CM
CM
rH
O
O
O

in

CM

o
o

0
0

0
0

ra
rH

CM
CO

f1

o
en CM CM en
co ^r "31 co
sj> in co T
vo CO in "31 co

CM CM rH
o ^p ST
CM coCO
co "^ qi

vo

fQ

[V]

qi

VO 03

CM

p4

rH O
^ O
CM rH
131 VO

o O CJ
en o co
rH o CM
vo vo co

-5T

ff
5J o
2] fQ CQ
PM p4 t,
03 CO co
O o o
0 0 o

VO

CO 03 CO CO en cs> en en
rtl
[y( PN p4 pM Pu FTi fTr fTt F"! FT< PM P>4 PM
03 03 03 CO CO 03 CO CO CO 03 CO CO CO
O O O o 0 0 0 0 0 0 o o o
0 0 0 0 0 o o 0 o o o o o o 0 0 O

427

o
CM
f-, o

IH
0

<4H

-a

4->

<U

CO

4->

ra

01
G
-H

<U

rH

-rH

13

rH

CU

G
0)
3

4-1
P

>

4-1
P

CJ

o cd

D1

td

rH
>H

SB

4-1
0)

CJ
C/3

co

o
CD

f3^
g
rT
CO

</>

-*
X
-X

*
*
X

m
CM
CO

*
X

*
X

ro

-*
X
X
-X

4fs

-X
X
*

^
CO
Q

cd
^_,
43

-X
X
X
X
X
X

4J
0)
CO

CO
4-1

03

En
O

o
o 0
o En
rH
ID

vo

sr CO
CQ pq
En
CO

CO

o o
o o

*
*
X
X
*

X
X

*
*
*
*
X

\>

-X
-X
-X
-X
-X
X
X
X
-X
-X
-X
-X
X
-X
X

rH

(
LO

CM

o
o
o
o

*
*
X
X

*
X

rr)

o
o
o
CD

X
*
IT)

Ex r^

H
o 31
CO

<

CM

En

CJ
En

ca

co CO
o o
0

*
-X
*
X
-X
-X

*
X
*
X
X
X

CO
>H

o
rH

0
G
-H
rH

CU

4-1
G

CJ

CM
</>

CU
CO

*
*
X
*

*
X
*
X

*
X

CO
0 4->
43 M

-X
X

rH

*
X

Q
.
CM
IQ

m
CM

CM

o CD

Q </>

*
X

o
CO

o
c
H
EH

g CJ
w
B

^4

CO

rH

t/3

*
X

Q Q

CM

K
CM CO
m ((^

CM CM CO

X
*

*
X
X
X

X
X
X
-X

in m

o
o
Pn

r-

*
-X
*

CM
0

X
X
X

CM

CM

He

|5

CU

o
CO

o
0
0
CD

cq

CO

o
^p

*
X
X

in
r^

w
o

o CJ
Cn En
CO CO

o o
o o

*
x
*
*
X
X
X
X

X
-X
X
X

X
-X
-X
X

in

CO
CO [V]
CO rH CD CO

Q ff>

*
*
*
X

</>

X
X
X
-X

CM

CM

[5

CD
G

^
CO

43

rH

rH CO

o 45

(Q
^

43

*
*
*
*
X

n ro 0 vo
m PQ VD

t-H
V.O

CM
3*

rH
\>

0
ID

-X
*

pq =r \o
o Q Q
Pn
Cn

*
*
*
X
*

rt

rtj

0 *p
p,
f. ]

*
X

*
X

CJ

\o

f^

m
CM

vt

CQ
CU
rH

CM

X
X
X

co CO
o o o
o o 0

CU

X
*

CM

0
0
J

CO

o
M CO
o H
o P

CM

31
OJ
^1

IH

CO

VD

0
CD

CO

*
*
X

in in

*
X

CO

vo m

X
*

rH

CO

rH

rH

o
<

P o a

0
CD

10

03

03

CO

Pn

0
Pn Pn
o 0 rH O 0
0 0 ^31 o 0

pt4

03

fVj

03

fJ

k,

CJ

fV)

CO

CO

Pn Pn En En
03

428

4-1
CO
.p

43

<

CM r3< CN in
CM CM VD

^ o
CM CD
</>

cr
CU

^ o
0 CD
</>

in
CM

=*=

4-1
CO
4-1

cr td
CU <u

,Q

rH

in

r^
in

\s>

in

X
X
X
X
-X

o CM
o o
o o
0 o
CD o
rH
5P

X
X

CO

o o o o o o o
o o 0 o 0 0 0

f
*-~

rH

.,

. .

X
X
X
X
X
X
X
X

CM

0 o

CD
0
CM

31

G
-H

o o o sr
o o o rH
o 0 CJ Pn

o
o
o
o

CU
A

X
*
w
M

|5
.

o,
o e

*
*
X
*
*>o

P"

*sO

in

<g
Pn

o o

*
*
X

CO

rH

vo

X
X
X

o
a

*
X
X

*
X
*

rH

rH

|5
. |5

CU

T3

C_J
f

Q.

pc P 0
^ CJ o

^
rH

X
X
X

*
X

en

X
X
X

X
X
X
X

<D
H

CO

4-1

*
-X
*

in

E
En

P o

0 o

CJ

*
*
X

*
-X
X
X
*
X

*
*
*
X

rH

-*
X
-X
-X
X

vo

rH

CO

01

-*
X

*
x

cd

-X

*
*
*
X

rH

o
o

cursor

rH

Cursor in column zero

rH

ess of the flash counter

0)

G
-H

h cursor

CD
G
-H

11 screen down
turn cursor back on

Atari ST Internals

are with maximum cursor line


in lowest linme, just cursor down

Abacus Software

X
*
X

CM

o
o
o
o
o

o
o
o
o

03

r- o

00 CD
H
En rH rH rH rH Pn

CO
r-,

CO

r-

ID

VD

Pn En o o o
CO

CO

<gi

sr 03 rtj
o o o o

CM

CD

CD

CD

0
CD

o o o o o o
0 o 0 o 0 o

VO

bra

subq.b #1, (Al)


$9022
bne
raove.b $2564,(Al)
bchg
#1,(AO)
$8ECE

009010
009012
009014
00901A
00901E

rts

5311
660E
12B900002564
08500001
6000FEAE

009022 4E75

****************************************************
move.w 4(A7),DO
bmi
$9022
cmp.w
#5,DO
bgt
$9022
asl.w
#1,DO
lea
$904A,AO
add.w
$903E(PC,DO.w),AO
jmp
(AO)

Decrement counter
Not yet run down ?
Reload flash counter
Invert cursor phase
Turn cursor off

Cursor configuration, XBIOS No. 21


Get number from stack
Negative, ignore
Greater than 5 ?
Yes, ignore

Base address of the table


Plus relative address
Execute function

302F0004
6BF8
B07C0005
6EF2
E340
41F90000904A
DOFB0004
4EDO

$904A- $904A
$904E- $904A
$9052- $904A
$9060- $904A
$906E- $904A
$9076- $904A

009024
009028
00902A
00902E
009030
009032
009038
00903C

dc.w
dc.w
dc.w
dc.w
dc.w
dc.w

Address of the routines

0000
0004
0008
0016
0024
002C

$8FOO

$8EBO

ESC e, Turn cursor on

ESC f, Turn cursor off

****************************************************
00903E
009040
009042
009044
009046
009048

bra

****************************************************
00904A 6000FEB4

bra

****************************************************
00904E 6000FE60

en
o

ii<

E?

U)
o

$8EEE

$8FOO
#0,$2576(A5)

Turn cursor back on

ESC f, Turn cursor off

****************************************************

bsr
bset

$8FOO
#0,$2576(A5)
$8EEE

7(A7),$2564(A5)

Calculate font data for character in Dl


Smallest ASCCI code in font
Compare with character to output
Character not in font
Largest ASCII code in font
Character not in font
Load font offset pointer
Code times two
Yields bit number in font
Divided by 8 yields byte number
Pointer to font data
Yields pointer to data for this character
Flag for character in font

Load cursor flash rate

4
Set cursor flash rate

Turn cursor back on

ESC f, Turn cursor off

bra

bsr
bclr
bra

it***********************************

009052 6100FEAC
009056 08ED00002576
00905C 6000FE90

***********
009060 6100FE9E
009064 08AD00002576
00906A 6000FE82

rts

move.b

****************************************************
00906E 1B6F00072564
009074 4E75

moveq.l #0,DO
move.b $2564(A5),DO
rts

****************************************************
009076 7000
009078 102D2564
00907C 4E75

move.w $256C,D3
cmp.w D3,D1
bcs
$90AA
cmp.w
$256A,D1
bhi
$90AA
move.l $2572,AO
add.w D1,D1
move.w (AO,Dl.w),Dl
Isr.w
#3,D1
move.l $2566,AO
add.w D1,AO
clr.w
D3

************************** ***********************
00907E 36390000256C
009084 B243
009086 6522
009088 B2790000256A
00908E 621A
009090 207900002572
009096 D241
009098 32301000
00909C E649
00909E 207900002566
0090A4 DOC1
0090A6 4243

L5

88"

0090A8 4E75
0090AA 7601
0090AC 4E75

rts

rts

moveq , 1 #1,D3

move . w
btst
beq
swap
bclr
move . w
bsr
move . 1
move . w
move . w
bsr
beq
move . w
mulu.w
move . 1
add.l
clr.w
cmp.w
bcc
add.w

swap

$2552,01
$911E
$2554, Al

DO

#2, $2576
SR, -(A7)
$9240
$255A,A1
$2560,00
$2562,01
$9348
$912C
$2554,00
01,00
$44E,A1
DO,A1

D7

$2558,07
#4, $2576
$9004

D7

move . 1 $255A,A1
move . w $2556,07

*************************** ***********************
bsr
$907E
$90B4
beq
rts
0090AE 61CE
0090BO 6702
0090B2 4E75
0090B4 22790000255A
0090BA 3E3900002556
0090CO 4847
0090C2 3E3900002558
0090C8 0839000400002576
0090DO 6702
0090D2 4847
0090D4 08B9000200002576
0090DC 40E7
0090DE 61000160
0090E2 22790000255A
0090E8 303900002560
0090EE 323900002562
0090F4 61000252
0090F8 6732
0090FA 303900002554
009100 COC1
009102 22790000044E
009108 D3CO
00910A 4240
00910C B27900002552
009112 640A
009114 D2F900002554

Character not present in font

ascout, ignore control codes


Character present in font ?
Yes

Screen address of the character


Background color
In upper word
Character color in lower word
Reverse turned on ?
No
Exchange character and background colors

Save status
Calculate new position
Screen address
Cursor column
Cursor line
Calculate relative screen address

Number of bytes per character line

Address of the screen RAM

Compare with maximum cursor line

Plus number of bytes per character line

65

SB"

Atari ST Internals

Abacus Software

O
CM
rH

G
o

-rt
4J

CO
CO

-H

C
C
-H
rH

CO TJ
(H T3

-H

til

01
>-<

ca

P
co ca
R

-H

0)
P

ca

t-l

1-4

<g

CO

ca

4->

U
CO
CO

CO

p.

rH

ft

rH
Q

rH

03

CJ

CJ PS

rt

CM CJ

ft
^v

cu

PS

amvovocj
* in in in ^

#1,

#2,

6714
beq
610001DA
bsr
08F9000100002576
08F9000200002576
4E75
140
142
146
14E
156

(A"

$93
$9:
bset
bset
rts

Dl,
move.w

Al,
DO,

bsr

$9:

138 33C100002562
13E 44DF
move.w

rH
rH

move.l
move.w

rH
rH

12C 23C90000255A
132 33C000002560

< o

movem.l (A"

in vo

124 6100025A

128 4CDF0203

CM

11E 48E7C040
122 7200
moveq.l #0,

rH

movem.l DO-

H - C M C M C M H - V Q W C M C M
rH CJ r H r H O
Q CM Q Q C O ^ - C / > - i / > i n r H - C / > < / >
*. i1

a <B
TJ JH
fl xi

cncncnenencncncncnencncnen
o o o o o o o o o o o o o
o o o o o o o o o o o o o o o

en en
0 O

co
Q

VOVO

P- PIOLO

CM
Q
rH

CO

Q Q

en
U3-

S
X)

ca

i&
ig

ca

03
en

rH
O
O
en CO

CO
SP

rH
-5P
CO
^

0
0
0
0
rH
VO

< o W
m in m m
03

rH

rH

CM

CJ

CM
CO

CM

Q P- Q P"

$21

p-

CO

*o> en

#1,
move.w

CO

co ca ca 4-1

ca >H s-i

cd
CO

A CO

rH
Q

rH
O

W CM rH
p- *C Q

rH CM

rH

CO

$2!

CO O

162 E242
asr.w
164 36390000257C

CO
O

* Q

ei

si
2
CO

O
g

S
-g1 rH

Q ca

ca ca

o
o
o
CO

CM

CJ VO
O VO

vo vo
rH

rH

move.w

ca
ca
CO
^

178 3 4 7 9 0 0 0 0 2 5 7 E

4j
ca
-H
tji

ca
M
CO
4-1
co

q
01
0)
M
O

H
O

rH
Q

CM CM
Q Q

CO

OH

X) > ra
P o S
CO

CO

CO CM
i o
CO CM CM

rH
VO
P-

O CM
P- PrH rH

VO

0 0 o
O 0 0

o o o o o
o o o o o

m co in

rrH

rH
CJ
^

CM CM
O
<T
CM CO

en co ^
W
prH

O CM
CO CO
rH rH

en en en en en en en en en en en en en en en en
O

o o o
0 0

432

0 O
0 0

o o
o o

Abacus Software

t!
(0

Atari ST Internals

05
rH
0)

H
O
rH
O
O

HH
O

G
CD
<D
M
O
CO
1H

0)

fi

-rl
EH

n)
m

CM

m o

CM
Q

CO

Q r- m

Q
CM

m <o w o

in
rH

K rH

in

in
Q

in
Q

rH

in
Q

Q Q Q Q Q ft, Q

3 3 3

3
rH

m
Q
O

rH

=tt= Q

(U
G

3
W

3 3

Q.

<

t n a > S < D i H O J 3 : ( D O
o

rH O g S
n o g o x ) ^ ? < a s < a c ; o < d G

<a

rH
<H
rf! *C Cft rH Cft
-IO- (t, Ot

n rH o n in CM CM

=*> Q

O
O

PQ

13

to

(0 S

o o & is ,g +j
g

S 3

0!
<d

Cil
<Q

Q)
G

0
c^
m

w
T
m
CM
o
o

VQ

in
m
CM
O
O
O
O

0
CM
^i
CM

in

o
en
PM
sJ1

CM
0
0
0

o
CM
o

o
r~~ ^*

o cs cy* ^r

CO

CO
CM

^*

m a1

(Y}

h
fci

CM

CO
CM

m r< o
o > <>

C M O C O C M O C M C M O e O C M O K S C M C M r H n r H

COCOCOCOC\C^C^^Cf^<^^(^^(^^CQCQ

o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o

o o
o o

433

o o
o o

m
r~
w

in o o in o
CM

CO CM O

< O H O CM
Q Q

o uo

o o o

eft en cy*
o o o
o o o

cyi en cTi en cjv


o o o o o
o o o o o

0091D4
0091D6
0091D8
0091DC
0091DE
0091E2
E245
4040
3A01
32CO
51CDFFFC
D3CA
51CAFFF4
4E75

3A01
22CO
51CDFFFC
D3CA
51CAFFF4
4E75
asr.w
negx.w
move , w
move . w
dbra
add.l
dbra

move.w
move . 1
dbra
add.l
dbra

rts

rts

0091E4
0091E6
0091E8
0091EA
0091EC
0091FO
0091F2
0091F6

363900002550
B640
6A02
3003
363900002552
B641
6A02
3203
36390000257C
3AOO
08850000
C6C5
08000000
6702
5283

beq

D1,D5
DO, (Al)+
D5,$91D6
A2,A1
D2,$91D4

#1,05
DO
D1,D5
DO, (Al)+
D5,$91EA
A2,A1
D2,$91E8

move . w $2550,03
cmp.w
DO,D3
bpl
$9204
move . w D3,DO
move . w $2552,03
cmp.w
01,03
bpl
$9210
move . w 03, Dl
move . w $257C,D3
move . w DO,D5
bclr
#0,05
mulu.w D5,D3
btst
#0,00
$9226
addq . 1 #1,03

***************************************************
0091F8
0091FE
009200
009202
009204
00920A
00920C
00920E
009210
009216
009218
00921C
00921E
009222
009224

Calculate cursor position (DO/01)


Maximum cursor column
Column value smaller ?
Else use max value
Maximum cursor line
Line value smaller ?
Else use maximum value
Number of screen planes
Column to D5
Times maximum value

ste

en

W2
O

en
H

Atari ST Internals

acter line

raster line

Abacus Software

0>
<D

<s
.c
o

H
<U
P.
<D
01
4-1
>i

43

1-4

0
M
O

M
O

0]

0) a CO
<U G H 0)
XI -H o 4->
4-1 M o >i

0>
3 in H
H 0 O
<H

> CO
CO 4-1
0> CB CB
H CO
-H o 4-1
rH TS IH
13' O

M
O
<H

43

>H
o

4->
ID
CO

H
0)

43
>w S
>H 3

CO

CD 0) 01 CO CO
* g CO 3 3 3
3 -H a .-1 .-H rH
Z H PQ PJ CM PL,

r-i
i=C

CM

fj;

iH
Q

"3"
V>

LO
P

**

CO

CJ
CM
CM

cn cn

o
o
o
o
o
en
rCM
CM

CM

in
o
ro
P

CM ro
CM CM

co
O
co
P

in
rPd
-=r

vo oo M
CM

r- Q o vo
P - r- en
* in CM CM
rH rH cn cn

CM

CM

cn cn cn
o o o o o oo
o o o o o oo

m
CM
o
o
o
o
en

in LO
CM CM
oo
oo
oo
oo
en en

cj
in
CM
cn

rCM

LO

co c LO cn
r*- co p ^^ <C </>
CM CM
CO-

o-

co-

. . .

en en o
=*=

CO
P

CO

LO

(f * >

> < D Q ) C r ( U c J 1 C U Q ) ( l ) " 4 J


<D
Q
> > 4 3 > 4 3 > > > H c o t r o > < a > > T
O O 3 O 3 O O O C 0 4 - 1 C B O O H O O O '
g S c o g o i e e S i a 4 3 4 3 4 3 g 4 3 4 3 g

vo r- sp

in

o
o
o
o
cn
fa
CM
P

Q
>
O
g

H H W

LO

vo o
CM
CM

01
4-1

E S <a id m H

in
in
CM
o
o
o
o

*. s. >. ?. s. >. s. 1 1 H

<U

r* *O w *O
O TJ 13 T!

CJ VO LO

CM CM CM i-l CM tH SP
to- to *> * CO- =tt= P

CO CM
Q CO-

S S H
<-t <-\
0) 3
J> "H
O 3

vo r- ^ Q r- Q P
in in LO K in > *

in Q w rfj *C LO
in * *P . . LO
CM

to

CO

CM

VO

S.

J C U ' l d c T i d
3 H > O > H C O
O . Q > O 4 3 4 J
e i a : a i d t 3 M

CM

O
O
O
O

PL,
O
O
O

<
PL,
PL,
CL,

CJ
P
fr,
PL,

r- r- co

co co co
O

VO CJ

CM

CM

CM

C M C M C M C M C M C M C M C M C M C M C M C M C M C M e M e M C M C M C M C M

cn cn en
o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o

435

value
maximum value

th maximum value

X
10

rH

O
0 C1*

01

M
3
0

O
m
CM

CO
CM

cn

cn

< < Q =tt= Q

< <
CO co CM in
Q '-C
Q

{Q

Jj*

(d

> t3 T3 ^ T3 M 05
O ID t? & T3 l -p
(0 (0 t3 (0 'O j-i

CO
p4

<=T

CQ r< Q

cn

in

<=c
*-*

<C co CM in CM vo

QJ

CO
Q

rQ

CD
O

4-1
O

CM

cn

J^

o
o T>
S <a a

>

M to

o> o

c_> O -^ o

r-

<^
rH

<C
Q

CO (H
Q LO

H
<=P

31
CQ
CM

VO CO rfj &}
CO 00 QO CQ
CM CM CM CM

^J1
tO

(H
IO

O ^
CT) O*l
CM CM

<y* <r\\^ ^
o o o o o o o
o o o o o o o

^p

rH
VO
rH

CO

CO

O
VO
^J1

CO
(^
rH

*^

o
o

CM
rH
<

CM

*
*
*
*
*
K
*

<8
^Q

T3

2
O

<a o

01
j\

*g*
CM

a1

Q
O

cn pq m
sp O r~

pn,
fa

^
o

8t!1

co
[v.

CO rH "S31 rH H
Q in m m

p] 0 3
CO rij
cn en cn en en (^ rij
VO

cn

vo

|5

O
C^

o
m

VO
CO
Q

************

4-1

VO

f
fS;

CM CM CM CM CM CM CM CM CM

cn cn cn cn cn cn cn cn
o o 0 0 0 o o o
0 0 o o 0 0 o o

cn
o

436

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

g
0)

0)

_l

(0

CD

01
J

rH
rH

CD

tm

e
3
e
-H
X

<a

C*i

(D

M
<B

CD
01
3

rH

(U

<a

o
in
in

rH

ta

rH
O

Q Q

CM

q
g
3

0)

0)
G
O -H <D
O () 4S
rt

rH

H
O
01
H
P
O

01
(H

3
O

M
>
J

-H

^1
O HH
01 O
^1

3
0

(V
>

^1
0)
4-1
O
<0

0!

ta

a>

CM
O>

0)
C
-H

<d
01

0
Q

in
to

>

-H

3
0

(1)
3
rH

g 4J
-H
i

3
c
g

(3
>H

_~j

-H

d at old position?

Atari ST Internals

Abacus Software

cn CM
</> vt

CM

CM

CO CM CM CM

m o
in CM
Vt

0 CM
vo VO

cn
</>

in
CM

Vt

o
Q

rH
Q

o
0
o
vo
CM
o
t ^ rH
in
CO
CM
CM CM cn o cn
</>
</> =*=. vt
*

3=

Jj

a,

01
rH

U 43

0)

01
rH

g > id

U 43

rH

G.
g

o
m
m
m
m
CM
CM
o
o
o
o
o
o
o
0
en vo cn
r- 0 CO
o co o
co
m
_> CM ^i

CM

r^

CQ CQ

CM

CM

CM

CM

3 3 3

in
in
CM
CM
0
o
0
o
o
o
o
0
cn vo cn
E-CM

<

g g g

CM

m
m

cu

o CM VO
vo VO E
in in in
CM CM CM
o O o
o O o
0 0 o
0 0 0
0 rH cn

o CO o
co CM co

O
CO

rH

vo co co co a*

4-1
01
j1
Q

4-1
01 cr
i) w
J3
43
43

CM
O
O
0
0
rH
CO
0

tr
01

0
0
CM o
CO rH
r CO
vo 0

o
^
cvo

0 CM CO M a1 fg [V} O *?
O O O Q a Q [V] [V)
CM CM CM CM CM CM CM CM CM

m O

en cn cn cn cn cn cn
o o o o o o 0
o o o o o o o

cn en cn en cn cn
0
0

o o 0
o o o

0 o
0 0

3
O

rH

1-1

4-1
IB

Vi
CD
01 4-1
Ol
O
CD IB
Vl Vl
o IB

IB

G 4-1
CD Vl
CD 0)
O (^
CO M

0 0

o m

Vl

4-1
01

a
CD

J_)

VI

CD
[>
01 p;
VI -H
T5
IB
3
d! O 01
M .G
-H
O 4-1 4-1
01
IB VI
VI 1-4
CD
3 O J_| 4-1
0
d) O
01 4-1 IB
3" Ol O VI
CD <B IB
G Vl Vl A
a IB 0
CD a
4-1 IB 0 VI
0
IB
rH
G 4-1 1-1
3 d) Vl
O CD d) tjl
rH
<B
VI
IB O G rH
CJ w M Em
CD

-a

01

Vi
3
U

3
U

00

m
in

vo
pm

CM

CM

s s

cr >
CD

rQ

Vl
01

VI
CO

X)

fiC

CM
O
O
O
O

cn
CO

o
10

in
m
CM
o
o
o
o

rH
O
O
O

o H cn
rH
00
O

CD
>
O

Vl

f.

w
pi)

Em
O

CD

01

01

01

4-1
Vl

CO

CM

cn

rH

o
o
cn m

V
CN
(4
VO

[V]

o
f T|
CM

Em Em [V, O
CM CM CN CO

CM

V>

H Em Po CJ r^
(1 ro rH CO w
10 CM VO o ^p
03

d)

01

M
0}

CM

31

CD

P.
01

IB

P3

G
3
O
0

rd

01

*C

in

CM

CM

d)

g
3

ol
rfl

>

o
g

01

4J
Vl

CJ

CM
O
O

31

o
o

Em
O
Q O
CO rH

VD

CM
O

o
o
o
en m
O
ro w
CM

M CM

10

CJ

rH

rH

rH

ro ro ro CO
cn cn cn cn
o o o 0
0

0 0

CD
J>
0

*
*
*
*
*
*
*
*
*
*
*
*
* pq
* r~

*
m
CM
* o
* o
* 0
* 0
* cn
* r* ^i
* ro
*
* pq
* rH
* CO
* cn
* o
* o
*

437

*
d)
>
0

ra
to
CD

VI
O

VI

a
o

01

IB
Vl

4-1

d>
c
0

*
d)

_Q

3
01

CM

CM

fi

cr

CD

0
g

rH

VI
d)
4-1
01
10
VI

G
d)
d)
Vl
0
01
4-1

CD
53

CO

rH

&

di

-H

rH CM rH

rH

CD

^
CD

<B IB
Vi
VI
CD G 4-1 d)
4J CD
G
G CD
J> -H X
3
O O G O 0)
O CO M CM 13

sp

r-

3
01

^
0

rH
CD
>

~
.
.p
0
G

CN

ro
ro
cn

rH

in

CN

ro
ro
cn
Q

3
.

a
a

IB tf
Vl ^3

<0
Vl

01

"0
IB

4-1
Vl

*
*
*
*
*

o
o
o
o
o
o
o
o
cn ^ en vo
*3*
CO

CO
CJ

sp

ro

in ro in
< CJ CM
CM

CM

*
*
*
*
*
*
*
*
*
*
*

ro
sp
CM
ro
cn
o
o

^P CJ \o m
Q P- Q Q

E3
^P

CO
CO

VI
CD
4-1
01
IB

10
Q

CN

m
m

CM
0

PCM
CM

01

01

CD
* 4-1 -H
CD
G

rfj

o o
ro ro
en cn cn cn cn cn cn cn cn cn
o o o o 0 0 0 0 0 0
o o o o 0 0 0 0 o o
CM

in
m

ID
pm
CM
o
o
o
o

rH
t
VO

f^ pq
w W
CM

IB
Vl
10

Vl
0)

4-1

4->

VI

f^
in
in
CM
o
o
o
o
cn

0)

==

4-1

X)

0.

0)
G
CD
CD
VI
U

CD

Vl
T)

rH

d!

-H

rH

4-1
M

o
CM

CD -H
-H

G
3 CD
O CD
rH
VI
IB U
CJ Cfl

ts

rH

CM

di
G

IB

CD
4J
10

==

01
d)

01

Vi 1-1
(!) O

rH

Vl
CD

Oi

CD
d) d)
VI 4J
0 G
01 3
O
M-l
O
0
IB
VI VI

CD
G

incn

01
01

d>

*1

CM
=*=

* * * * * * ** * * * * * * * * * * *

0]

Vl
O

f the character
line of the character
raster line

Vl
0

0
01
01

at cursor position

Vi
3
0

Q,

***********

01

rsor position
f the cursor position

VI
O

Atari ST Internals

sition

sition

Abacus Software

CO

co ro ro
cn cn cn
o o o
o o o

f^C

(Vj

^
1
O
03*

cn
^p
CO
CN

31
rH
^0

Cti
Em
fo
Em
Q cn
S3i
O
CJ

CO

rH

Q!

rH

*
in
Pw

Q m m m a1
31 VD CO
o o CN ^o
f^
CO CO CO ro ro SP
3*
ro CO CO ro ro ro ro ro
cn cn cn cn cn cn cn cn
0 o o o o o o o
o 0 o o o o 0 0
CO

SP

*
*
*
*
*
*
*
-ft
*
.

*
*
*

rH
Q

Q)
-H

ca
a o
ca a>
a> $-1
(D
G
3 o ft
O 01
01
o

rH

3
rH

O
O

Q)

G
0)
0)
M
O

O
CO
M
3
O

01
C
-H

c
CD
CD

CO

O
0)

rH
rH

1H

cd 01

rH

fc.

r4

3
S3

fl)

SH

co

in

0 CM CM

in VQ
in CO

*.

w
m
CO

en CO en CO
to- =tt= t/> Q

co
Q

0 0
Q Q

rH
==

rH
=tfc

i-H
J5

3
ft

co

************

KJ

CM

O"i

0)

4-1
01
4-1

a>
c

0 43 43 43

CO

^ 4-1
O M

CO
O 4-1
g

O CO co rH
f- Q Q

rH

CO

[5

CM

IK

rH

rH

co co
Q

U
3
3
3 3

4-1
CO
4J

IT 1
eu o rH
^
cd 43 43 cd 0

k.
rH

CO- =8= Q

|5

tf

rH

O
=H=

o
rco
en

CO
4J

rH

0!

cd

a
S
3 o
CO

ca

rH
0

CO
4-1
M

vo
r~

m
CM
O
O
O
O
CO

o
in
m
CM
0
0

o
o
en

r^

CM

o
o
o
en ^*

rH
VO

CO
CO

o
o

CO

in

o *rp (
vo CM W
O
CQ to o VQ *rp *3*
CO w o CO rij O
r~

m
CO
en en en
o 0 o
0 0 o
<p
CO

CD

CD
4-1

4-1
Q

1-4

O
CO

rP

CO

rH

O E
VQ W

^p

in

0
VO
CO

CM

in

en en en
o o o
o 0 o

en en
o 0
o o

CO

CO

CM

in m m
CO

o
o
o o vo en
^i o 0 "S31

CO

vo
co
en
o
o

03
O

r^
VO

CO
^p
CM CM

m
3" 03 (^ O
VO VO vo VO
CO CO co CO
en en en en
0 0 o 0
o o o o

m
r^
W
W
vo
co
en
0
0

m
CM
o
o
o
o
en co
co rP
^D co
co W
o vo
r- rco co
en en
0 o

0 0

438

CO
<?
CO

m
03

rco

CO

co in
"S31 r-

CM CM P^-]
Q C1 SP

f O E*3
p~ r f
co co CO

en en en en
0 0 o
o 0 0

o
o

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

line
CO

di

G
-H
rH

4-1

o m
CO
CO
0!

S
T)

o
j_i

racter

racter line

Atari ST Internals

Abacus Software

0)
G
-H

ca
o

rH

O
^4
0)
g

3
G

OJ

in

Q)
G
-H

rH

01
01

J_l

4-1

>, <U
o
>-,
rH
ft
4-1

-o
a

ia

CO
QJ -H T3
4-1 rH
rH
<U
3 3 -H
53 S

W
G
-H
rH

H
Q)
Q,

en
0)

o -P
CO

rl

3
O MH
O

4-1

c
0>

S-l
3
U

g
3

r4
01

-H

*a

"I

rH
Q

CO

3
53

CO

<
CO

PJ in

m
CM
^ t/>
to^p

rH

>
o

^r
o
o
o
o
o
en
c
vo

co

CO
Q

Q co
K

rH

a>

<

Q 0

3
rH

3
g

rH
Q

cd
0)

rH

(U

o
o
o

CM CO

rH

CJ
VO
0

CO
CO

rH

f-r.

S31

r-

SP

a
o o
cd g

CM

0
0

en
co
vo

in m
m in
CM CM
to-

3 3

rp

m
in
CM
o
o

CM

3 3

g g

"3

co
Q

^p

m in
m m
CM CM
O o
O o
0 o
0 o
en en
c- CO
CM vo
Q CO

0 vo O p] CM <=P
CO CO CO CO en en
co co co co CO co

PJJ

en
co
en en en en en en en
o o o o o o o
o 0 o o o o o

U)
^

0093AO
0093A4
0093A6
0093A8
0093AA
0093AC
0093BO
0093B6
0093B8

45F33000
C6C1
E443
6002
26DA
51CBFFFC
323900002552
3401
4841

0093BA 4842
0093BC 4241
0093BE 343900002550
0093C4 6000FD92

lea
mulu .w
asr .w
bra
move . 1
dbra
move . w
move , w
swap
swap
clr.w
move . w
bra
0(A3,D3.w),A2

D1,D3
#2,D3
$93AC
(A2)+, (A3)+
D3,$93AA
$2552,01
D1,D2
01
D2
Dl
$2550,02
$9158

***************************************************
0093C8 26790000044E
move . 1 $44E,A3
move , w $2552,03
0093CE 363900002552
mulu.w $2554,03
0093D4 C6F900002554
(A3,D3.w) ,A3
lea
0093DA 47F33000
0093DE 363900002554
move . w $2554,03
(A3,D3.w) ,A2
lea
0093E4 45F33000
move . w 01,00
0093E8 3001
DO
neg.w
0093EA 4440
add.w
$2552,00
0093EC D07900002552
mulu.w DO, 03
0093F2 C6CO
asr.w
#2,D3
0093F4 E443
$93FA
0093F6 6002
bra
move . 1 -<A3),-(A2)
0093F8 2523
D3,$93F8
dbra
0093FA 51CBFFFC
$93B6
0093FE 60B6
bra

Yields address of line 1


Number of bytes to move
Number of long words
Copy screen lines
Maximum cursor line

Maximum cursor column

Scroll screen at line Dl up


Address of the screen RAM
Maximum cursor line
Mult by number of bytes per character line
Yields address of last character line
Number of bytes per line
Yields address of line 1
Current line
Add maximum cursor line

Divide by 4 for long word transfer


Copy screen lines

>

2.
en
H

rt

Atari ST Internals

> PJ

<

width in bits
by maximum character width

0>
fi

CD

Ol

iH

_l

4-1

MH

maximum cursor line

01
W 4-1 0)
G
H -H T3
Q O T3

0 1
H CU
Q) *c3

03 T!

03

G CD

rH

per screen line


height of character
bytes per character line

to a)

G
CD
CO

0)

0)

03
CD

en

CD
.G
4-1
0
CO

a) 4-1
G

rH

-H

a)

CD
4J 4J
O3 G
<fl O
t, *M
4-1

>1

maximum cursor column

C 102, initialize font parameters


r to INTIN array
s of the font header
ight, height of a character

Abacus Software

rH

03
'C
rH

CO t3
0)

'I
S "H pG CD

g CD
-H -H
CQ EH >H

-rH

01

01
P

o
rH

4-1
G 4-1
O G 4-1
<*H O
MH 0
MH
CU
,G G
4-1 -H G
-H
M CU
0 T! Q)
O C
fi O O
O
SM
-H M M
3 O M
to O
- < CO
<
4-1 4J
4-1
-H 0) 01
IS rH
(U

a 01
g

rH

M * G 0) in <d
O -H -H -H 0 g
CO D S >H HH CO

P -H -H -H

& Q S >i

CD
rH

iQ
<fl <8
4-1 4J
<0
T3 4-1
CD
4J 03
O 4-1
IH O
O O
4-1 4-1
M rH
CU CU
4-1 4-1

en G G
>H -H -H
(0 O O

rJ

CH CM

10 CM
CJ
IQ
LO LO LO LO LO
CM CM CM CM CM
H
vo

o
Q

rf! *" LO
CM

^
o
* 00 ^
f. * * * * * A

*
*
*
*
*
*

LO
CM

CM
CO

rH
i-H

3"
LO
LO
CM rH 03
Q Vt Q
Q Q

LO
O CM 0 rH O CM
Q </> Q Q

CM
LO

LO

LO

CM rH

LO

O rH CM 0 0 O 0 0

O rH

!
O CM CM

=tt=

Q =B= </> LO

rH rH
Q CO CO

rH

rH

CU

01
>

O
g

o
g

0)
>
O
g

S 3

0)

P
g

0 O
g g

rH

> g

g a

P
01

O -H

>O
g

CU

>

O -H
T3

g g

rH rH

Sp O

>

01

-X
}(

K
fc
*
*

3*
00
LO

H
^r

w
r^

LO

LO

CM CM
O o
LO O
O o

CM
O
O
O

CM

o
o

en en en o>
o o o o
00 0o
^

o
o

CO

r~
LO

CM
O

CM
LO
LO
CM
O
O
0
O

CU

o o

0)

> 01
O 0 O 4-1
g H

w
o fjj
vo vo 10

10 CM
vo r-

LO

LO
CM
0
O
O
O
O

LO

LO

CM CM CM
0 000
o O
LO
r
LO
LO o o 0
o 0
CM
CM
O ^p
<=T VO
O
O ro
O LO CM CM
O 0
0
00
o o
o
O 0
en CO rH rH CO CO CO
0

o
o
o
o
o
^31 CJ pq Ed
co ro CO ro
LO ro ro ro

o
o
O rH O en o rH rH o
co U ^P CJ o ro Ed
oO o
CM
CM CM CM ro ro CM CM CM
O ro f^ co CO LO ro r^ ro CO
CM CO <C O CM CO <C O CM ^p r3* w o XD
rH rH rH CM CM CM CM CM ro ro ro ro ^r 3*
5* 5P ^i ^31 ^*
5T
31 SP *3*
^
cn ^en1 ^
en en en en en en ^en* en ^
en en en en
o 0o o 0o 00 00o 0o o
0o o o o o o o o o 0o 0o

o o o
en 0 CO o en
[^ LO CM o ro
o 0 O CO CM
CM CM ro CO CO
O VD CO CJ
O 0o o
^i
31 ^1

^J*
LO
LO
CM
O

CU

g g g g g

*
*
*
*

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

CO IQ CM

ro

440

LO

CM
0
0
0

00
^3*
O 0
o O
00 CO LO

Ed Pd Ed
CO ro n
CO CM CM

r~
M

Ed ^O H IO
sp LO LO U)
^i ql *sP ^i

Ed
vo
qi

<n en n en en
o o 0o o
0 0

Abacus Software

Atari ST Internals

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
X
*
-
*
*
*
*
*

CD

4J

HH
-H
01
01

rH

0
01
M CO

(d
w

CO co

=*>

CO
Q
vo

fa

75A

CM

o fa

T3

(d

g
o

CD

Xi

g
O
g

0)

o
<D

H-

g
O

4J

o
01
01

CD

HH
0

rH

<

CD
N
-H
m H
01 Id
CD -H
4->
-H

CM
=8=

CM

fa
vo
fa

vo
o
en
CO
rH

CO
O

en

w
01

X!

io

TJ
-rl

O
H
O
O

o
o
o
id

CD

fi

CD

rH

-H

rl
O
01
rl

SH
0
01

fi

O
O

CQ CJ

HH
O

rH

01
01
CD

8
o

vo O CM
in vo vo m o
in m m m

0 CM
Q

=tt= =s=

CM

CM

CM

0 o 0 o
Q Q Q Q

4J

CD

id
rH

O
01
rl
0

4J
CD

co

vo
rm
CM

01

<a

a
rl

01

id

H
HH

HH

CD

er>

id

a>
u
01

rH

rH

HH

CD
W

M
0 id
0 CD
0 H
CO CJ

0]
rl

VO

in
CM

63

rH

CM
CM
CM

a
fa
fa

H-

CO

fa

J1

rH

rH
=tt=

XI

O
rl

id
a
0
"M

in

CD

CD

, DO

CJ Q

4->

r-

0
CO
CD

CO

conout vector to standard

X!

rH

3AEE,$4A8

-H

rH

CO
X
CO

id
4-!

o
co

LE,$2565 Cursor flash counter to 30

05

C
O

vo

As screen address of the cursor

0
-H
+J

01

CD
4J
-H
ft

, $255A

!H

CO

Character color to black

c; <d
CD

01

PFFF,$2558

rl

*
* o

*
*
*
*
-K
*

rH

CD

Replace with 2 (high resolution)

01

CD
4J
01

CD
+J

High resolution ?

, DO

if*************
******>

Initialze screen output

0
-H

Set parameters for scren resolution

4J

C
O
HH

O
Q Q

rH

-H

<d
CD
rH

a
s
o

CD

C!

id
CD
rH

01

X)

g
o
g

fO
g

g
0

g
O

S S

gO
g

g
O
g

g
o

rH
g

s g

X) X! X)

go

g g

rH

rH

CD

id

0 O O 0 O o O
g g S g e a s

01
4J

CO

<c

^p

CO

o
^p

o
o
o
o
o
en
co
o
rH
^P

CJ
VQ
fa
O
0

VO

o
a\O

w
^
co CO
o 0
o o
o o
CJ CJ
F
O 0

U
f

m
ta

CM
O
O
O
^1 0 O

o
vo 0
vo co
CM

[V]

ro
o
o
o o

fa

CO

S31 CO

r
rH

rH

VO
rtj

o o
fa en 0 VO
rH fa r- o
0 rH o vo
co ^P ffl vo
pJ O vo ft.

CJ CJ Q Q Q Q Q
VQ VQ VD VQ VD vo vo
fa
fa fa fa fa fa
O
0

fa

o o
o 0

CM
O O
o O

w w w

rH ^31
O rH
O Q

o on
en o
fa o
rH
ql

vo o CM
in vo VO
in m m
CM CM CM
0 o o
0 o o
o o o
o o o
o o o

fa

fa
fa

o O
fa o o o o o

co o
VO co rCM vo W
fa
fa fa
VO vo vo
fa fa fa
o o o
rH

Pj

in
in
CM
o
o
0
o
o

CO

co n ro
CO

CO

vo O
o 0
t e
fa fa
o o

vo
e
in
CM
o
w
^ o
m
m o
o CM o
o o rH
o 0 O
o o 0
o o o
en CO CJ
r- CJ fa
o

"W

m
CM
o
o
o
o

vo
m

o o

CO

CM CM

rH

sP

rH

[V] qi
rH CM
t rfa
fa
fa
fa
O
O o O o
0 0 0 0 0 0 0 0 0 0 o

O
W

vo vo vo vo
fa fa fa fa
o o o o o o

O O
0 0 0 0 0 0

in
m
CM
o
o
o
o

o
o
o
o
o

0
0
r-.

441

CM

CO

rH
f-*

rH

fa

VO

fx]

CM
CM
^P
CM CM
O O
o O
o O
rH

tH O
O 0 0
O 0 o
rH

[V]
(CJJ

fa
CO
fa
rH

o
fa
fa
fa

o
o
o
o

o o o O
fa fa fa co

en

o
fa

in

co

o
CM

CJ
rH CO
in CM

63
qi

*)

CO

co n

CO
rH CO

CM

^p

<T
CM co
t rfa
fa
O 0
0 o

CO

co ql ^
r- r- r^
fa fa fa
o o 0
o 0 o

^
3* sp
r~ [

m
rfa fa fa
o o 0
o o o

OOF75A
OOF75C
OOF760
OOF766
OOF76A
OOF770
OOF776
OOF778
OOF77C
OOF782
OOF786
OOF78C

7200
123B0030
33C10000257C
123B0029
33C10000257E
33C10000257A
E340
323B001A
33C100002578
323B0016
33C100002570
4E75

moveq.l
move . b
move . w
move . b
move . w
move . w
asl.w
move . w
move . w
move . w
move . w
rts
#0,D1
$F78E(PC,DO.w),Dl
D1,$257C
$F791(PC,DO.w) ,D1
D1,$257E
D1,$257A
fl,DO
$F794(PC,DO,w),Dl
Dl,$2578
$F79A(PC,DO,w),Dl
Dl,$2570

OOF791 AOA050

OOF78E 040201

dc.w
dc.w

dc.b

dc.b

200,200,400
320,640,640

160,160,80

4,2,1

*************************************************

OOF794 OOC800C80190
OOF79A 014002800280

screen height
save
screen height
save

Initialize screen output


DO contains screen resolution
Get number of screen planes
And save
Get bytes per screen line
And save

Get
And
Get
And

Screen parameters
Number of screen planes
Bytes per screen line
Screen heights
Screen widths

Note: This BIOS listing contains some of the most important sections of TOS Version
1. Later versions of TOS may have some minor differences, but this listing should still
prove valuable.

Chapter Four
Appendix

4.1
4.2

The System Fonts


Alphabetical listing of GEMDOS functions

Abacus Software

4.1

Atari ST Internals

The System Fonts

The operating system contains three system fonts for character output.
The 6X6 font is used by the Icons, the 8X8 font is the standard font for
output on the color monitor, and the 8X16 font is used for the monochrome
monitor output. The chart on the next page includes the characters with the
ASCII codes 1 to 255.

445

Abacus Software

Atari ST Internals

6X6 System Font


0.
O

"1
>

Ul

2
Z
J
X

ft
*
X

Ul

<
<9

~J
M

!3
;o

:0

P
f.

I
Cl

N
U

*
B

f
A
n
V

<

III

_l

^
:D

e>

^
-5
*-i
X
13
U.
LJ
O
U
CO

<o
m

0.

c
ei
f-

:o
:3i
o
<3
0

:o
<o
$
u

.0
:a
**

:
*
:i

s
<
%
>
r
p
r

ID

-1

'1

ru

-'
'.3

n
q

(9
V

U
C

9
r

CM
H
O
X,

f
n

<"

0)
P-

*^
U

^
R

Jrt

G*

l
"Of

to
in
M
*

R.
a

1
i

A
II
V

03
N

:<i
'

.H
<

id
V
4

-n
:<g
<<i
0
:3

Oi

o
/

N
31

2
P

+*

*
%

X
3

1~

*
w

N
31
X

<*

>

rr

r-

n
n

<o

t
(J

X
s>

n
(<

t
-.

51

-1

"

<>

t
o

C
uf
O

fll
ni

u
x>

sj

fl

SO

ff>
CO

2
ifl

o n
- . 1 * 1
=5

<

rf

"

>

<
0
S

+
t
->

N
>
X
2
>
3
1W
Of

r
t.
.->
01
41
12
1C
--3
-0

it
!
-,
<VI
M

f
VI

2)
*i

:
to
M

m
ru
0
~*
=^

S-

s
*
?

a
o.
o
e
r*
J
^

efghi

IT
a
pja
m

a. ^<D III

. ^~
*-"
O .
^^
3E CO. U>

u
u

.a
A
/
1
<

n
/

"i :=J Ci

c
a
id
ttt
M

HHI
2C
CO
Ll
UJ

N
>
X

ca :o IN

PH
ca
S

cc

IP
f_

f ca

<a HJJ a
C" oec 8
/S XE <

f
*

II
V

r
P

/^ *O>
<i S-

JrHI

^^

~~

/Gl

^3

cr :eu r
CO
P*

rC

UQ
in
*^^
M

r
ft
71

n
a

CM
^^Hl
C3
w
^s
-

D
n
C

<GJ
CJ> C^|

*rn
/*o
z*o
<<a

^GJ
IZ3
O
rf*i
%!
2

53
r
^^
01

CT
^l
D
^^
^
S3

f*^ JX

^. '"* n
+ Sr^ r

a
P
r

j~i

zn cz

e*J
X
<U>

I> HZ
3 1"*
^^ f^;

3fC

*-*

n
X
P
:?

E3

a w n

C 7C
cr PD
.
Q P*
a C
IHJ
fe,
c o
C -I o-

'*

0"

UW

J^J

f-

ro ) \

OO

,-_a

JC JO

'(0
i

C" en tec
to GJ fcj
y -a ^B
rr> u to.

na
to
it

" ia jo
C3 / jro
-^ 1 A 1
i

'"

UQ H- /CC

y
1
s

f\J

r V
^
u
o
Oi
()
m -itZ
-3
tc -

3
0

v|
A|

+1

1S^

-v <
W

Ir^TI
^

!.

446

IO CD
ZZ3) KDl
>*
li.
O

/3
O
/O

C-3 <O
03 *M

LJ

z: SH -e-

> ' ' *{~\.


~-ti ^-H
*^
2tf O K3

tQ

RSTUUW

x
x,

a
o
c

8X1 6 System Font

o ih c
r u
z >

i :n
o
<a
r
u.
a
4
u
x>
u
m

8X8 System Font

-S
*4
0
*>

-JB

-^

"^
\*

ftl

_,

r^T

" S* ",
INJ r
> i.
>e & o

S3 3C
K 3-

OI U
<PI -1-

iv< =j >z 3
V = <=
A 1X1 *3 VI

O cz: ^o /M
^H

C3 *^

4"!

Abacus Software

Atari ST Internals

4.2 Alphabetical listing of GEMDOS functions


Name
Cauxin
Cauxis
Cauxos
Cauxout
Cconin
Cconis
Cconos
Cconout
Cconrs
Cconws
Cnecin
Cprnos
Cprnout
Crawcin
Crawio
Dcreate
Ddelete
Dfiee
Dgetdrv
Dgetpath
Dsetdrv
Dsetpath
Fattrib
Fclose
Fcreate
Fdatime
Fdelete
Fdup
Fforce
Fgetdta
Fopen
Fread
Frename
Fseek
Fsetdta
Fsfirst
Fsnext
Fwrite

Opcode (hex)

Page Number

03
12
13
04
01
OB
10
02
OA
09
08
11
05
07
06
39
3A
36
19
47
OE
3B
43
3E
3C
57
41
45
46
2F
3D
3F
56
42
1A
4E
4F
40

106
111
111
106
105
110
111
106
109
109
108
HI
107
108
107
117
118
116
111
128
110
119
126
122
120
137
124
128
128
115
121
123
136
125
112
134
136
124
447

Abacus Software

Malloc
Mfree
Mshrink
Pexec
Rerm
PtennO
Ptermres
Super
Sversion
Tgetdate
Tgettime
Tsetdate
Tsettime

Atari ST Internals

48
49
4A
4B
4C
00
31
20
30
2A
2C
2B
2D

129
130
131
132
133
105
115
112
115
113
114
114
115

448

Index

Abacus Software

Atari ST Internals

ACIA 6850~see Asynchronous Communications Interface Adapter


address bus, 7, 8
asynchronous bus control, 8-9
ADDRESS STROBE(AS), 8
DTACK, 9,10,12
LOWER DATA STROBE(LDS), 8
READ/WRTTECR/W), 8
UPPER DATA STROBE(UDS), 8
Asynchronous Communications Interface Adapter(ACIA), 41-47, 62-63
pins, 41-44
registers, 45-47
control register, 45-46
status registers, 46-47
BANK, 55
Basic Input Output System(BIOS), 140-154,242,246,247
listing, 268-442
BCDsee Binary Coded Decimal
BERR, 11,12,15
BG~see Bus Grant
BGACK~see Bus Grant Acknowledge
BGO~see Bus Grant Out
Binary Coded Decimal (BCD), 4
BIOSsee Basic Input Output System
BLANK, 15
BRsee Bus Request
Bus Grant(BG), 10, 13
Bus Grant Acknowledge(BGACK), 10,13
Bus Grant Out(BGO), 13
Bus Request(BR), 10,13
cartridge slot, 96
Centronics interface, 88-89
CLK, 11
data bus, 7
data registers, 4
DataRequestpR), 22
DE~see Display Enable
Digital Research, 103
Direct Memory Access(DMA), 8-9,12-13,18-19, 25,58-59,99-100
Display Enable(DE), 15

451

Abacus Software

Atari ST Internals

DMA-see Direct Memory Access


DR~see Data Request
exception vectors, 234-236
FDC~see Floppy Disk Controller
Floppy Disk Controller(FDC), 20-27
Command Register(CR), 24
Data Register(DR), 24
Sector Register(SR), 24
Status Register(STR), 24
Track Register(TR), 24
floppy disk interface, 97-98
GEM graphics, 206-233
high-res, 209-212
Hne-A opcodes, 229-233
line-A variables, 226-228
lo-res, 208-209
medium-res, 209-210
GEM graphics - commands, 213-233
BITBLT, 218
COPY RASTER FORM, 225-226
DRAW SPRITE, 224-225
FILLED POLYGON, 217
FILLED RECTANGLE, 216
GET PIXEL, 213
HIDE CURSOR, 223
HORIZONTAL LINE, 215
Initialize, 213
LINE, 214
PUT PIXEL, 213
SHOW MOUSE, 223
TEXTBLT, 218-222
TRANSFORM MOUSE, 223-224
UNDRAW SPRITE, 224
GEMDOS, 103-139, 242
functions, 104-138
error messages, 139
GLUE, 13-15, 18, 69
HALT, 11, 12
HSYNC, 15

452

Abacus Software

Atari ST Internals

IACK, 13
integrated circuits, 3-63
INTEL, 3
interrupts, 7, 10, 236-241
I/O registers, 55-63
ACIAs, 62
DMA/Disk Controller, 58-59
keyboard, 62
MFP 68901, 60-61
MIDI, 62, 240
sound chip, 59-60
Video Display Register, 56-58
keyboard control, 67-71, 74-84
longword, 7
Memory Management Umt(MMU), 11,13, 15-16, 18, 55
memory maps, 62-63
MFP 68901~see Multi-Function Peripheral
MFPINT, 13
MIDI see Musicial Instrument Digital Interface
MMU~see Memory Management Unit
Motorola 68000 microprocessor, 3-12, 255-267
registers, 4-6
exceptions, 7
connections, 7-12
instruction set, 255-267
mouse, 71-74
MS-DOS, 104, 180
Multi-Function Peripheral(MFP 68901), 28-40, 60-61, 90,171, 239, 241
Active Edge Register(AER), 32
connections, 28-32
Data Direction Register(DDR), 32
General Purpose I/O Interrupt Port(GPIP), 32
Interrupt Enable Register(lERA,IERB), 33
Interrupt In-Service Register(ISRA,ISRB), 34
Interrupt Mask Register(IMRA,IMRB), 34
Interrupt Pending Register(IPRA,IPRB), 33-34
Receiver Status Register(RSR), 38-39
registers, 32-40
Synchronous Character Register(SCR), 37

453

Abacus Software

Atari ST Internals

Timer A/B Control Register(TACR,TBCR), 35


Timers C and D Control Register(TCDCR), 36
Timer Data Registers (TADR,TBDR,TCDR,TDDR), 37
Transmitter Status Register(TSR), 39-40
UCR/USART, 37-38
UDR/USART, 40
Vector Register(VR), 34
Musical Instruement Digital Interface(MIDI), 93-95,170
NMI-see non-maskable interrupt
non-maskable interrupt (NMI), 6, 13, 237
operating system, 103
PSG (Programmable Sound Generator)~see YM-2149 Sound Generator
RESET, 11, 12
RS-232 interface, 90-92, 240-241
SHIFTER, 13, 15, 17, 18
status register, 6
supervisor mode, 4, 6, 7, 234
synchronous bus control, 9
E,9
Valid Memory Address(VMA), 9
Valid Peripheral Address(VPA), 9, 10
system fonts, 443-446
system variables, 247-254
Tramiel Operating System(TOS),103
UNIX,104
user byte ,4
user mode ,4, 6, 7, 234
video interface, 85-87
VSYNC, 15
VT52 emulator, 242-246
WD 1772, 20-27
word, 7
word access, 8
454

Abacus Software

Atari ST Internals

XBIOS, 155-205
YM-2149 Sound Generator, 48-54
attack/decay/sustain/release(ADSR), 48
digital/analog(D/A) converter, 48
registers, 52-54

455

Optional Diskette

For your convenience, the program listings contained in this book are
available on an SF354 formatted floppy disk. You should order the diskette
if you want to use the programs, but don't want to type them in from the
listings in the book.
All programs on the diskette have been fully tested. You can change the
programs for your particular needs. The diskette is available for $14.95 plus
$2.00 ($5.00 foreign) for postage and handling.
When ordering, please give your name and shipping address. Enclose a
check, money order or credit card information. Mail your order to:
Abacus Software
P.O. Box 7219
Grand Rapids, MI 49510
Or for fast service, call 616/241-5510.

FESSIONAL
DUCTIVITY
New ST software from a name you can count on...
PCBpard
Designer

FilePro
The electronic
filing system
for the ST

Create printed circuit board layouts

Features: Auto-routing, component


list, pinout list, net list

Word processor for the ST

PCBoard Designer
Interactive, computer-aided design
package that automates layout of
printed circuit boards. Auto-routing
with 45* or 90" traces; two-sided
boards; pin-to-pin, pin-to-BUS or 8USto-BUS. Rubberbanding of components
during placement. Prints board layout,
pinout, component list, net list. Output
to Epson printer at 2:1. Pays for itself
after first designed board.
$395.00

ST TextPro
Wordprocessor with professional
features and easy-to-use! Full-screen
editing with mouse or keyboard
shortcuts. High speed input, scrolling
and editing; sideways printing;
multi-column output; flexible printer
installation; automatic index and table
of contents; up to 180 chars/line; 30
definable function keys; metafile
output; much more.
$49.95

ST FilePro
A simple-to-use and versatile database
manager. Features help screens;
lightning-fast operation; tailorable
display using multiple fonts;
user-definable edit masks; capacity up
to 64,000 records. Supports multiple
files. RAM-disk support for 1040ST.
Complete search, sort and file
subsetting. Interfaces to TextPro. Easy
printer control.
$49.95

AssemPro
Combine graphics
with your text

STForih/MT
Powerful, multi-tasking Forth for
the ST. A complete, 32-bit implementation based on Forth-83
standard. Development aids: full
screen editor, monitor, macro
assembler. 1500+ word library.
TOS/LINEA commands. Boating
point and complex arithmetic.
Available Sept. '86.
$49.95

STPalniPro
A GEM among ST drawing
programs. Very friendly, but very
powerful. A must for everyone's
artistic or graphics needs. Use
up to three windows. Free-form
sketching: lines, circles, ellipses,
boxes, text, fill, copy, move,
zoom, spray, paint, erase, undo,
help.
$49.95

ST Text Designer
An ideal package for page layout
on the ST. Accepts prepared text
files from TextPro or other ASCII
wordprocessors. Performs block
operations copy, move, columns. Merges bit-mapped
graphics. Tools to add borders &
separator lines, more. Available
September -86.
$49.95

The complete 68000


assembler development
package for the ST

ST AssemPro
Professional developer's package includes editor, two-pass
interactive assembler with error
locator, online help including
instruction address mode and
GEM parameter information,
monitor-debugger, disassembler
and 68020 simulator, more.
Available Sept. '86.
$59.95
ST and 1040ST are trademarks of Atari Corp.

IZZXZ9, T TT TTII

^f^

GEM is a trademark of Digital Research Inc.

Abacus
Software
P.O. Box 7219 Dept.M9 Grand Rapids, Ml 49510 - Telex 709-101 Phone (616) 241-5510
Call now for the name of your nearest dealer. Or order directly from ABACUS with your MasterCard, VISA, or Amex card. Add
$4.00 per order for postage and handling. Foreign add $10.00 per hem. Other software and books corning soon. Call or
write for your free catalog. Dealer inquiries welcome-over 1400 dealers nationwide.

AssemPro
The complete 68000
assembler development
package for the ST

AssemPro is the professional developer's


package for programming in 68000 assembly
language on the ST. The package includes:
editor, two-pass interactive assembler with error
locator, online help including instruction address
mode and GEM parameter information,
monitor-debugger, disassembler and 68020
simulator.
$59.95

FilePro
The electronic
filing system
theST

FilePro is a simple to use but flexible data


manager. The drop-down menus allow you to
quickly define your file and enter your information
through screen templates. FilePro has many
unique features: store data items in different type
styles; create subsets of a file; change file
definition and format; includes and supports a
RAM disk for high speed operation. FilePro also
has a fast search and sort capabilities, can
handle records up to 64,000 characters in length,
allows numerical values with up to 15 significant
digits, accesses up to 4 files simutaneously,
indexes up to 20 different fields per file and has
complete, built-in reporting capabilities.
$49.95

Word processor for the ST

TextPro is a professional quality wordprocessor.


In addition to the standard options found in most
other word processors, TextPro features
multi-column output automatic indexing and table
of contents, sideways printing (to Epson printers),
up to 30 user definable function keys, mode for
editing C language source programs and flexible
printer driver installation. It is designed with fast
entry of text in mind. The advanced TextPro user
can substitute shortcut keyboard commands for
the drop-down menu commands.
$49.95

With Text Designer you


are now able to combine
text with graphics on your
screen. Add artwork to
your page layouts. Liven
up your pages with
pictures to add that

\
Designer/
Combine graphics
with your text

rtt

Li\r pages
witn\/ires to add that
personal flair.

TextDesigner is an ideal package for page layout


on the ST allowing you to interlace graphics with
text. TextDesigner reduces the steps and time
involved in preparing professional documents
and newsletters. Use the tools provided for
borders, lines, text, etc. or cut and paste from
PaintPro, Doodle, Degas, TextPro and other
ASCII word processors. TextDesigner is a simple
to use and versatile package which will give you
the professional results you deserve at a
reasonable cost.
$49.95

PaintPro
PaintPro
PaintPro

VAV
For creative illustrations on the ST

Multiple
windows

PaintPro is a friendly, yet powerful design and


painting package for drawing graphic and artistic
pictures. This GEM-based package supports up to
three active windows and has a complete toolkit
of functions: free-form sketching, lines, circles,
ellipses, boxes, fill, copy, move, spray, zoom,
undo, help and extensive text capabilities. You
can also import "foreign" pictures for
enhancement using Paintpro's double-sized
picture format and send hardcopy to most popular
dot-matrix printers. PaintPro works with either
monochrome or color systems.
$49.95

L,.

Multi-Tasking
Full-Featured

Forth/MT, the multi-tasking, full-featured Forth


language for the ST, is for serious programmers.
Forth/MT is a complete, 32-bit implementation
based on Forth '83 standard. Includes many
development aids: full screen editor, monitor,
macro assembler, over 1500 word library.
Includes TOS, LINEA, floating-point and complex
arithmetic commands.
$49.95

shGlf books
from Abacus
PRESENTING THE ST
Gives you an in-depth look at
this sensational new
computer. Discusses the
architecture of the ST. workIng with GEM, the mouse,
operating system, all the
various interfaces, the 68000
chip and Its Instructions.
LOGO.
2QQpp $16.95

ST GRAPHICS A SOUND
Detailed guide to graphics
and sound on the ST. 2D &
3D function plotters, Molr6
patterns, graphic memory
and various resolutions,
fractals, recursion, waveform
generation. Examples written
in C. LOGO. BASIC and
ModutB.2.
25Cpp $19.95

STB.flinn.r-.Guid.
Written for the firsthand ST
user. Get a basic understanding of your ST. Explore
LOGO and BASIC from the
ground up. Simple explanations of the hardware and
internal workings of the ST.
[[lustrations, diagrams. Glossary. Index. 200pp $14.95

ST LOGO GUIDE
Take confrol of your ST by
learning ST LOGO*he easy
to use. powerful language.
Topics Include: file handling.
recurslon-HllbBft ft Sierpinsk!
curves, 2D and 3D function
plots, data structure, error
handling. Helpful guide for
STLOGOusars.
$19.95

ST INTERNALS
Essential guide to the inside
information of the ST.
Detailed descriptions of
sound and graphics chips.
internal hardware. I/O ports.
using GEM. Commented
BIOS listing. An Indispensible reference for your ST
librwy.
450pp 519.85

ST PEEKS A POKES
the examples found within
this book. Explores using
different languages BASIC.
C. LOGO and machine
language, using various
Interfaces, memory usage,
reading and saving from and
to disk. more. 28Gpp $16.95

GEM Programme*! Rf.


For serious programmers
needing detailed information
on GEM. Presented in an
easy-to-understand format.
Afl examples are in C and
assembly language. Covers
VD1 and AES functions. No
serious programs? should be
without
410pp $19.95

MACHINE LANGUAGE
Program in the fastest language for your ATARI ST.
Learn 63000 assembly language, its numbering system,
use of registers, structure A
important details of Instruction set, and use of internal
system routines. Geared for
the ST.
260pp $19.95

BASIC Training GuM*


BASIC to C
Thorough guide for learning Move up from BASIC to C. If
ST BASIC programming. you're already a BASIC
Dataled programming funda- programmer, you can learn C
all that much faster. Parallel
tions. ST graphics ft sound, examples demostrate the
using GEM in BASIC, file programming techniques and
management, disk operation. constructs in both languages.
Tutorial problems give hands Variables, pointers, arrays,
on experience. 3QOpp $16.95 data structure. 250pp $19.95

ST TRICKS & TIPS


Fantastic collection of programs and info for the ST.
Complete programs include:
super-fast RAM dish; timesaving printer spooler; color
print herdeopy; plotter output
hardcopy; creating accessories. Money saving tricks
and tip*. 260pp $19.05

3D GRAPHICS
FANTASTIC) Rotate, zoom,
and shade 3D objects. All
programs written in machine
language for high speed.
Learn the mathematics
behind 3D graphics. Hidden
line removal, shading. With
3D pattern maker and
animator.
$24.95

The ATARI logo and ATARI ST ore tademarks of Atari Corp.

AL

****!"?" r*

.-

AbacusliiiiiiiJ Software
P.O. Box 7219 Dept. A9 Grand Rapids, Ml 49510 Telex 709-101 Phone (616) 241-5510
Optional diskettes are available for all book titles at $14.95
Call now for the name of your nearest dealer. Or order directly from ABACUS with your MasterCard, VISA, or Amex card. Add
$4.00 per order for postage and handling. Foreign add $10.00 per book. Other software and books coming soon. Call or
write for your free catalog. Dealer inquiries welcome-over 1400 dealers nationwide.

Вам также может понравиться