#@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`  `1  ɐ     `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.D1:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D1: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 }M D D D D %BB! % 9* v% w%u % D %LJ& fffffff>`<*}|0`̌8l8pv00````00 0f< x||||-}|||~|l8l8lfff< 0`@`0 000006c!"|™.}|™|~x|™|as22sa>2222r|晒xLLLLNB|晁晉|™||™/}v|~Þ~fdddd||晙d8晙™晙dd|2x`x`~<~~<"#30 ~ <~~<0}|~~||~~||>````~~8<8<||1}~~~|0000~l8|ll8l~ 8`8pp##82}$ %0$1$3$4$ ?̏?1$4$ॄ``ex$w$e{$z$褄 x${3}$`(mDeXYi????)^̜D)DȄ?Čei?̜D@L$4}i( %&L$??`??????8??Ƌ拑` T8` 8` n%D5} %LJ&} T8t?????@:@CD(DDi?18?8?8?@K????` -??6} $ &= Y%&'?L' &= Y%?`'XRUT`H)h)` i@LG&8 `DCIDID $ 87}Х)LS&ЭC?H &hɛL&,C0ɜf) `{\\X^T_PHC^? e,h .&) C8} $8??''i?i? 'LJ&?'?'LJ&ʊ &HIHd'Hc'H`# \^_|}~2k)9}9:+O)29+,0];'3A/1/s)l32'))(m(( ):--,+<,+4,++d,CIC`"I"` (8??8??? ??:} $8?内?凅((?m???i? $L'`8???? ????8?? ??`8??;}`??`ЭD(DDΝD $ '} T8L &L'ЭDΜDΜDD $ '} T8L &ƇƆL'<}Ƌ^^()`8eiL'^` 懥͒?^eiL'??L'=}??8̓??? $LC)s)s)`)))))`Ƌ ^`^Ƌ͂?L)ƌ >}L(L)??L')*^懥͒?LC)懥͒?LC)^L4)??????}`8??hh``8Ie?Ie?????8?m?͉? &۠= Y%?`???m?@}??m?? $????8?傅*+?僅 $8??????` K* ( h*8????` n( K* ( h*L+A}L. 9*2 &= Y% o%H &h)_ @W K* (Lh*S K* )Lh*P K* ;-Lh*`8????ХL'??B}L+͒???L++,L+ee8?傅?僅8傍?働? $8??????`C} @LO, @ O,L4) @ {, @` @ @ {,L'?m @?m @ͅ?hhL,m @m @8?倅?偅D} M$?m @??m @?`?It?`= Y% 8)})Y`,-Э`2 & > Y% ,L & % %LJ&^懥͒?E}LC)L4)Ƌ^Ƌ̓?L)8ee8内包LM-L'@ԩ-0F}1-XYȑȑ`ppp-.A-Hs) ԍЍ)Х  h@ЭG} 9* &> Y%I $I2 o%)_ @W . )L.S . )L.P . -L. 'L &??`8??H}?? *?? $L5.'U?? T8~ T8? o%?,C09 .n/CL.ɛE~L.~ T8L.) }̓?𻥌)I}Ю ? T8CL.?`2 &Ϡ= Y% ,L &D D D D Lto/j0CL|/C??L/CJ}8?勪,C0ɛ^L/ .&L/^L/ 2` &9> Y% [00@ w/p?D?E8??H??I B V0 oK}/ ';0 LX1H o/h!H} T8Q> Y%h v8 P0 -?` &Y> Y%L70C BLVpCCH@k0f1 .h? &hhL- P0CL}D?E?HICJBLV8??ą &s> Y% [0L0 % 0L0LX1CDE8?冝HM}?凝IB V`CHm??Im???e??e? /??` P0L0} T8ig1b2> Y%L70@ԭs)N})`????8* &?.??.??.??.? ??L1? ?8??????L1?`8????O}?? ? &> Y%?`m?m?8?倅?偅eͅ? &> Y%?` M$?m???c2^3m??P}?? $L'ȱȊ`)?! ;I@Ln(H)h)` @@L2i `Э& &? Y% .@L &?@̔?Q}L &@@S@ .&ъ 拥͒?6@ei?Ō?卐8@@@ '` _3Z4& ? Y%R}?` &8???? v8?`KE:P@HH8@@@@1pHI B@ V( 0LJ&hh@`S} &נ>LY%L5ЭL= &> Y% o1 [0L5 o1 3?? @ @C3? @@3t@??[4V5@T}@?@L5^)@@@?挐?@?ȱ?8ei@ 5@ 58.@??䅎@ 7 5@U}? 258??<:? ?? 25?E T8> Y% o% '; -} T8 &LJ&LX48?@0 5??兎B W5V}R65 7 5 5 5@@?8@@@@ &> Y% o% 3??䅎A 5 7?@0 5` ?@ 3`?m@W}@ 5` 3C 3` @) 25656 @L.7ʊ @6HHG6HF6H`8@eiLX4^@`wlrtbsnhf%p?xmqi6666X}66S6N766766x6n6e6'7P7ȩ@L*6 1@L*6 1@?@L*6 1@?@L*6 1?L*6?L*6 1?L*6 1?L*6 1?LY}*6 1?L*6 1?L*6@ȘH 25h@` 7?A?L*6ȱ^` 7?B?L*6 7L*6ȱ @Ls4 1H @)Z}hd@ *6LO7-86^ 2???`CC 0L3 % 0L3hhpCLN4̏?0 2 3 @  3_ 3L[}7`@) @ 2c8@?J8? 3@L7e8??8? L7u @I @#@@@ q8@L7 @d@ 3L7.8)9 B V\}nD8EHIBLV䌡8HI B V䬡8`E:Lx8Dԅ ؠH),D0 T8L8 3h0``]}D 8D)?<D)@`I@`D9,P a{)ɀ`H2ҢҠh`lj;k+*opui-=vc*99bx^}z436521, .nm/reytwq907~8<>fhdgsaLJ:K\^OPUI_|VCBXZ$#&%"![ ]NM?REYTWQ()'@}FHDGSA {  _} ` }9: 2@ : 2@ &: $L9L &Э# &? Y% .:@?<@̔?`}L &8@@e@@ee8?傅?僅 $8?@???:@) @ @ {,<@ .&:@m:@ia}L':; ';pD>EHIJB V0\DDdDeDDD L;0?+K T8 L;03D L;0) T8DD. T8L: b} L;ƌL:p B VpC`H T8h T8 L;0 T8LA;pHIBLV o1 .8 o1R} T8 : =DDDΘDΘD = o%c};a;<)_ݼ;L<ʊ ;H;H`+*-=RLUF12345678 ;<<0<<<<<=========G=%= =DL< =DDd} DDDL; =D8L< =Di͘DުL<>C) 2 C C.ʎDC`pBDHIDe}CELV CL^;pCJ C< w<0% % 00} T8 - &LJ&T T8LT8@ '; Y=Q> Y%@ v8 T8g}> Y% o% =L< I==` Y=? Y%>LT8=>`124 chr=1 sector.PAGE 6 WRITERExit to DOSBuffer FullDelete (S,W,P):h} Are You Sure? (Y/N)ERASE ALL TEXTErase (S,W,P): to exitSave (Device:Filename)>Error #BREAK Key AbortNo ErrorsLi}oad (Device:Filename)> Press D1:*.*Memory Ful>?lNo text in bufferPrint (Device:Filename)>Printing...Insert nexj}t sheet, press Find:Not FoundChange To: -Exit ̭oad ̭elete ormat nlock ock ename Drive #k}Rename to:Format Diskrive #w0080THIS BOOK WAS TYPED TO DISK FOR THE USE OF ALL ATARI USERS. ENJOY.TYPED BYMOONRAKER (JOHN)PINEAPPLE (ANDREA)m}TORPEDO (PAUL)DRAWINGS BY TORPEDOWE DID IT FOR YOU IN 1992.DE RE ATARI 400/800. THE BOOK.CONTENTSILLUSTRATIONn}S1-1 Coarse memory map for atari 400/8001-2 Atari 400/800 hardware layout2-1 Antic mode line requirements3-1 Color ro}egister labels and addresses3-2 Character encoding3-3 Color register selection for characters3-4 Energy bar tm bar charp}ts3-5 Terrain map with character set graphics4-1 Non contiguous ram images4-2 Player missile ram area layout4-3 Maskiq}ng a player for more resolution4-4 Using a player as a special character5-1 Examples of vertical screen architecture6-1 r} Arranging screen ram6-2 Linking the scroll to coarse scroll7-1 Diagram of bit flow of a shift register7-2 Divide by fos}ur diagram7-3 AUDC1-4 bit assignment7-4 Five-bit poly-counter7-5 Selection type function used to mix in distortion7-6 t} Available poly-counter combinations7-7 AUDC1-4 block diagram7-8 Sounds produced by distortion combinations at several fru}equencies7-9 Audctl bit assignment7-10 The effect of a high-pass filter inserted in channel 1 and clocked by channel 37-1v}1 Two sine waves at different frequencies and their sum7-12 Music notes played on a standard music routine7-13 Graphed tablw}e of frequencies that possibly duplicate a piano key7-14 Example of the three notes of fig. 10-10 played with a piano envelox}pe7-15 Graphed sine wave data for volume only program8-1 I/O subsystem8-2 OS and BASIC pointers (DOS present)8-3 Resety} memlo8-4 Protecting programs from user input error8-5 Vertical blank interrupt execution8-6 Rom jump vectors8-7 Ram z}vectors8-8 I/O subsystemrams from user input error8-5 Vertical blank interrupt execution8-6 Rom jump vectors8-7 Ram 00808-9 INPUT/OUTPUT control block (IOCB)8-10 Device Control Block (DCB)8-11 CIO routine8-12 Handler address table |}(HATABS)8-13 Printer handler entry point table8-14 Null handler8-15 SIO call to dump line to printer8-16 Basic direct CIO }} call8-17 Real-time clock8-18 Basic language metronome clock8-19 Assembly language metronome routine8-20 Floating point r ~}outines9-1 Auxiliary byte layout for the open command9-2 Note and point values9-3 Note and point example10-1 Example l }ine of tokenized input10-2 OS and BASIC pointers (no DOS present)C-1 Daisychained peripheral equipmentC-2E-1 Bit pattern }in prior selects GTIAE-2 Background color register ORed with pixel data to give data colorE-3 Background color register ORe }d with pixel to give final colorE-4 color register numbers and location and color command referenceround color register ORe e0080PREFACE1 System overview2 Antic and the display list Television displays ................ 2-1 } Computers and televisions .......... 2-2 Antic, a video microprocessor ...... 2-3 Building dis}play lists ............. 2-6 Writing to a custom display list screen 2-8 Applications of display l}ists 2-93 Graphics indirection (color registers and character sets) Color registers ............}........ 3-1 Character sets ..................... 3-4 Applications of character sets ..... } 3-54 Player missile graphics Difficulties with high-speed animation 4-1 Player missile fundamentals ..}...... 4-3 Vertical motion .................... 4-3 Horizontal motion .................. } 4-4 Other player missile features ...... 4-4 Missiles ........................... 4-5 }Player and playfield priorities .... 4-6 Hardware collision detection ....... 4-6 Applications }of player missile graphics 4-9 Special characters ................. 4-115 Display lists interrupts } theory of operation ................ 5-1 DLI timing ......................... 5-2 DLI example} ........................ 5-3 Attract mode ....................... 5-4 Detailed timing consider}ations ..... 5-4 Multiple DLI's ..................... 5-6 Kernels ............................ } 5-7 Applications of display list interrupts 5-86 Scrolling Horizontal scrolling ............... } 6-2 Fine scrolling ..................... 6-5 Applications of scrolling .......... 6-}8 6-2 Fine scrolling ..................... 6-5 Applications of scrolling .......... 6-00807 Sound Definition of terms and conventions 7-1 Sound hardware ..................... } 7-2 AUDF 1-4 ........................... 7-2 AUDC 1-4 ........................... 7-3 Volu}me ............................. 7-3 Distortion ......................... 7-3 AUDCTL ..........}................... 7-9 16-Bit frequency options ........... 7-10 High pass filters ...........}....... 7-12 9-Bit polynomial conversion ........ 7-13 Sound generation techniques ........ } 7-14 Static sound ....................... 7-14 Dynamic sound ...................... 7-}16 Basic sound ........................ 7-16 60-Hz interrupt .................... 7-18 Machi}ne code sound generation ...... 7-19 Volume only sound .................. 7-218 Operating syste}m Introduction ....................... 8-1 The monitor ........................ 8-3 Memory m}anagement .................. 8-8 Interrupt processing structure ..... 8-12 System vectors .....}................ 8-20 The centralized Input/Output subsystem 8-22 Real-time programming .........}..... 8-38 Floating point package ............. 8-459 The disk operating system The resident} disk handler .......... 9-1 File management system ............. 9-3 Disk utility package ....}........... 9-6 Random access ...................... 9-11 FMS disk utilization ............... } 9-13 AUTORUN.SYS file ................... 9-1710 Atari BASIC overview What is atari basic? ..}............. 10-1 How atari basic works .............. 10-2 The tokenizing process ...........}.. 10-3 The token file structure ........... 10-8 The program execution process ...... } 10-11 System interaction ................. 10-13 Improving program performance ...... 10-15} Advanced programming techniques .... 10-18AppendicesA/ Memory utilizationB/ Human engineeringC/ Atari ca}ssette overviewD/ Television artifactsE/ GTIAGlossary8AppendicesA/ Memory utilizationB/ Human engineeringC/ Atari ca90080Preface This manual is about the ATARI Home Computer. It covers both the ATARI 400 and the ATARI 800 computers.} These two computers are electrically identical, differing only in mechanical features such as the keyboards and cartridge sl}ots. The purpose of this is to explain in detail how to use all the features of the atari computer. Because this is a complex} and powerful machine, the explanations are accordingly rather long. Furthermore, they demand some expertise on the part of t}he reader. This book is not intended for the beginning programmer. The reader should be thoroughly familiar with the basic re}ference manual, which is provided with the computer. Familiarity with assembly language is also essential. A glossery in the }back defines and explains some of the less commonly encountered jargon. However, this glossary does not include terms that ev}ery serious personal computer programmer should already know. Written as a training manual for professional programmers wh}o use the atari home computer, this book may be modified for general use at some later date. It does not supplant the technic}al reference manual (atari part number co16555), which is a reference for programmers who already understand the system. This} book is intended to be a tutorial that explains ideas and possibilities rather than defining registers and control codes. } The title, DE RE ATARI, is pronounced "Day Ray Atari". It is an obscure literary reference. Some latin manuscripts in roman }and medieval times were entitled "de re this" or "de re that". Thus, "de re rustica" was a poem on farming and "de re metalli}ca" described metallurgy. Loosely translated, "de re" means "all about". Most of the word processing for the book was carr}ied out with atari computers. A source file editor was used for text editing, and a modified version of forms (available from} atari program exchange) was used to format and print the text. A letter-quality printer was used for output. Some sections w}ere developed with a conventional word processor. The software development support group wrote this book. Chris Crawford w}rote sections 1 through 6 and appendices a and b. Lane Winner wrote section 10 and appendix d with assistance from Jim Cox. A}my Chen wrote appendix c. Jim Dunion wrote sections 8 and 9. Kathleen Pitta wrote appendix e. Bob Fraser wrote section 7. Gus} Makreas prepared the glossary. The final result has many flaws, but we are proud of it.End of preface pagee section 7. Gusm00801System overview The atari home computer is a second-generation personal computer. First and foremost, it is }a consumer computer. The thrust of the design is to make the consumer comfortable with the computer. This consumer orientatio}n manifests itself in many ways. First, the machine is proofed against consumer mistakes by such things as polarized connecto}rs that will not go in the wrong way, a power interlock on the lid to the internal electronics, and a pair of plastic shields} protecting the system reset key. Second, the machine has a great deal of graphics power; people respond to pictures much mor}e readily then to text. Third, the machine has strong sound capabilities. Again, people respond to direct sensory input bette}r than to indirect textual messages. Finally, the computer has joysticks and paddles for more direct tactile input than is po}ssible with keyboards. The point here is not that the computer has lots of features but rather that the features are all part} of a consistant design philosophy aimed directly at the consumer. The designer who does not appreciate this fundamental fact} will find himself working against the grain of the system. The internal layout of the atari 400/800 computer is very diff}erent from other systems. It of course has a microprocessor (a 6502), ram, rom, and a (pia). However, it also has three speci}al-purpose (lsi) chips known as antic, ctia, and pokey. These chips were designed by atari engineers primarily to take much o}f the burden of housekeeping off of the 6502, therby freeing the 6502 to concentrate on computations. While they were at it, }they designed agreat deal of power into these chips. Each of these chips is almost as big (in terms of silicon area) as a 650}2, so the three of them together provide a tremendous amount of power. Mastering the atari 400/800 computers is primarily a m}atter of mastering these three chips. Antic is a microprocessor dedicated to the television display. It is a true micropro}cessor; it has an instruction set, a program (called the display list), and data. The display list and the display data are w}ritten into ram by the 6502. Antic retrieves this information from ram using direct memory access (dma). It processes the hig}her level instructions in the display list and translates these instructions into a real-time stream of simple instructions t}o ctia. Ctia is a television interface chip. Antic directly controls most of ctia's operations, but the 6502 can be progra}mmed to intercede and control some or all of ctia's functions. Ctia converts the digital commands from antic (or the 6502) in}to the signal that goes to the television. Ctia also adds some factors of its own, such as color values, player-missile graph}ics, and collision detection. Pokey is a digital input-output (i/o) chip. It handles such disparate tasks as the serial i/}o bus, audio generation, keyboard scan, and random number generation. It also digitizes the resistive paddle inputs and contr}ols maskable interrupt (irq) requests from peripherals. All four of these lsi chips function simultaneously. Careful seper}ation of their functions in the design phase has minimized conflicts between the chips.page 1-1 above The only hardware le}vel conflict between any two chips in the system occurs when antic needs to use the address and data buses to fetch its displ}ay information. To do this, it halts the 6502 and takes control of the buses.se the address and data buses to fetch its displM0080 As with all 6502 systems, the i/o is memory-mapped. Figure 1-1 presents the coarse memory map for the computer. }Figure 1-2 shows the hardware arrangement. With no dos with dos 2.0sOperating sys ram: :operating sys ra }m ---: 0000 :--- : : : 1000 : : : dos 2.0s } : 2000 :--- : : : 3000 : : : free : 4000 : } free ram : : ram space : 5000 : space : : : }6000 : : : : 7000 : : : : 8000 : } : : : 9000 : : : ---: a000 :--- : : Bas }ic or other: b000 :basic or other 8k cartridge : :8k cartridge ---: c000 :--- unallocated: }:unallocated ---: d000 :--- hardware i/o: :hardware i/o ---: e000 :--- operating syste }m: :operating sys rom : f000 : rom : : : ffff :page 1-2 above.e |0080system overviewpaddletriggers---------->:---: :pia:joystick : :---------->: :<--.keyboard $} : : :controllers: : :---------->:---: : :---: : : p : :paddles : o :<---->:-----: $} :-----:---------->: k : : :disk : :other: : e : : :drive:<->:peri.:keyboard : y : : :-----: :--$}---:---------->: :<--: :---: : : : keyboard : : speaker : $} : === : : """ : : v : : : : : : $} ------:-->:---:joystick triggers : :c.g:-------------------:-->:t.t: sound : :i.i:-->--->$}-. :==>:a.a: picture:console switches : : :->->-. :-------------------:-->:---: : : $} : : :-----: : : :tele : : : :vision $} : : :-----: :-----: : : :antic:->-:-->--' :-----:light pen: :<==: :right:-$}------->:-----: : ===>:cart.: : : :-----: :-----' :-----: $} : :-->: os : : : : rom : :-----: : : :-----: :6502 :<==: : $} :-----: : --->:-----: : :left : : :cart.: $} : :-----: :-----: : :-----: : os : : :user : : ram :<--:-->:ram : :-$}----: :-----:ATARI 400/800--: : :-----: : os : : :user : : ram :<--:-->:ram : :-$"00802ANTIC AND THE DISPLAY LISTTELEVISION DISPLAYS To understand the graphics capabilities of the atari home co(}mputer, one must first understand the rudiments of how a television set works. Television sets use what is called a raster sc(}an display system. An electron beam is generated at the rear of the television tube and shot toward the televisions screen. A(}long the way, it passes between sets of horizontal and vertical coils which, if energized, can deflect the beam. In this way (}the beam can be made to strike any point on the screen. The electronics inside the television cause the the beam to sweep acr(}oss the television screen in a regular fashion. The beam's intensity can also be controlled. If you make the beam more intens(}e, the spot in the screen that it strikes will glow brightly; if you make it less intense, the spot will glow dimly or not at(} all. The beam starts at the top-left corner of the screen and traces horizontally across the screen. As it sweeps across (}the screen, its changes in intensity paint an image on the screen. When it reaches the right edge of the screen, it is turned(} off and brought back to the left side of the screen. At the same time it is moved down just a notch. It then turns back on a(}nd sweeps across the screen again. This process is repeated for a total of 262 sweeps across the screen. (there are actually (}525 sweeps across the screen in an alternating system known as "interlace." we will ignore interlace and act as if the televi(}sion has only 262 lines.) These 262 lines fill the screen from top to bottom. At the bottom of the screen (after the 262nd li(}ne is drawn), the electron beam is turned off and returned to the upper left corner of the screen. Then it starts the cycle a(}ll over again. This entire cycle happens 60 times every second. Now for some jargon: a single trace of the beam across the(} screen is called a "horizontal scan line." a horizontal scan line is the fundamental unit of measurement of vertical distanc(}e on the screen. You state the height of an image by specifying the number of horizontal scan lines it spans. The period duri(}ng which the beam returns from the right edge to the left edge is called the "horizontal blank." The period during which the )}beam returns to the top of the screen is called the "vertical blank." the entire process of drawing a screen takes 16,684 mic)}roseconds. The vertical blank period is about 1400 microseconds. The horizontal blank takes 14 microseconds. A single horizon)}tal line takes 64 microseconds. Most television sets are designed with "overscan"; that means they spread the image out so)} the picture edges are off the edge of the television tube. This guarantees that you have no unsightly borders in your televi)}sion picture. It is very bad for computers, though, because screen information that is off the edge of the picture does you n)}o good. For this reason the picture that the computer puts out must be somewhat smaller than the television can theoretically)} display. Therefore, only 192 horizontal scan lines are normally used by the atari display. Thus, the normal limit of resolut)}ion of a television set used with this computer is 192 pixels vertically.page 2-1 above hus, the normal limit of resolut(]0080 The standard unit of horizontal distance is the "color clock." You specify the width of an image by stating how - }many color clocks wide it is. There are 228 color clocks in a single horizontal scan line, of which a maximum of 176 are actu- }ally visible. Thus, the ultimate limit for full-color horizontal resolution with a standard color television is 176 pixels. I- }t is possible with the atari home computer system to go even finer and control individual half-clocks. This gives a horizonta- }l resolution of 352 pixels. However, use of this feature will produce interesting color effects known as color artifacts. Col- }or artifacts can be a nuisance if they are not desired; they can be a boon to the programmer who desires additional color and-} is not fazed by their restrictions.Computers and televisions The fundamental problem any microcomputer has in using a -}raster scan televsion for display purposes is that the television display is a dynamic process; because of this, the televisi-}on does not remember the image. Conseqently, the computer must remember the screen image and constantly send a signal to the -}television telling it what to display. This process of sending information to the television is a continuous process and it r-}equires full-time attention. For this reason most microcomputers have special hardware circuits that handle the television. T-}he basic arrangement is the same on virtually all systems:Microprocessor--->screen ram--->video hardware--->tv screenThe m-}icroprocessor writes information to the screen ram area that holds the screen data. The video hardware is constantly dipping -}into this ram area, getting screen data that it converts into television signals. These signals go to the television which th-}en displays the information. The screen memory is mapped onto the screen in the same order that it follows in ram. That is, t-}he first byte in the screen memory maps to the top-left corner of the screen, the second byte maps one position to the right,-} then the third, the fourth, and so on to the last byte which is mapped to the lower right corner of the screen. The quali-}ty of the image that gets to the screen depends on two factors: the quality of the video hardware, and the quantity of screen-} ram used for the display. The simplest arrangement is that used by trs-80 and pet. (trs-80 is a trademark of radio shack co;-} pet is a trademark of commodore business machines.) Both of these machines allocate a specific 1k of ram as screen memory. T-}he video hardware circuits simply pull data out of this area, interpret it as characters (using a character set in rom), and -}put the resulting characters onto the screen. Each byte represents one character, allowing a choice of 256 different characte-}rs in the character set. With 1k of screen ram, one thousand characters can be displayed on the screen. There isn't much that-} can be done with this arrangement. The apple uses more advanced video hardware. (Apple is a trademark of apple computers.) T- }hree graphics modes are provided: text, lo-resolution graphics, and hi-resolution graphics. The text graphics mode operates i-!}n much the same way that the pet and trs-80 displays operate.s, and hi-resolution graphics. The text graphics mode operates i,=0080In the low-resolution graphics mode, the video hardware reaches into screen memory and interprets it differently. I1#}nstead of interpreting each byte as a character, each byte is interpreted as a pair of color nybbles. The value of each nybbl1$}e specifies the color of a single pixel. In the high-resolution graphics mode each bit in screen memory is mapped to a single1%} pixel. If the bit is on, the pixel gets color in it; if the bit is off, the pixel stays dark. The situation is complicated b1&}y a variety of design nuances in the apple, but that is the basic idea. The important idea is that the apple has three displa1'}y modes; three completely different ways of interpreting the data in screen memory. The apple video hardware is smart enough 1(}to interpret a screen memory byte as either an 8-bit character (text mode), two 4-bit color nybbles (lo-resolution mode), or 1)}7 individual bits for a bit map (hi-resolution mode).ANTIC, A VIDEO MICROPROCESSOR The atari 400/800 display list system 1*}represents a generalization of these systems. Where pet and trs-80 have one mode and apple has three modes, the atari 400/8001+} has 14 modes. The second important difference is that display modes can be mixed on the screen. That is, the user is not res1,}tricted to a choice between a screenful of text or a screenful of graphics. Any collection of the 14 graphics modes can be di1-}splayed on the screen. The third important difference is that the screen ram can be located anywhere in the address space of 1.}the computer and moved around while the program is running, while the other machines use fixed-screen ram areas. All of th1/}is generality is made possible by a video microprocessor called antic. Where the earlier systems used rather simple video cir10}cuitry, atari designed a full-scale microprocessor just to handle the intricacies of the television display. Antic is a true 11}microprocessor; it has an instruction set, a program, and data. The program for antic is called the display list. The display12} list specifies three things: where the screen data may be found, what display modes to use to interpret the screen data, and13} what special display options (if any) should be implemented. When using the display list, it is important to shed the old vi14}ew of a screen as a homogeneous image in a single mode and see it instead as a stack of "mode lines." A mode line is a collec15}tion of horizontal scan lines. It stretches horizontally all the way across the screen. A graphics 2 mode line is 16 horizont16}al scan lines high, while a graphics 7 mode line is only two scan lines high. Many graphics modes available from basic are ho17}mogeneous; an entire screen of a single mode is set up. Do not limit your imagination to this pattern; with the display list 18}you can create any sequence of mode lines down the screen. The display list is a collection of code bytes that specify that s19}equence. Antic's instruction set is rather simple. There are four classes of instructions: map mode, character mode, blank1:} line, and jump. Map mode instructions cause antic to display a mode line with simple colored pixels (no characters). Charact1;}er mode instructions cause antic to display a mode line with characters in it. Blank line instructions cause antic to display1<} a number of horizontal scan lines with solid background color. Jump instructions are analogous to a 6502 jmp instruction; th1=}ey reload antic's program counter.page 2-3 aboveground color. Jump instructions are analogous to a 6502 jmp instruction; th020080 There are also four special options that can sometimes be specified by setting a designed bit in the antic instr5?}uction. These options are: display list interrupt (dli), load memory scan (lms), vertical scroll, and horizontal scroll. M5@}ap mode instructions cause antic to display a mode line containing pixels with solid color in them. The color displayed comes5A} from a color register. The color register is specified by the value of the screen data. In four-color map modes (basic modes5B} 3,5, and 7, and antic modes 8,a,d, and e), a pair of bits is required to specify a color:Value of bit pair color registe5C}r used 00 0 colbak 01 1 colpfo 10 2 colpf1 11 3 5D} colpf2Since only two bits are needed to specify one pixel, 4 pixels are encoded in each screen data byte. For exampl5E}e, a byte of screen data containing the value $1b would display 4 pixels; the first would be color register 1, and the fourth5F} would be color register 2: $1b = 00011011 = 00 01 10 11In two-color map modes (basic modes 4,6, and 8, and a5G}ntic modes 9,b,c, and f) each bit specifies one of two color registers. A bit value of 0 selects background color for the pix5H}el and a bit value of 1 selects color register 0 for the pixel. Eight pixels can be stored in one screen data byte. There 5I}are eight different map display modes. They differ in the number of colors they display (2 VS 4), the vertical size one mode 5J}line occupies (1 scan line, 2, 4, or 8), and the number of pixels that fit horizontally into one mode line (40,80,160, or 3205K}). Thus, some map modes give better resolution; these will of course require more screen ram. Figure 2-1 presents this inform5L}ation for all modes.page 2-4 aboveresolution; these will of course require more screen ram. Figure 2-1 presents this inform4$0080Antic basic no. Scan lines/ pixels/ bytes/ bytes/Mode mode colors mode line mode line line 9N} screen 2 0 2 8 40 40 960 3 none 2 10 40 40 79O}60 4 none 4 8 40 40 960 5 none 4 16 40 40 480 9P}6 1 5 8 20 20 480 7 2 5 16 20 20 240 8 9Q} 3 4 8 40 10 240 9 4 2 4 80 10 480 A 5 9R} 4 4 80 20 960 B 6 2 2 160 20 1920 C none 29S} 1 160 20 3840 D 7 4 2 160 40 3840 E none 4 9T} 1 160 40 7680 F 8 2 1 320 40 7680FIGURE 2-1 ANTIC MODE LIN9U}E REQUIREMENTS Character mode instructions cause antic to display a mode line with characters in it. Each byte in screen r9V}am specifies one character. There are six character display modes. Character displays are discussed in section 3. Blank li9W}ne instructions produce blank lines with solid background color. There are eight blank line instructions; they specify skippi9X}ng one through eight blank lines. There are two jump instructions. The first (jmp) is a direct jump; it reloads antic's pr9Y}ogram counter with a new address that follows the jmp instruction as an operand. Its only function is to provide a solution t9Z}o a tricky problem: antic's program counter has only 10 bits of counter and six bits of latch and so the display list cannot 9[}cross a 1k boundary. If the display list must cross a 1k boundary then it must use a jmp instruction to hop over the boundary9\}. Note that this means that display lists are not fully relocatable The second jump instruction (jvb) is more commonly use9]}d. It reloads the program counter with the value in the operand and waits for the television to perform a vertical blank. Thi9^}s instruction is normally used to terminate a display list by jumping back up to the top of the display list. Jumping up to t9_}he top of the display list turns it into an infinite loop; waiting for vertical blank ensures that the infinite loop is synch9`}ronized to the display cycle of the television. Both jmp and jvb are 3-byte instructions; the first byte is the opcode, the s9a}econd and third bytes are the address to jump to (low then high). The four special options mentioned previously will be di9b}scussed in section 5 and 6.page 2-5 abovep to (low then high). The four special options mentioned previously will be di8,0080 The load memory scan (lms) option must have a preliminary explanation. This option is selected by setting bit 6 of=d} a map mode or a character mode instruction byte. When antic encounters such an instruction, it will load its memory scan cou=e}nter with the following 2 bytes. This memory scan counter tells antic where the screen ram is. It will begin fetching display=f} data from this area. The lms instruction is a 3-byte instruction: 1 byte opcode followed by 2 bytes of operand. In simple di=g}splay lists the lms instruction is used only once, at the beginning of the display list. It may sometimes be necessary to use=q}b%DOS SYSbC)AUTORUN SYSblDERE1 b{DERE2 bDERE3 bDERE4 bDERE5 bDERE6 b DERE7 bDERE8 bDERE9 bDERE10 b"DERE11 b>DERE12 bMDERE13 bcDERE14 b ~DERE15 BDERE16 bDERE17 BDERE18 b DERE19 bDERE20 bDERE21 bDERE22 bDERE23 b/DERE24 bBDERE25 bUDERE26 bhDERE27 bDERE28 bDERE29 bDERE30 bDERE31 #DERE32 #DERE33 #DERE34 #DERE35 # 1DERE36 # =DERE37 #JDERE38 #oRWORDPROCINS# RAMDISK COM#README DOC a second lms instruction. The need arises when the screen ram area crosses a 4k boundary. The memory scan counter has only 1=r}2 bits of counter and 4 bits of latch; thus, the display data cannot cross a 4k boundary. In this case an lms instruction mus=s}t be used to jump the memory scan counter over the boundary. Note that this means that display data is not fully relocatable.=t} Lms instructions have wider uses which will be discussed later.BUILDING DISPLAY LISTS Every display list should start of=u}f with three "blank 8 lines" instructions. This is to defeat vertical overscan by bringing the beginning of the display 24 sc=v}an lines down. After this is done, the first display line should be specified. Simultaneously, the lms should be used to tell=w} antic where it will find the screen ram. Then follows the display list proper, which lists the display bytes for the mode li=x}nes on the screen. The total number of horizontal scan lines produced by the display list should always be 192 or less; antic=y} does not maintain the screen timing requirements of the television. If you give antic too many scan lines to display it will=z} do so, but the television screen will probably roll. Displaying fewer than 192 scan lines will cause no problems; indeed, it={} will decrease 6502 execution time by reducing the number of cycles stolen by antic. The programmer must calculate the sum of=|} the horizontal scan lines produced by the display list and verify it. The display list terminates with a jvb instruction. He=}}re is a typical display list for a standard basic graphics mode 0 (all values are in hexadecimal):page 2-6 aboveuction. He<s008070 blank 8 lines70 blank 8 lines70 blank 8 lines42 display ANTIC mode 2 (BASIC mode 0)20 also, screenA} memory starts at 7C207C02 display ANTIC mode 20202020202020202020202020202020202020202020241 juA}mp and wait for vertical blankE0 to display list which starts at7b $7BE0 As you can see, this display list is shortA}---only 32 bytes. Most display lists are less than 100 bytes long. Furthermore, they are quite simple in structure and easy tA}o set up. To implement your own display list, you must first design the display format. This is best done on paper. Lay ouA}t the screen image and translate it into a sequence of mode lines. Keep track of the scan line count of your display by lookiA}ng up the scan line requirements of the various modes in figure 2-1. Translate the sequence of mode lines into a sequence of A}antic mode bytes. Put three "blank 8 lines" bytes ($70) at the top of the list. Set bit 6 of the first display byte (that is,A} make the upper nybble a 4). This makes a load memory scan command. Follow with 2 bytes which specify the address of the screA}en ram (low then high). Then follow with the rest of the display bytes. At the end of your display list put in the jvb instruA}ction ($41) and the address of the top of the display list. Now store all of these bytes into ram. They can be anywhere you wA}ant; just make sure they don't overlay something else and your jvb points to the top of the display list.page 2-7 aboveu w@z0072The display list must not cross a 1k address boundary. If you absolutely must have it cross such a boundary, insertE} a jmp instruction just in front of the boundary. The jmp instruction's operand is the address of the first byte on the otherE} side of the boundary. Next you must turn off antic for a fraction of a second while you rewrite its display list pointer. DoE} this by writing a 0 into sdmctl at location $22f. Then store the address of the new display list into $230 and $231 (low theE}n high). Lastly, turn antic back on with a $22 into sdmctl. During the vertical blank, while antic is quiet, the operating syE}stem (os) will reload antic's program counter with these values.WRITING TO A CUSTOM DISPLAY LIST SCREEN Screen memory canE} be placed anywhere in the address space of the computer. Normally the display instruction---the initial lms instruction. HowE}ever, antic can execute a new lms instruction with each display line of the display list if this is desired. In this way infoE}rmation from all over the address space of the computer can be displayed on a single screen. This can be of value in setting E}up independent text windows. There are several restrictions in your placement of the screen memory. First, screen memory cE}annot cross a 4k address boundary. If you cannot avoid crossing a 4k boundary (as would be the case in basic mode 8, which usE}es 8k of ram) you must reload the memory scan counter with a new lms instruction. Second, if you wish to use any of the operaE}ting system screen routines you must abide by the conventions the os uses. This can be particularly difficult when using a moE}dified display list in a basic program. If you alter a standard display list from a basic program and then attempt to print oE}r plot to the screen, the os will do so under the assumption that the display list is unchanged. This will probably result inE} a garbled display. There are three ways the display can fail when you attempt this. First, basic may refuse to carry out E}a screen operation because it is impossible to do in the graphics mode that the os thinks it is in. The os stores the value oE}f the graphics mode that it thinks is on the screen in address $57. You can fool the os into cooperating by poking a differenE}t value there. Poke the basic mode number, not the antic mode number. The second failure you might get arises when you mixE} mode lines with different screen memory byte requirements. Some mode lines require 40 bytes per line, some require 20 bytes E}per line, and some require only 10 bytes per line. Let's say that you insert one 20-byte mode line into a display list with 4E}0 byte mode lines. Then you print text to the display. Everything above the interloper line is fine, but below it the charactE}ers are shifted 20 spaces to the right. This is because the os assumed that each line would require 40 bytes and positioned tE}he characters accordingly. But antic, when it encountered the interloper line, took only 20 bytes of what the os thought shouE}ld be a 40-byte line. Antic interpreted the other 20 bytes as belonging to the next line, and displayed them there. This resuE}lted in the next line and all lines being shifted 20 spaces to the right.page 2-8 aboveand displayed them there. This resuDZ0080The only absolute way around this problem is to refrain from using basic printS and plotS to output to a custom disI}play list screen. The quick-and-dirty solution is to organize the screen into line groups that contain integer multiples of tI}he standard byte requirement. That is, do not insert a 20-byte mode line into a 40-byte display; instead insert two 20-byte lI}ines or one 20-byte line and two 10-byte lines. So long as you retain the proper integer multiples, the horizontal shift willI} be avoided. This solution accentuates the third problem with mixed display lists and basic: vertical shifts. The os positI}ions screen material vertically by calculating the number of bytes to skip down from the top of the screen. In a standard 40-I}byte line display, basic would position the characters onto the tenth line by skipping 360 bytes from the beginning. If you hI}ave inserted four 10-byte lines, basic will end up three lines further down the screen than you would otherwise expect. FurthI}ermore, different mode lines consume different numbers of scan lines, so the position on the screen will not be quite what yoI}u expected if you do not take scan line costs into account. As you can see, mixed mode displays can be difficult to use inI} conjunction with the os. Often you must fool the os to make such displays work. To print or plot to a mode window, poke the I}basic mode number of that window to address $57, then poke the address of the top left pixel of the mode window into locationI}s $58 and $59 (low then high). In character modes, execute a position 0,0 to home the cursor to the left-top corner of the moI}de window. In map modes, all plotS and drawtoS will be made using the top-left corner of the mode window as the origin of theI} coordinate system. The display list system can be used to produce appealing screen displays. Its most obvious use is for I}mixing text and graphics. For example, you could prepare a screen with a bold basic mode 2 title, a medium size basic mode 1 I}subtitle, and small basic mode 0 fine print. You could then throw in a basic mode 8 picture in the middle with some more textI} at the bottom. A good example of this technique is provided by the display in the atari states and capitals program. The I}aforementioned problems will discourage the extensive use of such techniques from basic. With assembly language routines, modI}ified display lists are best used by organizing the screen into a series of windows, each window having its own lms instructiI}on and its own independent ram area.APPLICATIONS OF DISPLAY LISTS One simple application of display list modifications isI} to vertically space lines on the screen by inserting blank line bytes. This will add some vertical spacing which will highliI}ght critical messages and enhance the readability of some displays. Another important use of display list manipulations isI} in providing access to features not available from basic. page 2-9 aboveer important use of display list manipulations isHL0072There are three text modes supported by antic that basic does not support. Only display list manipulations gain theM} user access to these modes. There are also display list interrupt and fine scrolling capabilities that are only available afM}ter the display list is modified. These features are the subjects of sections 5 and 6. Manipulations with the lms instructM}ion and its operand offer many possiblities to the creative programmer. For example, by changing the lms during vertical blanM}k, the programmer can alternate screen images. This can be done at slow speed to change between predrawn displays without havM}ing to redraw each one. Each display would continue to reside in (and consume) ram even while it is not in use, but it would M}be available almost instantly. This technique can also be used for animation. By flipping through a sequence of displays, cycM}lic animation can be achieved. The program to do this would manipulate only 2 address bytes to display many thousands of byteM}s of ram. It is also possible to superimpose images by flipping screens at high speed. The human eye has a time resolutionM} of about 1/16 of a second, so a program can cycle between four images, one every 1/60 of a second, so that each repeats everM}y 1/15 of a second. In this way, up to four images can appear to reside simultaneously on the screen. Of course, there are soM}me drawbacks to this method. First, four seperate displays may well cost a lot of ram. Second, each display image will be wasM}hed out because it only shows up one quarter of the time. This means that the background of all displays must be black, and eM}ach image must be bright. Furthermore, there will be some unpleasant screen flicker when this technique is used. A conservatiM}ve programmer might consider cycling between only three or even only two images. This technique can also be used to extend thM}e color and luminosity resolution of the computer. By cycling between four versions of the same image, each version stressingM} one color or luminosity range, a wider range of colors and luminosities is available. For example, suppose you wish to displM}ay a bar of many different luminances. First set your four color registers to the values: Background: M} 00 Playfield 1: 02 Playfield 2: 0a Playfield 3: 0cpagM}e 2-10 above Playfield 1: 02 Playfield 2: 0a Playfield 3: 0cpagL 0080Now put the following images into each of the screen ram areas:pixel contents (by playfield color register)FirsQ}t frame 1 1 1 1 2 3 2 3 2 3 2 3Second frame b 1 1 1 b b 2 3 2 3 2 3Third frameQ} b b 1 1 b b b b 2 3 2 3Fourth frame b b b 1 b b b b b b 2 3Effective luminancQ}e *4 2 4 6 8 10 12 20 24 30 36 40 48Perceived luminance :- ---------------- -------------------- Q} 1 2 3 4 5 6 7 8 9 10 11 12 ---------------- --------------------The perceived luminance Q}is signified by the number 1 being very light and the number 6 being medium and the number 12 being the darkest or black. DueQ} to limitations of drawing with a 1027 printer it is necessary to show you in this manner. The actual book shows a picture ofQ} squares with a few dots at number 1 and gaining in quantity as you go through the numbers where 12 is fully black. In this Q}way, much finer luminance resolution is possible. A final suggestion concerns a subject that is laden with opportunities bQ}ut little understood as yet: the dynamic display list. This is a display list which the 6502 changes during vertical blank peQ}riods. It should be possible to produce interesting effects with such lists. For example, a text editing program dynamically Q}inserts blank lines above and below the screen line being edited set it apart from the other lines of text. As the cursor is Q}moved vertically, the display list is changed. The technique is odd but very effective.page 2-11 abovext. As the cursor is Ph00803GRAPHICS INDIRECTION(COLOR REGISTERS AND CHARACTER SETS) Indirection is a powerful concept in programming. U}In 65O2 assembly language, there are three levels of indirection in referring to numbers. The first and most direct level is U}the immediate addressing mode in which the number itself is directly stated : lda #$f4The second level of indirection is reaU}ched when the program refers to a memory location that holds the number : lda $O6O2The third and highest level of indirectioU}n with the 65O2 is attained when the program refers to a pair of memory locations which together contain the address of the mU}emory location that holds the number. In the 65O2, this indirection is complicated by the addition of an index : lda ($dO),yU}Indirection provides a greater degree of generality (and hence power) to the programmer. Instead of trucking out the same oldU} numbers every time you want to get something done, you can simply point to them. By changing the pointer, you can change theU} behavior of the program. Indirection is obviously an important capability.COLOR REGISTERS Graphics indiection is built inU}to the atari home computer in two ways : with color registers and with character sets. Programmers first approaching this comU}puter after programming other systems often think in terms of direct colors. A color register is a more complex beast than a U}color. A color specifies a permanent value. A color register is indirect : it holds any color value. The difference between tU}he two is analogous to the difference between a box-end wrench and a socket wrench. The box-end wrench comes in one size onlyU} but a socket wrench can hold almost any size socket. A socket wrench is more flexible but takes a little more skill to use pU}roperly. Similarly, a color register is more flexible than a color but takes more skill to use effectively.There are nine coU}lor registers in the atari 4OO/8OO computer; four are for player missile graphics and will be discussed in section 4. The remU}aining five are not always used; as few as two registers or as many as five will show up on the screen. In basic mode O, onlyU} two and one-half registers are used because the hue value of the characters is ignored; characters take the same hue as playU}field register 2 but take their luminance from register 1. The color registers are in ctia at addresses $dO16 through $dO1a. U}They are "shadowed" from os ram locations into ctia during vertical blank. Figure 3-1 gives color register shadow and hardwarU}e addresses.page 3-1 aboveram locations into ctia during vertical blank. Figure 3-1 gives color register shadow and hardwarT0080 Image hardware os shadowControlled label address label address Player O colpmO dO12 pcolrO 2cY}O Player 1 colpm1 dO13 pcolr1 2c1 Player 2 colpm2 dO14 pcolr2 2c2 Player 3 colpm3 dO15 pcolr3 2c3PlayfiY}eld O colpfO dO16 colorO 2c4Playfield 1 colpf1 dO17 color1 2c5Playfield 2 colpf2 dO18 color2 2c6Playfield 3 cY}olpf3 dO19 color3 2c7Background colbk dO1a color4 2c8figure 3-1 color register labels and addressesFor most purpY}oses, the user controls the color registers by writing to the shadow locations. There are only two cases in which the programY}mer would write directly to the ctia addresses. The first and most common is the display list interrupt which will be discussY}ed in section 5. The second arises when the user disables the os vertical blank interrupt routines that move the shadow valueY}s into ctia. Vertical blank interrupts are discussed in section 8.Colors are encoded in a color register by a simple formulaY}. The upper nybble gives the hue value, which is identical to the second parameter of the basic setcolor command. Table 9-3 oY}f the basic reference manual lists hue values. The lower nybble in the color register gives the luminance value of the color.Y} It is the same as the third parameter in the basic setcolor command. The lowest order bit of this nybble is not significant.Y} Thus, there are eight luminances for each hue. There are a total of 128 colors from which to choose (8 luminances times 16 hY}ues). In this book, the term 'color' denotes a hue-luminance combination. Once a color is encoded into a color register, it Y}is mapped onto the screen by referring to the color register that holds it. In map display modes which support four color regZ}isters the screen data specifies which color register is to be mapped onto the screen. Since there are four color registers iZ}t takes only two bits to encode one pixel. Thus, each screen data byte holds data for four pixels. The value in each pair of Z}bits specifies which color register provides the color for that pixel. In text display modes (basic's graphics modes 1 and 2Z}) the selection of color registers is made by the top two bits of the character code. This leaves only six bits for defining Z}the character, which is why these two modes have only 64 characters available. Color register indirection gives you four speZ}cial capabilities. First, you can choose from 128 different colors for your displays. This allows you to choose the color thaZ}t most nearly meets your needs.page 3-2 above28 different colors for your displays. This allows you to choose the color thaX/0080 Second, you can manipulate the color registers in real time to produce pretty effects. The simplest version of thi^}s is demonstrated by the following basic line :For i =O to 254 step 2:poke 712,i:next iThis line simply cycles the border c^ }olor through all possible colors. The effect is quite pleasing and certainly grabs attention. The fundamental technique can b^ }e extended in a variety of ways. A special variation of this is to create simple cyclic animation by drawing a figure in four^ } colors and then cycle the colors through the color registers rather than redrawing the figure. The following program illustr^ }ates the idea :1O gr.232O for x=O to 393O for i=O to 34O color 15O plot 4*x+i,O6O drawto 4*x+i,957O next i8Onext x9O^ } a=peek(712)1OO poke 712,peek(71O)11O poke 71O,peek(7O9)12O poke 7O9,peek(7O8)13O poke 7O8,a14O goto 9O The third appl^}ication of color registers is to logically key colors to situations. For example, a paged menu system can be made more unders^}tandable by changing the background color or the border color for each page in the menu. Perhaps the screen could flash red w^}hen an illegal key is pressed. The use of the color characters avialable in basic graphics modes 1 and 2 can greatly extend t^}he impact of textual material. An account sum could be shown in red if the account is in thered, or black if the account is i^}n the black. Important words or phrases can be shown in special colors to make them stand out. The use of colors in map modes^} (no text) can also improve the utility of such graphics. A single graphics image (a monster, a boat, or whatever) could be p^}resented in several different colors to represent several different versions of the same thing. It cost a great deal of ram t^}o store an image, but it costs very little to change the color of an existing image. For example, it would be much easier to ^}show three different boats by presenting one boat shape in three different colors than three different boat shapes. The four^}th and most important application of color registers is used with display list interrupts. A single color register can be use^}d to put up to 128 colors onto a single screen. This very important capability will be discussed in section 5.page 3-3 abov^}eto put up to 128 colors onto a single screen. This very important capability will be discussed in section 5.page 3-3 abov\0080CHARACTER SETS Graphics indirection is also provided through the use of redefinable character set. A standard chab}racter set is provided in rom, but there is no reason why this particular character set must be used. The user can create andb} display any character set desired. There are three steps necessary to use a redefined character set. First, the programmer mb}ust define the character set. This is the most time consuming step. Each character is displayed on the screen on an 8*8 grid;b} it is encoded in memory as an 8-byte table. Figure 3-2 depicts the encoding arrangement.Character binary hexb} Image representation representation-------- OOOOOOOO OO---**--- OOO11OOO 18--****-- OO1b }111OO 3c-**--**- O11OO11O 66-**--**- O11OO11O 66-******- O111111O 7e-**--b!}**- O11OO11O 66-------- OOOOOOOO OOfigure 3-2 character encodingA full character set has 128 chb"}aracters in it, each with a normal and an inverse video incarnation. Such a character set needs 1O24 bytes of space and must b#}start on a 1k boundary. Character sets for basic modes 1 and 2 have only 64 distinct characters, and so require only 512 byteb$}s and must start on a 1/2k boundary. The first 8 bytes define the zero character,the next 8 bytes define the first character,b%} and so on. Obviously, defining a new character set is a big job. Fortunately, there are software packages on the market to mb&}ake this job easier. Once the character set is defined and placed in ram, you must tell antic where it can find the characteb'}r set. This is done by poking the page number of the beginning of the character table into location $d4O9 (decimal 54281). Thb(}e os shadow location,which is the location you would normally use, is called chbas and resides at $2f4 (decimal 756). The thib)}rd step in using character sets is to print the character you want onto the screen. This can be done directly from basic withb*} simple print statements or by writing numbers directly into the screen memory. A special capability of the system not suppob+}rted in basic is the four color character set option. Basic graphics modes 1 and 2 support five colors, but each character inb,} these modes is really a two color character; each one has a foreground color and a background color. The foreground color cab-}n be any of four single colors, but only one color at a time can be shown within a single character. This can be a serious hib.}ndrance when using character graphics.page 3-4 abovea time can be shown within a single character. This can be a serious hi`60080 There are two other text modes designed especially for character graphics. They are antic modes 4 and 5. Each charf0}acter in these modes is only four pixels wide, but each pixel can have four colors (counting background) the characters are df1}efined just like basic graphics mode O characters, except that each pixel is twice as wide and has two bits assigned to it tof2} specify the color register used. Unlike antic modes 6 and 7 (basic modes 1 and 2), color register selection is not made by tf3}he character name byte but instead by the defined character set. Each byte in the character table is broken into four bit paif4}rs, each of which selects the color for a pixel. (this is why there are only four horizontal pixels per character). The highef5}st bit (d7) of the character name byte modifies the color register used. Color register selection is made according to figuref6} 3-3 :Bit pair in d7=O d7=1Character defn OO colbak colbak O1 pfO f7} pfO 1O pf1 pf1 11 pf2 pf3figure 3-3 color register selection forf8} characters Using these text modes, multicolored graphics characters can be put onto the screen. Another interesting antic f9}character mode is the lowercase descenders mode (antic mode 3). This mode displays 1O scan lines, but since characters use onf:}ly eight bytes vertically, the lower two scan lines are normally left empty. If a character in the last quarter of the characf;}ter set is displayed, the top two scan lines of the character will be left empty; the data that should have been displayed thf<}ere will instead be shown on the bottom two lines. This allows the user to create lowercase characters with descenders.applf=}ications of character sets. Many interesting and useful application possibilities spring from character set indirection. Thef>} obvious application is the modified font. A different font can give a program a unique appearance. It is possible to have grf?}eek, cyrillic,or other special character sets. Going one step further, you can create graphics fonts. The 'energy czar' compuf@}ter program uses a redefined character set for bar graphs. A character occupies eight pixels; this means tha bar charts implefA}mented with standard characters have a resolution of eight pixels, a rather poor resolution.page 3-5 above bar charts impledl0080 'ENERGY CZAR' uses a special character set in which some of the less popular text symbols (ampersands, pound signjC}s, and the like) have been replaced with special bar chart characters. One character is a one pixel bar, another is a two pixjD}el bar, and so on to the full eight pixel bar. The program can thus draw detailed bar charts with resolution of a single pixejE}l. Figure 3-4 shows a typical display from this program. The mix of text with mapgraphics is only apparent; the entire displajF}y is constructed with characters.=============================================-- --========--- m pjG}rices (b$/quad) ---===- -== coal t ************ == 14 jH} == oil t ************* == 15 == nlgas t ******jI}******** == 16 == uranm t *********** == 14 jJ} == hydro t ********* == 12 ==- jK} -===--- etcetera ---========-- --==========================================jL}===figure 3-4 energy czar bar charts In many applications, character sets can be created that show special images. For ejM}xample, by defining a terrain graphics character set with river characters, forest characters, mountain characters, and so fojN}rth, it is possible to make a terrain map of any country. Indeed, with imagination a map of terrain on a different planet canjO} be done just as easily. When doing this, it is best to define five to eight characters for each terrain type. Each variationjP} of a single type should be positioned slightly differently in the character pixel. By mixing the different characters togethjQ}er, it is possible to avoid to avoid the monotonous look that is characteristic of primitive character graphics. Most people jR}won't realise that the resulting map uses character graphics until they study the map closely. Figure 3-5 shows a display of jS}a terrain map created with character set graphics. The reproduction in black and white does not do justice to the original dijT}splay, which has up to 18 colors.page 3-6 above The reproduction in black and white does not do justice to the original dih20080---------------------------------------- -- june 22, 1941 nV} -- ----------------------------------- -- ;. :. ;;:.: ; -- ; : :;: ; -nW}- ; : :: ; -- ; ; ; -- :-;;- ; . -- nX} ; ; ;.. -- :. : -- ; : -- nY} ; : -- .; :;:; -- . :; -- nZ} : -- -- ;. ; .-- press start when orders are in ---------------------n[}-------------------figure 3-5 terrain map with character set graphics(note:- the original picture shows a more detailed man\}p but due to printing on a 1O27, graphics proper are unavailable). You could create an electronics character set with transin]}stor characters, diode characters, wire characters, and so forth to prduce an electronics schematics program. Or you could crn^}eate an architectural character set with doorways, wall characters, corner characters, and so on to make an architectural blun_}eprint program. The graphics possibilities opened up by character graphics with personal computers have not been fully explorn`}ed. Characters can be turned upside down by pokeing a 4 into location 755. One possible application of this feature might bena} for displaying playing cards (as in a blackjack game). The upper half of the card can be shown right side up; with a displaynb} list interrupt the characters can be turned upside down for the lower half of the card. This feature might also be of some unc}se in displaying images with mirror reflections (reflection pools, lakes, etc). Even more exciting possibilities spring to mnd}ind when you realise that it is quite practical to change character sets while the program is running. A character set cost ene}ither 512 bytes or 1O24 bytes; in either case it is quite inexpensive to keep multiple character sets in memory and flip betwnf}een them during program execution. There are three time regimes for such character set multiplexing : human slow (more than 1ng} second); human fast (1/6O second to 1 second); and machine fast (faster than 1/6O sec).page 3-7 aboveman slow (more than 1lh0080 Human slow character set multiplexing is useful for "change of scenery" work. For example, a space travel program ri}might use one graphics character set for one planet, another set for space, and a third set for another planet. As the travelrj}er changes locations, the program changes the character set to give exotic new scenery. An adventure program might change chark}racter sets as the player changes locales. Human fast character set multiplexing is primarily of value for animation. This crl}an be done in two ways : changing characters within a single character set, and changing whole character sets. The space invarm}ders (trademark of taito america corp.) program on the atari home computer uses the former technique. The invaders are actualrn}ly characters. By rapidly changing the characters, the programmer was able to animate them. This was easy because there are oro}nly six different monsters; each has four different incarnations. High-speed cyclic animation of an entire screen is possiblrp}e by setting up a number of character sets, drawing the screen image, and then simply cycling through the character sets. If rq}each character has a slightly different incarnation in each of the character sets, that character will go through an animatedrr} sequence as the character sets are changed. In this way a screen full of objects could be made to cyclicly move with a very rs}simple loop. Once the character set data is in place and the screen has been drawn, the code to animate the screen would be trt}his simple :1OOO for i=1 to 1O1O1O poke756,charbase(i)1O2O next i1O3O goto 1OOO Computer fast character set animation isru} used to put multiple character sets onto a single screen. This makes use of the display list interrupt capability of the comrv}puter. Display list interrupts are discussed in section 5. The use of character sets for graphics and animation has many advrw}antages and some limitations. The biggest advantage is that it costs very little ram to produce detailed displays. A graphicsrx} display using basic mode 2 characters (such as the one shown in figure 3-5) can give as much detail and one more color than ry}a basic mode 7 display. Yet the character image will cost about 2OO bytes while the map image will cost 4OOO bytes. The ram crz}ost for multiple character sets is only 512 bytes per set so it is inexpensive to have multiple character sets. Screen manipur{}lations with character graphics are much faster because you have less data to manipulate. However, character graphics are notr|} as flexible as map graphics. You cannot put anything you want anywhere on the screen. This limitation would preclude the user}} of character graphics in some applications. However, there remain many graphics applications for which the program need dispr~}lay only a limited number of predefined shapes in fixed locations. In these cases, character graphics provide great utility.r}page 3-8 aboveted number of predefined shapes in fixed locations. In these cases, character graphics provide great utility.p00804PLAYER-MISSILE GRAPHICSDIFFICULTIES WITH HIGH-SPEED ANIMATION Animation is an important capability of any homv}e computer system. Activity on the screen can greatly add to the excitement and realism of any program. Certainly animation iv}s crucial to the appeal of many computer games. More important, an animated image can convey information with more impact andv} clarity than a static image. It can draw attention to an item or event of importance. It can directly show a dynamic processv} rather than indirectly talk about it. Animation must accordingly be regarded as an important element of the graphics capabilv}ities of any computer system. The conventional way to effect animation with home computers is to move the image data throughv} the screen ram area. This requires a two-step process. First, the program must erase the old image by writing background valv}ues to the ram containing the current image. Then the program must write the image data to the ram corresponding to the new pv}osition of the image. By repeating this process over and over, the image will appear to move on the screen. There are two prv}oblems with this technique. First, if the animation is being done in a graphics mode with large pixels, the motion will not bv}e smooth; the image will jerk across the screen. With other computers the only solution is to use a graphics mode with smallev}r pixels (higher resolution). The second problem is much worse. The screen is a two-dimensional image but the screen ram is ov}rganized one-dimensionally. This means that an image which is contiguous on the screen will not be contiguous in the ram. Thev} discrepancy is illustrated in figure 4-1. Image corresponding bytes in ram---v}--------------------- OO OO OO--------*--**--*-------- OO 99 OO--------*-****-*-------- OO bd OO--------********----v}---- OO ff OO--------*-****-*-------- OO bd OO--------*--**--*-------- OO 99 OO------------------------ OO OO OOv}Spacing of bytes in ram:OO OO OO OO 99 OO OO bd OO OO ff OO OO bd OO OO 99 OO OO OO OOImage bytes scattered through ramv}Figure 4-1 noncontiguous ram imagesPage 4-1 above OO ff OO OO bd OO OO 99 OO OO OO OOImage bytes scattered through ramt40080 The significance of this discrepancy does not become obvious until you try to write a program to move such an imagz}e. Look how the bytes that make up the image are scattered through the ram. To erase them, your program must calculate their z}addresses. This calculation is not always easy to do. The assembly code just to access a single screen byte at screen locatioz}n (xpos,ypos) would look like this (this code assumes 4O bytes per screen line):LDA SCRNRM address of beginning of screez}n ramSTA pointr zero page pointerLDA scrnrm+1 high order byte of addressSTA pointr+1 high order pointerLDA #$OOSTA z}tempa+1 temporary registerLDA ypos vertical positionASL a times 2ROL tempa+1 shift carry into tempa+1ASLz} a times 4ROL tempa+1 shift carry againASL a times 8ROL tempa+1 shift carry againLDX tempa+1 save yz}pos*8STX tempb+1 into tempbSTA temb low byteASL a times 16ROL tempa+1ASL a times 32ROL tempa+1Cz}LCADC tempb add in ypos*8 to get ypos*4OSTA tempbLDA tempa+1 now do high order byteADC tempb+1STA tempb+1LDA tempz}b tempb contains the offset from top of screen to pixelCLCADC pointrSTA pointrLDA tempb+1ADC pointr+1STA pointr+1Lz}DY xposLDA (pointr),Y Clearly, this code to access a screen location is too cumbersome. This is certainly not the most elegz}ant or fastest code to solve the problem. Certainly a good programmer could take advantage of special circumstances to make tz}he code more compact. The point of this is that accessing pixels on a screen takes a lot of computing. The above routine takez}s about 1OO machine cycles to access a single byte on the screen. To move an image that occupies, say, 5O bytes, would requirz}e 1OO accesses or about 1O,OOO machine cycles or roughly 1O milliseconds.page 4-2 aboveccupies, say, 5O bytes, would requirxY0080This may not sound like much but if you want to achieve smooth motion, you have to move the object every 17 millise~}conds. If there are other objects to move or any calculations to carry out there isn't much processor time left to devote to ~}them. What this means is that this type of animation (called "playfield animation") is too slow for many purposes. You can st~}ill get animation this way, but you are limited to few objects or small objects or slow motion or few calculations between mo~}tion. The trade-offs that a programmer must make in using such animation are too restrictive.Player-missile fundamentals T~}he atari home computer solution to this problem is player-missile graphics. In order to understand player-missile graphics, i~}t is important to understand the essence of the problem of the playfield animation: the screen image is two-dimensional while~} the ram image is one-dimensional. The solution was to create a graphics object that is one-dimensional on the screen as well~} as one-dimensional in ram. This object (called a player) appears in ram as a table that is either 128 or 256 bytes long. The~} table is mapped directly to the screen. It appears as a vertical band stretching from the top of the screen to the bottom. E~}ach byte in the table is mapped into either one or two horizontal scan lines, with the choice between the two made by the pro~}grammer. The screen image is a simple bit-map of the data in the table. If a bit is on, then the corresponding pixel in the v~}ertical column is lit; if the bit is off, then the corresponding pixel is off. Thus, the player image is not strictly one-dim~}ensional; it is actually eight bits wide. Drawing a player image on the screen is quite simple. First you draw a picture of ~}the desired image on graph paper. This image must be no more than eight pixels wide. You then translate the image into binary~} code, substituting ones for illuminated pixels and zeros for empty ones. Then you translate the resulting binary number into~} decimal or hexadecimal, depending on which is more convenient. Then you store zeros into the player ram to clear the image. ~}Next, store the image data into the player ram, with the byte at the top of the player image going first, followed by the oth~}er image bytes in top to bottom sequence. The further down in ram you place the data, the lower the image will appear on the ~}screen.Vertical motion Animating this image is very easy. Vertical motion is obtained by moving the image data through the~} player ram. This is, in principle, the same method used in playfield animation, but there is a big difference in practice; t~}he move routine for vertical motion is a one-dimensional move instead of a two-dimensional move. The program does not need to~} multiply by 4O and it often does not need to use indirection. It could be as simple as:page 4-3 abovegram does not need to|h0080 LDX #$O1LOOP LDA PLAYER,X STA PLAYER-1,X INX BNE LOOPThis routine takes about 4 milliseconds }to move the entire player, about half as long as the playfield animation routine which actually moves only 5O bytes where thi}s one moves 256 bytes. if high speed is necessary, the loop can be trimmed to move only the image bytes themselves rather tha}n the whole player; then the loop would easily run in about 1OO-2OO microseconds. The point here is that vertical motion with} players is both simpler and faster than motion with playfield objects.HORIZONTAL MOTION Horizontal motion is even easier t}han vertical motion. There is a register for the player called the horizontal position register. The value in this register s}ets the horizontal position of the player on the screen. All you do is store a number into this register and the player jumps} to that horizontal position. To move the player horizontally simply change the number stored in the horizontal position regi}ster. That's all there is to it. Horizontal and vertical motion are independent; you can combine them in any fashion you cho}ose. The scale for the horizontal position register is one color clock per unit. Thus, adding one to the horizontal position} register will move the player one color clock to the right. There are only 228 color clocks in a single scan line; furthermo}re, some of these are not displayed because of overscan. The horizontal position register can hold 256 positions; some of the}se are off the left or right edge of the screen. Position 47 corresponds to the left edge of the standard playfield; position} 2O8 corresponds to the right edge of the standard playfield. Thus, the visible region of the player is in horizontal positio}ns 47 through 2O8. Remember, however, that this may vary from television to television due to differences in overscan. A cons}ervative range of values is from 6O to 2OO. This coordinate range can sometimes be clumsy to use, but it does offer a nice fe}ature: a simple way to remove a player from the screen is to set the player's horizontal position to zero. With a single load} and store in assembly (or a single poke in basic), the player will disappear.OTHER PLAYER-MISSILE FEATURES The system desc}ribed so far makes it possible to produce high-speed animation. There are a number of embellishments which greatly add to its} overall utility. The first embellishment is that there are four independent players to use. These players all have their own} sets of control registers and ram area; thus their operation is completely independent. page4-4 aboves all have their owni0080They are labeled P0 through P3. They can be used side by side to give up to 32 bits of horizontal resolution, or th}ey can be used independently to give four movable objects. Each player has its own color register; this color register is co}mpletely independent of the playfield color registers. The player color registers are called colp(x) and are shadowed at pcol}r(x). This gives you the capability to put much more color onto the screen. However, each player has only one color; multicol}ored players are not possible without display list interrupts (display list interrupts are discussed in section 5). Each pla}yer has a controllable width; you can set it to have normal width, double width, or quadruple width with the sizep(x) registe}rs. This is useful for making players take on different sizes. You also have the option of choosing the vertical resolution o}f the players. You can use single-line resolution, in which each byte in the player table occupies one horizontal scan line, }or double-line resolution, in which each byte occupies two horizontal scan lines. With single line resolution, each player bi}t-map table is 256 bytes long; with double-line resolution each table is 128 bytes long. This is the only case where player p}roperties are not independent; the selection of vertical resolution applies to all players. Player vertical resolution is con}trolled by bit d4 of the dmactl register. In single-line resolution, the first 32 bytes in the player table area lie above th}e standard playfield. The last 32 bytes lie below the standard playfield. In double-line resolution, 16 bytes lie above and 1}6 bytes lie below the standard playfield.MISSILES The next embellishment is the provision of missiles. These are 2-bit wide} graphics objects associated with the players. There is one missile assigned to each player; it takes its color from the play}er's color register. Missile shape data comes from the missile bit-map table in ram just in front of the player tables. All f}our missiles are packed into the same table (four missiles times 2 bits per missile gives 8 bits). Missiles can move independ}ently of players; they have their own horizontal position registers. Missiles have their own size register, sizem, which can }set the horizontal width just like the sizep(x) registers do for players. However, missiles cannot be set to different sizes;} they are all set together. Missiles are useful as bullets or for skinny vertical lines on the screen. If desired, the missil}es can be grouped together into a fifth player, in which case they take the color of playfield color register 3. This is done} by setting bit d4 of the priority control register (prior). Note that missiles can still move independently when this option} is in effect; their horizontal positions are set by their horizontal position registers. The fifth player enable bit only af}fects the color of the missiles. You move a missile vertically the same way that you move a player: by moving the missile im}age data through the missile ram area. This can be difficult to do because missiles are grouped into the same ram table.pag}e 4-5 aboverough the missile ram area. This can be difficult to do because missiles are grouped into the same ram table.pag 0080To access a single missile, you must mask out the bits for the other missiles.PLAYER AND PLAYFIELD PRIORITIES An }important feature of player-missile graphics is that players and missiles are completely independent of the playfield. You ca}n mix them with any graphics mode, text or map. This raises a problem: what happens if a player ends up on top of some playfi}eld image? Which image has priority? You have the option to define the priorities used in displaying players. If you wish, al}l players can have priority over all playfield color registers. Or you can set all playfield color registers (except backgrou}nd) to have priority over all players. Or you can set player O and player 1 (henceforth referred to as pO and p1) to have pri}ority over all playfield color registers, with p2 and p3 having less priority than the playfield. Or you can set playfield co}lor registers O and 1 (pfO and pf1) to have priority over all players, which then have priority over pf2 and pf3. These prior}ities are selected with the priority control register (prior) which is shadowed at gprior. This capability allows a player to} pass in front of one image and behind another, allowing three-dimensional effects.HARDWARE COLLISION DETECTION The final e}mbellishment is the provision for hardware collision detection. This is primarily of value for games. You can check if any gr}aphics object (player or missile) has collided with anything else. Specifically, you can check for missile-player collisions,} missile-playfield collisions, player-player collisions, and player-playfield collisions. There are 54 possible collisions, a}nd each one has a bit assigned to it that can be checked. If the bit is set, a collision has occurred. These bits are mapped }into 15 registers in ctia (only the lower 4 bits are used and some are not meaningful). These are read-only registers; they c}annot be cleared by writing zeros to them. The registers can be cleared for further collision detection by writing any value }to register hitclr. All collision registers are cleared by this command. In hardware terms, collisions occur when a player i}mage coincides with another image; thus, the collision bit will not be set until the part of the screen showing the collision} is drawn. This means that collision detection might not occur until as much as 16 milliseconds have elapsed since the player} was moved. The preferred solution is to execute player motion and collision detection during the vertical blank interrupt ro}utine (see section 8 for a discussion of vertical blank interrupts). In this case collision detection should be checked first}, then collisions cleared, then players moved. Another solution is to wait at least 16 milliseconds after moving a player bef}ore checking for a collision involving that player. There are a number of steps necessary to use player-missile graphics. Fi}rst you must set aside a player-missile ram area and tell the computer where it is. If you use single-line resolution, this r}am area will be 128O bytes long; if you use double-line resolution it will be 64O bytes long.page 4-6 abovesolution, this rm00801 PMBASE=54279:REM PLAYER-MISSILE BASE POINTER2 RAMTOP=1O6:REM OS }TOP OF RAM POINTER3 SDMCTL=559:REM RAM SHADOW OF DMACTL REGISTER4 GRACTL=53277:REM } CTIA GRAPHICS CONTROL REGISTER5 HPOSPO=53248:REM HORIZONTAL POSITION OF PO6 PCOLRO=7O4:REM } SHADOW OF PLAYER O COLOR1O GRAPHICS O:SETCOLOR 2,O,O:REM SET BACKGROUND COLOR TO BLACK2O X}=1OO:REM BASIC'S PLAYER HORIZONTAL POSITION3O Y=48:REM BASIC'S }PLAYER VERTICAL POSITION4O A=PEEK(RAMTOP)-8:REM GET RAM 2K BELOW TOP OF RAM5O POKE PMBASE,A:REM } TELL ANTIC WHERE PM RAM IS6O MYPMBASE=256*A:REM KEEP TRACK OF PM RAM ADDRESS7O POKE SDMC}TL,46:REM ENABLE PM DMA WITH 2-LINE RES8O POKE GRACTL,3:REM ENABLE PM DISPLAY9O }POKE HPOSPO,1OO:REM DECLARE HORIZONTAL POSITION1OO FOR I=MYPMBASE+512 TO MYPMBASE+64O: REM THIS LOOP CL }EARS PLAYER11O POKE I,O12O NEXT I13O FOR I=MYPMBASE+512+Y TO MYPMBASE+ 518+Y14O READ A:REM T }HIS LOOP DRAWS THE PLAYER15O POKE I,A16O NEXT I17O DATA 8,17,35,255,32,16,818O POKE PCOLRO,88:REM MA }KE THE PLAYER PINK19O A=STICK(O):REM READ JOYSTICK2OO IF A=15 THEN GOTO 19O:REM IF I }NACTIVE, TRY AGAIN21O IF A=11 THEN X=X-1:POKE HPOSPO,X22O IF A=7 THEN X=X+1:POKE HPOSPO,X23O IF A<>13 THEN GOTO 28O24O FO}R I=8 TO O STEP -125O POKE MYPMBASE+512+Y+I,PEEK(MYPMBASE +511+Y+I)26O NEXT I27O Y=Y+128O IF A<>14 THEN GOTO 19O29O FOR }I=O TO 83OO POKE MYPMBASE+511+Y+I,PEEK(MYPMBASE +512+Y+I)31O NEXT I32O Y=Y-133O GOTO 19O Once players are displayed, th}ey can be difficult to remove from the screen. This is because the procedure by which they are displayed involves several ste}ps. First, antic retrieves player-missile data from ram (if such retrieval is enabled in DMACTL). Then antic ships the player}-missile data to CTIA (if such action is enabled in GRACTL). CTIA displays whatever is in its player and missile graphics reg}isters (GRAFP0 through GRAFP3 and GRAFM). Many programmers attempt to turn off player-missile graphics by clearing the contro}l bits in DMACTL and GRACTL. This only prevents antic from sending new player-missile data to CTIA; the old data in the GRAF(}X) registers will still be displayed. page 4-8 above from sending new player-missile data to CTIA; the old data in the GRAF(50080To completely clear the players the GRAF(X) registers must be cleared after the control bits in dmactl and gractl h}ave been cleared. A simpler solution is to leave the player up but set its horizontal position to zero. Of course, if this so}lution is used, antic will continue to use dma to retrieve player-missile data, wasting roughly 7O,OOO machine cycles per sec}ond.APPLICATIONS OF PLAYER-MISSILE GRAPHICS Player-missile graphics allow a number of very special capabilities. They are} obviously of great value in animation. They do have limitations: there are only four players and each is only 8 bits wide. I}f you need more bits of horizontal resolution you can always fall back on playfield animation. But for high-speed animation o}r quick and dirty animation, player-missile graphics work very well. It is possible to bypass antic and write player-missi}le data directly into the player-missile graphics registers (grafp(x)) in ctia. This gives the programmer more direct control} over player-missile graphics. It also increases his responsibilities concomitantly. The programmer must maintain a bit map o}f player-missile data and move it into the graphics registers at the appropriate times. The 65O2 must therefore be slave to t }he screen drawing cycle. (see the discussion of kernels in chapter 5.) this is a clumsy technique that offers minor performan!}ce improvements in return for major programming efforts. The programmer who bypasses the hardware power offered by antic must"} make up for it with his own effort. Players can also be used to produce apparent 3-dimensional motion. This is accomplish#}ed with the player width option. Each player is drawn with one of several bit maps. One bit map shows the player as 6 bits wi$}de, and another shows the player in 8 bits. When the 6 bit player is drawn at normal resolution, it will be 6 color clocks wi%}de. The next size step is achieved by going to double width with the 6 bit image; this will be 12 color clocks wide. The 8 bi&}t image will be 16 color clocks wide. Similarly, going to quadruple width will produce images 24 and 32 color clocks wide. Th'}us, the image can grow in size from 6 color clocks to 32 color clocks. This technique is used very effectively in star raider(}s. In the zylons there are two players with 16 bits, so the size transistions are even smoother. Player-missile graphics o)}ffer many capabilities in addition to animation. Players are an excellent way to increase the amount of color in a display. T*}he four additional color registers they provide allow four more colors on each line of the display. Of course, the 8-bit reso+}lution does limit the range of their application. There is a way around this that can sometimes be used. Take a player at qua,}druple width and put it onto the screen. Then set the priorities so that the player has lower priority than a playfield color-}. Next reverse that playfield color with background, so that the apparent background color of the screen is really a playfiel.}d color. The player disappears behind this new false background. Now cut a hole in the false background by drawing true backg/}round on it. The player will show up in front of the true background color, but only in the area where true background has be0}en drawn.page 4-9 aboveill show up in front of the true background color, but only in the area where true background has be0080In this way the player can have more than eight bits of horizontal resolution. A simple program for doing this is:2}1 RAMTOP=1O6:REM OS TOP OF RAM POINTER2 PMBASE=54279:REM ANTIC PLAYER-MISSI3}LE RAM POINTER3 SDMCTL=559:REM SHADOW OF DMACTL4 GRACTL=53277:REM CTIA GRAP4}HICS CONTROL REGISTER5 HPOSPO=53248:REM HORIZONTAL POSITION REGISTER OF PO6 PCOLRO=7O4:REM 5} SHADOW OF PLAYER O COLOR REGISTER7 SIZEPO=53256:REM PLAYER WIDTH CONTROL REGISTER8 G6}PRIOR=623:REM PRIORITY CONTROL REGISTER1O GRAPHICS 72O SETCOLOR 4,8,43O SETCOLOR 2,O,O4O COLOR 37}5O FOR Y=O TO 79:REM THIS LOOP FILLS THE SCREEN6O PLOT O,Y7O DRAWTO 159,Y8O NEXT Y9O A=PEEK(RAMTOP8})-2O:REM MUST BACK UP FURTHER FOR GR.71OO POKE PMBASE,A11O MYPMBASE=256*A12O POKE SDMCTL,4613O POKE GRA9}CTL,314O POKE HPOSPO,1OO15O FOR I=MYPMBASE+512 TO MYPMBASE+64O16O POKE I,255:REM MAKE PLAYER SOLI:}D COLOR17O NEXT I18O POKE PCOLRO,8819O POKE SIZEPO,3:REM SET PLAYER TO QUADRUPLE WIDTH2OO POKE GPRI;}OR,4:REM SET PRIORITY21O COLOR 422O FOR Y=3O TO 4O23O PLOT Y+22,Y24O DRAWTO Y+43,Y25O NEXT YPAGE<} 4-1O ABOVE SET PRIORITY21O COLOR 422O FOR Y=3O TO 4O23O PLOT Y+22,Y24O DRAWTO Y+43,Y25O NEXT YPAGE 0080This program produces the following display (in high resolution): ========== =========>}= ========== ==========Figure 4-3 masking a player for more resolutionSpecial characters?} Another application of player-missile graphics is for special characters. There are many special types of characters that cr@}oss vertical boundaries in normal character sets. One way to deal with these is to create special character sets that addressA} this problem. Another way is to use a player. Subscripts, integral signs, and other special symbols can be done this way. A B}sample program for doing this is:1 RAMTOP=1O6:REM OS TOP OF RAM POINTER2 PMBASE=54279:REM C} ANTIC PLAYER-MISSILE RAM POINTER3 SDMCTL=559:REM SHADOW OF DMACTL4 GRACTL=53277:RED}M CTIA'S GRAPHICS CONTROL REGISTER5 HPOSPO=53248:REM HORIZONTAL POSITION REGISE}TER OF PO6 PCOLRO=7O4:REM SHADOW OF PLAYER O COLOR REGISTER1O GRAPHICS O:A=PEEK(RAMTOP)-16:REM F} MUST BACK UP FOR 1-LINE RESOLUTION2O POKE PMBASE,A3O MYPMBASE=256*A4O POKE SDMCTL,625O POKE GRACTL,36O POKE HPOSPO,1G}O27O FOR I=MYPMBASE+1O24 TO MYPMBASE+128O8O POKE I,O9O NEXT I1OO POKE PCOLRO,14O11O FOR I=O TO 1512O READ X13O POKE MYH}PMBASE+11OO+I,X14O NEXT I15O DATA 14,29,24,24,24,24,24,2416O DATA 24,24,24,24,24,24,184,11217O ?" ":REM I} CLEAR SCREEN18O POSITION 15,619O ?"XDX"page 4-11 above24,24,24,24,24,184,11217O ?" ":REM H0080This program produces the following display. (note:-in the original document this is in high resolution) : K} - --- - - = = = XDX L} = = = = - - --Figure 4-4 using a player as a special charaM}cter A particularly useful application of players is for cursors. With their ability to smoothly move anywhere over the sN}creen without disturbing its contents they are ideally suited for such applications. The cursor can change color as it moves O}over the screen to indicate what it has under it. Player-missile graphics provide many capabilities. Their uses for actionP} games as animated objects are obvious. They have many serious uses as well. They can add color and resolution to any displayQ}. They can present special characters. They can be used as cursors. Use them.page 4-12 abover and resolution to any display^008061PAGE 6 ATARI WRITER WORD PROCESSOR INSTRUCTIONS AS PRINTED IN ISSUE #50 ATARI USER MAGAZINE, JUNE/JULY 1991.S}TYPED TO DISK FOR ATARI ENTHUSIASTS EVERYWHEREBYPINEAPPLE NOVEMBER 1991THERE WILL BE USERS IN THE ATARI COMMUNITY, WT}HO HAVE NEVER USED A WORD PROCESSOR. ONE OF THE MANY REASONS FOR THIS COULD BE THE EXPENSE OF BUYING A COMMERCIAL PRODUCT. NOU}W THEY HAVE NO EXCUSE, BECAUSE PAGE 6 WRITER IS A MORE OR LESS COMPLETE TYPE-IN WORD PROCESSOR, BASED AROUND ONE OR TWO COMMEV}RCIAL/PUBLIC DOMAIN PROGRAMS.BASIC USEAFTER LOADING PAGE 6 WRITER THE SCREEN COLORS BECOME WHITE TEXT ON A BLACK BACKGROUNW}D WITH A BLUE BAR AT THE TOP OF THE SCREEN. THIS BAR IS THE COMMAND LINE AND WILL DISPLAY VARIOUS MESSAGES AND PROMPTS. BELOWX} THE COMMAND LINE ARE A FURTHER 18 LINES WHICH IS KNOWN AS THE 'TEXT AREA'. THIS SPACE IS USED FOR ENTERING AND EDITING YOUR Y}DOCUMENT.TO START USING PAGE 6 WRITER ALL YOU HAVE TO DO IS BEGIN TYPING. WHEN THE CURSOR REACHES THE RIGHT HAND SIDE OF THEZ} SCREEN IT NATURALLY GOES BACK TO THE LEFT HAND SIDE, ONE LINE DOWN. IF A WORD WAS BEING TYPED AT THAT TIME, THAT TOO IS MOVE[}D TO THE NEXT LINE. THIS IS CALLED WORD-WRAP AND RETAINS A DEGREE OF READABILITY IN YOUR DOCUMENT. WHEN THE CURSOR REACHES TH\}E BOTTOM RIGHT HAND CORNER OF THE TEXT AREA, THE SCREEN AUTOMATICALLY SCROLLS THE TEXT UPWARDS TO MAKE WAY FOR THE NEW LINE.]}EDITING FUNCTIONSTHE EDITING FEATURES BUILT INTO PAGE 6 WRITER VARY SLIGHTLY FROM THE NORMAL ATARI EDITING FUNCTIONS, BUT T^}HIS SHOULD NOT PRESENT TOO MANY PROBLEMS.CTRL+ : MOVES THE CURSOR ONE SPACE TO THE LEFTCTRL* : MOVES THE CURSOR ONE SPACE _}TO THE RIGHTCTRL- : MOVES THE CURSOR TO THE BEGINNING OF THE PREVIOUS SENTENCECTRL= : MOVES THE CURSOR TO THE BEGINNING OF `}THE SENTENCESHIFT+ : MOVES THE CURSOR TO THE BEGINNING OF THE PREVIOUS WORDSHIFT* : MOVES THE CURSOR TO THE BEGINNING OF THa}E NEXT WORDSHIFT- : MOVES THE CURSOR TO THE BEGINNING OF THE PREVIOUS PARAGRAPHSHIFT= : MOVES THE CURSOR TO THE BEGINNING Ob}F THE NEXT PARAGRAPHTO INSERT A SINGLE SPACE USE CTRL INSERT. A BETTER IDEA IF YOU WANT TO TYPE IN SEVERAL WORDS IS TO USE Sc}HIFT INSERT AS THIS WILL INSERT 255 SPACES. A SINGLE CHARACTER OR SPACE CAN BE DELETED BY USING CTRL DELETE. THE EFFECT OF SHd}IFT DELETE INSTANTLY DELETES ALL SPACES BETWEEN THE CURSOR AND THE BEGINNING OF THE NEXT WORD.TO QUICKLY MOVE THE CURSOR TO e}THE TOP OF THE SCREEN, PRESS CTRL H. IF THE CURSOR WAS ALREADY AT THE TOP LEFT CORNER OF THE SCREEN THEN YOU WILL BE RETURNEDf} TO THE TOP OF YOUR DOCUMENT. SIMILARLY TO GET TO THE END OF YOUR DOCUMENT RAPIDLY, PRESS CTRL E.TO DELETE A BLOCK OF TEXT, g}PRESS CTRL D AND THE COMMAND LINE WILL TURN RED AND DISPLAY THE MESSAGE "ERASE (S,W,P):RETURN TO EXIT.". EACH TIME YOU PRESS h}S,W OR P ALL TEXT FROM THE CURSOR POSITION TO THE END OF THE SENTENCE, WORD OR PARAGRAPH WILL BE DELETED. TO EXIT THIS MODE Pi}RESS THE RETURN KEY. IF THE OPTION KEY IS HELD DOWN WHEN YOU PRESS CTRL D, ALL TEXT FROM THE CURSOR POSITION TO THE BEGINNINGj} OF THE SENTENCE, WORD OR PARAGRAPH WILL BE DELETED.WHEN YOU USE THE CTRL D FUNCTION, THE TEXT YOU HAVE JUST DELETED ISN'T Ck}OMPLETELY LOST. IT IS MOVED TO WHAT IS KNOWN AS THE 'DELETE BUFFER'. THIS PREVENTS YOU FROM ACCIDENTALLY ERASING TOO MUCH TEXl}T AND THEN HAVING TO RE-TYPE IT ALL. BY PRESSING CTRL R THE CONTENTS OF THE DELETE BUFFER WILL BE INSERTED AT THE CURRENT CURm}SOR POSITION. THE CTRL R FUNCTION CAN BE USED UNTIL THE "MEMORY FULL" MESSAGE APPEARS, AND CAN BE USED AS A VERY SIMPLE CUT-An}ND-PASTE FACILITY TO CREATE DATA TABLES, ETC. THE DELETE BUFFER IS CLEARED EVERY TIME CTRL D IS USED.CTRL I CONTROLS THE INSo}ERT/TYPEOVER TOGGLE AND DEFAULTS TO INSERT MODE WHEN PAGE 6 WRITER IS FIRST RUN. IN TYPEOVER MODE THE COMMAND BAR WILL TURN Bp}LACK AS A WARNING.IF AT ANY TIME YOU FEEL THAT YOUR DOCUMENT DOES NOT COME UP TO SCRATCH, PRESS EITHER SHIFT CLEAR OR CTRL Cq}LEAR. THE COMMAND LINE AGAIN TURNS RED AND DISPLAYS THE MESSAGE "ERASE ALL TEXT:ARE YOU SURE(Y/N)?". CONFIRM THIS BY PRESSINGr} 'Y' OR ABORT IT BY ANY OTHER KEYPRESS. ONCE AN ERASE-ALL TEXT OPERATION HAS BEEN COMPLETED THERE IS NO WAY TO RESTORE IT AT s}ALL.DISK USAGEA DOCUMENT CAN BE SAVED OR RECALLED TO/FROM DISK OR CASSETTE AT ANY TIME.TO SAVE YOUR TEXT, PRESS CTRL S ANt}D THE MESSAGE "SAVE(DEVICE:FILENAME)>" APPEARS ON THE COMMAND LINE. AT THIS POINT TYPE D:FILENAME.EXT AND PRESS RETURN. IF THu}E SAVE IS SUCCESSFUL THE MESSAGE "NO ERRORS" WILL APPEAR ON THE COMMAND LINE, OTHERWISE THE "ERROR #XXX" MESSAGE WILL BE DISPv}LAYED.TO LOAD A DOCUMENT INTO MEMORY, USE CTRL L. THE MESSAGE "LOAD(DEVICE:FILENAME)>" IS SHOWN ON THE COMMAND LINE. AS WITHw} THE SAVE COMMAND TYPE D:FILENAME.EXT AND HIT RETURN. IF THE COMMAND LINE TURNS GREEN WHEN YOU PRESS CTRL L (TO LOAD A VALID x}FILENAME) THEN THE EXISTING TEXT WILL NOT BE WIPED OUT OF MEMORY, AND THE FILENAME OF THE DOCUMENT YOU GIVE WILL BE INSERTED y}AT THE CURRENT CURSOR POSITION.DOS FACILITIESTHERE IS AN INTEGRAL MINI-DOS MENU BUILT INTO PAGE 6 WRITER, THE IDEA WHICH Wz}AS DERIVED FROM THE PUBLIC DOMAIN WORD PROCESSOR TEXTPRO. ACCESS TO THE MEMORY IS GAINED BY PRESSING CTRL M, WHICH DISPLAYS T{}HE DIRECTORY OF THE CURRENT DEFAULT DISK DRIVE.THE FIRST NOTICEABLE THING ABOUT THIS MANU IS THAT THE ENTIRE DIRECTORY OF A |}SINGLE DENSITY DISK CAN BE DISPLAYED. HOWEVER IN ORDER TO ACHIEVE THIS THE SECTOR COUNT OF EACH FILE IS MISSING. WHEN CALLED,}} THIS MENU HIGHLIGHTS THE FILENAME IN THE TOP LEFT-HAND CORNER. THE HIGHLIGHT BAR CAN BE MOVED TO ANY OF THE FILENAMES BY USI~}NG THE CURSOR ARROW KEYS, BUT THERE IS NO NEED TO HOLD CONTROL DOWN AS WELL.ESC : WILL EXIT THE MENU AND RETURN YOU TO YOUR }DOCUMENTCTRL L : LOADS THE HIGHLIGHTED FILE INTO THE WORD PROCESSOR. ANY EXISTING DOCUMENT WILL BE OVERWRITTENCTRL D : DE}LETES THE HIGHLIGHTED FILENAMEF : FORMATS THE DISK IN THE FAULT DRIVE. THERE IS A CONFIRM PROMPT TO THIS OPTIONL : LOCK. PR}OTECTS THE HIGHLIGHTED FILENAME FROM BEING ACCIDENTALLY ERASEDU : UNLOCK. UNPROTECTS THE HIGHLIGHTED FILENAMER : RENAMES TH}E HIGHLIGHTED FILE. SIMPLY TYPE IN THE NEW FILENAME AND PRESS RETURN1-8 : GETS A DISK DIRECTORY FROM THAT DRIVE NUMBER. THIS} DRIVE NUMBER THEN BECOMES THE DEFAULT, AND A DIRECTORY WILL BE TAKEN FROM IT IF THE MINI-DOS MENU IS LEFT AND THEN RE-ENTERE}DEXTRA FEATURESA SEARCH AND REPLACE FACILITY IS A MAJOR FEATURE, AND PAGE 6 WRITER IS NO EXEMPTION. TO USE THIS YOU MUST F}IRST TELL PAGE 6 WRITER THE STRING YOU WANT TO FIND. THIS IS DONE BY PRESSING DOWN OPTION AND PRESSING CTRL F, TO GET THE "FI}ND:" PROMPT ON THE COMMAND LINE. AFTER TYPING THE STRING PRESS RETURN, AND THEN TO FIND THE FIRST OCCURRENCE PRESS CTRL F WIT}HOUT OPTION. THE FIND FUNCTION IS FUSSY AND DISTINGUISHES BETWEEN CASES OF LETTERS. SO IF YOU ASKED PAGE 6 WRITER TO FIND 'TH}E' IT WOULD NOT STOP AT 'THE'. ALSO FIND WILL STOP AT CERTAIN WORDS BECAUSE THE STRING IS EMBEDDED, i.e.FURtheR. TO CHANGE TH}E FOUND STRING, YOU MUST FIRST SET THE REPLACE STRING. THIS IS DONE BY PRESSING OPTION DOWN AND PRESSING CTRL C TO GET THE "C}HANGE TO:" PROMPT ON THE COMMAND LINE. TYPE YOUR DESIRED REPLACEMENT AND HIT RETURN. NOW TO ACTUALLY CHANGE THE STRING FOUND }PRESS CTRL C.BY COMBINING THE KEYPRESSES OF CTRL F AND CTRL C WE CAN EFFECT SEARCH AND REPLACE. ALTERNATIVELY YOU CAN USE TH}E GLOBAL FUNCTION WHICH IS ACCESSED BY PRESSING CTRL G. THIS WILL FIND EVERY OCCURRENCE OF THE FIND STRING AND REPLACE IT WIT}H THE REPLACE STRING. USE WITH CAUTION, BECAUSE IF THE FIND STRING IS EMBEDDED WITHIN ANOTHER WORD, IT WILL PRODUCE HIGHLY UN}DESIRABLE RESULTS.MY PREFERENCE FOR SCREEN COLOR MAY NOT BE TO YOUR TASTE AND THIS CAN BE ALTERED AS WELL. PRESSING CTRL B A}ND CTRL T WILL CYCLE THROUGH THE COLORS AVAILABLE FOR THE BACKGROUND AND TEXT RESPECTIVELY.TO SOME DEGREE, MINOR TYPING ERRO}RS ARE ALSO CATERED FOR. A COMMON ERROR IS TO SEE A CHARACTER OR WORD THAT IS WRITTEN IN THE WRONG CASE. CTRL A CHANGES FROM }UPPERCASE TO LOWERCASE OR VICE-VERSA. AND TRANSPOSITION ERRORS CAN BE FIXED BY PRESSING CTRL X. THE CHARACTER AT THE CURRENT }CURSOR POSITION IS THEN SWAPPED WITH THE CHARACTER ON ITS RIGHT.ANOTHER SMALL FEATURE IS CTRL W WHICH DISPLAYS THE AMOUNT OF} FREE MEMORY IN TERMS OF CHARACTERS. AND BY PRESSING CTRL Z YOU ARE ABLE TO DISTINGUISH BETWEEN TRUE SPACES AND PADDED SPACES}, THE ONES THAT ARE USED TO COMPENSATE FOR WORD-WRAP. THAT'S MORE OR LESS THE BASIC FEATURES OF PAGE 6 WRITER. ALL THAT REMAI}NS NOW IS FOR YOU TO GET FAMILIAR WITH PAGE 6 WRITER AND GET READY TO PRINT IT.PRINTINGTHE SUPPORT THAT PAGE 6 WRITER OFFE}RS FOR PRINTING CAN BE COMPLICATED, YET ONCE MASTERED, YOU WILL BE ABLE TO SEE THE POWER OF THE ARRAY OF FEATURES. WITH THESE} NEW FEATURES COMES A WHOLE NEW SET OF COMMANDS AS WELL. TO BEGIN PRINTING IS SIMPLE, PRESS CTRL P, TYPE THE DEVICE AND FILEN}AME (GENERALLY P:ALTHOUGH YOU CAN PRINT TO THE DISK, ETC.) AND YOU ARE OFF. IN ORDER TO MAKE YOUR DOCUMENT LOOK PRESENTABLE, }PAGE 6 WRITER USES A SET OF DEFAULTS WHICH CAN BE ALTERED BY THE USER. PAGE 6 WRITER REQUIRES FORMATTING COMMANDS TO BE ENTER}ED IN INVERSE VIDEO, BUT BECAUSE THE NORMAL INVERSE VIDEO KEY IS DISABLED, THE SELECT KEY CAN BE USED INSTEAD. ALL FORMATTING} COMMANDS SHOULD BE TYPED IN LOWERCASE ONLY. THERE ARE TWO LEVELS OF FORMATTING WHICH ARE CALLED CONTROL AND EXECUTION. CONTR}OL MODE COMMANDS ARE CARRIED OUT WHEN THE LINE IS BEING PRINTED.CONTROL COMMANDSREMEMBER TO HOLD THE SELECT KEY DOWN BEFOR}E PRESSING THE KEY.l : IS USED TO SET THE LEFT MARGIN. ANY VALUE BETWEEN 0 AND 255 CAN BE USED, WITH 0 REPRESENTING NO MARGI}N. THE NORMAL DEFAULT IS 5r : POSITIONS THE RIGHT MARGIN, WITH A VALUE FROM 1 TO 255. THE NORMAL DEFAULT IS 75. IF THE RIGHT} MARGIN VALUE IS LESS THAN THE LEFT MARGIN BE PREPARED FOR SOME RATHER UNPREDICTABLE RESULTSt : TOP MARGIN POSITION. THE NUM}BER OF BLANK LINES TO BE PRINTED BEFORE THE ACTUAL TEXT IS PRINTED. DEFAULTS TO 5. IF A HEADER EXISTS, IT WILL ALWAYS BE PRIN}TED ON THE TOP LINE(S) OF THE PAGEb : BOTTOM MARGIN POSITION. THE NUMBER OF BLANK LINES TO BE LEFT AT THE BOTTOM OF A PAGE, }BEFORE GOING ON TO THE NEXT SHEET DEFINED AS THE PAGE LENGTH LESS THE VALUE GIVEN HERE. THE DEFAULT VALUE IS 58f : DEFINE FO}OTER. FOLLOWED BY A LINE OF UP TO 255 CHARACTERS, EXECUTION FORMATTING COMMANDS CAN BE INCLUDED IN THE LINE. YOU DO NOT HAVE }TO SET A HEADER TO USE A FOOTER OR VICE-VERSAh : DEFINE HEADER. AS FOR DEFINE FOOTER. IF YOU DO NOT WANT THE HEADER TO BE PR}INTED ON THE FIRST PAGE, SIMPLY PRESS THE RETURN KEY BEFORE DEFINING THE HEADERi : INCLUDE A FILE. IF FOLLOWED BY A LEGAL FI}LENAME (D:FILENAME.EXT), PAGE 6 WRITER WILL LOAD THE NEW DOCUMENT AND CONTINUE PRINTING AS NORMAL. THIS ALLOWS DOCUMENTS LARG}ER THAN MEMORY CAPABILITIES TO BE PRINTED.m : MARGIN RELEASE.USED TO OUTDENT TEXT, IT SHOULD COME INTO OPERATION BEFORE A LI}NE IS TO BE PRINTED, AND AFTER PRINTING THE NORMAL LEFT MARGIN VALUE IS RESTOREDn : NEXT PAGE. NO VALUE NEED FOLLOW THIS COM}MANDp :PAGE LENGTH COUNTER. DEFAULTS TO 69 THOUGH THIS MAY HAVE TO BE ALTERED DEPENDING ON YOUR PAPER SIZEq : QUOTATION. FO}LLOW WITH A LINE OF UP TO 255 CHARACTERS. IT WORKS IN A SIMILAR WAY TO THE BASIC REM STATEMENT AND WILL NOT BE PRINTEDs : SP}ACING. DEFAULTS TO 1 FOR SINGLE LINE SPACING, USE 2 FOR DOUBLE, 3 FOR TRIPLE, ETC.w : WAIT. USEFUL ONLY TO THOSE WITH LETTER} QUALITY OR SINGLE SHEET PRINTERS, IT MAKES PAGE 6 WRITER TEMPORARILY STOP PRINTING UNTIL A KEY IS PRESSEDx : CONTROLS THE P}AGE WIDTH AND DEFAULTS TO 80 FOR 80-COLUMN PRINTERS. USE 40 OR 132 FOR OTHERS% : A VALUE AFTER THIS SYMBOL, INDICATES WHAT N}UMBER TO START THE PAGE NUMBERING FACILITY WITH. DEFAULTS TO 1? : THIS CAUSES PAGE 6 WRITER TO START PRINTING ONLY WHEN THE }GIVEN PAGE NUMBER IS REACHEDEXECUTION FORMATTINGTHESE COMMANDS CAN BE EITHER AT THE BEGINNING OF, OR EMBEDDED IN, A LINE O}F TEXT. AGAIN REMEMBER TO HOLD DOWN THE SELECT KEY WHEN ENTERING THE KEYPRESS# : CAUSES THE CURRENT PAGE NUMBER TO BE PRINTE}Dc : CENTRE A LINE OF TEXT. PLACE AT THE BEGINNING OF THE LINE. IF YOU ARE USING A 40 OR 132 COLUMN PRINTER REMEMBER TO ALTE}R THE PAGE WIDTH ABOVE, AS CENTERING USES PAGE WIDTH IN ITS CALCULATIONe : EDGE TO RIGHT MARGIN. ALL TEXT ON THE LINE FOLLOW}ING THIS COMMAND WILL BE BLOCKED FLUSH TO THE RIGHT MARGINu : UNDERLINE MODE. USE ONE TO ENABLE UNDERLINING AND ON TO DISABL}E. IT WILL ONLY WORK ON PRINTERS THAT RECOGNISE CHR$(8) AND CHR$(95) AS THE UNDERLINE ON/OFF CONTROL MODESAS PAGE 6 WRITER W}AS DESIGNED TO BE SPECIFIC TO NO PRINTER, HOW DOES ONE SEND CONTROL CODES OUT? AS A PRACTICAL DEMONSTRATION LETS ADHERE TO TH}E EPSON STANDARD.FIRSTLY THE ESC CHARACTER MUST BE DEFINED AT THE START OF YOUR DOCUMENT. THIS CAN BE DONE BY HOLDING DOWN S}ELECT AND TYPING AN UPPER-CASE LETTER, FOLLOWED BY THE =SIGN AND THE ASCII VALUE FOR THE ESC CHARACTER. VIZ. } E=27REMEMBER THE E WILL BE INVERTED. THE E KEY HAS NOW BEEN ASSIGNED A VALUE OF 27 SO ALL THAT REMAINS TO BE DONE IS T}O DEFINE PRINTER CODES TO OTHER KEYS, IN MUCH THE SAME WAY. 1=14 2=15SO IF WE NO}W TYPED THE LINE: E1HELLOE2THE WORD HELLO WOULD APPEAR IN DOUBLE WIDTH, BECAUSE WE HAD SENT THE CONTROL C}ODES TO TURN ON DOUBLE-WIDTH PRINTING THEN OFF AGAINCONCLUSIONALL THAT REMAINS FOR ME TO DO NOW IS SAY THAT I HOPE TO PROV}IDE EXTRA ADD-ON ROUTINES IF THER IS SUFFICIENT INTEREST, SUCH AS WORD COUNT AND 80 COLUMN PRINT PREVIEWING, AT A LATER DATE.} PAGE 6 WRITER HAS BEEN TESTED WITH DOS 2.5, DOS XL, SPARTADOS WITH THE US DOUBLER, AND ONLY ONE PROBLEM OCCURRED IN USING DI}SKS THAT HAVE BEEN FORMATTED IN TRUE DOUBLE DENSITY, HEED MY WARNING.I HOPE YOU ENJOY USING PAGE 6 WRITER AS MUCH AS I ENJOY}ED WRITING IT. I WOULD ALSO LIKE TO EXTEND SPECIAL THANKS TO BEV PRINCE FOR A LITTLE SUPPORT AND TO CHARLOTTE FOR THE INSPIRA}TION TO FINISH THE PROGRAM.for printout on A4 single sheets or rolled paper. This part will not be printed.OR THE INSPIRAo8<<  B JKIHiDiELV`L8 8 BLV`Lx}8t8l Lu8hihiHHȱȱL8c !#3`Lu8JJJJ`H 8h`H}ȩh Q8L8 Z8L8 8L8 8L8 8L8S:@9E:E9H '9 H9I9 8 '9h)0IC}9D9L8 L :::: :Lr:::IEL[::i:iIIL[:`:i::i}::L:`L{:w:w: C`L:L: D8:MEM.SAV: 8| 9 '9`L:L: D:DUP.SYS:̩ 8} x:ɀL: '9`88 |9Y:X: '9L); D8:DUP.SYS; 8::88 9 '98? :`;WL`; 9}Ln; ` :Y;Y;L;L;)} Setting Up ATARI 130XE Ram Disk; 9L; ; -9  } L;D8:; :9 :Y;L