APPENDIX ELEVEN
Addenda And Errata To The First Edition
The material which follows is arranged by decimal address, hex,
then name, followed by the description, In some locations, all that's
added is a particularly good reference article or book which further
elucidates the use of that memory.
Lower memory locations used by BASIC and page six may be used
for other purposes by other languages--the ABC and Datasoft BASIC
compilers and MAC/65, for example, use many locations to perform
different tasks from those performed in the same space by BASIC.
Read the language's or compiler's memory map before using these
locations in order to avoid a conflict. The same may be true of the
more recent custom DOS programs which have been released since
the first edition of the book.
9 9 BOOT
- A value of 3 means both cassette and disk boot were successful.
You can trap the RESET button by POKE 9,3 followed by a POKE
2 and 3 (CASINI) with the address (LSB/MSB) of your machine
language routine to trap RESET (also store 3 into location 9
within the routine) and an RTS at the end.
12,13 C,D DOSINI
- To trap RESET into rerunning your machine language program,
load the initialization address of the program here. You can
also do it through CASINI; see above.
18,19,20 12,13,14 RTCLOK
- The number referred to in the second paragraph should be 256
cubed minus 1 (256 * 256 * 256 - 1). Also, to get the number of
seconds from the jiffy count, divide by 59.92334 (the actual VBI
time interval), not 60. See articles by Stephen Levy in COM-
PUTE!'s Third Book of Atari and by Bob Cockcroft in ROM
(December 1984 and February 1985) for articles on Atari timers.
29 1D PBPNT
- The pointer to the current byte or character to be sent to the
printer.
33 21 ICDNOZ
- The current device number.
59 3B CHKSNT
- Zero means not sent.
66 42 CRITIC
- POKE 66,1 to disable the update between shadow and hard-
ware registers; then you can POKE directly into the hardware
registers themselves. You can disable VBLANK at 54286 ($D40E)
as well.
67-73 43-49 FMZSPG
- Reinitialized by FMS each time it takes control.
82,83 52,53 LMARGN and RMARGN
- Both have a range of 0 to 39.
85,86 55,56 COLCRS
- Has a range of 0 to 319.
87 57 DINDEX
- To turn off the cursor when drawing in a text mode, POKE 752,1,
followed by a PRINT statement, To get different colors, add a
COLOR statement before the PLOT routine, The character will
be the ASCII equivalent of the number which follows COLOR.
88,89 58,59 SAVMSC
- The program to save the graphics screen doesn't work, To save
your graphics screen, create a string to hold a machine lan-
guage call routine:
1 DATA 104,104,104,170,76,66,228
2 REM PLA, PLA, PLA, TAX, JMP $E456
5 FOR N=1 TO 7:READ BYTE:ML$(N,N)=CHR$(BYTE
):NEXT N
Now OPEN a channel for writing to disk (OPEN #4.8,0,
"D:filename.ext"). Find RAMTOP (FINISH = PEEK(106) * 256 -
160), subtracting 160 bytes for any text window screen. Find the
address of the display list (DLIST = PEEK(560) + 256 *
PEEK(561): START = PEEK(DLIST + 4) + 256 * PEEK(DLIST + 5):
HIGH = INT(START/256): LOW = START - 256 * HIGH), and
POKE it into the proper location in the IOCB (POKE 900,LOW:
POKE 901,HIGH).
Next, figure the screen length (SIZE = (FINISH - START) + 1:
SZHI = INT(SIZE/256): SZLO = SIZE - 256 * B1), and POKE it into
the IOCB (POKE 904,SZLO: POKE 905,SZHI). POKE the binary SAVE
command into the IOCB (POKE 898,11). Call the CIO with the
USR command (X=USR(ADR(ML$),4 * 16)). Finally, save your
current graphics mode (MODE = PEEK(87): PUT #4,MODE) and
color registers (FOR N = 708 TO 712; PUT #4,PEEK(N): NEXT N)
and CLOSE #4.
To recall the screen, use the same USR routine and the above
PEEKs and POKEs, but POKE 898,7 rather than 11. This was de-
rived from a larger program by Fred Pinto in the March 1984 is-
sue of Antic. An article by Steve Kaufman in COMPUTE!,
November 1983, has a fast and dirty method which works just
as well (save and load), but doesn't save the color registers.
Creative Computing, November 1983, also had a similar ex-
ample in "Outpost Atari."
106 6A RAMTOP
- See K.W. Harm's article on the "RAMTOP Dragon" in COM-
PUTE!'s Second Book of Atari Graphics to see how to protect
high memory; another article in the same book, by Jim Clark.
describes how to protect low memory.
118 76 DELTAR
- This is the change of vertical position when drawing a sloped
line.
121 79 ROWINC
- Direction of line draw: 0 is down, 255 is up.
122 7A COLINC
- Direction of draw: 0 is right, 255 is left.
126,127 7E,7F COUNTR
- Iterations or steps required to draw a line.
132,133 84,85 VNTD
- COMPUTE!, October 1983, has an article by E.H. Foerster on
how to reserve a portion of RAM above VNTD--within a BASIC
program--which will also be saved intact when you save the
program.
138,139 8A,8B STMCUR
- Another way to lock up the system if something is done--say,
BREAK pressed--is by Z=USR(0).
146 92 MEOLFLG
- BASIC's modified EOL flag register. The Atari BASIC Sourcebook
lists all the RAM locations used by BASIC (pages 144-147).
147 93 ....
- Spare.
149,150 95,96 POKADR
- Address (LSB/MSB) of last POKE location, If no POKE command
was given, it is the address of the last OPERATOR token (often
155 for EOL).
182 B6 DATAD
- The data element being read. Registers the number of the ele-
ment in that line, say the tenth item in a DATA statement.
183,184 B7,B8 DATALN
- DATA statement line number; the BASIC line number of a DATA
statement being currently read. The RESTORE statement sets the
locations (and 182, above) back to zero. You can do the same
with a POKE. Here's a program which demonstrates these loca-
tions from Steve Rockower, Atari SIG. CompuServe.
10 REM DEMONSTRATES 182- 184($B6-$B8) AS SU
BSTITUTES FOR RESTORE
20 REM 182 ($B6) POINTS TO ITEM OF A LINE T
O BE READ NEXT
30 REM DATA STATEMENTS HAVE ELEMENT NAME SE
QUENTIALLV AND
40 REM NUMBER IN CURRENT LINE
50 DIM C$(2),A$(20):C$=CHR$(125)
100 DATA ONE-1, TWO-2, THREE-3, FOUR-4, 0
110 DATA FIVE-1, SIX-2, SEVEN-3, EIGHT-4, 0
120 DATA <9-1>,<10-2>,<11-3>,<12-4>,1
150 PRINT C$:RESTORE 100
160 READ A$:IF A$="0" THEN 200
170 IF PEEK(182)=1 THEN PRINT :PRINT "READI
NG LINE: ";PEEK(183)+256*PEEK(184)
180 IF A$="1" THEN 300
190 PRINT "#";PEEK(182);" "; A$;"{3 SPACES}"
;:GOTO 160
200 PRINT :GOTO 160
300 PRINT :PRINT
310 TRAP 400:PRINT "WHICH DATA LINE (1,2, O
R 3)";:INPUT DATALINE
320 PRINT "WHICH ITEM (1,2,3, OR 4)";:INPUT
ITEM
330 LET DATALINE=90+10*DATALINE
340 POKE 184,INT(DATALINE/256):POKE 183,DAT
ALINE-INT(DATALINE/256)
350 POKE 182,ITEM-1
360 READ A$:PRINT A$
370 GOTO 310
400 END
DOWNLOAD DATALN.BAS
190 BE SAVCUR
- Saves current line address.
192 C0 IOCMD
- I/O command.
193 C1 IODVC
- I/O device.
194 C2 PROMPT
- Prompt character.
200 C8 COLOR
- Stores the COLOR number used in a PLOT or DRAWTO statement.
The statement COLOR x can be replaced by POKE 200,x. Same
as location 763 ($2FB), but BASIC takes the value from 200 and
loads it into 763 before drawing or filling. From Judson Pewther,
New York.
202 CA LOADFLG
- Load in progress flag.
210,211 D2,D3 ....
- BASIC floating-point work area. $D2 is used for the variable
type, $D3 for the variable number and length of the FP
mantissa.
212,213 D4,D5 FR0
- Used by the USR command to return a two-byte number to
BASIC. If you store nothing here, then the equation
"I=USR(address, variables)" returns the address of the USR sub-
routine. Otherwise, you can store an integer (range 0-65535)
here which becomes the value of the USR function, From Judson
Pewther. New York.
522,523 20A,20B VSERIN
- Serial input ready vector.
524,525 20C,20D VSEROR
- Serial output ready vector.
528-533 210-215 POKEY timers
- In "From Here to Atari" in Micro, June and December 1983,
Paul Swanson explained how POKEY timers work--properly.
The manuals have an inaccurate description that causes your
system to lock up. The method below is taken from those issues.
This is described for channel 1; it can be used in channels 2
and 4 (not 3) by selecting the appropriate control and interrupt
vectors. First, POKE AUDCTL (53768; $D208) with a frequency
value (0 = 64 kilohertz, 1 = 15 kilohertz, 96 = 1.79 megahertz).
(You can actually change frequency between interrupts if you
wish.) Next, set the channel control register (53761; $D201). Enter
your interrupt routine and POKE its address into 528, 529 ($210,
$211).
After this is done, POKE 53769,0 ($D209). Now enable the inter-
rupt: POKE 16 with PEEK(16) plus the number of the interrupt
you're using (1 = timer 1 interrupt, 2 = timer 2, 4 = timer 4--
there's no timer 3!). POKE the same value into 53774. Your inter-
rupt routine will begin; it will generate an interrupt when the
timer counts down to zero. The timer is reloaded with the orig-
inal value you POKEd there, and the process begins all over
again.
There are several problems to watch for: First, the OS pushes
the A register onto the stack before jumping through the vector
address. If you need the X and Y registers, push them on as
well. Before you return from the interrupt, pull the X and Y back
off, PLA, and clear the interrupt with CLI.
If you don't need the screen display, POKE 559,0 to turn it off;
DMA steals clock cycles from the timer, This means you'll have
to make any commands which deal with shadow registers (like
SETCOLOR and GRAPHICS) first. DMA also turns off the keyboard
repeat and realtime clock. Disable the keyboard to gain a bit
more time if necessary.
Refer to Micro and ROM, December 1984, for more information
about POKEY timers.
555 22B SRTIMR
- Each time you read this location, you get a different number.
That's because it's counting down from when a key is de-
pressed to time the delay before repeating the key.
558 22E CDTMF5
- Set when location 544,545 ($220,$221) counts down to zero. From
Joe Gelman, Atari SIG, CompuServe.
570 23A CDEVIC
- The current SIO bus ID (device) number.
632 278 STICK0
- The pins on the joystick port are mapped as follows:
_______________________________
\ /
\ 1 2 3 4 5 /
\ /
\ 6 7 8 9 /
\_____________________/
1 Stick forward
2 Stick back
3 Stick left
4 Stick right (1-4 are four bits of the PIA port)
5 Potentiometer (paddle) B input (analog pin 1)
6 Trigger
7 +5 volts (recommended load of one TTL at 50 ma)
8 GND
9 Potentiometer A input (analog pin 2)
See Creative Computing, August 1983, for an example of using
the Atari ports for external control.
743,744 2E7,2E8 MEMLO
- It's quite handy to reserve a block of memory below your
BASIC program and use it to store variables which can be
passed back and forth between programs with PEEKs and
POKEs, Here's another routine which will reserve low memory
for you:
5 PRINT FRE(0)
6 REM PROGRAM IS WIPED OUT AFTER RUNNING: B
E SURE TO SAVE IT FIRST
7 REM PRINT FRE(0) AFTER RUNNING TO COMPARE
VALUES
10 REM REPLACE BYTES VARIABLE WITH NUMBER O
F BYTES TO PROTECT
20 MEMLO=BYTES+PEEK(743)+PEEK(744)*256
30 HIBYTE=INT(MEMLO/256)
40 LOBYTE=MEMLO-(INT(MEMLO/256)*256)
50 POKE 743,LOBYTE:POKE 744,HIBYTE
60 POKE 128,LOBYTE:POKE 129,HIBYTE:REM BASI
C LOMEM POINTER
70 POKE 8,0:REM RESET FLAG
80 X=USR(40960):REM JUMP TO BASIC COLDSTART
752 2F0 CRSINH
- Watch out for conflict with 755 when setting this location (and
vice versa).
755 2F3 CHACT
- See COMPUTE!'s Third Book of Atari for an article by Frank
Jones on creating blinking characters.
763 2FB ATACHR
- Not the color times 16 plus luminance; this is the number of the
latest COLOR statement, taken from location 200 ($C8). If you
POKE the number here, BASIC will take the number stored in
location 200 and dump it, changing your value (not so in ma-
chine language, however). From Karl Wiegers. Rochester, and
Judson Pewther, New York.
764 2FC CH
- In COMPUTE!'s Third Book of Atari, Orson Scott Card explained
the keyboard and how to read it using the CH register.
The values listed as "internal code" in Appendix 10 are not the
same as those produced at 764. The internal code is the order
the characters are stored in the character set. The keycode re-
flected by 764 is the hardware code, which is altogether dif-
ferent for no reason I've been able to ascertain.
768-779 300-30B Page three device information
- Here are some brief examples showing how to use these loca-
tions with the disk drive (it already has a handler in place, and
we don't have to write a new one). The CIO call routine can be
used in all your disk I/O routines based around these locations.
To check if a sector has data in it:
5 DIM SEC$(128),CHK$(128)
10 DATA 104,32,83,228,96
15 SEC$(1)=CHR$(0):SEC$(128)=SEC$:SEC$(2)=S
EC$:CHK$(1)=CHR$(0):CHK$(128) =CHK$:CHK$(
2)=CHK$
16 REM SETS UP ARRAY SPACE AND FILLS IT
17 REM CHK$ IS FULL OF BLANK SPACES - CONTE
NTS OF UNUSED SECTORS
20 FOR N=1536 TO 1540:READ X:POKE N,X:NEXT
N
25 REM THIS POKES THE CIO CALL UP ROUTINE I
NTO PAGE SIX
30 POKE 769,1:POKE 770,82
35 REM THIS POKES THE DRIVE NUMBER (1) AND
READ FUNCTION (82)
40 PRINT "ENTER A SECTOR NUMBER TO CHECK":I
NPUT SNUM
45 IF SNUM<0 OR SNUM>720 THEN 40:REM VALIDI
TY CHECK ON NUMBERS
50 POKE 778,SNUM-(INT(SNUM/256)*256):POKE 7
79,INT(SNUM/256)
51 REM POKES LSB, MSB OF SECTOR INTO 778, 7
79
55 BUFFER=ADR(SEC$):BUFFL=BUFFER-(INT(BUFFE
R/256)*256):BUFFH=INT(BUFFER/256)
56 POKE 772,BUFFL:POKE 773,BUFFH
57 REM POKE ADDRESS OF SEC$ INTO BUFFER ADD
RESS
60 Z=USR(1536):REM CALL UP CIO ROUTINE
70 IF SEC$=CHK$ THEN PRINT "NO DATA IN SECT
OR":GOTO 40
80 PRINT "SECTOR HAS DATA":GOTO 40
DOWNLOAD CKSECT.BAS
Another method to check for sector use is to see if byte 125
($7D) shows a sector has data in it; if not zero, it is being used (it
records the number of bytes used in a sector). You can examine
the sector contents by adding PRINT SEC$ after the read.
PRINT PEEK(771) after reading a sector will display the status; 1
means good, any other number means bad. Check for bad sec-
tors by PEEKing here after any sector read.
The above routine with a few modifications will print a list of all
the sectors on a disk with data in them (best directed to your
printer, but I use the screen display in the example below). This
is a slow and inelegant routine, but you can easily rework it for
your own use.
5 DIM SEC$(128),CHK$(128),CNT(720)
10 DATA 104,32,83,228,96
15 SEC$(1)=CHR$(0):SEC$(128)=SEC$:SEC$(2)=S
EC$:CHK$(1)=CHR$(0):CHK$(128)=CHK$:CHK$(
2)=CHK$
16 REM SETS UP ARRAY SPACE AND FILLS IT
17 REM CHK$ IS FULL OF BLANK SPACES - CONTE
NTS OF UNUSED SECTORS
18 FOR L00P=0 TO 720:CNT(LOOP)=0:REM EMPTY
ARRAY
20 FOR N=1536 TO 1540:READ X:POKE N,X:NEXT
N
25 REM THIS
30 POKE 769,1:POKE 770,82
35 TRAP 100
40 FOR SNUM=1 TO 720
50 POKE 778,SNUM-(INT(SNUM/256)*256):POKE 7
79,INT(SNUM/256)
51 REM POKES LSB, MSB OF SECTOR INTO 778, 7
79
55 BUFFER=ADR(SEC$):BUFFL=BUFFER-(INT(BUFFE
R/256)*256):BUFFH=INT(BUFFER/256)
56 POKE 772,BUFFL:POKE 773,BUFFH
60 Z=USR(1536)
70 IF SEC$=CHK$ THEN CNT(SNUM)=0:NEXT SNUM:
GOTO 100
80 CNT(SNUM)=SNUM:NEXT SNUM
100 FOR LOOP=1 TO 720
110 IF CNT(LOOP)=0 THEN NEXT LOOP:GOTO 150
120 PRINT CNT(LOOP);" ";:NEXT LOOP
150 END
DOWNLOAD PRINTSEC.BAS
To copy one sector to another, use the routine below. Add a
loop routine to copy more than one at a time. This routine
copies all 128 bytes, including the three "record" bytes.
1 DIM SEC$(128,Z$(1)
2 REM SPACE FOR SECTOR DATA
5 DATA 104,32,83,228,96
10 FOR N=1536 TO 1540:READ X:POKE N,X:NEXT
N
15 REM POKE CIO CALL DATA INTO PAGE SIX
20 PRINT "WHAT SECTOR TO COPY FROM?"
25 INPUT START:IF START<0 OR START>720 THEN
25
30 PRINT "WHAT SECTOR TO COPY TO?"
35 INPUT FINISH:IF FINISH<0 OR FINISH>720 O
R FINISH=START THEN 35
40 POKE 770,82:REM READ COMMAND
45 POKE 778,START-(INT(START/256)*256):POKE
779,INT(START/256)
46 REM POKE LSB/MSB OF SECTOR TO COPY
50 LOC=ADR(SEC$):POKE 772,LOC-(INT(LOC/256)
*256):POKE 773,INT(LOC/256)
55 REM POKE LSB/MSB OF ADDRESS OF DATA (SEC
$) INTO BUFFER ADDRESS
60 A=USR(1536):REM READ SECTOR INTO SEC$
70 PRINT "PRESS RETURN TO WRITE SECTOR": INP
UT Z$
80 POKE 770,87:REM WRITE COMMAND
85 POKE 778,FINISH-(INT(FINISH/256)*256):PO
KE 779,INT(FINISH/256)
86 REM POKE LSB/MSB OF SECTOR TO COPY TO
90 A=USR(1536):REM WRITE IT
100 GOTO 20
DOWNLOAD COPYSECT.BAS
See Antic magazine, December 1984, for more information about
device control. Several magazines have published BASIC pro-
grams to edit your disk by sectors, There are also good public
domain programs of this sort on the Atari SIG on CompuServe.
769 301 DUNIT
- Current number of device being used.
771 303 DSTATS
- Status = 1 means good.
784,785 310,311 TIMER2
- Final baud rate timer value.
832-959 340-3BF IOCBs
-
IOCB Address Chart
Label IOCB0 IOCB1 IOCB2 IOCB3 IOCB4 IOCB5 IOCB6 IOCB7 Use
ICHID 832 848 864 880 896 912 928 944 index
ICDNO 833 849 865 881 897 913 929 945 dev #
ICCOM 834 850 866 882 898 914 930 946 command
ICSTA 835 851 867 883 899 915 931 947 status
ICBAL/H 836 852 868 884 900 916 932 948 buffer
ICPTL/H 838 854 870 886 902 918 934 950 put buf
ICBLL/H 840 856 872 888 904 920 936 952 buf len
ICAX1 842 858 874 890 906 922 938 954 task #
ICAX2 843 859 875 891 907 923 939 955 aux2
ICAX3 844 860 876 892 908 924 940 956 sectorl
ICAX4 845 861 877 893 909 925 941 957 sectorh
ICAX5 846 862 878 894 910 926 942 958 byte #
ICAX6 847 863 879 895 911 927 943 959 aux6
1152-1405 480-57D STACK
- A 254-byte BASIC syntax checking stack; $480 is a BASIC input
index, $481 an output index, $482 a program counter.
1536 600 Page Six
- Any I/O greater than 128 bytes in BASIC will wipe out the bot-
tom 128 bytes in page six. This is because the I/O buffer starts at
1408 ($580), a mere 128 bytes below page six.
1792 700 DOS
- Here's a quick routine to read a disk directory in BASIC:
5 DIM R$(20)
10 OPEN #4,6,0,"D:*.*"
20 INPUT #4,R$:TRAP 60
30 PRINT R$
40 IF R$(10,16)="SECTORS" THEN 100
50 GOTO 20
60 PRINT R$
100 CLOSE #4
DOWNLOAD READDIR.BAS
For a quick method of inputting text into a tile, choose Copy
from the DOS menu and answer E:,D:filename. You can now
type directly to a disk file. End each line with RETURN and end
the file with CTRL-3. You can change with backspace, but each
line must have a RETURN in order to be accepted.
Another Digression: Disk Sectors
In a normal disk sector there are 128 bytes, 0 through 127. The
last three bytes are reserved by DOS for:
Byte Use
125 Leftmost six bits: file number (0-63, $3F);
rightmost two bits: next sector number (high two
bits)
126 Next sector number (low eight bits of the sector
number)
127 Number of bytes used in this sector (0-125, $7D)
The next sector to read is in a ten-bit number: eight bits from
byte 126 ($7E) and the two low bits of 125 ($7D). This means the
six leftmost bits remaining in byte 125 can be used only to count
up to 63 (which with zero makes for 64 filenames in one direc-
tory). This is true when reading linked files, such as BASIC pro-
grams or text files; auto-boot programs are usually sequential
and are not linked in this manner (nor are the first four boot
sectors, the VTOC, or directory sectors). When the next sector
number is zero, there are no more sectors to read.
A binary file always begins with 255 ($FF) twice, then four
bytes: the LSB and MSB ot the start and end addresses, respec-
tively, of the data to follow (that is, if they were 00 A0 00 B0, it
would start at $A000 and end at $B000). When a number of
bytes are loaded to fulfill the load vector, DOS assumes the next
four bytes are more start/end address vectors and will continue
to input the following data at the new address unless an EOF
(End Of File) is reached. Control is passed back to DOS at the
end of a load unless you put a new run address into 736,737
($2E0, $2E1). You can append a code like E0 02 E1 02 00 A0 to
your binary file (tour address bytes, tollowed by the appro-
priate data--two bytes to fill the two locations specified), which
in this case makes the new run address $A000. See COMPUTE',
March 1982.
1801 709 SABYTE
- Can be set greater than 7, but it only wastes memory space.
1923 783 ....
- Stores the drive number for the DUPSYS file. It you POKE here
with the ASCII equivalent of the drive number (for example,
POKE 1923,50 for drive 2), when you call DOS from BASIC,
DUP.SYS will be loaded trom the drive specified rather than the
default D1:. To make a permanent change to your DOS, POKE
the appropriate number, go to DOS, and write DOS files to a
disk.
3118 C2E ....
- POKE with 0 to change only the first of matching filenames in
case of duplication error in your directory (normally, Rename
changes all files of the same name). POKE with 184 ($B8) to re-
store. From the OS/A+ manual.
3460 D84 ....
- Deallocation bytes of the VTOC and directory; see the next few
locations.
4226 1082 ....
- LSB of the current directory sector (first of eight reserved sec-
tors). The directory is normally located in sectors 361-368. The
default number here is 105 ($69).
4229 1085 ....
- MSB of current directory sector. To change the location of the
directory, first copy the current sectors to the desired location
(see 768 above), then POKE the new location of the first sector
into the LSB/MSB bytes. That and the next seven sectors will be
recognized as the new directory area. Finally, write the number
for the new start sector (sector number/8 + 10) into 3460 ($D84).
Leave BASIC and rewrite DOS onto a newly formatted disk. DOS
disks with the original directory locations cannot read your
directory.
Disk Directories
Format of a directory entry:
Byte Use
0 Flag:
$00 entry new (never used)
$01 file opened for I/O
$02 file created by DOS 2
$20 file locked
$40 file in use (normal)
$80 file deleted
1-2 Number of sectors in the file
3-4 Starting sector number (LSB/MSB)
5-12 Filename (space or $20 if blank)
13ü15 Extension
4264 10A8 ....
- LSB of the current VTOC (Volume Table Of Contents--only one
sector reserved).
4266 10AA ....
- MSB of the VTOC sector, normally sector 360. The VTOC is a bit-
map of the disk contents; after the initial status bytes, each of
the following bits represents one sector on the disk in sequential
order, There are 720 sectors, but sector 0 cannot be accessed
by the OS. Sectors 1-4 are reserved as "boot" sectors on a DOS
disk, sectors 360-368 are reserved for the VTOC and directory
leaving 707 free for files, You can move the VTOC the same
way you move the directory.
If you change the directory location (make sure there's nothing
in the new directory location that you don't mind erasing first).
go into the VTOC and deallocate the original directory sectors
(write a one into the bits) and write a zero into the bits
representing the new locationüthis prevents them from being
overwritten, You can also lock out sectors by deallocating them
in the VTOC.
Volume Table of Contents
Byte Use
0 DOS code (0 = DOS 2.0)
1-2 Total number of sectors (707; $2C3)
3-4 Number of currently unused sectors
5 Reserved (unused at present)
6-9 Unused
10-99 Bitmap: one bit for each sector (0=in use--
locked; 1=unused--free). The leftmost bit of
byte 10 ($0A) is sector 0 (see above), the next bit
to the right is sector 1, and so on, until the
rightmost bit of byte 99 ($63), which is sector 719
($2CF).
100-127 Unused
There are only 707 sectors counted in bytes 1 and 2 (not 720).
since the first 4 are "boot" sectors, then the VTOC and directory
take another 9, for a total of 13.
A typical DOS 2.0 VTOC with DOS.SYS and DUP.SYS, but nothing
else except the boot, VTOC. and directory sectors in use; it looks
like this:
Byte
0 02 C3 02 50 02 00 00 00
8 00 00 00 00 00 00 00 00
16 00 00 00 00 00 00 00 00
24 01 FF FF FF FF FF FF FF
32 FF FF FF FF FF FF FF FF
40 FF FF FF FF FF FF FF FF
48 FF FF FF FF FF FF FF 00
56 7F FF FF FF FF FF FF FF
64 FF FF FF FF FF FF FF FF
72 FF FF FF FF FF FF FF FF
80 FF FF FF FF FF FF FF FF
88 FF FF FF FF FF FF FF FF
96 FF FF FF FF 00 00 00 00
104 00 00 00 00 00 00 00 00
112 00 00 00 00 00 00 00 00
120 00 00 00 00 00 00 00 00
The VTOC is the leftmost bit ot byte 55 ($37), and the directory
sectors are the remainder of the byte plus the leftmost bit of
byte 56 ($38). The leftmost four bits of byte 10 ($0A) are the boot
sectors, and the remainder of the bytes up to and including the
leftmost seven bits of byte 24 ($18) are in use by DOS and DUP.
Remember that the last three bytes in the VTOC and directory
are not status bytes.
Disk directories and the VTOC (as well as many other disk mys-
teries and delights) are explained in detail in Bill Wilkinson's
Inside Atari DOS from COMPUTE! Books, and are somewhat dis-
cussed in Atari Software Protection Techniques by George Mor-
rison (Alpha Systems, 1983).
4856 12F8 ....
- Should read drive type, not tape.
5446,5450 1546,154A ....
- LSB and MSB of the address the warm start routine places in 10
and 11 (DOSVEC). POKE your RESET handler routine address
here to always load it back into DOSVEC when RESET is
pressed. Point to 6047 ($179F); a USR call to 6047 loads DUP and
sends you to the DOS menu.
5576 15C8 ....
- You can run some machine language programs from within
BASIC by typing OPEN #1,4,0, "D:filename" then
X=USR(5576). CLOSE the channel afterward if you return to
BASIC.
40960 A000 ....
- A USR here will cold start the BASIC cartridge. If you're handy
with machine code, you can add commands to BASIC by trap-
ping the keystrokes before they get passed on to the editor.
Charles Brannon describes how to do this (with a good pro-
gram of commands) in COMPUTE!'s Third Book of Atari.
53260 D00C SIZEM
- POKE with 255 to quadruple the size of all missiles.
53268 D014 PAL
- NTSC systems have 60 frames per second and 262 lines per
frame; PAL systems have 50 frames and 312 lines. Should read
13 decimal, not 14.
53768 D208 AUDCTL
- Frequencies are rounded off; they are actually 63.9210 kilo-
hertz, 15.6999 kilohertz, and 1.78979 megahertz. You can use the
frequency to calculate the POKEY interrupt frequency by
INTFREQ = clock frequency/(2 * (1 + value in AUDF register
for that channel)).
COMPUTE!'s Third Book of Atari has articles by Matt Giwer and
Fred Tedsen on using POKEs to control the sound effects, the au-
dio channels, and AUDCTL.
53770 D20A RANDOM
- For example, random 0 to 9 would be INT(PEEK(53770)
*10/256) and 0 to 99 would be INT(PEEK(53770)*100/256).
54272 D400 DMACTL
- POKE with zero to blank out screen.
54286 D40E NMIEN
- POKE with zero, and VBLANK and system clock are disabled,
and shadowing is suspended. See COMPUTE! magazine, June
1983 (p. 254), for a method of trapping the RESET key in BASIC.
57344 E000 Character set
- See COMPUTE! magazine, June 1983 (p. 226).
58368-58447 E400-E44F Handler vectors
- Each vector consists of a 15-byte table, 2 bytes each for OPEN,
CLOSE, GET byte, PUT byte, Get status, and Special routine ad-
dresses, The next 3 bytes are a JMP instruction followed by the
address of the initialization routine for that handler. A zero
separates handlers (byte 16). Here are the locations for each
routine in the table:
Handler OPEN CLOSE GET PUT Status Special JMP
E: E400 E402 E404 E406 E408 E40A E40C
58368 58370 58372 58374 58376 58378 58380
S: E410 E412 E414 E416 E418 E41A E41C
58384 58386 58388 58390 58392 58394 58396
K: E420 E422 E424 E426 E428 E42A E42C
58400 58402 58404 58406 58408 58410 58412
P: E430 E432 E434 E436 E438 E43A E43C
58416 58418 58420 58422 58424 58426 58428
C: E440 E442 E444 E446 E448 E44A E44C
58432 58434 58436 58438 58440 58442 58444
58451 E453 DSKINV
- Takes its information from the bytes in the lower part of page
three ($300) for operation. The vectors between 58448 and
58496 ($E450-$E480) are all three-byte vectors; a JMP instruction
followed by an address in LSB/MSB format.
58454 E456 CIOV
- Page 147: IOCB number times 16 in the X register. The X register
becomes the CIO channel number. Since the screen is always
open for channel 0, when using the screen you make the X reg-
ister 0 as well. Bill Wilkinson says that to output a single charac-
ter through the CIO instead of an entire buffer (the normal
occurrence), set the buffer length to 0. This forces the I/O to in-
put or output a single character only. See COMPUTE!, January
1985.
58457 E459 SIOV
- Here are the pinouts for the serial I/O jack:
___________________________________
/ \
/ 2 4 6 8 10 12 \
/ \
/ 1 3 5 7 9 11 13 \
/___________________________________________\
1 Clock input 2 Clock output
3 Data input 4 Ground
5 Data output 6 Ground
7 Command 8 Motor control
9 Proceed 10 + 5v dc/Ready
11 Audio input 12 +l2v dc
13 Interrupt
58484 E474 WARMSV
- Do a USR here to warm start the computer.
58487 E477 COLDSV
- Do a USR here to cold start the computer.
59280,81 E790,91 ?
- Seems to be the same DLI vector address as 512-513.
GTIA Graphics Modes
- Graphics modes 9, 10, and 11 are unique to the GTIA chip; the early
CTIA chip didn't have them. Of course, the GTIA is standard now in
all later model 400, 800, XL, and XE models. The GTIA modes all use
8138 bytes of RAM, have 80 X 192 full-screen (no text window)
resolution, and have no border color. Each pixel is a wide, but short,
rectangle with a ratio of 4:1 for width to height. Each pixel uses four
bits. Here's a small chart which summarizes these modes.
GR# Colors SETCOLOR Registers
9 1 (16 lum) 4 712 Use the COLOR command (0-15) for luminance
10 9 0 704 Must be POKEd
1 705 Must be POKEd
2 706 Must be POKEd
3 707 Must be POKEd
4 708 Use COLOR 0
5 709 COLOR 1
6 710 COLOR 2
7 711 COLOR 3
8 712 COLOR 4 (BAK)
11 1 (16 hues) 4 712 Use COLOR command (0-15) for hue
Information on GTIA modes has been published in many books and
magazines, including De Re Atari and Your Atari Computer by Poole
et al. (a revised edition of the latter is available now). An example of
adding a text window to a GTIA screen by way of a DLI was in
David Sander's article in Antic, April 1983.
Return to Table of Contents
| Previous Chapter
| Next Chapter