Atari ST Internals

472

Click here to load reader

description

All you need to know about the internals of the famous ATARI ST

Transcript of Atari ST Internals

Page 1: Atari ST Internals
Page 2: Atari ST Internals

INTERNALSThe authoritative insider's guide

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

A Data Becker Book

Published by

Abacus Software

Page 3: Atari ST Internals

Third Printing, July 1986Printed in U.S.A.Copyright © 1985 Data Becker GmbH

Merowingerstr.304000 Dusseldorf, West Germany

Copyright © 1985 Abacus Software, Inc.P.O. Box 7219Grand Rapids, MI 49510

This book is copyrighted. No part of this book may be reproduced, storedin a retrieval system, or transmitted in any form or by any means,electronic, mechanical, photocopying, recording or otherwise without theprior written permission of Abacus Software or Data Becker, GmbH.

Every effort has been made to insure complete and accurate informationconcerning the material presented in this book. However Abacus Softwarecan neither guarantee nor be held legally responsible for any mistakes inprinting or faulty instructions contained in this book. The authors willalways appreciate receiving notice of subsequent mistakes.

ATARI, 520ST, ST, TOS, ST BASIC and ST LOGO are trademarks orregistered trademarks of Atari Corp.

GEM, GEM Draw and GEM Write are trademarks or registered trademarksof Digital Research Inc.

IBM is a registered trademark of International Business Machines.

ISBN 0-916439-46-1

Page 4: Atari ST Internals

Table of Contents

1 The Integerated Circuits 1

1.1 The 68000 Processor 31.1.1 The 68000 Registers 41.1.2 Exceptions on the 68000 71.1.3 The 68000 Connections 7

1.2 The Custom Chips 13

1.3 The WD 1772 Floppy Disk Controller 201.3.1 1772 Pins 201.3.2 1772 Registers 241.3.3 Programming the FDC 25

1.4 The MFP 68901 281.4.1 68901 Connections 281.4.2 The MFP Registers 32

1.5 The 6850 ACIAs 411.5.1 The Pins of the 6850 411.5.2 The Registers of the 6850 44

1.6 The YM-2149 Sound Generator 481.6.1 Sound Chip Pins 501.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 . 672.1.1 The mouse 712.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

Page 5: Atari ST Internals

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 1043.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 2063.4.1 An overview of the "line-A" variables 2263.4.2 Examples for using line-A opcodes 229

3.5 The Exception Vectors 2343.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 2553.8.1 Addressing modes 2563.8.2 The instructions 260

3.9 The BIOS listing 268

4 Appendix - The System Fonts 4434.1 The System Fonts 4454.2 Alpahbetical listing of GEMDOS functions 447

11

Page 6: Atari ST Internals

List of Figures

1.1-1 68000 Registers 51.2-1 GLUE 141.2-2 MMU 161.2-3 SHIFTER 171.2-4 DMA 191.3-1 FDC1772 211.4-1 MFP 68901 291.5-1 ACIA6850 421.6-1 Sound Chip YM-2149 491.6-2 Envelopes of the PSG 532.1-1 6850 Interface to 68000 682.1 -2 Block Diagram of Keyboard Circuit 702.1.1-1 The Mouse 722.1.1-2 Mouse control port 742.1.2-1 Atari ST Key Assignments 842.2-1 Diagram of Video Interface 862.2-2 Monitor Connector 872.3-1 Printer Port Pins 882.3-2 Centronics Connection 892.4-1 RS-232 Connection 922.5-1 MIDI System Connection 952.6-1 The Cartridge Slot 962.7-1 Disk Connection 982.8-1 DMA Port 1002.8-2 DMA Connections 1003.4-1 Lo-Res-Mode 2083.4-2 Medium-Res-Mode 2103.4-3 Hi-Res-Mode 212

111

Page 7: Atari ST Internals
Page 8: Atari ST Internals

Chapter One

The Integrated Circuits

1.1 The 68000 Processor1.1.1 The 68000 Registers1.1.2 Exceptions on the 680001.1.3 The 68000 Connections1.2 The Custom Chips1.3 The WD 1772 Floppy Disk Controller1.3.1 1772 Pins1.3.2 1772 Registers1.3.3 Programming the FDC1.4 The MFP 689011.4.1 68901 Connections1.4.2 The MFP Registers1.5 The 6850 ACIAs1.5.1 The Pins of the 68501.5.2 The Registers of the 68501.6 The YM-2149 Sound Generator1.6.1 Sound Chip Pins1.6.2 The 2149 Registers and their Functions1.7 I/O Register Layout of the ST

Page 9: Atari ST Internals
Page 10: Atari ST Internals

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. This16-bit chip is in a class by itself; programmers and hardware designers alikefind the chip very easy to handle. From its initial development by Motorolain 1977 to its appearance on the market in 1979, the chip was to be acompetitor to the INTEL 8086/8088 (the processor used in the IBM-PC andits many clones). Before the Atari ST's arrival on the marketplace, therewere no affordable 68000 machines available to the home user. Now,though, with 16-bit computers becoming more affordable to the commonman, the 8-bit machines won't be around much longer.

What does the 68000 have that's so special? Here's a very incomplete listof features:

16 data bits24 address bits (16-megabyte address range!!)all signals directly accessible without multiplexerhassle-free operation of "old" 8-bit peripheralspowerful machine language commandseasy-to-learn assembler syntax14 different types of addressing17 registers each having 32-bit widths

These specifications (and many yet to be mentioned here) make the 68000an incredibly good microprocessor for home and personal computers. Infact, as the price of memory drops, you'll soon be seeing 68000-based 64Kmachines for the same price as present-day 8-bit computers with the sameamount of memory.

Page 11: Atari ST Internals

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 onboard32-bit registers, the program counter and the status register.

The eight data registers can store and perform calculations, as well as thenormal addressing tasks. Eight-bit systems use the accumulators for this,which limits the programmer to a total of 8 accumulators. Our 68000 dataregisters are quite flexible; data can be handled in 1-, 8-, 16- and 32- bitsizes. Even four-bit operations are possible (within the limits of BinaryCoded Decimal counting). When working with 32-bit data, all 32 bits canbe handled with a single operation. With 8- and 16-bit data, only the 8th or16th bit of the data register can be accessed.

The address registers aren't as flexible for data access as are the dataregisters. These registers are for addressing, not calculation. Processingdata is possible only with word (16-bit) and longword (32-bit) operations.The address registers must be looked at as two distinct groups, the mostversatile being the registers AO-A6. Registers A7 and A7' fulfill a specialneed. These registers are used as the stack pointer by the processor. Twostack pointers are needed to allow the 68000 to run in USER MODE andSUPERVISOR MODE. Register A7 declares whether the system is inUSER or SUPERVISOR mode. Note that the two registers work "under"A7, but the register contents are only available to the respective operatingmode. We'll discuss these operating modes later.

The program counter is also considered a 32-bit register. It is theoreticallypossible to handle an address range of over 4 gigabytes. But the addressbits 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 0to 4 proper) is the "user byte". These bits, which act as flags most of thetime, show the results of arithmetical and comparative operations, and canbe used for program branches hinging on those results. We'll look at theuser byte in more detail later; for now, here is a brief list:

BIT 0 = Carry flag BIT 1 = Overflow flagBIT 2 = Zero flag BIT 3 = Negative flagBIT 4 - extend flag

Page 12: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.1-1 68000 Registers

31 16 15 8 7

.

D 0 j

D 1

D 2

D 3

D 4

D 5

D 6

D7 1

DATAREGISTERS

31

31

System Stack Pointer SSP

User Stack Pointer OSP

31 24 23

I L15 8 7

A 1

A 2

A 3

A 4

A 5

A6-

A7

PC

ADDRESSREGISTERS

I Sys Byte I User Byte I gj>

STACK POINTER

PROGRAMCOUNTER

STATUSREGISTER

Page 13: Atari ST Internals

Abacus Software Atari ST Internals

Bits 8-10, 13 and 15 make up the status register's system byte. Theremaining bits are unused. Bit 15 works as a trace bit, which lets you do asoftware controlled single-step execution of any program. Bit 13 is thesupervisor bit. When this bit is set, the 68000 is in supervisor mode. Thisis the normal operating mode; all commands are executed in this mode. Inuser mode, in which programs normally run, privileged instructions areinoperative. A special hardware design allows access into the other memoryrange while in user mode (e.g., important system variables, I/O registers).The system byte of the status register can only be manipulated in supervisormode; but there's a simple method of switching between modes.

Bits 8 and 10 show the interrupt mask, and run in connection with pinsEPLO-IPL2.

The 68000 has great potential for handling interrupts. Seven differentinterrupt priorities exist, the highest being the "non-maskable interrupt";NMI. This interrupt recognizes when all three EPL pins simultaneously readlow (0). If, however, all three IPL pins read high, there is no interrupt, andthe system operates normally. The other six priorities can be masked byappropriate setting of the system byte of the status register. For example, ifbit 12 of the interrupt mask is set, while 10 and II are off, only levels 7, 6and 5 (000, 001 and 010) are recognized. All other combinations fromBPLO-IPL2 are ignored by the processor.

Page 14: Atari ST Internals

Abacas Software Atari ST Internals

1.1.2 Exceptions on the 68000

We've spoken of interrupts as if the 68000 behaves like othermicroprocessors. Interrupts, according to Motorola nomenclature, are anexternal form of an exception (the machine can interrupt what it's doing,do something else, and return to the interrupted task if needed). The 68000distinguishes between normal operation and exception handling, rather thanbetween user and supervisor mode. One such set of exceptions is theinterrupts. Other things which cause exceptions are undefined opcodes, andword or longword access to a prohibited address.

To make exception handling quicker and easier, the 68000 reserves the firstIK of memory (1024 bytes, $000000-$0003FF). The exception table islocated here. Exceptions are all coded as one of four bytes of a longword.Encountering an exception triggers the 68000, and the address of thecorresponding table entry is output

A special exception occurs on reset, which requires 8 bytes (twolongwords); the first longword contains the standard initial value of thesupervisor stack pointer, while the second longword contains the address ofthe reset routine itself. See Chapter 3.3 for the design and layout of theexception table.

1.1.3 The 68000 Connections

The connections on the 68000 are divided into eight groups (see Figure1.1-3 on page 11).

The first group combines data and address busses. The data bus consists ofpins DO-D15, and the address bus A1-A23. Address bit AO is not availableto 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 68000can access data located on odd addresses as well as even addresses. Thesignals will be dealt with later.

It's important to remember in connection with this, that by word access tomemory, the byte of the odd address is treated as the low byte, and the even

Page 15: Atari ST Internals

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 alwaysbe 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 DirectMemory Access (DMA).

The second group of connections comprise the signals for asynchronousbus control. This group has five signals, which we'll now look atindividually:

1) R/W (READ/WRITE)The R/W signal is a familiar one to all microprocessors. Thisindicates to memory and peripherals whether the processor is writingto or reading data from the address on the bus.

2) AS (ADDRESS STROBE)Every processor has a signal which it sends along the data linessignaling whether the address is ready to be used. On the 68000, thisis 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, forindividual access to the low-byte and high-byte of a word, theprocessor must be able to distinguish between the two bytes. This isthe task performed by UDS and LDS. When a word is accessed,both strobes are activated simultaneously (active=low). Accessingthe data at an odd address activates the Lower Data Strobe only, whileaccessing data atan even address activates the Upper Data Strobe.

Bit AO from the address bus is used in this case. After every accesswhen 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

Page 16: Atari ST Internals

Abacus Software Atari ST Internals

5) DTACKThe above signals (with the exception of UDS and LDS) are neededby an 8-bit processor. DTACK takes a different path; DTACK mustbe low for any write or read access to take place. If the signal is notlow within a bus cycle, the address and data lines "freeze up" untilDTACK turns low. This can also occur in a WATT loop. This way,the processor can slow down memory and peripheral chips whileperforming other tasks. If no wait cycles are used on the ST, theprocessor moves "at full tilt".

The third group of connections, the signals VMA, VPA and E are forsynchronous bus control. A computer is more than memory and amicroprocessor; interfaces to keyboard, screen, printer, etc. must beavailable for communication. In most cases, interfacing is handled byspecial ICs, but the 68000 has a huge selection of interfaces chips onboard.For hardware designers we'll take a little time explaining these synchronousbus signals.

The signal E (also known as <&2 or phi 2) represents the reference count forperipherals. Users of 6800 and 6502 machines know this signal as thesystem counter. Whereas most peripheral chips have a maximum frequencyof only 1 or 2 mHz, the 68000 has a working speed of 8 mHz, which canincreased 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 thesynchronous 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 toproduce the CHIP-select signal for the synchronous bus.

The fourth group of 68000 signals allows simple DMA operation in the68000 system. DMA (Direct Memory Access) directly accesses the DMAcontrollers, which control computer memory, and which is the fastestmethod of data transfer within a computer system.

To execute the DMA, the processor must be in an inactive state. But for theprocessor to be signaled, it must be in a "sleep" state; the low BR signal

Page 17: Atari ST Internals

Abacus Software Atari ST Internals

(Bus Request) accomplishes this. On recognizing the BR signal, the68000'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, theBGACK (Bus Grant Acknowledge) is activated by the requested chip, andtakes over the bus. All essential signals on the processor are made high; inparticular, the data, address and control busses are no longer influenced bythe processor. The DMA controller can then place the desired address onthe bus, and read or write data. When the DMA chip is finished with itstask, the BGACK signal returns to its inactive state, and the processor againtakes over the bus.

The fifth group of signals on the 68000 control interrupt generation. The68000's "user's choice" interrupt concept is one of its most extraordinaryperforming qualities; you have 199 (!) interrupt vectors from which tochoose. These interrupt vectors are divided into 7 non-auto-vectors and 192auto-vectors, plus 7 different priority lines.

Interrupts are triggered by signals from the three lines IPLO to IPL2; thesethree lines give you eight possible combinations. The combinationdetermines the priority of the interrupt. That is, if IPLO, IPL1 and IPL2 areall set high, then the lowest priority is set ("no interrupt"). However, if allthree lines are low, then highest priority takes over, to execute anon-maskable interrupt All the combinations in between affect special bitein 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 termsmean?

If requesting an interrupt on IPLO-IPL2 while VPA is active (low), thedesired 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 IPLinterrupt code needed.

When DTACK, instead of VPA, is active on an interrupt request, theinterrupt is handled as a non-auto-vector. In this case, the vector numberfrom the triggered chip is produced by DTACK on the 8 lowest bits of thedata bus. Usually (though not important here), the vector number is placedinto the user-vector range ($40~$FF).

10

Page 18: Atari ST Internals

Abacus Software Atari ST Internals

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

Figure 1.1-3

FC200001111

FC100110011

FCO01010101

StatusunusedUser-mode data accessUser-mode programunusedunusedSupervisor data accessSupervisor programInterrupt verification

The seventh group contains system control signals. This group applies tothe input CLK and BERR, as well as the bidirectional lines RESET andHALT.

The input CLK will generate the working frequency of the processor. The68000 can operate at different speeds; but the operating frequency must bespecified (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 waschosen as a "middle of the road" frequency to avoid losing data at higherfrequencies.

The RESET line is necessary to check for system power-up. The 68000'sdata page distinguishes between two different reset conditions. Onpower-up, RESET and HALT are switched low for at least 100milliseconds, to set up a proper initialization. Every other initializationrequires 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 isloaded with the value $27. Once the processor is brought into supervisor

11

Page 19: Atari ST Internals

Abacus Software Atari ST Internals

status, the Trace flag in the status register is cleared, and the interrupt levelis set to 7 (lowestpriority, all lines allowable). Additionally, the supervisorstack pointer and program counter are loaded with the contents of the first 8bytes of memory, whereby the value of the program counter is set to thebeginning of the reset routine.

However, since the RESET line is bi-directional, the processor can alsohave RESET under program control during the time the line is low. TheRESET instruction serves this purpose, when the connection is low for 124"beats". It's possible to re-initialize the peripheral ICs at any time, withoutresetting 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 mentionedabove), in order to initialize things properly. This pin has still morefunctions: when the pin is low while RESET is high, the processor goesinto a halt state. This state causes the DMA pin to set the processor into thetri-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 becomelow, it means that a major error has occurred (e.g., doubled bus andaddress errors).

A low state on the BERR pin will call up exception handling, which runsbasically like an external interrupt. In an orderly system, every access to theasynchronous bus quits with the DTACK signal. When DTACK isoutputting, however, the hardware can produce a BERR, which informs theprocessor of any errors found. A further use for BERR is in connectionwith the MMU, to test for proper memory access of a specific range; thisaccess is signaled by the FC pins. If protected memory is tried for in usermode, a BERR will turn up.

When both BERR and HALT are low, the processor will "re-execute" theinstruction 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

Page 20: Atari ST Internals

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 firstprototype of the ST was 5 X 50 X 30 cm. in size, mostly to handle all thoseTTL ICs. Once multiple functions could be crammed into four ICs, the STbecame a saleable item. Then again, the present ST hasn't quite reached theultimate 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 inconcert 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 itsown (functions which are taken care of by the MMU). It's the same withSHIFTER — it controls video screen and color, but it can't address videoRAM. 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, andhow to control it. We're going to spend some time in this chapter exploringthe pins of the individual ICs.

The most important 1C of the "foursome" is GLUE. Its title speaks for thefunction — a glue or paste. This 1C, with its 68 pins, literally holds theentire system together, including decoding the address range and workingthe peripheral ICs.

Furthermore, the DMA handshake signals BR, BG and BGACK areproduced/output by GLUE. The time point for DMA request is dictated byGLUE by the signal from the DMA controller. GLUE also has a BG (BusGrant) input, as well as a BGO (Bus Grant Out).

The interrupt signal is produced by GLUE; in the ST, only EPL1 and BPL2are used for this. Without other hardware, you can't use NMI (interruptlevel 7). The pins MFPINT and IACK are used for interrupt control.

13

Page 21: Atari ST Internals

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*RDYVPA*BEER*DTACK*IPL 1*IPL 2*8MHZ inGNDBLANK*HSYNCVSYNCDEBR*BGACK*6850CS*500HZ out

27 C28 C29 C30 C31 C32 C33 C34 C35 C36 C37 C38 C39 C40 C41 C42 C43 C

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

GLUE I ID 68D 67D 66D 65D 64D 63D 62D 61

A21A20A19A18A17A16A15A14VccA13A12AllA10A9A8A7A6

U UU UUUUUUUUUUU UUU

H * * *& O MMfaOQQOH

*CO

* U

8* °toON*

§ S £S^HI'MOI £ rf

in

14

Page 22: Atari ST Internals

Abacus Software Atari ST Internals

The function code pins are guided by GLUE, where memory access tasksare performed (range testing and access authorization). Needless to say, theBERR signal is also handled by this chip. VPA is particularly important tothe peripheral ICs and the appropriate select signals.

GLUE generates a timing frequency of 8 mHz. Frequencies between 2mHz (sound chip's operating frequency) and 500 kHz (timing for keyboardand MIDI interface) can be produced.

HSYNC, VSYNC, BLANK and DE (Display Enable) are generated byGLUE for monitor operation. The synchronous timing can be switched onand off, and external sync-signals sent to the monitor. This will allow youto 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 dynamicRAM with the processor's bus (handled by address lines Al to A21). Thisgives us an address range totaling 4 megabytes. Dynamic RAM iscontrolled by RASO, RAS1, CASOL, CASOH, CAS1L and CAS1H, aswell as the multiplexed address bus on the MMU. DTACK, R/W, AS, LDSand UDS are also controlled by MMU.

We've already mentioned another important function of the MMU: it workswith the SHIFTER to produce the video signal (the screen information isaddressed in RAM, and SHIFTER conveys the information). Counters areincorporated in the MMU for this; a starting value is loaded, and within 500nanoseconds, a word is addressed in memory and the information is sentover DCYC. The starting value of the video counter (and the screenmemory position) can be shifted in 256-byte increments.

Another integrated counter in MMU, as mentioned earlier, is for addressingmemory using the DMA. This counter begins with every DMA access (diskor hard disk), loading the address of the data being transferred. Everytransfer automatically increments the counter.

The SHIFTER converts the information in video RAM into impulsesreadable on a monitor. Whether the ST is in 640 X 200 or 320 X 200resolution, SHIFTER is involved.

15

Page 23: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.2-2 MMU

00 P 3Hd 0 0

D & QCO

00

nnnnnnnnnnnnnnnnn

GND* 27 CCMPCS 28 £DCYC* 29 <-RDAT* 30 CDEV* 31 CAS 32 CRAM* 33 CR/W* 34 £A15 35 £A14 36 £A13 37 CA12 38 All 39 £A10 40 CA9 41 CA8 42 CA7 43 L

DDDDDD

^MMU 1pPDDDDDD

9 LATCH8 RASO7 CASOLOW6 CASOHIGH5 16MHZ IN4 D73 D62 D51 D4

68 D367 D266 Dl65 DO64 MAD 963 MAD 862 MAD 761 GND

U UUU UUUUUUUUUUUUU

nU

16

Page 24: Atari ST Internals

Abacus Software Atari ST Internals

Figure

XTL 0

XTL 1 32MHZ in

D 0

D 1

D 2

D 3

D 4

D 5

D 6

D 7

i.:

eccC

ccc(cc

LOAD*^

^D 8

D 9

D 1 0

D 1 1

D 1 2

D 1 3

D 1 4

D 1 5

6ND

c(((cccc<

1-3 SHlKl't

COSBH

Hiw

,R

J Vc c

\Z out

) cs *

) D E

)A i

1 5V. 2

) A 3

) A 4

) A 5

) R / W *

^ M O N O

J R 0

)» ») R 2

) G 0

). i) G 2

) B 0

). i) B 2

17

Page 25: Atari ST Internals

Abacus Software Atari ST Internals

The information from RAM is transferred to SHIFTER on the signalLOAD. A resolution of 640 X 400 points sends the video signal over theMONO connector. Since color is impossible in that mode, the RGBconnection is rendered inactive. The other two resolutions set MONOoutput to inactive, since all screen information is being sent out the RGBconnection in those cases.

The third color connection works together with external equipment as adigital/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 upthe "palette registers". These registers contain the color values, which areplaced in individual bit patterns. The 16 palette registers hold a total of 16colors for 320 X 200 mode. Note, however, that since these are based onthe "primary" colors red, green and blue, these colors can be adjusted in 8steps of brightness, bringing the color total to 512.

The DMA controller is like SHIFTER, only in a 40-pin housing; it is usedto oversee the floppy disk controller, the hard disk, and any otherperipherals that are likely to appear.

The speed of data transfer using the floppy disk drive offers no problems tothe processor. It's different with hard disks; data moves at such high speedthat the 68000 has to send a "pause" over the 8 mHz frequency. This paceis made possible by the DMA.

The DMA is joined to the processor's data bus to help transfer data. Tworegisters within the machine act as a bi-directional buffer for data throughthe 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 diskwork. Data transfer automatically transfers two bytes per word.

The signals CA1, CA2, CR/W, FDCS and FDRQ manage the floppy diskcontroller. CA1 and CA2 are signals which the floppy disk controller(FDC) uses to select registers. CR/W determine the direction of datatransfer 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, andeach would be almost useless on its own.

18

Page 26: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.2-4 DMA

R / W *

A 1

FCS *

D 0

D 1

D 2

D 3

D 4

D 5

D 6

D 7

D 8

D 9

D 1 0

D 1 1

D 1 2

D 1 3

D 1 4

D 1 5

6ND

<[CCCCCCCCCCCC(

CCC(

CC

ag

)))))))))

]))))))})

5

V C C

CLK

RD Y

ACK*

CD 0

GDI

CD 2

CDS

CD 4

CDS

CD 6

C D 7

GND

C A2

C Al

CR/W*

HDCS*

HDRQ

FDCS *

FDRQ

19

Page 27: Atari ST Internals

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 containsa complete floppy disk controller (FDC) with capabilities matching 40-pincontrollers. This 1C is software-compatible with the 1790/2790 series.Here are some of the 1772's features:

Simple 5-volt currentBuilt-in data separatorBuilt-in copy compensation logicSingle and double densityBuilt-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 Commodorediskettes can't be used.

Before going on to details of the FDC, let's take a moment to look at the 28pins of this 1C.

1.3.1 1772 Pins

These pins can be placed in three categories. The first group consists of thepower 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 betweenthe processor and the FDC.

20

Page 28: Atari ST Internals

Abacus Software Atari ST Internals

cs *

R / W *

A O

A 1

DAL 0

DAL 1

DAL 2

DAL 3

DAL 4

DAL 5

DAL 6

DAL 7

M R *

6ND

Figure 1.3-1 FDC 1772

(L^I^^^^H

CCCCCCCCCCCCr~

CM

•H

Qw

~~\R

~") D R Q

" DD *

~"\P *

~"\X

D T1 "Q V f \O

" W D

" W G

"} M O

" RD *

" CLK

"" D I R C

~^ S T E P

" \c

21

Page 29: Atari ST Internals

Abacus Software Atari ST Internals

DO-D7:Eight-bit bi-directional bus; data, commands and statusinformation 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 conjunctionwith R/W). The 1772 has a total of five registers which can bothread and write to some degree. Other registers can only read ORwrite. Here is a table to show how the manufacturer designedthem:

Al AO R/W=1 R/W=00011

0101

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

Command RegTrack Reg.Sector Reg .Data Reg.

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

CLK:Clock. The clock signal counts only to the processor bus. Aninput frequency of 8 mHz must be on, for the FDC's internaltiming 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; highmoves the head towards center of the diskette.

22

Page 30: Atari ST Internals

Abacus Software Atari ST Internals

RD:Read Data. Reads data from the diskette. This informationcontains both timing and data impulses — it is sent to the internaldata separator for division.

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

WG:Write Gate. WG will be low before writing to diskette. Writelogic 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 wouldbe low in this case.

IP:Index Pulse. The index pulses mark the physical beginnings ofevery track on a diskette. When formatting a disk, the FDCmarks the start of each track before formatting the disk.

WPRT:Write Protect. If the diskette is write-protected, this input willreact.

DDEN:Double Density Enable. This signal is confined to floppy diskcontrol; it allows you to switch between single-density anddouble-density formats.

23

Page 31: Atari ST Internals

Abacus Software Atari ST Internals

1.3.2 1772 Registers

CR (Command Register):Commands are written in this 8-bit register. Commands shouldonly be written in CR when no other command is underexecution. Although the FDC only understands 11 commands,we actually have a large number of possibilities for thesecommands (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. Thestatus register can only be read.

TR (Track Register):Contains the current position of the read/write head. Everymovement of the head raises or lowers the value of TRappropriately. Some commands will read the contents of TR,along with information read from the disk. The result affects theStatus Register. TR can be read/written.

SR (Sector Register):SR contains the number of sectors desired from read/writeoperations. Like TR, it can be used for either operation.

DR (Data Register):DR is used for writing data to/ reading data from diskette.

24

Page 32: Atari ST Internals

Abacus Software Atari ST Internals

1.3.3 Programming the FDC

Programming this chip is no big deal for a system programmer. Direct (andin most cases, unnecessary) programming is made somewhat harder ANDdrastically simpler by the DMA chip. The 11 FDC commands are dividedinto four types.

Type Function1 Restore, look for track 001 Seek, look for a track1 Step, a track in previous direction1 Step In, move head one track in (toward disk hub)1 Step Out, move head one track out (toward edge of disk)2 Read Sector2 Write Sector3 Read Address, read ID3 Read Track, read entire track3 Write Track, write entire track (format)4 Force Interrupt

Type 1 Commands

These commands position the read/write head. The bit patterns of these fivecommands look like this:

BIT7 6 5 4 3 2 1 0

Restore 0 0 0 0 H V Rl ROSeek 0 0 0 1 H V Rl ROStep 0 0 1 U H V Rl ROStep In 0 1 0 U H V Rl ROStep Out 0 1 1 U H V Rl RO

25

Page 33: Atari ST Internals

Abacus Software Atari ST Internals

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

Rl RO STEP RATE0 0 2 milliseconds0 1 3 milliseconds1 0 5 milliseconds1 1 6 milliseconds

These bits must be set by the command bytes to the disk drive. The V-bit isthe so-called "verify flag". When set, the drive performs an automaticverify after every head movement. The H-bit contains the spin-upsequence. The system delays disk access until the disk motor has reached300 rpm. If the H-bit is cleared, the FDC checks for activation of themotor-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. Ifthe motor is already running, then there will be no waiting time.

The three different step commands have bit 4 designated a U- bit. Everystep and change of the head appears here.

Type 2 Commands

These commands deal with reading and writing sectors. They also haveindividual bits with special meanings.

B I T 7 6 5 4 3 2 1 0Read Sector 1 0 0 M H E O OWrite 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, theFDC waits 30 milliseconds before starting the command. This delay isimportant for some disk drives, since it takes time for the head to changetracks. When the E-bit reads null, the command will run immediately.

The M-bit determines whether one or several sectors are read one afteranother. 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 eachnew sector read.

Bits 0 and 1 must be cleared for sector reading. Writing has its own specialmeaning: the AO bit conveys to bit 0 whether a cleared or normal data

26

Page 34: Atari ST Internals

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 isturned on or off. Pre-compensation is normally set on; it supplies a higherdegree of protection to the inner tracks of a diskette.

Tvoe 3 Commands

Read Address gives program information about the next ID field on thediskette. 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 arethe bit patterns for these commands:

B I T 7 6 5 4 3 2 1 0Read Address 1 1 0 0 H E O ORead Track 1 1 1 0 H E O OWrite Track 1 1 1 1 H E P O

The H- and E-bits also belong to the Type 2 command set (spin-up andhead-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 canwork with individual bits during another FDC command. When thiscommand comes into play, whatever command was currently running isended.

B I T 7 6 5 4 3 2 1 0Force Interrupt 1 1 0 1 13 12 II 10

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

27

Page 35: Atari ST Internals

Abacus Software Atari ST Internals

1.4 The MFP 68901

MFP is the abbreviation for Multi-Function Peripheral. This name is noexaggeration; wait until you see what it can do! Here's a brief list of themost noteworthy features:

8-bit parallel portData direction of every port bit is individually programmablePort bits usable as interrupt input16 possible interrupt sourcesFour universal timersBuilt-in serial interface

1.4.1 The 68901 Connections

The 48 pins of the MFP are set apart in function groups. The first functiongroup is the power connection set:

GND, Vcc, CLK:Vcc and GND carry voltage to and from the MFP. CLK is theclock input; this clock signal must not interfere with the systemtimer of the processor. The ST's MFP operates at a frequency of4mHz.

Communication with the data bus of the processor is maintained withDO-D7, DTACK, RS1-RS5 and RESET.

DO-D7:These bi-directional pins normally work with the 8 lowest databits of the 68000. It is also possible to connect with D8 throughD15, but it's impossible to produce non-auto interrupts. Thus,interrupt vectors travel along the low order 8 data bits.

28

Page 36: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.4-1 MFP 68901

R/ W*

A 1

A 2

A 3

A 4

A 5

T C

S 0

S Z

R C

V c c

NC .

TA 0

TB 0

TC O

TD 0

XTAZ.1

XTAX.2

TA Z

TB Z

R E S E T

I 0

Z 1

Z2

(T

Ccccccccccccccccccccccc

.

COvo

DDDDDDDDDDDDDDDDDDDDDDDD

C S *

D S *

D T A C K *

I A C K *

D 7

D 6

D 5

D 4

D 3

D 2

D 1

D 0

Vs s

C L K

I E I *

I EO *

I N T R *

RR *

T R *

I 7

Z 6

Z 5

Z 4

Z3

29

Page 37: Atari ST Internals

Abacus Software Atari ST Internals

CS (Chip Select):This line is necessary to communication with the MFP. CS isactive 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 orupper 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 linesof the processor, and serve to choose from the 24 internalregisters.

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 andffiO).

IRQ (Interrupt ReQuest):IRQ will be low when an interrupt is triggered in the MFP. Thisinforms the processor of interrupts.

IACK (Interrupt ACKnowledge):On an interrupt (IRQ and DEI), the MFP sends a low signal overIACK and DS on the data lines. Since 16 different interruptsources are available, this makes handling interrupts muchsimpler.

IEI, IEO (Interrupt Enable In/ Out):These two lines permit daisy-chaining of several MFPs, anddetermine MFP priority by their positioning in this chain. IEIwould work through the MFP with the highest priority. IEO ofthe second MFP would remain unswitched. On an interrupt, asignal is sent over IACK, and the first MFP in the chain willacknowledge with a high IEO.

30

Page 38: Atari ST Internals

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 ofeach port bit is set up in a data direction register of its own. Inaddition, though, every port bit can be programmed to be aninterrupt 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 aworking frequency for the four timers.

TAI,TBI (Timer Input):Timers A and B can not only be used as real counters differentlyfrom timers C and D with the frequency from XTAL1 and 2, butcan also be set up for event counting and impulse widthmeasurement. In both these cases, an external signal (TimerInput) 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 serialinterface. The built-in full duplex of the MFP can be run synchronously orasynchronously, 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 frequencyof this input; the source of this signal can, for example, be one ofthe four timers.

TC (Transmitter Clock):Similar to RC, but for adjusting the baud-rate of data beingtransmitted

31

Page 39: Atari ST Internals

Abacus Software Atari ST Internals

The final group of signals aren't used in the Atari ST. They are necessarywhen the serial interface is operated by the DMA.

RR (Receiver Ready):This pin gives the status of the receiving data registers. If acharacter is completely received, this pin sends current

TR (Transmitter Ready):This line performs a similar function for the sender section of theserial interface. Low tells the DMA controller that a newcharacter 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, makesprogramming the MFP much easier.

Reg 1 GPIP, General Purpose I/O Interrupt PortThis is the data register for the 8-bit ports, where data from theport bits is sent and read.

Reg 2 AER, Active Edge RegisterWhen port bits are used for input, this register dictates whetherthe interrupt will be a low-high- or high-low conversion. Zero isused in the high-low change, one for low-high.

Reg 3 DDR, Data Direction RegisterWe've already said that the data direction of individual port bitscan be fixed by the user. When a DDR bit equals 0, thecorresponding pin becomes an input, and 1 makes it an output.Port bit positions are influenced by AER and DDR bits.

32

Page 40: Atari ST Internals

Abacus Software Atari ST Internals

Reg 4,5 IERA,IERB, Interrupt Enable RegisterEvery interrupt source of the MFP can be separately switched onand off. With a total of 16 sources, two 8-bit registers areneeded to control them. If a 1 has been written to IERA orIERB, the corresponding channel is enabled (turned on).Conversely, a zero disables the channel. If it comes upon aclosed channel caused by an interrupt, the MFP will completelyignore it. The following table shows which bit is coordinatedwith which interrupt occurrence:

IERABit 7: I/O port bit 7 (highest priority)Bit 6: I/O port bit 6Bit 5: Timer ABit 4: Receive buffer fullBit 3: Receive errorBit 2: Sender buffer emptyBit 1: Sender errorBit 0: Timer B

IERBBit 7: I/O port bit 5Bit 6: I/O port bit 4Bit 5: Timer CBit 4: Timer DBit 3: I/O port bit 3Bit 2: I/O port bit 2Bit 1: I/O port bit 1Bit 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 RegisterWhen an interrupt occurs on an open channel, the appropriate bitin the Interrupt Pending Register is set to 1. When working witha system that allows vector creation, this bit will be automaticallycleared when the MFP puts the vector number on the data bus. Ifthis possibility doesn't exist, the IPR must be cleared usingsoftware. To clear a bit, a byte in the MFP will show the locationof the specific bit.

The bit arrangement of the IPR is shown in the table for registers4 and 5 (see above).

33

Page 41: Atari ST Internals

Abacus Software Atari ST Internals

Reg 8,9 ISRA,ISRB,Interrupt In-Serviee RegisterThe function of these registers is somewhat complicated, anddepends upon bit 3 of register 12. This bit is an S-bit, whichdetermines 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), whenthe processor gets the vector number from the MFP during anIACK cycle. The appropriate In-Service bit is cleared at the sametime. Now a new interrupt can occur, even when the previousinterrupt hasn't finished its work.

SEI mode sets the corresponding ISR-bit when the vectornumber of the interrupt is requested by the processor. At theinterrupt routine's end, the bit designated within the MFP mustbe cleared. As long as the Interrupt In-Service bit is set, allinterrupts of lower priority are masked out by the MFP. Once thePending-bit of the active channel is cleared, the same sort ofinterrupt can occur a second time, and interrupts of lesser prioritycan occur as well.

Reg 10,11 IMRA,IMRB Interrupt Mask RegisterIndividual interrupt sources switched on by IER can be maskedwith the help of this register. That means that the interrupt isrecognized from within and is signalled in the IPR, even if theIRQ line remains high.

Reg 12 VR Vector RegisterIn the cases of interrupts, the 68901 can generate a vector numbercorresponding to the interrupt source requested by the processorduring an Interrupt Acknowledge Cycle. All 16 interruptchannels have their own vectors, with their priorities coded intothe bottom four bits of the vector number (the upper four bits ofthe vector are copied from the vector register). These bits mustbe 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 "AutomaticEnd-of-Interrupt" mode.

34

Page 42: Atari ST Internals

Abacus Software Atari ST Internals

Reg 13,14 TACR,TBCR Timer A/B Control RegisterBefore 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 featureand an 8-bit count-down counter. Contents of the counters willdecrease by one every impulse. When the counter stands at 01,the next impulse changes the corresponding timer to the output ofits pins. At the same time, the value of the timer data register isloaded into the timer. If this channel is set by the IER bit, theinterrupt will be requested. The source of the timer beats willusually be those quartz frequencies from XTAL1 and 2. Thisoperating mode is called delay mode, and is available to timers CandD.

Timers A and B can also be fed external impulses using timerinputs TAI and TBI (in event count mode). The maximumfrequency on timer inputs should not surpass 1/4 of the MFP'soperating frequency (that is, 1 mHz).

Another peculiarity of this operating mode is the fact that thetimer inputs for the interrupts are I/O pins 13 and 14. Byprogramming the corresponding bits in the AER, a pin-jump canbe used by the timer inputs to request an interrupt. TAI is joinedwith pin 13, TBI by pin 14. Pins 13 and 14 can also be used asI/O lines without interrupt capability.

Timers A and B have yet a third operating mode (pulse-lengthmeasurement). This is similar to Delay Mode, with the differencethat the timer can be turned on and off with TAI and TBI. Also,when pins 13 and 14 are used, the AER-bits can determinewhether the timer inputs are high or low. If, say, AER-bit 4 isset, the counter works when TAI is high. When TAI changes tolow, an interrupt is created.

Now we come to TACR and TBCR. Both registers only use thefifth through eighth bits. Bits 0 to 3 determine the operatingmode of each timer:

35

Page 43: Atari ST Internals

Abacus Software Atari ST Internals

BIT 3 2 1 0 Function

00000000011111111

00000111100001111

00111001100110011

01011010101010101

TimerDelayDelayDelayDelayDelayDelayDelayDelayEventPulsePulsePulsePulsePulsePulsePulse

stop, no function executedmode, subdivider divides by 4mode, subdivider divides by 10mode, subdivider divides by 16mode, subdivider divides by 16mode, subdivider divides by 50mode, subdivider divides by 64mode, subdivider divides by 100mode, subdivider divides by 200Count Modeextension mode, subdivider dividesextension mode, subdivider dividesextension mode, subdivider dividesextension mode, subdivider dividesextension mode, subdivider dividesextension mode, subdivider dividesextension mode, subdivider divides

bybybybybybyby

410165064100200

Bit 4 of the Tinier Control Register has a particular function.This bit can produce a low reading for the timer being used withit at any time. However, it will immediately go high when thetimer runs.

Reg 15 TCDCR Timers C and D Control RegisterTimers C and D are available only in delay mode; thus, one bytecontrols both timers. The control information is programmedinto the lower three bits of the nibbles (four- bit halves). Bits 0and 2 arrange Timer D, Timer C is influenced by bits 4 and 6.Bits 3 and 7 in this register have no function.

Bit 2 1 0 Function - Timer DBit 6 5 4 Function - Timer C

0 0 0 Timer Stop0 0 1 Delay Mode, division by 40 1 0 Delay Mode, division by 100 1 1 Delay Mode, division by 161 0 0 Delay Mode, division by 501 0 1 Delay Mode, division by 641 1 0 Delay Mode, division by 1001 1 1 Delay Mode, division by 200

36

Page 44: Atari ST Internals

Abacus Software Atari ST Internals

Reg 16-19 TADR,TBDR,TCDR,TDDR Timer Data RegistersThe four Timer Data Registers are loaded with a value from thecounter. When a condition of 01 is reached, an impulse occurs.A continuous countdown will stem from this value.

Reg 20 SCR Synchronous Character RegisterA value will be written to this register by synchronous datatransfer, so that the receiver of the data will be alerted. Whensynchronous mode is chosen, all characters received will bestored in the SCR, after first being put into the receive buffer.

Reg 21 UCR,USART Control RegisterUSART is short for Universal Synchronous/AsynchronousReceiver/Transmitter. The UCR allows you to set all theoperating parameters for the interfaces. Parameters can also becoded in with the timers.

Bit 0 : unusedBit 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 ofstart- and stopbits and theformat desired.

Bit 4 3 Start Stop Format0 0 0 0 SynchronousO i l 1 Asynchronous1 0 1 1,5 Asynchronous1 1 1 2 Asynchronous

Bits 5,6 : These bits give the"wordlength" of the data bitsto be transferred.

Bits 6 5 Word length0 0 8 bits0 1 7 bits1 0 6 bits1 1 5 bits

37

Page 45: Atari ST Internals

Abacus Software Atari ST Internals

Bit 7 : Q=Frequency from TC and RCdirectly used as transferfrequency (used only forsynchronous transfer)l=Frequency in TC and RCinternally divided by 16.

Reg 22 RSR Receiver Status RegisterThe RSR gives information concerning the conditions of allreceivers. Again, the different conditions are coded intoindividual bits.

Bit 0 Receiver Enable BitWhen this bit is cleared, receipt is immediately turned off.All flags in RSR are automatically cleared. A set bit meansthat the receiver is behaving normally.

Bit 1 Synchronous Strip EnableThis bit allows synchronous data transfer to determinewhether or not a character in the SCR is identical to acharacter in the receive buffer.

Bit 2 Match/Character in ProgressWhen in synchronous transfer format, this bit signals that acharacter identical with the SCR byte would be received.In asynchronous mode, this bit is set as soon as the startbitis recognized. A stopbit automatically clears this bit.

Bit 3 Found - Search/Break DetectedThis bit is set in synchronous transfer format, when acharacter received coincides with one stored in the SCR.This condition can be treated as an interrupt over thereceiver's error channel. Asynchronous mode will causethe bit to set when a BREAK is received. The breakcondition is fulfilled when only zeroes are receivedfollowing a startbit. To distinguish between a BREAKfrom a "real" null, this line should be low.

Bit 4 Frame ErrorA frame error occurs when a byte received is not a null, butthe stopbit of the byte IS a null.

38

Page 46: Atari ST Internals

Abacus Software Atari ST Internals

Bit 5 Parity ErrorThe condition of this bit gives information as to whetherparity on the last received character was correct. If theparity test is off, the PE bit is untouched.

Bit 6 Overrun ErrorThis bit will be set when a complete character is in thereceiver floating range but not read into the receive buffer.This error can be operated as an interrupt.

Bit 7 Buffer FullThis bit is set when a character is transferred from thefloating register to the receive buffer. As soon as theprocessor reads the byte, the bit is cleared.

Reg 23 TSR Transmitter Status RegisterWhereas the RSR sends receiver information, the TSR handlestransmission information.

Bit 0 Transmitter EnableThe sending section is completely shut off when this bit iscleared. At the same time the End-bit is cleared and the UE-bit is set (see below). The output to the receiver is set inthe corresponding H- and L-bits.

Bits 1,2 High- and Low-bitThese bits let the programmer decide which mode of outputthe switched-off transmitter will take on. If both bits areclearedjthe output is high. High-bit only will create highoutput; low-bit, low output. Both bits on will switch onloop-back-mode. This state loops the output from thetransmitter with receiver input. The output itself is on thehigh-pin.

Bit 3 BreakThe break-bit has no function in synchronous data transfer.In asynchronous mode, though, a break condition is sentwhen the bit is set

39

Page 47: Atari ST Internals

Abacus Software Atari ST Internals

Bit 4 End of TransmissionIf the sender is switched off during running transmission,the end-bit will be set as soon as the current character hasbeen sent in its entirety. When no character is sent, the bitis immediately set.

Bit 5 Auto TurnaroundWhen this bit is set, the receiver is automatically switchedon when the transmitter is off, and a character willeventually be sent.

Bit 6 Underrun ErrorThis bit is switched on when a character in the senderfloating register will be sent, before a new character iswritten into the send buffer.

Bit 7 Buffer EmptyThis bit will be set when a character from the send bufferwill be transferred to the floating register. The bit iscleared when new data is written to the send buffer.

Reg 24 UDR, USART Data RegisterSend/receive data is sent over this register. Writing sends data inthe send buffer, reading gives you the contents of the receivebuffer.

40

Page 48: Atari ST Internals

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 serialinterface, as well as error-recognizing and data-formatting capabilities.Originally for 6800-based computers, this chip can be easily tailored for6502 and 68000 systems. The ST has two of these chips. One of themcommunicates with the keyboard, mouse, joystick ports, and runs theclock. Keyboard data travels over a serial interface to the 68000 chip. Thesecond ACIA is used for operating the MIDI interface.

Parameter changes in the keyboard ACIA are not recommended: Theconnection between keyboard and ST can be easily disrupted. The MIDIinterface is another story, though -- we can create all sorts of practicalapplications. Incidentally, nowhere else has it been mentioned that theMIDI connections can be used for other purposes. One idea would be touse the MIDI interfaces of several STs to link them together (for schools oroffices, for example).

1.5.1 The Pins of the 6850

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

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

RX DATA Receive DataThis pin receives data; a start-bit must precede the least significantdata-bit before receipt.

41

Page 49: Atari ST Internals

Abacus Software Atari ST Internals

V s s

RX

RX

TX

R T S

TX

I R Q

CS

CS

CS

R S

Vcc

Figure 1.5-1 ACIA 6850

(T

DATA (

CLK f"

CLK £~"

* CDATA f"

* C« C,. c1 Cc

r~

oin00vo

.HU

DD

DDD

uu

uD

C T S *

D C D * 1

D 0

D 1

D 2

D 3

D 4

D 5

D 6

D 7

E

R/W*

42

Page 50: Atari ST Internals

Abacus Software Atari ST Internals

RX CLK Receive ClockThis pin signal determines baud-rate (speed at which the data isreceived), and is synchronize to the incoming data. Thefrequency of RX CLK is patterned after the desired transferspeed and after the internally programmed division rate.

TX CLK Transmitter ClockLike RX CLK, only used for transmission speed.

RTS Request To SendThis output signals the processor whether the 6850 is low orhigh; mostly used for controlling data transfer. A low outputwill, for example, signal a modem that the computer is ready totransmit.

TX DATA Transmitter DataThis pin sends data bit-wise (serially) from the computer.

IRQ Interrupt RequestDifferent circumstances set this pin low, signaling the 68000processor. Possible conditions include completed transmissionor receipt of a character.

CS 0,1,2 Chip SelectThese three lines are needed for ACIA selection. The relativelyhigh number of CS signals help minimize the amount ofhardware needed for address decoding, particularly in smallercomputer systems.

RS Register SelectThis signal communicates with internal registers, and worksclosely with the R/W signal. We shall talk about these registerslater.

Vce VoltageThis pin is required of all ICs — this pin gets an operating voltageof 5V.

R/W Read/WriteThis tells the processor the "direction" of data traveling throughthe ACIA. A high signal tells the processor to read data, and lowwrites data in the 6850.

43

Page 51: Atari ST Internals

Abacus Software Atari ST Internals

E EnableThe E-signal determines the time of reading/writing. Allread/write processes with this signal must be synchronous.

DO - D7 DataThese data lines are connected to those of the 68000. Until theACIA is accessed, these bidirectional lines are all high.

DCD Data Carrier DetectA modem control signal, which detects incoming data. WhenDCD is high, serial data cannot be received.

CIS Clear To SendCTS answers the computer on the signal RTS. Data transmissionis 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 ofthem are write only. These registers are distinguished by R/W and RS,after the table below:

R/W0011

RS0101

RegisterControl RegisterSender RegisterStatus RegisterReceive Register

Accesswritewritereadread

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

44

Page 52: Atari ST Internals

Abacus Software Atari ST Internals

The Control Register

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

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

CR1 CRO0 00 11 01 1

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

CR 2,3,4These so-called Word Select bits tell whether 7 or 8 data-bits areinvolved; whether 1 or 2 stop-bits are transferred; and the type ofparity.

CR400001111

CR300110011

CR201010101

7

7

7

7

8

8

8

8

databits.

databits.

databits.

databits.

databits.

databits.

databits.

databits.

2

2

1

1

2

1

1

1

stopbits.

stopbits.

stopbit.

stopbit.

stopbit.

stopbit.

stopbit.

stopbit.

even

odd

even

odd

no

no

even

odd

parity

parity

parity

parity

parity

parity

parity

parity

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

45

Page 53: Atari ST Internals

Abacus Software Atari ST Internals

CR6 CR50 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, BREAKsent

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

CR70 Interrupt disabled1 Interrupt enabled

The Status Register

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

SROWhen this bit is high, the RX data register is full. The byte mustbe read before a new character can be received (otherwise anOVERRUN happens).

SRIThis bit reflects the status of the TX data buffer. An emptyregister sets the bit.

SR2A low-high change on pin DCD sets SR2. If the receiverinterrupt is allowable, the IRQ will be cancelled. The bit iscleared when the status register and the receiver register are read.This also cancels the IRQ. SR2 register remains high if thesignal on the DCD pin is still high; SR2 registers low if DCDbecomes low.

46

Page 54: Atari ST Internals

Abacus Software Atari ST Internals

SR3This line shows the status of CTS. This signal cannot be alteredby a master reset, or by ACIA programming.

SR4Shows "Frame errors". Frame errors are when no stop-bit isrecognized in receiver switching. It can be set with every newcharacter.

SR5This bit displays the previously mentioned OVERRUNcondition. SR5 is reset when the RX buffer is read.

SR6This bit recognizes whether the parity of a received character iscorrect. The bit is set on an error.

SR 7This signals the state of the IRQ pins; this bit makes it possible toswitch several IRQ lines on one interrupt input. In cases wherean interrupt is program-generated, SR7 can tell which 1C cut offthe interrupt.

The ACIAs in the ST

The ACIAs have lots of extras unnecessary to the ST. In fact, CTS, DCDand RTS are not connected.

The keyboard ACIA lies at the addresses $FFFCOO and $FFFC02. Built-inparameters are: 8-bit word, 1 stopbit, no parity, 7812.5 baud (500kHz/64).

The parameters are the same for the MIDI chip, EXCEPT for the baud rate,which runs at 31250 baud (500 kHz/16).

47

Page 55: Atari ST Internals

Abacus Software Atari ST Internals

1.6 The YM-2149 Sound Generator

The Yamaha YM-2149, a PSG (programmable sound generator) in the samefamily as the General Instruments AY-3-8190, is a first-class soundsynthesis chip. It was developed to produce sound for arcade games. ThePSG also has remarkable capabilities for generating/altering sounds.Additionally, the PSG can be easily controlled by joysticks, the computerkeyboard, or external keyboard switching. The PSG has two bidirectional8-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 arecontrolled by these registers.

The PSG has several "functional blocks" each with its own job. The tonegenerator block produces a square-wave sound by means of a time signal.The noise generator block produces a frequency-modulated square-wavesignal, whose pulse-width simulates a noise generator. The mixer couplesthe three tone generators' output with the noise signal. The channels maybe coupled by programming.

The amplitude control block controls the output volume of the threechannels with the volume registers; or creates envelopes (Attack, Decay,Sustain, Release, or ADSR), which controls the volume and alters thesound quality.

The D/A converter translates the volume and envelope information intodigital form, for external use. Finally one function block controls the twoI/O ports.

48

Page 56: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.6-

Vs s (*

NC . f

ANALOG B f

ANALOG A f

NC . (

I O B 7 £

I OB6 £

I OB5 (

I O B 4 ([

I O B 3 ([

I O B 2 ([

IOB1 £

I OBO (

I OA7 (

X O A 6 (

I O A 5 Q

I O A 4 Q

I O A 3 (

I O A 2 (

IOA1 (]

1 Sound chip YM-2149

Kj

S1

N>M.yn^

vo

J Vc c

^ TEST 1

J ANALOG C

) DA 0

) DA 1

) DA 2

J DA 3

) DA 4

) DA 5

D DA 6

) DA 7

) BC 1

) BC 2

) BD I R

J TEST 2

) A S

) A9 *

J R E S E T *

J CLOCK

J IOAO

49

Page 57: Atari ST Internals

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 thechip. These pins can be used for either input or output. Mixedoperation (input and output combined) is impossible within oneport, 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 signaloperates at a frequency between 1 and 2 mHz.

RESET:A low signal from this pin resets all internal registers. Without areset, random numbers exist in all registers, the result being arather unmusical "racket".

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

50

Page 58: Atari ST Internals

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

BDIR & BC1,2:The BDIR (Bus DIRection), BC1 and BC2 (Bus Control) pinscontrol the PSG's register access.

BDIR00001111

BC200110011

BC101010101

PSG functionInactiveLatch addressInactiveRead from PSGLatch addressInactiveWrite to PSGLatch address

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

BDIR BC1 Function0 0 Inactive, PSG data bus high0 1 Read PSG registers1 0 Write PSG registers1 1 Latch, write register number(s)

DAO - 7:These pins connect the sound chip to the processor, through thedata 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

Page 59: Atari ST Internals

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 ofinterest: the contents of the address register remain unaltered untilreprogrammed. You can use the same data over and over, without havingto send that data again.

Reg 0,1:These register determine the period length, and the pitch ofANALOG A. Not all 16 bits are used here; the eight bits ofregister 0 (set frequency) and the four lowest bits of register 1(control step size). The lower the 12-bit value in the register, thehigher 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=offBit 1:Channel B tone on/off 0=on /l=offBit 2:Channel C tone on/off 0=on /l=offBit 3:Channel A noise on/off 0=on /l=offBit 4:Channel B noise on/off 0=on /l=offBit 5:Channel C noise on/off 0=on /l=offBit 6:Port A in/output 0=in /l=outBit 7:Port B in/output 0=in /l=out

52

Page 60: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.6-2 Envelopes of the PSG

KBQ 15B3 B2 Bl BO

CONTXNaK

HOLD

/IO NKNKNNKKN

O

O NJ

O

XI53

Page 61: Atari ST Internals

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 thecontents 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 ofregister 12 are the high-byte of the sustain.

Reg 13:Bits 0-3 determine the waveform of the envelope generator. Thepossible envelopes are pictured in Figure 1.6-2.

Reg 14,15:These registers comprise the two 8-bit ports. Register 14 isconnected to Port A and register 15 is connected to Port B. Ifthese ports are programmed as output (bits 7 and 8 of register 7)then values may be sent through these registers.

54

Page 62: Atari ST Internals

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 a32K address register -- $FF8000 - $FFFFFF. Below is a complete table ofthe different registers. CAUTION: The I/O section can be accessed only insupervisor 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 nohint 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 memoryconfiguration is set up (four lowest bits). The MMU-IC is designed formaximum versatility within the ST. It lets you use three different types ofmemory expansion chips: 64K, 256K, and the 1M chips. Since all of theseICs are bit-oriented instead of by te-oriented, 16 memory chips of each typeare required for memory expansion. The identifier for 16 such chips(regardless of memory capacity) is BANK. So, expansion is possible to128 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

Page 63: Atari ST Internals

Abacus Software Atari ST Internals

SFF8001 Bit3-0000000010010001101000101010001001000100110101011

Memory conficrurationBank 0128K128K128Kreserved512K512K512Kreserved2M2M2Mreserved

Bank 1128K512K2 M

128K512K2 M, normally reserved

128K512K2M

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 colorpalette 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 videoRAM.

In order to relocate video RAM, another register is used. This register isthree bytes long and is located at $FF8205. Video RAM can be relocated in256-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, thecontents of these registers are incremented by 2.

56

Page 64: Atari ST Internals

Abacus Software Atari ST Internals

$FF820A BIT Synchronization mode1 0: :— 0=internal,l=external synchronization: 0=60 Hz, l=50Hz screen frequency

The bottom two bits of this register control synchronization mode; theremaining bits are unused. If bit 0 is set, the HSync and VSync impulsesare 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 isuseful only in the two "lowest" resolutions. High-res operation puts the STat 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 bedisplayed on the screen at one time. The reason for this is that the user has16 color pens on screen, and each can be one of 512 colors. The colorpalette registers represent these pens. All 16 registers contain 9 bits whichaffect the color:

FEDCBA9876543210XXX.XXX.XXX

The bits marked X control the registers. Bits 0-2 adjust the shade of bluedesired; 4-6, green hue; and 8-A, red. The higher the value in these threebits, the more intense the resulting color.

Middle resolution (640 X 200 points) offers four different colors; colors 4through 15 are ignored by the palette registers.

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

57

Page 65: Atari ST Internals

Abacus Software Atari ST Internals

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

$FF8260 Bit Resolution1 00 0 320 X 200 points, four focal planes0 1 640 X 200 points, two focal planes1 0 640 X 400 points, one focal planes

This register sets up the appropriate hardware for the graphic resolutiondesired.

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 noinformation, and consistently read 1. Which register of the FDC is useddepends 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 theappropriate bit in the DMA control register is set. The contents of theseaddresses 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 ofthe register.

Bit 0 0=no error, 1=DMA errorBit 1 0=sector count = null, l=sector countonullBit 2 Condition of FDC DATA REQUEST signal

Write access to this address controls the DMA mode register.

58

Page 66: Atari ST Internals

Abacus Software Atari ST Internals

Bit 0 unusedBit 1 0=pin AO is low

l=pin AO is highBit 2 0=pin Al is low

l=pin Al is highBit 3 0=FDC access

1=HDC accessBit 4 0=access to FDC register

l=access to sector count registerBit 5 0, reservedBit 6 0=DMA on

l=no DMABit 7 0=hard disk controller access (HOC)

1=FDC accessBit 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 bemoved. The initialization of the three registers must begin with the low-byteof 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 iswritten to the PSG.

$FF8800 8-bit Read data/Register select

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

59

Page 67: Atari ST Internals

Abacus Software Atari ST Internals

PORT ABit 0 Page-choice signal for double-sided

floppy driveBit 1 Drive select signal — floppy drive 0Bit 2 Drive select signal — floppy drive 1Bit 3 RS-232 RTS-outputBit 4 RS-232 DTR outputBit 5 Centronics strobeBit 6 Freely usable output (monitor jack)Bit 7 reserved

When $FF8800 is written to, the select register of the PSG is alerted. Theinformation 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 MOVEPinstruction.

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

Page 68: Atari ST Internals

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 PortBit 0 Centronics busyBit 1 RS-232 data carrier detect - inputBit 2 RS-232 clear to send - inputBit 3 reservedBit 4 keyboard and MIDI interruptBit 5 FDC and HDC interruptBit 6 RS-232 ring indicatorBit 7 Monochrome monitor detect

Timers A and B each have an input which can be used by external timercontrol, or send a time impulse from an external source. Timer A is unusedin the ST, which means that the input is always available, but it isn'tconnected 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 (DisplayEnable).

The timer outputs in A-C are unused. Timer D, on the other hand, sendsthe timing signal for the MFP's built-in serial interface.

61

Page 69: Atari ST Internals

Abacus Software Atari ST Internals

SFFFCOO Keyboard and MIDI ACIAs

The communications between the ST, the keyboard, and musicalinstruments 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

SFFFCOO

SFFFAOO

2 ACIA's 6580

MFP 68901

SFF8800

IFF8600

SFF8400

SFF8200

JFF800Q

SOUND AY-3-8910

DMA / WD1770

RESERVED

VIDEO CONTROLLER

DATA CONFIGURATION

62

Page 70: Atari ST Internals

Abacus Software Atari ST Internals

Figure 1.7-2 Memory Map of the ATARI ST

$FF FCOO

$FF FROG

$FF 8800860084008200

$FF 8000

I/O - Area

I/O - Area

16776192

16775680

1674649616745984167454721674496016744448

$FE FFFF

$FC 0000

$FR 0000

192 KSystem ROM

128 K ROMExpansion Cartridge

16711679

16515072

16384000

$07 FFFF

$00 0000

512 K RAM

524287

0

63

Page 71: Atari ST Internals
Page 72: Atari ST Internals

Chapter Two

The Interfaces

2.1 The Keyboard2.1.1 The Mouse2.1.2 Keyboard commands2.2 The Video Connection2.3 The Centronics Interface2.4 The RS-232 Interface2.5 The MIDI Connections2.6 The Cartridge Slot2.7 The Floppy Disk Interface2.8 The DMA Interface

Page 73: Atari ST Internals

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 astrivial as the keyboard, since keyboards all function the same way? Actuallythe title should read "Keyboard Systems" or something similar. Thekeyboard is controlled by its own processor. You will soon see how thisaffects the assembly language programmer.

The keyboard processor is single-chip computer (controller) from the 6800family, the 6301. Single chip means mat everything needed for operation isfound on a single 1C. In actuality, there are some passive components in thekeyboard circuit along with the 6301.

The 6301 has ROM, RAM, some I/O lines, and even a serial interface onthe 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 notburdened by having to continually poll the keyboard. Instead it can dedicateitself completely to processing your programs. The keyboard processornotifies the system if an event occurs that the operating system should beaware of.

The 6301 is not only responsible for the relatively boring task of reading thekeyboard, however. It also takes care of the rather complicated tasksrequired in connection with the mouse. The main processor is then fedsimply 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 keyboardcontroller.

In addition, this controller contains a real-time clock which counts inone-second increments.

67

Page 74: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.1-1 6850 Interface to 68000

in i»HI HW M H

VOHI

CO CM HIO ""J <!

0inoovo

IO N

Q oin

€Q

I

68

Page 75: Atari ST Internals

Abacus Software Atari ST Internals

In Figure 2.1-1 is an overview of the interface to the 68000. As you see, themain processors is burdened as little as possible. The ACIA 6850 ensuresthat it is disturbed only when a byte has actually been completely receivedfrom the keyboard. The ACIA, by the way, can be accessed at addressesSFFFCOO (control register) and $FFFC02 (data register). The individualconnection to the keyboard takes place over lines K14 and K15. K indicatesthe 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 theMFP 68901 which then generates an interrupt to the 68000. The clockfrequency 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 keyboardprocessor, 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. Thefunction is as simple as the figure is easy to read. The processor has 4K ofROM available. The 128 bytes of RAM is comparitively small, but it is usedonly as a buffer and for storing pointers and counters.

The lines designated with K are again the plug connections assigned to themain board. With few exceptions, the connections for the joystick andmouse are also put through. K16 is the reset line from the 68000. K15carries 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 thekeyboard matrix. One line from ports 3 and 4 is pulled low in a cycle. Thestate of port 1 is the checked, if a key is pressed, the low signal comesthrough on port 1.

Each key can be identified from the combination of value placed on ports 3and 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 stillequals zero, a joystick is active on the outer connecter 1. The data fromouter connector 0, to which a mouse or a joystick can be connected, doesnot come through by chance since it must first be switched through theNAND gate with port 2 (bit 0). The buttons on the mouse or the joystickthen arrive at port 2 (1 and 2).

69

Page 76: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.1-2 Block Diagram of Keyboard Circuit

V

A• niJJJI

v> m <* H «> t-H H H H H

M OH H

A 00 f-

70

Page 77: Atari ST Internals

Abacus Software Atari ST Internals

The assignments of the K lines to the signal names on the outer connecterare found in the next section.

The processor 6301 is completely independent, but it can also be configuredso that it works with an external ROM. Some of the port lines are thenreconfigured to act as address lines. The configuration the processorassumes (one of eight possibilities) depends on the logical signal placed onport 2 (bits 0-2) during the reset cycle. All three lines high puts theprocessor in mode 7, the right one for the task intended here. But bits 1 and2 depend on the buttons on the mouse. If you leave the mouse alone whilepowering-up, everything will be in order. If you hold the two buttonsdown, however, the processors enters mode 1 and makes a magnificentbelly-flop, since the hardware for this operating mode is not provided. Younotice this by the fact that the mouse cursor does not move on the screen ifyou 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 adrive mechanism.

The task of the mouse is to give the computer information about itsmovements. This information consists of the components: direction on theX-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 drivestwo encoder wheels whose drive axes are at angle of 90 degrees to eachother. The one or the other axis rotates more or less, forwards orbackwards, depending on the direction the mouse is moved.

It is no problem to determine the absolute movement on each axis. Theencoder wheels alternately interrupt the light barriers. One need only countthe pulses from each wheel to be informed about the path traveled on eachaxis.

71

Page 78: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.1.1-1 The Mouse

XA

OP

2 1 3 4 7 8 6 9

72

Page 79: Atari ST Internals

Abacus Software Atari ST Internals

It is more difficult when the direction of movement is also required. Thedesigners 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 thatthey are not shielded by the wheel at precisely the same time, but oneshortly after the other. This arrangement may not be so clear in Figure2.1.1-1, so we'll explain it in more detail The direction can be determinedby noticing which of the two light barriers is interrupted first. This is whythe 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 convertsthe 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 yousee it when you look at it from the outside. The designation behind the slashapplies when a joystick is connected and the number in parentheses is thepin 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

Page 80: Atari ST Internals

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 suchthings 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 inthe assembly language listing on page 80 (after command $21).

The "normal" action of the processor consists of keeping an eye on thekeyboard and announcing each keypress. This is done by outputting thenumber of the key when the key is pressed. When the key is released thenumber is set again, but with bit 7 set. The result of this is that no keynumbers greater than 127 are possible. You can find the assignment of thekey numbers to the keys at the end of this section in figure 2.1.2-1. Inreality these numbers only go up to 117 because values from $F6 up arereserved for other purposes. There must be a way to pass more informationthan just key numbers to the main processor, information such as the clocktime or the current position of the mouse. This cannot be handled in a singlebyte but only in something called a package, so the bytes at $F6 signal thestart of a package. Which header comes before which package is explainedalong with the individual commands.

A command to the keyboard processor consists of the command code (abyte) and any parameters required. The following description is sortedaccording to command bytes.

$07Returns the result of pressing one of the two mouse buttons. A parameterbyte with the following format is required:

74

Page 81: Atari ST Internals

Abacus Software Atari ST Internals

Bit 0 =1: The absolute position is returned when amouse button is pressed. Bit 2 must =0.

Bit 1 =1: The absolute position is returned when amouse button is released. Bit 2 must =0.

Bit 2 =1: The mouse buttons are treated likenormal keys. The left button is keynumber $74, the right is $75.

Bits 3-7 must always be zero.

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

1 byte Header in range $F8-$FB. The two lowestbits of the header indicate the conditionof 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 thatthe distance can no longer be expressed in one byte, another package isautomatically created which makes up for the remainder.

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

1 word Maximum X-coordinate1 word Maximum Y-coordinate

Mouse movements under the zero point or over the maximums are notreturned.

$OAWith this command it is possible to get the key numbers of the cursor keysinstead of the coordinates. A mouse movement then appears to the operatingsystem as if the corresponding cursor keys had been pressed. Theseparameters are necessary:

75

Page 82: Atari ST Internals

Abacus Software Atari ST Internals

1 byte Number of pulses (X) after which the keynumber for cursor left (or right) will besent.

1 byte Number of pulses (Y) after which the keynumber for cursor up (or down) will be sent.

$OBThis command sets the trigger threshold, above which movements will beannounced. A certain number of encoder pulses elapse before a package issent. This functions only in the relative operating mode. The following arethe parameters:

1 byte Threshold in X-direction1 byte Threshold in Y-direction

$ocScale mouse. Here is determined how many encoder pulses will go bybefore the coordinate counter is changed by 1. This command is valid onlyin the absolute. The following parameters are required:

1 byte X scaling1 byte Y scaling

$ODRead absolute mouse position. No parameters are required, but a package ofthe following form is sent:

1 byte Header = $F71 byte Button status

Bit 0 = 1 : Right button was pressed since thelast read

Bit 1 = 1: Right button was not pressedBit 2 = 1: Left button was pressed since the

last readBit 3 = 1 : Left button was not pressed

From this strange arrangement you can determine that the state of a buttonhas changed since the last read if the two bits pertaining to it are zero.

1 word Absolute X-coordinate1 word Absolute Y-coordinate

76

Page 83: Atari ST Internals

Abacus Software Atari ST Internals

$OESet the internal coordinate counter. The following parameters are required:

1 byte =0 as fill byte1 word X-coordinate1 word Y-coordinate

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

$10Set the origin for the Y-axis is up.

$11The data transfer to the main processor is permitted again (see $13).Any command other than $13 will also restart the transfer.

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

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

$14Every joystick movement is automatically returned. The packages sent havethe following format:

1 byte Header = $FE or $FF for joystick 0/11 byte Bits 0-3 for the position (a bit for each

direction), bit 7 for the button

$15End the automatic-return mode for the joystick. When needed, a packagemust be requested with $16.

$16Read joystick. After this command the keyboard sends a package asdescribed above.

77

Page 84: Atari ST Internals

Abacus Software Atari ST Internals

$17Joystick 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 1for 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 channelneeds to send the two bytes of the package.

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

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

1 byte RX1 byte RY1 byte TX1 byte TY1 byte VX1 byte VY

78

Page 85: Atari ST Internals

Abacus Software Atari ST Internals

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

$1BSet clock time. This command sets the internal real-time clock in thekeyboard processor. The values are passed in packed BCD, meaning a digit0-9 for each half byte, yielding a two-digit decimal number per byte. Thefollowing 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 digit1 byte Minutes, two digit1 byte Seconds, two digit

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

$1CRead clock time. After receiving this command the keyboard processorreturns a package having the same format as the one described above. Aheader is added to the package, however, having the value $FC.

$20Load memory. The internal memory of the keyboard processor (naturallyonly the RAM in the range $80 to $FF makes sense) can be written with thiscommand. It is not clear to us of what use this is since according to ourinvestigations (we have disassembled the operating system of the 6301), noRAM is available to be used as desired. Perhaps certain parameters can bechanged in this manner which are not accessible through "legal" means.Here are the parameters:

1 word Start address1 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

Page 86: Atari ST Internals

Abacus Software Atari ST Internals

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

1 word Address at which to read

A package having the following format is returned:

1 byte Header 1 =$F6. This is the status headerwhich precedes all packages containing anyoperating conditions of the keyboardprocessor. We will come to the generalstatus messages shortly.

1 byte Header 2 =$20 as indicator that thispackage carries the memory contents.

6 bytes Memory contents starting with the addressgiven in the command.

Here is a small program which we used to read the ROM in the 6301 andoutput it to a printer. Here you also see how the status packages arrive fromthe keyboard. These are normally thrown away by the 68000 operatingsystem. Section 3.1 contains information about the GEMDOS and XBIOScalls used.

i23456789

10111213141516

171819

00000000

000000040000000600000008OOOOOOOE

000000140000001A00000022

3F3C00224E4E548F41F90000000043F9000000D6

23C00000010423FOOOOC000001002189000C

prtchoutgemdosbiosxbiosstvecrdmwrkbdkbdvectermstart :

equequequequequ

equequequequequ

move . wtrapaddq . 1

lealeamove . 1move . 1

031131412$2125340

#kb#xb#2,0,akey

dO,

StVi

move.1

#kbdvec,-(a7)#xbios#2,a70,aOkeyin,aldO,saveastvec(aO,dO) , saveal,stvec(aO,dO)

80

Page 87: Atari ST Internals

Abacus Software Atari ST Internals

20 00000026

2122 0000002A23 000000302425 0000003426 0000003C27 0000003E28 0000004229 0000004430 0000004631 0000004A32 0000004C3334 0000004E3536 0000005437 0000005638 0000005839 0000005A40 0000005C4142 0000005E43 0000006044 0000006245 0000006846 0000006E47 0000007248 0000007449 0000007650 0000007C51 0000008052 0000008253 0000008454 0000008655 00000088

56 0000008A57 0000008C5859 0000009060 0000009261 0000009662 0000009A63 0000009C

64 0000009E6566 OOOOOOAO

383CFOOO

33C40000010A61000084

OC390000000000F867F63C3C0006610A5C44OC44FFFF6DDE6052

49F9000000F9

101C6106530666F84E75

3240E80802800000000F47F9000000E814330000E14A300902800000000F1433000030023F02E0486108301F6104103C0020

3FOO3F3COOOO3F3C00034E4D5C8F4E75

307900000104

move . w

loop:move . wbsr

wait:cmpi.bbeqmove . wbsraddq . w

cmpi . wbitbra

bufout :lea

bytout :move . b

bsrsubq.b

bnerts

hexout :movea . wIsr.bandi . 1leamove . bIsl.wmove . wandi . 1move . b

move . wmove . wIsr .wbsrmove . w

bsrmove . b

chrout :move . wmove . wmove . wtrap

addq . 1

rtsexit:

movea

#$fOOO,d4

d4,tbuf+lkeyout

#0,rbufwait#6,d6bufout#6,d4#$ffff,d4loopexit

rbuf+l,a4

(a4)+,dOhexout

#l.d6bytout

dO,al#4,dO#15, dOtable, a30(a3,dO),#8,d2al,dO#15, dO0(a3,dO) ,d2,dOd2,-(a7)#8,dOchrout(a7)+,dOchrout#" ",dO

dO,-(a7)

d2

d2

#prt,-(a7)#chout,-(a7)#bios#6,a7

savea, aO

81

Page 88: Atari ST Internals

Abacus Software Atari ST Internals

67 OOOOOOA6 203900000100

68 OOOOOOAC 2140000C

69 OOOOOOBO 3F3COOOO70 OOOOOOB4 4E417172 OOOOOOB6 13FCOOOOOOOOOOF873 OOOOOOBE 487900000109

74 OOOOOOC4 3F3C000275 OOOOOOC8 3F3C001976 OOOOOOCC 4E4E77 OOOOOOCE DFFC0000000878 OOOOOOD4 4E757980 OOOOOOD6 103C000881 OOOOOODA 43F9000000F88283 OOOOOOEO 12D884 OOOOOOE2 530085 OOOOOOE4 66FA86 OOOOOOE6 4E758788 OOOOOOE8 3031323334353637

88 OOOOOOFO 3839414243444546

89 OOOOOOF890 0000010091 0000010492 0000010893 00000109 2194 0000010A95 0000010C

move . 1move . 1

move . wtrap

keyout :move . b

peamove . w

move . w

trap

adda . 1

rtskeyin:

move . blea

repin :move . b

subq.b

bnerts

table:dc.b

rbuf: ds.bsave ds . 1savea ds . 1dummy ds.btbuf dc.b

ds.b.end

save/dO

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

#0,rbuf

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

18, dOrbuf ,al

(aO)+, (al) +#l,dOrepin

"0123456789ABCDEF"

81

11rdm2

82

Page 89: Atari ST Internals

Abacus Software Atari ST Internals

$22Execute routine. With this command you can execute a subroutine in the6301. Naturally, you must know exactly what it does and where it islocated, 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 messagesYou can at any time read the operating parameters of the keyboard bysimply adding $80 to the command byte with which you would to set theoperating mode (whose parameters you want to know). You then get astatus package back (header=$F6), whose format corresponds exactly tothose 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 =$F61 byte X-scaling1 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 evokedcommand back as such. For example, say you want to know what operatingmode the joystick is in ($14 or $15). You send the value $94 (or $95, itmakes no difference). As status package you receive, in addition to theheader, either $14 or $15 depending on the operating mode of the joystickhandler.

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 thekeyboard are too meager and who want to give it more "intelligence". Theprocessor 6301 is also available in "piggy-back" version, the 63P01(Hitachi). This model does not have ROM built in, but has a socket on thetop for an EPROM of type 2732 or 2764 (8K!). You can then realize yourown ideas and, for example, use the two joystick connections as universal4-bit I/O ports, for which you can also extend the command set in order toaccess the new functions from the XBIOS as well.

83

Page 90: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.1.2-1 ATARI ST Key Assignments

Id09

Id*O

f

to

AO

to

to

toM

10«fl

id

Idt-«

Id

U

Id•>

Idin

U

HD

HH

H"I

MO

to

M

10Id

10

*

toUI

tom

toJ

to

l-«O

10n

O•4

h"O

!-•H

Hto

HW

!-•«h

H(II

Mtn

Ha

t-«CO

Hto

t-»>•

Ma

UIU

0H

Oto

OId

0

0UI

Om

0~a

009

O*O

O>•

OD

O0

OD

to(D

Opa

-4O

-J

H

0

01M

Oi•a

-Jto

Ot

010

0,o

H

Ol

0109

atID

ft.

attd

0.

*

atUI

atat

84

Page 91: Atari ST Internals

Abacus Software Atari ST Internals

2.2 The Video Connection

Without this, nothing would be displayed. You would be tapping in thedark in the truest sense of the word. Conspicuous are the many pins on theconnection. Naturally more lines are required for hooking up an RGBmonitor than for a monochrome screen, but seven would be enough. Thereis also something special about the remaining lines. In Figure 2.2-1 youfind a block diagram in which you can see how the video connection is tiedto the system. The numbering of the pins is given on the figure on the nextpage, 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 amplifierconnected to the output of the sound chip. A high-impedanceearphone can be attached here if you do not use the originalmonitor.

2 Not used

3 GPO, General Purpose Output. This connection is available foryour use. The line has TTL levels and comes from I/O port A bit 6of the sound chip.

4 MONOCHROME DETECT. If this line, which leads to the 17input of the MFP 68901, is low, the computer enters thehigh-resolution monochrome mode. If the state of the line changesduring operation, a cold start is generated.

5 AUDIO IN leads to the input of the amplifier described in 1 and isthere 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 beamreturn of the monitor.

85

Page 92: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.2-1 Diagram of Video Interface

-DCYC

-CMPCS

R/-W

Al-5

DO-15

32MHz

-BLANK

GP O

AUDIO OUT-

H S Y N C

VSYNC

16MHz

+ 5V

SHIFT

10

11

3

1

9

12

4

5

AUDIO IN

-MONOMON

86

Page 93: Atari ST Internals

Abacus Software Atari ST Internals

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

11 MONOCHROME provides a monochrome monitor with theintensity signal.

12 VERTICAL SYNC takes care of the beam return at the end of thescreen.

13 GROUND.

A tip for the hardware hobbyist:

A plug to fit this connector is not available. If you want to make a plug forconnecting other monitors, simply use a piece of perf board in which youhave 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 forground.

Figure 2.2-2 Monitor Connector

4

3

12

5

9

13

87

Page 94: Atari ST Internals

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, theconnection to the system is somewhat unusual. The data lines and the strobeof the universal port of the sound chip are used. So you find these too onthe picture, in which the other lines, which will not be described in thesection, will not disturb you. They belong to the disk drive and RS-232interface and are handled there.

Here is the pin description:

I -STROBE indicates the validity of the byte on the data linesto the connected device by a low pulse.

2-9 DATA

I1 BUSY is always placed high by the printer when it is notable 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 atype D25-subminiature, a Cinch 36-pin (3M,AMP) and the appropriatelength of 25-conductor flat ribbon cable. You squeeze the connectors on thecable so that pins 1 match up on both sides (they are connected together).The other connections then match automatically. Note that there willnaturally be some pins free on the printer side.

Figure 2.3-1 Printer Port Pins

13

\5 14

Page 95: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.3-2 Centronics Connection

R/-W

-SNDCS

Al

2 MHz

-RESET

D8-15

SOUND

AUDIO IN

11

I O / T A 1

G P O

D R I V E O

DRIVE1

S I D E O

R T S

D T R

AUDIO OUT

89

Page 96: Atari ST Internals

Abacus Software Atari ST Internals

2.4 The RS-232 Interface

This interface usually serves for communication with other computers andmodems. 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 haveto do any special programming to use this interface. It is taken care of by theoperating system. Here the control of the interface is not controlled by aspecial 1C (UART) as is usually the case, but the lines are serviced more orless "by hand." The shift register in the MFP is used for this purpose. Thehandshake lines however come from a wide variety of sources. Note this inthe following pin description:

1 CHASSIS GROUND (shield)This is seldom used.

2 TxDSend data

3 RxDReceive data

4 RTSReady to send comes from I/O port A bit 3 of the soundchip and is always high when the computer is ready toreceive a byte. On the Atari, this signal is first placed lowafter receiving a byte and is kept low until the byte hasbeen processed.

5 CTSClear to send of a connected device is read at interruptinput 12 of the MFP. At the present time this signal ishandled improperly by the operating system. Therefore itis possible to connect only devices which "rattle" the lineafter every received byte (like the 520ST with RTS). Thesignal goes to input 12 of the MFP, but unfortunately istested only for the signal edge. You will not have any luckconnecting a printer because they usually hold the CTSsignal high as long as the buffer is not full. There is nosignal edge after each byte, which means that only thefirst byte of a text is transmitted, and then nothing.

90

Page 97: Atari ST Internals

Abacus Software Atari ST Internals

7 GNDSignal ground.

8 BCDCarrier signal detected. This line, which goes to interruptinput II of the MFP, is normally serviced by a modem,which tells the computer that connection has been madewith the other party.

20 DTRDevice ready. This line signals to a device that thecomputer is turned on and the interface will be serviced asrequired. It comes from I/O port A bit 4 of the soundchip.

22 RIRing indicator is a rather important interrupt on 16 of theMFP and is used by a modem to tell the computer thatanother party wishes connection, that is, someone called.

91

Page 98: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.4-1 RS-232 Connection

so

I/OA4

I/OA3

SI

16

12

II

1

I

II

2

20

4

3

22

5

8

13

714 25

92

Page 99: Atari ST Internals

Abacus Software Atari ST Internals

2.5 The MIDI Connections

The term MIDI is probably unknown to many of you. It is an abbreviationand stands for Musical Instrument Digital Interface, an interface for musicalinstruments.

It is certainly clear that we can't simply hook up a flute to this port. So firsta little history. Music professionals (more precisely: keyboardists,musicians who play the synthesizer) demanded agreement between thevarious manufacturers to interface computers to musical instruments. Theyfound it absurd to connect complicated set-ups with masses of wire. Theidea was to service several synthesizers from one keyboard.

The tone created was basically analog (and still is, to a degree), so that themanafacturers agreed that a control voltage difference of IV corresponded toa difference in tone of 1 octave. This way one could play several devicesunder "remote control," but not service them.

This changed substantially when the change was made to digital tonecreation. Here one didn't have to turn a bunch of knobs, there were buttonsto press, whereby the basis for digital control was created.

Some manufacturers got together and designed a digital interface, the basiccommands of which would be the same throughout, but which would stillsupport the additional features of a given device.

The device is based on the teletype, the current-loop principle, which is notvery susceptible to noise, but significantly faster. The transfer rate is 31250baud (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 forRS-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 beserviced by one master, or a device with 16 voices. These devices are allconnected to the same line (bus principle). To identify which device orwhich voice is intended, each data packet is preceded by the channelnumber. The device which recognizes mis number as its own then executesthe desired action.

93

Page 100: Atari ST Internals

Abacus Software Atari ST Internals

You may wonder what such an interface is doing in a computer. A computercan provide an entire arsenal of synthesizers with settings or completemelodies (sequencer) because of its high speed and memory capacity. It canalso be used to record and store input from a synthesizer keyboard.

For this purpose the ST has the interfaces MIDI-ESf and MIDI-OUT. Theinterfaces are even supported by the XBIOS so you don't have to worryabout their actual operation.

The current loop travels on pins 4 and 5, out through pin 4 (+) ofMIDI-OUT and in at 5, when a device is connected.

For MIDI-IN the situation is reversed because the current flows in throughpin 4 and back out through pin 5. It goes though something called anoptocoupler which electrically isolates the computer from the sender.

The receive data are looped back to MEDI-OUT (pins 1 and 3), whichimplements the MIDI-THRU function, although not entirely according tothe standard.

94

Page 101: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.5-1 MIDI System Connection

+5V

14

95

Page 102: Atari ST Internals

Abacus Software Atari ST Internals

2.6 The Cartridge Slot

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

Figure 2.6-1 The Cartridge Slot

4- 5 VH- 5 V

D 1 4D 1 5

D 1 2D 1 3D 1 O

D 1 1D8

D9D6D7

D4D5D2D3

DODl

A 1 3

A 1 6

Posit.ion :

12

34

56

7

891 01 11 21 31 41 51 61 71 81 92 0

2 12 22 32 42 52 62 72 82 93 03 13 23 33 43 53 63 73 83 94 0

A 8A 1 4

A 7A 9

A 6A 1 0

A 5

A 1 2A l l

A 4- R O M 3A 3- R O M 4

A 2- D O SA 1- L D S

G N DG N D

G N D

1

2120

40

96

Page 103: Atari ST Internals

Abacus Software Atari ST Internals

2.7 The Floppy Disk Interface

The interface for floppy disk drives is conspicuous because of the unusualconnector, a 14-pin DIN connector. All of the signals required for theoperation of two disk drives are available on it.

You know most of the signals from the description of the disk controller1772, since nine of the available connections are directly or via a bufferconnected to the controller. Only the drive select 1 and drive select 2 signalsand the side 0 select are not derived from the disk controller. These signalscome from port A of the sound chip.

Pinout of the disk connector:

1 READ DATA 8 MOTOR ON2 SIDE 0 SELECT 9 DIRECTION IN3 GND 10 STEP4 INDEX 11 WRITE DATA5 DRIVE 0 SELECT 12 WRITE GATE6 DRIVE 1 SELECT 13 TRACK 007 GND 14 WRITE PROTECT

97

Page 104: Atari ST Internals

Abacus Software Atari ST Internals

Figure 2.7-1 Disk Connection

CDO-7 YSS/S/SSA

CA2

CA1

CR/-W

-FDCS

-RESET

8MHz

I/OA2

I/OA1

I/OAO

FDC

10

8

10

8

4

1

6

5

2

FDRQ

INTR

98

Page 105: Atari ST Internals

Abacus Software Atari ST Internals

2.8 The DMA Interface

Up to 8 external devices can be connected to this 19-pin subminiature Dconnector. Such devices include hard disks, networks, and alsocoprocessors. The communication between the external devices and the STruns at speeds up to 1 million bytes per second. Unfortunately, noexperiments with DMA devices could be performed at the time this wasprinted. For this reason we cannot make the following statements with onehundred percent certainty.

The RESET line on pin 12 permits devices to be reset by the Atari. If thispin is low, as is the case when the Atari is turned on or when executing aRESET 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 beseen in connection with this, because it is then important if the controller hasmore than just one register. This signal can distinguish between tworegisters.

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 datafrom the bus (R/W is low). Data can be read or written only on the requestof the external device. The release of a transfer is signaled by the signalDRQ (pin 19).

The ACK signal on pin 14 appears to be a purely hardware-dependentconfirmation of the DRQ signal. The actual significance could not bechecked however.

The last signal on the DMA port is the INT input. A low on this connectioncan generate an interrupt The hard disk, for example, signals the end of thecommand through a low. The interrupt uses the same interrupt input on theMFP as the disk controller. This is input I/O 5. This means the at the floppydisk drive and the hard disk cannot transfer data together. The DMA is alsonot in such a position since it has only one DMA channel available.

The interrupt of this input is disabled in the MFP internally because thefloppy as well as the hard disk routines check the port bit in a loop in order

99

Page 106: Atari ST Internals

Abacus Software Atari ST Internals

to determine the end of the command. This simplifies the implementation ofthe time out, which is always generated when the floppy or hard disk hasnot reacted to the command within a certain length of time.

Figure 2.8-1 DMA Port10 i

19 11

Figure 2.8-2 DMA Connections

-RESET

INTR15

100

Page 107: Atari ST Internals

f*.

Chapter 3

f The ST Operating System J

3.1 The GEMDOS3.1.1 GEMDOS error codes and their meaning3.2 The BIOS Functions3.3 The XBIOS3.4 The Graphics3.4.1 An overview of the line-A variables3.4.2 Examples for using the line-A opcodes3.5 The Exception Vectors3.5.1 The interrupt structure of the ST3.6 The ST VT52 Emulator3.7 The ST System Variables3.8 The 68000 Instruction Set3.8.1 Addressing modes3.8.2 The instructions3.9 The BIOS listing

Page 108: Atari ST Internals
Page 109: Atari ST Internals

Abacus Software Atari ST Internals

The ST Operating System

GEMDOS—what is it? Is it in the ST? The operating system is supposed tobe TOS, though. Or CP/M 68K? Or what?

This question can be answered with few words. The operating system in theST is named TOS—Tramiel Operating System-after the head of Atari. ThisTOS, in contrast to earlier information has nothing to do with CP/M 68Kfrom Digital Research. At the start of development of the ST, CP/M 68Kwas implemented on it, but this was later changed because CP/M 68K is notexactly a model of speed and efficiency. A 68000 running at 8MHz andprovided with DMA would be slowed considerably by the operatingsystem.

At the beginning of 1985, Digital Research began developing a newoperating system for 68000 computers, which would include a user-levelinterface. This operating system was named GEMDOS. It is exactly thisGEMDOS which makes up the hardware-independent part of TOS. LikeCP/M, TOS consists of a hardware-dependent and a hardware-independentpart. The hardware-dependent part is the BIOS and the XBIOS, while thehardware-independent part is called GEMDOS. A large number of functionsare built into GEMDOS, through which the programmer can control theactual input/output functions of the computer. Functions for keyboard input,text output on the screen or printer, and the operation of the various otherinterfaces are all present. Another quite important group contains thefunctions for file handling and for logical file and disk management

103

Page 110: Atari ST Internals

Abacus Software Atari ST Internals

3.1 The GEMDOS

When you look at the functions available under GEMDOS, you willeventually come to the conclusion that the whole thing is not really new. Allthe functions in GEMDOS are very similar to the functions of the MS-DOSoperating system. Even the functions numbers used correspond to those ofMS-DOS. But not all MS-DOS functions are implemented in GEMDOS.Especially in the area of file management, only the UNIX compatiblefunctions are implemented in GEMDOS. The "old" block-orientedfunctions which are included in MS-DOS to maintain compatibility withCP/M are missing from GEMDOS. Also, special functions relating to thehardware of MS-DOS computers (8088 processor) are missing.

Another essential difference between MS-DOS and GEMDOS is that forGEMDOS calls as well as for the BIOS and XBIOS, the function number,the number of the desired GEMDOS routine, and the required parametersare placed on the stack and are not passed in the registers. The 68000 isparticularly suited to this type of parameters passing. GEMDOS is calledwith TRAP # 1 and the function is executed according to the contents ofthe parameter list After the call, the programmer must put the stack back inorder himself, by clearing the parameters from memory.

The basic call of GEMDOS functions differs from the BIOS and XBIOScalls only in the trap number.

In regard to all GEMDOS calls, it must be noted that registers DO and AOare changed in all cases. If a value is returned, it is returned in DO, or DOmay contain an error number, and after the call AO (usually) points to thestack address of the function number. Any parameters required in DO or AOmust be placed there before GEMDOS is called.

The remainder of this section describes the individual GEMDOS functions.

104

Page 111: Atari ST Internals

Abacus Software Atari ST Internals

$00 TERM

Calling GEMDOS with function number 0 ends the running program andreturns to the program from which it was started. For applications,programs started from the desktop, program control is returned to thedesktop. If the program was called from a different program, execution ispassed back to the calling program. This point is important for chainingprogram segments.

CLR.W -(SP)TRAP

$01 CONIN

CONIN fetches a single character from the keyboard. The routine waitsuntil a character is available. The result, the character read from thekeyboard, is returned in the DO register. The ASCII code of the pressed keyis returned in the low byte of the low word, while the low byte of the highword of the register contains the scan code returned from the keyboard.This is important when reading keys which have no ASCII code. Thisapplies 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 keypador the main keyboard were pressed, since these keys have identical ASCIIcodes, but return different scan codes.

MOVE.W #1,-(SP) * Function number on the stackTRAP #1 * Call GEMDOSADDQ.L #2,SP * Correct stack

105

Page 112: Atari ST Internals

Abacus Software Atari ST Internals

$02 CONOUT

CONOUT represents the simplest and most primitive character output ofGEMDOS. 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. TheASCII value of the character to be printed must be in the low byte of theword and the high byte should be zero.

The character printed by CONOUT is outputted to device number 2, thenormal console output. Control characters and escape sequences areinterpreted normally.

MOVE.W #'A',-(SP) * Output an AMOVE.W #2,-{SP) * CONOUTTRAP #1 * Call GEMDOSADDQ.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. Thefunction returns when a character has been completely received. Thecharacter 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 besent with this function. With this function the programmer should clear theupper eight bits of the word and pass the character to be sent in the lowereight bits.

106

Page 113: Atari ST Internals

Abacus Software Atari ST Internals

$05 PRINTER OUTPUT

PRINTER OUTPUT is the simplest method of operating a printer connectedto the Centronics interface. One character is printed with each call.

An important part of PRINTER OUTPUT is the return value in DO. If thecharacter was sent to the printer, the value -1 ($FFFFFFFF) is returned inDO. If, after 30 seconds, the printer was unable to accept the character (notturned on, OFF LINE, no paper, etc.), GEMDOS returns a time out to theprogram. DO then contains a zero.

MOVE.W #'A',-(SP) * Output an AMOVE.W #5,-(SP) * Function numberTRAP #1 * Call GEMDOS, output characterADDQ.L #4,SP * Correct stackTST.W DO * Affect flagsBEQ printererror

$06 RAWCONIO

RAWCONIO is a somewhat unusual mixture of keyboard input and screenoutput and receives a parameter on the stack.

With a function value of $FF the keyboard is tested. If a character ispresent, the ASCII code and scan code are passed in DO as described forCONIN. But if no key value is present, the value zero is passed as both theASCII code and the scan code in DO. The call to RAWCONIO withparameter $FF is comparable to the BASIC BSTKEYS function.

If a value other than $FF is passed to the function, the value is interpreted asa character to be printed and it is output at the current cursor position. Thisoutput also interprets the control characters and escape sequences properly.

107

Page 114: Atari ST Internals

Abacus Software Atari ST Internals

START:

MOVE.WMOVE.WTRAPADDQ.LTST.WBEQCMP.BBEQMOVEMOVETRAPADDQ.LBRA

#$FF,-(SP)#6,-<SP)#1#4,SPDOSTART#3, DOENDDO,-(SP)#6,-<SP)fl#4,SPSTART

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

* Character for output on the stack* Function number* Call GEMDOS, test keyboard* Correct stack* Get new character

$07 DIRECT CONIN WITHOUT ECHO

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

$08 CONIN WITHOUT ECHO

Function $08 does not differ from function $07. Both function calls haveexactly the same effect The reason for this seemingly nonsensical behaviorlies in the mentioned compatibility to MS-DOS. Under MS-DOS the twofunctions are different in that with $08, certain keys not present on theATARI are evaluated correctly, while this evaluation does not take placewith function $07.

108

Page 115: Atari ST Internals

Abacus Software Atari ST Internals

$09 PRINT LINE

You have already become familiar with functions to output individualcharacters on the screen with CONOUT and RAWCONIO. PRINT LINEoffers you an easy way to output text. An entire string can be printed at thecurrent cursor position with this function. To do this, the address of thestring is placed on the stack as a parameter. The string itself is concludedwith a zero byte. Escape sequences and control characters can also beevaluated 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 stackMOVE #$09,-(SP) * Function number PRT LINETRAP #1 * Call GEMDOSADDQ.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 thekeyboard. In contrast to the "simpler" character-oriented input functions, anentire input line can be fetched from the keyboard with HEADLINE. Thecharacters 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 maximumlength of the input line and must be initialized before the call. At the end ofthe routine, the second byte of the buffer contains the number of charactersentered. The characters themselves start with the third byte.

The routine used by HEADLINE for keyboard input is quite different fromthe character-oriented console inputs. Escape sequences are not interpretedduring the output. Only control characters like control-H (backspace) andcontrol-I (TAB) are recognized and handled appropriately. The followingcontrol characters are possible:

109

Page 116: Atari ST Internals

Abacus Software Atari ST Internals

AC Ends input AND program (!)AH Backspace one positionAI TABAJ Linefeed, end inputAM CR, end inputAR Entered line is printed in new lineU Don't count line, start new lineX Clear line, cursor at start of line

A

A function like AH, deleting a character entered, is useful, but for largeprograms you should write your own input routine because AC is very"dangerous." Unlike CP/M, the program will be ended even if the cursor isnot at the very start of the input line.

If more characters are entered than were indicated in the first byte of thebuffer at the initialization, the input is automatically terminated. If the inputis terminated by ENTER, AJ, or AM, the terminating character will not beput in the buffer.

After the input, DO contains the number of characters entered, excludingENTER, which can be found at buffer+1.

$OB CONSTAT

All key presses are first stored in a buffer in the operating system. Thisbuffer is 64 bytes in length. The key values stored there are taken from thebuffer when a call to a GEMDOS output routine is made.

CONSTAT can be used to check if characters are stored in the keyboardbuffer. After the call, DO contains the value zero or $FFFF. A zero in DOindicates that no characters are available.

$OE SETDRV

The current drive can be determined with the function SETDRV. A 16-bitparameter containing the drive specification is pased to the routine. Drive Ais 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

Page 117: Atari ST Internals

Abacus Software Atari ST Internals

$10 CONOUT STAT

CONOUT STAT returns the status of the console in DO. If the value $FFFFis returned, a character can be displayed on the screen. If the returned valueis 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. Theonly imaginable possibility for the not-ready status would be if the output ofthe individual bit pattern of a character was interrupted and the interruptroutine itself tried to output a character. This case could not, however, becreated.

$11 PRTOUT STAT

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

$12 AUXIN STAT

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

$13 AUXOUT STAT

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

$19 CURRENT DISK

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

Ill

Page 118: Atari ST Internals

Abacus Software Atari ST Internals

$1A SET DISK TRANSFER ADDRESS

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

MOVE.L #DTADDRESS,-(SP) * Address of the 44-byte DTA bufferMOVE.W #$1A,-(SP) * Function number SET DTATRAP #1 * Set DTAADDQ.L #6,SP * Clean up the stack

$20 SUPER

This function is especially interesting for programmers who want to accessthe peripheral components or system variables available only in thesupervisor mode while running a program in the user mode. After callingthis function from the user mode, the 68000 is placed in the supervisormode. In contrast to the XBIOS routine for enabling the supervisor mode,additional GEMDOS, BIOS, and XBIOS calls can be made after asuccessful SUPER call.

First we will look at the case in which the SUPER function is called from aprogram in the user mode with a value of zero on the stack. In this case theprogram finds itself in the supervisor mode after the call. The supervisorstack pointer is set to the value of the user stack pointer and the originalvalue of the supervisor stack pointer is returned in DO. This value should bestored 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 iscalled, this value is interpreted as the desired value of the supervisor stackpointer. In this case as well, DO contains the original value of the supervisorstack pointer, which the program should save.

Before a program ends, the user mode should be reenabled. This change ofoperating modes requires the address acquired the first time the routine wascalled in order to set the supervisor stack pointer back to its original value.

112

Page 119: Atari ST Internals

Abacus Software Atari ST Internals

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

* The 6800 is in the user modeCLR.L -(SP) * User stack becomes supervisor stackMOVE.W #$20,-(SP) * Call SUPERTRAP #1 * The supervisor mode is active

* after the TRAPADD.L $6,SP * DO = old supervisor stackMOVE.L DO,_SAVE_SSP * Save value

Here processing can be done in the supervisor mode

MOVE.L _SAVE_SSP,-(SP) * Old supervisor stack pointerMOVE.W #$20f-(SP) * Call SUPERTRAP #1 * Now we are back in the user modeADD.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 withclock time and date. It can be useful for some applications to have the dataavailable. The date can be easily determined by the GET DATE function.This function call requires no parameters and makes the date available in thelow word of register DO. It is rather thoroughly encoded, though, so thatthe 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 8contain the month in the value range 1 to 12, and the year is contained in

113

Page 120: Atari ST Internals

Abacus Software Atari ST Internals

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

$2B SET DATE

The clock time and date can also be set from application programs. This isparticularly interesting for programs which use the date and/or clock time.An example of this would be invoice processing in which the current date isinserted in the invoice. Such programs can then ask the user to enter thedate. This avoids the problems that occur if the user forgets to set the dateand clock time on the status field beforehand.

The date must be passed to the function SET DATE in the same format as itis 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/1985MOVE.W i$2B,-(SP) * Function number of SET DATETRAP fl * Set dateADDQ.L #6,SP * Repair stack

$2C GET TIME

The function GET TIME returns the current (read: set) time from theGEMDOS clock. Similar to the date, the clock time is coded in a specialpattern in individual bits of the register DO after the call. The seconds arerepresented in bits 0-4. But since only values from 0 to 31 can berepresented in 5 bits, the internal clock runs in two second increments. Inorder to get the correct seconds-result the contents of these five bits must bemultiplied by two. The number of minutes is contained in bits 5 to 10, whilethe remaining bits 11-15 give information about the hour (in 24-hourformat).

114

Page 121: Atari ST Internals

Abacus Software Atari ST Internals

$2D SET TIME

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

MOVE.W #%1000101010111101,-(SP) * Clock time 17:21:58MOVE.W f$2D,-<SP) * Function # of GET TIMETRAP #1 * Set dateADDQ.L f6,SP * Repair stack

$2F GET DTA

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

$30 GET VERSION NUMBER

Calling this function returns in DO the version number of GEMDOS. In theversion of GEMDOS currently in release, this question is always answeredwith $ODOO, corresponding to version 13.00. Official Atari documentationclaims that a value of $0100 should be returned for this version, thoughperhaps 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. Theprogram is also ended after a call to this function. $31 does differ from $00in several important points.

After processing TRAP #1, like TERM, control is passed back to theprogram which started the program just ended. In contrast to TERM, atermination condition can be communicated to the caller. While TERM

115

Page 122: Atari ST Internals

Abacus Software Atari ST Internals

returns the termination value zero (no error), zero or one may be selected asthe termination value for $31. A value other than zero means that an erroroccurred during program processing.

Another essential point lies in the memory management of GEMDOS. Whena program is started, the entire available memory space is made available toit. If the program is ended with TERM, the memory space is released andmade available to GEMDOS. The entire area of memory released is alsocleared, filled with zeros. The program actually physically disappears fromthe memory. With function $31, however, an area of memory can beprotected at the start address of the program. This memory area is notreleased when the program is ended and it is also not cleared. The programcould be restarted without having to load it in again.

KEPP PROCESS is called with two parameters. The example programsshows the parameter passing.

MOVE.W #0,-(SP) * Error code no error, else 1MOVE.L #$1000,-<SP) * Protect $1000 bytes at program startMOVE.W #$31,-(SP) * Function number, end programTRAP #1 * now

$36 GET DISK FREE SPACE

It can be very important for disk-oriented programs to determine the amountof free space on the diskette. Then you have the ability to request that theuser change disks at the appropriate time. "Disk full" messages or even dataloss can then be avoided.

Function $36 returns exactly this information. The number of the desireddisk drive and the address of a 16-byte buffer must be passed to thefunction. If the value 0 is passed as the drive number, the information isfetched from the active drive, a 1 takes the information from drive A, and a2 from drive B.

The information passed in the buffer is divided into four long words. Thefirst long word contains the number of free allocation units. Each file, evenif it is only eight bytes long, requires at least one such allocation unit

116

Page 123: Atari ST Internals

Abacus Software Atari ST Internals

The second long word gives information about the number of allocationunits present on the disk, regardless of whether they are already used or arestill free. For the "small," single-sided diskettes this value is $15C or 351,while the double-sided disks have $2C7 = 711 allocation units. The thirdlong word contains the size of a disk sector in bytes. For the Atari this isalways 512 bytes ($200 bytes).

In the last word is the number physical sectors belonging to an allocationunit. This is normally 2. Two sectors form one allocation unit.

The number of available bytes of disk space can easily be calculated fromthis information.

MOVE.W #0,-<SP)MOVE.L #BUFFER,-(SP)MOVE #$36,-(SP)TRAP flADDQ.L #8,SP

* Information from the active drive* Address of the 16-byte buffer* Function number

* Clean up stack

.bssBUFFER:f real :total:bps:pspal:

.ds

.ds

.ds

.ds

.1

.1

.1

.1

1111

****

Free allocation unitsTotal allocation unitsBytes /physical sectorPhys . sectors/alloc. unit

$39 MKDIR

A subdirectory can be created from the desktop with the menu option "NEWFOLDER". Such a subdirectory can also be created from an applicationprogram with a call to $39.

In order to create a new folder, the function $39 is given the address of thefolder name, also called the pathname. This name may consist of 8characters and a three-character extension. The same limitations apply topathnames as do to filenames. The pathname must be terminated with a zerobyte when calling MKDIR.

117

Page 124: Atari ST Internals

Abacus Software Atari ST Internals

After the call, DO indicates whether the operation was performedsuccessfully. If DO contains a zero, the call was successful. Errors areindicated through a negative number in DO. At the end of this chapter youwill find an overview of all of the error messages occurring on connectionwith GEMDOS functions.

MOVE.L ^pathname * Address of the pathnameMOVE #$39,-(SP) * Function numberTRAP #1ADDQ.L #6,SP * Repair stackTST.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. Asbefore, the pathname, terminated with a zero, is passed to RMDER. Theerror messages also correspond to those for MKDIR, with zero for successor a negative value for errors. An important error message should bementioned at this point. It is the message -36 ($FFFFFFCA). This is theerror message you get when the subdirectory you are trying to removecontains files.

Only empty subdirectories can be removed with RMDIR. In the event of thedescribed error message, one must first erase all of the files in the directorywith UNLINK ($41) and then call RMDIR again.

118

Page 125: Atari ST Internals

Abacus Software Atari ST Internals

$3B CHDIR

The system of subdirectories available under GEMDOS is exactly the sameform available under UNIX. This system is now running on systems withdiskette drives, but its advantages become noticeable first when a large massstorage device such as a hard disk with several megabytes of storagecapacity is connected to the system. After a while, most of the time wouldprobably be spent looking for files in the directory.

To better organize the data, subdirectories can be placed withinsubdirectories. It can therefore become necessary to specify severalsubdirectories 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 subdirectorycsorts . s. This subdirectory csorts . s is found in the subdirectorycf lies . s, which in turn is a subdirectory of hugos . dat. If the wholeexpression 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 wantto access another file via the same path (do you understand the termpathname?), the entire path must be entered again. But you can also makethe subdirectory specified in the path into the current directory, by callingCHDIR with the specification of the desired path. After this, all of the filesin the selected subdirectory can be accessed just by the filenames. The pathis set by the function.

MOVE.L #path,-(SP) * Address of the pathMOVE.W #$3B,-(SP) * Function numberTRAP #1ADDQ.L #6,SP * Repair stackTST.W DO * Error occurred?BNE error * Apparently

path:.dc.b '/hugos.dat/private.dat/', 0

119

Page 126: Atari ST Internals

Abacus Software Atari ST Internals

$3C CREATE

In all operating systems, the files are accessed through the sequence ofopening the file, accessing the data, (reading or writing), and then closingthe file. This "trinity" also exists under GEMDOS, although there is anexception. Under CP/M, for example, a non-existing file can also beopened. When a file which does not exist is opened, it is created. UnderGEMDOS, the file must first be created. The call $3C, CREATE, is usedfor this purpose. Two parameters are passed to this GEMDOS function: theaddress of the desired filename, and an attribute word.

If a zero is passed as the attribute word, a normal file is created, a file whichcan be written to as well as read from. If the value 1 is passed as theattribute, the file will only be able to be read after it is closed. This is a typeof software write-protect (which naturally cannot prevent the file fromdisappearing 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 createsa file with a "volume label." The volume label is the (optional) name whicha disk can be given when it is formatted. The disk name is then created fromthe maximum of 11 characters in the name and the extension. Files with oneof the last three attributes are excluded from the normal directory search. Onthe ST, however, they do appear in the directory.

When the function CREATE is ended, a file descriptor, also called a filehandle, is returned in DO. All additional accesses to the file take place overthis file handle (a numerical value bewteen 6 and 45). The handle must begiven when reading, writing, or closing files. A total of $28 = 40 files canbe opened at the same time.

If CREATE is called and a file with this name already exists, it is cut off atzero length. This is equivalent to the sequence delete the old file and create anew file with the same name, but it goes much faster.

If after calling CREATE you get a handle number back in DO, the file neednot be opened again with $3D OPEN.

120

Page 127: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.W #$0,-(SP)MOVE.L #filename,-(SP)MOVE.W #$3C,-(SP)TRAP #1ADDQ.L #8,SPTST DOBMI errorMOVE DO,handle

* File should have R/W status* Address of the filename on stack* Function number* Call GEMDOS* Clean up stack* Error occurred?* It appears so* Save file handle

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 tolength 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 inthe mode word, the opened file can only be read, with one it can only bewritten. With a value of 2, the file can be read as well as written. Thefilename, terminated with zero byte in the usual manner, is passed as thesecond parameter.

The OPEN function returns the handle number in DO as the result if the fileis present and the desired access mode is possible. Otherwise DO containsan error number. See the end of the chapter for a list of the error numbers.

121

Page 128: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.W #$2,-(SP)MOVE.L ffilenameMOVE.W #$3D,-(SP)TRAP #1ADDQ.L #8,SPTST.W DOBMI errorMOVE DO, handle

* File read and write* Address of the filename on* Function number* Call GEMDOS* Clean up the stack* Error occurred?* Apparently* Save file handle for later

the stack

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 accessedwithin a program, or when the program itself is ended. Especially whenwriting, files must absolutely be closed before the program ends or datamay be lost.

Files are closed by a call to CLOSE, to which the handle number is passedas a parameter. The return value will be zero if the file was closed correctly.

MOVE.W handle,-(SP)MOVE.W #$3E,-(SP)TRAP #1ADDQ.L #4,SPBMI error

* Handle number* Function number* Call GEMDOS* Error occurred?* Apparently

handle:.ds.w

122

Page 129: Atari ST Internals

Abacus Software Atari ST Internals

$3F READ

Opening and closing files is naturally only half of the matter. Data must bestored and the retrieved later. Reading such files can be done in a veryelegant 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 numberof 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 forREAD and WRITE operations. The device assignments are:

0 = Console input1 = Console output2 = RS-2323 = Printer

Numbers 4 and 5 also function as console input and output. When usingthese handle numbers, the system sometimes returns "invalid handlenumber". The correct programming and the exact purpose of these twonumbers is not known.

As return value, DO contains either an error number (hopefully not) or thenumber of bytes read without error. No message regarding the end of thefile is returned. This is not necessary, however, since the size of the file iscontained in the directory entry (see SEARCH FIRST/SEARCH NEXT). Ifthe file is read past the logical end, no message is given. The reading will beinterrupted at the end of the last occupied allocation unit of the file. Thenumber of bytes read in this case is always divisible by $400.

123

Page 130: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.L #buffer,-(SP)MOVE.L f$100,-(SP)MOVE.W handle,-(SP)MOVE.W #$3F,-{SP)TRAP #1ADD.L #12,SPTST.L DOBMI error

* Address of the data buffer* Read 256 bytes* Space for the handle number* Function number

* Did an error occur* Apparently

handle:. ds. w 1

buffer:.ds.b $100

Space for the handle number

* Suffices in our example

$40 WRITE

Writing to a file is just as simple as reading from it The parameters requiredare also the same as those required for reading. The file descriptors fromOPEN and CREATE calls can be used as the handle, but the devicenumbers listed for READ can also be used. The output of a program can besent to the screen, the printer, or in a file just by changing the handlenumber.

$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 bepassed to the function. If the DO register contains a zero after the call, thefile has been deleted. Otherwise DO will contain an error number.

124

Page 131: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.L pathname,-(SP) * Address of the data bufferMOVE.W #$41,-(SP) * Function numberTRAP flADD.L #6,SPTST.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 desiredinformation. An internal file pointer which points to the next byte to be readgoes along with each read. We can only move this pointer continuously inthe direction of the end of file by reading. A few bytes forward orbackward, setting the pointer as desired, is not something we can do. Thisis required for many applications, however.

LSEEK offers an extraordinarily easy-to-use method of setting the filepointer to any desired byte within the file and to read or write at thispoint.This UNIX-compatible option of GEMDOS is much easier to use thatthe methods available under CP/M for relative file management, forinstance.

A total of three parameters are passed to the LSEEK function. The firstparameter specifies the number of bytes by which the pointer should bemoved. An additional parameter is the handle number of the file. The lastparameter is a mode word which describes how the file is to be moved. Azero as the mode moves the pointer to the start of the file and from there thegiven number of bytes toward the end of the file. Only positive values maybe used as the number. With a mode value of 1, the pointer is moved thedesired positive or negative amount from the current position, and a 2 as themode value means the distance specified is from the end of the file. Onlynegative values are allowed in this mode.

125

Page 132: Atari ST Internals

Abacus Software Atari ST Internals

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

MOVE.W #1,-(SP) * Relative from the current file ptrMOVE.W handle,-(SP) * File handleMOVE.L #$-20,-(SP) * 32 bytes backMOVE.W #$42,-(SP) * Function numberTRAP #1ADD.L #10,SPTST.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. Thisattribute can be determined and subsequently changed only with the functionCHANGE MODE. The name of the file must be known because the addressof the name or the complete pathname must be passed to CHMOD. Anotherparameter word specifies whether the file attribute is to be read or set.Moreover, a word must be passed which contains the new attribute. Whenreading the attribute of a file this word is not necessary, but should bepassed to the routine as a dummy value. We indicated the possible fileattributes in our discussion of the function CREATE, but here they are againin 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

Page 133: Atari ST Internals

Abacus Software Atari ST Internals

MKDIR is used to create a subdirectory. The MKDIR function creates notonly the directory entry with the appropriate attribute, it also arranges thesubdirectory on the disk physically.

After the call, DO will contain the current attribute value, which will be thenew value after setting the attribute, or, as with all other function calls, anegative error number.

First example:

MOVE.W #1,-(SP) * Give file READ ONLY attributeMOVE.W #1,-(SP) * Set attributeMOVE.L fpathname,-(SP) * We also need the pathnameMOVE.W #$43,-(SP)TRAP #1ADD.L #10,SPTST.W DOBMI error

* Function number

* Did an ,error occur?* Apparently

pathname: * Don't forget zero byte at end!.dc.b 'killme.not',0

Second example:

MOVE.W #0,-(SP)MOVE.W #0,-(SP)

* Dummy value, not actually required* Read attribute

MOVE.L #pathname,-(SP) * and the pathnameMOVE.W #$43,-(SP) * Function numberTRAP #1ADD.L #10,SPTST.W DO * Did an error occur?BMI error * Apparently

pathname:.dc.b

* Don't forget zero byte at the end!'what—am.i',0

127

Page 134: Atari ST Internals

Abacus Software Atari ST Internals

$45 DUP

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

$46 FORCE

The FORCE function allows further manipulation of the handle numbers. Ifin a program the console input and output are used exclusively via theREAD and WRITE functions with the handle numbers 0 and 1, the input oroutput can be redirected with a call to this function. Screen outputs arewritten to a file, inputs are not taken from the keyboard, but from apreviously-opened file.

$47 GETDIR

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

128

Page 135: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.W #0,-(SP) * Get pathname of the current driveMOVE.L #buffer,-(SP) * Address of the 64-byte bufferMOVE.W #$47,-(SP) * Function numberTRAP #1ADDQ.L #8,SPTST.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 andSETBLOCK, 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 isloaded. This is uncritical in many cases, because only a single program isrunning. But there are applications under GEMDOS in which suchorganization is not sensible. An accessory such as the VT-52 emulator maybe called from within a program, for example. Such a program also requiresmemory space, but the memory might not be available. No further programmodules can be loaded if the entire memory is occupied. For this reason,each program should reserve only the space which it actually needs for theprogram and data. The memory not required can be given back toGEMDOS.

If the program should need some of the memory it gave back, it can requestmemory from GEMDOS via the function MALLOC (memory allocate). Thenumber of bytes required is passed to MALLOC. After the call, DO containsthe starting address of the memory area reserved by the call or an errormessage if an attempt is made to reserve more memory than is actuallyavailable.

If -1L is passed as the number of bytes to be allocated, the number of bytesavailable is returned in DO.

129

Page 136: Atari ST Internals

Abacus Software Atari ST Internals

First example:

MOVE.L #-l,-(SP)MOVE.W #$48,-(SP)TRAP #1ADDQ.L #6,SP

* Determine number of free bytes* Function number

* Number of free bytes in DO

Second example:

MOVE.L #$1000,-(SP)MOVE.W #$48,-(SP)TRAP #1ADDQ.L #6,SPTST.W DOBMI errorMOVE.L D0,mstart

* Get hex 1000 bytes for the program* Function number

* Error or address of memory?* Negative long word = error!* Else start addr of the reserved area

mstart:.ds.l

$49 MFREE

An area of memory reserved with MALLOC can be released at any timewith MFREE. To do this, GEMDOS is passed the address of the memoryto 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 GEMDOSwithout error. A negative values indicates errors.

130

Page 137: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.L mstart,-(SP) * Addr of a previously allocated areaMOVE.W #$49,-(SP)TRAP #1ADDQ.L #6,SPTST.L DOBNE error

* Function number

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

mstart:.ds.l 1

$4A SETBLOCK

In contrast to the MALLOC function, a specific area of memory can bereserved with the function SETBLOCK. The memory beginning at thespecified address is returned to GEMDOS, even if it was reserved before.This function can be used to reserve the actual memory requirements of aprogram and release the remaining memory.

The parameters the function requires are the starting address and the lengthof the area to be reserved. The area specified with these parameters is thenreserved by GEMDOS and is not released again until the end of the programor after calling the MFREE function.

Usually programs will begin with the following command sequence orsomething similar. After the call, DO must contain zero, otherwise an erroroccurred.

131

Page 138: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.L A7,A5MOVE.L #USTCK,A7MOVE.L 4(A5),A5

MOVE.L $C(A5),DOADD.L $14(A5),DO

* Save stack pointer in A5* Set up stack for the program* A5 now points to the base-page start* exactly $100 bytes below the prg start* $C(A5) contains length of the prg area* $14 (A5) cohtaing the length of the

ADD.L $1C(A5),DO

ADD.LMOVE.L

#$100,DODO,-(SP)

MOVE.L A5,-(SP)

MOVE.WMOVE.WTRAPADD.LTST.LBNE

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

* initialized data area* $1C(A5) contains length of the* uninitialized data area* Reserve $100 bytes base page* DO contains the length of the area* to be reserved* A5 contains the start of the area* to be reserved* Meaningless word, but still necessary!* Function number

* Clean up the stack as usual* Did an error occur?* Stop* Here the program continues...

$4B EXEC

The EXEC function permits loading and chaining programs. If desired, theprogram loaded can be automatically started. In addition to the functionnumber, the addresses of three strings and a mode word are expected on thestack.

The first address is a pointer to something called an "environment" string, astring which describes the "environment." If the environment is not set, theaddress of a null string, the address of a zero byte, will suffice.

The second pointer contains a command line for the program being called. Acommand line is comparable to the line which may be entered from thecommand mode when you have selected the point "TOS -takes parameters"from the option "Options".

132

Page 139: Atari ST Internals

Abacus Software Atari ST Internals

The third pointer points to the filename or pathname of the file. All threestrings 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 startsthe loaded program automatically, while a three loads the program withoutautomatically executing it. In this last case, either the address of the basepage or an error message is returned in DO.

MOVE.LMOVE.LMOVE.LMOVE.WMOVE.WTRAPADD.L

fil:

com:

env:

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

* Environment* Command line* Filename* Load and start, please* Function number

* Here we come to the end of the* chained program or postloaded module

* Load sort routine.dc.b "qsort.prg1,0

* Sort the file in ascending order.dc.b 'up data.asc",0

* 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 bythe program available to GEMDOS again. Different from TERM $00,however, a programmer-defined return value other than zero can be returnedto the caller. This allows a short message to be passed back to the callingprogram.

133

Page 140: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.W #37,-<SP) * Any 2-byte valueMOVE.W #$4C,-(SP) * End programTRAP #1 * now

* We never get here

$ 4E SFIRST

The SFIRST function can be used to check to see if a file with the givenname is present in the directory. If a file with the same name is found, thefilename, the file attribute, data and time of creation, and the size of the filein bytes is returned. This information is placed in the DTA buffer, whoseaddress is set with the SETDTA function, by GEMDOS.

One feature of this function is that the filename need not be specified in itsentirety. Individual characters in the filename can be exchanged for aquestion 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 thiscase the first file in the directory would satisfy the conditions and thefilename would appear in the DTA buffer along with the other information.

In addition to the filename, the SFIRST function must also be given asearch attribute. The possible parameters of the search attribute correspondto 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 whenthe corresponding attribute bits are set. Volume labels are notrecognized, however.

134

Page 141: Atari ST Internals

Abacus Software Atari ST Internals

In order to get the volume label, this option must be expresslyset in the attribute word. All other files are then ignored.After the call, DO contains the value zero if a corresponding filehas been found. In this case the 44-byte DTA buffer isconstructed as follows:

Reserved for GEMDOSFile attributeClock time of file creationDate of file creationFile size in bytes (long)Name and extension of the file

If, however, no file is found which corresponds to the specified searchstring, the error message -33, file not found, is returned.

BytesByteBytesBytesBytesBytes

0-202122-2324-2526-2930-43

MOVE.L #dta,-(SP)MOVE.W #1A,-(SP)TRAP #1ADDQ.L f6,SPMOVE.W #attrib,-(SP)MOVE.L #filnam,-(SP)MOVE.W #$4E,-(SP)TRAP . #1ADDQ.L #8,SPTST DOBNE not found

attrib:.dc.b 0

f ilnam:

* Set up DTA buffer* Function number SETDTA

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

* File found?* Apparently not

* Search for normal files

for

only

.dc.b '*.*',0 * Search for the 1st possible file

dta:.ds.b 44 * Space for the DTA buffer

135

Page 142: Atari ST Internals

Abacus Software Atari ST Internals

$4F SNEXT

The SNEXT function (Search next) can be used to see if there are other fileson the disk which match the filename given. To do this, only the functionnumber need be passed; SNEXT does not require any parameters. All of theparameters are set from the SFERST call.

If the search string is very global, as in the previous example, all of the fileson a diskette can be determined and displayed one after the other withSFIRST and SNEXT. This makes it rather easy to display a directorywithin a program. The SNEXT function is called repeatedly and thecontents 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 operatingsystem in one form or another, since renaming files is required fairly often.Under GEMDOS, files are renamed with the RENAME function, whichrequires two pointer to file or pathnames. The first pointer points to the newname, with the specification of the pathname of the file if necessary, andthe second pointer points to the previous name. A 2-byte parameter isrequired in addition to the two pointers. We were not able to determine thesignificance of the additional word parameter. Different values had no(recognizable) effect

As a return value, DO contains either zero, meaning that the name waschanged correctly, or an error code.

136

Page 143: Atari ST Internals

Abacus Software Atari ST Internals

MOVE.L tnewnam,-(SP)MOVE.L #oldname,-(SP)MOVE.W #Q,-(SP)MOVE.W i$56,-(SP)TRAP flADD.L #12,SPTST.L DO

* New filename* File to rename* Dummy?* Function number

* 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 dateand time of file creation as well as the size of the file in bytes is shown. Thetime and date can either be set or read with function $57. To do this it isnecessary that the file be already opened with OPEN or CREATE. Thehandle 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 timeand data are to be set (0) or read (1), and a pointer to a 4-byte buffer whicheither contains the result data or will be provided with the required databefore the call.

This date buffer contains the time in the first two byes and the date in thelast two. The format of the data is identical to that of the functions forsetting/reading the time and date.

137

Page 144: Atari ST Internals

Abacus Software Atari ST Internals

Example 1:

MOVE.W #1,-(SP) * Read time and dateMOVE.W #handle,-(SP) * File must first be openedMOVE.L #buff,-(SP) * 4 byte bufferMOVE.W f$57,-(SP) * Function numberTRAP #1ADD.L #10, SP

handle:. ds . b 2

buff:.ds.b 4

Example 2:

MOVE.W #0,-(SP) * Set time and dateMOVE.W fhandle,-(SP) * File must first be openedMOVE.L fbuff,-(SP) * 4 byte bufferMOVE.W #$57,-(SP) * Function numberTRAP #1ADD.L #10,SP

handle:-ds.b 2

buff:.ds.b 4

138

Page 145: Atari ST Internals

Abacus Software Atari ST Internals

3.1.1 GEMDOS error codes and their meaning

The GEMDOS functions return a value giving information about whether ornot an error occurred during the execution of the function. A value of zeromeans 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 section3.3

139

Page 146: Atari ST Internals

Abacus Software Atari ST Internals

3.2 The BIOS Functions

The software interface between the GEMDOS and the hardware of thecomputer is the BIOS (Basic Input Output System). The BIOS, as the namesuggests, is concerned with the fundamental input/output functions. Thisincludes screen output, keyboard input, printer output, as well as theRS-232 interface and, of course, input/output to the disk.

The BIOS functions are also available to user programs. The TRAPinstruction of the 68000 processor is used to call them. Any data required ispassed through the stack and the result of the function is returned in the DOregister. The machine language programmer should be aware that thecontents 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 usesimple function calls with the corresponding parameter lists. The functioncalls are stored as macros in an include file. In the examples, the definitionof the function and its parameters in C will be shown. For assemblylanguage programmers, the use is described in an example.

TRAP f 13 is reserved for the BIOS functions.

140

Page 147: Atari ST Internals

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 #13addq.l #6,sp

This function fills a 12-byte block whose address is contained in pointerwith the memory parameter block. This block contains three pointers itself:

long mfl Memory free listlong mal Memory allocated listlong rover Roving pointer

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

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

Example:

move.l #bufferf-(sp) Buffer for MPBmove.w #0,-(sp) getmpbtrap #13 Call BIOSaddq.l #6,sp Stack correction

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

link 0 No additional blockstart $3B900 Start address of the free memorylength $3C700 Length of the free memoryown 0 No process descriptor

141

Page 148: Atari ST Internals

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 #13addq.l #4,sp

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

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

The parameter dev specifies the input device:

dev Input device0 PRT:, Centronics interface1 AUX:, RS-232 interface2 CON:, Keyboard and screen3 MIDI, MIDI interface4 IKBD, Keyboard port

The following table lists the allowed accesses to these devices:

Operation PRT: AUX: CON: MIDI IKBDInput status no yes yes yes noInput yes yes yes yes yesOutput status yes yes yes yes yesOutput yes yes yes yes yes

This example waits until a character from the RS-232 interface is ready.

wait move.w #l,-(sp) RS-232move.w fl,-(sp) bconstattrap #13addq.l #4,sptst dO character available?beq wait no, wait

142

Page 149: Atari ST Internals

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 #13addq.l #4,sp

This function fetches a character from an input device. The parameter devhas the same meaning as in the previous function. The function does notreturn until a character is ready.

The character received is in the lowest byte of the result. If the input devicewas the keyboard (con, 2), the key scan code is also returned in the lowerbyte of the upper word (see description of the keyboard processor).

Example:

move.w #2,—(sp) conmove.w #2,-(sp) bconintrap #13addq.l #4,sp

143

Page 150: Atari ST Internals

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 #13addq.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 returnswhen the character has been outputted.

Example:

move.w #*A',-(sp)move.w #0,-(sp) PRT:move.w #3,-(sp) bconouttrap #13addq.l #6,sp

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

144

Page 151: Atari ST Internals

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 #13add.l #14,sp

This function serves to read and write sectors on the disk. The parametershave the following meaning:

rwflag Meaning0 Read sector1 Write sector2 Read sector, ignore disk change3 Write sector, ignore disk change

The parameter buffer is the address of a buffer into which the data will beread from the disk or from which the data will be written to the disk. Thebuffer should begin at an even address, or the transfer will run very slowly.

The parameter number specifies how many sectors should be read or writtenduring the call. The parameter recno specifies which logical sector theprocess will start with.

The parameter dev determines which disk drive will be used:

dev Drive0 Drive A1 Drive B2 Hard disk

145

Page 152: Atari ST Internals

Abacus Software Atari ST Internals

The function returns an error code as the result. If this value is zero, theoperation was performed without error. The returned value will be negativeif 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 Amove.w #10,-(sp) Start at logical sector 10move.w #2,-(sp) Read 2 sectorsmove.l fbuffer,-(sp) Buffer addressmove.w #0,-(sp) Read sectorsmove.w #4,-(sp) rwabstrap #13add.l #14,sp

buffer ds.b 2*512

146

Page 153: Atari ST Internals

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 #13addq.l #8,sp

The function set exec allows one of the exception vectors of the 68000processor to be changed. The number of the vector must be passed innumber and the address of the routine pertaining to it in vector. Thefunction returns the old vector as the result. If you just want to read thevector, pass the value -1 as the new address. The 256 processor vectors aswell 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 #13addq.l #8,sp

buserror

147

Page 154: Atari ST Internals

Abacus Software Atari ST Internals

6 tickcal return millisecond per tick

C: long tickcal {)

Assembler:

move.w #6,-{sp)trap #13addq.l #2,sp

This function returns the number of milliseconds between two system timercalls.

Example:

move.w #6,-(sp)trap #13addq.l #2,sp

Result: 20 ms

148

Page 155: Atari ST Internals

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 #13addq.l #4,sp

This function returns a pointer to the BIOS Parameter Block of the drivedev (0=drive A, l=drive B).

The BPB (BIOS Parameter Block) is constructed as follows:

int recsiz Sector size in bytesint clsiz Cluster size in sectorsint clsizb Cluster size in bytesint rdlen Directory length in sectorsint fsiz FAT size in sectorsint fatrec Sector number of the second FATint datrec Sector number of the first data clusterint numcl Number of data clusters on the diskint bflags Misc. flags

The function returns the address $3E3E for drive A and the address $3E5Efor drive B. An address of zero indicates an error.

Example:

move.w #0,-(sp) Drive Amove.w #7,-(sp) getbpbtrap #13addq.l #4,sp

149

Page 156: Atari ST Internals

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 DSrecsiz 512 512clsiz 2 2clsizb 1024 1024rdlen 7 7fsiz 5 5fatrec 6 6datrec 18 18numcl 351 711

150

Page 157: Atari ST Internals

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 #13addq.l #4,sp

This function tests to see if the output device specified by dev is ready tooutput the next character, dev can accept the values which are described infunction one. The result of this function is either -1 if the output device isready, or zero if it must wait

Example:

move.w #0,-{sp) Printer ready?move.w #8,-(sp) bcostattrap #13addq.l #4,sp

151

Page 158: Atari ST Internals

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 #13addq.1 # 4, sp

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

0 Diskette was definitely not changed1 Diskette may have been changed2 Diskette was definitely changed

Example:

move.w #l,-(sp) Drive Bmove.w #9,-(sp) mediachtrap #13addq.l #4,sp

152

Page 159: Atari ST Internals

Abacus Software Atari ST Internals

10 drvmap inquire drive status

C: long drvmap < )

Assembler:

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

This function returns a bit vector which contains the connected drives. Thebit number n is set if drive n is available (0 means A, etc.). Even if only onedrive is connected, %11 is still returned, since two logical drives areassumed.

Example:

move.w #10,-(sp) drvmaptrap #13addq.1 #2 , sp

153

Page 160: Atari ST Internals

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 #13addq.l #4,sp

With this function you can change or determine the status of the special keyson the keyboard. If mode is -1, you get the status, a positive value isaccepted as the status. The status is a bit vector which is constructed asfollows:

Bit Meaning0 Right shift key1 Left shift key2 Control key3 ALT key4 Caps Lock on5 Right mouse button (CLR/HOME)6 Left mouse button (INSERT)7 Unused

Example:

move.w #-l,-(sp) Read shift statusmove.w #11,-(sp) kbshifttrap #13addq.l #4,sp

154

Page 161: Atari ST Internals

.^$^ fjf-%

Page 162: Atari ST Internals

Abacus Software Atari ST Internals

3.3 The XBIOS

To support the special hardware features of the Atari ST, there are extendedBIOS functions, which are called via a TRAP 114 instruction. Thefunctions, like the normal BIOS functions, can be called from assemblylanguage as well as from C. When calling from C, a small TRAP handler inmachine language is again necessary, which can look like this:

trap!4:move.l (sp)+, ret save Save return addresstrap #14 Call XBIOSmove.l retsave,-(sp) Restore return addressrts

.bssretsave 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 functionnumber and TRAP call will be created when the macro is expanded.

When working in assembly language, the function number of the XBIOSroutine need simply be passed on the stack. The XBIOS has 40 differentfunctions whose signficance and use are described on the following pages.

155

Page 163: Atari ST Internals

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 #14add.l #12,sp

This XBIOS function initializes the routines for mouse processing. Theparameter vector is the address of a routine which will be executedfollowing a mouse-report from the keyboard processor. The parameter typeselects from among the following alternatives:

type0 Disable mouse1 Enable mouse, relative mode2 Enable mouse, absolute mode3 unused4 Enable mouse, keyboard mode

This allows you to select if mouse movements are to be reported and inwhat manner this will occur.

The parameter parameter points to a parameter block, which is constructedas follows:

char topmodechar buttonschar xparamchar yparam

The parameter topmode determines the layout of the coordinate system. A 0means that Y=0 lies in the lower corner, 1 means that Y=0 lies in the uppercorner.

156

Page 164: Atari ST Internals

Abacus Software Atari ST Internals

The parameter buttons is a parameter for the command "set mousebuttons" of the keyboard processor (see description of the IKBD, intelligentkeyboard).

The parameters xparam and yparam are scaling factors for the mousemovement. If you have selected 2 as the type, the absolute mode, theparameter block determines four more parameters:

int xmaxint ymaxint xstartint ystart

These are the X and Y-coordinates of the maximal value which the mouseposition can assume, as well as the start value to which the mouse will beset.

Example:

move.l tvector,-(sp) Address of the mouse positionmove.l tparameter,-(sp) Address of the parameter blockmove.w #l,-(sp) Enable relative mouse modemove.w #0,-(sp) Init mousetrap #14add.l #12,sp

parameter dc.b

vector ... Mouse interrupt routine

157

Page 165: Atari ST Internals

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 #14addq.l #4,sp

This function reserves memory space. The number of bytes must be passedin number. The memory space is prepared at the upper end of memory. Thefunction returns the address of the reserved memory area as the result. Thisfunction must be called before initializing the operating system, meaningthat is must be called from the boot ROM, before the operating system isloaded.

Example:

move.w #$400,-(sp) Reserve IKmove.w #l,-(sp) ssbrktrap #14addq.l #4,sp

158

Page 166: Atari ST Internals

Abacus Software Atari ST Internals

2 physbase return screen RAM base address

C: long physbase()

Assembler:

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

This function returns the base of the physical screen RAM. The physicalscreen 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

Page 167: Atari ST Internals

Abacus Software Atari ST Internals

3 logbd.se set logical screen base

C: long logbase()

Assembler:

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

The logical screen base is the address which is used for all output functionsas the screen base. If the physical and logical screen bases are different, onescreen will be displayed while another picture is being constructed in adifferent area of RAM, which will be displayed later. The result of thisfunction call is again a longword.

Example:

$78000, base address of the screen for 512K RAM

160

Page 168: Atari ST Internals

Abacus Software Atari ST Internals

4 getrez return screen resolution

C: int getrez()

Assembler:

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

This function call returns the screen resolution:

0 := Low resolution, 320*200 pixels, 16 colors1 := Medium resultion, 640*200 pixels, 4 colors2 := High resolution, 640*400, pixels, monochrome

Example:

2 r monochrome

161

Page 169: Atari ST Internals

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 #14add.l #12,sp

This function changes the screen parameters which can be read with theprevious three functions. If a parameter should not be set, a negative valuemust be passed. The parameters are set in the next VBL routine so that nodisturbances appear on the screen.

Example:

Set the physical and the logical screen address to $70000, retain theresolution.

move.w #-l,-(sp) Retain resolutionmove.l #$70000,-(sp) Physical basemove.l #$70000,-(sp) Logical basemove.w #5,-(sp) setscreentrap #14add.l #12,sp

162

Page 170: Atari ST Internals

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 #14addq.l #6fsp

A new color palette can be loaded with this function. The parameterpaletteptr must be a pointer to a table with 16 colors (each a word). Theaddress of the table must be even. The colors will be loaded at the start ofthe next VBL. Example:

move.l #palette,-(sp) Address of the new color palettemove.w #6,-(sp) set palettetrap #14addq.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

Page 171: Atari ST Internals

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 #14addq.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 thecolor, the color is not set but the previous color is returned.

Example:

move.w #$777,-(sp) Color whitemove.w #l,-(sp) As color number 1move.w #7,-(sp)trap #14addq.l #6,sp

164

Page 172: Atari ST Internals

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 #14add.l #20,sp

This function reads one or more sectors in from the diskette. The parametershave the following meaning:

count: Specifies how many sectors are to be read. Values betweenone and nine (number of sectors per track) are possible.

side: Selects the diskette side, zero for single-sided drives andzero or one for double-sided drives.

track: Determines the track number (0-79 for 80-traek drives or0-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. Thebuffer must begin on a word boundary and be large enoughfor the data to be read (512 bytes times the number ofsectors).

165

Page 173: Atari ST Internals

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 sectormove.w #0,-(sp) Page zeromove.w #0,-(sp) Track zeromove.w #l,-(sp) Sector onemove.w #l,-(sp) Drive Bclr.l -(sp)move.l fbuffer,-(sp)move.w f8,-(sp) floprdtrap #14add.l #20,sptst dO Did error occur?bmi error yes

buffer ds.b 512 Buffer for a sector

166

Page 174: Atari ST Internals

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 #14add.l #20,sp

One or more sectors can be written to disk with this XBIOS function. Theparameters have the same meaning as for the function & floprd. The functionreturns an error code which also has the same meaning as for readingsectors. Example:

move.w #3,-(sp) Write three sectorsmove.w #0,-(sp) Side zeromove.w #7,-(sp) Track sevenmove.w #l,-(sp) Sector onemove.w #0,-(sp) Drive Aclr.l -(sp)move.l #buffer,-(sp) Address of the buffermove.w #9,-(sp) flopwrtrap #14add.l #20,sptst dO Did an error occur?bmi error yes

buffer ds.b 3*512 Buffer for three sectors

167

Page 175: Atari ST Internals

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 #14add.l #26,sp

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

virgin: The sectors are formatted with this value. Thestandard value is $E5E5. The high nibble of each bytemay not contain the value $F.

magic: The constant $87654321 must be used as magic orformatting will be stopped.

interleave: Determines in which order the sectors on the disk willbe 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

Page 176: Atari ST Internals

Abacus Software Atari ST Internals

filler: Unused long word.

buffer: Buffer for the track data; for 9 sectors per track thebuffer 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 thiscase the buffer contains a list of bad sectors (word data, terminated byzero). You can format these again or mark the sectors as bad.

Example:

move.w f$E5E5,-(sp) Initial datamove.l #$87654321,-(sp) magicmove.w #l,-(sp) interleavemove.w #0,-(sp) side 0move.w #79,-(sp) track 79move.w #9,-(sp) 9 sector per trackmove.w #0,-(sp) drive Aclr.l -(sp)move.w #buffer,-(sp)move.w #10,-(sp) flopfmttrap #14add.l #26,sptst dObmi error

buffer ds.b $2000 8K buffer

11 unused

169

Page 177: Atari ST Internals

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 #14addq.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 containthe number of characters to be sent minus 1.

Example:

move.l #string,-(sp) Address of the stringmove.w #stringend-string-l,-(sp) Lengthmove.w #12,-(sp) midiwstrap #14addq.l #8,sp

string dc.b 'MIDI data"stringend equ *

170

Page 178: Atari ST Internals

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 #14addq.l #8,sp

This function initializes an interrupt routine in the MFP. The number of theMFP interrupt is in number while vector contains the address of thecorresponding interrupt routine. The old interrupt vector is overwritten.

Example:

move.l #busy,-(sp) Busy interrupt routinemove.w #0,-(sp) Vector number 0move.w #13,-(sp) mfpinttrap #14addq.l #8,sp* • * *

busy:

171

Page 179: Atari ST Internals

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 #14addq.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 device0 RS-2321 Keyboard2 MIDI

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

long ibuf Pointer to an input bufferint ibufsize Size of the input bufferint ibufhd Head indexint ibuftl Tail indexint ibuflow Low water markint ibufhi High water mark

The input buffer is a circular buffer; the head index specifies the next writeposition (the buffer is filled by an interrupt routine) and the tail indexspecifies from where the buffer can be read. If the head and tail indices arethe same, the buffer is empty. The low and high marks are used inconnection with the communications status for the RS-232 (XON/XOFF orRTS/CTS). If the input buffer is filled up to the high water mark, thesender is informed via XON or CTS that the computer cannot receive anymore data. When data received by the computer can be processed again, sothat the buffer contents sink below the low water mark, the transfer isresumed.

There is an identically-constructed buffer record for the RS-232 outputwhich is located directly behind the input record.

172

Page 180: Atari ST Internals

Abacus Software Atari ST Internals

Example:

move.w #1,—(sp)move.w #14,-(sp)trap #14addq.l #4,sp

Buffer record for keyboardiorec

Result: $9F2

The following table contains the data for all devices:

RS-232 input RS-232 output Keyboard MIDIAddress $9DOBuffer address $6DOBuffer length $100Head index 0Tail index 0Low water mark $40High water mark $CO

($9DE)$7DO$10000$40$CO

$942 $AOO$8DO $950$80 $800 00 0$20 $20$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. Theyhave significance only for XON/XOFF or RTS/CTS in connection withRS-232.

173

Page 181: Atari ST Internals

Abacus Software Atari ST Internals

15 rsconf set RS-232 configuration

C: void rsconf(baud, ctrlf 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 #14add.l #14,sp

This XBIOS function serves to configure the RS-232 interface. Theparameters have the following signifcance:

scr: Synchronous Character Register in the MFPtsr: Transmitter Status Register in the MFPrsr: Receiver Status Register in the MFPucr: USART Control Register in the MFPCtrl: Communications parametersbaud: Baud rate

See the section on the MFP 68901 for information on the MFP registers. Ifone of the parameters is -1, the previous value is retained. The handshakemode can be selected with the ctrl parameter:

Ctrl Meaning0 No handshake, default after power-up1 XON/XOFF2 RTS/CTS3 XON/XOFF and RTS/CTS (not useful)

174

Page 182: Atari ST Internals

Abacus Software Atari ST Internals

The baud parameter contains an indicator for the baud rate:

baud Baud rate0 192001 96002 48003 36004 24005 20006 18007 12008 6009 300

10 20011 15012 13413 11014 7515 50

Example:

move.w #-l,-(sp)move.w #-l,-(sp) Don't change MFP registersmove.w #-l,-(sp)move.w #-l,-(sp)move.w #l,-(sp) XON/XOFFmove.w #9,-(sp) 300 baudmove.w #15,-{sp) rsconftrap #14add.l #14,sp

175

Page 183: Atari ST Internals

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 #14addi.l #14,sp

With this function it is possible to create a new keyboard layout. To do thisyou must pass the address of the new tables which contain the key codes fornormal keys (without shift), shifted keys, and keys with caps lock. Thefunction returns the address of the vector table in which the three keyboardtable pointers are located. If a table should remain unchanged, -1 must bepassed as the address. A keyboard table must be 128 bytes long. It isaddressed via the key scan code and returns the ASCII code of the givenkey.

Example:

move.l #-l,-(sp) Don't change caps lockmove.l #shift,-(sp) Shift tablemove.l #unshift,-(sp) Table without shiftmove.w #16,-(sp)trap #14addi.l #14,sp

shift: ...unshift: ...

176

Page 184: Atari ST Internals

Abacus Software Atari ST Internals

17 random return random number

C: long random()

Assembler:

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

This function returns a 24-bit random number. Bits 24-31 are zero. Witheach call you receive a different result. After turning on the computer adifferent seed is created.

Example:

move.w #17,-(sp) randomtrap #14addq.l #2,sp

177

Page 185: Atari ST Internals

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 #14add.l #14,sp

This function serves to create a boot sector. A boot setor is located on track0, sector 1 on side 0 of a diskette and gives the DOS information about thedisk type. If the boot sector is executable, it can be be used to load theoperating system. With this function you can create a new boot sector, for adifferent disk format or to change an existing boot sector. The parameters:

execflag: determines if the boot sector is executable.

0 not executable1 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 theboot sector. If the serial number is greater than 24 bits ($01000000), arandom serial number is created (with the above function). A value of -1means that the serial number will not be changed.

The parameter buffer is the address of a 512-byte buffer which containsthe boot sector or in which the boot sector will be created.

178

Page 186: Atari ST Internals

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- 12- 78-1011-121314-151617-1819-202122-2324-2526-2728-29

Branch instruction to boot program if executab:'Loader'24-bit serialEPS 512SPC 1RES 1FAT 2DIR 64SEC 360MEDIA 252SPF 2SPT 9SIDE 1HID 0

number5122121127202532920

5122121127202485910

51221211214402495920

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 combinedinto one block by the DOS, 2 sectors equals IK.

RES : Number of reserved sectors at the start of the disk including theboot 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

Page 187: Atari ST Internals

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

Don't change executability80 tracks DSDon't change serial number

protobt

move.w #-l,-(sp)move.w #3,-(sp)move.l #-l,-(sp)move.l #buffer,-(sp)move.w #18,-(sp)trap #14add.l #14,sp

buffer ds.b 512

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

180

Page 188: Atari ST Internals

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 #14add.l #16,sp

This function serves to verify one or more sectors on the disk. The sectorsare read from the disk and compared with the buffer contents in memory.The parameters have the same meaning as for reading and writing sectors. Ifthe 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 thefollowing 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

Page 189: Atari ST Internals

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 rwabswas used to write the sectors and if the variable /verify ($444) is set, thesectors will automatically be verified after they are written.

Example:

move.w #l,-(sp) A sectormove.w #0,-(sp) Side zeromove.w #39,-(sp) Track 39move.w #l,-(sp) Sector 1move.w #0,-(sp) Drive Aclr.l -(sp)move.l #buffer,-(sp) Buffer addressmove.w #19,-(sp) flopvertrap #14add.l #16,sptst dO Error?bmi error

182

Page 190: Atari ST Internals

Abacus Software Atari ST Internals

20 SCrdmp output screen dump

C: void scrdmpO

Assembler:

move.w #20,-(sp)trap #14addq.1 #2,sp

This function outputs a hardcopy of the screen to a connected printer. Thepreviously-set printer parameters ("desktop Printer setup") are used. Youcan also perform this function by simultaneously pressing the ALT andHELP keys or from the desktop through "Print Screen" from the "Options"menu.

Example:

move.w #20,-(sp) Hardcopytrap #14 Call XBIOSaddq.l #2,sp

183

Page 191: Atari ST Internals

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 #14addq. 1 # 6,sp

This XBIOS function serves to set the cursor function. The parameterfunction can have a value from 0-5, which have the following meanings:

function Meaning0 Disable cursor1 Enable cursor2 Flash cursor3 Steady cursor4 Set cursor flash rate5 Get cursor flash rate

You can use this function to set whether the cursor is visible, and whether itis flashing or steady. Thie XBIOS function returns a result only if you fetchthe old baud rate. The unit of the flash frequency is dependent on the screenfrequency: It is 70 Hz for a monochrome monitor or 50 Hz for a colormonitor. You can set a new flash rate with function number 5. You needonly use the parameter rate if you want to pass a new flash rate.

Example:

move.w #20,-(sp) 20/70 secondsmove.w #4,-(sp) Set flash ratemove.w #21,-(sp) cursconftrap #14addq.1 # 6,sp

184

Page 192: Atari ST Internals

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 #14add.l #6,sp

This function is used to set the clock time and date. The time is passed in thelower word of time and the date in the upper word. The time and date arecoded as follows:

bits 0- 4 Seconds in two-second incrementsbits 5-10 Minutesbits 11-15 Hours

bits 16-20 Day 1-31bits 21-24 Month 1-12bits 25-31 Year (minus offset 1980)

Example:

move.l #%1011Q01100000100000000000000,-(sp)move.w #22,-(sp) settimetrap #14addq.l #6,sp

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

185

Page 193: Atari ST Internals

Abacus Software Atari ST Internals

23 gettime return clock time and date

C: long gettime()

Assembler:

move.w #23,-(sp)trap #14addq.l #2,sp

This function returns the current date and the clock time in the followingformat:

bits 0- 4 Seconds in two-second incrementsbits 5-10 Minutesbits 11-15 Hours

bits 16-20 Day 1-31bits 21-24 Month 1-12bits 25-31 Year (minus offset 1980)

Example:

move.w #23,-(sp) gettimetrap #14addq.l #2,spmove.l dO,time Save time and date

186

Page 194: Atari ST Internals

Abacus Software Atari ST Internals

24 bioskeys restore keyboard table

C: void bioskeys < )

Assembler:

move.w #24,-(sp)trap #14addq.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. Youcan call this function, for example, before exiting a program of your ownwhich changed the keyboard layout.

Example:move.w #24,-(sp) bioskeystrap #14addq.l #2,sp

187

Page 195: Atari ST Internals

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 #14addq.l #8,sp

This XBIOS function serves to transmit commands to the keyboardprocessor (intelligent keyboard). The parameter pointer is the address of astring to be sent, number is the length of a string minus 1.

Example:

move.l #string,-(sp) Address of the stringmove.w #strend-string-l,-(sp) Length minus 1move.w #25,-(sp) ikbdwstrap #14addq.l #8,sp

string dc.b $80,1strend equ *

188

Page 196: Atari ST Internals

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 #14addq.l #4,sp

This function makes it possible to selectively disable interrupts on the MFP68901. The parameter is the MFP interrupt number (0-15). The significanceof the individual interrupts is described in the section on interrupts.

Example:

move.w #10,-(sp) Disable RS-232 transmitter interruptmove.w #26,-(sp) Disable interrupttrap #14addq.l #4,sp

189

Page 197: Atari ST Internals

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 #14addq.l #4,sp

This function can be used to re-enable an interrupt on the MFP. Theparameter is again the number of the interrupt, 0-15.

Example:

move.w #12,-(sp) Enable RS-232 receiver interruptmove.w #27,-(sp) Enable interrupttrap #14addq.l #4,sp

190

Page 198: Atari ST Internals

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 #14addq.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). Themeaning of the individual registers is given in the hardware description ofthe sound chip. Bit 7 of the register number determines whether thespecified register will be written or read:

Bit 7 0: Read1: Write

When writing, an 8-bit value is passed in data; when reading, the functionreturns the contents of the corresponding register.

Example:

move.w #$80+3,-(sp) Write register 3move.w #$50,-(sp) Value to writemove.w #28,-(sp)trap #14addq.l #6,sp

191

Page 199: Atari ST Internals

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 #14addq.l #4,sp

A bit of port A of the sound chip can be selectively set with this functioncall. Port A is an 8-bit output port in which the individual bits have thefollowing funtion:

Bit 0: Select disk side 0/side 1Bit 1: Select drive ABit 2: Select drive BBit 3: RS-232 RTS (Request To Send)Bit 4: RS-232 DTR (Data Terminal Ready)Bit 5: Centronics strobeBit 6: General Purpose OutputBit 7: unused

Example:

move.w #4,-(sp) DTR bitmove.w #29,-(sp) offgibittrap *14addq.l #4,sp

192

Page 200: Atari ST Internals

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 #14addq.l #4,sp

This function is the counterpart of the previous function. With this it ispossible to clear a bit of port A in the sound chip.

Example:

move.w #4,-(sp) DTR bitmove.w #30,-(sp) ongibittrap #14addq.l #4,sp

193

Page 201: Atari ST Internals

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 #14add.l #12,sp

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

Timer A : 0Timer B : 1Timer C : 2Timer D : 3

The parameters data and control are the values which are placed in thecorresponding control and data registers of the timer. We refer you to thehardware description of the MFP 68901.

The parameter vector is the address of the interrupt routine which will beexecuted when the timer runs out. The four timers in the MFP are alreadypartly used by the operating system:

Timer A: Reserved for the end userTimer B: Horizontal blank counterTimer C: 200 Hz system timerTimer D: RS-232 baud rate generator

(the interrupt vector is free)

194

Page 202: Atari ST Internals

Abacus Software .Atari ST Internals

Example:

move.l #vector,-(sp) Interrupt routinemove.w data,-(sp) Data andmove.w control,-(sp) Control registersmove.w #0,-(sp) Timer Amove.w #31,-(sp) xbtimertrap #14add.l #12,sp

195

Page 203: Atari ST Internals

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 #14addq.l #6,sp

This function allows for easy sound processing. The parameter pointermust point to a string of sound commands. The following commands can beused:

Commands: $00-$OFThese commands are interpreted as register numbers of the soundchip. A byte following this is loaded into the corresponding register.

Command $80An argument follows this command which will be loaded into atemporary register.

Command $81Three arguments must follow this command. The first argument is thenumber of the register in the sound chip in which the contents of thetemporary register will be loaded. The second argument is atwo's-complement value which will be added to the temporaryregister. The third argument contains an end criterium. The end isreached when the content of the temporary register is equal to the endcriterium.

Commands $82-$FFOne argument follows each of these commands. If this argument iszero, the sound processing is halted. Otherwise this argumentspecifies the number of timer ticks (20ms, 50Hz) until the next soundprocessing.

196

Page 204: Atari ST Internals

Abacus Software Atari ST Internals

Example:

move.l tpointer,-(sp) Pointer to sound commandmove.w #32,-(sp) dosoundtrap #14addq.l #6,sp

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

197

Page 205: Atari ST Internals

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 #14addq.l #4,sp

This function allows the printer configuration to be read or changed. Ifconfig contains the value -1, the current value is returned, otherwise thevalue is accepted as the new printer configuration. The printer configurationis a bit vector with the following meaning:

Bit number 0 10 matrix printer daisy-wheel1 monochrome printer color printer2 Atari printer Epson printer3 Test mode Quality mode4 Centronics port RS-232 port5 Continuous paper Single-sheet

6-14 reserved15 always 0

Example:

move.w #%OOQ100,-(sp) Epson printermove.w #33,-(sp) setprttrap #14addq.l #4,sp

198

Page 206: Atari ST Internals

Abacus Software Atari ST Internals

34 kbdvbase return keyboard vector table

C: long kbdvbase()

Assembler:

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

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

long midivec MIDI inputlong vkbderr Keyboard errorlong vmiderr MIDI errorlong statvec IKBD statuslong mousevec Mouse routineslong clockvec Clock time routinelong joyvec Joystick routines

The parameter midivec points to a routine which writes data received fromthe MIDI input (byte in DO) to the MIDI buffer.

The parameters vkbderr and vmiderr are called when an overflow issignaled by the keyboard or MIDI ACIA.

The remaining four routines statvec, mousevec, clockvec, and joyvecprocess the corresponding data packages which come from the keyboardACIA. 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 onemillisecond of processing time.

Example:

move.w #34,-<sp) kbdvbasetrap #14addq.l #2,sp

199

Page 207: Atari ST Internals

Abacus Software Atari ST Internals

We get $AOE as the result The vector field contains the following values:

AOE midivec $79C6A12 vkbderr $759CA16 vmiderr $759CA1A statvec '$7034A1E mousevec $15296A22 clockvec $6A46A26 joyvec $7034A2A MIDI $7556A2E keyboard $7568

200

Page 208: Atari ST Internals

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 #14addq.1 # 6, sp

The keyboard repeat can be controlled with this function. The parameterdelay specifies the delay time after a key is pressed before the key willautomatically be repeated. The parameter repeat determines the time spanafter which the key will be repeated again. These values can be changedfrom 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 ofthe parameters, the corresponding value is not set. The function returns theprevious values as the result; bits 0-7 contain the repeat value and bits8-15 the value of delay.

Example:

move.w #-l,-(sp) Read old valuesmove.w #-l,-(sp)move.w #35,-(sp) kbratetrap #14addq.l #6,sp

Result: DO = $OB03

201

Page 209: Atari ST Internals

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 #14addq.1 # 6, sp

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

long blkprt Address of the screen RAMint offsetint width Screen widthint height Screen heightint leftint rightint scrres Screen resolution (0, 1, or 2)int dstres Printer resultion (0 or 1)long colpal Address of the color paletteint 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 blockmove.w #36,-(sp) prtblktrap #14addq.1 # 6, sp

parameter dc.1 ...

202

Page 210: Atari ST Internals

Abacus Software Atari ST Internals

37 WVbl wait for video

C: void wvbl()

Assembler:

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

This function waits for the next picture return. It can be used to synchronizegraphic outputs with the beam return, for example.

Example:

move.w #36,-(sp) wait for wvbltrap #14addq.l #2,sp

203

Page 211: Atari ST Internals

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 #14addq.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 theroutine to the function. Example:

move.1 #address,-(sp)move.w #38,-(sp)trap #14addq.1 # 6,sp

address move.l $400,00

204

Page 212: Atari ST Internals

Abacus Software Atari ST Internals

39 puntaes disable AES

C: void puntaes()

Assembler:

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

The AES can be disabled with this function, provided it is not in ROM.

Example:

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

205

Page 213: Atari ST Internals

Abacus Software Atari ST Internals

3.4 The Graphics

Next to the high processing speed and the large memory available, thegraphics capability is certainly the most fascinating aspect of the ST. Withthe standard monochrome monitor and the resolution of 640x400 points, itcreates a whole new price/performance class for itself. But also in the colorresoultion the ST can display 16 colors with 320x200 screen points.

In this chapter we want to explain how the graphics are organized and howyou can create fast and effective graphics without using the GEM graphicspackage, which is rather complicated for beginners. The ST offers theprogrammer (assembler and C) very useful routines, with whose helpgraphics programming isn't quite child's play, but they can take away agood deal of the programming work. Unfortunately, some of thesefunctions are so comprehensive that a detailed description would exceed thescope 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 softwaredevelopers have made use of the fact that there are two groups of opcodes inthe 68000 which the 68000 does not "understand" and which generate atrap, or software interrupt, when they are encountered in a program. Theseare the two groups of opcodes which begin with $Axxx and $Fxxx. In theST, 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 ofthe "command" to see what value it has. Values between zero and $E arepermissable here. This gives a total of 14 graphics routines, which shouldfirst be presented in an overview. Later we will talk about the actualcommands 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

Page 214: Atari ST Internals

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 ofGEM. 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 gameswindows are needed only in the rarest cases. Another important point is thespeed of the A-instructions. Using the graphic routines directly is clearlyfaster than if the output is handled by GEM. Before we describe theindividual commands in detail, we will take a brief look at the constructionof graphics in the various graphic modes of the ST.

Immediately after turning the ST on, an area of 32K bytes is initialized at theupper memory border as the video RAM. In normal operation this results inaddresses $78000 to $7FFFF acting as the screen RAM. This video RAMcan 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 wordsforms one screen line. The word with the lowest address is displayed on theleft edge of the screen, the additional words are displayed in order from leftto right. Within a word, the highest-order bit lies at the left and thelowest-order bit at the right

With this data, any point on the screen can be easily controlled or read. Forexample, to set the first screen point, the value $8000 must be written intomemory location $78000. Therefore you might store $8000 into memorylocation $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. Forthis reason, it is usually more advantageous to set the the point with the "A"function $A001. Function $A001 assumes an X-Y coordinate system withorigin in the upper left-hand corner, and determines the position of the videoRAM 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 bitis set, the point appears dark, or bright if the die inverse display mode isselected in color palette register 0. The screen consists of only one bit plane.Different colors cannot be represented with just one plane, however. This iswhy when the resolution increases in the color modes, the number ofdisplayable colors decreases.

207

Page 215: Atari ST Internals

Abacus Software Atari ST Internals

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

o i

VIDEO SCREEN

319

COLOR NUMBER U .UJ 1.1.Li I

VIDEO-RAM

208

Page 216: Atari ST Internals

Abacus Software Atari ST Internals

Four colors possible in the 640x200 resolution mode. In this mode, twocontiguous memory words form a single logical entity. The color of a pointis determined by the value of the two corresponding bits in the two words.If both bits are zero, the background color results. Therefore two sequentialwords 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 evenwords. In this mode, there are two planes available.

Things become quite colorful in the mode with "only" 320x200 points. Inthis operating mode, 4 contiguous memory words form one entity whichdetemines the color of the 16 pixels. To stick to the example we usedbefore: in order to set the point in the upper left-hand corner, the topmostbits of words $78000, $78002, $78004, and $78006 must be manipulated.The desired color results from the bit pattern in the words. It naturallyrequires some computer time to set a point in the desired color, independentof 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 currentresolution. Naturally, all four planes are present in this mode. The firstplane, keeping to our example, made up of the words at address $7FOOO,$7F008, $7F010, ..., and the other planes are composed of the otheraddresses correspondingly.

Another point to be clarified concerns the fonts or character sets. Since theST does not have a text mode, only a graphics mode, the text output iscreated in high-resolution graphics. There are three different fonts built intothe ST. You can load additional fonts from disk. Each font has a headerwhich contains important information about the displayable characters.Since the important data are contained in the font header, there are unusuallyfew limits for display. The characters can be arbitrarily high or wide. Theage of the 8x8 matrix for character output is over. Genuine proportionaltype on the screen (!) is even possible.

The three built-in fonts use relatively few of the many possibilities whichGEM allows for character generation. All three fonts are mono-spacedfonts, 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 onlyaccessible for output under GEM, not for output under TOS, and is used inthe output of the directory in the icon form, for example. The next-largesttype is composed of 8x8 points. This type is used when a color monitor isconnected to the ST, while the third and largest font is used for the normalblack-and-white mode. This font uses a matrix of 8x16 points.

209

Page 217: Atari ST Internals

Abacus Software Atari ST Internals

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

0 1 2 639

VIDEO SCREEN

COLOR NUMBER

VIDEO-RAM

210

Page 218: Atari ST Internals

Abacus Software Atari ST Internals

The exact layout of the font header is found under command $AQ08, whichrepresents a very versatile text output which goes far beyond what ispossible with the routine of the BIOS and GEMDOS.

Finally, we must clarify some of the terms which will come up often in thefollowing descriptions, whose meaning may not be so clear. These are theterms CONTRL array, INTIN array, INTOUT array, PTSIN array andPTSOUT array. These arrays are mainly used by GEM to pass parametersto individual GEM functions or to store results from these functions. Butline-A functions use parts of these arrays to pass parameters also. Thearrays are defined in memory as data areas, whereby each element in thearray consists of 2 bytes.

For GEM functions, the CONTRL array always contains the numberdesired in the first element (CONTRL(0)). This parameter is not used by theline-A commands, however. CONTRL(l) contains the number of XYcoordinates required for the function. These coordinates must be placed inthe PTSIN array before the call. The element CONTRL(2) is not suppliedbefore the call. After the call it contains the number of XY coordinates in thePTSOUT array. CONTRL(3) specifies how many parameters will bepassed to the function in the INTIN array, while CONTRL(4) contains thenumber of parameters in the INTOUT array after the call. The additionalparameters 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 thesearrays. For this reason there is another memory area which used as avariable area for (almost) all graphic outputs. The function and use of theseover 50 variables is found in a table at the end of this chapter. Importantvariables are also explained in conjunction with the functions which requirethem.

By the way, you should be aware that registers DO to D2 and AO to A2 arechanged by calling the functions. Important values contained in theseregisters should be saved before a call.

211

Page 219: Atari ST Internals

Abacus Software Atari ST Internals

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

0 1 2 639

VIDEO SCREEN

COLOR NUMBER

VIDEO-RAM

212

Page 220: Atari ST Internals

Abacus Software Atari ST Internals

$AOOO Initialize

Initialize is really the wrong expression for this function. After the call, theaddresses of the more important data areas are returned in registers DO andAO to A2. This function does not require input parameters.

The program is informed of the starting address of the line-A variables inDO and AO. After the call, Al points to a table with three addresses. Thesethree 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-Aroutines.

This opcode destroys (at least) the contents of registers DO to D2 and AO toA2. Important values should be saved before the call.

$A001 PUT PIXEL

This opcode sets a point at the coordinates specified by the coordinates inP 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. Thepossible range of the X and Y coordinates is naturally set according to thegraphic 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 themonochrome 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 valueis returned in the DO register.

213

Page 221: Atari ST Internals

Abacus Software Atari ST Internals

$A003 LINE

With the LINE opcode a line can be drawn bewteen the points withcoordinates xl,yl and x2,y2. The parameters for this function are notpassed via the parameter arrays, but must be transferred to the line-Avariables 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 aline, the highest bit of the line bit pattern is always set on the left screenedge. 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 todraw a line from 0,0 to 650,50, a line is actually drawn from, 0,0 to639,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 fordrawing lines. With write mode zero, the original bit pattern "under" the lineis 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, theold bit pattern, is ORed with the new line pattern so only additional pointsare set. In the XOR mode (_WRT_MOD=2), the background and the linepattern are exclusive-ored. The last mode (_WRT_MOD=S) is the so-called"inverse transparent mode." As in the transparent mode, it involves an ORcombination of the foreground and background data, in which theforeground data, the bit pattern determined by _LN_MASK, are invertedbefore the OR operation.

214

Page 222: Atari ST Internals

Abacus Software Atari ST Internals

$A004 HORIZONTAL LINE

This function draws a line from xl,yl to x2,y 1. Drawing a horizontal line issignificantly faster than when a line must be drawn diagonally. Diagonallines are also created with this function, in which the line is divided intomultiple horizontal lines segments. The parameters are entered directly intothe 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. Thecontents of the variable _patptr is the address at which the desired linepattern or fill pattern is located. The H-line function is very well-suited tocreating filled surfaces. The variable _patmsk plays an important role inthis. The number of 16-bit values at the address in _patptr is dependenton the its value. If, for example, jpatmsk contains the value 5, six 16-bitvalues should be located at the address in jpatptr as the line pattern. If ahorizontal line with the Y-coordinate value zero is to be drawn, the first bitpattern is taken as the line pattern. The second word is taken as the patternfor a line drawn at Y-coordinate 1, and so on. The pattern for a line withY-coordinate 6 is again determined by the first value in the bit table. In thismanner, very complex fill patterns can be created with relatively little effort.

215

Page 223: Atari ST Internals

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 essentialparameters are the coordinates of the upper left and lower right corners ofthe 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 usedjpatmsk = "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 thetotal picture. If the clipping flag is set to one (or any value not equal tozero), the rectangle, drawn by $A005, is displayed only in the area definedby the clipping-area variables. An example may explain this behavior better:The values 100,100 and 200,200 are specified as the coordinates. The clipflag is 1 and the clip variables contain the values 150,150 for XMN_CLIP andYMN 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 and200,200 as the lower right. The "missing" area is not drawn because of theclip specifications. Clearing the clip flag draws the rectangle in the originallydesired size.

216

Page 224: Atari ST Internals

Abacus Software Atari ST Internals

$A006 FILLED POLYGON

$A006 is also an extension of $A004. Arbitrary surfaces can be filled with apattern with this function. The entire surface is not filled with the call: justone raster line is filled, a horizontal line with a width of one point. Theresult is that there are significantly more options for influencing the fillpattern.

The necessary variables are:PTSIN = Array with the XY coordinatesCONTRL(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 fora call to $A005. Only the first three coordinates are different. The XYcoordinates are stored in the PTSIN array. It is important you specify thestart 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, threein our example, must be placed in CONTRL (1), the second element of thearray. With a call to the $A006 function you must also specify theY-coordinate of the line to be drawn. Naturally you can fill all Y-coordinatesfrom 0 to 399 (0 to 199 in the color modes) in order. But it is faster to findthe largest and smallest of the XY values and call the funtion with only theseas the range.

217

Page 225: Atari ST Internals

Abacus Software Atari ST Internals

$A007 BITBLT

The bit block transfer is used by the text block transfer, $AQ08, and copyraster form, $AOOE. Register A6 must contain a pointer to a parameter table.Unfortunately, the construction of this parameter table could not bedetermined definitively. Our attempts led to classic system crashes about70% 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 positionwith the TEXT BLock Transfer function. In addition, the form of thecharacter can be changed. The character can be displayed in italics,boldface, outlines, enlarged, or rotated. These things cannot be achievedwith the "normal" character outputs via the BIOS or GEMDOS. But to dothis, a large number of parameters must be set and controlled. A rathercomplicated program must be written in order to output text with thisfunction. If the additional options are not absolutely necessary, it isadvisable not to use this function. But please decide for yourself.

Before we produce a character on the screen, we must first concernourselves with the organization of the fonts. We must take an especiallyclose look at the font header because the font is describe in detail by theinformation 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 containsgeneral data about the font, such as its name and size, the number ofcharacters it contains, and various other aspects. This information takes up atotal 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 spaceas possible.

In order to be able to better describe the organization, we will imagine a fontwith only two characters, such as "A" and "B". These characters are to bedisplayed in a 9x9 matrix. The font data are now in memory so that the bitpattern 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, butonly the top bit of the following byte. 7 bits must be wasted if the top scanline 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

Page 226: Atari ST Internals

Abacus Software Atari ST Internals

byte of the font data. Only the data of the second and further scan linesalways start on a word boundary. In this manner, almost no bits are wastedin the font Only the start of the scan lines of the first character actuallybegin 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 withinthe font must be calculated. The calculation of the scan-line positions ispossible through the character offset table. This table contains one entry foreach displayable character. For our example, such a table would contain theentries $0000, $0009, $0012. Through the direction of this table, it ispossible to create true proportional type on the screen since the width ofeach character can be calculated. One subtracts the entry of the character tobe displayed from the entry of the next character. The last entry is present sothat the width of the last character can also be determined, although it is notassigned 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 inthe ST do not use all the possibilities of this table either. If this table werepresent, it would contain a positive or negative offset value for eachcharacter, 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 thevariables in the font header.

Bytes 0-1

Bytes 2- 3

Bytes 4-35Bytes 36-37

Bytes 38-39

Bytes 40-49

Bytes 50-51Bytes 52-53

Bytes 54-55

Font identifier. A number which describes thefont. l=system fontFont size in points (point is a measure usedin type-setting).The name of the font as an ASCII string.The lowest ASCII value of the displayablecharacters.The highest ASCII value of the displayablecharacters.Relative distances of top, ascent, half,descent, and bottom line from the base line.Width of the broadest character in the font.Width of the broadest character cell. The cellis always at least one pixel wider than theactual character so that two characters nextto each other are separated from each other.: Linker offset.

219

Page 227: Atari ST Internals

Abacus Software Atari ST Internals

Bytes 56-57 : Right offset. The two offset values are onlyused for displaying the font in italics(skewing).

Bytes 58-59 : Thickening. If a character is to be displayedin boldface, the value of this variable isused.

Bytes 60-61 : Underline. Contains the height of theunderline in pixels.

Bytes 62-63 : Lightening mask. "Light" characters are foundon the desktop when an option on a pull-downmenu is not available. This light greycharacter consists of masking the bits withthe lightening mask. Usually the value is$5555.

Bytes 64-65 : Skewing mask. As before, only for displayingcharacters in italics.

Bytes 66-67 : Flag. Bit 0 is set if the font is a systemfont.Bit 1 must be set if the horizontal offsettable is present.Bit 2 is the so-called byte-swap flag. If itis set, the bytes in memory are in 68000format (low byte-high byte). A cleared swapflag signals that the data is in INTEL format,reversed in memory. With this bit the fontsfrom the IBM version of GEM can be used on theST and vice versa.Bit 3 is set if the width of all characters inthe font is equal.

Bytes 68-71 : Pointer to the horizontal offset table orzero.

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 valuerepresents the length of the scan lines of allof the characters and thereby the start of thenext line.

Bytes 82-83 : Form height. This variable contains the numberof scan lines for this font.

Bytes 84-87 : Contain a pointer to the next font.

220

Page 228: Atari ST Internals

Abacus Software Atari ST Internals

After so much talk, we should now list the parameters which must be notedor prepared for the $A008 opcode.

_WRT_MODE_TEXT_FG_TEXT_BG_FBASE_FWIDTH_SOURCEX_SOURCEY_DESTXJDESTY_DELX_DELY_STYLE_LITEMASK_SKEWMASK_WEIGHT_R_OFF_L_OFF_SCALE_XACC_DDA_DDA_INC_T_SCLSTS_CHUP_MONO_STATUS_scrtchp_scrpt2

Write modeText foreground colorText background colorPointer to the start of the font dataWidth of the fontX-coordinate of the char in the fontY-coordinate of the char in the fontX-coordinate of the char on the screenY-coordinate of the char on the screenWidth of the character in pixelsHeight of the character in pixelsBit-wise coded flag for special effectsBit pattern used for "lightening"Bit pattern used for skewingFactor for character enlargementRight offset of the char for skewingLeft offste of the char for skewingFlag for scalingAccumulator for scalingScaling factorScaling direction flagCharacter rotation vectorFlag for monospaced typePointer to buffer for effectsOffset scaling buffer in _scrtchp

The five clip variables are also evaluated.

As you can see, an enormous number of variables are evaluated for theoutput of graphic text. Here we can go into only the essential (and those weexplored) 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 availablewhose effects are not yet known. The variable _TEXT_FG is in connectionwith first four write modes. They form the foreground color used fordisplay. The background color _TEXT_BG plays a role only with the 16additional modes. It is clear that the additional modes are relevant only inconnection with a color screen.

221

Page 229: Atari ST Internals

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 ofthe bytes 80 and 81 of the header.

The parameter _SOURCEX determines which character you output. It shouldcontain the ASCII value of the desired character.

The parameter _SOURCEY is usually zero because the character is to begenerated from the top to the bottom scan line.

The parameter _DELX can be be calculated as the width of the character inwhich the entry in the character offset table of the desired character issubtracted from the next entry. The result is the width of the character inpixels. _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 shouldbe 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. Anotherchange 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 originalsize. The _T_SCLSTS flag determines if the font is to be reduced orenlarged. A value other than zero must be placed here for enlarging._DDA_INC should contain the value of the enlargement or reduction. Anenlargement 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 range0 to 360 degrees in tenths of a degree. A restriction must also be made forthis function. Usuable results are obtainable only with rotations by 90degrees. 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 inwhich TEXTBLT can store temporary values. The exact size of this bufferis not known, but we always found a buffer of IK to be sufficient. Anotherbuffer must be specified for enlargement (_scrtpt2). An offset is passed asa parameter which refers to the start of the _scrtchp buffer. A value of $40proved to be sufficient here.

222

Page 230: Atari ST Internals

Abacus Software Atari ST Internals

$A009 SHOW MOUSE

Calling this opcode enables the display of the mouse cursor. The cursorfollows the mouse when it is moved. If the mouse cursor is disabled, themouse 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 mousecursor counts the number of calls to remove and enable the cursor. If thecursor is disabled twice, two calls must be made to re-enable it before it willactually appear on the screen. This behavior can be changed by clearingINTIN (o) . With this parameter the cursor is immediately set independent ofthe number of previous HIDE CURSOR calls. If the value in INTIN < o) isnot equal to zero the actually required number of $ AQ09 calls must be madein order to make the cursor visible.

$AOOA HIDE CURSOR

This functions hides the cursor. If this function is called repeatedly, thenumber is recorded by the operating system and determines the number ofcalls of SHOW CURSOR before the cursor actually appears.

$AOOB TRANSFORM MOUSE

Is the arrow unsuited as a mouse cursor for games? Simply make your owncursor. How would it be if a little car moved across the screen instead of anarrow? The opcode $AOOB gives your fantasy free reign, at least as far as itconcerns the mouse cursor.

The parameters must be passed in the INTIN array. A total of 34 words arenecessary. The following table gives information about the use and possiblevalues:

INTIN(3) Mask color index, normally 0INTIN(4) Data color index, normally 1INTIN(5) to INTIN(20) contain 16 words of the cursor maskINTIN(21) to INTIN (36) contain 16 words of cursor data

223

Page 231: Atari ST Internals

Abacus Software Atari ST Internals

The form of the cursor is determined by the cursor data. Each 1 in the datacreates a point on the screen. If a cursor is placed over a letter or pattern onthe screen, the border between the cursor and the background cannot bedetermined. The mask enters at this point. Each set bit in the mask clears thebackground at the given location. This permits a light border to be drawnaround the cursor. Take a look at the normal arrow cursor in order to see theoperation of the mask.

$AOOC UNDRAW SPRITE

This opcode is related to $AOOD, DRAW SPRITE. The ST actually has nohardware sprites in sense in which sprite is used on something like theCommodore 64. The ST sprites are organized purely in software. Eachsprite is 16x16 pixels large. One example of an ST sprite is the mousecursor. It is created with this function.

In order to clear a previously-drawn sprite, the address of a buffer in whichthe background was saved when the sprite was drawn is passed in registerA2. The opcode simply transfers the contents of the background buffer tothe right spot on the screen. The buffer itself must be 64 bytes large for eachplane. Another 10 bytes are used, independent of the number of planes. Formonochrome display, the buffer is a total of 74 bytes long, while in the320x200 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 bepassed in the DO, Dl, AO, and A2 registers.

DO and Dl contain the X and Y-coordinates of the position of the sprite onthe screen, called the hot spot. AO is a pointer to the so-called spritedefinition block and A2 contains the address of the sprite buffer in whichthe backgroud will be saved for erasing the sprite later.

The sprite definition block must have the following construction:

Word 1 : X offset to hot spotWord 2 : Y offset to hot spotWord 3 : Format flag 0=VDI format, 1=XOR formatWord 4 : Background color (bg)Word 5 : Foreground color (fg)

224

Page 232: Atari ST Internals

Abacus Software Atari ST Internals

Following this are 32 words which contain the sprite pattern. The patternmust be in memory in the following order:

Word 6 : Background pattern of the top lineWord 7 : Foreground pattern of the top lineWord 8 : Background pattern of the second lineWord 9 : Foreground pattern of the second lineetc.

The information in the format flag has the following significance:

VDI Formatfg bg Result0 0 The background appears0 1 The color in word 4 appears1 0 The color in word 5 appears1 1 The color in word 5 appears

XOR Formatfg bg Result0 0 The background appears0 1 The color in word 4 appears1 0 The pixel on the screen is XORed with the fb

bit1 1 The color in word 5 appears

$AOOE COPY RASTER FORM

Arbitrary areas of the screen can be copied with the $AOOE opcode. Notonly areas within the screen, but also from the screen into free RAM, andeven more important, from the RAM to the screen. Even complete screenpages can be copied very quickly with the COPY RASTER opcode. Thename RASTER FORM does express one limitation of the function,however. Each raster form to be copied must begin on a word boundary andmust 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 mustbe in memory for COPY RASTER. We will start with the MFD blocks.Since a copy operation must always have a source and a destination, oneblock describes the source memory range and the second describes thedestination. Each block consists of 10 words. The address of the memory

225

Page 233: Atari ST Internals

Abacus Software Atari ST Internals

described by the block is contained in the first two words. The third wordspecifies the height of the form in pixels. Word 4 determines the width ofthe form in words. Word 6 should be set to 1 and word 7 specifies thenumber of planes of which the form is composed. The remaining wordsshould 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 variablearea which contains more than 50 line-A variables. The essential variableshave been described along with the various calls, but not the location of thevariables within the variable block. We will present this list shortly. Whennaming the variables we have remained with the names used in the officialAtari 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

38404244

Size Function

024812162024262828323436

v_jp lanesv lin wrCONTRLINT INPTSININTOUTPTSOUT_FG_BP_1_FG_BP_2_FG_BP_2_FG_BP_2_LSTLIN_LN_MASKWRT MODE

wordwordlonglonglonglonglongwordwordwordwordwordwordword

_X2~Y2

wordwordwordword

Number of planesBytes per scan linePointer to the CONTRL arrayPointer to the INTIN arrayPointer to the PTSIN arrayPointer to the INTOUT arrayPointer to the PTSOUT arrayPlane 0 color valuePlane 1 color valuePlane 2 color valuePlane 3 color valueShould be -1 <$FFFF) (?)Line pattern for $A003Write mode (0=write mode

l=t ransparent2=XOR mode3=Inverse trans.)

Xl-coordinateYl-coordinateX2-coordinateY2-coordinate

226

Page 234: Atari ST Internals

Abacus Software Atari ST Internals

46

50

52

54

5658

6062

64

66

68

70

7274

76788082

_j>atptr long

j>atmsk word

multifill word

_CLIP

_XMN_CLIP_YMN_CLIP

_XMX_CLIP_YMX_CLIP

_XACC_DDA

_DDA_INC

T SCLSTS

word

wordword

wordword

word

word

word

MONO STATUS word

_SOURCEXSOURCEY

wordword

Pointer to the fill pattern(see $A004)Fill pattern "mask"(see $A004)0=fill pattern is only forone plane

l=fill pattern is for multi-plane

0=no clipping (see $A005)not 0=clippinganddefine upper left corner ofthe visible area for clippinganddefine lower right corner ofthe visible area for clippingShould be set to $8000 beforeeach call to TXTBLT (?)Enlargement/reduction factor$FFFF for enlargement,reduction doesn't work (?)0=reduction (?)l=enlargementl=not proportional font0=proportional type or widthof character changed by boldor italicsX-coordinate of char in fontY-coord of char in font (0)

Note:SOURCEX is the value of the character from thehorizontal offset table (HOT) and can becalculated witht he following formula:SOURCEX = HOT-element (ASCII value minus FIRSTADE)The variable FIRST ADE is contained in bytes36,37 of the font header (see example)

_DESTX_DESTY_DELXDELY

word X-position of char on screenword Y-position of char on screenword Width of the characterword Height of the character

227

Page 235: Atari ST Internals

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 ofthe font header.

848890

929496

98100

102

104

106

108

114116

_FBASE long Pointer to start of font data_FWIDTH long Width of font form_STYLE word Flags for special effects

(see $A008)

_LITEMASK word Mask for shading_SKEWMASK word Mask for italic type_WEIGHT word Number of bits by which the

character will be expanded_R_OFF word Offset for italic type__L_OFF word Offset for italic type

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

_SCALE

CHUP

_TEXT_FG

_scrtchp

112 _scrpt2

_TEXT_BGCOPYTRAN

word 0=no scalingl=scaling (enlarge/reduce)

word Angle for character rotation0=normal char representation$384=rotated 90 degrees$708=rotated 180 degrees$A8C=rotated 270 degrees

word Foreground color for textdisplay

long Address of buffer requiredfor creating special texteffects

word Offset of the enlargementbuffer in the scrtchp buffer

word Background color for text repword (?)

228

Page 236: Atari ST Internals

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 havegiven a few examples which can serve as a starting-point for you. In thefirst example, a point is set on the screen with $A001, and then the color ofthe point is determined with $A002.

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

* Demo of the $AOOO,$A001 and $A002 functions*

* rbr 09/28/85

intin

ptsin

init

setpix

getpix

equequ

equequequ

812

$aOOO

$a001$a002

start:

.dc.wmove . 1

move . 1

move

move

initintin (aO) , a3

ptsin (aO) , a<3

#300, (a4)

#100,2(a4)

move

.dc.w

move

move

.dc.w

#1,(a3)

setpix

#300,(a4)

#100,2(a4)

getpix

* call $AOOO* address of INTIN-arrays

* address of PTSIN-arrays

* X coordinate

* Y coordinate

* color set, pixel set

0 erase pixel

* pixel set

* X coordinate

* y coordinate

* 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

Page 237: Atari ST Internals

Abacus Software Atari ST Internals

The next example shows how a triangle can be drawn on the screen with thefunction FILLED POLYGON.

**************************************************** a006 - filled pologyn

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

contrlptsin

fg_bplfg_bp2fg_bp3fg bp4wrt mod

equequ

equequequequequ

412

2426283036

yi equ 40

patptrpatmskmultifillclipxmn_clipymn clipxmx_clipymx clip

initpolygon

equequequequequequequequ

equequ

4650525456586062

SaOOO$a006

.dc.w init * address of variable blockfrom AO

move.wclr .wclr .wclr .w

#l,fg_bpl(aO)fg_bp2(aO)fg_bp3(aO)fg_bp4(aO)

*set colors for monochrome

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

230

Page 238: Atari ST Internals

Abacus Software Atari ST Internals

*

loop

loopl

*

fill:

tab:

move . 1move . wclr .wclr .w

move . 1

addq . 1move . w

move . 1move . 1move . wmove . wdbra

move . wmove . wmove . 1

dc.w

move . 1addq . wcmp.wbne

move . wtrapaddq . 1

rtsmove . wtrap

dc.wdc.wdc.wdc.w

dc.wdc.wdc.wdc.w

#fill,patptr (aO)#4,patmsk(aO)multifill(aO)clip(aO)

contrl(aO) ,a6

#2,a6#3, (a6)

ptsin (aO) ,a6#tab,a5#8,d3<a5)+, (a6) +d3,loop

tlOO,d3d3,yl(aO)aO,-(sp)

polygon

(sp)+,aO#l,d3#301, d3loopl

#l,-(sp)#1#2,sp

#0,-(sp)#1

%1100110011001100%0110110110110110%0011001100110011%1001100110011001

320,100120,320520,300320,100

* pointer of the fill pattern* four fill patterns* for monochrome* no clipping

* adddress of CONTRL arrayfrom A6

* A6 > CONTRL (1)* the XY pair in PTSIN

* address PTSIN array from A6* table of coordinates* recieve 8 coordinates

* first scanline* from Yl* restore address variable block

* fill scanline, AO destroyed

* AO restored* calculate next sacanline* last scan line?* no, next scanline

* Code CONIN wait for keypress* Call GEMDOS* stack correction

* subroutine all done* terminate to desktop* Call GEMDOS

231

Page 239: Atari ST Internals

Abacus Software Atari ST Internals

The next example shows how the mouse fonn can be manipulated and howthe mouse can be enabled. The example waits for a key press beforereturning.

*********************************************************** show mouse - transform mouse**

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

intin equ

init_a equ $aOOOshow_mouse equ $a009transmouse equ $aOOb

start:

loop:

.dc.w

move.1movemove

add.l

leamove

move.1dbra

.dc.w

.dc.w

move.1clr .w

.dc.w

init_a

intin(aO),a5#0,6(a5)#l,8(a5)

#10,a5

maus,a4#16,dO

,(a5)+

dO,loop

transmouse

init_a

intin(aO),aO(aO)

show mouse

* address INIT from A5

* INTIN (3) = mask color value* INTIN (4) = data color value

* a5 > INTIN (5)

* data for new cursor* 32 words = 16 longs

* transfer INTIN array

* and set form

* Number Hide Cursor -ignore call

* now the new cursor

232

Page 240: Atari ST Internals

0000000000000000%0000000000000000%0000000110000000%0000000110000000%0000000110000000%0000000110000000%0000000110000000%0000000110000000%0000000110000000%0110000110000110%0110000110000110%0000011001100000%0000000110000000%0000000000000000%0000000000000000%

0000000000000000%0000001111000000%0000001111000000%0000001111000000%0000001111000000%0000001111000000%0000001111000000%

1111001111001111%1111001111001111%

0111111111111110%0001111111111000%0000011111100000%0000000110000000%

wop-M'Op-

wop-wop-

wop-

wop"

wop-

wop-wop-

wop-M'Op"

wop-«"op-M'Op*

wop-M-OP"

soawaa IT^Doq.

suop

1#(ds)-'o# K. ' BAOUI

sssjdAe>( joj

>[OBq.s

SOQW33 11BD

NINOD 9POO

1#(ds)-'-[f

I-bppH

snaeqy

Page 241: Atari ST Internals

Abacus Software Atari ST Internals

3.5 The Exception Vectors

The first 1024 bytes of the 68000 processor are reserved for the exceptionvectors. Routines which use exception handling store the addresses theyrequire in this range of memory.

A condition which leads to an exception can come either from the processoritself or from the peripheral components and controls units connected to itThe interrupts, described in the next section, belong to the class of externalevents. In addition, a so-called bus error can be created externally.

A bus error can be created by many circumstances. For one, certain memoryareas can be protected from unauthorized access by it. As you may alreadyknow, the 68000 can run in one of two operating modes. The operatingsystem is driven at the first level, the supervisor mode. The user mode isintended for user programs. In order that a user program not be able toaccess important system variables as well as the system components in anuncontrolled 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 aroutine, the address of which it fetches from the lowest 1024 bytes ofmemory. 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 buserror, this is 2. Mushroom clouds are then displayed on the screen. Theuser can determine the vector number by counting the number of mushroompictures. Execution then returns to the GEM desktop.

The following table contains all of the exception vectors.

234

Page 242: Atari ST Internals

Abacus Software Atari ST Internals

Vector number01234567891011

12-1415

16-23242526272829303132333435363738394041424344454647

48-6364-255

Address$000$004$008$OOC$010$014$018$01C$020$024$028$02C$030-$038$03C$040-$05C$060$064$068$06C$070$074$078$07C$080$084$088$08C$090$094$098$09C$OAO$OA4$OA8$OAC$OBO$OB4$OB8$OBC$OCO-$OFC$100-$3FC

Exception vector meaningStack pointer after resetProgram counter after resetBus errorAddress errorIllegal instructionDivision by zeroCHK instructionTRAPV instructionPriviledge violationTraceLine A emulatorLine F emulatorreservedUninitialized interruptreservedSpurious interruptLevel 1 interruptLevel 2 interruptLevel 3 interruptLevel 4 interruptLevel 5 interruptLevel 6 interruptLevel 7 interruptTRAP #0 instructionTRAP fl instructionTRAP #2 instructionTRAP #3 instructionTRAP #4 instructionTRAP #5 instructionTRAP #6 instructionTRAP #7 instructionTRAP #8 instructionTRAP 19 instructionTRAP #10 instructionTRAP #11 instructionTRAP #12 instructionTRAP #13 instructionTRAP #14 instructionTRAP #15 instructionreservedUser interrupt vectors

235

Page 243: Atari ST Internals

Abacus Software Atari ST Internals

The following vectors are used on the ST:

Line A emulator $EB9ALevel 2 interrupt $543CLevel 4 interrupt $5452TRAP #1 GEMDOS $965ETRAP #2 GEM $2A338TRAP #13 BIOS $556CTRAP #14 XBIOS $5566

The vector for division by zero points to rte and returns directly to theinterrupted program. Vectors 64-79 are reserved for the MFP 68901interrupts. All other vectors point to $5838 which outputs the vector numberand ends the program as described for the bus error.

All of the unused vectors can be used for your own purposes, such as theline 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 togood use in the ST. As you may have already gathered from the hardwaredescription of the processor, the processor has seven interrupt levels withdifferent priorities. The interrupt mask in the system byte of the statusregister determines which levels can generate an interrupt. An interrupt canonly be generated by a level higher than the current contents of the mask inthe status register. A interrupt of a certain priority is communicated to theprocessor by the three interrupt priority level inputs. The followingassignment results:

Level IPL 2 1 07 (NMI) 0 0 06 0 0 15 0 1 04 O i l3 1 0 02 1 0 11 1 1 00 1 1 1

236

Page 244: Atari ST Internals

Abacus Software Atari ST Internals

If all three lines are 1 (interrupt level 0), no interrupt is present. Interruptlevel 7 is the NMI (non-maskable interrupt), which is executed even if theinterrupt mask in the status register contains seven. Which interrupt isassigned which vector (that is, the address of the routine which will processthe interrupt) depends on the peripheral component which generates theinterrupt For auto-vectors, the processor itself derives the interrupt numberfrom the interrupt level. The following table is used in this process:

Level Vector number Vector addressIPL 1 25 $64IPL 2 26 $68IPL 3 27 $6CIPL 4 28 $70IPL 5 29 $74IPL 6 30 $78IPL 7 31 $7C

Only lines IPL 1 and IPL 2 are used on the Atari ST; Line IPL ispermanently set to a 1 level so that only levels 2,4 and 6 are available. Theresults in the following assignment:

IPL 2 HBL, horizontal blank, line returnIPL 4 VBL, vertical blank, picture returnIPL 6 MFP 68901

The HPL interrupt is generated on each line return from the video section. Itis generated every 50 to 64 (JLS depending on the monitor connected(monochrome or color). It occurs very often and is normally not permittedby an interrupt mask of three. The standard HBL routine therefore only hasthe task of setting the interrupt mask to three if it is zero and allows the HBLinterrupt so that no more HBL interrupts will occur. One use of the HBLinterrupt 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 muchgreater importance, however, is the VBL interrupt, which is generated oneach picture return. This occurs 50, 60, or 70 times per second dependingon the monitor.

The vertical blank interrupt (VBL) routine accomplishes a whole set of atasks which must be periodically executed or which concern the screendisplay. When entering the routine, the frame counter f re lock ($466) isfirst incremented. Next, a test is made to see if the VBL interrupt issoftware-disabled. This is the case if vb Is em ($452) (vertical blanksemaphor) is zero or negative. In this case the routine is exited immediately

237

Page 245: Atari ST Internals

Abacus Software Atari ST Internals

and execution returns to the interrupted program. Otherwise, all of theregisters are saved on the stack and the counter vbcloek ($462), whichcounts the executed VBL routines, is incremented. Next, a check is made tosee if a different monitor has been connected in the meantime. If a changewas made from a monochrome to color monitor, the video shifter isreprogrammed accordingly. This is necessary because the high screenfrequency of 70 Hz of the monochrome monitor could damage a colormonitor. The routine to flash the cursor is called next. If you load a newcolor palette via the appropriate BIOS functions or want to change thescreen address, this happens here in the VBL routine. Since nothing isdisplayed at this time, a change can be made here without disturbinganything else. If colorptr ($45A) is not equal to zero, it is interpreted asa pointer to a new color palette, and this is loaded into the video shifter. Thepointer is then cleared again. If screenptr is set, this value is used as thenew base address of the screen. This takes care of the screen specificportions.

Now the floppy VBL routine is called, which with help the of the writeprotect status, determines if a diskette was changed. An additional task ofthis routine is to deselect the drives after the disk controller has turned thedrive motor off.

Now comes the most interesting part for the programmer, the processing ofthe VBL queue. There is a way to tell the operating system to execute yourown routines within the VBL interrupt. The maximum number of routinespossible is in nvbls ($454). This value is normally initialized to 8, but itcan be increased if required. Address vblqueue ($456) contains a pointerto a vector array which contains the (8) addresses of the VBL routines. Eachaddress is tested within the VBL routine and the corresponding routineexecuted if the address is not zero.

If you want to install your own VBL routine, check the 8 entries until youfind one which contains a zero. At this address you can write a pointer toyour 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 areaof memory, append the address of your routine, and redirect vblqueue topoint to the new vector array. Naturally, you must not forget to incrementvbls, the number of routines, correspondingly. Your routine may changeall registers with the exception of the USP.

As soon as the VBL routine is done, the dmpf lg ($4EE) is checked. If thismemory location is zero, a hardcopy of the screen is outputted. The flag isset in the keyboard interrupt routine if the keys ALT and HELP are pressed

238

Page 246: Atari ST Internals

Abacus Software Atari ST Internals

at the same time. Finally, the register contents are restored, vb Is em isreleased and execution returns to the interrupted routine.

The MFP 68901 occupies interrupt level six in our previous table. Thiscomponent is in the position to create interrupt vectors on its own. These arereferred 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 interruptrequests of all peripheral components including its own.

The MFP can manage sixteen interrupts which are prioritized in reference toeach other, similar to the seven levels of the processor. All MFP interruptsappear on level 6 to the 68000, therefore prioritized higher than HBL andVBL interrupts. The following table contains the assignments within theMFP.

Le ve 1 As s ignment15 Monochrome monitor detect14 RS-232 ring indicator13 System clock timer A12 RS-232 receive buffer full11 RS-232 receive error10 RS-232 transmit buffer empty9 RS-232 transmit error8 Line return counter, timer B7 Floppy controller and DMA6 Keyboard and MIDI ACIAs5 Timer C4 RS-232 baud rate generator, timer D3 unused2 RS-232 CTS1 RS-232 DCD0 Centronics busy

Not all of these possible interrupt sources are enabled, however. Somesignals are processed through polling. The following is a description of theinterrupts which are used by the operating system.

239

Page 247: Atari ST Internals

Abacus Software Atari ST Internals

Level 2, RS-232 CIS, Address $73CO

This interrupt is generated every time the RS-232 interface is informed viathe 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 incrementedin the interrupt routine. The next actions are performed only every fourthcall to the interrupt routine, that is, only every 20ms (50 Hz). First a routineis called which handles the sound processing. Another task of this interruptis the keyboard repeat when a key is pressed and initial repeat. Finally, theevt 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 MIDIinterface. In order to decide which of the two components has requested aninterrupt, the interrupt request bits in the status registers of the ACIAs aretested and the received byte is fetched if required. If it comes from thekeyboard, the scan code is converted to the ASCII code by means of thekeyboard table and written into the receive buffer, which happensimmediately for MIDI data. Mouse and joystick data also come from thekeyboard 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 isactivated. Here the transmitter status register is read and the status is savedin 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-232interface, it generates this interrupt. It is then ready to send the next byte. Ifdata is still in the transmit buffer, the next byte is written into the transmitregister, which can now be shifted out according to the selected baud rate.

240

Page 248: Atari ST Internals

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 isactivated. This may involve a parity error or an overflow. The routine onlyclears 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 thecharacter can be fetched and written into the receive buffer (if there is stillroom). This routine takes into account the active handshake mode (sendingXON/XOFF or RTS/CTS).

The other interrupt possibilities of the MFP are not used, but they can beused for your own routines. For example, interrupt level 0, Centronicsstrobe, can be used for buffered printer output.

241

Page 249: Atari ST Internals

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 theGEMDOS functions by means of TRAP 11 or a direct BIOS call withTRAP #13. The other possibility consists of using the VDI functions.

You have special possibilities for screen control with both variants. We willfirst take a look at output using the normal DOS or BIOS calls. Here aterminal of type VT52, which offers a wide variety of control functions, isemulated for screen output. These control characters are prefixed with aspecial character, the escape code. Escape, also shortened to ESC, hasASCII code 27. Following the escape code is a letter which determines thefunction, as well as additional parameters if required. The following listcontains all of the control codes and their significance.

ESC A Cursor upThis function moves the cursor up one line. If the cursor was alreadyon the top line, nothing happens.

ESC B Cursor downThis ESC sequence positions the cursor one line down. If the cursoris already on the bottom line, nothing happens.

ESC C Cursor rightThis sequence moves the cursor one column to the right.

ESC D Cursor leftMoves the cursor one position to the left This function is identical tothe control code backspace (BS, ASCII code 8). If the cursor isalready in the first column, nothing happens.

ESC E Clear HomeThis control sequence clears the entire screen and positions the cursorin the upper left corner of the screen (home position).

242

Page 250: Atari ST Internals

Abacus Software Atari ST Internals

ESC H Cursor homeWith this function you can place the cursor in the upper left corner ofthe screen without erasing the contents of the screen.

ESC I Cursor upThis sequence moves the cursor one line towards the top. In contrastto ESC A, however, if the cursor is already in the top line, a blankline is inserted and the remainder of the screen is scrolled down a linecorrespondingly. The column position of the cursor remainsunchanged.

ESC J Clear below cursorBy means of this function, the rest of the screen below the currentcursor position is cleared. The cursor position itself is not changed.

ESC K Clear remainder of lineThis ESC sequence clears the rest of the line in which the cursor isfound. The cursor position itself is also cleared, but the position isnot changed.

ESC L Insert lineThis makes it possible to insert a blank line at the current cursorposition. The remainder of the screen is shifted down; the lowest lineis then lost. The cursor is placed at the start of the new line after theinsertion.

ESC M Delete lineThis function clears the line in which the cursor is found and movesthe rest of the screen up one line. The lowest screen line thenbecomes free. After the deletion, the cursor is located in the firstcolumn of the line moved up to take the place of the old one.

243

Page 251: Atari ST Internals

Abacus Software Atari ST Internals

ESC Y Position cursorThis is the most important function. It allows the cursor to bepositioned at any place on the screen. The function needs the cursorline and column as parameters, which are expected in this order withan 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 screenthe 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 caseletter.

ESC b Select character colorWith this function you can select the character color for furtheroutput. With a monochrome monitor you have choice between just0=white and l=black. For color display you can select from 4 or 16colors depending on the mode. Only the lowest four bits of theparameters are evaluated (mod 16). You can use the digit" 1" for thecolor 1 as well as the letters "A" or "a" in addition to binary one.

ESC c Select background colorThis function serves to select the background color in a similarmanner. 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 positionThis sequence causes the screen to be erased starting at the top andgoing to the current position of the cursor, inclusive. The position ofthe cursor is not changed.

ESC e Enable cursorThrough this escape sequence the cursor becomes visible. The cursorcan, for example, be enabled when waiting for input from the user.

ESC f Disable cursorTurns the cursor off again.

244

Page 252: Atari ST Internals

Abacus Software Atari ST Internals

ESC j Save cursor positionIf you want to save the current position of the cursor, you can usethis sequence to do so.

ESC k Set cursor to the saved positionThis is the counterpart of the above function. It sets the cursor to theposition which was previously saved with ESC j.

ESC 1 Clear lineClears the line in which the cursor is located. The remaining linesremain unaffected. After the line is cleared, the cursor is located in thefirst column of the line.

ESC o Clear from startThis clears the current cursor line from the start to the cursor position,inclusive. The position of the cursor remains unchanged.

ESC p Reverse onThe reverse (inverted) output is enabled with this sequence. For allfurther output, the character and background colors are exchanged.With a monochrome monitor you get white type on a blackbackground.

ESC q Reverse offThis sequence serves to re-enable the normal character display mode.

ESC v Automatic overflow onAfter executing this sequence, an attempted output beyond the end ofline will automatically start a new line.

ESC w Automatic overflow offThis deactivates the above sequence. An attempt to write beyond theline will result in all following characters being written in the lastcolumn.

245

Page 253: Atari ST Internals

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 selectedby choosing the proper function number. Note, however, that under VDIthe 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 screencoordinates. If necessary, you can use the ESC functions of the VT52emulation in addition.

The output of "unprintable" control characters

The three system fonts of the ST have also been supplied with characters forthe ASCII codes zero to 31, which are normally interpreted as controlcodes. On the ST, only codes 7 (BEL), 8 (BS backspace), 9 (TAB), as wellas 10, 11, and 12 (LF linefeed, VT vertical tab, and FF form feed allgenerate a linefeed) plus 13 (CR carriage return) have effect, in addition toESC. The remaining codes have no effect. How does one access thecharacters 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 oneselects number 5, however, all the codes from, 0 to 255 are outputted asprintable characters, control codes are no longer taken into account.

In the appendix you find the three ST system fonts pictured.

246

Page 254: Atari ST Internals

Abacus Software Atari ST Internals

3.7 The ST System Variables

The ST uses a set of system variables whose significance and addresses willnot change in future versions of the operating system. If you use othervariables, such as those from the BIOS listing which are not listed here, youshould always remember that these could have a different meaning in a newversion of the operating system. The system variables are in the lower RAMarea directly above the 68000 exception vectors, at address $400 to 1024.The address range from 0 to $800 (2048) can be accessed only in thesupervisor mode. An access in the user mode of the 68000 leads to a buserror.

In the following listing we will use the original names from Atari. Inaddition to the address of the given variable, typical contents and thesignificance 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 periodictasks 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 anotherdisk 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 notyet used.

247

Page 255: Atari ST Internals

Abacus Software Atari ST Internals

$420 L memvalid $752019F3

If the memory location contains the given value, the configuration ofthe 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 thereset 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 512Kmachine.

$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 memoryconfiguration valid.

$43E W flock 0

If this variable contains a value other than zero, a disk access is inprogress and the VBL disk routine is disabled.

248

Page 256: Atari ST Internals

Abacus Software Atari ST Internals

$440 W seekrate 3

The seek rate (the time it takes to move the read/write head to the nexttrack) is determined according to the following table:

Seek rate Time0 6 ms1 12 ms2 2 ms3 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 isperformed after every disk write access.

$446 W _bootdev 0

Contains the device number of the drive from the operating systemwas loaded.

$448 W palmode 0

If this variable contains a value other than zero, the system is in thePAL 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 newresolution 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 resolution1 640x200, medium resolution2 640x400, high resolution

249

Page 257: Atari ST Internals

Abacus Software Atari ST Internals

$44E L _v_bas_ad $78000

This variable contains a pointer to the video RAM (logical screenbase). The screen address must always begin on a 256 byteboundary.

$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 theVBL.

$45A L colorptr 0

If this value is not zero, it is interpreted as a pointer to a color palettewhich 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 setduring 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

Page 258: Atari ST Internals

Abacus Software Atari ST Internals

$46E L swv_vec $50 IE

Vector for changing the screen resolution. A branch is made via thisvector 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 Meaning0 Key click on/off1 Key repeat on/off2 Tone after CTRL G on/off3 "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

Page 259: Atari ST Internals

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 appropriateroutine, for example.

$4 AC W save_row 0

Temporary storage for cursor line when positioning the cursor withESCY.

$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 isresponsible for data sectors, the second for the FAT (file allocationtable) and the directory. Each buffer control block (BCB) isconstructed as follows:

252

Page 260: Atari ST Internals

Abacus Software Atari ST Internals

long BCB $4F8A, pointer to next BCBint drive -1, drive number or -1int type 2 buffer typeint rec $41C record number in this bufferint dirty 0 dirty flag (buffer changed)long DMD $2854 pointer to drive media descriptorlong 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 fordrive B, and so on.

$4C6 L _dskbufp $12BC

Pointer to a 1024-byte disk buffer. The buffer is used for GSXgraphic 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 arepressed simultaneously. A value of one generates a hardcopy of thescreen on the printer. A hardcopy can be interrupted by pressing ALTHELP again.

253

Page 261: Atari ST Internals

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 theinitialization of the BIOS.

254

Page 262: Atari ST Internals

Abacus Software Atari ST Internals

3.8 The 68000 Instruction Set

If you are already familiar with the machine language of some 8-bitprocessor: Forget everything you know. If you do, it will make it easier tounderstand the following material!

The 68000 processor is fundamentally different in construction andarchitecture from previous processors (including the 8086!). The essentialdifference does not lie in the fact that the standard processing width is 16and not 8 bits (which is sometimes a drawback and can lead toprogramming errors), but in the fact that, with certain exceptions, theinternal registers are not assigned to a specific purpose, but can be viewedas general-purpose registers, with which almost anything is possible.

In eariler processors, the accumulator was always the destination forarithmetic operations, but it is completely absent in the 68000. There areeight data registers (DO-D7) with a width of 32 bits, and as a general rule, atleast one of these is involved in an operation. There are also eight addressregisters (AO-A7), each with 32 bits, which are usually used for generatingcomplex addresses. Register A7 has a set assignment—it serves as the stackpointer. It is also present twice, once as the user stack pointer (USP) andonce as the supervisor stack pointer (SSP). The distinction is made becausethere are also two operating modes, namely the user mode and thesupervisor mode.

These two are not only different in that they use different stack pointers, butin that certain instructions are not legal in the user mode. These are theso-called priviledged instructions (see also instruction description), withwhose help an unwary programmer can easily "crash" the system ratherspectacularly. This is why these instructions create an exception in the usermode. An exception, by the way, is the only way to get from the user modeto the supervisor mode.

In addition there is the status register, the upper half of which is designatedas the system byte because it contains such things as the interrupt mask,things which do not concern the "normal" user, making access to this bytealso 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 programmerworks with these flags indirectly, such as when the execution of a branch ismade conditional on the state of a flag.

255

Page 263: Atari ST Internals

Abacus Software Atari ST Internals

Two things should be mentioned yet: Multi-byte values (addresses oroperands) are not stored in memory as they are with 8-bit processors, in theorder low byte/high byte, but the other way around. Four-byte expressions(long word) are stored in memory (and the registers of course) with thehighest-order byte first.

The second is that unsupported opcodes do not lead to a crash, but cause aspecial exception, whose standard handling must naturally be performed bythe operating system.

3.8.1 Addressing modes

This is probably the most interesting theme of the 68000 because theenormous capability first takes effect through the many various addressingmodes.

The effective address (the address which, sometimes composed of severalcomponents, 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, canbe specified with one of the addressing modes. This means that evenmemory 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 thedestination operand (behind the comma).

256

Page 264: Atari ST Internals

Abacus Software Atari ST Internals

Register Direct

The operand is located in a register. There are two kinds of register directaddressing: 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 addressregister 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 aperipheral component, naturally (see MOVEP). The address is specified inabsolute form.

This can have a width of a a long word, whereby the entire address spacecan be accessed, or it can be only one word wide. In this case issign-extended (the sign being the highest-order bit) to 32 bits. For example,the word $7FFF becomes the long word $00007FFF, while $FFFFbecomes $FFFFFFFF. Only the lower 32K and the upper 32K of theaddress space can be accessed with the short form. This addressing mode isoften used in the operating system of the ST because important systemvariables are stored low in memory and all peripheral components aredecoded at the top.

Example: MOVE.L $7FFF, $01234567

Instructions in which both operands are addressed with a long word are thelongest instructions in the set, consisting of 10 bytes.

257

Page 265: Atari ST Internals

Abacus Software Atari ST Internals

Program Counter Relative Addressing

This addressing mode allows even constants to be addressed in a completelyrelocatable program, since the base of the address calculation is the currentstate of the program counter.

The are two variations. In the first, a 16-bit signed offset is added to theprogram counter, and in the second, the contents of a register(sign-extended if only one word is specified) are also added in, though herethe 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 registerare then incremented by the length of the operand, by 1 for xxx.B or 4 forxxx.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 beforethe addressing.

Example: EOR.L DO,$1234 (A4)

258

Page 266: Atari ST Internals

Abacus Software Atari ST Internals

Indexed Register Indirect with Offset

As above, but the contents of another register (address or data) are alsoadded in, taking the sign into account. The offset may have a width of 8 bitshere, however.

Example: MOVE.W $12 (A5,A6.L) ,D1

Immediate Addressing

Here the operand is contained as such in the instruction itself. Naturally, anoperand specified in this manner can serve only as a source. The immediateoperands 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, thereforehaving a value from 0-7. An exception is the MOVE command, where theconstant may have 8 bits, but in which only a data register is allowed as thedestination.

Example: ADDQ.L #1,AO or MOVEQ f!23,Dl

Implied Register

This addressing mode is mentioned only for the sake of completeness and init, an operand address is already determined by the instruction itself. Theoperands are either in the program counter, in the status register, or thesystem stack pointer.

Example: MOVE SR,D6

Regarding the offsets, it should be noted that they are signed numbers intwo's complement. Their highest-order bit forms the sign. With an 8-bitvalue, an offset of +127/-128 is possible, and about ±32K with 16 bits.

259

Page 267: Atari ST Internals

Abacus Software Atari ST Internals

3.8.2 The instructions

In the following instruction description, the individual bit patterns are notlisted since this would lead to far in this connection.-Additonal informationcan be gathered from books like the M68000 16132-Bit MicroprocessorProgrammer's Reference Manual (Motorola).

The instructions are also explained only in their base form and variations arementioned only in name. We will briefly explain what the individualvariations can look like here.

The variations are indicated by letter after the operand. This can be one ofthe 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. Ioperands 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 valuerange of 0 to 7. This limited range has the advantage that the operandwill fit into the opcode. Since there is no special command forincrementing a register, something like ADDQ.L #1,AO works well inits place. An exception is MOVEQ. Here the operand may have a valueof 0-255.

X indicates arithmetic operations which use the X flag. This flag has aspecial significance. It is set equal to the carry flag for all arithmeticoperations. The carry flag, however, is also affected by transferoperations while the X flag is not so that it remains available for furthercalculations. This is especially useful for computations with higherprecision than the standard 32 bits, where temporary results must firstbe 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 dataregister, for example, has a width of 32 bits = 4 bytes = 1 long word, theinstruction CLR.B DO clears only the lowest-order byte of the register. Forregisters, .W specifies the lower word. The higher-order word is not

260

Page 268: Atari ST Internals

Abacus Software Atari ST Internals

explicitly addressable. If the operand is in memory, it is imporant to knowthat .W and .L operands must begin on an even address. The same appliesfor the opcode as such, which also always comprises one word.

If the destination of an operation is an address register, only operands oftype .W and .L are allowed, whereby the first is sign-extended to a longword.

Some listings contain instructions of the form MOVE.L #27,DO. Theprogrammer then assumes that the assembler will produce #$0000001Bfrom #27.

Now to the individual instructions:

ABCD Add Decimal with ExtendThere is one data format which we have not yet discussed: the BCDformat. This means nothing more than "Binary-Coded Decimal" and ituses 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 canthen add two such numbers. The processing width is always 8 bits.

ADD Add BinaryThis instruction simply adds two operands.Variations are ADDA, ADDQ, ADDI, and ADDX.

AND Logical ANDTwo operand are logically combined with each other according theAND function.Variation: ANDI

ASL Arithmetic Shift LeftThe 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 isshifted in at the right. If a data register is shifted, the processing widthcan be any. The number of places to be shifted is either specified as an Ioperand (3 bits) or is placed in an additional register. If a memorylocation is shifted, the processing width is always one word. A counteris then not given; it is always =1.

ASR Arithmetic Shift RightThe operand is shifted to the right, whereby the lowest bit is copied toC and X. The sign bit is shifted over from the left. See ASL forinformation about processing width and counter.

261

Page 269: Atari ST Internals

Abacus Software Atari ST Internals

Bee Branch ConditionallyThe branch destination is always a relative address which is either onebyte or one word long (signed!). Correspondingly, the branch canjump over a range of +127/-128 bytes or +32K-1/-32K. The point ofreference is the address of the following instruction.

Whether or not this instruction is actually executed depends on therequired condition, which is verified by means of the flags. Here are thevariations and their conditions. A minus sign before a flag indicates thatit must be cleared to satisdy the condition. Logical operations areindicated with "*" for AND and "/" for OR.

BRA Branch Always no conditionBCC Branch Carry Clear -CBCS Branch Carry Set CBEQ Branch Equal ZBGE Brangh Greater or Equal N*V/-N*-VBGT Branch Greater Than N*V*-Z/-N*-V*-ZBHI Branch Higher -C*-ZBLE Branch Less or Equal Z/N*-V/-N*VBLS Branch Lower or Same C/ZBLT Branch Less Than N*-V/-N*VBMI Branch Minus NBNE Branch Not Equal -ZBPL Branch Plus -NBVC Branch Overflow Clear -VBVS Branch Overflow Set V

BCHG Bit Test and ChangeThe specified bit of the operand will be inverted. The original state canbe 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 giveneither as an I operand or is located in a data register.

BCLR Bit Test and ClearThe specified bit is cleared. Everything else is handled as per BCHG.

BSET Bit Test and SetThe specified bit is set. Boundary conditions are per BCHG.

BSR Branch to SubroutineThis is an unconditional branch to a subroutine. Branch distances as forBcc.

262

Page 270: Atari ST Internals

Abacus Software Atari ST Internals

BTST Bit TestThe bit is only checked as to its condition. Everything else as perBCHG.

CHK Check Register Against BoundariesA data register is checked to see if its contents are less than zero orgreater than the operand. Should this be the case, the processorexecutes an exception. The program is continued at the address inmemory location $18 (vector 6). Otherwise no action is taken. Theprocessing width is only word.

CLR Clear OperandThe specified operand is cleared (set to zero).

CMP CompareThe first operand is subtracted from the second without changing eitherof the two operands. Only the flags are set, according to the result.Variations: CMPA and CMPIBoth operands are addresses with the addressing mode (Ax)+ with thevariant CMPM.

DBce Test Condition, Decrement and BranchA data register is decremented and the flags are checked for thespecified condition. A branch is performed if either the condition isfulfilled or the register is -1. Branch conditions and ranges as per Bcc.

DIVS Divide SignedThe second operand is divided by the first operand, talcing the sign intoaccount Afterwards the second operand contains the integer quotient inthe lower word and the remainder in the upper word, which has thesame sign as the quotient. The data width of the first operand is set at.W and at .L for the second.

DIVU Divide UnsignedOperation as above, but the sign is ignored.

EOR Exclusive ORThe two operands are logically combined according to the rules ofEXOR.Variations: EORI

EXG Exchange RegistersThe two registers specified are exchanged with each other.

263

Page 271: Atari ST Internals

Abacus Software Atari ST Internals

EXT Sign ExtendThe operand is filled to the given processing width with its bit 7 (in thecase of .B) or bit 15 (.W).

JMPJumpUnconditional jump to the specified address. The difference betweenthis and BRA is that here the address is not relative but absolute, that is,the actual jump destination.

JSR Jump to SubroutineJump to a subroutine. The difference from BSR is as above.

LEA Load Effective AddressThis often-misunderstood instruction loads an address register not withthe contents of the specified operand address as is normal for the otherinstructions, but with the address as suchl

LINK Link StackThis instruction first places the given address register on the stack. Thecontents of the stack pointer (A7) are then placed in this register and theoffset specified is added to the stack pointer.

With this practical instruction, data areas can be reserved for asubroutine, without having to make room in the program itself, whichwould also be impossible in programs which run in ROM. TheC-compiler makes extensive use of this capability for local variables.

LSL Logical Shift LeftFunction and limitations as per ASL.

LSR Logical Shift RightFunction and limitations as per ASR, except here the sign is not shiftedin on the left, but a 0.

MOVEThe first operand is transferred to the second.Variations: MOVEA, MOVEQ

MOVEM Move Mulitple RegistersHere an operand can consist of a list of registers. This can be used toplace all of the registers on the stack, for instance.Example: MOVEM.L AO-A67DO-D7,-(A7)

264

Page 272: Atari ST Internals

Abacus Software Atari ST Internals

MO YEP Move Peripheral DataThis speciality is made expressly for the operation of peripheralcomponents. 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 the68000's data bus. If a word or long word is to be transferred, the bytesmust 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 thenalways incremented by two so that the transfer always continues on thesame half of the data bus on which it was begun. Corresponding to thepurpose of this instruction, one operand is always a data register, andthe other is always of type register indirect with offset.

MULS Multiply SignedSigned multiplication of two operands.

MULU Multiply UnsignedMultiplication of two operands, ignoring the sign.

NBCD Negate Decimal with ExtendA BCD operand is subjected to the operation 0-operand X.

NEG Negate BinaryThe operand is subjected to the treatment 0-operand.Variations: NEGX

NOP No OperationAs the name says, this instruction doesn't do anything.

NOT One's ComplementThe operand is inverted.

OR Logical ORThe two operands are combined according to the rule for logical OR.

PEA Push Effective AddressThe address itself, not its contents, is placed on the stack.

RESET Reset External DevicesThe reset line on the 68000 is bidirectional. Not only can the processorbe externally reset, but it can also use this instruction to reset all of theperipheral devices connected to the reset line.This is a priviledged instruction!

265

Page 273: Atari ST Internals

Abacus Software Atari ST Internals

ROL Rotate LeftThe operand is shifted to the left, whereby the bit shifted out on the leftwill be shifted back in on the right and the cany flag is affected.Processing widths and shift counter as per ASL.

ROR Rotate RightAs above, but shift from left to right.

ROXL Rotate Left with ExtendAs ROL, but the shifted bit is first placed in the X flag, the previousvalue of which is shifted in on the right

ROXR Rotate Right with ExtendAs above, but reversed shift direction.

RTE Return from ExceptionReturn from an exception routine to the location at which the exceptionoccurred.

RTS Return from SubroutineReturn froma subroutine to the location at which it was called.

RTR Return and RestoreAs above, but the CC register (the one with the flags) is first fetchedfrom the stack (on which it must have first been placed, becauseotherwise execution will not return to the proper address.

SBCD Subtract Decimal with ExtendThe first operand is subtracted from the second. Refer to ABCD forinformation on the data format

Sec Set ConditionallyThe operand (only .B) is set to $FF if the condition is fulfilled.Otherwise it is cleared. Refer to Bcc for the possible condition codes.

STOPThe processor is stopped and can only be called back to life through anexternal interrupt.This is a priviledged instruction!

SUB Subtract BinaryThe first operand is subtracted from the second.

266

Page 274: Atari ST Internals

Abacus Software Atari ST Internals

SWAP Swap Register HalvesThe two halves of a data register are exchanged with each other.

TAS Test and Set OperandThe operand (only .B) is checked for sign and 0 (affecting the C and Nflags). Bit 7 is then set to 1.

TRAPThe applications programmer uses this instruction when he wants to callfunctions of the operating systems. This instruction generates anexception, which consists of continuing the program at the addressdetermined by the given vector number. See the chapter on the BIOSand XBIOS for the use of this instruction.

TRAPV Trap on OverflowIf the V flag is set, an exception is generated by this instruction,resulting in program execution continuing at the address in vector 7

TST TestAction like TAS, but the operand is not changed.

UNLK UnlinkThis instruction is the counterpart of LINK. The stack pointer (A7) isloaded with the given address register: and this is supplied with the laststack entry. In this manner the area reserved with LINK is released.

Addendum to the condition codes: The conditions listed under Bcc are notcomplete, 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 isalways fulfilled. F stands for false and is the opposite: the condition is neverfulfilled.

267

Page 275: Atari ST Internals

Abacus Software Atari ST Internals

3.9 The BIOS Listings - Version 1

COoHPQ

EHCO

HHK

EH

***•X

*•X

•X

-X

*•X•X

X

•Xx•X

**-X•X•X•X-XXX

*-XX

*X-XXXX£

XX

4-1

id4-1CO

id

eno

oEH

EdrH

om

243

urH

oVD

oo0inoo

rH

c0

-HCOrl

01

orH

43

o•a

oorHo

CMoomoo

COCO01

-a-oid

4-101CO01

EdrH

om

rH

o•o

EdrH

omoooo•c1

oomoo

E014-1CO

CO

en-rl

id

o01

4-1

o4-1rlid4-1

ooom

rH

o•a

ooomooooCOoomoo

$1

90

00

En

d

of

the

op

era

tin

g

sy

ste

m

rH

O•o

ooCJenrHOOO

CJooinoo

tntn01

•Q•aid

4-101COcuA

rH

Om

rH

O•o

EdrHOmooooorHOLO0o

$1

9B

F4

rH

O•o

•=31[V,

CQenrH

ooo*=rrHOin0o

inCO

oCM

014-1

•oco

-rt

id01

o

inCO

rHOCM

O

rH

O•a

m00enrH

oCM\S3O

COrH

omoO

O

3O•a

ooooCJrH0moo

,w

#$

27

00

, SR

Su

pe

rvis

or

mode,

no

inte

rru

pts

01

oE

0of^

CMCJfa

^T

CdrH

Omoo

,1

$5

01

E,$

42

A

Load re

sve

cto

r

01

oE

CM

00oooHrH0unooooenfanCM

CMCMoinoo

,1

#$

31

41

59

26

, $

42

6 R

esm

ag

ic to

re

sva

lid

01

oE

CM

00ooovoCMeninrH

*3*rH(T)

CJ

coCM

OCMOmoo

$F

FF

F8

80

0,A

O

Ad

dre

ss

of

the

so

un

d chip

01rH

00COCOfafv.rv.[V,

enfarHr

v£>coomoo

CQ

T3

id

rl

O

o

r-

01

oE

r-0ooCJPQorH

Ocoomoo

4-1

ft4-13O

O

0

CM

0CJV*=8=

0!

OE

CM0oooCJooCJ

rHrH

OJ1

O

moo

4-1M0ft

ti01rH

01CO

o

01

oE

Cd0ooCJ03orH

^O•q*O

m0o

CO01-rl

aorH

OcurH

CUtn01a

o

CM

CU

oE

CM0Oor-ooo0

rHrH

<£«qiO

in0o

o

rHOin</>o

4-1

4-1

COO

[V,

OooortlcoCO0

oinoin0o

0

0m

cu

COor-10

\£>moinoo

,b

#2

,$F

FF

F8

20

A

Syn

cmod

e

01

oE

££oCMCOf-,(V,fV,

fT,

CMOOOCJfacorH

CO

in0IT)OO

orlorH

OoCOCO01rl

-aT)

rH

0

CMCO

Cu

01rH

O«giCMCO(V,

fT,

PM

r-.enfc.n•ST

OVJ3Oino0

COrl

OrH

O0

rH

OQ

cC=tt=

cuoE

rv.OooCJenoCO

\£>VDOino0

01rH

43<d4-1

rl

orH

OCJ

01

4-1

inO

COCOCUH

TJT>

O

V

CJO4

CJrH

m

idcurH

Omnof£farH^n

<£^ooino0

014-14J0rH

idft

rlOrH

OoTiido

rH

H-

0

01

oE

COQCM<r)

W

O

mo0

rlOrH

OCJ

4-1X01

10om

oQ

id

43•a

CJ

f-,fT,

COCJrH

m0r-omo0

m

rl

idcurH

CJ

IO

m

'H-

3CO

QCJPQ

31

( —Omo0

,w

#$5F

C,A

O

En

d

of

the

op

era

tin

g

syste

m v

ari

ab

les

01

oE

CJfain0CJ

on^Dt —omoo

,w

#$

50

00

, A

l S

tart

o

f th

e

op

era

tin

g

syste

mcuoE

ooo

OCMn

f^[ —oinoo

oQ

rl

idcurH

CJ

oQ

0

rH

CU

oG

ooor-

Cdr-oinoo

01encid

101

rl

idCUrH

CJ

o

oQ

CU

OE

oOoCO

oCOomoo

c^-

T!01

JSoidcurl

T3GEd

rH

O

^~

EO

COOnPQ

CMCOO

moo

268

Page 276: Atari ST Internals

Abacus Software Atari ST Internals

o53

OCOQ

in

d)c43

i4jEM

«3

•=?COoin0o

o•oc0)

aoCO

x;CM

o

-in•*H

s«•

rH

0)

1

MCM•a1

OQU3OCM

\OCOoino0

CMCO

CO

q•HS

o

oooCO

*

""1433CO

oo0COoo00CJCMrHcn

<CO0inoo

As

vid

eo

a

dd

ress

v

bs

ad

m

W*>r«•

0

rH

<U

Og

w^poCO^1

PQCM

Ocnomo0

!201

D

base

h,

vid

eo

addre

ss

for

hard

ware

1CM<ft-

in*-*EM

•=r</>

^(U

O

rH

0CMCOEMCMEMCMEM

•31

OQ[V]

COrH

SPCftomoo

J2

03

Dbasel

EMEMEMEM

in~_om<o

43

0)

OS

CO0CMCOCMEMEMCMOin• p0QCM*COrH

CJcnoinoo

($7

FF

+1

)*1

6

=

32

K vid

eo

RA

M

QCMEM

«•*

£

0)

OE

CMCM

OUCOCMCO

9rOmoo

H-

O

—0Q

rH

P

O

o{_)oCM

CO<Oinoo

+

0

—oQ

rH

(U

O

oooCM

<=cfQ

omoo

Cle

ar

scre

en

H-

0

~—

OQ

rH

(U

O

OCJOCM

CJ

Omoo

H-

0

— -

OQ

H

P

O

OCJoCM

w<^oinoo

01(U

rH

<VK

CO

Oin

rHQ

rd

IQEMCMPT,enOrH

moCPomo0

o

o

^prH

m

rH

<0

O

pqmEMp-.rij[OCM

•=rpqomoo

0

rH

CMCO

mr-co

*

i~H

o

rH

CMCO

mvot—COoo^CJoCOpqoinoo

^poin«•

0)

•31

O( —to

HPQOinoo

o

o

COo

in«•

rH

\ofytEMEM

pr.

rH•0-

OCJ0inoo

CO0

•oG

<

<P

"^0

sSP

rH

<S>

Os

<CMi

0Oooongi

oooCO[y^COCM

spOomoo

COo00}X

EMCM

^0

SCO

rH

(U

o

wCM•310oooo03OooCOpq

COCM

CJCJOinoo

4-)-HC-H

>

W

m

«j•3"

COpq<«•*

rH

(U

O

t£>i

0COpqf^inooooCJf-

CM

QIQOmoo

•o

<r~SCOCOQm

*rH

0)K,

|

vor~^^0COCOQmo0ooCJp**

PQCM

CJQOmoo

1

33

m

CMr-

sEM"^OPQin

*rH

0)

O

CMr-SP

0a\0PQinooooCJf*.

PQCM

•=3"CMOinoo

i H

dv

media

ch

m

r-

S

WrHDIT)

*

rH

(U

O

wt —"5P0(4rHQmoo00CJ

mCM

CJwom00

4-J0Oft

•a

<<

</>CMPQo

V*

*rH

(U

0g

rtr~*?poCM

Ov^5OOOoo[•*»PQCM

•=rEMOmoo

Ao

oCD

CO

rd

•ord

CO

in

voCO

*in•«w•=P<«•

rH

<uo

\Q

CO

ow•*poQvoPQCM

CJCMOin0o

\5)

En

d

os

as

mem

ory

bo

tto

m

CMCOsp

•*in-~-

EM

<f*

rH

CD

O

CMCO

Of£

EM

0QV£)

PQCM

CMOrHin00

Initia

lize

sta

ck poin

ter

•*pjjCM

CO<n

(Q(UrH

,-£

CMwCOooooenEMEM•=P

COoHinoo

Nvbls

, num

ber

of

VB

L routines

inft,

m•srto-

co*

9

0)

o

spm

oCOo00osCO

woHm00

Fve

rify

, F

loppy V

eri

fy a

fte

r w

rite

in~—

5<3<«•

CO

«gi^P^P0Qw0m^prH

H

mo0

Se

ekra

te

for

floppy

to

3 m

s

in<0

qi

"tco=s=

9CO

0

o•a1*?poCOoo0CJr-pqCO

COrH

H

in00

I D

skbufp

to

$12B

C,

dis

k b

uff

er

<voCJ•sp

CJraCM

<n-*

rH

0)

o

IQo"d1

0CJpqCMrHOo00CJ

pqCM

wrH

H

m00

1 C

lear

dum

pflg

fo

r hard

copy

m

wwsEMfaCMEM

*

9

W

Os

w•=rOCMEMEMEMCJp-*

pqCO

^oCMHm00

I S

ysb

ase

, sta

rt

of

the opera

ting

syste

m

m<CMEM

«*t

00Oin=8=

rH

CD

0

CMCM•a10oooinoo00o[-pqCM

CJCMHin00

269

Page 277: Atari ST Internals

Abacus Software Atari ST Internals

CJfamtoo

to

Ei

S-lO

M

cn

io

CM

ofainto

rH

01

og

CMf3*"-TOCJfam000ooop^

PQCM

•=rCOrHmoo

CO

pra

.aCO•o

•a

m

vo

toCOCMCOinto=»=

rH

01

O

wvo•a1

oCOCMCOinooooCJ[ -

PQCM

CJCOrHtoOO

Poin

ter

to rte

|

CO

oQ.

CM

ininto

(00)rH

CJfaCOosCfat—sp

•=r•3*rHmoo

Poin

ter

to rt

s

|

CJ

COCMCOmto

ca01rH

WQrHO<sfaCTl•a*

CO*TrHmoo

\00

00

Ca

rtb

ase

, D

iagnostic cart

rige

in

sert

ed?

|

fato

famCO

CMtofato

1 — 1

d,sCl

ooo0

*^faoofaIOCOCMCMto( CfaenPQCJ0

CJ•a1

rHmo0

Ye

s,

do

n't in

itia

lize

ve

cto

rs

|

wrHtoto

tr01

VOCMr^vo

votorHmOo

Term

inate

p

roce

ss

|

rH

CJCM

COroCOin•CO

CB01rH

f-1QVOof£faCO•a1

COmrHinoo

rH

CM

CO

-H

G-H

CO-H

S-l0!

pC

SH

O

0)

rH

O0/•>

L #

$2

00

0(

< 1

•oTita

000o0oCMoofaCOQ

omrHino0

U0SHS-l01

CO

,Q

4-1-H

4-1

fflPen

o

COto

<a01rH

COo0o00ooenfarHW

CMVOrHmO0

Num

ber

of

ve

cto

rs

|

Q

Q

=»=

a01

o

QCOooCJ

0CO

00vorH10O0

Set

ve

cto

r |

+

o

rH

rH

01

0

enCJ0CM

CJVO<Hmoo

rH

1

CM

COP-H

G-H

(H0!

R

PG0)

0)

OC!H

rH

Oo/->

#$

10

00

1

« — 1

*QT)ta

oooooorH0CJfanQ

WvorHin0o

Next

ve

cto

r |

orHm

oQ

caSH

vofafafaCOOrHto•a-r^<Hmoo

'Div

isio

n by

ze

ro1 to

rt

e

|

tH<O

01

O

qlrHOOoo00PQOCOCM

COr-rHin0o

1 V

ert

ica

l B

lank In

terr

upt,

IP

L4

|

to

or-

CMm

into

rH

(0£>

0

Or-ooCMinspm0oooCJp-.

PQCM

wr~Hinoo

1 H

orizonta

l B

lank In

terr

upt,

IP

L2

|

in

COvo

,1

#$

54

3C

,

01

o

00voo0CJCO^Jlinoo00CJr-PQCM

VOCOrHm0o

01

SH

0

CM

*

EH

in

00CO

CO

rH

01

0

COCOooPQq*

PQCM

wCOrHin0o

1 TR

AP

#13

ve

cto

r |

to

PQto

,1

#$

55

6C

,

0)

o

J1

PQ00CJvointooo00ot—PQCM

CMenHin0o

S-lo4-1O01

rH

*

K

m

COPQ

vovoinmto=8=

rH

01J>0

COPQoovovommooooCJt—PQCM

f£cnrHin0o

1 LIN

E A

ve

cto

r |

m

COCMto

enPQ

=*>

rH

01

O

00CMO0

cnPQoo00or-PQCM

CM

rHin0o

COpSH

O4-1

01

-H4J

4-1

m

0

rH

01>

0

0o^pooQ1

PQCM

pj.rtjrH

0O

5)

Etv

critic

ve

cto

r |

<

o

to,1

#

$5

56

2,

01

0

*^T0•a1

0CMVOtotooo00oc—PQCM

wrHm0o

COpM

O4-1

e014-1

P

in

CO0

S;

i-H

01

O

COor0O

PQCM

voPQrHmOo

pCO-HrH

rH

<

iO

wCJ

to

ca01rH

wo0Q

rH«<

<PQrH1000

As

poin

ter

to vblq

ueue

|

io£vomtoo

r-l

01

O

vom

oCO"a1CQCM

wfflrHmoo

8 ve

cto

rs

|

oQ

&

01

0

( —o00CJcooco

CMCJrHmo0

4-1to-rl

rH

SH

0)rHCJ

O

.

HO

COC3>CM

VOOrHinoo

Next

ve

cto

r |

vo

toto0Q

ra

i

ofaCOorHtoCO0rHtoO0

Initia

lize

M

FP

|

CM

VO

J_l

CO

^prHQrHOOrHVO

oCJrHIOOO

SH01

G

4J-HPQ

0D

CM=st=rH

01

0

CM0Or-

oQrHino0

Cart

sca

n,

test

cart

ridge

|

faCMinto

S-4COA

P3JCMrHOOorHVO

CMQrHinoo

to

S-lca01rHO

intZ

in

i — i

pCO

QCJPQen

voQrHtoOO

270

Page 278: Atari ST Internals

Abacus Software Atari ST Internals

r next

pic

ture

re

turn

oH-I4J-rH

<0s^

£j£,s

r next

pic

ture

re

turn

oMH

JJ-H(0S

^rH43

S

ution

to

m

onoch

rom

e

rH

otn(UM

JJrH

P

(0

0)Q

monoch

rom

e

dete

ct

G.-H

tt,&PJPHs;

010)

EH

monitor

?

0)go!-4

AOOcoSo

T)gjjIH-HA01IH01•a

cu0

C"

0)TSOsMO

oCJ

ect

low

resolu

tion

rH

cu01

cu01

-H£HCU

01 flO JJ>H O

•agJJ<H-Hjq010]

>a<n

ram

shifte

r

tr>oHG.

fc.

•OgpIH-H

W

C"

o-H-pPrH

001wH

g3

CU

CO

M0rH

OO

0 JJ•M 3

0.— 4J

0 O

rH C

43 CU— <D

!Hm orH 01

m cuO NrH -H0 rH

O <B-H

E?i5o o c

43

•oJ.,•o

0)cuMIH

K

gcu01rH43>

o

rlCUOQ

PC

JJ-H

t cart

ridge

OicuJJ

•*.fi COa0 0OJ JJ

tJ r.eg enO M

rH

H0)43gPC

JJ-HCQ

t cart

ridge

01cujj

«.c<a001

timo

COoQ

CUN-HrH

<a-H

incM

jjoo;§01Q

!>•

X01-rl

O

<HrH

0!

01

T)morH

IS

•a<3orH•og 0CJ IS

rl

O01

MpO

CUrH

43<3cM

ocux:0)

op<

cus<3C

rHrH

p1Z

0)gmcrH

rH

P

•Z

*•

csp^CM

•Q13rf!S

OU~

«3i O•31 QU") •*m CM«• =«=

FF

FA

Ol

EHPH

«.t—=8=

(3n

EHrHm•u>

oQ

inP£— 0r< Q•SP rsr CM

</> *#=

ft.EHrHm•t/>

CMCOPH -,EH mEH rt!

O EH —

1O CM - VO

O EH CM - CM -«qi EH 00 fv) (jQ o• g i p r ^ O ^ P E H ^ T r H ^ 1 p £ ) O O P 4 O O< n - « - Q r H E H C J O « - E H C O Q p H t — E H C M

v K ^ C M E H V O i n - C M C M - C M T C M C Oo o O r H i n P H P H ^ > r H o i n - y > r H i n e n m ^ pQ Q Q = S = < « - « > « > * = * Q « - = t 1 = = ( » : - u > « > < n - < ' >

CMVOCMin</>

omwCO«>

pq•31

enm</>

CJ

"*-"

QWCMm<o

oPH•*_<r

Q

CMm«/>

CJP-,*—f

(3J -K

Q r-CN (<iO -^> 1

w a)

rQ ,Q

• 43O P 0) •> co cr > a PO JJ CU O g rH

43 g 43 43 g O

43 43 1543 • • 43 •

- <u 0) • QM > > a. cu >rH O O g G OO g g O 43 g

CU CU> > H SH

crCD> IH 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- n g g 0 4 3 g g 4 3 4 3 4 3 - P 4 3 4 3 4 3 O ,a

r< VOVO VO(O COo oo oo o

CO CJQ QrH rHm mo oo o

EHPH

EHCM C—O OO OO Ocj enCO COO COrH O

O -spW Win mo oo o

0

CJ MW (4rH rHin ino oo o

CMOOOCJ CMCO OO QCQ VQ

CM VOrH rHrH rHm mo oo o

CMCO

O EHo o oo -a- CJCM ffl CO

PH PH

oooCOopq

EHPHEHEHW

CMCOPHPHEHFHenEHCOCO

000

CMinooo

o oEH mo oo o oo oo oen cj

ooCJ

pqEHCOCO

CM

O OQ Oo coO CMO CJO EHrH VOVO *3*

O O

VD «=PO COO CM

O OO O

VO

CMCO

oO O ^ P£)CM* O VO EHO O O VOo o co oo on co o oO P~ rH O OrH < I— rH rHVO "3* VO VO VO

en inen eno oo or- r~co co

r~ voco CM

r H r H C M C M C M C O C O C O C O C OCM CO KC CM VO .<

in m m in<h *^ v-/ i—i *—i VN v^i <. i (• t v 1 * \' t *' i >.' I ^p **r " " p ui ui ut uf. . . . . . 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 Mi 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 no 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

271

Page 279: Atari ST Internals

Abacus Software Atari ST Internals

no4-)<0O-H•aG

Motfo-H•a

0!

-H tj!H n CT3 01 -H

4 is01

01 gA P4-> G

1H 01 rHO > -H

-H 4J

er

3G

01

3 01n g tnTS <0 G

G -H0) 0> H4-> H 4J(0 -H 01rH >H

P 4->O G G 01rH -H 01

. . G > 1801 -O 01 01 O 4J O0)

g e(0 10G G

a)f t I ft O - 0 1 > r H r H

O T 3 O O O < G C P P!3 sC CJ CJ PQ - M W B B

g(0Mtr>0Mft•o(0orH

fc,

O01x:ta

HrH10O

OT0

WO

M014-1C

-HOft

XO(04->0!

1 100!

M0O

0)M01rH•o•a<a01ej><aft01ra(0X!

Eto

0)o001

W

oPn

W W W CM ~ VO CM

CMm m

U oCMin

+ w~ voO CMff, in

o oQ Q

O

—Q Qa wCM CM

I CQ

o m m m m

— uS- ^— Q

CM I HO - CMin o in

m

CMen

WII

EHO t<m PIJ

ofa «fa PJ

v Qo B

rH S•• O* o

01(0 r-l (0 t>!H 01 ai oX! X) -H g

ft 01g eo xi

01 01> >o o

• X!01

_ ft o -ag X) g <a

0! 0!> <o <o ra • >01 01 01 Oft ft ft g

ft • 01 01 01<S "O > > (0 >

"O O O 01 O

ft, VO CMW vo ovo o ino o o

Ci o < cjm o fa r~O rH rH CMVO VO *3* ro

O CM VO <VO VO VO VOCM CM CM CMm in in mo o o oo o o o

nCMOOO CMrH OO vo

W CMvo r~CM CMin mo oo o

ooooo

a\o -5P cyi•31 CM <! OCM rH VO rH

•31 vo co f=cc— r- r~ t—CM CM CM CMin in m in0 0 0 0o o o o 0

05

28

0 D

03

C0

04

1

0CO

rH

COCMm0o 0

05

28

6 4

87

90

00

00

50

200

528C

4

87

90

00

05

2E

D0

05

29

2

48

7A

00

59

00

52

96

3F

3C

00

05

0052

9A

3F3C

004B

CMmoo

£ 4 - > i 0 5 g f t g f t g e

COoooH CMfa o•=p ino o

M o o in "31 PQO O O CO O -3"o o o o o oo o o o o oC J O C ^ C f l c O < O C Jf a ^ * [ — r ~ ~ o t — c o r o

01 01 ft • X! X! X)> > (0 T! ft • • •

O l O O M t J g O O O

O rHCM CM

-n TS * 3 "O

CMmomwCM

(M OO

o a fam ro faM O CO Oo oo oo o

CO fa CO fa faCM "3* CO CO

oo

m in- <* <H «Cfa fa "31 CO

coQ

Om CM

vo W CM -3> COPQ O CJ O

. . -' VO . . .f S r t r i l C Q p q p c i p q o c j O O Q Q

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

272

Page 280: Atari ST Internals

0052E4 4700

0052E6 47454D2E505247

dc.b

'GEM.PRG'

0052ED 000000

dc.b

0,0,0

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

0052FO 7003

0052F2 610A

0052F4 20790000047A

0052FA 4E90

0052FC 4E75

moveq.l #3,DO

bsr

$52FE

move.l $47A,AO

jsr

(AO)

rts

Dskboot, boot from disk

Bit number 3

Test cartridge

Hdv boot, load boot vector

And start attempt

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

N>-J

0052FE 41F900FAOOOO

005304 OC98ABCDEF42

00530A 661A

00530C 01280004

005310 670E

005312 48E7FFFE

005316 20680004

00531A 4E90

00531C 4CDF7FFF

005320 4A90

005322 2050

005324 66E6

005326 4E75

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

lea

$FAOOOO,AO

cmp.l

#$ABCDEF42,(A0)+

bne

$5326

btst

DO,4(AO)

beq

$5320

movem.l DO-D7/AO-A6,-(A7)

move.l

4(AO),AO

jsr

(AO)movem.l (A7)+,DO-D7/AO-A6

tst.l

(AO)

move.l

(AO),AO

bne

$530C

rts

Test cartridge

Cartbase

User cartridge inserted ?

NoInitialization ?

NoSave registers

Address of the init routine

Perform initialization

Restore registers

Additional application in cartridge ?

Get link address

Initialization next application

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

005328 4E75

rts

Default vector

****************************************************00532A D1C1

add.l

D1,AO

Memory test

Add offset to base address

ato

Page 281: Atari ST Internals

00532C 4240

00532E 43E801F8

005332 B058

005334 6608

005336 D07CFA54

00533A B3C8

00533C 66F4

00533E 4ED5

clr.w

lea

cmp.w

bne

add.w

cmp.l

bne

jmp

DO$1F8(AO),

(AO)+,DO

$533E

#$FA54,DO

AO,A1

$5332

(A5)

Clear test pattern

End address of the test

Test memory contents

Unequal,' terminate

Create next test pattern

End address reached ?

No, continue test

Back to the calling address

COrsen

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

005340 9BCD

005342 OCAD752019F30420

00534A 6608

00534C OCAD237698AA043A

005354 4ED6

sub.l

A5,A5

cmp.l

#1965038067,$420(A5) Memvalid

bne

$5354

cmp.l

#594974890,$43A(A5)

Memval2

jmp

(A6)

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

005356 00000000

00535A 00000000

00535E 00000000

005362 00000000

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

005366 1839FFFF8260

00536C C87C0003

005370 D844

005372 B1FC00008000

005378 6220

00537A B1FCOOOOOOOO

005380 6604

005382 307B4086

005386 4280

move.b

$FFFF8260,D4

and.w

#3,D4

add.w

D4,D4

cmp.l

#$8000,AO

bhi

$539Acmp.l

#0,AO

bne

$5386

move.w $530A(PC,D4.w) ,AO

clr.l

DO

Shiftmd, Get video resolution

Isolate bits 0 and 1

Double value for word table

ICMHI—ta**•1taSP

Page 282: Atari ST Internals

N>

005388 1039FFFF8201

00538E E148

005390 1039FFFF8203

005396 E188

005398 D1CO

00539A 7EOF

00539C 3C3B4078

0053AO 3605

0053A2 2448

0053A4 D4FB406A

0053A8 1011

0053AA 4BFA0004

0053AE 6042

0053BO 3202

0053B2 10290001

0053B6 4BFA0004

0053BA 6036

0053BC 3011

0053BE 4EFB4002

0053C2 6004

0053C4 600C

0053C6 6014

move . b

Isl.wmove

. b

lsl.1add.lmoveq

. 1

move . w

move . w

move . 1

add.wmove

. b

leabra

move . w

move . b

leabra

move . w

jmpbra

bra

bra

$FFFF8201,DO

#8, DO

$FFFF8203,DO

#8, DO

DO,AO

#15,07

$5416(PC,D4.w) ,D6

D5,D3

AO,A2

$5410(PC,D4.w),A2

(A1),DO

$53BO(PC),A5

$53F2

D2,D1

1(A1),DO

$53BC(PC),A5

$53F2

(A1),DO

$53C2(PC,D4.w)

$53C8

$5302

$53DC

Dbaseh

Dbasel

Low resolution

Medium resolution

High resolution

geno

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

0053C8 30CO

move.w

DO,(A0)+

0053CA 30CO

move.w DO,(A0)+

0053CC 30CO

move.w

DO,(A0)+

0053CE 30CO

move.w

DO,(A0)+

0053DO 600E

bra

$53EO

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

0053D2 30C1

move.w

D1,(AO)+

Low resolution

Medium resolution

cnH5.

Page 283: Atari ST Internals

Abacus Software Atari ST Internals

o

- —

rHQ

&

mo

ve.

rHCJO(0

^pQcomoo

o«;

CMQ

IS

mo

ve.

CMo0CO

voQcoinoo

o

"

CMQ

15

mo

ve.

CMCJOCO

COQ

COin0o

0

n")m

mM

sr0ovo

<JQCOinoo

co-H

3

0ra

Cn-H

•X

*

*•X

**-X****

•X•X.£

•X

1•X•X•X•X

*-X.£

-X-X

*-X•X•X-X•X•X-X•X

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

*•X

0

—rHQ

3

mo

ve,

rHo0CO

oQCOmoo

o

CMQ

&

mo

ve.

CMCJoCO

EdQcom0o

CO

<COin

COQ

cd

43•o

voCJptjPT-|

03O

moEdCOinoo

o

CM

rH

mo

ve.

<j•=poCM

•3*EdCOin0o

0

COm

VOQ

1

COm[V|

CM

WCJ

mvoEdCOm0o

f— )

<CM

*

£5

-81•acd

c^^p•rjl

in

EdCOmo0

oCOin

,-.a

M

Ed(=£fafafaO

in

oEdCOm0o

— '

•n

VO

QEd

OfaCOinoo

co

COQ

rH

move

.

COspvoCM

CMfaCOm0o

CMQ

O3t=

rH

*r!

mov

ec

00•31r--

qi

faCOm0o

COQ

r~=*£

rH

>-<H

mov

ec

r-0vot—vofa(Oinoo

oQ

rH=H=

43

rH

O

0rH

COEd

COfaCOin0o

rH1H

Hca0

§CO

1

PSw

f

mo

ve.

r-Ed0•a1

<CfaCOin0o

CMQ

rH

*

ai-HXO

CMIOcoEd

CJfaCOm0o

,SR

Re

sto

re

ca

rry fla

g

+

<

*

mo

ve.

faQVOirr.

tdfaCOin0o

CMD,_|

=«=

*

0S-t

CMincoEd

oo•3*moo

CO

COin

COQ

10

1

^31

P»4

fafaffiO

m

CM0^F

in0o

COQ

corij

rH

0

03ovoCM

VOo^m0o

rHrH10O

o4-1

O10

in•— •

t•n

mQ

sp

CO0•=?m0o

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

-X

*

****•X

*•X-X•X

***•X•X

**•X

*•X-X-X-X•X

*-X

***•X-X

*•X•X•X

*-X-X

CM

f-vorH

0•o

COoCO

o^pin0o

CMt—vorH

0•o

COCJEdCO

CJ0spm0o

voCOo

rH

IS

o•o

^pEdCO

Edospmoo

o

vorH

s0-a

o'-Coo

orHSP

in0o

0

vorH

S

o•o

o

oo

CMrHSP

m0o

276

Page 284: Atari ST Internals

Abacus Software Atari ST Internals

oCO O O O

S S S S0 0 0 0

TS TS TS TS

O O O rHin o o oo o o oo o o o

•31 V£< CO ff.rH rH rH rHSP "a1 "a1 *3*in in in ino o o oo o o o

CD•p4-1<arH

<aP.rl

orHOo

•it•it

***•it•u•it

•it

**•it

*-iC•it•it-it

*-it

•it•it

•it•it

**•it•it•it

*-it

**•it

•it-it

**•it

***•Jc

*-it•it•it

*

0)

-Hjg*

S

r-r-r-ift-

S

0TS

t—r-r^o

UrH^P

mo0

TSCO

oor~</>

IS

0TS

Oo[o

HrH

^pm0o

GCDCD

O

O[ —O•c/>

S

OTS

Or~oo

oCMTinoo

u0rHrHCD

Or-r—</>

S

0•o

or~r—o

CMCM•=3*moo

CD3rH

m

r-0o-u>

S

0TS

[ —OOoSJICM^tmoo

a; i

BCDCT>

S

c^0r-in

S

OTS

[ —Or—ovoCMSTinoo

c:CDCDM&1

P

«

t—r-o</>

S, o.

TS

E —r-oo

COCM

moo

>^CD

tJ>

^jc**O^-HrP

inmin

S.:. 0 ,-

TS

inmmo(3j

CM•a*moo

TS(U

-P

CD O>H -H

co coro coCO t —</> </>

S S0 O

TS TS

CO COCO COco r-o o

O MCM CM•a1 <3*m m0 0o o

GCDCDSHcn4Jr-;tP-H

cor-co</>

S

OTS

CO

COo

oCO

m0o

SOrH

CD>!

4J

tyi-r)

COf^r-<*>

S0

TS

CO

[ —0

CMCO

tnoo

CDprH

4->

23*•r)r^

[—COco-c/>

3

0TS

1—co

0

^pCO^pmoo

(04->GCDO>cag4->

O1-H

r-COi—t/>

S

OTS

r-

[ —0

voco

ino0

CDCDSH&tCD3rH,Q

4J

571-H

^

[

r-ro•u>-

so

TS

r~r^

CO0

COco•a1inoo

yOC{3rH

^

O001ft

so

TS

Oooo<JCO•a1moo

_ o o<^ Q Q

— OCM Q

—X O

I r~ oo +o —

•. rt; r* <a* co c^o *— <f> in -u> <;Q CM *«•=»= —

O Os s

0)> CDO 4JS n

CM OO Oo r-o o

O fn O «>O CM C~ O

no oCO O

CMOOOooCOo

O CO

CJ W CM «> CO W O

in in in in m m mo o o o o o oo o o o o o o

277

Page 285: Atari ST Internals

Abacus Software Atari ST Internals

4-1O.3MM0)4-1C

-H

Jpa

-X•X***•X•X*-X•X**•X**-X***

-X

*

*•X

•X

*-X•X

*-X

-X-X•x•X-X•X

*-X•X-X**

0000

0466

ad

dq

.l

#1

,$4

66

Incr

emen

t fr

clo

ck

tnpaCMLO

CMLO* T*LOOo

0000

0452

su

bq

.w

#1

,$4

52

Vbl

sem

en

COLO

COLO^pLOOo

OODC

bm

i $5

53C

V

BL

in

terr

up

t d

isab

led

?

oopavo

wLO^pmoo

FFFE

m

ovem

.l

DO

-D7/

AO

-A6, -

(A

7)

Sav

e re

gis

ters

r~EdCO•=r

CMVO•C1

LOOo

0000

0462

ad

dq

.l

#1

,$4

62

Incr

emen

t v

bclo

ck

erh

\he

n

enpaCMmVOvo1 1

LOoo

LO

(0CDrHCJ

in

in

43*pCO

QOen

CJvo^pLOOo

FF

FF

8260

m

ov

e.b

$FF

FF

8260

,DO

L

oad

shif

tmd

0003

a

nd

.b

#3

, DO

0002

cm

p.b

#

2, D

O H

igh

reso

luti

on

?

bge

$548

E

Yes

0007

FF

FF

FA

01

bts

t #7

,$F

FF

FF

A01

M

fp

gp

ip,

mon

ochr

ome

dete

ct

bn

e $5

4B4

No

co

lor

mo

nit

or

0002

m

ov

e.b

#2

, DO

Hig

h re

solu

tio

nb

ra

$54A

400

07F

FF

FF

A01

b

tst

#7,$

FF

FF

FA

01

Mfp

g

pip

, m

onoc

hrom

e d

ete

ct

beq

$54B

4 M

onoc

hrom

e m

on

ito

r ?

044A

m

ov

e.b

$44A

(A5)

,DO

D

efsh

iftm

d,

get

co

lor

reso

luti

on

0002

cm

p.b

#2, D

O

Mon

ochr

ome

?bit

$5

4A4

No

clr

.b

DO

E

lse

low

re

solu

tio

n04

4C

mo

ve.

b D

O,$

44C

(A5)

S

ave

ssh

iftm

dF

FF

F82

60

mo

ve.

b D

O,$

FF

FF

8260

S

hif

tmd

, p

rog

ram

sh

ifte

r04

6E

mo

ve.

l $4

6E(A

5),A

O

Vecto

r fo

r re

solu

tio

n

chan

ge

jsr

(A

O)

Ex

ecu

te

rou

tin

e3B

42

bsr

$8

FF8

Fla

sh c

urs

or

sub

.l

A5,

A5

Cle

ar A

5

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 QC 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 JO 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 ar 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

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 Ov 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*=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 Oo 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

045A

ts

t.l

$45A

(A5)

C

olo

rptr

, re

load

co

lor

pale

tte

?

Q

3<fflLOo0

o

COQmvt

tr0!43

COrH

vo

HmLO0o

045A

m

ov

e.l

$45A

(A5)

,AO

C

olo

rptr

, ad

dre

ss

of

the

new

pale

tte

FF

FF

8240

le

a $F

FF

F82

40,A

1 C

olo

rO,

ad

dre

ss

in

the

vid

eo

sh

ifte

rOO

OF

mov

e.w

#$

F,D

O

16 co

lors

QVOOCM

0U

IOoo

en cjfa COCO OSP CO

•a1 <CJ O

LO LO0 00 0

278

Page 286: Atari ST Internals

Abacus Software Atari ST Internals

MOHOCJ

> -pa KO CDCJ 13

C-H(0cn(0

M4-)a,!H0rH

OuH<0<1)rH

CJ

, n

ew

vid

eo

a

dd

res

s ?

4Jac(U01

o oCO S3

•o(0

01

43>

Q.4J

4->acCDCDM0 T303 fd

>1 01QH> ,QO

CJ >

01cu

-H4->

01 p(U O M O )

-H M CU Pa -p 01(X 1-3 C Po m p crrH > O rH

4-1 0 43<H >

M O <oO M O )m M 43 .£

0) P. "0 4J0) 43

T C £ 01 O 4-1 !Hm r H C M J S - H 3 ! H 4 - l O OrH 0) 1 CD 4-1 G O 4-J

1 0} VO 01 3 4 J 4 J 0 1 OC O I O r H < O O - . U M O I C U

43 43 M 01 CU CD <D >0 1 T 3 0 1 T 3 rH > > >-l

4-1 4-> i-3 43 C T) 4->- H O - r ) O m > O O T 3 C U( D E H f f l E H > 3 , 3 C J f < U

ec

ute

ro

uti

ne

xcu

C*i4-1

0 -

CD ON Q

iste

rs

er>cuM

CD

(0

rou

tin

ere

gis

ters

CD (U•P ^H3 00 4-1CD 01X CDW PS

t v

ec

tor

x mCU t<G

4-1 <fl01 CDCD rHEH CJ

ha

rdc

op

y

de

sir

ed

?

«-.tr>rH

1-1ft.ej3

Q

G-r)

(0

10

Cr>rH

>i pP. -0OO >H•C 10M CD

O H) rH

a cs cj

reg

iste

rsre

sto

re

VB

L a

gain

0) -M EO CD4J 0101 rH

CU 43

VO

o

-t-

rH

H-

o

SCD

O

CODCMm

wCJ"31

inoo

wCJ

m

oQ

M

CJ

fafaCO

OrHmoQ•vPinoo

in

in

rH

rHU

<Jm^poQ|C£

CM•5P

<=rQ*3<moo

m

wm«•

rH

4-1ol4-1

Wm•=r0QrS£<;•3*

COQr

10oo

COfamm

g,

0143

rHr-vo

CJo•a*moo

.1

$4

5E

(A5

),$

4'

cuo

H•a1^owm^poQVO

mCM

HQ•31

moo

oQ

m— oW Q

r CO

rH

> HO 01S rH

[V]

•vP*J*OQ COCM -3*O OCM P4

•=P CO

M PJ•gl ^pin ino oo o

oCMCO

fa

Oo

CD

O

o0CMCOfafa[V,

fa0orH

<w^pmoo

oaCO3t=

£

01rH

CO^31owofar

moo

0CMCO

fafa

oQ

43

>0

rH0CMCOfafafa0o"-*CMfa•=rmoo

VO

j_,

43

,e£

HrH<HOOrHVO

CO

famoo

Q

in

S

io5

^rm«SJ1

000ooenmPJo

CJ

KPm0o

CMmm

trcu43

0CMr-VO

CMOininoo

r~OrH

*

rH

sp01

r~COC )in•0min0o

.1

$4

56

, AO

>o

VOmspoo0ooent —0CM

VOOinmo0

rH

O

CU

0

CO

mCMCM

CJ0in100o

rH

O

rH

ci,eo

ooo0o0ooCJ

nCQwomino0

oCMininTO-

O1cu43

Or-vo

•a*rHin\no0

t~-

i

0

Q

rH

s"CU

0

OCOrHOff£)

CO•a-VOrHmmo0

rH

0)-r-1

rHcniy^p<crHmino0

o

-V

Q

c-

H

0)

0

oCOrHOfaQCJ•=P

CJrHmino0

CJ0inmmr-Q

2€

<cwfafafaorHinoCMminoo

m

a

43'p01

QO03en

<^pCMmmoo

m

wH

^01

4-1

Wf£J^31

OQVOrfl•0-

VO

CMminoo

COnminin

cu

CJ0VOVO

pj;

CMin

oo

oVO

<m

j_,0]

43

CM

in000rHVO

CJCMinin0o

H

in-fafafafa

SCD

O

nq

o0ooofafafafaofannonininoo

Q10Q

r~

rH

e01

o

fafafar-faQCJ

COCOinm0o

CMin

rH

cr•a•am

CMLO"STO00oocnr-CMinuininoo

CD4-1SH

ro

W•=r

CM•sPinmoo

279

Page 287: Atari ST Internals

**********

005544 40E7

005546 027CF8FF

00554A 203900000466

005550 BOB900000466

005556 67F8

005558 46DF

00555A 4E75

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

move.w

SR, -(A7)

and.wmove .

1cmp.lbeqmove .

wrts

#$F8FF,SR

$466,00

$466,00

$5550

(A7)+,SR

Wvbl, wait for next V-sync

Save statusIPL

0, allow

interruptsLoad

frclockFrclockStill

equal ?Restore

status

MOeXeno

****************************************************00555C 2F3900000404

005562 70FP

005564 4E75

move.l $404,-(A7)

moveq.l #-l,DO

rts

Critical error handler

Etv critic

****************************************************005566 41FA0084

00556A 6004

leabra

$55EC(PC),AO

$5570

TRAP #14

Address of the

TRAP #14

routines

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

00556C 41FA004C

005570 2279000004A2

005576 301F

005578 3300

00557A 231F

00557C 48E11F1F

005580 23C9000004A2

005586 08000000

00558A 6602

00558C 4E6F

00558E 301F

005590 B058

005592 6C10

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

lea $55BA(PC),AO

move.l $4A2,A1

move.w (A7)+,DO

move.w DO,-(A1)

move.l (A7)+,-(Al)

movem.l D3-D7/A3-A7,-(Al>

move.l A1,$4A2

btst #13,00

bne

$558Emove.l

USP,A7move.w

(A7)+,DOcmp.w

(AO)+,DO

bge

$55A4

TRAP #13

Address of the TRAP

#13 routines

Savptr, pointer to

save

areaStatus

register to DO

Save in

save areaSave

PCAnd

save C register

Update savptr

Call from

supervisor mode ?

YesElse

use USP

Get function number

from stack

Compare with maximal

numberToo

large, stop

$(/>H655?

Page 288: Atari ST Internals

Abacus Software Atari ST Internals

>n

ve

rt

num

ber

ot

long

co

un

ter

v>

o

oo

CM=tt=

si — !01rH

COJ1

LOW

rcnLO

LOO0

it

ad

dre

ss

of

the ro

utine

wCJ

oQ

"?

OQ

O

o

rH

<L>

Og

ooooorooCM

VOenLOLOoo

) A

O.t

31

cle

are

d ?

v ^nE-< pq

o o

- LOO LOO -to-

rnCD

o &.S ,Q

O CMr o

O <!CM VO

< 0cn cnLO LO

LO LOo o0 0

ise

use

a

dd

ress

indirectly

w

ort

o

(U

og

oLOoCM

W

LOLOO0

M<B

' — 1O

LO

rH

301

QOPQcn

o<CLO

LOOo

ce

cu

te ro

utine

r*

o

rH01

oen(4•31

CMf£LO

LOOo

rH4-1

01

4-1QJU

CM

0)

og

CMf£t«3*OO0oocnr^CMCM

«=rf£LOLOOo

ssto

re re

gis

ters

M*

r—

1CO

Q1

roQ

rH

g

r*O

COfr.CO(V,

cnQU

££>

LO

LO0o

0

01

co

On

r-

i

CDog

cnrHfT,

CM

W

LOLOOo

X0<u01

GO

3

ra

tn

r—

rH

CD

Og

cnrHCnCO

OmLOLOOO

sdate

savptr

M-i

ED

CM

rH

rH

Q)

O

CMrt^•giooo00Ot(_)nCM

CMpqLOLO0o

rH

oo4-1

om

CD4-1rH

COr-wr

COcaLOLO0o

rHrH

10O

rH=*=

CM

EH

01

-P

O

010!01010)tH•oT<

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

Ac

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

imber

of

rou

tin

es

•z.

CMrH

9O•o

o0oofQ

pqLOto0o

, getm

pb

0

MCMr-LO

rH

O•a

HCM[LO00oo

UPQLO

LO0o

, b

co

nsta

t

rH

voLO

rH

O•a

*3*cnvoLOoooooOLOLOO0

, bconin

CM

cnvoLO

rH

O•a

fQcnvotooooo^1U10LOO0

, bconout

CO

vo

voLO

rH

O•a

vo<JvoLO00oo

COCJLOLO00

, (i

nd

ire

ct)

rw

ab

s

ooooo00CO

H-vo

rH

O•a

vo[ —"31

0oooCO

CJoLOLOoo

, se

texe

c

LO

LOr-LO

rH

O•o

f£,LO

[ —LOOooooQLOLOO0

, tickca

l

vo

CM

r-LO

rH

O•a

CMr-~r~

LOOOoo•31

QLOLOO0

, (indirect)

getb

pb

$4

72

+$

80

00

00

00

7,

rH

O•a

CMr^^1

OoooCO

COQLOLOOo

, b

co

sta

t

CO

ovoLO

rH

o•a

orijvoLOoooo

CJQLOtooo

, (indirect)

m

edia

ch

o00ooooCO

H

rH

o•a

L-qt —i

0oooCO

oHLOLOOo

3 , d

rvm

ap

rH

VOrH

LO

rH

O•a

vorH1—too000

•HLOLOO0

4-1

-H

01

rH

CJrHr-LO

rH

o

CJrHr-LOOooo

CO

lOLOOo

281

Page 289: Atari ST Internals

00NJ

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

0055EC 0028

0055EE 00007ACO

0055F2 00005328

0055F6 0000577A

0055FA 0000578E

0055FE 00005794

005602 000057AO

005606 000057EE

00560A 000057F6

00560E 000062D2

005612 000063BO

005616 00006468

00561A 00005B64

00561E 00006B74

005622 00007138

005626 00007440

00562A 00007468

00562E 00007BC6

005632 00006062

005636 0000614A

00563A 00006602

00563E 00005A4E

005642 00009024

005646 00006AAA

00564A 00006A90

00564E 00007BF2

005652 00006CE6

005656 00007162

00565A 0000719C

00565E 00007A30

005662 00007A9A

dc.w

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

dc.l

40$7ACO

$5328

$577A

$578E

$5794

$57AO

$57EE

$57F6

$6202

$63BO

$6468

$5B64

$6B74

$7138

$7440

$7468

$7BC6

$6062

$614A

$6602

$5A4E

$9024

$6AAA

$6A90

$7BF2

$6CE6

$7162

$719C

$7A30

$7A9A

Addresses of the TRAP #14 calls

Number of routines

0, initmouse

1, rts

2, physbase

3, logbase

4, getrez

5, setscreen

6, setpalette

7, setcolor

8, floprd

9, flopwr

10, flopfmt

11, getdsb

12, midiws

13, mfpint

14, iorec

15, rsconf

16, keytrans

17, rand

18, protobt

19, flopver

20, dumpit

21, cursconf

22, settime

23, gettime

24, bioskeys

25, ikbdws

26, jdisint

27, jenabint

28, giaccess

29, offgibit

iff

965sr

Page 290: Atari ST Internals

005666 00007A74

00566A 00007B8A

00566E 00007COC

005672 00007C20

005676 00007C54

00567A 00007C32

00567E 00007D92

005682 00005544

005686 0000568E

00568A 0000581C

dc.ldc.ldc.ldc.ldc.ldc.ldc.ldc.ldc.ldc.l

$7A74$7B8A$7COC$7C20

$7C54

$7C32

$7092

$5544

$568E

$581C

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

00568E 206F0004

005692 4EDO

move . 1

jmp4(A7),AO

(AO)

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

00

005694 41FA0020

W

005698 6010

leabra

$56B6(PC),AO

$56AA

30, ongibit

31, xbtimer

32, dosound

33, setprt

34, ikbdvecs

35, kbrate

36, prtblk

37, wvbl

38, supexec

39, puntaes

supexec, routine in supervisor mode

Get address from stack

Execute routine in supervisor mode

bconstat, get input statis

Status table

>I

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

00569A 41FA0032

lea

$56CE(PC),AO

00569E 600A

bra

$56AA

bconin, input

Input table

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

0056AO 41FA0044

lea

$56E6(PC),AO

0056A4 6004

bra

$56AA

bcostat, get output status

Status table

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

0056A6 41FA0056

lea

$56FE(PC),AO

bconout, output

Page 291: Atari ST Internals

****************************************************0056AA 302F0004

0056AE E548

0056BO 20700000

0056B4 4EDO

move.w

4(A7),DO

Isl.w

#2,DO

move.l

0(AO,DO.w),AO

jmp

(AO)

Conout

Get device number

Times 4

Get

ad

dre

ss o

f th

e ro

utin

eE

xecu

te ro

utin

e

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

0056B6 00005328

0056BA 00006C70

0056BE 00006CFA

0056C2 00006B88

0056C6 00005328

dc.l

dc.l

dc.ldc.l

dc.l

$5328

$6C70$6CFA

$6B88

$5328

0056CA 00005328

dc.l

$5328

0056CE 00006C3C

dc.l

$6C3C

0056D2 00006C86

0056D6 00006D10

0056DA 00006BA4

0056DE 00005328

0056E2 00005328

dc.l

dc.l

dc.ldc.l

dc.l

$6C86

$6010

$6BA4

$5328

$5328

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

0056E6 00006C5C

0056EA 00006C96

0056EE 00006D46

0056F2 00006CBA

0056F6 00006B48

0056FA 00005328

dc.l

dc.l

dc.ldc.l

dc.ldc.l

$6C5C

$6C96

$6046

$6CBA

$6848

$5328

Input statis

RtsRS 232 status

Console status

MIDI status

RTS

RTS

Input

Parallel port

RS 232 input

Console input

MIDI input

RTS

RTS

Output status

Centronics status

RS 232 status

Console status

Keyboard status

MIDI status

rts

ergCO

STCOHI—

I

aro363sr

Page 292: Atari ST Internals

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

0056FE 00006BD4

005702 00006CAE

005706 00008ADE

00570A 00006B5A

00570E 00006CCC

005712 00008AD2

dc.l

dc.ldc.ldc.ldc.ldc.l

$6BD4$6CAE$8ADE

$6B5A

$6CCC

$8AD2

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

005716 202D04C2

00571A 4E75

move.l $4C2(A5),DO

rts

OutputCentronics

outputRS 232

outputConsole

output

MIDI output

Keyboard output

ASCII outout

Drvmap, get

active

floppies

Drvbits, get

bit vector

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

00571C 7000

moveq.l #0,DO

00571E 102DOA5D

move.b

$A5D(A5),DO

005722 322F0004

005726 6B04

005728 1B410A5D

00572C 4E75

move . w

bmi

move . b

rts

4(A7),D1$572CD1,$A5D(A5)

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

00572E 206F0004

005732 43ED048E

005736 2089

005738 42A80004

00573C 21490008

005740 4291

005742 236D04320004

005748 202D0436

00574C 90AD0432

005750 23400008

005754 42A9000C

move . 1

leamove

. 1

clr.lmove

. 1

clr.lmove

. 1

move . 1

sub.lmove . 1

clr.l

4(A7),AO

$48E(A5),A1

Al, (AO)

4(AO)

A1,8(AO)

(Al)$432(A5),4(A1)

$436{A5),DO

$432(A5),DO

DO,8(A1)

12 (Al)

Shift, keyboard

status

Kshift, get

shift

status

Get parameters

from

stackNegative,

then

set

Accept as kbshift

Getmpb, Memory

Parameter

Block

New MPB

Themd, Memory descriptor

Mp mfl = address

of the

MDMp mal

= zero

Mp rover

= address

of the

MD

Clear m link

Membot as mstart

MemtopMinus

membotLength

as m length

M own

= zero

CAH»Hanasa

Page 293: Atari ST Internals

Abacus Software Atari ST Internals

W4-1

mt —W•31

COmt—mo0

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

Se

texc,

se

t e

xce

ptio

n ve

cto

r

*******-X•X

*•X

***-X

*-X

*•X-X-X

****-X-X-X

*-X•X

M0)

pc

o

0)

4->0)U

0Q

p-

0)

og

•31

OOofaCMOCO

ri)mr-moo

01VI0)

•o-o(0

rH

(0

cr(U

010)

-HEH

oQ

CM

13

rH

05rH

00^FinWWinr-mo0

o

rl

(0

rH

U

o

o

rH

^QP

O)

CO

oen

0VQ

f —inoo

0(A

O,D

O.w

) ,A

O

Ge

t a

dd

ress

of

the

o

ld

ve

cto

r

ra0)rH

OoooofarH

*r

CM10t—IT)O0

OQ

O4-1

O4-1O(!)

•arH

0

oQ

0

51

0)r*0g

orH0CM

IOVQp-

m0o

M0

0)

s<Da

rHQ

10

rH

0)

Og

100oofaCMCMCM

COIOr-mo0

4J0)CO

0•o

(U

0)

-r)

4-1idCn

&

op-r-m

-r)

g

43

CMOCQVQ

Uvor-in0o

o

oa)

4-10)W

0

rH

Q

rH

0)

Og

rH

CO

0CM

avop-m0o

0}

4-1

inP-w

or~p-m0o

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

Tic

kcal,

tim

er

valu

e in

m

illis

econds

•X

***•X*•X

***•X

*****-X

**•X

*•X*•X**•X

**-X•X

0Q

rH

£_l

rH

U

OCOCM^31

CMr-t-m0o

g

g-rl

4-1

0Q

m

CM

&

<t>0g

CM"31

^3*OQCMOCO

•5J1

p-[—mo0

01

4J

inP-w

COp-p~

inoo

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

Ph

ysb

ase

, physic

al

vid

eo

a

dd

ress

•X

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

*-X

***•X•X•X

^c

**•X

*****

oQ

0

*rH

er0)

0g

0oop-fQp-( —ino0

e.b

$

FF

FF

82

01

,DO

D

base

h

og

rHOCMCOfafafafaa\o

orH

O

t—p-moo

oQ

CO

1 — j

tarH

CO

rH[y]

CMCOr-10oo

e.b

$

FF

FF

82

03

,DO

D

basel

0g

COoCMCOfafafafaCf>COorH

^TCO

( —mo0

0Q

q-H

M

(USn•o•o(0

o•8-H

OQ

CO

i-Httir-H

COCOrHW

COp*

in0o

tn4-1t-t

inr-W

CJCOp~

mo0

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

Logbase,

logic

al

vid

eo

a

dd

ress

•X•X

*•X*•X-X

*-X

**-X•X

**•X-X•X•X

*-X•X-X•X

*•X

*-X•X•X

*

•o<0

a>

4-10)U

oQ

in

W

rH

(1)os

E=3•3*•31

oQCNOCM

WCO

moo

014-1H

inP*3*3<

CMcnr^in0o

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

Ge

tre

z,

ge

t vid

eo re

solu

tion

•X

*•X***•X

******-X£

***-X•X•X•X•X

^c

**•X-X

*•X*

oQ

o=tt=

rH

O101os

ooo

«jien

mo0

286

Page 294: Atari ST Internals

oo-J

005796 102D8260

00579A C03C0003

00579E 4E75

move.b

and.b

rts

$FFFF8260(A5),DO

#$3,DO

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

0057AO 4AAF0004

tst.l

0057A4 6B06

bmi

0057A6 2B6F0004044E

move.l

0057AC 4AAF0008

tst.l

0057BO 6B10

bmi

0057B2 13EF0009FFFF8201

move.b

0057BA 13EFOOOAFFFF8203

move.b

0057C2 4A6FOOOC

tst.w

0057C6 6B24

bmi

0057C8 1B6FOOOD044C

move.b

0057CE 6100FD74

bsr

0057D2 13ED044CFFFF8260

move.b

0057DA 426D0452

clr.w

0057DE 4EB90000F6C4

jsr

0057E4 33FC000100000452

move.w

0057EC 4E75

rts

4(A7)

$57AC

4(A7),$44E(A5)

8(A7)

$57C2

9(A7),$FFFF8201

10(A7),$FFFF8203

12(A7)

$57EC

13(A7),$44C(A5)

$5544

$44C(A5),$FFFF8260

$452(A5)

$F6C4

#1,$452

Load shiftmd

Isolate bits 0 and 1

Setscreen, set screen address

Logical address

Negatice, don't set

Set v bs ad

Physical address

Negative, don't set

Dbaseh

Dbasel

Video resolution

Negative, don't set

Sshiftmd

Wvbl, wait for VBL

Sshiftmd to shiftmd

Vblsem, VBL disabled

Initialize screen output

Vblsem, permit VBL again

69r»enCflOIrt

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

0057EE 2B6F0004045A

move.l 4 (A7)

, $45A

(A5)0057F4

4E75

rts

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

0057F6 322F0004

move.w

4(A7),D1

0057FA D241

add.w D1,D1

0057FC C27C001F

and.w

#$1F,D1

005800 41F9FFFF8240

lea

$FFFF8240,AO

00580630301000

move.w

0(AO,Dl.w),DO

Setpalette, load new color palette

Set colorptr (execution in VBL)

Setcolor, set single color

Color number

Times 2

Limit to valid number

Address colorO

Get old color

j>«1

Page 295: Atari ST Internals

00580A C07C0777

00580E 4A6F0006

005812 6B06

005814 31AF00061000

00581A 4E75

and.w

#$777,DO

tst.w 6(A7)

bird $581A

move.w

6(A7),0(AO,Dl.w)

rts

Clear irrelevant bits

Test new color value

Negative, dont set

Set new color

Cft

O

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

00581C 207AF7F6

005820 OC9087654321

005826 660E

005828 B1F90000042E

00582E 6C06

005830 4290

005832 6000F7EA

005836 4E75

move.l $5014(PC),AO

cmp.l

#$87654321, (AO)

bne

$5836

cmp.l

$42E,AO

bge

$5836

clr.l (AO)

bra

$501E

rts

toQQ

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

°°

005838 6102

bsr

$583C

00583A

00583C

005842

00584A

00584C

005852

005856

00585C

00585E

005860

005864

00586E

005870

005876

4E7123DF000003C4

48F9FFFF00000384

4E68

23C8000003C8

303COOOF

41F9000003CC

224F

30D9

51C8FFFC

23FC1234567800000380

7200

1239000003C4

5341

nopmove . 1

movem . 1

move . 1

move . 1

move . w

leamove . 1

move . w

dbramove . 1

moveq . 1

move . b

subq.w

(A7)+,$3C4

DO-D7/AO-A7

USP,AO

AO,$3C8

#$F,DO

$3CC,AO

A7,A1

(Al)+, (A0)+

DO,$585E

#$12345678,

#0,D1

$3C4,D1

#1,D1

,$384

$380

Puntaes, clear AES and restart

os magic

Already there ?

No, done

In ROM ?

Yes, do nothing

Clear magic

To reset

Term, interrupt running program

PC on stack

Save PC including vector number

Save registers

USP

Save

16 words

Save area

Get SP to AlSave word from stack

Next word

Magic

for

sav

ed re

gis

ters

Get

vecto

r num

ber to

D

lC

onvert

in

db

ra

co

un

ter

enHBto

Page 296: Atari ST Internals

Abacus Software Atari ST Internals

$5

89

0 O

utp

ut

ap

pro

pri

ate

#

of

'mu

shro

om

s'.1

#

$5

FC

,$4

A2

Res

et

sav

ptr

fo

r B

IOS

8 61

16

bsr

A

23

FC

00

00

05

FC

00

00

04

A2

mo

ve.

r- r-CO COin m0 0o o

,w

#1

,-(A

7)

Re

turn

co

de

for

err

or

L -(

A7

) T

erm

inate

p

rocess

4 3

F3

C0

00

1 m

ov

e.8

42A

7 clr

.]

CO CO03 COm in0 0o o

rHrHCOO

COoQSEdCJ3

=*=

10

rH

W

COCOmoo

4JQ)

CU

G01

C

34-10!

M

rHom•CO

IS

o

r—fa0o0vo

CJCOCOin0o

****

****

****

****

****

W

rite

'm

ushr

oom

s'

on s

cree

n**

****

****

****

****

****

****

*^

*•JC

***

,b

$FFF

F826

0,D

7 S

hif

tmd

, g

et

reso

luti

on

t #3

,D7

Iso

late

si

gn

ific

an

t b

its

t D

7,D

7 T

imes

2

for

wor

d ac

cess

L DO

,b

$FFF

F820

1,D

O

Dba

seh

* #8

, DO

,b

$FFF

F820

3,D

O

Db

asel

L #8

, DO

Scr

een

add

ress

.1

DO

,AO

TO A

$58D

C(P

C,D

7.w

) ,A

O

Plu

s o

ffse

t fo

r m

idd

le

of

scre

en$5

8EE

(PC

),A

1 A

ddre

ss

of

bit

p

att

ern

fo

r "m

ushr

oom

1

,w

#$F

,D6

16 ra

ster

lin

es

,w D

1,D

2,1

A

O,A

2 .

Sav

e p

oin

ter

to sta

rt

of

lin

e,w

$5

8E2

(PC

,D7.

w)

,D5

Num

ber

of

wor

ds

(scr

een

pla

nes

),w

(A

1),(

AO

)+

Wri

te

a ra

ster

lin

e

0 ) " - » Q 1 ' C U - Q 1 ' O I O I O I G I C U

O C t J r H O C Q O c o O T i C U O O O O Og C O C d O g r H g r H g C B c H g g g g g

O rH COVO O OCM CM CMCO CO COfaCO fafa l< CO fa Of a O f a f a C M C O O C Mfao fafa o o o ofao fafa E — o o r^c n c j r - o c \ c o c n c o o p 3 f < c j r H c o p q( J L | M W C M O r H O r H O O C O C J ^ P ' = r i s Cr H C J Q ^ r H H r H W C M Q ' 3 ' C O C O C M C O

O V O f ^ C J W * 3 1 V O O W O * 3 1 C O C J P E 3 O ^ 1

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 ( jC 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 Oi 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 no 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

00

XICO3

01

01rH

oo

oCOin

mQ

10

-o

CJfafafaQCJrH

m

voCJCOm0o

CDG

-HrH

CU

CO

CU

Co

XCUcCU

EH

0oO3m

IS

CMQ

CO!H

ifaCJ

in

CJCOm00

G

CU4J

O,

4-1-H

CUXI4-1

O

O

01

CM=S=

3:

cf•o•a(0

Cfi

m

uCOmo0

? 5

58

E8

(PC

,D7

.w)

,A2

Nex

t d

esti

nati

on

ad

dre

ss»=•

•om

vorHO

fa

Q

OQ03in00

CUc

-H

0!XI4-1

O

4-1

104-1CO

0)

O4-1CO01

O

CM

rH

0)

Og

oCM

QCOmo0

0!G

-H

H014-1COcdr-l

01

COin

voO

6 51

CE

FF

E4

db

raA

4E

75

rts

Q QCO COm mO 0O 0

289

Page 297: Atari ST Internals

Abacus Software Atari ST Internals

»***

S

cree

n

cen

ter

•X

1•X*•X**•X•X*•X

4,*•X******-X*•X*-X**•X•X•X**•X*-X•X•X•X•X•X*

Low

re

solu

tio

n

orH

Ooi-H

£

OT3

OCOlaro

0QCOm0o

Mid

reso

luti

on

0vorH•X00rH

£0•o

oCOwcoK)QCOmoo

Hig

h reso

luti

on

oCO•XooCM

£

0•a

oCOwn

oWCOinoo

****

* N

umbe

r of

sc

reen

p

lan

es

•X•X

***•X•X•X*•X*-X•X*•X

•X•X•X***-X*•X•X•X•X*•X•X•X•X**•X-X****•X****

Low

reso

luti

on

n

£0

"O

moooCMWCOunoo

Mid

re

solu

tio

n

-

£

0•a

rHOOo•3*WCOin00

Hig

h reso

luti

on

o

£

O•a

000ovop£)COino0

1r-H

<DG

-H,-q

-X**•X

•X•X

jj•X•X*-X*•X*•X

•X

**•X**•X*•X**•X**•X**•X*-X•X-X****•X•X•X*

Low

reso

luti

on

ovorH

£

O•o

0P3J00

COWCOmoo

Mid

reso

luti

on

0voi-H

£

0•a

0*3.0o<3JMcoinoo

Hig

h reso

luti

on

0CO

£0•a

0m0oOwCOmo0

****

* B

it

pa

tter

n

'mu

shro

oms'

**•X*-X-X

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

**•X

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

0000orHrH

i-HrH00o00dP

£

O

0or-0

wwCOmoo

ooo01-1

3rH

0odP

£

O•o

oPT,PT,T— 1

Op~.COinoo

oo0

rH

rH

O

( — 1oo

£

o•o

COP-,cqmCM

coin0o

00rH0rH

3

0

rH0dp

£0•o

i*PT,

r-e—«qiPMCOmoo

0rH0rHrH

rH

rH0rH

0rHdP

£

OTS

*3*pT|

r-cqvoPT,

COin0o

orH0rH

3

0rH

0

£O

(3Jpt*cqCO

COpMCOin00

0

o

3rHrHrHrH

rHi-ldp

£

U•o

voPMfc.Q

p£fc*COmoo

L11

100

rH

rH00

0dP

£

OTS

O

vovo

o&MCOin0o

OOOTOC

o

1-100

00dP

£

O•a

,

COCOCM

££]

PHCOino0

o00ooo

ooo0o

£O•a

0COCM0

O0

inoo

OOOOOC

rH0

OrHO0

00

£U•a

o•31

•3*O

CMOo\O

o0

0000o

0

o1-100

00dP

£

o•a

0

<cro•3*0eninoo

OOOOOC

tH0

O1-100

0odP

£O•o

0•a1

0

vo0eninoo

oooo0

00

0rHOooodP

£

U•a

oCM

0

CO0

inoo

000001

00

oo1-10

00dP

£

O•a

0CMen0

f£0

inoo

0000oo0

o0rH0

0odP

£

O•a

oCMa\

Ooenmoo

290

Page 298: Atari ST Internals

00590E 1290

dc.w%0001001010010000

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

NJ

005910 206F0004

005914 226F0008

005918 303C003F

00591C 12D8

00591E 12D8

005920 12D8

005922 12D8

005924 12D8

005926 12D8

005928 12D8

00592A 12D8

00592C 51C8FFEE

005930 4E75

move . 1

move . 1

move . w

move.b

move . b

move . b

move . b

move . b

move . b

move . b

move . b

dbrarts

4(A7),AO8(A7),A1#$3F,DO(A0)+,

(Al) +

(AO)H-, (Al) +

(A0)+, (Al)

+(A0)+,

(Al) +

(A0)+, (Al)

+(A0)+,

(Al) +

(A0)+, (Al)+

(AO)H-, (Al) +

DO,$591C

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

005932 2F390000046A

005938 4E75

move . 1

rts$46A,-(A7)

Fastcopy, copy disk sector

Source address

Destination address

(63+l)*8 = 512 bytes

Copy 8 bytes

Next 8 bytes

Hard disk

initialization

Hdv init

on stack

Jump to routine

enI

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

00593A 5C4155544F5C

dc.b

'1AUT011

005940 2A2E50524700

dc.b

'*.PRG',0005946 123456789ABCDEFO

dc.l

$12345678, $9ABCDEFO

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

00594E 41FAFFEA

005952 43FAFFEC

005956 23DF000005FC

00595C 9BCD

00595E 2B480600

005962 2B490604

lealeamove.1

sub.lmove.1

move.1

$543 (PC),AO

$5940(PC),Al

(A7)+,$5FCA5,A5

AO,$600(A5)

A1,$604(A5)

Auto, start

and execute a program

Address of pathname

Address of filename '*.PRG'

Return address

Clear A5

Pathname

Filename

65cnHi—iBi>*iL3sr

Page 299: Atari ST Internals

Abacus Software Atari ST Internals

, 1

$4

C2

(A5

),D

O

Drv

bits,

ve

cto

r w

ith

active d

rive

01

og

CMCJ

OaCMOCN

VQ

cninoo

0)T>±>OQm

rHQ

VQ

Ol

oe

VQ"=p*sFOOOoocnCOCMCO

<cnmoo

C"

01

-H4-1Utfl

01

-H

Q

OD

D

4J

4-1ft

OOCOoo

cnino0

$5

9A

A

No

, d

on

e$

52

ED

(PC

),A

O

Po

inte

r to

null

na

me

, 1

AO

,-(A

7)

Environm

ent

O)cr CB ><H 01 OX! rH 5

r—r—cn[V,

VO fS, 03CO fc, 0( rH C^

VQ -sr CM

CM T CO

cn cn cnin m in0 0 0o o o

.1

AO

,-(A

7)

Com

man

d ta

il

,1

AO

,-(A

7)

Shell

na

me

% §0 0g g

CO 00o o["T, [V|

CM CM

(=C CJ

cn cnin ino o0 0

toen

a

CB0)MCJ

1in

<D

og

moooCJCOp4CO

wenm0o

gM

O

"8o

do>w

1CQ

>og

CQ•a1ooCJCOfv.CO

CM

cnmoo

#1

G

EMD

OS call

j #

$1

0,

A7

Co

rre

ct

sta

ck

?*cO T3m T)4J CB

Of-HOO

rH CJ"3* [-1w w^31 Q

VQ 03

cn cnm in0 0o o

Q4COCM

o

oQ

rH

0!

0g

OqloCM

CJCOcnm0o

,1

#$

59

AC

,8(A

O)

PC

fo

r a

uto

e

xe

c p

rog

ram

>og

COoooCJ

cnm00ooCJr-rHCM

wcnm0o

C7>q

-HM4JCO

i-H.

3

r-

CO

0)

0g

CQ0

CM

VO

eninoo

CM

CM

£

OQ

rH

>og

oofc,CM

CO

entn0o

CB

H

CO

S1

CO

§0g

CQ0

OJ

<cnmoo

r-

I

>og

•a1ooooCO[JMCO

U

cnin0o

,w

#$

4B

,-(A

7)

Exe

c,

load

pro

gra

m

gos

CQ

0oCJCOt,coocninoo

#1

G

EMD

OS call

* #

$1

0,

A7

Co

rre

ct

sta

ck poin

ter

ca T> raM T3 4-14J cci H

0fHOO

rH 0 in^ r^ r*(x3 r l f"i^ Q "a1

t1 VO ff

cn cy\nLn in ino o oo o o

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

Sta

rt

auto

e

xe

c p

rog

ram

****

****c****•n**-£*

*

*

*

**

*•X

***-X

L -(

A7

),w

#

$2

0,

-(A

7)

super,

ente

r superv

isor

mod

e

' >rH O

0 g

oCM00

r- CJ< COOJ pnsr co

CJ W

cn cnm mO 00 0

rH

COU

too

wcs

=*=

Q.fOH4-1

rH^31c=3•a1

CMCQOSinoo

0)4JC-HOa,

oca4-1CQ

4JU0)

OCJ

r-

=4t=

•S1TScd

fT|srCJmwcnmoo

M0)4-1

-HO!X

O

4-1CO

•o

oQ

rH

01

Og

0i

COCM

VOCQcnmo0

.1

4(A

7),

A5

Base

page

addre

ss

$og

roo0

vo

OJ

03CQcnLOoo

0)

OCQCB.a

oIM

cuoCOO,

CQ

in

oorH

«0)rH

OorH0Q

(V,

•a1

CJCQtyimoo

mo>4-1

OOrH

1

0orH

=*=

rH

ios

oorHOoo00CJCOfe.CM

oocnmoo

292

Page 300: Atari ST Internals

Abacus Software Atari ST Internals

<a<u

o

A4J

<d4Jen

X Ooo torH O45 OJJ S0) Wto CD

r(ffi4J

Oa,

otd4-J01

4-! C-O

oo

010)rH-HM-t

0)4J01

01

T!G

B0>

•a-H

fc.01 O0) ~^X K

a>idc;0)rH

-H

rst

sta

ck corr

ection

-H M^ O

A ""U 01M 0)

<U >iW CQ

CO0Q

M0

01

ffi

•oid

•gjQ

i-H

(d0

<d to-> O

4-1 S(1) t=3W CD

0)

-Hao

w

t}0>»HMOo

tH

id0

oQS

ID

0)

B-HOP,

U

01

O0)M

OO

f-

•aB30

<DrH

-Hfa

(US

B^3

o <dZ PM

0)gfi0)

-Hfa

(US

B

O.p3<

CJ1O

P,

(0a

a

O

a> a>S S <u10 ta Sfi R <8

M H a><dO

I r- ft,•* «C "

10 — «•

(~- — —rt I I

H-

tH

O CM tH —

tH VO

* *

Oo

Q CO <- o <H

tH VO tH r-* * =«= Q

O OP M & ,

ao

0059

C6

;

r-CNJ

0059

C8

t 3F3C

004A

0059

CA :

tH

tj7 306SO

O

0

0059

DO

I

o

0059

D2

(

vovo\n

0059

D4

f 3F3C

0007

0059

D6

: JF39

0000

0600

<oentooo

3F3C

004E

0059

EO

:

COo

0059

E4

I 1879

0000

0608

0059

E6

< 3F3C

001A

005

9EC :

tH

W

0059

FO

i

o

0059

F2

{

tH

W

0059

F4

(

t—oj^\6 I

o•SPft,

00

59

F8

t. ll".

0059

FA

( >07

9000

0060

000

59F

C

S ?479

0000

0604

005A

02

J 13F

9000

0063

400

5A08

i.

COQCM

005A

OE

]

COCJmm

005A

10

I

vo\n

005A

12

f 11F

9000

0062

600

5A14

t.

COaCM

005A

1A

]

ovo

005A

1C

f 187A

F8C

D00

5A1E

( 18

7AF8

C9

CMCM<ino0

1879

0000

0634

voCM

<10o0

voCM

00

5A

2C

<

293

Page 301: Atari ST Internals

Abacus Software Atari ST Internals

load

p

rog

ram

S call

- oO QCD sX WW C3

ct

sta

ck

po

inte

rfo

r s

tac

k

po

inte

r

01 w^ 0)

O >iCJ ffl

4JXCU 0)C rH

-H

0!H 4-1m xcu cuto s

o3rH

10>4-1H104-1CO

04-1

X0(0£1!HCU4-1G-HOQ.xo(04->co

COCO(U

•a•o

c

SH

•oO.J

t,

sc

ree

n

ha

rdc

op

y

-H

tPQ

rH

P O•o o

•o4-1 &HO CO

CO 35

du

mp

flg

M(0(UrH

o

p,

hard

co

py

g•an0to

A5

ad

, s

cre

en

ou

tpu

t

M<0 COcu ArH

CJ >

rH

rH

P

aO4-1

4-1<UCOmH-l0

G GO O

-H -H G4 - 1 4 - 1 C U OP 3 4J -HrH rH 4-1 4-1O O CU (0CO CO rH MCU 0) CO PM M O. M &

4J O CU -HG c ,G 45 M n 4-i 1-1CU <U 4-> tT> ( U O G C<U C U T > - r l N r H - H OM M -H CU O O OCJ O S .C 0 CJ OHCO CO 4-1 H

G C 0 X CU•• M CU CU 4_> 4J CO 4-1

T3 O CU CU 45 10 Cg CM 1H SH >H t? CO £ -H

4-1 O U -H CO M<4H CO CU CO CO r4 CD M Q<-H CU 0) rH 4-1 H 10& > g 43 4-1 4-1 M-l T3 73 C U 4 - 1c o c f l - r H t O C U C U C L C T j r H C UC O l O E H £ H O C 3 t - 3 < < C J C 3

r-

1

pa•c1

4t=

S

cuoe

pa•srooUcofaCO

fV)

CMf£

LOOo

rH

*

ara4-)

rH

^P

W•a1

CMn<£

LOOo

^orH</>=tt=

|5.

T3•a10

orHOOOfaWQ

J1

COf£

LOoo

p^Q

CM=8=

, — |•trCU

og

CMOwr-

00COf£

LOoo

1

fa</>=«=

J5.

cuog

fa•c1ooCJ

faCO

f£CO

(3^LOoo

voWCnm

CO

Q

vort^0vo

wCO

LOoo

r~<<qCMUCO</>

(0cu

rf^CMp-1COoo00CTifafar

0J1

(5J

LOoo

1•s

CJfaLO

rH•

CU> COO 4-1g r*

CJ

moooo0en inro r—fa MCM ^T

VO U

^ ^LO mo oo o

*********

****-X

*****•X

***-X

**-X•X•X

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

*****•X*

HM

</>

|5.

rH0

paMJ1OOo00CT1r-CM^31

W

LOoo

ovo(LO

MCOQ

f^C0rHVO

•51

LO

<LO

Oo

wH«=pin-

<*rH1

=tt=

S

CU

og

(V)

wooo00fafafafaCJfanCO

voin

LOoo

tn4-1

m[ —[V]-=T

f£J

in<inoo

**********

-X-X

**•X

***•X•X

*•X

*•X

*•X-x.£

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

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

in«,

m

rH.

Q

PU

Q

pqen

ovo

moo

LO<

SPLOVO•co-

in<

Mr

•31

<rt

rH•

CU

og

^31mvooW^*•31oQVOpqCM

CMVO

(moo

in*-*COmvo</>

S

rH

O

COmvo0QvoCM«sP

COvo

inoo

oQ

|5•

L^

rH

o

0*3*CM*3*

CJVO

LOOo

0Q

m

LO

<

CJr

"31

<fl-

fk

COJ>og

oQ1^p0QCM0rH

WVO

"5*LOOO

LO

CMVOvo<J}

K

0Q

s0)

og

CMvovooo"5TpaCO

CM

inoo

oQ

oQ

|5•

T5-oCO

O•5P

OQ

vo[

(inoo

o<

OCM

^pQ<m<n-

cd(UrH

inooP£farH^P

CO[

j^moo

m<

<invo«/>

?oQ

o<

0

S

CU

og

<;invooooooor—P3CO

CJr-

LOoo

LOft,

CJinvo«•

K

?oQ

<V

0<vo

»0)

og

CJinvoovoo0oor-PQ

CMCO

LOO0

LO

~—HLOvo</>

«}HrH

U

wLOvooQvoCM

COCO

mo0

LO

~—ovovo</>

sSHrH

0

ovovooQvoCM^p

oCO

LO0o

in<vovovo«•

KoI1

CMCOfafavt=tt=

rH•

cuog

vovovoo0spCMCOfafaooU

PQCM

0en

LOoo

LO

~—wvovo</>

5•

HrH

o

Lt)vovooQvoCM^p

COen

LOoo

rHQ

*fc

in<UCO<v>

scuog

oCOPJJoQCMCMco

oen

LOoo

294

Page 302: Atari ST Internals

Abacus Software Atari ST Internals

nte

d

CD73O

10 -H

&*

CO

-H

1oM3en

-HMH

oon(U

oo43

0) > -H

01 O 'O 4JCU 01EH H

(0-H

ft (UO ft go >, o o

73 4-> M 73

(0 M <0A CD 4-> 45

4-> C

O -H g O

ft CT>

0!ft E0 fS

<U4JS

ft >i Oft ft

QJ O45 O X

M (0

ft1oo73H10f,

>-<O

43 01<0 434J 4J

014J

73 -H

g -10 d)

C G<D (U

CD

t

no

t

a)3 -H

>1 4-J01 <8

4J -H gOJ (0 <0ft g 73 M>! O

4-> S 3=

CUCD43

X >i

01

(U4J

n mo

o oo

M (0 73

,-» fflrH flj0) .G0) ~ 3

45 X3 -H >.

M 01Si 4J -H01 <o <o

g 73

ff) O

orHOO

G G C0 O O01 01 01

OEH EH

EH 01 ft ft ftrf, ft W Eii] pc]

rHQ

n=tt=

01rH

cnqivssW

o

<moo

rHQ

,_,

=t£

3

C(0

rHO0oCjr-CMO

CM

<mo0

,10vo«•rH

Q

|5•

CD

Og

^PVDVO0rHqi

ffl

VO

moo

0Q

Q if) Q

.-!! — CJ --in o CM < m•— O O O V O r H O V O — C M P -

</> Q =t£ =*f= Q 4 : -t/> Q -W- </> =fr

S 3 = £g ^5 ^ 3:• • & £ ' $ • •

O O W G O C O O O W T 3 4 - )

f^jV3\£>O

O < - ) O r - o o * 3 ' " = pC O O V O O C M O I O O< O V O O O O V D C MO O O O r H O O f MQ t — t C Q O O O C Q O Q O P M L OCM o ^t r^~ ^ r** co O ^o o f r*^C M O C O O C Q C M O r O C O ( H C O Wn r o H Q c o O t — i c O ' = i i V O L O ' = rpg |V} o oj VQ f£ PI-| <NJ qp CJ Q CM

< ^ § § < § § ^ ^ < § §i n i n i nm in in i n i nLn inm ino o o o o o o o o o o oo o o o o o o o o o o o

*****•X

**c-X-X

**•XX

*X

*****-X•X

**•X•X•X

*•X•X•X•X

*•X•X

*•X

***•X

o

0qiVD

••CMn

3

U73

0COCMooCOCM00^1f— ]0

spain0o

oo

00CM

••oCM

3

U

oenrHoCOCJooCOCJ00

COQ

mo0

****

*•X

*•X

*****•X•X•X

*-X•X-X•X

*•X•X

********•X

*•X•X•X

*X

*•X

***•X*

O CM rH

_Q ^3 »Q

o o o73 73 73

O CM rH0 0 0

O rH CMW W W< < <m 10 mo o o0 0 0

,_,1

43

o73

&4

feCOw<mo0

rH rH rHCO 1 1 1

43 43 43 43

o o o o73 73 73 73

fo r*i F"I FTIo r^i FTI r*i•01 in vo r~

in m in ino o o oO 0 O 0

295

Page 303: Atari ST Internals

Abacus Software Atari ST Internals

01

oCM-XOoCO

o4J

4-> -H

C O 01•H o a

<0 O> X Ht3 <B inJS g G

-H

H(0-PCO

01.G4->

MHO

010101

•c•o

H<B

3G

MQ

M0)4J

-HOa <uisx o0 O M<a oi.p SH 4201 O

G U CD-H 01

&

3

0!

O (Q MO to Q

4JG W<u a0} O<B rHM M-la G

0!•a .p jjO O GO G

M0)

3G

CO

•a

M oi a>o > nM -H OM M CM Q M T3 M

(1)4J CM NG -HCO 4-> rHg co <$CO >i "H

o *j 4nC O G

H

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

votH

vo

c-H

ofafafavomW

CO[V]

p£inoo

inCM

0OCO

H"

01>OgvofainCM0O0oCJCMrHOOO00CJ

COCM

O[V]

f£inoo

0Q

^f—lo

0^pCM•31

VOfa

moo

vo

0Q

>og

vorfj<3i000000oCOCO

COfa

in0o

CMcnvo

oQ

CO

Og

CMcnvo^p00o00ocoCO

p£Jfa(<Jin0o

CM

OQ

03

Os

py]fa[V,

fa0*3*QCO

^POPQm0o

COinPQin

is$_iJp

W

ovo

CO0PQino0

,1

#$

3E

2A

,AO

>og

rS^CMWCOoo00CJ

oCM

<J0PQmoo

vo

CM

3

QJ

O€

tyi[V,

[V,

faHVOCMcoa*~H

PQmoo

o

' '•a•om

cnO

Q

<<*, — |

PQmoo

o r-f3? f£

r*J t>

M ^H

rH rH

O O

0 i~rH inCM CM•31 "O1

VO CO( — 1 T — 1

ffl PQm m0 0o o

I

"*

rH

O

tr-ioCM•=P

n3JrHPQin0o

i

"*

rHO

tr-ioCM•SP

CJrHPQino0

Co

CM

"

Og

WfafafaWCM

coty]rHmmo0

1

t 1

rH

o

r-f£CM

CMCMPQino0

[—

' '1rHO

r~

CM

^PCMPQino0

oCOCMVO

01T~l

CJCOCMVO0O00enPQW

voCM(Qino0

W

*

, 1

T3•a

p£]O000o00CJ

faaoCMPQmoo

r-

0Q

3*

>0s

oofaCO

CMCOPQmoo

o

Co

CM

*CO

og

fVj

fafafapqvooCO

•3*COPQino0

0

0

rH

•oTJ

COoQ

COCOPQmo0

L i$

49

10

,AO

•ot5

0rHcn•31

OOooCJfarHQ

(COpqmo0

0

H-

3*

Q/

0g

facnoCO

o•a*PQmo0

mpqm

01c

orHVOvo

CM•IPpqmo0

vo

rH=tt=

3*-ri

•o•offl

V0

rS^«sP

00o0ocnf^CMm^31QIpqino0

CMCJ

00

' — 1

SHO

CMCJ

Oooooco0ooooooen03oof£^yt

minoo

Co

CM1

rH

*

3M

•o•o

&3fafafa

voCMmi

mPQmoo

vo

CM

CM=tt=

"*

ago

wfafafaCMOooWvoCJ0

COmPQmoo

opqm

^jrH45

f^fQVO

WmPQmoo

vo

rHG3

p£}

msr

ovoPQinoo

296

Page 304: Atari ST Internals

005B62 4E75

rts

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

getdsb

005B64 4E56FFFC

005B68 4280

005B6A 4E5E

005B6C 4E75

linkclr.lunlkrts

A6,#-4

DOA6

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

005B6E 4E56FFF4

005B72 48E7070C

005B76 OC6E00020008

005B7C 6D06

005B7E 4280

005B80 60000192

005B84 302E0008

VO

005B88 EB40

>J

005B8A 48CO

005B8C 2A40

005B8E DBFC00003E3E

005B94 284D

005B96 3EBC0001

005B9A 4267

005B9C 4267

005B9E 3F3C0001

005BA2 3F2E0008

005BA6 42A7

005BA8 2F3C000012BC

005BAE 4EB9000062D2

005BB4 DFFC00000010

005BBA 2D40FFF4

005BBE 4AAEFFF4

linkmovem . 1

cmp.wbitclr.lbramove . w

asl.wext.l

move . 1

add.lmove . 1

move . w

clr.wclr.wmove . w

move . w

clr.lmove . 1

jsradd.lmove . 1

tst.l

A6,#-12

D5-D7/A4-A5,-(A7)

#2,8(A6)

$5B84DO$5D14:lnl:fp5

8(A6),DO#5,

DODODO,A5

#$3E3E,A5A5,A4

fl, (A7)

-<A7)

-<A7)

#1,-(A7)

8(A6),-(A7)

-(A7)

#$12BC,-(A7)

$62D2#$10, A7

DO,-12(A6)

-12 (A6)

Zero

getbpb, get

BIOS parameter block

Save registersDrive number

< 2,

okElse

zero

Drive number

Timers 32

Plus base address

Count, read

a sector

Side 0

Track 0

Sector 1

Drive number

FillerSector

buffer

Read sector

Correct stack

pointer

Save error

code

And test

>l-t5T

Page 305: Atari ST Internals

Abacus Software Atari ST Internals

P-

O

CD

PC

0)>

-HMQ

0)t3OO

OH!HEJ

err

or

han

dle

r

rH

IB

O-H4J-H^_lCJ

sta

ck p

oin

ter

j iu0)

Moo

0)•OOO

05^0)

CU

<Bto

C-Hn)

<a

0

%0)CO

0o43

•o(3O!

^1opU0)CO

H01fiCO0)4J

£)

^rHrH-t-

01u-lfHp

PQ

-p-H

O0o03VO

0p

^1a>Oi0)pG-H

VOCOoCO

4->SJ0)>Coo^

-HCMp

J_J

0•P00)CO

r(

O<

CO014J

^^jp

CJ)J><aCO

M0!•PCOprHO

H0!aCOMO•P001CO

^c*>cH-|-£.40)IHIHP

PQ

0)M

+Js

OOoCOvo

EH

EH

H O)0) -Pft C

M VOO CO4J OU CO0)CO J->

CM" ICM C+ OM U

01 -H <H - N0 01 M-I -H -H01 rH P CM COM O CQ P MH

01P

&

QCQin

oQ

— <: — o

voo oQ Q

m Nin CM

CM VO O VOrH <C O VO rtj CM ^I — O CD — EH rH- CM rH PQ CM PQ Q

o r H < / > i n < - H i n o i nQ I =tt= </> I «• Q «•

— voK Q

r- *.CM VO Q O CJrH CM - CJ CM</> VO O in rH

VO

Q

.— — ^ O

«• < CM ft, -

r H * - ~ C M C M V O C O « 3 » Q

C D C O d ) < T O ) C P - •0 ) > > ! > > - i ' O > > p H { T j Jt 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!

COo00

vo HrH <O Wvo nCM •srO UCQ pqm ino o0 0

fr!EHcy oCM O0 fc.CM O

CO OU CJm fflin inO 00 0

00

05

55

C

oen EHCQ coEH" ^<3" inW ^fCJ QCQ CQm «o o0 0

IEEH EH0 H•=r CMQ 0CM CM

vo <cQ Qpq PQm m0 0o o

00

10

00

0

0OPQoPQ

WQPQmoo

oPQvo"=rP3PQin0o

•3-EH

EHH

F«f

vop-*)CQinoo

vooovo

<££]

PQin0o

oCOCMsr

O

PQin0o

CMrH0Ooovo

w££]

PQin0o

r- en CMO CJ OCM CM CMrH rH rHO C J O PH CM C M O ^ P C Oova o PH o o o w oO V O O O rH O O VO Oo o o o o o o o oc j o o p a c n v o c j v Q o o r - v Q c j o oCQ o o c^ co co r*~ o co o co CQ o ^W r H W r - O c o o v o c M O C o e n M r H c nC 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

C M C O c j ( a o v o e o c j ( y o « p v o < o a 'E n E H E H E H O O O O O r H t H r H r H C M C Mp q p q p q p q o c j O C J C J O C J C J O C J C Ji n in inm in inm in in in in in in inmo 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

CO0ooCJ OCM •»0 CMco m

CO OCM CMCJ CJin inO 0o o

298

Page 306: Atari ST Internals

Abacus Software Atari ST Internals

oCU

.p<0

0)tsi-H

COOCOrH

N

-HCOrH

U

01CU

-HEH

XIN-H

COrH

O

03t)CU-H>H

dir

ecto

ry entr

ies

|

IHon

JSgpG

rH-f.

t^

COMHMHpm

G-H

O0oCOVD

O4-1

COenCU4Jc-H

«JCOoCO

4J

>G CMo coo

CO•• CJ)

-H 5CM -HP EH

N-H

COoCU^1

jj

T3CO

-rH

>-HQ

GCU

<^

CO

•orH

CO-H>H

§rH

•oO HCUrl CO

4-1 Pfd ' — 1

MH PJ

N-rl

COMH

COPrHPM

OCUJ_)

Id•a0)

T)rH

CO-H

se

cto

rs

|

MHO

rH

CU

g

P

G

airHH-

CUMHMHPPQ

G-H

0OoCO

o4-1

CU

CU4-1G-H

10COoCO

4-1rlCU

G0O

^-rH

CMP

OCO

4-1

•QCOpG

-Hs

N-H

COrH

O

jj

T3CU•o-H

-HQ

rH

o

G

CO•orH

CO-HJH

COCO•a-H

CO

MHO

(

J8EPG

voCMH-

j^CU

MHMHP

PQ

4Jc

-rH

Oo0CQVO

O4-1

COenCU4-1G-rl

voCO0CO

4-1

>coo

^-rH

CMP

COCU•a-H

COG•o

r tr

ack

|

CUaj_,04-1OCUCO

CTCMH-1CU

MHMHPPQ

4-1

-r)

0ooCOV0

o4-1

CO

CU4-1G-H

<£>COOCO

4-1M

g

GOO

-r)CMP

COCU•o

4-1 -HO, COCO G*O T3

&CO•aCOCOg

-HEH

UrVCO

•o0}

•arH

CO

-H>-l

hid

den

se

cto

rs

|

MH0

rH

CU

XIEPG

COCMH-MCO

MHMHppq

4JG

-H

O00COV0

04-1

SHCUenCO

G-H

V0COoCO

4-1rlCU

C0o

^-HCMP

GCO•a•a-H*G•a

sp

0rH

^OQ

^

§0E

r< o -> £C o ^-*O ^ ^ — .— G O O - a * — Q O T

O Q ^ P - O s p - . Q Q c < ; - - Q <Q - i < O Q « ; — - • . — pM4 -* «. •"- — . — C J « > O - - — ^ ^ - . ^ - C M C J V D T x-^-O"

^^ "31 "31 CM ^0 Q - - ^ 0 r t J ' 5 P < a 1 r H C M \ 0 r i 3 "TPrH^ T r t ^ K r H C M * . ^ P ^ *-* fC, (£, •. rH CM ~~* t«C •*i < - — o < / > v 0 i r > O ( < o o — ~ - * O - W > V O C M O — o— C M Q = t t = < O - = t t = Q — Q r H V Q C O Q = B = < / > r H Q C M Q

S S S r H 3 & S ? r H ? S

c u c o c o c u • • « ai aj • • a; a) • • o] a;> r H > > r | r H 4 J > > > - i 3 - t ! > > M X l 4 - l > >O P O O c o w X - r l O O T j - a O O M P X - ^ Og e s e x ) < u c u ' O £ £ c a r a s s x i « c u ' o e

VDaCMrHVt=»

rH

>Os

in

vo oV0 CMCM -V0 O«> Q

S

CUrl >CO OXI g

•a1

QCMrH^/j.

=tt=

rH

CU

OE

10CM10«>

rlCO

XI

in

CMKoQ

3

CO

Og

oQ

io•»-••

0CM

£

§

OE

oQ

in~-~•C1

CM

sCO

pE

in£CMCM

<vOQ

a

rOg

COQCMrH</5-

*

rH

£OE

«> CMCM •*VO O</> Q

S

CO

CO OX! E

005C

2E

39

40

00

0A

00

5C

32

30

14

005C

34

C1E

C00

020

05

C3

8 3

94

00

00

400

5C3C

2E

BC

0000

12C

D0

05

C4

2 6

10

00

62

20

05

C4

6 E

B40

005C

48

48C

O «=rO<HCO

<sp0moo 00

5C4C

3

94

00

00

60

05

C5

0 30

2CO

OO

A00

5C54

D

06

C0

00

60

05

C5

8 D

06

C0

00

800

5C5C

3

94

00

00

C0

05

C6

0 2E

BC

0000

12C

F00

5C66

61

0005

FE

005C

6A

906C

OO

OC

005C

6E

48C

O00

5C70

81

EC

0002

00

5C

74

39

40

00

0E

00

5C

78

2EB

C00

0012

D6

005C

7E

61

00

05

E6

005C

82

3B40

0014

00

5C

86

2E

BC

00

00

12

D4

005C

8C

61

00

05

D8

00

5C

90

3B

40

00

18

00

5C

94

302D

0014

00

5C

98

C1E

D00

1800

5C9C

3

B4

00

01

600

5CA

O 2

EB

C0

00

01

2D

800

5CA

6 61

0005

BE

005C

AA

3B

4000

1A

299

Page 307: Atari ST Internals

Abacus Software Atari ST Internals

num

ber

of

se

cto

rs

on d

isk

KOlrHH-MCD

U-H

303

J-JC

-rH

O0o00vo

o4-1

CD

CD

C-rl

CO

OCO

4-JrH

CD

coo^

-HCM3

Oftto•a,

43

•oCUT3-H

-rl

Q

racks

4-Jc•oto•orH

CD-H

X

ze

ro

o4-J

fa

CD4-JC

OCJ

fto0

tH rH

O CD4-J

•o cC -HCD O

ft04-J rH

CDft 1-1e IH3 3

er

dd

ress

4-1 fdC3 CQO CM0 CQ

ft CO0 3O rH

r^ Pj

er

r a

dd

ress

4-1 COG MH3 MH0 3

O ^ft toO 3O rH

>-3 a.

of

the serial

num

ber

CD4-1

Q

>.

ftOo

CD4_1;>,jp

4-J

CD

s a

lre

ad

y

?

CD4-J

Q

CDCDM

EH

j>CD

0 tiS3 0

to3

4-J194-1COft

fd4-J

CDUG C3 -H

to34-1id4-1

Xto

4-JHCDO

to3

4-JfO4-1CO

310CO

tn<d

PQp<CQfHO

r-eC

PuCJCMrH

</>=w=

rH•

CD

Og

^DVflCMVO O</> Q

rH

fa 4-1co x:43 CJ

oQ

. — .m<c—CMCM

3

to>-H•o

m~~COrH

^OQ

3

CD

Og

r-Q

|5.

MrH

O

CJQOm

<a

43

o<jj^

m

,_,•

(U>og

rH(

fc.[*-

Q

£

.

CD>Og

Orfj^

, — 1

<

(—1•-o

TJ

tH<;

^p»»

Q

3

CDp»Og

rH

CJtn

rH/j.

*

rH

*•o•a(B

00CM

^_^

rH<J««

CO

CDp>Og

r-Q

rH

S

tr•a•a(0

r- voQ CJ

~ 0n m

S

ft 4Jg rH0 43

o•.

vor^V£>4/j.

*

H

CD

OE

rH

«.»,

\fQ•~^CO

s.

CD>0g

Orij

«,rH

rHB

•a•o<a

rH

«.^31p^

\OVt

rH

CD>0s

CM

«,. — ,U>

• ^CO

s.

CD>0g

rH

*£«.

CM

rH

•TJ-o(3

0

*«^*.

^-^.rHrtj'*""

#•

CD>Og

CMOQm

trOJ43

O *3<Q o« Q

rH in=ft= </>

rH

CTCDP" *flO MS 43

oQ

S

MrH

O

rH<

<CMwn«•

*rH

(U>og

CM

*.. — .vof£^-^

CO

g*

Q)

«>Oe

rHrfj

«.

CM

.H

•-a•afd

rH<C O— Q

«. «.o mO <!

43 rH

CU 0)> >O Og g

005C

AE

2E

BC

0000

12C

F00

5CB

4 61

0005

BO

005C

B8

48C

O00

5CB

A

81E

D00

1600

5CB

E

3B40

0012

005C

C2

42

47

005C

C4

60

16

005C

C6

20

4D

005C

C8

32

47

005C

CA

D

1C9

005C

CC

3

24

700

5CC

E

D3F

C00

0012

BC

005C

D4

11

69

00

08

00

1C

005C

DA

5

24

700

5CD

C

BE

7C00

0300

5CE

O

6DE

400

5CE

2 20

7C00

0006

7600

5CE

8 3

26

E0

00

800

5CE

C D

1C

900

5CE

E

22

7C

00

00

06

74

005C

F4

34

6E

00

08

005C

F8

D3C

A00

5CFA

1091

005C

FC

6704

005C

FE 7

00

100

5DO

O

60

02

005D

02

42

40

005D

04

227C

0000

3E2A

005D

OA

34

6E00

0800

5DO

E D

3CA

005D

10 1

28

000

5D12

20

0D

300

Page 308: Atari ST Internals

Abacus Software Atari ST Internals

0]HQ)4-1CO

-rH&01M

<Url

O4-1U(UA

LO<

ST<

r-QI

voQ

H- +

r- r-

rH

rH E

4A

9F

tst.

4CD

F30

CO

m

ove

r vorH rHQ QIO LOO O0 0

voff.

rH

CP

LO

w

<£rH

Q

LO

O0

a4-1

LO

I—w

CJrHQLOO0

*:o<a•HT3(U

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

*•X•X

**

*

•X-X•X

•X

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

-X

*•X

**•X

0

vo

c-HrH

o0oovoLOH

p£lrHQLOOO

0]

(U4-101

-rH

(U

ien

ILO

Q1

arH

g

Og

•3*otoo

wCO

CMCMQIOo0

<ou-H

( U ( B O O )43 T3 C 43

P c u pC S 43 G r5

O O 00! G M CU 4-1 0> 0- X O > <d CM-H CM G H -H rHrl P M rl ft N

O V - W Q » ^5

^-- r- < 0 •V O O Q » — <C !— — • . OK J ; Q K < L O - . Q L O Q— C M - W — - L O C M r C C O O W V O . . C O K C - rHc o t O L O r ~ v o < p q — « < Q [ ^ , > o t o — <<;x Q r H Q » < K f O «.Q " . Q V O r f l Q *.PQ ^

C M L O 1 LO [— < / > e M L O C M L O « > l O r H S f ! ^= f t = - a > ^ = < / > c o Q = * ^ = i ^ « > = t t = < / > = f t = o < / > = * r < / > Q

rH r-H

& & rH 43 rH 3!

S CT - . r H 4 3 CJ1 - 4 3 . . .ft 4-1 r* ^3 r* 1 *^ CL, fl) ^ *d r^ 4-1 CT r* 1 r*g r H O r t O O T i S C O r l O O l C B O O O

0 4 3 E 4 3 S g « 5 0 4 3 S 4 3 e 4 - i 4 3 E e g

CO rfl VO ie^o CM r- PQo tt) vo icr0 CO 0 0C M C O O C M O O r H OO O O O O O O OO O O O O O O Oo o o o o t ^ o oN ^ 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 >

O Q O O W < P 3 O V O O O O < I > < O C MO 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

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 HC 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 OQ Q P Q D Q Q Q Q Q Q Q Q Q D Q QL 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 Oo 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

rH

rH

rH

•ats

enCJ(0Q

ovoQtooo

-H

ts0m

rH

rH CO

•s VOrH «/>

rH rHD

3C

9 add,

D3

FC

00

00

06

78

add,

CM TVO VOQ Q10 LO0 0o o

rHa

rH

rH

0

rHrHCMCM

(QVOQ10OO

OQ

rH

Q

rH

43P01

rHCOo

ovoQLO0o

, 1

$

25

F6

,DO

m

axa

cctim

$5

D7

A

BO

B9

00

00

25

F6

cm

p,

SC

O 4

bge

f£) ^31VO 1Q QLO IO0 00 0

301

Page 309: Atari ST Internals

005D76 4240

005D78 6004

005D7A 1015

005D7C 4880

005D7E 4A9F

005D80 4CDF2080

005D84 4E5E

005D86 4E75

clr.w

DO

bra

$5D7E

move.b

(A5),DO

ext.w

DO

tst.l

(A7)+

movem.l (A7)+,D7/A5

unlk

A6

rts

Restore registers

8

********************005D88 4E56FFFC

005D8C 48E70F04

005D90 OC6E00020012

005D96 6D06

005D98 70F1

005D9A 6000010E

005D9E 3C2E0012

005DA2 OC6E00020008

005DA8 6COOOOCE

005DAC 3006

005DAE EB40

005DBO 48CO

005DB2 2A40

005DB4 DBFC00003E3E

005DBA 3E86

005DBC 6100FF60

005DCO 3EOO

005DC2 BE7C0002

005DC6 660A

005DC8 70F2

005DCA 600000DE

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

link

movem.1

cmp.w

bit

moveq.1

bra

move.w

cmp.w

bge

move.w

asl.w

ext.l

move.1

add.l

move.w

bsr

move.w

cmp.w

bne

moveq.1

bra

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

A6,#-4

D4-D7/A5,-(A7)

#2,18(A6)

$5D9E

#-15,DO

$5EAA

18(A6),D6

#2,8(A6)

$5E78

D6,DO

#5, DO

DODO,A5

#$3E3E,A5

D6,(A7)

$5D1E

DO,D7

#2,D7

$5DD2

#-14,DO

$5EAA

rwabs, read/write sector(s)

Save registers

Drive number

< 2 ?

No, unknown device

Error branch

Save drive number

rwflag

Test media change

Save status

Disk changed ?

No

Media change error

Error branch

IWJH3

Page 310: Atari ST Internals

Abacus Software Atari ST Internals

•a0}enc13JSO

0101oax01-rlQ

Vlo4->O0101

4->Oo

CO

Vto4-10(D01

<0 O

"O (1)<a *O0) -H(X en

rHO

Vi.X OO 4->(B OVI 0)E-I cn

VI<DrH•oG(0

VlO (HVI COVI 4J0! C

-rH

<o au

•H X4-> O"H (QVl 4-1O CO

VI 0)O 01 VlVI 01 VIVI IB Opa CM cj

•a o<0 VlQ) VIP^ H

0) U

3 >Hpj O

VI VlO OVI Vi

COpid4J01

fiO

Ti0)

r-Wm

(0VI

Q^

rH

s0.go

wm

0)

43

t-

rH

s0)>og

1

.VlrHO

3

VlrHO

sI

rH

3

0)>oe

r-

Q

3

a>>og

r-

rH

VIrHO

CJ

rH

=s=

rH

CD>Oe

QCMVO

Vl01•n

r— <

0 1rH »«> O* Q

rHrH

• (D•a >•a o« g

oQ " vo

< < VO — CJ C-

P3 v — » m «. -in vo «=p o m CM o«• Q i Q «> =*» Q

oO Q

Q -«; - o— - o^p VO OI f£ O

oQ

< vo *rQ < n

</> in "3» in=tt= «> i -to

S rH 3 rH

Q) Q) Q) CT> > > vi -ao o o 01 -og g g -n <fl

§ §o og g

0)O, Cj* 4-1 CO ^ (0g a) 01 en o viO 43 4-1 43 g 43

m

m

3

vi <arH Vlo 43

O rHO < O

CO

<o o o oo o o ooo r- o P3 vo voovo pq vo

CM VO

CJ CMIS QCM CM

VO

ooo

r- O

W CM CM Pu

pa o CM

O O O C J O

O O O E c * E £ 4

CJfrt

Oininmoooo

oooo

CJ O rHPn CM O

spmr-vo

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

O O CO

" co pa oO CM OCJ O OVO CM VO

vo sC o oCM 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^i n in in in in inmin in in in in in in in in tn in in in in inmin in in in ino o o 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 o o o o

r- CJCM O•31 VO

in ino oo o

303

Page 311: Atari ST Internals

Abacus Software Atari ST Internals

M0)1-1tH34)

MO4->O0)w(U^ JH4J 0)

1-1 EO 3

CCOM rHCD idV-1 "H"O VJTJ (1)sc co

0)JMidQ,EOU

valu

eio

u

G.

0) Xtr> oc c<d (d

O 43

s oT!0)

3C

19-H

SH C"(U01 "O

(U<U 4J^ 014-> CD

4->

O OJ03

<D 4-14-> >i

43

£ "(US3

OS3

3 0!C 3

<D id> 4-1

-H O

0]ao

r-H

0) 45M U

C4-1 IdO Mfi 43

0) S-l> O

3C

MQ

3

-H 3M OQ O

S-l0)

3G

OQ

O IS

CJ Q

CM O

V} — O CO=8= CO Q CM

O

"is

Q

m O CMQ in

oQ

rH Wi m

=#= </>

p4

o•a- n <co •» «CW CM Wm i m

—• o — vo —CO G\O ril I

rH in CM r vo*«•=*= rH Q

- • 3= • S 3= CT0) fl) • 0) • • 0)> > 4 J > 4 - i G . i T > i OO O X O X E t U O ME E a > E O ) 0 4 3 g 4 3

T3 g rH o Ti O T3

43 S5 •• H 43 3 CT

Q) QJ * • • Q>^ fl) ^ *O M -M Q) J> (3O G O " O < - H 0 1 G O H

* O"* 0) Q)O, 0> A > >E rH 3 O OO 43 01 g g

wCMrHOOOoO

OrHOr~

O i n r H r Hc o r o c o ^ rc o c M C o o

' O ' C M O Oo p ^ i nr - o o

o o o o o o o o oo o o o o o o o o

coooo

r- 0CM Mm mCM -a*m mw tym mo o0 0

&3 voQ -a1Q 0vo nco (3m mpq pqm mo o0 0

00

00

67

6

oO vopt! «3»rH CMQ CO

O CMm vo&3 P3m m0 00 0

00

00

67

4

oO rH

CO OQ rH

«* fiCvo voW [£)in ino oo o

< voo -a1vo oVO CO

o wvo voW pqin in0 0o o

00

03

E2

A

oO 0h rHrH CMQ «a"o vor- t-W f*Jm m0 0o o

00

00

4A

6

0CPl *3*r~ o< vo^ vo

co Wpq ^m in0 Oo o

wf-.or-0COHin0o

voCM0voCMCOPL]m0o

00

10

00

8

ovooo•a1CO

Wmoo

coooo

«3i Wo voPM invo m«C oCO COpq pqm m0 O0 O

ooopq voff, Opq CMco coO ITO\S

H Wm mo o0 0

304

Page 312: Atari ST Internals

Abacus Software Atari ST Internals

oCo

1

vo

vo

3

>O£

orHOOfaCMfaovoCTlEdino0

CDMH

3

r-

I

vo<orH

>O£

<oooEdCMfaCM

<cenWmoo

cd

3

1<*

Co

03

3

(U

CO0ooEdCMfaO

Edc\

inoo

I

«•

CO.Q

orHrHVO

CM<=CWmoo

ncu4-1C-H0a

0<04JCO

b

oCJ

r-<

iH

•a•acd

<oo000oo0fafaQ

r<Edmoo

+

I4-!CO4J

faa\

•=3*

<=C<Edinoo

CO!H(U4-1to-Her>(UM0)

o4-1CO(Si

in-v

Q

mo

rH

1O£

0EdOCMfaQO•a1

O<Edm0o

<

.XrH

C3

PdmEd•=r0mEdin0o

CO4-!

inr-Ed•5T

CMmEdm0o

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

flo

prw

, re

ad

/wri

te

se

cto

rs******•:

***•it•it-X

***•it•it•it•it

*•it•it

*•it

****•it

*-n•1C

*

*•it•it

VO1

*vo

C-HrH

ri^fafafavomEd

•a1mEdmoo

-D7

/A5

,-(A

7)

Save

re

gis

ters

CMQ

rH

£01

i1ofar~EdCO*gi

COffl

moo

<s>

3C

0)

7!Q

OQ

VO

vo

3

0)

orHO0EdCM0CO

yCQtdmoo

CMroCO(U

-HEH

0Q

in=tt=

3

rHCOcd

o<3*mEd

0oEdinoo

0Q

4J

(U

OOCO^p

CMOEdinoo

in

0Q

01

o*3*

f^CM

«gi

OFdin0o

PQPMraCO

0)M

cd

CO

ACO3

m

Edo

=«=

•o•acd

wCdn00oo0fappavooEdin0o

, 13

(A

6)

Bu

ffe

r a

dd

ress

not

eve

n 1

0

4-1CO4J

Q0Oo00ooEdCMCOooO

m0o

CO0)

COQ

in

a>c.Q

tcp

ovovo

CMQ

m0o

Cle

ar

oddflag

0Q

3

HU

o53»

CM

*ji

Q

m0o

aryi

in

rdHX!

CMOOVO

voQEdin0o

er>rdrH*W

soJJ0)

CO

Oa

rH

tf

>0£

rHOOr—

COQ

m0o

0)

rdCO

•o

vo

CM1oQ

3

CD

EdfafafaO•a*Q

( JQEdm0o

4J0)01

OaCO•ts

in

CMCM

3

4-1CO4-1

VOf_Jooovon3J1*

EdQEdm00

CO

>H

in

0

.Q

(3jovovo

CMEdEdm00

en

(U

rd

a)COrHEd

oQ

a\H

tr>0£

01oor-i

Ed{V]

mo0

CO•oCO

in

CMCM

OQ

3

i0£

vof—4O0o*3*fflro

voEd

ino0

oa.CO•a•a

in

CM

oQ

3

0}

CO^ — Io0o*>rfflrof3JEdEdmo0

vo

rdj_iX)

Edm0oo0vo

EdEd[V]

moo

305

Page 313: Atari ST Internals

Abacus Software Atari ST Internals

C"

1 1

CD01

C31

<drH

•oTi0

J^

CD

>[ ]3

O

tJO CD3 CO

0101CD

T5T3id

CD>Mt-43

-P0!U

0

a01

•oG

tor

num

ber

oCD01

,—1ido-H

OrH

*.0GOCD

eld

s tr

ack

num

ber

-H>,o0,01•a

,

•o<D•o-H

-HQ

tor

num

ber

ofl)01

rH(JJ

o-H

OH

n.O

OCD

X0(0H4->

HCD0.

MO4->OCD01

—OP.01•a>1jQ

TJ0!•a

-HQ

ion

as

se

cto

r num

ber

1

01-H 4J> a-H M•3 T3

m ,GO 4->

-H

CD•O CD

-H <Q

(U OK CJ

rH

C7*CD

£_|

O

G<a4_>^4CD4J

CD

C3

0

•S-H03

rH

•8-H03

4->P.01•o[ 1

O<aj_i

^3CO

o*

4JCD01

O*<dH

•8TSo

rH

O4-)

M

4->G30U

4-1O CDS 03

HCD,Qg3G

HO4->UCD03

0!4-1 3Q. f^

01 -H•o s

r o

f se

cto

rs

CD43g3G

Aj j

•H

^CDM(0

&Oo

o>«

M(Q3trCD

^4o

^4CD4J<dCD^4C5

r equals

counte

r

w43g3G

JHO4JOCD01

0}4J 3O. Gra -H*O S

as

counte

r

01r-to4JUCD01

UHO

^4CD•§3K

^_^vo<CM1

Oofam<rt

oQ

CJmCMrHW-=B=

r0faLO<J>

OQ

„ ,vo<J

*—o\

Vi) Q

S ^vo vo1 rij*. ~--'

o trQ rH

vo ^Q Q

^-* <~*to vo<I f^l•fc— « -

VO CNJ «=? "O1Q CM rH Q

Q

^__^to•—CMCM

Q

^IO<J*^

ji <qiQ CM

COCMfam«•

oQ

OQ

mQ

enO

H m i n v o c o n o i nc M Q < < l n Q i n <fa •* — — fa -fa —

CM in rH in 'Q1

CM •«>

o vo o m co o voQ < «r < Q tn <

~ — fa — - fa —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 V ! > I O > > > 4 J > > 4 J > t O ! XC D O U O O O X - H O X - H S g, Q g , Q g g g C D ' O S C D ' O O l U

C D * * C D ( D * * C D ' C D? * . £ 3 4 J C 3 * r > ( O r * * Q P 1 < C O £ > f Q n J r *O 3 0 1 C D O r 4 O 3 g O > O 3 r 4 Og o i 4 J 4 ) S 4 ) g o i O 4 3 g o i 4 3 g

Wfafafalavop£•5P

CMfaWmoo

COo[ —vo

vofawinoo

CJpaCM

ooooUCOoCM

COfaWIO0o

•31

oovo

wfain0o

sCooo•wCMOCM

00fatooo

<fafafao"531

QCM

•vp

0fam0o

w0oowCMOCO

CO0fain0o

vooco•31

oofain0o

vorHOOQWQCO

wofam00

woooCMCOCO

CMrH

famoo

qlCJCO•3"

vorHfamoo

vorH00Q

G\O

COrHfainoo

"31r

CO•31

UrHfamoo

COrH0OQVOCOmwrH

famOo

•31oCJvo

CMCMfainoo

mCM^>•=rCMfainoo

vooovovoCMfain0o

rHOfQr-

COCMfatnoo

CO,_ t0oQVOCOen

<CMfatn0o

Mfafafa

vo*p

wCMfain0o

^por-voCM

fa0o

rHOVOr-IT

COfato0o

COrHOVO

voCOfato00

corHOoQCMOroCO

fam00

1•=POen

CJn1000

CMrHOovoo

wcofamoo

COoOvo

CM

fainoo

corHOoQCMVOco*3-^Pfamoo

^•3"VOCfl

CO

faIOoo

*?o0vo

<ifamoo

CMrHOO

CMVOcoCJ

fatnoo

306

Page 314: Atari ST Internals

Abacus Software Atari ST Internals

ent

se

cto

r #

(1st

num

ber

ea

d-w

rite

fla

g

S &HCD

0 WC 01M EH

poin

ter

^4ta"O MHcd MHCU 3P5 CQ

bu

ffe

r a

dd

ress

CQrH

3 I

tr <[V] J

ad

dre

ss

ation

a

dd

ress

CU GO -HH 4J

n p CQ1) O CUH to Q

MO M H4-1 CU CUO 4-> M 4-1CU C O CCQ -H CQ 4-1 -H

O >H O Ofa a o cu a

4-1 01

& U CU CU T3 OO <fl CQ MH Cti <dO 4-1 MH 0) 4-1 CU

CQ MH 3 M CQ 'o- O X) O

>1 4-1 K 4-1 00 , 0 ^ 1 n S H M M Oo <D ro _ V O < D < D O : S < U H4 - l S H . Q C U O 4 - l > ' H 4 - l Q . > H O C » .C Q M E T J C d O - r - l r H O O M r lr d O P - H U C U H - H C U r H O S H XM H C J S C O E H t O Q f a t O M H C J H O

y,

ve

rify

re

quired

?

MH-H

(U0 >j2 n \f sectors

CU

0 3S S

•3-Hto

yO

(HEH

inO CU4-1 >U -HCU H

CO Q

rl

CU

3

-Hfa

bu

ffe

r

r,

ve

rify

se

cto

r

H CU0 >4-> P.O O0) rH

CO MH

Q

S

•S1•o(3

vo

CO

4-1CQ

4-1

COQr.

m

cr0)X!

oQ

VO1

mo

ve

,

0Q

VO

o

1 — I

0

r-

in

crcuX)

Co

vo1

mo

ve

,

i

S

o

mo

ve,

orH

m

MB-n

c-

rH

1<a

1coQ

S

mo

ve,

imQ

mo

ve,

r-

1

voQ

S

mo

ve

,

I

•a-Q

mo

ve,

i

vorH

S

mo

ve

,

i

»HrHO

1

VO

vo1

rH

mo

ve,

0CQCOvo

M

-n

r-

ot — i

=tt=

•o•ocd

r-Q

OQ

rH

mo

ve,

voQfa

Q <o

4.1 CUCQ C4-1 .Q

VO•5T Qr fa

4-1 trto 0)4-1 X!

SnQ

S

mo

ve,

iinQ

3

mo

ve

,

r-

I

voQ

mo

ve,

i

Q

mo

ve,

i

vo

vorH

S

mo

ve,

~

i

( j

HrHO

1

aCMrHVt

rH

mo

ve,

CMovovo</}

tn

00

5F

50

52

44

005F

52

4A6E

0008

005F

56

67

00

00

80

005F

5A

202E

FF

FA

005F

5E

BO

AEO

OO

A00

5F62

67

10

005F

64

2EA

EFF

FA0

05

F6

8 2F

2EO

OO

A00

5F6C

4E

B90

0005

910

005F

72

58

8F

005F

74

3E83

005F

76

3F05

00

5F

78

3F06

005F

7A

3F04

005F

7C

3F2E

0010

00

5F

80

42A

700

5F82

2F

2EF

FF

A0

05

F8

6 4E

B90

0006

3BO

005F

8C

DFF

CO

OO

OO

OIO

005F

92

2EO

O00

5F94

4A

8700

5F96

66

3E0

05

F9

8 4

A7

90

00

00

44

400

5F9E

6

73

600

5FA

O

3E83

005F

A2

3F

05

005F

A4

3F

06

005F

A6

3F04

005F

A8

3F2E

0010

005F

AC

42

A7

005F

AE

2F

3C00

0012

BC

005F

B4

4E

B9

00

00

66

02

307

Page 315: Atari ST Internals

Abacus Software Atari ST Internals

014-1c;

-rH

oaJ<o104Jw.JJy01J_)J )ou

CDT30O

j^O 0-

S-t .***!w o

H01

UHIH3JP

04-1O

O 01z, en

4JC

-H

O0OCO

o4-1

!H01

0!4JC-H

IDCOOCO

4-1£_|

0)>oo

^-rH

CM3

jj03-HrH

IHO4JO0)

*o<0pa

o-

O

0}M04-1O01en

01o4-1O0!to

•o(Q

ffl

01MO4JU0!taIHo

0)

p

01M 4-1O C4.) -H

a; a o>M T3

0) T) O OIH <o <aIH 0) 4-1 M

H M O5

H0)

•acu!H-rl0101•a

M 010 4-14J GO -H(U O0) P.

X O O J f f l O H O )

•a o•a -H<0 4-1

cuo

a oO (0O 4J

O]

. 4-1a uu 014-1 SHw H<fl OIH O EH O

01 M> O

--H H)H r)Q W

OQ Q

CJ«> PQQ CMfa rH

M.

•oT)<U

H

01>Og

rH

•4-1014-1

0)C

01>oE

Q 10 rH —

o mQ «•

OVD

4J ero

r-

O

s01

og

r- r~

I i<s "s

Q Q

3 3

0) 01

o og g

r-

l

Q

s01

Og

1

Co — ,

vo —rH 1

S

01 •

0 rHg 0

1

Co c<c c— rV£> U

1 <-

rH

i >O le -'

M -a oSI rH3 </>

* =*=

H -da -O-i <0

0Q

Q £C

O VOQ 1

H M

(U 01> >0 0g g

0Q

ID CM

— 0O VDrH </>

<i trg 01O 43

--- c^

O VDrH 1

rH rH

0) 01> >o og g

o t-rH f£a\m <=P</> =*

rH

tfH TS0) 13-n tfl

COCMO

Q «>

4-1 Ol01 CPI i _Q

VD O< Q

VD t^rH Q

15 rH

? §O OE g

oooooocj ofa ofa W

r~ o00 rH

CJmCMrHCO COO CTlO CMO OCJCQ

O O CM O rfjO W O fci COrH |< I— W O

nCOW

O O O CM

CM OQ rHCM OXD O

< O Ofa O Ofa o ofa o o

r^ w en cj<C CM pa faCM fa W fa

ooo

<ooo

orHen

< ofa o o

o

P 3 C J O C J C J C J Q Q Q Q

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

308

Page 316: Atari ST Internals

00601C 3FOO

00601E 4EB90000555C

006024 548F

006026 2EOO

006028 BEBCOOOIOOOO

00602E 6700FF22

006032 4A87

006034 6C04

006036 2007

006038 601E

00603A 3003

00603C 48CO

00603E 7209

006040 E3AO

006042 D1AEOOOA

006046 D76EOOOE

00604A 976E0012

00604E 4A6E0012

006052 6600FE9E

006056 4280

006058 4A9F

00605A 4CDF20F8

00605E 4E5E

006060 4E75

move.w

jsraddq , 1

move , 1

cmp.l

beqtst.l

bge

move . 1

bra

move . w

ext.l

moveq . 1

asl.l

add.l

add.w

sub.w

tst.w

bne

clr.l

tst.l

movem , 1

unlk

rts

DO,-(A7)

$555C

#2,A7

DO,D7

#$10000, D7

$5F52D7$603AD7,DO

$6058

D3,DO

DO#9,D1D1,DO

DO,10(A6)

D3,14(A6)

D3,18(A6)

18 (A6)

$5EF2DO(A7)

+(A7)+,D3-D7/A5

A6

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

006062 4E56FFFC

006066 4AB9000025FA

00606C 6616

00606E 2039000004BA

006074 7210

link

tst.l

bne

move . 1

moveq . 1

A6,#-4

$25FA

$6084$4BA,DO

#16, Dl

On stack

Critical error handler

Correct stack pointer

Get error code

Attempt again

?

Yes

Error code

OKError code as result

I65

Sector counter

Times 512

Increment buffer address

Logical sector number plus counter

Decrement number of sectors to process

Sectors yet to read/write ?

Yes

OKRestore registers

random, generate random number

Last random number

Not zero ?

200 Hz counter

w23I-HaI-!*CDB5T1

Page 317: Atari ST Internals

Abacus Software Atari ST Internals

roI

vorH

O4-1

mrH1

O

CO.p-HCQ

z co

un

ter

JT{

0oCM

COprHCM

0)3

i— 1CO>

4-1

ffl4-1CO

COrd

01COD

iHCMvoCMeninrH*3*rHCO

<DPrH<0>

EO•oCCOM

4-1CO(0

t m

ultip

lication

-H

CMco

*CMCO

>Hffl4-1G-H

a*orflJJCO

4JU01}q^too

rH

COrj

rH

0.

4-1rH

PCO

0)K

01PrHm>4J

104-1CO

5

01G

CO

O

COCM

O4-1

031

rHCO

CO4-1-Hpq

COCU

CO(0

SH(D*Q

p

o•ocCB

4-1-H

|i

CM

OQ

I

QCM

< VOfa PJm o »CM -sr <

CQ fa

oQ

1f=C ofa QinCM

^ CQ •> CQ moQ

^ K in

O fa

fa a fafa

CM en CO rH O CM CO

00

60

76

E3A

O0

06

07

8 80

B90

0000

4BA

00

60

7E

23

C0

00

00

25

FA

00

60

84

2F3C

BB

40E

62D

00

60

8A

2F

39

00

00

25

FA

00

60

90

4E

B9

00

00

94

FA

00

60

96

50

8F

00

60

98

52

80

00

60

9A

2

3C

00

00

02

5F

A00

60A

O

20

39

00

00

25

FA

08

03

9

V0

90

0 00

60

A8

CO

BC

OO

FFFF

FF00

60A

E

4E

5E

0060

BO

4

E7

5

***********

bootload,

load

boot

se

cto

r

**************************•Je

*******

**

***

O

*,VOfQ

^s/*

G-HrH

0OOOVOmw•a1

CMCOovo00

CO

0)4-JCO

-Hen(U

<fltn

1

[—Q|

voQ

rH

•s01

0e

0oCOoc—paCO*T

VO

PQovooo

4-1-HG-H

•o

CMCOenm

HCO•n

CMCOenmoo00enCQpa•a1

P^CQoVOo0

COP.0rHMHG

VOf£•&

u•

CO4-1

VO

<^•a1oooooenr-(r

oCJ0vo00

o-

•o<uti<D

GOo(U

-HM•ooB

CJoovo</>

tra43

or-vo

vooovo00

T!10orH

4-1

•aHPOU

0Q

M.

rH=*£

rH

•CT0)

0e

oor~

CO

Uovo00

wCJ0vo</>

(0

£

CMOOVO

*3*CJoVOoo

<u-Hr<•ooG

oQ

h.CM

rH

•tr01

oE

CMOOr~

CJCJ0VOo0

COM0HSHQ

§10

CO

r-Q

*.oQ

Jj;•

(U

ge

oopatof-1CJ0VO00

CO0,orH

G

VOrt.

</>

5s•

4-1CO4J

VOf£«giOoo00cyi

f3^SP

oQOvooo

1C $4

46

bootd

ev

rH "•VO CM«> =**=

8" t& o

vo•c1ji0ooooCMO0o

^S1 CTt

r^ CJvo o

VO CO

D Qo oVD VO0 Oo o

c^

a4-14-1<DXCO

-H•a0•z,

CJrHrHVO</>

tuo>

nCJvo

owovoo0

04-100)CO

<ao

*., — ]=*=

3

(U

os

rH

0oo

MwCO

CM

OVO

oo

o

•rl

r-ri^^-*I

3=

rH

U

r-voCM^P

VO

paovooo

0

ora

EH

(^

1

sM

U

VOCMSP

COpaovooo

310

Page 318: Atari ST Internals

Abacus Software Atari ST Internals

o4-1O0!CO

4-1OO

r)O

nd>

M 4-1O C4-1 -HO OW ftCO

i-J XCU T) Om <a usMH 0) 4-1p Vl «43

S-l TJ OM CU M _O t3 CU O H CU M

t5 $CU OW 43

tJ & ^ °

CO M-l CJ

M VIO !-l

CO34-1'<d4-1CO

43<d•O

(U-aoo

o

CU

T3rH

O

4JCU

raT)J_)

O

O0rH

CU<Ht-(

J^j_!

O4-10CU

gPCOv;O

J5O

CU4-1(0

porH

<8

MCU

G-HOft

"u(04-1CO

4-10CU

H0

gCOyO0)

0

JG4-1-H

CU

<SftgO

c*»rH

(Q3trCU

4-1o</> 03 CJ O CJ

0)CO

o

•a-Hi-H(0

OG

CU4-1CO-r|

encu

Mo4-1CO(U

<1

rH

sCU

og

r-

iVOJ1

^p•CO-

•CU

og

r-

—i

rH,

rH

O

r-

I

CO CMCM QrH CMTO- VO=N= TO-

rH

CU

o wg -r-i

<orH

*

rH

•T3•am

0Q

rH•

4-1CO4-1

OrHrHVOTO

01G

43

i—D

J5•

HrH

O

CJrHrHVOTO-

n)n43

^31f-^voTO

43

4-1CO4-1

orHrH

VQ

TO

CUG43

oQ

CO

rH

cTCU

0g

o•31

rHVOTO-

<d

43

r-Q

S

4-1CO4-1

<3-CMrHVOTO

cTCU

43

oQ

r^Q

•(U

Og

o•=prHVOTO-

<0

^143

!—

00rHTO

*

jj•

CU

Og

r-

— 01 Q

O ^Ppq vo r- co WCM CO rtj CM COrH CM N rH rHTO- VO *sp TO- VO=S= TO- =8= =8= TO

rH rH

• • &cu tr •O CO T5 g Gg 43 <0 O 43

OQ

Q•>

H-

00

01

00

00

04

46

cj en r-co ro <;f'l f"l CMn co CT£C &j CTW W fao o oVO VO VOo o oo o o

00

00

12

BC

00

00

62

D2

cj enco Bfa p£iCM -a-

vo cjfV , fV ,

0 0VO VQ0 00 0

00

00

00

10

O o -=rPu CO Ofa < VQQ «3» VQ

CM 00 (<O O OrH rH rHVQ VQ VO0 0 00 0 0

r- O

CM O^31 VO

CJ Wo orH rHVO VOO 0o o

00

00

06

74

o\CO O<. VO*3< VO

O VOrH rHrH rHVO VO0 Oo o

CO <3>O CMO Or- vo

co ffCrH rHrH rHVO VOO O0 0

P- «3**3* OfS, C-•3" VO

CJ WrH rHrH rHVQ VOO O0 0

r- OO rH0 OCO VO

O CMCM CMrH rHVO VOo o0 0

0100

00

00

12

BC

O CJP3 ro

CO CM

•3- COCM CMrH rHVO VQO OO O

VO "31

o corH CM0 rH0 (k. CJo co r-rH CO OVQ m pq

M CM CTCM CO COrH rH rHVO VO VOO O Oo o o

CT O CMO CT OVO CM OVQ CT VO

co <; cjCO CO COrH rH rHVO VO VOO O Oo o o

0COoo

CT fa fao en Q0 < CJ

w o CMCO CT "SPrH rH rHVO VQ VOO O O0 0 0

311

Page 319: Atari ST Internals

Abacus Software Atari ST Internals

vo

M MC P3 IM

W LOto c—W H

VO COT -a1

vo vo0 00 0

****

****

****

****

****

****

****

****

****

****

****

***

pro

to

bt,

g

ener

ate

bo

ot

secto

r

****

vo

VQ

C

•H

EnEnEnVQm

•0<

vo00

E 48

E70

704 m

ovem

.l

D5

-D7

/A5

, - (

A7)

Sav

e re

gis

ters

^pvo00

ocuXo4Jffl01

EH

CO

4J01

CMtHOO

\

CMIT)

VOOO

-H

-HftIB4J3U0)

<uG

-Hrd

G-H

S

VOr-rHVQ

CD

ft

W

CJ

VQIO

VOoo

COT5

0

o0rH«•

r^

ooVt=»=

0)

0

oooCJfflW

CO10VDo0

C

2F

2E

00

08

mo

ve.l

8

(A6

),-(

A7

) A

dd

ress

o

f th

e se

cto

r b

uff

er

LO

VDO0

0 61

0000

D4

bsr

$6

236

Calc

ula

te

chec

ksu

m4

588F

ad

dq

.l

#4

,A7

Co

rrect

stack

po

inte

r6

B07

C12

34

cmp

.w

#$

12

34

, DO

Eq

uals

ch

eck

sum

fo

r b

oo

t secto

r?A

67

04

beq

$6

17

0 Y

esC

42

40

clr

.w

DO

N

ot

ex

ecu

tab

leE

6002

b

ra

$6

17

20

70

01

m

ov

eq.l

#1

,DO

E

xecu

tab

le2

3D40

0012

m

ove.

w

DO

,18(

A6)

ex

ecfl

g to

1

=

b

oo

t se

cto

r ex

ecu

tab

le6

4AA

EOO

OC

tst.

l 12

(A

6)

Seri

al

num

ber

A

6D3E

b

it

$61B

A

Neg

ati

ve,

do

n't

ch

ang

eC

20

2EO

OO

C m

ov

e.l

1

2(A

6),

DO

Seri

al

nu

mb

er0

BO

BC

OO

FFFF

FF

cm

p.l

#$

FF

FF

FF

,DO

>

$F

FF

FF

F

?6

6F08

b

le

$6

19

0 N

o8

6100

FE

D8

bsr

$

60

62

ran

d,

gen

era

te

rand

om

nu

mb

erC

2D

4000

0C

mo

ve.l

D

O,1

2(A

6)

Sav

e0

42

47

clr

.w

D7

Cle

ar

co

un

ter

V O V Q V Q V Q V Q V O f — r * - E ^ f ^ r " - C O C O C O C O C F *< — 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 — 1V 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 Oo 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

fflvoVt

CO

oCMovo

CM

iHvoo0

n4)•g3G

o•a(!)&,

oQ

VQ<CM

cuog

o0ooCM0CM

enr-ivo0o

8 C

OB

CO

OO

OO

OFF

an

d.l

#$

FF

,DO

Bit

s 0

-7E

32

47

mov

e.w

D

7,A

1

Po

inte

r to

n

ex

t b

yte

in

b

uff

er

a\n

vo voo oo o

312

Page 320: Atari ST Internals

Abacus Software Atari ST Internals

ddre

ss

of

serial

num

ber

in

bu

ffe

r

(0CD

M >!<a 43

CD01 4JP -HrH M

PH S

4J

-H

01

-H43

CO<D

4-> 3

-H Id

!H 010) 3

43 O CD

g 4J G

G r-l CD0! >

g T) IdO r-) O]T) 0C TSId G G05 M <

ounte

r 1

copie

d already ?

|

o m(ai i 1 1

G >iCD 43g(D d)M 0)O iHG JSH H

CD

Gido4J

0) GN O

-H TS01

0) CD4J >4J -HCD 4JX Id01 bi

O -r) 0)

IS Q S

1

uals

poin

ter

to p

roto

typ

e

BP

B

|

-H tr01 CD

0 CTl4J rH4->CD 01

•3 §-H -(HQ EH

CD4JGPO0

HOCD

O

01

1H

0)

MHO

0101CD

•aM TSCD id4JG 01P 3O rHCJ CU

the p

roto

typ

e B

PB

"M0

CQol PL,to rqCD

TS P.TS 0<c o

ounte

r•>

o4J rHGCD >ie TICD idH CDO HG rH 0H < IS

0101CD!H

TSTS<dH

CD

H-l3ca

om b

uff

er

|

SHin

T)

oJ5

,CD13

cksu

m genera

tion

CU

O T)i!H O0 gm

S XP CDco s

, .

\Q CO

^ FT3"•— ' fHVO VOi-l •«>

&

-P -PW <H-P .0

VOQ

, — ,VOfQ

~—VOrH

S

CD>0g

VOQ

(T)

rH</}•

*

3.

•0}rH3g

CM

rH[— VOQ •«>

J5•

M <drH r-lO ,£5

Of£

K

r-Q

3

*

Q)

OS

o*.

^-*VOrij•*-»CO

rH•

T!T)

rH

«,VOQ

g.•

0)•>Og

rHs5

00pVOrH«•

*

rH•

T!•o<d

o

rHrH

*., ,

rH

1* —

CD>Og

VOQ

rH

S

cr*TSTSid

[—Q

rH=«=

35•

O*TST!id

r-Q

rorH</>=»=

.3

fi»gO

OCJrHVO<0

.prH43

^^VOi C-—VO

1

J5•

<»_)rH

U

VO

1, ,VO

5CO

rH•

CD

O

CMOCMVO<0

id

43

o

^_^VOft^1

1

H*

Q)r*Og

0Q

«t_^,O*^3^^

gCD>0g

VO

~"VO

1

0Q

5:•

TSTS<d

Co•«--<pIK

CM

*

rH•

CJ1TSTS<d

O —rH — Q VO< rH v <

s~. — v o o c M r - Q wV O C O t < C Q r H Q s O T(£, •* *-" *. ". *. CO rH "^— O CM CO O rH V.CO Q rH =tfc Q 4t= =S

43 H rH SrH • • rH - • |5

• CD CD • CD CJ* •T ) > > J H > T S Q , 4 J• O O O M O T S g r H< d g g l d g l d 0 4 3

O CJO PL,

Q feVO tty

c o c o c j u o o on co r H C Q n R C C O o < OO O O O O rH rHrH O OO rH h j O tn fa ft,O O O O O O OO O OO O h O fa P u f J HOOO O O O OO O OO O feO Pn fali iW o w o o i ^ O i < W c o p £ l c J r - v o r ^ H v o c J r H V o r ~ o i ! r H P J W P t 3 0 i a i aC d ' < 3 ' C M C O ' 3 ' c I ' ( ^ Q V O C M C \ l f c ) ^ r r H « ' K I ' = P | i j i r ) ^ i ' « ' r - - t i 5 V O V O O V O r H V O S ! ;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 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

313

Page 321: Atari ST Internals

006202 202E0008

006206 DOBCOOOOOIFE

00620C BOAEFFFC

006210 62E2

006212 303C1234

006216 906EFFFA

00621A 226EFFFC

00621E 3280

006220 4A6E0012

006224 6606

006226 206EFFFC

00622A 5250

00622C 4A9F

00622E 4CDF20CO

006232 4E5E

006234 4E75

move . 1

add.lcmp.lbhimove .

wsub.wmove

. 1

move . w

tst.wbnemove .

1addq .

wtst.lmovem .

1unlkrts

8(A6),DO#$1FE,DO-4(A6),DO

$61F4

#$1234, DO

-6(A6),DO

-4(A6),A1

DO, (Al)

18 (A6)

$622C

-4 (A6)

,AO#1,

(AO)(A7) +(A7)+,D6-D7/A5

A6

Buffer addressPlus

$1FELast

word already

Checksum for boot

sectorSubtract

from previous value

Checksum in buffer

execflgBoot

sector executable ?

Increment checksum, not

executable

Restore registers

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

006236 4E560000

link A6,#0

00623A 48E70300

movem.1 D6-D7,-(A7)

00623E 4247

clr.w

D7

006240 600C

bra

$624E006242

206E0008

move.l 8(A6),AO

006246 3010

move.w (AO),DO

006248 DE40

add.w

DO,D7

00624A 54AE0008

addq.l #2,8(A6)

00624E 302EOOOC

move.w 12(A6),DO

006252 536EOOOC

subq.w #1,12{A6)

006256 4A40

tst.w DO

006258 66E8

bne

$624200625A

3007 move.w

D7,DO00625C

4A9P tst.l

(A7)+

Calculate checksum

Save registersClear

sum

Address of the

buffer

Get wordAnd

sum

Pointer to next word

Number of words

Minus 1All

words added already ?

NoResult to dO

s.n3Mvf

Page 322: Atari ST Internals

Abacus Software Atari ST Internals

CO

0)4-1CO

-H

0)rH

01

O

CO01

con

ver

t 80

86

num

ber

to

6800

0 nu

mbe

r

K

-HCM3

rH

0>f>

3C

01fl 0)

oCO OlCO -rH

0) fl

•Q 4-1T3 01fH C5

ini

CO

cr- O

1 -rH•U 0 4->H -rHO CO CO3 4J 0

-H ftO Q4-1 G

0! -rH•O 4-1C CO 4-101 rH MH

4-1 O -rHX co flw M sn

rH

0)X!

3G

01 13

4-1 O! O4J S

0 X! 0

co 3co o •O01 H C

i3 4-1 4-1•a 0) x< o w

m

ico

CO[~- 4-1

O Xi

CO jG4-1 4-1-H -H

0! 014-1 GIB -H

rH X}

O SCO OM O

ini,

in

itia

liz

e

driv

e

ftorH

MH

01

-H

"O

ffltoP

04-1

0)4-1

-H e>«Oft <

- 010 >f> -HCO rH

•O P

ffl0)

-HM

TJ

0rH

MH

fflCO

P

0)

<84-1

K

rHCO X!0! COx -o

ra

te

1u

lt

erro

r nu

mbe

r |

X ffl01 MH0! 01CO P

k nu

mbe

r to

ze

rolo

ck

, se

t p

ara

met

ers

ct

driv

e a

nd

sid

e

0 ft fl)10 O rH

rH rH fl)

EH MH efl

01rHO4-1CO0)rH

P

-t-

rH

e"01

o

oCOOOEMP0

f£]mCMVOo0

VO

rH COC 4J3 rH

w min r~[V} [V]

•31 T

CM rVO VOCM CMVO VO0 0O 0

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

HtHtHt.£

HeHeHeHeHeHeHeHeHt

*HeHeHeHe

*HeHeHe

*HeHeHe-3c

**He

•ST1

G-HrH

U

EM[•-!

VOinw

VOVOCMVOOo

0

VO

00

rH

ios

COooowVOoCM

rt^VOCMVOO0

0P

o

rH

01

O

rH

Ooo00CMOrH

E£]VOCMVOOO

OP

3

4-1X01

oCOCO•3*

<Mr^CMVOoo

oP

En

3

•oG<S

fi.,EMOoOoCJ

I1

[ —CMVOOO

0PCO

3rH

CO

(0

o«3*rHW

00[-~CMVO00

rH

VO

CO

rH

iso£

COooorv]VOCMCM

<J

[ —CMVOOO

rHP

rH

X)

01

o

rH

rH

CMrH

pqr^CMVOO0

rH

P

S

4-1X01

rHCOCO«gl

oCOCMVOoo

rHP

*sExEM

«*•

3

73C<0

EM

0OO

CMO

CMCOCMVOO0

oPrH

P

2=

MO

rH•5TOCO

VOCOCMVOoo

VO

rH

G3

[V]

inia

COCOCMVOo0

CO4-1rH

mH

(djCOCMVOoo

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

HeHeHeHeHe

**HeHeHeHeHeHeHtHt

*HtHeHe-}eHe

HeHeHeHeHeHeHeHeHeHe

COCJVO

<001rH

COOVOooo00enCMCO*r

CJCOCMVO0o

r—

CMrH

JCO4-1

CJO00EuVOf£^p

CMenCMVOoo

enCMVO

tr01A

VO0r-vo

VO<nCMVOo0

rH

CJCJVO

cfl01rH

OCJVOooo00enEMn

COenCMVOoo

rH

CM

O

>Os

CM0OOOsr*T00oooen!—mrowenCMVOo0

0PrH

1

=s=rH

eyCDos

EMEMoP^

VOfQCMVOOO

rH

O

JS

rHrH

U

0oooenVOCM

CO*3*CMVOO0

COVOr-vo

w

COQ

fflooorHVO

O

CMVOOo

CO

envo

rHCOX)

VOenvo000rHVO

OmCMVO00

rH

O

ooEM

=*»

3

ioe

o00000

EMCJ

COCO

<=rfflCMVOOo

PCOVO

rHCOX)

COrHVO000rH

VO

<;

fflCMVO00

P

VO

rH

ty>oE

vooEd

CM"fflCMVOOo

315

Page 323: Atari ST Internals

Abacus Software Atari ST Internals

CMVOCOVOCO

COXI

o<^in0ooT— Ivo

oCJCMVQOO

OCMVOCO

cucX)

COovovo

•a*CJCMVOo0

cuno4-1COcu«

QCOvoCO

t-lCO

•°

CJoVQOOOf— 1voVQCJCMVOOo

n0t-lt-lcuoc^

Xoftom

woCOvoCO

trcuX!

CMJ1

inooot —vo

<CJCMVOOo

t-lo!-lHa

«•.,-H-Hni

4HftO

rH

H-l

oO03VOCO

(0

XI

oCOmoooovo

HCJCMVOoo

r***

****

****

****

****

fl

op

rd,

read

se

cto

r (s

) fr

om

dis

k

T*

*-X-X*

-X*•X•X*•X****•X*-X•X.£**•X**•X•X•X-X**

cuen<aO

CO-H•o

O

4-1CO(U4-1

CUtnCIB

CJ

CMfaenvoCO

wa

fV]rH

[ —OoorHVO

CMOCMVOo0

I.I

#-1

1,

DO

Err

or

num

ber

to

read err

or

V

£oE

infaor—voQCMVOOo

$676

8 fl

op

loc

k,

set

para

mete

rs

t-iCO

•°

co03^TOOOrHVO

03QCMVOoo

CO•o-H

CO

•oGIB

CU

-H

-a4-1OCU

cuCO

CO

voCO

HCO

A

p£VOvoooorHVO

OQCMVOOo

$68A

E g

o2

track

, se

arc

h

for

tra

ck

MCOX)

0CJmooorHVO

OCOCMVO0o

0t-lS-lCO

-H

C

re)

EH

VOr-covo

COcXI

oen0ooovovo*giCOCMVOoo

,w

#-l

,$6

A2

cu

rre

rr

to

de

fau

lt

err

or

cuoE

CMf£VOo0ooofafafafa0

COCO

COCOCMvooo

CO

4-1CO4-1CO

Q

ISCU

rHO

vo"<c

0en

<*

>oE

oen0oCJpaCJCO

ofaCMVOOO

Oen

3CU

0E

oenrHoCJpqCJCO

*yfaCMVOO0

,w

#$

90

, (A

6)

Dat

a d

irecti

on

to

RE

AD

>oE

oen0oCJP3OCO

COfaCMVOOo

,w

$68C

(A5)

,$F

FF

F86

04

cco

un

t to

d

skctl

, se

cto

r co

un

ter

cu0E

spovoCOfafafafaOCOvooQHCOCO

CJfaCMVOOo

CMr-r~rH

Ho

1H

•oIB

ooMO4-1OCOCO

•aIBCOK

Co<

OCO

•»

%oe

o030oocaoCO

^poCOvooo

,w

#$

90

, D7

Rea

d m

ult

iple

cu0E

oen0oOCOPOCO

COoCOvooo

$69C

4 w

dis

kctl

, p

ass

D

7 to

17

72

MCOXI

vopavoooorHVO

CJoCOvoo0

cu4-1

3OO

4-130

-H4-1

CON

IB-H4-1-HCM

Q

00OO

rH

CU

oE

OOOO^PO0oCJcoCOCM

OrHCOVOOO

, 1

$6

92

(A5

),A

2 ed

ma,

d

est

inati

on

ad

dre

ss

for D

M.

§oe

CMenvooQvo•3*CM

VOrHCOVOOo

#5,$

FF

FF

FA

01

mfp

g

pip

, 1

77

2

do

ne

?

4JCO4JX)

rHOpjj

fafafafafaino0oenCOCOof^rHCOVOoo

COCO

COinCOvoCO

ercuX)

•31COr-vo

CMCMCOvooo

, 1

#l,

D7

Dec

rem

ent

tim

eo

ut

co

un

ter

erXI3CO

r^COCOm^jiCMCOVOOO

4-1

O

•o

-HEH

CJ

COvoCO

cr(UX)

^rCM

( —VO

voCMCOvooo

,b

$FF

FF

8609

,$69

D(A

5)

dmah

igh

cuoE

Qenvooen0voCOfafafafaenr^pa

COCMCOVOoo

,b

$FF

FF

860B

, $69

E(A

5)

dmam

id

§oE

COenvooeaovoCOfafafafaen

t—parH

OCOCOvooo

,b

$FF

FF

860D

,$69

F(A

5)

dmal

ow

cuoE

faenvooQ0VOCOfafafafaenr^parH

03COCOVOoo

L $6

9C(A

5),A

2 C

urr

ent

DM

A

ad

dre

ss

eq

ual

edm

a?

fteu

CJenvooQPOinpao•31

COVOoo

$631

A

No

, co

nti

nu

e to

w

ait

4JtnX!

*3*QPOVO

vr^rCOvooo

316

Page 324: Atari ST Internals

Abacus Software Atari ST Internals

t,

en

d t

ran

sfe

r

COCO(DK

err

to

ti

meo

ut

^ii-io

t,

en

d t

ran

sfe

rt

nex

t at

tem

pt

ct

DM

A

statu

s re

gis

ter

statu

srr

ror

?tr

y

agai

nct

1

77

2

statu

s re

gis

ter

kctl

, re

ad r

eg

iste

ris

ola

te

chec

ksum

u

nd lo

st d

ata

ok

, n

o err

or

its,

d

eter

min

e err

or

num

ber

ycn

t to

se

cond

at

tem

pt

?

CD >H 0> T3 * CD CO -. Q, £> toe o r d r - H < B i < c o . - | - i - | f a O ! - l 4 - lCD i ' Q) CJ) IS Q) Q) "(5 S2J ' — 1 to Q) {P5 w w pi Q >H tfl M K I-l CD M E

ek,

hom

e an

d re

seek

ycn

t,

decr

emen

t att

em

pt

cou

nte

rhe

r at

tem

pt

?fl

op

fail

Q) M 4-)CO 4J O -

3 (D (!) G O3 to M < 2

its,

1

77

2

statu

s in

err

or

num

ber

&i-ito0)

e p

rote

ct

?

.p-H

1&CO(D>t

•o3O

c•ao0CDK

err

or

?

« OQ) PH>H O

ra0)

rro

r,

tak

e d

efau

lt

err

or

CD4-1CD•o

CMenvo

COJO

voaoooi-HVO

vo^p(Ovooo

CM

VOCO O>

n CMVO |

0)rd >to OX! £

CMr£VO0wpLj

pE-t

ft|

CJ CJO r-O COVO CO

fiC 0•31 ^1

co covo voO Oo o

CMenvo

^_iCO

J3

fS^oooo(HVO

CMincovooo

vor-

vo

rd^_)A

H

OVO

vomCOvooo

vort

0en

0)>O£

OenooCJ

c )CO

COmCOvooo

0Q

io

CD>O£

vorHOCO

CJmfT)

voOo

0Q

O

4-)CO4-J.Q

O0ooooCOowI/)(0vooo

vo

covo

tr0)

CMrHr^vo

CMVOCOvooo

<

0CO

*

CD>Og

oCOooCJmCJ

•3*VOCOvooo

COQenvo

£_lCOA

iavovoooo.-Hvo

COvorovooo

oQ

CO

•acrd

COf — (

ooCJ(OoCJ

CJvoCOvoo0

0COvo

trCDA

CJen^pooot~vo

or~COV0o0

CO

vo

^4COA

COt-txHVO

•sP

( —COvoo0

in

CMr-vo«•

*

fV

gCJ

CMI—VOor-)

0ooQVOCJoVOp-COvoo0

CMCOcovo

CDG

•3"ovovo

CJ1—COvooo

vo

i-lCO&

rf.

«EPoooj-Hvo

p=3p-COVOoo

in

CM

vo

*

tr£>3ffl

CMr-vooQVOCOin

CMCOCOVOoo

OQCMVO

,-\.

A

•ejilO

&4oorf*vo

voCOCOVOoo

ooCOvo

rd^4JQ

<Ff-~

^POooovo

t£cocoVOoo

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

**¥¥

¥

****¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥

<H mQ rH rH (3^ 0 < Q O r t Q O r t —

C O Q < - Q < ^ Q < OrH » . C O C O s C O ' S T s f O r t JI VO VO I -31 VO I CO VO VO

tr tr tr> a CD > co CD >o - u q o p c o pg £> f> £ A f t g £>

m tr >CD OrQ g

v o ^p n oo o o <o o o voO O 0 0

C O O « 1 C O O C J C J O ' 3 ' Qp t t O t - H f i ^ O O P ^ O O C MC M C O V O C M C O V O C M C O r ~ C Mt — o v o r ~ o v O r ~ o v o c oW O - a ' V O c o c j W O ' a ' V Oc o e n e n e n e n e n e n ^ i e ^ r ^c o c o c o c o c O f O c o r O f O c oV O V O V O v O v O v O v O v O v O V Oo o o o o o o o o oo o o o o o o o o o

317

Page 325: Atari ST Internals

Abacus Software Atari ST Internals

SH

0)SH

3CJ

01

m

CM

vo

Q

s0)

oe

CM

VO0rH«qi

cnCO

<<5COVQ00

CO1 1

H

inr^Wr

W

COvooo

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

flo

pw

r,

wri

te

se

cto

r (s

) o

n d

isk

*-X-X-X•X•X

**•X•X•X

***•X•X

*•X

*-X•X•X

*•X

*-X•X•X•X•X

*

(U

cId

o

CO-H•oSHo

4-1

Q)

G

CJ

CMfa

VO

SH01

0

VQ0O0rHVO

OfflCOVQ

00

j.l

i-10,D

O D

efa

ult

err

or

to w

rite

w

rro

r

w

§os

VQ

faof-•T

mCOVQO0

COSHd)4-1CD

idS-lCDa4->CD01

XOOrH

aorHHH

COVOt—vo

01

43

offl

0o0rHVO

VQ

CQCOvo00

O'rH

SHfl>

G

o

oCDCO

OtuCOO

0Q

COCOvo

CD

oe

COCOvooQCM0to

<ratovoo0

oQ

rH=tt=

er£jCO

o•3*COm

Hffl

vo00

o

d)

Ci

OCO

4J

0caSH

O

oQ

in

voCOvo

s^O

voCOvooQVO0CO

ooCOvooo

o

CD•a-H

CO

co•a-HCOO

OQ

in

<COvo

s.£-1o

COvo0avooCO

•=pCJ

vo00

o

oa>CO

0o43

1*,

o

oQCOvo

(Uc

vo0vovo

03CJCOvooo

0)

Ioid-HTJ<Ds

0Q

CM

rH

pHU

os

CM0oc—f£oCOVQ0o

d>SHpin

2

04->

4->0)

CO

CM

VO

01

43

CJmvooo0rHVO

OCJtovoo0

$6

94

8 sele

ct,

sele

ct

drive

and s

eid

e

SHCO

43

vor-in0o0rHVO

OQCOvoo0

XoidM4-1

S-lo

>M

oSHcaCDCO

XoidSH4JCM0&

COvo

M0!43

03Q

OO0rHVO

•=pQ

VOOO

C-Hid

SH

O

w

COinvo

COG43

Wj-^Oo00vovo

COQ

vooo

,w

t-l,

$6

A2

(A5

) curr

err

to

defa

ult

err

or

<uos

CM

VO0fa

fafa0

«co

CJQCOVQOO

013

4->01

O

wrHCJ

vo

oenrH

S

sos

0enr-)

Oomo

CM

coVQOO

vo

0cnin-

*

SQ

OE

0

o0{_)fpCJcovowCOvooo

EH(-H

O4-1

C0-H

tJCO

-H•oCO4-1caQ

vo

ocn

£os

0CMt_jOCJ

CJCO

,.;;

&3COvooo

SH0)4-10]-rlcn0)SH

4-1G3OO

SHO

UCOCO

r-O

>OS

cH0ooCJcoMCO

wfV)

tovooo

CMr~-r~rH

O4-1

r~O

IK

H

tJXCO•H

1

Ovo

SHCO43

oQinooo,— ivo

CMfaCOvooo

CMf—r-01

(D

0)CA

vo

oCOrH

§Os

0COrHO{_)P3CJcovofaCOvooo

O4->oCOwtu-HSHS

Q

0

"*>

S

>Oe

o

ooocotato

<faCOvooo

CMr-r-rH

o4-1

r-Q

rH

tiX01•H

1

Ocnvovt

CO43

11

CJinoo0rHVO

(afaCOvooo

(U4-1C3O0

0

"HEH

c—Q

Ooo0•a1

=*>

(Uo5

O0o0^*oooOtotaCM

CM0"=TVO

Oo

(U

0•oCMr-r-rH

a-H

&

a<HS

rH0

fafafafafa

in

*

01fl 1

43

rHOrtjfafafafafain0oocncoCO0

COo

vooo

01

0)>H

OrH

VO

O*0)43

foP-vo

0rH•CTVO

oo

SH0)4-1

3OU

4->3O<u-rl4->

4-1

1(!)SHO(1)Q

r-Q

rH

=*=

rH

S3CO

r-03CO

CMrH

VOOO

4-1d)

3O

•o1-H

4-10

COo

VQ

CDG43

CMfaVOvoq,rH

VO

0o

HCO<H01GcdSH4J

•o0)

4-10)01COSH

MCMcnvo

SH01

43

vorHIf)OoorHVO

VOrH

VO

0O

318

Page 326: Atari ST Internals

Abacus Software Atari ST Internals

omVDto

id

43

3*COovo,3;•-1vo0o

(A6)

S

ele

ct

17

72

sta

tus

reg

iste

r |

».oCOf— tto^£

U•

0)

Og

oCOrHOoPQOCO

CJ"-1vo0o

rdis

kctl

, re

ad

17

72

reg

iste

rs

|

COQenvoto

J-(CO43

VDraooorHVO

OCM

VOoo

err

bit

s,

calc

ula

te

err

or

num

ber

|

MCO

VDto

^tCO43

03VDEnEH0OrHVO

•=rCM

VDO0

Wri

te p

rote

ct

?

|

oQ

VD3t=

4-1CO4-143

voo0o0oCO0

COCM

voo0

flo

pfa

il,

no

fu

rth

er

atte

mp

t |

o0COvoto

O!G43

CMQCO000voVD

OCM

voo0

fd4Jid•o4-1COOrH

•oidgCOXO(DfiO

EH•z,«

00)

s01

i!s

oQ

O

t/>=«=

43•0Gid

CJmooOCO0CJ

0CO

VDoo

G-Hid

id

4-1

to0

W

oinvoto

0)C43

*3*rHVDvoTCO

vo0o

to<D

3C

M04-1O0)CO

4-1

01

01S-lOG

-H

00)COo

COCOvoto

^rH

*

3

tr•oTS(d

COCOvooQvoCMmVDCO

vo0o

68E

(A5)

cdm

a,

DM

A a

dd

ress

to

nex

t se

cto

r |

to,CM

in=8=

,—)•

•a•oid

EdCOvooooCMoo0o0Q

voofS.CO

vooo

C(A

5)

cco

un

t,

decr

emen

t nu

mbe

r of

se

cto

rs

1

COvoto

fc.rH=tt=

stf433CO

OCOVD0QvocoinCMTvo0o

flo

po

k,

all

se

cto

rs,

then

do

ne

|

woCOVDto

tra>43

voOCO000r-VD

VOT

VO0o

S-lO)4-1

-HOa

Q

•oG

3G

S-lO4-1O0)CO

rH4-1O

r-l0)CO

O

{ —enVDto

s-iCO43

3*CMmo0orHVO

<•=pvo0o

Wri

te

nex

t se

cto

r w

ith

ou

t se

ek

|

CJaCOVOto

(dS-l43

CJovo

W•sp

VO0o

C"

!4-14->M

•oOo01CO

4J~

O

4J01

in

CM

[—votorH

*

sao

CMr-VDOrHOOoQvoOo0invo0o

o

OmVDto

0)G43

^iovovovomvoo0

XOl01CO

•aid

0)

o

0)COCO0)to

<*Cr-ODVOto

S-lCO43

oCM

OOOrHVO

03invoo0

to0)4JC30O

10)4-1

£4JCO)

§toUCD•o

4-1

O>!

4J

in

CMr-votorH

*

•tr433CO

CM

t—VOoQVDCOmOmvoo0

Ano

ther

at

tem

pt

?

|

oQCOvoto

rH

a43

NVDEH

0Of£voovovooo

flo

pfa

il,

err

or

1

o0COVDto-

rdto43

t-£enCOo0o0vo*rVD

VDOO

Uid4-1

4Jid

on

£<HaorH1-1

*

****

**

***

**-X-X•X•X•X*-X*•X•X**•X**-It•X**•X*•X•X•X•X•X*•X•X

-X•X

•X-X•X

o«S-l0)

3G

U-H

ids

1—CMCM

rHCMcoinVDr-coto

rH

ago

vorHoorHCMCO

invor-coEH

CJoCOvo

vo0o

No,

fl

op

fail

|0oCOvoto

01C43

fV]

COCOo0oVDVD

oC—vooo

<s>£nGidfioXCO

-H

too1-1

4JCO0)

oTo>Gido

CM[V,a\oto

S-lCO43

CJ

[—mo0orHvo•3<r-vo0o

Def

ault

err

or

num

ber

|

0Q

rH1

rH

cfcuog

pHEH0r-03r-vo0o

flo

plo

ck,

set

par

amet

ers

|

COvor-VDto

S-lCO43

CJ

CM000rHVD

<r-vo0o

sele

ct,

se

lect

dri

ve

an

d

sid

e |

CO•^P01voto

toCO43

COO000rHVO

Wr-vo0o

,$69

6(A

5) s

pt,

se

cto

rs p

er

track

|

^*r-f£'—*TrH

s0!

og

VDenVD0Wo00

voCPCO

CMCO

voo0

,$69

8(A

5)

inte

rlv

, in

terl

eav

e fa

cto

r |

.r-rfl••—oCM

•0)

og

COenvo0

rHOOEHvoPQCO

COCO

VDo0

,$69

A(A

5)

vir

gin

, se

cto

r d

ata

for

form

atti

ng

1

, —r-*3*—voCM

|5•

0)

Og

rtjenVD0

rHOOEHVDCOCO

MCO

vooo

319

Page 327: Atari ST Internals

to

006494 7002

006496 61000592

00649A 610003CO

00649E 66000360

0064A2 336D06860000

0064A8 3B7CFFFF06A2

0064AE 6128

0064BO 6600034E

0064B4 3B6D0696068C

0064BA 3B7C00010688

0064CO 6100015C

0064C4 246D068E

0064C8 4A52

0064CA 67000342

0064CE 3B7CFFF006A2

0064D4 6000032A

moveq . 1

bsrbsrbnemove .

wmove .

wbsrbnemove .

wmove .

wbsrmove .

1tst.wbeqmove .

wbra

#2, DO

$6A2A$685C$6800

$686(A5),0(A1)

t-l,$6A2(A5)

$64D8

$6800

$696(A5),$68C(A5)

#1,$688(A5)

$661E

$68E(A5) ,A2

(A2)

$680E

#-16,$6A2(A5)

$6800

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

0064D8 3B7CFFF606AO

0064DE 363C0001

0064E2 246D068E

0064E6 323C003B

0064EA 103C004E

0064EE 6100010A

0064F2 3803

0064F4 323COOOB

0064F8 4200

0064FA 610000FE

0064FE 323C0002

006502 103COOF5

006506 610000F2

00650A 14FCOOFE

move . w

move . w

move . 1

move , wmove .

bbsrmove .

wmove .

wclr.bbsrmove .

wmove .

bbsrmove .

b

t-10,$6AO(A5)

#1,D3

$68E(A5),A2

#$3B,D1

#$4E,DO

$65FA

D3,D4

#$B,D1

DO$65FA

#2,D1

#$F5,DO

$65FA

#$FE, (A2)+

'changed1

Diskette changed

hseek, search

for trackflopfail, not foundctrack, write

current track in DSB

currerr to default error

Format trackflopfail, errorspt

sectors per

track as ccount

countercsect,

start with sector

1verify,

verify sector

cdma, list

with bad sectors

Bad sector ?

Nocurrerr to 'Bad

Sector

1

flopfail, error

fmtrack, format

trackdeferror,

default error

numberStart

with sector

1cdma, buffer

for track data

60 times

$4E, track

headerwmult,

write in buffer

Save sector

number12 times0wmult,

write in buffer

3 times

$F5wmult, write

in buffer$FE,

address mark

o1Mno3?I)•»»1/3H

Page 328: Atari ST Internals

Abacus Software Atari ST Internals

•oG

<n<U

X!

CMtH10

X O OO 0) 4J 4J<a -o o oM -H CD <D

EH W (O CO

XIc-H

a>

CM •a'CM V>

M

0>e

£ CM

3

C-H

(U

-HM

,4J

p£3

0](U£-H4J

CO

1-1

Xi55

-H

fl>4_)-HJ_|

sK

4JH

IO 3[V, g

«• 3:

Mid

OO

r— )

X)

{^J4J<d•o

s,mfa</>

to0)g-H4J

VOIOCM

•o,_!id

-H4-1-HC

-H

N

C-Htn-H>

gtoofl toU 0)

d> -H4J -P

0H ±>CD o*H <l)H-) 013XI 4-1

0 -

-H H

3 0)

4J -H

C (1)C

M OO4J 010 3CD H H01 O P.

4, ti Hto a> o<U 01 4JO1 o

4J <IJX to

S 4J

<H

OraM4-)

4JG3

o4JO0)

(U1-1

4}c

CDOJ

4J

W 3

«- S

CM CM< <

Q QCOQ

CM CM< <

F, co ~ —CO CO - NVO VO -3" CMV* V* Q *

Xi X! Xf

rH OQ P

m

C U < U G } ( ] ) < D < D Q <U> > > > > > > M >O O O O O O O 0 1 Og g g g g g g X J g

0Q

f\M

O

faIOvo

01X!

tHQ

CM

*

s

mov

e,

oQIOfa

X!

mov

e,

faIOvo

M01

XJ

CM

PQfa

XI

mov

e,

Q

fafa*

s

mov

e,,b

$6

9A(A

5)m

ove

, ,b

$69B

(A5)

mov

e,

•=rIOvo

Q

<8

i

ac~fa=tt=

XI

mov

e,

Q

CM

mov

e,

oa

X!

mov

e,

faIOvo

MtoX!

io

COenvo

•o•oid

» $

69

6 (A

5)

o

favo

(U

Xi

Q

s

I

io

COonvo

•2f>

a,0

CMfa

VO

0)rHXI

rHQCOr-10vt=t(=

S

mov

e,

oQ

^P IO</> vo* -u>

Xi<J> MO 01£ X)

0065

0E 1

4F

90

00

00

68

70

06

51

4 1

4F

90

00

00

68

B00

651A

14

C4

0065

1C 1

4FC

0002

00

65

20

14FC

OO

F70

06

52

4 32

3C00

150

06

52

8 10

3C00

4E00

652C

61

0000

CC

00

65

30

323C

OO

OB

0065

34

42

00

00

65

36

6100

00C

200

653A

323

C00

0200

653E

10

3CO

OF5

00

65

42

6100

00B

60

06

54

6 14

FCO

OFB

0065

4A

323C

OO

FF0

06

54

E

14E

D06

9A0

06

55

2 1

4ED

069B

00

65

56

51C

9FF

F6

0065

5A

14FC

OO

F700

655E

32

3C00

270

06

56

2 10

3C00

4E0

06

56

6 61

0000

9200

656A

D

86D

0698

0065

6E

B86

D06

96

oCOfavoCMr-10vooo 0

06

57

4 52

430

06

57

6 B

66D

0698

0065

7A

6FO

OFF

760

06

57

E

323C

0578

00

65

82

103C

004E

00

65

86

6172

321

Page 329: Atari ST Internals

Abacus Software Atari ST Internals

,b

$6

91

(A5

),$

FF

FF

86

0D

dm

alow

,b

$6

90

(A5)

,$

FF

FF

86

0B

dm

amid

691F

FF

F86

0D

mo

ve.

69

0F

FF

F8

60

B

mo

ve,

o oQ QW Wro corH rH

CO OCO CMin invo vo0 0o o

,b

$6

8F

(A5

) ,$

FF

FF

86

09

dm

ahig

h6

8F

FF

FF

86

09

mov

e.

oaCOrH

COCMmvooo

CO3

4JCO

a

0)rH

CJ

VQ

OCMrH

=tt=

CU

o

0CMrHOopqCJCO

of3*mVQoo

,w

#$90

, (A

6),w

#$

190,

(A

6)

Dat

a d

irecti

on

to

WR

ITE

,w

#$1F

,D7

Sec

tor

cou

nte

r to

31

$69C

4 w

dis

kct

l,

D7

to

1772

,w

#$18

0, (

A6)

S

elec

t 17

72,w

#$

FO,D

7 F

orm

at

track

co

mm

and

$69C

4 w

dis

kct

l,

D7

to

1772

,1

#$40

000,

07

Tim

eout

co

un

ter

#5,$

FF

FF

FA

01

mfp

gp

ip,

1772

do

ne

?$6

5DC

Y

es, 1

#

1,D

7

Dec

rem

ent

tim

eou

t co

un

ter

$65C

6 N

ot

yet

tim

ed-o

ut

?$6

92E

rese

t,

term

inat

ej.

l #1

,D7

Cle

ar

Z-b

it,

err

or

c u a j c u c u o ) o ) 4 - > ty c u> > > M > > M > c o t r 4 5 a ) ! H > c oO O O C O O O C O O - P C U 3 C ! « O - Pg E £ 4 5 g g 4 5 g 4 5 4 5 c o 4 5 4 } g r <

0

fa0 fa0 fa0 fa0 fa

O O f a C M O O V Q q ' i n C OC M C M r H r H C O f a O O O IOO r H O ' = l 1 r H O « q ' O O C Oo o o o o o o o o oC J C J C J O C J C J O C J C M C J r ^ C N O r H i nc Q C Q c o o p q c o o c o c o o c o f a o o r -C J C J W r H C J W r H t a c o r ^ C O V O r H W WC 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

• ^ P O O O O - ^ C O C J O V O C t l O C M ^ C O r i ;t < r t ; r < p q p q p q c q c j c j c j C i Q Q Q C >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 m i nV Q V O V Q V Q V O V O V O V Q V O V O V O V O V O V O V Oo 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

,w

#$

19

0,

(A6)

S

ele

ct

DM

A

sta

tus

,w

(A6

),D

O

Rea

d

sta

tus

0) <U> >0 0g g

oenrH0O VQm rHO 0co coO 0Q Win mvo vo0 0o o

C"

in0

cu

Q

OQ

0=tt=

CO

4)

0o0o00COoCXI

mvo0o

COcu

>H

COQinVQto-

tT0)45

0favovopqif)vooo

cu4-1CO

•H

(!)

CO3

CO

CM

t—rH

PO0)

rH0)

CO

VO

oCOrH•to-*

0)

g

o03rHOCJcqCJ

03

mvoo0

CO

0)4->CO

-Hen0)

•o<d0)

rH

OXCO

-H•o

COQCMVO

CO45

ro000rHVO

Omvoo0

$638

E

err

bit

s,

calc

ula

te

err

or

num

ber

3 #$

44, D

O T

est

wri

te p

rote

ct

and

lost

d

ata

»*•*

M T303 C

fQ *Q

O ^PG\1

Q 0fa 00 Oo corH OVQ O

O •O'fa fam invo voO 00 0

CO4->JH

inpq•5T

COfainvooo

HCO

-rl

ra4-> 0)

5g

0)

M 0)S K

i faCM m< vo

0 rHQ Q

450) ID

O rQS "o

CJfafafa

O CMCJ O

rH in

< CJfa fam mvo voo o0 0

322

Page 330: Atari ST Internals

006600 4E75

rts

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

006602006606

006608

00660C

006610

006614006618

00661A

00661E

006624

006628

tx> 006630

W

006636

00663A

00663E

006642

00664A

006652

00665A

00665E

006662

006666

00666A

00666E

006672

006676

00667A

610003EE

70F5

6100015E6100033A

6100029C

660001EA

6104

600001F2

3B7CFFF506AO

246D068E

06AD00000200068E

3B7C00020672

3CBC0084

3E2D0688

6100038413ED0691FFFF860D

13ED0690FFFF860B

13ED068FFFFF8609

3CBC0090

3CBC0190

3CBC0090

3E3C0001

61000358

3CBC0080

3E3C0080

6100034C

2E3C00040000

bsrmoveq.l

bsrbsrbsrbne

bsrbra

move . w

move . 1

add.l

move . w

move . w

move . w

bsrmove , b

move , b

move . b

move . w

move . w

move . w

move . w

bsrmove . w

move . w

bsrmove . 1

$69F2

#-11, DO

$6768

$6948

$68AE

$6800

$661E

$680E

#-ll,$6AO(A5)

$68E(A5),A2

#$200,$68E(A5)

#2,$672(A5)

#$84, (A6)

$688(A5),D7

$69C4$691(A5),$FFFF860D

$690(A5),$FFFF860B

$68F(A5),$FFFF8609

#$90, (A6)

#$190, (A6)

#$90, (A6)

#1,D7$69C4#$80, (A6)

#$80, D7

$69C4#$40000,07

flopver, verfiy sector(s)

Change, test for disk change

"read error1, as default error

floplock, set parameters

Select

go2track, search for track

flopfail, error

verifyl, verify sectors

flopok, done

deferror to 'read

error'

cdma, DMA buffer for bad sector list

cdma to next sector

retrycnt, 2 attempts

Select sector register

csect, sector number

wdiskctl,to disk

controller

dmalow

dmamid

dmahigh

Clear DMA status

Data direction to READ

Sector counter to 1

wdiskctl

Select 1772 command register

Read sector command

wdiskctl

Tim

eou

t co

un

ter

ftinBB3

Page 331: Atari ST Internals

Abacus Software Atari ST Internals

cuco-aCMr-

aa

& 01M-l CU

s x

nt

tim

eo

ut

co

un

te

r

ut

yet

?

cu oS 1cu -aM CU0 ECU -rH

Q EH

CMr-r^j-H

4JCU01CU

1cu

4-14-1ca4-1Xcu

DM

A

sta

tu

s

re

gis

te

r

|

4Jocucu

nM CUCU 4-1XI G

M 3 CO OCU C 4-1 04-1 CBCO S-4 T> r4

-rH O O H

Cn M 4-1 4-1 CUCU CO M CO CJ 4-)M 3 0) O CD C

4-1 H 4-1 CO -Hco ca cu a M o3 4 J 4 - 1 T J E O 4 - 1 Q.4 - ! C Q r a G O ) 4 - l G C < .ca rH ca 4-1 o CD <c

C 4 J T S 3 4 - l C U E H S- r H C Q c a O C J c B t o C U O Qca CB rH fU r) 4-1

o i f - t n c M r - i c B O ^ ^ O O ^3 c a r ~ U X X 0) <U 4)4 - 1 S - 4 r ~ ^ K ( D C 1 ) T 3 C Q C Q

c a O > i r H r H ^ f a G G CD4 J r 4 H 4 - 1 0 ] ^ K r 4 K0 1 S - ) 4 - 1 4 - l O 4 - l p S - » 4 - l C U

C U O X - H ( - 1 4 - 1 G J 5 -4-1 K C U 0 1 X ) 4 J O C J 3 4 - l c aC B < 0 1 r H - r H M 0 1 H C U O O g

c u S c u c u T i r H C U r H o i e j c T )K Q > H W ! H C U E H f 4 0 C J < O

to

r list

mit N

ull

a

bs

ch

lie

@e

n

1

0cuCO

•ocaX!

t,

2n

s

attem

pt

?

|

co^4-10)M

.XCUcuCQ

O (U2 rH

nt

re

try

cn

t

1

atte

mp

t

?

|

(U rH

E CU

0) .CrH 4-1

0 0CU GQ <

4JCQ-HrH

O

CU01

•oca

G-H

CU

C

o4-1OcuCO

IK

4JCJCUCQ0

04-1OcuCQ

4-1

CU2

FF

FF

FA

Ol

</>K

in=tt=

4-1to4JX)

rH0<.fafafafafaino00er\COo

0COvoVQOo

envovo</>

crcu

f£0

( —VQ

ooCOVQVQ00

r-Q

KrH

*

,_,.

s3to

r—COnm<;COVQVO0O

0COvoVQU>

CUc

A

CMfaVQVQ

Cj

COVQVQ00

CMmVO«•

t-tto

X?

aenCMooorHVQ

wcovoVQOO

CJVOVQ</>

aSHft

VQ(T)

Ovo

CMenvoVQO0

vo

oen</>*

g.•

(U

oE

oenooCJpaCJ

TenVQVOOO

oQ

, ,VOf£"—"

J..

>oE

vorHOmCOenvovoo0

0Q

o=tt=

4-1CO

4-1X!

ooooooCOopqenvoVQ00

CJvovo•!/>

crcuX)

<CNr—VQ

Henvovooo

vo

0CO</>•=*.g.•

goE

oCOooCJpaCJnof£vovoo0

COQenvo</>

COX!

CMmnooorHVQ

•=r^qvovo00

wCOnvo«•

M

COXi

qiUOfaoorHVO

COpjjVOVQOo

0Q

CJrH</>

*

X)•oGca

CJrHOOCJ

oCJ

CJ<vovoo0

CJvovo«•

cucX!

COrHvovo

oCQvovoo0

in

COCOvoV*K,

rH

*2.

•§"•aC3

COCOvo0QvoCMmCMCQVQVQOO

68

C(A

5)

</>1

rH

*

S

O1X)3Ol

UCOvooQvonmVO

CQvovooo

onvovo«>

CUGX)

•31r-fafaoovovo

<pqvovooo

wCOVQ

ooCM</>

*

rH

X)3CQ

uCOVOOooCNOoo0oQ<

0

wCQvovo0o

. —CMrfj*-~

^nrH

0

CNmCM

VO

CJvovooo

Ol4-1rH

mr-<3*

COOvoVQOo

in

CM

vo</>KrH

*

K

aso

CMr~vo0rHO0ooVQCJO

<,Uvovo0o

voQvovo</>

0)GX!

r0vovo

oQvovooo

<r^COvo«•

M01X)

vo

i-H000rHVO

CMQvovooO

in

CM

VO</>

^rH

*

3

cfX)301

CMr^vooQVOnmvoQVOvo0o

CM

VOvo«•

rHaXI

vovofafaoovo

^q

Dvovo0o

CM<

fc.

in

COCOvo«•

ScuoE

CO03VOoar

mwQvovooo

CNPQvovoco-

carH

X)

[•-•)

oovoCNpqvovo0o

324

Page 332: Atari ST Internals

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

0066E4

0066E6

0066EC

0066FO

0066F4

0066F6

0066FC

0066FE

006702

006704

006708

00670A

00670E

006712

006714

N>

00671A

01

00671C

00671E

006720

006722

006726

00672A

006730

006734

006736

006738

00673C

006740

006744

006748

00674A

9BCD

4DF9FFFF8606

50ED0680

4A6D043E

6670

203900000466

1200

C23C0007

6638

3CBC0080

E608

C07C0001

41ED0674

DOCO

B079000004A6

6602

4240 .

5200

E308

OA000007

6100026C

3039FFFF8604

08000006

56DO

1002

6100025A

302D0674

816D0676

4A6D0682

6618

6100028C

sub.lleasttst

.wbnemove . 1

move , b

and.bbne

move . w

Isr.band.wleaadd.wcmp.wbneclr.waddq

. b

Isl.beor.bbsrmove . w

btstsnemove.b

bsrmove . w

or .wtst.wbne

bsr

A5,A5$FFFF8606,A6

$680 (A5)

$43E(A5)

$6766

$466, DO

DO,D1

#7,D1

$673C

#$80, (A6)

#3, DO

#1,DO

$674 (A5>,

DO,AO

$4A6,DO

$671E

DO#1,DO

#1,DO

#7, DO

$6994

$FFFF8604

#6, DO

(AO)

D2,DO

$6994

$674 (A5),

AO,DO

DODO,$676(A5)

$682 (AS)

$6762

$6908

flopvbl, floppy

vertical blank

handler

Clear A5

Address of the

floppy

register

Set motoron

flag

flock, disks

busy

?

Yes, do nothing

frclock

6Cflo

Calculate mod 8

Not yet

8th

interrupt ?

Select 1772 status

register

Use bit

4 as

drive number

wpstatus, write

protect

status

table

Index with

drive

number

nflops, number

of floppies

Drive select

bitShift

in position

Invert for

hardwareSelect

drive

dskctl, read

1772 status

Test write

rpotect

bit

And save

Previous select

status

Recreate

wp

status

Write wplatch

deslflg, floppies

already

deselected?

YesRaed

1772 status

register

Ii1B>5?

Page 333: Atari ST Internals

Abacus Software Atari ST Internals

CD01

-rl

43

corJ0

os

oQ

p-

*

u

01jj43

r^0ooooCOo

w^p-vooo

s,

the

n

do

n't

de

se

lect

<uJH

vovo

VD4J>

0)c45

CMrHVOVO

CMmp-vooo

th drives

oCQ

oQ

=tt=

43

W

0g

r~oo0oCOorH

•5Pint —vo0o

se

lect

CUQ

•=renenvo</>

01

43

<jCOCM000rHVO

COinp-vo0o

t d

eslflg

01en

^__in

- —CMCOVD«•

rH

*

IS

0)

og

CMCOvoorHO00op-CQCO

0mP-vo0o

ear

mo

toro

n flag

rHO

^_^m5.oCOvo</>

.^frHO

0COVQOQVOCM*3*

CMVOp-VOoo

014-1

mS•SP

VQVOP-VOOO

oplo

ck

rHM-)

•X

*•X•X•X

****c•X

*•X

*****

*•£•X

*•X

*•X

**-X-X

*-X•X-X

*-X-X

*-X•X

*•X-X

*****-X•X•X

gsa

ve

CDt-l

*3>f£vo</>

vof£1

CO<r~ocoQ

rH

cuog

•=3*i Cvooo00o03b.CO[•—a\O

*>p

COvop-vo0o

m

H<a0)r-to

in

m

.43

ta

OHCn

Op-p-VOo0

dre

ss

of

the floppy re

gis

ter

•o<:

vo

fc.vooVDCOPnfnfcl•(fl-

ed(UrH

VO0voCOCT,

fe,r-.

en

Q•3*

CMp-p-VOo0

t m

oto

ron fla

g

cuto

oCOvo</>

.p01

0COvoooo0oen

0mCOp-p-voo0

ferr

or

CO•a

___m•—'0

vo<o

oQ

S

CD

0g

O<vooo

sCO

pqp-p-voo0

rrerr

Po

__^in~—CM

VD<«•

OQ

S

CD

0g

CM

VOoo

CQcoCM03P-VDOO

ock,

dis

able

floppy-v

bl

routine

rHIH

^mf£•^—

co•a1«•

rH=^=

&

(0

0G

tdcoo1orHOooo£covoCOp-VDoo

*3o

>_s

mSwCOvovt,

p-sCO

rH

(U

og

fVj

COvooCOo0oP>4VDCQCM

oCOp-voo0

TJu

m

•a1COvo</>•••[<lVDrH

s(U>og

^pCOvooorH0opt,voCQco

CMenp-voo0

4-1o(U010

m

COCOvo**>••p-<cCOrH

sonog

COCOvooCMrH0orT)

voCQCO

COenp-voo0

XocdrH4-1o

m

voCOvo{/>

•*t^<oCM

scuog

voCOvooql

rHooPuvoCQCO

wenp-vooo

CD•a•r)ta0

in.=qrtCOvo</>

••p-<

CMCM

3

(U

og

rt^COvo0vorHoorT,

voCQco31

rt^p-vooo

4->

po00

in

0COvo«•

-(~-<

•=rCM

scu0g

0COvo0COrHoopt.voCQ

fQ(Qp-VD0o

trycn

t

cu>-t

^^in**•CM

vo«•

CM

*

scu0g

CMp-vo0CM0ooop-CQco0CQp-vo0o

o4301•a

rHrfj•.

^^insCOovo<ft

ca0)rH

COovo0Q

co

vomp-vo0o

CD•a0

^^insTCOVD</>

.4-1014-1

rCOvo0Qvo

J1

f^mp-vo0o

0

-HMQ

q,of"*1

vo</>

trcu43

tp0p-vopqCQp-VDo0

rH4301

•a

rH<c£

M.^^m

—oovo</>

cdcu

r-H

ovooQwco

0op-vo0o

p-Q

o^rH

FT1\Jcuog

oo

p-

rop-vo0o

ount,

nu

mbe

r of

se

cto

rs

ou

p-Q

*,^^m

—oCOvo<*>

scuog

oCOvo0QCM

CO

voop-VDoo

CMrHin01d>

-rH

EH

p-Q

CO=*=

.rH01rH

rT|

rHp£)

r3Jop-voo0

p-Q

rH=»=

.rH01rH

P>4

cowCJop-VDo0

ma,

sta

rt

DM

A a

ddre

ss

•ao

0rij

M.^-^m£wCOvo</>

i-H

CD

0g

MCOvo0Qvo0CM[V]

op-voo0

326

Page 334: Atari ST Internals

0067D2

0067D4

006708

0067DC

0067DE

0067E2

0067E6

0067EA

0067EC

0067EE

0067FO

0067F2

0067F6

0067F8

0067FE

D1C7

2B480692

4A690000

6A20

61000168

42690000

610000EC

6712

7EOA

6172

6606

610000EO

6706

337CFFOOOOOO

4E75

add.lmove

. 1

tst.wbpl

bsrclr.wbsrbeqmoveq

. 1

bsrbne

bsrbeqmove

. w

rts

D7,AOA0,$6920(A1)

$67FE

$6948

0(A1)

$6804

$67FE

#10, D7

$6862

$67F8

$6804

$67FE

#$FFOO,

(A5)

0(A1)

ij

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

"*•! nneonn inni

mmr&n ^

41 nn

006802 61000226

006806 302D06A2

00680A 48CO

00680C 6002

bsr

$6A2Amove.w $6A2(A5),DO

ext.1

DObra

$6810

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

00680E 4280

006810 2FOO

006812 3CBC0086

006816 3E290000

00681A 610001A8

00681E 3C3C0010

006822 610000C6

006826 303900000684

clr.lmove

. 1

move . w

move . w

bsrmove

. w

bsrmove

. w

DO

DO,-(A7)

#$86, (A6)

0(A1),D7

$69C4

#$10, D6

$68EA

$684, DO

Plus length

of sector

edma, yields

end

DMA

address

dcurtrack, current

track

>= 0 ?

No, select

Set track

to zero

Restore, head

to track

zero

OK ?

Seek track

10

Error ?

RestoreOK ?

Recalibrate, error

flopfail, error

in floppy

routine

Media change

to 'unsure'

Setcurrerr

flopok, error-free

floppy

routine

okSelect 1772

Get track

number

wdiskctl, send

to disk

controller

seek command

flopcmscdev,

drive

number

I

9

Page 335: Atari ST Internals

00682C E548

Isl.w

00682E 41F900000678

lea

006834 21AD04BAOOOO

move.l

00683A OC790001000004A6

cmp.w

006842 6606

bne

006844 216D04BA0004

move.l

00684A 201F

move.l

00684C 4CF978F8000006A4

006854 42790000043E

clr.w

00685A 4E75

rts

#2,DO

$678,AO

$4BA(A5),0(AO,DO.w)

#1,$4A6

$684A

$4BA(A5),4(AO)

(A7)+,DO

movem.l $6A4,D3-D7/A3-A6

$43E

As index

acctim

200 Hz counter as last access time

nflops

20 Hz counter for other drives

Restore error number

regsave

Clear flock, release vbl routine

o"Iencn

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

10NJ00

00685C

006862

- 00686A

00686E

006872

006876

3E3900000686

33FCFFFA000006A2

3CBC0086

61000154

3C3C0010

60000072

move

move

move

bsr

move

bra

.w.w.w.w

$686,

t-10,

#$86,

$69C4

#$10,

$68EA

D7$6A2

(A6)

D6

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

00687A

006882

006884

006886

00688A

00688E

006890

006894

006898

00689C

0068AO

0068A4

33FCFFFA000006A2

6150

664C

42690000

3CBC0082

4247

61000132

3CBC0086

3E3C0005

61000126

3C3C0010

6144

move

bsrbne

.w

clr.w

move.w

clr.w

bsrmove

move

bsrmove

bsr

.w.w.w

#-10,

$6804

$68D2

0(A1)

#$82,

D7$69C4

#$86,

#5,D7

$69C4

#$10,

$68EA

$6A2

(A6)

(A6)

D6

hseek

, head to

tra

ck

ctrackcurrerr to 'seek error'

Pass track number

wdsikctl

Seek command

flopcmds

ressek, home and seek

currerr to 'seek error1

Restore

Error ?

Current track to zero

Select track register

Track zero

wdiskctl

Select data register

Track 5

wdiskctl

Seek command

flopcmds

IiI

Page 336: Atari ST Internals

0068A6 662A

0068A8 337C00050000

bne

move.w

$6802

f5,0(Al)

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

0068AE 33FCFFFA000006A2

move.w

0068B6 3CBC0086

move.w

0068BA 3E2D0686

move.w

0068BE 61000104

tosr

0068C2 7C14

0068C4 6124

bsr

0068C6 660A

bne

0068C8 336D06860000

move.w

0068CE CE3C0018

and.b

0068D2 4E75

rts

#-10,$6A2

#$86,(A6)

$686(A5),D7

$69C4moveq.l #$14,D6

$68EA

$6802

$686(A5),0(A1)

#$18,07

Error

Track number to 5

go2track, search for trak

currerr to 'seek

error1

Select data register

ctrack, load track number

wdiskctl

Seek with verify command

flopcmds

Error

ctrack, Save track number

Test RNF, CRC

lost data

WJ

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

N>

0068D4 4246

0068D6 6112

0068D8 660E

0068DA 08070002

0068DE OA3C0004

0068E2 6604

0068E4 42690000

0068E8 4E75

clr.w

bsrbnebtst

eor.b

bneclr.w

rts

06$68EA

$68E8

#2,07

#4,SR

$68E80(A1)

restore, seek track zero

restore command

flopcmds

Error

Test track zero bit

Z-Flag invertieren

nicht Track Null ?

current Track auf Null

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

0068EA 30290002

move.w

2(A1),DO

0068EE C03C0003

and.b

#$3,00

0068F2 8COO

or.b

DO,06

0068F4 2E3C00040000

move.l #$40000,07

0068FA 3CBC0080

move.w

#$80,(A6)

0068FE 61000008

bsr

$6908

flopcmds

Seek rate

Bits 0 and 1

OR in command word

Timeout counter

Select 1772 register

rdis

kctl

S3E,of

Page 337: Atari ST Internals

006902 08000007

btst

#7,DO

006906 6606

bne

$690E

006908 2E3C00060000

move.l

-#$60000,0700690E

610000AA

bsr

$69BA006912 5387

subq.l II,D7

006914 6712

beq

$6928

006916 08390005FFFFFA01

btst

#5,$FFFFFA01

00691E 66F2

bne

$6912

006920 610000AC

bsr

$69CE

006924 4246

clr.w

D6

006926 4E75

rts

Motor on ?

YesElse

longer

timeout

wdiskctl6, write command in D6

Decrement timeout counter

Timed-out ?

mfp gpip, 1772 done ?

No, wait

rdiskct!7OK

8Sen

u>u>o

006928 6104

00692A 7C01

00692C 4E75

bsrmoveq . 1

rts

$692E#1,D6

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

00692E 3CBC0080

move.w f$80, (A6)

006932 3E3COODO

006936 6100008C

00693A 3E3COOOF

00693E 51CFFFFE

006946 4E75

move . w

bsrmove . w

dbrarts

t$DO,D7

$69C4#$F,D7

D7,$693E

Reset 1772

Error

Reset 1772, reset

floppy

controller

Select command register

Reset command

wdiskctl

Delay counter

Timed-out ? read status

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

006948 426D0682

00694C 302D0684

006950 5200

006952 E308

006954 806D068A

006958 OA000007

00695C C03C0007

clr.wmove.w

addq.b

Isl.b

or .w

eor.band.b

$682(A5)

$684(A5),DO

#1,DO

#1,DO

$68A(A5),DO

#7,DO

#7,DO

select, select

drive and

side

Clear deslflg

cdev, drive number

Calculate bit number

cside, side

in bit 0

Invert bits for

hardware

!I3

Page 338: Atari ST Internals

006960 6132

006962 3CBC0082

006966 3E290000

00696A 6158

00696C 422D069C

006970 3CBC0084

006974 3E2D0688

006978 614A

00697A 13ED0691FFFF860D

006982 13ED0690FFFF860B

00698A 13ED068FFFFF8609

006992 4E75

bsr

move . w

move . w

bsrclr.bmove

. w

move . w

bsrmove

. b

move . b

move . b

rts

$6994

#$82,(A6)

0(A1),D7

$69C4

$69C(A5)

#$84,<A6)

$688(A5),D7

$69C4

$691(A5),$FFFF860D

$690(A5),$FFFF860B

$68F(A5),$FFFF8609

Set bits

in sound chip

Select track

register

Get track

number

wdskctltmpdma,

clear

bits

24-31

Select sector

register

csect, get

sector

number

wdiskctldmalowdmamiddmahigh

65SenCflon

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

006994 40E7

006996 007C0700

0069A2 1239FFFF8800

0069A8 1401

0069AA C23COOFA

0069AE 8200

0069BO 13C1FFFF8802

0069B6 46DF

0069B8 4E75

move.w

SR, - (A7)

or.w

t$700,SRmove.b

$FFFF8800,D1move.b D1,D2

and.b

#$F8,D1

or.b

DO,D1move.b

D1,$FFFF8802move.w

(A7)+,SR

rts

setporta, set

port A in sound

chip

Save status

IPL 7

Read port

AAnd to D20069AA C23COOF8

Clear bits

0-2Set

new

bitsWrite

result

to port

ARestore

status

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

0069BA 6124

0069BC 33C6FFFF8604

0069C2 601C

bsr

$69EOmove.w

D6,$FFFF8604bra

$69EO

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

0069C4 611A

0069C6 33C7FFFF8604

bsr

$69EO

move.w D7,$FFFF8604

wdiskcte

Delay loop

for

disk controller

dskctlDelay

loop

for

disk controller

wdiskctlDelay

loop

for

disk controller

dskctl

IMl*

C/3HI—I

1

Page 339: Atari ST Internals

0069CC 6012

0069CE 6110

0069DO 3E39FFFF8604

0069D6 6008

bra

bsrmove.wbra

$69EO

$69EO$FFFF8604,D7

$69EO

Delay loop

for

disk controller

rdiskct7Delay

loop

for

disk controller

dskctlDelay

loop

for

disk controller

Sflrt'

s.WJO

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

to

0069D8 6106

0069DA 3039FFFF8604

0069EO 40E7

0069E2 3F07

0069E4 3E3C0020

0069E8 51CFFFFE

0069EC 3E1F

0069EE 46DF

0069FO 4E75

bsrmove.w

move.wmove.w

move.w

dbramove.w

move.w

rts

$69EO$FFFF8604,DO

SR, -(A7)

D7,-(A7)

#$20,D7

D7,$69E8

(A7)+,D7

(A7)+,SR

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

0069F2 OC790001000004A6

0069FA 662C

0069FC 302F0010

006AOO B07900004692

006A06 671C

006A08 3FOO

006AOA 3F3CFFEF

006AOE 6100EB4C

006A12 584F

006A14 33FCFFFF00000676

006A1C 33EF001000004692

006A24 426F0010

006A28 4E75

crnp.wbne

move . w

cmp.wbeq

move . w

move . w

bsraddq

. w

move . w

move . w

clr.wrts

#1,$4A6$6A2816(A7) ,DO

$4692,00

$6A24

DO,-(A7)

#-17, -(A7)

$555C

#4,A7

#$FFFF,$676

16(A7),$4692

16 (A7)

rdiskctlDelay

loop

for

disk controller

dskctlSave

status

Save D7

CounterDelay

loop

D7 back

Status back

change, tets

disk

change

nflopsNone

or 2 floppies,

done

Drive number

Equals diskette

number ?

YesDrive

number

'insert disk'

Critical error

handler

Correct stack

pointer

wplatch, Status

for

both drives

unsure

Save diskette

number

Drive number

to zero

>3.v>Hre3»3?"

Page 340: Atari ST Internals

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

006A2A 41F900003E2A

006A30 1FOO

006A32 302D0684

006A36 119FOOOO

006A3A 4E75

lea $3E2A,AO

move.b DO,-(A7)

move.w

$684(A5),DOmove.b

(A7)+,

0 (AO,DO.w)

rts

setdmode, set

drive change

modeDisk

mode

tableSave

mode

cdev, get

drive

numberSet

drive mode

****************************************************dskf,

disk

flags

006A3C AE

006A3D D6

006A3E 8C

006A3F 17

006A40 FB

006A41 80

006A42 6A

W

006A43 2B

W

006A44 A6

006A45 00

dc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.b

%10101110%11010110

%10001100

%00010111

%11111011

%10000000

%01101010

%00101011

%10100110

0

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

006A46 4BF900000000

006A4C 41EDOA43

006A50 610000DE

006A54 04000050

006A58 1400

006A5A E982

006A5C 610000D2

006A60 D400

006A62 EB82

006A64 610000CA

006A68 D400

lealeabsrsub.bmove

. b

asl.lbsradd.basl.lbsradd.b

$0,A5

$A43(A5),AO

$6B30

#80, DO

DO,D2

#4,D2

$6B30

DO,D2

#5,D2

$6B30

DO,D2

jdostime, IKBD

format

in DOS

format

Clear A5

Pointer to

clock-time buffer

bcdbinSubtract

offset

of

80YearShift

in position

bcdbinAdd monthAnd

shift in position

bcdbinA

dd day

R>3as5?

Page 341: Atari ST Internals

006A6A EB82

006A6C 610000C2

006A70 D400

006A72 ED82

006A74 610000BA

006A78 D400

006A7A EB82

006A7C 610000B2

006A80 E208

006A82 D400

006A84 2B420A4C

006A88 1B7COOOOOA8E

006A8E 4E75

asl.lbsradd.basl.lbsradd.basl.lbsrIsr.badd.bmove .

1move .

brts

#5,D2$6B30DO,D2

#6,D2

$6B30

DO,D2

#5,D2

$6B30

#1,DO

DO,D2

D2,$A4C(A5)

#$0,$A8E(A5)

And shift in position

bcdbinAdd hourAnd

shift in

positionbcdbinAdd minuteAnd

shift in positionbcdbin2-second

resolutionAnd

add seconds

Save new timeClear handshake

flag

asnenC/3

i

***************************************************006A90 1B7CFFFFOA8E

006A96 123C001C

006A9A 61000234

006A9E 4A2DOA8E

006AA2 66FA

006AA4 202DOA4C

006AA8 4E75

move.bmove.bbsrtst.bbnemove.1rts

#-l,$A8E(A5)#$1C,D1$6CDO$A8E(AS)

$6A9E

$A4C(A5),DO

gettime, get

current clock

time and

date

Request handshake flag

for timeget

time of day

command

SendNew time

arrived ?

No, waitGet time in DO

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

006AAA 2B6F00040A50

move.l 4(A7),$A50(A5)

**************************************************006ABO 41F900000A5A

006AB6 242DOA50

006ABA 1002

006ABC 0200001F

006ACO E300

leamove.1move.band.basl.b

$A5A,AO$A50(A5),D2

D2,DO

#31,00

#1,DO

settime, set

clock time

and datePass time

ikbdtimePointer

to end

of time

bufferGet time to

convertTo dOIsolate bits

0-4, seconds

2-second resolution

Ias

Page 342: Atari ST Internals

Abacus Software Atari ST Internals

4-1f-l 0)CD 4J> 3C GO -H

CJ S

inI0

CO4-1-r-1

43

0) 4_>

CO 0)•H >0 G01 OH CJ

CO

P0

1o

4-1-H43

CU4-1CO,-H001M

4-1

CU

G >iO CO0 Q

•sr1o

014-1-H

CU4-1CO

001

H

.pInCU

GOCJ

c-\J

G0S

c*>io

CO4-J

3CU4-1

r-H

oCOM

4-!

<D

G caO CUCJ :M

r-10

CO4J-H

0)4JCOrH

O01

M

et O

f D

ay

com

man

d

IKB

D

f b

yte

s to

sen

d

of

the

p

ara

me

ter

blo

ck

Of

Day

co

mm

and

IKB

D

01 d> O <U4-1 m g o co e oS-l M-l -H 4-1 M CO -H4-1(U O 6-1 CU CU 6-1^ *O rQ ^H *O *OG T i 4 - l G S T ! G 4 J GO ' C O J C U P ' O C U C U C UO < t O t O ! 3 , < t O C 3 t O

oO O O 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 Q C O C M O - C OQ Q •. tH Q Q - < - ) Q Q - < H Q Q - r H Q Q

— Q < Q- - o n - o - o

O M Q Q - a ' p t j O Qoa -vo m«> 41=

H•

M fMCO 01

^CMQ

43

CU>OS

COvo*

43

•0GCO

03vou>

J-l0143

N ^VO CM* Q

43

• CU

01 O

t__ fO=tt>

43

T3Cco

(O -vo in<o *

,— f•

!-t M01 0143 H

^CMQ

43

01>OS

,-ipa - - m P Q - - r ~ p a c o r - i c j -inf O V O i n C M r - * V O ^ P C M < ' > - V O - U > < / > V Q i n i <= S = - U > = K = Q = W = - C Q - = t | = Q = t t ! « l - = » = = % « > = * < O

H43 43 43

43 <H • 43 H • 43 43 • D1. CU • • CD • • o cu

T J M ^ J > T 3 M M > T J ? H t 3 > M i > c OG M c o O C O l o l O G c O ' t f O o l O e i )c 0 4 3 ' - i e r 0 4 3 ' H e c a 4 3 c a g 4 3 e ' - l

ovoto

CO43

i-i4/>

*

43

CU>oe

CJvoc/>

M COCQ 4-143 T4

006A

C2 6154

006A

C4

EA8A

006A

C6

10

02

006A

C8

0200

003F

006A

CC

61

4A

006A

CE

E

C8A

006A

DO 1

00

200

6AD

2 0

20

00

01

F00

6AD

6 6

14

000

6AD

8 E

A8A

006A

DA 1

002

006A

DC

0

20

00

01

F00

6AE

O 6

136

006A

E2

EA8A

006A

E4 1

00

200

6AE

6 0

20

00

00

F00

6AE

A 6

12C

006A

EC

E88

A CM0O<-H

Ww<voOO 00

6AFO

02

0000

7F

CMCMj-HVO

Tfe<VOoo 00

6AF

6 0

61

00

08

000

6AF

A

123C

001B

006A

FE

61

0001

DO

inovot-CMotavo0o 00

6B04

45

F9

00

00

0A

500

6BO

A

6100

01E

400

6BO

E 12

3C00

1C00

6B12

61

0001

BC

006B

16

4E

75

335

Page 343: Atari ST Internals

ON

006B18 7200

006B1A 760A

006B1C 9003

006B1E 6B04

006B20 5201

006B22 60F8

006B24 0600000A

006B28 E901

006B2A D001

006B2C 1100

006B2E 4E75

moveq . 1

moveq . 1

sub.b

bmi

addq . b

braadd.basl.badd.b

move . b

rts

#0,D1#10,

D3D3,DO$6B24#1,D1$6B1C#10,00#4,D1

D1,DO

DO,-(AO)

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

006B30 7000

006B32 1010

006B34 E808

006B36 E308

006B38 1200

006B3A E500

006B3C D001

006B3E 1218

006B40 0241000F

006B44 D041

006B46 4E75

moveq . 1

move . b

Isr.b

Isl.bmove . b

asl.b

add.bmove . b

and.wadd.wrts

#0,DO(AO)

,DO#4,

DO#1,DODO,D1

#2, DO

D1,DO

(AO)+,D1#15, Dl

D1,DO

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

006B48 70FF

006B4A 1439FFFFFC04

006B50 08020001

006B54 6602

006B56 7000

moveq.1 #-l,DO

move.b $FFFFFC04,D2

btst #1,D2

bne

$6B58moveq.1 #0,DO

binbcd, convert byte to BCD

Ten's counter

Load 10

Subtract 10

Increment ten's counter

Generate one's counter

Tens in upper nibble

And add

ones

Write result

in buffer

bcdbin, convert BCD to binary

BCD byte

Ten's place

ergWJOI

Isolate one's place

Plus ten's place

midiost, MIDI output status

Default to OK

Read MIDI-ACIA

status

And

test

OKSta

tus

not OK

II3655?

Page 344: Atari ST Internals

Abacus Software Atari ST Internals

we

, o

utp

ut

ch

ara

cte

r to

M:

ch

ara

cte

r

-rl

•a 4-1-H 0)e o

ter

to

MID

I-A

CIA

MID

I s

tatu

s

c-rH 4-1

O 0)

o

-H4-1C3

4-1 4-1CO -H0) 10EH S

M

O4->

0)4-1

4-13O,4-13O

MQMS

O4-1

C-H

4JCO

•oC

CO

co"-rHT)-HE

G

1 M4-1

tn coG

-H CD

4-1 4-1CO

IHIH Oo

COfi CO4-1 0)tr> MG T!0) t)r3 <

C-H

4-1CO

Me QO MM S

001 4-1

£ S

P.

4-1 4J(U 3U O

w4-1

4-1

0)

tat,

M

IDI

receiv

er

sta

tus

c

for

MID

I

CO (U-a n-H Og -H

ter

to

MID

I-A

CIA

s d

efa

ult

C CO-H0 rtiCn O

Ind

ex

Ind

ex

terr

up

tab

le te

st

U rH Crfl -H -H0) (0 C

OS EH O

rH

10

O1 Wfl) O

4-1 4-1O Os s

M4-)

lOr-w•

COmCQvoo0

-K

*-K

***•X

*****•jc-)C

-X-}C

-K

****•K-K-K

*-K•£

*-Jt

*-X

rHQ

>

0)

V£>OOoft,CNJCMm<;topqvooo

$F

FF

FF

C0

4,A

1

<oO

"oOCMCMCMCMCMenCMm^p

wmcqvoo0

CMQ

O

X!

0)

Og

ooooenCMr

iH

•vTVO

pqvooo

CMQ

*

4-1CO4-1

t— )OOoCMOCOo

COvopqvooo

•=r

pqvo

crCDX!

voCMr-vo

Ovopqvoo0

iH

CM

rH

Q

X)

(U

O

CM0OOf-H"31

miH

HvoPqvooo

CO4-1

m[V}

•5P

CMr-pqVDoo

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

•X

*•X•X•X•X•X

*-X-X-X•X-X•X

**•X•X•X•X-X•X•X•X•X

**•X•X

*-X

Q

0

trCD

os

oovor-•SJ1

r-pqvooo

mQ

3

CD

•a1OooCMCMVOm

vo[PQvooo

CM

r-

vo

rH

0)

oe

vooooCMvo^s1CM

rt^f^pqvo0o

Q

H- W

CM pqft. VO

0)^ MO COe X)

r£ O

<H QCM rH<H VO

w or- coPQ mVQ VO0 0o o

pqvo

mQ

<o£1

•a

<£rM

CMCMpqCJiHinCM03pqvoo0

CO4-1

mw

vo03PQvooo

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

**-X-X-X-X

*-X•X•X•X-X-X-X•X•X•X•X•X-X•X-X•X•X•X•X•K•X-X•X-X

o

in

o0

fOCDrH

oop£oQ

rH*3*

COcopqVO0o

$F

FF

FF

C0

4,A

1

10<urH

sroU

CMCMCMCM

CM

^P

UCOPQvoo0

oorH1

=tf

rH

tfcuOe

CMCMOr~

CMCftfflVOOo

ao<vo

10CDrH

voo0003Win

•31

encqvoo0

m

0

03

(flCDrH

03OOoCO

[ —Q1

COa\Q

voo0

H-

CM

Q^eo

cqinPQ

uenpqvoo0

CM

VO-CO-

CDcXI

CM0vovo

Cd

pqvoo0

oQ

o

rH

trcuoe

oo0r-

ofCpqvooo

CO4-1

m(V)

i

CMft.pqvoo0

337

Page 345: Atari ST Internals

Abacus Software Atari ST Internals

MQMsgo

CD

Ora

rao

to&

TJ-H

P<d

CO•o-Hg

C"

Ti

Oi

rH

CD

o

(0

0

CO

sta

tu;

Q)

O f$]Z. CO

inte

rru

pts

|

CD

mCO-rl

-o

r-

CMM

CD•oC

-H

•oCDre

1-H

rH

-HIB4-1

fi

-rH

CD

IB

OCJ

XCD•oC-H

T5rdCD,dpCD

CDrHUCM

P"

CDN-H

CO

!HCD

<M

3

G10

JZ4-1

rH

CD4-JrdCDt-tC3

r s

tart

ag

ain

|

CD1H

H-l3

4-1rd

C,-H(T>

O CDS3 pq

I b

uff

er

|

QMS

O4-1

CD4->R

-rH

OCM

fro

m b

uff

er

|

CD

ch

ara

c4-1CDu

CD•a-H

•afO

3

C

§<aco

CO

Idmy>U0+JCOCD

(X.

ch

ara

cte

r to

C

en

tro

nic

s

|

4-)3ft4-13O

3O

CO

CD4-1q3OO

0oCM

tim

eo

ut

|

H

SG-HrH

ft

CO3

-rl

&

an

5

seco

nd

s ?

|

£

CD

o

•aCD

s

4-13O

CD

-H

COCD

SHra

0

CQ-H

rH

0mCD

-r|

4-1

4-1

rO4-1CO

S-lCD4-1G

§0

N

OOCM

CO3

rd4-1CO

PCO

4)

O

4-1COCD4-1

•o<q

•o<D

CD4-1C

-H

CM

0)4J

3OU

NES

OOCM

1-H4-1

4-1SH

P0}

3

-HS

•oa)

f>- Ora

co CD*C3 rH

0 4-1U CDCD >iCO

4-10 O

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

-X

****-X******-K

**

**•X

**-X•X

****-X•X

***

COCO

CQvo

CO43

CMCdrHVO

^rtCQvooo

03O VOQ «>

S

P CTCO 0!4J 43

o f=C• p r*t<C t~-•C1 VO

VO 00

<C rtC03 CQvo voo oo o

r-

I

CO

CD

OE

r~wo•5J1

r C

<;CQvooo

CO

oo

S

o

oor-oCJ

o0

CJ<2mvooo

rHQ

O

VO

(U

Og

vo0ooCOCMCNn

003CQvoo0

rHQ

O

CO

S

ftgO

00oooCOVQ

CMO3

^1

PQfflvoo0

oQ03voU}

trCD43

vorH

t—VO

CO

CQfflvooo

rHQ

rH

S

CTTST)ffl

rH«qi

CMmjaj03CQvoo0

rHQ

O

S

ftgCJ

^poo0COvoCMCQ{JPQCQvooo

CJ03VO

COo43

CMOinvo

oCJmvoo0

rHQ

O

rH

er<D

og

ooCNr^

CMCJCQvoo0

0

o

CD

0g

ooo0COvoCMCM

•5PCJCQvooo

oQ

IsrH

Q

0

CD

Og

o0orHrHCOOrH

COCJCQvoo0

0

vo

rHQ

*CD

0g

VQ0OOrH^31

rHn

OOCQvooo

£

(U> coO 4-1

fc. mQ r-vo w

O CMQ QCQ CQvo voo o0 0

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

*.£

**********•K

*He-jt£

*

*

*

*

*

*

*

*

*

*

*

*

*

*

CMQ

in

rH

!>Og

(3jCQ0QCMji

CM

spQCQvoo0

CMQ

in

oCO

jrj

3

0CO

f^oQ

^pen

COQ03voo0

CMQ

OOorH

ftg0

CO[j!)COOo0ooCMCQCJo

CJQCQvoo0

CJPuPQvo

COO

COj-Hinvo

CMWCQvoo0

CMQ

in

CD

0g

pC03•cpoQCM

CM

^Pw03voo0

0mCJvo

iCO£

CMp^rHVO

COpqCQvoo0

vooU

o voQ «•

SB

4-> CDCO Gi i n

O CO^P rH<; voi VO

< oCQ CQvo voo o0 0

e.l

$

4B

A(A

5),

D3

J>0E

CQoQCMvoCMr£)

wCQvooo

Q

CMQ

jQ

3CO

CMCOVOcn

CM

CQvoo0

COQ

o0ovo=«=

rH

ftg0

ofr^, — i0oooCOCOCJo*5P|y,

CQvooo

CO

03vo

PrHQ

CJ

QVO

^fjCTHCQvooo

338

Page 346: Atari ST Internals

vO

006BFC 7000

006BFE 2B6D04BAOA80

006C04 4E75

006C06 40C3

006C08 007C0700

006COC 7207

006COE 61000E28

006C12 00000080

006C16 7287

006C18 61000E1E

006C1C 46C3

006C1E 302F0006

006C22 728F

006C24 61000E12

006C28 610C

006C2A 6104

006C2C 70FF

006C2E 4E75

moveq . 1

move . 1

rtsmove

. w

or .wmoveq. 1

bsror .bmoveq. 1

bsrmove

. w

move . w

moveq. 1

bsrbsrbsrmoveq . 1

rts

#0,DO$4BA(A5)

SR, D3

#$700, SR

#7,D1

$7A38

#$80, DO

#$87, Dl

$7A38

D3,SR

6(A7),DO

#$8F,D1

$7A38

$6C36

$6C30

#-l,DO

Flag for time

out

200 Hz

center

as

last time-out time

Save status

IPL 7, no

interrupts

MixerSelect

registers

Port B to

output

Write enable

Restore status

Character to output

Write to

port B

Strobe low

Strobe high

Flag for

OK

gI

***********************************************006C30 7420

006C32 60000E46

moveq,1 #$20,D2

bra

$7A7A

Strobe high

Bit 5

Set

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

006C36 74DF

006C38 60000E66

moveq.1 #$DF,D2

bra

$7AAO

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

006C3C 7207

006C3E 61000DF8

006C42 0200007F

006C46 7287

moveq, 1 #7,D1

bsr

$7A38

and.b

#$7F,DO

moveq. 1 #$87, Dl

Strobe low

Bit 5

Clear

listin, Get

character

from

parallel port

MixerSelect

register

Port B to

input

Ii5T

Page 347: Atari ST Internals

006C48

006C4C

006C4E

006C50

006C52

006C54

006C56

006C58

61000DEE

61E2610C4A40

66FA

61EO

720F

60000DDE

bsrbsrbsrtst.wbne

bsrmoveq.lbra

$7A38

$6C30

$6C5C

DO$6C4E

$6C36

#15,01

$7A38

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

006C5C

006C62

006C64

006C6A

006C6C

006C6E

41F9FFFFFA01

70FF

082800000000

6702

7000

4E75

leamoveq

. 1

btstbeqmoveq

. 1

rts

$FFFFFA01,AO

#-l,DO

#0,0 (AO)

$6C6E

#0,DO

Strobe high = not

busy

Get parallel

port status

Wait until character arrives

Strobe low

= busy

Select port

BRead

byte

from port

Istostat, parallel

port

status

Address of the

MFP

Default to ok

Test busy

OKStill busy

***********************************************006C70

41ED09DO

lea

$9DO(A5),AO

006C74 70FF

moveq.l #-l,DO

006C76 45E80006

lea

6(AO),A2

006C7A 47E80008

lea

8(AO),A3

006C7E B54B

cmpm.w

(A3)+,(A2)+

006C80 6602

bne

$6084

006C82 7000

moveq.l

#0,DO

006C84 4E75

rts

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

006C86 61E8

006C88 4A40

006C8A 67FA

006C8C 610005D8

bsr

$6C70tst.w

DO

beq

$6C86bsr

$7266

auxistat, RS232

input

status

iorec for

RS232

Default to ok

Head index

Tail Index

Buffer leer

?

NoNo character

there

auxin, get

character

RS-232

auxin, character

ready

?

No, wait

rs232get, get

character

Ii

Page 348: Atari ST Internals

006C90

024000FF006C

94 4E

75an

d.w

rts

#$FF

,DO

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

006C96

006C9A

006C9C

006CAO

006CA4

006CA8

006CAA

00 6CAC

41ED09DO

7 OFF

34280016

6100087CB4680014

6602

7000

4E75

lea

$9DO(A5),AO

moveq.l #-l,DO

move.w

22(AO),D2

bsr

$751E

cmp.w

20(AO),D2

bne

$6CAC

moveq.l #0,DO

rts

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

006CAE 322F0006

move.w

6(A7),D1006CB2 61000556

bsr

$720A006CB6 65F6

bcs

$6CAE

006CB8 4E75

rts

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

006CBA 7OFF

006CBC 1439FFFFFCOO

006CC2 08020001

006CC6 6602

006CC8 7000

006CCA 4E75

moveq.l #-l,DO

move.b

$FFFFFCOO,D2

btst #1,D2

bne

$6CCA

moveq.l #0,DO

rts

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

006CCC 322F0006

move.w

6(A7),D1

006CDO 43F9FFFFFCOO

lea

$FFFFFCOO,A1

006CD6 14290000

move.b

0{A1),D2

006CDA 08020001

btst

#1,D2

Iso

late

b

its 0-7

auxostat, RS232 output status

iorec for RS232

Default to ok

Tail index

Test for wrap around

Compare with head index

Not equal

No more space in buffer

CAoB9

auxout, RS232

output routine

Get data byte

rs232put, and output

Try again

ikbdost, IKBD output status

Default to ok

IKBD ACIA status

TestOKNot ready

ikbdwc, send character to IKBD

Get byte

Address of the keyboard ACIA

Get status

Ready

It/3H363

Page 349: Atari ST Internals

Abacus Software Atari ST Internals

4-1-H

s

o

voQCJvo

CT<a

VOtur~vo

frf

QCJVO0o

M0)

tJH)SJ

o4J

ft3O

CM

rHQ

45

CD>O

(NOOorH^pCOrH

O[V]

CJvo0o

tn4-1>-i

toP-WT

^31

UCJvo0o

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

ikbdw

s,

send str

ing

to

ke

yb

oa

rd

**-x•X-X-X

****•x

**•X

**-x

**•X

*****-X

*•X•X•X

nQ

o=B=

0)>O

oovo[ —

voHOVQO0

raj-i(U

O

<B

0

O

0)

3

coQ

s01>0

^p0oofc.CMVOcoCOHCJvoo0

c-HM4-10!

0)

4-1

O

CO

atCDMT!•a

CM

P-

vo

01>0

vo0o0fT,vo«spCM

CJWCJvoOo

q-HM

o

<H 4-1

0> ft4-1 4J

45 O

4J T)0! GO KC

Q

H- 0

— QCM O<C vo

0!> MO eoS 45

< CJrH QCM r-lrH VO

0 CM

CJ OVO VOo oo o

<B

01IS

0

0vo

Q

a!-i ra45 4J*O &H

<;1*-,fv,fV,

pa LOO P-rH W

<3< CO(%, (V,

O CJVO VO0 00 O

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

co

nsta

t,

ke

yb

oa

rd in

put

sta

tus

*•X**•X•X•X

***-X

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

*•XX-X•X-X

*•X

**

•o

o45

CD

O

0(U

0-H

O

LO

CM

a\S

0)

CMEKcnoQW.-I•*P

ifT|

CJVOoo

oo4-1

4-1r-H3

01Q

OQ

1=«=

tr0)>0

&Jpt,or-

Mt.CJvo00

X

•sG-H

Q)

CM

O

VO

<aCD

voo0oCOWLO

00Qvo00

X

1-H

r-f-H(8En

0

CO

<d01^H

COoooCOWr—•a1

^p0QVO0o

0)0)

0)1-4

3

CM

-t-

ft

§

PQ

LO

CQ

CO0

§oo

o

Woavo

0)

45

CM0VOvo

<oQvoo0

eq.l

#

0,D

O

No chara

cte

rs th

ere

>0

0o0p-

CJoQVOO0

0}4J

LOp-[y]^31

[VI

OQVOo0

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

conin

, get

chara

cte

r fr

om

keyboard

*•X•X•X

*•X•X

*-X

*****•X•X•X

**•X

*•X

***•X

*-X

*•X•X

c-

TSOlWCO0)

ft

0)

4J(04-1a>

oU

ovo

^_lCO

43

CO

t_jvo

o

QVOoo

0Q

4-1CO4J

0

rtfr

CM

QVOOo

4-1-H(fl

0

Ot-lQvo

tr0)

fenp-V0

i

Ovooo

e.w

S

R,

-(A

7)

Save

sta

tus

w

#$

70

0,

SR

IPL

7,

dis

able

in

terr

upts

£> •

O HE 0

Oop-o

P- Ojyi p«.o o

VO COr-l (HO QVO VOo oo o

X0)•oG-H

•aCOCD

Q

O

vo

0)>oe

voo0oCOCMCMnCJ

OVDoo

X0)•a-H

rH-HCO4-1

4-1-H

01

<g

0o

rHO

o

CO

3=

ft

O

CO0ooCOvoCMeaoCMavoo0

CM

OVO

tr0)45

CJrHp-voM

CMQVOo0

342

Page 350: Atari ST Internals

U)

006D26 5441

006D28 B2680004

006D2C 6502

006D2E 7200

006D30 22680000

006D34 7000

006D36 30311000

006D3A 31410006

006D3E E188

006D40 E048

006D42 46DF

006D44 4E75

addq . w

cmp.wbcsmoveq . 1

move . 1

moveq. 1

move . w

move . w

lsl.1Isr.wmove . w

rts

#2,D14(AO),D1$6030#0,D10(AO),A1#0,DO0(Al,Dl.w)D1,6(AO)

#8, DO

#8, DO

(A7)+,SR

,DO

***************************************************006D46 70FF

006D48 4E75

moveq.1 #-l,DO

rts

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

006D4A 082D00020484

006D50 670E

006D52 2B7C00007D5AOA86

006D5A 1B7COOOOOA8A

006D60 4E75

btst

#2,$484(A5)

beq

$6D60move.l #$7D5A,$A86(A5)

move.b #$0,$A8A(A5)

rts

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

Head index + 2

Greater than or equal buffer size

?

NoBuffer

pointer

back

to start

Pointer to keyboard buffer

Get character and

scan

code

Save new head index

Scancode to

bits 16-23

ASCII code

to bits 0-7

Restore status

conoutst, console

output status

Always OK

ringbel, tone after

CTRL

GTone

enabled

?

NoPointer to sound table for

bell

Start sound timer

006D62 001B313233343536

dc.b006D6A 373839309E270809

dc.b006D72 71776572747A7569

dc.b006D7A 6F70812BOD006173

dc.b006D82 646667686A6B6C94

dc.b

006D8A 8423007E79786376

dc.b

006D92 626E6D2C2E2DOOOO

dc.b

Keyboard table, unshifted

$00,esc, 'I'/^Va1, '4',

'5', '6'

'7', '8',

'9', 'O1, '(§',

"',bs ,tab

'q1,'w1,'e','r','t1,'z1,'u','i'

'o1,'p','[',' + ',cr,

$00,'a1,'s'

']','#',$00,'l','y','x','c','v'

•bS'n', 'm1,', ','.',

'-',$00,$00

non

Page 351: Atari ST Internals

006D9A 0020000000000000

dc.b

006DA2 0000000000000000

dc.b

006DAA 00002D0000002BOO

dc.b

006DB2 0000007FOOOOOOOO

dc.b

006DBA 0000000000000000

dc.b

006DC2 3C000028292F2A37

dc.b

006DCA 3839343536313233

dc.b

006DD2 302EODOOOOOOOOOO

dc.b

006DDA 0000000000000000

dc.b

$00,' ',$00,$00,$00,$00,$00,$00

$00,$00,$00,$00,$00,$00,$00,$00

$00,$00,'-',$00,$00,$00,'+',$00

$00,$00,$00,del,$00, $00,$00, $00

$00,$00,$00,$00,$00, $00,$00, $00

'<',$00,$00,'8',')','/','*','7'

'8','9','4','5','6', '!','2', '3'

•O'/'.'/cr, $00,$00,$00,$00,$00

$00,$00,$00,$00,$00,$00,$00, $00

BSC/5O

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

006DE2 001B2122DD242526

dc.b

006DEA 2F28293D3F600809

dc.b

006DF2 51574552545A5549

dc.b

006DFA 4F509A2AOD004153

dc.b

006E02 444647484A5B4C99

dc.b

006EOA 8E5E007C59584356

dc.b

006E12 424E4D3B3A5FOOOO

dc.b

006E1A 0020000000000000

dc.b

006E22 0000000000000037

dc.b

006E2A 38002D3400362BOO

dc.b

006E32 3200307FOOOOOOOO

dc.b

006E3A 0000000000000000

dc.b

006E42 3E000028292F2A37

dc.b

006E4A 3839343536313233

dc.b

006E52 302EODOOOOOOOOOO

dc.b

006E5A 0000000000000000

dc.b

Keyboard table, shifted

$00,esc, '!',"",'I1, '$',

'%', 'S'

'/','(', ') ','

= ', 'T'/'ISbs, tab

'Q', 'W, 'E1, 'R1, 'T',

'Z1, 'U1, 'I'

'0','P1,'[','*',cr, $00,'A','S'

']','"'B1,'N','M1,',•',':', 'I1,$00, $00

$00,' ',$00,$00,$00,$00,$00,$00

$00,$00,$00,$00,$00,$00,$00, '7'

'8',$00,'-','4',$00, '6',' + ',$00

'2',$00,'0',del,$00,$00,$00,$00

$00,$00,$00,$00,$00,$00,$00,$00

•>',$00,$00,'(',')1,

I/',I*

I,I7'

'8','9','4','5','6','I1,'2','3'

•OS'.'jCr ,$00,$00,$00,$00,$00

$00,$00,$00,$00,$00,$00,$00,$00

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

Keybaord table, Caps Lock

006E62 001B313233343536

dc.b

$00,esc,'1','2','3','4','5','6'

006E6A 373839309E270809

dc.b

'7','8','9','0','@',' "

,bs, tab

006E72 51574552545A5549

dc.b

'Q1,'W,'E1,'R1,'T1,'Z','U','I'

HB1I-*BI1

Page 352: Atari ST Internals

Abacus Software Atari ST Internals

co

<~?o -O ^4

SH "OCJ -

:+?" U

O4 fa

O Q

43 43

A2

BO

D0

04

15

3

dc,

74

84

A4

B4

C9

9

dc

,

en To voin -a1fa r*j" r

f< CMt— COCd WVO VOo o0 0

- 0> 0

- 0

- vt

X 1

>H •

^ >O -o S

=*= "Z

" ca

o o

07

E5

96

84

35

6

dc

,

D2

C2

E2

DO

OO

O

dc,

O "CO WCM TW CMCO "51

< CMCO C5>pq c£)vo voo oO 0

00

0

«•

00

ooft

oo

oo

oo

00

00

00

00

00

0

dc,

ooCMOO

rfjenfjQ

VOoo

0 00 0

O 0

</> -to

0 00 0

o oo o

o oo o

o oo o</> -to

0 00 0<fe Vr

O Oo o

00

00

00

00

00

0

dc,

00

00

00

00

00

0

dc,

o oo oo oo oo o

W CMen <2u avo voo oo o

oo

3-oo

oo

oo•in-

J

oo

oo

D0

00

00

02

BO

O

dc,

CMOOOO

(rf

^{V]

vooo

o oo o

o oo o

o oo o

0 0O 0

rH O

0) 073 Vr

0 00 0

o oo o

0 00 0

»Q f£J

07

FO

OO

OO

OO

O

dc

,

00

00

00

00

00

0

dc,

0 0o oo oo oo o

CM (<pa PQw wvo voo oo o

r-

**-x

~

oo

00</>

V

43

0•o

CO

CMfaCMenCMCOCMOOOOCJcoCMOvo00

- oCO O

- oCM O

- OrH O

- OVO O

- oIf) O

**• SH- O

en "•

CO O

43

53

63

13

23

3

dc,

DO

OO

OO

OO

OO

O

dc

,

co oen MCO CMCO Oco co(=C CMO Qvo vo0 00 0

oo

oo

oo

oo

oo

o0

do

oo

43

00

00

00

00

00

0

dc,

ooooo(Qa

vo00

Ep,

initia

lize

M

FP

68

90

1

G

-H(•H

***

******ir

k********i

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

****•K

*******

3S

of

the

M

FP

iliz

e re

gis

ters

w

ith

ze

ro

:o ie

ra

:o is

rb

:o vr

sn

-au

tove

kto

r #

to

$4

8,

se

t S

-bi-

ms

to

20 m

illiseconds

: tim

er C

sr

20

0

Hz

alize

tim

er

and in

terr

upt

ve

cto

r

C in

terr

upt

routine

C in

terr

upt

num

ber

< D - H Z S H O t H - H S H S H$ H 4 J P « 4 3 4 3 ( D O ) 4-1 CD CDTJ -rH -H SH SH PJ g rH -3< CM "H g g' O G Q t C O O l f a -H (!) VO en G -H -H< H O> -H -H S EH CO -^ rH H EH EH

!«(*C ^-* ^* m

«. ^^ O CO *CrH O < <C ~-O -~»* -v f=C — - W - C M CM< O O — - CM •. *3" CM fiCfa ( ^ r t J O C M r H ^ P rH Q ».

fa Q o co -to co" t Q o en in Qfa «. - * - . ^ P r H O .. O CJ O CJ «.faoooo«j--u>CMCMCD«>r-r~in• u > = S = Q Q Q = S = * * = » t » = » = = t t = - U J - - o > *

H H H rH <-H H rH

O - ' C X e ^ e i , * " - ^ ^ * o^Q ) < D < 1 ) C ] ) 0 ) C D ( 1 ) ( 1 ) ( D ( D Q )

O J O O O O O O O O O ' O M C U OM g g g g g g g g g g 4 3 M g

rH VO -sp CM CJO rH CO T in«; o < •* cjfa o o o r-f a O C O O C O r H * ? 1 O P Q Of a O O r H ^ T r H r H O t - Of a O O O O r H O O r H Of a O O O O r H O O O Oc n o c o c o c o c j O O C M O C J o e n mfaoooor~r~t-oincoofaor H O r H r H r H r H P Q P q O C M - a ' r H i n O* 3 * r — o o o r H c o c o t — r - - c o v o ^ j ' r -

C M C O < ( a c M V O O C M C O r t ; O O ' ! I ' <H p i q E i a b q f a f a f a O O O O r H r H r H

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

nt, in

sta

ll in

terr

upt

c tim

er

D

-H O4J Q)-H rH

G fl)-H CO

VO O«gi QrH -r- co•to *

ef0)

M t^f>*01 O

43 g

COCMCMO0 CO0 0rH 0vo r-

O 0rH CMfa faVO VOO OO O

345

Page 353: Atari ST Internals

Abacus Software Atari ST Internals

T>

idmooVDen3_iom

•31

~x

-O

1043

ooVQa\t vector

•oqCO

MCDE

-H4J

<uN

-HrH

td-H4J-HGM

^-fO

K

rHO

^COenv>^

oo

J_(01

K

^_,01

s-

opK

rH G

O Ool

KO EH

EH Q

CMCOCMU)P5rHo

MH

OCUMO

-rH

O4J

HG CUO 4->

CCO -HEH OPi CM

O0)!HO

O1H

m(d

T3

.p

fd4J

C/3

f^Pi

0ol 4_>(U G4J -H>^43 >i

ft•=p OCO O

MQM

O0)

o-H

O+J

MCU

G-HO

OCD

o-H

j^0t-l

id4->(Q (ft•a CD

jjS-H 43<aCO rH

SPJJpio4JG-H

ftOU

or

ve

cto

r

Mn0)

HQt-HS

•Bfim•0M<aO43>iCDM

ine

ke

yb

oa

rd

4JP0H^4OnMCU

04-1

MCD4-1C-HO

CM

HQMS

CU

-t-l4->P0H

HOrHrH

CU

o4->

M0!4-1G-H0

CM

H04-1OCD>

4JftP!HMCU4Jc;-H

HQMS

4-1CU01CUM

MCU4-101fflS

<MOrtl1MQMS

4-1-H

ft

OG

-r-143

ftO4-101

rH

•V

4J-rH43

CO

^vorHN.

bell e

nable

•oGP

.p<dCUftCUi«,yO

-HrH0

>^CUM

OCU>4-1id4-101

O «!CU> 0X CU0 >o >rH O

O -n

01(I)rH

3-HH<0> fH

0)tJ 4J Hc c a)3 -H S0 O -H01 ft 4->

M T3 >i(d G <d0! P rHrH O 0)O W Q

rHQ

rH

rH

CU>Og

rHOCMf^

CMCMfaVO0o

CMQ

CM=tt=

CD>Og

CMO*=Tr-

•=rCMfaVDOO

o

£

M01

43

00VDrHO00rHVO

VOCMfaVOo0

Q

rH0rHO00

=tt=

CU

og

rHOrHO00enoooCOoCM

<:CMfaVOoo

o

voCM

Q

.H

oT-HCU>og

VDCMOOCOUrHO

OCOfaVDO0

Or-

r-

0143

*-Ccofflo00rH

VO

•5TCOfaVOoo

COvo

s

rH01

HCMmo00rH

VO

03COfaVOoo

*.

0Q

(dCUrH

OQ

OQMrH•5F

UCOfaVDO0

rH

W

<dCUrH

Wmor^0oo0enfaCO•=r

O•SJ1

favooo

oQjrj

CO=tt=

c— 1

0!

Os

rHCM0p-vo•SJ1

faVOoo

VDCO

f—

Mra

CJWoo0orHVO

03«gifaVOoo

in

0

1

id0)rH

00

0Q[V]

rH

^

U•a1favoOo

rH

O

s

(dCUrH

omor-0o00cy\

CO«ToinfaVDoo

oQ

CO

=8=

H

f-HUCU

og

Q0Or^voin[V,

vooo

voCO

r—

^401

43

CJQO000rHVO

COinfavooo

oO

£to

=*t=

CUJ>og

Uenm

0o0o(_)COoCM

0mfavooo

m

CMrH

OQ

rH

CU

Og

CMrH

00•S31

PQCM

CMVDfaVOoo

inrt!vorH<

OQ

CU

Og

vorH

00«3*CQCM

VOvofaVDOO

m£o

voOen

rH

CU>og

W0

oVDOenr^0o00CJ

oqCM

<VOfavoo0

m

CM

COmm

rH

CU

og

CM

oCOmmc—o0ooosCM

CMt-faVO0o

aCM

COVOin

vt

rH

CU[>Og

WCM

0COvoin

0000CJ

sCM

f£r-favo0o

^pQ

O

fa

fa

t-0

*

43

0)>Og

•0"0ofafafafafa(Oo00CJfaCOrH

CMCOfaVOO0

0ofafa

en

=tt=

43

CU

OS

oUfafafafafamOSoo0faCOrH

<,COfavooo

m

CO

vt

*43

0)>Og

qiCO•31

Or^000oc—mrH

CMenfavo0o

m

CM

i

rH

CU>0g

CMCMrt0vo•3*(3*vo0o0oor-fflCM

COenfavoo0

0O

COo

H

CU>Os

J1COor-oo0oocooCM

OfffaVOO0

in

rH

OQ

rH

CU>Og

rfjrH

Oo1 1

PQCM

VO

<faVOo0

in

W<H

OQ

rH

0

>Og

[V]

<H

OO^*coCM

g?

faVOoo

m

voCM

OQ

H

CU>O

voCM<Oo

PQCM

wrt*favoOo

oQ

O

*rH

CU>Og

Ooor-

CMpqfavoo0

in

voCO

oQ

rH

CU>os

voCO

O0

pqCM

•=rCQfaVOO0

IO

CO

oQ

43

CU>o

rflCO

oo

mrH

COCQfavooo

346

Page 354: Atari ST Internals

Abacus Software Atari ST Internals

4-13 .do en0) -He .G

-H4-1 O

•aido43>i(U

o<U

i-4O

o4-1

a>EH

M 4-1PH CO

S-4O

id4-1rd 01 4-1

4J -H4-> >1

!B G,

S

So

01

43IB4-1

•oMrd043>,0!y

wOMmo4-1

<:MO•a;•a

ojQ

>i

-H

IB

OG

4-1-H43

O,O4-1

rH

CO4-1-H

O4-1O0)

4-1G,

M

0)4-1C

PM

S

O4-1

01VlO4-100)>f-130

<H

<uN

co o id4-1 -H

H0!

3G 4-1

0)4-1 COft. HH

H O

0) 014-1 3C rH

(UrH43IB4-1

g0H

M-l

^1O4J00!J>

4-10)cs

4-1G,3MH0)4-1G•rl

rHrH

IB4JCOG-H

*,4-1G

-Hi)-HG-H

)04-1O(U>4-1

<D

JHO

tj0)>•om

o431 1

0)

*oGid

MQrHS

vo)

01

g=3G

VIO4-1O0>>4-1A3>HMCD4-1G-H

rH

IB4-1COC-H

•.

0)G-H4-13O^4

4-1a3i

a>

CM

n0143

3G

4-1a,3HH0)4-1G-H

rHrH

IB4-101G

-H

K,

Q

gM

i-l0>H

134-1IB

T3

4-1

G-H

O4-1

4-1 4-1>H G G SHO -H -H O4-14-1 4-1O -H CO O0! C EH 0)> -H CJ >

Qea

o4-1

en

4-1 H CO 4.1G 0) (D 01-H 4-1 4-1-H q > •§

01to

-H -H 43G O

-H P4 ^=r

~ —- m ^- oin r3?

P3 O03 CO

OCO

o oQ D

<•« o

CM Q VO CM

o ra

ooCJfafafa

ooCJfafa

VI- O<v CO

CMQ

CM O O CM ^ VOQ Q O, Q CO -a-

K ^ ^ ^ < rHrH rH CTi CM — C^Q Q =»==«= o -co-

in<

o vo o oCM Q O Q

vo r- t—3*= </> **>

vo co•sr orH r~r~ <f>

co oQ fa

43 43

O Os e

>01 O43 e

tr0!

cr

o o>S rH

0) 01> > -q rH >_ ^4o i b c o c o b b b b b b t i c Q b c o

^ * * S S i a r a g 4 3

tr>O COS 43

tr trJ> SH J> t* J-f tOO CO O O CO 4-1S 43 E £ 43 M

pa oCO CO< <;o oo o•a1 rCQ parH CM

0

VO OCJ 0[%, Q

0 OO r^rH 03VO rH

0CM0OOO("""

pa

CMfacy*oQfarH•a>

CM

Or-o0ooenfaco«3-

QOOt—

0oo

q> Om orH rHVO VO

3F

FF

FF

CO

O

oooCJ

corH

6F

FF

FF

CO

O

en00oco

0CO0r-oo00O COr- oVO CM

rH rH0 0^P OCM CM

O000 CM0 COvo mO H

< oCM OrH CO

Q CM O

COOr-

o oCM OrH OO O

CJ COr- o

O r H - a ' V O r H H

O o r co pq «=ppa o o o o afa fa h fa b< faVO VO VO VO VO VDo o o o o oo o o o o o

o o o o oo o o o o

o oo o

o oo o

o co CJ sCO CO W CMO rH fa in rHCM o fa r- oCO O en Q VO Or- o o W o o H«• rH rH in O rH in

O O r H r H r H r H r H C M C M C M C M C O C 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 o o o o o o o o o o o o

347

Page 355: Atari ST Internals

007036 10D9

007038 51C8FFFC

00703C 4E75

move.b

(Al)+,(AO)+

dbra

DO,$7036

rts

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

00703E 8001121A

dc.b

$80,$01,$12,$1A

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

007042 000008DO

007046 0080

007048 0000

00704A 0000

00704C 0020

00704E 0060

dc.l

dc.w

dc.w

dc.w

dc.w

dc.w

$8DO

128

003296

Block move

Next byte

Reset keyboard, disable mouse und joystick

iorec for keyboard

Keyboard buffer

Length of the keyboard buffer

Head index

Tail index

Low water mark, 1/4 buffer length

High water mark, 3/4 buffer length

63en!

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

00007050 00000950

007054 0080

007056 0000

007058 0000

00705A 0020

00705C 0060

dc.l

dc.w

dc.w

dc.w

dc.w

dc.w

$950128003296

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

00705E 000006DO

007062 0100

007064 0000

007066 0000

007068 0040

00706A OOCO

00706C 000007DO

007070 0100

dc.l

dc.w

dc.w

dc.w

dc.wdc.w

dc.l

dc.w

$6DO

256

0064192

$7DO

256

iorec for MIDI

MIDI buffer

Length of the MIDI buffer

Head index

Tail index

Low water mark, 1/4 buffer length

High water mark, 3/4 buffer length

iorec for RS232

RS232 input buffer

Length of the input buffer

Head index

Tail index

Low water mark, 1/4 buffer length

High water mark, 3/4 buffer length

RS232 output buffer

Length of the output buffer

Page 356: Atari ST Internals

007072

007074

007076

007078

00707A

00707B

00707C

00707D

00707E

00707F

0000

0000

0040

OOCO

000000000100

dc.w

dc.w

dc.wdc.wd

c.bd

c.bd

c.bd

c.bd

c.bd

c.b

0064192000010

Head indexTail indexLow water mark,

1/4 buffer length

High water mark,

3/4 buffer length

rsrbyte, receiver

statustsrbyte,

transmitter status

rxoff,txoffrsmode, XON/XOFF

modefiller

63GO

I3

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

007080 00007426

007084 00007374

007088 00007408

00708C 000072CO

dc.l

$7426

dc.l

$7374

dc.l $7408

dc.l $72CO

Interrupt vectors

for MFP

#9, transmitter

error#10,

transmitter interrupt

#11, receiver

error#12,

receiver interrupt

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

007090 48E7F8FO

007094 207CFFFFFA01

00709A 267C00007124

0070AO 247C00007128

0070A6 615A

0070A8 267C00007118

0070AE 247C00007128

0070B4 614C

0070B6 267C0000711C

0070BC 247C00007128

0070C2 613E

0070C4 267C00007120

0070CA 247C00007128

0070DO 6130

movem . 1

move . 1

move . 1

move . 1

bsrmove

. 1

move . 1

bsrmove

. 1

move . 1

bsrmove .

1move

. 1

bsr

DO-D4/AO-A3,-(A7)

#$FFFFFA01,AO

#$7124, A3

#$7128, A2

$7102

#$7118, A3

#$7128, A2

$7102

#$711C,A3

#$7128, A2

$7102

#$7120, A3

#$7128, A2

$7102

setimer, initialize

timer in MFP

Save registers

Address MFP

Iia635?

Page 357: Atari ST Internals

0070D2 267C0000712C

0070D8 247C00007130

0070DE 6122

0070EO C749

0070E2 47F900007134

0070E8 7600

0070EA 16330000

0070EE 11823000

0070F2 B4303000

0070F6 66F6

0070F8 C749

0070FA 8313

0070FC 4CDFOF1F

007100 4E75

007102 6106

007104 1612

007106 C713

007108 4E75

00710A 7600

00710C D6CO

00710E 1613

007110 D688

007112 2643

007114 D4CO

007116 4E75

move . 1

move . 1

bsrexgleamoveq . 1

move.b

move . b

cmp.b

bneexgor .bmovem . 1

rts

bsrmove . b

and.b

rts

moveq . 1

add.w

move . b

add.l

move . 1

add.w

rts

#$712C,A3

#$7130, A2

$7102

A3,A1

$7134, A3

#0,D3

0(A3,DO.w)

D2,0(AO,D3

0(AO,D3.w)

$70EE

A3,A1

Dl, (A3)

,D3.w),D2

(A7)+,DO-D4/AO-A3

$710A

(A2),D3

D3, (A3)

#0,D3

DO, A3

(A3),D3

AO,D3

D3,A3

DO,A2

I3Write data in

MFP

And compare

Until match

Restore registers

I

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

007118 06060808

00711C OAOAOCOC

dc.bdc.b

6er

o D

r Of o r o

10,10,12,12

I3

Page 358: Atari ST Internals

007120 OEOE1010

007124 12121414

007128 DFFEDFEF

00712C 181A1C1C

007130 00008FF8

007134 1E202224

dc.b

14,14,16,16

dc.b

18,18,20,20

dc.b

$DF,$FE,$DF,$EF

dc.b

$18,$1A,$1C,$1C

dc.b

0,0,$8F,$F8

dc.b

$1E,$20,$22,$24

movem.l DO-D2/AO-A2,-(A7)

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

007138 302F0004

move.w 4(A7),DO

00713C 246F0006

move.l 6(A7),A2

007140 02800000000F

and.l

#15,00

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

007146 48E7EOEO

00714A 6120

00714C 2400

00714E E542

007150 068200000100

007156 2242

007158 228A

00715A 614A

00715C 4CDF0707

007160 4E75

$716C

DO,D2

#2,D2

#$100,D2

D2,A1

A2,(Al)

$71A6

movem.l (A7)

H-,DO-D2/AO-A2

rts

bsr

move.1

asl.w

add.l

move.1

move.1

bsr

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

007162 302F0004

move.w

4(A7),DO

007166 02800000000F

and.l

#15,00

00716C 48E7COCO

movem

007170 41F9FFFFFA01

lea

007176 43E80012

lea

00717A 614A

bsr

1 DO-D1/AO-A1,-(A7)

$FFFFFA01,AO

18(AO),A1

$71C6

ussenCA

mfpint, set

MFP interrupt vector _

Interrupt number

Interrupt vector

Number 0-15, long word

initint, Set MFP interrupt vector

Save registers

Disable interrupts

Vector number

As index for long word

Plus base of the MFP vectors

Vector addres

Set new vector

Enable interrupts

Restore registers

disint, disable MFP interrupts

Get interrupt number

Convert to long word index

Save registers

Address the MFP

Address imra

Calculate bit number to clear

z5?

Page 359: Atari ST Internals

00717C 0391

00717E 43E80006

007182 6142

007184 0391

007186 43E8000A

00718A 613A

00718C 0391

00718E 43E8000E

007192 6132

007194 0391

007196 4CDF0303

00719A 4E75

bclr

leabsrbclr

leabsrbclr

leabsrbclrmovem.l

rts

Dl, (Al)

6(AO),A1

$71C6

Dl, (Al)

10(AO),A1

$71C6

Dl, (Al)

14(AO),A1

$71C6

Dl, (Al)

(A7)+,DO-D1/AO-A1

And clear bit

Address iera

Calculate bit number to clear

And clear bit

Address ipra

Calculate bit number to clear

And clear bit

Address isra

Calculate bit number to clear

And clear bit

Restore registers

63£en

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

00719C 302F0004

move.w

0071AO 02800000000F

and.l

0071A6 48E7COCO

movem.l

0071AA 41F9FFFFFA01

lea

0071BO 43E80006

lea

0071B4 6110

bsr

0071B6 03D1

bset

0071B8 43E80012

lea

0071BC 6108

bsr

0071BE 03D1

bset

0071CO 4CDF0303

movem.l

0071C4 4E75

rts

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

4(A7),DO

#15,DO

DO-D1/AO-A1,-(A7)

$FFFFFA01,AO

6(AO),A1

$71C6

Dl, (Al)

18(AO),A1

$71C6

Dl,(Al)

(A7)+,DO-D1/AO-A1

jenabint, enable MFP interrupts

Vector number

In long word index

Restore registers

Address MFP

Address iera

Calculate bit number to set

And set bit

Address imra

Calculate bit number to set

And set bit

Restore registers

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

0071C6 1200

0071C8 OC000008

0071CC 6D02

move.b

DO,D1

cmp.b

#8,DO

bit

$71DO

bselect, calculate bit and register number

Save interrupt number

Greater than 8 ?

No

I/IHB1(•«*r&3&5?

Page 360: Atari ST Internals

0071CE 5141

0071DO OC000008

0071D4 6C02

0071D6 5449

0071D8 4E75

subq.w

#8,D1

cmp.b

#8,DO

bge

$7108

addq.w

#2,A1

rts

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

0071DA 41F9000009DO

0071EO 43F9FFFFFA01

0071E6 4E75

lea

lea

rts

$9DO,AO

$FFFFFA01,A1

Else subtract offset

Greater than 8 ?

Yes

Pointer from a to b register

rs232ptr

Pointer to RS232 iorec

Pointer to MFP

tanpta

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

0071E8 34280008

move.w 8(AO),D2

0071EC 36280006

move.w

6(AO),D3

0071FO B443

cmp.w

D3,D2

0071F2 6204

bhi

$71F8

0071F4 D4680004

add.w

4(AO),D2

0071F8 9443

sub.w

D3,D2

0071FA 4E75

rts

rs232ibuf

Tail index

Head index

Head > tail 1

No

Add buffer size

Tail - head

0071FC 082800010020

007202 6704

007204 61000862

007208 4E75

A**************************************************

r**** *******************

btst

#1,32(AO)

beq

$7208

bsr

$7A68

rts

rtschk

RTS/CTS mode

Nortson

00720A 40E7

00720C 007C0700

007210 61C8

007212 082800000020

007218 6706

move.w

SR, -(A7)

or.w

#$700,SR

bsr

$71DA

btst

#0,32(AO)

beq

$7220

rs232put, RS232 output

Save status

IPL 7, disable interrupts

rs232ptr, get buffer pointer

XON/XOFF mode ?

No

sCMHna

Page 361: Atari ST Internals

00721A 4A28001F

00721E 6618

007220 08290007002C

007226 6710

007228 34280014

00722C B4680016

007230 6606

007232 1341002E

007236 601A

007238 34280016

00723C 610002EO

007240 B4680014

007244 6716

007246 2268000E

w

00724A 13812000

t-ft 00724E 31420016

*"

007252 61A8

007254 46DF

007256 023COOFE

00725A 4E75

00725C 619E

00725E 46DF

007260 003C0001

007264 4E75

tst.bbnebtstbeqmove

. w

cmp.wbnemove .

bbra

move . w

bsrcmp.wbeqmove

. 1

move . b

move . w

bsrmove .

wand.brts

bsrmove

. w

or .brts

31 (AO)$7238#7,44(A1)

$7238

20 (AO) ,D2

22(AO),D2

$7238

D1,46(A1)

$7252

22(AO),D2

$751E

20 (AO) ,D2

$725C

14 (AO) ,A1

D1,0(A1,D2

D2,22(AO)

$71FC

(A7)+,SR

#254, SR

$71FC

(A7)+,SR

#1,SR

.w)

XON active ?

YesIs MFP

still sending ?

YesHead

indexTail

indexStill

characters in buffer?

Pass byte to MFP

Tail index

Test for wrap

aroundCompare with

head index

Same, buffer full

Get current

buffer address

Write character

in bufferSave

new tail

indexrtschk,

set RTS

?Restore

status flag

Clear carry

flag

rtschk, set

RTS ?

Restore status

Set carry flag,

don't output

char

B9sCO

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

007266 40E7

move.w SR, -(A7)

007268 007C0700

or.w

#$700,SR

00726C 6100FF6C

bsr

$71DA

007270 32280006

move.w

6(AO),D1

rs232get, RS232

inputSave

statusIPL 7,

disable interrupts

rs232ptr, get

RS232 pointer

Head index

Page 362: Atari ST Internals

OiUiU)

007274 B2680008

007278 671A

00727A 61000296

00727E 22680000

007282 7000

007284 10311000

007288 31410006

00728C 46DF

00728E 023COOFE

007292 6006

007294 46DF

007296 003C0001

00729A 082800000020

0072AO 671C

0072A2 4A28001E

0072A6 6716

0072A8 6100FF3E

0072AC B468000A

0072BO 660C

0072B2 123C0011

0072B6 6100FF52

0072BA 4228001E

0072BE 4E75

cmp.wbeq

bsr

move . 1

moveq.lmove

. b

move . w

move . w

and.bbra

move . w

or .bbtstbeqtst.bbeqbsrcmp.wbnemove

. b

bsrclr.brts

8(AO),D1$7294$75120(AO),A1

#0,DO

0{Al,Dl.w),DO

D1,6(AO)

(A7)+,SR

#254, SR

$729A

(A7)+,SR

#1,SR

#0,32(AO)

$72BE

30 (AO)

$72BE

$71E8

10(AO),D2

$72BE

#$11, Dl

$720A

30 (AO)

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

0072CO 48E7FOEO

0072C4 6100FF14

0072C8 1169002A001C

0072CE 08280007001C

0072D4 67000092

0072D8 082800010020

movem.l DO-D3/AO-A2,-(A7)

bsrmove.bbtstbeqbtst

$71DA42(A1),28(AO)#7,28(AO)

$7368

#1,32(AO)

Tail index

No character in buffer ?

Test for wrap around

Get buffer address

Get character

from bufferSet new

head indexRestore

statusClear

carry flag, OK

Resto

re sta

tus

Set carry flag, no character there

XON/XOFF mode ?NoXON

active?NoGet

input biffer length

usedEqual

low water mark ?

NoXONSendClear

XON flag

rcvint, RS232 receiver

interrupt routine

Save registers

rs232ptr, get RS232

pointerRead

receiver status register

Interrupt through

receiver buffer

full ?NoR

TS/C

TS

mode

?

ttnenIMM

*

t/5HE.8?

Page 363: Atari ST Internals

Abacus Software Atari ST Internals

4H4HO01

4-1H

M<D4-1ol

-HenCDH

M0)>

-HCDO0)in

EoMIH

104J<0•a•a(0CD

c-

CD

(fl

U

toEHe;

C"

0!73O£

fafaOX

01 3Q) O

>H X

£\

T!(U

-H0)O(U

30 03 X

en10rH

M-l

fafaoX

M10<u

O rH

3 CJ

M<BIHtH

343

C-H

J_JbG

j |

<B4-1O10

IS

u

£V.

fafaoX

0)

-H0)o01

en<drH

1-1

fa

fa

0

X

4-1O 0)3 (/}

M(1)

HHm343

G-rl

4-1OG

^_(

0!4_)O<aj_l

10e*

U

•aG3On<aa,<s>H

X 150)•a MG O

-H tH

rH 4J-H 0119 CD

EH EH

C**

, — 1-H104_)

rH

103tr0)

•a(0 01(U 0)W >H

01U(UM•o•a<o!HCD

IHp

43

4-10)IS

M<D

<M1H

343

G-H

0)4-1

45

•a0)

-H(UO0)K

x0)•aG

-H

rH

-H104-1

u0)G

(U

<0t/3

T!0)Ol

3

^51 1D^G0!rH

M0!IHIH343

4-13aG

-H

4-10)13

o-_*sM10£

JHCD4-110

^r^Cn-H^q

rH

103O1 0H 3

C*'

0)•o0E

£/)EHU•v^

inEH«

C"

0)•ao£

fafaOX•v .

01 3at o

SH X

O"

4-1G0)01

>1•a10(UMrH

IS

pl-,-1

PM

0 OS X

<=r *xrC£) VD

CM f=Cr- r-

cr MQJ W

0Q

_„_,_)

<^-~_-<^Q

•=r

43

(U

OE

0<

CM

^_,— ]

*

4J05JJ

irHCOr-

0)c

0

•ta'

CMCO^

O

4-1014-1

•C*rHCOr-<rt

O1(U43

oQ

p .

1-1

41=

43

aEO

vooCOt—

0!C

O

rHCO CO

0 CO

* <*

•0)

.> ISO JH

0Q

cnrH

*

43

a,so

^?rH

CO

«>

0)

C

rH

CO•fc

PL,

h

•c/>=tt=

45

?'oE

COvoCOt—«•

ISH43

rHQ^

. .

Of^C<^-co

,5•

0)

oe

CNtH

iOp-«•

01

43

rH

Q

|

, „

O

f^*— 'VO

S

fi£O

COvoCOr-«>

trCD43

CM

^,_%

o•fc—

o

rH

0)

oE

0

CM

f^-—O^

OQ

43

0)

0E

0f3*•~r

COfc.

T-H

Q

.J•

(U

0E

COWrH

( —«>

01

43

CMQ

^_^

Ort^•»--

CMrH

uo,E0

uIOCOf-*«•

0)c43

0

- --

CMCO^

rH=t(=

4-1014-143

COvoCOr-«•

0!G43

0

•*-•

CMCO

»,0

*

4-1014-143

,~^

0 0an <CO —r~ o«> CO

43

CT 4-10) 0143 4-1

oCMOO

CM H rHCO CM O[ ^ 0 00 0 0

OCMOoOOOo

Oo

oooooo

• s r o a i c O ' 3 ' C O C J O c o t J C MO O C M C M C M C M r H O O l ^ V O

Q M TT1 M M fTi f~i TTi f~i FTT f~^C M C M t M C M C M C N C M C M C M C M C O

0 0 0 0 0 0 0 0 0 0 0o o o o o o o o o o o

OO

CO farH fa

O Oo oo co u •a1o o r- 10O VO rH OO VO rH VO

VO < O CMO O O rHro ro ro ror- r~ r- r-o o o oo o o o

CO COO faO rHO OCO OCM O

O O CO 00o o o tqo o o wO rH O fa

VO CO O rH O^r vo co

CJoooCO

oCMoorHoooCO

O VO CM CMVO CO

CMoooooo

CO CO

ooCOCM

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

356

Page 364: Atari ST Internals

00734C

00734E

007354

007358

00735C

007362

007364

007368

00736E

007372

660E

117COOFF001E

123C0013

6100FEBO

082800010020

670461000702

08A90004000E

4CDF070F

4E73

bne

$735C

move.b #$FF,30(AO)

move.b #$13,Dl

bsr

$720A

btst

#1,32(AO)

beq

$7368

bsr

$7A68

bclr

#4,14{A1)

movem.1 (A7)+,DO-D3/AO-A2

rte

Yes

Set flag for XOFF

XOFF

Send

RTS/CTS mode ?

Nortson

Clear interrupt service bit

Restore registers

tana

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

007374 48E720EO

movem.1 D2/AO-A2,-(A7)

007378 6100FE60

00737C 082800010020

007382 6630

007384 082800000020

00738A 6706

00738C 4A28001F

007390 6622

007392 1169002C001D

007398 34280014

00739C B4680016

0073AO 6712

0073A2 6100017A

0073A6 2468000E

0073AA 13722000002E

0073BO 31420014

0073B4 08A90002000E

0073BA 4CDF0704

0073BE 4E73

bsr

btst

bne

btst

beq

tst.b

bne

move.b

move.w

cmp.w

beq

bsr

move.1

move.b

move.w

bclr

$71DA

#1,32(AO)

$73B4

#0,32(AO)

$7392

31(AO)

$73B4

44(A1),29(AO)

20(AO),D2

22(AO),D2

$73B4

$751E

14(AO),A2

0(A2,D2.w),46(Al)

D2,20(AO)

#2,14(A1)

movem.1 (A7)+,D2/AO-A2

rte

txrint, transmitter buffer empty

Save registers ?rs232ptr, get RS232 pointer

RTS/CTS mode ?

Yes, then use this interrupt

XON/XOFF mode ?

NoXOFF active ?

Yes

Save transmitter status register

Head index

Compare with tail index

Send buffer empty

Test for wrap arround

Pointer to send buffer

Pass byte to MFP for sending

Save new head index

Clear interrupt service bit

Restore registers

ff

2.S3reBE>3?

Page 365: Atari ST Internals

0073CO 48E720EO

0073C4 6100FE14

0073C8 082800010020

0073CE 672A

0073DO 1169002C001D

0073D6 08280007001D

0073DC 67F8

0073DE 34280014

0073E2 B4680016

0073E6 671E

0073E8 61000134

0073EC 2468000E

0073FO 13722000002E

0073F6 31420014

0073FA 08A900020010

LOUi

007400 4CDF0704

00

007404 4E73

movem . 1

bsrbtstbeq

move . b

btstbeq

move . w

cmp.wbeqbsrmove

. 1

move . b

move . w

bclrmovem

. 1

rte

D2/AO-A2,-(A7)

$71DA

#1,32(AO)

$73FA

44(A1),29(AO)

#7,29(AO)

$73D6

20(AO),D2

22(AO),D2

$7406

$751E

14 (AO),A2

0(A2,D2.w) ,46(A1)

D2,20(AO)

#2,16(A1)

(A7)+,D2/AO-A2

ctsint, CTS

interrupt routine

Save registers

rs232ptr, get

RS232

pointer

RTS/CTS mode ?

No, then

ignore

interrupt

Save transmitter

status

Transmitter buffer empty

?

No, wait

(must

jump

to $73DO!)

Head index

Compare with

tail

index

Transmit buffer

empty

Test for

wrap arround

Pointer to transmit

buffer

Pass byte to

MFP

for sending

Save new

head index

Clear interrupt

service

bit

Restore registers

B3Ocno

007406 60F2

bra

$73PA

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

007408 48E780CO

00740C 6100FDCC

007410 1169002A001C

007416 1029002E

00741A 08A90003000E

007420 4CDF0301

007424 4E73

movem.l DO/AO-A1,-(A7)

bsr

$71DAmove.b

42(Al),28(AO)

move.b

46(A1),DObclr

#3,14

{ADmovem.l

(A7)+,DO/AO-A1

rte

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

007426 48E700CO

movem.l AO-A1,-(A7)

Transmit buffer empty

rxerror, receive

error

Save registers

rs232ptr, get

RS232

pointer

Save receiver

status

Read data

register

(clears

status)

Clear interrupt

service

bit

Restore registers

txerror, transmit

error

Save registers

Bsr3sr

Page 366: Atari ST Internals

Abacus Software Atari ST Internals

$71D

A

rs2

32

ptr

, g

et

RS2

32 p

oin

ter

toJ3

Wg£of T (

ootHv£)

ts£CM•C1

r-00

.b

44 (

Al)

,29

(AO

) S

ave

tran

smit

ter

statu

s

0!

oE

QTH

OOUCMOOen^otHtH

WCM^P

[ —O0

#1

,14

(A1

) C

lear

in

terr

up

t se

rvic

e b

it

rHO

H0OotHOooen<£COo•=pCO"C1

r-00

m.l

(A

7)+

/AO

-A1

Rest

ore

reg

iste

rs

cuoE

0oCOofry.QCJ

f£CO"C1

( —o0

cu4-1(H

COr-W*=p

WCO31

r^00

****

****

****

****

****

* io

rec,

get

po

inte

r to

ta

ble

•X*•X•X**

*•X

*****•X•X•X•X-XX•X****-X

**•X-1C

*•X

Q

o

rH

cfcuoe

ooCMr^o•31•31r^o0

cuX!3C

CU0

-H>•o4-10)U

tHQ

io

^pooo[V,

CMCMCO

CM1*

«gir-00

to3

104-1to

Ien

c—

I

P?en

cuo£

i—Wo^pVQ•=3*•31f^O0

#$

70

0, S

R

IPL

7

, d

isab

le

inte

rru

pts

3M

O

0o[~-ooooCO*=psp[•oo

$745

C,A

2 B

ase

ad

dre

ss

of

the

tab

le

COCU

CJ

«gir-0oooen(J4

in"3*opspr-o0

•Q

o3

CorH

o

COCU

-HEH

Q

CM

rH

CO10

tHCOinwCMin«gir-oo

.1

0(A

2,D

1.1

) ,D

O

Get

p

oin

ter

to

iore

c.w

(A

7)+

,SR

Rest

ore

st

atu

s

> > toO O 4J

0OCOrHCM Cs4 in<o Q r-0 VO H

^P CO <in m in"31 *T *Tr- r~ r-o o oo o o

****

****

****

****

****

* io

rec

tab

le

•X-X*•X***•X•X*•X*•X•X*-X•X-X•X•X•X*-X-X*-X•X•X•X*•X

CMCOCMtoK

oQen

rH

o•o

oQenooooo

0in•3"[OO

1M

CM

cn

H.o

TS

CMfccnoooooo10^p[oo

(HQMS

Oo

rH

OTJ

OorijOOooo"=rvospr-oo

****

****

****

****

****

* rs

co

nf,

co

nfi

gu

re

RS2

32

•X-X•X•X-X*-X-X******•X•X•X***-X*•X*•X*•X•X*-X•X*

CO

a3M

cu4-1c•rH

curH

COto

-H•o

1—

CU

en•s

0o

3MO

oor~-oUooCO10•31

[ —oo

$71D

A

rs2

32

ptr

, g

et

RS2

32

po

inte

r

<aXi

OvoQPT,

OotHVD

CJU>sp[oo

OCO

en4-1

CO!H

03

CD

en

Q

coCM

a,§0s

COCMoOcnspEnO

0

[—pr-oo

oQ

O

rH

cr

oE

ooo[

*3*

[—•C1

r-oo

ncu-H

CUOcuM

CUrH

.Q<0CO

-HQ

tH<

CM^P

OQ

XI

io

fCM000

COtH

vot^•31f^00

cu4-14-1-HECOCffl

4-1

CUrH

COCO

-HQ

tH

OQ

iog

CJCMOoo•a1COtH

<£r-qir^oo

•80S

vo

3

4-1to4J

1 3O0O

^Qt*C•531

w^Tr^00

cu0]

4-1

Co•occuX CU•M T3ocu «> r4

-H4-> 4-1(0 CUtn cocu <u!Z K

O

CMCO

W ~co r-

vt r-

CU-H >S 0X) E

oCMOOr-o0o

o voffl rH

CM -31

CO CO•sP T

f^- (^0 00 0

359

Page 367: Atari ST Internals

00748A

00748C

00748E

007492

007494

007498

00749E

0074A2

0074A8

0074AC

0074AE

0074BO

0074B4

0074B8

0074BA

0074CO

OJON

0074C4

°

0074C6

0074CC

0074DO

0074D2

0074D8

0074DC

0074DE

0074E4

0074E6

0074EA

0074EE

0074FO

7000

7400

4A6F0004

6B20

322F0004

45F9000074F2

10321000

45F900007502

14321000

2200

7003

6100FBDE

4A6F0008

6B06

136F00090028

4A6FOOOA

6B06

136FOOOB002A

4A6FOOOC

6B06

136FOOOD002C

4A6FOOOE

6B06

136FOOOF0026

7001

1340002A

1340002C

2007

4E75

moveq.l

moveq.ltst.wbmi

move . w

leamove

. b

leamove

. b

move . 1

moveq , 1

bsrtst.wbmi

move . b

tst.wbmi

move . b

tst.wbmi

move . b

tst.wbmi

move . b

moveq . 1

move . b

move . b

move . 1

rts

#0,DO#0,D24(A7)$74B44(A7),D1

$74F2,A2

0{A2,Dl.w),DO

$7502, A2

0(A2,Dl.w),D2

DO,D1

#3, DO

$7090

8(A7)

$74CO

9(A7) ,40 (Al)

10 (A7)

$74CC

11(A7),42(A1)

12 (A7)

$7408

13{A7),44(A1)

14 (A7)

$74E4

15(A7),38(A1)

#1,DO

DO,42(A1)

DO, 44 (Al)

D7,DO

Baud rate

Negativce, then don1

Get baud rate number

Table for baud rate

Get value from table

Table for baud rate

Get value from table

Pointer to timer D

Set timer D for new

Set ucr ?

NoSet ucr

Set rsr ?

NoSet rsr

Set tsr ?

NoSet tsr

Set scr ?

NoSet scr

Enable receiver

Enable transmitter

t change

control

data

baud rate

Old value of the control register

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

0074F2 0101010101010101

dc.b

1,1,1,1,1,1,1

Timer values for RS-232 baud rates

High byte

I21I635?

Page 368: Atari ST Internals

0074FA 0101010101010202

007502 01020405080AOB10

00750B 204060808FAF4060

007512 5241

007514 B2680004

007518 6502

00751A 7200

00751C 4E75

dc.b

1,1,1,1,1,2,2

dc.b

1,2,4,5,8,10,11,16

Low byte

dc.b

32,64,96,128,143,175,64,96

addq.w #1,D1

cmp.w

4(AO),D1

bcs

$751C

moveq.l #0,D1

rts

wrapin, test for wrap arround

Head index + 1

Equal to buffer size ?

NoElse start with zero again

CP1enW5O

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

00751E 5242

007520 B4680012

007524 6502

007526 7400

ON

007528 4E75

H-»

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

00752A 48E7FFFE

00752E 4BF900000000

007534 246DOA2A

007538 4E92

00753A 246DOA2E

00753E 4E92

007540 08390004FFFFFA01

007548 67EA

00754A 08B90006FFFFFA11

007552 4CDF7FFF

007556 4E73

addq.w #1,D2

cmp.w

18(AO),D2

bcs

$7528

moveq.l #0,D2

rts

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

movem.l DO-D7/AO-A6,-(A7)

lea

$0,A5

move.l $A2A(A5),A2

jsr

(A2)

move.l $A2E(A5),A2

jsr

(A2)

btst

#4,$FFFFFA01

beq

$7534

bclr

#6,$FFFFFA11

movem.l (A7)+,DO-D7/AO-A6

rte

wrapout, test for wrap arround

Tail index + 1

Equals buffer size

?

NoElse start with zero again

midikey, keyboard + MIDI interrupt

Save registers

Clear A5

mbufrec, $7558

Interrupt from MIDI-ACIA ?

kbufrec, $7568

Interrupt vfromon Keyboard-ACIA ?

Still interrupt ?

Yes

Clear interrupt service bit

Restore registers

S?

Page 369: Atari ST Internals

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

OS

007558 41EDOAOO

00755C 43F9FFFFFC04

007562 246DOA16

007566 600E

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

007568 41ED09F2

00756C 43F9FFFFFCOO

007572 246DOA12

007576 14290000

00757A 08020007

00757E 671C

007580 08020000

007584 670A

007586 48E720EO

00758A 6112

00758C 4CDF0704

007590 02020020

007594 6706

007596 10290002

00759A 4ED2

00759C 4E75

lea

$AOO(A5),AOlea

$FFFFFC04,A1

move.l

$A16(A5),A2bra

$7576

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

lea

$9F2(A5),AOlea

$FFFFFCOO,A1

move.l

$A12(A5),A2move.b

0(A1),D2

btst

f7,D2beq

$759C

btst

tO,D2beq

$7590

movem.l D2/AO-A2,-(A7)

bsr

$759Emovem.l

(A7)+,D2/AO-A2

and.b

#$20,D2beq

$759C

move.b

2(A1),DOjmp

(A2)

rts

MIDI interrupt

iorec for

MIDI

Address of the

MIDI ACIA

$759C, MIDI

error

routine

Keyboard interrupt

iorec for

keyboardAddress

of the

keyboard-ACIA

$759C, Keyboard

error

routine

Get ACIA status

Interrupt request

?

NoReceiver

buffer

full

?NoSave

registers

arcvint, get

byte

Restore registers

Mark bit

tested

No error

Read data

clear

status

Execute error

routine

SBn</iceo69

*************************************************00759E

10290002

move.b

2(A1),DO

0075A2 B1FC000009F2

cmp.l

#$9F2,AO

0075A8 66000416

bne

$79CO

0075AC 4A2DOA32

tst.b

$A32(A5)

0075BO 6654

bne

$7606

0075B2 OCOOOOF6

cmp.b

#$F6,DO0075B6 650000F4

bcs

$76AC

arcvint, get

byte

from

ACIAGet

data

from

ACIAKeyboard

ACIA

?

No, MIDI

Keyboard state

Keypress ?

Yes895T

Page 370: Atari ST Internals

0075BA

0075BE

0075C4

0075CA

0075DO

0075D6

0075DC

0075EO

0075E4

0075E6

0075EA

0075EC

0075FO

040000F6

0280000000FF

47F9000075F2

1B7300000A32

47F9000075FC

1B7300000A33

064000F6

OCOOOOF8

6DOA

OCOOOOFB

6E041B400A40

4E75

sub.b

and.l

leamove.b

leamove . b

add.w

cmp.b

bitcmp.b

bgtmove.b

rts

#$F6,DO

#$FF,DO

$75F2,A3

0(A3,DO.w),$A32(A5)

$75FC,A3

0(A3,DO,w),$A33(A5)

#$F6,DO

#$F8,DO

$75FO

#$FB,DO

$75FODO,$A40(A5)

Subtract offset

Pointer to IKBD code table

Save IKBD merken

Pointer to IKBD lengths table

IKBD index

Add offset again

Mouse position record ?

NoMouse position record ?

NoSave mouse position

Oio\*

0075F2 01020303030304050607

0075FC 07050202020206020101

IKBD parameter

Status codes

Lengths

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

007606 OC2D00060A32

00760C 64000084

007610 45F900007656

007616 7400

007618 142DOA32

00761C 5302

00761E E342

007620 D42DOA32

007624 5302

007626 E542

007628 20722000

00762C 22722004

007630 24722008

cmp.b

bcc

leamoveq . 1

move . b

subq.b

asl.wadd.b

subq.b

asl.w

move . 1

move . 1

move . 1

#6,$A32(A5)

$7692

$7656,A2

#0,D2

$A32(A5),D2

#1,D2

#1,D2

$A32 (A5)

,D2#1,D2

#2,D2

0(A2,D2.w),AO

4(A2,D2.w),Al

8(A2,D2.w),A2

Joystick record ?

YesPointer to IKBD parameter table

Kstate

1 - 5 => 0 - 4

Times 2

+ 11 - 5 => 0 - 4

Times 4

IKBD record pointer

IKBD index base

IKBD interrupt routine

IiB838T

Page 371: Atari ST Internals

007634 2452

007636 7400

007638 142DOA33

00763C 93C2

00763E 1280

007640 532DOA33

007644 4A2DOA33

007648 660A

00764A 2F08

00764C 4E92

00764E 584F

007650 422DOA32

007654 4E75

move , 1

moveq.l

move . b

sub.lmove . b

subq.btst.bbnemove . 1

jsraddq .

wclr.brts

(A2),A2#0,D2$A33(A5)

,D2D2,A1

DO, (Al)

#1,$A33{A5)$A33

(A5)$7654AO,-(A7)

(A2)#4,A7$A32

(A5)

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

007656 OOOOOA34

007 65A

OOOOOA3B

00765E OOOOOA1A

007662 OOOOOA3B

007666 OOOOOA40

00766A OOOOOA1E

00766E OOOOOA40

007672 OOOOOA43

007676 OOOOOA1E

00767A OOOOOA43

00767E OOOOOA49

007682 OOOOOA22

007686 OOOOOA49

00768A OOOOOA4B

00768E OOOOOA26

dc.l

dc.l

dc.ldc.ldc.ldc.l

dc.ldc.ldc.ldc.ldc.ldc.ldc.l

dc.ldc.l

$A34$A3B$A1A$A3B$A40$A1E$A40$A43$A1E$A43$A49$A22$A49$A4B$A26

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

Get interrupt vector

Get IKBD

index

Minus base

crasnCO

IKBD index

minus 1

Test index

Pass record

pointer

Execute interrupt

routine

Correct stack

pointer

Clear IKBD

state

Parameter table for IKBD

I3M

Page 372: Atari ST Internals

Abacus Software Atari ST Internals

terr

upt

routine

joystick

data

c-H HH

O

O CO-H 014-1 <B01 M?*i 130 T)

1~3 £C

eiv

ed

ke

yb

oa

rd

cod

es

sta

tus

key

pre

sse

d ?

odi 4-1 4-1

-H -H01 45 4501 01 010)0 -O 4->O <d 1HM O O )Oj r3 1-3

t!-rH

CO

0)H

MO

4J-H43

4-1O 0)3 CO

key

rele

ased

?

4-1

-rl450]

4->

<D,-3

X

-H

0!

4J>H0)

MO

MH

4J

43

iid0)

0 rH£3 CJ

f-

T)0)01010)rH

0!X

4J>M-He-\1

4J45er>-H OK 13

d)

U-l-H

01

4->45

-rH

J_l

0M-l

4J-H43[ 1

W

key

rele

ased

?

j 1

>H•H4501

^J45

-rH«

<U

4J

-H4501

4-145

•HrH

MO

tf_4

4-1-H43

rH

id0)

O rH53 O

ess

ed

?

J_(

a>,0)

,j]P^gHO

a)

«EHO

MO4-1

4-1-H43

+JO 0)3 W

leased

?

Q)M

>^0)

HqC^EHO

Q m — m m*• *£ CM r^ F^

r tJCO K ^ N C M * 5 P V O« > r i ; v o r H O r a ; ^ r ~ -= t t = « - = S = Q Q « - « > - U >

rH 43 rH 43 rH

• 43 • • • •Q) • CT 0) Q) Q)> T S 4 3 > > > < 0 < dO T i P O O O f f l r H

S < a c o g g g r H 4 3

oooooCJ

CMCM

CMenvo

oo

SoQ rHCM OCM QQ in CM

o oO Q Qco vo M

CM -a1

O CM VOCO CJen en envo vo vo vo vo vbp- r- p- r- r- P-o o o o o o0 0 0 0 0 0

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

****•it•X•X

****•X

*•X-X•X•X•X

in o o< O Q— - * C J r H O * C O r H OQ r i C f f l Q f O r t J C J Q C O

m c M V o » p - < v o •-p-fQ </> P- rH P- </> C rH P-

o oQ Q» ^P rH O »

VO Q Q COm vo - p-«> P- o p-= % « • * « •

o oQ Q

v O r H O " . O r H O -V O W Q n Q W Q O Q( Q v o ^ p - r H v o - p - e n-C/5- p* O P- </> P~ CM E— O>

0) CD idG CO M43 43 43

43M

G, (1) HE G OO 43 43 43

S G 01O 43 43

ft, <!) H" G O

43 O 43 43 43

fX (!) Q) idS G 01 s-iO 43 43 43

CMOOO VDO OO VOO VO

o ^PQ rnvo vop- P-o oo o

o <o oo orH <O" OCJ P- OCO O Oo vo o

vo < CJcq ca cavo vo vop- p- p-0 0 0o o o

vooooo vo

oooo

CJ

ooo

VO rH COO CO VOV O C O O C J V O C O O C J V Qv o o v o o v o o v o o v o

O CM VO CO O

o o c j i n o o c o i n o o o

Qenoooo

CO O CJ VO CO O CJo vo o vo o vo o

O QO rHO Oo o

VO rH O O VO

CMOoo

O CJ CJ CJ CJ CJvo CJ

Q Q Q Q Q fv 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 op - p - p ~ p - p - p - p - p - p - p - p - r - p - p - p - p -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

365

Page 373: Atari ST Internals

Abacus Software Atari ST Internals

EHU

4-)-H43

m(U

O rH

"Z. CJ

•oCU«

a, oM-l

4-1O 0)S co

TS01coIBCUrH

(UH

>i0!X

EH

<

4J-rH

O

C"

•o0)COCO0)

a>!

CD

«CJo

CO

p£u

Go-H4-1IBH3er>

-rH

IMCoo

^(U UrH -H

O rH

CO UGO >iU CU

4-1O 0! O53 O 3

IB4-1

T!CP0CO

Xo-HrH

O

r>1

01

CU_C"I

.p

1HO

COCO

•8•o

•oC3OCO

4-1HIB4-1CO

CO34-1<B4-1CO

«CJOrJ

CO

3

O

4-1M

§GM

CO34-1

4_)CO

4-1

-HACO

30G

CU

IBco

&Q)M

CDT>OOre

leas

ed

>1 01 rH CM01 4-1 XX <B >i >i

CO CO Q< COIB CD CU CU IB 01 CUS >H 05 >H CO Q Q

IB Id

M rH0) (U4-1 4-1G G3 3O O0 o

IB idrH rH

CU CU•a TJrH rH

id <d01 01rH rH

CJ CJ

CO rHEn QVO >*r- CM-U> =8=

0Q

O -CO COr- ror- <n</> =8=

«gi

or—

r-vt

rH OQ CO

co r-41= «•

0Q

COm•U5-=!*=

O,—)r-f~*</>

,—1Q

CO41=

0Q

O -co <r~ cor^ </!•«• 4^

VOcop-[

v>

in<r

COr CJ

</> CM*. p-

o r~4^ V*

VOCO

COp-D

to-4^

m -~< m

< —CO Q<C m•CO rH i<

- Q <«•O - Kvt *y i — i4!= 4t= Q

in

in in ~ —rf; <; m m

CJ Q — —

PQ <Cp- -co-

^ CO rtl *.m m «> w

-. r~ r- r~ » p-c^ r^ ri p- o <;4^ < / > < / > < / > Q to-

OQ

P- p-f£. P-

CJ QP- p-

</> «/>

O O

JH0) rH

C O43 43 43

4-1 • rHi B C X C U t U i B Q - C U r H

S C «O 43 43 43 O

E G O

4-1&, cu M tro

43 43

G 4 - 1 C U O O U O 4 - 1- - 4 3 E E 4 3 E r H

4-1CO CU 4-1 0)4J C CO C43 43 4-1 43

43_ 43_ 43

CU CU CD

0 0 0

43 43_

CU CU

CMOOo

VD rHO COVO COVO O

COto0VD

COCOOoo voo oCJ VOO VD

COooorH 0CJ CMCO OO VO

COmoOOoCJo

COooo

VO rHO COVO COvo o

oCMoVD

pf,CO0oo oO CMO voo vo

«=rCO

0ooo0QCMCOo

7D

78

0A

86

0ooow u

O p-P- COVO CM

CO

oooooCJ

fflrH

T Qo mo <o orH rH

co m0 rH

P-oooo

O Qp- p-

o oW CnP- p-

o offl o oP- O O

<: f=c o oo o o oQ VO O G\t

mr~

o oo oo oo oo o

oO C M C M r H T r ~ p - C Oc o v o i < v o p q p q c Q o p 3 P 3o 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 '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 Ovo vo vo vo vo vo i— p- p- p- [— f [ [ ( p~ p— [—- p~ {—P - P - P - P - P - P - P - P - P - P - P * P - P - P - P - P - P - P - P - P -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

V O r f S C J O C M V O W ^ O C O Wco co co m in mp - p - r - r ~ p - p - p - r ~ r ~ p -P - P - P - P - P - P - P - P - P - P -o o o o o o o o o oo o o o o o o o o o

366

Page 374: Atari ST Internals

Abacus Software Atari ST Internals

$7

79

2

$A

7B

(A5

)

id 4JM COXI i '

PQr-ft.o

O QCM CMO ftVO -a*

•=T VOVO VD

in m

PQ CJr- t—

r- Q to to

p- O rH rH•CO =4t= Q Q

- X! X)

01 0! 01tr > > ><p o o oX! e g e

PQ CJr- r~ft f£o o

H 0 rH rHO O ^* ^r~~ CM PQ CQVQ r- (H (H

< U W CMVQ VO VD r^-

IAS)

1

HO

ME

ke

y re

lea

se

d

?

1

Q 0r- Q

to r-- O

Q =*=

X!

01 •> fto eg CJ

Q r-r- CJ<, oo orH O^31 OPQ CJrH O

VO ft.r~ c—

Ye

s 1

INS

ER

T

ke

y

rele

ase

d

?

oQ

03 -CO CMr- Qt/> =*!

tr ft0! g

X) CJ

CMDoo

CO O0 0r- CJVO O

W or- co

o!3

wm

01G

COmCM000

VO

ITCO

C"

T!01COCO01

ftrH

rH

-H4-1CO

01

<

in

Q

ft.

n=tt=

4-1CO

s

Qmft,oCO0ooQCMCOoCOCO

oS3

PQen

tr0)X)

fxlCMCMooor~VO

wCO

pid4-1CO

01rH

oCOco

in

03

to

o=tt=

CO

s

rCO%roooo0QCMCOoCMen

CJ-HrH

CJ

0)

oMH

Xiid4-1

•ac3oCO

01

0 ^-H >HrH O

0CO

i CO01 0!

TS0 T!S3 ft.

in<VO03<

$7

7A

8

#$

7D

78

,?

rH

tr §0) OX) S

VOCO

o03r^Qr-ooo0

W Uo r-r- PQVO CM

03 ft.Cn CTt

V(A

5)

Sta

rt

so

un

d

1

Save io

rec

fo

r keybaord

1

r *, * —03 r-

to —- I

o »to o

X) rH

0) CU

O Og g

ie£03f£OO0ooCJ COt— oPQ ferH CM

CM CO< <C

Scan

code to

D

l

,AO

A

dd

ress

of

the

sta

nd

ard

ke

yb

oa

rd ta

ble

#0

,D1

DO

,D1

$A

5E

(A5

)

H- X) rH

01 CD 0!

o o og S g

wmp£0

0 0 Q0 0 VOCM CM Ot- rH CM

ft, O W

oQ

r-to

*

•dcid

[V,

r-ooo^1

CM0

CMm

c>-

0!

-H4-1O

CJO

COPM

CJ

in

Qmto

4-1CO

£

Omft.oroo0DCMCOoVOPQ

No

1

,AO

A

dd

ress

of

the

C

AP

S

LOC

K keyboard

ta

ble

$7

7C

2

$A

66

(A5

)

rH

tr i01 OX! g

VOVOft,0

^ QO VOr- oVO CM

CJ WPQ CQ

-o0!01CO01Mft

0!X

-HACO

en-H

in

Qmto0

*

CO

s

Qin<coooo0QCMCOO

CMCJ

01

CMQ

to

(U

Xi

COoVOVO

O3O

p-

T!0)COCO01nft

0)X

-H

CO

01

in

Qmto

4-1CO4-1XI

Qin<CorHOO0QCMCOO

ft.CJ

o

CJwr-to

tr01X)

ft,rH

VO

0Q

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

367

Page 375: Atari ST Internals

Abacus Software Atari ST Internals

C"

0)

co-H-P0C

fe

o-

CD

GO

-H4-!OC

O 3

et

to

GS

X s

tan

da

rd

CIJm

o

•oO T>

of

the shift

keyboard

ta

b.

<a«01M•a•a

0!

(8+J

0)

•P

O P-

*W *OCD

0) MTi MO CDO S-l

O,M(—1 ,

O CDW X

J "j

-p r i0) EHCD 0

retu

rn

0)

<o-HS-l

O 10S3 CJ

to

linefe

ed

.pM01

GO OS3 CJ

E

?

to

GS

X s

tandard

0 oW O

•(/>1 ~\ T3

EH O T!CJ 3 <

IP.CDcH

0

f-l3O

t "P5EHO

to

GS

X sta

ndard

4->

CD

G0O

P

-HM

OMM3O

(_3

KEHCJ

to

GS

X s

tandard

pCDJ>

c0o

oQ

*.enlO*

&*

ft.E0

COWp-p-«•

uO

oQ

«.COVD

*

43

ag0

COUp-p-«•

-M

43

f_ IQ

.*LOCM=s=

J5.

T!•ocd

0Q

0=*^H

tf

J>Og

COenen^-«•

n)S-l

o

io*-*CMVO

^C•tft-

rH•

CD>0g

OQ

OQ

Of£

— -O

•0)>og

in

Qin<</>

».CM=*t=

-pM

^_>

43

COinCOr-«•

cr0)

oQ^co

r_|=tt=

43

P.gO

CM0COp*«•

0)

oQ

*,0f—l=«=

•~1tr^>og

oCMCOp~«•

O1<a43

Q

p-r

«-=w=

43

P.

U

ot-H00p-«-

CD

43

c-t rHQ Q

O CO •* U *•Q Q Q

^ co ^ pq _ ..O C n p O i - H O Q C I Q C Mc o c n ^ r c o E — ^ . c n ^ r c o t —

oa

o oo •* CD oQ en CM en Q

*. en co co=«= -co =tt= «• «• =*=

43 t T t T 4 3 (TO* 43 CT• • • C U G J • 0 ) 0 ) • CU

o l p , < D T 3 c a p , ( i j > > ( O p , c i ) > > < o p , a ) >" - T S U S G O O S H g G O O S - l g G O

f d 4 3 0 4 3 g g 4 3 0 4 3 g g 4 3 0 4 3 g

00

77

D2

OC

00

00

3B

00

77

D6 6

51

00

07

7D

8 O

C00

0044

0077

DC

62

0A0

07

7D

E

06

41

00

19

00

77

E2

70

00

00

77

E4

60

00

01

B2

00

77

E8

206D

OA

620

07

7E

C

10

30

00

00

00

77

FO

08

2D00

020A

5D0

07

7F

6 6

76

00

07

7F

8 O

CO

OO

OO

D0

07

7F

C

66

04

00

77

FE

70

0A0

07

80

0 67

2A0

07

80

2 O

C01

0047

00

78

06

66

08

00

78

08

06

41

00

30

00

78

0C

6

00

00

18

A0

07

81

0

OC

0100

4B0

07

81

4 6

60

80

07

81

6

72

73

00

78

18

7

00

00

07

81

A

60

00

01

7C

00

78

1E

O

C01

004D

COoVQ\aCMCMCOp-oo 0

07

82

4 7

27

40

07

82

6 7

00

00

07

82

8 6

00

00

16

E0

07

82

C

OC

0000

320

07

83

0 6

60

60

07

83

2 7

00

0

368

Page 376: Atari ST Internals

Abacus Software Atari ST Internals

(V.

a>01010)

a;>,0)X C"

E-i(-3 O Oi=C S3 -

01P

S4J01

4-1lf_|

- -HO <Sl fi& - fO

C1-•o0)CO01fi\MA>,<D

^

4->>H-HA01

4-1,£?

-H^H

$-10

•oG<0

4-1

(D O• 13

•o(UCOo]0)m(X>,0)X

4-11-1-HJ501

0]P M4J O10 ~v4-1 T!01 C

<a4JM-t 4-J

O O

oQ

CO s en va -=ren o cor- </> r^

oQ

^ CO

o oQ O

K O -

d m faCM co in en<o r*

oQ

CO - CO

in<Qm< co

CMa

|k< en <o enen K en

p* -to i n p- -to

rH OQ Q

•, o -< CO O

CO

in o <-H< Q Q— CM CO K CO -Q Q en o enm

*

*=C n r-en to <n CM co in in

CMQ

o in o <-H oQ ft Q Q Q

. . ^ — CM CO ^ 0 0 v O -e n p q Q Q e n c q c n c o p q Q

en en CM co in

* <O =!t= -to

cr(B >C O

ae c oO 45 g

45 ftCT S 43 • • 43CD • 4J • ( D O ) ' _> < o T 3 ( a o i t r a < u > > t ! c r >

<o 4-1 d)45 45

C O O C O J O M g4 5 g g i 0 4 5 E 4 5 0

45 45 45 4545 • • 4501 ' oj a> a)

< o p . a > > > i o c r >O O G 0) o

4543

0)OJ >C O

g g < 0 4 5 g 4 5 0 4 3 g

00

78

34

60

00

01

62

00

78

38

OC

00

00

36

00

78

3C

6

60

60

07

83

E 7

01

E0

07

84

0 6

00

00

15

60

07

84

4 O

C00

002D

00

78

48

66

06

00

78

4A

70

1F

00

78

4C

6

00

00

14

A0

07

85

0

02

40

00

1F

00

78

54

60

00

01

42

00

78

58

082D

0003

0A5D

00

78

5E

6

70

00

13

80

07

86

2 O

CO

IOO

IA0

07

86

6 6

61

80

07

86

8 1

03

C0

04

00

07

86

C

142D

OA

5D0

07

87

0 0

20

20

00

30

07

87

4 6

70

00

12

20

07

87

8 10

3C00

5C0

07

87

C

6000

011A

00

78

80

OC

0100

270

07

88

4 6

61

80

07

88

6 10

3C00

5B0

07

88

A

142D

OA

5D0

07

88

E

02

02

00

03

00

78

92

67

00

01

04

00

78

96

10

3C

00

7B

00

78

9A

60

00

00

FC

00

78

9E

O

C01

0028

00

78

A2

6618

00

78

A4

103C

005D

369

Page 377: Atari ST Internals

Abacus Software Atari ST Internals

c-•O0)co03CD!HQ,

4-1tH-Hflco

t-<CO

4J Ora -x4-1 tSco G

c-.CM

HW

EH

>,aoo•c!Hraf\

OMH

enrHHHagPT)

4-1o cuS CO

ocu0

-H

raO

43

(Ur^

0)

O4-1COa>PS

(!)GOQ

ouse

sc

an

cod

e ta

ble

s

g cuP

O H4-1 ra

>

0) -5P4JG 4->

-H COO 0)Hi EH

•oGPO

(!)3Mrd>

mP

,— ]

ra

4-1CO X0! (!)>H £3

o-

aP

^1oCO!HPCJ

cu

rso

r up

^_l

o*4— 1

4J0)CO

HHIH0

o

cu

rso

r up

atu

s

JH 4-1O CO«H

| t (J_j

CD -HCO f\H co

O 4J(U

>H CD

•o0)coCO(!)

a

IH-H

CO

,G

-H

SH0

*O

G<8

4nCD

ti-H

co

4J-H

a

MCDX-H0!

(!)GO

^0 GS3 0

r>

4J

0)i-H

Oca

PO

cu

rso

r le

ft

$_|

Otf_|

4-1(!)CO

>H

OO53 >H

cu

rso

r le

fta

tus

M -MO W

*W4J

4J IH0) -Hco 45

>H coHH0 4J

G)X U

•ocuCOCO0)

ft

4JUH-HACO

4-1

0>-H

MO

^x.T3Gra

4J>H(!) 0^ S3

CMa

•*in— CMQ Qm -< nm =tt=

£,• 43

<D .

0 CE ra

COenenP^<n-

trCD

oQ

Q enr- ento r-=s= v>

£•

> raO >-lg 43

Q

CMvo40=tt=

^Q

A,

O

CJCJCO£^

to

0)

in

— opq fc

^ -f- &3to ^— * P3

N r- entH ( r^= « = — « •

IS rH• •

tr cu"O > rd•t! O inrd E 43

CM

K

CJCM(SjJp«.

to

ra(U

CMan*rH

er0)

0g

CMQ

CMfQ-^f0

^aU

03

01P.*«•

trcu43

OCO

F—<O

•.CMQ

ra

1

Q

CO^pto=tt>

43

fiO

CM0enr—to

CD

S

f-HO

A,

0

43

io

CMQ

CO1

=*>

43

io

oQ

in<

Qm(rf

«•

43

gO

oQk.n=«=

43

•ora

\oo<*t—in

tr43

CMQ

t-H1

43

i0

vo0<Jf-

(8

43

Q

pa^31m-=tt=

43

U

<qn

CMenr-

0)

A

CMQ

».041=

43

io

rHQ

CO1

*43

io

0Q

inrtj•*-*Qin( Jto

43

§O

O VBQ 0

K ^co r-=*»= -co

43

73 trC CDra 43

Qin<oQCMr

rH

CO<COr~-oo

n0ooCMOCMO

O<COr*-Oo

V£>

OOoo[VD

Om03f^00

Q

OOCJno«-i•=pffl03(-.00

pr]

QOOoooVD

COPQcoi —00

CM

Oot-HOCJo

OmCOr~00

<ovo«5

OOCO( —00

pc3

•a1OQu>CMm

CMoCOf~-00

P4in0CM

10ocor—00

^pEuOooo0vo

COoCO[•—00

CJCM<r~ooooenUtin•=p

CJCJCOr-oo

COo«=pr~

CMQCOr-oo

oooCMCMnCMm^paCOr-oo

HOrHOOOt—vo

COQCOr-oo

UlfehPH<CJ<Hm

CJQCO[—Oo

CO•31

OorHOOo

oWCOC—oo

CJt-HVOvo

^p{*)03!—OO

0oooooCMrH

VOW03r-oo

CO

£EKOn^pi-H

<w03r~oo

Qin<oQCMOrH

HH03r-oo

moooooCMO

CMt<COr-oo

worHOOor-vo

voP4COr-oo

fo&hOCO^pi-H

<CM03[—OO

voorH0000vo

HPMCOr^00

ra<T00rH0CJO

CM0CTlr~0o

OrHVOVO

vooenr-0o

oo00oco^prH

COoenr—0o

COhfeEn.CJfOCMrH

CJ0enr*0o

Q

S0QCMOrH

OrHenr-oo

no000oCMO

^prHenr-oo

CJa000or-vo

COrHenr-0o

370

Page 378: Atari ST Internals

00791C 123CFFFF

007920 600000E4

007924 OC01004D

007928 661C

00792A 123C0008

00792E 143COOOO

007932 102DOA5D

007936 02000003

00793A 670000CA

00793E 123C0001

007942 600000C2

007946 OC010050

00794A 661C

00794C 123COOOO

007950 143C0008

007954 102DOA5D

007958 02000003

00795C 670000A8

007960 143C0001

007964 600000AO

007968 OC010002

00796C 650C

00796E OCOIOOOD

007972 6206

007974 06010076

007978 600C

00797A OC000041

00797E 650A

007980 OC00005A

007984 6204

007986 7000

007988 600E

move . b

bra

cmp.bbne

move . b

move . b

move . b

and.bbeq

move . b

bra

cmp.bbne

move . b

move . b

move . b

and.bbeqmove

. b

bra

cmp.bbcs

cmp.bbhi

add.bbra

cmp.bbcs

cmp.bbhi

moveq . 1

bra

#$-l,Dl

Onl;$7A06#$4D,D1

Cur

$7946

No

#8,D1

X o

#0,D2

Y o

$A5D(A5),DO

, Shi

#3, DO

Lef

$7A06

NO

#1,D1

Onl;

$7A06#$50,

Dl

Cur$7968

No

#0,D1

X o

#8,D2

Y o

$A5D(A5),DO

Shi#3, DO

Lef-$7A06

No

#1,D2

Onl$7A06

#2,D1

'!'$797A

Not

#$D,D1

'='$797A

Not

#$76, Dl

$7986

#$41, DO

'A'$798A

#$5A,DO

'Z'$798A

#0,DO

$7998

Only one

pixels left

with

shift

Cursor right

?

NoX offset

for

cursor

right

Y offset

for

cursor

right

Shift status

Left and/or

right

shift

key

pressed?

NoOnly one

pixel right

with

shift

Cursor down

?

NoX offset

for

cursor

down

Y offset

for

cursor

down

Shift status

Left and/or

right

shift

key

pressed?

NoOnly one

pixel down

with

shift

Not greater

or equal

Not less

or equal

gcoIBE-

Page 379: Atari ST Internals

Abacus Software Atari ST Internals

r~LO 1rH 0

co tn-p

CO -r-t4-> ft-H.« 0

4Jo4-1 0)

T30) O73 0OO MC Mra uo enen <

oin

ter

p.X

0 0)<u -an GO -rH

-r-lrH

4-1 -HCD >dC5 EH

er

reached

?M-IM-lPa

CM 4HO

tn3 T!•H G0, H

ter

back

to

b

uff

er

sta

rt

c-HoaMCD

MHMH

O 3S3 CQ

0--,-H

rH rH

-H 3<d MH4-1

!-i•H CD<d MH3 M-ltr 301 ,Q

TJ -fd en0) 0)W >H

i-<tu

MHMH

j^<a01 c0) -HH•a iaT! 4-1id <d

•0M<D 0)1-1 4-1in -H3 SH

CQ S

X0)•oG

-rH

i-l-H104-1

s0)S3

MID

I in

terr

upt

handle

r

o4-1

0)4-1 M>, 0).Q 4-1-H C•a -H-H 0E CH

<VG

-H4-13Or4

<u4-13O(11xw

X0)•a

-H C•a -H-H£ rHtn -H>i id0! H

er

rea

ch

ed

?

MHM-l

4-1 3C ,QU)E MH0) OH0 73G CM W

4-1fHid4J«

O4-1

XOid t^-X! rH

rH rHr-l -H Pfl) (0 M-l4-1 4-1C M

•H rH 0)

o <a M-IO, 3 M-l

tr 31-1 <U X50)

M-l T3 ^M-I <a «

O 3 0) <US3 CQ K »

oQ^

1-t

vot/>=8=

&•

ao

t-HVO0ooo(Jo<;COcnr-oo

COcncnr-

MO43

COomvs

wCOcnr-oo

oQ^

<£r-m=»=

^Q

aO

<cr-oooouo

ocncnr-oo

COcncn( —v>

-H

J3

CM0CM<£>

^pcncnr-o0

ViO

COcn[u>

mr-lQ

WwOV0

<*Qcnenr~oo

t— 1Q

^CO

3•

rH

CO

id

rH

rHf£|

COcnenr-oo

oQ..

!-H

Q

3*

TJ•oid

rH"C1

OQ

f£cncnr~oo

o

-t-

r~r32

~—

,-H

>

CD

0E

PMinoCM

ucncnr^0o

1— 1Q

-,Of£^^CO

3

CD

OE

COoooCOCMCMmwencnr~oo

rHQ

*.CM=tt=

J5•

tr•a•o<d

rH^P• Pm

CM

cnr~oo

rHQ-_s

Of£•w^r

•P.0

*To0oCO^0

CMcq•31

f^cnr-00

CJ

cnr^

</>

CO

0

.a

CMOin

CO

cnt —0o

rHQ

•fc

0=«=

rH

trffl

Os

ooCM

C —

<Cenr^0o

rHa

ft.

^_^

0rf^«•—vo

3

io

voo00COV0CMcq

Ocnt —o0

PT")

CQcnr-

trCD

CJor—«J

0cqcn[ —o0

CM

,_,0rtj~-*o

rH

cv0E

ooooCOva•=pCM

CMcqcnr-o0

5s

rH

Q

CM

•^—O

*.OQ

u•

to0

oo0rHOCOLf}

n\r)

CQcnr^o0

o~—CO^

rHQ

3

CD

OE

COo00rHsrrHO

rf

CQcnr-o0

CO4-1r-l

inr-*3>

WCQo\—

o0

********

**•X•JC

*•Je

**-JC

*•JC•JC

•Je

**•Je•JC

**•JC

*****Jfi•Je

**•JC•Je-JC

*****•JC-JC

**

CM

in•—Ctlor^</>

rH

0)

E

ao(0Q

rCM

Ooenr-oo

. — .CM

*--

I-n

CMQ

•a1

•>pOcnr~o0

********

•1C

*•JC

**•1C•1C

*-X•X•X

•X•X•XJfi•X

***•X•X•1C

**•X•X-X•X•X

*•X•X•X

**•X•X

*•X•X

rHQ

^-^O|C£

*—CO

u•

01

0E

COoooCOCMCMnVDucnr^oo

iHQ

rH=&=

3

tr

*

rH

CMm

rSl

uC3>

[ —0O

rHQ

^-^

0<J»--*T

3

eo

"C1

0ooCO10CMcqr_)fjcn[ —0o

iQcnr^vt

0

CMOmvo

oacnt —0o

, — )

Q

0=«=

rH

tr0)

oE

ooCM

CMQcnp^o0

rHQ

^_^

0r3S*-*

VD

3

E*O

«

vooooCOVDCMCQ

^pQcnr^oo

ISwcnf^vt

tr0)

oOr-vo

COQenr^oo

372

Page 380: Atari ST Internals

0079DA 24680000

0079DE 15801000

0079E2 31410008

0079E6 4E75

rnove.l 0(AO),A2

move.b DO,0(A2,Dl.w)

move.w D1,8(AO)

rts

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

0079E8

007 9EA

0079EE

0079FO

0079F2

0079F6

0079F8

0079FC

007 9FE

007A02

-J

007A04

7605

08010004

6702

7606

08010007

6706

07ADOA5D

6004

07EDOA5D

7200

7400

moveq.lbtstbeqmoveq.lbtstbeqbclrbrabsetmoveq

. 1

moveq . 1 #5,D3#4,

Dl$79F216, D3

#7,D1

$79FE

D3,$A5D(A5)

$7A02

D3,$A5D(A5)

#0,D1

#0,D2

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

007A06

007AOA

007AOE

007A10

007A14

007A16

007A1A

007A1E

007A22

007A26

007A28

007A2A

41EDOA5A

246DOA1E

4280

102DOA5D

EA08

060000F8

11400000

11410001

11420002

4E92

205F

4E75

leamove

. 1

clr.lmove

. b

Isr.badd.bmove

. b

move . b

move . b

jsrmove

. 1

rts

$A5A(A5),AO

$A1E(A5),A2

DO$A5D(A5) ,DO

#5, DO

#$F8,DO

DO,0(AO)

D1,1(AO)

D2,2(AO)

(A2)

(A7)+,AO

Buffer address

Write received

byte

in buffer

New tail

index

keymauslAccept

right

button

is right

button

($47/$C7)

left button

Pressed or released

?

PressedClear

bit

for

key

Set bit

for

key

keymausPointer

to mouse-emulator

buffer

Mouse interrupt

vector

Get status

of the

"mouse"

buttons

Bit for

right button

to bit

0Plus

relative

mouse

header

Byte in buffer

Store X value

Store Y value

Call mouse interrupt

routine

Restore iorec

for

keyboard

nSiIMST

Page 381: Atari ST Internals

***************************************************007A

2C 47C

7d

c.b$47,$C7,$52,$D2

007A30

007A38

007A3A

007A3E

007A42

007A48

007A4A

007A4E

007A50

007A52

007A54

007A58

007A5A

007A5C

007A60

007A62

302F0004

40E7

007C0700

48E76080

41F9FFFF8800

1401

0201000F

1081

E302

6404

11400002

7000

1010

4CDF0106

46DF

4E75

move . w

move . w

or .wmovem .

1leamove

. b

and.bmove

. b

asl.bbccmove

. b

moveq . 1

move . b

movem . 1

move . w

rts

4 (A7) ,DO

SR, -(A7)

#$700, SR

D1-D2/AO,

$FFFF8800

D1,D2

#15, Dl

Dl, (AO)

#1,D2

$7A58

DO,2(AO)

#0,DO

(AO) ,DO

-(A7)

,AO

(A7)+,D1-D2/AO

(A7)+,SR

muskeylScan

code

mouse substitute

giaccess, read/write

sound chip

DataSave

status

IPL 7, disable

interrupts

Save registers

Address of the

sound

chip

Get register

number

Registers 0-15

Select register

Test read/write

bit

ReadWrite

data

byte

in sound

chip

register

Read byte

from

sound

chip

register

Restore registers

Restore status

B9ny>cnoI•1n

***************************************************007A64 7408

moveq.l #8,D2

007A66 6012

bra

$7A7A

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

007A68 74F7

007A6A 6034

moveq.l #$F7,D2

bra

$7AAO

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

007A6C 7410

007A6E 600A

moveq.l #16,02

bra

$7A7A

rts off, disable RTS

Set bit in port A

rts on, enable RTS

Clear bit in port A

dtr off, disable DTK

Set bit in port A

Iina»ff

Page 382: Atari ST Internals

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

007A70 74EF

007A72 602C

moveq.l #-17,D2

bra

$7AAO

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

007A74

007A76

007A7A

007A7E

007A80

007A84

007A86

007A88

007A8A

007A8C

-J

007A8E

01

007A90

007A92

007A94

7400

342F0004

48E7EOOO

40E7

007C0700

720E

2F02

61AE

241F

8002

728E

61A6

46DF

4CDF0007

007A98 4E75

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

007A9A 7400

007A9C

007AAO

007AA4

007AA6

007AAA

007AAC

007AAE

007ABO

342F0004

48E7EOOO

40E7

007C0700

720E

2F02

6188

241F

moveq . 1

move . w

movem . 1

move.wor .wmoveq . 1

move . 1

bsrmove

. 1

or .b

moveq . 1

bsrmove

. w

movem. 1

rts

***********

-ki

moveq . 1

move . w

movem . 1

move . w

or .wmoveq . 1

move . 1

bsrmove

. 1

#0,D24(A7),D2

DO-D2,-(A7)

SR, -(A7)

#$700, SR

#14, Dl

D2,-(A7)

$7A38

(A7)+,D2

D2,DO

#$8E,D1

$7A38

(A7)+,SR

(A7)+,DO-D2

#0,D2

4(A7),D2

DO-D2,-(A7)

SR, -(A7)

#$700, SR

#14,01

D2,-(A7)

$7A38

(A7)+,D2

dtroff, enable

DTK

Clear bit

in port

A

ongibit, set

bit in sound

chip

port

A

Get bit

pattern

Save registers

Save status

IPL 7, disable

interrupts

Port A

Save bit

number

Select port

A

Bit number

back

Set bit(s)

Write to port

A

Write new

value

Restore status

Restore registers

offgibit, clear

bit

in sound

chip

port

A

Get bit

pattern

Save registers

Save status

IPL 7, disable

interrupts

Port A

Save bit

patternSelect

port

A

Restore bit

pattern

65ntaIiBSi

Page 383: Atari ST Internals

007AB2 C002

007AB4 728E

and.b

D2,DO

moveq.l #$8E,D1

OJ

007AB6 6180

007AB8 46DF

007ABA 4CDF0007

007ABE 4E75

bsrmove . w

movem . 1

rts

$7A38(A7)+,SR(A7)+,DO-D2

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

007ACO 4A6F0004

007AC4 6726

007AC6 2B6FOOOAOA1E

007ACC 266F0006

007ADO OC6F00010004

007AD6 6724

007AD8 OC6F00020004

007ADE 6736

007AEO OC6F00040004

007AE6 6770

007AE8 7000

007AEA 4E75

tst.w

beqmove , 1

move . 1

cmp.wbeqcmp.wbeqcmp.wbeqmoveq . 1

rts

4(A7)

$7AEC10(A7),$A1E(A5)

6(A7),A3#1,4(A7)

$7 AFC

#2,4(A7)

$7B16

#<3,4(A7)$7B58#0,DO

Clear bit(s)

Write to

port A

Write new value

Restore status

Restore registers

initmouse

Disable mouse ?

Yes disable mouse

Mouse interrupt

vector

Address of the

parameter block

Relative mouse ?

YesAbsolute mouse

?

YesKeycode

mouse ?

YesError, invalid

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

007AEC 7212

007AEE 6100F1EO

007AF2 2B7C00007BCOOA1E

007AFA 6070

moveq.l #$12,Dl

bsr

$6CDOmove.l #$7BCO,$A1E(A5)

bra

$7B6C

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

007AFC 45EDOA6A

007BOO 14FC0008

007B04 14FCOOOB

007B08 6166

lea

$A6A(A5),A2move.b #$8,

(A2) +

move.b #$B,(A2)+

bsr

$7B70

Disable mouse

Disable mouse command

Send to IKBD

Mouse interrupt

vector

to RTS

Relative mouse

Transfer buffer pointer

Relative mouse

Relative mouse threshold x,

Set mouse

parameters

II

Page 384: Atari ST Internals

007BOA 7606

007BOC 45EDOA6A

007B10 6100F1DE

007B14 6056

moveq.1 #6,D3

lea

$A6A(A5),A2

bsr

$6CFO

bra

$7B6C

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

007B16 45EDOA6A

007B1A 14FC0009

007B1E 14EB0004

007B22 14EB0005

007B26 14EB0006

007B2A 14EB0007

007B2E 14FCOOOC

007B32 613C

007B34 14FCOOOE

007B38 14FCOOOO

007B3C 14EB0008

007B40 14EB0009

007B44 14EBOOOA

007B48 14EBOOOB

007B4C 7610

007B4E 45EDOA6A

007B52 6100F19C

007B56 6014

007B58 45EDOA6A

007B5C 14FCOOOA

007B60 610E

007B62 7605

007B64 45EDOA6A

007B68 6100F186

007B6C 70FF

007B6E 4E75

leamove

. b

move . b

move . b

move . b

move . b

move . b

bsrmove

. b

move.bmove

. b

move . b

move . b

move . b

moveq , 1

leabsrbraleamove

. b

bsrmoveq

. 1

leabsrmoveq

. 1

rts

$A6A(A5),A2

#9, (A2)+

4 (A3), (A2)+

5 (A3), (A2)+

6 (A3), (A2) +

7 (A3), (A2)+

#$C, (A2)+

$7B70

#$E, (A2)+

#0, (A2)+

8 (A3), (A2)+

9(A3), (A2)+

10 (A3), (A2)+

11 (A3), (A2)+

#16, D3

$A6A(A5),A2

$6CFO

$7B6C

$A6A(A5),A2

#$A, (A2)

+

$7B70

#5,D3

$A6A(A5),A2

$6CFO

#-l,DO

Length of the strings

- 1

Transfer buffer pointer

Send string

to IKBD

Absolute mouse

Transfer buffer

pointer

Absolute mouse

xmax rnsb

xmax Isb

ymax msb

ymax Isb

Absolute mouse

scale

Set mouse

parameters

Initial absolute

mouse

position

Fill byte

Start position

x msb

Start position

x Isb

Start position

y msb

Start position

y Isb

String length

-1

Transfer buffer

pointer

Send string

to IKBD

Transfer buffer

pointer

Mouse keycode

mode

Set mouse

parameters

Length of the

string

-1

Transfer buffer pointer

Send string

to IKBD

Flag for OK

Mns!3IinaMsr

Page 385: Atari ST Internals

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

007B70 14EB0002

move.b 2(A3),(A2)+

007B74 14EB0003

move.b 3(A3),(A2)+

007B78 7210

moveq.l #16,01

007B7A 922BOOOO

sub.b

0(A3),D1

007B7E 14C1

move.b Dl,(A2)

+007B80

14FC0007

move.b

#7,(A2)+

007B84 14EB0001

move.b 1(A3),(A2)+

007B88 4E75

rts

setmouse, set

mouse parameters

x threshold,

scale,

delta

y threshold,

scale,

delta

Top/bottom ?

B9£wf**************************************************

007B8A

007B8C

007B8E

007B90

w

007B94

£J

007B98

007B9C

007BAO

007BA4

007BA6

007BAA

007BAC

007BB2

007BB8

007BBC

007BCO

7000

7200

7400

302F0004

322F0006

342F0008

6100F4F2

4AAFOOOA

6B1A

246FOOOA

7200

43F900007BC2

0280000000FF

10310000

6100F588

4E75

moveq . 1

moveq . 1

moveq . 1

move . w

move . w

move . w

bsrtst.lbmimove

. 1

moveq . 1

leaand.lmove

. b

bsrrts

#0,DO#0,D1#0,D24(A7),DO

6(A7),D1

8(A7),D2

$7090

10 (A7)

$7BCO

10(A7),A2

#0,D1

$7BC2,A1

#$FF,DO

0(Al,DO.w) ,DO

$7146

xbtimer, initialize

timer

Timer number

(0-3 =>

A - D)

Value for

control

register

Value for

data register

Set timer

values

Interrupt vector

Not used

?Interrupt

vector

Table for

determining interrupt

number

Get interrupt

number

initint, set

MFP interrupt

*************************************************007BC2

OD080504

dc.b

13,8,5,4Interrupt

numbers

of the

MFP

timers

Page 386: Atari ST Internals

Abacus Software Atari ST Internals

set

ke

yb

oa

rd ta

ble

KCOCrdMj_l>,CUM

**•It

***•it

**•X

****•it

*•it

•it•It•it

*•s*•It

***•It

**•it•it

*•It•It•it

***•It

*•it

*•It•it

*•»•It

C1'

d>rH43id4-1

SH

•oCfd4-)CO

CU

C

c*t

CJ

f~^r-(Q•*—*3*

rH

COp

•a1ooo&4

ff,*3"

VO0PQr-o0

o&

CMQpqc—<o

-He

vo0pqvo

Opqc-0o

f th

e

sta

nd

ard

table

oCOCOCUM

•tsTS<

^^^in<E4m<<O

,-^r-<•a1

rH

<u0g

wm

o"3*OOoEuvocqCM

OOCQr-oo

wrH

StH-H

CO

Q)O1Cid

O

.r-rf**—CO

rH

CO4-1

03OOofc,*=3I•a*

CMQ

r-o0

o

WQpqr-<o

-Hg

voopqvovoQ

r-o0

<urH

•a4-1

4-14-4-HftCO

CU45P

HHO

COCOenM

TST)<

^_^

m<:CMvo<CO

^-^r—<CO

rH.

CU

0E

CMVO<oCOoooEnvoPQCM

COQCQr-oo

CDrH

4-1

UO

CO

f£U

<U

q<-;

O

^_^

r—•»--CMrH

rH

CO4-1

OoooEM< *

"a1

HQpqr-oo

o

fQwpqr-to

-He43

vooegvo

CMWpq[-X

oo

at

id4->

oSCOEM

O

(U

4-1

0

COfl)M

*?3

<

m<vovofQ{O*

^^^t—rfj"•

CM

,-H•

>0s

VDVOf£Ooo0ofv,vopqCM

IQ1

fy*j

PQr-oo

0)

rs

cu4-1

KHO

COCOcu

ido4J

CUpc

-HOeu

oQ

fV)

mft.to-3£

,—j.

cuo

wmoooooonoCM

fQp,qPQr-oo

CO4JM

inP*.E"3<cp

0

egr-o0

set

sta

ndard

ke

yb

oa

rd ta

ble

iCO>!CUXCOo-H43

•n•n

****•n

**•it•it

*•it

**•n•It

***•it

**•it•It

***•it

**•it**•n•it•it

*•It•it

**•n•it^t

*•it•it•it

*

cu0) rHrH 4343 idId CU 4->4J rH

43 XTS id OH 4-1 Oid 1-4•O 4Jq IH COid -H PM4-1 43 <CO CQ O

in in m£ £ S:W CM VOm vo vo<; rs, <</>«•«>

V ^ *.

CM CM CMVO pc] VOQ Q avo vo vo*n- <t> v>* =»= =s=

H rH rH

0) 0) CU> > > COO 0 0 4Je s s M

pt} CM VOm vo vo^ ^ -CO 0 0CM CM CMVO £3 VOQ Q Mvo vo voo o oo o o0 0 0O 0 0O O CJ mr*~ r- r-- r—pq eg pq E^CM CM CM ^T

CM (=C CM KSf^ j pr, O Q

pq eg o or- r- r- r-O 0 0 OO O 0 0

sta

rt

sound

•oq3oCO0•o

***•it

***•it

**********•it•n

***•it

*•it

*•it•it

***•it

**.£•it

•it

•it

*•it

•it

*•it

*•it

*•it

*

*•it

sta

tus

•aa3OCO

[ )

CUO

OQ

*.^^lO

•^—voCO^C•c/>

<H•

§0H

voCO

0QCM0CM

OO0t-o0

rH

id

•o3OCO

cu4J

HH0

coCO<s)•a

•o

rHQ

^^[-.rtj~~*•a>

rH

CU

0

•a1oo0

CMCMCM

Oi-HOr-o0

4-1CUCO

4-1

OTS

H.

<u•H^jKjO^cu

&3rH

CJ

•CO

-rlg

43

CO0CQvo

rrH

O

t~-

0o

cu

14-1

TJc;3OCO

Scuz

,m<voCO<<o

^rHQ

H.

CU

0g

voCO

o1-1^4

PQCM

VOrH

0p-o0

CUrH43id4J

TS

30m

4->Hid4-1CO

^ in<

<CO<to

43

rHO

CO

0QCMCM•a-<rH

CJr-o0

CO4-1M

inr-

•a>

WrHCJr-o0

et/

ge

t printe

r configura

tion

CO

K

pMa4-1<UCO

•it**•K•it

**•it

*•it

*•It

***•it•it

*•it

**•it•it

**•It•it

*•H•it

**•it•it•H

*•It•ft•K

**•it•it

*•H•H•H

**•It•it

er

configura

tion

4-1

-HMa4-1<ucs

0a

K

^^m<

UCO<«•

S

ios

CJCO

0QCM0CO

oCMCJr-oo

cu3Hid£>

3CU"Z

*~*f-*(3JVrf

•a'

|5

PCO

4_J

•a10oovo

^1

Q1CMOr-oo

do

n't se

ter

configura

tion

-. JJcu c> -H-H M-P Q<(QO^ 4-Jcu cu73 CO

^B ,

m(•*oCOrtjto

^o —n r-CJ <t— ~to "a1

-H >g 043 g

CJCOrt0

0oo

VO [V|O VDpq pqvo o

co <CCM CMO CJr- r-o o0 O

379

Page 387: Atari ST Internals

007C30 4E75

rts

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

007C32 302DOA7E

rnove.w

$A7E(A5),DO

007C36 4A6F0004

tst.w

4(A7)

007C3A 6B16

bmi

$7C52

007C3C 322F0004

move.w

4(A7),D1

007C40 1B410A7E

move.b D1,$A7E(A5)

007C44 4A6F0006

tst.w

6(A7)

007C48 6B08

bmi

$7C52

007C4A 322F0006

move.w

6(A7),D1

007C4E 1B410A7F

move.b D1,$A7F(A5)

007C52 4E75

rts

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

007C54 203COOOOOAOE

007C5A 4E75

move.1

rts

t$AOE,DO

kbrate, set/get keyboard repeat

Delay before key repeat

Test new value

Negative, don't set

Set new value

Repeat rate

Negative, don't set

Set new value

ikbdvecs, pointers to IKBD

H- MIDI vectors

Address of the vector table

63senC/3

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

007C5C 52B9000004BA

007C62 E7F900000A84

007C68 6A4E

007C6A 48E7FFFE

007C6E 4BF900000000

007C74 614C

007C76 082D00010484

007C7C 672A

007C7E 4A2DOA7B

007C82 6724

007C84 4A2DOA7C

007C88 6706

007C8A 532DOA7C

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

addq.l #1,$4BA

rol.w

$A84

bpl

$7CB8

movem.l DO-D7/AO-A6,-(A7)

lea

$0,A5

bsr

$7CC2

btst

#1,$484(A5)

beq

$7CA8

tst.b

$A7B(A5)

beq

$7CA8

tst.b

$A7C(A5)

beq

$7C90

subq.b #1,$A7C(A5)

timercint, timer C interrupt

Increment 200 Hz counter

Rotate divisor bit

Not fourth interrupt, then done

Save registers

Clear A5

Process sound

Key repeat enabled ?

NoKey pressed

?NoCounter for start delay

Not active

Decrement counter

IenHi6S5T

Page 388: Atari ST Internals

Abacus Software Atari ST Internals

Not

ru

n ou

t ?

\5)

Dec

rem

ent

cou

nte

r fo

r re

pea

t d

elay

*••*«

QP-

CO F^

o *r- rHv> =>t=

0) 43C 343 CQ

Qr-

oCO QrH <MVQ mVQ in

W oCO O\ CJ

p- p-o oO 0

Not

ru

n ou

t, $

A7D

(A5)

R

eloa

d co

un

ter

, DO

Key

to

re

pea

t,A

O P

oin

ter

to

iore

c k

eyb

oar

dK

ey

code

in

k

eyb

oar

d b

uff

er

,-(A

7)

20

mil

lsec

on

ds

per

call

,AO

Get

ev

ent

tim

er v

ecto

rE

xecu

te

rou

tin

eC

orr

ect

stac

k

po

inte

r-D

7/A

O-A

6 R

esto

re r

eg

iste

rsrA

ll C

lear

in

terr

up

t se

rvic

e b

it

10 m 10 10 10 Q &j

i C tn cQ CM cr* os] o , — » t£ *— . -to-C j r ^ r - i J M r - ^ p o o «» r- -.r - r f ! ^ c ^ r ^ t ^ ^ r r f £ < M f 3 S i o</> -o> </> •£/> -u>- -c/> -o> *— ' =&= ••— =&=

*. * * 1 * 1£U QJ CO CD O1 CD Vta > > > c a v i > > v i ' a > r H a )

G O O O J O J O O f f l T J O O - P43 E £ *~~ 1 43 S 5 "r~* <0 E 43 -*

faQ far- fc,P5J fa0 fafafflCMCJCMO fain

o o o f a o o r ^ oC M Q Q Q O Q Q O f a f a C n n( - ) V Q C M ( J i I O C M V O C r s ^ ' Q P 3 P -VQ rn o i — i t — i fa c> p3 ^^ cj co MV Q < - H i - H ' C 1 V Q f ^ C M ^ 1 i n ' = S ' O < 3 1

^ r V O O o ^ r c o O o c M ' 3 ' C O Oc n c ^ c n s C s C ' ^ C ' ^ I C P C Q C Q f f l OO C J C J C J C J C J C J C J C J C J C J Or ^ r ^ p - r ~ c ^ p - p - p - p - p - p - p -o o o o o o o o o o o oo o o o o o o o o o o o

****

**

snd

irq

, so

und

inte

rru

pt

rou

tin

e

.j*

****

****

****

****

****

****

****

j

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

, -(A

7)

Res

tore

reg

iste

rs

_

^tHQ0Q

rH

(U1

OCO0op-MCO•5T

CMCJOp-o0

0)

3T!

30

0

(U

G-rlo

CM

oQ

""in

voCO

</>

0

voCO

0QCMOCM

VQOOP-Oo

No

sou

nd

acti

ve

?P

oin

ter

to A

O

m (Z.Q -p- oVt Q

0)tr >(U 043 g

COCOoo0 0O «=PP- 0VQ CM

ff pq0 CJO CJp- p-o oO 0

C"

•aa> cu3 4J

^H VI10 <0> 4J

aVI0) -aS G

-H 3.p 0

toTS(0 SeO COn3 S3

0Q

in

rtS QCO CJ(Q P-

> cr0 0)E 43

CO

0Q coCM OO p-rH VO

O ^*Q QO CJP- P-O OO 0

Els

e de

crem

ent

tim

eroQ

*

3a

oooinVQQCJP-Oo

(D3.H10

S<0in

CO•a GG O< Q

2i

CO

«• in- aO p-Q <0

0)> mO M

CO

0o vo31 p*n o•H VO

CO OQ QO CJP- p-O Oo o

Get

so

und

com

man

d

Q

Q

0

0

COt_lof— 1

wQCJp-O0

Bit

7 set,

th

en

specia

l co

mm

and

3800

S

elec

t re

gis

ter

in

soun

d ch

ip

DEJEO pM

Q ^r- o«> Q

*dj

-H >e o43 e

0oCOCOfafafafa

w oCM Ora o

O CMM CT1CJ Op- p-o oo o

Reg

iste

r 7

?N

oD

ata

for

reg

iste

r 7

.Q

O CO +Q 0 ^

•* G 0r~~ r^ c33

43

d)C^ CD >S C Oo 43 e

r-0oo0 < COO rH t-HO VQ CMO VQ rH

co o eaM M MO CJ Op- p- p-o o oo o o

381

Page 389: Atari ST Internals

Abacus Software Atari ST Internals

d

m

Io

014-1-HX)

0)4-1(0.HO01M

T-H

Q

faCO</!•

*

X!

•ac

0)X

-.H

•o

K

OQ

OOCOCOfafafafa

_Q

>

>oE

r—I

vo

014-1-HXI

01

<dH0WH

OQ

OCJ

=t?=

Q

-dc<a

10

ra•aKo

oQ

rHQ

X!

t-tO

byte

in

sound chip

re

gis

ter

ound

co

mm

and

0) ta

s *Vl 0)3: K

CMOCOCOfafafafa W«/> Q

K CJO [—Q </>

_£,

*(U^ (do ^£ X?

PH-H&O

T>

O01

c-H

>i^H4-1O0)M

-HT)

<U4-1>X)

O)

3VIs

CMOCOCOfafafafavt

N

-t-

^^o^-"

Xi

?oS

sound

co

mm

and

S013

WQO

«>

10

^1Xi

r- c-

fa 0fa CO</> «••o -oG G(0 10

0 00 0

01 01 01cfl 0) *0 Os ^ s s

oQ

0 VO ^ 0Q -3- <-H CM^ Q CO Q

rH r- u> r~3t> <fr 3t= V>

Xi

if•O rH Q, 01T! ft, S G

0)4-1

O

014J

X!

£

to

-_s

m•— -CQCO*3H</>

ik.-{-

— KO

" ^

§0s

sound

co

mm

and

S0)P3

HQO

vt

(0VIX)

c-

rH 01

co E«> -H

A ^•o a)C 01(0

E o?0 01CJ >H

oQ

K. VOCM -a-CO QWt r~

* w

X)

a a>S GO Xi

IM0)4-101-H

S1Vl

4-1O0)rH0!W

OOCOCOfafafafa</>^

H-^-^off

*~" '

Xi

>oS

ncre

ment-

valu

e

-H

S<

0Q

iH-^^0

(*^

Xi

0!

OE

^-^m<paCOri^</>

.0Q

X!

•a•o10

0!3H

>

•oR

OQ

«.+, — .0ft.

X!

ioE

0)4J01-H&0)VI

P.-H

O

•sC3O01

C-H

0!3.-!(0

0)4-1-MVIS

CM0COCOfafafafa</>

K

^-^infS^•*—

paCO

</>

X!

>oE

alu

e

reached

?

>•a <nC 0)W >H

0Q

^^inril— oP3 mco ai c r^~«• «•

X!

pH {y1

S 0)0 X)

poin

ter

back

to

sa

me

co

mm

am

•acow

o ort m^ Q

*3* P*

* «•

s•trXi <0

01 X)

VI

1-H4-1

>110rH

0)•o0)(0

0)3rH<a

ti0)K

^^m<*-*<CO<«•

K+ o--* in0 Q^C r~~— «>XJ

•QJ

^ flJ0 CE Xi

O

0)N

o4J

014-1

-HO

•ac30W

0f^

h.o

*

s•

>os

0)

1001

•oc**

^— .lOrij*-*VOCOrf|•o>

fc.o<._,

•01

re re

gis

ters

o4-1010)«

O<• vrHQ1OQ

i+*-*r~

*•*

<-\

>O£

00

3F

FF

FF

8800

rH dO COCM OO rH

O ^fa faU U

oCJooO t-HO OCM OO CO

< Hfa faCJ Ur- r-

FF

FF

88

02

o voCJ QCO 0!-H VO

o voo oQ Dr~ r~

FF

FF

8802

COQCO1-1

COoQr-

WCJ0vo

WoQr-

ooCMmof — iQt—

CMCO

vo

CMrHQt—

COoooo00

ITt_4

Qr-

voovovo

COf — 1

Qr~

PQCO

oco win papa o

< wr~\ — 1Q Q

CMOCOCO

0 fao faCO faCO fa

CM fa pa pa pa ^ oCO fa CO CO CO CO OO fa <C *C r£ <J OO fa O O O O OO O C O C O Q C O Q Q E i ] C O < C O s p Oo c M Q i - H C M t - H W C M O ^ p o i n o r -O v o r o o r H O c o o r - C T i o p a v o oO 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

O ^ P V O C J W C M ' = P C J O C M ' = P V a < C JCM CM CM CM CM fO CO CO ^* ^P ^ *3* *3* "-3*0 0 0 0 0 . 0 . 0 . 0 . 0 . 0 0 0 0 0t— r - i — r - r - t - r ~ r ~ r - r - r - r - r - r -

vo coCO OfS, rH0 0CO fa•531 Qm cjCM •SP

O *Pin inQ Qr- r-

o o o o o o o oo o o o o o o o

000000 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

382

Page 390: Atari ST Internals

00

007D58 4E75

rts

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

bellsnd, tone after

CTRL G

007D5A 0034

007D5C 0100

007D5E 0200

007D60 0300

007D62 0400

007D64 0500

007D66 0600

007D68 07FE

007D6A 0810

007D6C 0900

007D6E OAOO

007D70 OBOO

007D72 OC10

007D74 OD09

007D76 FFOO

dc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.b

0,$341,02,03,04,05,06,07,$FE

8, $10

9,010,011,012,

$1013,9$FF,0

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

007D78 003B

007D7A 0100

007D7C 0200

007D7E 0300

007D80 0400

007D82 0500

007D84 0600

007D86 07FE

007D88 0810

007D8A OD03

007D8C OB80

007D8E OC01

dc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.bdc.b

0,$3B

1,02,03,04,05,06,07,$FE

8, $10

13,311,

$8012,1

Envelope channel A

keyclk, key click

Envelope channel A

Envelope single attack

5?

Page 391: Atari ST Internals

Abacus Software Atari ST Internals

o

XIO•o

ooPnEn

OenQr~oo

>sxoo•onrdP3

-K

*****-K

******

***

******

*-X-K

***-K-X

*-}e

**-Je

*****•)c

********

0=!*=

VQrt

c-HrH

OO0oVQLOEdr

CMenar-oo

em

.l

D5

-D7

/A4

-A5

,-(A

7)

Sa

ve re

gis

ters

>o

oor~or-WCO**rvoenQr-oo

e.l

8

(A6

),A

5 A

dd

ress

if th

e

para

mete

r blo

ck

>o£

COooowVQ<JCM

f^CenQt—OO

e.l

#

$2

60

0, A

4 A

dd

ress

of

the

wo

rkin

g

mem

ory

>o

o0voCM0OO0CJ

COCM

WenQr^o0

eq.l

#

30

,07

30 b

yte

s$7

DA

Ce

.b

(A5

)+,

(A4

)+

Pu

t para

mete

rs

in w

ork

ing

mem

ory

> m >O H OE ft £

W sp QrH 0 QfV] o COf^ VQ rH

^P VO COrfS **C c£Q O Qr- r- r-o o oo o o

(U4J

(U53

t— coQ <

*. Q

=S= Q to

*• »CT •XJ 4J 4J3 M &CO 4J X)

r- r- co•a1 "sp faC"O ( PS]10 T VQ

< CJ Wrf^ rti rilo Q ar- r- r~o o oo o o

COid

0)

0

1rH

CO

CO

(X

CM

rH

.p

CO4-1

rtjrHVOCMOoo0enmrtj•31

OpqQr*oo

TJ0)CO3

4-10

OCJQ

(T(U

COor-vo

VQCDQr-oo

CO

£

•aCOo

0Q

CM

0)

ie£rHVOCM0OooenCOoCM

COfflQr-o0

oa

<uiX!

vo0ovo

HQ( —oo

e.l

#$

16D

4C,D

O

Defa

ult

m

ask

j>o£

CJ

QvorHOOoCJ

oCM

0Uor~

OO

CO

CO

£

a

voCM

OQ

rH

CDJ>O

<JrHVOCM0OOOOO

CM

VOCJQr-oo

4J

aa

CO

voCM

rH

siO

COrHVOCMOO0OrHOOoenr~

CJO

OoQr-oo

UQQ

COrH

X)

vo0COvo

rQQr-o0

<arHM-l

4-1(U

CO

0arH

1

rH

cfCDp>0E

[y.[V,

of —

voaQ10O

a04-1CO

oHM

0

CO

fBSHX)

vo

%oooovo

COQQF~oo

4-1

asx

COrHVOCM

S

4-1CO4-1

COrHVOCMO0ooenr-r£T

OQQt—Oo

COU-r)

co

(UCJ

CO

Qr-

crcuX?

^Por-vo

CMWQr-oo

CM

CM

AII0

wQ

O r-Q to

M (drH H

u X)

O CM^P OCM O^T VO

«< VO[y] p£j

Q Qr^ r^

o o0 0

eq.l

#

1,D

O

1=

Ce

ntr

on

ics

P>0E

rHOo[

00wQr^

OO

4-1

a(U

c-r)

S-lPH

H

toCMto

OQ

X)

ajP>os

wirj

CMO0oooorH

wQ

OO

4-1A-H

CU

COOvoCM

4-1CO

4->

COOvoCMOOOOenj —f^«=p

0

Qr-oo

O

CUN

4J0

<nwr~to

CUcX!

CMspVQVO

VOp-.Qr-oo

384

Page 392: Atari ST Internals

Abacus Software Atari ST Internals

C"c

•O(UCOCO0)

ft

Ed

I3•o

ftO4-1tfi

4-1ft

4-1ft

o a; 43 t4'Cd 4J

« 43 G O

£ -P0) 3

ft

4-1•o-H

ftO4-1CO

(B(U

t!) 4J

4-1 ft

a>>-)

JJ 0 j_) 0) +J S-lG P c p a> 0)o o H o en H

4-1

(U

(U

O0)Q

0!4J

4-1Xcu

j j oft SH4J Op IM

CP (!)<a crH O

fa Q

4-1(3

CO

OCO

£

ft

ft

ftO4-1CO

to w

O-H4-1PrHOCO(UM

rl0)4JC

-H

ft

n0)

4-1co

fto4-1

cn co<aM-l

to Ed

CM

o(< O- Q

O «CM Ed O OEd Ed Ed VO o ^ CPi(— SP [— CM ^C O O COt/> Vt t/3- t/5- "*^ Q Q to-

coovo oCM CM Q Oto- CM N <!

N Cd rH Cn

rH O r- I CO=tt= Q «> 4t= -CO-

o voQ O- vo

VO CMO VI-VO -

O CM rHQ -CO- =8=

faQ

o r—Q to- Q

cnCO

VOCM

oQ o

Ed rH cnr- I ooto- =*t= -co-

voCM

Ed

oQ O

rH cnI CO

=8= tf>

4-1 0)0) • 0)> 4-1 > T) 4-1

ertr

C O C O O X O C O T ) C O S U O4-1 43 g g fl) 43 <d -P 43 g 43

• CD B1 •^4 > 43 4-1 0) M ft)rH O 3 CO G rH HO g co 4-1 43 O 43

ft CO

I 43

tr> mO r4

g 43

trft COS '—IO 43

O Hg 43

Ed[V)•31OOoo0

co cnCM r-O rtjVO p

0ovoCMOO0o

CM cn orO C- rHVO 0 0VO CM rH

0ovoCM

<• Ocn oP3 o0 0

o o o cnCO CO 0 CQCO Pd rH CMsp co vo in

oCOcqo

O VO fa O^ CO fa COP£ r~- o oSP VO ( — VO

C O < O C M C O < O P d C M C O < O E dfafaOOOOOOrHrHrHi-lrHQ Q W P d E d E d E d t d E d E d P d P d E dr ~ - r - r ~ r - c - r - r - r - r — r - r - r - r -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

0pCMP

CMCMEdr-0o

00

02

60

6

ocnn0nSPCMPdr-0o

00

02

60

6

0

r-nmf£CMPdr-0o

0prt*SP

opr)

wr-0o

voOvovo

CMnW

r—0o

0"31CMP

SPnWr-0o

COvo

o000vovoft*)

Pdr-0o

ooao

ooo;

0cnrOo

<nPdt~-0o

vo0covoCM31

Pdr-0o

faor~SP

1Wr~oo

CO

S00oovovoiqi

Pd

r—o0

ooio

ooo;

ocnr-UOf£

1PdI—Oo

voonvoCMmPd[-o0

fafaor-SPmPdr-oo

CO

S0ooovovoinr-oo

385

Page 393: Atari ST Internals

Abacus Software Atari ST Internals

e c cG G O G OO O -H O C -H

-H -H R 4-> -H O .P4J 4J O 3 P -H 33 3 -H ^H 3 +J ^H^ ^H +J O .H 3 0O O 3 P" en O r H O Jen 01 *H Q) en O (1)<B 01 OC M 0) C" en MM H C- 01 O M fl)

0 -H E G M MC G C M .p p G O 0>0) < D O 3 -H 0) -H ,<S Pm ffl -H S iH *O 0) P tP C Q)M A P ft M .p 00 ( B M P -H -H C- -O0 O 0) O O 3 ,H en g O r H ,e M Ooj .p en 4J en rH 0) coo P . O J S

tJi e n m Ci 0 1 O M M M O ! 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 .po i n - i M HH M CD M cu 3 a> < B - HM O P O M & M - H » M ,G O> M 4-1 •-!0 P M M J J M OS < O O T 3 <3 O CP !3 4J 01 <SM ( D M 0) Q M MO . - H M O ) ^ H M - H ,H CO <I) 301 en w E-I to wr M i -3 h o i s fcoita c n - a e - i o

o

CM

CM=8=

Q,6CJ

wovoCMOOOoCMOOOent^Oo

inWp^0O

ICOrH

VO0rovo

CM

Wr~00

oQ 0

•> rtrH cn

1 CO

tyffl

O M5 43

COoCQ0

fe. 0ft* O0 0r— vo

vo voM pqt — p-0 0O 0

ovoCM

ftso

ovoCMoooo[ooocnr~~Oo

voWr^0o

o< Q oW <H enP- 1 CO</> =te «/>

if(U

01 > cOrH O M43 g 43

COCMCQo

VO PC, 0O f-i oto o ovo r- vo

CN ^* VOp" p- P-H H Hp~ P- P~0 0 0o o o

wovoCM

s4J01+J

HovoCMooo0enp-rt•a1

<[V]c~~o0

voCO

tr0)43

•53*0p-vo

oCOHp"0o

oQ

MrH

O

Or

CM•SI-

CMCOaf^Oo

COCOHp-

<0M43

CM00VO

COar^0o

oQ

rH

if(!)

O6

<H00p-voCOpt)p-0o

CMCOfc.

OQ

43

0)

Og

CMCOPL*J1

Ooo0oo«H

COCOpt]P-O0

ovoCM

tH

3

ft

°

wovoCMOooo(HO0oenp-U0

COpt)

{ —oo

U

p"

tr0)43

•a10[-vo

voenWp-o0

oQ

MrH

O

O•=PCM•3*

COenar-o0

1<oM43

CM00vo

cnWp-oo

oQ

*

0)

oe

rH00p-oenHp-oo

voQ

OQ

43

<B

Os

voQwS31

Ooo0oorH

sacnHp~o0

wo

CM

CM

S

fts0

wovoCMOOooCMOo0cnp-O0

rtp&lp-oo

CM

P-

(T0)43

*CJ*

0p-VD

O

wp-o0

CQ

O p-Q «•

M ISrH M0 43

O CM• OCM Osr vo

[V) of£ PQW Wp- p-o oO 0

oQ

*

O1

CD

OS

fHOop-

CM

Mp-o0

COQ

oQ

43

(U

0e

COQ

rooo00onrH

S

P-OO

o(HVOCM

4JCO

^

OrHVOCMOoo0enp-rtj•a1

1p-o0

voUHp-

er(U43

rop-vo

oop-oo

oQ

MrH

0

0^pCM•a1

CMUp£)P-O0

COU

p-vt

<BM43

CMOOvo

CJ

p-oo

386

Page 394: Atari ST Internals

Abacus Software Atari ST Internals

-Hi-l

Oo

-o <O HS <

CO COp ft

O,

aX-HS-l

(8 0!S -Hi <a

OoH ft

EH<

CO4J

-HMO,

H C1-(U0) X,C -H

>i <aM S-H

P5 C< oEn tort Q.

fO P 01-H 0>Pn ft >H

13 SHS CO

[ i (^O -Htj SH

s a~X rHCQ cocoG .Co sft >1H to

-HM - ido -o

•H

0)•ao

o4J0}

O•o

H&> 05ia <rH EH Ofc. < 3

COC4 -M0 G01 -Hft O M O

ps^ FS P-i J3

O

OCO(D

CO.p

-H

OQ

voCM O

Qw

O

H oO Q

voCM CM

=tt= Q =tt= «•t~- O C— rH O

* WCM r- o r-

0" VOCO rHfc, VO

O ^ CM COQ «• «• O

oQt-

< o r «sp wO Q </> CO r-t

oQ o

oQ

rH o co r- o r— oQ

r-<o

covt

CM CO CM On H n afo H fc, v

tr0) 0!

tr • sco a> • CO 0)s s tr • .Q o1• • CD Q) • CO

ft O* M IB ^ ^ 4-1 &* ^ IB

A ^Q D1 *• • CO CO

•P CJ1 -P CO t* *B K*01 CO 01 H O !H Op £> 4-> £> S ft S

vorHVOCM

CO OW OW Osr oO rHO Oo oo oo c^

o o r-

vorHvoCM

W OO Or- oo CMo oo o

o co o c—[— rH O VO

O CMO *3" O O

VOrHVOCMOooo

O COo oo oo o

COPu

COoQ

o oo oo oo o

CO<o

CM o o co o r-VO t— rH O

o r - o ^ j i o o o r - o s j 'c M o o o o r - c M

o oo o

O CO O Pn Oco rtl r- o o

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

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 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 CO COa w wr- W W

o o oo o o0 0 O0 0 Oen cj en r rH co enCO O CO O O O CO< r- < vo o o o

W <r vo o W o CMrH CM CM CM CM CO CO

O O O O O O Oo o o o o o o

387

Page 395: Atari ST Internals

Abacus Software Atari ST Internals

olu

tion

ion

?

M 4-1Q> 3

OM 01CD 0)-U M

-5 3!H O

01C-HrH

HCO

01

%-rl

O

P.

OCMco^

454-1t)

O -H

e-^

3-H

COG-HrH

asP.014J

-HOP,

4-1 O45 CMjy ro-H!H -

O CO 4JCM 3 TiCO rH -rl

1 04 3

0)

-HrH

COp.014-1G-H0P,

0

vo

^r-;

3-rt

3

e-j

S-rl

3

0

^*4J VOir;CJI O-rl 4-1rl

45O 01 4J"31 3 *DVO rH -H

1 cn S

tion

?

counte

r

3 MrH OO rH

0! O

CO Ufa

M45 10cy 01 co

-H <B rH33 >n CJ

rH

<0p.00

014->-H

G<a10rH

H CDO &HrH rl0 -HU

4J 01CO (0CJ S

!H0rH

Oo

COG C"

O <U

rl 45

CD 34-1G rH

M -H (00 O 3r H P . t r

O 0)O rH

<0 M0) P, 0> rH rH

(0 O OW O O

rl0rH

Oo•o

01 <00) 0>-! r3

OQ

3

4-1X

oCOCO•5P

CO

w

«,oQ

_Q

.CD

0g

COww•31

oo00oCJ

rH

CMCO

*3*in

434-1014-1

CMCOfa•xPOo00enCO

«p

voovoCM</>

H ». p£)VO O VOfa CM far- co r-

3cy PI 01CD S rH

43 U 43

vo0voCMo0ooo<qirH0

vo en oCM [— rHr- CJ covo o vo

oQ

voovo

O CMQ in-

sl£ •• 0)rl >rH 0

0 g

vo0voCMoo00

o en^P COCM 0•5P CO

oQ

Oofa=tt=

3•a•ocfl

oowfaor-0Q

OovoCM

•.0Q

3•

•oTS<0

CJ0voCMOo00ent—rH

Q

VO0VOCMin-oCMCO

g.•

<D

Og

VOovoCMOOO0ot—Joofacoto

VOovoCM

CM - CMcn o enfa •a1 far— VQ r-m- =#* m

3

10 P, 01rl g rH43 0 43

vo0voCMOoo00COCMO

j1 en (3jCM r- rHO O COVO O VO

OQ

voovo

O CMQ <*

3• 0!

rH 0

0 g

VOovoCM00Oo

o en•sp COCM O•a1 co

oQ

0COQfa«>

*

3•

T>•o*

0CODfaOr-oQ

CJ0VOCM

*.OQ

•T3T)10

oovoCM00OOenr-rH

Q

VOovoCM

0

VO=s=

s•

CO

0g

VO0voCMOoo00COCMOOfacoco

COOUi

</>

43

4-1014J

COQW*3*00Ooencof%w

oCOrHCOtO-

COG

43

vor_£J

rHOOOvovo

rH

rH

COr-rH

r- coQ m-

3•

!H <0rH M

0 43

COQrHO

r- o•3* OCM Ocp VO

0

CMrHVOCM 0m- Q

rH

• 3

£> ^40 rHg 0

CMrHVOCM00ooen op. iO CMCM T

0Q

003*

""-"

s

•CO

0g

orH0co

oQ

r-r-

ift

*

3

T3G(0

t—[~-r-oCJt—0o

r-irt

^0Q

3CO

0g

m*$iOO0ooCJtoco

CMrHVOCM

*CM

rH•

er•o•a03

CMrHVOCMOO00enCO

10

03p-

vt-r~r~in-=*!

3

P.g0

mr~ioooof«.

r~r~oenP-O0

inrHCOin

tr43

enrHoo0r-vo

0a

p-iin

3

ai0g

<mr-•3*OO00enco0co

fafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafac— 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 oo 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

Page 396: Atari ST Internals

Abacus Software Atari ST Internals

r)CO4-1C-H

ft

X-H

rH 4-1rH CD ca0) > rH g

> (U (U IO) 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 ) r H 0 ) r H < U O <B C D C U0 ) > O < 1 ) > O < D > O > rH rH4 - l K J O 4 - l < Q O 4 - l f l 3 <UR 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 CO C EH O CD H MH < i-3 1 - H K C r P M < l< !3 K O C3

O OO Q

O O rH rH rH rH rH

CM O fiCO *3* <J r f J r3? • O O rtj • rfjU Q Q Q e n ^ — » r H Q Q N r H ^ — ,L O ^ M K «> O - O < - - C J l = S O r H

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 » . r H r H W r t ;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= t t = Q « - = s = = « = Q < n - = t t = = » = Q « > « > Q < = * « > - Q r t ; = t t = o - u > < n - « - « j - c i r t ; = t ( = O Q s C = » = 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 On ) 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

owH^oooo

en o oO fa coCO O CMQ 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 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 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

CM <CJ «m r—CO ^P

r~ o o0 0 0o o oo o oU o enC- CJ COo to oCJ (0 CO

r-o00

0 CJ•31 E —CO Ow o

< <Q PQW r~•3» •a10 00 0o oo oo enO COCO OCO CO

^penvo«3»

r- o0 0o oo o

o o o«T E~- OO O COW O CO

wCJr-<3<O 'S'0 rHO rH

o oen oco o< r-sp «>

r~ co•31 O0 rHCO Q

O ^PW enW «>SP ^P0 00 00 00 0O en r~fa PQ sprH 0 0Q CO CO

0WW!

oo00

CO CJO r-rH CMQ CM

<QH*r

o oo oCO 0en oo enco c—0 0to m

<Qu•SP

oooo

co en tqo co opL4 O O

\o co vo

C- CO^p CJO rHCO Q

CJHH^3*O OO OO COo enO 0r- coCM OCM CO

389

Page 397: Atari ST Internals

Abacus Software Atari ST Internals

rH <B0) rH rH <-\> <U Q) 0) <B0) > > > rHrH 0) (U 0)

rH rH H G(1) (Up T> -O - G O )<H (1) (V (1) Hm « PS o5 u

o oa Q

rH rH rH rH rH rH rH£ C B O O <C • (4! O f£ S T O r i |- rH Q Q v rH - —, Q - rH CTlQ -

C J < - - O r < C J r H - O Q V O - OO 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 Wf = C r f ^ W O C J ^ O O t — ( ^ C ^ W O r f ^ r f l C t l "-" 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 « >Q r = s ; = s = o « - « l - « > < « - Q f S ; = H = O Q r t ; = f t = Q « > Q r a ; ^ 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 Hd ) - 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 - aO ' 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 JE < 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 JH U O W H < ^ H c n Q WW i n i n W W V O H V O H f M^ P C O C O J1 ^ 1 * 3 ' ^ 3 ' ' S ' ^ ' ^ Po o o o o o o o o o o oo o o o o o o o o o o oo c o o o o c o o o o o o oo c n o o o c 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 o o o o o oC 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 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 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

390

Page 398: Atari ST Internals

Abacus Software Atari ST Internals

^H rH<1) rH <B rH> rH <D H > 0! rH0) 0) > 0) 0) > fl)rH > (!) > rH <B >

(1) rH 0) rH 0>R rH H C rH

a> ai a) <B0) 'O 3 T5 0) 3 t3(J <1) rH <|) H rH 0)o « M « u m «

rH

Q

^

^^rH

<

3

>OE

rHQ

rH

3

•aTJ10

oQ

rH

a

3

43'p0!

\Oo00

.p

43

0Q

3

(HrH

O

00ooCO

<d

43

0Q

rH=8=

rH

tJ1

(U

Os

QW

</>^

OQ

3

§OE

0oCMO10CO

3.

•0)

os

j— frtj

^r-Q

3

^OS

rH

ft.

rH

•*!

rH

T3

T3fd

<CJwwp

«•

*

rH

•a•o(3

rH

Q

-,

rH££

"*-*

3.

•d)

Og

rH O rt

Q Q W- - orH rH CO

=**= Q <*>

£

FT* •#43 4J•O 3 Wfd o) 43

oO

3

^rHu

CJ

o00<0

(dM43

oQ^

rH

*rH

cf§

OE

CMOIOCO<o-^

0Q

3•

0}

Q

6

OQ

•SPON\Q•sP

«•

3.•

(U

OE

0avCM

*

3rH

COid

rH

Q«.

<0w•q»«•

s

>0S

rH

Q

^rH

*

3rH

at<3

OQ^

rH

Q

sT!•ota

0Q

K

CMO10co«•

s•o•(0

rH

^r—Q

3*

Os

rH

ft,

^rH<

rH

t5TS<d

<

COONVO^3*«•

=*

rH

T5

<0

_

rH

^~—

•s

OQ

3.

>OE

oQ

K00 -=PIO ONrH tOCO *3*•o> u>

s

m

<d >M O43 E

rH

rH

CMco

rH rH -3- O CM

«^ ^P O ^P OCM O W CM OIO <3N \O ^P \O

QW

Oooo

rH O

o oO COr^ ro

CMCJIOCOoo00ON r-CO ^PO CMco co

OW«5i00o0

ON O rH rH rH -ST OCJ p4 rH "531 ^T O ^CO CO CM CM O W CMO Q co in ON vo «a*

CM rH0 0o o\Q t —

CM TO ONIO VOCO ^0 00 00 00 00 WO COCO Oco co

Q

spooo0

O CNi co

IO CMptj co

CMoIOCOoo00

rH i-H ON*3* •rP C"~co o o&3 C3 Q

00

•5P

00oo

r- ON CJT CJ feCM CO COCO Q Q

0COCMco

Sroo00

O ON^P COo o«3 CO

O O O O O O O O O O O O O O O O O O O O O O O r H r H r H r H r H r H r H r H r H

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

391

Page 399: Atari ST Internals

Abacus Software Atari ST Internals

DI O^ O^ ^ ^C G G Oi CO 01-H -H -H G 4J M4J 4-i 4J -H G «HA A fi rH 3 Id

-H -rl -rl O O -OCO fl) CO W CD C1-3 3 3 SH rH

^ 0 - O S H G<#> d° o\ O rH G O OO C5> rH O O l d r H - HrO 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 Oro 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 HC O C O C O C D C O - r l SH OE co E 3 E > 0 ^ 3

-rl IH -rl rH -rl -rl G VO O O

oQ

swrH

3g

Q

Q

s

mo

ve,

rH

Q

co

=»=

3

rH

g

OQ

rH

O

•a•a<S

Q

CMCJ

3

mo

ve

,

rH

O

CQ

=t!=

3

rH

3

0Q

rHQ

•d"O<3

OQ

, i

4-1XCU

oQ

=a=

S

-rl

T3

rH

Q

mo

ve,

rH

rH

•d•a

CJ

*

•oTS

rH

0Q

mov

e,

o

Q

mov

e,

o

o

•o•aIS

COenvo

«i>=tt=

•a!HrH

o

rH

CO

^3

o

Q

S

mov

e,

o

o<

•a•o(S

03en

=tt=

•a"T3

0

3

mo

ve,

o

Q

mo

ve,

o

o

, 1

•a•aIS

CJwW

=tt=

, 1

•a•aIS

0

CO=»>

mov

e,

r-QrH=»=

S

-S1•a(8

Q» CM

O K£

«• r^=!t= «•

Cl< 4-1E rHU ,£3

CMCOfa•5P

4-1«4-1

fa1 Ocn Qt — i K

«• =*

rH

CO<r >CO O

,£? E

WrHOoCJFMrHU

WrH

rH

<QM^POOOoenCOCMCO

CMCMrH

fflmoouPuroCJ

CO

CMrH

rH•=3*OQ

0CMrH

CMOU1f)OoooenoCMCO

WCMrH

«OOOCJfaroCJ•=rCOrH

rH^POQ

03OrH

OCJCO•0"

rt;roi-H

*TvaooU r-fa ^prH CMCO ro

CJ 0CO ^PrH rH

enoCOQ

CM

rH

OHH

oo0oCJfaCOQ

•S31

^J1

rH

OCOCMO

^TrH

t—

0fO

orH

COUrHQ

W

rH

COen\o•a1ooooOfarHQ

OmrH

OmCM

vomrH

CJ

ovo

CO

inrH

r~

•31

0n

<inrH

COOrHQ

OmrH

COenvo*r0oooofarHQ

WmrH

[OOoCJpqoro•sPvorH

r~

•31

Oro03vorH

COCJrHQ

<VOrH

CJMH«=POOooofarHQ

OvorH

03OOoopqoro

CMr~rH

r-

CMinvor-.

rH

0rHOOCJr-Hpa03r-rH

^PCMHfaooQVO

or-rH

CM03fa^POO00enco<r

0COrH

VOrHr^

VO

VO

COrH

SPOo

03COrH

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

392

Page 400: Atari ST Internals

Abacus Software Atari ST Internals

G-H

p.X

C 4->O Ifl-H g4J I3 4->H OO T3°> —<U &

0*g +Jp K J3 4J

-H O 4-> Cf fi•o n t-i -H Q>s a

fi,0 Q) 0)j

o c o o i c r o c M O — ^~o o o o o o oo « 3 W M v o w o r- r - Q o o Q Q Q Q

— «• O O O « 3 Q < / > « T v HK ^ ^ t H H ^ H ^ ^ » » r H » v ^ r - < H ^ r M 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 ^ - S I S S 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 > > MO 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 OW «J K| Opq r- H Pn

C J 5 N O 3 VO O C O O O O O O CJ CJ < V O O C O V O V D C MO M V O Q O « 5 O O O O Q O O O O O V O C T C n UP o W r - W pu r -o o o o r - h f c i v o v o « > r - V D « 3 H^ r - s r ^ r •a1 • O ' ^ P O 0 0 0 * 3 * r ^ C M C M C M ^ T ^ r ^ - c 'O O O O O O ^ r i H O O C M O C M t H 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 O000 O 000 O O O O O 00 O O O O O 000O 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 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 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

393

Page 401: Atari ST Internals

Abacus Software Atari ST Internals

G-H<8

co0)

T3TS

I0) 01

01 H.p

rH S-l C .H43 O < .Q

4-J0)CO

M-lW1-1

toto(!)

p.PM

HW

•. M(71 0)

3•o

.C

-H

*

K

O<D•a-H

O

OPJ

OCO

«/>«.

0Q

00

, DO

FF

FF

FF

E,D

O

$4

6B

8

VO fa •*CM <O OW- =ft= Q

OQ

•s

00

CM«>

O

COpa•5I1

<«-CMCO«•

0a

oa^p o0 VOVO CMCM CO O•y> -c/> Q

0Q

VOCM

O

KCO

*

r-

v CM en paO <H CO SPQ <*>< />< />

COCMVO

vo coen -CO rH</> =**>

o oQ Q

vo coo vovo r~~CM -a1

oQ

O CO OQ vo Q

•> r- ..

o OQ O* pa o

co <r Qpq «• -vo •>. 10

rH •

rH • CP S• 0) 4) •

T3 > > !•<•O O O rH<a g g o

00

82

26

33

C0

00

00

3E

80

00

82

2C

2

03

90

00

02

60

00

08

23

2 C

OB

CFF

FFFF

FE0

08

23

8 2

3C

00

00

04

6B

80

08

23

E

20

39

00

00

26

00

00

82

44

BO

B90

0004

6B8

<ovovo<CMCO0o 0

08

24

C

42

40

00

82

4E

3

03

90

00

02

60

40

08

25

4 60

0A0

08

25

6 4

24

00

08

25

8

30

39

00

00

26

04

COCMVOCO

O rtl f""\

r~ CM •» o•5P <H O OO O VO O W iHO O rH O rH Oo o r- o r- oo o o o o o

o o e n o c n o c j o^ i C _ ? r ~ o t — o f a * 3 *O C O C M O < 3 V O C O C M

VO COo vovo r~CM *3"o oo o

COvot—oooo

en en co en cofa

o oo oCO

co Upq QVO [£1

o oo oo oo o

o o o en o fao oco o

co o n co CM CO OT •O' Q

pq O o

m v o v o v o r - r - t - ' C o c o c o c n c n c n c T !C M C M C M C M C M f M C M C M C M C M C M C M C M C M

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 W o vo cj pqen cs\j (!3J <l ^JCM CM CM CM CM CM

O O O O O Oo o o o o o

394

Page 402: Atari ST Internals

Abacus Software Atari ST Internals

4-1 -P& f, A4J Oi B>TS -H -H

-H -H 0) <B

4}Ti

rHQ

VOOvoCM

3sgO

vo0voCMOOOOenCOCM

rHQ

CM*

TJqra

EMoooCJr-CM

CMrHCM

Q TO•- ».

rH OQ Q

s

IS •. <1>

3 OCO g

CMrHEMi

OO00

rH 0•5T OO CO

CJCMCflCO

ousCMTO

g.

g

OgCJCMcflco00oo\0V0CMOo00csCMCO

oQ

CM CO[v, oCO VDCO O CMTO Q TO

g.U •

• <D(fl H >M rH O43 0 g

COovoCM

*xp O

CM OrH OO Oco o eno "a1 coO CM O

OQ

CM*CM

TO

U

433

CflCMrHOOOoenr-o

oQ

CM

Pfl0 0 0 «•Q Q O TO-

j.

!5 *

(0 M Ri FS rH S -Hw o co "O

CMCM*fT~)

^31OOo0

o o o os^p ^p ^a1 CMCO CM CO O

oa

f CMCM MCM Mco •a1TO- TO-

j.•

Q)tr >0) O43 g

CMCM"p£)

•a1oooo

co eno cot— o

0Q

CM COO Oco «>03 O CMTO Q TO

ss •

« M gM H O43 0 g

CO0VO

CMOooo

CJ O CSo ^ coO CM O

0Q

WCM!— )

TO

3s

43*3a

rtjpqCMrHOoooosr-o

CMQwTO-

M.Oa

jj•

cu0g

CMQ

jioo00oCJ

C,$

49

3C

QCfl

TO- Q

H

• 31(1) .> iH0 ^g 0

OCOOSsroooooQW

Oo00os r-CM J1

CO CM

ScoCOTO

<0M43

Cflenooooo

rHCM•a1TO

S

rHU

rfjrHCM*rooooent—CM

Cfl0CM

TO*.

rH

*

•<a0g

cfloCM•a*oo00rHOOooCM

C,$

47

BE

COcnji

TO

rH

g

Og

Cflpar-^pooooCJ(OOS•a1oooocnCMto

O

"a* pfl\O PQco r-

VD CO -31Q TO TO

rH

S

M (0 >rH H O

0 43 g

Cfl

r~*3*0o00

%o o cnT co t—CM 0 0

OQ

,_*Of3j^-^

g

Og

orHO

rHQ

rH •»Q CM-. rH

m CMt — ) ^*

* ^rH

cf S> 430 3g W

CMrHCM«giOOOo

EM eno t—CM CM

C O C O C O O O C O C O O O O O C O O 3 0 3 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 X ) C O C O C Q 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 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

395

Page 403: Atari ST Internals

Abacus Software Atari ST Internals

co

OcoCD

-H Oat &

o < w «> O f i S o o r -Q r H C Q Q < , •> ~ Q C O Q

^ f c , r- - * o o » m »W T * r W « > C O ' 3 < C O « 5 ( < ' = l ' C O r a c M < O H < r M C O | i a « > O ^ T t — C M C O C O OO « > < 0 - O Q « 5 n Q C O r H C O O j m B i ; < H K i ; W — < C M p q c n Q 4 0 - Q Q t - H C M F t ,h - itu ^ r ~ n w c o & n r o « > c o c o l i < ".^ - C O « > C O V Q » «. ^ H r o v o c o

* SA - S H r H ' S £)

m • t? • O1 ' • • •- '

00

83

44

E26

00

08

34

6 C

07C

0001

00

83

4A

C

1F90

0004

FO

E0

08

35

0 D

1790

0004

F1A

00

83

56

54B

9000

047B

E00

835C

E

1F90

0004

FO

E0

08

36

2 5

24

60

08

36

4 B

C7

90

00

04

76

80

08

36

A

6DC

80

08

36

C

4A39

0000

4ED

80

08

37

2 6

71

20

08

37

4 4A

7900

004F

1A0

08

37

A

67

08

0083

7C

42

39

00

00

36

28

00

83

82

603A

00

83

84

601C

00

83

86

30

79

00

00

4F

1A

00

83

8C

D1

C8

00

83

8E

D

1FC

0000

4EE

C0

08

39

4 O

C50

0008

00

83

98

6

70

800

839A

4

23

90

00

03

62

800

83A

O 6

01

C00

83A

2 3

03

90

00

04

69

600

83A

8 E

34

000

83A

A

48C

O00

83A

C

D1B

9000

0493

C00

83B

2 5

24

700

83B

4 B

E79

0000

4ED

200

83B

A

6DO

OFF

5C00

83B

E 4

A3

90

00

03

62

800

83C

4 67

36

396

Page 404: Atari ST Internals

Abacus Software Atari ST Internals

M4J

•a

ra

o<aa. oW 53

fc.•5P CM

oa

OQ

OQ

O coW(0CO« / > « « • = %

OCM

co o«> CM

r- t-Q Q

O O O

CMCO

OQ

O OQ <H

c- oQ Q

OQ

OO

vocoHn o«- Q

oaoo

r- o CMQ Q =«=

oQ

o r- oQ Q Q

o oQ Q

r- oQ Q

coco

CO CM f^C/5~ Q FT1

^ r- coo T coQ </>« />

QJ a)

ooooen

ooooa\-

<C

COvo

oooo

co enr-t COO ovo n

OOoo

o eno mCO «H^* en

O OCM CM

O O

co co coO O «5 OO O Q OO O WO O hten en oi— r- oco

ooenco

o oo oo oo oen enP&4 CO

CO lf> «> co o

fC, r- oo o or- o co

CMoooO CM O O r - o

oo

OO

coooooo

oo o

CO CMCO QW C"""CO spo o voo o rto o ^0 0 0o en o

coO C M P ^ O C O i H C O C O O C O i H C O C M O

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

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

397

Page 405: Atari ST Internals

Abacus Software Atari ST Internals

4JG

-H

P,

10

4JO•o

oo

GO

-H4-1PrH

Om0)

En O -H< K 33

o]CU

VO

•X

OWW

0)

ts-rH

Mo,CDA4J

O4-1

O*S3-HH4->01

c*»4-1

P, 04-1 rH

o w

£_l

os^Jq0)

SHO1H

O110

O rH

& Ed

014-1<0G

-rH

g

CD4-1

K

^]OL4}_l

H

rH

CD

4-1

-HrH

P,

O4-1

MIO 4-1

X 4-1- P M

ft. OO 4J MW

O W

CD4J

rH 10

O GrH -HH gCU M

0)M 4-1O"H -

rH

tP OId rHrH SH

Ea W

rH

CU

4-1C

-HrH

ft,

O

4-1

X

4-101

r"4-1

- P SHft, O

O 4-1 rHW P rH

W O W

orH

OfH

tp10

C O W W C M C O C M C O E ^ )c o c n c j C Q D f C l c o r -

M10Q MVO pr,I-H cn«• CO

CO -CO CO

o fc. vo oO Q O C M T W Q W O Q OE— *. rtl CQ </> cn vo pt. cn *. <J" r p r H C n "3* ^ • O ' r H C n S T r H C n

O 03 I CO C O r H C O « > C 3 O C O | C OQ < / > = t e - U > t / > ^ H / > ^ = < / > Q < / > = * ^ < / >

COvo

CM Q Hpq vo hsr <-H cnCO </> CO O CO</> ^ <«• Q «>

oCM Qpq v

I=tt=

Ho4-1 CT 4-1 CD 4-1 CD >O) (U W C 01 G O .4 - 1 ^ 3 4 - 1 ^ 3 4 - 1 4 3 g 4 3 4 - l

s tr0)

SH 4-1 D" > 10ffl CD O rH

S 43

10 ft. 0) >M S G O43 O 43 g

? O1

SH 4J O1 > (001 01 cu o SH43 4-i 43 g 43

(U10 > rH 4-1 CJ*

rH O 01 01 0)

43 g 43 4-1 43

tTCD

o

00

04

F8

8

ocnr^CM*r

VQ^P

OIO

oooovo

o

00

04

7C

E

ocnnf^•=r

oIO

<IOr-vovoin

00

04

ED

8

oCTlro<^TCOIO

00

04

F8

8

oCM cn10 r-vo <VO T

W 0If! vo

VOrHVOVO

voVD

00

16

D5

E

oocoP=3CM

COvo

COIO000rHVO

Wvo

o•31rtj•5T

CMr-

vo0r~vo

•3<r^

voCM

0

Eu 00 0r- vo

VO COr- r-

C O C O C O C O O 3 C O C O C O C O C O C O C O C O C Oo 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

novo

COCOEd

0o0orHO00en[Oo

vorHVOVO

rovoQvorHOoo0fflWCM

tv")

VO10ooorHVO

O VO^ o^ f ~3, VO

vo0IOo

Ed OPd 0o or~ vo

C _ ) W V O C O £ £ i C M ^ r V Q C O( " " • r ^ o o c o c o c n c n c n c y i

o o o o o o o o oo o o o o o o o o

COvoQVOrH 00o 10o too o

•a- O o o vo Pdt—1 fi O i O pdO W rH f3J t— Ovo CM vo .31 vo r~O Mcn cn

co o

CO CO CO CO CO COo o o o o oo o o o o o

398

Page 406: Atari ST Internals

Abacus Software Atari ST Internals

P<ac

M(U4J

o

w

c*.

<U+JC!-HS-lQ,

X-HM4-><0s

o•o

CQ

GOCQP.w

<DC

-H•H•

CQ4JC

•H0P.

0VOen

0)»cdS-H

4J~t~\Q

^-„

CJO COS3 W

CDC

-H.H

— .014JG-HOaovoen

0)er><ae-H

4JtHCQ

^-_

CJwH

Ma>4JG-HS-lao•P

C"H

CQp.

J3 Ma o3 MO W

o sM -H

0) M

er

3C

0)A•P

<HO

O <-\l

oS-lS-lw

0) 0> X•P -P O

Xi

a>C3

P„ +J 3 H

s ra £ °O S 3 . .^ O O W

0)M 4Jo taM C

CD S

t?i Oid H

er

3C

0),£S4->

O

0)

M fflO G

S-lO

3 M&, 0

0 H 9)C3

G 3 HO O H

0 HW

o

CO

c—rt

Q <Hvo r~-Q 03 Q

oVO Q O

Q C J V O C J V O p t * Q ^ r f j

- t O - C Q - ^ ^ O ^ i O Q W - ^ - C O

oQ

co o o co o co<O Q Q -CO Q «>

OQ O

enco

oQ —

«. I—CO <CO —wCO O O•CO Q Q

Ovo o oO K <

if) i-i eno co i coQ «O * -CO

Hw

<D

4J CT >CO 0) O

s cr0} * 0}> M -P £T S> fOO W « <D O (HS ^1 4-* .Q S 43

O

s cr0 • QJJ> M -P CT r* * 1O « 03 <U O HS ,Q -P J3 £ 4 3

I O 01 CQ 0)e Xi jj xi

> caO MS Xi

XI0)I

w

oooovo

03Oo

DO

4 6D6D

ooooen co CJto o CQ< r~ w

ooo

r~QVOrH T

to1O

VO CJo eno

ooo o

oo

CM VO CM VO

O CM COO O O

CO CO CO CO 03 COo o o o o oo o o o o o

CQ

CJoo

O VO Fn O

(=C r- o o^ VO f- VO

O W O CMO CJ Q QCO CO CO O3o o o oo o o o

voCOWcoooooencoo

voQ

03OO

COo mo o

O O O O VO [c, O

co w .H < r- o o•a- to vo 131 vo t— vo

CJ w o ^ voQ Q W W

o o o o o o oo o o o o o o

COCOHcoooooencoo

offl

oen

CO *CH W

o oO O O O VO (k, Oco co o -=r o h oco w IH <C r- o o«< to vo vo r- vo

*3< VO CO O W O CM

o o o o o o o oo o o o o o o o

ooooiHoooo

voomCOoo

399

Page 407: Atari ST Internals

Abacus Software Atari ST Internals

-H<U

oQW

co UCQ M

CO W5H r-CM CO<-H CO

CJ 0n <

r- co r~Q m a

Q r-r~ ~ a

I §

r~ oQ O

** LOCO CO

vo

LOr- coQ in

0 O

r- oQ fC

r3? OCO fS.w —</> r^* =tt=

r~ r~Q Q

S S

M110CO O^3* Q

oQ

CO0

CMin

oQ

<

CMrH O«• Q

OP

CM

O o «rO Q in-

0Q

0 CM W

ill

tr ft

(J CMa ^Hw h• -qio oo oo oo oO O O C OC Q C Q W101— CM^p -=T i— Io o o oO O O - a 1o o o no o o o

Qr--C1

oOoo

coOoo

COHCOo r ~O Oo oo o

Ooo

C O <O HU > C MCNi-Ho oO Oo oo o

oOoo

oOoo

M j r 4 t iC 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

c o c o c o c oo o o oo 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 o c o c o c o c 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 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

400

Page 408: Atari ST Internals

Abacus Software Atari ST Internals

GO-H

4-1

tP-H0)ft

Oto0)M

-H O« S3

OJCO

p.

oQ

3

, — |O

o^pCM^P

OQ

COovoCM</>

3CDog

COovoCMOoooenrooco

0Q

t^WCMrH</>

3

43*pCO

wCMrHOOooenr~oen

CMQW«sP

w-IK.

OQ

3

CD

og

CMQWqiOooooCJcoco

Ocoen

CJQ&331«•

H

•0!

Oeoen

o0o0CJQwpooooenfaff)CM

rtjenvo

r- coQ Vt

3

!-H fOrH M

0 43

COfaoo

r- o*3* OCM O<=p VO

m

§oen

(U CDO Oe e

M

W Oo ofc. o

< o orH O COP=H o en

O rH OO O O0 0 00 0 0en o en vo

CM co ro CM

o< o

v Q rHO H «. Q& « « - - » • .in r- o inCO l1 rfj rH-V> </>*-* =**=

OQ

CM O O WrH Q Q O

fc. r-

vop

•CO P =*=

•a- M vo co o co CM</> O Q VO CJ P CM

*. PC, «. [— in M vo

op

PL, VQ VO O•31 CO CM rfl« > < / > < / > " —

• • cr 3CD CU CD •> > > 450 0 0 3e a e

K)m

3 rH 33 3 - 3 - 3 - 3 43 3• • c Q - c y - C T - • •

M T S r H T S T S r H T ) O . 4 - J 4 - J (T4J<n

« mT J ' ^ C O ' O S r H C Q C D< 3 c d r d r d O 4 3 4 - > 4 3

rH 43

(U CU

O Oe g

O rH CQ OCOVO

COp

oooo

o enco r*o oVO CM

OOOo

o fa en oo

rH OO Oo oo ocj enr~

o oo oo oo oen en

CQO CM CM CM O rH rHCO en

O CM CO W T M Oco co co co en en <cin in in in in m mco co co oo oo co coo o o o o o o0 0 0 0 0 0 0

*3* PC CM CJ W O< cc co pa FQ om in m in m mco co co co co coo o o o o oo o o o o o

vo co < o CM voO U CJ Q Q Qin in in in in inCO CO CO CO CO COo o o o o oo o o o o o

O CMQ Edm inco coo oo o

ooooen vorH CMw mCO f*lpq pqin mco coo oo o

ooooen co

CJPvo

o vo

m mco coo oo o

%en CM enco CM tp VO p

CD H O

in m voCO CO 00000o o o

voCMoooo

cj en oO r~ rHr~ o oVO CM rH

vo co Ho o ovo vo voCO CO CO000o o o

401

Page 409: Atari ST Internals

Abacus Software Atari ST Internals

Xto

< rH < O < rH <~ K < ^ < ^ ft ^iH K C K C O — «< K u< C O O O C O < r H C n ^ O O Q r f l r H H— CO f j ; < ; H r H B ! ; v O - - v ( < K S r - r H < C K l

K V O K » n f e , ^ ' 0 ' i H ^ ^ ^ 3 - l i ! » S Po c o r - o « - < = T ! H « > r a ; r ~ o « > - « i t H « >a</> Q rt * «• rt * ~- Qr t ;= !«=«>r i : *

a; • a)O T3 O

< ftCO rHW faCO SPO 00 0o oo oO enfa t-rH CMQ n

COenvo^>00oo

en oO faco coa Q

rH<noco

r- coSP Oo oco Q

•31 rfjQ rHt- fa•3* <P0 O0 00 0o oo enfa r-rH CM0 CO

owMSP0ooo

en oO faP) COQ Q

rH enin oCM CMCO Q

<rHVOCM0Oooen rHfa enco oQ rH

r- co^P Oo oCO Q

sr <Q rHr- fa«3* *3*0 00 0o oo oO enfa r-rH CMQ CO

enOcoQ

OHW

00ooO rHfa lf>CO CMQ CO

Qr-

oooo

o c x i o r - o o v o t ^ c o

C O O C N C M C O C M O O r Hqi VO i CO Q rH VO CO Q

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

V O V O V O V O V D V D V O 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 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

402

Page 410: Atari ST Internals

Abacus Software Atari ST Internals

C"

M

G.

X

!8

CO-H

Oo

O01

fflm

o,O> ffl

O -H 0>

oQ

— orH Q

- VO O<H en Qf£ vo -

OCOen

oQ

r- CMQ O

•> W

*r w Kg co <=C«C O 03 Q 00to r- r- iy r-

o o c o o o o c ooQ

COCO

lO

oa

w «•wVO

O O CO </> COQ Q m- * «•

p-CO

< rH VOrH O 0\ O VO

{ M O ' ?O rH OO O OO O OO O O

<T)O

O feCM COQ Q

< CJ CM COc- r~ oo co«5 <£> \O VDCO CO CO COo o o oo o o o

Oco

ooooenfflQ

CM

CM WQ OW j—

O CM OO O OO pt| OO pC4 O

r*- en o enT r- o coCM w Q <

CO CO COo o oo o o

>o ra

en en sC <IVO VD VO VOCO CO CO COo o o oo o o o

CO O COa w co

Q O Q O O Oo o o o o oo o o o o oo c n o r - o c n c n ^ r ^ c oO C O O T O C O t — C M - s P OC— < ; V O C M O C M | < V Q O < H

V O 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 OC 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 Oo 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 CM0 0 OO CO Oo en oO O O O O O COr* co o C&i "sr «3* oCM o co i-i co < r~

O CO[V] COM T'Io oo oo oo o

oooen

$

oooo ofc. VOco o o vorH VO O VO

v o v o v o v oC O C O C O C Oo o o oo o o o

403

Page 411: Atari ST Internals

Abacus Software Atari ST Internals

o o o o o o or3? rij f3? rfj W rt! W

<C o <; o rfj o rfjo^r rfl o «=ro o c o < ; i < o o c o f < r f ; o o c o < ; i < o o o o r i ; c M ' O > o o o c o r t ; u - w - o f y o o?•£ 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" OQ < 4 t = = * ^ - y > Q < = # = = t e < * > Q < = H = 4 ^ « > Q < = » 5 = H = « > - = * t = < r t - Q < s f r = * * 5 < O - = * ^ - 0 > - « > Q <

£ ^ S 3 4 3 3 , $ £• r H ^ H ^ • *-J H S - i H H S - H H 3 : • - r H * H 3 : - ^ 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 ( i f l ) > O ^ T S ' O ( X f l ) > 4 J O i > ' BO ' 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 ' ag ( 0 < B o 4 3 g < o < a o 4 3 S < a i a o 4 3 S < o i a o 4 3 S 4 3 S < a < a o 4 3 e 4 J 4 3 S < 3

o oM MH Wsr ^p

< < <: < o r t o oC O C O C O C O O C O O HW H H M O H O W01 0 o n o n o oO C M o n O V D o r ^ - * H o r o t - n o0 0 0 0 0 0 0 0 0 O O O OO O O O O O O O O O O O OO 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 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 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

404

Page 412: Atari ST Internals

Abacus Software Atari ST Internals

oQ

r-Q

O O Q -—

O 15

O Q •,H f - O

W O

i - ) i - I O Q O H < - I O OQ Q Q « . r H C Q Q « > t H

Q -a1 «> Q- « > Q -

a j o ) - a j M < i j t r

OOOO

-srO r HO OO OO O

-a-OOOO

H Op q oin ono

« > O OC O O C OO O OO O O

-=TQr~-a1O OO OO OO <£>

O [=3

i H O OO O OO O OO O O

O OO OO OO O

< M OO OO OO O

COOOO

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

405

Page 413: Atari ST Internals

£

0087E4 6DBC

0087E6 1039000035BE

0087EC 4880

0087EE 3E80

0087FO 610001B8

0087F4 4A40

0087F6 6706

0087F8 70FF

0087FA 600001A4

0087FE 4A3900004EEA

008804 6704

008806 4240

008808 6002

00880A 7001

00880C 13C000004EEA

008812 5247

008814 303900004FOC

00881A 5840

00881C BE40

00881E 6DOOFF70

008822 4A39000047DO

008828 6720

00882A 4A3900004EEA

008830 6718

008832 1039000035BE

008838 4880

00883A 3E80

00883C 6100016C

008840 4A40

008842 6706

008844 70FF

bitmove

. b

ext .wmove

. w

bsrtst.wbeqmoveq

. 1

bra

tst.bbeqclr .wbramoveq

. 1

move . b

addq . w

move . w

addq . w

cmp.wbittst.bbeqtst.bbeqmove

. b

ext .w

move . w

bsrtst.wbeq

moveq . 1

$87A2

$35BE,DO

DODO, (A7)

$89AA

DO$87FE

f-l,DO

$89AO

$4EEA

$880A

DO$880C

#1,DO

DO,$4EEA

#1,D7

$4FOC,DO

#4, DO

DO,D7

$8790

$47DO

$884A

$4EEA

$884A

$35BE,DO

DODO, (A7)

$89AA

DO$884A

#-l,DO

Output

Error, terminate

Epson B/W

dot-matrix printer

?

No

9

OutputOK ?

YesSet

flag

=I

Page 414: Atari ST Internals

Abacus Software Atari ST Internals

H<D

e-H

ft

c-HO(3ftCO

M4-1

<D-P<ac;-H

OnnW

to0)

4-1<0£5

-Hgm0!

> 4-1

HO>-lM

4-1O•aS-loHOO

c;o-H4-1

rHOCOQ)

o o >H to w5; O> toEH O -H CD

vorHCM

OtoW

CMC M r H O O C O O O -rH fa Q Q pq Q Q f-fa •& - pij CM - •« «: o

O « f « > O C O O "3> CM rH CO O O ~— »< C O Q Oi<C <o ** f"~ vo Q </> rH </> pq CM CM ^ rtC en *• *3Jen «. m co E— •* * . p y » . c M p q m Q e n c o r n c nCO 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 COfa- = t t = = S = « - « - = t t = Q Q « - * « > « - « - = * = « J - Q « J - = * « >

CO OCO Q

• t o o p q a p q a p q a c o i or H ^ 1 C O * 5 T C O t r ) C O r H ' 3 1 C O3 £ V } V > V * V > 3 E V > 3 £ V } V >

(Or-Qvo

(3

43

• 3 = - S r H r H S ' - S : • S ITcy • 0 . . . . t r < D * o • ci)• O P . f l ) > r H 4 - l ' { 3 H ' O > P . 4 - l > > H 4 - l O ' > < a' O g r H O t o X T S r H ' O O E r H - O t O W C D O<S O 43 E ra o us E o 43 E £ 43

o1 ••d 4-1T) to(d 4-1

M G O4J 43 S

&1 O10) CU<a ' (U

Q. 4-1 >O g G> Og O 43 g

CMrH

oooovo

COCOoo

CM OrH OPw O•SP OO faO Oo oo oen en

.CM oto o

covor-

oooo

vo en

O CM CO CO OQ rH PJ PJ CMW F"l CM CM r~1

O O O O O C O Q HO O O O O K C O r H

CJ O rHfa O O

O O O O Oo o o o o

o o e n c n c y i e n c n o o o o v oo

Pu O[V| ^

o o(— VO

• ^ m i o i o v o v o v o v o r - r - r - c o c o c o c o c n c n c nc 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 oc 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 oo 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

co pqco oPu r-^Ji 31o oo oo oo oen enr~ coCM <10 Tco pqen enco coco coo oo o

coQW*rOooocj eno co

vo <*

COCOfa*=poooo

^r co CM rH enO O O 0 t~~vo o o o ovo r- vo r~ pq

vo oco coCO COo oo o

O CM ^pq PP ffl

o o o o oo o o o o

QV0

«3* rHen opq ofa oO Oo pqpq cq10 CM

PQ pQco coco coo oo o

407

Page 415: Atari ST Internals

Abacus Software Atari ST Internals

M0)4-1C

-HS-la,o

D^c

-HS-l4-1CO

4-13a4-130

tr>id,-H4-4

4-1(U

CO

(U4-110G-H

S-4

0>4-1

N

S-lOS-lS-lw

4J

3a (v.

&4 3 W

i-3 O O

S3*idrHIM

CO 4-10) 0)>H CO

04JidG-HgS-lCD4-1

^

^1oS-lS-lM

GO

-H4-13

1 1

OCOCU

S-l(U4-1G-HS-l&4

GO-H4J

rH

OCO(U

S-l(U4-1c-HS-l

spacin

g

a>

,_|

VOI— 1CM

f— |

*.f— I

-0•.

oenw

<u4-1G

S-la04-1

O!

C-H

4Jaj

4-13a4-13o

4J3o,4-13O

C CJ1o m

i-HH M-lOV4 4-1S-l O 0)W 3 C/3

0)4-1(QG-Hg

014-1

h.S-loS-l}_lH

wb.enco o

oCM Q OQ - <03 ,-t en

Q -co-03 I CO

oQ O

en coco o CD</> Q </>

enCO

Q

t— O O V O O C O O C M V O C O G O

- W 03 Olco r-«• Q

r^ oVO Q H CM Q OO VO fc, CN - <en rH en en ,-H enCO </> CO O CO I CO</> ^t= </> Q </> ^= </>

S tTS-l 4-1 tT > (8co co d) o s-i43 4-i 43 g 43

S cT0) • 0)> s-i 4-1 (T > idO CO CO 0) O S-lg 43 4-1 43 S 43

• 43•S1*-•a co(0 4-1

trCU

O M O4-1 4-1 CT S-l&i CO CD <-H

(!)( J J>

S-l OO 43 S

s tr0!

S-i 4-1 tT > idCO co CJ O S-l43 4-) 43 g 43

co on Qi-H Oo oO O VO [n OO • O fT| O

i—i <^ r~- o o

•a1 co < o HU O CJ CJ OCO 03 O3 CO COCO O3 CO CO CO

o o o o oo o o o o

O Qo oo oO o o03 o ^H .-I <CO VO -31

«oo

VO pLH O

r~ o ovo r- vo

W OCM VO FQ Q Ci Q O WO3 CO CO CO CO COCO CO 00 CO CO COo o o o o oo o o o o o

CM COa wr- H

o oo oo oo oen enCM r£ur> •&

CMQr- Wo vo oo pq oo fa o

Qvo<H 00O P3O Oo o

oCOoo

VO PH oO £H Or- o ovo r^ vo

c o c o c o c o c o c o c o c o e n e n c n c n c n c n c n c n c n c nC O C O 0 3 C 0 0 3 C O C O C O C O C O C O 0 3 C O C O C X ) 0 3 C O C Oo 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

408

Page 416: Atari ST Internals

Abacus Software Atari ST Internals

01-HO<ga

4J

ft4-13O

<uG

fflG

-HG-H

3•a

4-13 Mft 0

3 JHO W

SMQ)

61 4J<BrH KIH vi

0ll J_)

O 0) Ha w w

I4-1OT3

OCO

i-H

ECMc-~-xr-^

-i-H•,

OenW

04-1

O1G-H

J_)

4-1CO

4-13a4->30

4-1

0

o^fi-HS-l3•a£_j

0

S-lW

o^IBrH

4-1O 0)

0!4J

G-HS£_)0)-p

^VIOMIM

4J3Q,4J3o

•a3 Ma. o

fa 3 M OiJ O W S3

0)

s

Of-l

W

< CO

CO O CO

oQ O

enco

r-<

r- o^ p Q ^ P O Q O ^ o f a m K ^ Cen ^en « . « . e n r H c n c n r n c nC O C M C O r H O C O « > C O O C O I CO- y > ^ = ^ > = * ^ Q < / 5 - = B = < / > O ^ > = t t = « >

*3< O— ^ CO Q O

rfj en en rH en•f/> CO O CO I CO=H= -CO Q </> =8= <*>

oQ

O OCO Q

oQ

CO> S-l 4->O CO COS 43 4J

tr

Oe

T! .T) co (U(0 4J ~

tr tr &a> co •tr > « > ao n o ss 43 e o

>-i 4-1 tr > «01 CQ <U O J-143 4J 43 g 43

> HO CQg 43

4-1a4J 43

tr(Utr >tu og 43

O COe ffl

< CMO COo oo oopqw

o o u>O "5P Ot-l < I—

^P t£>\o

Hvooo

o or- vo

oQr-^pooooen

CMtft

«> CMo or- oVO p—

CMO Oo o

far-QIQ<-too oo oCQ

o oO ^ C5

. . _ „ .t- pq «> CM

CM «> < CJ M OCM CM CM CM CM COen en en en en enCO GO CO CO CO GOo o o o o oo o o o o o

^3» ^O O pt)CO CO CO COen en en enCO CO CO COo o o oo o o o

O CM VO CO

vo r- voco

oooopqCO

o -a1 fa co*r o fa co< r- o o

CMm in m

c n c n c n c n c n c n c n c n c n c nC O C O C O C Q C O C O G Q C O C O C Oo o o o o o o o oo o o o o o o

O0 0 0

< W O CM P VOm m u> u> vo u>en en en en en en

o o o o o oo o o o o o

oCOHcoooooen o oCO T Oo co coCO W -=P

CO K) Ovo «> t-cn en enoc? ^ ooo o oo o o

409

Page 417: Atari ST Internals

Abacus Software Atari ST Internals

ordaCO

(UC

CD

-H Ms-i oCO J-l

o4J IM

G. en4J <a3 HO &4

0>4-101-Hen

o4J010)

acte

r

M<8.coffl

3a

o

4J

Oa

a>4JC-H

C"

CMCOCM

3

4J3fi.

0

040

MCD

-3ft!t-l<gJ5o

T>

O3

O

•oG0)4J

ryOm4JCO

0)x:

4J3P.4J

0

04J

M0)

t(0Mra4io

•o03

o.p

•oqa)Xw

!>•

Xo<a4J01

fiO

Xu

A

•oft

ntr

onic

s port

0)o19

•H>

4J3a4->

C?

M0)4J

-HOa**tO<3J j

co

•g<u^f^40o

C"

g

Mo

CO

GO-H

|

IM

d>CDM

U-4IHOMM

a H

cn o ft.m a wVO ^ CM^T CM t-H</> r*i <^>

-. H

Q -y>

o oQ Q

o oQ Q

coco

co < o Q Wo p£] r- vo (JMVO CM CM t-H C3\M iH CO

t—QvoQ

<n =»=

"~\ *. B. ''O P* 'O M J>T3 O 13 «H Om e m o g

a -H >U S 1

Q — —

B rH to O G 4-1X) O 4-1 g 3 !-!

CO CM <ea w wVO W CM

o o oo o o0 0 0o o o

03 KGo

coCOavo

O O CJ t-HO O Q OO O CO O

pqVO CMCM

OOO

_ _ _ O O Pt4 Oc n c n c n o c n c n o c j o o c ^ E ^ E ^ i nC Q c o r ^ - s r r o f ^ o c p v o ^ c n Q i n r * -r - I O t - I C M O O C M H i - I C M r t l C J f a W

C M C O H ^ V O C J C M V O O M O C M V O C Oc ^ r ~ r * - c o c o c o c n c n c n c n r f j < s < S r f !cn cn cn cn cn cn cn cn cn cn cn cn cn cnC 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 Oo 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

****

***

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

*****

****************-J(

*

*

*

*

*

*VO<,

c-H

O[V,

p4[V,

VOinM

pirt*cnCO0o

W

mCM

Q

4JCO4J

(jqfe,

CM0Oo0cnto(•a1

££)<J

cnCOo0

COoenCO</>

trCD

CMCMr-voi

menCO0o

oQ

vo<cn

,Q

ioe

cn0o0fjqCM0f— 1

vomcnCOo0

oQ

3

X0)

0COCO•a1

f^fflenCO0o

t—•^

»,oQ

3

ioe

0COWco5_jCQcnCOo0

0Q

s<•»-*

cn

q•

<3J

0E

cno00pqCM0f-f

pqCQcnCO0o

oQ

3

X<tt

OCOco^1

CMCJcnCOo0

s1N

oQ

3

i0s

oo1*4cnTCJcnCOoo

CJCMftCO</>

MCO

CJCMftCOo0o0cnmr

voOcnCOoo

ftCM

•H•

•§"•o<o

(V,

CO*3*inoCJcnCOoo

oO

3pCO^j

O1 1ft^gt

woenCOoo

voQcnCO^>

<BaXi

^povovo

oQcnCOoo

oai-ti31s

1-1

tf

0)

os

fT|

PuOr-

CMQcnCOoo

fthcnCOto

n>M^3

QICMOVO

IQ«

QcnCOoo

COt=HcnCO</>

f!)^4JQ

OCMOVO

voQcnCOo0

410

Page 418: Atari ST Internals

O089D8 102E0009

Q089DC 4880

O089DE 3E80

0089EO 102E0009

0089E4 4880

0089E6 3FOO

0089E8 4EB900008A46

0089EE 548F

0089FO 4A40

0089F2 6604

Q089F4 70FF

0089F6 6002

0089F8 4240

0089FA 4E5E

0089FC 4E75

move . b

ext. wmove . w

move . b

ext ,wmove . w

jsraddq .

1tst

.wbnemoveq . 1

braclr

.wunlk

rts

9(A6),DO

DODO, (A7)

9(A6),DO

DODO,-(A7)

$8A46

#2,A7

DO$89F8

#-l,DO

$89FA

DOA6

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

0089FE 4E56FFFC

008A02 6018

008A04 206E0008

008A08 1010

008AOA

4880

008AOC 3E80

008AOE 619A

008A10 52AE0008

008A14 4A40

008A16 6704

008A18 70FF

008A1A 600C

008A1C 206E0008

008A20 OC1000FF

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

linkbramove.1

move.b

ext .w

move.w

bsraddq.l

t st.

wbeqmoveq.1

bramove.1

cmp.b

A6,#-4

$8A1C

8(A6),AO

(AO),DO

DODO,(A7)

$89AA

#1,8 (AS)

DO$8A1C

#-l,DO

$8A28

8(A6),AO

#$FF,(AO)

Character to output

Extend to word

And on stack

Character to output

Extend to word

And back

on stack

(?)

Output via RS-232

Correct stack pointer

OK ?

Yes

Set error flag

Output string to printer

Get string address

String character

Extend to word

Output character

Pointer to next character

Error-free output ?

Yes

Error

Terminate output

Pointer to string

$FF as end indicator

IB«>n3»5?

Page 419: Atari ST Internals

008A24 66DE

008A26 4240

008A28 4E5E

008A2A 4E75

bne

S8A04

clr.w

DO

unlk

A6

rts

Next character

OK

asn

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

008A2C 302F0006

move.w

6(A7),DO

008A30 48E71F1E

movem.l D3-D7/A3-A6,-(A7)

008A34 3FOO

move.w

008A36 3FOO

rnove.w008A38 9BCD

sub.l

008A3A 6100E198

bsr

008A3E 584F

addq.w

008A40 4CDF78F8

008A44 4E75

DO,-(A7)

DO,-(A7)

A5,A5

$6BD4

#4,A7

movem.l (A7)+,D3-D7/A3-A6

rts

Centronics output

Character to output

Save registers

Character to output

Clear A5Output

character to Centronics port

Correct stack

pointerRestore registers

to******************************************************

008A46 302F0006

move.w 6(A7),DO

008A4A 48E71F1E

movem.l D3-D7/A3-A6,-(A7)

008A4E 3FOO

move.w

008A50 3FOO

move.w

008A52 9BCD

sub.l

008A54 6100E258

bsr

008A58 584F

addq.w

008A5A 4CDF78F8

movem.l

008A5E 4E75

rts

DO,-(A7)

DO,-(A7)

A5,A5

$6CAE

#4,A7

(A7)+,D3-D7/A3-A6

RS232 output

Character to

outputSave registersCharacter to output

Clear A5

Output character via RS-232

Correct stack pointer

Restore registers

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

008A60 207900002580

move.l $2580,AO

008A66 3028000A

move.w

10(AO),DO

008A6A B07C0013

cmp.w

#$13,DO

008A6E 6236

bhi

$8AA6

VDI ESCAPE functionsPointer to CONTRL arrayFunction numberGreater

than 19 ?

WJHis>sr

Page 420: Atari ST Internals

Abacus Software Atari ST Internals

curH

104-1

o

COCOCU

0)

-rH4-110

rH

0)!H

4-1CDO

dre

ss

|

•o10

<uCO10

•§<

(UG

-H4-1

O

(U4-1

oCDXH

add

ress

able

al

ph

a ch

arac

ter

cell

sha

m

ode

exCD rHS-) CO

-HP 4-1co cr -H

4-1 C XM I — 1 pi)

O rH CM

CD•oo

<0J2exra,

0)4-1

W

n

cex oP T3

O OCO CO

p p0 0

(0 <fl

ex exrH rH

<, <

SP m

4J

tr>-H

MOCO

pO

(0«-;ex<

vn

rso

r le

ftha

cu

rso

ren

d of

al

ph

a sc

reen

o en

d o

f al

ph

a te

xt

lin

eal

ph

a cu

rso

r ad

dre

sscu

rso

r ad

dre

ssab

le

alp

ha

tex

tv

ideo

on

vid

eo

off

curr

ent

alp

ha

cu

rso

r ad

dre

ssta

ble

t st

atu

sy ra

ph

ic

curs

or

at

locati

on

p ex o 4-1 cu cu CD CD ex 01O rH 4J 4-1 4-1 CO CO M r4 O

10 < D O P M r 4 - r H - H O d )fd 0 ) c o C D e X C D ( D P P t 3 O4 i ! c u c o c E j r 4 4 - i > > c r c r r - 4 < oe X E < 3 r 4 - i H P C I ) < D C C < O r H

r-H O r J W Q O K K r H H M f ^ft, !B W

- - • * O r H C M O < 3 ' i n V O r ~ 0 3

last

g

rap

hic

cu

rso

r

>oecu

a\H

OtH

HQ

WPJ

CMOrH

rHQ

W

(04-1(0T3

4-1CO

CDN

-HrH

10-H4-1-HG

-H

010)

- *—. *s *

K O C J C J O C J C J C J C J U C J C J O C J C J C J C J O O C J C J U *O < ^ O 3 C O C O a 3 C O C O C O C 0 0 3 C O C O C O C O C O C O C O C O C 0 0 3 C O ->:f-it 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 QW 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 •&0 0 < 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 * r H C O r H C T V

**3: *

• rH * S |S

C O - S S S S S S S S S S S s S S S : ? ? ? ? : ^ * * •> T S C X * e x t r e x c r c oO 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 Jg f O - n • O T 3 T i " O - a T ! - a i a - O T 3 - O T ! T S T 3 ' O T 3 ' a - O T 5 ' O * O X ) U 4 3 ! H

*********< *

CJ *03 *

ice o * in VD pi)O O * VO «3 *To o * o o c^o o * o o oC 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 am Q « T o o o o o o o o o o o o o o o o o o o o * p Q t ^ p q v o * ^

*

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

413

Page 421: Atari ST Internals

***************************************************008AB6 61000448

008ABA 207900002584

008ACO 3010

008AC2 COF90000257E

008AC8 33C00000255E

008ACE 6000041E

bsr

$8FOO

move.l

$2584,AO

move.w

(AO),DOmulu.w $257E,DO

move.w DO,$255E

bra

$8EEE

VDI ESC 101

Cursor off

Pointer to INTIN array

Get paramaters

Times number of bytes per screen line

B3rsencn

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

008AD2 322F0006

move.w 6(A7),D1

008AD6 024100FF

and.w

#$FF,D1

008ADA 600005D2

bra

$90AE

ascout

Get character from stack

Process only low byte

Output character

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

008ADE 322F0006

008AE2 024100FF

008AE6 2079000004A8

008AEC 4EDO

move.w 6(A7),D1

and.w

#$FF,D1

move.l $4A8,AO

jmp

(AO)

conout

Get character from

stack

Process only low byte

Get conout vector

And execute routine

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

008AEE B27C0020

cmp.w

#$20, Dl

008AF2 6C0005BA

bge

$90AE

008AF6 B23C001B

cmp.b

#$1B,D1

008AFA 660C

bne

$8B08

008AFC 23FC00008B4A000004A8 move.l #$8B4A,$4A8

008B06 4E75

rts

Standard conout

Control code ?

No, output character

ESC ?

No, process other CTRL codes

Conout vector to ESC processing

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

008B08 5F41

008BOA 6B22

008BOC B27C0006

008B10 6E1C

subq.w #7,D1

bmi

$8B2E

cmp.w

#6,D1

bgt

$8B2E

Process CTRL codes

Less than 7 ?

Ingore, RTS

Greater than 13 ?

Ignore, RTS

S3M5T

Page 422: Atari ST Internals

Abacus Software Atari ST Internals

w #1

,D1

Bri

ng

to

wor

d p

roce

ssin

g

•<a

rH

cn•31COWCMrH

CQCOo0

.w

$8B

20 (

PC

,Dl.

w)

,AO

Get

re

lati

ve

add

ress

fr

om ta

ble

0)

og

t3*oorHpq( —OCO

^prH

CQCOo0

1

I$8B

30,A

O

Ad

d b

ase

add

ress

to

it

rr*U•oid

oCOpqCOooooCJfarHQ

COt — |

CQCOo0

(AO)

A

nd

exec

ute

co

rres

po

nd

ing

ro

uti

ne

-[—>

oQW"

HrH

CQCO0o

****

****

****

****

****

* Ju

mp

tab

le

for

co

ntr

ol

codes

*•X*-X-X•X-X-X**•X*•X•X**

**-X•X***

wpq

0COCQCO

1oCO

CO

3

0T!

oooooCMCQCOo0

wCQ

CO

0

mCO

1oQoCO

IS

o•a

CJfS^rHoCMCM

COo0

CQEH

en

oCOCQCO

COpqCO

30•a

<=p000

•c1

CMCQCOoo

far3

0rH

0COCQCO

1Q

CO

*0•a

f£t3^310

\oCMCQCOoo

EH

rH

0COCQCO

1Q

CO

3

0•a

^J10

COCMCQCOoo

fafa

CM

0coCQCO

QfaCO

3o•a

rf^f£•V0

(^CMCQCOoo

U

COrH

oCOCQCO

1CJfaCO

3o•a

[V]

en*gi

oCJCMCQCO0o

**

**

**

**

**

**

**

**

**

**

*

*•X**•X***•X*•X*•X•X•X**•X*•X***•X•X•X•X*-X•X•X

4-1H

mr~f-*j^p

pqCMCQCO0o

**

**

**

**

**

**

**

**

**

**

*

BE

L

•X

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

01§4-1

4-1POH4-1

O

Q

S-lX!

COrHCMWooovooCOPQCOo0

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

T

AB

•X

***•X•X-)J

**•X*•X•X•X•X-X.£

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

prH00

n0caoCJ

oQ

ovoinCM

3

(U

0

0voinCMOO0OcncooCO

<3*COCQCOo0

w I$

FFF8

,DO

C

on

ver

t to

nu

mbe

r d

ivis

ab

le b

y 8

rri\J

G

COfafafao*xpCMO

*3»COCQCOo0

CO

•OtsIB

•a

oQ

CO=*

cr•oIB

o^poinwCOCQCOo0

0)G

-HrH

o01M

U

rH

Q

CM

CM

*!>O6

CM^OinCM0O0ocnCOCMcooCQCOoo

HOCQHPO

4-1(U0}(U

CJ

CMcn

X!

^rvor-0o00

vo^*

CQCOoo

****

****

****

****

****

* P

roce

ss

char

acte

r a

fte

r E

SC

-X

*****•X•X•X**•X•X**•X•X-X*X•X*•X•X*•X•X*•X*-X

.1

I$8A

EE

,$4A

8 co

no

ut

vec

tor

back

to

st

an

dra

d0)

0sCOa:o0ooowwCO0o00CJfaCOCM

££>

«

CQcooo

COp

-Hs

rH

Q

rH

=*>

3

pCO

„— )^rooOr-CMcnsrmCQCOoo

0)H0

er>-H

C0)

4-1

COCO(U

CMpqCO

gX!

31QPQIQ

CO

CQCOoo

s

Q

CJ

=«=

r\

O

OO0oCJc-CMpq

mCQCOoo

415

Page 423: Atari ST Internals

008B5E 6F50

ble

$8BBO

008B60 B27C0018

cmp.w

#$18, Dl

008B64 663C

tone

$8BA2008B66 23FC00008B72000004A8 move.l

#$8B72,$4A8

008B70 4E75

rts

To ESC table for capital letters

'Y1 for set cursor ?

No,test for lowercase letters

conout vector for ESC Y

srtanCA

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

008B72 927C0020

sub.w

#$20, Dl

008B76 33C1000004AC

move.w

D1,$4AC

008B7C 23FC00008B88000004A8 move.l #$8B88,$4A8

008B86 4E75

rts

Process line

after ESC Y

Subtract offset

And save line value

Process conout

vector to column

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

008B88 927C0020

sub.w

#$20,Dl

008B8C 3001

move.w

D1,DO

008B8E 3239000004AC

move.w

$4AC,D1

008B94 23FC00008AEE000004A8 move.l

#$8AEE,$4A8

008B9E 6000070C

bra

$92AC

Process column after

ESC YSubtract

offsetColumn

valueAnd

lineconout

vector back to

standardAnd

set cursor

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

008BA2 927C0021

008BA6 6B86

008BA8 B27C0015

008BAC 6F10

008BAE 4E75

sub.w

#$21,Dl

bmi

$8B2Ecmp.w

#$15,Dlble

$8BBE

rts

*****************************************************008BBO E349

008BB2 307B1058

008BB6 D1FC00008B2E

008BBC 4EDO

Isl.w

#1,D1

move.w $8COC(PC,Dl.w),AO

add.l

#$8B2E,AOjmp

(AO)

Test for

ESC lowercase

Subtract offset

Ignore lowercase

'b1

iwi

Less than

or equal, process

sequence

ESC uppercase

Code times 2 for word

accesGet

relative address from table

Add base

addressAnd

execute routine

IiI&3?

Page 424: Atari ST Internals

Abacus Software Atari ST Internals

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

ES

C lo

we

rca

se

*•X***•X•x

*•X

***-X•X-X

***•X•X-x

****•X

-X

*•X

*

01010)oo

•o4o3=

too

CM

0101

-H

0)T50O

rHQ

rH

*

S

01i-H

cnSJ1f*>H

MCQmCOoo

6 (P

C,D

1 .

w)

,AO

G

et

rela

tive

a

dd

ress

fro

m ta

ble

CM0CO</>

S

tuoE

•a1'•O0rH

fflf^

OooCJmCO0o

2E

,AO

A

dd b

ase

ad

dre

ss

fflCO*/}•=4fc

rH

•o

wCM

COOO00OfarHQ

jiCJPQCOoo

An

d e

xe

cu

te ro

utine

^^o*^-

oS

-i—i

0Qatp

CJfflCO0o

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

ES

C b

se

t ch

ara

cte

r co

lor

*-X*-X•X-X

*•X

*-X

******•X-X•x-X

**-X

**-X****•X

*

*-X

*•x*-X

D8

,$4

A8

Se

t conout

ve

cto

r

«CO«>=&=

rH•

01

oE

COf^C« ioooooCOQCQCOoo0oofaCM

CJCJfflCO0o

054-1to

IOp-.

w

\&

afflCOo0

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

***-x

*•X•X•X

*.jt

**X•X

**•X-X•X•X

*•X-X•X

**-X

*•X

*-JC

•X•X-X•X•X

**•X•X

EE

,$4

A8

Se

t sta

ndra

d

conout

ve

cto

r

COvt=tt=

rH•

0)

og

CO<£^1oooo0w»s£COooooCJfaCOCM

COQffl00o0

4-10)01tH

0

4-1O

to

|

to

rHQ

OCM</5-=ti=

|5•

•§01

oCMOOOp~-

CM

CMWm00oo

oQ

f— 1

o

S

§oe

rHOOnIQwfflCOoo

or-H

oU

CD4-1O

IB

O

4J<a

cjHCO-u>

(TJ

JQ

CM&lCMOO0O10

CO

fflCO0o

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

ES

C c

set

backgro

und co

lor

**•X*-X•X•X

**

*•X-X•X•X

*•X

*•X-X

***-X

*•X•X•X

*-X

*•X

*-X*•X

****

F8

,$4

A8

Se

t conout

ve

cto

r

CQCO{/}•

=**=

rH•

CDt> WO 4-1

CO<J•a1O00o0COfaffl00oo0oCJ 10p4 [CO WCM Vf

CJ VO{•-•) f^J

m fflco co0 00 O

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

***•X•X-X

***•X

***•X

*•X•X

*•X

**-X

*•X•X

**•X**-X•X•X

*•X-X

***

EE

,$4

A8

Sta

ndard

conout

ve

cto

r

,3jCO</5-=4t=

rH•

O

oE

CO

r^ji

00ooo

H

COoo0oCJfanCM

CO

fflCOo0

, D

l S

ubtr

act

off

se

t

oCM</>=H=

|5•

301

oCM00ot—CM

CMooCO00

oQ

rHQ

U•

>K*

Oe

rHOo

10oOCOoo

toorHOo•acPoto

O

£>

4-1CO

COCOPE]CO</>

(Tj

JQ

H

CMOOOOvo

COoCJCOo0

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

Ad

dre

ss ta

ble

fo

r E

SC

upper

ca

si

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

*X•X

•X

****t

**•X-X.£-X-X

*•X•X

***•X

**-X-X•X

**•X**

CJCOH

HCMfflCO

1

CMCQCOV}

IS

o•a

vo^orHO

CJoUCOoo

fflCJww

HCMmCO

CMCQCO</>

IS

o•a

i"3!r-rHO

tyj

oCJCOoo

U

otow

wCMfflCO

1CMCQO34/>

IS

o•a

•vTQ^

^0

orHCJCOo0

Q

O

wCMfflCO

wCMfflCO</>

So•o

pqffrHO

CMrHCJCOo0

wow

CMfflCO

1MCMCQCO</>

S

U•a

CMVOrH0

•3*rHCJCOoo

417

Page 425: Atari ST Internals

Abacus Software Atari ST Internals

0)COniOS-l0)

or-1

OCO

S-lo

<d4J

CO

01

to to 014-1 4-> 4->

« en4J -P

03 CQ W CQ4J 4-J 4-1 4->

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

C M C M C M C M C M C M C M C Mf ^ r n r n r o r n f ^ r n mC 0 0 3 C O O O O 3 0 3 O 3 C Ov t v t v t v t v t v t v t v tI I I I I I I I

M H W W W W W WC M C M C M C M C M C M C M C Mc Q p q n p q p q c q p q p qvtvtvtvtvtvtvtvt

3 3 3 3 3 3 3 3O O O O O O O O

O O O O O & j C M C OO O t H n t - l t H C O C Oo o o o o o o oV O C O f i C O W O C M ' O 'r H t H r H i H i - J C M C S J C MU U U U O U O C Jc o c o c o c o c o c o c o c oo o o o o o o oo o o o o o o o

******

•it*•it•it*•it*-it*****•it•it*•it*•it*•it-it•it**•it**•it•it•it•n•K

*

****•it*

*•it*

*

paCMpqCOvt1paCM

03•in-

3O•o

was00

\CMCJO300

paCMpqCOvt1paCM

COvt

3O•a

wpq00

COCMCJ03O0

wCMpqCOvt\a

CMpqCOvt

3O•a

10voco0

f%CMCJ0300

p£jCMpq03vt1paCMpqCOvt

3O

CMCOCOO

oCMCJCOO0

wCMpqCOvt1paCMpqCOvt

3U•a

CMaCOopaCMCJCOo0

paCMpqCOvt1paCM

COvt

3O•a

0ooooCOOCOo0

paCM

COvt1paCMpqCOvt

3O•a

0oooCMCOO03OO

paCMcqCOvtIpaCMpqCOvt

3O•a

oooo«3*COoCOoo

paCMmCOvtIpaCMpqCOvt

3o•o

CMk,COotoCOoCOoo

paCMpaCOvtIpaCMpqCOvt

3O•a

paosrO

COCOo03oo

paCMmCOVtIpaCMpqCOVt

3O•a

COCMPO

f£COOCOoo

paCMpqCOvt1paCMpq03Vt

3O•a

oooooCOOCOoo

paCMpqCOvt1paCMpqCOvt

3O•a

oooopaCOOcooo

paCMpq03VttpaCMpqCOvt

3O•o

voQ1

STO

0poCO0o

paCMpqCOVtlpaCMpqCOvt

3O•a

<a\MoCM«=?0CO0o

paCMpqCOVtlpaCMpqCOvt

3O•a

*r££CMO

iiCJCO0o

paCMpqCOvt1paCMpqCO•in-

3O•a

ooooV£iCJCO0o

paCMpqCOVtlpaCMpqCOvt

3o•a

ooooCO"WoCO0o

paCMpqCOVtlpaCMpqCOvt

3O•a

oooo<J"C1O0300

paCMpqCOVtlpaCMpqCOvt

3O•a

o0o0

0

CJCO00

paCMpqCOvttpaCMpqCOvt

3O•a

oCOr0

paoco00

paCMpqCOVtlpaCMpqCOvt

3OTJ

«>en*?0

omOCOo0

418

Page 426: Atari ST Internals

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

008C52 207900002580

008C58 317C00020008

008C5E 20790000258C

008C64 303900002550

008C6A 5240

008C6C 31400002

008C70 303900002552

008C76 5240

v

008C78 3080

008C7A 4E75

move . 1

move . w

move . 1

move . w

addq . w

move . w

move . w

addq . w

move . w

rts

$2580, AO

#2,8(AO)$258C,AO

$2550,00

#1,DO

DO,2(AO)

$2552,00

#1,DO

DO, (AO)

VDI ESC

1, get screen

sizePointer

to CONTRL

array2 result

valuesPointer

to INTOUT array

Maximum cursor

column (79)

Plus 1 equals

number of

columnsAs

second result

Maximum cursor

line (24)Plus

1 equals number

of lines

As first

result

VO

***************************************************008C7C

3F3C0014

move.w #$14,-{A7)

008C80 4E4E

trap

#14

008C82 548F

addq.l #2,A7

008C84 4E75

rts

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

008C86 6108

008C88 60000226

bsrbra

$8C90$8EBO

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

008C8C 61000272

bsr$8FOO

VDI ESC

17Hardcopy

Put stack

back in order

VDI ESC

3, Enter

alpha mode

ESC E, Clear Home

ESC e,

Cursor on

VDI ESC

2, Exit alpha

modeESC

f, Cursor off

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

008C90 615E

008C92 6064

bsrbra

$8CFO$8CF8

ESC E,

Clear Home

ESC H, Cursor Home

ESC J, Clear

rest

of screen

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

008C94 323900002562

008C9A 67DE

move.wbeq

$2562,01$8C7A

ESC A,

Cursor up,

VDI ESC

4Cursor

lineZero,

then done

alreadyCD5f

Page 427: Atari ST Internals

008C9C 5341

008C9E 303900002560

008CA4 60000606

subq.w #1,D1

move.w $2560,00

bra

$92AC

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

008CA8 323900002562

008CAE B27900002552

008CB4 67C4

008CB6 5241

008CB8 303900002560

008CBE 600005EC

move.wcmp.wbeqaddq.wmove.wbra

$2

56

2,0

1$

25

52

,01

$8C7A

#1,0

1$

25

60

,00

$92AC

Subtract one

Get cursor

columnAnd

set cursor

ESC B,

Cursor down,

VDI ESC

5Cursor

line

Compare to maximum

cursor line

Already in lowest

line,

done

Increment by

oneCursor

column

Set cursor

B9nwCOe.

***************************************************008CC2 303900002560

move.w $2560,00

008CC8 B07900002550

cmp.w

$2550,00

008CCE 67AA

beq

$8C7A

008CDO 5240

addq.w

#1,00

008CD2 323900002562

move.w

$2562,01

008CD8 60000502

bra

$92AC

ESC C,

Cursor right,

VDI

ESC

6Cursor

column

Compare with

maximum

value (79)

Increment by one

Get cursor

line

And set

cursor

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

008CDC 303900002560

move.w $2560,00

008CE2 6796

008CE4 5340

008CE6 323900002562

008CEC 600005BE

beq

$8C7A

subq.w #1,00

move.w $2562,01

bra

$92AC

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

008CFO 7000

008CF2 3200

008CF4 600005B6

moveq.l #0,00

move.w 00,01

bra

$92AC

ESC 0, DEL, Cursor left, VDI ESC 7

Cursor column

Already zero

?Decrement

by one

Cursor line

Set cursor

ESC H,

Cursor Home,

VDI

ESC 8

ColumnAnd

line

to zero

Set

curso

r

IenHI-M

!COST

Page 428: Atari ST Internals

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

008CF8 612A

008CFA 323900002562

008DOO B27900002552

008D06 6700FF72

008DOA 5241

008DOC 4841

008DOE 323COOOO

008D12 343900002552

008D18 4842

008D1A 343900002550

008D20 60000436

bsrmove

. w

cmp.wbeqaddq

. w

swapmove

. w

move . w

swapmove

. w

bra

$8024

$2562,01

$2552,01

$8C7A

#1,01

01#0,01

$2552,02

02$2550,02$9158

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

008D24 08B9000300002576

008D2C 40E7

008D2E 610001DO

008D32 610001EC

008D36 323900002560

008D3C 08010000

008D40 6716

008D42 B27900002550

008D48 673A

008D4A 323C0020

008D4E 6100035E

008D52 323900002560

008D58 4841

008D5A 323900002562

008D60 3401

008D62 4841

008D64 4842

008D66 343900002550

bclrmove

. w

bsrbsrmove

. w

btstbeqcmp.wbeqmove

. w

bsrmove

. w

swapmove

. w

move . w

swapswapmove

. w

#3, $2576

SR, -(A7)

$8FOO

$8F20$2560,01#0,01$8058

$2550,01$8084#$20,01

$90AE

$2560,01

01$2562,01

01,02

0102$2550,02

ESC J,

Clear rest

of screen,

VDI 9

ESC K, Clear

rest

of line

Cursor line

Compare with

maximum cursor

line

cnp

Maximum cursor

line

Maximum cursor

column

(79)

ESC K, Clear

rest

of line,

VDI ESC

10

Clear flag

for

line overflow

Save old

value

ESC f, Cursor

off

ESC j, Save

cursor

position

Cursor column

Compare with

maximum

value (79)

In last

column,

then

output

space

SpaceOutputCursor

column

Cursor line

Maximum cursor

column

te2.

Page 429: Atari ST Internals

Abacus Software Atari ST Internals

$915

8,w

(A

7)+

,CC

R

Rest

ore

fl

ag

rl >to O43 g

woO fa0 QrH ^Pvo "=r

CJ 0vo r~Q QCO COo oo o

$8D

7C

Not

se

t ?

#3

, $2

576

Res

etb

eq00

3000

0257

6 b

set

oco en0 fa[— COvo oCM -ST

r- C—Q QCO COo o0 0

$8F3

C

ES

C

k,

Rest

ore

cu

rso

r p

osi

tio

n$8

EE

E

Re-

enab

le cu

rso

r

CO M43 43

W CJm vorH rHO O0 00 0rH 0VO VO

CJ 0r- coQ QCO CO0 00 O

4-1a> 3o fx<0 4-1<X 3CO O

rHQ- W O

o < r-CM 0 Q•CO- Ch CO=ft= -w> </>

& M (uO CO M

O ^CM CMo oo oCJ O CMn o HCM rH On vo vo

•5P CO CJCO CO COQ Q QCO CO COo o o0 0 O

****

****

****

****

***

VD

I E

SC

11

, S

et

cu

rso

r*

**

**

**

**

**

**

**

**

**

* j

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

!HM

MEH

M

O4-1

0!

CD -H4-1 rH

-H 4-1O fl)P< CS

O

- O

CO -^IO 0CM <!<o —

0002

584

mov

e,m

ove,

oen oE— rHO CMCM CO

W ^Pco enQ QCO COo oo o

4-10)to c

1H B>H 3O rH

001 U

C 4-1-rl W& CS

oQ

Q 0

* CM

s sO1 <B

3 0CO g

CM0oo

rH COT CMco o10 coVO COen enQ QCO CO0 0o o

,w

#1,D

O

Min

us

off

set

$92A

C

Set

cu

rso

r

43 <S

to 43

u0IOo

o o^P On oIO VO

o wen enQ QCO COo oo o

****

****

****

****

***

VD

I E

SC

12

, T

ext

ou

tou

t**

****

****

****

****

**v

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

,1

$2

58

0, A

O P

oin

ter

to

CON

TRL

arr

ay

,w

6(A

O),

DO

N

umbe

r of

ch

ara

cte

rs00

0258

0 m

ove,

006

mov

e,

0 0en cor- CMo oCM CO

CM CO*3. ^Q QCO COO 00 0

,1

$2

58

4, A

O P

oin

ter

to

INT

IN

arr

ay

$8D

C2

0002

584

mov

e,b

ra

0en Hr- oo oCM VO

CJ CM< cqD QCO CO0 O0 O

,w

(AO

)+,D

1 G

et p

oin

ter

to

Dl

n.l

D

O/A

O,-

(A7)

R

esto

re re

gis

ters

$8A

E2

Ou

tpu

t ch

ara

cte

r in

D

ln

.l

(A7)

+,D

O/A

O

Reg

iste

rs b

ack

DO

,$8D

B4

Ou

tpu

t n

ext

ch

ara

cte

r

£4 £H

Q) Q) d} CO> > M > H COO O CO O 43 4-1g g 43 g 3 M

0 VO rH OCO CM O fa0 Q rH faCO p"| O p&i

co r- o p4 co torH W 0 Q CJ r-CM CO tH O rH W00 " \O ^p tO ^

<3* V£) rij W CVI ^Ocq cq pq pq CJ cjQ Q Q Q Q QCO CO CQ CO CO COo o o o o oo o o o o o

422

Page 430: Atari ST Internals

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

008DC8 08F9000400002576

bset

f4,$2576

008DDO 4E75

rts

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

008DD2 0889000400002576

bclr

#4,$2576

008DDA 4E75

rts

ESC p, reverse on, VDI ESC 13

Set flag for reverse

ESC q, reverse off, VDI ESC 14

Clear flag for reverse

8

00

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

008DDC 207900002580

008DE2 317C00020008

008DE8 20790000258C

008DEE 303900002562

008DF4 5240

008DF6 3080

008DF8 303900002560

008DFE 5240

008EOO 31400002

008E04 4E75

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

move.l $2580,AO

move.w #2,8(AO)

move.l $258C,AO

move.w $2562,00

addq.w #1,DO

move.w DO,(AO)

move.w $2560,00

addq.w

#1,DO

move.w DO,2(AO)

rts

VDI ESC 15, Get cursor position

Pointer to CONTRL array

2 result values

Pointer to INTOUT array

Cursor line

Plus offset

As first result

Cursor column

Plus offset

As second result

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

008E06 207900002580

move.l $2580, AO

008EOC 317C00010008

move.w

#1,8(AO)

008E12 20790000258C

move.l $258C,AO

008E18 30BC0001

move.w #1, (AO)

008E1C 4E75

rts

VDI ESC 16, Inquire tablet status

Pointer to CONTRL array

A result value

Pointer to INTOUT array

Tablet available

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

008E1E 207900002584

move.l $2584, AO

008E24 30BCOOOO

move.w #0, (AO)

008E28 4EF90000FF50

jmp

$FF50

Pointer to INTIN array

No result values

Set graphic cursor

c/>HS1

*+•fBB65B1

Page 431: Atari ST Internals

Abacus Software Atari ST Internals

, C

lear

gra

phic

cu

rso

r

CftrH

CJCOW

MQ

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

*•X•X

-X

*-X•X

*-X•X

*•X

**•X**-XHe

***•X•X•X

*•X

*He-X-X

**•X*•X•X

**

CO

fafa

fte

CO[ —fafaoo0oenfaWJ1

HCMWCO0o

sor

up, scro

ll if

needed

jq

3O.,

H

CJCOw

•X

**•X•X-X

*-X

*

**-je•X•X•X

*•X*•X•X•X

**•X

*•X

****•X

*He•X•X

*•X•X

**•X•X•X•X

**-X•X•X

(UG

-rHrH

o01rH3CJ

rHQ

CMVOinCM

j5•

cu>og

CMVOinCMOO00enCOCMCO

•a*COWCO00

p.

rH

O01rH3O

GCU

0

cuG-HrH

G-H

4JO

CJo\JCO</>

cuG

43

ovoWfa00vovofQCO

CD00

r colu

mn

otoJ_43O

CU

caCO

,c^££

«— -|

^OvomCM

|5•

CU>og

ovomCMOO0oencofaCO

pel)

[V]

CO00

CU

-rH.

rH

JLirHCUGOGM

».,_p

OCOw

w•5TwCOto-

rn0143

CO0rHVO

^T

HCO00

rso

r colu

mn

3ocu0

010)

oQ

i

r-fQ•—

|5•

CU>0g

farH0CO

vo

HCO00

0rHcuN

O

ca-HrH

rHO01rH

3CJ

rHQ

O=s=rH

trcuJ>og

00CMt—CO

wCO00

rHo01M3O

4JCU

CO

O

CM</>

<8

43

Ovoroooovof^

EdCOoo

0>G-HrH

rHCU

Ct-H

».,_}

Oto

*He

*•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•X•X

***•X

fHino

HO01rH3O

».im

CJCOw

oofaCO<ft

rH0)43

0COoooorHVO

ptl

WCOoo

cu-HrH

rH

0COrH

3O

rHQ

CMVOinCM

J5•

cu>0g

CMvoinCM00OOa\o

CMCO

CMmHco0o

inder

of

scre

en

dow

n

<dgcurH

.pt[ j

-H45CO

COCJ

en</>

rH0143

WvomooorHVO

COinaCO0o

colu

mn

0

G-H

rHO01rH

3

CJ

OQ

S

rHrHO

or

CM

OinaCO0o

cuG-HrH

rHo01

3O

rHQ

CMVOmCMvt

[5•

cu>0g

CMVOinCM00ooenCOCMCO

&3inWCO0o

rHo01rH3O

4JCU

CO

CJ

CMcn</>

rH01

43

vosr•a1ooorHVO

•a»vo[V]CO0o

cu

rso

r

curH

43

G

icu

wM

CO<0

<0rH

43

rCOooooovo

COvoMCO0o

CUG-HrH

rHm0)rHCJ

^soCO

•X•X•X

*-X

*•X•X

**•X-X•X

*•X-X•X•X

**•X-X•X•XHe•X

*•X•X

****•X•X•X•X-X•X•X•X•X•X•X•X

***•XHe•X

HH

O

HOmrH

3CJ

^MH

OCOH

00faCO</>

rHCO43

CMcnoooorHVO

0voa030o

0)C-HrH

rHO01rH3O

,_)

Q^

CMVOmCMo>

S

CU>o£

CMvoinCM0oo0a\O

CMCO

O

WCOoo

inder

of

scre

en u

p

cagcurH

4_>IM-rH.r;

CO

0COcoen</>

M0143

COoin00orHVO

VO

pqCOoo

cuJ>043cacu(U

omwCO-co-

carH

43

0

ovo<s£

WCOoo

MOrHOO

rHCU

OcarHm,GO

4_)(U

CO

•X•X

*•X•XHe•X•XHe•X•X•X•X

*•X•X•X•XHe

*•X•X

*•X

*He•X•X•X•X•XHeHeHeHe•X•X

*•X

*•X

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

in

•o

KvorH

•a0g

oQ

*.

PH4

•o>=«*=

s••a

Gca

fao00CJr—0oo(V|

COo0

rHOrHOU

rHCU4->ocarHcafZocu£>ca

CO

COinmS

IKoQ

•CU> 010 4Jg M

COmmCMoo00o mcj r-co wCO "a1

O VOCO COM Wco coo o0 0

424

Page 432: Atari ST Internals

***************************************************008E88

C07COOOF

008E8C 33C000002556

008E92 4E75

and.w

move.w

rts

#$F,DODO,$2556

Set background color

mod 16,

0..15Save

background color

tanSC/5O

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

008E94 610000DE

008E98 343900002562

008E9E 67F2

008EAO 5342

008EA2 4842

008EA4 343900002550

008EAA 7200

008EAC 600002AA

bsrmove.w

beqsubq,wswapmove.w

$8F74

$2

56

2,0

2$8E92#1,D2D2$2550,02

moveq.l #0,01

ESC d, Clear

screen

to cursor

ESC o, Clear

line

to cursor

Cursor line

Already zero,

done

Maximum cursor column

ta

bra$9158

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

K008EBO

4A7900002422

008EB6 67DA

008EB8 427900002422

008EBE 41F900002576

008EC4 08100000

008EC8 6618

008ECA 08000002

008ECE 303900002560

008ED4 323900002562

008EDA 6100031C

008EDE 6000043E

008EE2 61EA

008EE4 08000001

008EE8 08000002

008EEC 4E75

tst.w

beqclr

.wleabtstbnebsetmove . w

move . w

bsrbra

bsrbsetbsetrts

$2422$8E92$2422$2576,

AO#0, (AO)

$8EE2#2,

(AO)$2560,00$2562,01$91F8$931E

$8ECE#1,

(AO)#2,

(AO)

ESC e, Cursor on

Cursor already

on ?

Yes, done

Flag for

cursor on

Cursor column

Cursor line

Calculate cursor position

Invert character

at cursor

position

Invert character

at cursor

position

re3BB

Page 433: Atari ST Internals

Abacus Software Atari ST Internals

CMCM

* CM CM CM W* CM O1 </> CQ* <s- H K M•it CM CO rH CO

*** S* is* • tr* 4J CT 43 tj1 to-K to 03 3 Q) 4J* 4J 43 M 43 >H-K•it

*

•it

***•X CM CM* CM CM

* CM CM* O O* O O* O O* O O* CM o 01 o m* i~- 01 r~ cj r~-it < t^ co r~ P£]-it 'a' vo in vo <gi

* H ^ vo o W•it H P&H pt4 Pn En-it W H W W PL|* CO CO CO CO 00* o o o o o* o o o o o

to4-1H

c>-

•arH(510c0) 01

4-1

Oto t>H toP (UCJ >H

Q)>O43<0

0)0)

CO

HHm0

n0COM3CJ

«.tH

OCOw

MHmoi

oCO^t30

^1O

^M

CJ1<drH

En

MOto^f3CJ

>-loIH

O>(0rH

>H

r^<aCD, — |

o

mo;>,•a(Q

(VH, — |<oCO(0£

oto$ l3O

CM VO

•81

o o oi=C CM rfl W <C W— o\ cj — cj

in *• p£i •. M ». MCM CM CO O CO rH CO-tO- =tfc «• * </> * «•

l O r H t r O l C T r H C U l OCJ 0) 4-> O CJ

fQ .O 43

CM VOCM r-•sr inCM CM

CMo oo o o0 o oo o o01 Ol

oooo

o o o voCTi CO rH CQ

oooo oOl

C M r H O O C - C O I — O 3 V O Hi n T O V O O V O O V Q Q '

O V O C J O C M V O C O C J WO O O r H r H r H r H r H r HE n P n E n E n E n E n E n E n E nC O C O C O C O O O C O C O C 3 O 3o o o o o o o o oo o o o o o o o o

cu

rso

r positio

n

0)>a

CO

K-n

OCOw

***•it•it

***•it

******•it

*******•it

*•H

*•it•it•it•it

**•it•it

*******•X

******-K

**

rso

r sa

ved

3O

MOm

e>orHEn

VOt—inCM«•

Km*

j_)

0)to

43

vop^inCMoo00inoo0ONEnCOo

0CMEn0000

the

te

mp,

sto

rag

e

MHoCOCO0)H•c•o<

O<pjCM•a1CM</>

<00>rH

PtJCM^PCM0O00o>EnrH•5P

COCMEn03o0

3rHOO

rl0toJ_(3O

-j-^_^Of£«

KOvoinCM

V*

£•

0)>oE

ovomCM0o00a\n0rofjQCMEnCOo0

0)G-HrH

H001

^t3O

^^Off•»•-

KCMVOmCM•to

U•

0)>Og

CMVOinCMoo00enCQOn

srCOEnCOoo

CO4J

mt—[V]

•*p

rtjcoPnCOoo

or

to

save

d p

ositio

n

COr(3O

K

XoCOPJ

*•it

*•K

*******•it

*•it

***•it

*******•it

**•it

*•it

***•it•H

***•it•it•it•it

*-it

*•it•jt•H

***

positio

n

save

d ?

Uotan3O

to<as

vor-mCM«•

^m

*

HrH043

vor^inCMoo00mo0001cqCO0

OnEnCOoo

o

oPnOCOt/>

er0)4}

rfj

• CQPnoor-vo

•31i

EnCOoo

the

te

mp,

str

oa

ge

IHO

toCOHIiH•a•a<;

o«:paCM<=TCM«•

ra0)rH

wCMi

CMOO0oenPnrHngi

COqt

CnCOoo

q

3rHOO

HOto!H3CJ

OQ

H-^_^Of^*•— -

(1)>OS

COrHOCO

wq!

EnCO00

0)fi-HrH

^4O«^13O

rHO

^^Of$*

*—

EtmJ>OS

orHCMro

oIOEnCO00

Moto^13U

4J(U

oCMtn</>

<o!H43

comcoo0oovo

CMinEnCO00

426

Page 434: Atari ST Internals

Abacus Software Atari ST Internals

CDG

-HrH

0)4-1CDrH

(U•oK

rH

oCOw

•X

*-X•X•X•X•X

**.£•X

*-X

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

****•£•X•X-X•X•X-X•X•X•XJfi

*****•X-X

*•X

*•X-X-X•X

turn

cu

rso

r o

ff

K

iw£_JCOW

o0CMCO

^1CO

43

COp%rHVD

vomPMCOo0

<uG-HrH

J^oCOVlpCJ

rH

Q

CM CMVO Qin •••CM rH<0 Q

IS IS• •

CD CD> >o og S

CMvoinCM00ooen rHCO OCM "=PCO CO

CO 65m m[V, fV,CO CO0 0o o

m

cu

rso

r colu

mn

p

-H

cds

CMQ

omin

rH rH CM CMQ Q Q -u>

|5IS •ft • ft CD

(0 Vl cfl r"S rH g 0CO O 0) £

oininCMoooo

rH rH CM en«q* qi ^31 coO3 CM CO ^1

•=r "=r "31 COO CM " VOvo vo vo vofVj f-, [V, [V,

CO CO CO COo o o oo o o o

COinen<o

VIM

ffC£J

rH

ooorHvo

CJvofv,COo0

in

colu

mn

ze

ro

Vl0COVIpo

om65CO•co-

caM

pa]

wfrVj

ooovo

oJ —PuCOoo

Cle

ar

line

to

curs

or

^0

ov>65

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

*•X•X

****•X-}s

*•X

Turn

cu

rso

r o

ffS

ave

cu

rso

r positio

n

colu

mn

- - VlIH "<~i o

mO U VICO CO PIS 65 CJ

CMQ

O O OO CM VOf-, pn irjCO CO CMto to -co

|5•

0!

CO CO O43 43 g

ovoinCM00oo

r^ 03 en03 rS, cof — 1 f — 1 ^VO VO CO

•=3" VO COt — r^ r~p., fT] fT|

CO CO COo o o0 0 0

0)

oT3

G<D

k.o(UISI

0CDfc,CO<o

crcu

ocof^vofV)

r^fcCOo0

CMQ

O=3^

^jCO^_)Q

0oooCMO03O

O03[y(

03O0

VOen[V,

CO<o

0)G

OrHVOVO

t3*COPN03Oo

(UomaCO

rH

Q

0CM

=!(=

sCD

Oe

0CMOooCMCO

vo03p403Oo

4-)Pa,-PPo

s0en<o

ViCO

43

CMCMrHOOOf — 1

vofQCOpMCOo0

colu

mn

ioCOVlpCJ

CMQ^

0voinCM

S

CD£»0s

ovoinCMo00oencosj>CO

[V]

COPuCO0o

CD

-HrH

VI0COVipO

CMQ^

CM CM rHQ VO Q^ in -

CM CM CM CM CM=4t= Q -CO Q Q

S 15 15• • •

O"1 A 0) Q) fX43 cd J> £» <dP IS 0 O S01 co g S co

CMVOinCMoo00

CM CM en CM CMr "31 co o ^p

in co T CM coin "31 co co "•qi VO 03 W Oen cs> en en rtlFTi fTr fTt F"! FT<03 CO CO CO 030 0 0 0 0o o o o o

COinrH

rH rH enQ Q <«•

Scd Vi ViS rH M

co 0 43

orarH

OrH rH OST ^ OCO CM rHqi 131 VO

CM -5T VO

PM P>4 PMCO CO COo o o0 0 O

Re

sto

re

cu

rso

r positio

n

KX

CJCOH

O

f*,COCO

ViCO

43

oenrHvoff2]PM03O0

rn

cu

rso

r back on

P4-1

•oG<

H

PL]

CO<o

njVi

43

0

f-,p4Ooovo5JfQ

p4COo0

(Uo<0c^

rH

Q

CM</>=4*=

sCD>Os

oCMooCJcoCMcooCQt,cooo

427

Page 435: Atari ST Internals

Abacus Software Atari ST Internals

4-1P£.4-1PO

W

oCD

COQ

03EnOooorHID

srCQEnCOoo

f3^g£rT

CO</>•

cd^_,43

0En0vo

COpq

COoo

0)G-HrH

<4H

O

•o<U

4->ra

<Uc

-rH

rH

0)

3

>

CJwH

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

**•X

*•X*

D1tdrH>H

4-10)co

vor—mCM•CO

K

ro4fs

4J0)COA

\£>

( —LO

CMoooorr)

oooCDExCOo

<caEncoo0

CO4-1

IT)r^H•31

CMCJEnCOoo

CDG-HrH

IH0

-aGw

4->CO

01G-HrH

13CU

G

oB

SB

CJC/3w

•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

*•X•X•X

cdrH

cd01rH

CJ

[ —inCM</>

^o

rH

043

*sO

r-inCM0o0oCOo00CDcqCOo

^poCnCOoo

CO4->M

inr^

w

oCJEnCOoo

Cu

rso

r in

co

lum

n

ze

ro

K0

•X•X•X

***-X•X•X•X•X

*•X•X

**•X•X

*•X-X•X•x•X

*•X•X•X

**-X•X•X•XHe•X

*•X•X

**•x

*•X•X•X•X•X-X•X•X

0G-HrH

oCO

Po

rHQ

«.CMIQmCM

|5.

CU

CM*>oinCMooooCD0CMmpqoPnCOoo

orH

CUN

o4-1

G

PrH

oCJ

oQ

|5•

^4rH

0

0•31

OJ

^1

•=rQ

cooo

curs

or

4-1CU

CO

C_Jf£

CMCD</>

CO

Q

•31

QCMoo00«J

\oQCnCOo0

»o•orH

0CO

>H

5

EEn

en

pc^

•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

*•X•X•X•X

****•X

*•X

<D

•H

oCO

PCJ

oQ

K

CMvoinCM

|5•

CU

CMvoinCMooo0CDnom

rtQpt4

03oo

are

w

ith

m

axim

um cu

rso

r lin

e

Q.

0o

oQ

KCMmmCM

|5.

o,e0

CMminCMoo00CDr-0PQ

ow03oo

in

low

est

linm

e,

just

cu

rso

r dow

n

•gB

CO((

oCO

CDG

ooCJPno0voVD

10f£J

k,03o0

o

oCO

3ocH

EH

CJww

ooPnCO

CO43

srrHPnPn00t-HV.O

rtj

CJPnCOoo

11

scre

en

do

wn

0

ot/3

oCOCO

rH CDQ ff>

[5•

M rH

rH COo 45

fVj

03n0

rH O^31 oCM rH«3* \£>

W 0fV) p,

Pn EnCO 03o o0 0

turn

cu

rso

r back

on

•o

wM[V]

CO</>

(Q

43

COPnw000ID

*pf. ]EnCOo0

h

cu

rso

r

CO<grH

Pn

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

*-X•X

*•X•X•X

*•X•X

T3rHoa

rH

CUA

oCO

CO

CU

M•o•o

o

«.\of^mCMvt

CQCUrH

VDr^inCMooo0CDEnrH•5P

COr-,

PnCOo0

0

oCOHPCJ

. — .of£*-~

^CM

4-1CO.p

43

CMoooorHCOo

wEnCOoo

0

CMCMoCD</>

crCU

HrHr-ID

CMooCDo0

P"

G-H

CO

rH

IH

oCOrH

Po

. — ,or3<•«—

^0

=*=

4-1CO4-1

ooooorH03o

srooCDoo

o2

CNCMoCD</>

crCU,Q

00rHr-VD

03ooCDo0

ess

o

f th

e fla

sh

counte

r

rH•o•a<

rH<

KinVDinCM

td<urH

in\s>inCMooooCDPno<gi

rtjo0CDoo

428

Page 436: Atari ST Internals

009010 5311

009012 660E

009014 12B900002564

00901A 08500001

00901E 6000FEAE

subq.b

#1, (Al)

bne

bra

$9022

raove.b $2564,(Al)

bchg

#1,(AO)

$8ECE

Decrement counter

Not yet run down ?

Reload flash counter

Invert cursor phase

Turn cursor off

eno

009022 4E75

rts

VO

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

009024 302F0004

009028 6BF8

00902A B07C0005

00902E 6EF2

009030 E340

009032 41F90000904A

009038 DOFB0004

00903C 4EDO

move.w 4(A7),DO

bmi

$9022

cmp.w

#5,DO

bgt

$9022

asl.w

#1,DO

lea

$904A,AO

add.w

$903E(PC,DO.w),AO

jmp

(AO)

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

00903E 0000

009040 0004

009042 0008

009044 0016

009046 0024

009048 002C

dc.w

dc.wdc.w

dc.wdc.w

dc.w

$904A-

$904E-

$9052-$9060-$906E-

$9076-

$904A•$904A$904A

•$904A•$904A$904A

****************************************************00904A 6000FEB4

bra

$8FOO

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

00904E 6000FE60

bra

$8EBO

Cursor configuration, XBIOS No. 21

Get number from stack

Negative, ignore

Greater than 5 ?

Yes, ignore

Base address of the table

Plus relative address

Execute function

Address of the routines

oESC f, Turn cursor off

ESC e, Turn cursor on

Iii—<iaE?

Page 437: Atari ST Internals

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

U)o

009052 6100FEAC

009056 08ED00002576

00905C 6000FE90

bsr

$8FOO

bset

#0,$2576(A5)

bra $8EEE

***********it***********************************

009060 6100FE9E

009064 08AD00002576

00906A 6000FE82

bsr

$8FOO

bclr

#0,$2576(A5)

bra

$8EEE

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

00906E 1B6F00072564

move.b 7(A7),$2564(A5)

rts009074 4E75

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

009076 7000

009078 102D2564

00907C 4E75

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

00907E 36390000256C

009084 B243

009086 6522

009088 B2790000256A

00908E 621A

009090 207900002572

009096 D241

009098 32301000

00909C E649

00909E 207900002566

0090A4 DOC1

0090A6 4243

moveq.l #0,DO

move.b

$2564(A5),DO

rts

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

move.w

$256C,D3

cmp.w D3,D1

bcs

$90AA

cmp.w

$256A,D1

bhi

$90AA

move.l

$2572,AO

add.w D1,D1

move.w

(AO,Dl.w),Dl

Isr.w

#3,D1

move.l

$2566,AO

add.w D1,AO

clr.w

D3

ESC f, Turn cursor off

Turn cursor back on

3ESC f, Turn cursor off

Turn cursor back on

4Set cursor flash rate

Load cursor flash rate

Calculate font data for character in Dl

Smallest ASCCI code in font

Compare with character to output

Character not in font

Largest ASCII code in font

Character not in font

Load font offset pointer

Code times two

Yields bit number in font

Divided by 8 yields byte number

Pointer to font data

Yields pointer to data for this character

Flag for character in font

§L588"

Page 438: Atari ST Internals

0090A8 4E75

0090AA 7601

0090AC 4E75

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

0090AE 61CE

0090BO 6702

0090B2 4E75

0090B4 22790000255A

0090BA 3E3900002556

0090CO 4847

0090C2 3E3900002558

0090C8 0839000400002576

0090DO 6702

0090D2 4847

0090D4 08B9000200002576

0090DC 40E7

0090DE 61000160

0090E2 22790000255A

0090E8 303900002560

0090EE 323900002562

0090F4 61000252

0090F8 6732

0090FA 303900002554

009100 COC1

009102 22790000044E

009108 D3CO

00910A 4240

00910C B27900002552

009112 640A

009114 D2F900002554

rtsmoveq , 1

rts#1,D3

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

bsrbeqrts

move . 1

move . w

swapmove

. w

btstbeqswapbclrmove

. w

bsrmove

. 1

move . w

move . w

bsrbeqmove

. w

mulu.wmove

. 1

add.lclr.wcmp.wbccadd.w

$907E$90B4

$255A,A1$2556,07

D7$2558,07

#4, $2576

$9004

D7#2, $2576

SR, -(A7)

$9240

$255A,A1

$2560,00

$2562,01

$9348

$912C

$2554,00

01,00

$44E,A1

DO,A1

DO$2552,01

$911E$2554, Al

Character not present in font

ascout, ignore control codes

Character present in font ?

Yes

Screen address of the character

Background color

In upper word

Character color in lower word

Reverse turned on ?

NoExchange character and background colors

Save status

Calculate new position

Screen address

Cursor column

Cursor line

Calculate relative screen address

Number of bytes per character line

Address of the screen RAM

Compare with maximum cursor line

Plus number of bytes per character line

65iaSB"

Page 439: Atari ST Internals

Abacus Software Atari ST Internals

caMCO4-1co

-HtilCO

cdCO

4j caca ca

-H COtji ^CO TJ(H T3

GcaP

co caR 4->

-H ca

O CO O O Oco ca ca 4-1

ca >H s-iCO O p p

COcu

03 CJ CJ PS

O

CM

rH

G —o

-rt CO

4J CO-H C

HO01>-<O

0)•P<grH

o

o

q010)MOca

1-4o

C-HrH

UCOCO

O

t-lCOp.

rH CJQ CM

*. i — 1

•a <BTJ JHfl xi

rH W

CM Oin vo

< orH rHrH rHen en0 Oo o

p- ft

rH

1 Q1 PS

rH O rt O CM CJ V O V Oft a m v o v o c j P- P-• v «* in in in ^ I O L Or H r H O H - C M C M C M H - V Q W C M C MQ Q C O ^ - C / > « - i / > — » i n r H - C / > < / >

11

E

48

E7

C0

40

mo

ve

m.l

DO

-

12

2

72

00

mo

ve

q.l

#

0,

12

4 6

10

00

25

A

bs

r $

9:

12

8 4

CD

F0

20

3 m

ov

em

.l

(A"

12

C

23

C9

00

00

25

5A

m

ov

e.l

A

l,

13

2 3

3C

00

00

02

56

0 m

ov

e.w

D

O,

13

8

33

C1

00

00

25

62

mo

ve

.w

Dl,

13

E

44

DF

m

ov

e.w

(A

"

14

0 6

71

4

be

q

$9

31

42

6

10

00

1D

A

bs

r $

9:

14

6

08

F9

00

01

00

00

25

76

bset

#1

,

14

E

08

F9

00

02

00

00

25

76

bs

et

#2

,

15

6

4E

75

rts

c n c n c n e n e n c n c n c n c n e n c n c n e no o o o o o o o o o o o oo o o o o o o o o o o o o

CMQ

rHQ

X)

ca

COSPen

03menOo

oQ

Q Q

S

i &i g

rH rHO -5PO COCO ^

< oin mrH rHen eno o0 0

CO

en•U3-

ca

03en0000rHVO

Wmenoo

coQ

CM CJQ P-

16

2

E2

42

as

r.w

#

1,

16

4 3

63

90

00

02

57

C

mo

ve

.w

$21

en en0 O0 0

CO CMQ P"

*o> en

A COei

oooCO CM

CJ VOO VO

vo vorH rHen eno oo o

CO rHO Q

rH CM* Q

si2 OCO g

CO CM«i oCO CMm co

O CMP- P-rH rHen en0 0O 0

Q

rH

-g1

•Qca

CMin

eno0

rHO

COQ

S

rHcaca

rHVOP-

VOr-rHenoo

CM

Wp-

17

8

34

79

00

00

25

7E

m

ov

e.w

$

2!

enoo

CM rH*C Q

rH CM CMQ Q Q

• CO OHX) > raP o SCO g CO

rH CM CMCJ O <T^ CM COen co

W O CMp- CO COrH rH rHen en eno o oo o o

432

Page 440: Atari ST Internals

Abacus Software Atari ST Internals

t!(0M

05rH0)

W

HHO

0)fi

H GO CDrH <DO MO O

CO•OC 1H

-rlEH

On)m

CMQ

CMQ

CMQ

rH O=*> Q

m oQ r-- m

m <o w oin K rH rH

3

inQ

inQ

COPQ

rH <Hin rf! *C Cft rH CftQ — — -IO- (t, Ot

n rH o n in CM CMQ Q Q Q Q ft, Q

inQ

mQ

O O rH OQ Q =tt= Q

3 3 3

•O•O<a

3 rH On o g

g S

3 3 3rH 3 • 3 • •

• • X Q. • X <»

t n a > S « < D i H « O J 3 : « ( D O13 M to

o x ) ^ ? < a s « < a c ; o < d Go o o & is ,g +jg g S 3 (0 S H

0! (U 3 Cil Q)<d G W <Q G

CMi

CMin

wTmCMoo0oenPM•sJ1

0

CM*COm

oCOCM•a1

VQinmCMOOOOcs(Y}

<

0c^mCM000oCMo0ocy* rr~~ *o mo «>

COCMr-<£>

hfci

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

mr~w

in o o in oCM O CO CM O

C O C O C O C O C \ C ^ C ^ ^ C f ^ < ^ ^ ( ^ ^ ( ^ ^ C Q C Q

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

o oo o

o u oeft en cy*o o oo o o

< O Ho o o

O CMQ Q

cyi en cTi en cjvo o o o oo o o o o

433

Page 441: Atari ST Internals

0091D4 3A01

0091D6 22CO

0091D8 51CDFFFC

0091DC D3CA

0091DE 51CAFFF4

0091E2 4E75

0091E4 E245

0091E6 4040

0091E8 3A01

0091EA 32CO

0091EC 51CDFFFC

0091FO D3CA

0091F2 51CAFFF4

0091F6 4E75

move.w

move . 1

dbra

add.l

dbra

rts

asr.w

negx.w

move , w

move . w

dbra

add.l

dbra

rts

D1,D5DO, (Al)+D5,$91D6

A2,A1

D2,$91D4

#1,05DOD1,D5

DO, (Al)+

D5,$91EA

A2,A1

D2,$91E8

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

0091F8 363900002550

0091FE B640

009200 6A02

009202 3003

009204 363900002552

00920A B641

00920C 6A02

00920E 3203

009210 36390000257C

009216 3AOO

009218 08850000

00921C C6C5

00921E 08000000

009222 6702

009224 5283

move . w

cmp.w

bplmove . w

move . w

cmp.w

bplmove . w

move . w

move . w

bclr

mulu.w

btst

beqaddq . 1

$2550,03

DO,D3

$9204

D3,DO

$2552,03

01,03$9210

03, Dl

$257C,D3

DO,D5

#0,05

D5,D3

#0,00

$9226#1,03

tesenW2O

Calculate cursor position (DO/01)

Maximum cursor column

Column value smaller ?

Else use max value

Maximum cursor line

Line value smaller ?

Else use maximum value

Number of screen planes

Column to D5

Times maximum value

enH5

Page 442: Atari ST Internals

Abacus Software Atari ST Internals

acte

r line

M<s.coH<UP.

<D014-1>i431-40

MO

*£•3Z

0>3H«>

0>«-HrH

COCDg

-HH

0><DMO0]

<UXI4-1

in0

COCOCBH•oTS13'

0)COa

PQ

0)G

-HM

HO<H

4-1CBCO

4-1IHO

013.-1PJ

G£•aHooMO<H

4->IDCO

>w>H0

CO3.-HCM

ras

ter

line

HaCO0)

4->>i43

>HoH0)43S3cCO3rHPL,

Q r-i fj;i=C

in Q w rfj *C LOin * *P ». ». LOCM iH "3" LO CO CM«• Q V> P Q CO-

CM CO

vo r- ^in in LOCM CM CMto- to *>

toQ

** CJ VO LOQ r- Q P

K in •> *i-l CM tH SP* CO- =tt= P

r—r- Q o voP - r- en* in CM CM

rH rH cn cn

LOr-CM

co c£ LO cnr*- co p ^^ <C </>CM CM « • . • . • .en en o

cjinCMcn•co-

•CO- =*= PCO CO LO CM VO

S S H• • <-t <-\

0) 3 <U • • •J> "H r* *O w *O 01O 3 O TJ 13 T! 4-1£ E S <a id m H

*. s. >. ?. s. >. s. 1 1 H o- (f *• > S.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> > > 4 3 > 4 3 > > > H c o t r o > < a « > > T 3 H > O > H C OO 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 Jg 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

ininCMoooo

CO CJ

vo oCM CMCM CMcn cno oo o

E

oooooen inr- oCM roCM P

CM roCM CM

o oo o

HLOinCMoooo

co cn inO fa r-co CM PdP P -=rvo oo M

CM CM CMcn cn cno o oo o o

H H Wvo r- spm in LOCM CM CMo o oo o oo o oo o oen en enr- r- co

co co co

O VO CJ

CM CM CMcn cn eno o oo o o

ot—

CMO PL, < CJO O PL, PO O PL, fr,O O CL, PL,

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

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

435

Page 443: Atari ST Internals

Abacus Software Atari ST Internals

M001M30

4-1

th

max

imum

valu

e

-H3cg3rHO0

0)

(0t

C1*

£_l

CDrHrHm

valu

e

gi-HX10g0)01£J

CD01

max

imum

valu

e

_«~j

4J-H

0)C-HrH

(D

<d§•

(1)3rH

>

e3e

-HX<a

C*iCD

M 01<B 3

rH (U<a ta

qg3

OO

rtO01(H3O

(V

0)G-H(—)

1O01

130

>

(3

>H

HO01HPO

<D4S

HHO

0!taa>s

d

at

old

p

osit

ion

?

0)

M

£>£J

-H

10)4-1O<0

mo

COCMcn

OmCMcn

<C co CM in CM vo— < < Q =tt= Q

QJ • • {Q Jj* (d> t3 T3 ^ T3 M 05O ID t? & T3 £l -p£ (0 (0 t3 (0 'O j-i

COp£4 O

<=T CQ r< Q C^ M too> o c_> O - o r-<^ <C CO (H J1 (H HrH Q Q LO tO IO <=P

•31 VO CO rfj &} O ^CQ CO 00 QO CQ CT) O*lCM CM CM CM CM CM CM<y* <r\\^ ^o o o o o o oo o o o o o o

COQ

—<=c•*-*

Q•

CD

Oe

^prHVOrH

VOcnCMcno0

COQ

rQ

4-1O

COOVOJ1

COenCMcno0

in

COQ

£$•

>OS

COCO

(rH

rijcnCMcn0o

<co'-C

3

•0•o<a

m0* «ooenCMcn0o

<CM

J^

•oT>a

oCOQ

p£]enCMcn00

VOcnCMcn«•

inQ

<8

^Q

T3

*g*CMpn,

faQOrHin0(^CMcno0

rH<

CM

*

|5•

•81t!<a

cn•sp"S31

m«3»rijCMcnoo

omCMcn«-voQ

2O

•o

•a1co[v.pqOrHmVO££CMcnoo

01j \

mr~H

f£fS;CMcno0

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

*

*****•K

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

0Q

OintoCM•O>

Jj

a,£U

0mmCMooooenr-om£_>r^CMenoo

CMcn</>

01rH43

vo0co

CMCQCMcnoo

oQ

oininCMvt

3=

0)

og

ommCMooo0cnCOocoi

CQCMcnoo

rHQ

CMminCMVt

3

G.gU

CMmmCM00oocnE--CM

<mCMcnoo

COoCMcn</>

01rH43

voocovo

0OCMcnoo

rHO

CMin

CM

3•

§Og

CMininCMooo0cnCOCMco

CMOCMcnoo

0vomCM

oQ

3•

gOg

ovoinCMoo000ococoCOOCMcn0o

CMVOmCMVt

rHQ

3

>Og

CMVOinCMOO00rHOCOco

MOCMcn00

o

vot—inCM</>

idcurH

VO

E —inCMooo0cn

rH•a*

•a1QCMenoo

0

•••

CM

*

4-101j 1Q

CMOO00rHCO0

fg

aCMcnoo

CMrHCOcn</>

tr01

43

CMCOr—vo[V}

QCMen0o

o

—o=*=.

4-101i)J3

Oo00orHCO0

O[V]

CMcn00

o

CMcnvt

crw

43

oc-vo

*?[V)

CMcno0

436

Page 444: Atari ST Internals

Abacus Software Atari ST Internals

VIO01Vi30

•orH

O

1-1o01OlCDVl•o•oIB

GCDCD

OCO

sitio

n

oQ,Vl00]

3O

4-1IB

ViCD4-1OIBVlIB

O

4-1Vl0)

(M

0101CD

-aT5IB

MO01VI30

3"d>G

CD4-1IBrH

3OrH

IBCJ

VlO01Vi3U

d!.G4-1

1-4O

01OlCDVl•a•aIB

Gd)CDVIOw

sitio

n

0aVIo01VI3O

4-1IB

J_|

d)4-1O<BVlIB

0

4-1Vld)

GM

•aCD

J_)

CD[>p;-H

01-H

VICD4-1OIBVIIBA0

VI01-1

tjl<BrH

Em

rso

r p

osit

ion

3U

CDG

CD4J10rH

3OrH

IBCJ

f th

e

cu

rso

r p

osit

ion

o0101CDVlT)•oIB

GCDCDVIUCfl

at

cu

rso

r p

osit

ion

VlCD

tsIBVl10

u4-1M

£*GM

CD

-H

GCDCDVIU01

Vi(!)P.01CD4-1

P3

Oi

-H

0)0)

O01

IB

1-1O

4-1f.

-HCD

Vl0)

G3O0

rdVl

€01*C

01diG

rH

0.

CDd)VI001

M-l0

VId)g3

M

d)4JG3OO

IBVI

€olrfl

01d)

-H

VICD4-101IB

VIO

ViCD4JG3OO

f th

e

ch

ara

cte

r

oratoCDVI•a•o<B

GCDCD

OCO

line

o

f th

e

ch

ara

cte

r

CD

01IBVl

IB

4-1

J>GM

ras

ter

lin

e

4-1

d>c0

VId)G-HO

CM

CD

-H

VId)4-10110VIUX0)13

rH

§di

rH

Gd)d)Vl001

4-1XCD53

0

CM=*=

Vl

o

CMOOOOcnCOo10wCMenoo

0

*4-101

%

rHOOOorH00O

f^WCMcnoo

o m

rH

d!cr >CD OrQ £

fiCinmCMoooo

H cnrH P-t— CMVO CM

[V] opq fT|CM CMcn cno oo o

w

s

Vl01X)

V£CN(—4VO

V£>EmCMcn00

00

* — 1

VICO

wpi)EmOo( — 110

03EmCMcn00

minCM

s

CD>O

f^ininCMoooocnCJroCM

O[V,

CNcn00

cn

VI01X)

rHrHVO

CMOCOcn00

vop-mCMin-CM=»=

4-1CD01

IDp-mCMooooCM0oocnEmCOo

•31

orocn0o

014-1Vl

mP-w^pCJorocn0o

o

CM

4->d)01£1

CMOOooQCOo

M0rocno0

CO

cn

M0}

•31

H

EmOOrHVD

CMrHrocno0

inmCM

rH

rH

CD>og

rfjmmCMOoooenOroCM

10rHrocno0

014JVl

m

w

CJrHCOcn00

***********

*

***************•£

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

CN

winCM

CDJ>0

pqr~mCMoo00cnr-iropqrHCOcnoo

Q

W

mCM

*d)>0

E3^PmCMoooocnCOCOro

spCMrocnoo

10Q

^P CJQ P-

rH CM

S *& d)

_Q ^3 001 g

Or-mCMoooo

^ en*3* COCO CJin ro< CJCM CMco rocn cno oo o

\oQ

rH=»=

fi

cr301

vosproin

CMCOrocnoo

mQ

Q

sCD

0

^1O03*

CO

•31

COrocn0o

sp

rH

rH

CD>0

cn^pCOCN

VDCOCOcno0

~.

.p0G

•31

rH^0•SP

COCOCOcnoo

CN

.

•a•a

/•£oCOQ

f^rorocnoo

COrorocn

inQ

IBVl

f^C(Vj

CtifoQOrHmororocnoo

rH

CN

3

tf• 3"0IB

cnS3iQ!

moSProcnoo

rorocn

Q

<0Vl

0

EmEm

CJrHmCN

rocno0

014-1Vl

inP-w•a1

^o•3*rocno0

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

*******

***************************-ft.£

*

**

437

Page 445: Atari ST Internals

Abacus Software Atari ST Internals

G

3rH

OO

Q)

O

01C-H

OCOM3O

g

•H O"ix cd 01KJ rH fl)

S fc. SH

O1H

G0)0)MOCO

O

0)

3S3

rH

Q

Q)

-HrH

4-1caG3O•ocCDCD

OCO

rHrH0r4

Oco

K

aa>a>o01

CD

4-1

1-4oCOCO0!

•ST)

racte

r line

cao$-1(Dft

01CD4-1

Q

moj_iQJ

353

COdiG

-HrH

O

^40)

g3G

>,o

>-,rHft4-1-H4-1rH3S

0)G-HrH

OJ

^4-1

inO

0101<U

-o•aiaCOT3rH<U

-H

WG

-HrH

4-1c0>

S-l3U

Q)G-HrH

J_loCOrl3O

g3

-H

*as

ra

cte

r line

caoHQ)Q,

en0)-Po

MHO

r4

01

"I353

oo0ininCM

3

ft

0

oinmCM00ooenr~

OCQ

CO<pCOeno0

CMVQCOento-

0)c43

CMrHVOto

w«rP

COen00

inCM

*.CO=tt=

4-1014-143

vor~mCMOOOOCOoooenCOCOoomCOenoo

wmCOent/>

a>c43

^*ovoVQ

COinCOenoo

COQ

J5

^rHO

CO*rp

CM*rp

rijmCOeno0

CO4-1M

in( —W*3*

OmCOenoo

coQrH=«=

i-H

tf

Og

rH

OVQt—

WinCOenoo

CO4-1

mE—W^p

0VOCOen0o

0Q

rH=tfc

|5•

•§*•scd

o« iCMin

CMvocoenoo

0Q

O=H=

4-1CO4J43

oooooo03O

•3"VOCOen0o

or-coen•CO-

ITeu43

vo0r^VO

03VOCOen0o

rH

k.rH

=8=

[5•

•S1•ocd

en"S31

CMm(vocoenoo

COQ

u

^rH0

CO^pCM

OVOCOen0o

CO4J

mr^W

Wvocoen00

coQ

Of-mCM

U•

£og

ur^mCMooooenco^Dcoor-coen00

COQrH

*

3

rH0!cd

co•rP

coWvor-coeno0

coQrH

*

3

S3CO

CO<?COm03r-coen0o

rH

IKcoQ

3•a•oca

COoCMQ

f£p~coen00

coa

3

rH

0

co"S31

CM•C1

Or—coeno0

CO4-1M

inr-P -]SP

E*3fCOenoo

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

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

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

CO

PJ^p

to-

rH

>og

H

roooooenc—voCM

0COcoenoo

coQ

inmCMt/>

3

a>0g

•rp

minCMoo00encovoCO

voCOcoeno0

coQ

KrH

Q

3

3rH

3g

rHCJVO0

OCOcoenoo

CO<

"3COQ

co<0

cd0)rH

oooCOCOf-r.

r-

p£]

COcoenoo

rHQ

3

(UG

rH•S31

•SP

CMenCOenoo

rHQ

CMinmCM

3

•a•ocd

CMmmCMOO00enc-CMQ

<=Pencoenoo

COa

minCMto-

3

iog

^pinmCMooooenCOvoCO

PJJencoenoo

438

Page 446: Atari ST Internals

0093AO 45F33000

0093A4 C6C1

0093A6 E443

0093A8 6002

0093AA 26DA

0093AC 51CBFFFC

0093BO 323900002552

0093B6 3401

0093B8 4841

0093BA 4842

0093BC 4241

0093BE 343900002550

0093C4 6000FD92

leamulu .wasr .wbramove .

1dbramove .

wmove , wswapswapclr.wmove .

wbra

0(A3,D3.w),A2

D1,D3#2,D3

$93AC

(A2)+, (A3)+

D3,$93AA

$2552,01

D1,D2

01D2Dl$2550,02

$9158

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

0093C8 26790000044E

U)

0093CE 363900002552

^

0093D4 C6F900002554

0093DA 47F33000

0093DE 363900002554

0093E4 45F33000

0093E8 3001

0093EA 4440

0093EC D07900002552

0093F2 C6CO

0093F4 E443

0093F6 6002

0093F8 2523

0093FA 51CBFFFC

0093FE 60B6

move . 1

move , wmulu.wleamove .

wleamove .

wneg.wadd.wmulu.wasr.wbramove .

1dbrabra

$44E,A3

$2552,03

$2554,03(A3,D3.w)

,A3$2554,03

(A3,D3.w) ,A2

01,00

DO$2552,00

DO, 03

#2,D3

$93FA

-<A3),-(A2)

D3,$93F8

$93B6

Yields address

of line 1

Number of bytes to move

Number of long words

Copy screen

lines

Maximum cursor line

>I

Maximum cursor

column

Scroll screen

at line Dl up

Address of the

screen RAM

Maximum cursor

lineMult by

number of bytes per

character line

Yields address

of last

character

line

Number of bytes per

lineYields

address of line 1

Current line

Add maximum

cursor line

Divide by

4 for long word transfer

Copy screen

lines

I2.enHrt3

Page 447: Atari ST Internals

Abacus Software Atari ST Internals

C 1

02

, in

itia

lize

fo

nt

pa

ram

ete

rsr

to

INT

IN a

rra

y

to a)W 4-1

GH -HQ O> PJ

s o

f th

e fo

nt

head

er

igh

t,

heig

ht

of

a ch

ara

cte

r

01 0>0) fi

T3 iHT3 0< MH

GCD£_l0)g

per

sc

reen

li

ne

|

Ol

0)4-1

CQ

hei

gh

t o

f ch

ara

cte

rb

yte

s p

er

ch

ara

cte

r li

ne

0303 'CCD rHg CD

-H -HEH >H

GCDCOrH

Oen

CD.G4-1

0

CO

a) 4-1G A

rH -Ha)CD4J 4JO3 G<fl Ot, *M

4-1 >10 £1

H CUQ) *c3•S "HP -H& Q

max

imum

cu

rso

r li

ne

0303 T!p ' — IG CD

-H -HS >i

wid

th

in b

its

by

max

imum

ch

ara

cte

r w

idth

G CDCO t30) -rHM £*O -H

CO D

rH

01PG

-HS

max

imum

cu

rso

r co

lum

n |

01•orH0)

-H>H

4-1G 4-1O G

<*H OMH

CU,G G4-1 -H

•M CU0 T!

Ofi O

S M-H M3 Oto- <

4-1 4J•a 01-H 0)IS rHg rHin <d0 g

HH CO

4-1

0MH CD

rHG iQ

-H <fl <84-1 4J

Q) <0•C T3 4-1O CDO 4J 03

M O 4-1M IH OOCO O O< 4-1 4-1

4-1 M rH01 CU CU(U 4-1 4-1en G G>H -H -H(0 O OrJ CH CM

J

^*

f. *****

A

******

****-X•}(***************•K•fc**

O

00LOCM

01

Og

•3*00LOCMOOOoen[oCM

OOieno0

rf!

^

rH

>Og

0LO0CM

VD0

eno0

oQ*"

o

CMCO

CU

og

CMLOOoCOCMOroCOo•31eno0

wLOCM

OQ

>Og

HrLOCMOOooooCOCO

CJo1o>oo

i-H

wLOCM</>

0)

og

wrLOCMooooenroCMCO

CMrH

cno0

Q

0Q

S

prHPg

OoCMO

COrH

1en0o

•3"LOLOCMVt

rHQ

0)

0g

J*LOLOCMOOoorHO

ro

<CrH

«enoo

rHQ

O

rH

Og

OoCMf

OCM«5*enoo

03

CM

S

>Og

COr~LOCMOoooencoCMcoCMCM•5Pen0o

Q

OQ

3

g-H•a

oUCMCO

COCMienoo

Q

rH=tt=

g

P01

rHProLO

<CCM31en0o

CMLOLOCM

Q

S

>Og

CMLOLOCMOO0OrHCJroroOCM*en0o

rHQ

O=B=

CU

og

ooCMr

CMro*en0o

o

!—CM</>

>Og

0

r—LOCMOOOoenroCMropro•5T»

en0o

rHQ

O

CMLO

g

-HT3

pro0oCOEdCMCO

r3*ro

eno0

rHQ

rH

3

Sp01

rH31

coLO

wro•31en0o

oLOLOCM

rHQ

>Og

0LOLOCMOO0orHCJroroorSPeno0

HvoLOCM

0

oCO

CU

og

wvoLOCM0ooooLOooCOpqCOroXD•3**3*enoo

CJIQLOCM

0

CO

CU

og

ovoLOCM0ooo<=TCM0OCOEdroroEdspi<no0

LOCM

O

COro

§Og

fjj10LOCM0O00VOCM00COEdCOCO

OLOql

eno0

10

LOCM

0

IQ

rH

0)

0g

10voLOCM0OOOO

Oo00PdroCM

HLO*sP«n0o

CM

LOCM

0

CM

rH

>Og

CMr-LOCM000o003*0OCOEdnCM

IOU)ieno0

014-1H

LOr~M

Edvoqienoo

440

Page 448: Atari ST Internals

Abacus Software Atari ST Internals

if*************

Initia

lze

scre

en o

utp

ut

****

**>

*******-K****************•X

**-£

****

0-H

3

001CDrl

c;CD

!HO

•o4JHH-H

0101

OQ

CJ

XI

go

o^poooooencoorH

^PCJVQfaO0

rH

R<d0

05

-HX!

CD

rH001M

OQ

CO

T3

(d

cooooCJF—OUf£CJVQfaO0

CO

oQ

co=*>

go

CO0ooCJ

0mtaCJVQfaoo

0

COQvofa

CDCXi

^1ovovo

CMQVDfao0

, D

O

Repla

ce w

ith

2

(hig

h r

esolu

tion)

CM

*

g

Og

CMOOO0

0coS31

QVQfaO0

0-H

+J3rH0COCD

g

(dw

r-

oQ

S

gO

OofaCO

COQVDfaO0

75A

Se

t p

ara

me

ters

fo

r scre

n re

solu

tion

fa

w01X!

[V]

r-oooorHVO

rtjQvofao0

CO

4->

Oin

rl

0)

o

<D

oQ

H-

]

ioe

farH0cop£J

Qvofao0

CO

HH

CD+J01

01

COX

CO

CD

o0101

CD

1

O

<

rH

<dCDrH

wr—rHOooenfarH^P

Owvofao0

, D

O

Hig

h re

solu

tion

?

CM=8=

aso

CMOOo0r-offlvowvofao0

o

CMfavofa

CDC!

VOovovo

ft.wvofaoo

4J

0m

CD4J01

CO

vorH

XCO

CD

HH0

m01CD

1

o

vooenCOrH

idCDrH

VOoa\O

rHOOoenfarHql

OWvofao0

id4-!id•a4J

0"M

CDN-HHId

-H4->-H

M

COO

en

M

01X)

^31rHQonoorHVO

CMfaVOfao0

PF

FF

,$2

55

8 C

hara

cte

r colo

r to

bla

ck

=tt=

gog

COinmCMoooofafafa

ofacocovofavofao0

0Q

o=s=rH

fOg

Ooor-

Wfavofao0

CD4J-Hft

OHOO

•o

o

oid

CQ

voininCM

0Q

g

0S

voininCM00ooooCO

00r-.

faO0

oCD

fi

3rHOO

rlO01rl3CJ

OvomCM

oQ

gOS

ovomCMoooooocoCO

voot—fao0

0

N

CDc-HrH

SH001

o

CMvomCM

0Q

gOg

CMVOmCMoooooonCO

O0e—fao0

mmCM

oQ

gOg

P£j

ininCMoo0oooro

CMrHf-*

faO0

soTJ-rl

fi

HHO

0101CD

•8•o

o

W

-H

gos

w•sP

oooooenr-oCM

COrHt—fao0

, $

25

5A

As

scre

en

a

dd

ress

of

the

cu

rso

r

0

rH

g

0g

mmCMo0ooCOCJ

CM

[V]

rHt—faO0

idrH

O01rl

0

4JCDco

vor-mCM

rH

*

X)

go

voe—inCMoooorHO0oCJfarH

«qiCMr-faoo

LE

,$2

56

5 C

urs

or

fla

sh

counte

r to

3

0

X!

g0g

mVOmCMoooofx]rHOOofacorH

oCMt—faO0

ocoo4J

CD

M

01idHHH

O0]rl

O

VOinCM

63J — 1

X)

gOg

"WvomCMOoootH00ofanrH

<Tcor-fa0o

§001n

0

oHH

idrHHH

CDW

CMCM

CM

rH=tt=

g

OS

CMCM^PCMOOOorHO0oofaCOCO

ocor-faoo

<a•arlO

er>0rH

000CO

rH

afafa

*

CD

0g

faCOfarHOcoCMco

^pqlr-fao0

CDa>

u01

MidCDHCJ

H-

O

OQ

rH

gOe

0

oCM

CO

r^

fa0o

CO

(—fa

Q

id

»o•a

ofafafaenCJrHin

«3*r~faoo

3AE

E,$

4A8

conout

ve

cto

r to

sta

nd

ard

rH

g

Os

CO<c^pooooo[V]

(CJJ

COooooofaCOCM

£*•)sp

[ —faoo

014J

in63qi

COmr-fa0o

441

Page 449: Atari ST Internals

OOF75A 7200

OOF75C 123B0030

OOF760 33C10000257C

OOF766 123B0029

OOF76A 33C10000257E

OOF770 33C10000257A

OOF776 E340

OOF778 323B001A

OOF77C 33C100002578

OOF782 323B0016

OOF786 33C100002570

OOF78C 4E75

moveq.lmove .

bmove .

wmove .

bmove .

wmove .

wasl.wmove

. w

move . w

move . w

move . w

rts

#0,D1

$F78E(PC,DO.w),Dl

D1,$257C

$F791(PC,DO.w) ,D1

D1,$257E

D1,$257A

fl,DO

$F794(PC,DO,w),Dl

Dl,$2578

$F79A(PC,DO,w),Dl

Dl,$2570

Initialize screen

outputDO

contains screen

resolutionGet

number of screen

planesAnd

saveGet bytes

per screen

lineAnd

save

Get screen

heightAnd

saveGet

screen height

And save

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

OOF78E 040201

dc.b

4,2,1

OOF791 AOA050 dc.b

160,160,80OOF794 OOC800C80190

dc.w

200,200,400

OOF79A 014002800280

dc.w

320,640,640

Screen parameters

Number of screen

planesBytes

per screen

lineScreen

heightsScreen

widths

Note: This B

IOS listing contains som

e of the most im

portant sections of TOS V

ersion1. Later versions of TO

S may have som

e minor differences, but this listing should still

prove valuable.

Page 450: Atari ST Internals

Chapter Four

Appendix

4.1 The System Fonts4.2 Alphabetical listing of GEMDOS functions

Page 451: Atari ST Internals
Page 452: Atari ST Internals

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 foroutput on the color monitor, and the 8X16 font is used for the monochromemonitor output. The chart on the next page includes the characters with theASCII codes 1 to 255.

445

Page 453: Atari ST Internals

Abacus Software

6X6 System Font

0. "1 Ul

O »> c2 ft UlZ * «J X <»X • <9~J !3 CM ;o •i :n «o <a r»u. a 4u x> «O :0 Mu <o Pm m f.I N *Cl U Bf .0 sA :a <n ** %V »• >

« :•« r* p

p :«i r0) *^ ^P- U RID -1 aM '1 r« :<i R.m •' aru -' n

'.3 q(9 U 9V C r

t f1 « fi — n+ v rX N 2« 31 P*« X 1-% 3 ~<* > rrx o r-w •• n» « nt t X

(J s>a -

x o tx, c on t ®(< -. 51a £0 -1 •IT " :•a £ top- m Mja »• •«m <> eJ D 0fll u »ni x> sj•* fl SOo » n- . 1 * 1=5 < * nrf n — a£ S f a"» M .« •><•• N r .0 > t. •S X .-> »« 2 01 itK > 41 •!•• 3 12 -,+ 1- 1C <-t W --3 VI-> Of -0 M«• a •«• «

8X8 System Font

0.orz_l

-5*-iX13U.LJOUCOceif-AIIV•«

G*03Ntoin

*MCMHOX,

1

*+

*«w

•aX<o

2)*i

CufOff>CO

•2iflmru

0~*=^£S-s*?

•<»ih«>«

:D:o:3io<3•0:o<o

$•u•«:«.H

<«Jrt•«l"OfidV•4-n:<g<<i•0:3Oio/<"»

wN31X3»3fVILao.oer*J£•^

efg

hi

•uu.aA/

1<n/LJ

N>X

RS

TU

UW

O

IIIcu«e>tQ

caidt-

ttMPHcaS

f«*rPr-C

rft71naDnCrnr

aPr

Cr«nXP:?

0"

s

'(0i«•«y1snatoit

§ i'"• W

^ Vru ••o •Oi ()m -i-tZ -3tc «-•3 v|•0 A|«H +1

Atari ST Internals

8X1 6 System Font

a. ^<D IIIO . . *-"^^ ^~3E CO. U>z: SH -e-i >• ' ' *{~\.~-t • -H *^

2tf O K3"i :=J CiHHI IO CD2C ZZ3) KDlCO /3 >*Ll— O li.UJ /O Oca :o INC-3 <O IP03 *M f_cc f« ca<a HJJ aC" oec 8/S XE <II /»^ *O>V <«i S-••^ JrHI ^^

~~ /Gl ^3cr» :eu r—CO <GJ •—P*» CJ> C |UQ *rn 53in /*o r™*^^ z*o ^^M <<a 01CM ^GJ CT^ Hl IZ3 « lC3 O D••w rf*i ^^^s» %! ^»

- 2 S3| f*^ JX

. '"* • n•+• Sr r3fC M E3j«~»i zn cz*-* x •—e*£J I> HZX 3 1"*<U> ^^ f^;a w n« C« 7C— • cr PD». Q P*a ° fe,'* C— IHJ

C c o•-I o»-

UW J^J f-

ro •— ) \« ,-_a •

OO JC JOC" en tecUQ H- /CCto GJ fcjy -a ^Brr> u to.f\J £} 1S™" ia joC3 / jro-• 1 A 1-v < V «W Ir TI " ™ ftl

^ -JB \»* _,

!«.•• -^ r^T C

-S " S* ",*4» INJ r •0 >• i. •*>• >e ••& oS3 3C OI UK 3- <PI -1-iv< =j >z — 3V •— «= <=—A 1X1 *3 VIO cz: ^o /M^H C3 *«^ 4"!

446

Page 454: Atari ST Internals

Abacus Software Atari ST Internals

4.2 Alphabetical listing of GEMDOS functions

Name Opcode (hex) Page Number

Cauxin 03 106Cauxis 12 111Cauxos 13 111Cauxout 04 106Cconin 01 105Cconis OB 110Cconos 10 111Cconout 02 106Cconrs OA 109Cconws 09 109Cnecin 08 108Cprnos 11 HICprnout 05 107Crawcin 07 108Crawio 06 107Dcreate 39 117Ddelete 3 A 118Dfiee 36 116Dgetdrv 19 111Dgetpath 47 128Dsetdrv OE 110Dsetpath 3B 119Fattrib 43 126Fclose 3E 122Fcreate 3C 120Fdatime 57 137Fdelete 41 124Fdup 45 128Fforce 46 128Fgetdta 2F 115Fopen 3D 121Fread 3F 123Frename 56 136Fseek 42 125Fsetdta 1A 112Fsfirst 4E 134Fsnext 4F 136F write 40 124

447

Page 455: Atari ST Internals

Abacus Software Atari ST Internals

Malloc 48 129Mfree 49 130Mshrink 4A 131Pexec 4B 132Rerm 4C 133PtennO 00 105Ptermres 31 115Super 20 112Sversion 30 115Tgetdate 2A 113Tgettime 2C 114Tsetdate 2B 114Tsettime 2D 115

448

Page 456: Atari ST Internals

Index

Page 457: Atari ST Internals
Page 458: Atari ST Internals

Abacus Software Atari ST Internals

ACIA 6850~see Asynchronous Communications Interface Adapteraddress bus, 7, 8asynchronous bus control, 8-9

ADDRESS STROBE(AS), 8DTACK, 9,10,12LOWER DATA STROBE(LDS), 8READ/WRTTECR/W), 8UPPER DATA STROBE(UDS), 8

Asynchronous Communications Interface Adapter(ACIA), 41-47, 62-63pins, 41-44registers, 45-47

control register, 45-46status registers, 46-47

BANK, 55Basic Input Output System(BIOS), 140-154,242,246,247

listing, 268-442BCD—see Binary Coded DecimalBERR, 11,12,15BG~see Bus GrantBGACK~see Bus Grant AcknowledgeBGO~see Bus Grant OutBinary Coded Decimal (BCD), 4BIOS—see Basic Input Output SystemBLANK, 15BR—see Bus RequestBus Grant(BG), 10, 13Bus Grant Acknowledge(BGACK), 10,13Bus Grant Out(BGO), 13Bus Request(BR), 10,13

cartridge slot, 96Centronics interface, 88-89CLK, 11

data bus, 7data registers, 4DataRequestpR), 22DE~see Display EnableDigital Research, 103Direct Memory Access(DMA), 8-9,12-13,18-19, 25,58-59,99-100Display Enable(DE), 15

451

Page 459: Atari ST Internals

Abacus Software Atari ST Internals

DMA-see Direct Memory AccessDR~see Data Request

exception vectors, 234-236

FDC~see Floppy Disk ControllerFloppy Disk Controller(FDC), 20-27

Command Register(CR), 24Data Register(DR), 24Sector Register(SR), 24Status Register(STR), 24Track Register(TR), 24

floppy disk interface, 97-98

GEM graphics, 206-233high-res, 209-212Hne-A opcodes, 229-233line-A variables, 226-228lo-res, 208-209medium-res, 209-210

GEM graphics - commands, 213-233BITBLT, 218COPY RASTER FORM, 225-226DRAW SPRITE, 224-225FILLED POLYGON, 217FILLED RECTANGLE, 216GET PIXEL, 213HIDE CURSOR, 223HORIZONTAL LINE, 215Initialize, 213LINE, 214PUT PIXEL, 213SHOW MOUSE, 223TEXTBLT, 218-222TRANSFORM MOUSE, 223-224UNDRAW SPRITE, 224

GEMDOS, 103-139, 242functions, 104-138error messages, 139

GLUE, 13-15, 18, 69

HALT, 11, 12HSYNC, 15

452

Page 460: Atari ST Internals

Abacus Software Atari ST Internals

IACK, 13integrated circuits, 3-63INTEL, 3interrupts, 7, 10, 236-241I/O registers, 55-63

ACIAs, 62DMA/Disk Controller, 58-59keyboard, 62MFP 68901, 60-61MIDI, 62, 240sound chip, 59-60Video Display Register, 56-58

keyboard control, 67-71, 74-84

longword, 7

Memory Management Umt(MMU), 11,13, 15-16, 18, 55memory maps, 62-63MFP 68901~see Multi-Function PeripheralMFPINT, 13MIDI —see Musicial Instrument Digital InterfaceMMU~see Memory Management UnitMotorola 68000 microprocessor, 3-12, 255-267

registers, 4-6exceptions, 7connections, 7-12instruction set, 255-267

mouse, 71-74MS-DOS, 104, 180

Multi-Function Peripheral(MFP 68901), 28-40, 60-61, 90,171, 239, 241Active Edge Register(AER), 32connections, 28-32Data Direction Register(DDR), 32General Purpose I/O Interrupt Port(GPIP), 32Interrupt Enable Register(lERA,IERB), 33Interrupt In-Service Register(ISRA,ISRB), 34Interrupt Mask Register(IMRA,IMRB), 34Interrupt Pending Register(IPRA,IPRB), 33-34Receiver Status Register(RSR), 38-39registers, 32-40Synchronous Character Register(SCR), 37

453

Page 461: Atari ST Internals

Abacus Software Atari ST Internals

Timer A/B Control Register(TACR,TBCR), 35Timers C and D Control Register(TCDCR), 36Timer Data Registers (TADR,TBDR,TCDR,TDDR), 37Transmitter Status Register(TSR), 39-40UCR/USART, 37-38UDR/USART, 40Vector Register(VR), 34

Musical Instruement Digital Interface(MIDI), 93-95,170

NMI-see non-maskable interruptnon-maskable interrupt (NMI), 6, 13, 237

operating system, 103

PSG (Programmable Sound Generator)~see YM-2149 Sound Generator

RESET, 11, 12RS-232 interface, 90-92, 240-241

SHIFTER, 13, 15, 17, 18status register, 6supervisor mode, 4, 6, 7, 234synchronous bus control, 9

E,9Valid Memory Address(VMA), 9Valid Peripheral Address(VPA), 9, 10

system fonts, 443-446system variables, 247-254

Tramiel Operating System(TOS),103

UNIX,104user byte ,4user mode ,4, 6, 7, 234

video interface, 85-87VSYNC, 15VT52 emulator, 242-246

WD 1772, 20-27word, 7word access, 8

454

Page 462: Atari ST Internals

Abacus Software Atari ST Internals

XBIOS, 155-205

YM-2149 Sound Generator, 48-54

attack/decay /sustain/release(ADSR), 48digital/analog(D/A) converter, 48registers, 52-54

455

Page 463: Atari ST Internals

Optional Diskette

For your convenience, the program listings contained in this book areavailable 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 SoftwareP.O. Box 7219

Grand Rapids, MI 49510

Or for fast service, call 616/241-5510.

Page 464: Atari ST Internals

FESSIONALDUCTIVITY

New ST software from a name you can count on...

PCBpardDesigner

Create printed circuit board layouts

Features: Auto-routing, componentlist, pinout list, net list

Word processor for the ST

FileProThe electronic

filing systemfor the ST

PCBoard DesignerInteractive, computer-aided designpackage that automates layout ofprinted circuit boards. Auto-routingwith 45* or 90" traces; two-sidedboards; pin-to-pin, pin-to-BUS or 8US-to-BUS. Rubberbanding of componentsduring placement. Prints board layout,pinout, component list, net list. Outputto Epson printer at 2:1. Pays for itselfafter first designed board. $395.00

ST TextProWordprocessor with professionalfeatures and easy-to-use! Full-screenediting with mouse or keyboardshortcuts. High speed input, scrollingand editing; sideways printing;multi-column output; flexible printerinstallation; automatic index and tableof contents; up to 180 chars/line; 30definable function keys; metafileoutput; much more. $49.95

ST FileProA simple-to-use and versatile databasemanager. Features help screens;lightning-fast operation; tailorabledisplay using multiple fonts;user-definable edit masks; capacity upto 64,000 records. Supports multiplefiles. RAM-disk support for 1040ST.Complete search, sort and filesubsetting. Interfaces to TextPro. Easyprinter control. $49.95

Combine graphicswith your text

AssemProThe complete 68000

assembler developmentpackage for the ST

STForih/MTPowerful, multi-tasking Forth forthe ST. A complete, 32-bit imple-mentation based on Forth-83standard. Development aids: fullscreen editor, monitor, macroassembler. 1500+ word library.TOS/LINEA commands. Boatingpoint and complex arithmetic.Available Sept. '86. $49.95

STPalniProA GEM™ among ST drawingprograms. Very friendly, but verypowerful. A must for everyone'sartistic or graphics needs. Useup to three windows. Free-formsketching: lines, circles, ellipses,boxes, text, fill, copy, move,zoom, spray, paint, erase, undo,help. $49.95

ST Text DesignerAn ideal package for page layouton the ST. Accepts prepared textfiles from TextPro or other ASCIIwordprocessors. Performs blockoperations— copy, move, col-umns. Merges bit-mappedgraphics. Tools to add borders &separator lines, more. AvailableSeptember -86. $49.95

ST AssemProProfessional developer's pack-age includes editor, two-passinteractive assembler with errorlocator, online help includinginstruction address mode andGEM parameter information,monitor-debugger, disassemblerand 68020 simulator, more.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 SoftwareP.O. Box 7219 Dept.M9 Grand Rapids, Ml 49510 - Telex 709-101 • Phone (616) 241-5510Call 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 orwrite for your free catalog. Dealer inquiries welcome-over 1400 dealers nationwide.

Page 465: Atari ST Internals

AssemProThe complete 68000

assembler developmentpackage for the ST

AssemPro is the professional developer'spackage for programming in 68000 assemblylanguage on the ST. The package includes:editor, two-pass interactive assembler with errorlocator, online help including instruction addressmode and GEM parameter information,monitor-debugger, disassembler and 68020simulator. $59.95

Page 466: Atari ST Internals

FileProThe electronic

systemtheST

filing

FilePro is a simple to use but flexible datamanager. The drop-down menus allow you toquickly define your file and enter your informationthrough screen templates. FilePro has manyunique features: store data items in different typestyles; create subsets of a file; change filedefinition and format; includes and supports aRAM disk for high speed operation. FilePro alsohas a fast search and sort capabilities, canhandle records up to 64,000 characters in length,allows numerical values with up to 15 significantdigits, accesses up to 4 files simutaneously,indexes up to 20 different fields per file and hascomplete, built-in reporting capabilities. $49.95

Page 467: Atari ST Internals

Word processor for the ST

TextPro is a professional quality wordprocessor.In addition to the standard options found in mostother word processors, TextPro featuresmulti-column output automatic indexing and tableof contents, sideways printing (to Epson printers),up to 30 user definable function keys, mode forediting C language source programs and flexibleprinter driver installation. It is designed with fastentry of text in mind. The advanced TextPro usercan substitute shortcut keyboard commands forthe drop-down menu commands. $49.95

Page 468: Atari ST Internals

With Text Designer youare now able to combinetext with graphics on yourscreen. Add artwork toyour page layouts. Livenup your pages withpictures to add that

\Designer/Combine graphics

with your text

rttLi\r pageswitn\/ires to add thatpersonal flair.

TextDesigner is an ideal package for page layouton the ST allowing you to interlace graphics withtext. TextDesigner reduces the steps and timeinvolved in preparing professional documentsand newsletters. Use the tools provided forborders, lines, text, etc. or cut and paste fromPaintPro, Doodle, Degas, TextPro and otherASCII word processors. TextDesigner is a simpleto use and versatile package which will give youthe professional results you deserve at areasonable cost. $49.95

Page 469: Atari ST Internals

PaintProPaintPro

PaintProVAV

Multiplewindows

For creative illustrations on the ST

PaintPro is a friendly, yet powerful design andpainting package for drawing graphic and artisticpictures. This GEM-based package supports up tothree active windows and has a complete toolkitof functions: free-form sketching, lines, circles,ellipses, boxes, fill, copy, move, spray, zoom,undo, help and extensive text capabilities. Youcan also import "foreign" pictures forenhancement using Paintpro's double-sizedpicture format and send hardcopy to most populardot-matrix printers. PaintPro works with eithermonochrome or color systems. $49.95

L,.

Page 470: Atari ST Internals

Multi-TaskingFull-Featured

Forth/MT, the multi-tasking, full-featured Forthlanguage for the ST, is for serious programmers.Forth/MT is a complete, 32-bit implementationbased on Forth '83 standard. Includes manydevelopment aids: full screen editor, monitor,macro assembler, over 1500 word library.Includes TOS, LINEA, floating-point and complexarithmetic commands. $49.95

Page 471: Atari ST Internals

shGlf booksfrom Abacus

PRESENTING THE STGives you an in-depth look atthis sensational newcomputer. Discusses thearchitecture of the ST. work-Ing with GEM, the mouse,operating system, all thevarious interfaces, the 68000chip and Its Instructions.LOGO. 2QQpp $16.95

STB.flinn.r-.Guid.Written for the firsthand STuser. Get a basic understand-ing of your ST. ExploreLOGO and BASIC from theground up. Simple explan-ations of the hardware andinternal workings of the ST.[[lustrations, diagrams. Gloss-ary. Index. 200pp $14.95

ST INTERNALSEssential guide to the insideinformation of the ST.Detailed descriptions ofsound and graphics chips.internal hardware. I/O ports.using GEM. CommentedBIOS listing. An Indispen-sible reference for your STlibrwy. 450pp 519.85

GEM Programme*! R«f.For serious programmersneeding detailed informationon GEM. Presented in aneasy-to-understand format.Afl examples are in C andassembly language. CoversVD1 and AES functions. Noserious programs? should bewithout 410pp $19.95

MACHINE LANGUAGEProgram in the fastest lang-uage for your ATARI ST.Learn 63000 assembly lang-uage, its numbering system,use of registers, structure Aimportant details of Instruc-tion set, and use of internalsystem routines. Geared forthe ST. 260pp $19.95

ST TRICKS & TIPSFantastic collection of pro-grams and info for the ST.Complete programs include:super-fast RAM dish; time-saving printer spooler; colorprint herdeopy; plotter outputhardcopy; creating access-ories. Money saving tricksand tip*. 260pp $19.05

ST GRAPHICS A SOUNDDetailed guide to graphicsand sound on the ST. 2D &3D function plotters, Molr6patterns, graphic memoryand various resolutions,fractals, recursion, waveformgeneration. Examples writtenin C. LOGO. BASIC andModutB.2. 25Cpp $19.95

ST LOGO GUIDETake confrol of your ST bylearning ST LOGO—*he easyto use. powerful language.Topics Include: file handling.recurslon-HllbBft ft Sierpinsk!curves, 2D and 3D functionplots, data structure, errorhandling. Helpful guide forSTLOGOusars. $19.95

ST PEEKS A POKES

the examples found withinthis book. Explores usingdifferent languages BASIC.C. LOGO and machinelanguage, using variousInterfaces, memory usage,reading and saving from andto disk. more. 28Gpp $16.95

BASIC Training GuM*Thorough guide for learningST BASIC programming.Dataled programming funda-

tions. ST graphics ft sound,using GEM in BASIC, filemanagement, disk operation.Tutorial problems give handson experience. 3QOpp $16.95

BASIC to CMove up from BASIC to C. Ifyou're already a BASICprogrammer, you can learn Call that much faster. Parallelexamples demostrate theprogramming techniques andconstructs in both languages.Variables, pointers, arrays,data structure. 250pp $19.95

3D GRAPHICSFANTASTIC) Rotate, zoom,and shade 3D objects. Allprograms written in machinelanguage for high speed.Learn the mathematicsbehind 3D graphics. Hiddenline removal, shading. With3D pattern maker andanimator. $24.95

The ATARI logo and ATARI ST ore tademarks of Atari Corp.

A L ****!"?" r*» .£-AbacusliiiiiiiJ SoftwareP.O. Box 7219 Dept. A9 Grand Rapids, Ml 49510 • Telex 709-101 • Phone (616) 241-5510Optional diskettes are available for all book titles at $14.95Call 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 orwrite for your free catalog. Dealer inquiries welcome-over 1400 dealers nationwide.

Page 472: Atari ST Internals