0% found this document useful (0 votes)
1K views

Atari ST Internals

Uploaded by

Karlson2009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Atari ST Internals

Uploaded by

Karlson2009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 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 Data Becker GmbH
Merowingerstr.30
4000 Dusseldorf, West Germany
Copyright © 1985 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 The 68000 Processor 3
1.1.1 The 68000 Registers 4
1.1.2 Exceptions on the 68000 7
1.1.3 The 68000 Connections 7
1.2 The Custom Chips 13
1.3 The WD 1772 Floppy Disk Controller 20
1.3.1 1772 Pins 20
1.3.2 1772 Registers 24
1.3.3 Programming the FDC 25
1.4 The MFP 68901 28
1.4.1 68901 Connections 28
1.4.2 The MFP Registers 32
1.5 The 6850 ACIAs 41
1.5.1 The Pins of the 6850 41
1.5.2 The Registers of the 6850 44
1.6 The YM-2149 Sound Generator 48
1.6.1 Sound Chip Pins 50
1.6.2 The 2149 Registers and their Functions 52
1.7 I/O Register Layout of the ST 55
2 The Interfaces 65
2.1 The Keyboard . 67
2.1.1 The mouse 71
2.1.2 Keyboard commands 74
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
2.6 The Cartridge Slot 96
2.7 The Floppy Disk Interface 97
2.8 The DMA Interface 99
3 The ST Operating System 101
3.1 The GEMDOS 104
3.1.1 GEMDOS error codes and their meaning 139
3.2 The BIOS Functions of the Atari ST 140
3.3 The XBIOS 155
3.4 The Graphics 206
3.4.1 An overview of the "line-A" variables 226
3.4.2 Examples for using line-A opcodes 229
3.5 The Exception Vectors 234
3.5.1 The interrupt structure of theST 236
3.6 The STVT52 Emulator 242
3.7 The ST System Variables 247
3.8 The 68000 Instruction Set 255
3.8.1 Addressing modes 256
3.8.2 The instructions 260
3.9 The BIOS listing 268
4 Appendix - The System Fonts 443
4.1 The System Fonts 445
4.2 Alpahbetical listing of GEMDOS functions 447

11
List of Figures

1.1-1 68000 Registers 5


1.2-1 GLUE 14
1.2-2 MMU 16
1.2-3 SHIFTER 17
1.2-4 DMA 19
1.3-1 FDC1772 21
1.4-1 MFP 68901 29
1.5-1 ACIA6850 42
1.6-1 Sound Chip YM-2149 49
1.6-2 Envelopes of the PSG 53
2.1-1 6850 Interface to 68000 68
2.1 -2 Block Diagram of Keyboard Circuit 70
2.1.1-1 The Mouse 72
2.1.1-2 Mouse control port 74
2.1.2-1 Atari ST Key Assignments 84
2.2-1 Diagram of Video Interface 86
2.2-2 Monitor Connector 87
2.3-1 Printer Port Pins 88
2.3-2 Centronics Connection 89
2.4-1 RS-232 Connection 92
2.5-1 MIDI System Connection 95
2.6-1 The Cartridge Slot 96
2.7-1 Disk Connection 98
2.8-1 DMA Port 100
2.8-2 DMA Connections 100
3.4-1 Lo-Res-Mode 208
3.4-2 Medium-Res-Mode 210
3.4-3 Hi-Res-Mode 212

111
Chapter One

The Integrated Circuits

1.1 The 68000 Processor


1.1.1 The 68000 Registers
1.1.2 Exceptions on the 68000
1.1.3 The 68000 Connections
1.2 The Custom Chips
1.3 The WD 1772 Floppy Disk Controller
1.3.1 1772 Pins
1.3.2 1772 Registers
1.3.3 Programming the FDC
1.4 The MFP 68901
1.4.1 68901 Connections
1.4.2 The MFP Registers
1.5 The 6850 ACIAs
1.5.1 The Pins of the 6850
1.5.2 The Registers of the 6850
1.6 The YM-2149 Sound Generator
1.6.1 Sound Chip Pins
1.6.2 The 2149 Registers and their Functions
1.7 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 1 = Overflow flag
BIT 2 = Zero flag BIT 3 = Negative flag
BIT 4 - extend flag
Abacus Software Atari ST Internals

Figure 1.1-1 68000 Registers

31 16 15 8 7
D 0 j
D 1
D 2
DATA
D 3 REGISTERS
D 4
D 5
D 6
. D7 1

31

A1
A 2 ADDRESS
REGISTERS
A 3
A 4
A 5
A6-

31
System Stack Pointer SSP
A7 STACK POINTER
User Stack Pointer OSP

31 24 23
I L15 8 7
PC PROGRAM
COUNTER
I Sys Byte I User Byte I gj> 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 FC1 FCO Status
0 0 0 unused
0 0 1 User-mode data access
0 1 0 User-mode program
0 1 1 unused
1 0 0 unused
1 0 1 Supervisor data access
1 1 0 Supervisor program
1 1 1 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* 27 C 3 9 A21
RDY 28 C D 8 A20
VPA* 29 C D 7 A19
BEER* 30C D 6 A18
DTACK* 31 C D 5 A17
IPL 1* 32 C D 4 A16
IPL 2* 33 C b 3 A15
8MHZ in 34 C
GND
BLANK*
35 C
36 C
GLUE II
D 68
A14
Vcc
A13
HSYNC 37 C D 67 A12
VSYNC 38 C D 66 All
DE 39 C D 65 A10
BR* 40 C D 64 A9
BGACK* 41C D 63 A8
6850CS* 42 C D 62 A7
500HZ out 43 C D 61 A6

U UU UUUUUUUUUUU UUU

CO
* * °
8
* U
to
ON*
H
& *O* *
MM
faOQQOH § SS^HI
£ in
' M O I £ rf

14
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
Abacus Software Atari ST Internals

Figure 1.2-2 MMU

00 P 3
Hd 0 0
0
0
D&Q
CO

nnnnnnnnnnnnnnnnn

GND* 27 C D 9 LATCH
CMPCS 28 £ D 8 RASO
DCYC* 29 <- D 7 CASOLOW
RDAT* 30 C D 6 CASOHIGH
DEV* 31 C D 5 16MHZ IN
AS 32 C D 4 D7
RAM* 33 C 3 D6
2 D5
R/W*
A15
34 £
35 £ MMU 1p
^ 1 D4
A14
A13
A12
36 £
37 C
38 ^
PD 68
67
66
D3
D2
Dl
All 39 £ D 65 DO
A10 40 C D 64 MAD 9
A9 41 C D 63 MAD 8
A8 42 C D 62 MAD 7
A7 43 L D 61 GND

U UUU UUUUUUUUUUUUU

n
U

16
Abacus Software Atari ST Internals

Figure i.:1-3 SHlKl't,R

XTL 0 e J Vc c

XTL 1 32MHZ in
c \Z out

D 0
D 1
cC ) cs *
) D E

D 2
c )A i
D 3
c 1 5V. 2

D 4
c CO )A 3
D 5
( SB ) A 4

D 6
c H ) A 5

D 7
LOAD*^
c ) R/W*

^ MONO
Hi
D 8
c^

w J R 0

D 9
D 10
(( )» »
) R 2

D 11 ( ) G 0

D 12 c ). i
D 13
c )

c
G 2

D 14 ) B 0

D 15
c ). i
6ND
< ) 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*
<[ ) V CC
A 1
C ) CLK
FCS *
C ) RD Y
D 0
C ) ACK*
D 1
C ) CD 0
D 2
C ) GDI
D 3
C ) CD 2
D 4
C ) CDS
D 5
C a ) CD 4
D 6
D 7
C
C
g CDS
] CD 6
D 8
C ) C D7
D 9
C ) GND
D 10 ( ) C A2
D 11
C ) C Al
D 12
C ) CR/W*
D 13
C ) HDCS*
D 14 ( } HDRQ
D 15
C ) FDCS *
6ND
C 5 FDRQ

19
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
^I^^^^H
~~\R

R/W*
C ~") DRQ
AO
C CM
"^ DD *

A1
C ~"\P *

DAL 0
C •^
~"\X

DAL 1
C H D T1 "Q V f \O

DAL 2
C "^ WD

DAL 3
C "^ WG

DAL 4
C Q
"} MO

DAL 5
C w
"^ RD *

DAL 6
C "^ CLK

DAL 7
C ""^ DIRC

MR*
C ~^ STEP

6ND r~ "^\c

21
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 R/W=1 R/W=0
0 0 Status Reg. Command Reg
0 1 Track Reg. Track Reg.
1 0 Sector Reg. Sector Reg .
1 1 Data 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 Function
1 Restore, look for track 00
1 Seek, look for a track
1 Step, a track in previous direction
1 Step In, move head one track in (toward disk hub)
1 Step Out, move head one track out (toward edge of disk)
2 Read Sector
2 Write Sector
3 Read Address, read ID
3 Read Track, read entire track
3 Write Track, write entire track (format)
4 Force Interrupt

Type 1 Commands
These commands position the read/write head. The bit patterns of these five
commands look like this:
BIT
7 6 5 4 3 2 1 0
Restore 0 0 0 0 H V Rl RO
Seek 0 0 0 1 H V Rl RO
Step 0 0 1 U H V Rl RO
Step In 0 1 0 U H V Rl RO
Step Out 0 1 1 U H V 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 STEP RATE
0 0 2 milliseconds
0 1 3 milliseconds
1 0 5 milliseconds
1 1 6 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 7 6 5 4 3 2 1 0
Read Address 1 1 0 0 H E O O
Read Track 1 1 1 0 H E O O
Write Track 1 1 1 1 H E P 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 6 5 4 3 2 1 0
Force Interrupt 1 1 0 1 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* (T D CS *

A 1
C D D S *

A 2

A 3
c
c
D
D
DTACK*

I ACK*

A 4
c D D 7

A 5
c D D 6

T C
c D D 5

S 0
c D D 4

S Z
R C
c
c .
D
D
D

D 2
3

Vc c
c D D 1

NC .
c D D 0

TA 0
c CO D Vs s

TB 0
c vo D C LK

TC O
c D I EI *

TD 0
c D I EO *

XTAZ.1
c D INTR*

XTAX.2

TA Z
c
c
D
D
RR *

TR*

TB
RESET
Z
c
c D
D
I 7

Z 6

I 0 c D Z 5

Z 1
c D Z 4

Z2
c D Z3

29
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: I/O port bit 7 (highest priority)
Bit 6: I/O port bit 6
Bit 5: Timer A
Bit 4: Receive buffer full
Bit 3: Receive error
Bit 2: Sender buffer empty
Bit 1: Sender error
Bit 0: Timer B
IERB
Bit 7: I/O port bit 5
Bit 6: I/O port bit 4
Bit 5: Timer C
Bit 4: Timer D
Bit 3: I/O port bit 3
Bit 2: I/O port bit 2
Bit 1: I/O port bit 1
Bit 0: I/O port bit 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-of-
Interrupt" 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-of-
Interrupt" 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 Atari ST Internals

BIT 3 2 1 0 Function
0 0 0 0 Timer stop, no function executed
0 0 0 1 Delay mode, subdivider divides by 4
0 0 1 0 Delay mode, subdivider divides by 10
0 0 1 1 Delay mode, subdivider divides by 16
0 0 1 1 Delay mode, subdivider divides by 16
0 1 0 0 Delay mode, subdivider divides by 50
0 1 0 1 Delay mode, subdivider divides by 64
0 1 1 0 Delay mode, subdivider divides by 100
0 1 1 1 Delay mode, subdivider divides by 200
100 0 Event Count Mode
1 00 1 Pulse extension mode, subdivider divides by 4
101 0 Pulse extension mode, subdivider divides by 10
101 1 Pulse extension mode, subdivider divides by 16
110 0 Pulse extension mode, subdivider divides by 50
1 10 1 Pulse extension mode, subdivider divides by 64
1 11 0 Pulse extension mode, subdivider divides by 100
1 1 11 Pulse extension mode, subdivider divides by 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 210 Function - Timer D
Bit 654 Function - Timer C
000 Timer Stop
001 Delay Mode, division by 4
010 Delay Mode, division by 10
011 Delay Mode, division by 16
100 Delay Mode, division by 50
101 Delay Mode, division by 64
110 Delay Mode, division by 100
111 Delay Mode, division by 200

36
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 : unused
Bit 1 : 0=0dd parity
l=Even parity
Bit 2 : 0=No parity (bit 1 is ignored)
l=Parity according to bit 1
Bits 3,4 : These bis control the number of
start- and stopbits and the
format desired.
Bit 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 : These bits give the
"wordlength" of the data bits
to be transferred.
Bits 6 5 Word length
0 0 8 bits
0 1 7 bits
1 0 6 bits
1 1 5 bits

37
Abacus Software Atari ST Internals

Bit 7 : 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 UE-
bit 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

Vss (T D CTS*

RX DATA (
o D DCD*1

RX

TX
CLK

CLK
f"

£~"
in D

D
0

1
00
RTS
* C vo D D 2

TX DATA f"
D D 3

IRQ
* C . D D 4

uuu
CS
« C D 5

CS ,. c H
U
D 6

CS
1 C D 7

RS

Vcc
c
r~
D
^
E

R/W*

42
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. All
read/write processes with this signal must be synchronous.
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 RS Register Access
0 0 Control Register write
0 1 Sender Register write
1 0 Status Register read
1 1 Receive Register 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 CRO
0 0 RXCLK/TXCLK without division
0 1 RXCLK/TXCLK by 16 (for MIDI)
1 0 RXCLK/TXCLK by 64 (for keyboard)
1 1 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 CR3 CR2
0 0 0 7 databits. 2 stopbits. even parity
0 0 1 7 databits. 2 stopbits. odd parity
0 1 0 7 databits. 1 stopbit. even parity
0 1 1 7 databits. 1 stopbit. odd parity
1 0 0 8 databits. 2 stopbit. no parity
1 0 1 8 databits. 1 stopbit. no parity
1 1 0 8 databits. 1 stopbit. even parity
1 1 1 8 databits. 1 stopbit. 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 RTS low, transmitter IRQ disabled
0 1 RTS low, transmitter IRQ enabled
1 0 RTS high, transmitter IRQ disabled
1 1 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 Interrupt disabled
1 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 . f ^ TEST 1

ANALOG B f J ANALOG C

ANALOG A f ) DA 0

NC . ( ) DA 1

IOB7 £ ) DA 2

I OB6 £ Kj J DA 3
I OB5 (
S ) DA 4

I O B 4 ([
1 ) DA 5

I O B 3 ([
N> D DA 6

I O B 2 ([
M ) DA 7

IOB1 £ .yn^ ) BC 1

I OBO (

I OA7 (
vo ) BC 2

) BD I R

XOA6 ( J TEST 2

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 PSG function
0 0 0 Inactive
0 0 1 Latch address
0 1 0 Inactive
0 1 1 Read from PSG
1 0 0 Latch address
1 0 1 Inactive
1 1 0 Write to PSG
1 1 1 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 BC1 Function
0 0 Inactive, PSG data bus high
0 1 Read PSG registers
1 0 Write PSG registers
1 1 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 0:Channel A tone on/off 0=on /l=off
Bit 1:Channel B tone on/off 0=on /l=off
Bit 2:Channel C tone on/off 0=on /l=off
Bit 3:Channel A noise on/off 0=on /l=off
Bit 4:Channel B noise on/off 0=on /l=off
Bit 5:Channel C noise on/off 0=on /l=off
Bit 6:Port A in/output 0=in /l=out
Bit 7:Port B in/output 0=in /l=out

52
Abacus Software Atari ST Internals

Figure 1.6-2 Envelopes of the PSG

KBQ 15
B3 B2 Bl BO

C
O
N
T
X H
N O
a L
K D

/I
O
NKNKNNKKN

O
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 Memory configuration


$FF8200 Video display register
$FF8400 Reserved
$FF8600 DMA/disk controller
$FF8800 Sound chip
$FFFAOO MFP 68901
$FFFCOO 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 Atari ST Internals

SFF8001 Bit Memory conficruration


3-0 Bank 0 Bank 1
0000 128K 128K
0001 128K 512K
0010 128K 2 M
0011 reserved
0100 512K 128K
0101 512K 512K
0100 512K 2 M, normally reserved
0100 reserved
1000 2M 128K
1001 2M 512K
1010 2M 2M
1011 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 8-bit Screen memory position (high-byte)
$FF8203 8-bit 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 8-bit Video address pointer (high-byte)
$FF8207 8-bit Video address pointer (mid-byte)
$FF8209 8-bit 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 16-bit Color palette register 0
$FF8242 16-bit Color palette register 1

• *• «

: : Color palette registers 2-13
• * •
• * *
$FF825C 16-bit Color palette register 14
$FF825E 16-bit 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 reserved
$FF8602 reserved

$FF8604 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 0=no error, 1=DMA error
Bit 1 0=sector count = null, l=sector countonull
Bit 2 Condition of FDC DATA REQUEST signal
Write access to this address controls the DMA mode register.

58
Abacus Software Atari ST Internals

Bit 0 unused
Bit 1 0=pin AO is low
l=pin AO is high
Bit 2 0=pin Al is low
l=pin Al is high
Bit 3 0=FDC access
1=HDC access
Bit 4 0=access to FDC register
l=access to sector count register
Bit 5 0, reserved
Bit 6 0=DMA on
l=no DMA
Bit 7 0=hard disk controller access (HOC)
1=FDC access
Bit 8 0=read FDC/HDC registers
l=write to FDC/HDC registers
$FF8609 8-bit DMA basis and counter high-byte
$FF860B 8-bit DMA basis and counter mid-byte
$FF860D 8-bit 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 Page-choice signal for double-sided
floppy drive
Bit 1 Drive select signal — floppy drive 0
Bit 2 Drive select signal — floppy drive 1
Bit 3 RS-232 RTS-output
Bit 4 RS-232 DTR output
Bit 5 Centronics strobe
Bit 6 Freely usable output (monitor jack)
Bit 7 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 8-bit Parallel port
$FFFA03 8-bit Active Edge register
$FFFA05 8-bit Data direction
$FFFA07 8-bit Interrupt enable A
$FFFA09 8-bit Interrupt enable B
$FFFAOB 8-bit Interrupt pending A
$FFFAOD 8-bit Interrupt pending B
$FFFAOF 8-bit Interrupt in-service A
$FFFA11 8-bit Interrupt in-service B
$FFFA13 8-bit Interrupt mask A
$FFFA15 8-bit Interrupt mask B
$FFFA17 8-bit Vector register
$FFFA19 8-bit Timer A control
$FFFA1B 8-bit Timer B control

60
Abacus Software Atari ST Internals

$FFFA1D 8-bit Timer C & D control


$FFFA1F 8-bit Timer A data
$FFFA21 8-bit Timer B data
$FFFA23 8-bit Timer C data
$FFFA25 8-bit Timer D data
$FFFA27 8-bit Sync character
$FFFA29 8-bit USART control
$FFFA2B 8-bit Receiver status
$FFFA2D 8-bit Transmitter status
$FFFA2F 8-bit USART data
See the chapter on the MFP for details on the individual registers.
I/O Port
Bit 0 Centronics busy
Bit 1 RS-232 data carrier detect - input
Bit 2 RS-232 clear to send - input
Bit 3 reserved
Bit 4 keyboard and MIDI interrupt
Bit 5 FDC and HDC interrupt
Bit 6 RS-232 ring indicator
Bit 7 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 Atari ST Internals

SFFFCOO Keyboard and MIDI ACIAs

The communications between the ST, the keyboard, and musical


instruments are handled by two registers in the ACIAs.

$FFFCOO 8-bit Keyboard ACIA control


$FFFC02 8-bit Keyboard ACIA data
$FFFC04 8-bit MIDI ACIA control
$FFFC06 8-bit MIDI ACIA data

Figure 1.7-1 I/O Assignments

2 ACIA's 6580
SFFFCOO

MFP 68901
SFFFAOO

SOUND AY-3-8910
SFF8800
DMA / WD1770
IFF8600
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 16746496
8600 16745984
8400 I/O - Area 16745472
8200 16744960
$FF 8000 16744448

$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 0

63
Chapter Two

The Interfaces

2.1 The Keyboard


2.1.1 The Mouse
2.1.2 Keyboard commands
2.2 The Video Connection
2.3 The Centronics Interface
2.4 The RS-232 Interface
2.5 The MIDI Connections
2.6 The Cartridge Slot
2.7 The Floppy Disk Interface
2.8 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» VO
HI H HI
W M H

CO CM HI IO N
O ""J <!

in
0
oo Q o €Q
vo in
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
Abacus Software Atari ST Internals

Figure 2.1-2 Block Diagram of Keyboard Circuit

V
A
• niJJJI

v> m <* H «> t- M O A 00 f-


H H H H H H H

70
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
Abacus Software Atari ST Internals

Figure 2.1.1-1 The Mouse

XA

OP

2 1 3 4 7 8 6 9

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 XB/UP (K12)
2 XA/DOWN (K10)
3 YA/LEFT (K9)
4 YB/RIGHT (K8)
6 LEFT BUTTON/FIRE (Kll)
7 +5V (K13)
8 GND (Kl)
9 RIGHT BUTTON (K6)
Portl
1 UP (K7)
2 DOWN (K5)
3 LEFT (K4)
4 RIGHT (K3)
5 PortO enable (K17)
6 FIRE (K6)
7 +5V (K13)
8 GND (Kl)

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 Header in range $F8-$FB. The two lowest
bits of the header indicate the condition
of the two mouse buttons.
1 byte Relative X-position (signed!)
1 byte 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 Maximum X-coordinate
1 word 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 Atari ST Internals

1 byte Number of pulses (X) after which the key


number for cursor left (or right) will be
sent.
1 byte Number of pulses (Y) after which the key
number 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 Threshold in X-direction
1 byte 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 X scaling
1 byte 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 =0 as fill byte
1 word X-coordinate
1 word 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 Header = $FE or $FF for joystick 0/1
1 byte 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 Bit 0 for the button on joystick 1, bit 1
for that of joystick 0
1 byte 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 RY
1 byte TX
1 byte TY
1 byte VX
1 byte 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 Year, two digit (85, 86, etc.)
1 byte Month, two digit (12, 01, etc.)
1 byte Day, two digit (31,01,02, etc.)
1 byte Hours, two digit
1 byte Minutes, two digit
1 byte 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 prt equ 0
2 chout equ 3
3 gemdos equ 1
4 bios equ 13
5 xbios equ 14
6 stvec equ 12
7 rdm equ $21
8 wrkbd equ 25
9 kbdvec equ 34
10 term equ 0
11 start :
12 00000000 3F3C0022 move . w #kb
#kbdvec,-(a7)
13 00000004 4E4E trap #xb
#xbios
14 00000006 548F #2,
addq . 1 #2,a7
15 00000008 41F900000000 lea 0,a
0,aO
16 OOOOOOOE 43F9000000D6 lea keyin,al
key
17 00000014 23C000000104 move . 1 dO,savea
dO,
18 0000001A 23FOOOOC00000100 move . 1 stvec(aO,dO)
StVi , save
19 00000022 2189000C move.1 al,stvec(aO,dO)

80
Abacus Software Atari ST Internals

20 00000026 383CFOOO move . w #$fOOO,d4


21 loop:
22 0000002A 33C40000010A move . w d4,tbuf+l
23 00000030 61000084 bsr keyout
24 wait:
25 00000034 OC390000000000F8 cmpi.b #0,rbuf
26 0000003C 67F6 beq wait
27 0000003E 3C3C0006 move . w #6,d6
28 00000042 610A bsr bufout
29 00000044 5C44 addq . w #6,d4
30 00000046 OC44FFFF cmpi . w #$ffff,d4
31 0000004A 6DDE bit loop
32 0000004C 6052 bra exit
33 bufout :
34 0000004E 49F9000000F9 lea rbuf+l,a4
35 bytout :
36 00000054 101C move . b (a4)+,dO
37 00000056 6106 bsr hexout
38 00000058 5306 subq.b #l.d6
39 0000005A 66F8 bne bytout
40 0000005C 4E75 rts
41 hexout :
42 0000005E 3240 movea . wdO,al
43 00000060 E808 Isr.b #4,dO
44 00000062 02800000000F andi . 1 #15, dO
45 00000068 47F9000000E8 lea table, a3
46 0000006E 14330000 move . b 0(a3,dO),d2
47 00000072 E14A Isl.w #8,d2
48 00000074 3009 move . w al,dO
49 00000076 02800000000F andi . 1 #15, dO
50 0000007C 14330000 move . b 0(a3,dO) ,d2
51 00000080 3002 move . w d2,dO
52 00000082 3F02 move . w d2,-(a7)
53 00000084 E048 Isr .w #8,dO
54 00000086 6108 bsr chrout
55 00000088 301F move . w (a7)+,dO
56 0000008A 6104 bsr chrout
57 0000008C 103C0020 move . b #" ",dO
58 chrout :
59 00000090 3FOO move . w dO,-(a7)
60 00000092 3F3COOOO move . w #prt,-(a7)
61 00000096 3F3C0003 move . w #chout,-(a7)
62 0000009A 4E4D trap #bios
63 0000009C 5C8F addq . 1 #6,a7
64 0000009E 4E75 rts
65 exit:
66 OOOOOOAO 307900000104 movea savea, aO

81
Abacus Software Atari ST Internals

67 OOOOOOA6 203900000100 move . 1 save/dO


68 OOOOOOAC 2140000C move . 1 dO,stvec(aO)
69 OOOOOOBO 3F3COOOO move . w fterm, -<a7)
70 OOOOOOB4 4E41 trap tgemdos
71 keyout :
72 OOOOOOB6 13FCOOOOOOOOOOF8 move . b #0,rbuf
73 OOOOOOBE 487900000109 pea tbuf
74 OOOOOOC4 3F3C0002 move . w #2,-(a7)
75 OOOOOOC8 3F3C0019 move . w #wrkbd, -(a7)
76 OOOOOOCC 4E4E trap txbios
77 OOOOOOCE DFFC00000008 adda . 1 #8,a7
78 OOOOOOD4 4E75 rts
79 keyin:
80 OOOOOOD6 103C0008 move . b 18, dO
81 OOOOOODA 43F9000000F8 lea rbuf ,al
82 repin :
83 OOOOOOEO 12D8 move . b (aO)+, (al) +
84 OOOOOOE2 5300 subq.b #l,dO
85 OOOOOOE4 66FA bne repin
86 OOOOOOE6 4E75 rts
87 table:
88 OOOOOOE8 3031323334353637 dc.b "0123456789ABCDEF"
88 OOOOOOFO 3839414243444546
89 OOOOOOF8 rbuf: ds.b 8
90 00000100 save ds . 1 1
91 00000104 savea ds . 1 1
92 00000108 dummy ds.b 1
93 00000109 21 tbuf dc.b rdm
94 0000010A ds.b 2
95 0000010C .end

82
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
Abacus Software Atari ST Internals

Figure 2.1.2-1 ATARI ST Key Assignments

to O 0
H •4 H
D
Id A O
09 O h" to
H O
H
to O
!-• Id
H H
"I
to 0
H
M to
O
to 0
M H UI
to W
10 O
«fl !-• m
M «h

id 0
H ~a
Id 10 (II
*O Id
Id 0
t-« M 09
10 tn
*
Id O
H *O
to ^a
UI
U O
to
t-«
CO
>•
m
Id O
•> H D
to to
^J
Id O
in t-» 0
to >•
O
f M D
a
U
to
l-« (D
O

O
pa
10 UI
n U

Ot Ol at
-4 0 td
O
01 01 01 0.
M 0 09
*

-J Oi 0, at at
H
•a o ID UI

-J ft. at
to H 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
Abacus Software Atari ST Internals

Figure 2.2-1 Diagram of Video Interface

16MHz

+ 5V

-DCYC

-CMPCS

R/-W
SHIFT
Al-5
10
DO-15

32MHz
11

-BLANK
GP O 3
AUDIO OUT- 1
HSYNC 9
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

3 5

12 9

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 OUT
AUDIO 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.
2 TxD
Send data
3 RxD
Receive data
4 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.
5 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

7 GND
Signal ground.
8 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

so 2

I/OA4 20

I/OA3 4

SI 3

16 I 22

12 II 5

II 8

1 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
Abacus Software Atari ST Internals

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

4- 5 V 1 2 1 A 8
H- 5 V 2 2 2 A 14
D 14 3 2 3 A 7
D 15 4 2 4 A 9
D 12 5 2 5 A 6
D 13 6 2 6 A 10
D 1O 7 2 7 A 5
D 11 8 2 8 A 12
D8 9 2 9 All
D9 10 3 0 A 4
D6 11 31 -ROM3
D7 12 3 2 A 3
D4 13 33 - ROM4
D5 14 3 4 A 2
D2 15 3 5 -DOS
D3 16 3 6 A 1
DO 17 3 7 - LDS
Dl 18 38 G N D
A 13 19 3 9 G N D
A 16 2 0 4 0 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 READ DATA 8 MOTOR ON
2 SIDE 0 SELECT 9 DIRECTION IN
3 GND 10 STEP
4 INDEX 11 WRITE DATA
5 DRIVE 0 SELECT 12 WRITE GATE
6 DRIVE 1 SELECT 13 TRACK 00
7 GND 14 WRITE PROTECT

97
Abacus Software Atari ST Internals

Figure 2.7-1 Disk Connection

CDO-7 YSS/S/SSA

CA2

CA1

FDC
CR/-W

10
-FDCS

-RESET

8MHz
4

I/OA2 6

I/OA1 5

I/OAO 2

10 FDRQ
8 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

19 11

Figure 2.8-2 DMA Connections

-RESET

15
INTR

100
Chapter 3

f*.
f The ST Operating System J

3.1 The GEMDOS


3.1.1 GEMDOS error codes and their meaning
3.2 The BIOS Functions
3.3 The XBIOS
3.4 The Graphics
3.4.1 An overview of the line-A variables
3.4.2 Examples for using the line-A opcodes
3.5 The Exception Vectors
3.5.1 The interrupt structure of the ST
3.6 The ST VT52 Emulator
3.7 The ST System Variables
3.8 The 68000 Instruction Set
3.8.1 Addressing modes
3.8.2 The instructions
3.9 The BIOS listing
Abacus Software Atari ST Internals

The ST Operating System

GEMDOS—what 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 TOS—Tramiel 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 -(SP)
TRAP

$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) * Function number on the stack


TRAP #1 * Call GEMDOS
ADDQ.L #2,SP * 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 #'A',-(SP) * Output an A


MOVE.W #2,-{SP) * CONOUT
TRAP #1 * Call GEMDOS
ADDQ.L #4,SP * 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 #'A',-(SP) * Output an A


MOVE.W #5,-(SP) * Function number
TRAP #1 * Call GEMDOS, output character
ADDQ.L #4,SP * Correct stack
TST.W DO * Affect flags
BEQ printererror

$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
Abacus Software Atari ST Internals

START:

MOVE.W #$FF,-(SP) * Function value test keyboard


MOVE.W #6,-<SP) * Function number
TRAP #1 * Call GEMDOS, test keyboard
ADDQ.L #4,SP * Correct stack
TST.W DO * Character arrived?
BEQ START * Not yet
CMP.B #3, DO * AC selected as the end marker
BEQ END
MOVE DO,-(SP) * Character for output on the stack
MOVE #6,-<SP) * Function number
TRAP fl * Call GEMDOS, test keyboard
ADDQ.L #4,SP * Correct stack
BRA START * 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 #text,-(SP) * Address of the string on the stack


MOVE #$09,-(SP) * Function number PRT LINE
TRAP #1 * Call GEMDOS
ADDQ.L #6,SP * "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 Atari ST Internals

AC Ends input AND program (!)


AH Backspace one position
AI TAB
AJ Linefeed, end input
AM CR, end input
AR Entered line is printed in new line
A U Don't count line, start new line
X 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 #DTADDRESS,-(SP) * Address of the 44-byte DTA buffer


MOVE.W #$1A,-(SP) * Function number SET DTA
TRAP #1 * Set DTA
ADDQ.L #6,SP * 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.

* The 6800 is in the user mode


CLR.L -(SP) * User stack becomes supervisor stack
MOVE.W #$20,-(SP) * Call SUPER
TRAP #1 * The supervisor mode is active
* after the TRAP
ADD.L $6,SP * DO = old supervisor stack
MOVE.L DO,_SAVE_SSP * Save value

Here processing can be done in the supervisor mode

MOVE.L _SAVE_SSP,-(SP) * Old supervisor stack pointer


MOVE.W #$20f-(SP) * Call SUPER
TRAP #1 * Now we are back in the user mode
ADD.L #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 #%101101011001,-(SP) * Set date to 10/25/1985


MOVE.W i$2B,-(SP) * Function number of SET DATE
TRAP fl * Set date
ADDQ.L #6,SP * 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 #%1000101010111101,-(SP) * Clock time 17:21:58


MOVE.W f$2D,-<SP) * Function # of GET TIME
TRAP #1 * Set date
ADDQ.L f6,SP * 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 #0,-(SP) * Error code no error, else 1


MOVE.L #$1000,-<SP) * Protect $1000 bytes at program start
MOVE.W #$31,-(SP) * Function number, end program
TRAP #1 * 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 #0,-<SP) * Information from the active drive


MOVE.L #BUFFER,-(SP) * Address of the 16-byte buffer
MOVE #$36,-(SP) * Function number
TRAP fl
ADDQ.L #8,SP * Clean up stack

.bss
BUFFER:
f real : .ds .1 1 * Free allocation units
total: .ds .1 1 * Total allocation units
bps: .ds .1 1 * Bytes /physical sector
pspal: .ds .1 1 * 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 ^pathname * Address of the pathname


MOVE #$39,-(SP) * Function number
TRAP #1
ADDQ.L #6,SP * Repair stack
TST.W DO * Error occurred?
BNE error * Apparently

pathname:
.dc.b '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 #path,-(SP) * Address of the path


MOVE.W #$3B,-(SP) * Function number
TRAP #1
ADDQ.L #6,SP * Repair stack
TST.W DO * Error occurred?
BNE error * 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
Abacus Software Atari ST Internals

MOVE.W #$0,-(SP) * File should have R/W status


MOVE.L #filename,-(SP) * Address of the filename on stack
MOVE.W #$3C,-(SP) * Function number
TRAP #1 * Call GEMDOS
ADDQ.L #8,SP * Clean up stack
TST DO * Error occurred?
BMI error * It appears so
MOVE DO,handle * Save file handle

filename: * Don't forget zero byte


.dc.b 'myfile.dat',0

handle:
. ds. w 1

$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 Atari ST Internals

MOVE.W #$2,-(SP) * File read and write


MOVE.L ffilename * Address of the filename on the stack
MOVE.W #$3D,-(SP) * Function number
TRAP #1 * Call GEMDOS
ADDQ.L #8,SP * Clean up the stack
TST.W DO * Error occurred?
BMI error * Apparently
MOVE DO, handle * Save file handle for later accesses

filename: * Don't forget zero byte!


.dc.b '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 handle,-(SP) * Handle number


MOVE.W #$3E,-(SP) * Function number
TRAP #1 * Call GEMDOS
ADDQ.L #4,SP * Error occurred?
BMI error * 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 Atari ST Internals

MOVE.L #buffer,-(SP) * Address of the data buffer


MOVE.L f$100,-(SP) * Read 256 bytes
MOVE.W handle,-(SP) * Space for the handle number
MOVE.W #$3F,-{SP) * Function number
TRAP #1
ADD.L #12,SP
TST.L DO * Did an error occur
BMI error * Apparently

handle:
. ds. w 1 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 Atari ST Internals

MOVE.L pathname,-(SP) * Address of the data buffer


MOVE.W #$41,-(SP) * Function number
TRAP fl
ADD.L #6,SP
TST.W DO * Did an error occur?
BMI error * Apparently

pathname:
-de.b '/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 handle,-(SP) * File handle
MOVE.L #$-20,-(SP) * 32 bytes back
MOVE.W #$42,-(SP) * Function number
TRAP #1
ADD.L #10,SP
TST.W DO * Did an error occur?
BMI error * Apparently

handle:
.ds.w 1 * 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 = normal file status, read/write possible
$01 = File is READ ONLY
$02 = "hidden" file
$04 = system file
$08 = file is a volume label, contains disk name
$10 = file is a subdirectory
$20 = 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 #1,-(SP) * Give file READ ONLY attribute
MOVE.W #1,-(SP) * Set attribute
MOVE.L fpathname,-(SP) * We also need the pathname
MOVE.W #$43,-(SP) * Function number
TRAP #1
ADD.L #10,SP
TST.W DO * Did an ,error occur?
BMI error * Apparently

pathname: * Don't forget zero byte at end!


.dc.b 'killme.not',0

Second example:
MOVE.W #0,-(SP) * Dummy value, not actually required
MOVE.W #0,-(SP) * Read attribute
MOVE.L #pathname,-(SP) * and the pathname
MOVE.W #$43,-(SP) * Function number
TRAP #1
ADD.L #10,SP
TST.W DO * Did an error occur?
BMI error * Apparently

pathname: * Don't forget zero byte at the end!


.dc.b 'what—am.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 Atari ST Internals

MOVE.W #0,-(SP) * Get pathname of the current drive


MOVE.L #buffer,-(SP) * Address of the 64-byte buffer
MOVE.W #$47,-(SP) * Function number
TRAP #1
ADDQ.L #8,SP
TST.L DO * Error?
BNE 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 #-l,-(SP) * Determine number of free bytes
MOVE.W #$48,-(SP) * Function number
TRAP #1
ADDQ.L #6,SP * Number of free bytes in DO

Second example:
MOVE.L #$1000,-(SP) * Get hex 1000 bytes for the program
MOVE.W #$48,-(SP) * Function number
TRAP #1
ADDQ.L #6,SP
TST.W DO * Error or address of memory?
BMI error * Negative long word = error!
MOVE.L D0,mstart * 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
Abacus Software Atari ST Internals

MOVE.L mstart,-(SP) * Addr of a previously allocated area


MOVE.W #$49,-(SP) * Function number
TRAP #1
ADDQ.L #6,SP * Number of free bytes in DO
TST.L DO * Error?
BNE error * DOOO is error!

mstart:
.ds.l 1

$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 Atari ST Internals

MOVE.L A7,A5 * Save stack pointer in A5


MOVE.L #USTCK,A7 * Set up stack for the program
MOVE.L 4(A5),A5 * A5 now points to the base-page start
* exactly $100 bytes below the prg start
MOVE.L $C(A5),DO * $C(A5) contains length of the prg area
ADD.L $14(A5),DO * $14 (A5) cohtaing the length of the
* initialized data area
ADD.L $1C(A5),DO * $1C(A5) contains length of the
* uninitialized data area
ADD.L #$100,DO * Reserve $100 bytes base page
MOVE.L DO,-(SP) * DO contains the length of the area
* to be reserved
MOVE.L A5,-(SP) * A5 contains the start of the area
* to be reserved
MOVE.W *0,-<SP) * Meaningless word, but still necessary!
MOVE.W f$4A,-(SP) * Function number
TRAP #1
ADD.L #12,SP * Clean up the stack as usual
TST.L DO * Did an error occur?
BNE error * 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
Abacus Software Atari ST Internals

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 #env,-(SP) * Environment


MOVE.L #com,-(SP) * Command line
MOVE.L tfil,-(SP) * Filename
MOVE.W #0,-(SP) * Load and start, please
MOVE.W #$4B,-(SP) * Function number
TRAP #1
ADD.L #14,SP * Here we come to the end of the
* chained program or postloaded module

fil: * Load sort routine


.dc.b "qsort.prg1,0
com: * Sort the file in ascending order
.dc.b 'up data.asc",0
env: * No environment
.dc.b 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) * Any 2-byte value


MOVE.W #$4C,-(SP) * End program
TRAP #1 * 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 = Normal access, read/write possible
$01 = Normal access, write protected
$02 = Hidden entry (ignored by the ST desktop)
$04 = Hidden system file (ignored like $02)
$08 = Volume 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
Abacus Software Atari ST Internals

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 0-20 Reserved for GEMDOS


Byte 21 File attribute
Bytes 22-23 Clock time of file creation
Bytes 24-25 Date of file creation
Bytes 26-29 File size in bytes (long)
Bytes 30-43 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 #dta,-(SP) * Set up DTA buffer


MOVE.W #1A,-(SP) * Function number SETDTA
TRAP #1
ADDQ.L f6,SP
MOVE.W #attrib,-(SP) * Attribute value
MOVE.L #filnam,-(SP) * Name of file to search for
MOVE.W #$4E,-(SP) * Function number
TRAP . #1
ADDQ.L #8,SP
TST DO * File found?
BNE not found * Apparently not

attrib:
.dc.b 0 * Search for normal files only
f ilnam:
.dc.b '*.*',0 * Search for the 1st possible file

dta:
.ds.b 44 * 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
Abacus Software Atari ST Internals

MOVE.L tnewnam,-(SP) * New filename


MOVE.L #oldname,-(SP) * File to rename
MOVE.W #Q,-(SP) * Dummy?
MOVE.W i$56,-(SP) * Function number
TRAP fl
ADD.L #12,SP
TST.L DO * Test for error

oldnam: * Don't forget zero byte at end!


.dc.b 'oldfile.dat',0
newnam:
.dc.b 'newname.dat',0

$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 #1,-(SP) * Read time and date


MOVE.W #handle,-(SP) * File must first be opened
MOVE.L #buff,-(SP) * 4 byte buffer
MOVE.W f$57,-(SP) * Function number
TRAP #1
ADD.L #10, SP

handle:
. ds . b 2
buff:
.ds.b 4

Example 2:
MOVE.W #0,-(SP) * Set time and date
MOVE.W fhandle,-(SP) * File must first be opened
MOVE.L fbuff,-(SP) * 4 byte buffer
MOVE.W #$57,-(SP) * Function number
TRAP #1
ADD.L #10,SP

handle:
-ds.b 2
buff:
.ds.b 4

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 Invalid function number
-33 File not found
-34 Pathname not found
-35 Too many files open (no more handles left)
-36 Access not possible
-37 Invalid handle number
-39 Not enough memory
-40 Invalid memory block address
-46 Invalid drive specification
-49 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 Atari ST Internals

0 getmpb get memory parameter block

C: void getmpb(pointer)
long pointer;

Assembler:
move.l pointer,-(SP)
move.w #0,-(SP)
trap #13
addq.l #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 mfl Memory free list
long mal Memory allocated list
long rover Roving pointer

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


long link Pointer to next block
long start Start address of the block
long length Length of the block in bytes
long own Process descriptor

Example:
move.l #bufferf-(sp) Buffer for MPB
move.w #0,-(sp) getmpb
trap #13 Call BIOS
addq.l #6,sp Stack correction

We get the values $48E, 0, and $48E. The following data are at address
$48E:
link 0 No additional block
start $3B900 Start address of the free memory
length $3C700 Length of the free memory
own 0 No process descriptor

141
Abacus Software Atari ST Internals

1 bconstat return input device status

C: int bconstat(dev)
int dev;

Assembler:
move.w dev,-(sp)
move.w #l,-(sp)
trap #13
addq.l #4,sp

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


follows:
Status 0 No characters ready
Status -1 (at least) one character ready

The parameter dev specifies the input device:

dev Input device


0 PRT:, Centronics interface
1 AUX:, RS-232 interface
2 CON:, Keyboard and screen
3 MIDI, MIDI interface
4 IKBD, Keyboard port

The following table lists the allowed accesses to these devices:


Operation PRT: AUX: CON: MIDI IKBD
Input status no yes yes yes no
Input yes yes yes yes yes
Output status yes yes yes yes yes
Output yes yes yes yes yes

This example waits until a character from the RS-232 interface is ready.
wait move.w #l,-(sp) RS-232
move.w fl,-(sp) bconstat
trap #13
addq.l #4,sp
tst dO character available?
beq wait no, wait

142
Abacus Software Atari ST Internals

2 COnin read character from device

C: long conin(dev)
int dev;

Assembler:
move.w dev,-(sp)
move.w #2,-(sp)
trap #13
addq.l #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 #2,—(sp) con
move.w #2,-(sp) bconin
trap #13
addq.l #4,sp

143
Abacus Software Atari ST Internals

3 bconoilt write character to device

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

Assembler:
move.w c,-(sp)
move.w dev,-(sp)
move.w #3,-{sp)
trap #13
addq.l #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 #*A',-(sp)
move.w #0,-(sp) PRT:
move.w #3,-(sp) bconout
trap #13
addq.l #6,sp

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

144
Abacus Software Atari ST Internals

4 FWabs read and write disk sector

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


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

Assembler:
move.w dev,-(sp)
move.w recno,-(sp)
move.w number,-(sp)
move.l buffer,-(sp)
move.w rwflag,—(sp)
move.w #4,-(sp)
trap #13
add.l #14,sp

This function serves to read and write sectors on the disk. The parameters
have the following meaning:
rwflag Meaning
0 Read sector
1 Write sector
2 Read sector, ignore disk change
3 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 Drive
0 Drive A
1 Drive B
2 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 OK, no error
-1 General error
-2 Drive not ready
-3 Unknown command
-4 CRC error
-5 Bad request, invalid command
-6 Seek error, track not found
-7 Unknown media (invalid boot sector)
-8 Sector not found
-9 (No paper)
-10 Write error
-11 Read error
-12 General error
-13 Diskette write protected
-14 Diskette was changed
-15 Unknown device
-16 Bad sector (during verify)
-17 Insert diskette (for connected drive)

Example:
move.w #0,-(sp) Drive A
move.w #10,-(sp) Start at logical sector 10
move.w #2,-(sp) Read 2 sectors
move.l fbuffer,-(sp) Buffer address
move.w #0,-(sp) Read sectors
move.w #4,-(sp) rwabs
trap #13
add.l #14,sp

buffer ds.b 2*512

146
Abacus Software Atari ST Internals

5 Sfitexec set exception vectors

C: long setexec(number, vector)


int number;
long vector;

Assembler:
move.l vector,-(sp)
move.w number,-(sp)
move.w #5,-(sp)
trap #13
addq.l #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 fbuserror,-(sp)
move.w #2,-(sp)
move.w #5,-(sp)
trap #13
addq.l #8,sp

buserror

147
Abacus Software Atari ST Internals

6 tickcal 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 dev,-(sp)
move.w #7,-(sp)
trap #13
addq.l #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 recsiz Sector size in bytes
int clsiz Cluster size in sectors
int clsizb Cluster size in bytes
int rdlen Directory length in sectors
int fsiz FAT size in sectors
int fatrec Sector number of the second FAT
int datrec Sector number of the first data cluster
int numcl Number of data clusters on the disk
int bflags 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 #0,-(sp) Drive A
move.w #7,-(sp) getbpb
trap #13
addq.l #4,sp

149
Abacus Software Atari ST Internals

Here are the BPB data for 80 track single and double-sided disk drives:
Parameter 80 track SS 80 track DS
recsiz 512 512
clsiz 2 2
clsizb 1024 1024
rdlen 7 7
fsiz 5 5
fatrec 6 6
datrec 18 18
numcl 351 711

150
Abacus Software Atari ST Internals

8 bcostat return output device status

C: long bcostat(dev)
int dev;

Assembler:
move.w dev,-(sp)
move.w #8,.-(sp)
trap #13
addq.l #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 #0,-{sp) Printer ready?
move.w #8,-(sp) bcostat
trap #13
addq.l #4,sp

151
Abacus Software Atari ST Internals

9 Itiediach inquire media change

C: long mediach(dev)
int dev;

Assembler:
move.w dev,-(sp)
move.w #9,-(sp)
trap #13
addq.1 # 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 Diskette was definitely not changed
1 Diskette may have been changed
2 Diskette was definitely changed

Example:
move.w #l,-(sp) Drive B
move.w #9,-(sp) mediach
trap #13
addq.l #4,sp

152
Abacus Software Atari ST Internals

10 drvmap 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) drvmap
trap #13
addq.1 #2 , sp

153
Abacus Software Atari ST Internals

11 kbshift inquire/change keyboard status

C: long kbshift(mode)
int mode;

Assembler:
move.w mode,-(sp)
mode.w #11,-(sp)
trap #13
addq.l #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 Meaning
0 Right shift key
1 Left shift key
2 Control key
3 ALT key
4 Caps Lock on
5 Right mouse button (CLR/HOME)
6 Left mouse button (INSERT)
7 Unused

Example:
move.w #-l,-(sp) Read shift status
move.w #11,-(sp) kbshift
trap #13
addq.l #4,sp

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 (sp)+, ret save Save return address
trap #14 Call XBIOS
move.l retsave,-(sp) Restore return address
rts

.bss
retsave ds.l 1 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 Atari ST Internals

0 initmous initialize mouse

C: void initmous(type, parameter, vector)


int type;
long parameter, vector;

Assembler:
move.l vector,-(sp)
move.l parameter,-(sp)
move.w type,—(sp)
move.w fO,(-sp)
trap #14
add.l #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 Disable mouse
1 Enable mouse, relative mode
2 Enable mouse, absolute mode
3 unused
4 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 topmode
char buttons
char xparam
char 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 xmax
int ymax
int xstart
int 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 tvector,-(sp) Address of the mouse position
move.l tparameter,-(sp) Address of the parameter block
move.w #l,-(sp) Enable relative mouse mode
move.w #0,-(sp) Init mouse
trap #14
add.l #12,sp

parameter dc.b

vector ... Mouse interrupt routine

157
Abacus Software Atari ST Internals

1 SSbrk save memory space


C: long ssbrk(number)
int number;

Assembler:
move.w number,-(sp)
move.w #l,-(sp)
trap #14
addq.l #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 #$400,-(sp) Reserve IK
move.w #l,-(sp) ssbrk
trap #14
addq.l #4,sp

158
Abacus Software Atari ST Internals

2 physbase 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 Atari ST Internals

3 logbd.se 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 Atari ST Internals

4 getrez 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 Atari ST Internals

5 SCtSCreen set screen parameters

C: void setscreen(logadr, physadr, res)


long logadr, physadr;
int res;

Assembler:
move.w res,-(sp)
move.1 physadr,-(sp)
move.1 logadr,-(sp)
move.w #5,-(sp)
trap #14
add.l #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 #-l,-(sp) Retain resolution
move.l #$70000,-(sp) Physical base
move.l #$70000,-(sp) Logical base
move.w #5,-(sp) setscreen
trap #14
add.l #12,sp

162
Abacus Software Atari ST Internals

6 setpalette set color palette


C: void setpalette(paletteptr)
long paletteptr;

Assembler:
move.l paletteptr,-(sp)
move.w #6,-(sp)
trap #14
addq.l #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 #palette,-(sp) Address of the new color palette
move.w #6,-(sp) set palette
trap #14
addq.1 # 6,sp

palette dc.w $777,$700,$070,$007,$111,$222,$333,$444,


$555,$000,$001,$010,$100,$200,$020,$002,
$123,$456

163
Abacus Software Atari ST Internals

7 setcolor set color


C: int setcolor(colornum, color)
int colornum, color

Assembler:
move.w color,-(sp)
move.w colornum,-(sp)
move.w #7,-(sp)
trap #14
addq.1 # 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 #$777,-(sp) Color white
move.w #l,-(sp) As color number 1
move.w #7,-(sp)
trap #14
addq.l #6,sp

164
Abacus Software Atari ST Internals

8 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 count,-(sp)
move.w side,-(sp)
move.w track,-(sp)
move.w sector,-(sp)
move.w dev,-(sp)
clr.l -(sp)
move.l buffer,-(sp)
move.w #8,-(sp)
trap #14
add.l #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 OK, no error
-1 General error
-2 Drive not ready
—3 Unknown command
-4 CRC error
-5 Bad request, invalid command
-6 Seek error, track not found
-7 Unknown media (invalid boot sector)
-8 Sector not found
-9 (No paper)
-10 Write error
-11 Read error
-12 General error
-13 Diskette write protected
-14 Diskette was changed
-15 Unknown device
-16 Bad sector (during verify)
-17 Insert diskette (for connected drive)

Example:
move.w #l,-(sp) Read a sector
move.w #0,-(sp) Page zero
move.w #0,-(sp) Track zero
move.w #l,-(sp) Sector one
move.w #l,-(sp) Drive B
clr.l -(sp)
move.l fbuffer,-(sp)
move.w f8,-(sp) floprd
trap #14
add.l #20,sp
tst dO Did error occur?
bmi error yes

buffer ds.b 512 Buffer for a sector

166
Abacus Software Atari ST Internals

9 flopwr 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 count,-(sp)
move.w side,-(sp)
move.w track,-(sp)
move.w sector,-(sp)
move.w dev,-(sp)
clr.l -(sp)
move.l buffer,-(sp)
move.w #9,-(sp)
trap #14
add.l #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 #3,-(sp) Write three sectors
move.w #0,-(sp) Side zero
move.w #7,-(sp) Track seven
move.w #l,-(sp) Sector one
move.w #0,-(sp) Drive A
clr.l -(sp)
move.l #buffer,-(sp) Address of the buffer
move.w #9,-(sp) flopwr
trap #14
add.l #20,sp
tst dO Did an error occur?
bmi error yes

buffer ds.b 3*512 Buffer for three sectors

167
Abacus Software Atari ST Internals

10 flopfmt 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 virgin,-(sp)
move.l magic,-(sp)
move.w interleave,-(sp)
move.w side,-(sp)
move.w track,-(sp)
move.w spt,-(sp)
move.w dev,-(sp)
clr.l -(sp)
move.l buffer,-(sp)
move.w #10,-(sp)
trap #14
add.l #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 f$E5E5,-(sp) Initial data
move.l #$87654321,-(sp) magic
move.w #l,-(sp) interleave
move.w #0,-(sp) side 0
move.w #79,-(sp) track 79
move.w #9,-(sp) 9 sector per track
move.w #0,-(sp) drive A
clr.l -(sp)
move.w #buffer,-(sp)
move.w #10,-(sp) flopfmt
trap #14
add.l #26,sp
tst dO
bmi error

buffer ds.b $2000 8K buffer

11 unused

169
Abacus Software Atari ST Internals

12 midiws write string to MIDI interface


C: void midiws(count, ptr)
int count;
long ptr;

Assembler:
move.l ptr,-(sp)
move.w count,-(sp)
move.w #12,-(sp)
trap #14
addq.l #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 #string,-(sp) Address of the string
move.w #stringend-string-l,-(sp) Length
move.w #12,-(sp) midiws
trap #14
addq.l #8,sp

string dc.b 'MIDI data"


stringend equ *

170
Abacus Software Atari ST Internals

13 mfpint initialize MFP format

C: void mfpint(number, vector)


int number;
long vector;

Assembler:
move.l vector,-(sp)
move.w number,-(sp)
move.w #13,-(sp)
trap #14
addq.l #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 #busy,-(sp) Busy interrupt routine
move.w #0,-(sp) Vector number 0
move.w #13,-(sp) mfpint
trap #14
addq.l #8,sp
* •* *

busy:

171
Abacus Software Atari ST Internals

14 iorec return record buffer

C: long iorec(dev)
int dev;

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

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

The buffer record for an input device has the following layout:
long ibuf Pointer to an input buffer
int ibufsize Size of the input buffer
int ibufhd Head index
int ibuftl Tail index
int ibuflow Low water mark
int ibufhi 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
Abacus Software Atari ST Internals

Example:
move.w #1,—(sp) Buffer record for keyboard
move.w #14,-(sp) iorec
trap #14
addq.l #4,sp

Result: $9F2
The following table contains the data for all devices:
RS-232 input RS-232 output Keyboard MIDI
Address $9DO ($9DE) $942 $AOO
Buffer address $6DO $7DO $8DO $950
Buffer length $100 $100 $80 $80
Head index 0 0 0 0
Tail index 0 0 0 0
Low water mark $40 $40 $20 $20
High water mark $CO $CO $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 Atari ST Internals

15 rsconf set RS-232 configuration


C: void rsconf(baud, ctrl f ucr, rsr, tsr, scr)
int baud, Ctrl, ucr, rsr, tsr, scr;

Assembler:
move.w scr,—(sp)
move.w tsr,-(sp)
move.w rsr,-(sp)
move.w ucr,-(sp)
move.w ctrl,-(sp)
move.w baud,-(sp)
move.w #15,-(sp)
trap #14
add.l #14,sp

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


parameters have the following signifcance:
scr: Synchronous Character Register in the MFP
tsr: Transmitter Status Register in the MFP
rsr: Receiver Status Register in the MFP
ucr: USART Control Register in the MFP
Ctrl: Communications parameters
baud: 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 Meaning
0 No handshake, default after power-up
1 XON/XOFF
2 RTS/CTS
3 XON/XOFF and RTS/CTS (not useful)

174
Abacus Software Atari ST Internals

The baud parameter contains an indicator for the baud rate:


baud Baud rate
0 19200
1 9600
2 4800
3 3600
4 2400
5 2000
6 1800
7 1200
8 600
9 300
10 200
11 150
12 134
13 110
14 75
15 50

Example:
move.w #-l,-(sp)
move.w #-l,-(sp) Don't change MFP registers
move.w #-l,-(sp)
move.w #-l,-(sp)
move.w #l,-(sp) XON/XOFF
move.w #9,-(sp) 300 baud
move.w #15,-{sp) rsconf
trap #14
add.l #14,sp

175
Abacus Software Atari ST Internals

16 keytbl set keyboard table

C: long keytbl(unshift, shift, capslock)


long unshift, shift, capslock;

Assembler:
move.l capslock,-<sp)
move.l shift,-(sp)
move.l unshift,-(sp)
move.w #16,-(sp)
trap #14
addi.l #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 #-l,-(sp) Don't change caps lock
move.l #shift,-(sp) Shift table
move.l #unshift,-(sp) Table without shift
move.w #16,-(sp)
trap #14
addi.l #14,sp

shift: ...
unshift: ...

176
Abacus Software Atari ST Internals

17 random 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) random
trap #14
addq.l #2,sp

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 execflag,-(sp)
move.w disktype,-(sp)
move.l serialno,-(sp)
move.1 buffer,-(sp)
move.w #18,-(sp)
trap #14
add.l #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 40 track, single sided (180 K)
1 40 track, double sided (360 K)
2 80 track, single sided (360 K)
3 80 track, double sided (720 K)
-1 Disk type remains unchanged

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 40 track DS 80 track SS 80 track DS

0- 1 Branch instruction to boot program if executab:


2- 7 'Loader'
8-10 24-bit serial number
11-12 EPS 512 512 512 512
13 SPC 1 2 2 2
14-15 RES 1 1 1 1
16 FAT 2 2 2 2
17-18 DIR 64 112 112 112
19-20 SEC 360 720 720 1440
21 MEDIA 252 253 248 249
22-23 SPF 2 2 5 5
24-25 SPT 9 9 9 9
26-27 SIDE 1 2 1 2
28-29 HID 0 0 0 0
510-511 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
Abacus Software Atari ST Internals

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 #-l,-(sp) Don't change executability
move.w #3,-(sp) 80 tracks DS
move.l #-l,-(sp) Don't change serial number
move.l #buffer,-(sp)
move.w #18,-(sp) protobt
trap #14
add.l #14,sp

buffer ds.b 512

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

180
Abacus Software Atari ST Internals

19 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 count,-<sp)
move.w side,-(sp)
move.w track,-(sp)
move.w sector,-<sp)
move.w dev,-<sp)
clr.l -(sp)
move.l buffer,-(sp)
move.w #19,-(sp)
trap #14
add.l #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 OK, no error
-1 General error
-2 Drive not ready
-3 Unknown command
-4 CRC error
-5 Bad request, invalid command
-6 Seek error, track not found
-7 Unknown media (invalid boot sector)
—8 Sector not found
-9 (No paper)
-10 Write error
-11 Read error
-12 General error
-13 Diskette write protected
-14 Diskette was changed
-15 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 #l,-(sp) A sector
move.w #0,-(sp) Side zero
move.w #39,-(sp) Track 39
move.w #l,-(sp) Sector 1
move.w #0,-(sp) Drive A
clr.l -(sp)
move.l #buffer,-(sp) Buffer address
move.w #19,-(sp) flopver
trap #14
add.l #16,sp
tst dO Error?
bmi error

182
Abacus Software Atari ST Internals

20 SCrdmp 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) Hardcopy
trap #14 Call XBIOS
addq.l #2,sp

183
Abacus Software Atari ST Internals

21 CUFSCOnf set cursor configuration

C: int cursconf(function, rate)


int function, rate;

Assembler:
move.w rate,-(sp)
move.w function,-(sp)
move.w #21,-(sp)
trap #14
addq. 1 # 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 Meaning
0 Disable cursor
1 Enable cursor
2 Flash cursor
3 Steady cursor
4 Set cursor flash rate
5 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 #20,-(sp) 20/70 seconds
move.w #4,-(sp) Set flash rate
move.w #21,-(sp) cursconf
trap #14
addq.1 # 6,sp

184
Abacus Software Atari ST Internals

22 settime set clock time and date

C: void settime(time)
long time;

Assembler:
move.l time,-(sp)
move.w #22,-(sp)
trap #14
add.l #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 #%1011Q01100000100000000000000,-(sp)
move.w #22,-(sp) settime
trap #14
addq.l #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 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.w #23,-(sp) gettime
trap #14
addq.l #2,sp
move.l dO,time Save time and date

186
Abacus Software Atari ST Internals

24 bioskeys 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) bioskeys
trap #14
addq.l #2,sp

187
Abacus Software Atari ST Internals

25 ikbdws intelligent keyboard send

C: void ikbdws(number, pointer)


int number;
long pointer;

Assembler:
move.l pointer,-(sp)
move.w number,-(sp)
move.w #25,-(sp)
trap #14
addq.l #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 #string,-(sp) Address of the string
move.w #strend-string-l,-(sp) Length minus 1
move.w #25,-(sp) ikbdws
trap #14
addq.l #8,sp

string dc.b $80,1


strend equ *

188
Abacus Software Atari ST Internals

26 jdisint disable interrupts on MFP

C: void jdisint(number)
int number;

Assembler:
move.w number,-(sp)
move.w #26,-(sp)
trap #14
addq.l #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 #10,-(sp) Disable RS-232 transmitter interrupt
move.w #26,-(sp) Disable interrupt
trap #14
addq.l #4,sp

189
Abacus Software Atari ST Internals

27 jenabint enable interrupts on MFP

C: void jenabint(number)
int number;

Assembler:
move.w number,-(sp)
move.w #27,-(sp)
trap #14
addq.l #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 #12,-(sp) Enable RS-232 receiver interrupt
move.w #27,-(sp) Enable interrupt
trap #14
addq.l #4,sp

190
Abacus Software Atari ST Internals

28 giaccess access GI sound chip


C: char giaccess(data, register)
char data;
int register;

Assembler:
move.w #register,-(sp)
move.w #data,-(sp)
move.w #28,-(sp)
trap #14
addq.1 # 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 #$80+3,-(sp) Write register 3
move.w #$50,-(sp) Value to write
move.w #28,-(sp)
trap #14
addq.l #6,sp

191
Abacus Software Atari ST Internals

29 offgibit reset Port A GI sound chip


C: void offgibit(bitnumber)
int bitnumber;

Assembler:
move.w #bitnumber,-<sp)
move.w #29,-(sp)
trap #14
addq.l #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 1: Select drive A
Bit 2: Select drive B
Bit 3: RS-232 RTS (Request To Send)
Bit 4: RS-232 DTR (Data Terminal Ready)
Bit 5: Centronics strobe
Bit 6: General Purpose Output
Bit 7: unused

Example:
move.w #4,-(sp) DTR bit
move.w #29,-(sp) offgibit
trap *14
addq.l #4,sp

192
Abacus Software Atari ST Internals

30 ongibit clear Port A of GI sound chip

C: void ongibit(bitnumber)
int bitnumber;

Assembler:
move.w fbitnumber,-(sp)
move.w #30,-(sp)
trap #14
addq.l #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 #4,-(sp) DTR bit
move.w #30,-(sp) ongibit
trap #14
addq.l #4,sp

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 vector,-(sp)
move.w data,-(sp)
move.w control,-(sp)
move.w timer,-(sp)
move.w #31,-(sp)
trap #14
add.l #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 A :0
Timer B :1
Timer C :2
Timer D :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 A: Reserved for the end user
Timer B: Horizontal blank counter
Timer C: 200 Hz system timer
Timer D: RS-232 baud rate generator
(the interrupt vector is free)

194
Abacus Software .Atari ST Internals

Example:
move.l #vector,-(sp) Interrupt routine
move.w data,-(sp) Data and
move.w control,-(sp) Control registers
move.w #0,-(sp) Timer A
move.w #31,-(sp) xbtimer
trap #14
add.l #12,sp

195
Abacus Software Atari ST Internals

32 dosound set sound parameters

C: void dosound(pointer)
long pointer;

Assembler:
move.l pointer,-(sp)
move.w #32,-(sp)
trap #14
addq.l #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 tpointer,-(sp) Pointer to sound command
move.w #32,-(sp) dosound
trap #14
addq.l #6,sp

pointer 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 config,-(sp)
move.w #33,-(sp)
trap #14
addq.l #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
0 matrix printer daisy-wheel
1 monochrome printer color printer
2 Atari printer Epson printer
3 Test mode Quality mode
4 Centronics port RS-232 port
5 Continuous paper Single-sheet
6-14 reserved
15 always 0

Example:
move.w #%OOQ100,-(sp) Epson printer
move.w #33,-(sp) setprt
trap #14
addq.l #4,sp

198
Abacus Software Atari ST Internals

34 kbdvbase 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 midivec MIDI input


long vkbderr Keyboard error
long vmiderr MIDI error
long statvec IKBD status
long mousevec Mouse routines
long clockvec Clock time routine
long joyvec 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) kbdvbase


trap #14
addq.l #2,sp

199
Abacus Software Atari ST Internals

We get $AOE as the result The vector field contains the following values:
AOE midivec $79C6
A12 vkbderr $759C
A16 vmiderr $759C
A1A statvec '$7034
A1E mousevec $15296
A22 clockvec $6A46
A26 joyvec $7034
A2A MIDI $7556
A2E keyboard $7568

200
Abacus Software Atari ST Internals

35 kbrate set keyboard repeat rate

C: int kbrate(delay, repeat)


int delay, repeat;

Assembler:

move.w repeat,-(sp)
move.w delay,—(sp)
move.w #35,-(sp)
trap #14
addq.1 # 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 #-l,-(sp) Read old values


move.w #-l,-(sp)
move.w #35,-(sp) kbrate
trap #14
addq.l #6,sp

Result: DO = $OB03

201
Abacus Software Atari ST Internals

36 prtblk output block to printer

C: void prtblk(parameter)
long parameter;

Assembler:
move.l parameter,-(sp)
move.w #36,-(sp)
trap #14
addq.1 # 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 blkprt Address of the screen RAM
int offset
int width Screen width
int height Screen height
int left
int right
int scrres Screen resolution (0, 1, or 2)
int dstres Printer resultion (0 or 1)
long colpal Address of the color palette
int type Printer type (0-3)
int port Printer port (0=Centronics, 1=RS232)
long masks Pointer to half-tone mask

Assembler:
move.l ^parameter,-(sp) Address of the parameter block
move.w #36,-(sp) prtblk
trap #14
addq.1 # 6, sp

parameter dc.1 ...

202
Abacus Software Atari ST Internals

37 WVbl 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) wait for wvbl
trap #14
addq.l #2,sp

203
Abacus Software Atari ST Internals

38 SUpexec set supervisor execution

C: void supexec(address)
long address;

Assembler:
move.1 address,-(sp)
move.w #38,-(sp)
trap #14
addq.1 # 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 #address,-(sp)
move.w #38,-(sp)
trap #14
addq.1 # 6,sp

address move.l $400,00

204
Abacus Software Atari ST Internals

39 puntaes 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 Determine address of required variable range
$A001 Set point on the screen
$A002 Determine color of a screen point
$A003 Draw a line on the screen
$A004 Draw a horizontal line (very fast!)
$A005 Fill rectangle with color
$A006 Fill polygon line by line
$A007 Bit block transfer
$A008 Text block transfer
$A009 Enable mouse cursor
$AOOA Disable mouse cursor

206
Abacus Software Atari ST Internals

$AOOB Change mouse cursor form


$AOOC Clear sprite
$AOOD Enable sprite
$AOOE 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
Abacus Software Atari ST Internals

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

o i 319

VIDEO SCREEN

COLOR NUMBER 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)


0 1 2 639

VIDEO SCREEN

COLOR 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 SCREEN

COLOR 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 =
xl coordinate
_Y1 =
yl coordinate
_X2 =
x2 coordinate
_Y2 =
yl coordinate
_FG_BP_1 =
Plane 1 <all three modes)
_FG_BP_2 =
Plane 2 (640x200, 320x200)
_FG_BP_3 =
Plane 3 (only 320x200)
_FG_BP_4 =
Plane 4 (only 320x200)
_LN_MASK =
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 = xl coordinate
_Y1 = yl coordinate
_X2 = x2 coordinate
_FG_BP_1 = Plane 1 (all three modes)
_FG_BP_2 = Plane 2 (640x200, 320x200)
_FG_BP_3 = Plane 3 (only 320x200)
_FG_BP_4 = Plane 4 (only 320x200)
_WRT_MOD = Determines the write mode
_jpatptr = Pointer to the line pattern to use
_patmsk = "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 = xl coordinate, left upper
_Y1 = yl coordinate
_X2 = x2 coordinate, right lower
_Y2 = y2 coordinate
_FG_BP_1 = Plane 1 (all three modes)
_FG_BP_2 = Plane 2 (640x200, 320x200)
_FG_BP_3 = Plane 3 (only 320x200)
_FG_BP_3 = Plane 4 (only 320x200)
_WRT_MOD = Determines the write mode
_jpatptr = Pointer to the fill pattern used
jpatmsk = "Mask" for the fill pattern
_CLIP = Clipping flag
_XMN_CLIP = X minimum for clipping
_XMX_CLIP = X maximum for clipping
_YMN_CLIP = Y minimum for clipping
_YMX_CLIP = 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 = Array with the XY coordinates
CONTRL(l) = Number of coordinate pairs
_Y1 = yl coordinate
_FG_BP_1 = Plane 1 (all three modes)
_FG_BP_2 = Plane 2 (640x200, 320x200)
_FG_BP_3 = Plane 3 (only 320x200)
_FG_BP_3 = Plane 4 (only 320x200)
_WRT_MOD = Determines the write mode
_patptr = Pointer to the fill pattern used
_patmsk = "Mask" for the fill pattern
_CLIP = Clipping flag
_XMN_CLIP = X minimum for clipping
_XMX_CLIP = X maximum for clipping
_YMN_CLIP = Y minimum for clipping
_YMX_CLIP = 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 Font identifier. A number which describes the
font. l=system font
Bytes 2- 3 Font size in points (point is a measure used
in type-setting).
Bytes 4-35 The name of the font as an ASCII string.
Bytes 36-37 The lowest ASCII value of the displayable
characters.
Bytes 38-39 The highest ASCII value of the displayable
characters.
Bytes 40-49 Relative distances of top, ascent, half,
descent, and bottom line from the base line.
Bytes 50-51 Width of the broadest character in the font.
Bytes 52-53 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.
Bytes 54-55 : 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 Write mode
_TEXT_FG Text foreground color
_TEXT_BG Text background color
_FBASE Pointer to the start of the font data
_FWIDTH Width of the font
_SOURCEX X-coordinate of the char in the font
_SOURCEY Y-coordinate of the char in the font
_DESTX X-coordinate of the char on the screen
JDESTY Y-coordinate of the char on the screen
_DELX Width of the character in pixels
_DELY Height of the character in pixels
_STYLE Bit-wise coded flag for special effects
_LITEMASK Bit pattern used for "lightening"
_SKEWMASK Bit pattern used for skewing
_WEIGHT Factor for character enlargement
_R_OFF Right offset of the char for skewing
_L_OFF Left offste of the char for skewing
_SCALE Flag for scaling
_XACC_DDA Accumulator for scaling
_DDA_INC Scaling factor
_T_SCLSTS Scaling direction flag
_CHUP Character rotation vector
_MONO_STATUS Flag for monospaced type
_scrtchp Pointer to buffer for effects
_scrpt2 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 1 : X offset to hot spot
Word 2 : Y offset to hot spot
Word 3 : Format flag 0=VDI format, 1=XOR format
Word 4 : Background color (bg)
Word 5 : 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 6 : Background pattern of the top line
Word 7 : Foreground pattern of the top line
Word 8 : Background pattern of the second line
Word 9 : Foreground pattern of the second line
etc.

The information in the format flag has the following significance:


VDI Format
fg bg Result
0 0 The background appears
0 1 The color in word 4 appears
1 0 The color in word 5 appears
1 1 The color in word 5 appears

XOR Format
fg bg Result
0 0 The background appears
0 1 The color in word 4 appears
1 0 The pixel on the screen is XORed with the fb
bit
1 1 The color in word 5 appears

$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 Size Function

0 v_jp lanes word Number of planes


2 v lin wr word Bytes per scan line
4 CONTRL long Pointer to the CONTRL array
8 INT IN long Pointer to the INTIN array
12 PTSIN long Pointer to the PTSIN array
16 INTOUT long Pointer to the INTOUT array
20 PTSOUT long Pointer to the PTSOUT array
24 _FG_BP_1 word Plane 0 color value
26 _FG_BP_2 word Plane 1 color value
28 _FG_BP_2 word Plane 2 color value
28 _FG_BP_2 word Plane 3 color value
32 _LSTLIN word Should be -1 <$FFFF) (?)
34 _LN_MASK word Line pattern for $A003
36 WRT MODE word Write mode (0=write mode
l=t ransparent
2=XOR mode
3=Inverse trans.)
38 word Xl-coordinate
40 word Yl-coordinate
42 _X2 word X2-coordinate
44 ~Y2 word Y2-coordinate

226
Abacus Software Atari ST Internals

46 _j>atptr long Pointer to the fill pattern


(see $A004)
50 j>atmsk word Fill pattern "mask"
(see $A004)
52 multifill word 0=fill pattern is only for
one plane
l=fill pattern is for multi-
plane
54 _CLIP word 0=no clipping (see $A005)
not 0=clipping
56 _XMN_CLIP word and
58 _YMN_CLIP word define upper left corner of
the visible area for clipping
60 _XMX_CLIP word and
62 _YMX_CLIP word define lower right corner of
the visible area for clipping
64 _XACC_DDA word Should be set to $8000 before
each call to TXTBLT (?)
66 _DDA_INC word Enlargement/reduction factor
$FFFF for enlargement,
reduction doesn't work (?)
68 T SCLSTS word 0=reduction (?)
l=enlargement
70 MONO STATUS word l=not proportional font
0=proportional type or width
of character changed by bold
or italics
72 _SOURCEX word X-coordinate of char in font
74 SOURCEY word 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 _DESTX word X-position of char on screen


78 _DESTY word Y-position of char on screen
80 _DELX word Width of the character
82 DELY word 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 _FBASE long Pointer to start of font data


88 _FWIDTH long Width of font form
90 _STYLE word Flags for special effects
(see $A008)

92 _LITEMASK word Mask for shading


94 _SKEWMASK word Mask for italic type
96 _WEIGHT word Number of bits by which the
character will be expanded
98 _R_OFF word Offset for italic type
100 __L_OFF word Offset for italic type

Note:
The above five variables should be loaded with
the corresponding values from the font header.

102 _SCALE word 0=no scaling


l=scaling (enlarge/reduce)
104 CHUP word Angle for character rotation
0=normal char representation
$384=rotated 90 degrees
$708=rotated 180 degrees
$A8C=rotated 270 degrees
106 _TEXT_FG word Foreground color for text
display
108 _scrtchp long Address of buffer required
for creating special text
effects
112 _scrpt2 word Offset of the enlargement
buffer in the scrtchp buffer
114 _TEXT_BG word Background color for text rep
116 COPYTRAN word (?)

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 equ 8
ptsin equ 12

init equ $aOOO


setpix equ $a001
getpix equ $a002

start:
.dc.w init * call $AOOO
move . 1 intin (aO) , a3 * address of INTIN-arrays
move . 1 ptsin (aO) , a<3 * address of PTSIN-arrays

move #300, (a4) * X coordinate


move #100,2(a4) * Y coordinate

move #1,(a3) * color set, pixel set


0 erase pixel

.dc.w setpix * pixel set

move #300,(a4) * X coordinate


move #100,2(a4) * y coordinate

.dc.w getpix * get color value

* 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 equ 4
ptsin equ 12

fg_bpl equ 24
fg_bp2 equ 26
fg_bp3 equ 28
fg bp4 equ 30
wrt mod equ 36

yi equ 40

patptr equ 46
patmsk equ 50
multifill equ 52
clip equ 54
xmn_clip equ 56
ymn clip equ 58
xmx_clip equ 60
ymx clip equ 62

init equ SaOOO


polygon equ $a006

.dc.w init * address of variable block


from AO

move.w #l,fg_bpl(aO) *set colors for monochrome


clr .w fg_bp2(aO)
clr .w fg_bp3(aO)
clr .w fg_bp4(aO)

move.w 12,wrt mod(aO) * replace mode

230
Abacus Software Atari ST Internals

move . 1 #fill,patptr (aO) * pointer of the fill pattern


move . w #4,patmsk(aO) * four fill patterns
clr .w multifill(aO) * for monochrome
clr .w clip(aO) * no clipping

move . 1 contrl(aO) ,a6 * adddress of CONTRL array


* from A6
addq . 1 #2,a6 * A6 > CONTRL (1)
move . w #3, (a6) * the XY pair in PTSIN

move . 1 ptsin (aO) ,a6 * address PTSIN array from A6


move . 1 #tab,a5 * table of coordinates
move . w #8,d3 * recieve 8 coordinates
loop move . w <a5)+, (a6) +
dbra d3,loop

move . w tlOO,d3 * first scanline


loopl move . w d3,yl(aO) * from Yl
move . 1 aO,-(sp) * restore address variable block

dc.w polygon * fill scanline, AO destroyed

move . 1 (sp)+,aO * AO restored


addq . w #l,d3 * calculate next sacanline
cmp.w #301, d3 * last scan line?
bne loopl * no, next scanline

move . w #l,-(sp) * Code CONIN wait for keypress


trap #1 * Call GEMDOS
addq . 1 #2,sp * stack correction
* rts * subroutine all done
move . w #0,-(sp) * terminate to desktop
trap #1 * Call GEMDOS

fill:
dc.w %1100110011001100
dc.w %0110110110110110
dc.w %0011001100110011
dc.w %1001100110011001

tab:
dc.w 320,100
dc.w 120,320
dc.w 520,300
dc.w 320,100

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 equ $aOOO


show_mouse equ $a009
transmouse equ $aOOb

start:
.dc.w init_a * address INIT from A5

move.1 intin(aO),a5
move #0,6(a5) * INTIN (3) = mask color value
move #l,8(a5) * INTIN (4) = data color value

add.l #10,a5 * a5 > INTIN (5)

lea maus,a4 * data for new cursor


move #16,dO * 32 words = 16 longs

loop:
move.1 ,(a5)+ * transfer INTIN array
dbra dO,loop

.dc.w transmouse * and set form

.dc.w init_a

move.1 intin(aO),aO
clr .w (aO) * Number Hide Cursor -ignore call

.dc.w show mouse * now the new cursor

232
0000000000000000%
0000000000000000% wop-
0000000110000000% M'Op-
0000000110000000%
0000000110000000%
0000000110000000% wop-
0000000110000000% wop-
0000000110000000%
0000000110000000% wop-
0110000110000110%
0110000110000110%
0000011001100000%
0000000110000000%
0000000000000000%
0000000000000000% wop"

0000000000000000%
0000001111000000%
0000001111000000% wop-
0000001111000000%
0000001111000000% wop-
0000001111000000% wop-
0000001111000000%
wop-
1111001111001111% M'Op"

1111001111001111% wop-
«"op-
0111111111111110% M'Op*
0001111111111000%
0000011111100000% wop-
0000000110000000% M-OP"

soawaa IT^D 1#
oq. (ds)-'o# K. ' BAOUI
suop

>[OBq.s I-bppH
SOQW33 11BD 1#
sssjdAe>( joj NINOD 9POO (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
Abacus Software Atari ST Internals

Vector number Address Exception vector meaning


0 $000 Stack pointer after reset
1 $004 Program counter after reset
2 $008 Bus error
3 $OOC Address error
4 $010 Illegal instruction
5 $014 Division by zero
6 $018 CHK instruction
7 $01C TRAPV instruction
8 $020 Priviledge violation
9 $024 Trace
10 $028 Line A emulator
11 $02C Line F emulator
12-14 $030-$038 reserved
15 $03C Uninitialized interrupt
16-23 $040-$05C reserved
24 $060 Spurious interrupt
25 $064 Level 1 interrupt
26 $068 Level 2 interrupt
27 $06C Level 3 interrupt
28 $070 Level 4 interrupt
29 $074 Level 5 interrupt
30 $078 Level 6 interrupt
31 $07C Level 7 interrupt
32 $080 TRAP #0 instruction
33 $084 TRAP fl instruction
34 $088 TRAP #2 instruction
35 $08C TRAP #3 instruction
36 $090 TRAP #4 instruction
37 $094 TRAP #5 instruction
38 $098 TRAP #6 instruction
39 $09C TRAP #7 instruction
40 $OAO TRAP #8 instruction
41 $OA4 TRAP 19 instruction
42 $OA8 TRAP #10 instruction
43 $OAC TRAP #11 instruction
44 $OBO TRAP #12 instruction
45 $OB4 TRAP #13 instruction
46 $OB8 TRAP #14 instruction
47 $OBC TRAP #15 instruction
48-63 $OCO-$OFC reserved
64-255 $100-$3FC User interrupt vectors

235
Abacus Software Atari ST Internals

The following vectors are used on the ST:


Line A emulator $EB9A
Level 2 interrupt $543C
Level 4 interrupt $5452
TRAP #1 GEMDOS $965E
TRAP #2 GEM $2A338
TRAP #13 BIOS $556C
TRAP #14 XBIOS $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) 0 0 0
6 0 0 1
5 0 1 0
4 O i l
3 1 0 0
2 1 0 1
1 1 1 0
0 1 1 1

236
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 Vector number Vector address
IPL 1 25 $64
IPL 2 26 $68
IPL 3 27 $6C
IPL 4 28 $70
IPL 5 29 $74
IPL 6 30 $78
IPL 7 31 $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 HBL, horizontal blank, line return
IPL 4 VBL, vertical blank, picture return
IPL 6 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 As s ignment
15 Monochrome monitor detect
14 RS-232 ring indicator
13 System clock timer A
12 RS-232 receive buffer full
11 RS-232 receive error
10 RS-232 transmit buffer empty
9 RS-232 transmit error
8 Line return counter, timer B
7 Floppy controller and DMA
6 Keyboard and MIDI ACIAs
5 Timer C
4 RS-232 baud rate generator, timer D
3 unused
2 RS-232 CTS
1 RS-232 DCD
0 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 Sample contents

$400 L etv__timer $F526

This is the event timer vector of the GEM. It takes care of the periodic
tasks of GEM.
$404 L 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 L 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 Atari ST Internals

$420 L memvalid $752019F3

If the memory location contains the given value, the configuration of


the memory controller is valid.
$424 W memetrl $0400

This is a copy of the configuration value in the memory controller.


The value given applies for a 512K machine.
$426 L 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 L resvector $FC0008

See above.
$42E L phystop $80000

This is the physical end of the RAM memory; $80000 for a 512K
machine.
$432 L _membot $3B900

The user memory begins here (TPA, transient program area).


$436 L _memtop $78000
This is the upper end of the user memory.
$43A L memval2 $237698AA

This "magic" value together with "memvalid" declares the memory


configuration valid.
$43E W flock 0

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 Atari ST Internals

$440 W seekrate 3

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 Time


0 6 ms
1 12 ms
2 2 ms
3 3 ms

$442 W _timer_ms $14, 20 ms

The time span between two timer calls, 20 ms corresponds to 50 Hz.


$444 W _fverify $FF

If this memory location contains a value other than zero, a verify is


performed after every disk write access.

$446 W _bootdev 0
Contains the device number of the drive from the operating system
was loaded.
$448 W palmode 0

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 W defshiftmod 0

If the Atari is switched from monochrome to color, it gets the new


resolution from here (0=low, 1 medium resolution).
$44C W sshiftmod $200

Here is a copy of the register contents for the screen resolution.


0 320x200, low resolution
1 640x200, medium resolution
2 640x400, high resolution

249
Abacus Software Atari ST Internals

$44E L _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 W vblsem 1

If this variable is zero, the vertical blank routine is not executed.


$454 W nvbls 8
Number of vertical blank routines.
$456 L _vblqueue $4CE
Pointer to a list of nvbls routines which will be executed during the
VBL.
$45A L colorptr 0

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 0

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 L _vbclock $2D26A

Counter for the number of VBL interrupts.


$466 X. _frclock $2D267

Number of VBL routines executed (not disabled by vblsem).


$46A L hdv_init $5AE8
Vector for hard disk initialization.

250
Abacus Software Atari ST Internals

$46E L 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 L hdvjbpb $5B6E

Vector to fetch the BIOS parameter block for a hard disk.

$476 L hdv_rw $5D88

Read/write routine for a hard disk.


$47A L hdvjboot $60B2

Vector to a routine to reboot the hard disk.

$47E L hdvjmediach $5D1E

Media change routine for hard disk.


$482 W _comload 0

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 B contemn 6
Attribute vector for console output
Bit Meaning
0 Key click on/off
1 Key repeat on/off
2 Tone after CTRL G on/off
3 "kbshift" is retured in bits 24-31 for the
BIOS function "conin"

$485 B unused, reserved

$486 L trp!4ret 0

Return address for TRAP #14 call.

251
Abacus Software Atari ST Internals

$48A L criticret 0

Return address of the critical error handler


$48E 4L themd 0

Memory descriptor, filled out by the BIOS function getmpb.


$49E 2W md 0

Space for additional memory descriptors.


$4A2 L savptr $5CE

Pointer to a save area for the processor registers after a BIOS call.

$4A6 W _nflops 2
Number of connected floppy disk drives.

$4 AS L con__state $8AEE
Vector for screen output; set by ESC functions to the appropriate
routine, for example.
$4 AC W save_row 0

Temporary storage for cursor line when positioning the cursor with
ESCY.
$4AE L sav_context 0

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 Atari ST Internals

long BCB $4F8A, pointer to next BCB


int drive -1, drive number or -1
int type 2 buffer type
int rec $41C record number in this buffer
int dirty 0 dirty flag (buffer changed)
long DMD $2854 pointer to drive media descriptor
long buffer $4292 pointer to the buffer itself

$4BA L _hz_200 $71280

Counter for 200 Hz system clock


$4BC 4B the_env 0
Default environment string, four zero bytes.
$4C2 L _drvbits 3

32-bit vector for connected drives. Bit 0 stands for drive A, bit 1 for
drive B, and so on.
$4C6 L _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 L _autopath 0

Pointer to autoexecute path.


$4CE SL _vbl_list $15398,0,0...

List of the standard VBL routines.


$4EE W _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 Atari ST Internals

$4FO W _j>rtabt 0

Printer abort flag due to time-out.

$4F2 L _sysbase $5000

Pointer to start of the operating system.

$4F6 L _shell_p 0

Global shell information.

$4FA L end_os $3B900


Pointer to the end of the operating system in RAM, start of the TPA.
$4FE L 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 assignment—it 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 Branch Always no condition
BCC Branch Carry Clear -C
BCS Branch Carry Set C
BEQ Branch Equal Z
BGE Brangh Greater or Equal N*V/-N*-V
BGT Branch Greater Than N*V*-Z/-N*-V*-Z
BHI Branch Higher -C*-Z
BLE Branch Less or Equal Z/N*-V/-N*V
BLS Branch Lower or Same C/Z
BLT Branch Less Than N*-V/-N*V
BMI Branch Minus N
BNE Branch Not Equal -Z
BPL Branch Plus -N
BVC Branch Overflow Clear -V
BVS Branch Overflow Set 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

3.9 The BIOS Listings - Version 1

Supervisor mode, no interrupts

End of the operating system variables


E
01
4-1
CO 01

Address of the sound chip


rH
CO 43
in <d
en CO 4-1

Resmagic to resvalid
End of the operating system

Start of the operating system


-rl rl
o
id o rH 01 01
CM CO O 4-1 en
4-1 01 CJ 4J c
-rl 0 id
CO
o
id
4-1
CO
CO
CO
o
01
tn
tn
01
4-1 CQ
a
o
o
rl
o
01

4-1
rH
id
ft
c^-
H 01 01 4-1 rH rH T!
PQ 4-1 •o T3 M O
o
in rl rl 01
id rH -a •Q 4-1 0 CO O O O 1 JS
-o •a c m o 01 o

Syncmode
EH id ft rl rH rH
CO en c id o id o ft O CO O CO O O Q id
cu CO o CJ
Load resvector

o 0 -rt 4-1 CO rH cu
HH -H 4-1 4-1 4-1 3 ti rH 01 O CU rl rl rl rl
K CO 01 rl 01 id O 01 CU rl 0 H Ti 4-1 id id id
rl CO id CO 01 rl rH tn -a TJ id X cu cu CU T3
EH o 01 01 4-1 cu O O 01 01 T) T> o 01 rH rH rH G
EH A o CO a rH CJ CJ CJ Ed
#$31415926, $ 4 2 6

#2,$FFFF820A
$FFFF8800,AO

rH O
o
$501E,$42A

# $ 5 0 0 0 , Al
in
# $ 2 7 0 0 , SR

0 0 rH
CJ

#$5FC,AO
CO
o o rH CM O4 10
o CO O o o
$19000

$19BF4

rH CM O
Ed Ed o O in 0 Q CJ H- m IO o rH
* rH o rH rH CM 0 CM </> rH Q
* o o o o O CJ
o m
0 Cu cC 0
o m o
*
•X m m m m O r- V* m 0 O
rH O =8= =tt= Q Q
•*
X
rH
,1
,1

,b

,w
,w
,w

•X

-X 43 rH rH rH rH rH rH 3 01 01 01 01 0! 01 CU 4-1 01 cu 01 id 'H- 01 cu CU CU ^~
id
*
2 o o o O
•a •o •a •o •o •o •a •a E E E
O O O O o o o 01 o O
E E E E
o o 4-1 cu o
E
01 o cu o 43 3 o o o
E E •a
O E
E E G E O
•X 43 rH rH rH CO
•X

X CM CM

•X 0 0
x 0 0 ££
•X o o o
o o CM
* o o CO
*
-X H vo 0 CM CM CO f-, O
•X rH CM 0 0 0 O (V, «gi
•X en CO 0 o O fV, CM
•X un in CO o o [V, fT,
CO
-X Ed o o Ed •=31 m 0 o rH fa r- o Cd r- O CM (V, rv. O CJ CJ o
X rH o o rH 00 o o *3* fv. [V, 0 CJ 0 o o O fT,
O m fa o
X o o CJ O CQ en f^ o rH rv. o o o o o O PM o n f-, in o
m m en m en rH CM o [V, (T) o o o o o O r-. o o fT, 0
*
-X u o o o rH o rH o o CJ en CJ en CJ CJ CJ 0 rtl CO CJ en CJ f£ CO CO Q CJ O o o CO
X rH o o o O o o CM o fa fa fa PQ 03 co o fa fc. en fa Q CJ CJ o O O
o rH o o O o o \S3 o n co rH o rH o rH CO r- co n o rH CM rH PQ o CM o o n
*
X VD o o o O o o O o ^T CM CM ^r rH rH rH rH 0 10 rH •ST CO ^n <r) m n n r- CO PQ
-X
X o CM •c1 CO CJ o *=r CO CJ Cd CM O v£> O O ^O <£ o \£> CO O \£> <£ W 0 ^31 ^D Cd o CM
X o o o o o rH rH rH rH rH CM CM co co ^J1 •q* «qi in m in VJ3 ^o
VD r- — t— [f^
— r- CO CO
X 0 o o o o O O o 0 O o O o o O O O o o 0 O o O o (O
O o o o o O
£ in m m m in
LO in m m m in m m m m m in in in IT) in in in m m m m in in m m
X 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
X o o o o o o o O o o o o o o o o o o o O 0 0 0 0 0 0 o o o o o

268
Abacus Software Atari ST Internals

Sysbase, start of the operating system


Dbaseh, video address for hardware

Fverify, Floppy Verify after write

Dskbufp to $12BC, disk buffer


number of VBL routines
($7FF+1)*16 = 32 K video RAM

Seekrate for floppy to 3 ms

Clear dumpflg for hardcopy


As video address v bs ad

Initialize stack pointer


End os as memory bottom
A
o

01 o
o (U
CD
•o Clear screen
c
0) CO
rd
CM 4-) 4-J
a CO CO -H 0 •o
o o rd
Dbasel

Nvbls,
rH CO C O
1 ft

i Hdv mediach
CO 0 -H
CO 0 CO
q •o 0} >
o x; •H <V G X •o •a
53 CM S K W 33
J203
!201

\5)
in

I
1
m m m m m
1EM
EM
EM
o
0

o
< < vo
CO
CM
CO
< <
o CM EM «j r~ CM r- < sp vo w CM
m <ft- rH < EM r- in in CJ w EM

in
- o
W in in ^
^ Q
H-
+
H- H- CO o
CM
CO o <P
CM •3"
S s S </> in in * •*
•* m in 0 CJ
ft, < •sp
s «
*t

o O 0 0 0 O m CO CO EM" W CM EM 0
O •*^ o *>r *-* ~_ CM in ^p ^p CO "^
^^ ^
^^
pq CO ^O rH PQ •« -~- pjj •sr ~— qi ra fa 0
CO H o «• EM o EM ~— —- rH r-o o 0 0 < Q PQ D o w CM to- CM CM O
Q

in s
«• *
CO
0 •=r
m
«•
</> <o *

0
Q

o
Q
O O rH
Q Q Q
m
co
in in
* «• «•
sS
SP CO
«•
m in
* * *
IT)

* *
V*
EM
•=P
<«• <f*
CO
<n *
co
5 "t
<3< co <n-
«• =s=
*
EM

*
in
=8=

rH rH ^ 43 £ rH rH rH H rH rH rH rH rH rH rH rH rH rH 9 9 rH 9 rH
i~H
0) ""1 <U (U 0) 0) (U (U P rd <0 <S> (U (U 0) 0) (U (U <u CD 0) CO 0) W CD
P
d) 43
K,
(Q
c 3 O O O O O O O O O 0) O o O |O O 0 o O (U o 0 o O 0
43 1 CO g S E € o rH s g rH CO s

rH CO < w vo CM w rt IQ CM
0 0 CM CM t£> r~ r- — r~
^i •31 ^i ^^ SP t"5P
o CM
CM CM *?p "d1 •a1
CO CO 0 0 0 0 0 0 o 0 0
o EM CM rH O o CO CO (4 CM a \Q CM ,-£ sp o CJ w o
o CM EM CM o o pq CO \0 rH CO CO CM m •a1 pq o
0 EM EM CO o o f^ Q PQ Q O w *?p CM •=r o
CO CM CM o o in m in m v^5 o O CO o o rH O in
M o w EM O CM IQ pq m \o ngi 03 o o o o O w o CO «gi CO O CM
f£ o
CM o in CM EM m vo fyt o O o 0 o o O EM o o ^P o o EM o
•a10 ^p •31 •^p CM EM t— EM o o o o o 0 O •*p o 0 ^P o 0 EM 0
O 0 o O 0 O PT, p-. CO EM o o o o o 0 o o 0 o 0 0 0 0 EM 0
i4j Q CJ CO Q Q U o o O O en rij o •31 CO CO CJ CJ CJ CJ o Q Q en o Q CJ CJ CJ o
{_) o
EM
«3
U3 CM ^1
O rH PQ
CM cn CM
[V] CM* CO
CO CO CM
rH rH CO
o o
CM
CJ CJ
O o
CM CM CM
O [^ o^
rH
m
O
CM
CJ
o
O pr. [y^ pq f- p** f*.
(— rH CO CO PQ PQ
to •0- CM CM CM CM CM CM CM
[•*»
PQ m
vo V£)
PQ PQ EM
CM
EM

CM
w r-
0 pq pq pq
•=P
sm
CO CO CM
p-*

CO
[-
pq
CM

•=? \O < O SP CJ 9 CO <=c CJ w o •=r CO H O sp CJ QI CJ •=3" CJ •=r CJ CM CO w ^p CO w ^o CJ


CO CO CO cn Cft cn r^ <^ CP
pq pq w EM
< fQ rH rH rH CM CM PQ CJ O CJ Q Q CM CM O o o
o o 0 o o o O O o O o o o o o o O O H H H H H O 0 O O O O rH H H
in in in m m 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
0 o o o o 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 0 o 0 o 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
Abacus Software Atari ST Internals

|
|
|
|

|
|

|
|
|
|

|
|
|

|
|

|
Cartbase, Diagnostic cartrige inserted?

Horizontal Blank Interrupt, IPL2


Vertical Blank Interrupt, IPL4
rH rH

Yes, don't initialize vectors


1

'Division by zero 1 to rte


CM CM

Cart scan, test cartridge


CJ CO CO
fa P

As pointer to vblqueue
m -H -H
to
U
o G 0 G
-H SH -H

Etv critic vector


Number of vectors
Terminate process

S-l
to CO 01 (H CO

Initialize MFP
CO -H 0! S-l p CO
Pointer to rte

o SH p
Pointer to rts

CO 01
S-l 4-1 M
Ei 0! ,Q SH O O

Next vector

Next vector
R 01 4-1 O
p 0 SH
Set vector
S-l 4-1 4-1
to

8 vectors
O ra p 4-1 P 01
01 e p to

1 TRAP #13 vector


C -H G -rl
.a 0) CM rH CO rH
M CO -H 01 -H

1 LINE A vector
SH
•o O 4-1 0) * * 4J 4-1 rH SH G S-l
ca
ffl O rH 0) 4J 01
•a 0) P C! K 4-1 P rH -H rH
cn en H EH CJ PQ O
\0000

5)
m
1
1

io fa to in to m m <
CO to rH rH rH

CM vo fa o CO CO CO m o in < io
m O
+
O r- vo in PQ PQ CM
£
to o CJ CO CJ 0 o o to to to vo
Q. /-> CO iO vo
#$10001

CM /•>
#$5562,
#$556C,
#$543C,
#$2000(

CO CM Q o rH CM 00 vo 0 0 m
o CM CO to w CO
CM o m tH m CO vo en o to CM 0 in
fa CO CM ro Q <O in PQ w to Q to D fa tZ
in in in CO fa rH CO in m CJ O CM
to to in m to to in CO rH o to CO to o 0 VO CM in in
=»= to to to •CO to =»= Q =8= =*> S; to Q =st= to
rH
a
,1
,1

,1

rH rH rH rH rH rH rH rH i-H r-l &


i—i
L

1 —1 < 1 « —1
01 01 ca 01 01 0) 01 01 01 . ra 01

i
01 01 01 (0 01 01 01 01
(0 ca d, tr CB •o <a *Q SH £> J> > ca J_l S-4
o O 0) 01 s 01 01 Ti 01 o 0 T) O 0 o 0 o 0 O 0 0 O 01 O ^
0 H CO 0 CO ^
p
g rH rH Cl rH ta rH ta rH O A CO
o
o
o
0
CM w O 00 ^J1 CO 00 *^T
f3* vo fa
*^ r- vo PQ PQ CM 0
"-T •a1 o o o
o O 0 •a1
O o o o 0
o 0 0 0
CJ CO fa 0 CO o ql CM CJ vo CJ CM
fa CM IO 0 o o rH in CO vo vo cn VO
m CO CO 0 0 o O sp ^Jl in m PQ to
0 in CM o o o O m in to m to
0 o CJ W CM f-10 0 Q o vo o 0 o CO o o o 0 o CO w vo (— o ^p P3J
0 o fa Q to Q o 0 CO o fa o o o CO o o o o o o o m o rH CM
o o CO rH (^C VO CM o o rH fa 0 o 0 o 0 o 0 ^p 0 fa 0 ^r Q rH
o o o O fa o o o o 0 fa 0 o 0 o 0 o 0 o 0 0 0 o 0 rH O
o CJ sC <s
p^ [^- fa fa
en VO f£ o en CJ en CJ CO PQ CJ CJ PQ o CJ o o o O Q CO CJ CO CO O CM Q O
PQ CM fa fa fa CJ fa O O p-. r- q* t— t— r- Q1 c— "a1 co C3> o O 0 o CJ
PQ PQ t— CTl CJ r^ CO CO rH 0 0 n rH CO PQ PQ PQ PQ PQ PQ PQ PQ PQ rH CQ o CM rH rH O rH PQ
CM CM sp •a* 0 vo •a1 Q W CO CM Q to CM CM CM CM CM CM CM CM CM CM «< CM co to VO r- VO en
•=r CJ •=r CO CJ vo CO o CM 00 CJ W •a- CO w VO w CM f£
VO CO o o CM vo CM pj.
w vo < w CM
CO CO •3* *T to m m •a1 VO vo VO vo r^ r- r~
CO en cn CO CJ O 0 CJ Q Q Q rtj PQ PQ ffl
rH rH rH rH rH rH rH rH rH rH <H rH <H rH H rH H rH r^rH
H rH rH rH rH rH rH rH rH rH rH rH rH
m to m m m m in in m 10 m in m in in m in in in in m m 10 m m in to IO in in to
o O o o o O o o O O o 0 o 0 o 0 0 0 0 0 0 0 O 0 o o o O O o o O
o O o o 0 o o 0 0 0 o o o o o o o o o o O o o 0 o 0 o 0 O 0 o O

270
Abacus Software Atari ST Internals

r next picture return


r next picture return

ution to monochrome
CO

ect low resolution


!>•

monochrome detect
M
0 X
rH 01
O -rl
O

t cartridge
cartridge
ram shifter
0 JJ
monitor ? •M 3 O
0.
— 4J
C" 0 O <H
rH
rH C 0!
o 43

CU
<D 01
-H
CO

t
T) -p !H
o o rH G. 0) g rH •a tr> P m o Oi 01 o T) rl *•
H-I MH o -H g jj C" cu g o rH rH 01 0) o cu rH cu Q m O cs
tn tt, o IH 01 JJ H 0 cu JJ jj o 01 p^
4J JJ (U & -H 0) !-4 <H G. 01 m cu M rl H CU rH M CM
-rH -H M A A TS cu -H w O N IH CU •*. 0) «. N p o cu 0) •
<0 (0 PJ O 01 O 01 jq fc. H rH -H O fi CO 43 c -H IS O cu s g Q
s S JJ PH O IH s -H 01•O 0 rH 43 K Q a g rH jj •a <a x: <3 m 13
rH s; c 01 £ 0] g g O <B g P 0 0 P 0 <a o <3 CU 0) C c rf!
P o •a M H p 3 -H •o cu C OJ JJ C 01 -H o o rH S
^
ti
^
£j S IH J., rH 43 o rH
in ;§ •o
O CU 01 rH rH

o E?i5
rH (0
43 01 01 fl > -H JJ JJtJ r. <3 rH rH O
£, 0) 0) o cu o O JJ a CU o c •o 43 -H eg en -H m c 01 g 0 c p p P U
s S Q EH 0 CJ >H O <n W > O M CQ o M Q CJ IS M < 1Z •Z ~

CM
CO
PH ^-,
EH m
EH rt!
FFFAOl

O EH —
o
Q 1O CM - VO

CJ o CJ
in

O EH CM - CM - PH P-,
*—f
EH «qi EH 00 fv) (jQ o "*-" •*_<r

«3i O PH — 0 ft. •gipr^O^PEH^TrH^1 p £ ) O O P 4 O O CM o pq Q Q (3J ^-K

•31 Q
(3n

EH r< Q EH < n - « - Q r H E H C J O « - E H C O Q p H t — E H C M VO m •31 W Q r-


U") •* «. rH •SP rs rH v K ^ C M E H V O i n - C M C M - C M T C M C O CM w en CM CM CN (<
m CM 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 in CO m m m iO ^-
«• =«= =8= •u> </> *#= •t/> Q Q Q = S = < « - « > « > * = * Q « - = t 1 = = ( » : - u > « > < n - < ' > </> «> </> <o «/> ^> 1

rQ ,Q
43 43 15
• 43 43 • • 43 • cr

w a)
O P
> co cr > a P
O JJ CU O
0)
g

rH
M > > a. cu Q>
- <u 0) •
rH O O g G O
>
CU CU
> H SH > IH
CD
JJ O1
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
43 g 43 43 g O 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

EH CM
PH in
EH
EH o
EH W o CM
PH o CO
CM CM o o
EH CO CO EH m o
r< VO CM C— CM PH o o O O VD «=P O O ^ P£) en in
VO VO O O O o PH o oo Q O O CO CM* O VO EH en en
(O CO O O O o EH o o o o co O CM O O o o O VO
o o O O O O EH o FH o o o O CM o o co oo o
o o cj en 0 CJ CM o o o en en cj CJ O CJ O O o on co o o
o o CO CO CO O o -a- CJ CO EH EH O EH O O O P~ rH O O r- r~ r~ vo
O CO O Q CM ffl CO o CO pq CO rH VO rH < I— rH rH co co co CM
rH O CQ VQ pq CO CO VO *3* VO "3* VO VO VO
CO CJ O -sp CJ M CM VO CM O O VO CM CO KC CM VO .<
Q Q W W W (4 rH rH 0
<h^ 0
*^ 0 PH PH
v-/ ri—iH r*—i
H CVN
M Cv^i M C(• O
M C<.^i t Cv 1O
* C\' O
t C*' O
i C>.' O in ui
I ^p **r ^" "^p ui m ut in
m uf
rH rH rH rH 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
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
tfo

er
-H
•a
3
G 0)
M M
0! 01 01 01
n 4-1 rH
o -H tj^ 3 01 g C •o
4-) !H n C n g tn (0 -H •a
<0 T3 01 -H TS <0 G M O <a
O
-H
•a
01
A
4
g
P
is
01
G -H
0) 0> H
4-> H 4J
tr>
0
M X
ft
01
ej>
G 4-> G (0 -H 01 ft O <a
rH >H H (0 ft
1H 01 rH P 4-> •o rH 4->
O > -H O G G 01 (0 10 0! 01
-H 4J rH -H 01 g e o O ra
1 1 (0
. . G > 18 (0 10 rH 0)
01 -O 01 01 O 4J O G G OT 0 X! o
0) fc,
0 0!
a) O 0
ftI ft
O T 3 O O O < G C P P
!3 sC CJ CJ PQ - M W B B
O - 0 1 > r H r H 01
x:
ta
W 0
O O
M
E
to
01
W

CM
en
o
fa «
fa PJ
o O — u v Q
o B
Pn o o
Q Q S- ^ II
W W W CM ~ VO CM+ w Q Q — Q W
U o ~ vo a —
w I CQ CM I H m
O
EH
t<
rH S
CM CM O CM CM CM O - CM •• O
m m in ff, in o m m m m in o in m PIJ * o

• X!
01 01 01 01 0! 0! ft • 01 01 01 01 01 ft • X! X! X)
(0 r-l (0 t> ft 01 > > > <o <o ra • > <S "O > > (0 > > > (0 T! ft • • •
!H 01 ai o g e _ ft
o o o -a 01 01 01 O "O O O 01 O O l O O M t J g O O O
X! X) -H g o xi g X) g <a ft ft ft g £ 4 - > i 0 5 g f t g f t g e -n TS *^3 "O
CM
m
o
m
CO w
o CM
o
o
4879000052ED

(M O
487900000502

H CM
fa o O
•=p in o a fa
o o o m ro fa
n o M o o in "31 PQ
3F3C004B
005280 D03C0041

487A0059
3F3C0005

ft, VO CM M O CO O
W vo o CM o O O O CO O -3" o o o
vo o in O o o o o o o o o o o
o o o O o o o o o o o o o m in
Ci o < cj O CM a\o -5P cyi 0 CJOC^CflcO<OCJ - <* <H «C
m o fa r~ rH O CO f a ^ * [ — r ~ ~ o t — coro fa fa "31 CO
O rH rH CM O vo •31 CM <! O O rH CO fa CO fa fa O co
VO VO *3* ro CM rH VO rH rH CM CM CM "3* CO CO Q m CM
•31 vo co f=c vo . . -' VO . W. . CM -3> CO
005286

005296
005292

O CM VO <
00529A

W CM
00528C

VO VO VO VO vo r~ c— r- r~ t— CO f S r t r i l C Q p q pPQc i Op qCJ
o cOj O O Q Q
CM CM CM CM CM CM CM CM CM 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
m in in m in m in in m in m m inininininininminininininin
o o o o o o 0 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 o o o o o o o o o o o o o o o o o o o

272
0052E4 4700
0052E6 47454D2E505247 dc.b 'GEM.PRG'
0052ED 000000 dc.b 0,0,0
**************************************************** Dskboot, boot from disk
0052FO 7003 moveq.l #3,DO Bit number 3
0052F2 610A bsr $52FE Test cartridge
0052F4 20790000047A move.l $47A,AO Hdv boot, load boot vector
0052FA 4E90 jsr (AO) And start attempt
0052FC 4E75 rts
***************************************************** Test cartridge
0052FE 41F900FAOOOO lea $FAOOOO,AO Cartbase
005304 OC98ABCDEF42 cmp.l #$ABCDEF42,(A0)+ User cartridge inserted ?
00530A 661A bne $5326 No
N>
00530C 01280004 btst DO,4(AO) Initialization ?
-J
005310 670E beq $5320 No
005312 48E7FFFE movem.l DO-D7/AO-A6,-(A7) Save registers
005316 20680004 move.l 4(AO),AO Address of the init routine
00531A 4E90 jsr (AO) Perform initialization
00531C 4CDF7FFF movem.l (A7)+,DO-D7/AO-A6 Restore registers
005320 4A90 tst.l (AO) Additional application in cartridge ?
005322 2050 move.l (AO),AO Get link address
005324 66E6 bne $530C Initialization next application
005326 4E75 rts
***************************************************
005328 4E75 rts Default vector
**************************************************** Memory test
a
00532A D1C1 add.l D1,AO Add offset to base address to
00532C 4240 clr.w DO Clear test pattern
CO
00532E 43E801F8 lea $1F8(AO), End address of the test rs
005332 B058 cmp.w (AO)+,DO Test memory contents en
005334 6608 bne $533E Unequal,' terminate
005336 D07CFA54 add.w #$FA54,DO Create next test pattern
00533A B3C8 cmp.l AO,A1 End address reached ?
00533C 66F4 bne $5332 No, continue test
00533E 4ED5 jmp (A5) Back to the calling address
****************************************************
005340 9BCD sub.l A5,A5
005342 OCAD752019F30420 cmp.l #1965038067,$420(A5) Memvalid
00534A 6608 bne $5354
00534C OCAD237698AA043A cmp.l #594974890,$43A(A5) Memval2
005354 4ED6 jmp (A6)
******************************************************
005356 00000000
00535A 00000000
00535E 00000000
005362 00000000
*******************************************************
005366 1839FFFF8260 move.b $FFFF8260,D4 Shiftmd, Get video resolution
00536C C87C0003 and.w #3,D4 Isolate bits 0 and 1
005370 D844 add.w D4,D4 Double value for word table
005372 B1FC00008000 cmp.l #$8000,AO I
005378 6220 bhi $539A CM
00537A B1FCOOOOOOOO cmp.l #0,AO
H
005380 6604 bne $5386 a
I—t
**•
005382
005386
307B4086
4280
move.w
clr.l
$530A(PC,D4.w) ,AO
DO
1
ta
SP
005388 1039FFFF8201 move . b $FFFF8201,DO Dbaseh
00538E E148 Isl.w #8, DO g
005390 1039FFFF8203 move . b $FFFF8203,DO Dbasel
005396 E188 lsl.1 #8, DO en
o
005398 D1CO add.l DO,AO
00539A 7EOF moveq . 1#15,07
00539C 3C3B4078 move . w $5416(PC,D4.w) ,D6
0053AO 3605 move . w D5,D3
0053A2 2448 move . 1 AO,A2
0053A4 D4FB406A add.w $5410(PC,D4.w),A2
0053A8 1011 move . b (A1),DO
0053AA 4BFA0004 lea $53BO(PC),A5
0053AE 6042 bra $53F2
0053BO 3202 move . w D2,D1
0053B2 10290001 move . b 1(A1),DO
N>
0053B6 4BFA0004 lea $53BC(PC),A5
0053BA 6036 bra $53F2
0053BC 3011 move . w (A1),DO
0053BE 4EFB4002 jmp $53C2(PC,D4.w)
0053C2 6004 bra $53C8 Low resolution
0053C4 600C bra $5302 Medium resolution
0053C6 6014 bra $53DC High resolution
***************************************************** Low resolution
0053C8 30CO move.w DO,(A0)+
0053CA 30CO move.w DO,(A0)+
0053CC 30CO move.w DO,(A0)+
0053CE 30CO move.w DO,(A0)+ cn
H
0053DO 600E bra $53EO
5.
***************************************************** Medium resolution
0053D2 30C1 move.w D1,(AO)+
Abacus Software Atari ST Internals

c
o
-H rH
1H rH
3 rH
10
0 O
ra H
ca o
0 4-1

,SR Restore carry flag


Cn § O
-H CO 10

************
•X

*
•X

*
*
-X CO 0 o CO

o o o * 0 o
<
CO CO CO CO
«; 0 * in o m f—) in co CM CO o 1 CM + CM in CO -X CM CM vo
-— " * — < Q Q D t— CO o 0
* f-
Q Q Q
n") * — in o
rH CM CM m rH CM CO CM VO CM ,-. CO O r~ rH PS rH < ,_| CO co vo vo vo vo
Q Q Q ^
•X Q Q Q Q a —' Q 3t= =*£ =H= w =«= Q rij •—• * rH rH rH rH rH
•X * * *
.£ rH rH *
& IS 15 •X 3 & rH £5 rH
*r! >-<H
43 f a rH •*
X
*
move.

move,

move.
move.
move.

move.

move.

move.
move.

movec
movec

*
s
m
M 1 cd
43
•o 1 cd
-8•a1 M
€ •n
rH

O
i-H
X
O 0
S-t 1
10

0 t
•n
*
•X
-X
•X
0 0
IS
o 0 o
•o •o •o -a •o
S

•X
•X *
•X *
•X *
•X
•X
*
-X
.£ *
-X *
•X
-X
*
•X
*
-X -X
•X -X
•X -X
-X vo Ed CO ^31 •X
•X CJ (=£ m P»4
-*
•X ptj fa [V|
fa X
-X PT-|
fa fa
rH CM 03 <j W c^ fa
CM
rH CM CM sr •X VO CO 0 r- 0 r- CM fa CM ffi 03 m * CO CO ^p o o
CJ o CJ 0 o CJ O •=p CJ ^p O Q sp 0 0 rH Ed IO Q in O o Q * o CJ '-C
O 0 O o * 0 o o •rjl Ed vo •31 vo CO 0 co VO co vo *
•X ^d o o
Ed E ^
(0 CO CO vo *
•X CO CO m CM m in in CM r-- t— Ed •a1 Ed irr. Ed m CM sp -X CO CO CO o o
•X
^p vo CO <J •X o Ed o •3* vo o O vo CO <C CJ
CM qi td o CM VO CO *
•X CJ Ed o CM
Q Q Q Q •X Q Q ^
Ed Ed Ed Ed Ed fafa fa fa fa fa
fa fa o 0 o 0 •X o
^ 0 o rH rH
co co CO CO •X CO co CO CO CO CO CO CO CO (O CO CO CO
CO CO •3* ^F •=? •X ^p sp sp SP SP
m in in in m m in in m m m in m m in in in m in m in ^
m m in m m in m
o o 0 o * o 0 o 0 0 o 0 o 0 0 o 0 0 0 0 o 0 0 0 *
-X 0 0 o 0 0
o o o o ^
•X o o o o o 0 o o o o o o o o o o o o o -X o o o o o

276
Abacus Software Atari ST Internals

CD
CD
CD (0 SH
•p S 4-> &
4-1 G O G t
<a c: >^ CD rH CD CD CD
rH CD CD TS CD p O> 3
<a CD (U SH CD rH ca rH
P. a M tJ> cn g ,Q
u ; i &
>!

rl 0) G 0 B 1 ^j -P 4J 4J 4-> 4-> 4J y
o CD rH CD CD c** r-; O
rH-H TS CD rH 3 CT> P O^ CD O> tP tyi 23* O1 571 C{3
O g* COj
CD rH -H H -H -H -r) •r) -H -H rH
o S O m S « rP r^
^ ^

•it
•it
*
*
•it
*
•u
•it
_ o o — O
•it <^ Q Q CM Q
* —X O o +
•it
* r- o O O r- c^ t— in co co co CO [— r- O [ I r~ o o —
r- o [— r- 0 0 r- m ro co r- f^ CO CO r- 0 •. rt; r* <a* co c^
o *
-iC r- r~ O r— o r- o in CO t— co r- co i— ro 0 o *— <f> in -u> <;
CO O O O •it ift- </> •c/> </> -u> in </> </> </> </> <*> -c/> t/> •u>- 1ft Q CM *«•=»= —
•it
-it

S S S S *
-it S IS S S S S S S S S S S 3 S s s 0)
> CD
0 0 0 0 •it 0 0 O 0 0 O , o.
.:. 0 ,- 0 O O 0 0 O o o O O O 4J
TS TS TS TS •it TS TS TS •o TS TS TS TS TS TS TS TS TS TS TS TS s s S n
•it
•it
*
•it
*
•it
•it
-*
it CM
O
* O
*
•it O
CM O o
•it O O o
-it o r- CO
o o o
* O O o [— [—
— in CO CO CO
O O O rH t— CO 1— r-r~ O O fn O «>
Er-
in o o o •it
* r- o r~ r~ O O m CO CO co r^ o O CM C~ O
o o o o r^ [^ o r— O r— o m co r- CO CO o o o
o o o o * o o o o o o o o o o o [— [—
0 0 0 0 o n CO O O CO
*
•31 V£< CO ff. •*Jc U H o CM SJI vo CO (3j O M o vo COCM ^p <J CJ W CM «> CO W O
rH rH rH rH rH rH CM CM CM CM CM CM CM CM CO co coCO CO CO
SP "a1 "a1 *3* -it ^P ^p T •=3* ^t ST
* •a* •a1 <3* ^ •a1 ^p •a1
in in in in •it m m in m m in m m m m m tn m in in m in in in in m m m
o o o o •it o 0 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 0 o o o o o o o o o o o o 0 o o o o o o o o o
*

277
•X
-X

-X
•X

•X
•X
•X

-X

•X
-X

-X
•X
•X
-X
•X

-X
•X
•X
-X
-X
-X

•x
*
*
*
M

*
0)

pa

-X
-H

*
*
*
*
4-1

*
J

*
C

*
*
4-1

*
*
3
O.

CM
pa

CM

LO
LO
LO

*^T*
00000466 addq.l #1,$466 Increment frclock

CO

LO
LO
CO
LO

^p
00000452 subq.w #1,$452 Vblsem

pa

m
w
OODC bmi $553C VBL interrupt disabled ?

LO
^p
CO
vo •=r
CM

LO
VO
•C1
FFFE movem.l DO-D7/AO-A6, - (A7) Save registers

CM
m
VO

LO
00000462 addq.l #1,$462 Increment vbclock erh\hen

* o o o o o
* O O o O o
Abacus Software

LO

CJ
rH
CD
(0

in
in

CO
p
43*

en

LO
O
FFFF8260 move.b $FFFF8260,DO Load shiftmd
0003 and.b #3, DO
0002 cmp.b #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 ?

278
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

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
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

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

o o o o o o o o o o o o o o o o o o o o o
sub.l A5,A5 Clear A5
045A tst.l $45A(A5) Colorptr, reload color palette ?

LO
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 <
Q

o o o o o o o o o o o o o o o o o o o o o
0
3
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
o

m
CO

vt
Q

rH
0!
43

LO
CO

vo

m
tr

o
0
045A move.l $ 4 5 A ( A 5 ) , A O Colorptr, address of the new palette

o
o
H 0
FFFF8240 lea $FFFF8240,A1 ColorO, address in the video shifter

VO fa CO
CM SP CO
O CO O

IO LO LO
•a1 <
U CJ O
Q en cj
OOOF move.w #$F,DO 16 colors

0 0
0 0
Atari ST Internals
Abacus Software Atari ST Internals

, new video address ?


01
cu

hardcopy desired ?
-H

restore VBL again


4->
•o 01 p
(0 (U O MO)
-H M CU P
a -p 01

ecute routine
01
C 43 (X 1-3 C P
-H o m p cr G
(0 > rH > O rH -r)
cn 4-1 0 43 (0

registers
registers
Q.

t vector
(0 <H >
M O <o

routine
4J 10
O MO)

isters
M
4-) 4-> m M 43 .£ Cr>
a, a 0) P. "0 4J rH
!H c 0) 43
M 0 CD T C £ 01 O 4-1 !H
O rH CD m r H C M J S - H 3 ! H 4 - l O O
H O 4J M rH 0) 1 CD 4-1 G O 4-J x er> x m «-. >i p
O u a 0 T3 1 0} VO 01 3 4 J 4 J 0 1 O cu cu CD (U CU t< tr> P. -0 0) -
CJ c 03 fd C O I O r H < O O - . U M O I C U C*i M •P ^H G rH O M E
H (U 43 43 M 01 CU CD <D > 4-1 3 0 1-1 O >H O CD
> -p <0 01 >1 01 0 1 T 3 0 1 T 3 rH > > >-l 0 - CD 0 4-1 4-1 <fl ft. •C 10 4J 01
a K <1) QH> ,Q 4-1 4-> i-3 43 C T) 4-> CD 01 01 CD e M CD 01 rH
O CD rH o o O - H O - r ) O m > O O T 3 C U CD O (0 X CD CD rH j3 O H) rH CU 43
CJ 13 CJ CO S3 CJ > ( D E H f f l E H > 3 , 3 C J f < U N Q W PS EH CJ Q a cs cj

VO

o
$45E(A5),$4'

-t- o o 0 o H
Q CM CM t~- Q
rH CO CO 1
w fa rH
-V
CJ in- 0
in m m fa i Q m
$456, AO

CJ fa 0 Q CM
Q rH in fa in
H- m CO — o o r~ o 0 m m CO o fa
w fa W Q a CM O CM m w n VO fa
o in m VO in m O O in rH c- H m < fa r~
o
Q
m
«• m
^r CO O
o
CO
3t=
o
Q
m rH

*
in
TO- Q
r-
Q
in m
a rH
in
rH H rH
S
.1

S S
.1

rH 43 rH
rH £ rH s" e
io trcu s
rH

CD
O
M
rH
4-1
ol
g,

01
cu
o
>
O
H
01
CD
O 01
> j_,
0
>
p o
CU
0
ci,
e cu
O1
CU
0 ^
0)
0)
0
2 43'p ^ 01
cu j_,
0]
CD
O
01

o
cr
•a
•a
CD
4-1
€ U 4-1 43 S rH rH 43 5 43 01 o 43 -r-1 € 01 4-1 43 m SH

nq

o
H o rH ^r VOo 0 CM
•a1 0 0 m m o o LO
^ CM CM «SJ1 sp o o "ST
o CO CO 0 o 0 o O
CJ <J W w [V] fa fa ,e£ 0 o o O o <c W CM fa fa 0
m m m •vP fa fa H 0 0 0 CO CO w f£J fa fa 0
fa ^p •=r ^p *J* [V, rH o o o rH rH fa ^31 in fa fa o
fa o 0 o O fa fa <H o o o O O fa O 0 fa r- o
CO CO Q Q Q Q CO 0 CO 0 O en 0 r~ en CO CJ f Q Q CJ 0 o fa cn ro
rH fa fa
D O |C£ rS£ ^
rH VO CM -3* o o
^31 O m CM CO t — m ^ f£) cn Q
O O VO 0 0 fa Q r- o
CM rH CM <; r- m O O o rH PJ r- C^) 0 CM n r- CO iy CJ rH 03 rfl VO rH n CJ CM W
m m •5P •3* vo CM CM P4 rH w "-* VO o VO in CM CM CQ vo •a- ^p •=P in en •0- VO VO n in •=r
w o <=r CO CJ CJ •a* VO <c CJ o
H •=P CO < o CM CO CM •^ VO CJ w <^p
VO pj; CJ o CO u CM
CJ Q Q Q o Q M PJ w fa fa
fa rH rH rH rH CM O 0 O 0 o CMCM CM CM n CO •sP
"31 *3< ^r •a* •31 •gl ^p ^p ^r •=r
•vP KP in m m m m in m in in m m m in in in in in in
in in m 10 m m in in m m m m m in in m 10 in \n m in in in m in in in m in m
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 0 o 0 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 o o o o o o o o

279
********** ************************************** Wvbl, wait for next V-sync
M
005544 40E7 move.w SR, -(A7) Save status O
005546 027CF8FF and.w #$F8FF,SR IPL 0, allow interrupts e
X
00554A 203900000466 move . 1 $466,00 Load frclock en
o
005550 BOB900000466 cmp.l $466,00 Frclock
005556 67F8 beq $5550 Still equal ?
005558 46DF move . w (A7)+,SR Restore status
00555A 4E75 rts
**************************************************** Critical error handler
00555C 2F3900000404 move.l $404,-(A7) Etv critic
005562 70FP moveq.l #-l,DO
005564 4E75 rts
**************************************************** TRAP #14
005566 41FA0084 lea $55EC(PC),AO Address of the TRAP #14 routines
00556A 6004 bra $5570
***************************************************** TRAP #13
00556C 41FA004C lea $55BA(PC),AO Address of the TRAP #13 routines
005570 2279000004A2 move.l $4A2,A1 Savptr, pointer to save area
005576 301F move.w (A7)+,DO Status register to DO
005578 3300 move.w DO,-(A1) Save in save area
00557A 231F move.l (A7)+,-(Al) Save PC
00557C 48E11F1F movem.l D3-D7/A3-A7,-(Al> And save C register
005580 23C9000004A2 move.l A1,$4A2 Update savptr
005586 08000000 btst #13,00 Call from supervisor mode ? $
00558A 6602 bne $558E Yes (/>
00558C 4E6F move.l USP,A7 Else use USP H
00558E 301F move.w (A7)+,DO Get function number from stack
005590 B058 cmp.w (AO)+,DO Compare with maximal number
005592 6C10 bge $55A4 Too large, stop 65
5?
Abacus Software Atari ST Internals

>nvert number ot long counter


rH
rH
10

ise use address indirectly


O
it address of the routine

rH
=*=

, (indirect) mediach
CM

7,, (indirect) getbpb


, (indirect) rwabs
EH

imber of routines
sstore registers
.t 31 cleared ?

01
cecute routine

X
0 -P
<u

sdate savptr

, bconstat
01 rH O

, tickcal

3 , drvmap
, setexec
, bconout

, bcostat
rH 0
o

, getmpb

, bconin
4-1 G 01 4-1
O 0!
01 o 01 -H
4-1 01
c 01
) AO

M 01 3 0)
<B o tH
4-1 ra o •o
v> w v ^n '—1 r* QJ M*
T<

Ac
M-i

o CJ E-< pq w O U On tn ED m •z. 0 rH CM CO LO vo CO rH rH

r—
1
*******************

o o

$472+$80000000
CO
o o 0
Q o 0
o o
Q r- r— o o
"? 1 0 o
ro 0 o
O o Q i CM CO CO
Q rt
o o o M vo H- CM o VO CJ
o O CM CM cn vo LO H rH rH
- LO o o rH rH r- vo vo vo r- r- vo r-
CM O LO LO rH CM LO LO LO LO LO LO LO LO LO
=tt= o O -to- rH

rH rn rH
s rH g
<L> CD (U • 0) CD CD Q) •X 9 rH rH rH rH rH rH rH rH rH rH rH rH
i—! rH r* CD •X
01 O o &. o 3 01 o O o O O 4-1 O Oo o O o
O O O O O O O
rH g S ,Q g 01 g g g rH * •o •a •a •a •a •a •o •a •a •a •a •a
*
-X

*
•X
•X
•X
•X
•X

CM CM *
-X
f£t rt^ •X
«3* •gi •X
O o •X
o CO o O •X H fQ vo
*3* vo f£, o L-q vo CJ
CM CM
o fr. o 0 •X CM cn cn <J LO rij t— rH rH
r-~ r^
[—
o o CO 0 -X [^ vo vo vo "31 [—
vo ^i 1— r-
r~ ^1
o o (V, 0 -X LO LO to LO 0 LO O LO 0 to LO
LO
CO o O CM o Q o cn cn cn cn Ot CO •X o 0 o o 0 o O o o o o O
O
^J1 ro ^r o LO O en r^ Q rH rH (_) r- •X 0 0 o o 0 o o O o o o 0 o
LO o O <! o PQ (4 CM U f , Cn n w T
•X o o o o o o o o o o o 0 o
W CM CM VO CM cn •31 CM CM CO CM ^r -X o o o o o CO o o CO o CO 0 o
-X
^r VO < 0 W o CM «=r ££> W O CM CO -X fQ U o ^1 CO CJ o •3 CO CJ o •^ CO
1
cn en cn cn <C f£ f£ m pq ca -X pq PQ O U CJ o Q Q Q Q H H
LO LO LO LO LO LO LO LO ^
LO LO LO LO LO -X LO 10 LO
LO LO LO LO LO LO LO LO LO lO
LO LO LO LO LO LO LO LO LO LO LO LO LO •X to LO LO LO
LO LO LO LO LO to LO LO LO
O o o o O O O O 0 O O 0 0 •X 0 0 O O 0 o O O O o O O O
0 o 0 0 0 o o o o o O o o •X o o 0 0 0 o 0 0 o o o 0 o

281
***************************************************** Addresses of the TRAP #14 calls
0055EC 0028 dc.w 40 Number of routines
0055EE 00007ACO dc.l $7ACO 0, initmouse
0055F2 00005328 dc.l $5328 1, rts
0055F6 0000577A dc.l $577A 2, physbase
0055FA
0055FE
0000578E
00005794
dc.l
dc.l
$578E
$5794
3, logbase
4, getrez
i
005602 000057AO dc.l $57AO 5, setscreen
005606 000057EE dc.l $57EE 6, setpalette
00560A 000057F6 dc.l $57F6 7, setcolor
00560E 000062D2 dc.l $6202 8, floprd
005612 000063BO dc.l $63BO 9, flopwr
005616 00006468 dc.l $6468 10, flopfmt
00561A 00005B64 dc.l $5B64 11, getdsb
00561E 00006B74 dc.l $6B74 12, midiws
005622 00007138 dc.l $7138 13, mfpint
00 005626 00007440 dc.l $7440 14, iorec
NJ
00562A 00007468 dc.l $7468 15, rsconf
00562E 00007BC6 dc.l $7BC6 16, keytrans
005632 00006062 dc.l $6062 17, rand
005636 0000614A dc.l $614A 18, protobt
00563A 00006602 dc.l $6602 19, flopver
00563E 00005A4E dc.l $5A4E 20, dumpit
005642 00009024 dc.l $9024 21, cursconf
005646 00006AAA dc.l $6AAA 22, settime
00564A 00006A90 dc.l $6A90 23, gettime
00564E 00007BF2 dc.l $7BF2 24, bioskeys ff
005652 00006CE6 dc.l $6CE6 25, ikbdws
005656 00007162 dc.l $7162 26, jdisint
00565A 0000719C dc.l $719C 27, jenabint
00565E 00007A30 dc.l $7A30 28, giaccess
005662 00007A9A dc.l $7A9A 29, offgibit 9
65
sr
005666
00566A
00566E

00007A74
00007B8A
00007COC

dc.l
dc.l
dc.l

$7A74
$7B8A
$7COC

30,
31,
32,

ongibit
xbtimer
dosound
I>
005672 00007C20 dc.l $7C20 33, setprt
005676 00007C54 dc.l $7C54 34, ikbdvecs
00567A 00007C32 dc.l $7C32 35, kbrate
00567E 00007D92 dc.l $7092 36, prtblk
005682 00005544 dc.l $5544 37, wvbl
005686 0000568E dc.l $568E 38, supexec
00568A 0000581C dc.l $581C 39, puntaes
*************************************************** supexec, routine in supervisor mode
00568E 206F0004 move . 1 4(A7),AO Get address from stack
005692 4EDO jmp (AO) Execute routine in supervisor mode
*************************************************** bconstat, get input statis
00 005694 41FA0020 lea $56B6(PC),AO Status table
W 005698 6010 bra $56AA
*************************************************** bconin, input
00569A 41FA0032 lea $56CE(PC),AO Input table
00569E 600A bra $56AA
*************************************************** bcostat, get output status
0056AO 41FA0044 lea $56E6(PC),AO Status table
0056A4 6004 bra $56AA
**************************************************** bconout, output
0056A6 41FA0056 lea $56FE(PC),AO
**************************************************** Conout er
0056AA 302F0004 move.w 4(A7),DO Get device number g
0056AE E548 Isl.w #2,DO Times 4
0056BO 20700000 move.l 0(AO,DO.w),AO Get address of the routine CO
0056B4 4EDO jmp (AO) Execute routine
***************************************************** Input statis
0056B6 00005328 dc.l $5328 Rts
0056BA 00006C70 dc.l $6C70 RS 232 status
0056BE 00006CFA dc.l $6CFA Console status
0056C2 00006B88 dc.l $6B88 MIDI status
0056C6 00005328 dc.l $5328 RTS
0056CA 00005328 dc.l $5328 RTS
Input
0056CE 00006C3C dc.l $6C3C Parallel port
0056D2 00006C86 dc.l $6C86 RS 232 input
0056D6 00006D10 dc.l $6010 Console input
0056DA 00006BA4 dc.l $6BA4 MIDI input
0056DE 00005328 dc.l $5328 RTS
0056E2 00005328 dc.l $5328 RTS
***************************************************** Output status
0056E6 00006C5C dc.l $6C5C Centronics status
0056EA 00006C96 dc.l $6C96 RS 232 status
0056EE 00006D46 dc.l $6046 Console status
ST
0056F2 00006CBA dc.l $6CBA Keyboard status
0056F6 00006B48 dc.l $6848 MIDI status CO
0056FA 00005328 dc.l $5328 rts H
I—I
aro
3
63
sr
****************************************************** Output
0056FE 00006BD4 dc.l $6BD4 Centronics output
005702 00006CAE dc.l $6CAE RS 232 output
005706 00008ADE dc.l $8ADE Console output
00570A 00006B5A dc.l $6B5A MIDI output
00570E 00006CCC dc.l $6CCC Keyboard output
005712 00008AD2 dc.l $8AD2 ASCII outout
****************************************************** Drvmap, get active floppies
005716 202D04C2 move.l $4C2(A5),DO Drvbits, get bit vector
00571A 4E75 rts
****************************************************** Shift, keyboard status
00571C 7000 moveq.l #0,DO
00571E 102DOA5D move.b $A5D(A5),DO Kshift, get shift status
005722 322F0004 move . w 4(A7),D1 Get parameters from stack
005726 6B04 bmi $572C Negative, then set
005728 1B410A5D move . b D1,$A5D(A5) Accept as kbshift
00572C 4E75 rts
******************************************************* Getmpb, Memory Parameter Block
00572E 206F0004 move . 1 4(A7),AO New MPB
005732 43ED048E lea $48E(A5),A1 Themd, Memory descriptor
005736 2089 move . 1 Al, (AO) Mp mfl = address of the MD
005738 42A80004 clr.l 4(AO) Mp mal = zero
00573C 21490008 move . 1 A1,8(AO) Mp rover = address of the MD
005740 4291 clr.l (Al) Clear m link
005742 236D04320004 move . 1 $432(A5),4(A1) Membot as mstart CA
Memtop H
005748 202D0436 move . 1 $436{A5),DO »H
00574C 90AD0432 sub.l $432(A5),DO Minus membot
Length as m length
a
n
005750 23400008 move . 1 DO,8(A1)
005754 42A9000C clr.l 12 (Al) M own = zero
a
sa
Abacus Software Atari ST Internals

milliseconds

Physbase, physical video address

Logbase, logical video address

Getrez, get video resolution


set exception vector

4J

Tickcal, timer value in


Get address of the old vector
0)
01 CO
VI
0)
0
•o Q
M -o 0
0) (0 O •o q
Q -H

p rH O (U M
c (0 4-1
(U •o<0
cr M g Sn
o (U O 0 o •o
o 4-1 0) •o a>
O o g (0
Setexc,

0) a)

Dbasel
0)

Dbaseh
(!) -r) -rl
01 rl 4-1 4-1 o
0) id
4->
0) -H
(0

rH
•a s
rH <D
Cn 4-1
0)
•8
-H
4-1
0)
U EH U 0 a & W U

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

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

0 ( A O , D O . w ) ,AO

$FFFF8203,DO
$FFFF8201,DO
0 o
Q Q
0 rH
Q o Q m in
Q 0
o o o o o O o
p- Q p- CM Q Q Q W Q
0 r-
o m CO o
CM
51 10
rH
Q
0
Q
0 CO
=tt=
*
rH rH
&
e.b

rH rH
e.b

rH
13 rH rH er O1
0) 0) 0) 0) <t> 0) (1) 01
W rH ^Q ra r* -r) 0} •X £_l 01 •X 1—j i-H tn •X 01 •X
4-1 * o
^ 05 P 0) 0 O
^ g O
^
4-1 rH 0 4J 0 o ta
^ 0
^ tti 4-1 •X o 4-1 o
*
*
g rH O) rH g g 43 g * U g * g g rH g r-H t-t s H *
•X s
* * *
•X
* *
•X * *
* * *
•X *
* *
•X * -X *
•X
*
-X *
•X * * *
-X *
* *
•X *
*
•X *
•X * *
* *
-X *
* * * rH CO •X *
* * •*
X O o *
-X
*
-X * CM CM * £
* *
-X CO CO *
•X
*
-X •31 O 10 *
-X CM fa fa -X E=3 *
O o 0 "31 * fa fa •X •3* *
*
•X O o o * ^3* * fa fa •X •31 *
-X
-X o o o *
•X O *
•X fa fa o •X
m -X fa 00 CO o o fa CM rH in O Q in •X 0 a\o CO Cf> CO in *
-X Q in •X o
t— CM ^F o fa rH CM O CO P- *
•X CO CM P- •X o CO CO r- •X CN •X o
W * in rH 0 CM CQ
O 0 w CM O w ^c o o rH o rH W -X O P*3 •X o
•31 * W en *r CM CM VQ
CO CM *
•X ^31 CO p- rH [y] rH W •X CM *3< ^c
* *
CO *
-X ri) W 0 CM IO CO U a o * CM •5J1 CO *
•X fQ O CM ^T CJ *
•X W CM * «ji
m -X m in VQ 10 VQ IO vo vo r~ *
•X r- p- p- p- CO CO CO
^ CO CO cn *
•X en
t— -X r- r- f— t— p- r- r- p- p- t- [— p~ * (— t—
p- r- p* p~ -*X r^ -X
m m m in IT) m m in m m * m m in * in m 10 (m

in m •X m in m
o -*X o o o O 0 o 0 0 0 -*X 0 o o * o o o o 0 o •X o 0 *
•X o
0 •X o 0 o 0 o 0 o o o •X o 0 o * 0 o o 0 o 0 o o 0
* * *

286
005796 102D8260 move.b $FFFF8260(A5),DO Load shiftmd
00579A C03C0003 and.b #$3,DO Isolate bits 0 and 1 69

00579E 4E75 rts en
Cfl
O
***************************************************** Setscreen, set screen address
0057AO 4AAF0004 tst.l 4(A7) Logical address
0057A4 6B06 bmi $57AC Negatice, don't set
I
rt
0057A6 2B6F0004044E move.l 4(A7),$44E(A5) Set v bs ad
0057AC 4AAF0008 tst.l 8(A7) Physical address
0057BO 6B10 bmi $57C2 Negative, don't set
0057B2 13EF0009FFFF8201 move.b 9(A7),$FFFF8201 Dbaseh
0057BA 13EFOOOAFFFF8203 move.b 10(A7),$FFFF8203 Dbasel
0057C2 4A6FOOOC tst.w 12(A7) Video resolution
0057C6 6B24 bmi $57EC Negative, don't set
0057C8 1B6FOOOD044C move.b 13(A7),$44C(A5) Sshiftmd
0057CE 6100FD74 bsr $5544 Wvbl, wait for VBL
oo 0057D2 13ED044CFFFF8260 move.b $44C(A5),$FFFF8260 Sshiftmd to shiftmd
-J 0057DA 426D0452 clr.w $452(A5) Vblsem, VBL disabled
0057DE 4EB90000F6C4 jsr $F6C4 Initialize screen output
0057E4 33FC000100000452 move.w #1,$452 Vblsem, permit VBL again
0057EC 4E75 rts
***************************************************** Setpalette, load new color palette
0057EE 2B6F0004045A move.l 4 (A7) , $45A (A5) Set colorptr (execution in VBL)
0057F4 4E75 rts
j>
****************************************************** Setcolor, set single color «1
0057F6 322F0004 move.w 4(A7),D1 Color number
0057FA D241 add.w D1,D1 Times 2
0057FC C27C001F and.w #$1F,D1 Limit to valid number
005800 41F9FFFF8240 lea $FFFF8240,AO Address colorO
00580630301000 move.w 0(AO,Dl.w),DO Get old color
00580A C07C0777 and.w #$777,DO Clear irrelevant bits
00580E 4A6F0006 tst.w 6(A7) Test new color value
005812 6B06 bird $581A Negative, dont set
005814 31AF00061000 move.w 6(A7),0(AO,Dl.w) Set new color Cft
O
00581A 4E75 rts
****************************************************** Puntaes, clear AES and restart
00581C 207AF7F6 move.l $5014(PC),AO os magic
005820 OC9087654321 cmp.l #$87654321, (AO) Already there ?
005826 660E bne $5836 No, done
005828 B1F90000042E cmp.l $42E,AO In ROM ?
00582E 6C06 bge $5836 Yes, do nothing
005830 4290 clr.l (AO) Clear magic
005832 6000F7EA bra $501E To reset
005836 4E75 rts
to
QQ ****************************************************** Term, interrupt running program
°° 005838 6102 bsr $583C PC on stack
00583A 4E71 nop
00583C 23DF000003C4 move . 1 (A7)+,$3C4 Save PC including vector number
005842 48F9FFFF00000384 movem . 1DO-D7/AO-A7 ,$384 Save registers
00584A 4E68 move . 1 USP,AO USP
00584C 23C8000003C8 move . 1 AO,$3C8 Save
005852 303COOOF move . w #$F,DO 16 words
005856 41F9000003CC lea $3CC,AO Save area
00585C 224F move . 1 A7,A1 Get SP to Al
00585E 30D9 move . w (Al)+, (A0)+ Save word from stack
005860 51C8FFFC dbra DO,$585E Next word en
005864 23FC1234567800000380 move . 1 #$12345678, $380 Magic for saved registers H
00586E 7200 moveq . 1#0,D1
005870 1239000003C4 move . b $3C4,D1 Get vector number to Dl
B
005876 5341 subq.w #1,D1 Convert in dbra counter to
Abacus Software Atari ST Internals

Address of bit pattern for "mushroom1


Plus offset for middle of screen

Number of words (screen planes)


Save pointer to start of line
G

Write 'mushrooms' on screen


CU
CD 4J CU
'mushrooms'

Next destination address


G

Shiftmd, get resolution


-H -H
rH O,
4J
Q) CU 4-1 0!
-H XI
CU 0 4-1
Terminate process

0 CO
CU 0!
G XI CU XI O G
01 CO 4-1 -H
Times 2 for word access
3 4-1
Reset savptr for BIOS
Output appropriate # of

16 raster lines
rH C O 10 H
Isolate significant bits

rH 01 o 4-1 01
Return code for error

,w ( A 1 ) , ( A O ) + Write a raster line


CO C CO 4-1
O 01 CO
3 rH X O 0) cd

Dbasel
Dbaseh
CO 4-1 CU r-l
o 0! c O
Q o 4-1
S o CU CO

Screen address
Ed 01 01 01
CJ3 M EH

TO AO

558E8 ( P C , D 7 . w ) ,A2
,w $58E2 (PC,D7.w) ,D5
$58DC(PC,D7.w) ,AO

.
***************************^********************

$58EE(PC),A1
,b $FFFF8203,DO
,b $FFFF8260,D7

,b $FFFF8201,DO
#$5FC,$4A2

0
#1,-(A7)

o o CO
,w #$F,D6

COO3
in m in
#8, DO

,1 AO,A2
#8, DO
D7,D7

,w D1,D2

O
#3,D7
$5890

.1 DO,AO
-(A7)

rH
o IS
m m vo
DO

CM CM CM
=*= •CO Q Q =S= O
3:
23FC000005FC000004A2 move..1
move.,w

rH
*

?
t

»
t
clr.]L

»=•
cf

dbra
0 ) " - » Q 1 ' C U - Q 1 ' O I O I O I G I C U 10 CO 0)
•o
bsr

!H

rts
10 IS
•a •o
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 -o € (0 m g
O

O rH CO
VO O O
CM CM CM
CO CO CO
3F3C0001

6 51CEFFE4

o faCO fafa l< CO fa O CJ vo

r—
fa
faO
fao
fao
fafa
fafa
o o o
E— o o
fafa
o
r^
C M C O O CM fa
fa
fa
ifa rH
O
cncjr-oc\cocncoop3f<cjrHcopq
6116

42A7

rH 0
A 4E75

Q Cfi
o CJ CJ fa
W 0 ( J L | M W C M O r H O r H O O C O C J ^ P ' = r i s C rH o
vo r H C J Q ^ r H H r H W C M Q ' 3 ' C O C O C M C O m in m Q CM
CJ
8

vo
A

O
4

O V O f ^ C J W * 3 V O O W O * 3 C O C J P 3 O ^
r- r- CO CO CO CO * 1 1 E
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
1

CO CO 03 CO CO CO •JC 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
in m m in m in * 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
0 0 0 0 o 0 * 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 o o o o o o 0 0 0 0 O 0

289
Abacus Software Atari ST Internals

Number of screen planes

***** Bit pattern 'mushrooms'


High resolution
High resolution
High resolution

Low resolution
Mid resolution
Low resolution
Low resolution
Mid resolution

Mid resolution
Screen center

1
r-H

<D
G
-H
,-q

0 o o 0 o 0 o o

L11100
0

OOOOOC
OOOTOC

OOOOOC

000001
0 0
0 o o o
*****

-X 0 rH rH 0 0 0
* 0 o 0 rH o 0
»***

0 0 0 0
* 0 0 0 rH rH o o 0 o 0
•X o 1-1 rH rH rH o o 0 o
•X •X * rH
3 rH
3 rH o o rH tH 0 0 o
•X •X •X * rH rH 3 3 0 0 0 0 0 0
* •X i-H rH rH 1-1 O o O 0 o o
o * o
1
•X
0
vo o
rH rH CO
•X •X
*
*
•X
•X
jj -X
-X
rH
0
0
o
O

(—1
rH 0 rH rH 0
0 0 rH rH 0 0
rH rH 0
o
o
rH 1-1 1-1 rH o 0
O 0 0 O 1-1 rH
0 0 0 o
0 0
* O 0 o •X •X o 0 * 0 0 o rH 0 0 rH 0 0 0 0 0 o 0 0
•X o 0 o * •X vo vo 0 * 0 o o 0 rH i-l 0 0 0 0 o o o 0 o
*
*
i-H rH CM •X n
* - o *
-X
rH i-H CO •X
•X
dP dP dp dP dp dP dP dP dP dP dP dP
•X -X * •X
•X •X •X *
* * * *
•X £ £ £ •X £ £ £ •X £ £ £ * £ £ £ £ £ £ £ £ £ £ £ £ £ £ £ £
4, O 0 0 •X 0 0 O •X O 0 0 * O O o 0 O O U O O O o O U O O
U
* T3
•X
•o •a •X
•X
"O •a •a *
*
•o •a •a *
*
•o •o •o TS •o TS •a •a •a •a •o •a •a •a
* * •X *
* * * •X
* * * *
* -X •X *
* * * *
* •X •X *
-X •X * *
* •X * *
•X •X •X •X
* * * *
-X •X * •X
* •X •X
*
,
* •X * *
•X •X * •X
•X * •X
•X * * *
* O o o •X m rH 0 -X 0 0 0 *
*
0 o CO ^i* *3* (3J vo O CO 0 o 0 0 0 o o
* CO CO CO
•X la w w
-X o O 0
* o O 0
•X P3J *3. m *
o PT, P-, pT| pt* PM
PT, CO CO •31 •a1 CM CM CM
-X 0 0 0 •X r- PT, cq r- r- cq fc. vo CM CM •3* <cr en a\
* ro co n * o o o * 0 o o •X 0 T—1 m e— cq CO Q vo 0 O o 0 0 0
-X * * *
•X 0 K) o * CM •3* vo * CO <3J O •X w O CM «qi vo CO p£ o ££] O CM •3* vo CO f£ O
•X Q Q W •X W W p£) * W M w * w
PH 0 O p~.
0 PM PT,
pM fc* &M 0 0 0 o
•X CO CO CO * CO CO CO •X CO co CO •X CO o\Oen
CO CO co CO CO CO CO CO en en
m m in * un in in •X m in m •X m in m in in m in in in in in m
* o o 0 o 0 0 o 0 o o o in
•X in in
•X0 o o * o 0 o •X o o o o o o o o
* o o o * o 0 0 * o o 0 •X o o o o o 0 o o 0 o 0 o o o o o

290
00590E 1290 dc.w %0001001010010000
**************************************************** Fastcopy, copy disk sector en
005910 206F0004 move . 1 4(A7),AO Source address
Destination address
005914 226F0008
005918 303C003F
00591C 12D8

move . 1 8(A7),A1
move . w #$3F,DO
move.b (A0)+, (Al) +
(63+l)*8 = 512 bytes
I
00591E 12D8 move . b (AO)H-, (Al) +
005920 12D8 move . b (A0)+, (Al) +
005922 12D8 move . b (A0)+, (Al) + Copy 8 bytes
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) +
00592C 51C8FFEE dbra DO,$591C Next 8 bytes
005930 4E75 rts
NJ ****************************************************** Hard disk initialization
005932 2F390000046A move . 1 $46A,-(A7) Hdv init on stack
005938 4E75 rts Jump to routine
******************************************************
00593A 5C4155544F5C dc.b '1AUT011
005940 2A2E50524700 dc.b '*.PRG',0
005946 123456789ABCDEFO dc.l $12345678, $9ABCDEFO
******************************************************* Auto, start and execute a program 65
00594E 41FAFFEA lea $543 (PC),AO Address of pathname
005952 43FAFFEC lea $5940(PC),Al Address of filename '*.PRG' cn
005956 23DF000005FC move.1 (A7)+,$5FC Return address H
i—i
00595C 9BCD sub.l A5,A5 Clear A5 B
i>*
00595E 2B480600
005962 2B490604
move.1 AO,$600(A5)
move.1 A1,$604(A5)
Pathname
Filename
i
L3
sr
Abacus Software Atari ST Internals

Drvbits, vector with active drive

Start auto exec program


0)
Pointer to null name

PC for auto exec program


4J M 0)
g C 0)
-H 4-1

#$20, - ( A 7 ) super, enter supervisor mode


M O
a, -H
C" O O O
!X CQ
01 o CB
Environment

C7> rH ca .a
q 4-1 O m
-H
"8

Base page address


to CO CQ o>

Exec, load program


4-1 -H
en o M CB U o 4-1

#$10, A7 Correct stack pointer


U 4-1
tfl 4J 4J CO IM
0) a CO to U
T> 01 H o 0) •o cu
±> CB d i-H. o O
O -H 0) o> Q4 CM CO O
No, done

Q M CO 3 w O O, rH
m Q CJ w CM CM CO cs CJ CQ
Shell name

Correct stack
GEMDOS call

GEMDOS call
A O , - ( A 7 ) Command tail

******************
$52ED(PC),AO

#$59AC,8(AO)
$4C2(A5),DO

#$4B,-(A7)

4(A7),A5
AO,-(A7)

r-
AO,-(A7)

r- in
#$10, A7

rH 1
Q 1 £ S
o I r-
$59AA

O 0

-(A7)
VQ D 1 CQ 1 o o
o rH
in o
#1

#1

o CO O CO rH
D Q Q =*= =4t= Q =*=
,1

,1
.1
,1

.1
,1

,w

,w
rH rH rH rH
?*
*
j

01
o o
Ol 4J

4-1
cr CB > % §
<H 01 O 0 0 o o m T)
O)
> cO T3 <D 0!
0
> > > g ca T> ra
o 0 o 0 o o M T3 4-1
0)
§ *
*
*
rH
'
O
Q.
> fO 1
H TS O
01
•S $
o
«
0)
io
g e ft X! rH 5 g g g g 4J CB g g g g g g s 4J cci H 0 g 4-1 cd g g rH
s
*
*
*
CO *
o *
^c
o
o *
VQ CJ * o
"=p * o
*sF cn *
•n rH
O m O
CM O r— m CQ O 0 •a1 CQ 0 * o ^r O o
CJ O r— o •a1 f-H 0 o fH -*
£ CM o o o
o cn o o O o o 0 O 0 o rH 0
O o [V, o o O o o o O * 0 0 0 0
a cn O VO fS, 03 CO 00 CJ CJ rH CJ O CJ CQ o CQ o CJ rH 0 in * r- CJ rH fT| 0 Q CJ
CM CO O CO fc, 0 o o CO CO "3* [-1 ql r- 0 o 0 CO CO ^ r^ r* < CO^31 sr ^i vo CO
O CM CO ( rH C^ ["T, [V| p4 fv. w w o rH fc, [JM t, (x3 r^l f"i * OJ pn c=3 CJ CO (V, fe.
CN CO o VQ -sr CM CM CM CO CO ^31 Q CM CM CM CM OJ CO co ^ Q "a1 * sr co •a1 m CM ^
OJ •a1 CM
*
VQ < o CM T CO (=C CJ w CM VQ 03 CJ w VO CO < U o ^t1 VO ff * CJ W CM w VO 03 CJ o
CO •X
* CQ CQ CQ CQ o
cn cn cn cn cn cn cn cn en cn cn cn cn cn en en cn cn cn cn cy\n cn cn OS cn cn cn tyi cn
in m in in m in in in m m m in m m in tn m in in Ln in in * m m in m m LO m m
o o o 0 0 0 o o 0 o 0 0 0 0 o 0 o 0 o o o o * O 0 o o o o o o
o o 0 o o o 0 0 o o o o o o o o o o o o o o *
-X 0 0 o o 0 o o o

292
Abacus Software Atari ST Internals

01
0)

stack correction
rH
-H
<a M-t
<u
r( 0)
ffi 4J 0) 0)
4J 01 CO CJ1
0 B O
o 01 Q -H -H
O
a, T!
G
M
0
a O
P,
P,

o o U f- (0
rst
A td B 01 i-H tH a
4J 4-J 0> •a a> a>
01 -H M ffi (d w id 01 B (U
X O •a a> ^ O 0 0 3 (U 0) S S S <u
10 ta S
o
o to
rH O
4-!
O
C- -H
id A "" •o <d to
c; U 01 id ^-> O
t} o
0>
O
0)
0 S
B
g
fi
B a fi R <8
45 O fc. 0) M 0) »H Q M <D ^3 0)O
.p
M H a>
<d JJ S 01 O rH
•gj 4-1 S M S rH <d
4J 0) W o 0) ~^ -H <U >i ^ (1) t=3 O O -H o <d -H 3 O
en to CD o X K W CQ Q W CD o ID O fa Z PM fa < O

H-
tH
O O
(~- — — O CM tH — PM&,
rt I I
I r- ft, O Q CO <
•* «C "^ o - o <H
10 — «• tH VO tH VO tH r-
* * =«= Q
* *
<187900000608

t.11F900000626
S>07900000600
JF3900000600

J?47900000604

187900000634
i.13F900000634

187AF8C9
0059CA :3F3C004A

:3F3C001A

( 187AF8CD
:3F3C004E
:3F3C0007

a r- tH o CO tH tH t— o CO CO CO o
o vo o o •SP Q CJ a vo
CNJ tj 0 vo
\n
W o W ft,
j^\6 I ll".
CM m vo
m \n
CM vo CM
0059C6 ;

]
]
{

t.
(

I
I

005A2C <
i
7 306SOO
0059C8 t

(
(
f

vo
005 9EC

<
005A1A
0059EO

0059F8

005AOE
0059FO

0059FC
0059DO

005A10
005A02

005A12
005A08
0059D6
0059D4

0059E4

005A1E
0059E6

CM
0059D2

005A1C
0059FA
0059F2

005A14
0059F4

o CM CM
en < <
to in 10
o o o
o 0 0

293
Abacus Software Atari ST Internals

o
3
rH
10
>
4-1 G G
H O O
10 -H -H G
4-1 4 - 1 4 - 1 CU O
CO P 3 4J -H

screen hardcopy
for stack pointer

ad, screen output


rH rH 4-1 4-1
0 O O CU (0
ct stack pointer

4-1 CO CO rH M
CO CU 0) CO P
load program

X CO M M O. M &
0 (U 4J O CU -H
G c ,G 45 M n 4-i 1-1

p, hardcopy
(0
£1 •a CU <U 4-> tT> ( U O G C
•o rH <U CUT>-rl N r H - H O

dumpflg
!H rH M M -H CU O O O
CU P CJ O S .C 0 CJ OH
c a
S call

4J 4-1 CO CO 4-1 H
X G rH G C 0 X CU
CU 0) -H O •• M CU CU 4_> 4J CO 4-1
T3 O CU CU 45 10 C

A5
C rH O 4-1
-H Q. g CM 1H SH >H t? CO £ -H
t,

SH P O 4-1 4-1 O U -H CO M
- o 01 w 0 x -H •o o M g M <U <4H CO CU CO CO r4 CD M Q<
O Q ^ 0) !H 4-1 o •o •o (0 •an <0 CO m
CO -H CU 0) rH 4-1 H 10
CD s m x (0 t 4-1 &H (U cu A & > g 43 4-1 4-1 M-l T3 73 CU4-1
X W O >i cu cu 4-> O P O CO rH 0 rH H-l c o c f l - r H t O C U C U C L C T j r H C U
W C3 CJ ffl to s co .J Q CO 35 o to CJ > 0 C O l O E H £ H O C 3 t - 3 < < C J C 3

m LO
< ft,
LO in
< CJ <
**********

<
in in
*********

SP vo vo vo
LO o «/> «• vo
VO 0 < K vo rH
•co- Q LO «• Q
r- m ? ? K *fc
r~ w O o
< H in in LO CM CM o o LO LO ^I1 LO in
1 1 1 «=p <
*-* < VO Q Q CM <
^
p^ vo <q •s o in- -X in vo o ^p ~— ~— ~— <V CO
pa o Q fa W CM CJ * H vo <* -X M CO CJ <J} Q Q o 0 H o fa w U
•c1 rH Cn U fa * M (^ rH «, ^r m ^r K < < < LO vo fa vo CO
rH </> CM </> m CO LO * LO 1 * m •31 vo o "31 0 o m vo vo vt vo <
4t= =tt= =8= =«= </> *
-X </> =tt= *
•X <rt </> Q <fl- Q Q <n- 0 vo </> </> =tt= </> v>
*
,— | * *
S • J5 rH * S * rH fk s S » rH s
|5 tr . • * |5 *
•X rH • S |5 |5 s • 5
cu a cu. CU CU * . CU •X . CU • CO 0) • CU 0) ^« cu • cu
ra T3 CO (0 > CO •*
X M tn Q
^
L^ J> T5 cd }H SH H
o ^ •a o o cu O 4-1 ^
rH CO o 4-1 *
•X P o rH rHo o -o (U o o rH rH o rH o
e 4-) 10 g g ^
Q g r* *
*
0 Q g •*X
U g O o g g CO rH g g U 0 g o g
*
-X
*
•X
* -x
*
-X (V) .£ vo
•X w vo
•X * vo
o * o
rf^ CJ * pa o * ^31 <; CJ 0
CM * M o * m in in sp
m
p-1 * ^J1 0 * vo vo vo CM
COo * O 0 * o o o CO
pa o fa o o * O fa * W CO o CM f£ o vo w o fa Lt) o
•sr rH •c1 o o * o fa *
•X ^* m Q1 vo in o o LO vo fa vo CO
o O o 0 o * 0 fa •X •31 vo ^p vo o o 0 vo vo o vo PJJ
o O o 0 0 * 0 fa o 0 0 o o o o o o o o o
U rH O CM CJ vo CTi en in * CT1 f^C CJ m * Q Q Q 0 Q o O P£ o o Q Q U Q Q
co ^P fa O rt^ fa ro r— * r- 0 fa [— * VO vo *3* CM "5T •5P fa r— r- vo vo vo CM
fa W W w fa 0 fa fa M * CM rH n [V] * pq pq CM CM 0 pa O rH P3 PQ CM CM PQ CM CM
CO •a1 Q r- CO vo ^r CM ^T *
•X ^31 VO CO -=T * en CM «sP *3* rH CO Q ^P CO ^p CM ^p co
*
fV) CM ^J1 00 f£ w 0 VO U * W •51 vo f£J *
•X o CM CO CJ W CM vo CO CJ CM CO o 0 CO o
CM n CO CO CO CO ^J1 * LO in in vo VO vo VO VO [^ [^ r- CO CO CO en en en
f£ <£ f£ f£
(3^
(5J * < < * (^

j^
"5* (^
LO LO LO LO LO LO LO LO
^ m^ * L^O LO LO in * m
^ m i^
n ^
LO LO in in m LO LO m LO LO LO LO
O O o o o o o o o •*
X 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 o o o o 0 0 o o o o
* *

294
Abacus Software Atari ST Internals

nted
o
o
43
ft
o 1
o t
C
O 73 ,-» ffl
-H CU

not
H
10 CD rH flj
1o 0! f, 43 0) .G
M ft (U ft E <U 0) ~ 3
CD 3 O ft g 0 fS 4J >-< a) 45 X
73 en o >, o o S O X >i 3 -H >.
O -H 73 4-> M 73 3 -H M 01
MH (0 ft >i O Si 4J -H
-H (0 M <0 ft ft >1 4-J 01 <o <o
o A CD 4-> 45 QJ O 01 01 <8 g 73
o 4-> C 45 O X 43 01 4J 01 4J -H g
<0 43 OJ (0 <0 M (0 73
n O -H g O M (0 4J 4J ft g 73 M o
10 -H (U 73 -H >! O rH
ft CT> 4-> S 3= o O
&* o o ff) O O
0) > -H n m o
C G (U G G C
g <D
- (U 4J 0 O O
10 d) CD 01 01 01
01 O 'O 4J EH 01 ft ft ft
CU 01 EH EH rf, ft W Eii] pc]
EH H O

0
Q

, Q
.-!!
in
if)

o
Q
CJ
CM < m
--
*
o o

0
o

0
****

10 * qi 0
rH rH vo •— O O O V O r H O V O — CMP- * VD CM *
•X
Q Q «• * •• ••
*
•X •*
X
n ,_, rH CM o ,_, rH rH rH
=tt= =t£ Q </> Q =t£ =*f= Q 4^: -t/> Q -W- </> =fr * n CM * O CM rH 1 CO 1 1 1
*
^c *
-X *
|5 S3= £g ^5 ^ 3: -X *
3 • • • & £ ' $ • • *
•X
^• CD * 3 3 •X _Q ^3 »Q 43 43 43 43 43
* •X
01 C O O O W G O C O O O W T 3 4 - ) •X U U o o o o o o o o
rH (0 g X 73 *
-X 73 73 73 73 73 73 73 73
•X
*
X -X
•X
*
* *
•X
* •X
*
*
-X *
•X *
f^j 0 o *
V3 * CO en *
\£> *
•X CM rH *
O •X o o *
rH ^P O <-)Or-oo*3'"=p •X o CO *
O VD CO O V O O C M O I O O CO CJ *
•X
0 VO < O V O O O O V D C M *
•X CM o
o 0 O O O O r H O O f M •X 0 o *
•X
cn Cj rH Q t —t C Q O O O C Q O Q O P M L O •X 0 CO •X
qi r- qi CM o ^t r^~ ^ r** co O ^o o f r*^ •X ^1 CJ •X
vss CM ffl C M O C O O C Q C M O r O C O ( H C O W f—] 0 O CM rH &4 fo r*i F"I FTI
W O n r o H Q c o O t —i c O ' = i
iVOL O'=r *
•X 0 0 *
X 0 0 0 fe o r^i FTI r*i
•X
o CM VO pg |V} o oj VQ f£ PI-| <NJ qp CJ Q CM sp CO *
•X O rH CM CO •01 in vo r~
*
•X a Q W W W w
<
m m m
< <^§§<§§^^<§§ * < < < <
inininmininininLninmin
^ o o o o o o o o o o o o * in m * m 10 m m in m in in
o o o * 0 o *
•X o o o o o o o o
o 0 o o o o o o o o o o o o o •X o 0
* 0 0 0 0 O 0 O 0
*

295
Abacus Software Atari ST Internals

01 M
M 0) CO
0)
o 4J
CM 3
-X -H 4J G •a
O O G W
o a is<u <u0} a
O
CO 01
.G x o <B rH
o 4-> H 0 O M M M-l
4J <B <a oi
0!
aG (1)
MH .p SH 42
O 01 O •a .p jj 4J CM N
4-> -H -H 3 3 O O G G -H
01 G O G CO 4-> rH
C O 01 01 G U CD g co <$
•H o a 01 -H 01 0! M oi a> CO >i "H
>
t3
<0
X
<B
O
H
in
H
(0
-P
•c
•o M
& O (Q M
o > n
M -H O
M M C
o *j 4n
C O G
JS g G CO Q O to Q M Q M T3 M H

i$4910,AO
#$3E2A,AO

0
-X in CM Co vo
vo CM vo cn r- vo CM
* tH vo CJ
*
•X CM CO vo o Co o Co 0 H- CM CM
0 in [— CO m 1 o
•*
X O PQ o r- CM W pq pq
vo CO 0 0 o O in CM f3? f£ I CM VO 0 CM 0 m rH 00 rH CM m vo
-X Q Q Q Q i 1 Q =tt= =tt=
* *
*
•X
3
,1

•X H 3 3 3 3
1 , 1
L

t
" •^ r*J t> "* "* "
' '
* * rH * *-ri M
"*
*
-X 01 CO 03 QJ ' ' CO Q/ '—1
•X c > f—l > is > •a 1^ T3 > •o •o 01 •o •o a ^j rH
•o g
M ^H
-H O ^ o O O $_i o O •o rH rH
^ rH
rH ^ O rH ^ rH ^01 •a 0 o TJ t5 0 c •o SH rH G
*
•X g o g g s Jp g € m O O O O g o O T~l s g g ffl O o 45 3
•X
•X vo CM
•X fa CJ
in
*
•X CM O
0 o
* O o
* 0 o
*
-X o o
CJ vo CM rS^ CJ p£] 0 V0 co w
* CM rfj cn CM CO O rH rS^ 0 fa
* rH <3i vo W CM 0 cn «sP o fa
*
-X O 0 ^p CO VO 0 •31 0 o fa
•X o O 0 0 py] o tyi W 0 0 fVj O 0 o &3 CM
fa O 0 0 fa o [V, fa O o fa O o o fa O
*
•X fa 0 0 o [V, 0 [V, fa 0 0 fa o 0 o fa o
•X fa 0 0 0 fa 0 fa fa 0 0 fa o o o fa o
-X vo CJ 0 0 0 0 W CJ H cn 0 i~ tr- tr- W r- r~ en CJ o pq CO CJo cn fa en W p£}
m ^p o o *3* VO O rH in io io CM f£ PQ o vo o fa cn rH f^ 03 vo vo f^
f^ m
* W CO CM CO co Q o o CM CM CM CM CM CM ^
CM W fa fa o rH o VO CM o CM CJ Q
-*
X
-X
CM •31 CO CO CO vo CM co Q •31 "O1 •=P •SP co a CO CO Q Q CO vo m o m 0 VO sr
-X CO O VO CO p£J ^P CO <J a <<* VO CO n3J CJ ty] CM ^P CM vo o •3* CO o CM ^31 f£ ^i CO W o
CO CO CO •a* •IP QI
(^
-X [V] [V] fa fa 0 0 *~H ,—| (—1 T—1
fa O rH rH rH CM CM CM CM CO ^yt
m m m vo
-X p£ f£ (<J PQ PQ PQ PQ PQ ffl PQ PQ m PQ PQ (Q PQ PQ PQ PQ PQ pq PQ pq pq m PQ PQ PQ PQ
-X in in m in in m in m m m m m in in m in in in m m in m m m m in in m m m in
-X 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 o o o o o
-X o o o o o o 0 o o o o o o 0 0 0 0 0 o o 0 0 0 0 0 0 o o o o o

296
005B62 4E75 rts
************************************************* getdsb
005B64 4E56FFFC link A6,#-4
005B68 4280 clr.l DO Zero
005B6A 4E5E unlk A6
005B6C 4E75 rts
************************************************** getbpb, get BIOS parameter block
005B6E 4E56FFF4 link A6,#-12
005B72 48E7070C movem . 1D5-D7/A4-A5,-(A7) Save registers
005B76 OC6E00020008 cmp.w #2,8(A6) Drive number
005B7C 6D06 bit $5B84 < 2, ok
005B7E 4280 clr.l DO Else zero
005B80 60000192 bra $5D14:lnl:fp5
005B84 302E0008 move . w 8(A6),DO Drive number
VO 005B88 EB40 asl.w #5, DO Timers 32
>J 005B8A 48CO ext.l DO
005B8C 2A40 move . 1 DO,A5
005B8E DBFC00003E3E add.l #$3E3E,A5 Plus base address
005B94 284D move . 1 A5,A4
005B96 3EBC0001 move . w fl, (A7) Count, read a sector
005B9A 4267 clr.w -<A7) Side 0
005B9C 4267 clr.w -<A7) Track 0
005B9E 3F3C0001 move . w #1,-(A7) Sector 1
005BA2 3F2E0008 move . w 8(A6),-(A7) Drive number >
005BA6 42A7 clr.l -(A7) Filler l-t
005BA8 2F3C000012BC move . 1 #$12BC,-(A7) Sector buffer
005BAE 4EB9000062D2 jsr $62D2 Read sector
005BB4 DFFC00000010 add.l #$10, A7 Correct stack pointer
005BBA 2D40FFF4 move . 1 DO,-12(A6) Save error code
005BBE 4AAEFFF4 tst.l -12 (A6) And test
5T
Abacus Software Atari ST Internals

-p +J
s
-H

O O
0 O
o o
03 CO
VO M vo
0!
0 •P
^1 p CO
o p EH
p ^1 rH
U a> O EH
0) Oi
C CO 0) H H O)
error handler

-H p 0) -P
stack pointer
J_J
0!
n) H G 0 a ft C
01 -H •P
<a fi 0 CO
VO 0) M M VO
CO CO CO O O CO
0) 0 0) o •P 4J O
•O 4J CO r( 0 U CO
O
O
%0) £) 4-> O<
01
CO
0)
CO J->
CD CO SJ
0) ^ 0) CO
t3 0 rH > 01 c*>^ CM" I
P O rH 0 rH C 4J cH CM C
C O ji 5^ o -t- o -|- 0) + O
IB
O u 0) 43 o ^^
jp £.4 M M U
0) -H 0) 01 0)
P- > ^
O 4J CU •o u-l ^ CJ)
IH 01 -H <H - N 01
-H H -H M (3 fH -H J> IH 0 01 M-I -H -H P
M !H ^_l o ^<B O! p CM <a P 01 rH P CM CO
O Q EJ
^ CJ o to PQ p CO PQ M O CQ P MH &

o o o
Q vo Q Q
— vo .— — ^ O
K Q VO
CM VO O VO r- *. Q «• < CM ft, -
— <: — o rH <C O VO rtj CM ^
Q I — O CD — EH rH CM VO Q O CJ rH*-~CMCMVOCO«3»Q
CQ m N - CM rH PQ CM PQ Q rH CM - CJ CM
in in CM o r H < / > i n < - H i n o i n </> VO O in rH
Q I =tt= </> I «• Q «•

C D C O d ) < T O ) C P - •
0 ) > > ! > > - i ' O > > p H { T j J
t n O O O e o T J O O E c u c o
^3 S S S 'f~» fd S S O ^Q 4-J O X!

r- en CM
0010000
000555C

O CJ O
CM CM CM
rH rH rH
CO •3- OCJ O PH CM CMO^PCO CO
o
0
0
fr!
EH o
IE
EH EH 0
EH
EH
CM
rH
0
ova
OVO
oo
o
O
o
PH
O
o
o
rH
o
o o w o
O O o
o o o o o
VO O
0

vo H cy o en EH o H vo o 0 H O O 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
rH < CM •=r CM PQ PQ
O CQ co o CO o CQ o o c^ co co r*~ o co o co ^ CQ o ^CM •»
O W 0 fc. EH" ^ Q 0 o
vo n CM O <3" in CM CM PQ vo «f
o CM o
F^ vo
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
sr vo 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

CM •sr CO O W ^f vo <c W "=r vo < O w C M C O c j ( a o v o e o c j ( y o « p v o < o a ' CO O


O U U CJ CJ Q Q Q Q P3 p-*) ££] ££]
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 CM
CQ pq m ffl CQ CQ pq PQ PQ PQ CQ PQ PQ
PQ 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
m in in in m « m m m in in in in in 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 0 o o 0 0 o 0 o 0 0 0 o o o o o o o o o o o o o o o O 0
0 0 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 o o o

298
Abacus Software Atari ST Internals

|
|

|
directory entries
4J 4-1 4J
G G c G
-H -H -rH -r) -H

hidden sectors
O 0 O 0 O
0 O o o 0
o o 0 o 0
CO CO CQ CO CO
VD VO V0 V0

o o 0

sectors
O O

r track
4-1 4-1 4-1 4-1 4-1
CO
CO SH
CO CU •a CO CO CU
en -H en en
CU CU CO CU CU CO
4J 4-1 4-1 4-1
IH c MH G MH G CU G MH G
o -H O -H O -rl a -H 0 -H

n «J N rH 10 (^ vo j_, <£> rH V0
CO -H CO N CO 0 CO CO
JSg o
CO o
CO
CU

g
o
CO
-H
CO
J8E 0
CO
4-1 O
O CO
XI
CU

E
o
CO
XI p CU O P rH P CU P
N G 4J ^1 G CU G 4-1 O O rH G 4-1 CO 4-1 G 4-1
N -H CU J_) rl CO o M U rl
-H
CO
rH
CO
rH
O rH G ^
>
CM
jj
<^
§ •aId
rH
N
G
-rl
ai
rH
CU
4-1
jj

G CM
vo >
c
CT g
CM G
&
rV
CO
CO •o
CO
CM
CU

C
0) U -f. o co T3 •o CO0 •Q H- T3 H- o CO H- O CO •a H- 0 G
o tsi 03 t^ o CO CO O H MH O 0) CU CO j^ o CU 1^ O CU 0} M o CO
CU -H 01 t)CO CO •o CU ^
CU T)
CO •o •o CU •a CU •o CO •a CO •a
CO CU MH •• CJ) -rH rH rl CO CO rH MH p -H rH MH ^ -H MH „ 4-1 -H CO rH MH ^ •a
.p O CU MH -H 5 > CO
^
4-1 P P CO MH -rH G CO MH -rH CO MH -r) O, CO g CO MH -H -H
<0 CO -H -H p CM -H -H -H fd '—1 rH -H P CM -H -H -H P CM G P CM CO G -H -H p CM *G
rH EH >H P m EH Q >H MH PJ PM PQ P s Q JH PQ P •o PQ P *O T3 EH >-l pq P •a

r< o ^-> £C o ^-* o o


sp O^^ — .— G O O - a * — Q
O T in in Q Q in m
O Q ^ P -
Q - i < O
O s p - . Q Q c < ; -
Q « ; — - • . — pM4
Q <-
«. •" VD
-* •a1 £ CO £
0 - —. — C J « > O --— ^ ^ - . ^ - C M C J V D T x-^-O" a vo o Q io in CM Q
rH ^^ "31 "31 CM ^0 Q -^-^ ^ 0 r t J ' 5 P < a 1 r H C M \ 0 r i 3
" T P r H CM V0 CM CM 10 CM CM CM «> CM
^ ^ T r t ^ K r H C M * . ^ P ^ *-* fC, (£, •. rH CM ~~*
t«C •* rH CM - rH CM K •»-•• ~-~ <v rH CM •*
O i < -— o < / > v 0 i r > O ( < o o —^ ~ - * O - W > V O C M O — o Vt V0 O ^/j. 10 o 0 •C1 O </5- VO O
Q — CMQ=tt=<O-=tt=Q — Q r H V Q C O Q = B = < / > r H Q C M Q =» «> Q =tt= «> Q CM CM Q </> Q
*
S S S r H 3 & S ?rH ? S rH S rH 3 £ s a rH S
^
cucococu • • « ai aj • • a; a) • • o] a; CU CU CO
§
CO CO
§ > r H > > r | r H 4 J > > > - i 3 - t ! > > M X l 4 - l > > > rl > rl £
0 O P O O c o w X - r l O O T j - a O O M P X - ^ O O CO O O CO O O p r^
O O CO O
E 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 XI g E E g E X! E
005C3C 2EBC000012CD

005C78 2EBC000012D6
005C60 2EBC000012CF

005CAO 2EBC000012D8
005C86 2EBC000012D4
005C4C 39400006
005C2E 3940000A

005C54 D06C0006
005C50 302COOOA

005C5C 3940000C

005C6A 906COOOC

005C74 3940000E
005C66 610005FE

005C7E 610005E6

005C9C 3B400016
005C98 C1ED0018
005C90 3B400018
005C8C 610005D8
005C58 D06C0008

005CA6 610005BE
005C34 C1EC0002

005CAA 3B40001A
005C42 61000622
005C38 39400004

005C70 81EC0002

005C82 3B400014

005C94 302D0014

«=r
005C46 EB40

005C6E 48CO
005C48 48CO
005C32 3014

O
<H
CO

<
sp
0
m
o
o

299
Abacus Software Atari ST Internals

J-J
C
number of sectors on disk
-rH

O
0
o
00
vo

of the serial number


o
4-1

CD

CD 3

s already ?
10
C CO
ft fd

r address
-rl
o 4-J
tn
0
<d
ddress
CO CD
zero

O U
racks

O
CO ft tH rH G C PQ
to O CD 3 -H p<
•a CQ
er

er
4-J 4-J
rH
^, •o c to 4-J
K CD 4-J o C -H 4-1 fd 4-1 CO CD 3 H fH
Ol 43 c 4-J CD O C G MH CD CD 4-J 4-1 CD O
rH c •o ft 3 CQ 3 MH 4-1 4_1 to id O
H- o •o fa 0 O CM 0 3 ;>, Q 3 4-1
M o CU to CD 4-J rH 0 CQ
O ^
Q jp 4-J to
CD T3 •o 4-J CD CD 19 3
^ -H rH C ft 1-1 ft CO ft to >. 4-J CD j> 4-1 X 4-J
U-H -H CD e IH 0 3 O 3 ft M CD CO to fO
3 CM -rl -H O 3 3 O rH O rH O CD 0 ti ft 4-1
03 3 Q X CJ r^ Pj >-3 a. o ^EH S3 0 CO

r-
eC o rH rH
Q m 00 o rH rH CM 0 < CM
CM
Pu .—. ~~ CJ •. «. «. «, *«^ < *. rH
CJ ^D m CO CJ o rH O tH tn ^_^ r- r- vo vo ^», O ^31 .—, rH *. CM O *3< CM .—. rH <C O
CM Vfl <c rH Q <jj (^ rfj <; rH Q Q CJ r^ \ rij p^ U> *£ ^-^. O Q o w vo rfj — Q
rH CM ^ O ^ fc. ^ rH <J ~ 0 V£> fQ «, \O «. rH Q « Q n f£ «. «. «.
</> VO O —
CM O r- m m [*- ,—1 p»»^ ^/j. ««^ rH n m 4/j. •~^ rH Vt •^^
^ CM rtj m rH in o «• ^-^ CM o m
=w= </> Q CM Q Q Q < Q CO CO CO '*"" =ft= </> Q CO O <!
* * *
rH 3 3 ,_, 3 S H
s rH
s # rH
rH
g 43 rH
• rH |5 • £
. (—1 rH ^• S . rH . rH • CT S • * .H
CD to CD . (U CD • CD CD tr CD CD B
CD CD • CD CD (U Q)
• CU 0)
fa 4-1 > M <a > > -o p» •o *
p> •a ft 4J > •a > > TJ > tr P" *fl M > -a«> >
o O •a O O
>
O co x: -H O rH
^ o O TJ O •a O •a g rH O 0 •o 0 0 -o O OJ O M rH
g 43 CJ •o g O 43 g g g (B g (0 0 43 E g <a s g (3 g 43 S 43 O g e fd g g
005CAE 2EBC000012CF

005CCE D3FC000012BC
005CD4 11690008001C

005CE2 207C00000676

005D04 227C00003E2A
005CEE 227C00000674
005CBA 81ED0016

005CDC BE7C0003
005CB4 610005BO

005CBE 3B400012

005CE8 326E0008

005CF4 346E0008

005DOA 346E0008
005CFA 1091

005CFE 7001
005CC4 6016

005CCA D1C9
005CC6 204D

005CF8 D3CA
005CB8 48CO

005CEC D1C9
005CC8 3247
005CC2 4 2 4 7

005CCC 3247

005DOE D3CA
005D10 1280
005CDA 5247

005DOO 6002

005D12 200D
005D02 4240
005CFC 6704
005CEO 6DE4

300
Abacus Software Atari ST Internals

0]
H
Q) <o
4-1 0] u
CO -H
-rH (U
& 4-1 (U ( B O O )
43 T3 C 43

maxacctim
01 01
M -rH
P c u p
<U *: (U C S 43 G r5

rl o O O 0
O <a 0! G M CU 4-1 0 -H
4-1
U
(U
•H
T3
(U i
> 0- X
-H CM G
rl P
O >
H -H
M rl ft
<d
rH
CM
N
ts
0
A en O V - W Q » ^5 m

*
LO *
< *
*
ST *
•X
< •X
•X
r- •X
Q I
I *
•X

$25F6,DO
vo •X LO ^-- r- < 0 • rH
Q V O O Q »— <C !— —•. O rH
* K J ; Q K < L O - . Q L O Q a

$5D7A
H- + * 0 — C M - W —- L O C M r C C O O W V O ..COKC -rH rH rH CO O
Q c o t O L O r ~ v o < p q — « < Q [ ^ , > o t o — <<; Q
r- r- * 1 x Q r H Q » < KfO «.Q " . Q V O r f l Q *.PQ ^ •s VO rH
vo vo CMLO 1 LO [— < / > e M L O C M L O « > lOrHSf!^ rH rH «/> rH
ff. •X a =ft=-a>^=</>co Q=*^=i^«>=tt=</>=ft=o</>=*r</>Q Q
-X
rH •X rH rH r-H
& & rH 43 rH 3! rH

cmp,, 1
rH E •X g S CT - . r H 4 3 CJ1 -43 . . . rH rH rH rH
tst.

add,
add,
move

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

•a

bge
rH a c ft 4-1 r* ^3 r* 1^ *^ CL, fl) ^ *d r^ 4-1 CT r* 1^ r* 43
C 4-1 -H O g r H O r t O O T i S C O r l O O l C B O O O ts 0 P
P rH g 043E43Sg«5043S43e4-i43Eeg 01

CO rfl VO ie^
BOB9000025F6
D3FC00000678

o CM r- PQ
o tt) vo icr
0 CO 0 0
o •3* C M
4CDF30CO

C O O C M O O r H O
0 o O O O O O O O O
o to O O O O O O O O
o o o o o o o t ^ o o
vo en
D3C9
4A9F

SCO 4

LO N ^ T r H O L s 3 , > C J L O ^ r C M V O C J O « 3 1 C J C > \ i > rH rH


LO
I—
LO w CJ rH CO
w w H CO O Q O O W < P 3 O V O O O O < I > < O C M (0 CM o
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 CM

^r vo <£ CJ -X p£l CM 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 o CM T (Q o f£) ^31


rH rH rH rH rH CM 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 vo VO VO VO vo VO 1^
Q Q Q Q *
•X Q 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 LO LO LO LO 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 o o o o o 0 0 O 0 0 0
0 0 0 0 *
•X O 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 4240 clr.w DO
005D78 6004 bra $5D7E
005D7A 1015 move.b (A5),DO
005D7C 4880 ext.w DO
005D7E 4A9F tst.l (A7)+
005D80 4CDF2080 movem.l (A7)+,D7/A5 Restore registers
005D84 4E5E unlk A6
005D86 4E75 rts
*************************************************** rwabs, read/write sector(s)
005D88 4E56FFFC link A6,#-4
005D8C 48E70F04 movem.1 D4-D7/A5,-(A7) Save registers
005D90 OC6E00020012 cmp.w #2,18(A6) Drive number
005D96 6D06 bit $5D9E < 2 ?
005D98 70F1 moveq.1 #-15,DO No, unknown device
005D9A 6000010E bra $5EAA Error branch
005D9E 3C2E0012 move.w 18(A6),D6 Save drive number
8 005DA2 OC6E00020008 cmp.w #2,8(A6) rwflag
005DA8 6COOOOCE bge $5E78
005DAC 3006 move.w D6,DO
005DAE EB40 asl.w #5, DO
005DBO 48CO ext.l DO
005DB2 2A40 move.1 DO,A5
005DB4 DBFC00003E3E add.l #$3E3E,A5
005DBA 3E86 move.w D6,(A7)
005DBC 6100FF60 bsr $5D1E Test media change
005DCO 3EOO move.w DO,D7 Save status I
005DC2 BE7C0002 cmp.w #2,D7 Disk changed ? WJ
005DC6 660A bne $5DD2 No H
005DC8 70F2 moveq.1 #-14,DO Media change error
005DCA 600000DE bra $5EAA Error branch
3
Abacus Software Atari ST Internals

VI
<D
rH
•o
Vl G
o (0 CO
4-> p
O
01 Vl id
•a 01 O (H 4J
01
0} VI CO
en 4-> VI 4J
c O 0! C
13 o -rH
JS CO
O <o a
u fi
Vt •H X O
o 4-> O
4-1 "H (Q 0) U
0 Vl 4-1
01 (D O CO Ti
01 01 rH 3 >H 0)
o O pj O
a <0 O Vi
VI Vl
.X O VI 0)
x "O (1) O 4-> O 01 Vl •a o O O
01 <a *O (B O VI 01 VI <0 Vl VI Vi
-rl 0) -H VI 0) VI IB O Q) VI
Q (X en E-I cn pa CM cj P^ H

o
o O Q o
Q " vo Q
t- s r-
CJ
r— <
< < VO — CJ C-
«;
^p
Q
o-
— ^- o
-
VO O < vo *r
r- Q I r- Q 0 1 I f£ O Q < n m
W ^ w rH CM rH » P3 v — » m «. -
m rH m rH rH VO «> O in vo «=p o m CM o </> in "3» in m
1 Q =s= *Q «• Q i Q «> =*» Q =tt= «> i -to

s 3 3 rH rH S rH 3 rH
s 3 rH rH 3
(0 0.
VI g
0)
0)
>
o
.
Vl Vl
rH rH
0)a>
> >
o o
VI
rH
CD
>
O
Vl
01

•a >
•a o
(D Q) Q)
> > > vi -a
Q)

o o o 01 -o o o
CT
§§ O, Cj* 4-1
g a) 01 en o vi
0)
CO ^ (0 vi <a
rH Vl
o 43 g O O e g O e •n « g g g g -n <fl g g O 43 4-1 43 g 43 o 43

CJCM O o
ISQ in o
CMCM in o
VO m o
CO O rH O O O C J O CJ o CJ O rH O O CO
< O < O
o
o frt o Pn CM O
o o o o o
o o o o o OOOEc*E£4 o
o r- O
o r- o P3 vo vo
sp " co pa o r- CJ
m O CM O
o W CM CM Pu r- CJ O O CM O
vo pq vo vo VO CM VO •31 VO

CM VO pa o CM vo sC o o
CJ Q Q Q Q pa H H W p L , p t , ( i , O O O O O O r H r H r H r H C M CM CM CM f^l
Q Q O Q Q f*j Q Q Q Q Q Q Q [V| fV] pj p£J jv^ fv] (V] pT"j f£] pr"} pT"] pj p^ fv^
ininininininmininininininininintninininininmininininin in in
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o 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
Abacus Software Atari ST Internals

M
0)
1-1 3
tH C
3
4)
19
M -H
O SH C"
value

4-> (U
O 01 "O
0) (U
w <U 4J
^ 01
(U 4-> CD
^ JH 4->
0) X 0) 45 S-l
iou

4J 0)
tr> o O OJ M U 0)
1-1 E c c 03 C
O 3 <d (d <D 4-1 4-1 Id
C 4-> >i 3 0! O M 3 3 3
CO 0) O 43 C 3 fi 43 C G
M rH JM G. 43 0]
CD id id <D id a 0) S-l
V-1 "H Q, > 4-1 o > O
"O VJ E T! £ " -H O r-H -H 3
TJ (1) O 0) (U O M M O
sc co U s o S3 S3 Q Q O

O O
Q
"is
O IS
Q o
CJ Q Q o
m O CM •a- n < —• o — vo —
CM O Q in p4
co •» «C CO G\O ril I
rH W W CM W
V} — O CO i m m i m rH in CM ^r vo
=8= CO Q CM =#= </> * « • = * = rH Q

43 S5 •
- • 3= • S 3= CT • H 43 3 CT
0) fl) • 0) • • 0) Q) QJ * • • Q> * O"* 0) Q)
> > 4 J > 4 - i G . i T > i O ^ fl) ^ *O M -M Q) J> (3 O, 0> A > >
O O X O X E t U O M T3 g rH o Ti O T3 O G O " O < - H 0 1 G O H E rH 3 O O
E E a > E O ) 0 4 3 g 4 3 O 43 01 g g
0003E2A
0000676

00004A6

0010008
0000674

w
CM
rH
O O co co
O rH o o o
O O o o o
o r~ o o o o 0 o o o
O OinrHrH 'O'CMOO r- 0 &3 vo O vo O rH < vo O 0 CPl *3* w vo «3i W pq vo
coroco^r op^in Q -a1 pt! «3» o -a1
r~ o f-. CM h rH vo o vo ff,O
cocMCoo r-oo CM M Q 0 rH CM CO < vo o 0
O vo o rH CM o PM in pq CM
m m vo n Q CO Q VO CO Q «a" ^ vo r- vo
rH o vo m co co
CM -a* co (3 O CM «* fiC o w o vo co W 0 CM •a1 «C o O IT
m m m m m vo vo vo vo vo r- t- CO CO CO CO CO O\S
w ty pq pq &3 P3 W [£) W pq W f*J pq ^ H PL] W pq pq H W
m m m m m m in in in in m m m in in m m m m m m
o o o o o o o o o o o o o 0 0 o o 0 0 0 0 0 O 0 0 o 0 O o o
o o o o o o o o o 0 0 0 0 0 0 o o o o o o o o o o o 0 O 0 0

304
Abacus Software Atari ST Internals

floprw, read/write sectors


n PQ
cu PM
4-1 ra
C
-H CO CO
0 !H
a (U 0)
M

Buffer address not even 1


4-1

Clear oddflag
to
0 -H
<0 er> <s> cd er> en
4J (U rd
CO M rH (U
3 CM CO *W 0) 4J o

o CD cd
b
0)
o
-D7/A5,-(A7) Save registers C ro
0) CO
A s
o
rd
CO
0)
01
rd
CO
a.
CO
•a
C MH 4-1 (U CO O a) •o •a
•o a
o
3 3 Io CJ
CO
(Si 7! -H
Q EH
3 CO
0)
JJ
0)
CO
CO
•ts
CO

>H
CO
rH
Ed
CO
***************

in
-v
r-
Q
m
, 13 (A6)

O
1 I m Q vo in in
1 o
<* r- VO Ed
vo vo < + 1 VO 0 in o CO O CM in o CM
< Co Q Q a
ryi
a 1 Q CM CM
*
******•:

vo o vo CM vo in 0 0 0 in 0 in o CM in a\H O o vo

3
rH 03 «•

3
iH
I rH
< Q

rH

£
3
=tt=

3
Q Q =«= Q

3
rH

tf
Q CM

3
3 tr
Q Q

3 3

>
O
>
O
(U
o ^
CO
•a
•a
4-!
CO
1 rH
O
.X
CO
C 4-!
* C
-H
01
0
0)
0
rH
CO
4J
01
0
•o
•a
4-1
CO
4J
a>
c H H
rd >
0
CD
0
4-1
CO
0 >
0
i
0
0}
0
rd
j_i
£ £ £ .Q cd 4J £ 3 * rH £ £ cd (U £ cd .Q U X! £ £ 4-1 .Q £ £ £ X)
*
•it
•it
-X
*
*
*
•it
•it
< •it w Q
o •it 0
o Cd O
0 *
•it n o
o < CO 0 0 •it ri^ ^i1 o 0 0 Ed VO vo CO Ed
rH o 0 0 Ed fa o rH 0 0 fa f_J f—4 ^—I m
O o o o O •it
* fa fa O o o fa o O o
O o o o CM fa 0 o o fa o 0 0 0
fa Ed Ed o 0 fa fa Pd in * vo r~ Ed o O o 0 Ed tcp o CM rH O o (3j 01 o o o
CM CM CM rH fa a\ Q m r- * m Ed CM <3* O *3* fa CM o 53» O O •a* vo o o *3* *>r o
fa fa fa rH fa O Ed Ed * Ed CO 0 m CO f^ pp CO vo CM O O Q n3J vo o ffl ffl 0
o CM O VO Q •=3* •a1 •=r •5T •it
* *gi CO Ed ^p CM a o vo VO r— ^1* vo r- ro ro vo
vo <c ^r <=C O 0 CM
Ed CM
c\ <=C < < < m m
-*
n •a1 CO y 0 CM «gi vo o CM *ji vo CO (^J Ed CM ^i vo f3J Ed
CTl en •1C m ffl CQ o O O o O Q Q Q Q Q Q Ed Ed Ed Ed Ed
Ed W W Ed Ed Ed Ed Ed Ed td Ed Ed Fd Ed Ed Ed Ed Ed {V] Ed [V]
in m in m m in m in m * m m m in in in in m m m in m m m m m in m m
o o o o o o 0 0 0 •it
* o o o o o 0 0 0 0 0 0 0 0 0 0 o o o o
0 o o o o o o o o •it o o o o o o o o o o o o o 0 0 0 0 0 o

305
Abacus Software Atari ST Internals

1
ion as sector number
elds track number

r equals counter
X
0
(0

r of sectors
H
4->

as counter
tor number
number
H
CD
0.
M
O
4-> rH

tor O
CD H
01 o -H o 01 01 C7* CD CD o>« w
01 CD >, fl) -H 4J CD ,Q 43 43 01
CD 01 01 > a rH g g M g r-t
o O— -H M £_| 3 3 (Q 3 o
T5 ,—1 0, rH P. •3 T3 O O G G 3 G 4J
C" T3 id 01 (JJ 01 4-> o* 4-) tr U
J^
CD id o •a o •a m ,G G P. H A CD JH CD
11 -H
^, -H O 4-> <a 01 4J M O jj
^4 O 01
CD >[ ] >1 -H
4_> •o CD 4-> •H 4J
01 3 ^
CD O O jQ 01 4-> U o O UH
>M 0 rH ^ H CD
^4
[ 1 G CD ^ CD O
C31 t-4 •o n. TJ •O CD O O* 3 03 CD ^4
01
<d 3 a *. <D 0! CD 0 rH <a <d 0 M CD ^4
rH ^
O 01 0 •o O •a -H <Q 4J j_i H U 0! (0 4J 0} CD
G -H 4-1 3 <d 4J 3
•o tJ
Ti O CD
-P
0!
•o
G
O
CD -H
O
CD -H (U O
CD
-H
•S •8
-H 3
•8
TS
4-1
O CD
Q. f^
01 -H O
& CD O. G
ra -H
•§
3
03 ^
^4
0 3 CO U Q Q K CJ C3 03 CO o S 03 •o s o C5 *O S K

o O vo ^ o O m en
Q Q Vi) Q Q Q Q Q Q Q Q O
^_^ CJ „ , S ^ ^-* <~* ^
^__^
vo O m ^r vo vo vo to voto IO CO H m i n v o c o n o i n o vo o m co o vo
< o CM 0 <J 1 rij <I f^l <J CM c M Q < < l n Q i n < Q < «r < Q tn <
fa rH fa *— *. ~--' •fc— «^- •— *^ fa fa •* — — fa -fa — ~ — fa — - fa —
CM m W- LO o o tr VO CNJ «=? "O1 CM ^ji <qi m CM in rH in 'Q1
1 <rt =B= <J> \ Q rH Q CM rH Q CM Q CM «• CM •«> Q rH «• CM Q «> rH

'—I ^H ^H IS IS is ^
• rH • • rH S
CD C D C D C D ' O l O J i i O l C X " C D * * C D ( D * * C D ' C D
CV!>IO > > > 4 J > > 4 J > t O ! X ? * . £ 3 4 J C 3 * r > ( O r * * Q P 1 < C O £ > f Q n J r *
C D O U O O O X - H O X - H S g O 3 0 1 C D O r 4 O 3 g O > O 3 r 4 O
,Qg,Q g g g C D ' O S C D ' O O l U g o i 4 J 4 ) S 4 ) g o i O 4 3 g o i 4 3 g

CJ
pa
CM
W o sC < w vo w vo CO CO
M co CM co CM
fa o o fa 0 rH o rH rH ,_t
fa rH rH rH rH
fa o o fa o O o 0 0 0 fa O O O O
fa o o fa o O o 0 O o fa o o o O
la CO U •31 •w o w vo Q ql Q "31 Q •31 m vo rH Q rH CO Q ^1
^p CO Q ^ *?
vo o COo CM CM o
"531 W CM CJ ^r VO o o O VO vo o O rH CM •=P vo o CM •3" o CM
p£ [— o o O Q O co Q CO CO G\O CO CO CJ CM o fQ CO r- VO O O O o O VO VO 0 VO
•5P vo CM vo CM CM CO •31 CO CO •3" •31 m *p vo r- VO ro en
vo ^> vo r- en ^ vo co Cfl vo co
CM vow CO 0 COo
•vp w CM vo CO U w CM •=r vo CO < w CM IT vo CO CJ w CM *3- CO < CJ
^i
fafa fa fa 0 0 0 o o rH rH rH rH rH CM CM CM CM CM CM CO CO n co ^P
W w W fa fa fafa fa fa fa
fa fa fa fa fa fa fa fa fa fa fa fa
fa fa fa fa fa fa fa
m in IO in to m in in m m m in m m in in in tn tn in to to m 10 m in m IO m tn
o o 0 0 o 0 0 0 0 o o o o O o o 0 o 0 0 0 0 0 0 0 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 0 0 0 o o o o o o

306
Abacus Software Atari ST Internals

ent sector # (1st number

y, verify required ?

r, verify sector
M
O M H
buffer address
ead-write flag

4-1 CU CU
ation address O 4->
CU C
M 4-1
O C
CQ -H CQ 4-1 -H
O >H O O
fa a o cu a
4-1 01
pointer

address

buffer
& U CU CU T3 O
O <fl CQ MH Cti<d
O 4-1 MH 0) 4-1 CU
CQ MH 3 M CQ 'o
- O X) O
>1 4-1 K 4-1 0
S &H ^4 CQ CU G 0,0^1 n S H M M O MH
^ in rl H CU
CD ta rH O -H o <D ro _ V O < D < D O : S < U H -H CU y O CU CU 0 >
"O MH 4 - l S H . Q C U O 4 - l > ' H 4 - l Q . > H O C » . O 4-1 > 4-> P.
0 W cd MH
C 01 CU 3
3
tr <1)
n
I
H 4J
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
(U
0 > 0 3 -H (H
•3 U
CU
-H
H
3
-H
O
0)
O
rH
M EH P5 CQ [V] JH to Q M H C J S C O E H t O Q f a t O M H C J H O j2 n \f S
sectors
S to EH CO Q fa CO MH

o 0
Q Q i i 1 i 1
r- r- r-

Q vo
CO
Q
VO
r-
Co S o c-
rH
1i 1
I — VO 0
CQ o Q
t—i
r- vo VO
Q •5T Q
S i I i
vo ~ a
CM
CM
o
r. CO fa ^r fa rH vo
m VO o in vo o m co m vo •a- vo vo vo O n in vo vo Vt vo
CO 1 1 Q Q Q Q rH i 1 =tt= Q Q <o Q Q Q Q rH i </}

S rH S S S rH rH S 3 S ( j
rH
1—I
move,

move,
move,

move,
move,
move,
move,
move,

move,
move,
move,

move,

move,
move,
move,

move,
•S•o1 4-1
CQ
cr
0)
cr
cu
M
B 1
»H
rH
M •o
•o
4.1 CU
CQ C
4-1 tr
to 0) rH
H
tn
(3 4-1 X! 0 X) -n <a O -n cd 4-1 .Q 4-1 X! O

005FAE 2F3C000012BC
005F86 4EB9000063BO
005F6C 4EB900005910

005F8C DFFCOOOOOOIO

005FB4 4EB900006602
005F98 4 A 7 9 0 0 0 0 0 4 4 4
005F68 2F2EOOOA
005F64 2EAEFFFA

005F82 2F2EFFFA
005F5E BOAEOOOA
005F52 4A6E0008

005F5A 202EFFFA

005FA8 3F2E0010
005F56 67000080

005F7C 3F2E0010
005F72 588F

005F9E 6736
005F78 3F06
005F74 3E83

005FAO 3E83
005F62 6710

005F96 663E
005F76 3F05

005FA4 3F06
005FA2 3F05
005F92 2EOO
005F94 4A87

005FAC 42A7
005F80 42A7
005F50 5244

005F7A 3F04

005FA6 3F04

307
Abacus Software Atari ST Internals

4J
C
-H
O
0
O
CO

o
4-1

!H
01
0!
4J H
^
01 C 01 0) M 01
4-1 -H M 4-1 0 4-1
c; O C 4J G
-rH ID 01 4.) -H O -H
o CO M (U O
a O jj O a; a o> 0) P.
CO 03 4J M T3 •a
J< H -H U cu
o 01 4-1 rH o- 0! 0) T) O O !H a o
10 UH £_| 01 ta IH <o <a -rl O (0
4J CD IH 0) IH
^
IH 0) 4-1 M 01 •a o O 4J
w T3 3 > O ^O o IH H M O 01 •a -H O]
0 JP 4J 4-1 o 5 •a <0 4-1
.JJ O o O 0} O . 4-1
y o 0) M 0! cu a u
01 j^ ^
0 0 to 0) X O O J f f l O H O ) o u 01 01 M
J_) O 0- 4-1 4-1 4-1 SH > O
^
J^) O -rH *o O •o w H --H H
o S-t .***! O 01 CM <0 01 (Q p <fl O )H r)
u w o z, en 3 pa en ffl IH O EH O Q W

--- c^
0 0
1 1 Q Q
r- r~ r-
CJ r-
«> PQ Co —, Co cM - ID CM o t- CO VD O
Q CM Q 10 rH — I i l <c ca o Q £C rH f£
a\
CM < Q
fa rH O <s "s — rSI rH — 0 O
O o m VD vo — V£> U3 </> O VO O VD O VD m <=P VD t^
Q Q Q «• O Q Q Q rH 1 1 <-* =*=
Q 1 rH </> rH 1 </> =* Q «> rH Q

H s 3 3 s S rH H M rH rH rH 15 rH
M rH

•o
T)
. 01 •
> 4-1
O 01
0)
C
^
01
>
o
4J er
o
01
o o o
0) 01 01
O
01
0

rH
i >H -d
O la -O
(U 01
> > <i tr > >
0 0 g 01 o o
0) 01 tf
H TS 4-1 Ol
0) 13 01 CP
?
O
§
O
<U g 4-1 E g g g g g 0 e -'-i <0 g g O 43 g g -n tfl I i _Q E g

CJ CM O o
m Q rH rH
o CM CM O en
o rH XD O
o CO CO < O O < < o
o O CTl fa O O o o
o O CM fa o o o o fa o o
o O O fa o o o o o
cj o r~ o CJ O O CM O rfj n r^ w en cj
fa o 00 rH CQ O W O fci CO CO O O O CM <C CM pa fa
fa W rH |< I— W O W CM fa W 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

3FOO
4EB90000555C
548F

move.w DO,-(A7)
jsr $555C
addq , 1 #2,A7

On stack
Critical error handler
Correct stack pointer
I
006026 2EOO move , 1 DO,D7 Get error code
006028 BEBCOOOIOOOO cmp.l #$10000, D7 Attempt again ?
00602E 6700FF22 beq $5F52 Yes 65
006032 4A87 tst.l D7 Error code
006034 6C04 bge $603A OK
006036 2007 move . 1 D7,DO Error code as result
006038 601E bra $6058
00603A 3003 move . w D3,DO Sector counter
00603C 48CO ext.l DO
00603E 7209 moveq . 1#9,D1 Times 512
006040 E3AO asl.l D1,DO
006042 D1AEOOOA add.l DO,10(A6) Increment buffer address
006046 D76EOOOE add.w D3,14(A6) Logical sector number plus counter
00604A 976E0012 sub.w D3,18(A6) Decrement number of sectors to process
00604E 4A6E0012 tst.w 18 (A6) Sectors yet to read/write ?
006052 6600FE9E bne $5EF2 Yes
006056 4280 clr.l DO OK
006058 4A9F tst.l (A7) +
00605A 4CDF20F8 movem , 1 (A7)+,D3-D7/A5 Restore registers
00605E 4E5E unlk A6
006060 4E75 rts
w
************************************************* random, generate random number
006062 4E56FFFC
006066 4AB9000025FA
link
tst.l
A6,#-4
$25FA Last random number 23
I-H
a
00606C 6616 bne $6084 Not zero ? I-!*
CD
00606E 2039000004BA move . 1 $4BA,DO 200 Hz counter
B
006074 7210 moveq . 1 #16, Dl
5T1
Abacus Software Atari ST Internals

CO

bootload, load boot sector


t multiplication
CU

CO
(0
>H
ffl SH o-
(D
z counter

4-1
0) G 01 *Q •o
ro 3 <D -H P O <u
I
vo
i—1
CO
P
rH a rH
m CO
p
ti T!
rH

O
>
4-1
<0
> *o rH
>
4J
CM

O o
CO
0)
<D
G
10
o
c^
4-1 E rfl CO 4-1 •o 4-J O
o
rH CO a
JT{
ffl iH O -H JJ rj
10 c CO M 4-1
m 4-1 CM •o CO rH 4-1 03 CB -H 4-1 <u 0 4-1 0
rH 0 CO vo C 0. CO 1 en 4-1 (U H <D 4-1
(U -H

bootdev
1 o CM CO CM 4J rH -H SH X 0 0
O CM CO en M co U 4-1 5 CO 4-1 G CO -H •a r< Q CO CO 0) o
rd in 01 rH 01 -H -H P. M H •o 0, -H CO
CO CO rH 4-1 }q P G CO 0 •o P o •a o
.p p 01 *3* CO * ^t CO |
4-1 ^ rH O o § rH <a ra
-H rH CO rH (0 CM o 0) CO -H ^i <fl •o MH o U G 10 0 •rl
CQ CM D CO CO o K pq CM *********** tn G B CO G •z, o EH

I
o
Q Q
CM
< VO f=C o
1

$446
fa PJ 1 fa Q
m o » in
CM -sr < o CM [— w o r-

1C
O O fa O CM CJ 0 CJ
Q CQ fa Q fa a fa Q CO VO
| en f£
o Q CJ Q Q VO
h. *. rt.
rH
*.
r-
ri^ (^
^ CQ •> CQ m ^ K in fa *, o M. 0 rH "• rH
CM en CO rH O CM CO * VO vo m •& vo rH vo CM o VO CM VO ,— ] ^-* ^^
* fQ Q </> =*£ </> ^
Q </> «> =**= </> =*= I 1
*
* rH rH rH
* Jj; 3
* s

u• CT
• •
tr • 5s 3= s
* ^s/*
01 0) 01 (U • ^• (U
*
*
*
G
-H
rH
0
e
H
CO CO
•n 4-1 43
tr
a 0
e
(0
£
o
E
g
e
4-1
CO
4J
8" t
& o
tu
o> o
s
rH
U
M
U
*
*
*
*
*
* vo
* •c1
* ^ji
* 0
* o
2039000025FA
4EB9000094FA

23C0000025FA

CM VO
23C0000025FA
80B9000004BA

2F39000025FA

0060A8 COBCOOFFFFFF
2F3CBB40E62D

VO
* CO <^ f£ o
* en •a1 «gi o
* m o O o
* 0 0 o o o CM rH
* O o o o o O 0
*
•Je O CO 0 o 0 0 o
O o 0 o 0 o o
c— en en o cyi
508F

0060BO 4E75
0060AE 4E5E
5280

r-
E3AO

^S1 CTt
0803 9V0900

VO
*
*
*
m pa CQ r- o o
w CO pa (^ r- o pa f3^ r^ CJ
CM
O
O
CM
O
O
o n
CJ
M
w
vo
CM
VO
CM
* •a1 *T •a1 ^r vo r~ r~ to SP vo o VO vo CO ^P SP
*
o vo CO *3* CJ f-1 o VO CO o
00608A

00609A
00607E

006096

0060AO
006076

006090

006098
006078

* CM VO
006084

CM VO CO
* CO PQ P^
CQ CJ o U CJ CJ CJ Q D Q w pa pa
* o o o 0 o o o 0 0 O o o o O o o
* vo vo VO vo vo vo VO VO VO vo VD VO vo VO vo vo
* 0 o o 0 0 0 o o 0 o 0 O o o o o
* 0 o 0 0 0 0 o 0 0 o o o 0 o o o
*

310
Abacus Software Atari ST Internals

o
4-1
O
0!
CO

4-1
O
O

r)
O

n M g
d> CU
M 4-1 CO
O C (U g G y 0)
4-1 -H -a P -H O CO
O O o CO O 0)
W ft o v; ft CU
CO O 0 4-1
i-J X o CO
CU T) O o CU J5 "u JG -r|
m <a us <H O (0 4-1 c*» en
MH 0) 4-1 ra t-( 4-1 -H •a cu
p Vl « 43 CU T) CU CO rH -H
43 CO <d J_) 4-1 (Q i-H
J^ 3
3 •O T3 O (0 4-1 CU (0
M CU M S-l TJ
_ O 4-1 rH j_! 0 tr M
O t3 CU O H CU M '<d O O p <S
CU CU o
4-1 O 4-1 o ft 4-1
t5CU $O tJ & ^
M
O
°
VI
!-l
CO 4J
CU
0
rH
0
CU
rH H g
<8 0 O
4-1
o
O
G
CO
(U
W 43 CO M-l CJ </> 03 CJ O CJ

r- r-
r- !— — 0
I 1 Q
Q
< i
CO CM
< O CJ o o o <3- o o 0
O ^P
pq vo r- co W O
•>
H-
1 VO r- CM Q o rH rH ^31 rH Q •31 CM Q •=p 0 CM CO rtj CM CO Q
^J1 rH CM rH rH rH f-^ rH rH rH rH rH rH CM N rH rH
rH ^p TO- VO 0 VO i— VO vo VQ CO VO r- VO r^ VO TO TO- VO *sp TO- VO
•CO- —
i =N= TO- Q TO D TO- TO TO TO- Q TO Q TO- =S= TO- =8= =8= TO
* *
rH
s rH
J5

jj rH rH
^• rH rH rH 43 cT S ^• • • • &
CU CU ,
CU •
• • CU (U CU cu tr •
T3 4-1 01 H n) 4-1 CU <d 4-1 cT <0
o o ^
rH o w •a CO G rH n CO G 0 CO CU O ^1 O O CO T5 g G
g g O g -r-i m 4-1 43 O 43 4-1 ^
43 g 43 4-1 43 g 43 g g 43 <0 O 43
00000446

000012BC
00000010
000012BC

00000674
000062D2
0001

0100

VO "31 0
o co CO
rH CM o
0 rH o
cj en r- cj en O o -=r r- O o\ CO <3> P- «3* r- O O CJ 0 (k. CJ CT O CM CT fa fa
co ro <; co B Pu CO O CO O O CM *3* O O rH P3 ro o co r- O CT O o en Q
f'l f"l CM fa p£i fa < VQ CM O <. VO O O fS, C- 0 O rH CO O VO CM O 0 < CJ
n co CTCM -a- Q «3» VQ ^31 VO *3< VO r- vo •3" VO CO VO CO CM VQ m pq VQ CT VO

£C &j CT vo cj CM 00 (< CJ W O VO co ffC CJ W O CM •3- CO M CM CT co <; cj w o CM


W W fa O O O o o fV, fV,
rH rH rH rH rH rH CM CM CM CM CM CO CO CO CO CO
CO CT "SP
o o o 0 0 rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH rH
rH rH rH
VO VO VO VO VQ VQ VQ VO VO VO VO VO VO VO VQ VO VO VO VO VQ VO VO VO VO VO VO
VO VQ VO
o o o 0 0 0 0 0 O 0 0 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 0 o o o o 0 0 0 0 0 0 O O o o o o o o 0 0 0

311
3
vo

W
W
C

VO
to c—
M

LO
IM

H
P

CO

vo vo
T -a1

0 0
0 0
*********************************************** proto bt, generate boot sector

vo

VQ

•H

En
En

m
VQ
En
C

* vo vo
* •0< ^p
E 48E70704 movem.l D5-D7/A5, - (A7) Save registers

* 0 0
* 0 0
Abacus Software

\
cu

4J

EH
01
o

CO
o

4J
01

CM
tH

CM
IT)
O
O

O
O
ft

ft
S
-H
-H

<u
4J

rd
0)

ffl -H
X -H
IB

G
G

rH
VQ
VO

CD

CJ

VO VO
VQ
IO
3

o
CO

r^
rH
T5

Vt
0

=»=
o

0)

W CJ
0

«•

W
r- o
o

CO
10
ffl
o
o
o

o o
VD VD
LO

O
C 2F2E0008 move.l 8 ( A 6 ) , - ( A 7 ) Address of the sector b u f f e r

0 0
0 610000D4 bsr $6236 Calculate checksum
4 588F addq.l #4,A7 Correct stack pointer
6 B07C1234 cmp.w #$1234, DO Equals checksum for boot sector?
A 6704 beq $6170 Yes
C 4240 clr.w DO Not executable
E 6002 bra $6172
0 7001 moveq.l #1,DO Executable

312
2 3D400012 move.w DO,18(A6) execflg to 1 = boot sector executable
6 4AAEOOOC tst.l 12 (A6) Serial number
A 6D3E bit $61BA Negative, don't change
C 202EOOOC move.l 1 2 ( A 6 ) , D O Serial number
0 BOBCOOFFFFFF cmp.l #$FFFFFF,DO > $FFFFFF ?
6 6F08 ble $6190 No
8 6100FED8 bsr $6062 rand, generate random number
C 2D40000C move.l D O , 1 2 ( A 6 ) Save

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
V O V Q V Q V Q V Q V O f — r*-E^f^r"-COCOCOCOCF*

o o o o o o o o o o o o o o o o
0 4247 clr.w D7 Clear counter
Vt
vo

CO

CM

CM

vo
vo

<—1 t—1 *—t f~l «—l t—1 t—1 t—1 t—1 t—1 *~H j-H t—1 t—1 t—1 i—1 iH
o
o

o o o o o o o o o o o o o o o o o
0
ffl
4)
n
•g
•a
G

(!)

VQ

cu
&,

CM
o

<
o

g
3

CM
CM

r-i
o

o
o
0
o

0
8 COBCOOOOOOFF and.l #$FF,DO Bits 0-7

en a\n
vo vo vo
E 3247 move.w D7,A1 Pointer to next byte in buffer

o o o
o o
Atari ST Internals
Abacus Software Atari ST Internals

|
1
1

uals pointer to prototype BPB


of serial number in buffer 4J

copied already ?

the prototype BPB

cksum generation
-H
01
01
1H
-H CD
43

om buffer
G
CO id 0)
<D
o

ounter
ddress

ounter

4-> 3
-H Id 4J MH
O 01
!H 01 0) G 01
N O

•>
0) 3 CD 01 CD
(0 43 O CD o m -H TS -H tr 4J 01 o !H SH CU

i i (a1 1
CD g 4J G 01 01 CD G CD "M TS in
P 0 4J rH TS O T)
M G >! G r-l CD >i 0) CD 0 CTl O •a CQ G <d T) ^i
<a 43 CD 0! > 43 4J > 4J rH 0 M TS ol PL, CD >i !H O
g g T) Id 4J -H 4-> CD id to rq e TI H o 0 g
CD O r-) O] (D d) CD 4J CD 01 H 4J CD CD id CD J5 m
01 4J T) 0 M 0) X Id O G 01 H CD
P -H C
rH M
TS O
Id G G G
iH 01 bi
JS O -r) 0) -H -(H
•3 §
CD P 3
O rH
TS
TS
P.
0
O H
G rH 0
H-l
3
^,
CD
S X
P CD
PH S 05 M < H H IS Q S Q EH O CJ CU <c o H < IS ca 13 co s

VO
rH o
VO s5 o
rH — O
Q —
VO Q o VO Co
< rH v < VO
,—, Q *.
0 rH r- 1 ^_^ Q
0
•«--
, . 0 rH Q ^^
~"
s~. — v o o c M r - Q w \Q CO VO CM O ^-* rH p*. VO [— O VO , , CM VO «t VO <p
V O C O t < C Q r H Q sOT ^ FT3 fQ (T) f£ VO VO , , Q Q ro CJ i^C VO O ft _^, 1 I
-—
(£,
— O
•* *-" *.
CM CO O
". *. CO rH
rH V.
"•—' fH ~— rH
"^
VO VO VO </}• [—
rH
VO
K

r-
rij ^«, rH rH
•*-» VO «•
1^
rH
rH rH
rH </> VO VO 5 CM
VO ^1
O
*^3 0 CM
K

CO Q rH =tfc Q 4t= =S i-l •«> rH Q •«> Q CO Q *— =«= =»= <0


1 CO <0
1 ^^ Q
*
* *

rH
43 H
• • rH
rH
-
S
• |5 &
S
3.
• J5
3

rH
g.
• rH ^•
S 35
• .3 J5
rH

H
*
grH
5: •
• CD CD • CD CJ* • CD 0} • *
Q) • 0) • CD cr* O* • CD Q) CD • CJ1
T ) > > J H > T S Q , 4 J -P -P > rH M <d T! •> T! > TS TS fi» .p <»_) id r* > TS TS
• O O O M O T S g r H W <H 0 3 rH r-l ^
O T) O •o O TS T! g rH rH ^
O O 0 TS TS
< d g g l d g l d 0 4 3 -P .0 g g O ,£5 S g <d g id id O 43 U 43 g g <d <d

O CJ
O PL,
Q fe
VO tty
cococj u o o on co rHCQ n RCCO o <O
O O O O O rH rHhjO rHrH
tn fa ft, O OO
O O O O O O O h O OO
fa PufJH O OO
OOO O O O O feO OO
Pn falii O OO
Wowooi^Oi<Wcop£lcJr-vor^HvocJrHVor~o !rHPJWPt30iaia 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 '

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 202E0008 move . 1 8(A6),DO Buffer address
006206 DOBCOOOOOIFE add.l #$1FE,DO Plus $1FE
00620C BOAEFFFC cmp.l -4(A6),DO Last word already
006210 62E2 bhi $61F4
006212 303C1234 move . w #$1234, DO Checksum for boot sector
006216 906EFFFA sub.w -6(A6),DO Subtract from previous value
00621A 226EFFFC move . 1 -4(A6),A1
00621E 3280 move . w DO, (Al) Checksum in buffer
006220 4A6E0012 tst.w 18 (A6) execflg
006224 6606 bne $622C Boot sector executable ?
006226 206EFFFC move . 1 -4 (A6) ,AO
00622A 5250 addq . w #1, (AO) Increment checksum, not executable
00622C 4A9F tst.l (A7) +
00622E 4CDF20CO movem . 1(A7)+,D6-D7/A5 Restore registers
006232 4E5E unlk A6
006234 4E75 rts
************************************************** Calculate checksum
006236 4E560000 link A6,#0
00623A 48E70300 movem.1 D6-D7,-(A7) Save registers
00623E 4247 clr.w D7 Clear sum
006240 600C bra $624E
006242 206E0008 move.l 8(A6),AO Address of the buffer
006246 3010 move.w (AO),DO Get word
006248 DE40 add.w DO,D7 And sum
00624A 54AE0008 addq.l #2,8(A6) Pointer to next word
00624E 302EOOOC move.w 12(A6),DO Number of words
006252 536EOOOC subq.w #1,12{A6) Minus 1
006256 4A40 tst.w DO All words added already ?
006258
00625A
66E8
3007
bne
move.w
$6242
D7,DO
No
Result to dO
s.
n
00625C 4A9P tst.l (A7)+ 3
M
vf
Abacus Software Atari ST Internals

|
1
convert 8086 number to 68000 number
ffl
01
0)

ini, initialize drive

lock, set parameters


-H
-H
in m "O M

ct drive and side


rH rH TJ
i

k number to zero
i

ult error number


0> 0) ffl
f> CO X! co to
P 0
CO 3 c 3 CO rH
C r- O G [~- 4-1 0 MH
0) 1 -rH 4-1
4-1 01 •U 0 4-> 01 13 O Xi ffl
CO fl 0) H -rH CO
-H O CO CO 4-1 O! O CO jG 0) P
3 4J 0 4J S 4-1 4-1 4-1
0) -H ft -H -H 0)
rH o O Q 0 X! 0 -H e>«

rate
4-1 G O <8
01 CO Ol 0! -rH co 3 0! 01 ft < 4-1 01
CO -rH •O 4-1 co o •O 4-1 G rH
O 0) fl C CO 4-1 01 H C IB -H - 01 K O
K 01 rH MH rH X} ft 0 > rH X ffl 0 ft fl) 4-1
CO -H •Q 4-1 4-1 O -rH i3 4-1 4-1 O S o f> -H CO X! 01 MH 10 O rH CO
01 CM T3 01 X co fl •a 0) x CO O rH CO rH 0! CO 0! 01 rH rH fl) 0)
3 fH C5 w M sn < o w M O MH •O P x -o CO P EH MH efl rH

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

rH

rH
0 0 rH O
P P o rH rH rH
•ST P P P CM 0 o
-t- 1 0 *s o r— P CO CO o
VO o P VO Ex P CO en CJ O rH VO EM P P
En rH EM CJ CM CJ rH r- en CO
VO O CO rH rH VO VO CM VO VO 1 vo vo VO VO
00 rH P CO P «*• P rH =s= O =*»

rH rH rH
rH rH X) 3
e" 3 3 3 S 3 ey JS ty
01
o
rH CO
C 4J
Ht
Ht
G
-H
io 01

O
4-1
X
•o
G
rH
CO
ios 01
o
4-1
X
73
C
2=
M
rH
G
CO
4-1
He
He
He
<0
01
J
CO
tr
01
cfl
01
>
O
CD
o
rH
rH
w
CO
rH
CO
i
o
rH
CO
>
o
3 rH Ht

rH s 01 <S (0 £ 01 <0 O 3 rH He
He
rH 4-1 A rH s s U Q X) e X) E

He *
He H*e
He He
He He CM
He He 0
He He O
He He O
He Ht CO O O o
Ht Ht O CJ sr 0
VO VO *T 0
He
* Ht
* o o 0 0
o He U CO rH fi., CO EM He o CJ o 0 0 f£ VO 0 CO
CO He o O EM o He o O o o o ffl en 0 rH
O He EM o o O o 0 -}e 0 0 0 o o vo VO
O [•-! o o o o O He 0 0 0 o o o 0 EM 0
EM w m He
* VO w 00 o O o rv] rH rH O rH [V]
m en Eu VO EM en en CJ en o 0 0 vo
P in r~ He in VO CM CO «3* VO rH CO •5T in He CM VO 0 EM !— EM 0 VO o 0 o
0 [V} [V] He w o O CO o rH CM CM CO CM O ia H He CO f£ r- n m o CM rH rH CO rH Ed
•31 T CM rH •3* CJ W CM rH «gl O CO He *r ^p vo ro P^ VO VO CO VO
He
* He
f£] CM ^r He VO rt^ E£] <M ^I1 00 <J pq o CM VO CO (dj He CJ CM VO CO w VO CO O O <=r <; CM"
m VO VO He VO VO VO r^ [—
[-~
[—
r^ CO CO CO CO CO He CO en <n en en fQ *3* m ffl ffl ffl
CM CM CM -3c CM CM CM CM CM CM CM CM CM CM CM CM CM He CM CM CM CM CM CM CM CM CM CM CM CM
VO VO VO VO VO VO VO VO VO VO VO VO VO VO VO VO He VO VO VO VO VO VO VO VO VO VO VO VO
o 0 0 * O O O o O 0 O O o O o o o He 0 o o o o O O O 0 O 0 O
0 O 0 He
* o 0 O o O 0 O 0 o 0 o 0 o He o o 0 o 0 O 0 o 0 o 0 o

315
Abacus Software Atari ST Internals

Current DMA address equal edma?


floprd, read sector (s) from disk

ccount to dskctl, sector counter


cu CM
en r-

go2track, search for track


r~

wdiskctl, pass D7 to 1772

Decrement timeout counter


<a rH cu

floplock, set parameters


4-1

$ 6 9 2 ( A 5 ) , A 2 edma, destination address for DM.


O H
o 3
1H O
CO
-H
•oCO
-H •o
O
•o CO 4-1
0 IB 3
n
Error number to read error
•o t-l 0

mfp gpip, 1772 done ?


CO
0 t-l O G S-l

No, continue to wait


o

Data direction to READ


t-l o IB CO 4-1
t-l !-l CO o -H
cu H 4-1 CU 4-1 4-1
a CO -H CO M
o

#-l,$6A2 currerr to default error


(U -H O CO
c «•. 4-1 C 4-1 N 4-1
,-H -a O
cu

dmahigh
^ -H Q CO O
n

dmamid
dmalow
X ni CU 4-1 CO IB
o •o

Read multiple
o 4H tn O re) -H
4-1 ft ft C CU IS •a 4-1
CO o O IB CU IB -H CO
cu ^ rH cu rH CO C CO -H
« m H-l CJ CO EH O K M EH

$68C(A5) ,$FFFF8604

$FFFF860B, $69E(A5)
$FFFF8609,$69D(A5)

$FFFF860D,$69F(A5)
r*******************

#5,$FFFFFA01

$69C(A5),A2
#$90, (A6)

Q
vo" Co
<c <
I.I #-11, DO

#$90, D7
0
0

#l,D7
w o

$631A
CO
$6768

$69C4
$68AE

CM CM CO VO O O CJ
VO O Q o O fa r- 0 en O O in
CO CM CO CO 03 en co en CO CO CO
VO VO vo vo VO vo vo vo vo vo
CO CO CO CO CO CO CO <* CO CO

•» ,1
,1

3
,w

,b

,b
,w

,b
,w
,w

rH

L
T* V
cu
^CO cuc tr £o t-iCO
CU
>
cu
%o cu CU 4J
er
er
cr cuo § cu
ft
o §
*
t-l (0 -X H M CO > M CO XI 4J
CO cu -X ^
w CO CO c o o 0 o 0 0 CO o 4J cu 3 (U o o e tn
XI X) •° X! XI * a
E •° A
X) XI E E E E E e E XI E e X) X) CO X) E E E u X!

-X
*
•X
•X CM sp rH Q CO fa
* f£ o O en en en
•X VO vo pjj vo vo vo
* o CO fa o o o
* 0 fa O fa en ea Q
* o fa O fa 0 o 0
* o fa O fa vo vo VO
•X o fa O fa CO CO CO
o CJ CM o * fV] co p£ 0 o fa o o o O o o vo
en pa
fa fa fa en
CJ ^P CM in
o ^J1 CO -X rH 03 VO CJ en fa en en en CO 03 fa fa fa vo O en o
<^
in VQin m •X ^T vo m 0 fa 0 rH 0 vo 0 0 vo fa fa fa 0 vo 0
0 O o o .£ O
[— O o o o fa o o o o o o o o o o fa fa fa o
o CO O o o * o in O o o o 0 CJ CJ CJ Q o O o CJ Q en •31 r^ ^r en en en Q *3*
o o O o o * o fa O o o o pa pq P3 H ca CO o co vo CO CO CO CM r^ r^ PO Q
T—I vo f—1 o •X rH o rH rH rH vo CO CJ CJ O CO o PO rH CO •3* CO r- CO pa pa in PO
pa t—
vo vo vo vo
t— vo * VO VO VO VO vo CO CO CO CO CO CO CO VO CM CM o vo m VO (— rH rH pa VO
* r—
o •a* VQ <^ H •X CM vo 03 O O *gi CO CO CJ o *y ^p CO CJ O VO f^ CM ^ji vo CO O 03 o vr
CJ CJ CJ CJ CJ •X O Q Q Q CO CO CO fa fa fa fa o o o rH rH rH CM CM CM CM CO CO •31 ^r
CM CM CM CM CM •X CM CM CM CM CM CM CM CM CM CM CM CO CO CO CO CO CO CO CO CO CO CO CO CO CO
VQ VO VO VO VO -X VO VO VO VO VO VO vo VO VO VO VO 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 0 O O O O o o o O O o o O o o o o o o
O 0 o o o * 0 o o o o o o O 0 o o o o 0 O o o o O o o o o o o

316
Abacus Software Atari ST Internals

its, 1772 status in error number


isolate checksum und lost data

ycnt, decrement attempt counter


its, determine error number

rror, take default error


ct 1772 status register

ycnt to second attempt ?


ct DMA status register

kctl, read register

ek, home and reseek


t, end transfer

t, end transfer
t next attempt
err to timeout

her attempt ?
•o

ok, no error

e protect ?
try again 3
O

flopfail

error ?
rrror ?
status

c
•a
CO ^i CD >H 0> T3 * CD CO -. Q, £> to Q) M 4-) & .p o CD
CO i-i e o r d r - H < B i < c o . - | - i - | f a O ! - l 4 - l CO 4J O - i-i -H CO 0 « O ra 4-1
(D CD i ' Q) CJ) IS Q) Q) "(5 S2J '— 1 to Q) {3 (D (!) G O to ^1 (D CD Q) PH 0) CD
K o P5 w w pi Q >H tfl M K I-l CD M E3 to M < 2 0) & >t K >H O •o

*******************
in in
CM vo
rt 0 < o CM
r-
CM <H m
VO Q Q Q rH rH (3
CO O> vo 0 vo CO vo CM vo O o ^ 0 < Q O r t Q O r t —
CM CM r- 0 Q 0 Q CO 0 CO «• CO Q o C O Q < - Q < ^ Q < O
en n CMen en io co CO en CO co CM CO rH ».COCO sCO'ST sfOrtJ
vo VO | vo vo O vo vo vo vo vo vo VO vo I VO VO I -31 VO I CO VO VO

* * *

tr tr tr
0) 0) CD 4-) CD tr
rd > ^_i rd > > CO tr > £_l •a tr ^4
fV CD i-l £> ,-\. rd > a CD > co CD > m tr >
C^
O to O CO ^_) O O 4-J 0) O CO c CD CO g G CO 3 ^4 * o - u q o p c o p CD O
JO X! £ J3 A £ £ .Q g A rd A A CJ & ffl A JQ *
¥
¥
g £> f> £ A f t g £> rQ g

¥
*

*
*
*
CM CM ¥
*
r£ I— ¥
VO VO ¥
0 o ¥
vo w fS^ O O o ia CO CJ r-) rf. CM •eji <F ¥ vo ^p n o
a pLj
o en 0 CO vo f—( en 0 r- lO f-~ ¥ o o o <
pE-t o o o vo o ^p o vo«EP ^P ¥ o o o vo
o o ft|
o o o o o o o o o &4 O ¥ O O 0 0
o CJ CJ o H CJ vo o CM CJ o CJ o CO Q •3" o Q o o ¥ C O O « 1 C O O C J C J O ' 3 ' Q
o O r- o rH o rH m o (O o t-t VO o o VO o o ¥ p t t O t - H f i ^ O O P ^ O O C M
i-H O CO (H O c^) O CO r^ CJ .-H o t~ xH CJ vo j-H CO rf* o ¥ C M C O V O C M C O V O C M C O r ~ C M
VO VO CO VO VO CO CO o vo vo CJ vo VO o vo vo in vo vo ¥ t— o v o r ~ o v O r ~ o v o c o
¥
vo fiC 0CM vo CO CJ w CM •3* CO CJ o •sP VO CJ p=3 CM vo t£ ¥ WO-a'VOcocjWO'a'VO
^p •31 ^1 I/) vo vo r~ ( — p- 1— p-
in m m m CO co
VO VO CO ¥ coenenenenenen^ie^r^
(O co co co CO CO (0 ro CO CO CO CO CO CO
fT)
CO co
CO CO CO ¥ cococococOfOcorOfOco
vo vo vo vo vo vo vo vo vo vo vo vo V0 vo vo vo VO VO VO VO ¥ 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 ¥ 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 o o o o o o o o o

317
Abacus Software Atari ST Internals

on disk
(U
c X
Id o SH
CO id 0)

currerr to default error


o M
flopwr, write sector (s)
SH O' 4-1
d) rH o 4-1 EH
4-1 (-H SH 3
CO CD SH S-l 0) CM CM (U O
-H fl> d) o 4-1r~- r- U H
•o id o >M 0]r~ r- 0 CO
O •o 4-> 4-1 <H

select, select drive and seide


S-l -rl rH rH
SH CD o C 01 4-1 cn 3 d) 01
o a G Ci a> o -H 3 0) O o CM O G
j.l i-10,DO Default error to write wrror

CO d> SH id C SH 4-1 (U r-
4-1 <u cd
4-> o SH ca 0 4-1 r- SH
4-1 CD o O 0) p CD 4-> -H 4-1 r~ r- C rH -rl 3 4J
01 CO CD 0 in CO 01 G O CM O Q 3 4-> O
SH Q) o •a o tJ 3 f— 4-> O •o
a
0) X
CD
CO
4J -H 43
CO I 2
X
SH CO O
O H
IK r- o
CO rH
0
-H
4-1 •o
0)
SH
3
O
O
rH 0 co
1oid 0
4->
o
id
SH
O -H
•o SH
O
tJ
X
01 w
1-H
tu
(!)
ti
X
4-1 0
&
1
CJ a O ca •a -H O CO CO (D SH 01
0)

01
G
o tu
rH CO
SH -H
CO o
*, TJ 4->
<D 0)
4J
CM
0
w
rH
4-1
ca CO
U -H
0) SH
•H 01 O 4-1 01
•H
"H <H 0) (1) 0 CO
a
CJ HH O O O s CO & w CJ Q CO 1CA S 1EH S >H Q SH
******************

rH
t-l,$6A2(A5)

0 o O 0
m Q Q Q c—
vo vo vo Q fa
vo fa
CM in in O fa
o fa
Q
vo o o o o r- o fa O r- CO M
$6948

CM CO 0 CO o
fa VO CO Q vo < Q Q CM in en 0 cn O O CO 0 O
cn •a1
0 rH Q o CM
cn
t— CO CO CO CO CO rH cn rH
VO vo vo rH vo vo vo CM VO vo vo in- vo vo in VO rH VQ vo
Q =tt= "*> vt =*> =*=
* *
rH
s S
,w

pH
S S rH
w U
0)
o
CO
11
*
-X
-X
SH
01
§ ^
er s
o 01 o £j
CD s.
£-1
(U
c o ^
01
SH
CO
M CO <u
0! G o o
s Q
O
£ > SH § > ^ 01 O* CD SH
o O CO O O CO o fl 1 0) 3 G 01
(U
S
e H -X
•X
s 43 e CO O
^
o s 43 43 43 43 s s E s S 43 s e 43 5 43 43 CO 43 43
•X

*
*
•X
•X rH
•X O
rtj
* fa
* CM O fa
*
•X 0 fa
•X VO o fa
0 0 fa
CM *
•X 0 o CO vo CJ vo 03 W fa 0 0 0 cH o 0 o ^* in 1^1 vo
ffl CO CO ^
CO m r- Q j-^ en CM 0 Q CO CJ o 0 rH
VO *
-X VQ vo vo vo vo in O
fa r-) o t_j o in rH o in o o If)
0 •X 0 0 o o 0 o 0 O o fa O 0 O o o O o o o o O
rH in •X O VQ o Q o Q a vo CM o o o O 0 0 {_) CJ CJ o {_) o o O cn f^ r- CM o
«qi
cn
r^ 0 fa 0 CM •3* VO vo 0 0 0 0 m 0 0 fp co o P3 co
M ,—i CJ ta
0 to co o 03 fa o
rH ta CO P- CO VO rH
W *
•X rH o rH 0 CO 0 o vo o rH rH « o rH vo CJ CJ
CO ^r VO f- VO to m CO CO vo c— VO VO VO vo co co CO CO vo co to VO CM 0 vo vo VO
*
< W -X O •T VQ < H o •=p 03 f£ O O •=p CO CJ CM vo ,.;; w CM vo < (a CM CO 0 CM q, VO
<5 •X ffl m CQ ra ffl o CJ CJ o CJ Q Q Q Q w &3 fV) fa fa fa fa 0 o rH rH rH rH
CO CO •X CO CO CO to CO CO CO to CO CO co CO CO to CO CO CO CO "=T •CT
VQ vo •X VQ VQ vo vo vo vo vo vo VQ vo vo VO vo VQ VQ vo vo vo vo vo vo vo VO vo VO VO VO VO
0 o •X 0 O 0 o 0 o 0 o 0 o o O o O O o o o o o o o O o o O 0 0
0 o 0 0 0 0 0 o 0 o o 0 0 O o O O o o o o o o o o o o O o O
*

318
Abacus Software Atari ST Internals

|
|
|
|

|
|

|
|
|

|
|
|

1
1

1
fd

|
4J
id

|
•o S-l
4-1 O)

|
CO 4-1
O to

ccount, decrement number of sectors


0)

virgin, sector data for formatting


rH -H
O 4J
•o a C

errbits, calculate error number


3

flopok, all sectors, then done

select, select drive and side


id to

Write next sector without seek


rdiskctl, read 1772 registers 0
<D O

flopfail, no further attempt


g Q <s>
•oG 1 £n

interlv, interleave factor


CO 3 C" G
id

floplock, set parameters


X

68E(A5) cdma, DMA address to next sector


C
fi
!
O 0)
(D M 4-1 o
fi
O
0
4-1 X
Ol
£ U
X
CO

Default error number


O 4-1
0) 4-> 01 4J id -H
EH CO 3 M CO C

Another attempt ?
•z, G O) 4-1
•o •a

, $ 6 9 6 ( A 5 ) spt, sectors per track


(A6) Select 1772 status register

G to
Write protect ?

« 4-1
-H S-l § 4J o

flopfail, error
id 01 O O id to id o« 1-1
4-1 o U
0 id 0) S-l

No, flopfail
01 O 01 CD 4J
o •o
0) S-l 0) CO o 0) CO

s O
G
4-1 -H
CO

4J~ 4-1
n
3
0)

01 to
0
rH
4-1
O
O
0)
CO
O
>!
£a
<H
G
U
-H
oT
o>
G
i! 0
0)
CO
r-l
0)
4J
01 o
CO
0)
4J o
rH id
id
s W o CO to 1-1 s o

1—

,$69A(A5)
,$698(A5)
* CM
* CM
C(A5)

*
in in * rH
* CM
co
». o CO CM CM *
*
^* ^.^
Q CO to CO r- in 0
o o CO M o o o vo ^, vo w O CJ vo [— O <*C vo o o * VD 0 CM Q CO CO r- r- r- ,—
m CO Q CO Q 0 O in to CM tofc. o {— a to m r- to Q 0 * r- o [V, vo •^P f£ rfl *3*
en
f—t CO CO en CO OD CO CO * co CO a\o rH r- 01 '— ••—
VD to vo VD VD vo t/> vo rH^ in rH VD VD VO rH VD VO rH vo VD to vo 1 to
VD vo *T o vo —
to ^£ to to 3t= to =«= to * =8= =tt= to to to * to to * to to- *
*
to to to rH CM CM
-X
-X rH
U

3 s,—) s ^•
•X
cf
s ^•
|5

43 •X rH
0) 4-1 tr tf • tr •X cu 0! 0) 0)
id
O
J-(
CO
^t
CO
CO
4-1
O!
G
•0
G
0)
C TS
•o •a 43 tr
•o 3 a>
s-i (d
CO S-l
a 0)
G
S-l
CO
43
3
rH
a
rd
to
* a 01 S-l
-X
S-l to
g C CO o CO CO o o O
^
43 g 43 43 43 43 id 43 (d id CO 43 43 43 o 43 43 CO 43 43 * o 43 43 g 43 43 g g g
•X
•X
*
*
•X
Ed * vo
CO * rH
vo -It o
o •X o
o CM * rH VD CO rtj
o r- * CM en en en
CM VD •X CO VD vo VD
o O * 0 0 0
o
VD 03 vo CM CJ CO o O vo ^3* rH o CM N t-£ •X in fV] CJ CJ CO W
CO VD ra o Q
0 CO o
m CO 0 CO O CM
vo o VD CO m
O CM VD en •X vo CO O o rH rH
rH En O VO
t— EH CO •X r- CO [—
m CM 0 O O
O o EH o 0 o o 0 0 0 o o O o o •X co o o 0 0 0 O O
^3*
CO PQ o O
o
o 0 0 0 O
o 0 CO
*3* Q
vo
Q Q 0 0 CJ Q ^i O Q 0
vo 0 o
0 •X EH 0 0 pH 0 0 EH EH
rH vo o O VD O o * o o EH 0 0 vo vo VD
o O rH rH CO vo 0 VD CM vo co r- rH o O vo rH CO f£ 0 •X CJ VD rH 0 rH rH CP PQ CO
vo CO VO VO 0 VD CJ vo m o in VD VO vo o vo VO m vo vo •X o VD vo r- VD VO CO CO CO
,3; CJ O •=r CO O 0 T VD fS. CM VO < W 0 vo 03 O o *r -X CO o •3< 03 < W CM CO M
•-1 "-1 CM CM CM CM CO CO CO CO T T •=p •sp in m in m vo VD •X vo r- r- r- r- CO CO CO
C—
vo vo VO VD vo vo VD vo vo vo vo VO vo VO vo vo vo vo vo VD •X vo vo vo vo vo vo vo VD vo
0 0 o O o o o 0 0 o 0 0 0 0 0 o o o o O -X 0 o 0 0 0 0 o o o
o o o 0 0 0 o o o o o o o o o 0 0 0 o O •X o o o o o o 0 0 o

319
006494 7002 moveq . 1#2, DO 'changed1 o1
M
006496 61000592 bsr $6A2A Diskette changed n
00649A 610003CO bsr $685C hseek, search for track
00649E 66000360 bne $6800 flopfail, not found o
0064A2 336D06860000 move . w $686(A5),0(A1) ctrack, write current track in DSB 3?
0064A8 3B7CFFFF06A2 move . w t-l,$6A2(A5) currerr to default error
0064AE 6128 bsr $64D8 Format track
0064BO 6600034E bne $6800 flopfail, error
0064B4 3B6D0696068C move . w $696(A5),$68C(A5) spt sectors per track as ccount counter
0064BA 3B7C00010688 move . w #1,$688(A5) csect, start with sector 1
0064CO 6100015C bsr $661E verify, verify sector
0064C4 246D068E move . 1 $68E(A5) ,A2 cdma, list with bad sectors
0064C8 4A52 tst.w (A2) Bad sector ?
0064CA 67000342 beq $680E No
0064CE 3B7CFFF006A2 move . w #-16,$6A2(A5) currerr to 'Bad Sector1
0064D4 6000032A bra $6800 flopfail, error
to
***************************************************** fmtrack, format track
0064D8 3B7CFFF606AO move . w t-10,$6AO(A5) deferror, default error number
0064DE 363C0001 move . w #1,D3 Start with sector 1
0064E2 246D068E move . 1 $68E(A5),A2 cdma, buffer for track data
0064E6 323C003B move , w #$3B,D1 60 times
0064EA 103C004E move . b #$4E,DO $4E, track header
0064EE 6100010A bsr $65FA wmult, write in buffer
0064F2 3803 move . w D3,D4 Save sector number
0064F4 323COOOB move . w #$B,D1 12 times
0064F8 4200 clr.b DO 0 I
)•»»
0064FA 610000FE bsr $65FA wmult, write in buffer 1/3
0064FE 323C0002 move . w #2,D1 3 times H
006502 103COOF5 move . b #$F5,DO $F5
006506 610000F2 bsr $65FA wmult, write in buffer
00650A 14FCOOFE move . b #$FE, (A2)+ $FE, address mark
Abacus Software Atari ST Internals

•o
G

0
<n H ±> O
<U CD o C (1) ra (U
*H <l) C M 1-1
1-1 M H-) 01 M O 4-)
X! 3 id 3 O
XI Xi •o XI 4-1 4J 01 4}
CM 0 3
tH c C 55 ,_! CD H H 4J c
10 -H -H -H O
^ id g 01 O P. G
3
O -H
a> (U fl> r—) 4-1 to 0 - 4, ti H CD
4_) X) -H to a> o OJ
-H -H C o -H H <U 01 4J o
M M J_|
{^J to -H O1 o 4J
s 4J 0) fl to 3 0) 4J
X
<IJ
to
O
0> 0] <d g N U 0) <H 0)

X O O
e ^,
4J
(U
£
K

4J
•o -H C
4J -H d> -H 4J -H S 4J 4J
O 0) 4J 4J -H H s, tn 4J -P
<a -o o o p 4J IO 3 m VO W 3
M -H CD <D CM •a' £ CM £ [V, g fa IO -H
EH W (O CO CM V> 3 CO «• 3: </> CM > «- S

CM CM
< < CO
Q Q Q
CM
a rH

$696 (A5)
CM CM
$69B(A5)
$69A(A5)

< < rH O o •=r o io io Q o


Q P Q Q IO
vo
Q a Q
tH CM CO
F, co ~ — fa Q IO fa PQ fa c~ fa CO fa Q CO fa r-
CO CO - N m 0
IO
vo CM
fa voIO fa fa fa CM IO en
vo vo vo
on
vo VO
10 ^P IO
vt </> vo
VO VO -3" CM
V* V* Q * Q
*
* Q =tt= =t(= * -u>

s s XI s S Xi
move,,b

Xi X! Xf XI X!
move ,,b

f\M X!

I
»

•2
f>
move,
move,

move,
move,
move,

move,
move,

move,

C U < U G } ( ] ) < D < D Q <U <8 <J


> > > > > > > M > M M •o (U a, 0) > M
O O O O O O O 0 1 O
g g g g g g g X J g O
01
X!
01
XJ i to •o
X! id o Xi
rH
0 XI
O 01
£ X)
14F90000068B
14F900000687

14ED069B
14FCOOFB
323COOOB

323COOFF
610000CC

610000B6

103C004E
103C004E
323C0015

51C9FFF6
14ED069A

B86D0696
103COOF5

6FOOFF76
323C0578
D86D0698

B66D0698
14FCOOF7

103C004E
14FCOOF7

323C0027
14FC0002

323C0002

61000092
610000C2

o
5243
4200
14C4

6172

CO
fa
vo
00650E

00655A
00651A

006528
00652C

006556
006536

006566
006520

00653A

00656A
006546
00654A
00654E

006586
006530

006552

00657E
006514

006524

006542

00656E

006582
00651C

006576
006574
006534

00655E

00657A
00653E

006562

CM
r-
10
vo
o
o

321
Abacus Software Atari ST Internals

Decrement timeout counter


cu

Test write protect and lost data


4-1
CO CO
•H
0)
(!) 4->

wdiskctl, D7 to 1772
wdiskctl, D7 to 1772
CO H
-H CO
CO en
3 0)

$638E errbits, calculate error number


CO
Data direction to WRITE

mfp gpip, 1772 done ?


Timeout counter
3
CO
•o<d

Not yet timed-out ?


4J 0) -rl
CO C" CM
ra
in 4-> 0)
Sector counter to 31

Clear Z-bit, error


Format track command

0 t—
rH rH
a

#$190, (A6) Select DMA status


dmahigh

5g
O
dmamid
dmalow

P
cu O X 0)

reset, terminate
0) CO

Read status
CO rH -H
Yes
0)
rH
Q >H CO
cu 0) •o M 0)
S K
CJ
,w #$180, (A6) Select 1772
$690 (A5) ,$FFFF860B
$68F(A5) ,$FFFF8609
$691(A5),$FFFF860D

#5,$FFFFFA01
,1 #$40000,07
#$190, (A6)

VQ VO
#$90, (A6)

#$44, DO
, 1 #1,D7

i fa
(A6),DO
#$1F,D7

,w #$FO,D7

CM m
< vo
j.l #1,D7

O CO o CO
$65C6
$65DC

$692E

O
$69C4

$69C4

CM Q Q CO Q
rH in rH CM
0 VQ •to- VO 0 rH
=tt= =tt= to- * Q Q

45
,w

,w
move.,b

,w
move.,b

,w
move,,b

,w

3
»*•*
CU
>c u >a j>c uM > >c uMo ) > c oo ) t4 - r> 4 5 ty
a ) ! H >c u c o 0)
> >
<U
CO tT
0)
M T3 CO
0) ID
o O O O C O O O C O O - P C U 3 C ! « O - P 0 0 0) CO 03 C 4-> O rQ
g E £ 4 5 g g 4 5 g 4 5 4 5 c o 4 5 4 } g r < g g 4) 45 g 45 fQ *Q JH S "o
690FFFF860B
68FFFFF8609
691FFFF860D

0 fa
fa
0 fa
0 fa
0 fa
0 O O f a C M O O V Q q ' i n CO o 0 o O ^P CJ
CM C M C M r H r H C O f a O O O IO en o 03 G\1 fa
o o o
rH O r H O ' = l 1 r H O « q ' O O
o o o o o o o o o o
CO rH 0 rH roQ 0 fa
O 0 o O 0 fa 0 fa
Q Q a 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 VQ 0 0 CJ 0 0 O in O CM
W W 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 - m rH fa cq 0 o co
0
pq CJ O
ro co 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 O 0 CJ rH rH O
CO
rH rH 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 o vo VO VQ O •5T rH in
CO O CO o • ^ P O O O O - ^ C O C J O V O C t l O C M ^ C O r i ; O 0 CXI vo 03 O O •O' CO < CJ
CO CM CM f3* t<rt;r<pqpqpqcqcjcjcjCiQQQC> Q W pq fa fa fa fa fa
in in m m i n ininininininminininininmin in m m if) m m m in in m m
vo vo vo VQ V Q VOVQVQVOVOVOVQVOVOVOVOVOVOVO vo vo vo vo vo vo vo vo vo vo vo
0 0 o o o o o o o o o o o o o o o o o 0 0 0 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 o o o o o 0 0 0 0 o 0 0

322
006600 4E75 rts
ft
************************************************ flopver, verfiy sector(s) in
006602 610003EE bsr $69F2 Change, test for disk change
006606 70F5 moveq.l #-11, DO "read error 1 , as default error
006608 6100015E bsr $6768 floplock, set parameters
00660C 6100033A bsr $6948 Select
006610 6100029C bsr $68AE go2track, search for track
006614 660001EA bne $6800 flopfail, error
006618 6104 bsr $661E verifyl, verify sectors
00661A 600001F2 bra $680E flopok, done
00661E 3B7CFFF506AO move . w #-ll,$6AO(A5) deferror to 'read error'
006624 246D068E move . 1 $68E(A5),A2 cdma, DMA buffer for bad sector list
006628 06AD00000200068E add.l #$200,$68E(A5) cdma to next sector
tx> 006630 3B7C00020672 move . w #2,$672(A5) retrycnt, 2 attempts
W 006636 3CBC0084 move . w #$84, (A6) Select sector register
00663A 3E2D0688 move . w $688(A5),D7 csect, sector number
00663E 61000384 bsr $69C4 wdiskctl,to disk controller
006642 13ED0691FFFF860D move , b $691(A5),$FFFF860D dmalow
00664A 13ED0690FFFF860B move , b $690(A5),$FFFF860B dmamid
006652 13ED068FFFFF8609 move . b $68F(A5),$FFFF8609 dmahigh
00665A 3CBC0090 move . w #$90, (A6) Clear DMA status
00665E 3CBC0190 move . w #$190, (A6)
006662 3CBC0090 move . w #$90, (A6) Data direction to READ
006666 3E3C0001 move . w #1,D7 Sector counter to 1
00666A 61000358 bsr $69C4 wdiskctl
00666E 3CBC0080 move . w #$80, (A6) Select 1772 command register
006672 3E3C0080 move . w #$80, D7 Read sector command
006676 6100034C bsr $69C4 wdiskctl
B
00667A 2E3C00040000 move . 1 #$40000,07 Timeout counter B3
Abacus Software Atari ST Internals

|
|

|
1
4J
CQ
-H

abschlie@en
rH

O
n
M CU
CU 4-1 CU
XI G 01

M 3 CO O •o
ca

register
CU C 4-1 0
4-1 CB
counter

?
Null
CO S-4 T> r4
-rH O O H G
-H

attempt
Cn M 4-1 4-1 CU
CU CO M CO CJ 4-)
M 3 0) O CD C
cu 4-1 H 4-1 CO -H CU

mit
c co ca cu a M o

retrycnt

?
o
status
timeout

3 4 J 4 - 1 T J E O 4 - 1 Q.
-a 4 - ! C Q r a G O ) 4 - l G C < .
ca rH ca 4-1 o CD <c

attempt
C
ut yet ?

list
C 4 J T S 3 4 - l C U E H S

2ns
CM
r- - r H C Q c a O C J c B t o C U O Q
ca CB rH fU r) 4-1 o
o i f - t n c M r - i c B O ^ ^ O O ^ 4-1
DMA

CM 1 3 car~ U X X 0) <U 4) O 0

tor
r- cu cu
nt

4-1S-4 r ~ ^ K ( D C 1 ) T 3 C Q C Q 4-1

nt
t,
a r^ 4-1 c a O > i r H r H ^ f a G G CD CO O
cu o j-H 4-1 4 J r 4 H 4 - 1 0 ] ^ K r 4 K 0 c (U rH cu
a S 1 ca 4J 01S-)4-14-lO4-lpS - »4-lCU cu o .X E CU IK CQ
cu -a 4J o CU O X - H ( - 1 4 - 1 G J 5 - CO
^ CU 0) .C 4J
M CU CU 4-1 cu 4-1 K C U 0 1 X ) 4 J O C J 3 4 - l c a
^ cu rH 4-1 CJ 4-1
& 01 0 E 01 X C B < 0 1 r H - r H M 0 1 H C U O O g •o 4-1 CQ 0 0 CU
M-l CU CU -rH CU cu cu c u S c u c u T i r H C U r H o i e j c T ) ca 0) O (U CU G CQ CU
s x Q EH K Q > H W ! H C U E H f 4 0 C J < O X! M 2 rH Q < 0 2
FFFFFAOl

CM
<
68C(A5)

in w in in
CO fc.

vo vo VQ
o 0 CO CM CM in
Q Q CO
r- 0 0 CO w vo o o vo vo < VO CM CN
</> en Q CO CM CJ o , , Q CJ 0 Q CO CJ CJ </> n o .—
</> Q r^ </> CO PQ
K vo K vo m VO en VO vo CO en n rH vo V*K, 1^ vo CM CM K vo CO ^ ^
VO CO vo
in vo rH VQ VO VQ </> f£ o vo </>• vo vo </> vo rH rH vo </> rfj rH vo vo rH vo vo vo
=tt= </> U> «• </>
* "—" =tt= •!/> =*. </> «• «• * «> * *-~ </> «• «• «• co-
* * * * *
,_, g. J. g. 2 S 3 S
. • . • X) . rH K
4-1
to
4J
cr
cu
s3
CU
c
t-t a
to SH
(U
o o
>
4-1
CO
4-1
cr
cu o ^
CO
g M
CO
•o cu •§"
G c •a
O1
3 G 3 rH
^
X) CU X) n Ol
4-1
a
so
0)
G
M cf
X) rH
01 3 a o
cu
ca
rH
X) to X? ft E E X! X) E X! Xi ca X! C3 Ol X) CQ 0 rH X! X) 01 XI E X)
A

rH u
0 CO
<. VO
fa O
fa o CM
fa o r~
fa CN vo
fa O 0
in a o o o CM qi CJ U •31 CO o rH vo CM vo CO
o en en o m U CO rH r- CO CO o O r^ vo 03
0 CM o o o n O O vo vo fa 0 0 vo fa VO
^
i-H
0 o o o o o fa O 0 o fa o o o fa o
0
er\ f£ r— CM o VQ CJ vo o < CJ o o CJ CO Q Q o Q CN m o o a
^r 0 Q [•-•)
0 CO fa o (T)
pa rH o CN pa o o vo vo o < m r-
rH VQ o
0 0 VO o
CO (— n VQ rH O CJ O CO r— CJ rH rH o vo CM n vo CM CJ nvo rH^r o
o VQ m VQ VQ vo m o VQ n VQ VO CJ vo m m vo 0 <3* O vo VO
m vo m vo
0 oo <; Cj w CM T CO pq H o •=r CO CJ o CM VO < w VO CO <, o CM vo w ^q CN
CO CO CO
CO co en en en en en f£ ^q pjj < CQ CQ CQ pq CQ CJ O U Q Q Q D Q pq
vo VQ VQ VQ vo vo VQ vo vo vo vo vo VO vo vo VQ vo vo vo vo vo vo vo vo VO vo vo vo
VQ VQ VO VQ VQ VQ VO vo VQ vo vo vo VQ vo vo VQ vo vo vo vo VQ vo vo vo vo vo vo vo
O 0 0 0 O O O o 0 o o 0 O o o O o o 0 o O 0 o o 0 0 o 0
o 0 O 0 O 0 O 0 0 o 0 0 o 0 0 O o o o o o o o O o o o o

324
************************************************ flopvbl, floppy vertical blank handler
0066E4 9BCD sub.l A5,A5 Clear A5
0066E6 4DF9FFFF8606 lea $FFFF8606,A6 Address of the floppy register 6
0066EC 50ED0680 st $680 (A5) Set motoron flag Cfl
o
0066FO 4A6D043E tst .w $43E(A5) flock, disks busy ?
0066F4 6670 bne $6766 Yes, do nothing
0066F6 203900000466 move . 1 $466, DO frclock
0066FC 1200 move , b DO,D1
0066FE C23C0007 and.b #7,D1 Calculate mod 8
006702 6638 bne $673C Not yet 8th interrupt ?
006704 3CBC0080 move . w #$80, (A6) Select 1772 status register
006708 E608 Isr.b #3, DO Use bit 4 as drive number
00670A C07C0001 and.w #1,DO
00670E 41ED0674 lea $674 (A5>,AO wpstatus, write protect status table
006712 DOCO add.w DO,AO Index with drive number
006714 B079000004A6 cmp.w $4A6,DO nflops, number of floppies
N> 00671A 6602 bne $671E
01 00671C 4240 . clr.w DO
00671E 5200 addq . b #1,DO Drive select bit
006720 E308 Isl.b #1,DO Shift in position
006722 OA000007 eor.b #7, DO Invert for hardware
006726 6100026C bsr $6994 Select drive
00672A 3039FFFF8604 move . w $FFFF8604 ,DO dskctl, read 1772 status
006730 08000006 btst #6, DO Test write rpotect bit
006734 56DO sne (AO) And save
006736 1002 move.b D2,DO Previous select status
006738 6100025A bsr $6994 Recreate I
00673C
006740
302D0674
816D0676
move . w
or .w
$674 (A5),DO
DO,$676(A5)
wpstatus
Write wplatch i
006744 4A6D0682 tst.w $682 (AS) deslflg, floppies already deselected?
006748 6618 bne $6762 Yes
00674A 6100028C bsr $6908 Raed 1772 status register 1
B>
5?
Abacus Software Atari ST Internals

ock, disable floppy-vbl routine


dress of the floppy register

ount, number of sectors


s, then don't deselect

ma, start DMA address


ear motoron flag

t motoron flag
CD
01
t deslflg
th drives

-rl
43
CM
c m

trycnt
oplock

ferror
rH
select

o in
gsave

rrerr
X 4->
rJ H 4-1 o CD 01
0 <a o cd •a p
o
o
CD -H 43
rH d>
0) (U rH •r) 43
o <u o CU 01 rH rH CD •o cu CO P
r-t rH *3 TJ 01 4-1 ta 0 cu 01 •a M 01 o -rH •a
s JH CQ Q en O M-) t-l o <: to •a o IH o u 0 o 0 0 >-t •a 0 Q •a u EH o

•X *3>
f£ >_s
vo m m m in in
•X
* </> m .=q
•X vo
^__ •X vo ___ __^ ^ S •a1 CO vo rt 0 ^^ rH rH p- 0
in f£ fc. m in m w CO CO CO CO CO in rfj•. <c£ Q rij
* 1 vo f£ CO vo vo vo vo vo M. *, M.
^_^ * CO o •—' ~— •^— vo </> {/> </> «• **• ^^ ^^ ^^ ^^ ^-^
-CM
— m * < VD 0 CM vt ••• **>•• •* •• CM in in m m m
o vo
CO
o •=r VD 5. *
^c CO
•X r~ in Pn
co , [^
vo VD •a1
-
p- t^ p- (~- vo q, p- p- p- £ ss
Q vo Q en «• o o fn o <o <«• «• p- <l <c < < < «• CO T o — o Q — o Q Q w
p- VD
en
vo rH
CO
vo
•*
X CO
co m fcl vo o O rH s o CO o
VD CO o CM •=r CM vo VD vo vo o vo CO rH vo
CO CO
<*> =*= =»= </>
f"*1

4J> =tt= </>


^ </> * Q •(fl- </> Q Q =^= CO rH rH CM CM CM <ft </> </> </>
* * * ^ *
* rH rH
43 IS *
*
S S & rH s s s 3 s s FT1
s i-H
\J
u
W 0) . cu . CD CD (0 (U (U on cu (U cu cu . cu cu . . CD
01
jj c
0)
^ ^f 01 *
•£ 43 ed > ca 4-1 tr cd rH rH
0 01 o rH 4-1 •X o (U .p 0 0 0 o o o o o 0 0 0) 01 cu cu o o 01 01 0
43 45 g 43 g O
*
g ta rH 01 g g G g g g g g g g rH 4-1 43 r-H g g rH rH g
•X

*
•X

*
*
-X •=3*
-X i^C
vo
-X
* o
CM •X o VO0 td fVj ^p CO vo rt^ 0 CM
CO -X 0 co CO CO CO CO CO CO p-
0 CO
vo 0 vo vo
o1 vo vo vo vo vo vo vo
o *
-X o CO o o o o o o 0 0 0
r^ r~ <j rH 0 -X 03 o O CM rH CO o CM ql vo CO CM CO ^r
CT,
o o M
0 o CO O CO b. fe, o < O o rH rH rH rH rH 0 o CO CO CO
o o CM 0 VQ *
-X CO 0 vo VO o 0 0 0 o o o o vo vo vo vo vo
o 0 0 0 O •X [•— r-. o o o o o o o o o o o 0 0 o 0 0
o CM o 0 o
Q m a\O O en en o o o P>4 pt, r Pu pt. o Q Q T) r T,
tp Q o Q r T| P>4 Q
o
CO
o
rH
VO
VO
CO
o
rH
0 p- VO
rH CQ CM
VO CO *3*
S
•SP
*
•X
-X
*>p
H
Cn
Q 0
•3* m
s co £co
CO
CQ
VD

CM
vo vo vo vo vo p-
CQ CQ CQ CQ CQ CQ CQ co
co CO CO co co
vo 0 w
^J1 vo
p- co
o
p- CO
CM
rH
p£)
co
w
vo
0
CM
*
w CM •5P CO 0 CM VQ * CO O CM pqCO CM vo o CM CO w ^31 fQ 0 vo pq 0 ^r vo r3J CJ [V]
^ m in in m VO VO * vo p- p-p- p- 03 CO CO en en m f^
en rt^ (Q CQm o o o o CQ o o
p- p- t— p- P- p- P- * p- p- p-p- p- P- p- p- p- p- p- p- p- p- p- p- p- p- p- p- p- p- p-
vo vo vo vo vo VO VO *
-X vo VO VOvo vo VD VD vo vo vo vo vo VD vo vo vo VD vo vo VD vo VD vo
o o 0 0 0 o O •X 0 o o o o O o o o o o o 0 0 0 0 o 0 0 o o o o
o o o o o o O •X o 0 0 0 0 O o 0 0 0 o o o o o o 0 o o o 0 0 0

326
0067D2 D1C7 add.l D7,AO Plus length of sector
0067D4 2B480692 move . 1 A0,$692 (A5) edma, yields end DMA address
006708
0067DC
0067DE

4A690000
6A20
61000168

tst.w
bpl
bsr

0(A1)
$67FE
$6948

dcurtrack, current track


>= 0 ?
No, select
I
0067E2 42690000 clr.w 0(A1) Set track to zero
0067E6 610000EC bsr $6804 Restore, head to track zero
0067EA 6712 beq $67FE OK ?
0067EC 7EOA moveq . 1#10, D7
0067EE 6172 bsr $6862 Seek track 10
0067FO 6606 bne $67F8 Error ?
0067F2 610000EO bsr $6804 Restore
0067F6 6706 beq $67FE OK ?
0067F8 337CFFOOOOOO move . w #$FFOO, 0(A1) Recalibrate, error
0067FE 4E75 rts
ij *************************************************** flopfail, error in floppy routine
"*•! nneonn inni mmr&n ^ 41 nn Media change to 'unsure'
006802 61000226 bsr $6A2A Set
006806 302D06A2 move.w $6A2(A5),DO currerr
00680A 48CO ext.1 DO
00680C 6002 bra $6810
*************************************************** flopok, error-free floppy routine
00680E 4280 clr.l DO
006810 2FOO move . 1 DO,-(A7) ok
006812 3CBC0086 move . w #$86, (A6) Select 1772
006816 3E290000 move . w 0(A1),D7 Get track number
00681A 610001A8 bsr $69C4 wdiskctl, send to disk controller
00681E 3C3C0010 move . w #$10, D6 seek command
006822
006826
610000C6
303900000684
bsr $68EA
move . w $684, DO
flopcms
cdev, drive number
9
00682C E548 Isl.w #2,DO As index o"
00682E 41F900000678 lea $678,AO acctim
I
en
006834 21AD04BAOOOO move.l $4BA(A5),0(AO,DO.w) 200 Hz counter as last access time
00683A OC790001000004A6 cmp.w #1,$4A6 nflops cn
006842 6606 bne $684A
006844 216D04BA0004 move.l $4BA(A5),4(AO) 20 Hz counter for other drives
00684A 201F move.l (A7)+,DO Restore error number
00684C 4CF978F8000006A4 movem.l $6A4,D3-D7/A3-A6 regsave
006854 42790000043E clr.w $43E Clear flock, release vbl routine
00685A 4E75 rts
****************************************************
00685C 3E3900000686 move .w $686,D7
hseek, head to track
ctrack
006862 33FCFFFA000006A2 move .w t-10,$6A2 currerr to 'seek error'
- 00686A 3CBC0086 move .w #$86, (A6) Pass track number
00686E 61000154 bsr $69C4 wdsikctl
10
NJ 006872 3C3C0010 move .w #$10,D6 Seek command
00
006876 60000072 bra $68EA flopcmds
***************************************************** ressek, home and seek
00687A 33FCFFFA000006A2 move .w #-10, $6A2 currerr to 'seek error1
006882 6150 bsr $6804 Restore
006884 664C bne $68D2 Error ?
006886 42690000 clr.w 0(A1) Current track to zero
00688A 3CBC0082 move .w #$82, (A6) Select track register
00688E 4247 clr.w D7 Track zero
006890 61000132 bsr $69C4 wdiskctl I
006894
006898
3CBC0086
3E3C0005
move .w
move .w
#$86, (A6)
#5,D7
Select data register
Track 5
i
00689C 61000126 bsr $69C4 wdiskctl
0068AO 3C3C0010 move .w #$10,D6 Seek command
0068A4 6144 bsr $68EA flopcmds
I
0068A6 662A bne $6802 Error
0068A8 337C00050000 move.w f5,0(Al) Track number to 5
*************************************************** go2track, search for trak WJ
0068AE 33FCFFFA000006A2 move.w #-10,$6A2 currerr to 'seek error1
0068B6 3CBC0086 move.w #$86,(A6) Select data register
0068BA 3E2D0686 move.w $686(A5),D7 ctrack, load track number
0068BE 61000104 tosr $69C4 wdiskctl
0068C2 7C14 moveq.l #$14,D6 Seek with verify command
0068C4 6124 bsr $68EA flopcmds
0068C6 660A bne $6802 Error
0068C8 336D06860000 move.w $686(A5),0(A1) ctrack, Save track number
0068CE CE3C0018 and.b #$18,07 Test RNF, CRC lost data
0068D2 4E75 rts
*************************************************** restore, seek track zero
N> 0068D4 4246 clr.w 06 restore command
*° 0068D6 6112 bsr $68EA flopcmds
0068D8 660E bne $68E8 Error
0068DA 08070002 btst #2,07 Test track zero bit
0068DE OA3C0004 eor.b #4,SR Z-Flag invertieren
0068E2 6604 bne $68E8 nicht Track Null ?
0068E4 42690000 clr.w 0(A1) current Track auf Null
0068E8 4E75 rts
***************************************************** flopcmds
0068EA 30290002 move.w 2(A1),DO Seek rate
0068EE C03C0003 and.b #$3,00 Bits 0 and 1
0068F2 8COO or.b DO,06 OR in command word S3
0068F4 2E3C00040000 move.l #$40000,07 Timeout counter
0068FA 3CBC0080 move.w #$80,(A6) Select 1772 register
0068FE 61000008 bsr $6908 rdiskctl E,
of
006902 08000007 btst #7,DO Motor on ?
006906 6606 bne $690E Yes 8
006908 2E3C00060000 move.l -#$60000,07 Else longer timeout S
00690E 610000AA bsr $69BA wdiskctl6, write command in D6 en
006912 5387 subq.l II,D7 Decrement timeout counter
006914 6712 beq $6928 Timed-out ?
006916 08390005FFFFFA01 btst #5,$FFFFFA01 mfp gpip, 1772 done ?
00691E 66F2 bne $6912 No, wait
006920 610000AC bsr $69CE rdiskct!7
006924 4246 clr.w D6 OK
006926 4E75 rts
006928 6104 bsr $692E Reset 1772
00692A 7C01 moveq . 1#1,D6 Error
00692C 4E75 rts
u>
u> *************************************************** Reset 1772, reset floppy controller
o 00692E 3CBC0080 move.w f$80, (A6) Select command register
006932 3E3COODO move . w t$DO,D7 Reset command
006936 6100008C bsr $69C4 wdiskctl
00693A 3E3COOOF move . w #$F,D7 Delay counter
00693E 51CFFFFE dbra D7,$693E Timed-out ? read status
006946 4E75 rts
*************************************************** select, select drive and side
006948
00694C
006950

426D0682
302D0684
5200

clr.w $682(A5)
move.w $684(A5),DO
addq.b #1,DO

Clear deslflg
cdev, drive number !
006952 E308 Isl.b #1,DO Calculate bit number
006954 806D068A or .w $68A(A5),DO cside, side in bit 0
006958 OA000007 eor.b #7,DO Invert bits for hardware I
3
00695C C03C0007 and.b #7,DO
006960 6132 bsr $6994 Set bits in sound chip 65
006962 3CBC0082 move . w #$82,(A6) Select track register S
en
006966 3E290000 move . w 0(A1),D7 Get track number
Cfl
00696A 6158 bsr $69C4 wdskctl o
00696C 422D069C clr.b $69C(A5) tmpdma, clear bits 24-31
006970 3CBC0084 move . w #$84,<A6) Select sector register
006974 3E2D0688 move . w $688(A5),D7 csect, get sector number n
006978 614A bsr $69C4 wdiskctl
00697A 13ED0691FFFF860D move . b $691(A5),$FFFF860D dmalow
006982 13ED0690FFFF860B move . b $690(A5),$FFFF860B dmamid
00698A 13ED068FFFFF8609 move . b $68F(A5),$FFFF8609 dmahigh
006992 4E75 rts
**************************************************** setporta, set port A in sound chip
006994 40E7 move.w SR, - (A7) Save status
006996 007C0700 or.w t$700,SR IPL 7
0069A2 1239FFFF8800 move.b $FFFF8800,D1 Read port A
0069A8 1401 move.b D1,D2 And to D20069AA C23COOF8
0069AA C23COOFA and.b #$F8,D1 Clear bits 0-2
0069AE 8200 or.b DO,D1 Set new bits
0069BO 13C1FFFF8802 move.b D1,$FFFF8802 Write result to port A
0069B6 46DF move.w (A7)+,SR Restore status
0069B8 4E75 rts
****************************************************** wdiskcte
0069BA 6124 bsr $69EO Delay loop for disk controller
dskctl I
0069BC 33C6FFFF8604 move.w D6,$FFFF8604 Ml*
0069C2 601C bra $69EO Delay loop for disk controller C/3
H
******************************************************
0069C4 611A
0069C6 33C7FFFF8604
bsr
move.w
$69EO
D7,$FFFF8604

wdiskctl
Delay loop for disk controller
dskctl
1
I—I
0069CC 6012 bra $69EO Delay loop for disk controller
Sfl
rt'
rdiskct7 s.
WJ
0069CE 6110 bsr $69EO Delay loop for disk controller O
0069DO 3E39FFFF8604 move.w $FFFF8604,D7 dskctl
0069D6 6008 bra $69EO Delay loop for disk controller
****************************************************** rdiskctl
0069D8 6106 bsr $69EO Delay loop for disk controller
0069DA 3039FFFF8604 move.w $FFFF8604,DO dskctl
0069EO 40E7 move.w SR, -(A7) Save status
0069E2 3F07 move.w D7,-(A7) Save D7
0069E4 3E3C0020 move.w #$20,D7 Counter
0069E8 51CFFFFE dbra D7,$69E8 Delay loop
0069EC 3E1F move.w (A7)+,D7 D7 back
0069EE 46DF move.w (A7)+,SR Status back
to 0069FO 4E75 rts
*************************************************** change, tets disk change
0069F2 OC790001000004A6 crnp.w #1,$4A6 nflops
0069FA 662C bne $6A28 None or 2 floppies, done
0069FC 302F0010 move . w 16(A7) ,DO Drive number
006AOO B07900004692 cmp.w $4692,00 Equals diskette number ?
006A06 671C beq $6A24 Yes
006A08 3FOO move . w DO,-(A7) Drive number
006AOA 3F3CFFEF move . w #-17, -(A7) 'insert disk' >
006AOE 6100EB4C bsr $555C Critical error handler 3.
006A12 584F addq . w #4,A7 Correct stack pointer v>
006A14 33FCFFFF00000676 move . w #$FFFF,$676 wplatch, Status for both drives unsure H
006A1C 33EF001000004692 move . w 16(A7),$4692 Save diskette number
clr.w 16 (A7) Drive number to zero re
006A24 426F0010
3
006A28 4E75 rts »
3?"
****************************************************** setdmode, set drive change mode
006A2A 41F900003E2A lea $3E2A,AO Disk mode table
006A30 1FOO move.b DO,-(A7) Save mode
006A32 302D0684 move.w $684(A5),DO cdev, get drive number
006A36 119FOOOO move.b (A7)+, 0 (AO,DO.w) Set drive mode
006A3A 4E75 rts
**************************************************** dskf, disk flags
006A3C AE dc.b %10101110
006A3D D6 dc.b %11010110
006A3E 8C dc.b %10001100
006A3F 17 dc.b %00010111
006A40 FB dc.b %11111011
006A41 80 dc.b %10000000
006A42 6A dc.b %01101010
W 006A43 2B dc.b %00101011
W 006A44 A6 dc.b %10100110
006A45 00 dc.b 0
*************************************************** jdostime, IKBD format in DOS format
006A46 4BF900000000 lea $0,A5 Clear A5
006A4C 41EDOA43 lea $A43(A5),AO Pointer to clock-time buffer
006A50 610000DE bsr $6B30 bcdbin
006A54 04000050 sub.b #80, DO Subtract offset of 80
006A58 1400 move . b DO,D2 Year
006A5A E982 asl.l #4,D2 Shift in position
006A5C 610000D2 bsr $6B30 bcdbin
006A60 D400 add.b DO,D2 Add month
006A62 EB82 asl.l #5,D2 And shift in position
R>
006A64 610000CA bsr $6B30 bcdbin
006A68 D400 add.b DO,D2 Add day
3
as
5?
006A6A EB82 asl.l #5,D2 And shift in position as
006A6C 610000C2 bsr $6B30 bcdbin n
006A70 D400 add.b DO,D2 Add hour en
And shift in position C/3
006A72
006A74
006A78
006A7A

ED82
610000BA
D400
EB82

asl.l
bsr
add.b
asl.l

#6,D2
$6B30
DO,D2
#5,D2

bcdbin
Add minute
And shift in position
i
006A7C 610000B2 bsr $6B30 bcdbin
006A80 E208 Isr.b #1,DO 2-second resolution
006A82 D400 add.b DO,D2 And add seconds
006A84 2B420A4C move . 1 D2,$A4C(A5) Save new time
006A88 1B7COOOOOA8E move . b #$0,$A8E(A5) Clear handshake flag
006A8E 4E75 rts
*************************************************** gettime, get current clock time and date
006A90 1B7CFFFFOA8E move.b #-l,$A8E(A5) Request handshake flag for time
006A96 123C001C move.b #$1C,D1 get time of day command
006A9A 61000234 bsr $6CDO Send
006A9E 4A2DOA8E tst.b $A8E(AS) New time arrived ?
006AA2 66FA bne $6A9E No, wait
006AA4 202DOA4C move.1 $A4C(A5),DO Get time in DO
006AA8 4E75 rts
************************************************** settime, set clock time and date
006AAA 2B6F00040A50 move.l 4(A7),$A50(A5) Pass time
************************************************** ikbdtime
006ABO 41F900000A5A lea $A5A,AO Pointer to end of time buffer
move.1 $A50(A5),D2 Get time to convert
I
006AB6 242DOA50
006ABA 1002 move.b D2,DO To dO
006ABC 0200001F and.b #31,00 Isolate bits 0-4, seconds
006ACO E300 asl.b #1,DO 2-second resolution as
Abacus Software Atari ST Internals

of the parameter block


f bytes to send
Of Day command

Of Day command
in •sr c*> r-
I 1 1 i 1
0 o o o 0

IKBD
IKBD
CO 01 CO CO
4-1 4-1 4-1 4-J 4J

et
-H -H -H
-r-1
43 43 3 01 d> O <U
4-1 0) 4_> CU 4-1 CU .p CU 4-! 0) 4-1 m g o co e o
f-l 0) 4-1 4-1 In 4-1 4J S-l M-l -H 4-1 M CO -H4-1
CD 4J CO 0) CO CO CU CO CU c-\J <D CO (U O 6-1 CU CU 6-1
> 3 •H > ,-H r-H rH ^ *O rQ ^H *O *O
C G 0 G ^
P 0 G >i 0 G G o G ca O GTi4-l G S T ! G4J G
O -H 01 O 0 01 O CO 01O 0 CO O CU 01O ' C O J C U P ' O C U C U C U
CJ S H CJ M 0 Q H CJ S M CJ :M M O < t O t O ! 3 , < t O C 3 t O

o
O O O O Q — Q < Q
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 - - o n -o -o
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
«> 41= Q u> * Q =tt> <o * Q = S = - U > = K = Q = W = - C Q - = t | = Q = t t ! « l - = » = = % « > = * < O to
* c/>
*
H
43 43 43 43 43 43 43
H 43 43 ,—f 43 <H • 43 H • 43 43 • D1
• CU • CU • 01 . CU • • CD • • o cu CU
M fM > •0 J-l T3 !-t M > T J M ^ J > T 3 M M > T J ? H t 3 > M i > c O > M CO
CO 01 O G 01 01 O C 01 01 ^
O G M c o O C O l o l O G c O ' t f O o l O e i )CO o CQ 4-1
S CO 43 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
45F900000A5
006AC8 0200003F

006AD2 0200001F

006AFA 123C001B
006AE6 0200000F
006ADC 0200001F

006AFO 0200007F

123C001C
610001BC
006AF6 06100080

006AFE 610001DO

610001E4

in
006AC4 EA8A

006ACE EC8A

006AEO 6136
006ACC 614A

006AD8 EA8A

006AE2 EA8A

006AEC E88A
006AD6 6140

006AEA 612C
006AE4 1002
006ADO 1002

006ADA 1002
006AC6 1002
006AC2 6154

4E75

CM CM
0 CM o
O j-H vo
<-H VO t-
006BOA
006BOE

^T
006B16
006B12
006B04

W CM
w fe o
<
vo <
VO
ta
vo
O o 0
O o o

335
binbcd, convert byte to BCD er
006B18 7200 moveq . 1#0,D1 Ten's counter g
006B1A 760A moveq . 1#10, D3 Load 10
006B1C 9003 sub.b D3,DO Subtract 10 WJ
O
006B1E 6B04 bmi $6B24
006B20 5201 addq . b #1,D1 Increment ten's counter I
006B22 60F8 bra $6B1C
006B24 0600000A add.b #10,00 Generate one's counter
006B28 E901 asl.b #4,D1 Tens in upper nibble
006B2A D001 add.b D1,DO And add ones
006B2C 1100 move . b DO,-(AO) Write result in buffer
006B2E 4E75 rts
************************************************** bcdbin, convert BCD to binary
006B30 7000 moveq . 1#0,DO
006B32 1010 move . b (AO) ,DO BCD byte
006B34 E808 Isr.b #4, DO Ten's place
ON 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
006B40 0241000F and.w #15, Dl Isolate one's place
006B44 D041 add.w D1,DO Plus ten's place
006B46 4E75 rts
*************************************************** midiost, MIDI output status I
006B48 70FF moveq.1 #-l,DO Default to OK
006B4A 1439FFFFFC04 move.b $FFFFFC04,D2 Read MIDI-ACIA status
006B50 08020001 btst #1,D2 And test
006B54 6602 bne $6B58 OK I
006B56 7000 moveq.1 #0,DO Status not OK 3
65
5?
Abacus Software Atari ST Internals

we, output character to M:

tat, MIDI receiver status


M
Q
M
S

O
4-1

terruptable test
G

ter to MIDI-ACIA
ter to MIDI-ACIA

C
M C 1 M -H
-H 4-1
tn co 4-1
MIDI status

4J G CO

c for MIDI
O CO -H CD M
e Q

s default
character

4->
o •o 4-1 4-1 O M
0) C CO M S

Index
Index
4-1 IH
-H CO IH O 0 w rH

4-1 o 01 4-1 4-1 10


C CO
3 4-1 co" fi CO O1 W
3 4-1 0) £ S fl) O
-rl c 4-1 4-1 O, -rH tr> M P. 4-1 COC CO (U U rH C
•a 4-1 -rH 4-1 CO -H 4-1 T) G T! 4-1 4J -a n -H rfl -H -H 4-1 4-1
-H 0) O 0) 0) 10 3 -H 0) t) (U 3 0) -H O 0 rti 0) (0 C O O
e o EH S O E r3 < U O g -H Cn O OS EH O s s
*******************

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

$FFFFFC04,A1
$FFFFFC04,A1

o H-

CM
rH
Q
CM
Q iH
m
Q
CM
Q
pq
in
o
am
CM •=r H- W vo o CM o
Q CM Q r- o o 0 Q
pq
vo
CM pq 0 rH <
rH 0 ft. VO m 1 VO o
O Q vo Q =tf vo 03 -CO-
*
rH rH

> X! X) 3 rH

tr tf tr
0) 0) 4-1 (U CD CD 0) 0) <o cu cu
M -K <o CO cr CO •X ^ M ^ CO fO 10 10 (fl Q^ CD CO
4-) o O O 4-1 CD O 4-1 o
^ O o O CO £1
^ 4-1 * CD <u O
^ CD CD e c o 4-1
*
-K £ g X! *
•X s £ e e X) •a *
-X rH rH e rH rH o XI e
•X -X
* •X -X
* •X -X
•X
* •X
*
-X
* *
-X •X
* -X •X
* -X •X
* •X -X
•jc
* "^ -X -X sr
-)C o •X -X o
-X O •X U
-}C
CM * •X
-K V£> CM o t—) CM *
•X •a1 vo <£ •X o CM vo 03
O CM o O 0 •X O o rM •X o CM o O
* O CM o O O •X o o CM •X p£ CM 0 O
* o CM o o O •X o o CM -X o CM 0 o
lO * ft, en en CM vo f-H m -X o CM CM r£ O pq m •X Q CM CO cq 03 CM o m
r- •K
* CNJ CM CM O CM "31 •X o CM vo <H Q CJ -X CM CM W 0 o
w -K CM m ^r COr- m [V} •X vo VO ^s1 CM rH iH w •X rH O in [— in vo 0 (V)

•^ -K m ^p iH o vo iH •5P •X r- m CM <H VO in •X *3* ^P r~ Q1 PQ vo r- ^i


•X •X
CO -*
K <; w •vT CO O H CM vo •SJ1 rt^w o CM vo •X CO U CM •31CO u Cd o CM
m •£ to m VO vo vo vo r- * r- [^ f^ r- co 03 03 •K co CO Cft en a\Qen fC ft.
CQ pq cq pq pq pq Pq pq •*X pq PQ pq PQ m pq PQ •X pq PQ ffl cq pq pq pq pq
vo -Jt
* vo vo vo vo vo vo VD •X vo vo vo VQ VO vo vo -X VO vo VO vo vo vo vo vo vo
o o o o o o o o o o 0 0 0 o o •X 0 o O o o o o o o
0 *
-X o 0 o o 0 o o *
-X o o o o o 0 o -X o 0 o 0 0 0 0 o 0

337
Abacus Software Atari ST Internals

|
|
|

|
|

|
|
SH
ra

character to Centronics
0
CQ
-H

M rH
0

an 5 seconds ?
Q
M m
s

r start again
P" CD
g
interrupts

from buffer
o CD -r|
N 4-1
-H

I buffer
4-1

timeout
CO
1 X
rO
CD -H CD !H
•o CD CD 4-1
O C" rH C <M •a CO
ra -H -H
IB 3 -H CO 1 •o
ra Ti CD 4-1 T5 CD Q CO 4-) H £ S-l 3 -H a)
rd 1H M
^ •a 3 CD 4-1 CD 0) 4-1
o Oi fi CD G H-l S CD fO ft 4-1 3 4-1 rd •o
^ 4J f>- O
CO m ,d 10 3 Id 4-1 q S CD O G 4-1 4-1 ra
statu;

charac
CO -rH JZ O 3 3 G CO <D 3 SH co CD
to rH -rl CD p 4-1 4-1 m O O -H o CD § O *C3 rH
& CD -o •o 4-1 3 O rH 0 P 4-1 U P
P C CD CD rH rd y> ft -H CO CO 0} 0 4-1
<d o -H CD CD C U •a N CD CD N U CD
r- IB CD4-J C, 4-> 0 3 CO CD 4) 4-1 4-1 ES CD >i

TJ
-H -H
CO
•o (0
O
Q)

f$ CM
•o
CD O
rH rd
U CD
C t-t O
-H R
(T> -rH
CD O
4-1
CD
§<a +J
CO
CD
O

CO
0
o
3
-rl
CO
CD
O
O
•o
C
-H O
O -H 0
3 CO
4-1
O
g 0 ]Z. CO M re CJ M C3 S3 pq CM u co (X. CM & s CM O <q CM CM S

*******************
o
******************

$4BA(A5),D3
CM CM CM
Q Q Q
Is
r- rH rH rH CM CO
CO Q Q Q rH 0 in in Q in Q
Q
CO I o o rH rH O CJ 0 vo o CO
CO o O O Q Q O CJ Q 0 vo o O Pu m o Q 0
CQ 03 03 03 CO o PQ CJ U o 03
vo O VO vo rH VO O rH rH vo vo o vo CM vo vo
Q «> CO VO CO U} o 0 Q Q «• Q =«=
rH

£ rH

e.l
S
S S S er * SB rH
CD CT S (U
<D CD CD CD (U CD
-X P CT ft tr TS ft CO > co !> jrj
ft CO ^i 4-> CD J> ^jQ ft
g
P
^
CO CO 0! O O g CD T) g o o 0 O 0 O 4-1 *
.£ O 3 g O 0 CO CO G 0 3 rH
*
*
43 4J 43 E ^
o g O 43 ffl CJ 43 g g g g
*
g 0 g £ ii n E CO 0 Q

* *
*
-X *
*
* *
* *
* *
* *
* *
-*
K *
•K CO o
[j!) f
* He
* CO r^
* -jt O ,—i
* o vo 00 ^p o o VQ £ (3j 0 o pC f£ 0
*
•X o 0 o o o 0 0 CQ CO 0 03 CQ o
r- o o o o o O *
f^
o •cp o
* o o o 0 0 rH O * 0 o o o o o
*
-X CM o f=C r~ CJ CO CO vo rH CO CM o CO rH rH fc. m * Q Q CM CO Q CM O CO Q CM CO CJ
•X Cd •^p r*t w CM VQ rH «qi vo O o vo CO ^31 Q r- * CM CQ j-H CM p^ ^P rH CM CO CO
rH <C t~- o o CN CM
t—
CM CM in CN CM O rH vo w * ^ji ^p CJ in rH <; vo vo VO CJ Q
* VO •C1 VO •5J1 0 n O3 VO m CQ vo r^ CM rH n * CM en o vo CM VO ^i VO CM cn o VO
* *
* VO 00 ^1 CO jaj {J o CM •5P CO O O CM
r^C CJ 0 * sp CJ CM ^P CO < o r£) CM *5P ^fj
CO
* <C rtC <; Q Q Q W w pq
^
-X rt 03 PQ CQ 03 PQ CJ CJ CJ CJ O Q Q
<2 * w |y, CTH
•X CQ 03 CQ CQ m
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
m * CQ 03 CQ CQ 03 CQ CQ CQ CQ CQ CQ CQ
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 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 * 0 0 0 0 0 0 0 0 o 0 o o
* *

338
006BFC 7000 moveq . 1#0,DO Flag for time out
006BFE 2B6D04BAOA80 move . 1 $4BA(A5) 200 Hz center as last time-out time g
006C04
006C06
006C08
006COC
006COE
006C12
006C16

4E75
40C3
007C0700
7207
61000E28
00000080
7287

rts
move . w SR, D3
or .w #$700, SR
moveq. 1 #7,D1
bsr
or .b
$7A38
#$80, DO
moveq. 1 #$87, Dl

Save status
IPL 7, no interrupts
Mixer
Select registers
Port B to output
Write enable

I
006C18 61000E1E bsr $7A38
006C1C 46C3 move . w D3,SR Restore status
006C1E 302F0006 move . w 6(A7),DO Character to output
006C22 728F moveq. 1 #$8F,D1 Write to port B
006C24 61000E12 bsr $7A38
006C28 610C bsr $6C36 Strobe low
006C2A 6104 bsr $6C30 Strobe high
006C2C 70FF moveq . 1#-l,DO Flag for OK
vO 006C2E 4E75 rts
*********************************************** Strobe high
006C30 7420 moveq,1 #$20,D2 Bit 5
006C32 60000E46 bra $7A7A Set
*********************************************** Strobe low
006C36 74DF moveq.1 #$DF,D2 Bit 5
006C38 60000E66 bra $7AAO Clear
I
***********************************************
006C3C 7207 moveq, 1 #7,D1
listin, Get character from parallel port
Mixer
i
006C3E 61000DF8 bsr $7A38 Select register
006C42 0200007F and.b #$7F,DO Port B to input
006C46 7287 moveq. 1 #$87, Dl
5T
006C48 61000DEE bsr $7A38
006C4C 61E2 bsr $6C30 Strobe high = not busy
006C4E 610C bsr $6C5C Get parallel port status
006C50 4A40 tst.w DO
006C52 66FA bne $6C4E Wait until character arrives
006C54 61EO bsr $6C36 Strobe low = busy
006C56 720F moveq.l #15,01 Select port B
006C58 60000DDE bra $7A38 Read byte from port
*********************************************** Istostat, parallel port status
006C5C 41F9FFFFFA01 lea $FFFFFA01,AO Address of the MFP
006C62 70FF moveq . 1#-l,DO Default to ok
006C64 082800000000 btst #0,0 (AO) Test busy
006C6A 6702 beq $6C6E OK
006C6C 7000 moveq . 1#0,DO Still busy
006C6E 4E75 rts
*********************************************** auxistat, RS232 input status
006C70 41ED09DO lea $9DO(A5),AO iorec for RS232
006C74 70FF moveq.l #-l,DO Default to ok
006C76 45E80006 lea 6(AO),A2 Head index
006C7A 47E80008 lea 8(AO),A3 Tail Index
006C7E B54B cmpm.w (A3)+,(A2)+ Buffer leer ?
006C80 6602 bne $6084 No
006C82 7000 moveq.l #0,DO No character there
006C84 4E75 rts
I
***********************************************
006C86 61E8 bsr $6C70
auxin, get character RS-232
auxin, character ready ? i
006C88 4A40 tst.w DO
006C8A 67FA beq $6C86 No, wait
006C8C 610005D8 bsr $7266 rs232get, get character
006C90 024000FF and.w #$FF,DO Isolate bits 0-7
006C94 4E75 rts
auxostat, RS232 output status CA
************************************************ o
006C96 41ED09DO lea $9DO(A5),AO iorec for RS232
006C9A 7 OFF moveq.l #-l,DO Default to ok B9
006C9C 34280016 move.w 22(AO),D2 Tail index
006CAO 6100087C bsr $751E Test for wrap around
006CA4 B4680014 cmp.w 20(AO),D2 Compare with head index
006CA8 6602 bne $6CAC Not equal
006CAA 7000 moveq.l #0,DO No more space in buffer
00 6CAC 4E75 rts
************************************************ auxout, RS232 output routine
006CAE 322F0006 move.w 6(A7),D1 Get data byte
006CB2 61000556 bsr $720A rs232put, and output
006CB6 65F6 bcs $6CAE Try again
006CB8 4E75 rts
************************************************ ikbdost, IKBD output status
006CBA 7OFF moveq.l #-l,DO Default to ok
006CBC 1439FFFFFCOO move.b $FFFFFCOO,D2 IKBD ACIA status
006CC2 08020001 btst #1,D2 Test
006CC6 6602 bne $6CCA OK
006CC8 7000 moveq.l #0,DO Not ready
006CCA 4E75 rts
I
************************************************* ikbdwc, send character to IKBD t/3
Get byte
H
006CCC 322F0006 move.w 6(A7),D1
006CDO 43F9FFFFFCOO lea $FFFFFCOO,A1 Address of the keyboard ACIA
006CD6 14290000 move.b 0{A1),D2 Get status
3
006CDA 08020001 btst #1,D2 Ready 63
Abacus Software Atari ST Internals

conin, get character from keyboard


send string to keyboard

constat, keyboard input status


X
c- 0)
•a
ra c TS

IPL 7, disable interrupts


j-i -H q Ol -H
(U M -H •o W
4-1 M CO rH
M O 0! 0) -H
0) o CO

No characters there
tJ
H)
<B
0)

4-1 o
45
CD o
ft 4-1

SJ 0 0) 4-1
<H 4-1 o X X 0) X -H

4-1 o O
O
0> ft
<B
O
4-1
•s 1 0)
4-1
-H
0)
•o
G
ikbdws,

-H CO 4-1 4J 4-1 G 4J 01
4J at r-H -H -H (0 (fl -H
s 0) CD 45 O 0 3 0) 4-1
•aCO
<g
ft M (U 1-4 a>

Save status
r-f
T! 4J T) -H
o 3 3 •a 0! G 01 0 01 Q) (8
En
3 o o
U
0 CD
o
0
O O KC IS -H Q

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

SR, -(A7)
CM

#$700, SR
co CM 0 CM rH
Q Q LO Q O
0 O
vo n vo
eq.l #0,DO

H- 0 Q -t- W O CM
Q CM Q P- CM O 0 o t-l O o
CJ —
CM Q
O a o Q O
vo rH o <C vo a\S 1 vo vo 0 vo VO
Q =B= vo Q =«= VO CO Q vo CO

s
e.w
45
tr 3=
a

w
CD 0) 01 01 0! 0) 0)
CT > tn > > > !-i ra
> M > <a <d ft 0) > 0} ^_l 4-1 tr £> • > ft tr
<a O 4-1 * O 0 0 O eo 45 4J *
•X 0) 0 CD 01 0 4J *
•X CO CO 0) O H o 0)
>-i -x
*
•X
S 45 *O &H
*
^H §
45 •X
•X
43 4J E 0 e O 45
-X *
•X
-X •X *
•X
•X •X
*
* * *
-X
* *
•x
* *
-X *
*
* * *
*
•X * *
* *
•X
* * •X
(N -x
* ^p vo <; * CM vo CO •X vo CO O
O 0 0 1*-, * EK o o o o 0
O * o o fv, * cn 0 o * p- 0 o
o •*
X o 0 fV, *
•X o o o •*
X o o o
VO rH to o fc. fT, < CJ pa LO •X Q &J CO CO PQ CM 0 LO CO 0 P- O CO CO CJ
tu ^p P- * o CM vo rH Q O P- W pt, W W 0 o p- *
•X
t_j rtf
^
fen jyi p«. CM vo rH
r~ CO W * vo VO «sp CM r-l rH W •*X .-I o LO r— LO VO 0 [y] p- o o CM CM p-
vo rH T * [— co CM rH VO X •*P r- •a1 CQ vo p- ^31 * vo ^r V0 n ea vo
* -X *
frf O ^31 *
-X vo CO CJ 0 CM <3< CO •X M 0 ^p CO < CJ [VI •*
X o CJ o
t. VO CO M
i^ CM ^i
Q [V] U H H W (%, (V, -X f T| 0 0 0 o o O r-l (H CM CM
CJ
VO
0
CJ
vo vo
0 0
CJ *
•X
•X
O CJ CJ
VQ
O
vo
o
vo
O o o
CJ
VO
O
VO
O CJ
VO VO
0 0
•*
X
CJ CJ Q Q
VO vo vo VO
o 0 0 0
Q Q Q
§o o
vo VO VO
O o
-*

*
X

•X o
vo VO VO VD vo VO
o o o o o o
Q
VO
Q
VO
O
^
O O Q O a Q

o o o •X 0 0 o o o 0 O * o 0 0 o o 0 0 0 •X o o o o o o 0 0
*

342
006D26 5441 addq . w #2,D1 Head index + 2
006D28 B2680004 cmp.w 4(AO),D1 Greater than or equal buffer size ? n
006D2C 6502 bcs $6030 No
006D2E 7200 moveq . 1#0,D1 Buffer pointer back to start on
006D30 22680000 move . 1 0(AO),A1 Pointer to keyboard buffer
006D34 7000 moveq. 1 #0,DO
006D36 30311000 move . w 0(Al,Dl.w) ,DO Get character and scan code
006D3A 31410006 move . w D1,6(AO) Save new head index
006D3E E188 lsl.1 #8, DO Scancode to bits 16-23
006D40 E048 Isr.w #8, DO ASCII code to bits 0-7
006D42 46DF move . w (A7)+,SR Restore status
006D44 4E75 rts
*************************************************** conoutst, console output status
006D46 70FF moveq.1 #-l,DO Always OK
006D48 4E75 rts
U)
*************************************************** ringbel, tone after CTRL G
006D4A 082D00020484 btst #2,$484(A5) Tone enabled ?
006D50 670E beq $6D60 No
006D52 2B7C00007D5AOA86 move.l #$7D5A,$A86(A5) Pointer to sound table for bell
006D5A 1B7COOOOOA8A move.b #$0,$A8A(A5) Start sound timer
006D60 4E75 rts
***************************************************** Keyboard table, unshifted
006D62 001B313233343536 dc.b $00,esc, 'I'/^Va1, '4', '5', '6'
006D6A 373839309E270809 dc.b '7', '8', '9', 'O1, '(§', "',bs ,tab
006D72 71776572747A7569 dc.b 'q1,'w1,'e','r','t1,'z1,'u','i'
006D7A 6F70812BOD006173 dc.b 'o1,'p','[',' + ',cr, $00,'a1,'s'
006D82 646667686A6B6C94 dc.b
006D8A 8423007E79786376 dc.b ']','#',$00,'l','y','x','c','v'
006D92 626E6D2C2E2DOOOO dc.b •bS'n', 'm1,', ','.', '-',$00,$00
006D9A 0020000000000000 dc.b $00,' ',$00,$00,$00,$00,$00,$00
BS
006DA2 0000000000000000 dc.b $00,$00,$00,$00,$00,$00,$00,$00
006DAA 00002D0000002BOO dc.b $00,$00,'-',$00,$00,$00,'+',$00
006DB2 0000007FOOOOOOOO dc.b $00,$00,$00,del,$00, $00,$00, $00 C/5
O
006DBA 0000000000000000 dc.b $00,$00,$00,$00,$00, $00,$00, $00
006DC2 3C000028292F2A37 dc.b '<',$00,$00,'8',')','/','*','7'
006DCA 3839343536313233 dc.b '8','9','4','5','6', '!','2', '3'
006DD2 302EODOOOOOOOOOO dc.b •O'/'.'/cr, $00,$00,$00,$00,$00
006DDA 0000000000000000 dc.b $00,$00,$00,$00,$00,$00,$00, $00
***************************************************** Keyboard table, shifted
006DE2 001B2122DD242526 dc.b $00,esc, '!',"",'I1, '$', '%', 'S'
006DEA 2F28293D3F600809 dc.b '/','(', ') ',' = ', 'T'/'ISbs, tab
006DF2 51574552545A5549 dc.b 'Q', 'W, 'E1, 'R1, 'T', 'Z1, 'U1, 'I'
006DFA 4F509A2AOD004153 dc.b '0','P1,'[','*',cr, $00,'A','S'
006E02 444647484A5B4C99 dc.b
006EOA 8E5E007C59584356 dc.b ']','"
006E12 424E4D3B3A5FOOOO dc.b 'B1,'N','M1,',•',':', 'I1,$00, $00
006E1A 0020000000000000 dc.b $00,' ',$00,$00,$00,$00,$00,$00
006E22 0000000000000037 dc.b $00,$00,$00,$00,$00,$00,$00, '7'
006E2A 38002D3400362BOO dc.b '8',$00,'-','4',$00, '6',' + ',$00
006E32 3200307FOOOOOOOO dc.b '2',$00,'0',del,$00,$00,$00,$00
006E3A 0000000000000000 dc.b $00,$00,$00,$00,$00,$00,$00,$00
006E42 3E000028292F2A37 dc.b •>',$00,$00,'(',')1,I/',I*I,I7'
006E4A 3839343536313233 dc.b '8','9','4','5','6','I1,'2','3'
006E52 302EODOOOOOOOOOO dc.b •OS'.'jCr ,$00,$00,$00,$00,$00
006E5A 0000000000000000 dc.b $00,$00,$00,$00,$00,$00,$00,$00
****************************************************** Keybaord table, Caps Lock H
006E62 001B313233343536 dc.b $00,esc,'1','2','3','4','5','6' B
I-*1
006E6A 373839309E270809 dc.b '7','8','9','0','@',' " ,bs, tab
B
006E72 51574552545A5549 dc.b 'Q1,'W,'E1,'R1,'T1,'Z','U','I'
I1
Abacus Software Atari ST Internals

set S-bi-

alize timer and interrupt vector


ilize registers with zero
initialize MFP 68901

sn-autovektor # to $48,

ms to 20 milliseconds

nt, install interrupt


C interrupt routine
C interrupt number
3S of the MFP

: timer C

c timer D
sr 200 Hz
:o isrb
:o iera

:o vr
- 0 0 0 0 o o o - o o
co ^ > 0 0 0 0 o o o r- CO O o

Ep,
o o - o o
<~? * G <D-H
- 0 0 O 0 Z S H O t H - H S H S H -H O

- vt «• </> -to 3- o o CM O o $H4JP«4343


-H TJ -rH -H SH SH PJ
(DO)
g rH
4-1 CD CD 4J Q)
-3< CM "H g g -H rH
(^ ' O G Q t C O O l f a -H (!) VO en G -H -H G fl)
o - 0 0 0 o o o - O o •H < H O> -H -H S EH CO -^ rH H EH EH -H CO
O ^4 X 1 0 0 0 o o o *-x rH O o

o o o o 0 0 - O o
SH "O
CJ -
>H • o o o o
ft
O 0 ~ VO O o

:+? ^ >
o o o o
o o o o
•in-
rH
0)
73
O
0
Vr

-
If)
o o
O o *
*
* !«
O - o o o 0 0 o o (*C ^-* ^* m
" Uo S o o o 0 0 o **• SH 0 * «. ^^ O CO *C
</> -to J - O * rH O < <C ~-
* O -~»*-vf=C — -W-CM CM
0 0 o o o 0 d * < O O —- CM •. *3" CM fiC
O4 fa =*= "Z 0 0 o o o 0 en "• o * fa (^rtJOCMrH^P rH Q ».
<fe Vr </> * VO O
ir fa Q o co -to co" t Q o en in Q «gi Q
* * * * * * * * * * * * * * * * * * *k * * * * * * * * i

o O O o 0 0 o fa «. - * -.^PrHO .. O CJ O CJ «. rH -
O Q " ca o o o o 0 0 V CO O o faoooo«j--u>CMCMCD«>r-r~in
•u>=S=QQQ=S=**=»t»=»==tt=-UJ--o>*
r- co
•to *
H H H rH <-H H rH

O - ' C X e ^ e i , * " - ^ ^ * o^ ef
43 43 o o »Q f£J 43 43 Q)<D<1)C])0)CD(1)(1)(D(D Q) 0)
t^
M f>*
dc,
dc,
dc,
dc,
dc,

dc,
dc,

dc,

dc,
dc,

dc,

dc,

dc,

0 01 O
O J O O O O O O O O O ' O M C U O
•o M g g g g g g g g g g 4 3 M g 43 g
07E59684356
7484A4B4C99

00000000000
00000000000

43536313233
07FOOOOOOOO
D2C2E2DOOOO

DOOOOOOOOOO
00000000000

00000000000

00000000000
A2BOD004153

D0000002BOO

CO

CM
fa rH VO -sp CM CJ
CM O rH CO T in
en «; o < •* cj
CM fa o o o r-
CO f a O C O O C O r H * ? 1 O P Q O CO
CM f a O O r H ^ T r H r H O t - O CM
O f a O O O O r H O O r H O CM
en T O "^ o o o CM 0 0 O co o o f a O O O O r H O O O O O
o vo CO W o o o O o o O en M o * c n o c o c o c o c j O O C M O C J o e n m 0 CO
in -a1 CM T CM o o O o o O CO CM o * faoooor~r~t-oincoofao 0 0
fa ^r W CM O o o O o o CJ CO O o * r H O r H r H r H r H P Q P q O C M - a ' r H i n O rH 0
*j" ^r CO "51 O o o O o o co co co o •*
K * 3 * r — o o o r H c o c o t — r - - c o v o ^ j ' r - vo r-
f< CM < CMrfj W CM (rf CM (< CM (=C CM (Q * C M C O < ( a c M V O O C M C O r t ; O O ' ! I ' < O 0
t— CO CO C5> en en <2 pa PQ O O Q a * 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 rH CM
Cd W pq c£) fjQ u a w w {V]
^ * fa fa
VO VO vo vo VO vo vo vo vo vo vo vo vo vo * vovovovovovovovovovovovovovo VO VO
o o o o o o o o o o 0 0 0 0 * o o o o o o o o o o o o o o O O
0 0 O 0 o o o o o o 0 0 0 0 * o o o o o o o o o o o o o o O O
*

345
Abacus Software Atari ST Internals

ine keyboard

bell enable
4-1
-H

or vector
H
Q ft
M
CM S O
CO G
CM CU
U)
P5 -t-l 4-1
J_( M M 4J 4-> H CU -r-1 •o 01
•o 01 rH O Q O n P P 0 01 43 G (I)
q o 0) M CD 0) 0 0 4-1 CU P rH
CO ^-f MH !H H H O M ft
O K
^_,
O o H CD O .p 3
T> M O O -H Q ^4 H > M 4-1 <d O -H
CD 01 CU 0) t-H O O CU 01 CU CU H
id E K M j^ S n rH 4J 4-1 ft > <0
m -H rH O ^
O o 0 S
PJJ M rH ft 01 rH CU 4-1 > fH
4J O s- -rH 1H f^ -H t-l
^ •B CU CU P ffl ^i id 0)
o Pi pi fi !H S •V
4-1 tJ 4J H
o <u o
^ O m O id m 0 o M 4J «, 01 c c a)
VD -O N ^ p 4J 0 +J 4-> o 4-1 4-> CU < -rH y 3 -H S
en -H CO (d ol 4_> (Q (ft 4J •0 4J M 43 O O «! 0 O -H
10 rH en K H (U G M •a CD G M M M c; O -H CU 01 ft 4->
3_i 43 td v> rH G G CU T3 4J -H CU jj -H <a CD 0! -H rtl CO 0 rH >
o -H O O O 4-> .p >^ O 4-1 4-1 1 0 X CU
^
M T3 >i
m o 4J ^ ol C 43 >i G S-H 43 43 C G H M 0 > (d G <d
o -H o K CO -H ^fd ft -H <a ^
ft >i -H -H Q Q vo
>^ o > 0! P rH
•31 VQ G o O EH EH O 4J •=p O O O CD O 0 M M rH CU rH O rH O 0)
~x a\t MvectorEH Q Pi CM C/3 CO O CO rH U M CM CM S S M O -n
^N. O W Q

m m
£ a ^p
0
o
m

Q
Q m in o CM CM O fa m CM in in m in IO
o *. o rt! fa 0
rH rH O fa O
0
rH vo
rH

o
^
in
o
CM
rH
vo
rH vo CO CO CO
W vo
rH <H CM
vo
CO CO
rH
Q
CM
Q
o O
00
CM O
r- vo
CO
0
Q
Q
jrj
VD
CO 0
O Q

CO
vo £
CO to
< O m VO
en m in
fa
en
vt i CO
o
o
Q
rH CM
=tt= £ =tt= Q
r-
s W
CO
=tt=
f—
1s =8=
r—
=*t=
O O
Q Q
vt t-0

*
=tt=
*
O
Q Q
O O O
Q
*
o o
Q Q
rH .H c—1 H rH

o f-H
rH rH rH rH 43 43 43 rH H rH rH H rH 43
T-H U
CU CD CU CU 0! CU CU CU CU CU CU CU0) CU 0) CU CU CU 0 CU CU CU CU
> > M > rH (d <d M id (d J> > [>> > > > > > > > > >
O O 01 o o ^
01 01 CU CU O ra 0) CU o ^4
01 o O O o o O O O O 0 O O O O O o o
g g 43 g g 43 rH rH s rH rH g 43 g g g g g g g S g g s g g s g

W W •0" CM
0 CM CM 0 o CM
o U rt
o o 0 fa fa 0
rH W o U VD CO CO fa fa
qi vo ^J1
O m m en O m vo fa fa CO •3* CO
rH o o m en m in fa fa •31 (3* o
O r^ r- r^ c— fa fa r^
O vo r-
00 00 VD *-C H O 0 CJ 0 0 CJ 0 CM vo 0 o 0 (O m 0 o rfj vo vo rfl[V]

VD en CM co CM QW 0 o o Q o rH rH o 0 0 o OS 0 o o rH <H CM CO CO
rH o O m
ffl o 0 o O 0 0 o 0 0 o 0 0 0 <
O o O o O 0
o o 0 0 0 o 0 0 0 o 0 0 o 0 o o O O O O o
rH CM 0 o CO 0 0 Q en rH 0 Q cy\ Q 0 (_) 0 0 CJ o CJ CJ 0 o o o o O o O 0 o
O
CM
f^
O
*=T
r-
0 CO
rH o
VO CM
U 0 0 M fa CM o [V]
rH rH rH rH CO 0 rH rH CO O
O VO VO •=r p- VO
•5F
0
«T r^ ^
0 CO •S31 «3*
rH o PQ CQ oq
fa fa
CO CO
VO CM CM CM CM CM CM rH rH
ss c— r- co 1^1 ^*
rH
o
m ffl o PQ co PQ o pq m
CM CM CM CM CM r- CM rH

CM •=r VO <: O •5T 03 U O vo 03 U o vo CO 0 CM VO < CM f£ CM <, CM CO O VO g? w CM •=r CO


rt* pq CQ CQ
CM CM CM CM CO CO CO CO •SJ1 •SJ1 «gi •a1 in in in m VD vo VO t- r- CO
CO en en ff <
fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
[V,
fa fa
fa fa fa fa fa ^
fa fa fa fa fa
VO VD VO VO VD VO VO VD vo VO VO vo VD vo vo vo VO VD vo VO vo vo
VO vo vo VO VO VO vo vo VO vo
0 O o o O o o O o o o O o o o o o O o 0 0 O o 0 o O o o O o O o
o O 0 o 0 o o 0 o o o o o o o o o O 0 o o 0 o o 0 0 0 o o 0 0 o

346
Abacus Software Atari ST Internals

VI
O
4-1
01 -H O O
4-1 0> Q
•a 43 IB O >
IB 0) g
id 4-1 O 4-1 4-1 4-1 M
o G G, A a,
43 •o 4-1 3 JH 3 3 i-l
>i M G, 01 M O >H H 0
(U rd
0
43 43
M O
Vl
4-1
4-1
-H (U
rH
H
0)
4-1
tj0) M
CD 0)
4-1 G
H
0)
4-1 13
>H

>, <: 0) 0 43 G > G -H G 4-1 Q


i-4 0! M O, 4-1 0) IB •rl -H 4-1 -H IB ea
O y O O C > 4-1 •o 3 T3
o •a;
4-1
f-1
H rH m
vo
rH O rH
4-1 <U w 0! g rH
^4 CM rH 4-1
3 .d S-4 O •a rH PM 3 0 IB o IB IB o
o en O S M 0 H 4J 43 ^) 4-1 4-1 n 4-1 G 4-1
m 3 M-l CO 1^1 01 a 01 01 -H
0) -H
e .G
-H o id
S o
o
jQ
CO
4-1 O
S
<H

<u
G 4-1
0) ^1 -H
G ^)
0
0)
CO
C
g= -H
3 43 G
-H O
en
4-1 O 4-1 4-1 o 4-1 >i -H 4-1 N 4-1 CO O 4-1 3 ^i 3 4-1
rd 01 4-1 ft. HH 4J *, O *o G •. a> G K,

0 4-1 (U G 4-1 4-1 4-1 H CO 4.1


4J -H co o id H O 0! G
J> -H
> id >H G G SH G 0) (D 01
4-> >1 4-1 -H O -H -H O -H 4-1 4-1
!B G,
0)
4-1 3
01 i)
4-1 -H
4-1 M 4-14-1
Q O -H
4-1 -H q > •§
CO O -H -H 43
a> M 4-1 C rH 0) G <D rH 0! C EH 0) G O 01
EH PH CO cs -H S > -H CJ > -H P4 ^=r to

o
o
o CJ
~ —- m ^- o o fa
in r3? CJ fa
fa
fa in
P3 O < CM <
03 CO •« o fa VI- O Q
O CM Q VO CM <v CO CM O O CM ^ VO o vo o ovo co co o
CO Q Q O, Q CO -a- CM Q O Q •sr o Q fa
o ra K ^ ^ ^ < rH rH r~
o o rH rH CTi CM — C^ vo r- t— r~ <f>
Q D Q Q =»==«= o -co- 3*= </> **>

43 43
tr cr tr tr tr
0! 0) 01
> > > -q
_ rH > ^4 > J> SH J> t* J-f tO
O O 01 O o o> o i b c o c o b b b b b b t i c Q b c o O CO O CO O O CO 4-1
s e 43 e S rH ^ * * S S i a r a g 4 3 S 43 S 43 E £ 43 M
3FFFFFCOO
6FFFFFCOO

CM 0
CO CO
O 0 O
0 0 r- r- r-
pa o CM CM o o o co CJ sC < o o o
CO CO VO O 0 fa 0 0 o en o O O CO W CM CM O CM O
< <; CJ 0 O cy* o o o 0 0 0 O rH fa in rH CO rH O
o o [%, Q O o o o o 0 0 0 CM o fa r- o O O
o o 0 O O Q en Q q> O CJ o O CO rH rH 0 CM CO O en Q VO O Q CM O CJ CO
•a1 ^r O r^ (""" fa fa O m o r- o 0 0 0 CO r- o o W o o H r- o
CQ pa rH 03 pa rH co O rH rH co co VO CM ^P O vo m «• rH rH in O rH in O r H - a ' V O r H H
rH CM VO rH •a> «3- t— VO VO rH CM CM O H
O o ^r co pq «=p
pa o o o o a O O r H r H r H r H r H C M C M C M C M C O C O
fa fa h fa b< fa o o o o o o o o o o o o o
VO VO VO VO VO VD
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
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
007036 10D9 move.b (Al)+,(AO)+ Block move
63
007038 51C8FFFC dbra DO,$7036 Next byte
00703C 4E75 rts en
************************************************
00703E 8001121A dc.b $80,$01,$12,$1A Reset keyboard, disable mouse und joystick !
*********************************** ************* iorec for keyboard
007042 000008DO dc.l $8DO Keyboard buffer
007046 0080 dc.w 128 Length of the keyboard buffer
007048 0000 dc.w 0 Head index
00704A 0000 dc.w 0 Tail index
00704C 0020 dc.w 32 Low water mark, 1/4 buffer length
00704E 0060 dc.w 96 High water mark, 3/4 buffer length
************************************************* iorec for MIDI
007050 00000950 dc.l $950 MIDI buffer
00
007054 0080 dc.w 128 Length of the MIDI buffer
007056 0000 dc.w 0 Head index
007058 0000 dc.w 0 Tail index
00705A 0020 dc.w 32 Low water mark, 1/4 buffer length
00705C 0060 dc.w 96 High water mark, 3/4 buffer length
************************************************* iorec for RS232
00705E 000006DO dc.l $6DO RS232 input buffer
007062 0100 dc.w 256 Length of the input buffer
007064 0000 dc.w 0 Head index
007066 0000 dc.w 0 Tail index
007068 0040 dc.w 64 Low water mark, 1/4 buffer length
00706A OOCO dc.w 192 High water mark, 3/4 buffer length
00706C 000007DO dc.l $7DO RS232 output buffer
007070 0100 dc.w 256 Length of the output buffer
007072 0000 dc.w 0 Head index
63
007074 0000 dc.w 0 Tail index
007076 0040 dc.w 64 Low water mark, 1/4 buffer length
007078 OOCO dc.w 192 High water mark, 3/4 buffer length GO
00707A 00 dc.b 0 rsrbyte, receiver status
00707B 00 dc.b 0 tsrbyte, transmitter status I
00707C 00 dc.b 0 rxoff, 3
00707D 00 dc.b 0 txoff
00707E 01 dc.b 1 rsmode, XON/XOFF mode
00707F 00 dc.b 0 filler
*************************************************** Interrupt vectors for MFP
007080 00007426 dc.l $7426 #9, transmitter error
007084 00007374 dc.l $7374 #10, transmitter interrupt
007088 00007408 dc.l $7408 #11, receiver error
00708C 000072CO dc.l $72CO #12, receiver interrupt
*************************************************** setimer, initialize timer in MFP
007090 48E7F8FO movem . 1DO-D4/AO-A3,-(A7) Save registers
007094 207CFFFFFA01 move . 1 #$FFFFFA01,AO Address MFP
00709A 267C00007124 move . 1 #$7124, A3
0070AO 247C00007128 move . 1 #$7128, A2
0070A6 615A bsr $7102
0070A8 267C00007118 move . 1 #$7118, A3
0070AE 247C00007128 move . 1 #$7128, A2
0070B4 614C bsr $7102
0070B6 267C0000711C move . 1 #$711C,A3 I
0070BC 247C00007128
0070C2 613E
move . 1 #$7128, A2
bsr $7102 i
0070C4 267C00007120 move . 1 #$7120, A3
0070CA 247C00007128
0070DO 6130
move . 1 #$7128, A2
bsr $7102
a
63
5?
0070D2 267C0000712C move . 1 #$712C,A3
0070D8
0070DE
247C00007130
6122
move . 1 #$7130, A2
bsr $7102
I
0070EO C749 exg A3,A1
0070E2 47F900007134 lea $7134, A3
0070E8 7600 moveq . 1#0,D3
0070EA 16330000 move.b 0(A3,DO.w) ,D3 3
0070EE 11823000 move . b D2,0(AO,D3 .w) Write data in MFP
0070F2 B4303000 cmp.b 0(AO,D3.w) ,D2 And compare
0070F6 66F6 bne $70EE Until match
0070F8 C749 exg A3,A1
0070FA 8313 or .b Dl, (A3)
0070FC 4CDFOF1F movem . 1 (A7)+,DO-D4/AO-A3 Restore registers
007100 4E75 rts
007102 6106 bsr $710A
007104 1612 move . b (A2),D3
007106 C713 and.b D3, (A3)
007108 4E75 rts
00710A 7600 moveq . 1#0,D3
00710C D6CO add.w DO, A3
00710E 1613 move . b (A3),D3
007110 D688 add.l AO,D3
007112 2643 move . 1 D3,A3
007114
007116
D4CO
4E75
add.w
rts
DO,A2
I
*************************************************
007118 06060808 dc.b 6 r erOf oo r oD I3
00711C OAOAOCOC dc.b 10,10,12,12
007120 OEOE1010 dc.b 14,14,16,16
us
007124 12121414 dc.b 18,18,20,20 s
en
007128 DFFEDFEF dc.b $DF,$FE,$DF,$EF CA
00712C 181A1C1C dc.b $18,$1A,$1C,$1C
007130 00008FF8 dc.b 0,0,$8F,$F8
007134 1E202224 dc.b $1E,$20,$22,$24
************************************************* mfpint, set MFP interrupt vector _
007138 302F0004 move.w 4(A7),DO Interrupt number
00713C 246F0006 move.l 6(A7),A2 Interrupt vector
007140 02800000000F and.l #15,00 Number 0-15, long word
************************************************** initint, Set MFP interrupt vector
007146 48E7EOEO movem.l DO-D2/AO-A2,-(A7) Save registers
00714A 6120 bsr $716C Disable interrupts
00714C 2400 move.1 DO,D2 Vector number
00714E E542 asl.w #2,D2 As index for long word
007150 068200000100 add.l #$100,D2 Plus base of the MFP vectors
007156 2242 move.1 D2,A1 Vector addres
007158 228A move.1 A2,(Al) Set new vector
00715A 614A bsr $71A6 Enable interrupts
00715C 4CDF0707 movem.l (A7) H-,DO-D2/AO-A2 Restore registers
007160 4E75 rts
**************************************************
007162 302F0004 move.w 4(A7),DO
disint, disable MFP interrupts
Get interrupt number
z
007166 02800000000F and.l #15,00 Convert to long word index
00716C 48E7COCO movem 1 DO-D1/AO-A1,-(A7) Save registers
007170 41F9FFFFFA01 lea $FFFFFA01,AO Address the MFP
007176 43E80012 lea 18(AO),A1 Address imra
00717A 614A bsr $71C6 Calculate bit number to clear
5?
00717C 0391 bclr Dl, (Al) And clear bit
63
00717E 43E80006 lea 6(AO),A1 Address iera
007182 6142 bsr $71C6 Calculate bit number to clear
£
en
007184 0391 bclr Dl, (Al) And clear bit
007186 43E8000A lea 10(AO),A1 Address ipra
00718A 613A bsr $71C6 Calculate bit number to clear
00718C 0391 bclr Dl, (Al) And clear bit
00718E 43E8000E lea 14(AO),A1 Address isra
007192 6132 bsr $71C6 Calculate bit number to clear
007194 0391 bclr Dl, (Al) And clear bit
007196 4CDF0303 movem.l (A7)+,DO-D1/AO-A1 Restore registers
00719A 4E75 rts
*************************************************** jenabint, enable MFP interrupts
00719C 302F0004 move.w 4(A7),DO Vector number
0071AO 02800000000F and.l #15,DO In long word index
0071A6 48E7COCO movem.l DO-D1/AO-A1,-(A7) Restore registers
0071AA 41F9FFFFFA01 lea $FFFFFA01,AO Address MFP
0071BO 43E80006 lea 6(AO),A1 Address iera
0071B4 6110 bsr $71C6 Calculate bit number to set
0071B6 03D1 bset Dl, (Al) And set bit
0071B8 43E80012 lea 18(AO),A1 Address imra
0071BC 6108 bsr $71C6 Calculate bit number to set
0071BE 03D1 bset Dl,(Al) And set bit
0071CO 4CDF0303 movem.l (A7)+,DO-D1/AO-A1 Restore registers
0071C4 4E75 rts
************************************************** bselect, calculate bit and register number I/I
H
0071C6 1200 move.b DO,D1 Save interrupt number B
(•«*1
r&
&3
0071C8 OC000008 cmp.b #8,DO Greater than 8 ?
0071CC 6D02 bit $71DO No
5?
0071CE 5141 subq.w #8,D1 Else subtract offset
0071DO OC000008 cmp.b #8,DO Greater than 8 ? ta
n
0071D4 6C02 bge $7108 Yes
0071D6 5449 addq.w #2,A1 Pointer from a to b register
p
0071D8 4E75 rts
ta
*************************************************** rs232ptr
0071DA 41F9000009DO lea $9DO,AO Pointer to RS232 iorec
0071EO 43F9FFFFFA01 lea $FFFFFA01,A1 Pointer to MFP
0071E6 4E75 rts
*************************************************** rs232ibuf
0071E8 34280008 move.w 8(AO),D2 Tail index
0071EC 36280006 move.w 6(AO),D3 Head index
0071FO B443 cmp.w D3,D2 Head > tail 1
0071F2 6204 bhi $71F8 No
0071F4 D4680004 add.w 4(AO),D2 Add buffer size
0071F8 9443 sub.w D3,D2 Tail - head
0071FA 4E75 rts
r**** ******************* rtschk
0071FC 082800010020 btst #1,32(AO) RTS/CTS mode
007202 6704 beq $7208 No
007204 61000862 bsr $7A68 rtson
007208 4E75 rts
A************************************************** rs232put, RS232 output s
00720A 40E7 move.w SR, -(A7) Save status CM
00720C 007C0700 or.w #$700,SR IPL 7, disable interrupts H
007210 61C8 bsr $71DA rs232ptr, get buffer pointer
007212 082800000020 btst #0,32(AO) XON/XOFF mode ? n
007218 6706 beq $7220 No a
00721A 4A28001F tst.b 31 (AO) XON active ? B9
00721E
007220
6618
08290007002C
bne
btst
$7238
#7,44(A1)
Yes
Is MFP still sending ?
s
CO
007226 6710 beq $7238 Yes
007228 34280014 move . w 20 (AO) ,D2 Head index
00722C B4680016 cmp.w 22(AO),D2 Tail index
007230 6606 bne $7238 Still characters in buffer?
007232 1341002E move . b D1,46(A1) Pass byte to MFP
007236 601A bra $7252
007238 34280016 move . w 22(AO),D2 Tail index
00723C 610002EO bsr $751E Test for wrap around
007240 B4680014 cmp.w 20 (AO) ,D2 Compare with head index
007244 6716 beq $725C Same, buffer full
007246 2268000E move . 1 14 (AO) ,A1 Get current buffer address
w 00724A 13812000 move . b D1,0(A1,D2 .w) Write character in buffer
t-ft 00724E 31420016 move . w D2,22(AO) Save new tail index
*" 007252 61A8 bsr $71FC rtschk, set RTS ?
007254 46DF move . w (A7)+,SR Restore status flag
007256 023COOFE and.b #254, SR Clear carry flag
00725A 4E75 rts
00725C 619E bsr $71FC rtschk, set RTS ?
00725E 46DF move . w (A7)+,SR Restore status
007260 003C0001 or .b #1,SR Set carry flag, don't output char
007264 4E75 rts
*************************************************** rs232get, RS232 input
007266 40E7 move.w SR, -(A7) Save status
007268 007C0700 or.w #$700,SR IPL 7, disable interrupts
00726C 6100FF6C bsr $71DA rs232ptr, get RS232 pointer
007270 32280006 move.w 6(AO),D1 Head index
007274 B2680008 cmp.w 8(AO),D1 Tail index
tt
007278 671A beq $7294 No character in buffer ? n
00727A 61000296 bsr $7512 Test for wrap around en
00727E 22680000 move . 1 0(AO),A1 Get buffer address
007282 7000 moveq.l #0,DO
007284 10311000 move . b 0{Al,Dl.w),DO Get character from buffer
007288 31410006 move . w D1,6(AO) Set new head index
00728C 46DF move . w (A7)+,SR Restore status
00728E 023COOFE and.b #254, SR Clear carry flag, OK
007292 6006 bra $729A
007294 46DF move . w (A7)+,SR Restore status
007296 003C0001 or .b #1,SR Set carry flag, no character there
00729A 082800000020 btst #0,32(AO) XON/XOFF mode ?
0072AO 671C beq $72BE No
0072A2 4A28001E tst.b 30 (AO) XON active?
Oi
Ui 0072A6 6716 beq $72BE No
U) Get input biffer length used
0072A8 6100FF3E bsr $71E8
0072AC B468000A cmp.w 10(AO),D2 Equal low water mark ?
0072BO 660C bne $72BE No
0072B2 123C0011 move . b #$11, Dl XON
0072B6 6100FF52 bsr $720A Send
0072BA 4228001E clr.b 30 (AO) Clear XON flag
0072BE 4E75 rts
************************************************** rcvint, RS232 receiver interrupt routine
0072CO 48E7FOEO movem.l DO-D3/AO-A2,-(A7) Save registers I
MM*
0072C4 6100FF14 bsr $71DA rs232ptr, get RS232 pointer t/5
H
0072C8 1169002A001C move.b 42(A1),28(AO) Read receiver status register
0072CE 08280007001C btst #7,28(AO) Interrupt through receiver buffer full ?
0072D4 67000092 beq $7368 No
0072D8 082800010020 btst #1,32(AO) RTS/CTS mode ? E.
8?
Abacus Software Atari ST Internals

M
<D
4-1
ol
-H T!
en 0)
CD Ol
H 3

M M M M ^5 o-
0) <B (1) <D 11
> IH HH <M D^ _*s
-H tH m •a 1H G M
CD 3 3 G 3 x 0! 10 O"
O 43 43 3 01 43 0) rH £
0) O C** U •a 4-1
in C G n (U G G M JH G
C" en -H -rl <a , —1 M -H -H 0! CD C" 0)
E c- £\
10 £V. -H •o IH 4-1 C*' 01
o 0! rH J_J en 4-1 a, 10 •a 0) rH IH 10 0)
M CD 73 T! M-l b fa <d O <s 4_) <o 4-1 -H 3 0) •a >1
IH O (U G fa rH G >H 10 43 ^ •o o •a
O £ fa o 1-1 X 15 rH !H 45 4-1 r^ 0 £ 10
10 £ -H fa j^|
X 0) 10 CD 4-1 Cn E (U
•a u
^_(

4J fa 0) o <B fa 0! •a M 3 3 -H fa M
<0 (fl fa O X 4-1 0) fa 4_) G O tr IH
p
0) 0) a ^q £/) fa rH
4H •a O (U O 0 O -H tH 0)
^ G G EH O IS
4H U X M 10 -H X <a 43 -H -H rH U X
O •a 10 0) j_l
rH 4J •a (U (U
in 01 3
10 •v^ •v^. pl-,-1

01 (0 to 01 3 3 <u ^
IS o 4-1 10 -H 01 (0 01 4-1 O 4-1 3 PM

4-1 CD EH Q) O 0 0 O rH 01 O 0) e* 19 CD (U 0) 0) 0) <0 0) O1 0 EH at o 0 O
H e; >H X 3 X 3 CJ u 3 (/} U EH EH W >H IS K t/3 13 H 3 « SH X S X

0 O 0 CM
Q 0 0 rH rH CM Q 0 0
_„_
< •ta'
rH Q Q CM 0
o rH 0 CO ^
f3* ^_^ -^-- •*-• ,~^

^?
|^
^ f^
<=r *xr ,_) CM ^i CM •C* Q vo CO CO Q •fc CO . .
CN , „
CO ,_%
-—
•~r
CO O u CM CO CM 0 0
C£) VD rH CO rH o rH PL, vo O tH O vo o O CO W rt^ IO CO vo CO an <
CM f=C
<^
-~_- ^_ CO ^ CO
p^.
CO 0 CO cn CO h CO f^C iO f^' CO ^
fc. rH •»-- CO ^ CO », CO —
r- r- <^Q ,—] r- O r- t— •c/> t— <^- p- *— r- •fc— O T-H
^ CM f-* rH r- 0 r~ o
•=r <rt
1-1

41=
* <*
rH
«> =tt= «• co «• VO «> o Q Q (—
«> rH «• =t(= «• * «> CO
* *

43
,5 rH 43
.J
43 ^• 43
45
• S • u 43
(U 4J 4-1 0) ?' 0) 0) 0) (U 4-1 4-1
cr M
QJ W O
05
JJ
0)
c
01
4-1
O1 a
(U E
0! .>
C O
IS
JH
a,
s
0)
C o
IS
H o ^ fi tr
£ CD
01 o 0 0 ^
01
o,
E c
0) 01
CT 4-1
0) 01
4-1
0!
G
01
4-1
E 43 O o E 43 e 43 O 43 E E E 43 0 43 43 43 43 43 4-1

o O o
CM CM CM CM
O O o O o o
O o o O o o
CM H rH O o CO fa CO CO O O CJCO 00 rH o
CO CM O O o rH fa O fa o o o tq o o o
[ ^ 0 0 O O o O O O rH o o o w o o o o
0 0 0 o o o o o O O O rH O fa o o o o
•sroaicO'3'COCJOcotJCM o co u •a1 CO O VO CO O rH O CO CO CO CO CO
O O C M C M C M C M r H O O l ^ V O o o r- 10 CM O ^r vo co O VO CM CM CM
O VO rH O VO CO
O VO rH VO

VO < O CM
Q M TT1 M M f T i f~i T T i f~i F T T f~^ O O O rH
CMCMtMCMCMCNCMCMCMCMCO ro ro ro ro
r- r~ r- r-
0 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 o o
o o o o o o 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 660E bne $735C Yes
ta
n
00734E 117COOFF001E move.b #$FF,30(AO) Set flag for XOFF
007354 123C0013 move.b #$13,Dl XOFF
007358 6100FEBO bsr $720A Send
00735C 082800010020 btst #1,32(AO) RTS/CTS mode ?
007362 6704 beq $7368 No a
007364 61000702 bsr $7A68 rtson
007368 08A90004000E bclr #4,14{A1) Clear interrupt service bit
00736E 4CDF070F movem.1 (A7)+,DO-D3/AO-A2 Restore registers
007372 4E73 rte
***************************************************** txrint, transmitter buffer empty
007374 48E720EO movem.1 D2/AO-A2,-(A7) Save registers ?
007378 6100FE60 bsr $71DA rs232ptr, get RS232 pointer
00737C 082800010020 btst #1,32(AO) RTS/CTS mode ?
007382 6630 bne $73B4 Yes, then use this interrupt
007384 082800000020 btst #0,32(AO) XON/XOFF mode ?
00738A 6706 beq $7392 No
00738C 4A28001F tst.b 31(AO) XOFF active ?
007390 6622 bne $73B4 Yes
007392 1169002C001D move.b 44(A1),29(AO) Save transmitter status register
007398 34280014 move.w 20(AO),D2 Head index
00739C B4680016 cmp.w 22(AO),D2 Compare with tail index
0073AO 6712 beq $73B4 Send buffer empty
0073A2 6100017A bsr $751E Test for wrap arround
0073A6 2468000E move.1 14(AO),A2 Pointer to send buffer
0073AA 13722000002E move.b 0(A2,D2.w),46(Al) Pass byte to MFP for sending
ff
2.
0073BO 31420014 move.w D2,20(AO) Save new head index
0073B4 08A90002000E bclr #2,14(A1) Clear interrupt service bit S3
0073BA 4CDF0704 movem.1 (A7)+,D2/AO-A2 Restore registers
re
0073BE 4E73 rte
B
E>
3?
ctsint, CTS interrupt routine
B3
0073CO 48E720EO movem . 1D2/AO-A2,-(A7) Save registers O
0073C4 6100FE14 bsr $71DA rs232ptr, get RS232 pointer
0073C8 082800010020 btst #1,32(AO) RTS/CTS mode ? cn
o
0073CE 672A beq $73FA No, then ignore interrupt
0073DO 1169002C001D move . b 44(A1),29(AO) Save transmitter status
0073D6 08280007001D btst #7,29(AO) Transmitter buffer empty ?
0073DC 67F8 beq $73D6 No, wait (must jump to $73DO!)
0073DE 34280014 move . w 20(AO),D2 Head index
0073E2 B4680016 cmp.w 22(AO),D2 Compare with tail index
0073E6 671E beq $7406 Transmit buffer empty
0073E8 61000134 bsr $751E Test for wrap arround
0073EC 2468000E move . 1 14 (AO),A2 Pointer to transmit buffer
0073FO 13722000002E move . b 0(A2,D2.w) ,46(A1) Pass byte to MFP for sending
0073F6 31420014 move . w D2,20(AO) Save new head index
LO
0073FA 08A900020010 bclr #2,16(A1) Clear interrupt service bit
Ui 007400 4CDF0704 movem . 1 (A7)+,D2/AO-A2 Restore registers
00 007404 4E73 rte
007406 60F2 bra $73PA Transmit buffer empty
***************************************************** rxerror, receive error
007408 48E780CO movem.l DO/AO-A1,-(A7) Save registers
00740C 6100FDCC bsr $71DA rs232ptr, get RS232 pointer
007410 1169002A001C move.b 42(Al),28(AO) Save receiver status
007416 1029002E move.b 46(A1),DO Read data register (clears status)
00741A 08A90003000E bclr #3,14 {AD Clear interrupt service bit
007420 4CDF0301 movem.l (A7)+,DO/AO-A1 Restore registers
007424 4E73 rte
B
***************************************************** txerror, transmit error sr
007426 48E700CO movem.l AO-A1,-(A7) Save registers
3
sr
Abacus Software Atari ST Internals

iorec, get pointer to table

rs232ptr, get RS232 pointer


rs232ptr, get RS232 pointer

CO
a cu

rsconf, configure RS232


3 O 0]
•Q M CO
4-1
cu

IPL 7, disable interrupts


o
3 4-1 cu C

Base address of the table


Clear interrupt service bit

c en 4-1 o
Restore registers

cu •rH 4-1 n 4-1 •o


cu
44 (Al) , 2 9 ( A O ) Save transmitter status

X! C -H
o c

Get pointer to iorec


cu E

Restore status
3 rH rH -H CO cu
C CO CU C X CU
to CO !H

iorec table
O ffl •M T3
CU 3 o to cu o
0 -H M 4-1
-H 10 •o cu «
> 4-1
to
0
3
CU
rH
CU
rH
>
-H
r4

•o
4-1
0)
U en
I
CO
CU
-H
EH
CM
CO
CM
to
K
1
M
(H
Q
M
S
1—
CU
CD

en
.Q
<0
CO
-H
Q
CO
CO
-H 0
•8
Q S !Z K
4->
(0
tn
cu
4-1
CU
co
<u

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

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

0(A2,D1.1) ,DO

O
m.l (A7)+/AO-A1

Q
#1,14(A1)

#$700, SR

tH
(A7)+,SR

tH tH CM
$745C,A2

Q c— en•s < CO

I o W ~

$71DA
$71DA

0 CM
Q Q o CM O o Q ^P co r-
Q o co
o P? CM en cn CM O O O
en Q Q vo vt r-
rH rH
.1
.b

.w

XI
cf a, cr 3
i i ig
rH
0! cu * cu
•X cu 3 rH
H.
rH •X 3 CU
^to o rH
O
cu
o 4-1 •X o o o
CO
CU CO
>
O
> to
O 4J
•X
-X o o O
-X
•X M ^<a § 4-1 -H >
0 o o o to S 0
J3 E E (H •X
*
e £ O
M
10 *
•X
•o TS TJ •X O Xi s E 4J X) E
-X
* * *
*
* -X
•X * -X
*
•X *
* •X *
*
* *
*
•X *
*
* *
Q H •X CJ •X * o
TH0 •X •X •X CM
O O •X «gi * •X O
O o •X r- -X •X O
W U tH 0 -X ^p 0 0 0 •X o CM O * o O CO
f^ CJ 1^3 r-
g£ CM o O X o o o O -X Q fc o * o vo CM CM CM O o
o o CO O •X o [~- o CO •X en cn rij * r~- Q o 0 O 0 0
fT ( o o O * o o o rH •X o o O -X o PT, O 0 o O o
o en en fry. CO * o [V, o en tH CM Cs4 in •X o o O * U O cn o 0 o
o ^o <£ Q r- * o CM i— W (J4 CO <o Q r- * o o o •X o sp o •a1 ^Q o vo
tH tH CO CJ W * CM CM o o in in 0 VO H -X o o o * o tH En o CO CO t*C ffl rH
v£) tH o *=p -X r^ CO ^p o "3* w -X o o o •X o VD O [^ tH tH •531
* *
ts£ W •=p f£ W
CM CM CO CO CO
* o CM VQ CO o CM ^P CO <
* •31 ^1* •=3* *=p ^p in in m in
-X
•X
0 o
in 10
"=r
vo
•X
•X
CO CJ 0 *3*
10 U> t^
vo <£
r-
w CM
CO
-31
CO
•C1 ^P "C1 "C1 ^31 •X•31 «gi •31 sp sp «gi "31 *T *T •X •3" ^p sp * [— •C
•31 sp ^p [—1 •31 qi ^T •sP T
r- r- r^ -1Cr^ r- f^ [•^ r- r- r- r~ r- •X [^ [^ r- -X [^ r- r- f^ r^ r^ f^- (^
— 0 (o
0 [O — 0 * o 0 O o o o o o o * O o o •X [— o o o 0
o o 0 0 0
0 0 0 0 0 •X 0 0 0 o 0 o o o o •X O o o * o o o o 0 o 0 0 0

359
00748A 7000 moveq.l #0,DO
00748C 7400 moveq.l #0,D2
00748E 4A6F0004 tst.w 4(A7) Baud rate
007492 6B20 bmi $74B4 Negativce, then don1 t change
007494 322F0004 move . w 4(A7),D1 Get baud rate number
007498 45F9000074F2 lea $74F2,A2 Table for baud rate control
00749E 10321000 move . b 0{A2,Dl.w),DO Get value from table
0074A2 45F900007502 lea $7502, A2 Table for baud rate data
0074A8 14321000 move . b 0(A2,Dl.w),D2 Get value from table
0074AC 2200 move . 1 DO,D1
0074AE 7003 moveq , 1 #3, DO Pointer to timer D
0074BO 6100FBDE bsr $7090 Set timer D for new baud rate
0074B4 4A6F0008 tst.w 8(A7) Set ucr ?
0074B8 6B06 bmi $74CO No
0074BA 136F00090028 move . b 9(A7) ,40 (Al) Set ucr
0074CO 4A6FOOOA tst.w 10 (A7) Set rsr ?
OJ
ON 0074C4 6B06 bmi $74CC No
° 0074C6 136FOOOB002A move . b 11(A7),42(A1) Set rsr
0074CC 4A6FOOOC tst.w 12 (A7) Set tsr ?
0074DO 6B06 bmi $7408 No
0074D2 136FOOOD002C move . b 13{A7),44(A1) Set tsr
0074D8 4A6FOOOE tst.w 14 (A7) Set scr ?
0074DC 6B06 bmi $74E4 No
0074DE 136FOOOF0026 move . b 15(A7),38(A1) Set scr
0074E4 7001 moveq . 1#1,DO
0074E6 1340002A move . b DO,42(A1) Enable receiver
0074EA 1340002C move . b DO, 44 (Al) Enable transmitter I
0074EE 2007
0074FO 4E75
move . 1 D7,DO
rts
Old value of the control register
21
**************************************************
0074F2 0101010101010101 dc.b 1,1,1,1,1,1,1
Timer values for RS-232 baud rates
High byte
I
63
5?
0074FA 0101010101010202 dc.b 1,1,1,1,1,2,2 CP
dc.b 1,2,4,5,8,10,11,16 Low byte
007502 01020405080AOB10
00750B 204060808FAF4060 dc.b 32,64,96,128,143,175,64,96
1
en
W5
O
wrapin, test for wrap arround
007512 5241 addq.w #1,D1 Head index + 1
007514 B2680004 cmp.w 4(AO),D1 Equal to buffer size ?
007518 6502 bcs $751C No
00751A 7200 moveq.l #0,D1 Else start with zero again
00751C 4E75 rts
************************************************** wrapout, test for wrap arround
00751E 5242 addq.w #1,D2 Tail index + 1
007520 B4680012 cmp.w 18(AO),D2 Equals buffer size ?
007524 6502 bcs $7528 No
007526 7400 moveq.l #0,D2 Else start with zero again
ON 007528 4E75 rts
H-»
************************** ************************* midikey, keyboard + MIDI interrupt
00752A 48E7FFFE movem.l DO-D7/AO-A6,-(A7) Save registers
00752E 4BF900000000 lea $0,A5 Clear A5
007534 246DOA2A move.l $A2A(A5),A2 mbufrec, $7558
007538 4E92 jsr (A2) Interrupt from MIDI-ACIA ?
00753A 246DOA2E move.l $A2E(A5),A2 kbufrec, $7568
00753E 4E92 jsr (A2) Interrupt vfromon Keyboard-ACIA ?
007540 08390004FFFFFA01 btst #4,$FFFFFA01 Still interrupt ?
007548 67EA beq $7534 Yes
00754A 08B90006FFFFFA11 bclr #6,$FFFFFA11 Clear interrupt service bit
007552 4CDF7FFF movem.l (A7)+,DO-D7/AO-A6 Restore registers
007556 4E73 rte
S?
******** ******************************** MIDI interrupt
SB
007558 41EDOAOO lea $AOO(A5),AO iorec for MIDI n
00755C 43F9FFFFFC04 lea $FFFFFC04,A1 Address of the MIDI ACIA </i
007562 246DOA16 move.l $A16(A5),A2 $759C, MIDI error routine ce
o
007566 600E bra $7576
69
**************************************************** Keyboard interrupt
007568 41ED09F2 lea $9F2(A5),AO iorec for keyboard
00756C 43F9FFFFFCOO lea $FFFFFCOO,A1 Address of the keyboard-ACIA
007572 246DOA12 move.l $A12(A5),A2 $759C, Keyboard error routine
007576 14290000 move.b 0(A1),D2 Get ACIA status
00757A 08020007 btst f7,D2 Interrupt request ?
00757E 671C beq $759C No
007580 08020000 btst tO,D2 Receiver buffer full ?
007584 670A beq $7590 No
007586 48E720EO movem.l D2/AO-A2,-(A7) Save registers
OS 00758A 6112 bsr $759E arcvint, get byte
00758C 4CDF0704 movem.l (A7)+,D2/AO-A2 Restore registers
007590 02020020 and.b #$20,D2 Mark bit tested
007594 6706 beq $759C No error
007596 10290002 move.b 2(A1),DO Read data clear status
00759A 4ED2 jmp (A2) Execute error routine
00759C 4E75 rts
************************************************* arcvint, get byte from ACIA
00759E 10290002 move.b 2(A1),DO Get data from ACIA
0075A2 B1FC000009F2 cmp.l #$9F2,AO Keyboard ACIA ?
0075A8 66000416 bne $79CO No, MIDI
0075AC 4A2DOA32 tst.b $A32(A5) Keyboard state
0075BO 6654 bne $7606
0075B2 OCOOOOF6 cmp.b #$F6,DO Keypress ?
0075B6 650000F4 bcs $76AC Yes 89
5T
0075BA 040000F6 sub.b #$F6,DO Subtract offset
0075BE 0280000000FF and.l #$FF,DO
0075C4 47F9000075F2 lea $75F2,A3 Pointer to IKBD code table
0075CA 1B7300000A32 move.b 0(A3,DO.w),$A32(A5) Save IKBD merken
0075DO 47F9000075FC lea $75FC,A3 Pointer to IKBD lengths table
0075D6 1B7300000A33 move . b 0(A3,DO,w),$A33(A5) IKBD index
0075DC 064000F6 add.w #$F6,DO Add offset again
0075EO OCOOOOF8 cmp.b #$F8,DO Mouse position record ?
0075E4 6DOA bit $75FO No
0075E6 OCOOOOFB cmp.b #$FB,DO Mouse position record ?
0075EA 6E04 bgt $75FO No
0075EC 1B400A40 move.b DO,$A40(A5) Save mouse position
0075FO 4E75 rts
IKBD parameter
0075F2 01020303030304050607 Status codes
Oi
o\* 0075FC 07050202020206020101 Lengths
*****************************************************
007606 OC2D00060A32 cmp.b #6,$A32(A5) Joystick record ?
00760C 64000084 bcc $7692 Yes
007610 45F900007656 lea $7656,A2 Pointer to IKBD parameter table
007616 7400 moveq . 1#0,D2
007618 142DOA32 move . b $A32(A5),D2 Kstate
00761C 5302 subq.b #1,D2 1 - 5 => 0 - 4
00761E E342 asl.w #1,D2 Times 2
007620 D42DOA32 add.b $A32 (A5) ,D2 + 1 I
007624
007626
5302
E542
subq.b #1,D2
asl.w #2,D2
1 - 5 => 0 - 4
Times 4 i
007628 20722000 move . 1 0(A2,D2.w),AO IKBD record pointer
00762C 22722004 move . 1 4(A2,D2.w),Al IKBD index base
B
007630 24722008 move . 1 8(A2,D2.w),A2 IKBD interrupt routine 83
8T
007634 2452 move , 1 (A2),A2 Get interrupt vector cr
as
007636 7400 moveq.l #0,D2 n
007638 142DOA33 move . b $A33(A5) ,D2 Get IKBD index CO
00763C 93C2 sub.l D2,A1 Minus base
00763E 1280 move . b DO, (Al)
007640 532DOA33 subq.b #1,$A33{A5) IKBD index minus 1
007644 4A2DOA33 tst.b $A33 (A5) Test index
007648 660A bne $7654
00764A 2F08 move . 1 AO,-(A7) Pass record pointer
00764C 4E92 jsr (A2) Execute interrupt routine
00764E 584F addq . w #4,A7 Correct stack pointer
007650 422DOA32 clr.b $A32 (A5) Clear IKBD state
007654 4E75 rts
*********************************************** Parameter table for IKBD
007656 OOOOOA34 dc.l $A34
007 65A OOOOOA3B dc.l $A3B
00765E OOOOOA1A dc.l $A1A
007662 OOOOOA3B dc.l $A3B
007666 OOOOOA40 dc.l $A40
00766A OOOOOA1E dc.l $A1E
00766E OOOOOA40 dc.l $A40
007672 OOOOOA43 dc.l $A43
007676 OOOOOA1E dc.l $A1E
00767A OOOOOA43 dc.l $A43
00767E OOOOOA49 dc.l $A49
007682 OOOOOA22 dc.l $A22 I
007686 OOOOOA49 dc.l $A49
00768A OOOOOA4B dc.l $A4B
00768E OOOOOA26 dc.l $A26
*************************************************
3
M
Abacus Software Atari ST Internals

eived keyboard codes


<U
d)

key released ?
terrupt routine
X
f-

key released ?
4J

joystick data

key pressed ?
T) -H
-H 0) U-l 45
t!
-rH 0!
01
01
-H 01
a)

leased ?
0) 01 4-1

essed ?
CO 4J rH 45
>H 4->

status
0) 45 •H
rH «
0) 0! -rH EH
H M X M O
O O
c o M MH 4J J_l j1 tf_4 J_( M Q)
-H HH di 4-1 4-1 O 4-1 >M
-H
0
M-l
>H
•H
a O
4-1
M
O 4J 4-1
-H -H -rl e-\1 45 -H >, >^
O CO 01 45 45 4J 45 43 4J 01 43 0) 4-1 0)
-H 01 01 01 01 -H 0] -H -H
4-1 <B 0) 43 ^i 4J 43 43
01 M 0 -O 4-> id 45
^J
45
rH
id ,j] Hq
?*i 13 O <d 1H 4-1
4->
0) er> [ 1
0) P^ +J C^
0 T) M O O ) O 0) <D 0 rH -H O W -rH O rH gH O 0) EH
1~3 £C Oj r3 1-3 3 CO ,-3 £3 CJ K 13 « 53 O O 3 W O

*
*
*
*
*
*
Q m — m m * in o o o o o o
*• *£ CM r^ F^
* < O Q Q Q Q Q
* — -*CJrHO * C O r H O » ^P rH O v
» O r H O ".OrHO -
* Q r i C f f l Q f O r t J C J Q C O VO Q Q CO V O W Q n Q W Q O Q
rtJCO K ^ NCM*5PVO * mcMVo »p-<vo •-p- m vo - p- ( Q v o ^ p - r H v o - p - e n
«>ri;vorHOra;^r~- * fQ </> P- rH P- </> C rH P- «> P- o p- -C/5- p* O P- </> P~ CM E— O>
=tt=«-=S=Q Q«-«>-U> * =%«•*«•
*
*
rH 43 rH 43 rH *
• 43 • • • • * 43
Q) • CT 0) Q) Q) * M
> T S 4 3 > > > < 0 < d * 0) CD id G, (1) H ft, <!) H fX (!) Q) id
O T i P O O O f f l r H * G CO M E G O S G 01 " G O S G 01 s-i
S < a c o g g g r H 4 3 * 43 43 43 O 43 43 43 O 43 43 43 O 43 43 43 O 43 43 43
*
*
*
*
*
•*it
•X
•X
*
*
o *
o * vo o O Q CM Q
o o < o o o en
o
o o
S o o
•X

*
•X
CM
O
O
o
o
o
o
o
o
o
o
o
o
O
O
o
rH
O
o
O
o
o
o
o
CJ Q rH O Q Q O VD rH <O" O VO rH CO o vo CJ VO rH O O VO o
CM O co vo M -X O O CJ P- O O CO VO o o c j i n o o c o i n o o o o
CM CM Q •X O VO 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
CM Q in CM CM -a1 •X O VO o vo o v o o v o o v o o v o o v o o vo o vo o vo o
•X
CM CO CJ O CM VO o ^ vo < CJ O CM VO CO O vo CJ
en en en en PQ rn cq ca ca O CJ CJ CJ CJ CJ Q Q Q Q Q f
vo vo vo vo vo vo vb vo vo vo vo vo vo vo vovovovovovovovovovo vo vovovo
p- r- p- r- r- P- p- P- p- p- p- p- p- p~p-p-p-p-p-p-p-p-r- p- p-p-p-
o 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 0 0 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

365
Abacus Software Atari ST Internals

IB
4-1
T!
C
P
0
G CO
o
C" -H X CO
4-1 o 3
•o IB -H 4-1 CO &
0) H rH <B 3 Q)
CO 3 O 4-1 4-1 M M rH
CO er> CO 0) (U
0) -rH r>1
4_) 4-1 4-1
IM «

released
EH TS 01 CO G G
U •o 01 a C CJ 3 3
CU co o O 4-1 O O
« IB >! o CU rJ CD 0 o
CU CD _C"I -H T>
rH (U ^
U .p •o CO A O
o (U rH -H C CO O IB id
4-)
-H
a, M-l H 4J
-rH
«
CJ
O
CO
rH
U
1H
O
3
O
3
O 3
rH
CU
rH
CU
43 >i o G CO 0 >1 01 rH CM •a TJ
0! O >i CO 4-1 G 01 4-1 X
X U CU CO 4-1 M X <B >i >i rH rH
m CO H CU IB Id id <d
O
(U
rH O 0)
4-1 EH

4-1
O 0! O
•8
•o
IB §
4-1 G IB
CO
IB
CO Q< CO
CD CU CU IB 01 CU
01
rH
01
rH
"Z. CJ S co ^
< O u 53 O 3 CO M co S >H 05 >H CO Q Q CJ CJ

in in ~ —
VO m -~ rf; <; m m
in CO < m
< CJ Q — —
< — CJ Q
0 0 0 ^r CO Q in PQ <C P- p-
Q Q Q CO CO <C m p- -co-
CO rH O - «gi rH O O ,—1 O - VO ^r CJ p- •CO rH i< O ^^ CO rtl *. </> «/>
En Q o Q CO
CO CO CO ,—) Q co < co </> CM D - Q <«• Q m m «> w
VO >* r- ro r— m r-
f~*
r~ co p- *. p- O - K
-. r~ r- r~ » p- P- p- O O
r- CM r- <n r- co r- •U5- CO r^ </!• [^ o r~ to- vt *y i—i c^ r^ ri^ p- o <; f£. P-
-U> </> =8= vt 41= «•
=8= =!*= </> 41= «• 4^ v> 4^ V* 4^ 4!= 4t= Q 4^ < / > < / > < / > Q to-

43 43 43_ 43_ 43 43 43_


JH 4-1 • rH 4-1 4-1 CU CU CD CU CU
0)rH
C O
i B C X C U t U i B Q - C U r H
E G O
&, cu M tr CO CU 4-1 0)
0 0 0
S C «
o G- 4 -- 41 C3 UE OE O4 U3 OE4r - H1
4J C CO C
43 43 43 O 43 43 43 O 43 43 4-1 43

O Q
7D780A86

p- p-
o o
«=r W Cn
CO CO P- p-
0 o o o o o
CM CO CO CO CO pf, o 0 o ^T Q P- m ffl o o o o
O CO o
o
m
o
o
o
CO o
o
o o o m
o o o <
o
o
r~
<:
P-
f=c o o
O O o o
O O 0 o o
o o o O o o 0 o o o o o o o o o o o
VD rH CO o vo
O CO to o o
rH 0 O VO rH o o o Q
CJ CM o O CO CM O CM CM O p-
CJ rH rH w u o Q VO O
O C M C M r H T r ~ p - C O
G\t o
VO CO 0 CJ VO
VO O VD O VD
CO 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 covoi<vopqpqcQop3P3
o vo VO rH rH rH VO rH rH

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 ' V O r f S C J O C M V O W ^ O C O W


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 co co co ^ ^ ^ ^ m in m
vo vo vo vo vo vo i— p- p- p- [— f^ [^ [^ (^ p~ p— [—- p~ {— p-p-r-r~p-p-p-r~r~p-
P-P-P-P-P-P-P-P-P-P-P*P-P-P-P-P-P-P-P-P- P-P-P-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 o o o
o o o o o o 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
Abacus Software Atari ST Internals

1
1

1
1

1
CJ

Address of the CAPS LOCK keyboard table


Address of the standard keyboard table
1
-H
rH

CJ

0)

o
MH


Xi p-
id -o

Save iorec for keybaord


C" 4-1 0! T!
01 0)

INSERT key released ?


T! •a CO CO
01 c 01 CO

HOME key released ?


CO 3 c>- M 01
CO o ft n
01 CO 0! ft

Dl
ft 01 -H 0!
p 4-1 X 0)
O X

Scan code to
rH
rH id 0 ^
-H 4-1 -H >H
4-1 CO rH O -H
CO 0 CJ A -H
01 CO O CO
rH ^i CO CO
01 o 01 0!
CO CO
c TS PM en
Yes

o o o 0 T! -H 01 01 o

No
V ( A 5 ) Start sound
!3 < S3 S3 ft. CJ

in
<
VO

$A5E(A5) ,AO

$ A 6 6 ( A 5 ) ,AO
IAS)

in m in in 03 in in in
<
r^*, *—
#$7D78,?
$A7B(A5)

0
PQ CJ o Q Q 03 r- o Q Q Q
r- Q
r- t— Q 03 Q m m m
ft.
#0,D1
DO,D1

- w to —

$77C2
$77A8

03 CJ
$7792

CM
r- Q to to to r- CO CM m PQ to - I to to Q to w
- O r- Q en o » r-
p- O rH rH n o to o to 0 r-
•CO =4t= Q Q Q =*= t/> =*! =tt= =tt= to to
* *
^- X! X) X! rH X) rH H- X) rH rH

01 0! 01 01 • 4-1 0) CU 01 CD 0! 4-1 4-1


id 4J tr > > > tr ft > ft 01 CO tr CO tr § •d CO tr i CO (U CO tr
M CO <p o o o o e 0! g
XI i ' X! e g e g CJ X) CJ
G
s s 0)
X)
0)
X)
O
S
O
g g
O o o o
g S g id
c 01
£ X!
O
g s Xi
4-1
XI
01
X)

VO
CO

o
Q ^r 03 ie£ O Q Q
m CO r^ 03 m in in
ft, %r Q f£ ft. <c <C
o o r- O o o o
PQ PQ CJ Q r- CO CO fxl o
CM o O w [V, ^r VO o rH
r- r- r~ r- CJ D m 0 CM o o 0 m r- o VO o O
ft. ft f£ <, o o CM o CM o o o p£ o o ft, o O
o o o o o o 0 o o 0 0 o 0 o 0 0 0 0
O Q H 0 rH rH rH O CO O 0 Q o Q W U CJ CO 0 0 Q o D ^ Q Q CO Q ft,
CM CM O O ^* ^ ^31 O 0 0 0 CM o CM o r- t— o 0 0 VO ^1 CM O VO CM o CM rH
O ft r~~ CM PQ CQ PQ CJ r- CJ CO r~ CO r- PQ PQ fe CM CM O CM CO r- o CO VO CO
VO -a* VQ r- (H (H rH O VO O VO o VO o VO CM rH CM t- rH CM 0 o VO CM O VO O VO
•=T VO < U W CMVO W o
ft. IT CO w CM 03 ft. CM CO ft, O W CM VO CJ W CM O3 ft. 0
VO VD VQ VO VD r^- r~ c— r- co CO CO CO en Cn CTt < <C m PQ 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 Atari ST Internals

of the shift keyboard tab.


0!

(8
et to GSX standard
+J

to GSX standard

to GSX standard
to GSX standard
0)
•P

to linefeed
O P-
P
*W *O
IP.

return
CD
C" o- 0) M CD -H
Ti M cH M
O CD

E ?
0) CD O S-l
O, 0 O
M M
c G CIJ (—1 ^, 0)
.p
f-l M
o O m <a O CD 0 o 3 4-> 3 p
-H -H « W X <o M W O O O
-P 4-! o 01 -H 01 •(/> CD CD
0 O M J "j S-l 1 ~\ T3 t"^ (_3 J>
C C •o •a -p r^i G ^ P5 G ^ K c
O 3 O T> •a 0) EH O 10 O O EH O T! EH 0 EH 0
fe CD 0 S3 CJ S3 CJ CJ 3 < O O CJ o

O
Q
o
in

io O Q c-t rH o
o o f_I Q in o o Q Q Q Q Q Q a
Q CO Q CO Q 0 CO *-* < CO Q CM Q o o ^ co ^ pq O_ CO
.. •* U *• o oo •* CD o
*. W «. U .* Q en CM O </> in
^ 0 *, CM p- t-H O C n p O i - H O Q C I Q C M Q en CM en Q
en p- CO p- VO f£
LO ». en CO co CO 0 CO ^r 00 cocn^rcoE— ^ . c n ^ r c o t — *. en co co
lO p- VD p- CM 0 ^- ^C CM r- r_| p* f—l p~ «- p-

* «• «• =s= =* «• •tft- —-
O =*t= «• =tt= «• =«= «• =w= «- =«= -co =tt= «• «• =*=
*
^H •~1
rH
& 43 J5 tf
.
• ^• 43 tr 43 43 t T t T 4 3 (TO* 43 CT
CD 0) -p • • • CUGJ • 0)0) • CU
> 0) ^> O
*
ft. u a -M T! J> n) > M cr P. o 1l pP., <CD D T 3 c a p , ( i j > > ( O p , c i ) > > < o p , a ) >
E O g •o O S-l 0 o ^_> 0) g o <a" - T S U S G O O S H g G O O S - l g G O
0 0 43 cd g g g 43 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
0077FO 082D00020A5D
0077D2 OC00003B

007810 OC01004B
0077DE 06410019

00780C 6000018A
0077F8 OCOOOOOD

00781A 6000017C
00781E OC01004D
0077EC 10300000

6000016E
0077E8 206DOA62

007802 OC010047

007808 06410030
0077D8 O C 0 0 0 0 4 4

0077E4 600001B2

OC000032
0077DC 620A

007800 672A
0077FE 700A

007816 7273
0077D6 6510

0077E2 7000

0077F6 6760

007814 6608
007806 6608

007818 7000

6606
0077FC 6604

7000
7000

CO
7274

o
VQ
\a
00782C
007830
007832
007824

007828

CM
007826

CM
CO
p-
o
o

368
Abacus Software Atari ST Internals

C1-
•o •o
0) (U
CO CO
01 o]
fi\ 0)
M m
A (X
>, >,
<D 0)
X
^
4-> 4-1
>H 1-1
-H -H
A J5
01 01
(V.
4-1
,£?
a> -H
01 ^H
01 01 0]
0) P $-1 P M
a
;>,
S
4J
01
0
•o
G
4J O
10 ~v
4-1 T!
01 C
0) <0 <a
X C" 4-1 4J
lf_|
4-1 M-t 4-J
E-i - -H
(-3 O O O <Sl fi (D O O O
i=C S3 - & - fO •^ 13

CM CM
in a Q
<
o o o o o Q rH O in o <-H o in o <-H o
Q Q Q O Q m Q Q < Q Q Q ft Q Q Q
CO s ^ ^ CO K O - CO < co •, o - — CM CO K CO - . . ^ — CM CO ^ 0 0 v O
- CO -
en va -=r d m fa |k< en <o en < CO OQ Q en o en enpqQQencqcncopqQ
en o co CM co in en en K en CO m en to <n CM co in in en en CM co in
r- </> r^ <o r* p* -to i^ n p- -to *=C n r-
* <O =!t= -to
*
45 ft 45 45 45 45 43
cr CT S 43 • • 43 45 • • 45 45
CD • 4J • ( D O ) ' 01
_ ' oj a> a) 0)
(B > a ><oT3(aoitra<u>>t!cr> <op.a>>>iocr> OJ >
C O e c o 4-1 d) C O O C O J O M g O O G 0) o C O
O 45 g <o 45 45 4 5 g g i 0 4 5 E 4 5 0 g g < 0 4 5 g 4 5 0 4 3 g
082D00030A5D

103C005B

02020003
02020003

103C007B
0240001F
OC000036

6000011A
142DOA5D

103C005D
6000014A

OCOIOOIA

142DOA5D
60000156

103C005C
67000138

103C0040

600000FC
OC00002D

OC010028
67000122

OC010027
60000162

60000142

67000104
701F
6606

6618

6618

6618
701E
6606
007838

00784A
00784C
007850

007858

00786C
00783C

00787C
007868

00788A
007848

007878

007880

00789A
007840

00789E
00788E
00783E

007866

0078A2
007884
007844
007834

007896
00785E

0078A4
007886
007870
007874

007892
007854

007862

369
Abacus Software Atari ST Internals

c-
•O •o •o
0) 0) cu
co co CO
03 CO CO

ouse scancode table


CD (!) 0)
!H
Q, a ft
ti
-H

co

cursor left
cursor left
>,
4-1 a 4J
o o UH

cursor up
cursor up
tH IH
-H o cu -H 4J -H
fl •c -H A
co !H 0 CO CO
ra -H
f\ a 4-1

atus
atus
,G
0>
O ^
ra -H M -H
t-< CD r>

s
MH O
CO 43 g cu ^_l JH 4-1 X $_|
M -M
en P •o o- o O CO SH -H 4J O O W M
4J O c-. rH (U O H G m *4— 1 «H 0 tf_| *W O
ra -x HH 4-1 ra P P a 0!
0) 4J ^x.
4-1 tS CM a r^
> O P
,— ] 4J | t (J_j
*O (!) i-H 4-1 4J IH T3
co G g 0) ra 0) CD -H G G (!) 0) -H G
H P 0) -5P ^1 CO CO f\H<8 co O CO co 45 ra
W T) O 4J (!) o HH ^
O >H >H co
4-1 (!) G 4-> 3 4-1 CO IH ca HH 4J
4-1 CO G -H CO M CO X !H 0 O 4J 4n O 0 4J >H
^
EH o cu a> O O 0) rd 0! (!) P o (U CD 0 G P O G) (!) 0
S CO PS Q Hi EH > >H £3 CJ >H CD S3 ^
0 O 53 >H X U ^ S3

CM o 0
a in Q Q
•*
— o CM
in o
pq
CM O in in
rtj
Q Q fc K Q CO Q CM < CM Q rH
— CM CO CJ ^ -f- &3 CJ CM 03 F— CM f-H Q o \o Q vo <qn CM Q •*-* O VB
Q Q en Q en CM CJ to ^—* P3 CM a CM <O CO 0 O Q Q
k.
o 0 paCM Q
».
Q Q 0
m - en r- en vo CO N r- en (SjJ fQ 01
P.*
•. ^p en A, CO m <*
t-H <J ^31 en CO in
< n P^ to r- 40 £^ tH (^ r^ p«. n -^f CM to r— 0 1 (rf n t— 1 f- m- r- 0 1
(^J co r-
K ^

m =tt= <n- =s= v> =tt= to = « = — « • to * 0 «• Q =tt> to =*> «• =«= in =tt= 41=
* to =*»= -co

£, £ IS rH
rH
43 43 43 43 43 43 43
• 43 • • • er 43 43 43 43
<D
0 C
.
tr
CD
> ra
O >-l
^Q

A,
tr cu
0) "O > rd
•t! O in
ra
(U
0)

0
^
a tr
cu
ra
fi CD io i o
g
O
•o tr i
0
(8 0) ii
o o
§ 73 tr
O C CD
E ra g 43 O rd E 43 g U 43 1 O S ra 43 43 U A ra 43

CJ
CM
<
r~
Q n V£> Q pr] CM pc3 ^p o o H Ul CO 0 CO w fo vo
Q m ra o CO Q n CJ
in 0
< o
o o
O O
O O
Q
O
O o
O
O
•a1
o
Eu
O
o
o
o
o
o
CM
O fe
rH h
O PH
•31
O
o
o
o
o
£
in o o
< o rH
EK o o O h 0
o
rH & <T
0
0
o h
0 fe
0 En.
S 0 0
0 0 0
o a

Q CM o CJ o t-H < Q P4 o en CO CM O < rH CJ o O Q o O O 0 rH O CJ o Q 0 0


CM O o n o O o u> in o Ut o n O CJ O t-H o n CM o o CO 0 0 rH co fO CM o o
^r CM [^ o o CJ vo CM 0 0 in «=p CM t— <HO VO CM ^p O CM r- ^p 0 CJ VO ^p CM O CM r-
rH O VD «-i VD o «5 m CM vo •=p r~ m vo m o vo rH i-H rH O vo i-H vo O VO rH rH rH O vo

CO O O •=p CO O O CM 10 CO CJ CM ^p CO CJ o ^p VO < H CM vo < H


CM vo CO CJ O ^p CO
< < m ffl PQ m O o o o CJ Q a Q Q W {*) W w H t< P4 CM PM
0 o o 0 rH rH rH
CO CO 03 03 co CO CO CO co CO CO CO CO CO CO CO 03 03 03 03 CO CO 03 CO CTl en en en en en en
r~- r*- f^ (-. i— r~ f~- r— [•— r- r- r- r- [— C— !— r- r~ r- r- r- [— r^ r~ r- r— r* r- r- r-
(—
o O 0 0 0 0 0 0 0 0 o o o o O o O o o o o o O 0 0 0 0 0 o o 0
o o 0 0 0 0 0 0 0 0 o o o o o o O o o o o o O 0 o o o o o o o

370
00791C 123CFFFF move . b #$-l,Dl Only one pixels left with shift
Onl;
007920 600000E4 bra $7A06
007924 OC01004D cmp.b #$4D,D1 Cursor right ?
Cur g
007928 661C bne $7946 No co
00792A 123C0008 move . b #8,D1 X ooffset for cursor right I
00792E 143COOOO move . b #0,D2 Y ooffset for cursor right
007932 102DOA5D move . b $A5D(A5),DO , Shift
Shi status
007936 02000003 and.b #3, DO Left
Lef and/or right shift key pressed?
00793A 670000CA beq $7A06 No
NO
00793E 123C0001 move . b #1,D1 Only one pixel right with shift
Onl;
007942 600000C2 bra $7A06
007946 OC010050 cmp.b #$50, Dl Cursor
Cur down ?
00794A 661C bne $7968 No
00794C 123COOOO move . b #0,D1 X ooffset for cursor down
007950 143C0008 move . b #8,D2 Y ooffset for cursor down
007954 102DOA5D move . b $A5D(A5),DO Shift status
Shi
007958 02000003 and.b #3, DO Left
Lef- and/or right shift key pressed?
00795C 670000A8 beq $7A06 No
007960 143C0001 move . b #1,D2 Only
Onl one pixel down with shift
007964 600000AO bra $7A06
007968 OC010002 cmp.b #2,D1 '!'
00796C 650C bcs $797A Not greater or equal
00796E OCOIOOOD cmp.b #$D,D1 '='
007972 6206 bhi $797A Not less or equal
007974 06010076 add.b #$76, Dl
007978 600C bra $7986
00797A OC000041 cmp.b #$41, DO 'A'
00797E 650A bcs $798A
007980 OC00005A cmp.b #$5A,DO 'Z'
007984 6204 bhi $798A
007986 7000 moveq . 1#0,DO B
bra $7998
007988 600E
E-
Abacus Software Atari ST Internals

ter back to buffer start

MIDI interrupt handler


4-1
fH
id
4J
«

er reached ?
er reached ?
r~ O
LO 1 4-1
rH 0 i-<
tu X
co tn MH O
-p 0-- MH id t^-
ointer
CO -r-t ,-H X! rH
4-> ft rH rH j^ <V rH rH
-H -H 3 <a X G r-l -H P
.« 0 <d MH 01 c 0) -H fl) (0 M-l
4J 4-1 0) -H •o 4-1 4-1 4-1
o p. M-I c !-i H G 3 MH C M
4-1 0) X M-l -H •H CD •a ia -rH o O X M-l •H rH 0)
T3 0 0) P o <d MH T! 4-1 4-1 r4 0) 4-1 3 o <a M-I
0) O <u -a a a 3 M-l id <d i-l 0) •a C ,Q O, 3 M-l
73 0 n G tr 3 •0 -H 4-1 M <u -H C U) tr 3
O O -rH CM 4H 01 ,Q M M 10 >, 0) 4-1 •a -H E MH 1-1 <U X5
O M -r-l O CD <D 0) 4-1 .Q 4-1 3 -H 0) O 0)
C M rH tn MH TJ - 1-1 4-1 -H C O £ rH H M-l T3 ^
ra u 4-1 -H 3 T! MH fd en in -H s •a -H0 (11 tn -H 0 73 M-I <a «
o en CD >d •H G O 3 0) 0) 3 SH 0) -H x >i id G C O 3 0) <U
en < C5 EH 0, H S3 CQ W >H CQ S S3 E CH w 0! H M W S3 CQ K »

********

********
5s
CM
rH
Q
o 1—1 rH rH CM rH rH rH
o o Q Q a CM o in Q Q Q
Q Q ft.

,_, •^— ~— •— ^i
-_s

^ CO ^ CO ViO t—1 o -t- ^-, rH CJ rH ^_^ PT") •1C ^-^ iH ,—) ^_^
IS
w
^-^

1-t cn <£ cn
CO Q Q O Q O Q 0 CQ 0 O CO * Ctl .— . O Q 0 Q Q 0
vo cn r- cn cn ^ .. r~ f£ *. f£ cn rf^ cn rtj *.
^ *
•X o CM *
•JC |C£ <J cn r3S cn
t/> r- m (— [^
•fc

CO !-H r32
^^ CM •w^ r^ 0 «•— r- ~-* O rH •JC rH »-- r^ 0 *-* f^
*—
=8= =»= v> u> Q ~—
CO =tt= ^r </> =«= vo o Q Q r^
</> *--
^ * CO =&= *T vt =«= VD vt
•*
Je •*
1C
rH rH
,-H
3 J5 rH u 3 * rH
•1C
u 3
& ^Q 3

3 > • tr 3 • *
-JC *
-X • 3 tr 3
• CD CD tr ^• ffl cv to CD •X 01 tr 0)
a M
O
a -H m
r-l
rH
CO
TJ
•o
*

0 O
•a
•o
P. CO
0 O i tr
CD 0 0 O
CO
4-1
*
•JC

•JC
0)

I
•X
0 e 0 o E* 0)
tr
o 43 O J3 Q id id E E <d 0 .a s o E E r-l •Je E -n •X E o E O
*
•X
•X
*
*
•Je Jfi
•JC •X
«
* *
•*
JC *
*
•X
* •X
* •1C
*
* *
*
Jfi •*X
t-H <c CO *T vo o o CO •Je a •X CO "C1 vo
VO r- o o o o o o o -X o 0 o
0 o o 0 0 o 0 0 * (^ •X o o o
o o o o 0 o rH 0 *
•JC 0 •X o o o
o CO o CM W rH rH PM CO rH CO CM o CO CJ CO O rH in •Je Q CM CO rH CO CM o CO o
o o o 0 w ^
"C1 in CM ^P ^0 O o V0 o va CO sr r- -JC Q *
•X CM 10 O o VD O
(J m u CM O rH O o CM •^P CM in CM CM r— •=p Lf} rH ^r •X CM CM m CM CM r-
CM
o vs o <£> V0 f£| Q CM m m cq C— cq «J CM n O *3> * CM •a1 •X n m cq vo CQ vo
*
<; w o ^p <*Q CO f£ u w CM •31 O CO f£ 0 CM \r) rf W * O •>p * VD rSl r_) o CM ^p CO
CO CO cn cn cn cn cn cn en f^ <C cq cq CQ CQ
CQ * o O *
•X u u fj a Q Q Q
cn cn cn cn en en cn cn cn cn cn c^
n en cn cn cn cn cn o\— *
•JC en cn •X cn C3> cn cn cn cn en
r- r- r- r- r~ r- r~ r^ r~ r~ r- r^ t— [— r- r^ r- -JC r- r~ r^ [— [— p^ r^ r^
o o o o o o o 0 o o 0 t0 — 0 o o o o o o o o *
•X o 0 0 t0 —
o o o
o o o 0 o o o o o o 0 o o 0 0 0 0 0 0 * o 0 •X o O o o 0 o o
*

372
0079DA 24680000 rnove.l 0(AO),A2 Buffer address
0079DE 15801000 move.b DO,0(A2,Dl.w) Write received byte in buffer n
move.w D1,8(AO) New tail index S
i
0079E2 31410008
0079E6 4E75 rts
**************************************************** keymausl
0079E8 7605 moveq.l #5,D3 Accept right button
007 9EA 08010004 btst #4, Dl
0079EE 6702 beq $79F2 is right button ($47/$C7)
0079FO 7606 moveq.l 16, D3 left button
0079F2 08010007 btst #7,D1 Pressed or released ?
0079F6 6706 beq $79FE Pressed
0079F8 07ADOA5D bclr D3,$A5D(A5) Clear bit for key
0079FC 6004 bra $7A02
007 9FE 07EDOA5D bset D3,$A5D(A5) Set bit for key
007A02 7200 moveq . 1#0,D1
-J 007A04 7400 moveq . 1#0,D2
*************************************************** keymaus
007A06 41EDOA5A lea $A5A(A5),AO Pointer to mouse-emulator buffer
007AOA 246DOA1E move . 1 $A1E(A5),A2 Mouse interrupt vector
007AOE 4280 clr.l DO
007A10 102DOA5D move . b $A5D(A5) ,DO Get status of the "mouse" buttons
007A14 EA08 Isr.b #5, DO Bit for right button to bit 0
007A16 060000F8 add.b #$F8,DO Plus relative mouse header
007A1A 11400000 move . b DO,0(AO) Byte in buffer
007A1E 11410001 move . b D1,1(AO) Store X value I
007A22 11420002 move . b D2,2(AO) Store Y value
007A26 4E92 jsr (A2) Call mouse interrupt routine
007A28 205F move . 1 (A7)+,AO Restore iorec for keyboard
007A2A 4E75 rts
M
ST
*************************************************** muskeyl
B9
n
007A2C 47C7 dc.b $47,$C7,$52,$D2 Scan code mouse substitute
y>
giaccess, read/write sound chip cn
007A30
007A38
007A3A

302F0004
40E7
007C0700

move . w 4 (A7) ,DO


move . w SR, -(A7)
or .w #$700, SR

Data
Save status
IPL 7, disable interrupts
I
o
•1
n
007A3E 48E76080 movem . 1D1-D2/AO, -(A7) Save registers
007A42 41F9FFFF8800 lea $FFFF8800 ,AO Address of the sound chip
007A48 1401 move . b D1,D2 Get register number
007A4A 0201000F and.b #15, Dl Registers 0-15
007A4E 1081 move . b Dl, (AO) Select register
007A50 E302 asl.b #1,D2 Test read/write bit
007A52 6404 bcc $7A58 Read
007A54 11400002 move . b DO,2(AO) Write data byte in sound chip register
007A58 7000 moveq . 1#0,DO
007A5A 1010 move . b (AO) ,DO Read byte from sound chip register
007A5C 4CDF0106 movem . 1 (A7)+,D1-D2/AO Restore registers
007A60 46DF move . w (A7)+,SR Restore status
007A62 4E75 rts
*************************************************** rts off, disable RTS
007A64 7408 moveq.l #8,D2
007A66 6012 bra $7A7A Set bit in port A
*************************************************** rts on, enable RTS
007A68 74F7 moveq.l #$F7,D2 I
007A6A 6034 bra $7AAO
****************************************************

Clear bit in port A


i
dtr off, disable DTK
n
007A6C 7410 moveq.l #16,02
a
007A6E 600A bra $7A7A Set bit in port A »
ff
**************************************************** 65
dtroff, enable DTK n
007A70 74EF moveq.l #-17,D2
007A72 602C bra $7AAO Clear bit in port A
**************************************************** ongibit, set bit in sound chip port A ta
007A74 7400 moveq . 1#0,D2
007A76 342F0004 move . w 4(A7),D2 Get bit pattern
007A7A 48E7EOOO movem . 1DO-D2,-(A7) Save registers
007A7E 40E7 move.w SR, -(A7) Save status
007A80 007C0700 or .w #$700, SR IPL 7, disable interrupts
007A84 720E moveq . 1#14, Dl Port A
007A86 2F02 move . 1 D2,-(A7) Save bit number
007A88 61AE bsr $7A38 Select port A
007A8A 241F move . 1 (A7)+,D2 Bit number back
007A8C 8002 or .b D2,DO Set bit(s)
-J 007A8E 728E moveq . 1#$8E,D1 Write to port A
01 007A90 61A6 bsr $7A38 Write new value
007A92 46DF move . w (A7)+,SR Restore status
007A94 4CDF0007 movem. 1 (A7)+,DO-D2 Restore registers
007A98 4E75 rts
*********************** *********** -ki offgibit, clear bit in sound chip port A
007A9A 7400 moveq . 1#0,D2
007A9C 342F0004 move . w 4(A7),D2 Get bit pattern
007AAO 48E7EOOO movem . 1DO-D2,-(A7) Save registers
007AA4 40E7 move . w SR, -(A7) Save status I
007AA6
007AAA
007AAC

007C0700
720E
2F02

or .w #$700, SR
moveq . 1#14,01
move . 1 D2,-(A7)

IPL 7, disable interrupts


Port A
Save bit pattern
i
007AAE 6188 bsr $7A38 Select port A
B
007ABO 241F move . 1 (A7)+,D2 Restore bit pattern Si
007AB2 C002 and.b D2,DO Clear bit(s)
007AB4 728E moveq.l #$8E,D1 Write to port A
007AB6 6180 bsr $7A38 Write new value
007AB8 46DF move . w (A7)+,SR Restore status
007ABA 4CDF0007 movem . 1 (A7)+,DO-D2 Restore registers
007ABE 4E75 rts
***************************************************** initmouse
007ACO 4A6F0004 tst.w 4(A7) Disable mouse ?
007AC4 6726 beq $7AEC Yes disable mouse
007AC6 2B6FOOOAOA1E move , 1 10(A7),$A1E(A5) Mouse interrupt vector
007ACC 266F0006 move . 1 6(A7),A3 Address of the parameter block
007ADO OC6F00010004 cmp.w #1,4(A7) Relative mouse ?
007AD6 6724 beq $7 AFC Yes
007AD8 OC6F00020004 cmp.w #2,4(A7) Absolute mouse ?
007ADE 6736 beq $7B16 Yes
OJ
007AEO OC6F00040004 cmp.w #<3,4(A7) Keycode mouse ?
007AE6 6770 beq $7B58 Yes
007AE8 7000 moveq . 1#0,DO Error, invalid
007AEA 4E75 rts
*************************************************** Disable mouse
007AEC 7212 moveq.l #$12,Dl Disable mouse command
007AEE 6100F1EO bsr $6CDO Send to IKBD
007AF2 2B7C00007BCOOA1E move.l #$7BCO,$A1E(A5) Mouse interrupt vector to RTS
007AFA 6070 bra $7B6C
I
*************************************************** Relative mouse
007AFC 45EDOA6A lea $A6A(A5),A2 Transfer buffer pointer
007BOO 14FC0008 move.b #$8, (A2) + Relative mouse
I
007B04 14FCOOOB move.b #$B,(A2)+ Relative mouse threshold x,
007B08 6166 bsr $7B70 Set mouse parameters
007BOA 7606 moveq.1 #6,D3 Length of the strings - 1
M
007BOC
007B10
45EDOA6A
6100F1DE
lea
bsr
$A6A(A5),A2
$6CFO
Transfer buffer pointer
Send string to IKBD sn
007B14 6056
007B16 45EDOA6A

bra
lea

$7B6C
**************************************
$A6A(A5),A2
Absolute mouse
Transfer buffer pointer
Absolute mouse

!
3
007B1A 14FC0009 move . b #9, (A2)+
007B1E 14EB0004 move . b 4 (A3), (A2)+ xmax rnsb
007B22 14EB0005 move . b 5 (A3), (A2)+ xmax Isb
007B26 14EB0006 move . b 6 (A3), (A2) + ymax msb
007B2A 14EB0007 move . b 7 (A3), (A2)+ ymax Isb
007B2E 14FCOOOC move . b #$C, (A2)+ Absolute mouse scale
007B32 613C bsr $7B70 Set mouse parameters
007B34 14FCOOOE move . b #$E, (A2)+ Initial absolute mouse position
007B38 14FCOOOO move.b #0, (A2)+ Fill byte
007B3C 14EB0008 move . b 8 (A3), (A2)+ Start position x msb
007B40 14EB0009 move . b 9(A3), (A2)+ Start position x Isb
007B44 14EBOOOA move . b 10 (A3), (A2)+ Start position y msb
007B48 14EBOOOB move . b 11 (A3), (A2)+ Start position y Isb
007B4C 7610 moveq , 1 #16, D3 String length -1
007B4E 45EDOA6A lea $A6A(A5),A2 Transfer buffer pointer
007B52 6100F19C bsr $6CFO Send string to IKBD
007B56 6014 bra $7B6C
007B58 45EDOA6A lea $A6A(A5),A2 Transfer buffer pointer
007B5C 14FCOOOA move . b #$A, (A2) + Mouse keycode mode
007B60 610E bsr $7B70 Set mouse parameters I
007B62 7605
007B64 45EDOA6A
moveq . 1#5,D3
lea $A6A(A5),A2
Length of the string -1
Transfer buffer pointer i
007B68 6100F186 bsr $6CFO Send string to IKBD
Flag for OK
n
007B6C 70FF moveq . 1#-l,DO a
007B6E 4E75 rts M
sr
************************************************** setmouse, set mouse parameters
B9
007B70 14EB0002 move.b 2(A3),(A2)+ x threshold, scale, delta £
007B74 14EB0003
007B78 7210
007B7A 922BOOOO
007B7E 14C1
007B80 14FC0007
007B84 14EB0001

move.b
sub.b
move.b
move.b
move.b

3(A3),(A2)+
moveq.l #16,01
0(A3),D1
Dl,(A2) +
#7,(A2)+
1(A3),(A2)+

y threshold, scale, delta


Top/bottom ?
f
w
007B88 4E75 rts
************************************************** xbtimer, initialize timer
007B8A 7000 moveq . 1#0,DO
007B8C 7200 moveq . 1#0,D1
007B8E 7400 moveq . 1#0,D2
007B90 302F0004 move . w 4(A7),DO Timer number (0-3 => A - D)
w 007B94 322F0006 move . w 6(A7),D1 Value for control register
£J 007B98 342F0008 move . w 8(A7),D2 Value for data register
007B9C 6100F4F2 bsr $7090 Set timer values
007BAO 4AAFOOOA tst.l 10 (A7) Interrupt vector
007BA4 6B1A bmi $7BCO Not used ?
007BA6 246FOOOA move . 1 10(A7),A2 Interrupt vector
007BAA 7200 moveq . 1#0,D1
007BAC 43F900007BC2 lea $7BC2,A1 Table for determining interrupt number
007BB2 0280000000FF and.l #$FF,DO
007BB8 10310000 move . b 0(Al,DO.w) ,DO Get interrupt number
007BBC 6100F588 bsr $7146 initint, set MFP interrupt
007BCO 4E75 rts
************************************************* Interrupt numbers of the MFP timers
007BC2 OD080504 dc.b 13,8,5,4
Abacus Software Atari ST Internals

et/get printer configuration


set standard keyboard table
0)
at

f the standard table


rs
set keyboard table

id
<u 4->

er configuration

er configuration
rH cu rH

C1' •a CD
o 4-1 id
d>
4-1
rH S KH
•o

start sound
rH 4-1 O

don't set
43 4-4 CO 4-1
id w -H 4-1 EM CO 3 CU
4-1 rH ft CO O CO CU
cu CO

status
O rH

S
CO
U cu 4-1 cu 43
SH
•o
C
fd
tH
-H
CU O
45
P

HH
CO
(U
4-1 id
o
0)
rH
43
Id CU 4->
4J rH
rH
43
id
cu
4J

HH
O
TS
1
4-1 TS
id
4J

K 4-) o O f£ 0 4J i^ 43 X •a 0 H.
TJ 3 CO 4-1 cu -. JJ
CO CO CO U CO TS id O a <u c; 0 3 cu c
C CO CO >! H 4-1 O •o 3 co 3 m K -H H > -H
rd CU CO Q) CO <U CO CU CU id 1-4 q O CO •H O p M id -H M
M CU O1 en fl) p X •O 4J 3 CO <s ^j CO 4-> M a £> -P Q<
j_l C M C M q M c CO q IH CO o ^)
Kj H a (Q
>, •ts id TS -H o id -H PM CO [) •a O^ S id 4-1 4-1 3 O^ 4-J
CU c*t o TS o T) <-; o *?3 O -H 4-1 43 < 0 CU •o cu cu 4-1 <U <u CU cu cu
M CJ & < O < O eu 43 CO CQ O •o O z CO CO cs "Z 73 CO

<

•it
^^^
^_^
m •n in in m * ^B^,

in m < •n
£ £ S: * * m
* < <: •*it •*K (^
*
•It vo * W CM VO O ^, •it 0 •*^
E4 CM vo * m vo vo * Q m a o
* m vo fQ * <; rs, < * *. < * K CO
* < < {O* o •n </>«•«>
* *
•it ^^ rH ^^ •it
* ^^
rtj
•it
* <O CO ^ Q V ^ *. lO Q vo in m to
^_^
^^ * CM CM CM * CO < •it
* < ^
* f~^ CM ,-^ .^ W ^-^ r— fQ t— fV) •*it VO pc] VO * •^— ^^ &3 < o *~* —
•*
X r- Q r- r- Q r—
(Q pq < rf* pq < •^
w rfj m •it Q Q a * vo [-. rH <o < •It
* U n f-* r-
»-- pq "•^ ft. vo vo vo * CO rtj CJ ^ CO CO CJ (3J <
* •*— c— *— r- CM r- CM to- •*it *n- <t> v> * ^C ~~* rH < * < t— Vrf
~
* *3* <o •a1 CO <o CO rH to 3£ * =»= =s= * •c/> •a> •CO Q to * «• •a' to "a1
* * * •it
*
•*it •*n * •it
rH rH ,-H ,—j •It H rH rH * <H rH H S
*
•it rH rH . rH • . •it
* • . 43 •it
* |5 ^•
io

<u CU cu * 0) 0) CU •n CU CU
•it
•It CO
-H
e 0 CO
-H
g 0 CO
-H
e
>
0 o
CO
4J
*
*
•it
>
O
> >
0 0
CO
4J *
§0 0
-rl
g 0 rH 4-1
CO *
•it
*
P -H
CO g
>
0
•it p g 4-1 E 4-1 43 s M e s s M * H 43 g O M •it s 4_J 43 g
* •*it
*
•s •it
* *
•It *•it •It
*
•*It •it
* •it
*
* * pt} CM VO •it *
•H
* •*it m vo vo •it
•It
* ^ ^ ^-C *
* O 0 0 * *
* w CM VD w *•it CM CM CM •it
* •it
* CJ
•*it m VO VO m VO £3 VO •it CO
•it
o
<
o

o
*
•n vo vo vo
Q Q M * •H rt
O * *
.£ 0
•*It •a1 "3* 03 CO O o o •it o o o •it vo •a1 vo •*It CJ •a1
•It o o O O o o o •it o o o •it CO o CO ^
CO •ft CO 0 0
•it o o O O o 0 o 0 0 0 •it o •K o o
o o o o o o o •It O 0 0
* 0 0 o 0 0
^ o o
* &4 vo Eu fc, vo En EM vo fv, o in •it O O CJ m Q CO 1-1 Q in * Q VO [V|
* 0 vo o vo <^* o vo n P*. r*~ r- r-- r—
*
•it

•it CM CM 0 ^4 CM r- •it
* CM vo O VD
•It f^
* f, pq cq *^
=3I pq PQ
*3" vo CM •a* vo CM
eg pq o
"a1 vo CM CM
E"3
<cp
* pq eg pq E^
*
•n CM CM CM ^T
0 CM CQ
vo
PQ CM •it 0 pq pq
^ *
•it CM CM CM •a- •a> CO ^1
^ vo o
*
•it •it •H
*
VO O CM vo CO H CM IQ1 fQ 0 ^t CM (=C CM KS *
•it O O ^r VO < W •H o Q1 co <C
*•It 0 ^ O O Q Q Q p,q
Q W fy*j f^j pr, O Q O i-H rH rH rH rH •H CM CM CM CM
•it PQ pq CQ CQ PQ eg
pq pq PQ •it
* pq eg o o *
•it 0 O O 0 CJ CJ CJ O O CJ
r- c- r- r- r- r- r- r- r- r-
[-X •it r- r- r- r- t- r- t~- p- r- r- * r- r- r- r-
•*» o 0 o o o o o o o o o •it O 0 0 O * o o 0 o o o •*It o o o o
•It 0 o o 0 0 o o o o o 0 O O 0 0 *
•it 0 0 o 0 0 0 •it o o 0 O
*

379
007C30 4E75 rts
63
*************************************************** kbrate, set/get keyboard repeat
s
en
007C32 302DOA7E rnove.w $A7E(A5),DO Delay before key repeat C/3
007C36 4A6F0004 tst.w 4(A7) Test new value
007C3A 6B16 bmi $7C52 Negative, don't set
007C3C 322F0004 move.w 4(A7),D1
007C40 1B410A7E move.b D1,$A7E(A5) Set new value
007C44 4A6F0006 tst.w 6(A7) Repeat rate
007C48 6B08 bmi $7C52 Negative, don't set
007C4A 322F0006 move.w 6(A7),D1
007C4E 1B410A7F move.b D1,$A7F(A5) Set new value
007C52 4E75 rts
**************************************************** ikbdvecs, pointers to IKBD H- MIDI vectors
007C54 203COOOOOAOE move.1 t$AOE,DO Address of the vector table
007C5A 4E75 rts
********************** ****************************** timercint, timer C interrupt
007C5C 52B9000004BA addq.l #1,$4BA Increment 200 Hz counter
007C62 E7F900000A84 rol.w $A84 Rotate divisor bit
007C68 6A4E bpl $7CB8 Not fourth interrupt, then done
007C6A 48E7FFFE movem.l DO-D7/AO-A6,-(A7) Save registers
007C6E 4BF900000000 lea $0,A5 Clear A5
007C74 614C bsr $7CC2 Process sound
007C76 082D00010484 btst #1,$484(A5) Key repeat enabled ?
007C7C 672A beq $7CA8 No I
007C7E 4A2DOA7B tst.b $A7B(A5) Key pressed ? en
007C82 6724 beq $7CA8 No H
007C84
007C88
007C8A

4A2DOA7C
6706
532DOA7C

tst.b
beq
subq.b

$A7C(A5)
$7C90
#1,$A7C(A5)

Counter for start delay


Not active
Decrement counter
i
6S
5T
Abacus Software Atari ST Internals

Decrement counter for repeat delay

Bit 7 set, then special command


sndirq, sound interrupt routine

Select register in sound chip


Key code in keyboard b u f f e r
Pointer to iorec keyboard 0)

Correct stack pointer


3

Else decrement timer


20 millseconds per call
C"

Data for register 7


•a

No sound active ?
rAll Clear interrupt service bit

Restore registers
Restore registers

Get sound command


Get event timer vector T! a> cu
Execute routine
3 4J
Reload counter

3 ^H VI (D
10 <0

Pointer to AO
0 3
Not run out ?

> 4J .H
a

Register 7?
10
Not run out

0 VI
0) -a
S G
-H 3 S<0
Key to repeat

(U .p 0
to in
G TS CO
-rl (0 Se •a G
o

No
O CO G O
CM n3 S3 < Q
-D7/AO-A6
, $A7D(A5)

******
, -(A7)
,-(A7)

3800
o
, DO

0
,AO

,AO
\5)

_
Q Q
*••*« .j "" 2i .
E
Q DEJ
Q 10 m 10 10 10 Q &j * in in Q Q
P- CO
tH o O pM O
****************************j

CO +
CO F^
i^C tn cQ CM cr* os] o ,—» t£ *—. -to- ^
Q vo m (Z. rtS Q Q «• in Q 0 ^
o * C j r ^ r - i J M r - ^ p o o «» r- -. CO Q - CO CJ
p- o (Q P-
-a 0 Q ^ •* G 0
r- o r~~ r^ c33
r- rH r - r f ! ^ c ^ r ^ t ^ ^ r r f £ < M f 3 S i o 0 O p-
v> =>t= </> -o> </> •£/> -u>- -c/> -o> *—' =&= ••— =&= Q </> Vt Q * Q <0 «> Q
rH
*. * *1 *1 0) 0)
*
dj d)
43
£U QJ CO CD
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 ^-*
O1 CD Vt
1
(U
tr > > cr >
0 (U 0 0 0) 3 O
43 g E 43 a
m
M 0
-H >
e o S C O
43 e o 43 e
C^ CD >

fa
Q fa 0
r- fc, o
P5J fa CO
0 fa CO
Q fafflCMCJCMO fain O vo CO fa r-
r- CO CO
0
CO
o
CO CO fa
fa o
0
o o o o f a o o r^o * o 0 o 0 0 fa o
CO Q C M Q Q Q O Q Q O f a f a C n n * p- Q 0 0 Q co o o vo CO w o 0 < CO
rH <M (-)VQCM(JiIOCMVOCrs^'QP3P-
VQ m VQ rn o i—i t—i fa c> p3 ^^ cj co M
* M CM O «=P CM O o ^31 p* t_l CM O O rH t-H
*
* CO O P- 0 O p- o n o o ra o OO VQ CM
VQ in V Q < - H i - H ' C 1 V Q f ^ C M ^ 1 i n ' = S ' O < 3 1 in •H VO f—1
* •5T CM VQ CM rH VO VQ rH
W o ^rVOOo^rcoOocM'3'COO * CM VQ ff pq O ^* VQ CO O w O CM co o ea
CO O\ cCJ
nc^cnsCsC'^C'^ICPCQCQfflO * CJ O 0 CJ Q Q Q Q Q Q M CT1 M M M
O C J C J C J C J C J C J C J C J C J C J O * O O O CJ O CJ CJ O CJ CJ CJ O O CJ O
p- p- r ^ r ^ p - r ~ c ^ p - p - p - p - p - p - p - * p- P- p- p- P- P- P- P- 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 o o
O 0 o o o o o o o o o o o o * 0 o O 0 O 0 o o o 0 o o o o o

381
Abacus Software Atari ST Internals

pointer back to same commam d


byte in sound chip register
PH 0)
-H 4J
& 01
O -H
&
T> 0)
VI

O P. VI
01 -H
1
c O -H
O
-H 4-1
•s

alue reached ?
ncrement-value
>i C >1 0)

sound command
sound command
m ^H 0) 3 10 N

re registers
ound command

4-1 r- c- 4-1 O rH

I r— O 01 0) o
I 0) fa 0 c- IM •o 4J
o vo M fa CO 0) C
-H </> «• rH 01 4-1 -H 0)
01 01 T) O co E 01 (0 01
4-1 4-1 •o -o «> -H -H 0! 4-1
-H
X) 0)
X
-H
XI
<U
4-1
>
G
(0
G
10 01
4J
S1
Vl 3 (0
3
0! .-!
0)
3
rH
-H
O 0)
0) -.H 01 10 X) •o
A ^a) H <a
4-1 0 0 X! C 01 4-1 10
(0 <d ra 0) ta O) 0 0 (0 O -H > 0) > •a •a 01 o
.H
O
01
•o H
0
W
•a
K
s * 3VI S
Vl 0) 01
01
cfl
01
0)
01
*0 O
£ S0) E
0
0)
o? rH
01 0! S
•o
4-1
-M
R VI
•a <n c
C 0) o
ti
0)
c
3
0
•o
c
4-1

0)
01

o 3: K s 3 s ^ s s to P3 W < S W >H w K W «
M K H CJ >H
**
CM
0
CO
CM -_s O CO
O O fa ^^ O
CO m CO fa m <
O CM CO CO fa < •^v
Q O fa •—- fa ^-^ fa 0 *-* ^— . rH
CO fa CQ fa m </> Q < lO Q
O CO fa CO fa < K CO rij 1
O fa fa *3H fa 0 O ^-^ ^^ < *-* O
T-H CO O fa vt o </> o </> Q pa Q in in
«. fS^ ril
«• VO Q
Q CO Q fa N Q ik. Q ^
i^ CO K CO i^
fa o W -t- W
fa 0 VO ^ 0 -{- H K. VO H- H- ri^ + •*— — o o o + o 0 rf| +
fa fa O Q «/> Q ^^ Q Q -3- <-H CM
—K
Q CM -a- ^-^ ^^ </> ,—. pa
P3 m rt m --* in f^ •o> *-*
CO fa CJ K CJ o O ^ Q CO Q O O CO Q o 0 ^. 0 CO co a ^ Q 0 Q h. fc. r~
</!•

*
fa rH O [—
=t?= Q Q </> ^^-" «>
rH r- u> r~
3t> <fr 3t= V> ^
"^^ vt
Wt r~
* w
ff
(^
*~"' *^ Q
0 ft.
</>
^ «• «•
i^c r^~ *3*
* «•
P* ^C r~~ o o
— «> *
< *^•*
<-\
_Q _£,
Xi Xi Xi Xi X! X!

s XJ

s• ._,•
X! > Q ^• X) X! X!
i
*

•a > -d
c o c
X!

t-t
(U
^
o ^
(d ?
o ^1
10
if
•O rH Q, 01 §
T! ft, S G 0
(0
VI
a a> >
S G o
0!

O
•a
•o o o S 0)
tr
> pH {y1 Xi <0
QJ
^
0 flJ
C
>
o o
01
>
O
E <a O £ X? S Xi s X) O Xi S E 10 E E 0 X) 01 X) E Xi s £ £

CM
O
CO
CO
FFFF8800

FFFF8802

fa
FFFF8802

0
o fa
CO fa
CO fa
o CM fa pa pa pa ^ o vo co
003F

PQ
CJ CO CO CO fa CO CO CO CO O CO O
o o O fa <C *C r£ <J O fS, rH
o o o O fa O O O O O 0 0
rH d O t-H o vo CO W o CM o vo co w O O C O C O Q C O Q Q E i ] C O < C O s p O CO fa
O CO O O CJ Q Q CJ o CO o o in pa ocMQi-HCMt-HWCMO^poinor- •531 Q
CM O CM O CO 0 CO 0 CM 0 vo pa o OvoroorHOcoor-CTiopavoo m cj
O rH O CO !-H VO 1-1 vo m vo 0 vo 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 ^ o vo CO W< H o CM IT CO < w O ^ P V O C J W C M ' = P C J O C M ' = P V a < C J O *P


fa fao o o o fa fa f—i rH t_4 f—1 r~\—1 CM CM CM CM CM fO CO CO ^* ^P ^ *3* *3* "-3* in in
U U CJ U Q D Q Q Q Q Q Q Q Q 0 0 0 0 0 . 0 . 0 . 0 . 0 . 0 0 0 0 0 Q Q
r- r- r~ r~ r- r- t—t— r- r~ t— r - i — r - r - t - r ~ r ~ r - r - r - r - r - r - r- r-
o o o o o o o o 0 0 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 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
007D58 4E75 rts
***************************************************** bellsnd, tone after CTRL G
007D5A 0034 dc.b 0,$34
007D5C 0100 dc.b 1,0
007D5E 0200 dc.b 2,0
007D60 0300 dc.b 3,0
007D62 0400 dc.b 4,0
007D64 0500 dc.b 5,0
007D66 0600 dc.b 6,0
007D68 07FE dc.b 7,$FE Envelope channel A
007D6A 0810 dc.b 8, $10
007D6C 0900 dc.b 9,0
007D6E OAOO dc.b 10,0
007D70 OBOO dc.b 11,0
007D72 OC10 dc.b 12, $10
00 007D74 OD09 dc.b 13,9
007D76 FFOO dc.b $FF,0
***************************************************** keyclk, key click
007D78 003B dc.b 0,$3B
007D7A 0100 dc.b 1,0
007D7C 0200 dc.b 2,0
007D7E 0300 dc.b 3,0
007D80 0400 dc.b 4,0
007D82 0500 dc.b 5,0
007D84 0600 dc.b 6,0
007D86 07FE dc.b 7,$FE
007D88 0810 dc.b 8, $10 Envelope channel A
007D8A OD03 dc.b 13,3 Envelope single attack
007D8C OB80 dc.b 11, $80
007D8E OC01 dc.b 12,1
5?
Abacus Software Atari ST Internals

Address of the working memory

Put parameters in working memory


CO
id

0)
0
8 ( A 6 ) , A 5 Address if the parameter block

1
Save registers

rH 4-1

Default mask
a
(U
0
4-1
CO
U a

1= Centronics
> 4J TJ CO CO -r) CM O
sx CO 0) CO <a c
o CO £ 4J rH 4-1 o CM (U 4-1 CU
o CO 3 CO M-l A N
•o •a
£ a o
H a A c
-H
30 bytes

n 4-1 CO 4-1 -r) 4J


rd (U 0 o (U M (U II S-l CU 0
P3 53 (X a a CO sx CJ 0 PH

-K
D5-D7/A4-A5,-(A7)

*
*
*
*
(A5)+, ( A 4 ) +

*
-K
#$16D4C,DO

*
#$2600, A4

* 0 CO H
* Q
* vo vo 0 to
#30,07

o t— co U a 0 CM CO <
$7DAC

* 0 O CM CM CO CO

eq.l #1,DO
* =!*= Q < CJ o Q rH w to O n
*. Q Q a Q rH VO Q
r- O r-
Q
O
vo w
r~
* VQ CM CM O rH 1 CO CM CM
* rt =S= Q to Q Q to Q to
*
em.l

rH
eq.l

X)
e.b

* rH
e.l

e.l
e.l

* *• » rH cf S
XI * CT • 0) CD CD aj
* c > > > > m > XJ 4J 4J .p (T <u j> J> si CO p> fB 4-1 cr M (d P> P> 4-1 CU
O * -H o o o O H O 3 M & CO (U O ^i o O rH 0 SH CO cu rH H 0 o CO c
•o * rH £ E ft £ CO 4J X) 4-1 £ X! £ O X) E X) 4-1 X? u X) E s 4-> X!

-X
*
-K

* CO
* rH
-K
* VO
-X CM
o rtj ie£ CJ <J O CO w CO
*
-}e 0 rH rH rH O rH O
vo VO VO Q VO 0 VO irj vo
* CM CM CM vo CM O CM CM CM
-Je
* O o CO 0 O 0 rH 0 rH vo O O O
O o o O o O O O O 0 0 O
* 0 r~ o O o o O O O % o o O
* o o o 0 0 o o O o o o o O
o * VQ r- w CJ W sp Q r- r- co en CO en vo CJ O en vo o
[y. en ^P O CM rH o en CM
o * LO W VQ rH 0 Q •a1 "sp fa m o CO 0 O r~ 0 o
[V, r- o ^P O O o j— sp
Pn •)c
* Ed CO <J CO fV] o CO C"O (^ PS] rtj r- o o o CJ CO o o r£ r- CM O o f^ VQ
En ^r **r CM CM f^ VQ rH 10 T VQ •31 vo CM vo CM CM O vo f— vo T vo ^T VO [^ rH «=p VO
*
O * CM vo f^C W ^P VO CO < CJ W O VQ CO H 0 VO O ^r vo CO O CM «< VO 00 0 VO
en * en en en en rfS **C c£ rf^ rti ril pq CD ffl U CJ Q a Q o Q W [y] p£j w w
^ p-.
Q
r~
* a Q Q Q Q O Q o Q a Q Q Q Q o Q Q Q Q Q Q Q Q Q Q Q Q Q
* r- r- t— r^ r- r- r- r- r- r~ r* r- r- (— r~r- r- r- 1^ F~ t— 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 0 o O o o o O O o o
o * o o O 0 o o o o o o o o 0 o O o o 0 O o o o 0 0 O O o o
*

384
Abacus Software Atari ST Internals

C"
c

•O
(U
CO
CO
0)
O
ft -H
4-1
P
4-1 rH
Ed 0! (3 O
4J CO
4-1 (U
•o M
-H
4-1 4-1 CO rl
ft X 0)
cu 4J
(B O C
o a; 43 t4' ft (U CO ft -H ft
O jjo o
ft
O
Cd 4J

« 43 G O
4-1
CO
4-1
ft SH
£ O
4-1
CO
ft
cn co
4-1

4-1 (U 4J O <a
I tfi t!) 4J £ -P p IM n
3 4-1 0) 3 (U ft 0) M-l
•o ft 4-1
JJ
ft
0
ft
j_) 0) +J S-l O
CP (!)
<a c 4-1
a> G P c p a> 0) 0) rH O co
>-) o o Ho en H Q fa Q ft to w to Ed

o co o vo
(< O o Q O
- Q vo o - vo VO o vo o
CM O « CM CM Q O VO CM CM Q o CM Q O
CM Ed O O to- CM N <! O VI- fa
Ed Ed Ed VO o ^ CPi N Cd rH Cn VO - Q cn Ed rH cn Ed rH cn
(— SP [— CM ^C O O CO rH O r- I CO O CM rH o r— CO r- I oo I CO
t/> Vt t/3- t/5- "*^ Q Q to- =tt= Q «> 4t= -CO- Q -CO- =8= Q to- Q to- =*t= -co- =8= tf>

er tr tr
0) • 0) • CD B1 •
4-1 0) > 4-1 > T) 4-1 tr ^4 > 43 4-1 0) M ft) ft CO > m ft CO
O H
C O C O O X O C O T ) C O S U O rH O 3 CO G rH H O r4 S '—I
4-1 43 g g fl) 43 <d -P 43 g 43 O g co 4-1 43 O 43 I 43 g 43 O 43 g 43
ooioooo;
ooaoooo;
0002606
0002606

Ed 0 0
[V) o o
•31 vo vo
O CM CM
O O <• O o CO CO CO
o cn o CO vo
o
0 o
O
0 P3 o
00
cq
o o 0 o 0
S
0 o
S
0
cn cn cn vo
co cn CM cn o o o o cnO VOfaO
CM r- rO C- rH CO CO 0 CQ ^ CO fa CO
0
^p n r-
0 vo 0 0
^p O "31 0 r^ vo
0
fa 0
o r- o
fa o
fa o
O rtj VO 0 0 CO Pd rH CM P£ r~- o o CM 0 n rt* vo CM 0 O co o o U n o o
VO ^p VO CM rH sp co vo in SP VO ( — VO ^P n m SP vo ^P vo o vo r~ vo O vo r- vo
C O < O C M C O < O P d C M C O < O E d CM SP f£ o CM SP vo < CM SP vo f£ CM SP vo
fafaOOOOOOrHrHrHi-lrH CM CM CM n npr) ft*) n ^31 ^1 iqi ^1 m m in
QQWPdEdEdEdtdEdEdPdPdEd Ed Pd Pd w W W Pd Pd Pd W Pd Pd
Pd [-^ Pd
r~-r-r~r-c-r-r-r-r—r-r-r-r- r- r- r- r- r- r- t~- r- r~ r- r-
o o o o o o o o o o o o o 00000 r— 0 0 0 0 o r— o I—
O o o o
o o o o o o o o o o o o o ooooooo o oo0 o 0 o o

385
Abacus Software Atari ST Internals

e c c
G G O G O
O O -H O C -H
-H -H R 4-> -H O .P
4J 4J O 3 P -H 3
3 3 -H ^H 3 +J ^H
^ ^H +J O .H 3 0
O O 3 P" en O rHOJ
en 01 *H Q) en O (1)
<B 01 OC M 0) C" en M
M H C- 01 O M fl)
0 -H E G M M
C G C M .p p G O 0>
0) < D O 3 -H 0) -H ,<S P
m ffl -H S iH *O 0) P tP C Q)
M A P ft M .p 00 ( B M P -H -H C- -O
0 O 0) O O 3 ,H en g O r H ,e M O
oj .p en 4J en rH 0) coo P.OJS
tJi e n m Ci 0 1 O MM MO! M T !
- i d IH <a -.« o o - ( u o - o >i
01 .H - O -H - 01 0) O-i 01 g »H en M >W 01 E .p
o i n - i M HH M CD M cu 3 a> < B - H
M O P OM & M -H » M ,G O> M 4-1 •-!
0 P M M JJM OS < O O T 3 <3 O CP !3 4J 01 <S
M (DM 0) Q M MO .-HMO) ^HM-H ,H C O <I) 3
01 en w E-I to wr Mi-3 hois fcoita cn-ae-io

CM vo w CO
o o CO o Q o Q
o vo o fc. vo
CM Q 0 CM < Q o w vo CO o CM U o CM CM o o vo CO
•> rt o CO CO Q Q CQ Q (H U U
CM
=8= I rH cn
1 CO
W <H en
P- 1 CO
</> =te «/>
vo
CM
H
o p-
Q
rH
O
Q
tH p" o
Q 1 *
O CM P-
Q
O p-
Q «•
*
o
Q
VO
CM
H
p- o p-
Q vt

43 43 43
ty
ffl
if s if
(!) 0)
3
0) <B
S O1
(U
(U CD
Q, CO ft 01 > cO 4J tr M <0 ft tr M <o ft(T M IS 4J er M <B
6 rH O M s rH O M 01 0) rHM O O 0) rH M o O s 0) rH M O 0 CO (U rH M
CJ 5 43 o 43 g 43 +J 43 O 43 6 g 43 O 43 e s 0 43 0 43 S e 43 0 43
^
°

w w w
o o o o
vo vo vo vo
CM CM CM CM
O o H CM O vo O CO O
O o o CO o Q O Q rH
O o vo PL* o w o VO
o o CM ^J1 o S31 o ^r CM
CM CO [^ CO o O (H O CM o O
O o o CM o o O o O o o
O CQ o CQ o o 0 o o o o
O 0 o o 0 0 o 0 0 0 0
en VO fe. 0 cn VO PC, 0 en •53* O CM <H o en •a1 O CM rH o cn O CM
*CJ* fH 0 en ^r 0 CM
t^0 ft* O r~~ O f-i o p- 0 ^r 0 0 o p- 0 •=P 0 0 o p- 0 •^ O O o p- o ^p O
O ro 0 0 O to o o rt p- CM 0 0 U [-^ CM 0 0 O p- CM O o n rtj p- CM O
o vo r— vo o vo r- vo •a1 vo •SI- VO p- «H 0 vo •3* vo p- rH 0 VD sr vo p- rH •a1 vo •a1 vo
CM CN ^* VO
< o CM vo CO vo CO o sa O [V) o CM o CM
in vo vo vo p" p- P- CO CO CO CO CO CO en en cn en cn rt f£ PQ S o U CJ
W W M pq W H H H [V] H a a pt) pt] pt) W a W H H p&l w W W M 1 p£)
p^ r~ t— p- r^ p~ P- P~ c~~ p" f^ r^ p- P- {— p- r- p- p- p~ p- p- p- p- p- P- p- p- P- p-
0 0 0 0 0 0 0 0 o 0 O 0 0 O o o o o o o o o o o o O o o O o
O 0 O 0 o o o o 0 o o o o 0 o 0 0 o o 0 o 0 O 0 0 O 0 o 0 o

386
Abacus Software Atari ST Internals

CO
4J
-H
M
O,
H C1-
-H (U 13 SH
i-l a 0) X S CO •H
,C -H
X [ i (^
-H O -H
S-l >i <a tj SH
M S
(8 0! -H s a
S -H ~X rH 0) O
O i <a CQ co •ao
o co
G .C
P5 C o s
< o O O
-o < En to ft >1
H to o
•o CO
(D
O H rt Q.
S < -H 4J
O M - id 0}
o o -o CO
CO CO CO
p ft H ft H C4 -M .p
&> 05 0 G
fO P 01 ia < 01 -H -H
EH -H 0> rH EH O ft O M O
O, < Pn ft >H fc. < 3 ps^ FS P-i J3

0" VO o o
O CO rH Q Q
vo vo fc, VO t- o
O CM O H o CM CM O ^ CM CO < o ^r «sp w Q o CM CO CM O
Q Q O Q Q «• «• O O Q </> CO r-t n Hn a
w *W fo H fc, v
t~- O C— rH O CM r- o r- rH o co r- o r— o r- co
=tt= Q =tt= «• Q <o vt

tr tr • s s s tr • .Q o1 A ^Q D1 *
0) 0! co a> • CO 0)
ft

O* M

IB
CD Q) • CO
^ ^ 4-1 &* ^ IB
• • CO CO
•P CJ1 -P CO t* *B K*
01 CO 01 H O !H O
p £> 4-> £> S ft S

vo vo VO
rH rH rH
VO vo VO
CM CM CM
CO O W O O o O CO CO
W O O O CO o Q CO a w w
W O r- o Pu o r- W W
sr o o
O rH o CM O CO o o o o o
O O o o o o o o CO 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 c^ O CM en cj en ^r rH co en
o o r- O *3" O O o r - o ^ j i o o o r - o s j ' o o O CO O Pn O CO O CO O O O CO
o co o c— CM o o co o r- c M o o o o r - c M o o co rtl r- o o < r- < vo o o o
[— rH O VO VO t— rH 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 o o o o o o o

387
Abacus Software Atari ST Internals

!H
0
01 CO 0) rH
C G O
-H -H -H o
rH rH rH

H
CO as CO 01 CO
P. p.

counter
4-> G C"
olution

-H

tion ?
01 01 01 O <U
ion ?

4J 4-1
% G
-rl -H -H G rl 45
O O 0 <a CD 3
P. P, P, 0 4-1
M 4-1 ^*
3 M 10 G rH
Q> 3 O 4-1 O 0 4J VO rH O rH M -H (0 rl
CM 45 CM ir; O rH H CD 0 O 3 0
O co jy ro vo CJI O 0! O O &H rHP.tr rH
M 01 -H -rl 4-1 CO U rH rl O 0) O
CD 0) ^ !H - ^ rl fa rH 0 -H O rH o
-U M 45 e-^ r-; e-j 45 M <0 U <0 M

-5
!H
3
O O -H
4-1
t) 3
-H
O

CO
CO
CM 3 Ti
rH
4J

-rl
3
-rt
S
-rl
O
"31
VO
01 4J
3 *D
rH -H
45
-H
10
cy 01 co
<B rH
p.
0
4J
CO
0)
01 > rH rH
(0 (0 O O
P, 0
01
0)
•o
<0
0
1 04 3 3 3 1 cn S 33 >n CJ 0 CJ S W O O >-! r3

vo VO VO VO 03
o o 0 o o o rH p-
CO vo o Q O VO vo O Q CJ vo 0 o CM 0
CM Q o CM CM Q 0 CM rH 0 Q rH vt- a
w </> O vo in- 0 VO Q r- VO
CM H ». p£) vo o CM CM - CM vo CO CM CO o CO CM r- CM r~
CO VO O VO o o cn o en o Q 0 O CO r- rH r- irt in
«, fa CM fa vo fa •. CM fa •a1 fa vo fa *. U rH rH VO 0 ^ r~ rH p-
^i
O o *3* r- co r- O CM 0 CO r— VQ r- O CM «> O VO ^i CO r- co CM 0 03* ift 0 CM* in- CO
Q Q in Q in- =tt= Q m- =#* m Q <* Q =s= </> tO- Q m- m- Q ""-" Q =*!
in in
* *
s g. s s
_Q
3 rH 3 rH 3
3 . 43 3 l£ • 3 3 • 3 3 • 43 3 • 3 • 3 • 3
CD • 0) • <D • 0! • ^• CO • CO CO er ai
4-1 4-1 cy PI 01 rl > •a •o 10 P, 01 T> T3 4-1 CO !H <0 £> ^4 T3 •o P. tr
X 0 01 CD S rH rH 0 •o TS O rl g rH rH 0 •o T) 0 01 G rH M 0 rH 0 G 0 •a03 g 0
g 4-1 43 U 43 0 g cfl <0 g 43 0 43 0 g 10 g 4J 43 0 43 g 0 g (0 g 0 43 g
*

vo VO vo VO
0 o 0 0 m
vo vo vo vo r~
CM CM CM CM ^i
CO CM o vo CJ O O VO o O CO CM f£ CM o <
w CO 0 0 0 O o o o o Q rH m rH o m
w fa o vo vo O o vo vo o W VO VO o r-
•31 •xP o CM CM 0 0 CM CM 0 *3* CM *$i CM o •3*
o O o o o O o 0 0 0 0 0 0 vo CO 0 t— O O f«. O
o o <qi o o o CO 0 CO 0 CO 0 r~
r_£J Q 0 [~- O O en
^
O
0 0 rH 0 w 0 t—J CM O D rH rH o
O CM O r- r~ 0 0 rH 0
0 0 0 0 fa 0 o O o fa O O o O O o o o o 0 o 0
o o en vo en o o en o en o ^j1 en (3j o en O en O en O r- o en o o CJ o en en o en
CO CJ CO CM [— rH ^P CO r- t— fa CM r- rH •sp CO r- r- fa co O •3* O p. ^i rH t— CJ CO P- 0 co
CO r- CJ co CM 0 0 rH co O O CO CM O o rH co f% vo CM O O CM 0 0 to O r- 0
•5P rH p vo o vo •5P CO Q Q to VO
«^ O VO •a1 co Q Q co w vo cp VO CM T co o co 10 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 4-1
rH CD ca
0) > rH g
> (U (U I
O) rH > 4->
rH CD O
G rH -O

P CD 73 *H rH rH
rH !H iH H CD O 0 ) 0 )
,Q O C71 O M rH rH >>
0)rH 0)rH < U O <B C D C U
0 ) > O < 1 ) > O < D > O > rH rH
4 - l K J O 4 - l < Q O 4 - l f l 3 <U
R 3 W <tf CO C O e Q r H rH C C
rH "d rH TJ rH « CD 0!
O T S n J O T j f l J O T S ' S S *O C D O )
M G O e o G O C O C EH O CD H M
H < i-3 1-HKCrP M < l< !3 K O C3

O O
O Q
O O rH rH rH rH rH
CM O fiCO *3* <JrfJ r3? • O O rtj • rfj
U Q Q Q en ^ — » r H Q Q NrH ^—,
L O ^ M K «> O - O < - - 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 1515 & S S I S r H I S g g r H g g ^

• <D 0) • • (D OJ • • <D • (a • • 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 < < < ^p w O ^P 0 < < CJ o


CJ « Q PQ en CJ W en W Q Q H w
m r— W r~ vo r- W «> W H u H H
CO ^P •3» •a1 «3» <3< SP ^P ^! *r •SP ^3* ^
r~ o o r- 0 0 r- o O 'S' 0 0 o o o o O O o
0 0 0 o 0 0 0 0 0 rH 0 0 o o o o O O o
o o o 0 o o o o O rH 0 0 0 CO 0 o O CO o
o o o 0 o o o o o o 0 0 0 en o o o en o
U o en 0 CJ o en o o o en o r~ co O en r~ CO CJ o en co en tq C- CO O 0 en o o
C- CJ CO •31 E— O CO «T E~- O co o •31 O fa PQ sp O r- co c— o co o ^p CJ r- co O fa co
o to o CO O CO O O O CO < r- 0 rH rH 0 0 rH CM 0 0 pL4 O O O rH CM O CO O CM
CJ (0 CO w o CO CO W O CO sp «> CO Q Q CO CO Q CM to m \o co vo CO Q CM CO Q Q 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 1 = r « > O

E C^f^t— C~*r^-[^C^"E— E 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 Atari ST Internals

rH <B
0) rH rH <-\
> <U Q) 0) <B
0) > > > rH
rH 0) (U 0)
rH rH H G
(1) (U
p T> -O -GO)
<H (1) (V (1) H
m « PS o5 u

o o
a Q
rH rH rH rH rH rH rH
£ C B O O <C • (4! O f£ STO ri|
- rH Q Q v rH - —, Q -rH CTlQ -
C J < - - O r < C J r H - O Q V O - O
O O p i ] 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 ^ T O ^ T r t i r H r H W
f = C r f ^ W O C J ^ O O t — (^C^WOrf^rflCtl "-" c^ <J ril &3 ^v O Q rij ri^ Q </> O 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 • • S • • H « - - r H r H ' " « c H r H - - S IS C T - ' - r H r H


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 O C J ' O ' C J s p f i C C J
H U O W H < ^ H c n Q W
W i n i n W W V O H V O H f M
^ P C O C O ^J1 ^ 1 * 3 ' ^ 3 ' ' 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 c o o o oco o o o o o o
o c n o o ocn o o o o o o

o o o o o o o o 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 <B rH
> rH <D H > 0! rH
0) 0) > 0) 0) > fl)
rH > (!) > rH <B >
(1) rH 0) rH 0>
R rH H C rH
a> ai a) <B
0) 'O 3 T5 0) 3 t3
(J <1) rH <|) H rH 0)
o « M « u m «

0 < CM O rH 0 <
_ o
rH Q o rH O Q Q
«.
Q
CO
Q
K
Q W CJ Q IO K rH
rH o \ 00 0 CM j—f rH w rH O rt CJ o CO •SP 0 < rH O CM rH rH ON 00 -=P
Q <o- ON a 0
^
^^ Q Q O
o
o
o
Q </> O rtj ft. w ^-, Q Q W
o ^ ^ \Q v w
Q Q O ft, VO ^
~—
IO ON
rH tO
rH ^ 10 ^ ^p rH
- - o o 00 rH 0 ^ ^ 10 ^ ^ ^ ^3* •s
rH rH 00 0 CO rH O CO r- rH «• ££ rH rH CO •sP CM •q» rH rH co r— rH «• O CO *3*
Q «•
<
a Q =8= Q Q •*! "*-* =**= Q <*> O <0 «• Q «• Q <
=*
Q •o> u>
* * * *

3 3
rH
3 3. 3 3.
£
rH
3 3. s
3 3. s
3 3 tJ1 • rH rH •
FT* •
3 cf • • 3 • 3 s s * rH rH • m
(U 0) d) 0} (U
> •a 43' .p (H <d § T3 •a # 4 3 4J (d § rH > rH T! •o t5 T5 > <d >
O TJ p rH O o O T3 •o O •O 3 W rH
O ^ M O
Q O CO 0 at •o O TS O M O
E 10 0! 43 O 43 s E s ^
S fd (3 g fd o) 43 u 43 E 6 E id S <3 ta •^
(0 s <d <0
^ E 43 E

CM O
CM T CM 00
Q CJ W
O ON Q o
W IO IO VO IO S
«5iCO CO ^ sp CO •5P ^r
0O o 0 0 o o 0 o
o o 0 0 0 o o 0 o
o 0 o 0 0 o 0 o 0
o 0 0 0 0 0 0 o 0
rH rH rH -3- O CM rH O ON r- ON O rH rH rH -ST O CM rH 0 W O CN rH i-H ON r- ON CJ 0 O ON
rH «^ ^P O ^P O o o CO ^P CJ p4 rH "531 ^T O ^ 0 0 O CO ^i co *3* •rP C"~ T CJ fe CO ^P CO
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 o CM CO CO CM o 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 Q CO Q Q co «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 Atari ST Internals

DI O^ O^ ^ ^
C G G Oi CO 01
-H -H -H G 4J M
4J 4-i 4J -H G «H
A A fi rH 3 Id
-H -rl -rl O O -O
CO fl) CO W CD C1-
3 3 3 SH rH
^ 0 - O S H G
<#> d° o\ O rH G O O
O C5> rH O O l d r H - H
rO rH LO rH rH O ,£ O 4-1
CO rH O 3
•* > •* CO K >1 4 _ ) C Q r H
o CO en > rH ,Q C M 4 - J O
ro rH m o> rH C O O X M
rH CO g rH CO CO
M C M W ' c J C O O C J H
C O C O C O C D C O - r l SH O
E co E 3 E > 0 ^ 3
-rl IH -rl rH -rl -rl G VO O O

o Q rH Q o rH
Q Q rH Q CJ rH CO 03 0 CJ 0 Q
O CM O 0 rH rH o o en o o en o o w r- » CM CM fa1 O
Q Q CJ Q vo W Q O K£ CO cn Q
co CQ fa t—i K
o «i> o o rH «• r^
s =»= rH
O =t!=
rH
Q
O
Q =a= Q
rH

*
0
Q Q =tt=
CO
Q < =tt= Q
CO
=tt= =»> =»= =!t= «•
•5P
«• =*
rH
s 3 3 3
, i
S S 3
, 1 , 1
S
move,

move,

move,
move,

move,

move,

move,
move,

move,

w
rH
3
rH •a
•a
rH
3 "O
•d 4-1
X -rl
•d •o
•a TS
•o
•a •a
!H
rH
•a •a"
•o T3
•a •a
•a •a
-S•a1 Cl< 4-1
E rH
4-1
«
<r >
CO O
CO

g g <S <3 CU T3 IS o ^3 (S IS IS (8 U ,£3 4-1 ,£? E

< CM O CO CO CJ CM
Q O H en en M 03
M U1 H \o vo H fa
^P f)
^
•a1 *r «=P ^P
W O ffl O « *T o o 0 [^ O 03 0 ^P O
rH mO o O va o o o O O O rH CM O
O oO o O o 0 o o O o O O H 0
o o o o O o o o o o o o O fa 0
CJ en u rH en CJ rH O U r- en CJ O t— CO O O CJ r~ CO o CJ r~ CO o o CJ o en
r- VO SP
FM CO Pu •=3* o fa ^P CJ fa ^p o fa CO U fa m •31 O fa pq •31 CJ fa pq r- o co rH O
rH CM ro O CM ro O CO rH CM CO CO CM 0 rH rH CM o 0 rH rH o O rH rH o CM H Q < r^ o
U CO CJ Q CO CJ Q •0" CO ro Q Q O fO Q Q vo n Q Q ro ro Q Q ro in pa VO ^r VO

W CM CO 0 W •=r 03 rt; CJ 0 CM •S31


f£ o W O vo CO < O W •sP 03 < O CM vo 03 o 0 VO 03
rH CM CM CM CM CO ro CO ^P O
^J1 ^T vo vo VO m m in in m m
CO CO vo r~ r-. r- r- CO
rH rH rH 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
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
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o o o o 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 4->
O Ifl
-H g
4J I
3 4->
H O
O T3
°> —
<U &
0*
gp K
+J
J3 4J
-H O 4-> Cf fi
•o n t-i -H Q>
fi,0 Q) 0)
s a j

ocooicrocMO — ^~o oo o o o o
o « 3 W M v o w o r- r-Q oo Q Q Q Q
— «• O O O « 3 Q < / > « T v H
K ^ ^ t H H ^ H ^ ^ » » r H » v ^ r - < H ^rM K[U [- K V O l O V O t ^ ^ 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 S S ? S S S S S S S S S S
. . . £} j y - - - • • • £> • . . r-l • • £ • S 3: • S • • •
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 O) OJ O
W «J K| O
pq r- H Pn
CJ5NO3 VO O C O O O O O O CJ CJ < V O O C O VOVDCM
O M V O Q O « 5 O O O O Q O O O O O V O CTCnU
PoWr- W pur-o ooor- h fci vovo«>r- VD«3H
^r-sr^r •a1 •O'^PO 000*3* ^r ^ CMCMCM^T ^r^-c'
OOO O O O ^ r i H O O C M O CM tHO O O O O O OOO
O O O O O O O O O O O O O O O O O O O O O O
000 O 000 O O O O O 00 O O O O O 000
O O O O O O O O O O O O O O O O O O O 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
(!)

co
p. K
0) PM
O
T3 H <D
TS W •a
-H

O
I
0) 01 •. M
(71 0)
01 H 4-J
.p 0) .C
CO W
M-l 1-1
rH S-l C .H 3 -H O
43 O < .Q •o PJ
*
FFFFFFE,DO

o CO o o o o O
$46B8

O O O 0
00, DO

CO Q a Q CM Q Q Q Q O
•s r- VO * pa o
0 CO ^p o O vo co vo co O CO O co <r Q
«/> 0 pa 0 VO o vo Q vo Q pq «• -
«. VO fa •* CM VO CM VO K v CM en pa en - vo r~~ •> r- .. vo •>. 10
0 CM <O O CM •5I1 CO 0 CM CO O CM CO O <H CO SP CO rH CM -a1
Q W- =ft= Q «> <«- «• a •y> -c/> Q Q < * > < / > < / > </> =**>
*
rH •
rH • CP S
• 0) 4) •
T3 > > !•<
•O O O rH
<a g g o

CO
CM
VO
CO
BOB9000046B8
COBCFFFFFFFE

VO CO
23C0000046B8

co U
33C000003E80

203900002600

CO
203900002600

O f""\
303900002604

303900002604

rtl
o vo vo pq Q
r~ CM •» o vo r~ t— VO [£1
•5P <H O O CM *3"
O O VO O W iH o o o o o
O O rH O rH O o o o o o
o o r- o r- o o o o 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
600A
4240
4240

o ^ i C _ ? r ~ o t — o f a * 3 * CO fa pq O o
vo O C O C M O < 3 V O C O C M o o co o n co CM CO O
vo co o T •O' Q

< O W o vo cj pq
008258
008238

00824C
00823E
008232

008256
00822C

00824E
008244

008254
008226

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


CM CMCMCMCMCMfMCMCMCMCMCMCMCMCM CM CM CM CM CM CM
CO
0 o o o o o o o o o o o o o o O O O 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 Atari ST Internals

4-1 -P
& f, A
4} 4J Oi B>
Ti TS -H -H
-H -H 0) <B

C,$47BE
C,$493C
CJ
CM
Cfl
rH CM CO o O o o 0 0 CM Cfl O rH
Q rH Q Q Q a Q Q Q 0 O Q
rH CM w CM Q rH •»
VO Q CM CO CM f CM CM CO "a* pfl Q CM
O Q TO o o CM*
[v, CM M O O W TO- Q S rH TO CO \O ,_*
PQ -. rH
vo
CM
CM •- ».
rH O CM
us CO
VD CM
O CM CO 0
Pfl CM M co
«> CM
0 0 «• co •a1 03 O CM !—) O
M. Cfl co CM *. cn
CO •a1 rH ^ji
co r-O m CM
VD CO -31 f3j t—) ^*
* Q Q TO TO Q TOTO Q Q O TO-TO- TO- TO Q TOTO a TO- QTO TO TO QTOTO ^-^
* ^
*
rH
3s s g.
g. j. j. s jj H
rH rH
3» IS • •
U • U !5 * • s • 3s • • 31 S ^• S ^• cf S
. <1> • <D Q) cu (1) . <a
g TJ g
(fl H > 43 (0 M Ri F tr > « M g 43* > iH <0 g
M (0 > g
> 43
O q 3 O O M rH O 3 S rH S -H 0) O M H O 3 0 0 ^ M rH 0 O rH H O O 0 3
ra CO g g 43 0 g w o co "O 43 g 43 0 g a g g 0 43 U g g 0 43 g g g W

CJ O Cfl
CM CO pa
cfl OS r-
co sr ^p
0 o cfl o
0 o o o
o o CM o
o o •a* o
vo CM \ CO CM CM CO rtj CM o rfj o CJ Cfl CM
0 rH 0 o ^Cfl CM* CM" 0 pq Q Q rH o (O rH
vo EM V0 vo CM fT~) p£) VO CM W CM 0 OS r~ CM
CM ^i CM CM rH ^31 •a1 CM rH ^ji *r 0 •a1 *3* «gi
O EM O O *xp O O o O Cfl O O o O o rH o O 0
O o O o CM O O o o o o o
O en o O o o O
O o 0 0 rH O O o o o o 0 0 o o O o 0 O
O o 0 0 O O o 0 o o o 0 0 o o o o 0 o
en CJ rH 0 cs co o en en o o o os co en CJ O CS os o os r- o en o cn %o o cn o EM en
CO r- •5T O CM o "a1 co r- ^p ^p ^a1 CM o co o ^ cor- CJ CM ^J1 o t— CM CM T co t— rH o t—
CM CM O CO CO O CM O o CO CM CO O t— o O CM O o CO CM o 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

m
00834A C1F900004FOE
008350 D17900004F1A

-
QrHCQ
^f c ,r-
< w

• t?
008356 54B9000047BE

h - itu
00835C E1F900004FOE

'
Abacus Software

008362 5 2 4 6

• O1
Q

'
«>
-
008364 BC7900004768
00836A 6DC8

co
CD
c
o

-H


00836C 4A3900004ED8

O
at &
008372 6712


008374 4A7900004F1A
00837A 6708


00837C 423900003628
008382 603A
008384 601C

<

^r~nwco&nro«>cocoli<
008386 307900004F1A

396
00838C D1C8

O f i S
00838E D1FC00004EEC

o o
, •> ~
008394 OC500008
008398 6708

A
00839A 423900003628
0083AO 601C

*
Q

".^ - C O « > C O V Q
0083A2 303900004696 o
»
O«><0-OQ«5nQCOrHCOOjmBi;<HKi;W — <CMpqcnQ
0083A8 E340 WT*rW«>CO'3<CO«5(<'=l'COracM<OH<rMCO|ia«>O
»
o

0083AA 48CO
m
C

0083AC D1B90000493C
r
O

S
0083B2 5247
Q
-

- S H r H ' S
»

0083B4 BE7900004ED2
0083BA 6DOOFF5C
£)

0083BE 4A3900003628
^Tt— C M C O C O O
40-QQt-HCMFt,
«. ^ H r o v o c o

0083C4 6736
Atari ST Internals
Abacus Software Atari ST Internals

M
4J

•a

ra
o
<a
a. o
W 53

o O O r- t- O vo o co
a Q CM Q Q Q co a co
fc. H
•5P CM O co O co o O O O O O O c- o O n o o CO CM f^
W Q «> CM Q Q <H Q Q O «- Q o C/5~ Q FT1
(0 CM ^ r- co
CO CO r- o CM o o r- o o o r- o o T co
«/>««•=% Q Q =«= Q Q Q Q Q Q Q Q Q </>«/>

QJ a)

CO O O O O CO CM
vo CM CM CO Q
W C"""
co co co co CO sp
o o o O O O «5 O o o CM o o o o vo
o o o O O O Q O o o o o o o o rt
o o o o O O W o o o o o o o ^
o o o o O O ht o o o o O o o 0 0 0
en a\- co en o en en en o en en en fC, r- o O CM O O r - o O o o o o en o
r-t CO o m i— r- o co P&4 CO o o o
<C O o CO «H co r- o co O C M P ^ O C O i H C O C O O C O i H C O C M O
vo n ^* en CO lf> «> co o co

O Q Q Q Q W f"1 F*i PM PTi O O 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 0)
-H

P,
ts
-rH rH rH
M CD CU
o, 4-1 4-1
C
CD -H -H
A rH rH
10 4J P, ft,

O 01 O CD O
4J G 4-1 4-1 4-1 4J 4-1
O O £_l <0 rH 10
•o -H O* o G O G o
4-1 S3 s^ -rH rH -H rH
P -H
H
Jq g H g
rH 0) M CU M
O VO 4-> CD IO 4-1 0) 4-1
o m 01 SH 4-1 M 4-1 01
o 0) • c*» O O r" O
X 4-1 1H K X 4-1 "H -
X 4-1 fH
^] - P M rH - P SH
P, 0 O1 O ft. O tP O ft, O tp
o] O 4-1 rH 10 L4 O 4J M Id rH O 4-1 rH 10
En O -H CU W O rH }_l W rH SH W P rH
< K 33 W o w & Ed H O W Ea W W O W

CO -
M CO CO CO
10 o fc. vo o vo o
C O W W C M C O C M C O E ^ ) Q M O Q O C M T W Q W O Q O CM Q H CM Q
cocncjCQDfClcor- VO pr, E— *. rtl CQ </> cn vo pt. cn *. <J pq vo h pq v
I-H cn "rprHCn "3* ^•O'rHCn STrHCn sr <-H cn
«• CO O 03 I CO C O r H C O « > C 3 O C O | C O CO </> CO O CO I
Q</>=te-U> t/>^H/>^=</>Q</>=*^</> </> ^ <«• Q «> =tt=

s tr
0)
? O1
(U
tT
CD
4-1 CT 4-1 CD 4-1 CD > SH 4-1 D" > 10 10 0) > SH 4J O1 > (0
ft. 10 > rH 4-1 CJ*
H O) (U W C 01 G O ffl . CD O rH M S G O 01 01 cu o SH rH O 01 01 0) o
o 4-1^34-1^34-143 g434-l S 43 43 O 43 g 43 4-i 43 g 43 43 g 43 4-1 43

CO
CO
Ed
ro
00047CE

0016D5E
0004F88
0004F88

0004ED8

0 CO
o vo vo
0 Q Q
o vo VO
O vo rH rH tv") vo rH 00
IO CO CM O O VO 0 o 10
IO 0 o 10 IO o to
o o o o o o 0 0 0 oo o o o
cn o cn < CTl CM cn VO o 0 o vo en vo 0 o O VO Ed O •a- O o o vo Pd
r^ o n IO ro 10 r- rH co 0 •31 0 Eu 0 n [^ rH ffl o ^ o Pd 0
^ t—1 fi^ O ^i O pd
CM o f^ r- <^ vo < VO P=3 rH rtj r~ 0 0 o O VO W rH ^ f^~ o o O W rH f3J t— O
*r vo •=r vo T VO T VO CM VO •5T vo r- vo vo o VO CM VO ^3, VO r~ vo vo CM vo .31 vo r~
VQ o o vo CO W 0 vo CO W CM •3< VO CO C _ ) W V O C O £ £ i C M ^ r V Q C O O M co o
^P IO in IO If! vo VD vo vo r- r^ r- r- (""•r^oocococncncncyi cn cn
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 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 o o o o o o o o
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o

398
Abacus Software Atari ST Internals

<D CD
C C
-H -H
•H .H
•^
c*. CQ —
01.
4J 4J
^
<U C G
+J •H -H
C! 0 O
-H P. a M
a>

er
S-l
Q, o 4J

er
0
VO vo G
X en en -H
-H S-l 3
M 0) 0) a 3 C
4-> » er> C
<0 cd <a o 0)
P s S e •P 0) 0) ,£S
<a -H -H A M 4J 4-> M ffl
c o s •P o ta O G
o 4J 4J C M -H M C
•o ~t~\Q tH "H <H O
M CQ 0) M O CD S
(U 0)
4J ^ ^ CQ 0) 0> X S-l
CQ
^ - - p. •P -P O O
_ P
G „ J3 M Xi „ +J 3 H 3 M
o O a o o
S-l s ra £° t?i O
id H
&, 0
CQ CJ CJ
P. O CO w 3 M O <-\l S-l a> O S 3 .. 0 H 9) G 3 H 0 H
w w S3 W H O W w C3 ^ O O W C3 O O H W

c—
rt
o o
Q <H Q Q — H
vo r~- o O «. I— O
vo o o
w
o Q 03 Q VO Q O Q O CO <
Q C J V O C J V O p t * Q ^rfj CO — O K <
en w if) i-i en
CO co o o co o co co CO O O o co i co
-tO-CQ-^^O^iOQW-^-CO <O Q Q -CO Q «> •CO Q Q Q «O * -CO

XI
s cr s cr
4J
CO
CT
0)
<D
>
O
0}
>
*
M -P £T
O W « <D
S ^1 4-* .Q
0}
S> fO
O (H
S 43
O
0
J>
O
M -P
« 03

CT
<U
S ,Q -P J3 £ 4 3
QJ
r*
O
*^1
H I O 01
e Xi jj xi
CQ 0)
> ca
O M
S Xi
0)
I

w
vo CO o
6D6D
4 DO

r~ CO CO o
Q W H o
VO co co o
o rH T CJ o CO o o o iH
o o o to o o o m o ffl en o
o o o 1O o o o
o o o o o o o o o o o o o
o en co CJ VO CJ o O VO Fn O en O O O O VO [c, O en O O O O VO (k, O o
o to o CQ o en o co co co co o -=r o h o
o < r~ w o (=C r- o o o co w .H < r- o o o co w IH <C r- o o
vo CM VO CM VO ^ VO f- VO •a- to vo 131 vo t— vo «< to vo ^ vo r- vo
O CM CO O W O CM vo CJ w o ^ vo CO *C *3< VO CO O W O CM vo
CQ O O O O CJ Q Q Q Q Q W W H W o
m
03 CO CO CO CO 03 CO CO CO CO O3 03 CO
O o o o o o o o o o o O o o o o o o o o o o o o o o o o
o o o o o o o o o o o O o o o o o o o o o o o o o o o o

399
Abacus Software Atari ST Internals

-H
<U

o
Q
W
o o O 0
Q Q P Q
r3? O
co U CO W5 CJ 0 Q r- r~ o vo 0 O CO fS. r~ r~ CO < CM 0 CM W
CQ M H r- n < r~ ~ a Q O w — Q Q M1 0
CM CO ** LO LO 10 CM
<-H CO r- co r~
Q m a I § ^
CO CO r- co r- o </> r^ CO
Q in Q fC * =tt= S S ^3*
O CM rH O O o «r
Q in «• Q O Q in- ill
tr ft

(J CM
a ^H
w
•^ h
-qi
o o
o o
o o
o o
O O O C O CO<
CQCQW Q CO OH
101— CM r- H U>CM
^p -=T i—I -C1 CO CNi-H
o o o o o co or~ oo o o
O O O - a 1 O O O O O O O O O
o o o n o o oo o oo o o
o o o o o o oo o oo o o
M j r 4 t i
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 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 o o o o o o o o

400
Abacus Software Atari ST Internals

G
O
-H

O
to
0)
4-1 M
OJ
tP CO
-H
0) -H O
ft « S3 p.

O
co m
en
0 CM
O o O vo
Q Q Q § < o Q p o
p
W v Q rH fc. r-
CO t^ CJ rtj
«sP o O H «. Q CM O O W •a- M vo co o co CM
o W w- Q en & « « - - » • . rH Q Q O </> O Q VO CJ P CM
vo CM IK. &3 vo en in r- o in *. PC, «. [— in M vo PL, VQ VO O
o CM rH O ^31 r- co CO ^l1 rfj rH •31 CO CM rfl
Q </> </> Q «• Q Vt -V> < / > * - * =**= •CO P =*= «></></>"—

H
3 3 3 rH 3 rH 43
3 3 • 3 • • cr 3 3 3 - 3 - 3 - 3 43 3
CD CD 0! (U CD CD CU CD • • • c Q - c y - C T - • • (U CU
43* !-H fO > > > 45 M T S r H T S T S r H T ) O . 4 - J 4 - J (T4J
,^
—| o p o O rH M O O 0 0 0 3 <n T J ' ^ C O ' O S r H C Q C D O O
O g CO g e 0 43 e e e a e « m < 3 c d r d r d O 4 3 4 - > 4 3 e g
o M
en
o W O
0 o o
o fc. o
0
CO CM CJ < o o K) CO CO
o
vo
w Q Q
^
CM W w
rH O
P=H o
CO
en
m O rH CQ O VO p vo
CM rH qi ^p CM
O O O o CO O rH O o O rH O o o o o o
o O o o fa O O O o O O O o o 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 0 0 0 o o o o o o o o o
o en en o en r- o en o en vo o en o fa en ocj en en en en vo en co en CM en cj en o
^p ro r~ CJ fa *3* O co r*^ o r~ CQ CJ co CM t^ O
CM o
^P co

O
o
en
CM CO W
co
co
ff) CM
CM
T
<=p

M
O
VO

O
CM co ro CM o o O CM CM CM O rH rH
VO CM CO en
rH CM
w m
P
*3* PC CM CJ W O vo co < o CM vo O CM CO f*l o vo CD H O vo
r~
vo ^p VO ^p VO % r~
o o
CM

co H
rH

rH

co co co co en en <c
in in in in in m m
< 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 oo
vo vo
co co co oo oo co co 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 o o o o o o o 000 000
0 0 0 0 0 0 0 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

< rH < O < rH <


~ K < ^< ^ ft ^
iH K C K C O — «< K u
<CO O O C O < r H C n ^ O O Q r f l r H H
— CO fj;<;HrHB!;vO--v(<KSr-rH<CKl
KVO K » n f e , ^'0'iH ^^^3-li! »SP
oco r-o«-<=T!H«>ra;r~o«>-«itH«>
a</> Q rt * «• rt * ~- Q r t ; = ! « = « > r i : *

a; • a)
O T3 O

< ft CO •31 rfj o < sr < O


Q CO rH en Q rH w rH Q rH H
r- W fa vo t- fa M VO r- fa W
CO SP ^> •3* <P SP CM «3* *3*
^
o O 0 0 0 O 0 0 0 0 0
o 0 0 0 0 0 o O 0 0 0
o o o o 0 0 o o o o o
o o o o o o o o o o o
o c x i o r - o o v o t ^ c o O en en o rH r- co o en en o rH en en rH r- co O en en O rH
fa t- O fa <n SP O fa r- O fa in o fa en ^P O fa r- O fa lf>
C O O C N C M C O C M O O r H rH CM co co o o o rH CM P) CO CM CM co o o o rH CM co CO CM
qi VO ^i CO Q rH VO CO Q Q n a Q co co Q 0 CO Q Q CO Q Q rH CO Q Q CO Q Q CO

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
Abacus Software Atari ST Internals

C"

G.
X

!8

C
O
-H

O
O 01
o
ffl
m
O> ffl
O -H 0>
o,

o
Q

— o O CO
rH Q CO CO
en o
^- VO O r- CM *r w Kg co <=C oocooooco Q w «•
<H en Q Q O «C O 03 Q 00 w lO
f£ vo - •> W to r- r- iy r- VO p-
o o O O CO </> CO CO
Q a Q Q m- * «•

O CO
[V] CO
M T'I
< rH VO O CM W CO O CO o o
rH O 0\ O VO co Q O a w co o o
W j— o o
{MO '? o o
O rH O o O CM O O O CM
O O O o O O O Q O Q O O O 00 O o o
O O O o O pt| O o o o o o o O CO O o o
O O O o O pC4 O o o o o o o o en 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
O fe <T) 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
CM CO O CM w Q < C— < ; V O C M O C M | < V Q O < H CM o co i-i co < r~ co o o vo
Q Q Q >o ra rH VO O VO
<

«5
CJ
c- r~ oo co
<£>
CM

\O
CO

VD
CM
en en sC <I
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 CO CO CO 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

o o o o o o o
r3? rij f3? rfj W rt! W
<C o <; o rfj o rfjo^r rfl o «=r
ooco<;i<oocof<rf;ooco< ;i<oooori;cM'O>ooocort;u -w-ofyoo
?•£ F£ H "— r") f£ f£ H -w-p ro rtj ril M "*•* ro rfj rfl W "*"* *s* •* 10 rtj rij H ^^' 10 *. p£] t rf ^
•*. K C O ^ p* *. "-co •» p* *• K n » » P ~ *. *.co » . P - < H P * *. ^ n * . t — i n c d p * *. •*.
P- O </> CM CO P- O -t/> CO CO P- O </> VO CO I— O </> P* CO •*/> CO P* O V> n CO -O> ^ CO P" O
Q <4t==*^-y>Q <=#==te<*>Q <=H=4^«>Q <=»5=H=«>-=*t=<rt-Q <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 o
M M
H W
sr ^p
< < <: <o rtoo
CO CO CO COO CO O H
W H H M O H O W
01 0 o n o n o o
OCM on OVD o r ^ - * H o r o t - n o
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
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 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
Abacus Software Atari ST Internals

o
Q

O 15
r- W O
Q
O O Q -— O Q •, i-)i-IOQOH<-IOO Q -a1 «> Q
H f - O Q Q Q «.rHCQQ«>tH -«>Q -

ajo)-aj M<ijtr

HO -=T O [=3
pqo Q
in o r~
-sr -a- no -a1
O OrH O « > O O O O i H O O O O <MO CO
O O O O C O 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

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 6DBC bit $87A2
0087E6 1039000035BE move . b $35BE,DO
0087EC 4880 ext .w DO
0087EE 3E80 move . w DO, (A7)
0087FO 610001B8 bsr $89AA Output
0087F4 4A40 tst.w DO
0087F6 6706 beq $87FE
0087F8 70FF moveq . 1f-l,DO
0087FA 600001A4 bra $89AO Error, terminate
0087FE 4A3900004EEA tst.b $4EEA
008804 6704 beq $880A
008806 4240 clr .w DO
008808 6002 bra $880C
00880A 7001 moveq . 1#1,DO
00880C 13C000004EEA move . b DO,$4EEA
£ 008812 5247 addq . w #1,D7
008814 303900004FOC move . w $4FOC,DO
00881A 5840 addq . w #4, DO
00881C BE40 cmp.w DO,D7
00881E 6DOOFF70 bit $8790
008822 4A39000047DO tst.b $47DO Epson B/W dot-matrix printer ?
008828 6720 beq $884A No
00882A 4A3900004EEA tst.b $4EEA
008830 6718 beq $884A
008832 1039000035BE move . b $35BE,DO
008838 4880 ext .w DO
9
00883A 3E80 move . w DO, (A7)
00883C 6100016C bsr $89AA Output
008840 4A40 tst.w DO OK ? =
008842
008844
6706
70FF
beq $884A
moveq . 1#-l,DO
Yes
Set flag I
Abacus Software Atari ST Internals

H
<D c
-H
e O
(3
-H
ft
ft CO

M
4-1

<D vo
-P 4-1 4-1 c; rH
<a <0 O o CM
c; £5 •a -H
-H -H 4-1
g S-l
m o rH
0! H O
> 4-1 O CO
O Q)

H
O O
n to >-l 5; O> to O
n 0) M EH O -H CD to
W o o >H to w W

CM
CMrH O O C O O O -^ CO O
rH fa Q Q pq Q Q f- CO Q (O
fa •& - pij CM - •« «: o r-
O « f « > O C O O "3> CM rH CO O O ~— »< C O Q O Q
i<C <o ** f"~ vo Q </> rH </> pq CM CM ^ rtC en *• *3J • t o o p q a p q a p q a c o i o vo
en «. m co E— •* *.py».cMpqmQen corncn
CO 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 rH^1CO*5TCOtr)COrH'31CO
fa- =tt==S=«-«-=tt=QQ«-*«>«-«-=*=«J-Q«J-=*«> 3£V}V>V*V>3EV>3£V}V>

•3= - S r H r H S ' - S : • S IT &1 O1


cy • 0 . . . . t r < D * o • ci) o1 • 0) CU
<a '
(U
(3 • O P . f l ) > r H 4 - l ' { 3 H ' O > P . 4 - l > > H 4 - l O ' > < a •d 4-1 Q. 4-1 >
' O g r H O t o X T S r H ' O O E r H - O t O W C D O T) to M G O O g G> O
43 <S O 43 E ra o us E o 43 E £ 43 (d 4-1 4J 43 S g O 43 g

CM
rH

CM O co O CM CO CO O co pq co CO
rHO vo Q rH PJ PJ CM co o Q CO
Pw O r- W F"l CM CM r~1 Pu r- W fa Q
•SPO ^Ji ^31 *r *=p V0
O fa o O O O O O C O Q H o o O o «3* rH
O O o O O O O O K C O r H o o o o en o
o o o O O O O O CJ O rH o o o o pq o
o o o o o o o o o fa 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 Pu O enen cj en ^r co CM rH en
O O
o [V| ^ r~co o co o pq
O O O 0 t~~
o .CM o o o CM< vo o o o o
pq cq
vo to o (— VO 10T vo <* vo r- vo r~ pq 10 CM
copq vo o O CM ^
•^mioiovovovovor-r-r-cococococncncn enen pq PP ffl PQ pQ
CO cocococococococococococococococococo coco co co co co
CO cocococococococococococococococococo coco 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 o o o o o o o o o
o o o o o o 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
Abacus Software Atari ST Internals

spacing
M
0) <u
4-1 a> 4-1
C G
-H
S-l ,_| S-l
a, G G a
O O
o (U 0 -H -H VO 0 0)
4-1 4J 4-1 4J I—1 4-1 4J 4-1
10 id 3 CM 3 (Q
D^ G G 1 1 rH O! o, G
c -H -H O O f—| C 4-1 -H
-H g CO CO -H 3 g
S-l S-4 S-l CU (U *. O
4-1 0> CD f—I 4J^ 01
CO tr> 4-1 S3* 4-1 aj C CJ1 4-1
id id S-l S-l -
o m
4-1 ,-H N 4J rH ^ (U (U 0 4-1 i-H h.
•. 3 H M-l S-l
3 4-4 S-l 3 IM 4-1 4-1
a O a (v. ^1
o G c a O o
4-1 4-1 S-l CO 4-1 S-l -H -H o 4-1 V4 4-1 S-l
3 (U S-l &4 3 W 0) 0) S-l S-l S-l en 3 S-l O 0) }_l
0 CO w i-3 O O >H CO M &4 w o W 3 C/3 H

Q
o o r^ o
w CM Q O Q O t— O O V O O C O O C M V O C O G O VO Q H CM Q O
b. Q - < O VO fc, CN - <
en 03 ,-t en en co en - W 03 Ol en rH en en ,-H en
co o 03 I CO co o CD CO co r- CO </> CO O CO I CO
Q -co- </> Q </> «• Q </> ^t= </> Q </> ^= </>

S tT S cT • 43 tr s tr
S-l 4-1 tT >
co co d) o s-i
(8
0) • 0)
> s-i 4-1 (T > id
O CO CO 0) O S-l
•S•a 1co*- CU
O M O
4-1 4-1 CT S-l
&i CO CD <-H
(^J
S-l O
(!)
J> S-i 4-1 tT
CO co CJ
0!
> id
O S-l
43 4-i 43 g 43 g 43 4-1 43 S 43 (0 4-1 O 43 S 43 4-) 43 g 43

CM CO CM
a w Q
r- H r- W Q
vo
co o o o o vo o <H 00 o
n Q O Q « o o O P3 CO
i-H O o o o o o o pq o O O o
o o o o o o o o fa o o o o
O O VO [n O O o o VO pLH O en en VO PH o
O •^ O fT| O 03 o ^ O £H O
i—i <^ r~- o o H .-I < r~ o o CM r£ r- o o
CO VO -31 vo r- vo ur> •& vo r^ vo
•a1 co < o H CM VO F W O
U O CJ CJ O Q Q Ci Q O W
CO 03 O3 CO CO O3 CO CO CO CO CO cocococococococoenencncncncncncncncn
CO O3 CO CO CO CO CO 00 CO CO CO 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 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
4J <u 4J
G 3
ft Q,
4-1 i-H 0 4-1 0! 4J 0)
3 4-1 4J 3
O ffl
G
-H
I
4-1
O
E
CM
c-
O1
G
0

o^
G
-H
o
s
G S T3 ~-x -H fi S
-H M r- J_) -H £_)
Q) 4-1 S-l 0)
3 61 4J ^ CO 3 o^ -p
•a <B
rH K -
i-H
•a IB
rH
•a
4-1 4-1 ^
3 M IH vi •, 3 £_j VI 3
ft 0
ll
0
J_)
O
CO O
a
4->
0
4-1
O
M
a. oM O
f-l
3 JH O 0) H en 3 S-l O 0) IM fa 3 M O
O W a w w W 0 W iJ O W S3 W

r-
<
o
Q
o r- o *3< O
Q O — ^ CO Q O O O
< CO ^ p Q ^ P O Q O ^ o f a m K^C CO Q
en en ^ e n « . « . e n r H c n cnrncn rfj en en rH en
CO O CO co C O C M C O r H O C O « > C O O C O I CO •f/>CO O CO I CO o
-y>^=^>=*^ Q</5-=B=</>O^>=tt=«> =H= -CO Q </> =8= <*> Q

tr tr tr & tr
CO a> co • tr >(U
>
O
S-l 4->
CO CO O
T! .
T) co
tr > «
(U o n
>o sa >-i01 4-1CQ <Utr O> «J-1 >
O CQ a
H 4-1
tu o O CO
S 43 4J e (0 4J ~ s 43 e o 43 4J 43 g 43 g 43 4J 43 g 43 e ffl

o fa o
Q r- CO
r- Q H
^p IQ co
< CM H o <-t o
O CO vo o o o o
o o o o o o o o
o o o o o o o o
o o o u> en «> CM CM o o o o -a1 fa co en o o
pq O "5P O o o O O CQ O ^ C5 pq *r o fa co CO T O
w t-l < I— o o CM r- o o o . . _ „. < r- o o o co co
\o ^P t£> r- vo tft VO p— t- pq «> CM vo r- vo CO CO W -=P
CM «> < CJ M O ^3» ^O O pt) O CM VO CO CM co < W O CM ^P VO CO K) O
CM CM CM CM CM CO CO CO CO CO m in m m m u> u> vo u> vo «> t-
en en en en en en en en en en c n c n c n c n c n c n c n c n c n c n en en en en en en cn en en
CO GO CO CO CO GO CO CO CO CO C O C O C O C Q C O C O G Q C O C O C O oc? ^ oo
o o o o o o o o o o o o o o o o o o o O o o 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 o o o o o o o o o

409
Abacus Software Atari ST Internals

ntronics port
o G
rd
a !>•
M
0)
O
-H
CO
4J 4J 4J
3 |

acter
(U 3
C fi. P. X -H
4J o O
0> <a a I
4-1 0 T>
^ 0 •o 4J
**t
M
01 M 01 0)
-H <8 4J 0 O ry 0 0 o O
-H M en .c
o
40 3 O 4J
m
3 fi <3
s-i o O 19 O Jj d>
a M O 4J M o •H co CD
CO J-l ffl CD CO 0) .p X > M M
o C" u o U-4
4J IM
o ^
3
a>
4J CM
-3ft! •o
G
0) t
x: (0
•o
q A
4J
3
•g
<u H
I

G. en
4J <a
4J
01
a C
-H
CO
CM
t-l
<g
0)
4J
M
ra
a)
•o
a
4->
^f C"
CO
O
M
CD 3 H
O &4
0)
o 3 J5
o c§ 4i
o wX ft C?
^4
0
o g a H
M

t—
*******

Q
cn o ft. o o vo o 0
m a w
VO ^ CM
Q Q co
co
co < o Q W
Q Q
t—
Q
s o
vo a ft
^T CM t-H
</> r*i <^> o p£] r- vo (JM
***
W CO
o vo
m en < »,
•^ s
<
1 CM
N ft
CJ
ft Q h t=H
cn i-t cn cn
CO

-. H VO CM CM t-H C3\M iH CO
o o
*
o o
o o CO CM o i CO
Q -y> Q Q <n =»= Q — — ** VO
<,
CM CO
</> cn Q Q cn Q Q
•»-*

</> O ^>
CO
31s
CO
to </>
* ,Q q 3 •H
1-1

"~\ *. B. ' ** Q 3
3
• 3 • 3

i io i
tf

'O
T3
P* 'O M
O 13 «H
J>
O
a -H > ** c
-H
4J
CO
tr
CD o X
<3J
0 X 0
M •§"
p <B
CO •o CO a
0)
o
n>
M
f!)
m e m o g US 1 B
X)
rH to
O 4-1
O
g
G
3
4-1
!-! •X 4J e 0) e E <tt s <o ^j Xi s ^3
^4
JQ

*
*
*
*
*
*
*
CO CM < 03 KG co * (jq CJ
ea w w o pq CO * fe, CM
VO W CM VO CM a * ft
CM vo * CM CO
o o o O O CJ t-H O * O 0 cn cn o
o o o O O Q O O * [V, O 0 o 0
0 0 0 O O CO O O * p4 o o 0 o
o
_ o
_ o
_ O O Pt4 O * [V, 0 0 0 0
cncncnocncnocjooc^E^E^in * VO cn CM fjq 0 0 pq O o cn (V, O ^p f T| QI O
CQcor^-srrof^ocpvo^cnQinr*- * in to CM CM CO CO CM CO o m CO o Pu CM CM
1^1
r-IOt-ICMOOCMHi-ICMrtlCJfaW * M (^ r- 0 CO W 0 co 1*4 *3* vo O O O
ft
* •a1 vo f— 1 •a1 co f-f ^1 cn ^r in vo r- VO VO
^gt
*
C M C O H ^ V O C J C M V O O M O C M V O C O * pi ££) ^i vo
-J(
f^
5_j pq CM T vo o w o CM vo IQ«

c^r~r*-cocococncncncnrfj<s<Srf! rt* <J m m ffl CQ CQ CJ CJ O CJ o Q Q Q Q


cn cn cn cn cn cn cn cn cn cn cn cn cn cn * cn cn en cn en cn cn cn cn cn cn en 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 * CO CO CO CO CO CO CO CO CO CO CO CO CO CO CO CO
o o o o o o o o o o o o o o * 0 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 o o * o 0 o 0 o 0 o 0 o o o o o o o 0
*

410
O089D8 102E0009 move . b 9(A6),DO Character to output
Q089DC 4880 ext. w DO Extend to word
O089DE 3E80 move . w DO, (A7) And on stack
0089EO 102E0009 move . b 9(A6),DO Character to output
0089E4 4880 ext ,w DO Extend to word
0089E6 3FOO move . w DO,-(A7) And back on stack (?)
0089E8 4EB900008A46 jsr $8A46 Output via RS-232
0089EE 548F addq . 1 #2,A7 Correct stack pointer
0089FO 4A40 tst .w DO OK ?
0089F2 6604 bne $89F8 Yes
Q089F4 70FF moveq . 1#-l,DO Set error flag
0089F6 6002 bra $89FA
0089F8 4240 clr .w DO
0089FA 4E5E unlk A6
0089FC 4E75 rts
********************** ************************** Output string to printer
0089FE 4E56FFFC link A6,#-4
008A02 6018 bra $8A1C
008A04 206E0008 move.1 8(A6),AO Get string address
008A08 1010 move.b (AO),DO String character
008AOA 4880 ext .w DO Extend to word
008AOC 3E80 move.w DO,(A7)
008AOE 619A bsr $89AA Output character
008A10 52AE0008 addq.l #1,8 (AS) Pointer to next character
008A14 4A40 t st. w DO Error-free output ? I
008A16 6704 beq $8A1C Yes
008A18 70FF moveq.1 #-l,DO Error
008A1A 600C bra $8A28 Terminate output B
«>
008A1C 206E0008 move.1 8(A6),AO Pointer to string n
008A20 OC1000FF cmp.b #$FF,(AO) $FF as end indicator 3
»
5?
008A24 66DE bne S8A04 Next character
008A26 4240
as
n
clr.w DO OK
008A28 4E5E unlk A6
008A2A 4E75 rts
****************************************************** Centronics output
008A2C 302F0006 move.w 6(A7),DO Character to output
008A30 48E71F1E movem.l D3-D7/A3-A6,-(A7) Save registers
008A34 3FOO move.w DO,-(A7) Character to output
008A36 3FOO rnove.w DO,-(A7)
008A38 9BCD sub.l A5,A5 Clear A5
008A3A 6100E198 bsr $6BD4 Output character to Centronics port
008A3E 584F addq.w #4,A7 Correct stack pointer
008A40 4CDF78F8 movem.l (A7)+,D3-D7/A3-A6 Restore registers
008A44 4E75 rts
****************************************************** RS232 output
to
008A46 302F0006 move.w 6(A7),DO Character to output
008A4A 48E71F1E movem.l D3-D7/A3-A6,-(A7) Save registers
008A4E 3FOO move.w DO,-(A7) Character to output
008A50 3FOO move.w DO,-(A7)
008A52 9BCD sub.l A5,A5 Clear A5
008A54 6100E258 bsr $6CAE Output character via RS-232
008A58 584F addq.w #4,A7 Correct stack pointer
008A5A 4CDF78F8 movem.l (A7)+,D3-D7/A3-A6 Restore registers
008A5E 4E75 rts
*************************************************** VDI ESCAPE functions WJ
008A60 207900002580 move.l $2580,AO Pointer to CONTRL array H
008A66 3028000A move.w 10(AO),DO Function number
008A6A B07C0013 cmp.w #$13,DO Greater than 19 ?
i
008A6E 6236 bhi $8AA6
srs>
Abacus Software Atari ST Internals

addressable alpha character cells

current alpha cursor address


cursor addressable alpha text

raphic cursor at location


o end of alpha text line
cu

alpha cursor address


end of alpha screen

last graphic cursor


rH

10
4-1
(0

tablet status
o 4-1
(0
T3
4J

video off
c

video on
4-1

ha cursor
rsor left
CO
CO CD tr> C
•o ex o -H O
ha mode

CU
o P T3
dress

(U M CD
G <0 O O O N
-H J2 CO CO CO -H
ex p p p p ex o 4-1

y
0) 4-1 rH
•o10 ex cu cu CD CD ex 01 CM 10
-rH O CD rH ra 0 0 O O rH 4J 4-1 4-1 CO CO M r4 O O O -H
4-1 S-) CO 10 < D O P M r 4 - r H - H O d ) > tH rH 4-1
10 <uCO -H ^, (0 <fl fd
(0 0 ) c o C D e X C D ( D P P t 3 O o -H
rH (U P 4-1 0) 4i!cucocEjr44-i>>crcrr-4<o e
«-; H rH G
0) 10 4-1 co cr -H 4-1 ex ex ex r-He X OE < r3 Jr 4W- iQH OP CKI K) < rDHC HC <MO fr H^ cu Q Q -H
!H 4-1 C X rH rH
o M I—1 pi) W <, << ft, !B W 01
4-1 CD
CD •§ X - - •*OrHCMO<3'inVOr~03 a\H W W 0)
O < H O rH CM n SP m vn PJ

- *
—. *
s *
KO 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 K -CO <O </> <O <O <O <O </> Vt Vt Vt Vt Vt Vt Vt Vt Vt Vt Vt Vt * O O
— <. I I I I I I I I I I I I I I I I I I I I * Q Q
W C - 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 * -^ -°
[— U "^ 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 * r H C Q c M O
< 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£ O •&
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: *
• rH * S |S
C O - S S S S S S S S S S S s S S S : ? ? ? ? : ^ * * •
>TSCX *extrexcrco
O T i g O O O O O O O U O O O O O O O O O O O O * g C D g C D 4 J
gfO-n •OT3Ti"O-aT!-aia-OT3-OT!TST3'OT3'a-OT5'O * O X ) U 4 3 ! H
*
*
*
*
*
*
*
*
< *
*
CJ *
03 *
ice o * in VD pi)
O O * VO «3 *T
o o * o o c^
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 ' « 1 * C J K C C J O I O

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 * O [ ^ O C ~ - p a
mQ«T o o o o o o o o o o o o o o o o o o o o * pQt^pqvo*^
*

CO CO 00 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 * 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 o o * o o o o o
o o o o 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
*************************************************** VDI ESC 101
008AB6 61000448 bsr $8FOO Cursor off B3
rs
008ABA 207900002584 move.l $2584,AO Pointer to INTIN array en
008ACO 3010 move.w (AO),DO Get paramaters cn
008AC2 COF90000257E mulu.w $257E,DO Times number of bytes per screen line
008AC8 33C00000255E move.w DO,$255E
008ACE 6000041E bra $8EEE
***************************************************** ascout
008AD2 322F0006 move.w 6(A7),D1 Get character from stack
008AD6 024100FF and.w #$FF,D1 Process only low byte
008ADA 600005D2 bra $90AE Output character
***************************************************** conout
008ADE 322F0006 move.w 6(A7),D1 Get character from stack
008AE2 024100FF and.w #$FF,D1 Process only low byte
008AE6 2079000004A8 move.l $4A8,AO Get conout vector
008AEC 4EDO jmp (AO) And execute routine
***************************************************** Standard conout
008AEE B27C0020 cmp.w #$20, Dl Control code ?
008AF2 6C0005BA bge $90AE No, output character
008AF6 B23C001B cmp.b #$1B,D1 ESC ?
008AFA 660C bne $8B08 No, process other CTRL codes
008AFC 23FC00008B4A000004A8 move.l #$8B4A,$4A8 Conout vector to ESC processing
008B06 4E75 rts
***************************************************** Process CTRL codes
008B08 5F41 subq.w #7,D1 Less than 7 ? S3
008BOA 6B22 bmi $8B2E Ingore, RTS
008BOC B27C0006 cmp.w #6,D1 Greater than 13 ?
008B10 6E1C bgt $8B2E Ignore, RTS M
5T
Abacus Software Atari ST Internals

Convert to number divisable by 8


Get relative address from table

conout vector back to standrad


Jump table for control codes

Process character after ESC


And execute corresponding routine

0)
H
Add base address to it

0
Bring to word processing

er>
-H
H
01 p 0) O

§
4-1
rH
0
0
CO
G
-H
rH
CQ
H
P
C
0)
•O O 4-1
CQ fa EH fa 4-1 n ts
w w r3 fa U P 0 IB o 4-1 CO
pq CQ EH OH ca 01 (U p CO
•a

TAB
BEL
4-1 M 0} CO

CO en
0
rH rH
CM CO
rH O
o
CJ U
(U -H
s
(U s

*********************
*********************
$8B20 (PC,Dl.w) ,AO

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

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

0 o 0 0 0 o

.1 I$8AEE,$4A8
0
CO CO CO CO co CO
I$8B30,AO

CQ m CQ CQ CQ CQ CQ
CO CO CO CO CO CO CO o
Q I$FFF8,DO rH
Q rH
1 1 1 1 1 Q
o o o o CM CJ
#1,D1

Q
CO Q CO Q Q Q CJ vo Q rH CM
(AO)

o pq fa fa Q in CM
cn
pq CJ
CO CO CO CO CO CO CO CM CO CM CO
=* =*> =«=

*
.w

3
1

3
w

• 0) rr*
* 3 IS 3 * 3 3 3 * •X •X (U rri
cr !> -X 0) r\
<a o •o U
•X 0 o 0 0 0 o o •X 4-1 * S-l * 0
\J
G •oIB O * 0 p g
rH g id -[—> * T! •a •a •a •a •a •a *
*
H •X X! *
*
^
6 X! * s CO
* X! O
-X •X
-X •X •X •X * CO
•X *
*
*
*
•X
-)J
* a:
-X •X
-X * •X * •X o
* •X •X * •X 0
* * •X •X * o
•X •X * * * o
* * * •X •X o
o •X •X * •X 0 CM •X w
CO •X •X * •X vo ^O * w
pq * •X * •X in in *
CO * * •X -X CM CM •X CO
t3* o * * CO .£ O CO ^r
0 •X 0 „—) O
o o
o o
•X
*
*
*
rH
CM
•X
*
O
0
fa
fa
vo
O
r-
0
-X
* o 0
o ^r
0
O
rH o •X * W * O fa o 0 X o ^31 o 0
cn pq CJ o o CJ <=p f£ f£ rf^ [V] * m * o •X cn o o cn o •X O CJ CJ
•31 fa Q o fS^ 0 t3^ f£ en * r~ * o * co *xp ^p CO 0 * fa r- Q c-
CO O(— rH W o rH 0 ^31 ^J1
^ •V *gi * f-*j * o •X o CM o CM 0 •X CO CM PQ CM
W CO Q "^ o o 0 0 0 0 o •X ^p * vo * CO O in co •X CM cn IQ pq
* •X * * * ££>
CM ^p CO H * o CM •c1 \o CO (^ CJ •X pq * o * <3* *3» w o vo •X sr CO
rH rH t—| rH -X CM CM CM CM CM CM CM •X CM •X CO * CO CO CO ^* •X « m ^
m
CQ CQ CQ CQ •X CQ CQ CQ CQ CQ CQ * CQ * PQ •X CQ CQ CQ CQ CQ * CQ CQ CQ CQ
CO CO CO CO * CO CO CO CO CO CO CO -X CO * CO •X CO CO CO CO CO •X co CO CO CO
o o o 0 * o o o o o o 0 •X 0 •X o * o o o o o * o o o o
0 0 0 o * 0 0 o o o o o •X o * 0 * 0 0 0 o o -X o o o o

415
008B5E 6F50 ble $8BBO To ESC table for capital letters sr
ta
n
008B60 B27C0018 cmp.w #$18, Dl 'Y1 for set cursor ?
008B64 663C tone $8BA2 No,test for lowercase letters CA
008B66 23FC00008B72000004A8 move.l #$8B72,$4A8 conout vector for ESC Y
008B70 4E75 rts
****************************************************** Process line after ESC Y
008B72 927C0020 sub.w #$20, Dl Subtract offset
008B76 33C1000004AC move.w D1,$4AC And save line value
008B7C 23FC00008B88000004A8 move.l #$8B88,$4A8 Process conout vector to column
008B86 4E75 rts
****************************************************** Process column after ESC Y
008B88 927C0020 sub.w #$20,Dl Subtract offset
008B8C 3001 move.w D1,DO Column value
008B8E 3239000004AC move.w $4AC,D1 And line
008B94 23FC00008AEE000004A8 move.l #$8AEE,$4A8 conout vector back to standard
008B9E 6000070C bra $92AC And set cursor
****************************************************** Test for ESC lowercase
008BA2 927C0021 sub.w #$21,Dl Subtract offset
008BA6 6B86 bmi $8B2E Ignore lowercase 'b1
008BA8 B27C0015 cmp.w #$15,Dl iwi
008BAC 6F10 ble $8BBE Less than or equal, process sequence
008BAE 4E75 rts
***************************************************** ESC uppercase I
008BBO
008BB2
E349
307B1058
Isl.w #1,D1
move.w $8COC(PC,Dl.w),AO
Code times 2 for word acces
Get relative address from table i
008BB6 D1FC00008B2E add.l #$8B2E,AO Add base address
008BBC 4EDO jmp (AO) And execute routine
&I
3?
Abacus Software Atari ST Internals

Address table for ESC upper casi


Get relative address from table

set background color


01

set character color


01
0)
o
o

Standard conout vector


•o

Set standrad conout vector


^4 to
o
And execute routine

o
3= o rH
r-H O
to o o

Subtract offset
o 4-1 U
0) •a
c
ESC lowercase

01
CM tH CD P
o
Set conout vector

Set conout vector


4-1
O to
Add base address

01 0
01
4-1
-H O IB O

ESC c
ESC b

to O £> ffl U Q w
0)
T5 | 4J 4-1 CJ CJ o O o
0 <a CO CO w to w
O to H w w

**************
6 (PC,D1 .w) ,AO

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

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

w w
D8,$4A8

EE,$4A8

EE,$4A8
F8,$4A8

H H
CM CM CM CM CM
ffl m
2E,AO

ffl ffl ffl


CO CO CO CO CO
rH
Q
, Dl 1 1 1
rH o cj o CO w M
Q CM ffl ^^ « O Q CQ ,3j o Q CO -X CM CM CMCM CM
•*X 0 CO o *
-X CO * C^ O CM H * CO * CO CM PE] •X CQ CQ CQ ffl CQ
rH CO */}• «> * vt </5- f—1 CO *
•X {/}• * </5- </> rH CO •X CO CO O3 CO CO
* </> =4fc *^
^- *
-X =&= -x =tt=
* =ti= o -u> *
•X =4t= =H= Q </> •X V} </> 4/> </> </>
* * •X *
-X
=**=
•X •X
*
•X -X *
•X •X -X -X
•x S rH •X rH S •X rH rH U
S rH *
•X • •X • |5 • * • |5 • *
X
*
•X tu • o 01 0) • * * O • IS IS IS S S
* 05 .jt
* •§
§ (TJ *
CD
t> W * >
K*
(Tj
•X

01 o •o S -X o 4-1 o o O 4-1 •X o 3 O •X o o o o U
* i-H E -i—i E to * g 01 e JQ *
•X E 01 e JQ
•a •a •a •o •a
* * *
X -X * *
*
-X * CO •X CO •X CO * CO *
•X * f^C <£ •X <J *
•X *
-X * «^i * ^1 •a1 r^
^ji *
^t
* o •*X o •*
X O •*
X 0
* *
•X o -X o 0 •X 0 *
* -X o •X o *
•X 0 o *
•X
*
•X •x o •X o -X o *
•X o -X
•X -X o 0 0 o .£
-x w CO •*X w * CO * -X
CM * Q -X * fa -*X H -X
* *
-X CQ •X »s£ *
-X ffl
* CO CO CO 00 *
•X ^
CO *
•X
* •a1O * o * o o CM *
•X o •X o o H •X
•*
X '•O O -*
X o -*
X o CM &l •X o o CM
0 0 0 o O CM •X 0 * 0 0 CM *
rH 0 * o *
•X o O O o *
•X o 0 O *
cn ffl O 0 * o IO CJ O rH O *
-X CJ 10 CJ o rH O *
•X vo i"3! •vT pq CM
SJ1 f^ fa Q * fa p-. *
-JC fa p~- O 0 p4 [^ * fa t— O O ^o r- ff VO
•* w Q^
f*> a
O rH X •X CO CM O O *
•X CO W *
-X n CM o O * rH rH rH rH
H o Q tp CM •X CM n 10 CM Vf •X CM vo *
-X O O ^
0 O 0
* -X -*X •X -X
M o ^ji CJ \& •X CO CM IQ CO CJ VO CO CM10 CO •X CJ o CM •3*
tyj
^J
CQ CJ CJ C *
-X CJ a •X Q W w •*
X {•-•) f^J *
•X o o o o o rH rH rH
-X m CO
m PQ ffl
*
•x
ffl ffl ffl m ffl ffl m ffl -X ffl o O CJ * U CJ CJ CJ CJ
CO CO CO CO CO * 00 00 CO CO * co co CO CO CO CO *
•X CO CO CO CO CO
*
•X o 0 o 0 0 o *
•X o o o 0 * 0 0 * o 0 o o o o o o o
o o o o *
-X o 0 •X 0 o o o * 0 O * 0 0 o 0 * o o 0 0 o
* * * *

417
Abacus Software Atari ST Internals

0)
CO
ni
O
S-l
0)
o
r-1

O
CO

S-l
o

<d to to 01 « en 03 CQ W CQ
4J 4-1 4-> 4-> 4J -P 4J 4-J 4-1 4->

CO
01

C J U C J O O O O O • 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
******

•it pa pa w p£j w pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa pa
C M C M C M C M C M C M C M C M * CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM
f^rnrnrornf^rnm •it pq pq pq pq pq pq
•it
cq m pa m pq COpq pq pq pq pq pq pq pq pq CO
CO CO
pq
C 0 0 3 C O O O O 3 0 3 O 3 C O CO CO CO 03 CO CO CO CO CO CO CO CO 03 CO CO CO CO CO
vtvtvtvtvtvtvtvt * vt vt vt vt vt vt vt vt vt vt Vt vt vt Vt Vt Vt vt Vt Vt Vt vt Vt
I I I I I I I I •it 1 1 \a 1 1 1 1 I I I I 1 1 t l l 1 l l l t l
M H W W W W W W
CMCMCMCMCMCMCMCM
*
-it
pa pa
CM CM
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
cQpqnpqpqcqpqpq *
* 03 CO
pq pq pq
CO CO
pq pq pq pq pq pq pq pq pq pq pq pq pq pq pq pq
CO CO CO CO CO CO CO 03 CO CO CO CO CO CO CO CO CO CO
vtvtvtvtvtvtvtvt * •in- vt vt vt vt vt vt vt vt vt Vt Vt vt vt vt vt •in- vt vt vt vt vt
*
*
•it
•it
3 3 3 3 3 3 3 3 * 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 O O O O •it O O O O U O O O o O O O O O O O O o O O O O
*
•it
•o •a •a •a •a •a •a •o •a •a •a •a •o •a •a •a •a •a •a •a TJ
*
•it
-it
•it
*
*
•it
*
*
•it
•it
•it
•n
•K

O O O O O & j C M C O
* w w 10 CM CM 0 0
as pq vo
CO a
o o
o CM pa
o k, o
CO
CM
o o vo
oo Q1
< *r
a\M ££ o o o o o «>
o o o 0 CO en
* 0 0 co CO CO o o oo
O O t H n t - l t H C O C O * o CO sr ^P ST CM o o o o ^r *?
o o o o o o o o * 0 00O o o o o o O O oo O o O o o o 000
*
V O C O f i C O W O C M ' O ' •it \ CO f% o pa o CM «3* to CO
f£ o pa 0 CM ^i V£ CO <J 0 pa o
rHtHrHiHi-JCMCSJCM * CM CM CM CM CM CO CO CO CO CO CO CO CO ^p «=? ^i ^i "W "C 1 m
U U U U O U O C J
cocococococococo *
CJ
•it O3
CJ
03
CJ CJ CJ O O ooo
O O O
03 CO CO CO 03 CO CO 03 CO CO co
o 0 CJ CJ o O CJ o O
CO CO CO CO CO 03 CO co CO
o o o o o o o o * 0 O 0O o o O o o o o o o 00000000o
o o o o o o o o * 0 0 0000O o o o o o o o o o o o 0000

418
**************************************************** VDI ESC 1, get screen size
008C52 207900002580 move . 1 $2580, AO Pointer to CONTRL array
008C58 317C00020008 move . w #2,8(AO) 2 result values
008C5E 20790000258C move . 1 $258C,AO Pointer to INTOUT array
008C64 303900002550 move . w $2550,00 Maximum cursor column (79)
008C6A 5240 addq . w #1,DO Plus 1 equals number of columns
008C6C 31400002 move . w DO,2(AO) As second result
008C70 303900002552 move . w $2552,00 Maximum cursor line (24)
008C76 5240 v addq . w #1,DO Plus 1 equals number of lines
008C78 3080 move . w DO, (AO) As first result
008C7A 4E75 rts
*************************************************** VDI ESC 17
008C7C 3F3C0014 move.w #$14,-{A7) Hardcopy
008C80 4E4E trap #14
008C82 548F addq.l #2,A7 Put stack back in order
008C84 4E75 rts
VO
*************************************************** VDI ESC 3, Enter alpha mode
008C86 6108 bsr $8C90 ESC E, Clear Home
008C88 60000226 bra $8EBO ESC e, Cursor on
*************************************************** VDI ESC 2, Exit alpha mode
008C8C 61000272 bsr $8FOO ESC f, Cursor off
**************************************************** ESC E, Clear Home
008C90 615E bsr $8CFO ESC H, Cursor Home
008C92 6064 bra $8CF8 ESC J, Clear rest of screen
**************************************************** ESC A, Cursor up, VDI ESC 4
008C94 323900002562 move.w $2562,01 Cursor line
008C9A 67DE beq $8C7A Zero, then done already CD
5f
008C9C 5341 subq.w #1,D1 Subtract one
B9
008C9E 303900002560 move.w $2560,00 Get cursor column n
008CA4 60000606 bra $92AC And set cursor w
CO
**************************************************** ESC B, Cursor down, VDI ESC 5
e.
008CA8 323900002562 move.w $2562,01 Cursor line
008CAE B27900002552 cmp.w $2552,01 Compare to maximum cursor line
008CB4 67C4 beq $8C7A Already in lowest line, done
008CB6 5241 addq.w #1,01 Increment by one
008CB8 303900002560 move.w $2560,00 Cursor column
008CBE 600005EC bra $92AC Set cursor
*************************************************** ESC C, Cursor right, VDI ESC 6
008CC2 303900002560 move.w $2560,00 Cursor column
008CC8 B07900002550 cmp.w $2550,00 Compare with maximum value (79)
008CCE 67AA beq $8C7A
008CDO 5240 addq.w #1,00 Increment by one
008CD2 323900002562 move.w $2562,01 Get cursor line
008CD8 60000502 bra $92AC And set cursor
*************************************************** ESC 0, DEL, Cursor left, VDI ESC 7
008CDC 303900002560 move.w $2560,00 Cursor column
008CE2 6796 beq $8C7A Already zero ?
008CE4 5340 subq.w #1,00 Decrement by one
008CE6 323900002562 move.w $2562,01 Cursor line
008CEC 600005BE bra $92AC Set cursor
I
*************************************************** ESC H, Cursor Home, VDI ESC 8 en
H
008CFO 7000 moveq.l #0,00 Column I-M
008CF2 3200 move.w 00,01 And line to zero
008CF4 600005B6 bra $92AC Set cursor
!
CO
ST
*************************************************** ESC J, Clear rest of screen, VDI 9
008CF8 612A bsr $8024 ESC K, Clear rest of line
008CFA 323900002562 move . w $2562,01 Cursor line
008DOO B27900002552 cmp.w $2552,01 Compare with maximum cursor line cn
p
008D06 6700FF72 beq $8C7A
008DOA 5241 addq . w #1,01
008DOC 4841 swap 01
008DOE 323COOOO move . w #0,01
008D12 343900002552 move . w $2552,02 Maximum cursor line
008D18 4842 swap 02
008D1A 343900002550 move . w $2550,02 Maximum cursor column (79)
008D20 60000436 bra $9158
**************************************************** ESC K, Clear rest of line, VDI ESC 10
008D24 08B9000300002576 bclr #3, $2576 Clear flag for line overflow
008D2C 40E7 move . w SR, -(A7) Save old value
008D2E 610001DO bsr $8FOO ESC f, Cursor off
008D32 610001EC bsr $8F20 ESC j, Save cursor position
008D36 323900002560 move . w $2560,01 Cursor column
008D3C 08010000 btst #0,01
008D40 6716 beq $8058
008D42 B27900002550 cmp.w $2550,01 Compare with maximum value (79)
008D48 673A beq $8084 In last column, then output space
008D4A 323C0020 move . w #$20,01 Space
008D4E 6100035E bsr $90AE Output
008D52 323900002560 move . w $2560,01 Cursor column te
008D58 4841 swap 01 2.
008D5A 323900002562 move . w $2562,01 Cursor line
008D60 3401 move . w 01,02
008D62 4841 swap 01
008D64 4842 swap 02
008D66 343900002550 move . w $2550,02 Maximum cursor column
Abacus Software Atari ST Internals

ESC k, Restore cursor position

VDI ESC 11, Set cursor


!H
M

********************v******************* VDI ESC 12, Text outout

Restore registers
Re-enable cursor

M
EH

Registers back
Restore flag

M 4-1

Get pointer to Dl
0)

Output character in Dl
O to c

move,,1 $2580, AO Pointer to CONTRL array

DO,$8DB4 Output next character


4-1 1H B

move,,1 $2584, AO Pointer to INTIN array


move,,w 6 ( A O ) , D O Number of characters
0! >H 3
O rH
4-1 CD -H 0
a> 3 4-1 rH 01 U
Reset

Set cursor
o fx
Not set ?

<0 4-1 -H 4-1 C 4-1

Minus offset
<X 3 O fl) -rl W
CO O P< CS & CS
******************** j*******************

n.l ( A 7 ) + , D O / A O
n.l DO/AO,-(A7)
(A7)+,CCR

o
#3, $2576

,w (AO)+,D1
rH Q
Q - O

$8AE2
#1,DO
$8EEE

- W O
$9158

$8F3C
$8D7C

$92AC

o < r- CO -^ Q 0 $8DC2
CM 0 Q IO 0
•CO- Ch CO CM <!
=ft= -w> </> <o — * CM
s s
,w
,w

move,
move,

£4 £H

&^ Q) Q) d} CO
bset

O1 <B
> > M > H CO
beq

43 <S
bra

rl > M (u
to O CO M O CO M 3 0 O O CO O 43 4-1
43 g 43 43 CO g to 43 g g 43 g 3 M
00300002576

0002584
0002584

0002580

W CJ u
006

O ^ CM 0 VO rH O
w m vo CM CM
o o
0 0 CO CM O fa
rH rH o IO 0 Q rH fa
o O o O o o * o o o •X 0 0 0 CO p"| O p&i
O fa co en
0 0 CJ O CM * en o rH CO o o * en co en H co r- o p4 co to
0 Q 0 fa 0 0 n oH •X
E— rH
T CM^P O * r- CM r- o rH W 0 Q CJ r-
rH ^P [— CO rH 0 CM rH O * O CM co o n o * o o o o CM CO tH O rH W
vo "=r vo o
VO VO n vo vo * CM CO 10 co IO VO •X CM CO CM VO 00 "^ \O ^p tO ^
* *
CJ 0 CM -ST CJ 0 •5P CO CJ •X W ^P VO CO o w * CM CO CJ CM <3* V£) rij W CVI ^O
vo r~ r- co CO CO CO * co en en en en en •X *3. ^ < cq cq cq pq pq CJ cj
Q Q r-
Q C—
Q Q Q Q Q Q •X Q Q Q Q Q Q * Q Q D Q Q Q Q Q Q Q
CO CO CO CO CO CO CO CO CO * CO CO CO CO CO CO * CO CO CO CO CO CO CQ CO CO CO
o o o o 0 0 o o o * o o 0 0 o o •X O 0 0 O o o o o o o
o o 0 0 0 O 0 0 O •X o o o o o o * 0 0 0 O o o o o o o

422
************************************************ ESC p, reverse on, VDI ESC 13
008DC8 08F9000400002576 bset f4,$2576 Set flag for reverse 8
008DDO 4E75 rts
************************************************ ESC q, reverse off, VDI ESC 14
008DD2 0889000400002576 bclr #4,$2576 Clear flag for reverse
008DDA 4E75 rts
*************************** ********************* VDI ESC 15, Get cursor position
008DDC 207900002580 move.l $2580,AO Pointer to CONTRL array
008DE2 317C00020008 move.w #2,8(AO) 2 result values
008DE8 20790000258C move.l $258C,AO Pointer to INTOUT array
008DEE 303900002562 move.w $2562,00 Cursor line
008DF4 5240 addq.w #1,DO Plus offset
008DF6 3080 move.w DO,(AO) As first result
008DF8 303900002560 move.w $2560,00 Cursor column
008DFE 5240 addq.w #1,DO Plus offset
00
008EOO 31400002 move.w DO,2(AO) As second result
008E04 4E75 rts
*********************************************** VDI ESC 16, Inquire tablet status
008E06 207900002580 move.l $2580, AO Pointer to CONTRL array
008EOC 317C00010008 move.w #1,8(AO) A result value
008E12 20790000258C move.l $258C,AO Pointer to INTOUT array
008E18 30BC0001 move.w #1, (AO) Tablet available
008E1C 4E75 rts
*********************************************** c/>
008E1E 207900002584 move.l $2584, AO Pointer to INTIN array H
008E24 30BCOOOO move.w #0, (AO) No result values S1
*+•
Set graphic cursor fB
008E28 4EF90000FF50 jmp $FF50
B
65
B1
Abacus Software Atari ST Internals

needed
, Clear graphic cursor

inder of screen down


p.

inder of screen up
rH
sor up, scroll if

O
01
rH
3

rsor column
O
rH
G 0 M O
r column

column 0
CU CU rH 0> O rH
cu G fH CU HH rH O
N -H in G O U

cursor
-rH.
rH rH o -H O O
O rH rH
0 JLi H H rH in CU
rH rH O rHO CU 4->
(U cu CU ca CU 01 cu cu m m 0) o
Cft jq
G G o GO 3 rH rH <d G rH 0) rH C ca O • ca
rH 3 -rH -H to G o -H o C 3 -H g G -H o cu rH 3 -H g cu ca o rH
O rH rH J_4 M rH 01 t-H O rH cu -H rH 01 rH CJ CJ rH cu J> rH ca
CJ 3 cu M rH rH 43 rH 0 m K fZ
CO ., G O ». rH 3 ». ». rH rH rH 3 rH 43 ,G vo o
W H o
^ -H
01
,_p 0 O
01
O ,_} im 0
CO
.p
t[ j
O
01
o
01
O G s^ ^
MH O 4_>
01 IM
ca O rH
cu
CU
M CJ rH 4J O 01 rH 4J O CJ rH -H rH 4J i o O rH -rH. cu 4_) •a £>
Q CO 3 O ca CO 0) 3 CU to CO 3 45 3 3 CU cu CO CO 3 r; (U (U 0 ca
w CJ CO w CJ CO w O CO CJ O CO H O CO CO g CO

•X •X •X
*
He •X •X
* •X
*
•X •X
*
* •X ^, *
•X *
-X •X
* -X c^ He
* ££ * *
•X •X
•X
* * rH «—- o *
•X rH rH •X ,_)
•X CO
•X -X Q | Q •X Q Q Q He in
•X ^ * ^ •X o m
CO * w O *
•X o w * o •X Q
•X

* * in
o\J vo •5T
CM
VO
CJ
i
rH
Q
O
o
CM
VO
CO
CJ
CM
VO
m
CJ
M
•X
-X
0 CM
0 VO
fa m co w
m
0
CO •X *. SIK
•X fa m w r-
fQ
CM * fa in CM •X •X PH4

•X fa *
-je CM CO CM CO O *
•X CO CM en O CM cn CO CO CM en CO •o> o
•X </> to- •— =s= </> <ft </> Q vt </> <0 X </> o> </> -co-
•* •X
* =«*= Q
-X •X *
•X -X •X
•X rH •X •X
*
-X j5 |5 |5 • *
•X J5 [5 •X S •X
•X *
•X • • • tr •X • S • He s ^•
cu CU CU cu •X cu cu * CU CU
*
-X ft *
•X > cu > rn > J> <8 •X rH > rH rH > rH <0 *
•X rH > M ca •X
* •a• > 01
•X e •X o G o 01 0 o •X 0) 0 01 rH 0 01 rH -X CO o 01 rH •X G 0 4J
•X g 43 g 43 g g 43 •X 43 g 43 O g 43 43 •X 43 £ 43 43 ca g M
•*
X •X •X *
•X
* He
* *
•X * •X *
He
*
•X .*x •X
*
•X -X *
•X •X
* •X •X
-*
X * *
•X •X
He * •X * •X
* •X * He
* CO *
•X CM o CM CM * CM He CO
* [—
VO vo *
•X vo VO *
•X vo He m
*
•X fa *
He in m •X in in •X in He m
•X fa •X CM CM CM CM •X CM •X CM
•X o •X O o O O * 0 0 Wvo 0 ^r •X CM 0 CO •X fa o
o O vo O vo * CO 0 vo
sr 0 CO -X cn o o o o
*
•X 0 *
•X 0 W 0 ^r *
•X o O m o •a1 o •X o o in *
•X 0 0
o •X 0 fa o o o O o o o o •X o 0 0 0 0
*
He en en 0 en CO 0 fa o * o a\o o o en o o •X o a\O0 0 •*
X CJ o m
-X fa * CO 0 co 0 rH 0 o *
•X o o ^r CO o o •X o o r— cj r-
-X W *
•X CM vo fa rH 0 CM o •X rH CM rH CM CM rH o •X rH CM rH o * 0 co w
^J1 •X CO vo CO VO CO t— vo •X VO CO VO CO VO vo •X VO CO VO vo *
•X o CO "a1
* •X •X •X •X
•*
X H •X •a* fQ pel) ^T vo CO f^ •X ptl CM CO O &3 •a» CO 0 O VO <s£ •X o O VO
CM CO CO •X m in in in vo vo * vo •X CO CO
*
•X W * W [V] H H w Ed W H a a W [V] M * a W pq W •X (V| M W
•X CO *
-X CO CD CO CO CO CO CO * COco CO CO CO CO CO *
•X 03 CO CO CO •X CO co co
0 •X 0 0 0 0 0 0 o * o 0 0 0 0 0 0 He 0 o o o •X o o o
* o •X 0 0 0 0 0 0 o *
•X o o o o o o o •X o o o o •X 0 0 0
*

424
*************************************************** Set background color
ta
008E88 C07COOOF and.w #$F,DO mod 16, 0..15 n
008E8C 33C000002556 move.w DO,$2556 Save background color S
C/5
008E92 4E75 rts O
************************************************** ESC d, Clear screen to cursor ta
008E94 610000DE bsr $8F74 ESC o, Clear line to cursor
008E98 343900002562 move.w $2562,02 Cursor line
008E9E 67F2 beq $8E92 Already zero, done
008EAO 5342 subq,w #1,D2
008EA2 4842 swap D2
008EA4 343900002550 move.w $2550,02 Maximum cursor column
008EAA 7200 moveq.l #0,01
008EAC 600002AA bra $9158
*************************************************** ESC e, Cursor on
008EBO 4A7900002422 tst.w $2422 Cursor already on ?
K 008EB6 67DA beq $8E92 Yes, done
008EB8 427900002422 clr .w $2422 Flag for cursor on
008EBE 41F900002576 lea $2576, AO
008EC4 08100000 btst #0, (AO)
008EC8 6618 bne $8EE2
008ECA 08000002 bset #2, (AO)
008ECE 303900002560 move . w $2560,00 Cursor column
008ED4 323900002562 move . w $2562,01 Cursor line
008EDA 6100031C bsr $91F8 Calculate cursor position
008EDE 6000043E bra $931E Invert character at cursor position
008EE2 61EA bsr $8ECE Invert character at cursor position
008EE4 08000001 bset #1, (AO)
re
008EE8 08000002 bset #2, (AO)
3
008EEC 4E75 rts BB
Abacus Software Atari ST Internals

or to saved position
the temp, storage

the temp, stroage


to

position saved ?
cursor position
4-1
H

rsor saved
M m
O o
MH to
m ;>,
^f
c>-
HH
m
o 3
CJ
•a(Q
0 ^i (V
•a o >-l ,H
n CO o —| q
rH 0 ^t IH <o
(5 CO 3 0) 3 3 0) CO 3 0)
10 M 0 O> CO > O MH rH G r( U IH rH fi M
c Q) 3 (0 (0 a o O -H 3 o O O -H o
0) 01 > CJ ^1 rH £ CO M O rH O ta
n to
O rH to
4-1 O O >H O CO ^1
43 «. ^M K m CO rl H K 3 CO H ^4 3
O <0 tH o ^ -n 0) 0 0 X O HI O O U
to t CJ1
r^
<a to e> H to 01 iH to «
>H to 0) O <d CD $^l O o •c J_( o to •a !H ^1 4J
P (U 0) CO rH ,—| 3 CO rH •o 3 3
^t
CO <a o •a 3 3 (U
CJ >H CO w En o O w En < O O PJ s <; CJ O

* *
•it
*
•it
* *
•K
•it
-j- *
* ^_^ ^^ *
* O O *
CM *
•it VO O f£ ff * vo o O
CM t— < « •»•- * r- «: Q rH
o o o * in K K * m O
* CM CM CM W CM VO i=C CM rfl W <C W * CM pj O CM •it
* CM o pa H- o
* CM O1 </> CQ — o\ cj — cj * «• CM vo VO «• Pn CM ^_^
^^
* <s- H KM in *• p£i •. M ». M * K •a1 in m •it
* ^ O <=T O O CM
•it CM CO rH CO CM CM CO O CO rH CO * m CM CM CM m CO CM f^* f$* tn
-tO- =tfc «• * </> * «• •it
* </>
V*
•to * t/> «• •— -
*— </>
* * *
* * •it
*
*
* S * £ U Et
* is * • • * ^ •
** 4J• tr * j_)
0) 0) H m

-K
CT
to 03 3 Q) 4J
43
tj1 to •81 l O r H t r O l C T r H C U l O
CJ 0) 4-> O CJ
*
*
0) <0
to 0> o
> >
O
CO
4J
*
*
*
rH
0 0)
er ra
0)
(1)
>
O
J>
O
<o
!H
* 4J 43 M 43 >H fQ .O 43 •*
it 43 rH E g * 43 4} rH S S 43
-K *
•it *
•H •it
*

* •it
* *
•it *
•it
•it •it vo vo
•it p^ *
•it r^
*
*
in in
* CM * CM
*
•X CM CM CM VO •it
* o PtJ o CM * o w
* CM CM CM r- •it o CM vo VO •*it o CM
•sr in 0 ^P m in •H 0 ^i
* CM CM CM CM * 0 CM CM CM 0 CM
* O O o o CM o * in 0 0 o * m rfj O co
* O O o o o o o * o O o o * o •^C O m
* O O 0 o o o o * o 0 0 0 •*it 0 Q 0 co
* O O o o o o o * 0 0 0 0 •it 0 Pn o o
* CM o 01 o m 01 Ol o o o voo o * ON o> a\n en m •it 01 o en CO o 0
* i~- 01 r~ cj r~ CTi CO rH CQ Ol •*
X En En CQ t— •it cq o Pn rH rH o
-it < t^ co r~ P£] CMrHOOC-COI— O3VOH CO rH 0 O [V] CO r- rH O CM o
-it 'a' vo in vo <gi i n T O V O O V O O V Q Q ' * o •5P ro n •*p *
-it 0 vo ngi CO ro vo
*
* H ^ vo o W O V O C J O C M V O C O C J W * 0 CO fjQ sr rtj •*it O •31 CO w o CM
•it H P&H pt4 Pn En O O O r H r H r H r H r H r H * CM CM CM CO co •jt n ^i qt q! IO in
-it W H W W PL| EnPnEnEnEnEnEnEnEn * En En En En Pn •H En En Cn En En En
* CO CO CO CO 00 C O C O C O C O O O C O C O C 3 O 3 -*
K 00 03 CO CO CO CO CO CO CO CO CO
* o o o o o o o o o o o o o o 0 o o o o * o o o 0 0 0
* o o o o o o o o o o o o o o * 0 0 0 o o * o o o 0 0 0
* *

426
Abacus Software Atari ST Internals

Restore cursor position


Save cursor position
Clear line to cursor

rn cursor back on
Turn cursor off
turn cursor off

m cursor column

in column zero
CD
G
-H
rH 0)
o

column
column
0)
4-1 T3
CD <u CD
rH G G
(U -H <D -H
•o rH rH

K
K
J^ p Vl ^ - - Vl 4-) ^i VI K P
rH iw o 0 0 IH "<~i o k. (U P o 0 X 4-1 (U
CO -H CO m o o a, CO CO o
o £_J Vl VI o O U VI m -P Vl Vi CJ •o <0
CO CO p cd p v> CO CO P (U a P p p CO G c^
w W CJ s o 65 IS 65 CJ ISI CO o CJ O H <

•X
•X •X
•X
-*X •X
•X
•X *
•X *
•X *
•X
rH CM •X CM CM CM
* Q Q Q rH Q Q rH
*
.£ * Q ^ Q
o
s
^
•X o CM CM o CO ^
•X O O O 0 CM VO 0 CM CM rH CO O H
0 VO Q m in m •X O CM VO CD Q en 0 vo Q VO Q in
*
-X CM in ••• in 65 •X f-, pn irj fc, [V, CM 0 in rH ^ in - f*, PL] CM
CO CM rH rH rH CM CM en CO •X CO CO CM CO O CO en CM CM CM CM CM CM rH rH en CO CO </>
•X <0 Q Q Q Q -u> <o •co- •X to to -co <o =3^ <o =!(= <o =4t= Q -CO Q Q Q Q <«• CO <o =4*=
•X •X
-X •X
-X IS IS |5 |5 s S S 15 15 s
•X • • IS • * • • • • S
•X CD CD ft • ft CD *
•X 0! ^j CD CD O"1 A 0) Q) fX CD
-X ^1 > > (0 Vl cfl r" VI ca •X cr CO 0) Vi £» 43 cd J> £» <d cd Vi Vi Vi nj >
•X CO o o S rH g 0 M M -X CO CO O cu ^_) G ^
O CO 0 P IS 0 O S S rH M CO Vi O
43 g S CO O 0) £ •X 43 43 g Q e 43 s 01 co g S co co 0 43 43 43 s
*
* *
•X
*
•*
£ *
•X *
•X •*X
-X •X
•X •X
•X
-X CM o •*X o o CM
•X vo in vo vo VO
•X in in -*
X in in in
•X CM CM •X CM CM CM
Jfi 0 o ff p£ •X 0 0 0 CM o o o 0 o
*
0 o C£J pa]
o rH w
•X 0 o CM CM 0 o ra CM
f-, o
o •X o o O rH 0 0 rH
* o o o frVj •X o o o O o 0 O p4 o
* CO en rH rH rH CM en o o r^ 03 en o CM O o O en CM CM en CM CM rH rH O o O CJ
* p% CO O «q* qi ^31 co o o •*
X 03 rS, co co O rH O co ^r "31 co o ^p ST ^ O en o co
*
•X rH CM "=P O3 CM CO ^1 rH o •X f—1 f—1 ^ f^ 03 VO CM f—1sj> in co T CM coCO CM rH rH o CM
-X VD CO CO •=r "=r "31 CO vo vo VO VO CO vo O VO CO vo CO in "31 co co "^ qi 131 VO vo vo co
*
*
•X vo CO 65 O CM "^ VO CJ o * •=3" VO CO fV) O t3* vo fQ [V] •qi VO 03 W O CM -5T VO ff 5J o
m m m vo vo vo vo vo J— * t— r^ r~ r^ CO 03 CO CO en cs> en en
03 rtl 2] fQ CQ
*
•X PM [V, fV, fVj f-, [V, [V, fv, Pu *
•X p., f T] fT| fc
[y( PN p4 pM Pu FTi fTr fTt F"! FT< PM P>4 PM PM p4 t,
-X CO CO CO CO CO CO CO CO CO -}s CO CO CO CO
03 03 03 CO CO 03 CO CO CO 03 CO CO CO 03 CO co
-X o 0 o o o o o o
0 o o o o O O O o 0 0 0 0 0 0 o o o O o o
•X 0 o o o o o o 0 o *
•X 0 0 0 0 0 o o 0 o o o o o o 0 0 O 0 0 o

427
Abacus Software Atari ST Internals

in lowest linme, just cursor down


CD

are with maximum cursor line


G
-H
0) rH
G
IH

ess of the flash counter


-H
rH 0
-a

Cursor in column zero


<4H
O G »
o
T3

turn cursor back on


w rH
•o •o o
4-> a
<U CO rH o
0

11 screen down
4-> 01 CO
ra G >H o rH P"
-H
<U
c
rH
o
5 CO

3 CU G
-rH 13 rH o A -H
CU

h cursor
rH CU
G 0
G
N E
En
<D c
H
CO

cursor
0) o cd -H o •H o rH
IH
3 D1 B rH rH 4-1 EH 0
td en CO
4-1 rH G CO
P >
>H SB o o CU o o
£. cd CO P CO Q. 0 CO M CO CO rH
4-1 CJ 4-1 CJ 01 rH 4-1 •g CJ •o <g •o H rH •o
P w 0) C/3 rH K P o CU pc P 0 w o rH •o P 0 P o •a
O H co w CJ 0 o CJ CO ^ CJ o B w t/3 Pn CJ o 2 <

•X •X •X •X •X
-X •X •X •X
-*
X •X •X
*
•x •*
X
-*X * * •X
* -X * *
* -X *
-X *
•X *
•X
*
•X vo •X •X rH o o •X o rH
•X r— [— •X Q *
•X Q Q .— . .—, <
m * in •X «. K K *
•X «. o o K
W f3^ -*
X CM *
•X CM •X CM C_J *
•X CM CM CO o o w \o f£ CM r3< CN in
g£ -X •CO </> IQ f£ •X vo m ((^ o CO M * f^ *-~ CM •«— CM VD
o rT K *
•X ^ *
•X m CM in m o Pn CO [V] * m ^ o ^ o in
CD CO *
•X ro o •X CM o CD * CM CM CO CO rH CD CO •*
X CM CM CD 0 CD CM
</>• 4fs -*
X Q </> *
•X Q ff> </> •X vt </> =*=
</>
-X •X * •X •X
-X *
•X •X
*
•X •X |5 * |5 -X
-X * . |5 *
•X • |5 [5
•X 4J * *
•X CU • •X CU . • * 4-1 4-1
cd •X 0) CO *
•X ^
rH CO -X CO •X o, CD M rH (Q * CQ CO cr CO cr td
^
CO ^_, •X CO 4-1 •X 0 4-> •X o ^4
rH •X o e G ^
CO rH CO * CU .p CU 4-1 CU <u
Q 43 •X A •X 43 M •x £ 0 Q £ 0 43 o 45 ^
43 •*
X rH 43 ,Q rH
•X •X *
•X •X
* •X •X
*
-X *
•X *
•X •X •X
•X •X •X •X
•X * •X -X •X
\£> * *sO •X
*
•X (— * r- * * •X
-X LO *
•X in *
-X * •X
-X CM CM •X *
•X
-X o * 0 •X CM •X CM CM * VD in
-X o *
•X o •X *>o -X vo m *
•X r^ \s>
-X o •X 0 He in -X in in in in
•X o o •X CM •X CM CM *
•X CM CM
03 •X rr) *
•X CO o •31 o o o sr fVj CO •X o CM o o
En •X o o *
•X o Q *
•X o o o rH 03 Pn •X o o o o
O -X o *
•X 0 •X o CM •X o 0 CJ Pn n w •X o o o o
o -X o 0 o o 0 0 Pn Pn 0 •X 0 o o o
o 0 -X CD IT) *
-X CD in * CD 0 o *
•X CD CD o 0 rH O 0 -X CD o H 00 CD o
o En -X Ex r^ cq r^ •x
* 0 •31 0 •X n r- 0 0 ^31 o 0 En rH rH rH rH Pn
rH 0 •X COH *
•X CO w CM OJ 0 •X o 0 vo t-H CM rH 0 *
-X rH CO r- 03 r- o
ID vo -X o •31 -X o •*X m ^1
«J •X m PQ VD V.O «3* \£> ID •X •5P o ID o VD <gi
•X -X •X
sr CO < CM ^p o •X pq •=r \o * rt o 10 rtj W 0 *p *
•X CO w CMsr 03 rtj
CQ pq * ca CJ *
•X o CJ •X o Q Q * Q w f£J CJ fV) p, f. ] •X r-, o o o o
En *
•X En En Cn En •X Pn Cn * pt4 k, Pn Pn En En •X Pn En o o o 0
CO CO co CO •*X CO CO -X COco CO *
•X 03 03 03 CO CO 03 CO CO CO CD CD CD CD
o o *
•X o o •X o o •X o o o o o o o o o o *
•X o o o o o o
o o 0 o •X o o •X o o 0 *
•X o o 0 o 0 0 0 •X 0 o 0 o 0 o
*

428
009010 5311 subq.b #1, (Al) Decrement counter
009012 660E bne $9022 Not yet run down ?
009014 12B900002564 raove.b $2564,(Al) Reload flash counter
Invert cursor phase en
00901A 08500001 bchg #1,(AO) o
00901E 6000FEAE bra $8ECE Turn cursor off
009022 4E75 rts
**************************************************** Cursor configuration, XBIOS No. 21
009024 302F0004 move.w 4(A7),DO Get number from stack
009028 6BF8 bmi $9022 Negative, ignore
00902A B07C0005 cmp.w #5,DO Greater than 5 ?
00902E 6EF2 bgt $9022 Yes, ignore
009030 E340 asl.w #1,DO
009032 41F90000904A lea $904A,AO Base address of the table
009038 DOFB0004 add.w $903E(PC,DO.w),AO Plus relative address
00903C 4EDO jmp (AO) Execute function
VO
**************************************************** Address of the routines
00903E 0000 dc.w $904A- $904A
009040 0004 dc.w $904E- •$904A
009042 0008 dc.w $9052- $904A
009044 0016 dc.w $9060- •$904A
009046 0024 dc.w $906E- •$904A
009048 002C dc.w $9076- $904A
**************************************************** o
I
00904A 6000FEB4 bra $8FOO ESC f, Turn cursor off
ii—<
****************************************************
00904E 6000FE60 bra $8EBO ESC e, Turn cursor on
i
a
E?
****************************************************
009052 6100FEAC bsr $8FOO ESC f, Turn cursor off
009056 08ED00002576 bset #0,$2576(A5)
00905C 6000FE90 bra $8EEE Turn cursor back on
*********** it*********************************** 3
009060 6100FE9E bsr $8FOO ESC f, Turn cursor off
009064 08AD00002576 bclr #0,$2576(A5)
00906A 6000FE82 bra $8EEE Turn cursor back on
**************************************************** 4
00906E 1B6F00072564 move.b 7(A7),$2564(A5) Set cursor flash rate
009074 4E75 rts
****************************************************
009076 7000 moveq.l #0,DO
U) 009078 102D2564 move.b $2564(A5),DO Load cursor flash rate
o 00907C 4E75 rts
************************** *********************** Calculate font data for character in Dl
00907E 36390000256C move.w $256C,D3 Smallest ASCCI code in font
009084 B243 cmp.w D3,D1 Compare with character to output
009086 6522 bcs $90AA Character not in font
009088 B2790000256A cmp.w $256A,D1 Largest ASCII code in font
00908E 621A bhi $90AA Character not in font
009090 207900002572 move.l $2572,AO Load font offset pointer
009096 D241 add.w D1,D1 Code times two
009098 32301000 move.w (AO,Dl.w),Dl Yields bit number in font
00909C E649 Isr.w #3,D1 Divided by 8 yields byte number
00909E 207900002566 move.l $2566,AO Pointer to font data
0090A4 DOC1
0090A6 4243
add.w D1,AO
clr.w D3
Yields pointer to data for this character
Flag for character in font
§
L5
88"
0090A8 4E75 rts 65
0090AA 7601 moveq , 1 #1,D3 Character not present in font
0090AC 4E75 rts
*************************** *********************** ascout, ignore control codes
0090AE 61CE bsr $907E Character present in font ?
0090BO 6702 beq $90B4 Yes
0090B2 4E75 rts
0090B4 22790000255A move . 1 $255A,A1 Screen address of the character
0090BA 3E3900002556 move . w $2556,07 Background color
0090CO 4847 swap D7 In upper word
0090C2 3E3900002558 move . w $2558,07 Character color in lower word
0090C8 0839000400002576 btst #4, $2576 Reverse turned on ?
0090DO 6702 beq $9004 No
0090D2 4847 swap D7 Exchange character and background colors
0090D4 08B9000200002576 bclr #2, $2576
0090DC 40E7 move . w SR, -(A7) Save status
0090DE 61000160 bsr $9240 Calculate new position
0090E2 22790000255A move . 1 $255A,A1 Screen address
0090E8 303900002560 move . w $2560,00 Cursor column
0090EE 323900002562 move . w $2562,01 Cursor line
0090F4 61000252 bsr $9348 Calculate relative screen address
0090F8 6732 beq $912C
0090FA 303900002554 move . w $2554,00 Number of bytes per character line
009100 COC1
009102 22790000044E
009108 D3CO

mulu.w
move . 1
add.l

01,00
$44E,A1
DO,A1
Address of the screen RAM i
a
00910A 4240 clr.w DO
00910C B27900002552 cmp.w $2552,01 Compare with maximum cursor line
009112 640A bcc $911E
009114 D2F900002554 add.w $2554, Al Plus number of bytes per character line
SB"
Abacus Software Atari ST Internals

O
CM
rH
G —
o
-rt CO
4J CO
-H C
C
-H
rH

H q U
O 01 CO
ca 4j ca ca 01 0) CO
M ca ca G P >-< M
CO -H CO O O
4-1 tji ^ co ca O ca
co CO TJ R 4->
-H (H T3 -H ca 0) 1-4 t-l
til •P o CO
CO <g
rH
p.
O CO O O O
co ca ca 4-1 o
ca >H s-i CO
cd CO O p p cu
CO 03 CJ CJ PS o

p- ft
rH
1 Q
1 PS
rH O rt O CM CJ VOVO co CM
ft amvovocj P- P- Q
•^v «* in in in ^ IOLO
rH CJ r H r H O H - C M C M C M H - V Q W C M C M CM o CO CM CJ CO CM CO rH rH W CM rH
Q CM Q Q C O ^ - C / > « - i / > —» i n r H - C / > < / > Q Q Q P- Q P" O Q Q O p- *C Q

$2!
#1,

$21

*. i—1
movem.l DO-

DO,
movem.l (A"

#2,
Dl,
Al,

rH en *o> en rH CM rH CO rH CM CM
Q Q Q •U3- * Q Q Q Q Q

move.w
move.w

move.w
move.l

move.w
$9:

$9:

S
$93

i& si
bset
bset

• CO OH
•a <B X) > ra
rts

X) A CO -g1 rH
TJ JH
fl xi ca ig ca
ei 2 O •Q ca
ca ca
P o S
#1,

CO g CO g CO
(A"

bsr
bsr

beq
moveq.l #0,

asr.w
08F9000100002576
08F9000200002576
move.w

178 3 4 7 9 0 0 0 0 2 5 7 E
132 33C000002560

164 36390000257C
12C 23C90000255A

138 33C100002562

610001DA
11E 48E7C040

03
128 4CDF0203
124 6100025A

en o
0 o
o
6714

0
4E75
122 7200

162 E242

rH rH
13E 44DF

rH W 0 CO CM CO CM rH rH CM CM
CO O -5P 0 «i o VO CJ O <T
CM O SP O CO rH CJ VO CO CM CM P- ^ CM CO
in vo en CO ^ VO O VO m co in en co ^
14E
156

< o 03< o W
146
140
142

O CM VO W O CM
rH rH m in m m vo vo P- P- r- p- CO CO
rH rH rH rH rH rH rH rH rH rH rH rH
cncncnenencncncncnencncnen
en en en en en en en en en en en en en en en en en en
0 O o o o o o o o o o o o o o O o o o 0 O o o 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 o 0 0 o o O 0 0 o o o o o

432
Abacus Software Atari ST Internals

t!
(0 05
M rH
0)

H G
HH O CD
O rH <D
O M
O O
CO
•O
C 1H
0)
fi

O
-rl n)
EH m

CM m o CO
Q Q r- 3 PQ
- m rH <H
CM CM in in in rf! *C Cft rH Cft in m
Q Q m <o w o Q Q Q — — -IO- (t, Ot Q Q
in K rH rH
rH O n rH o n in CM CM O O rH O
=*> Q Q Q Q Q Q ft, Q Q Q =tt= Q

3 3 3 3 3 3
rH 3 • 3 • •
• • X Q. • X <»
•O 13 M to
•O 3 rH O g S o
t n a > S « < D i H « O J 3 : « ( D O o o & is ,g +j 0! (U 3 Cil Q)
<a n o g o x ) ^ ? < a s « < a c ; o < d G g g S 3 (0 S H <d G W <Q G

0
c^
m
CM
w VQ 0
T in 0
m m 0
CM CM o
o O CM
o O o
0 O 0 h
o O o fci
CM
^i
en CM
^*
o cs cy* ^r
r~~ ^*
CO m
r~
in o o in o
PM CO (Y}
CM
CM
in
•sJ1
0
CO
m •a1
CM < o m r-
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 w CM O CO CM O

< O H O CM
COCOCOCOC\C^C^^Cf^<^^(^^(^^CQCQ o uo o o o Q Q
eft en cy* cyi en cTi en cjv
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
o o o o o 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
0091D4 3A01 move.w D1,D5
0091D6
0091D8
22CO
51CDFFFC
move . 1
dbra
DO, (Al)+
D5,$91D6
ste
en
0091DC D3CA add.l A2,A1 W2
O
0091DE 51CAFFF4 dbra D2,$91D4
0091E2 4E75 rts
0091E4 E245 asr.w #1,05
0091E6 4040 negx.w DO
0091E8 3A01 move , w D1,D5
0091EA 32CO move . w DO, (Al)+
0091EC 51CDFFFC dbra D5,$91EA
0091FO D3CA add.l A2,A1
0091F2 51CAFFF4 dbra D2,$91E8
0091F6 4E75 rts
*************************************************** Calculate cursor position (DO/01)
0091F8 363900002550 move . w $2550,03 Maximum cursor column
0091FE B640 cmp.w DO,D3
009200 6A02 bpl $9204 Column value smaller ?
009202 3003 move . w D3,DO Else use max value
009204 363900002552 move . w $2552,03 Maximum cursor line
00920A B641 cmp.w 01,03
00920C 6A02 bpl $9210 Line value smaller ?
00920E 3203 move . w 03, Dl Else use maximum value
009210 36390000257C move . w $257C,D3 Number of screen planes
009216 3AOO move . w DO,D5 Column to D5
009218 08850000 bclr #0,05 en
00921C C6C5 mulu.w D5,D3 Times maximum value
H
00921E 08000000 btst #0,00 5
009222 6702 beq $9226
009224 5283 addq . 1 #1,03
Abacus Software Atari ST Internals

raster line
acter line

0>
M <D H
<s
.c
o
M
O
0]
G
£
a
0) •a CO
H <U G H 0)
<U XI -H o 4->
P. 4-1 M o >i
0> 43
<D 3 in H M
01 H 0 O O >H
4-1 « <H <H o
>i > CO
43 CO 4-1 4-> H
0> CB CB ID 0)
1-4 « H CO CO43
0 -H •o 4-1 >w S
rH TS IH >H 3
M 13' O 0 c
O CO
CD 0) 01 CO CO
*£• g CO 3 3 3
3 -H a .-1 .-H rH
Z H PQ PJ CM PL,

CM CO to cj
Q r-i fj; Q r- in
i=C r— LO CM CM
** CJ VO LO r- Q o vo co c£ LO cn cn
in Q w rfj *C LO vo r- ^ Q r- Q P P - r- en r*- co p ^^ <C </> •co-
in * *P ». ». LO in in LO K in •> * * in CM CM CM CM « • . • . • .
CM iH "3" LO CO CM CM CM CM i-l CM tH SP rH rH cn cn en en o CO CO LO CM VO
«• Q V> P Q CO- to- to *> * CO- =tt= P •CO- =*= P

S S H
• • <-t <-\ *. s. >. ?. s. >. s. 1 1 H o- (f *• > S.
0) 3 <U • • • Q > < D Q ) C r ( U c J 1 C U Q ) ( l ) " 4 J <D Q J C U ' l d c T i d
J> "H r* *O w *O 01 > > > 4 3 > 4 3 > > > H c o t r o > < a « > > T 3 H > O > H C O
O 3 O TJ 13 T! 4-1 O O O 3 O 3 O O O C 0 4 - 1 C B O O H O O O ' O . Q > O 4 3 4 J
£ E S <a id m H g g S c o g o i e e S i a 4 3 4 3 4 3 g 4 3 4 3 g e i a : a i d t 3 M

o
E

H H H W
in LO vo r- sp t—
in in m in LO
CM o CM CM CM CM CM
o o o o oo O PL, < CJ
o o o o oo O O PL, P
o o o o oo O O PL, fr,
o o o o oo O O CL, PL,
en in co cn in en en en
r- o O fa r- r- r- co
CM ro co CM Pd
CO CJ CM P P P -=r co co co
vo o vo oo M O VO CJ
CM CM CM ro
CM CM CM CM CM CM CM 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 cn cn cn cn cn en
o o o o o oo o o o o o o o o o o o o o o o o o o o o o o o
o o o o o oo o o o o o o o o o o o o o o o o o o o o o o o

435
Abacus Software Atari ST Internals

d at old position?
th maximum value

maximum value
(3
>H

value
(1)
3 H
rH O
01
> q H
-H _«~j g P 0)
3 g 4J
-H
e 3 0)
G
O
M
3
c i e O -H <D
g -H -H O (—) 4S £>
3 X 0) X £J
rH 10 C <a rt ^1 -H
M O g -H O O HH
0 0 C1* rH C*i 01 01 O ^1
01 0) CD (H
^1 0)
M 0) £_l 01 (D M 01 3 3 0! 4-1
3 CD £J <B 3 O 0 ta O
0 (0 rH <d a> <0

4-1 tm rH CD
01 §•
rH
<a
(U
ta
(V
> s m
o

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

O VO o 0 o rH rH 0 CM o
CO m CO cn m Q Q Q O vo VO
CM CM Q in CM CM m m 0 o
cn cn cn rH cn O o CM CO CM CM CM vo CM o
— < < «• < «- in in m o in Vt t— •••^ rH —
— * to CM in in CM in CO CM
<C co CM in CM vo
— < < Q =tt= Q
<=c
•*-*
CO
Q
CO co CM in
Q '-C Q
CM vo
Q *
CM
•O>
cn CM
</> vt
CM
Vt
cn
</>
CM o
Q
rH
Q
CM CM cn o cn
</> </> =*=. vt
* * *
*
Q £$ |5 * 3= 3 3 3
• rQ
• 3 • *
•K Jj 3 • •
J^
QJ • • {Q Jj* (d CD <8 0) 4-1
> t3 T3 ^ T3 M 05
O ID t? & T3 £l -p O
4-1
O
>
O
•o
•0
•o T> ^Q
•8t!1 2
O
01
j\
*
*
a,
£
01
rH o
G.
g
01
rH
§ g > id
O O O cu
4-1
01
j1
tr
01
01 cr
i) w
£ (0 (0 t3 (0 'O j-i e S <a a T3 <a •o * U 43 g U 43 g g g rH Q 43 J3 43
*
*
*
*
*
*
*
*
*
* 0 o CM CM o CM VO
* m m m in vo VO E —
* m m m in in in in
* CM CM CM CM CM CM CM
CO *g* •a1 * o o 0 o o O o CM O
p£4 O CM co * o o 0 o o O o O o
pn, * o o o o 0 0 o O 0
fa [v. * o 0 o 0 0 0 0 0 0
<=T CQ r< Q C^ M to ^p CO CO m Q cn pq m * en vo cn cn vo cn 0 rH cn 0 CM o
o> o c_> O -^ o r- rH O CO 0 o
^ O •sp O r~ * r- 0 CO E-- o CO o O rH CO rH ^
o
<^ <C CO (H ^J1 (H H VO VO
(^ *^« CO rH "S31 rH H * o co o CM co CM co CO rH CO r— CO c-
rH Q Q LO tO IO <=P rH ^J1 rH o Q in m m * m co vo co co co •a* 0 vo 0 vo
*
•31 VO CO rfj &} O ^ VO CO rij p£] 0 «3»
o VO f£ * £_> CM ^i < 0 CM CO M •a1 fg [V} O *?
CQ CO 00 QO CQ CT) O*l cn en cn en en (^ rij ££ fS; * r^ CQ CQ m O O O O Q a Q [V] [V)
CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM CM * CM CM CM CM CM CM CM CM CM CM CM CM CM
<y* <r\\^ ^ cn cn cn cn cn cn cn cn cn * en cn cn cn cn cn cn cn en cn en cn cn
o o o o o o o o o 0 0 0 o o o o * o o o o o o 0 0 o o 0 0 o
o o o o o o o 0 0 o o 0 0 o o 0 * o o o o o o o 0 o o o 0 0
*

436
Abacus Software Atari ST Internals

line of the character


f the cursor position
sition

at cursor position
sition

f the character
•a
o

rsor position
0 CD
VI Q, 01 Vl a

raster line
O 01 O J_)
01 Vl CD 01 VICD
Vi 0 Vi o [>
3 0] -a 3 01 p;
Oi 01
01
0 T5 U VI -H d)
3 IB 3 di
•o O d! O 01 CD -H G -H
rH M .G -H
O 4-1 O 4-1 4-1 -H rH
IB 01 IB VI 0. VI
1-1 VI 1-4 CD 0) CD rH
o Vi 3 O J_| 4-1 3 o Vl G 0) M
4-1 o CD
CD 0 d) O U CD CD Vl CD 01
^ 4-1 §
01 4-1
Ol O
CD IB
01 4-1 IB
3" Ol O VI
d> CD <B IB CD
01
01
CD
ts IB
CD
VI
U
O
01
0)
G
d) d)
VI 4J
0 G
IB ra
to
CD
CD
01
d>
c
-H di
rH

Vl Vl G Vl Vl A G Vl Vl 01 IB 3 01 3 VI VI IB VI G
•o IB •a IB 0 T) 10 O O O •a Vl 0 d) d)
•o CD •a CD •o Vi 1-1 0 M-l O •o 4-1 d)
IB O 4-1 IB 0 VI 4J IB u (!) O 0 <B IB 01 Vl
IB 0 10 P. rd IB Vi VI 10 0
G 4-1 rH G 4-1 1-1 rH G 4-1 4-1 Vl VI VI CD G 4-1 d) VI 01
d) U
CD Vl
CD 0)
rH
3 d) Vl
O CD d) tjl
VI <B
3 CD
O CD
rH VI
M
CD
£* 4-1 -H
01 f.
€ g
€ 4J CD
G CD
3
G
J> -H X
4-1
X
O (^ IB O G rH IB U G CD 01 3 ol O O G O 0) CD
CO M CJ w M Em CJ Cfl M P3 *C rfl O CO M CM 13 53

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

vo CN 10 CO
m p- in Q Q ro ro
0 0 in m o m ro ro
w 00 CM CM CO CM w W ^P CJ \o m sp cn rH cn
o m in- Q P- Q Q
*—1 in m
s s cn cn in

~
CM CM CM CM CM rH CM rH rH CN CN
*
rH
=*= =»= =»= Q Q Q

rH rH
* S *
fi s rH 3
* cr . .
Vl 4-1 d! CD 4-1 4-> CD CD d) & d) CD CD IB tf <0
01 cr > Vl VI > VI CD 01 d) M > 01 * J> > > .p •a Vl •^3 Vl 01 *
o CO O 01 4-1 01 0} o 4J * 0 0
_Q
3
^
0 ^
0 0 0 •a "0 *
%
CD
rQ
O
£
01
X)
01
X) Vl £1 g Vl *
*
01 g
3
01 G € IB =§
4-1
Vl *
*
* *
* *
* *
* *
ID * *
p- * *
m * *
CM * *
fiC f^ o
o
rfj * pq
* r~
E3 O
r-
*
in in m ^P *
m in o m *
•£ m m m *
CM CM o CM CM CM CM *
CM rH o w o CM CM •31 O * o o o f^C 0 *
O O o o 0 O H o * o o o (Vj *
O O o pi) o o O o * 0 o o Cti Em *
O O o Em o o o Em o * 0 o o fo Em *
O o H cn V£ O cn cn m o O en m * cn cn ^ en vo cn •31 /•£ Q cn in *
cn rH rH P- CN o CJ r^ H Em P- Q O O * r- CO *3* CO sp ^
O
1
^p rH o O S3i CJ P- *
CO 00 t— CM (—4 (—1 ro rH CO w CO rH ro w * ^i CO CO CJ ro 03* CO ^0 CO rH Q!
rH w *
o O VO CM VO 10 CM VO o ^p o VD CM * ro ro in ro in CO CN Q m m m •a1
•SP *
* *
10f^ pq
[V] o V£> 03 O CM •31 CJ M CM 10 CJ * pq sp < CJ CM •31 VD CO
f^ o o CN ^o *
w W f T| o o
Em Em [V, O 0 rH rH rH * rH CM CM CM CO CO CO CO ro ro SP •3* -ft
*
CM CM CM CM ro ro
CM CM CN CO ro ro ro CO * CO ro co ro ro ro CO CO ro ro ro ro ro .£
en cn cn cn cn cn cn cn cn cn cn cn cn cn * cn cn cn cn cn cn cn cn cn cn cn cn cn
o o o o 0 0 0 0 0 0 o o o 0 * o o o o o 0 o o o o o o o *
o o o o 0 0 0 0 o o 0 0 0 0 * o o o o o o 0 o o o o 0 0 *
* *

437
Abacus Software Atari ST Internals

racter line

line
racter
rH
Q CO
di
Q) G 0)
-H G
-H rH -H
rH ca K rH ca
G 4-1 a o O OJ o
ca a>
3 a> $-1 ^4 4-1
^ Q) H
rH G (D 0) G Q)
O Q) 3 o ft g
in -H Q,
O G O 01 O rH
O 0) •o 01 3
J_l
en
0) CD CD G 01 0)
O 01 M c 4-1 01 o -P
CO C O CD 4-1 >, <U W CO
M -H CO CD Q
o G rl o
3 1-4 -o -H 3
O O o m >-, •a rH O MH
O CO o rH ia O
g O CO ft 4-1 g
1H rH CO j_i CO 4-1 c 3 r4
0) rH 0! QJ -H T3 0> 01
•H O"i 0 4-1 rH -H
x
KJ rH
cd 01
fl) 3
r4
O
•S
T)
rH
3 3 -H
<U S-l
3 *a
"I
3
S fc. SH S3 co 53 S U s 53

************
CO
<

co
"3
o co rH CO
o Q CO Q CO Q a
in Q
0 CM CM w co 0 0 o rH O CO co rH co CM
in VQ m Q Q Q r- f- Q Q PJ in Q co in m
in CO
CM
*.
en CO en CO
CO
rH rH O
co
en
k.
rH CO
m
CM rH rH
IK
co co *
^p m
CM
K
rH
< rH
m in
CM CM
to- =tt= t/> Q =«= =tfc =H= •CO- =8= Q Q a * ^ t/>
to- Q 0 Q to-
* * *
i-H *
|5 [5 U 3 * rH 3 3 3
3 J5 tf • • u • 3 3 3 * 3 3
ft 0)
c
4-1
01
4-1
a>
c ^ 4-1
rH
CO CO
O 4-1
•§*
•s
4-1
IT 1
CO
eu •o rH
4J ^
•S CO
4J
£o rH
0!
S •a
3 •o rH
CO
4-1
*
*
*
>
o
a>
0
3
rH
3
cd
0) (U
•a
•o o
i
0 43 43 43 O M g cd 43 43 cd 0 g cd CO ca 0 M * g g g rH G cd g
*
*
*
*
*
vo
r~ *
m *
CM *
o O u
r^
* H •rp CM ^p
in O * m m in
m O m * ^r in m m
CM O CM * o CM CM CM
0 CO o o * o o o O o
0 o o o * o o o O o
o o o o * o 0 o 0 o
o o o o * o 0 CO 0 o
en CM en ^* CO in rH m o o vo en CO m en co CO CO co in * en en rH CO rH en en
r~ rH o *rp (—
CO O E— «^i o 0 "S31 ^p r^ co •rP <? o "S31 r- * c— co CJ f-r. •S31 c- CO
O VO vo CM W
CO VQ W CM 03 r^ CM CM W ^D co CO CM CM P^-] * vo vo VO r- •SP CM vo
CQ to o VQ *rp *3* t— ^p in O m
VO co W m Q •C1 SP * CM CO 0 Q CO
*
CO w o CO rij O W 0 CM •3" 03 (^ O W o vo 03 f£ O E*3 * 0 vo O p£] CM <=P PJJ
<p m
«rP in m m in VO vo VO VO vo VO vo r- r- r- p~ r— f * CO CO CO CO en en en
CO CO
CO CO CO CO CO CO co CO CO co CO co co co co co co CO * co co co co CO co co
en en en en en en en en en en en en en en en en en en en en * en en en en en en en
o 0 o o o o o 0 o 0 0 o 0 0 0 o 0 0 o o * o o o o o o o
0 0 o o 0 o o o o o o o o 0 0 0 o 0 0 o * o 0 o o o o o
*

438
>
0093AO 45F33000 lea 0(A3,D3.w),A2 Yields address of line 1
0093A4 C6C1 mulu .w D1,D3 Number of bytes to move I
0093A6 E443 asr .w #2,D3 Number of long words
0093A8 6002 bra $93AC
0093AA 26DA move . 1 (A2)+, (A3)+ Copy screen lines
0093AC 51CBFFFC dbra D3,$93AA
0093BO 323900002552 move . w $2552,01 Maximum cursor line
0093B6 3401 move , w D1,D2
0093B8 4841 swap 01
0093BA 4842 swap D2
0093BC 4241 clr.w Dl
0093BE 343900002550 move . w $2550,02 Maximum cursor column
0093C4 6000FD92 bra $9158
*************************************************** Scroll screen at line Dl up
0093C8 26790000044E move . 1 $44E,A3 Address of the screen RAM
U) 0093CE 363900002552 move , w $2552,03 Maximum cursor line
^ 0093D4 C6F900002554 mulu.w $2554,03 Mult by number of bytes per character line
0093DA 47F33000 lea (A3,D3.w) ,A3 Yields address of last character line
0093DE 363900002554 move . w $2554,03 Number of bytes per line
0093E4 45F33000 lea (A3,D3.w) ,A2 Yields address of line 1
0093E8 3001 move . w 01,00 Current line
0093EA 4440 neg.w DO
0093EC D07900002552 add.w $2552,00 Add maximum cursor line
0093F2 C6CO mulu.w DO, 03
0093F4 E443
0093F6 6002
asr.w
bra
#2,D3
$93FA
Divide by 4 for long word transfer I
2.
0093F8 2523 move . 1 -<A3),-(A2) Copy screen lines en
H
0093FA 51CBFFFC dbra D3,$93F8
0093FE 60B6 bra $93B6
rt
3
Abacus Software Atari ST Internals

|
|
C 102, initialize font parameters
G
CD
CO

by maximum character width


ight, height of a character
rH
O

bytes per character line


en
CD

maximum cursor column


.G 4-1
4-1 G 4-1

maximum cursor line


O G 4-1
s of the font header

<*H O

height of character
0 MH 0
CU MH CD
CO ,G G rH
r to INTIN array

a) 4-1
per screen line
4-1 -H G iQ

width in bits
G A -H <fl <8
•M CU 4-1 4J
rH -H 0 T! Q) <0
a) O •C T3 4-1
fi O O CD
CD O 4J 03
4J 4J SM
O3 G -H M M O 4-1
<fl O 3 O M IH O
t, *M to O
- < CO O O
4-1 >1 < 4-1 4-1
0 £1 4-1 4J
rH •a 01 4-1 M rH
to a) 01 0> G 03 H CU 03 G CD 01 -H 0) 01 CU CU
W 4-1 0) fi CD Ol 03 'C Q) *c3 03 T! CO t3 01 •o IS rH (U 4-1 4-1
en G G
G 0) CD rH
•S "H pG CD
'—I 0) -rH P rH g rH
H -H T3 iH £_l 4-1 g CD M £* G 0) in <d >H -H -H
Q O T3 0 0) -H -H P -H -H -H O -H -H -H 0 g (0 O O
> PJ < MH g CQ EH >H & Q S >i CO D S >H HH CO rJ CH CM

H CJ 10 CM
vo IQ
LO LO LO LO LO
o rH CM CM CM CM CM
J O Q w i-H •3"
LO
CM
LO
Q o
LO
rf! *" LO LO LO LO
^
* 00 ^
o CM w CM rH 03
Q Vt Q
CM rH o O rH CM 0 0 O 0 0
Q Q Q Q
LO LO !—
f. * * * * * A

CM CM O CM 0 rH O CM O rH O CM CM rH rH o CO IQ CM
CO Q </> Q Q Q =tt= Q =B= </> LO Q CO CO ro
rH
rH S S 3 S 3 rH rH

CU 0) p CU CU CU
*
*
01
O
>
O o
>
O o
rH
P
0)
0 O
> g
O -H
g
P
>O o >
O -H
g
Sp O >
o o §
0)
> 01
O 0 O 4-1
*
* g g g g g g g g g •a 01 g g g T3 01 g g g g g g H
*
*

*
*
* w o fjj
vo vo 10
10 CM
vo r-
*
-X LO LO LO LO LO
•}( CM CM CM CM CM
*
*
•3*
00
H
^r
w
r^
^J*
LO
CO
r~
CM 0 0 000
o O o
0
O
0
0
LO LO
* LO LO LO LO LO LO r—
LO LO o o 0 O 0
* CM CM CM CM CM CM CM CM o 0 o O o
* O CM O o O O O O ^p O <=T VO o O 00
* O LO O o O o O O ro O LO CM CM ^3*
* O O o o o o 0 O 0 0 00 o O 0
* o o o o o o O o o o O 0 o o O
* en 0 CO o en O rH O en o rH rH o en CO rH rH CO CO CO 00 CO LO
* [^ LO CM o ro oO o co U ^P CJ o ro Ed ^31 CJ pq Ed Ed Pd Ed r~
* o 0 O CO CM CM CM CM CM ro ro CM CM CM co ro CO ro CO ro n M
* CM CM ro CO CO O ro f^ co CO LO ro r^ ro CO LO ro ro ro CO CM CM
*
* O VD CO CJ CM CO <C O CM CO <C O CM ^p r3* w o XD Ed ^O H IO Ed
* O 0o o rH rH rH CM CM CM CM CM ro ro ro ro ^r •3* sp LO LO U) vo
•K ^i •31 ^1 «5* •5P ^i ^31 ^* •5T» •31 SP *3* ^i ql *sP ^i qi
•fc en en en o>
^
cn ^en1 «^
^ en en en en en en ^en* en ^ en en en en <n en «n en en
* o o o o o 0o o 0o 00 00o 0o o o o 0o o
* 00 0o 0o o o o o o o o o 0o 0o 0 0 o 0 o

440
Abacus Software Atari ST Internals

4J

Set parameters for scren resolution


C 0
O m

As screen address of the cursor


HH
0

conout vector to standard


-H CD

Character color to black


CD 4J
o
Initialze screen output

0
+J
01
01

CO
CD
4J
s co
§
01 rH 01 id -H o o
CD vo 4-! ft 4J
Replace with 2 (high resolution)

rl C CO rH id o TJ 0
R O X X •a -rl CD 01
c; <d CO CO CD 0 n
CD 4-> 4J O <a
•a

LE,$2565 Cursor flash counter to 30


0 0 CD CD H id M 0
!H -H 0 O fi N fi rH rl
O 05 +J O "M O O
3 in 3 CD 01 o CD
-H rH HH CD •o rH c HH id HH a>
o er>
High resolution ?
X! 0 rl 0 N O -H O O H
•o CO -H O rH 01 HH u
CD CD 0) 01 m H o 01 rl id 0 01
4J 01 01 Id rl SH 01 rH rH
HH o CD CD -H O 0 CD 0 O HH M
-H 4-> 01 01 0] 0 id
rH
0
g
(d o
-H o
id
rl •8
•o
4J rl 0 CD
01
01
01
M CO
0
w
<D 1
1 M CQ CJ
3
o
CD
co O
CD
W
0 H
CO CJ
if*************

PFFF,$2558

3AEE,$4A8
O o , $255A VO rH
o vo O CM vo in CM a H- CO
O r- Q in vo vo m o r- CM CM
Q < vo in m m m m fa O (—
, DO

, DO

o CO H- o CO 0 CM fa
75A

O CM CM CM CM CM CM
CJ Q Q Q fa en O Q W 63 fa
vo vo CO
******>

J—1
CO co fa CM o fa rH CM fa rH en o 0 o 0 o 0 rH rH O
=*> Q =8= =tt= =s= Q Q Q Q =tt=
* Q Q
* *

XI S
] rH
-H rH X) X! X) rH rH

*
* o g T3
g
CD
C
g
O
g
O
w
01
io <d
CD
a
s
o
CD
C!
id
CD
M
01
g
o
fO g
0
g
O
gO g
O
g
o
g
0
go g g
0 O O 0 O »o O
g
CD
g id g 01
4J
*
*
(d o Xi g X! e rH rH X) g g S S g g s g g g S g e •a s
* CO
* <c
*
-K ^p
o
* CO vo m "W CM o
* in e— VO vo CM o
* m in m m ^P o
* CM CM CM CM CM o
* o f£ VO o vo o CM P£j w o o O O
* o o in vo VO in m
^ o o o O [V]
* ^p w
^ a\O o in m m in •sPm o o o O (CJJ

* o r— o CM CM CM CM o CM o o o o CO
* o co CO CM [V] rHCM rH ^31 fa 0 o o o o o rH fx] rH fa o o
* o o 0 O r- O O O rH fa 0 o o o o 0 O rHtH O CO fa o
* o o o O o o O O Q fa o o o 0 o o 0 O 0 0 fa fa o
* o o o O o o o o on o o o o o o o O 0 o rH fa o
* en CJ CJ ^1 0 O o fa en 0 VO en o o O o o o o en CO CJ o o o O 0 en o in
* co F— o o o rH fa r- o fa o fa o o o o o r- CJ fa fa fa fa co CJ fa
* o O 0 vo 0 fa rH 0 rH o vo rH rH co o CO co n ro o co n CO CM o rH CO 63
*
•X rH U m vo co CO VO co ^P ffl vo ql VO co r- CO CO CM CM rH rH rH CO co CM in CM qi

* ^P f£ ta CM S31 CO rtj p£J O vo ft. O CM vo W [V] «qi 0 vo O CM CO o <T o ^p CO £*•) CO



* CJ CJ CJ Q Q Q Q Q w w w W fa fa fa rH CM 0 o 0 rH rH CM co co ql ^ «^
3* sp
r~ [—
m
VQ VQ VQ VD VQ VD vo vo vo vo vo vo VO vo vo t— r- r-. t— e— f-* t— t— r- r- r- r^ r-
* fa fa fa
fa fa fa fa fa fa fa fa fa fa fa fa
fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
* O O o o O O o o o o o o o o o
O O o O o o o O 0 o o 0 o o 0
* 0 0 o 0 0 0 0 0 0 0 o 0 0 0 0 0 0 0 0 0 0 o 0 o o 0 o o o o
*

441
Initialize screen output
OOF75A 7200 moveq.l #0,D1 DO contains screen resolution
OOF75C 123B0030 move . b $F78E(PC,DO.w),Dl Get number of screen planes
OOF760 33C10000257C move . w D1,$257C And save
OOF766 123B0029 move . b $F791(PC,DO.w) ,D1 Get bytes per screen line
OOF76A 33C10000257E move . w D1,$257E And save
OOF770 33C10000257A move . w D1,$257A
OOF776 E340 asl.w fl,DO
OOF778 323B001A move . w $F794(PC,DO,w),Dl Get screen height
OOF77C 33C100002578 move . w Dl,$2578 And save
OOF782 323B0016 move . w $F79A(PC,DO,w),Dl Get screen height
OOF786 33C100002570 move . w Dl,$2570 And save
OOF78C 4E75 rts
************************************************* Screen parameters
OOF78E 040201 dc.b 4,2,1 Number of screen planes
OOF791 AOA050 dc.b 160,160,80 Bytes per screen line
OOF794 OOC800C80190 dc.w 200,200,400 Screen heights
OOF79A 014002800280 dc.w 320,640,640 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 The System Fonts


4.2 Alphabetical listing of GEMDOS functions
Abacus Software Atari ST Internals

4.1 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 8X8 System Font 8X1 6 System Font
0. "1 Ul
•<» III a. ^<D III
O . . ^~
*-"
O »> c 0.
2 ft Ul o ih c ^^
Z * « r « u 3E CO. U>
z: SH -e-
J X <» z > ~-ti• ^-H
>• ' ' *{~\.
*^
X • <9 _l « «e> 2tf O K3
tQ
~J !3 C
M ;o • ^
-5
^
:D c "i :=J Ci
*-i :o a HHI IO CD
i :n « 2C ZZ3) KDl
o <a r» X :3i id CO /3 >*
u. a 4 13 o t- Ll— O li.
u x> « U. <3
UJ /O O
O :0 M LJ •0 tt ca :o IN
u <o P O :o M C-3 <O IP
m m f. U <o 03 *M f_
I N * CO PH
c $ ca cc f« ca
Cl
f
U
.0 s
B
ei •u S <a HJJ a
A :a < f- •« C" oec 8
n ** % A :« f /S XE <
V »• > II .H II /»^ *O>
« :•« r V <« «* V <«i S-
••^ JrHI ^^
* p •« Jrt r ~~ /Gl ^3
p :«i r •«l
P cr» :eu r—
0) *^ ^ G* "Of
r- CO <GJ •—
P- U R 03 id
P*» CJ> C^|
ID -1 a N V C UQ *rn 53
M '1 r to •4
in /*o r™
« :<i R. in -n r *^^ z*o ^^
m •' a :<g ft
ru -' n *
M <<i 71 M <<a 01
CM •0 n CM ^GJ CT
'.3 q ^^Hl IZ3 «^l
(9 U 9 H :3 a C3 O D
V C r O Oi D ••w rf*i ^^
t f X, o n ^s» %! ^»
1 « f / C
|
- 2
f*^ JX
S3
i — n 1 <"» r ^. '"* • n
+ v r n •+• Sr^ r
X N 2 +* w r
3fC M E3
« 31 P N a j«~»i zn cz
*« X 1- «
*
w
31 P
r *-* x •—
% 3 ~ X
<* > rr 3
x o r- •a » C e*£J
X
I> HZ
3 1"*
w •• n X 3 r <U> ^^ f^;
» « n <o f «
t t X VI n a w n
(J s> • L X « C« 7C
a - a P — • cr PD
x o t o. :?
x, c o 2) o a C—
».
'*
fe,
° IHJ
Q P*
n t ® *i e c o
(<
a
-.
£
51
C r* 0"
C •-I o»-
UW J^J f-
0 -1 • uf J£
ro •—) \« ,-_a •
IT " : O •^ s
•a £ to ff>
efghi

p- m M CO '(0 OO JC JO
ja »• •« i« C" en tec
m <> e UQ H- /CC
J D 0 •2
ifl
•«
y to GJ fcj
fll u » •u 1 y -a ^B
ni x> sj m u s rr> u to.
ru .a na f\J £} 1S^
•*
o » n
fl SO
A to ™" ia jo
- . 1 * 1 0 / it C3 / jro
=5 < * n 1 -•^ 1 A 1
rf n — a ~*
=^ < § i -v < V «
W Ir^TI "^™ ftl
£ S f a £ n '"• W
S-
^ -JB \»* _,
!«.•• -^ r^T C
"» M .« •> /
<•• N r . s LJ -S " S* ",
0 > t. • N ^ r V *4» INJ r •
S X .-> » * > u • 0 >• i. •
« 2 01 it ? X •o • *>• >e ••& o
S3 3C OI U
RSTUUW

K > 41 •!• Oi ()

+
t
3
1-
W
12
1C
--3
-,
<-
VI
| m -i-
tZ -3
tc «-
K 3-
iv< =j >z — 3
V •— «= <=—
<PI -1-

-> Of -0 M •3 v| A 1X1 *3 VI
«• a •«• « •0 A| O cz: ^o /M
£ O «H +1
^H C3 *«^ 4"!

446
Abacus Software Atari ST Internals

4.2 Alphabetical listing of GEMDOS functions

Name Opcode (hex) Page Number


Cauxin 03 106
Cauxis 12 111
Cauxos 13 111
Cauxout 04 106
Cconin 01 105
Cconis OB 110
Cconos 10 111
Cconout 02 106
Cconrs OA 109
Cconws 09 109
Cnecin 08 108
Cprnos 11 HI
Cprnout 05 107
Crawcin 07 108
Crawio 06 107
Dcreate 39 117
Ddelete 3A 118
Dfiee 36 116
Dgetdrv 19 111
Dgetpath 47 128
Dsetdrv OE 110
Dsetpath 3B 119
Fattrib 43 126
Fclose 3E 122
Fcreate 3C 120
Fdatime 57 137
Fdelete 41 124
Fdup 45 128
Fforce 46 128
Fgetdta 2F 115
Fopen 3D 121
Fread 3F 123
Frename 56 136
Fseek 42 125
Fsetdta 1A 112
Fsfirst 4E 134
Fsnext 4F 136
Fwrite 40 124

447
Abacus Software Atari ST Internals

Malloc 48 129
Mfree 49 130
Mshrink 4A 131
Pexec 4B 132
Rerm 4C 133
PtennO 00 105
Ptermres 31 115
Super 20 112
Sversion 30 115
Tgetdate 2A 113
Tgettime 2C 114
Tsetdate 2B 114
Tsettime 2D 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
BCD—see 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
BIOS—see Basic Input Output System
BLANK, 15
BR—see 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 FilePro
Designer The electronic
Create printed circuit board layouts filing system
for the ST

Features: Auto-routing, component Word processor for the ST


list, pinout list, net list

PCBoard Designer ST TextPro ST FilePro


Interactive, computer-aided design Wordprocessor with professional A simple-to-use and versatile database
package that automates layout of features and easy-to-use! Full-screen manager. Features help screens;
printed circuit boards. Auto-routing editing with mouse or keyboard lightning-fast operation; tailorable
with 45* or 90" traces; two-sided shortcuts. High speed input, scrolling display using multiple fonts;
boards; pin-to-pin, pin-to-BUS or 8US- and editing; sideways printing; user-definable edit masks; capacity up
to-BUS. Rubberbanding of components multi-column output; flexible printer to 64,000 records. Supports multiple
during placement. Prints board layout, installation; automatic index and table files. RAM-disk support for 1040ST.
pinout, component list, net list. Output of contents; up to 180 chars/line; 30 Complete search, sort and file
to Epson printer at 2:1. Pays for itself definable function keys; metafile subsetting. Interfaces to TextPro. Easy
after first designed board. $395.00 output; much more. $49.95 printer control. $49.95

AssemPro
The complete 68000
assembler development
Combine graphics package for the ST
with your text

STForih/MT STPalniPro ST Text Designer ST AssemPro


Powerful, multi-tasking Forth for A GEM™ among ST drawing An ideal package for page layout Professional developer's pack-
the ST. A complete, 32-bit imple- programs. Very friendly, but very on the ST. Accepts prepared text age includes editor, two-pass
mentation based on Forth-83 powerful. A must for everyone's files from TextPro or other ASCII interactive assembler with error
standard. Development aids: full artistic or graphics needs. Use wordprocessors. Performs block locator, online help including
screen editor, monitor, macro up to three windows. Free-form operations— copy, move, col- instruction address mode and
assembler. 1500+ word library. sketching: lines, circles, ellipses, umns. Merges bit-mapped GEM parameter information,
TOS/LINEA commands. Boating boxes, text, fill, copy, move, graphics. Tools to add borders & monitor-debugger, disassembler
point and complex arithmetic. zoom, spray, paint, erase, undo, separator lines, more. Available and 68020 simulator, more.
Available Sept. '86. $49.95 help. $49.95 September -86. $49.95 Available Sept. '86. $59.95

ST and 1040ST are trademarks of Atari Corp.


GEM is a trademark of Digital Research Inc.
_ IZZXZ9, T TT TTII ^f^ ^

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
Li\r pages

rtt 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 Multiple
windows
For creative illustrations on the ST

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 STB.flinn.r-.Guid. ST INTERNALS GEM Programme*! R«f. MACHINE LANGUAGE ST TRICKS & TIPS
Gives you an in-depth look at Written for the firsthand ST Essential guide to the inside For serious programmers Program in the fastest lang- Fantastic collection of pro-
this sensational new user. Get a basic understand- information of the ST. needing detailed information uage for your ATARI ST. grams and info for the ST.
computer. Discusses the ing of your ST. Explore Detailed descriptions of on GEM. Presented in an Learn 63000 assembly lang- Complete programs include:
architecture of the ST. work- LOGO and BASIC from the sound and graphics chips. easy-to-understand format. uage, its numbering system, super-fast RAM dish; time-
Ing with GEM, the mouse, ground up. Simple explan- internal hardware. I/O ports. Afl examples are in C and use of registers, structure A saving printer spooler; color
operating system, all the ations of the hardware and using GEM. Commented assembly language. Covers important details of Instruc- print herdeopy; plotter output
various interfaces, the 68000 internal workings of the ST. BIOS listing. An Indispen- VD1 and AES functions. No tion set, and use of internal hardcopy; creating access-
chip and Its Instructions. [[lustrations, diagrams. Gloss- sible reference for your ST serious programs? should be system routines. Geared for ories. Money saving tricks
LOGO. 2QQpp $16.95 ary. Index. 200pp $14.95 librwy. 450pp 519.85 without 410pp $19.95 the ST. 260pp $19.95 and tip*. 260pp $19.05

ST GRAPHICS A SOUND ST LOGO GUIDE ST PEEKS A POKES BASIC Training GuM* BASIC to C 3D GRAPHICS
Detailed guide to graphics Take confrol of your ST by Thorough guide for learning Move up from BASIC to C. If FANTASTIC) Rotate, zoom,
and sound on the ST. 2D & learning ST LOGO—*he easy the examples found within ST BASIC programming. you're already a BASIC and shade 3D objects. All
3D function plotters, Molr6 to use. powerful language. this book. Explores using Dataled programming funda- programmer, you can learn C programs written in machine
patterns, graphic memory Topics Include: file handling. different languages BASIC. all that much faster. Parallel language for high speed.
and various resolutions, recurslon-HllbBft ft Sierpinsk! C. LOGO and machine tions. ST graphics ft sound, examples demostrate the Learn the mathematics
fractals, recursion, waveform curves, 2D and 3D function language, using various using GEM in BASIC, file programming techniques and behind 3D graphics. Hidden
generation. Examples written plots, data structure, error Interfaces, memory usage, management, disk operation. constructs in both languages. line removal, shading. With
in C. LOGO. BASIC and handling. Helpful guide for reading and saving from and Tutorial problems give hands Variables, pointers, arrays, 3D pattern maker and
ModutB.2. 25Cpp $19.95 STLOGOusars. $19.95 to disk. more. 28Gpp $16.95 on experience. 3QOpp $16.95 data structure. 250pp $19.95 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.

You might also like