@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@W!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr d M * @  $ % CC$$)%1 Udߥ$9%: !0 S$%} DD˙`  }J)Lr J  ((  p L ()   J}L= ( L 0q A    IB JC;? D W } LL  ` W )LA!  ߰")-݆ p" } $G@LL 08`Q")<2Q0 -G$Ș݆ UL# ; p8(()(0ʥ)NQ` }$GȘ݆LU )L ݆ L GȘ ݆LL )W>Z   HH)H }p h  hyhy D L> L JJ    ! LA*` BF }7'8  M HN H` 8 Z  \LdJJ!"! GFE@F (!L }EE !E^ ^ E E7EȩEdE/EȩE  D } .L }  ;F d  ;?F7F? ( .   Z D LL d } . D  L    p  E` , d)  D L) 0BM݊L݉} ML  N݆ L NLML [ TEqEHȱEqEh 0Gȹ G} HLL GɛL  LFREE SECTORS G) *Gȩ GȽG GȌ*jj >G} C8jJ3j2CD( C202C ԠBX` N 1? l LlD:RAMDISK}.COMLu L1 L ;LHL  T`  `8  ɐ     `TU  } L ? .  t`GBJ ~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI4 0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D8:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D8:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J  (` 9 V⪍ ઍ  -'}LLu ÝDEHILV 9 .l 9 .l  `` s$B BH(}I|DE V BLV nB,DE JLV B V BLVDEIʩ BꭝLu } 3E:}DISK OPERATING SYSTEM II VERSION COPYRIGHT 1984 ATARI CORP.A. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDG*}E J. DUPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRES+}SF. LOCK FILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES P. FORMAT SINGLEL !N',}#"&))9(&*)/h)''-&؆莟R'S  vL/ˢ L }Insert DOS 2.0s, type Y Λx -}DEfHI 1莏#q! @ y0ɛ8A0,' ȅ 1 1ild! 1L!NO SUCH ITEMSELECT.} ITEM OR FOR MENU! 0 .z:*{}.|{ 1 0 0JB 18L%|DL/}%DIRECTORY--SEARCH SPEC,LIST FILE?[# 0 0 &|D3" 1L!NOT A DISK FILEN !B 1L!E# 1 !BD0}ED:}:1BJ|DE 1DEBHI 1 h0ߢ 0.1}  0?詛 1 y0YЛ 1 ;#L" ;#L! BL1TYPE "Y" TO DELETE...DELETE FILE SPEC2}COPY--FROM, TO?OPTION NOT ALLOWED697 FREE SECTORS COPYING---D8:COPY32.COMl# 0|D .L/%#3}##JB|DE 1BHID#E 1#0: B 1L!#͑### B 1#c$0SY4}S1}:## # # .#Ƚ# # 𩛙## 1,#PD#ELJ- <.BJD#E 5}1 1HH 0hh|DL%1}:̳# L% #D#EL% 1 0 . .0O% 1L!WILD CARDS NOT A6}LLOWED IN DESTINATION 0 <.|K}N 2 FORMAT. t* 5) 1L!`) 0NΞ 0 L1) 1 L!BAD LOAD FILELOAD FROM WHAT FILE?) 0 ?}0#B 1L!WHAT FILE TO LOCK?) 0 0$B 1L!WHAT FILE TO UNLOCK?DUP DISK-SOURCE,DEST DRIVES?TYPE "Y" IF OK TO US@}E PROGRAM AREACAUTION: A "Y" INVALIDATES MEM.SAV.FE! +L1   `*  70 2 2A} 0.* 1 y0 0)INSERT BOTH DISKS, TYPE RETURN^, 1 y038逍 N, 1L! ,B}C, t*  Lx+, 0 ^, 1 y0 , ,0,0 ,L+ ,I0 ,Vǭ0C}Ξ, 0 }, 1 y0C,ШC, 0K'!" H H 'h h Lx+!EF 5L1L!D,I,HhD}` NOT ENOUGH ROOMINSERT SOURCE DISK,TYPE RETURNINSERT DESTINATION DISK,TYPE RETURNE}`  `8 rL1`-* 1P* 1 y0Y`hhL!NAME OF FILE TO MOVE?- 0 0|DL% <.F},^ 1 70 0 .@L# .BJ 1  DEHIB V L1 ,} 1 70,L.  G}JB|,#P#DE 1 HI BDEHHII 1 B 1 ,^ 1 70,0La- B V,#PH},^ 1 70 0L#L!-* 1P* 1 y0Yj383}mm ݭI}}`8}``|* ? ɛ,`|:-)| / 1L!`DESTINATION CANT BE DOJ}S.SYS0 0H{ 24Δ 28/L!/) 2 Π 2 0 ξK}hAΞB,0 J 1 BDEHI,HÝDE 1HIHIDELSAVE-GIVE L}FILE,START,END(,INIT,RUN)O S0 1`BDEPHI V` S0H 1 L!M}0 0 1L~0`PLEASE TYPE 1 LETTER,0`hhL! 70 1L0L<1 ,;ɛ7,"ɛ:ݦ1ݥN}A"D|ݤD|ȩ:|ȩ|ɛ,,(/+.ީ1 1,ɛ`轤{NAMEO} TOO LONG B VL!` L1I H1EΝDL1|mDiE` V0`8d/8 i:222 1 LP}!ERROR- 164ɛ+,' 20*.. өr2 1``2TOO MANY DIGITSINVALID HEXAQ}DECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8uR} ECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8u05  15 2 2151^116115ύ011$r2ԭ5 3)5)5ԭx GT}@@L00)+& 2 L0=ɛ -L!1LV1L1 /3 3ȹ441L-4 v3 25 2H 2h͔5U}L3L3 2 k3U hh`DOC`QL3P1Lk0S1H /3h0B k3@ VL0LU!#$53 1181118V}1111Ε5 1Lk0552 1Ȍ1i111i11115Lk0pppB4f5&&&&&&&&^6f^6&&&&&W}&&A1@BJ D2ELVK@BHILV^Щ6 2BD2EJ VBD5EHI0 V0%5X}5 2iХiL[2 25 25`D:*.*` i@`8 ``@i `8@`0 BLV525<4Y}5`HH i ԍΗ552 ԍhh@ Lح1Э1Ѣ 24.4 24Z}4`D4E` 2BJ k3LVRH` 2BD4EhK)I JLV333 BASIC language TUR > TURBO BASIC OBJ| f}COM > MACHINE language DOC > DOCumentation PIC|MIC|FNT|MVM > Graphics AMS|MUS|MBD > Music LST > BASIC g} LISTing -Some MACHINE language programs can only be run by loading the MENU without BASIC! ------- -For s h}ome programs, XL/XE models may require a "TRANSLATOR" program (available from BELLCOM) to be loaded first! -Most i}programs are relatively self-explanatory; however, some may have separate DOCumentation files. Some BASIC programs m j}ay contain instructions in their program listings. LIST to read. -To view DOCumentation files one page at a time, k} press [START], [Return], or the Joystick Trigger to display the highlighted DOC file. Pressing the [Esc] key cau l}ses a return to MENU. -To print out a hard-copy of any DOCumentation file, [Q]uit the MENU, boot DOS, and then from m} DOS, use the (C)Copy command: D:Filename.DOC,P: -To use this great MENU program on your own disks, simply n} copy the file "AUTORUN.SYS". D:Filename.DOC,P: -To use this great MENU program on your own disks, simply ! ==== ==== ==== ==== ==== ===p}=== == == == == == == == == == [R] _________________________________ q}ATARI * SYSTEM REFERENCE MANUAL _________________________________ A voluntary payment of $1.50 is requested for thisr} SHAREWARE disk. I will give any technical support I can to those who have paid this fee and include a S.A.S.E. withs} their questions. Write to the address on the title page of this Manual: Bob DuHamel, 6915 Casselberry t}Way, San Diego, CA. 92119 This double sided disk contains parts 1 and 2 of an extensive 4- part systems refeu}rence Manual for Atari 8-bit computers, consisting of 20 chapters, plus 3 appendices. The Manual is written for the Av}tari 400/800, but updates for latest XL/XE models are included. The Manual may be read from the SCREEN and/or PRINTED w}out by using the READER.OBJ program included, or it may be dumped to a PRINTER by using your own favourite Word Procex}ssor. It is recommended that the Manual be printed out, due to it's large size and the need for referral. Also, as ty}he Manual is written in 80-columns, it is much easier to read in a printed form. ADDITIONAL PRINz}TING INSTRUCTIONS _____________________ The files on this disk were written with AtariWriter, and for an Epson{} MX80 printer. You should be able to load them into another Word Processor and easily change them to work with it an|}d a different printer. If you have AtariWriter and an Epson compatible printer, load and print each CHAP/APNDX file }}(CHAP1-CHAP20 / APNDXA-APNDXC). Ignore the files with extensions (i.e. CHAP1.1) as they will auto- matically chain to t~}he previous CHAP file. Change the following codes for a different word processor or printer: [CTRL][O]27E starts }NLQ mode " [O]27F stops NLQ mode " [O]27G starts BOLD mode " [O]27H stops BOLD mode " [V]D:... chai}ns new file " [E] page eject " [L] left margin " [R] right margin " [T] top margin (hal}f " [B] bottom margin lines) " [Y] page length " " [C] center " [C][C] right justify} _________________________________ (Advertisement) **************************** * DO YOU PROGRAM IN BA}SIC? * **************************** Add over 40 powerful new commands to Atari and compatible BASICs with the Ata}ri BASIC Power Pack; a function library for Atari BASIC. Just some of it's features are: = High speed disk access d}irectly to strings. = High speed graphics saving and loading. = Custom character set loading. = Mixed text a}nd graphics in mode 8. = English error messages. = Decimal aligned number columns. = Five color, 40 column text} mode. It is written in standard Atari BASIC with some machine language in strings. It's easy to use too because} all commands are called by name, not by address or line number. For information on how to obtain this terrific utility} by Bob DuHamel, write to: |BELLCOM |Public Domain Software Library |P.O. Box 1043, Peterborough |ONTARIO, CANADA} K9J 7A5DuHamel, write to: |BELLCOM |Public Domain Software Library |P.O. Box 1043, Peterborough |ONTARIO, CANADA $d0L 2L>%L-Lx%Lo(L(L(L(L4)L2)L%L%L%L%L%LU,L`,L(L)L,L(L+L$(L".L,L(L'L'L'Lm'Lv'L,L,L'L(L'L'L.L.Lk}.L.L.L.L.L.L.L#*L.*L&L&L.&L=&LF&LQ&Lk&Lr&L{&L&L&L&L)L)L)L)L,.L)L:'L'L&LL'L['LR'L*L*L.L&L&L&La'LB(LR(L}.L(L/L9/L6/L/L/L/L/L0L0L+0LC0L/L^(Lj(L)'L@'Lo/Lr/LO/L%L'L%L% -膚 ɩҍD҅ 2 22}2 a(2222 ` -Lq -l ԤՄԅ`ȱ`ȱ`ȥ`}ԑȥՑ`ԤՄ`ԤԅդՅ` '0=D '04.5 '0.( '0 ' ' 8`ԅ`} & & & &ѐ & &ʥ %аЪ %Зьɛ &0 &0 `}ԥ`Ɠƒ` % &LS* %LS* %օ0֥0 S*` %eԥe` %La* % % o*L% %Lo* % &L|* %L|* %}L% % Ʌ` BLV䅆L' %ԅ`TU HH 'hhL, B VԩL%p v'P}KJBDEL, &fL=) %ԅ`Ę eĘ +L4( % & %` %Ԅԅ`} -``&eԅԥeՅ`L% o(ԨL%Ԅ & %eԥe` Ԅ &ɛ +0` d) ذI} ( 8ԅԩՅL%L,ȹɛ꩛` d)f & 8fԆՅɛ摥0L}?)$0`2 2L,(,ɛM(M( )ɛ )򩀅` %ԍ`ԄL%}ԄL%ɛԆL% &󅐩f =) ؐL(L4,ԅԥՅL%82ԭ 2L%ԤՄԅե`}8ե`eեe` B* K+fL% B* +fL%8ԨՄԅL% & B*ԥՄԩՅօפԥFf G+}ԥ K+ԅՅԥզЦ`ԅՅʩ0B+=+ B+ 08f$˹ `' d }+1ԦԄզՄFԐ eਊe&Lh+Ԇ`hh L, +Ff&֐ݥ ԆՅԠ&&&8થ}օԈ`քע +Ե 8`晄 ,L,`GHFH` U,0ɛȄ ؐL,HI h 8}ԅԩՅL%?S, ,򦅩DEBHIL,ɛ +` +` %HI BL,}՝HIB VL,L%B Vú.hh -l. -0dd-8/ i - 0-- ,}@ . ,... + x' $(.Ԏ.8ե ".LO-- , `,ɛD(C` ذ -L- -L 2 -- ,}L- - -L-l lp '8`ERROR- ?Run address> BASIC exitTrace:P8Յթԅ` ,.L, .-}ȘH *h00,)` & ҅ԭ ) |*օեׅ` L,0թԅթᨊઐ}```Յ`8Յթԅ`0 ԩ`ԅ`` ' %`BԝK)I JD/ELVS:)H)h y}` & % & %TԅUՅV`&B ,NLսM` & %ԝL՝MN%BL, & /` BHIL, & /`}B JKL, %ԅUՅV & %ԅT`)ҩҊ H) hҘ` %)xԩL% %))Lc&LZ& %})pԩL% %)|LZ&Lc& V0L-$2~2'@'@DDhDDL 2 $ppҠD Z$1@ H$ ?$ $ <}G@vD $K@D $5@ !$PD '$5@ !$R22D '$N@hD $Z@D $a@} !$ $D $ h9 Z$ ?$ Z$c@ H$ Z$ -$ᢐD <$2}3թ@D $L*3L}3ԩթ@D $LY3L3ԩթ@D $~33L3@wD $L3 h9}L2 h9 Z$ ?$ Z$@ H$ Z$ -$ᢐD <$ԩթ@D $L43{4L%6ԩթ@}D $L/4L%6ԩթ@D $Ls4@D $Ly4 h9L3 h9|44 Z$ ?$ Z$@ }H$ Z$ -$ᢐD <$ԩթڅ@D $L4LV5ppҠDԩթ@4z5D }$L5LV5ԩթ܅@D $LP5/@ !$PD '$LV5 h9Ly4 h9 Z$ ?$ Z$ޠ@ H$ Z$ -${55}ᢐD <$ԩթڅ@D $L5L%6ԩթ@D $L5L%6ԩթ@}5y6D $L6/@ !$RD '$L%6 h9LV5 h9 Z$ ?$ Z$A H$ Z$ -$ hD <$ԩթ @h}D $z66L6N@hD $L> h9 Z$ ?$ Z$A H$ ?$ Z$ ?$ Z$5A H$ ?$Щ r$LD '$LD !$C@} $L6L7LD6x7 !$?@ $L7L 2L6 Z$1@ H$ ?$8 %vD{D $hD~D $ Z$}{D f$ Q$ Z$y77ᢌD f$ Q$ppҠD =ԩթ@D $L8 Z$1@ }H$ ?$ Z$ ?$ Z$ ?$ Z$ ?$ Z$Q7x8A H$ ?$ Z$ `$FD '$ԩթjAD $L?8 ~; Z$FD !$ }$ᢀ K$FD !$a@ $L8 Z$y88ᢧD K$ ?$L8é r$HD '$RHD !$pA $L8 Z$ ?$ Z}$rA H$ ?$ Z$ ?$L9 Z$ ?$ Z$A H$HD !$ E$8x9A H$ ?$ Z$ T$ Z$ T$0 Z$ T$ppҠD Z$A H$ ?$Щ} r$LD '$LD !$C@ $L_9Lb9L69L 2L$5@ !$OA $$ $y99 Z$ؠA H$ ?$A !$B $$ $ Z$wD K$ ?$}ԩթjAD $L9A !$A@ $$ $ Z$B H$9x: ?$ԩթ@D $LH:}A !$A@ $$ $ Z$ B H$ ?$PD !$5@ $L:A !$B $$ $ Z$By:: H$ ?$PD !$/@ $L:A !$}B $$ $ Z$B H$ ?$RD !$5@ $L:A !$'B $$ $ Z$)B H$ ?$RD !$/@:v; $L$;A !$'B $$ $} Z$,B H$ ?$A !$'@ $$ $ Z$0B H$ ?$A !$'@ $$ $ Z$ hD K$ ?$5@ !$E@w;; $$ $`T r$JD '$}^D !$3@ $L; Z$ ?$ Z$ $L> Z$A@ !$ $ᢀ K$RD !$/@ $L> Z$)D !$ $ᢀ K$-D !$ $}ᢀ K$/D !$n>> $ᢀ K$` Z$1@ H$ ?$/@ !$^D '$8 %vDD $0 Z$ T$ R Z$1@} H$ ?$0 Z$ᢓD f$>l? Q$ppҠD Z$3D H$vD K$7D H$ ?$ Z$ ?$? %/@ !$ND '$0 Z$ }`$`D '$ Z$`D !$ $ᢀm?? K$`D !$a@ $L? Z$ᢧD K$ ?$ ~;ND $BD $LE?é r$HD }'$pA $L?L83@ !$^D '$ ~;R?b@ Z$ ?$0 Z$ T$5@ !$^D '$ Z$1@ H$ ?$ }]. What appears on the screen depends on what graphics mode the computer is in.27GBefore sending data to the screen in BA!?}SIC, a color register must be assigned to the data. Once a point is plotted on the screen, it's color will be determined by !@}the color register it was assigned to.To assign a color to a ploted point, the COLOR command us used as follows.COLOR co!A}mmand format COLOR registerFor example, COLOR 1After using the above command, all points plotted will be controlled !B}by color register 1. To change color registers, use the COLOR command again.27HIn assembly language, the color is determi!C}ned by the data sent to the screen. See the above section on graphics modes for color information.27GIn BASIC the PLOT co!D}mmand is used to put data on the screen. The PLOT command is used as follows.The BASIC PLOT command PLOT x,y 11x and !E}y are the horizontal and vertical coordinates for the plotted point. 10In modes 3 through 11 a single point will be plotte!F}d. In modes 1 and 2 a text character will be printed on the screen by the PLOT command.The PRINT and PUT commands can also!G} be used in basic. What appears on the screen depends on the graphics mode.In modes 1 and 2 the ATASCII characters sent to!H} the screen will be printed just as in mode 0. See the paragraph on modes 1 and 2 above for more information. 27HIn the ot!I}her modes what appears depends on how the ANTIC chip interprets the data bytes sent to the screen. For example, in mode 8, e!J}ven numbered characters will be single pixels in color 1. Odd numbered characters will be in color 0 (background).27GTher!K}e are two special commands for the screen handler, DRAW and FILLDRAW 27H(ICCOM = $11 (17))27GThe draw command works exa!L}ctly like the plot command except a straight line is drawn from the previous pixel to the new one. In BASIC it is used in th!M}e following format.the BASIC DRAW command DRAWTO x,y27HFILL (ICCOM = $12 (18))Fill works like draw except the area!N} to the right of the drawn line will be filled with the color in FILDAT [$02FD (765)]. The fill command expects to find a bo!O}undary to the right. If no boundary is found, the entire horizontal screen between the ends of the line is filled.To use t!P}he fill command in BASIC the XIO command must be used in the following format. POSITION x,y XIO 18 #6,0,0,"E:"Note that !Q}the cursor is first moved by the POSITION command. Below is an example of how to prepare for and use the fill command.usi!R}ng the fill command 2nd DRAWTO .____. DRAWTO here | | | | | | !S}fill to here ! ! PLOT hereThis will draw and fill a box on the screen.27GTHE COLOR REGISTERSThere are nine bytes !T}of memory which control the colors on the screen. These bytes are called color registers. 27HThe color registers have the !U}following names and relationships.D:CHAP8.3. These bytes are called color registers. 27HThe color registers have the 0Color registers and relationships 377Register Register modesname address 0 & 8 %W} 1 & 2 3 5 7 4 & 6 9 & 11 10 HEX decimal COLOR numbersPCOLR0 $02C0 704 %X} 0PCOLR1 $02C1 705 1PCOLR2 $02C2 %Y}706 2PCOLR3 $02C3 707 %Z} 3COLOR0 $02C4 708 0 - 63 1 1 4COLOR1 $02C5 709 1 - 255 64 -127 %[}2 5COLOR2 $02C6 710 0 128-191 3 6COLOR3 $02C7 711 %\} 192-255 7COLOR4 $02C8 712 border backgnd 0 backgnd backgnd 8%]}The color numbers are in decimal. These are actually shadow registers. See the O.S. equates below for relationships. In m%^}odes 0 - 3 the COLOR number actually determines the character printedThe register to which a pixel/character is assigned to%_} is determined by the data byte sent to the screen through CIO. 1070The data in the color registers in in the following fo%`}rmat.Color register data format 7 6 5 4 3 2 1 0 ----------------- | color |bright | %a} ----------------- color = one of 16 possible colors bright = one of 8 possible brightnesses (e%b}ven numbers, 0 - E)27GIn basic, the COLOR command is used to assign color registers. The corresponding registers depends%c} on the graphics mode. For example, COLOR 0 is COLOR2 in mode 8. In most other modes COLOR 0 is COLOR4. See the above char%d}t for the register relationships.To change the contents of the color registers in BASIC, the SETCOLOR command is used. In %e}all modes except mode 10, the SETCOLOR command refers to the registers COLOR0 to COLOR4.SETCOLOR/register relationships%f} SETCOLOR 0 COLPF0 (COLOR0) SETCOLOR 1 COLPF1 (COLOR1) SETCOLOR 2 COLPF2 (COLOR2) SETCOL%g}OR 3 COLPF3 (COLOR3) SETCOLOR 4 COLBK (COLOR4)The format for the SETCOLOR command is...SETCOLOR comma%q} B%DOS SYSB*)DUP SYSB SAUTORUN SYSB_HELP DOCBoMANUAL DOCBBREADER OBJB4CHAP8 B2CHAP8 1 B#3CHAP8 2 B,VCHAP8 3 B!CHAP9 B&CHAP10 B'CHAP10 1 B:CHAP11 B43CHAP12 B3gCHAP13 BCHAP14 nd format SETCOLOR register,hue,brightness register = 0 - 4 (0 - 8 in mode 10) hue = 0 - 15 (16 colors) bright%r}ness = 0 - 16 (even numbers only (8 brightnesses)The following chart gives the colors represented by the hue number.co%s}lors represented by hue numbers0 grey 8 blue1 gold 9 cyan2 gold-orange 10 blue-g%t}reen3 red-orange 11 blue-green4 orange 12 green5 magenta 13 yellow-green6 purple-blu%u}e 14 yellow7 blue 15 yellow-redThe attract modeIf a key is not pressed for more than 9 minutes the %v}computer will enter the attract mode. This mode is used to prevent burning of the TV phosphors by lowering the brightness an%w}d constantly changing the colors. 27HThe attract mode timer, ATRACT [$004D (77)], is set to 254 ($FE) when the the attract %x}mode is entered. 27GTo force the computer out of the attract mode, poke a number less than 127 into ATRACT.27HUseful d%y}atabase variables and OS equates 557APPMHI $000E,2 (14): lower limit for screen regionA%z}TRACT $004D (77): attract mode timer and flagLMARGN $0052 (82): left marginRMARGN $0053 (83): right ma%{}rginROWCRS $0054 (84): horizontal cursor positionCOLCRS $0055,2 (85): vertical cursor positionDINDEX $0057 %|} (87): current graphics modeSAVMSC $0058,2 (88): starting address of display bufferOLDRO%}}W $005A (90): previous cursor positionOLDCOL $005B,2 (91): " " "OLDCHR $005D (93): chara%~}cter currently at the text cursorOLDADR $005E,2 (94): memory address of cursorRAMTOP $006A %} (106): end-of-RAM + 1 (MSB only)SDLSTL $0230,2 (560): shadow register of display list %}addressTXTROW $0290 (656): text window cursor positionTXTCOL $0291,2 (657): " " " "TXTMSC $0294,2%} (660): starting address of text window data bufferRAMSIZ $02E4 (740): permanent end-of%}-RAM + 1 (MSB only)CRSINH $02F0 (752): cursor inhibit, 1 = no curso%}rFILDAT $02FD (765): color data for fillDSPFLG $02FE (766): if >0 screen control codes %} are displayed as ATASCII characters (EOL is uneffected)SSFLAG $02F%}F (767): > 0 = stop screen printCOLPM0 $D012 (53266): actual color registersCOLPM1 $D013 (53267): loaded from%} shadowCOLPM2 $D014 (53268): registers duringCOLPM3 $D015 (53269): vertical blankCOLPF0 $D016 (53270):COLPF1 %}$D017 (53271): see aboveCOLPF2 $D018 (53272): for useCOLPF3 $D019 (53273):COLBK $D020 (53274):OS shad%}ow registersnext pageOS shadow registersPCOLR0 $02C0 (704): COLPM0PCOLR1 $02C1 (705): COLPM1PCOLR2 $%}02C2 (706): COLPM2PCOLR3 $02C3 (707): COLPM3COLOR0 $02C4 (708): COLPF0COLOR1 $02C5 (709): COLPF1C%}OLOR2 $02C6 (710): COLPF2COLOR3 $02C7 (711): COLPF3COLOR4 $02C8 (712): COLBK $02C5 (709): COLPF1C$a12 4 1 5 0 10 70 2 12 1329-@27E27HCHAPTER 9THE RESIDENT DISK HANDLERThe resident disk handler is sepa)}rate from DOS and is part of the permanent operating system ROM. The disk handler does not use CIO.The resident disk handl)}er works with one sector at a time. It is used by setting the drive number, sector number, and operation code in the device )}control block. The program then jumps (JSR) to the handler entry vector, DSKINV [$E453 (58451)].Device control block (for)} resident disk handler) 11DDEVIC [$0300 (768)] Serial bus I.D. Set by handlerDUNIT [$0301 (769)] Drive num)}berDCOMND [$0302 (770)] Command byteDSTATS [$0303 (771)] status byteDBUFLO [$0304 (772)]DBUFHI [$0305 (773)})] 16Pointer to 128 byte memory block for data storage. 11DTIMLO [$0306 (774)] Timeout value (response time limit) )}in secondsDBYTLO [$0308 (776)]DBYTHI [$0309 (777)] number of bytes transferred, set by handlerDAUX1 [$030A (778)])}DAUX2 [$030B (779)] sector number 10DISK HANDLER COMMANDSGET SECTORBefore the JSR to DSKINV is made the follo)}wing parameters are set.GET SECTOR parameters DCOMND = $52 (82) DUNIT = (1 - 4) DBUFHI and DBU)}FLO = address of 128 byte buffer DAUX1 and DAUX2 = Sector number (LSB,MSB)This operation will read the spec)}ified sector and put the data into the specified buffer.PUT SECTORPUT SECTOR is used the same as GET SECTOR except for DC)}OMND.PUT SECTOR parameters DCOMND = $50 (80)This operation sends the data in the specified buffer to the specified)} disk sector.PUT SECTOR WITH VERIFYPUT SECTOR WITH VERIFY is used the same as PUT SECTOR except for DCOMND.PUT SECTOR )}WITH VERIFY parameters DCOMND = $57 (87)This operation sends the data in the specified buffer to the specified disk s)}ector then checks for errors.GET STATUSOnly the DUNIT and DCOMND need to be setGET STATUS parameters DCOMND = )}$53 (83) DUNIT = (1 - 4)The status information will be put in three bytes starting at DVSTAT [$02EA (746)].Statu)}s format 7 6 5 4 3 2 1 0 ----------------- DVSTAT + 0 | command stat | )} ----------------- + 1 | hardware stat | ----------------- )} + 2 | timeout value | -----------------The command status byte gives the following information.)} Bit 0 1 = invalid command frame received 1 1 = invalid data frame received 2 1 = unsuccessful)} PUT operation 3 1 = disk is write protected 4 1 = active/standbyThe hardware status byte contains the sta)}tus register of the ISN1771-1 disk controller chip.The timeout byte contains the maximum allowable response time for the dr)}ive in seconds.FORMAT DISKThe handler will format then verify the the disk. The numbers of all bad sectors (up to 63) wi)}ll be put into the specified buffer followed by two bytes of $FF.The following parameters are set before the call.FORMA)}T parameters DCOMND = $21 (33) DUNIT = (1 - 4) DBUFLO and DBUFHI = address of bad sector list (buf)}fer)After the operation the status byte is set. Also, DBYTLO and DBYTHI will contain the number of bytes of bad sector inf)}ormation (not including the two $FF bytes). 575Useful data base variables and OS equatesDVSTAT $02EA,3 (746): de)}vice status block, 3 bytesDDEVIC $0300 (768): serial bus I.D.DUNIT $0301 (769): device numberDCOMND $0302 )} (770): command byteDSTATS $0303 (771): status byteDBUFLO $0304 (772): data bufferDBUFHI $0305 ()}773): pointerDTIMLO $0306 (774): timeout valueDBYTLO $0308 (776): number of bytes transferedDBYTHI $0309 )} (777):DAUX1 $030A (778): sectorDAUX2 $030B (779): numberDSKINV $E453 (58451): disk handler entr)}y vector:DAUX1 $030A (778): sectorDAUX2 $030B (779): numberDSKINV $E453 (58451): disk handler entr( 12 4 1 5 0 10 70 2 12 13227E2710-@CHAPTER 10SYSTEM INTERRUPTSThere are four types of interrupts whic-}h can occur with the 6502 microprocessor:6502 interrupts 1. chip reset 2. IRQ, interrupt request (maskable-}) 3. MNI (non-maskable interrupt) 4. software interrupt (BRK instruction)CHIP RESETOn the 400/800 the chip -}reset occurs only upon power-up and causes the computer to do a cold start. On later models, pressing [SYSTEM RESET] will ca-}use a chip reset but the computer then does a warm start. On the 400/800, the [SYSTEM RESET] key generates a NMI interrupt.-}COLD STARTThis is a synopsis of the cold start routine. 111 15The warm start flag [$0008] is set to 0 (false) 112 15-}If a cartridge slot contains a diagnostic cartridge, control is handed to the cartridge. 113 15The end of RAM is determine-}d by trying to complement the first byte of each 4K block of memory. 114 15Hardware registers at $D000 - $D4FF (except $D1-}00 - $D1FF) are cleared. 115 15RAM is cleared from $0008 to the top of ram. 116 15The user program jump vector, DOSVEC -}[$000A] is set to point to the black board mode (Atari logo display mode in XL/XE models). 117 15The screen margins are s-}et to 2 and 39 118 15Interrupt vectors are initialized. 119 15Bottom of free RAM pointer, MEMLO [$02E7], is set to poin-}t to $0700. 1110 15Resident CIO handlers are initialized. 1111 15If the [START] key is pressed the cassette boot reques-}t flag, CKEY [$004A], is set. 1112 15The CIO device table is initialized. 1113 15If a cartridge is present it is initia-}lized. 1114 15Channel 0 is opened to the screen editor. The top-of-free-RAM pointer, MEMTOP [$02E5], is set to point belo-}w the screen region. The computer then waits for the screen to be established before continuing. 1115 15If the cassette b-}oot flag is set the cassette is booted. 1116 15If there is no cartridge present or a cartridge doesn't prevent it, the dis-}k is booted. 1117 15The cold start flag is reset. 1118 15If there is a cartridge present, the computer jumps to the car-}tridge's run vector. 1119 15If there is no cartridge present the computer jumps through the vector DOSVEC [$000A (10)]. D-}OSVEC will point to either a booted program, the memo pad routine (400/800) or the logo display routine (XL/XE).WARM START-} 111 15The warm start flag is set to $7F (true). 112 15cold start steps 2 - 4 are executed. 113 15RAM is cleared fr-}om $0010 - $007F and $0200 - $03FF. 114 15Cold start steps 7 - 14 are executed. 115 15If cassette booted software is pr-}esent the computer JSRs through CASINI [$0002]. 116 15If disk booted software is present the computer JSRs through DOSINI -}[$000C (12)]. 10The difference between cold start and warm start is the condition of the warm start flag, WARMST, [$0008].-} If this flag is 0 a complete cold start is executed. If the flag is anything other than 0 then only the warm start part of-} the warm start/cold start code is executed.NON-MASKABLE INTERRUPTS (NMI)NMI interrupts are generated by the following co-}nditions: 111. Display list interrupt, generated by the ANTIC chip.2. TV vertical blank interrupt, generated by the A-}NTIC chip.3. [SYSTEM RESET] key (400/800). 10When an NMI interrupt occurs, the hardware register NMIST [$D40F] is -}examined to determine what type of interrupt occurred. The computer is then directed through the proper ram vector to servic-}e the interrupt.DISPLAY LIST INTERRUPTS (DLIs)The computer makes no use of DLIs. The ram vector points to an RTI instruc-}tion.VERTICAL BLANK INTERRUPTS (VBIs)There are two stages to the VBI service routine. The second stage is only done if-} a critical function was not interrupted.Stage 1 (VBI) 11The real time clock, RTCLOK [$0012 - $0014], is incremented.-}The attract mode variables are processed.System timer 1 is decremented. If it goes to zero the computer JSRs through syst-}em time-out vector 1. 10Stage 2 (VBI) 11The hardware registers are loaded with the data in their shadow registers.Sy-}stem timer 2 is decremented. If it goes to zero the computer JSRs through the system time-out vector 2.System timers 3, 4-}, and 5 are decremented. If a timer goes to zero the computer sets system timer flags 3, 4, and/or 5.If auto-repeat is ac-}tive, the auto-repeat process is done.The keyboard debounce timer is decremented if not 0.Information at the controller p-}ort registers is read, processed and placed in the proper shadow registers. 10[SYSTEM RESET] INTERRUPTIf a [SYSTEM RESET-}] interrupt is generated on the 400/800 the computer jumps to the warm start routine.D:CHAP10.1RRUPTIf a [SYSTEM RESET,dINTERRUPT REQUESTS (maskable interrupts (IRQs))When an IRQ interrupt occurs the hardware register IRQST [$D20E], the PIA st1}atus registers, PACTL [$D302] and PBCTL [$D303] are examined to determine what caused the interrupt.For each interrupt, the1} 6502 accumulator is pushed to the stack. The computer is then directed to the proper ram vector to service the interrupt.1}SOFTWARE INTERRUPT (BRK instruction)The operating system doesn't use software interrupts. The software interrupt vector po1}ints to a PLA followed by an RTI. 11Interrupt vectorsLabel address type functionVDSLST $0200 NMI DLI Points to a1}n RTIVVBLKI $0222 NMI stage 1 VBIVVBLKD $0224 NMI return-from-interrupt routineCDTMA1 $0226 NMI time-out 1 (used 1}by SIO)CDTMA2 $0228 NMI time-out 2 (not used by OS)VPRCED $0202 IRQ not used (points to PLA,RTI)VINTER $0204 IRQ 1}not used (PLA,RTI)VKEYBD $0208 IRQ keyboard interruptVSERIN $020A IRQ used by Serial I/O routineVSEROR $020C IRQ 1}used by SIOVSEROC $020E IRQ used by SIOVTIMR1 $0210 IRQ not used by OS (PLA,RTI)VTIMR2 $0212 IRQ not used by OS (1}PLA,RTI)VTIMR4 $0214 IRQ ?VIMIRQ $0216 IRQ main IRQ codeVBREAK $0206 BRK unused by OS (PLA,RTI) 10SYSTEM TIMER1}SThe following timers are updated during vertical blank (VBI) as noted above. If a timer is decremented to 0 the computer 1}jumps through it's associated vector or sets it's associated flag. 11Label address flag/vectorRTCLOK $0012 3 byte 1}clock ($0012 = MSB)CDTMV1 $0218 CDTMA1 $0226 vector (SIO time-out)CDTMV2 $021A CDTMA2 $0228 vectorCDTMV3 $021C 1}CDTMF3 $022A flagCDTMV4 $021E CDTMF4 $022C flagCDTMV5 $0220 CDTMF5 $022E flagHARDWARE INTERRUPT CONTROLThere a1}re two registers on the antic chip which control interrupts. These registers can be used to disable interrupts if necessary.1} There are also two associated interrupt status registers.The IRQ enable and status registers use the same address. The r1}esult is that reading the register does not reveal the enabled interrupts but the interrupts pending. IRQ interrupt enable d1}ata should usually be written to the OS shadow first. Reading the OS shadow tells which interrupts are enabled.Non maskab1}le interrupt enable 11NMIEN $D40E 7 6 5 4 3 2 1 0 ----------------- | | | not used | 1} ----------------- bit 7 1 = DLI enabled 6 1 = VBI enabled 10Non maskable interrupt status 11NMIST $D41}0F 7 6 5 4 3 2 1 0 ----------------- | | | | not used| ----------------- bit 7 11} = DLI pending 6 1 = VBI pending 5 1 = [SYSTEM RESET] key pending 10Interrupt request enable 11IRQEN $D1}20E 7 6 5 4 3 2 1 0 ----------------- | | | | | | | | | ----------------- bit 7 1}1 = [BREAK] key interrupt enable 6 1 = keyboard interrupt enable 5 1 = serial input interrupt enable 4 1 = 1}serial output interrupt enable 3 1 = serial output-finished interrupt enable 2 1 = timer 4 interrupt enable 1}1 1 = timer 2 interrupt enable 0 1 = timer 1 interrupt enable IRQEN has a shadow register, POKMSK [$0010 (A)].In1}terrupt request status 11IRQST $D20E 7 6 5 4 3 2 1 0 ----------------- | | | | | | | | |1} ----------------- bit 7 1 = [BREAK] key interrupt pending 6 1 = keyboard interrupt pending 5 1 = se1}rial input interrupt pending 4 1 = serial output interrupt pending 3 1 = serial output-finished interrupt pending1} 2 1 = timer 4 interrupt pending 1 1 = timer 2 interrupt pending 0 1 = timer 1 interrupt pending 10WAIT 1}FOR HORIZONTAL SYNCWriting any number to WSYNC [$D40A (54282)] will cause the computer to stop and wait for the next TV hor1}izontal sync.It is wise to use DLIs one TV line before needed then writing to WSYNC. This will keep other interrupts from1} causing DLIs to be serviced late. This can cause a DLI to change something in the middle of a scan line. 5Useful databa1}se variables and OS equatesPOKMSK $0010 (16): IRQEN shadowIRQEN $D20E (53774): enables IRQs when written toIRQ1}ST $D20E (53774); gives IRQs waiting when readPACTL $D302 (54018): bit 7 (read) peripheral A interrupt 1} status bit 0 (write) peripheral A interrupt enablePBCTL $D3031} (54019): bit 7 (read) peripheral B interrupt status bit 0 (write) perip1}heral B interrupt enableWSYNC $D40A (54282): wait for horizontal syncNMIEN $D40E (54286): 1}NMI enableNMIST $D40F (54287): NMI statusleWSYNC $D40A (54282): wait for horizontal syncNMIEN $D40E (54286): 0/12 4 1 5 0 10 70 2 12 13227E27H11-@CHAPTER 11THE FLOATING POINT ARITHMETIC PACKAGEThe routines which5} do floating point arithmetic are a part of the operating system ROM. The Atari computer uses the 6502's decimal math mode. 5} This mode uses numbers represented in packed Binary Coded Decimal (BCD). This means that each byte of a floating point numb5}er holds two decimal digits. The actual method of representing a full number is complicated and probably not very important 5}to a programmer. However, for those with the knowledge to use it, the format is given below.Floating point number represe5}ntation byte 0 xx excess 64 exponent + sign xx \ xx \ 5} xx > 10 BCD digits xx / byte 7 xx /The decimal point is shifted to left of the 6}MSD and the exponent is adjusted accordingly. Therefore, the decimal point doesn't need to be represented.For programming 6}purposes, floating point numbers can be in ASCII code. It takes up to 14 bytes to store a floating point number in this mann6}er. The floating point package has a routine to convert numbers between ASCII and floating point.USE OF THE FLOATING POINT6} PACKAGEThe floating point package has several routines to convert between ASCII and FP and to do the arithmetic functions.6} These are the important data base variables.Floating point data base variablesFR0 $00D4,6 (212): 6 byte buffer6} for floating point numberFR1 $00E0,6 (224): 6 byte buffer for floating point 6} numberCIX $00F2 (242): index for INBUFF addressINBUFF $00F3,2 (243): 2 byte pointer to ASCII floatin6}g point numberFLPTR $00FC,2 (252): 2 byte pointer to user buffer for 6} floating point numberLBUFF $0580,? (1408): result buffer for FASC routineMAKING THE CALLTo do a floating point funct6 }ion, first set the proper pointers and JSR to the operation entry point. Below is a list of the entry points and parameters.6 }ASCII to floating pointConverts ASCII representation pointed to by INBUFF to FP in FR0. AFP = $D800 INBUFF = addre6 }ss of ASCII number CIX = buffer offset if any JSR AFPFLOATING POINT TO ASCIIConverts floating Point number in F6 }R0 to ASCII. The result will be in LBUFF. INBUFF will point to the ASCII number which will have the bit 7 of the last byte 6 }set to 1. FASC = $D8E6 JSR FASCINTEGER TO FLOATING POINT CONVERSION.Converts a 2 byte unsigned integer (0 to 65535)6} in FR0 to floating point in FR0. IFP = $D9AA JSR IFPFLOATING POINT TO INTEGER CONVERSION.Converts floating point 6}number in FR0 to 2 byte integer in FR0. FPI = $D9D2 JSR FPI BCS overflowADDITIONAdds floating point numbers in F6}R0 and FR1 with result in FR0. FADD = $DA66 JSR FADD BCS out of rangeSUBTRACTIONsubtracts FR1 from FR0 with the6} result in FR0. FSUB = $DA60 JSR FSUB BCS out of rangeMULTIPLICATIONMultiplies FR0 by FR1 with the result in FR0.6} FMUL = $DADB JSR FMUL BCS out of rangeDIVISIONDivides FR0 by FR1 with result in FR0. FDIV = $DB28 JSR FDI6}V BCS out of range or divisor is 0LOGARITHMSPuts logarithm of FR0 in FR0 LOG = $DECD LOG10 = $DED1 JSR LOG ;f6}or natural log.or JSR LOG10 ;for base 10 log. BCS negative number or overflowEXPONENTIATIONPut exponentiation of F6}R0 in FR0 EXP = $DDC0 EXP10 = $DDCC JSR EXP ;for e ** Zor JSR EXP10 ;for 10 ** ZPOLYNOMIAL EVALUATIONPuts6} the result of an n degree polynomial evaluation of FR0 in FR0. PLYEVL = $DD40 LDX LSB of pointer to list of floating p6}oint coefficients, ordered high to low. LDY MSB of above LDA number of coefficients in list JSR PLYEVL BCS overflow6}CLEAR FR0Sets FR0 to all zeroes ZFR0 = $DA44 JSR ZFR0CLEAR ZERO PAGE FLOATING POINT NUMBERClears user floating6} point number in page zero. ZF1 = $DA46 LDX address of zero page FP buffer JSR ZF1LOAD FR0 WITH FLOATING POINT N6}UMBERLoads FR0 with user FP number in buffer pointed to by 6502 X and Y registers or by FLPTR. After either operation belo6}w, FLPTR will point to the user FP buffer. FLD0R = $DD89 LDX lsb of pointer LDY msb JSR FLD0Ror FLD0P = $DD8D6} FLPTR = address of FP number JSR FLD0PLOAD FR1 WITH FLOATING POINT NUMBERLoads FR1 with user FP number in buffer po6}inted to by 6502 X and Y registers or by FLPTR. After either operation below, FLPTR will point to the user FP buffer. FLD16}R = $DD98 LDX lsb of pointer LDY msb JSR FLD1Ror FLD1P = $DD9C FLPTR = address of FP number JSR FLD1PSTO6}RE FR0 IN USER BUFFERstores the contents of FR0 in user FP buffer pointed to by 6502 X and Y registers or by FLPTR. After 6 }either operation below, FLPTR will point to the user FP buffer. FST0R = $DDA7 LDX lsb of pointer LDY msb JSR FST0R6!}or FST0P = $DDAB FLPTR = address of FP number JSR FST0PMOVE FR0 TO FR1Moves the contents of FR0 to FR1 FMO6"}VE = $DDB6 JSR FMOVEThe usual use sequence of the floating point package might be to: 11load FR0 and FR1 with FP num6#}bes from user specified buffersdo the maththen store FR0 in a user buffer. 10An alternative might be to: 11convert an6$} ASCII representation to FP (the result is automatically in FR0).move FR0 to FR1.Convert the second ASCII number.Do the6%} math.Convert FR0 back to ASCII.Store the number back into a user buffer. 10The floating point package uses the follow6&}ing blocks of RAM.RAM used by floating point package $00D4 - $00FF $057E - $05FFIf the floating point pac6'}kage is not used the above ram is free. 575Useful data base variables and OS equatesFR0 $00D4,6 (212): syste6(}m FP bufferFR1 $00E0,6 (224): system FP bufferCIX $00F2 (242): INBUFF indexINBUFF $00F3,2 (243): po6)}inter to ASCII FP bufferFLPTR $00FC,2 (252): pointer to user FP bufferLBUFF $0580 (1408): result buffer for FP6*} to ASCIIAFP $D800 (55296): ASCII to FPFASC $D8E6 (55526): FP to ASCIIIFP $D9AA (55722): integer to6+} FPFPI $D9D2 (55762): FP to integerZFR0 $DA44 (55876): clear FR0ZF1 $DA46 (55878): clear zero page 6,}FP bufferFSUB $DA60 (55904): FR0 - FR1FADD $DA66 (55910): FR0 + FR1FMUL $DADB (56027): FR0 * FR1FDIV6-} $DB28 (56104): FR0 / FR1FLD0R $DD89 (56713): load FR0 by X,Y pointerFLD0P $DD8D (56717): load FR0 by FL6.}PTR pointerFLD1R $DD98 (56728): load FR1 by X,Y pointerFLD1P $DD9C (56732): load FR1 by FLPTR pointerFST0R $D6/}DA7 (56743): store FR0 at buffer by X,Y pointerFST1P $DDAB (56747): store FR0 at buffer by FLPTR pointerFMOVE $60}DDB6 (56758): move FR0 to FR1EXP $DDC0 (56768): e exponentiationEXP10 $DDCC (56780): base 10 exponentiat61}ionPLYEVL $DD40 (56640): polynomial evaluationLOG $DECD (57037): natural log of FR0LOG10 $DED1 (57041):62} base 10 log of FR0 (56640): polynomial evaluationLOG $DECD (57037): natural log of FR0LOG10 $DED1 (57041):412 4 1 5 0 10 70 2 12 13227E27H12-@CHAPTER 12Boot software formatsThere are three ways which program:4}s may be booted (loaded automatically upon power-up): From the disk drive From the cassette recorder From a ROM cartrid:5}geDISK BOOTED SOFTWAREThe disk drive is the primary source for programs (other than the BASIC interpreter in the compute:6}r ROM). A program booted from disk must be a machine language program. Secondly, the program is arranged on disk in a diffe:7}rent manner from the DOS files.When the computer is first turned on, it will attempt to read a program starting at sector o:8}ne in disk drive one. The exceptions are, if a cartridge prevents the disk boot process or the [START] key is pressed. The :9}program is expected to use all 128 bytes of each sector.FORMAT OF A DISK BOOTED PROGRAMA disk booted program begins at se::}ctor one on the disk and continues in sequence. The first six bytes of the first sector contain program information. The re:;}st of the bytes contain the program itself.Disk boot program header 1st byte $00 flags, stored in DFLAGS [$0240] :<} $xx number of sectors used by program $xx address to start load $xx :=} $xx initialization address 6th byte $xx 7th byte $xx start of program 11The flags byte is usually unused :>}and should be zero.The load address is stored in BOOTAD [$0242,2 (578)].The initialization address is stored in DOSINI [$:?}000C,2 (12)]. 10After the program is completely loaded the computer will JSR to the address stored in DOSINI for initializ:@}ation. It will then jump to the address stored in DOSVEC to run the program.The initialization part of the program should :A}set the bottom-of-free-RAM pointer, MEMLO [$02E7,2 (743)], to point to the end of the program + 1. This will protect the pro:B}gram from the computer and other programs. The top-of-user-RAM pointer, APPMHI [$000E,2 (14)], is also usually set to point :C}to the same address. This will protect the program from the video hardware. It must also set DOSVEC [$000A,2 (10)] to actua:D}lly point to the run address of the program. The initialization should of course end with and RTS. With DOSINI and DOSVEC p:E}roperly set, the program will restart up pressing the [SYSTEM RESET] key.Rmember that the load address of the program shou:F}ld be six bytes before where you want the program to reside in memory. The six byte header will load at the specified start :G}address followed by the program.CASSETTE BOOTED SOFTWAREThe cassette boot process is nearly identical to the disk boot pr:H}ocess. The processes are so similar that cassette boot programs can usually be transferred directly to disk and vice-versa. :I} The two differences are: 11The cassette is booted instead of the disk if the [START] key is pressed when the power is turn:J}ed on.A bug in early operating systems requires the booted program to turn off the cassette motor with the following comman:K}d. LDA #$3C STA PACTL [$D302] 10CARTRIDGE BOOTED SOFTWAREThe Atari 800 has two cartridge slots. All other model:L}s have only one. The second cartridge slot, slot B on the 800, resides from $8000 to $9FFF. The first slot, slot A, resides:M} from $A000 to BFFF. If a cartridge is inserted in a slot it will disable any RAM in the same area.Slot A, which is presen:N}t in all models, can reside at the entire 16K used by both cartridges in the 800 ($8000 to $BFFF).Cartridges use the last s:O}ix bytes for boot information. In cartridge A these bytes are from $BFFA to $BFFF. In cartridge B they are from $9FFA to 9F:P}FF.last six bytes of a cartridge $9FFA or $BFFA xx start address xx 00 :Q} xx flag byte xx init address $9FFF or $BFFF xx Flag byte bit 0 1 :R}= allow disk boot bit 2 0 = do not start cartridge after init bit 7 1 = cartridge takes control before OS i:S}s initializedThe initialization process for the cartridge should be similar to that for disk and cassett:T}e. A minimum of an RTS instruction is required.The third byte of the cartridge tailer is used by the OS to check for the p:U}resence of a cartridge. This byte must be zero.A 16K cartridge will use both cartridge areas and the cartridge B tailer ar:V}ea can be used for program code.THE CARTRIDGE HARDWAREMost cartridges consist of two ROM chips on a single circuit board.:W} Moreover, both chip sockets have identical pin assignments. In other words, the chips can be switched to opposite sockets :X}and the cartridge will still work. The difference is in the chips themselves. On one chip, the A12 pin acts as an active-l:Y}ow chip select. On the other the A12 pin acts as an active-high chip select. Therefore the state of the A12 pin selects bet:Z}ween the two chips.Cartridge slot pin assignments BACK 111111 543210987654:[}321 --------------- --------------- SRPNMLKJHFEDCBA FRONT 15 :\} 1 1 = 16K A A13 (16K only) 2 A3 B GND 3 A2 C A4 4 A1 D A5 :]} 5 A0 E A6 6 D4 F A7 7 D5 H A8 8 D8 J A9 __ 9 D:^}1 K A12 (CS)/(CS) 10 D0 L D3 11 D6 __ M D7 12 (CS) N A11 13 +V:_}cc P A10 14 +Vcc R NC 15 NC S NC 10The BASIC interpreter resides in the memory use:`}d by cartridge A. In 400, 800 and 1200XL models, a BASIC cartridge is required to run BASIC programs. On other XL and XE mo:a}dels, inserting a cartridge into the slot or pressing the [OPTION] key upon power-up will disable the internal BASIC ROM. If:b} BASIC is disabled without inserting another cartridge, the area from $A000 to $BFFF will contain RAM. 575Useful data ba:c}se variables and OS equatesAPPMHI $000E,2 (14): low limit of screen regionDOSVEC $000A,2 (10): run and progra:d}m reset vectorDOSINI $000C,2 (12): init and reset initCARTB $8000 (32768): start of cartridge BCARTA $A000 :e} (40960): start of cartridge APACTL $D302 (54018): port A control register Bit 3 contr:f}ols the cassette motorrtridge APACTL $D302 (54018): port A control register Bit 3 contr812 4 1 5 0 10 70 2 12 13227E27H13-@CHAPTER 13THE SERIAL INPUT/OUTPUT INTERFACE (SIO)Most input and o>h}utput with the Atari computer passes through the serial I/O bus. The SIO interface is rather complicated but you are unlikel>i}y to need to use it directly. CIO usually handles SIO for you. However, if you want to design your own I/O device and it's >j}associated handler, you need to know how to use the SIO.SIO transfers data at a rate of 19,200 baud on separate input and o>k}utput lines. The data is sent one byte at a time, LSB first, in an asynchronous format. There are also clock-in and clock-o>l}ut lines. There is a signal on the clock-out line but it is not used by any present devices. The clock-in line is available>m} for synchronous transfer but is not used by the OS. The signal on the clock-out line goes high at the leading edge of each >n}bit and goes low in the middle of each bit.One byte of SIO data +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ >o} | | | | | | | | | | | | | | | | clock -------------+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +------ ---------+ >p} +---+ +-------+ +-------- | 0 | 1 | 0 | 1 1 | 0 0 | 1 data +-------+ +---+ >q} +-------+ | | start bit stop bit>r}The SIO interface is used much like the resident disk handler. In fact, it uses the same device control block as the residen>s}t disk handler. After the control block parameters are set, a JSR is made to the SIO entry vector, SIOV, at $E459 (58457).>t}Device control block (for SIO) 11DDEVIC [$0300 (768)] Serial bus I.D. Set by handler or program.DUNIT [$0301 >u}(769)] Device number if more than one.DCOMND [$0302 (770)] Device command byte.DSTATS [$0303 (771)] 16Befor>v}e the SIO call, this byte tells whether the operation is read, write or that there is no data transfer associated with the co>w}mmand. After the call this byte will hold the status (error/no error code) of the operation. 10DSTATS format before comm>x}and 7 6 5 4 3 2 1 0 ----------------- |W|R| not used | ----------------- 11If both W>y} and R are 0, there is no data transfer.DBUFLO [$0304 (772)]DBUFHI [$0305 (773)] 16Points to the data buffer for either >z}input or output. 11DTIMLO [$0306 (774)] 16Timeout value (response time limit) in 64/60ths of a second to be set by handle>{}r or program. 11DBYTLO [$0308 (776)]DBYTHI [$0309 (777)] 16Number of bytes to be transferred, set by handler or program.>|} This parameter is not required if the DSTATS specifies no data transfer. 11DAUX1 [$030A (778)]DAUX2 [$030B (779)] 16>}}These parameters are sent to the device as part of the command frame. 10USING THE SIO INTERFACEAll commands on the seri>~}al bus must originate from the computer. The peripherals will present data on the bus only when commanded to do so.Any ope>}ration on the serial bus begins with a five byte command frame. While the command frame is being sent, the command line of t>}he serial connector is 0.Command frame format $xx DDEVIC $xx DCOMND $xx DAUX1 >}$xx DAUX2 $xx checksumThe first four bytes of the command frame come from the device control block. the checks>}um is the sum of the other four bytes with the carry added back after each addition.If both R and W of the DSTATS are 0, no>} data is sent to, or expected from the peripheral, after a command frame is sent. However, the device is usually expected to>} send an ACK byte ($41) after the command frame is sent. If the command frame is invalid, an NAK byte ($4E) should be sent.>}If the operation is output (W = 1) the computer will send a data frame after it receives the ACK of the command frame. It t>}hen expects an ACK after the data frame is sent.If the operation is an input (R = 1) the computer expects a data frame from>} the peripheral after the ACK. With either input or output, a "complete" code ($43) should be sent to the computer when the >}operation is finished. The "complete" code would follow the ACK of the data frame with an output operation.If the operatio>}n is not completed for some reason, the peripheral should send an error code ($45) instead of "complete".SIO data frame>} byte 1 $xx\ > data bytes byte n $xx/ byte n+1 $xx checksumSIO commandsREAD >} $52WRITE $57STATUS $53PUT $50FORMAT $21DOWNLOAD $20READADDR $54READ SPIN $51MOTOR ON $55VERI>}FY SECTOR $56Present SIO device I.D.sDISK $31 - $34 (D1 - D4)PRINTER $40RS-232-C $50 - $53 (R1 - R4)T>}HE SERIAL CONNECTORThe serial connectors on the computer and all peripherials are identical. Nearly all peripherials have >}two serial connectors. Either connector may be used for any connection. The serial bus is designed so that peripherials can>} be daisy-chained together. The following is a diagram of the serial connector.The serial connector pin-out >} 1 1 2 4 6 8 0 2 ----------- /o o o o o o\ /o o o o o o>} o\ ----------------- 1 3 5 7 9 1 1 1 3 15 1 clock in (to computer) 2 >} clock out 3 data in 4 GND 5 data out 6 GND 7 command (active low) 8 cassette motor control 9 proceed (active l>}ow)10 +5V/ready11 audio in12 +12V (400/800)13 interrupt (active low) 14Proceed goes to pin 40 (CA1) of the PIA. It>} is not used by present peripherials.Interrupt goes to pin 18 (CB1) of the PIA. It is not used by present peripherials.P>}in 10 doubles as a 50mA +5V peripharal power supply and a computer ready signal. 575Useful database variables and OS eq>}uatesSIOV $E459 (58457): serial port handler entryDDEVIC $0300 (768): device IDDUNIT $0301 (769): >}device numberDCOMND $0302 (770): command byteDSTATS $0303 (771): status byteDBUFLO $0304 (772): data >}buffer pointerDBUFHI $0305 (773):DTIMLO $0306 (774): timout valueDBYTLO $0308 (776): number of bytes >}to transferDBYTHI $0309 (777):DAUX1 $030A (778): sent to deviceDAUX2 $030B (779): sent to devices <{12 4 1 5 0 10 70 2 12 13227E27H14-@CHAPTER 14THE HARDWARE CHIPS27GThe previous chapters described tB}he operating system of the computer. The following chapters will examine the hardware which supports the 6502 and the hardwaB}re's associated software.THE GTIA CHIPThe GTIA (George's Television Interface Adapter) is the main video circuit in the cB}omputer. It controls the following functions.GTIA functions 11Priority of overlapping objectsColor and brightness, inB}cluding information from the antic chip.Player/missile control.console switches and game control triggers. 10THE ANTIC B}CHIPThe main job of the ANTIC chip is interpreting the display buffer for the GTIA chip. The ANTIC chip is somewhat of a pB}rocessor in it's own right. The program which runs it is called the display list and usually resides just before the displayB} buffer in memory.The ANTIC chip operates independent of the 6502. It operates by direct memory access (DMA). The ANTIC cB}hip gives a HALT signal the 6502, causing the 6502 to give up control of the address bus. The ANTIC chip can then read any dB}ata it needs to from memory.ANTIC chip functions 11DMA (Direct Memory Access) control.NMI (Non-Maskable Interrupt) conB}trol.LIGHT PEN READINGWSYNC (wait for horizontal sync) 10THE POKEY CHIPThe most important jobs of the POKEY chip areB} reading the keyboard and operating the serial port. It also has the following functions.POKEY chip functions 11KeyboarB}d reading.Serial port.Pot (game paddles) reading.Sound generation.System timers.IRQ (maskable interrupt) control.B}Random number generator. 10THE PIA CHIPThe PIA (Parallel Interface Adapter) is a commonly used I/O chip. It consists ofB} two 8 bit parallel ports with hand shaking lines. In the Atari, it has the following functions. 11Game controller port cB}ontrol (bi-directional).Peripheral control and interrupt lines. 10Registers in the hardware chips are treated as memoryB} addresses. Many of the registers are write only. These registers cannot be read from after they are written to. Other regB}isters control one function when written to and give the status of an entirely different function when read from. Still otheB}r registers are strobes. Any command which causes the address of one of these registers to appear on the address bus will caB}use their functions to be performed.The write only registers have shadow registers in RAM. Data to be put in the registersB} is usually put into the shadow registers. The data in the shadow registers is automatically moved to the operating registerB}s during vertical blank.For register use and address, see the previous chaptes on the associated functions.rating register@n