#@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@P!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr d M * @  $ % CC$$)%1 Udߥ$9%: !0 S$%} DD˙`  }J)Lr J  ((  p L ()   J}L= ( L 0q A    IB JC;? D W } LL  ` W )LA!  ߰")-݆ p" } $G@LL 08`Q")<2Q0 -G$Ș݆ UL# ; p8(()(0ʥ)NQ` }$GȘ݆LU )L ݆ L GȘ ݆LL )W>Z   HH)H }p h  hyhy D L> L JJ    ! LA*` BF }7'8  M HN H` 8 Z  \LdJJ!"! GFE@F (!L }EE !E^ ^ E E7EȩEdE/EȩE  D } .L }  ;F d  ;?F7F? ( .   Z D LL d } . D  L    p  E` , d)  D L) 0BM݊L݉} ML  N݆ L NLML [ TEqEHȱEqEh 0Gȹ G} HLL GɛL  LFREE SECTORS G) *Gȩ GȽG GȌ*jj >G} C8jJ3j2CD( C202C ԠBX` N 1? l LlD:RAMDISK}.COMLu L1 L ;LHL  T`  `8  ɐ     `TU  } L ? .  t`GBJ ~DEHI B V0dV!}QDEHI VF9 ,0 ,0 s0hhL  L` H hDHEh"}DEL8HI4 0 HI,0 0  9 .G VLO#},0 L4*IJ`llD1:AUTORUN.SYSNEED MEM.SAV TO LOAD THIS FILE.D8:MEM.SAV J y08 B|DEHI$} V0 0`B;DEL`?<0LV`@ʆ v s? F0Ξ05: [ BDEHI%} VY8 B V  @  /DE `E:D8:DUP.SYSERROR-SAVING USER MEMORY ON DISKTYPE Y TO &}STILL RUN DOS B;DE J  (` 9 V⪍ ઍ  -'}LLu ÝDEHILV 9 .l 9 .l  `` s$B BH(}I|DE V BLV nB,DE JLV B V BLVDEIʩ BꭝLu } 3E:}DISK OPERATING SYSTEM II VERSION COPYRIGHT 1984 ATARI CORP.A. DISK DIRECTORY I. FORMAT DISKB. RUN CARTRIDG*}E J. DUPLICATE DISKC. COPY FILE K. BINARY SAVED. DELETE FILE(S) L. BINARY LOADE. RENAME FILE M. RUN AT ADDRES+}SF. LOCK FILE N. CREATE MEM.SAVG. UNLOCK FILE O. DUPLICATE FILEH. WRITE DOS FILES P. FORMAT SINGLEL !N',}#"&))9(&*)/h)''-&؆莟R'S  vL/ˢ L }Insert DOS 2.0s, type Y Λx -}DEfHI 1莏#q! @ y0ɛ8A0,' ȅ 1 1ild! 1L!NO SUCH ITEMSELECT.} ITEM OR FOR MENU! 0 .z:*{}.|{ 1 0 0JB 18L%|DL/}%DIRECTORY--SEARCH SPEC,LIST FILE?[# 0 0 &|D3" 1L!NOT A DISK FILEN !B 1L!E# 1 !BD0}ED:}:1BJ|DE 1DEBHI 1 h0ߢ 0.1}  0?詛 1 y0YЛ 1 ;#L" ;#L! BL1TYPE "Y" TO DELETE...DELETE FILE SPEC2}COPY--FROM, TO?OPTION NOT ALLOWED228 FREE SECTORS COPYING---D1:DISKFIX.COMl# 0|D .L/%#3}##JB|DE 1BHID#E 1#0: B 1L!#͑### B 1#c$0SY4}S1}:## # # .#Ƚ# # 𩛙## 1,#PD#ELJ- <.BJD#E 5}1 1HH 0hh|DL%1}:̳# L% #D#EL% 1 0 . .0O% 1L!WILD CARDS NOT A6}LLOWED IN DESTINATION 0 <.|K}N 2 FORMAT. t* 5) 1L!`) 0NΞ 0 L1) 1 L!BAD LOAD FILELOAD FROM WHAT FILE?) 0 ?}0#B 1L!WHAT FILE TO LOCK?) 0 0$B 1L!WHAT FILE TO UNLOCK?DUP DISK-SOURCE,DEST DRIVES?TYPE "Y" IF OK TO US@}E PROGRAM AREACAUTION: A "Y" INVALIDATES MEM.SAV.FE! +L1   `*  70 2 2A} 0.* 1 y0 0)INSERT BOTH DISKS, TYPE RETURN^, 1 y038逍 N, 1L! ,B}C, t*  Lx+, 0 ^, 1 y0 , ,0,0 ,L+ ,I0 ,Vǭ0C}Ξ, 0 }, 1 y0C,ШC, 0K'!" H H 'h h Lx+!EF 5L1L!D,I,HhD}` NOT ENOUGH ROOMINSERT SOURCE DISK,TYPE RETURNINSERT DESTINATION DISK,TYPE RETURNE}`  `8 rL1`-* 1P* 1 y0Y`hhL!NAME OF FILE TO MOVE?- 0 0|DL% <.F},^ 1 70 0 .@L# .BJ 1  DEHIB V L1 ,} 1 70,L.  G}JB|,#P#DE 1 HI BDEHHII 1 B 1 ,^ 1 70,0La- B V,#PH},^ 1 70 0L#L!-* 1P* 1 y0Yj383}mm ݭI}}`8}``|* ? ɛ,`|:-)| / 1L!`DESTINATION CANT BE DOJ}S.SYS0 0H{ 24Δ 28/L!/) 2 Π 2 0 ξK}hAΞB,0 J 1 BDEHI,HÝDE 1HIHIDELSAVE-GIVE L}FILE,START,END(,INIT,RUN)O S0 1`BDEPHI V` S0H 1 L!M}0 0 1L~0`PLEASE TYPE 1 LETTER,0`hhL! 70 1L0L<1 ,;ɛ7,"ɛ:ݦ1ݥN}A"D|ݤD|ȩ:|ȩ|ɛ,,(/+.ީ1 1,ɛ`轤{NAMEO} TOO LONG B VL!` L1I H1EΝDL1|mDiE` V0`8d/8 i:222 1 LP}!ERROR- 160ɛ+,' 20*.. өr2 1``2TOO MANY DIGITSINVALID HEXAQ}DECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8uR} ECIMAL PARAMETER800 0 8 00`,0'D800 H,ɛh`2L1NEED D1 THRU D8u8<<  B JKIHiDiELV`L8 8 BLV`LxT}8t8l Lu8hihiHHȱȱL8c !#3`Lu8JJJJ`H 8h`HU}ȩh Q8L8 Z8L8 8L8 8L8 8L8S:@9E:E9H '9 H9I9 8 '9h)0ICV}9D9L8 L :::: :Lr:::IEL[::i:iIIL[:`:i::iX}::L:`L{:w:w: C`L:L: D8:MEM.SAV: 8| 9 '9`L:L: D:DUP.SYS:̩ 8Y} x:ɀL: '9`88 |9Y:X: '9L); D8:DUP.SYS; 8::88 9 '98? :`;WL`; 9Z}Ln; ` :Y;Y;L;L;)} Setting Up ATARI 130XE Ram Disk; 9L; ; -9  [} L;D8:; :9 :Y;LLG d}چن߂ 6 M L섭܂ L 6 K L 6 K ʅ 6 M  e} 6 K 6 K L&ą 6 K ʅ 6 M  6 K!  6ɂ M >L1 f}ʅ 6 K ʅ 6 M  6 K  6ɂ M >L1ͅ 6 K ʅ 6 g} M  6 K  6ɂ M >L1Ѕ 6 K ʅ 6 ؆ M  6 K Ӆ h}6 K ۆ ` Lنچ چن 6 6 À LKنچ 6 `ENTER # i}LOAD #ASM ASM #,#,#,#DOSۆ䝇!"``!"ffLL}OS j}S MAC/65MACRO ASSEMBLER 4.20 (c) 1982 Stephen D. Lawro.I.ELS.ENDI.MACR.END.TITLŠ.PAG.WOR.ERRO.BYT.SBYT.DBYT.E k}N.OP.TA.INCLUD .FLOA.CBYTŻ.LOCA.SE*.JSJMDEINLDLDSTSTCPCPBIBRCLCLCLCLDEDEIN l}INNOPHPHPLPLRTRTSESESETATATSTXTXTYBCBCBEBMBNBPBVBVORANEOADSTLDCMSBASROLSRO% <> m}.DEƽ<><.O.AN.NOԡ.RE .REF.DEF.NOT .AND .OR ,X),,,ةNNOOBEREJECLISX n}REMLISCLISNUؐҐҐɐҐ3''3ϐꐰ'ϐϐĐPKrrurSSTWT~x(æK o}J3bǧrnhw ^~7*C25  榤 XʈHh(@`8x0Pp!Aa p}&Ff Ɍ T :X  ,  C uLЋ - ۢ q}-Hȱ h L(EDIWHATTEXTMODũ5 L(Ҍ` HH`ɛ ۱Lɛ r}L^LH Ɛ ݟ 8 zH %h  c $p əLHL ݟ H %h  s}@ ؐ`H h ٰ եԄL Q Ɉ򅗅 `  C t}Ȋ L0ߩ` 04C L؍l !L؍ u}L;8eHeHL H H`L0󆞥hhL;`ʆL; 0  v}  L L; `` 񒦞` ) %H$H`͒I9Ɛ Ɛ`L ĭs  w}i ů8` @`` ۢB `хѦ򤟱")Q ȱ8e`8`LISԠNEבDE̘FI x}NIJASSAVLOAENTEBLOABSAVNUPRINRE΢REРSIZLOME͠BYŠCРDO TEX ۄ ذ ِЄ y}L ۱$  @L8 @ @ @` ۄЩ Əe Ə  ZڰեLo800  z}8` ۹ɛg+< ۩, @`0" `Ѫ$ɛ @$P ` {}8`ɛ @`0 g8`0 45` ۄ, = @`8`U; =ZZZfZn |}nZ& /# 1D EFGJHIMKL=>A Aλ߻A A @: }}=>@>>8?8679<;ޑ<<;C;?<;< ~}>7;;<;<><;N;?>;<<;<;;B<<>< 0 4 5 # 1u  } $%! 3" 2=_  W @=:q:ߌћݝOƞd6ޕÛipMM/,[]+ }-*/!&^"   ۱Ò ɛ;ė(` -Є 5ɛș IX; @򹋻 @ɛ`旤 };*,0ҪH  h`L ۄЄ  @)++D LT hh ` ۤЄѱ  }>  &𥐪 @ @񊨱ɁȱAх`? [``.8` i L@0:`󙋻ə< }ɛ5)"ȱɛ&)"a{i 'ȱɛ`IȢ8ee͙̘ װL8 }u慓eeeee褚 `8IȄ嚅8圕坕 }嚅馛褚`` . ݟ ȱ "Lsee`Lee` }  g `8` ݟ ȑ "L ,L ݟ "8堨0 }L c S> a з` g S /    "Ll` L  Qڥ }< g Qڠȱ)Ȅ汥 )   UX `Xd ĵB  ] Ķ m  } ` 9;!  ݩLVԩ <0 ̎ H Nԅh ܗL'ՅԅՅօנ&uԕ } JJJJ ϗ) ϗ(L' 0 `$  ꗥHJJJJ h))`Lį`s8 քՊօ }0ȱ8eԐհֱ֤֠H h`J (L ` ) ` ``͌ƵƵƶƶ`mi͝L }H 0+ hȄ H Qڭim hLhH hL˜ H  hH hɛ` S }Ʈ` S  g LݟƐƐLݟ@  SƐ  SAR }{Ɛ 00 N g 0ͥeLyԦH gh g S) S N g$PI L } Įɛʆ N g䮐)`  Lai@( `ș`@  SE*JFH hG }*I%L˚ SJ FH ޚh* S=Lܢ`8qiHH hihi` }H饦 ޚL  LEH h HLܢ WHVH`ajllvp)`8`LLܢ g. };* S  Q ؐ! gͭLv ] ]ҩ; S>+ 8吪8吅膐 LWƐ ] } 8 " ,p   "L`- ? Qک Q L(Y ɛL08҅8HŲ }&eҪȹɛʈıh8宅汥豂Ʈ򅗅 -L^ BL& c 򈄲 }Ʊ洤́汤IJ ـ褳Ȅ` , g S?莁` S)e` m } m } }mL= SB  JLH$ h L L g SN 匥 eLH LH g Z ZL Z }Ze樥e͙ ̘Ѧ o  碈  з` Z7 Z0 Z ZLF Z Z 9 } ZL|L ȟ 8儅充 k  ӍLӷ ȟ ( 8慜煝 k }Lʼnň` š Š``  `ŝ Ŝ` ԥ ݟ $p L( N [б })ȩ Ȅe8Ш ˶ LQڥЯ ˶ L ޶Lԟ搠 ޶  ն L ř Ř } ř Ř` "L` e` }  } g    š Ġ }`Ʈ0ii`   g; L L L` g]; X _ &  gD S; } g+ S; ȟ g / ~ G P n !@ ^ L+ S<` }& { з ޶ii  j H L(  G P:ӄ7 }X҄ۺ;hd~  }` <& S] ߭р SXILLy,PLޚ$0c ^ m )$0O J = ե m $01  }, L۸$ 8 MLL θ)` Ƹ  Ĺ  -(`$0 ` L S i U8`0 } "Ȅ<$0)Hh`H 8嬨孪8h g g0  0 L }v" mHlH`+LD gLv)ㅪ) S?>  @Ɛ eɂ ɀ  }  g g g  Lv  (L9@ L 9L < S ` S 9) - } ܢLLܢ LФȥ LL ư  LܢLФ` L S ) } Lܢ@𥆝i ܢ 0$0 `i e/ }ȑȥȥȄ g>;:=A /L*Ɛ HhȥȥȄiL⥥`L S  Ǭ搦ʩ` }G!@` ܢ`Le H h g g gLv@L搩l S }@)8 <L S`L*) ܢ < ܢ S`8 } E( Ǭ$0). ȥՑL) ȱՆL ) LHH hh` էL }ܢ է Lܢ SA`/0 S)QP S) `    cLܢ Z Z Z Z`L } $LHH ޚ hhLL$ 8`$p/+ߤėLѤė ՚ Ƹ } ਩8 LШL۸ Ĺ  sƗƮ`_<+ 2ԅդ6e  }$Hՙ+ȥԙ+ȄhԅL83+`ų* {LdHH`+L8 L搥 Ɛԥ }ȥ`刾++`(Xȉ9܂e( S0' J搱`LS 1 }`ei` )ȱ` ` S@` 劤шܦ eȪHȱȱ)h`6` }0``Յԩ` ©eԅԘeՅ`8ԅԩՅ` ©8ԅԘՅ`օנ` © FfffԈ0?uؕԅՅ } ©Ն &&&8થ׆Ԉ` ©%ՅՊ%ԅ`$p$0)  몥 Ն` 몥 })Iڤhh+Lshhզ uՆL8 ©ՅՊԅ` ©EՅՊEԅ` ©Ր` ><7 23 +)* ©! }  LL    ) }䯐` ?i??[Z 07ee YzȱĘL8匝 }卝ei͙ ̘L8匑ȥ卑ȪȑȑȩȽ䯐`$P<@4 }!18匝9卝808899莚(` Lӭ )H0 L )ёё hH  h$ }$0 ,P {`? ?ԩL*** ERROR -MEMORY FULBAD DEBRANCH RANGNOT Z PAGE/IMUNDEFINED LAB }EEXP TOO COMPLEDUP LABEO'FLO IF/ENDIF NESTIN VAL >25 IF/ENDIF STAC NESTED MACRO DE PHASE ERRO*= EXP UNDESYNTAX } O'FLODUP MACRO NAMLINE # >6553MISSING .ENDNO *NUM/REN O'FLONESTED INCLUDLIST O'FLONOT SAVE FILLOAD TOO BI }NOT BINARY FILINVALID .SETOO MANY X-REFTOO MANY LOCAL FIELDUNDEFINED MACRMACRO NESTIN BAD PARAMETE!NOT F.P. NO } DEV HANDLE҉TRUNCATED REÊTIMEOUԋNAːWRITE PROTECTEĒBAD DEV CMĠDRIVE TOO MANY OPEN FILEӢDISK FUL̥FILE NAMŧLOCKEĪFIL }E NOT FN(SEE MANUAL$`݆   װLH`H H hh 鸩 R ƥ0C }6ȐH J, h⩮^+ȱ8e;LLa L ͹0L` GA }) 8动勢  * ɇ * *LɆɅɄ $p 6LN`ۺȄ@ J @[ }L 0 0 Ĺ `0עਈɛO(K֠)- Hȱh ץ8 0L }q JL >L(@[` 0 0i~iنؠ0 >օנ֐ֈƮ ȱ֐+Į! }䪱ؑHر֑hֈ֥ЦքׄИ}e`q䨊e`8包卅  0PH }hšĠ答 $0 (,  J8  鸩 Ĺ Lqɇ'IimiLv  LvɆ } LֳɅ LvɄ#Lv`` Z渦 6LN ) `Ԣ儐 }`Z8圅坅 o   L8HI 8` }LKȅ k L搥3 财 Qڠ Ÿh _ &Lܢ Lܢɛ }򈱑 `濥ɀ`8~H m~  h`$0 8 xIiH {h {L } { {ȹ8 {9 {̚ȱ`& Ͷ LMLN= Ȋ ``l 搤搱` Ͷ 0`L }ө ϶HI` `H ҶhH hLJ*K+GHFH`H ƶhL `H ն  } նhJ S)` 0`ɀ/ L˷)Lʎ JLڱ)⭆Ŧ  L( } `Ɉ"% ͶNLM 0L4 ӷ 财@` 緥Ɉ` ն 0` ն }C` ӷΆ`~IHEDBKLV`ՆԈ gȱ80 LQՆ gФб$0 } (` LH shHJJJJ ~h)L0123456789ABCDEF s )LL mL殤 (` L0) `` }) Lװ`͟?)4 Ƹ/HH L ^ hhԩ` է Ƹ ܢ J`L 鸭 }` { Ĺ  J }L Ĺ۠ 8 XhLL` }Ĺ  J }8厪 J"LPAGESYMBOL*** ASSEMBLY ERRORS: BYTES FRE ?=?%?=?ۺ; } } }DOS } ]1 dEInX;xX; THE CLASH OF KINGSX; BY: Bryan SchappelX; and Barry KolbeX;X; Chess section by:X; Bryan S}chappel (c) 1985X; X; EquatesX;PMBASE;;PM baseGRACTL;;PM enableHPOSP0;;HorizontalHPOSP1};;P/M positionsHPOSP2HPOSP3HITCLR;;hit clearSIZEP0;;P/M sizes"SIZEP1 ,SIZEP2 6}SIZEP3 @SDMCTL/;;DMA screenJSDLSTL0;;display listTGPRIORo;;priority reg^PCOLR0;;P/M colorshP}COLR1rPCOLR2|PCOLR3COLOR0;;PlayfieldCOLOR1;;colorsCOLOR2COLOR3COLOR4}COLPF0;;hardware colorCOLPF1;;registersCOLPF2COLPF3 COLBKWSYNC ;;wait for sync}CHBAS;;char setVDSLST;;DLI vectorNMIEN;;NMI enableSKCTL;;sound controlsAUDCTL&AUDF}1;;freq. registers0 AUDF2: AUDF3D AUDF4NAUDC1;;volumes +XAUDC2;;distortionsb AUDC3l} AUDC4vVSCROL;;vertical scrolCONSOL;;console keysSTICK0x;;joy stickSTRIG0;;fire button}RTCLOK;;jiffy clockSETVBV\;;Set VBLANK vecSYSVBV_;;system VblankXITVBVb;;exit VBVATRACTM;;atra}ct modeBOOT? ;;boot flagDOSINI ;;init vectorCOLDSTD;;cold startRANDOM ;;random numberX;MYPM};;P/M memory PLR0MYPMPLR1MYPM PLR2MYPM*PLR3MYPM4GAMBRD;;current board>HTAB};;hit tableHMYSCRNMYPMRMYLINEMYSCRN\SCRTAB;;scr mem tablefSLN1MYSCRN;;scroll memorypSCMEMMY}SCRNzPMBMYPM;;player baseZPAGE;;zero pageX;BORD;;border charBAR;;hit point barSTAR;;bould}er(star)X;X; Zero page usageX;INDR ;;indr temp holdTABPOS ;;table positPLRX ;;cursor X}-posPLRY ;;cursor Y-posSCR ;;screen pntrSCROLC ;;scroll indexSAVEY ;;Y hold$SAVEX ;;X }hold.MOVED ;;last move8IND2 ;;temp indr holdBPLAYER ;;current PLYRLSAVEA ;;temp A holdVOLDPOS} ;;old TABPOS`OLDPCE ;;old piecejOMOVE ;;old movetMEN1 ;;lives left~ MEN2 LINES ;;lines} scrolledDCLOR ;;DLI colorDLIX ;;DLI save XINTC ;;DLI base colorWINNER ;;battle winnerPLR}TYPE ;;player typeTIMER ;;fade timerVTIME ;;plyr def timerSTIME ;;sound timerPTYPE ;;plyr} typeRFLG ;;who hit flagEXEC ;;vblank exec flgWSR ;;whirley sound PMFR ;;player pntrs PMTO} XTEM ;;save x(TEMP ;;temp location2XPOS0 ;;plyr positions<XPOS1 ;;x coordFXPOS2 PX}POS3 ZYPOS0 ;;ditto-y coorddYPOS1 nYPOS2 xYPOS3 SCX ;;scr pos of plyrWC ;;wal}l check flgSAVST ;;saves sticksX1 ;;store xX2 ;;store xZAP ;;plyr hit flagBSR ;;blowu}p snd regMISM ;;miss directionMISF ;;missile fromMIST ;;missile toHTS ;;# hits leftHSCL };;h scrl regVSCL ;;v scrl regUDFL ;;missile Up/Dn?MSR ;;missile soundMTIME ;;missile timer}"PFLG ;;hit plyr flg,PCX ;;store x6TRY ;;other plyr pos@ZTIME ;;maze timerJMZR ;;random ma}ze ptrLG ;;hit plyr flg,PCX ;;store x6TRY ;;other plyr pos@ZTIME ;;maze timerJMZR ;;random maKD:KINGEQU.M65 >D:KING.DATX;X;Erase P/M MemoryX;CLRPM%>;;zero }A + YCCPM1PPLR08;;zap plyr's PPLR18 PPLR28 PPLR383HCPM1;;loop again :;;bye.X;"X;Erase screen m}emory,X;6CLRSCR$>;;do 1K@%>J'SCRT Q>5MYSCRN^ PSCRhCrCS1P@SCR7|3HCS1;;page yet? #SCR}0;;next pageICS1 :;;done.X;X;Erase MYLINEX;ERMYLN%>';;40 charsQ>ERLPMYLINE8;;on scrn1I}ERL :;;doneX;X;Print routine&X;0EPRINTPIND2;;save address: 'IND2D ERMYLN;;clear lineN 3;;Y = 0XPRL}1Q@IND27;;first charbIPRL2;;normal? printlM>;;mask inversevPRL2PMYLINE8;;on screenQ@IND27;;get againGPRL3};;if>$80 end3;;up countHPRL1;;go againPRL3%>w;;two secondsPRL4 WAIT;;wait jiffy1;;dec loop IPRL4 :;;}leavePRL5$>;;wait 10 sec.PRL6 PRL30 HPRL6: X;X;Show number of men left X;*MENLEFTQMEN1;;player} one4,;;add color>O>PHPMENL;;on scrnRQMEN2;;same for\,;;player twofO>Pp PMENLz :;;done.X;X;Ver}tical Blank RoutineX;VBLANK1Q>;;just KILLPATRACT;;atract mode. !SYSVBVX;X;Audio promptsX;BEEPQ>};;high toneHBTONE;;play itX;BOOPQ>d;;low toneBTONEPAUDF1;;save freqQ>;;pure sound PAUDC1$ BWAIT;};and leave on.X;8X;Sound OffBX;LSNDOFFQ>;;now zeroVPAUDF1;;the sound`PAUDF2;;registersj PAUDC1t PAUDC2~}:X;X;Wait 4 jiffiesX;BWAIT%>;;wait 4 jiffiesDOW WAIT;;pause 1 jiffy1;;decrease loopIDOW;;do again} :;;leaveX;X;Turn on screenX;TURNON$>&COLOR4;;in color  &COLOR2$> &COLOR1($>4GDLI;;point to} DLI2 &VDSLST< $>5GDLIF&VDSLSTP$>;;turn it onZ &NMIENd$>>n &SDMCTLx :;;doneX;X;Turn off screen}X;TURNOFF$>&SDMCTL;;turn off scrn !WAITX;X;Posit players for boardX;POSPM$>;;get zero &PCOLR2} &PCOLR32&GPRIOR;;set priority&SIZEP0;;double wide CLRPM;;erase P/M"Q>;;gold color, PPCOLR06Q>5MYPM};;set PMBASE@ PPMBASEJQ>;;set sizesT PSIZEP2^ PSIZEP3hPGRACTL;;turn on P/MrQ>;;define plyrs|%>>;;2 + 3 as} thePDF1PPLR28;;borders PPLR383)> HPDF1Q>,;;now positionPHPOSP2;;them on theQ>;;screen PHP}OSP3 :;;later.X;X;Switch playersX;SWITCHQPLAYER;;get playerN>;;flip itPPLAYER;;store& :;;done.0X;}:X;Wait a 1 jiffyDX;NWAITQ>;;zero the clockX PRTCLOKbW1QRTCLOK;;get clocklFW1;;if same loopv :;;leaveX;}X;Test player moveX;TESTITPSAVEA;;save AGMVOK;;empty? yes.FMVNK;;bad moveR>;;objects? EMVNKQPL}AYER;;get plyr #HHAV2;;player 2QSAVEA;;charR> ;;equal 10?EMVOK;;no. good.DMVNK;;bad move. HAV2QSAVEA;};restore AR> ;;> 10? EMVNK;;yes. bad one.*MVOK,;;signal good.4 :;;leave.>MVNK;;;signal bad.H :;;leaveRX;\X };Move + define cursorfX;pDEFINEQPLRX;;get X poszPHPOSP0;;in horizontal%PLRY;;get Y pos$>;;and erase topA };;half of theDEF0PPLR08;;cursor1 HDEF0%PLRY;;get Y againDEF1QDEFPL19;;and put inPPLR08;;the definitio }n32(>;;20 bytes yet?HDEF1;;no. DEF2PPLR08;;now erase under 3;;the cursor. HDEF2$ :;;done.. X;8 X;P }erform a cursor moveB X;L DOMOVE%MOVED;;get moveV QMOVTAB8;;load and store` PMOVJMP;;vector inj QMOVTAB8;;the } tablet PMOVJMP~ MOVJMP!;;Move it! X; X;Move LEFT X; LEFT%TABPOS;;get pos QGAMBRD8;;look left FD}N1;;bad move! %>;;okeh move it LLP'SAVEY;;back 8 pixels "PLRX  WAIT;;wait a jiffy DEFINE %SAVEY 1 I}LLP "TABPOS;;new posit DN1:;;done.( X;2 X;Move RIGHT< X;F RIGHT%TABPOS;;positionP QGAMBRD8;;look rightZ FD}N1;;bad oned %>;;move rightn RLP'SAVEY;;8 pixels.x #PLRX WAIT DEFINE %SAVEY 1 IRLP #TABPOS : X}; X;Move UP X; UPQTABPOS;;posit ;;;up one line S> ? QGAMBRD8;;look in board FDN2;;bad move!" 'TABPOS;};save posit, %>;;move player6 ULP'SAVEY;;up 16 pixels@ "PLRYJ WAITT DEFINE^ %SAVEYh 1r IULP| : X; X;M}ove DOWN X; DOWNQTABPOS;;posit ,;;add 13 for line O>;;down ? QGAMBRD8;;get piece FDN2;;bad 'TABPOS;;sa}ve posit %>;;move player DLP'SAVEY;;down 16 pixels #PLRY WAIT DEFINE %SAVEY& 10 IDLP: DN2:;;all do}neD X;N X;Read Stick + buttonX X;b X;MOVED = 0 for leftl X; = 2 for rightv X; = 4 for up X; = 6 for do}wn X; STICK$PLAYER;;get player Q>;;and reset PSTICK09;;stick values Q> PSTRIG09 QMOVED;;put last move} POMOVE;;in hold area STCKQ> PMOVED;;no move made CSTKQSTICK09;;read stick R>;;no move FTRYTRG;;try trig}ger R> ;;left? HST0;;no. Q>;;move is 0* FSTDN4 ST0R>;;right?> HST1;;no.H Q>;;table offsetR HSTDN;;=2\ }ST1R>;;up?f HST2;;no.p Q>;;offset = 4z HSTDN ST2R> ;;down? HCSTK;;no. read again Q>;;make a 6 STDNP}MOVED;;save move ;;;signal move : TRYTRGQSTRIG09;;trigger HCSTK;;read stick ,;;signal fire : X; X;Add bord}er to game board X;ADDBORD$> ;;12 linesQ>;;make thePCOLOR2;;screen black$ PCOLOR4.Q>4MYSCRN 8PSCR}BQ>5MYSCRN L PSCRVBOR0%>;;26 chars`Q>T;;red spacejBOR1P@SCR7;;on screent1;;down loop~IBOR1;;and }run againQSCR;;now add 40,;;to screenO>(;;pointer toPSCR;;get to nextQSCR;;screen lineO> PSCR}0;;dec outer loopIBOR0;;do again:;;all doneX;X;Randomize terrain featuresX; TERRAIN%>;;21 features}TERR1QRANDOM;;numberR>( DTERR12R>Q< ETERR1F>PTERR2QRANDOM;;next numberZR>;;check if pieced DTERR2n }R>x ETERR2PSAVEA;;save itQGAMBRD9;;get pieceITERR1;;<128 no goodQSAVEA;;get feature,;;and add 18O!}>PGAMBRD9;;put in 1;;boardITERR1;;do againX;X;Now assure a path throughX;DOPATHQRANDOMM>;;only"} 0-3 R>;;=3?FDOPATH;;yes do again"T?;;times 8,T?6T?@?J$>;;do 8 spacesTPATH2QPATHS8;;get posit^'SAV#}EY;;save Yh?rQ>;;get blank|PGAMBRD8;;put in%SAVEY;;board. get Y3;;up posit0;;dec loopIPATH2;;and loop $}again:;;all doneX;X;Fill play fieldX;SETSCR%>Q>4DLIST1;;install myPSDLSTL;;display list Q>5DLIST%}1PSDLSTL SE1QGAMBRD8;;get a pieceFSNXT;;leave aloneISE2;;have character&Q>;;get empty0SE2T?;;* 2&}: T?;;* 4D'SAVEY;;save yN>;;char indexXC;;screen positb T?;;* 2l?vQSCRTAB8;;look up addrPINDR;;and save it'}QSCRTAB8 PINDR%>SE3QCHARS9;;get charP@INDR7;;on screen2;;up count3)>;;2 yet? HSE3;;no(}.%>QINDR;;add 40 to scrn,;;positionO>(  PINDR QINDR O>* PINDR4SE4QCHARS9;;next half of>)}P@INDR7;;characterH2;;goes on screenR3\)>fHSE4p%SAVEY;;restore YzSNXT3;;up it.)>F;;70 yet? HSE1;;no*}. :;;done.X;X;Copy game boardX;BEGIN-;;no decimalQ>;;fix boot status PBOOT?Q>4BEGIN;;make program+}PDOSINI;;reset proof Q>5BEGINPDOSINIQ>;;init soundPSKCTL;;stuffQ>;;kill cold start$ PCOLDST. P,}AUDCTL8$>;;erase bottomBERZPGPZPAGE9;;half ofL2;;page zeroV HERZPG`?jZGBPGAMBRD8;;erase GAMBRDt3~HZGB-}Q> ;;set # of men PMEN1 PMEN2%>E;;now copy inBEG1QBRDSET8;;the newPGAMBRD8;;board1 IBEG1%>.};;copy in theHTBQHITTAB8;;hit pointPHTAB8;;table1IHTB Q>4SCRTAB;;now we makePINDR;;up the screenQ>/}5SCRTAB;;definition(PINDR;;table.2$><Q>4MYSCRN, ;;startFPIND2;;screen positPQ>5MYSCRN, Z PIND20}d SC1%>nSC2QIND2;;get scrnx,;;and add 2O> PIND2P@INDR7;;save in table QIND2O>;;now do hi byt1}e3P@INDR7;;in table PIND23)>;;28 yet? HSC2;;no.QINDR;;now add offset,;;to tableO>;;positi2}onPINDR;;and store it. QINDR"O>, PINDR6QIND2;;now update@,;;screen pointerJO>4;;52 chars laterT P3}IND2^ QIND2hO>r PIND2|2;;up line count(>;;5 yet? HSC1;;no. INTRO;;display intro TERRAINX;4}X;Start of gameX;CHESS TURNOFF%>4VBLANK1;;set Vblank$>5VBLANK1;;vectorQ>;;Immediate mode SETVBV;;5}set it! CLRSCR;;erase screen ADDBORD;;add border SETSCR;;set board up POSPM;;add P/M& TURNON;;turn it on06}X;:LOOP0Q>N;;position playerD PPLRXNQ>FX PPLRYbQ>;;set tabpos.l PTABPOSvQ>;;make player 1 PPLAER7}QPLAYER;;get player FSCRONQ>;;player 2PPLRX;;reset cursorQ>;;and tabposPTABPOS;;pntrs.Q>i;;player8} II PPLAERX;SCRON MENLEFT;;# men left SETSCR;;update scrnLOOP DEFINE;;put on cursor$PLAYER;;player9} num  STCK;;read stickDFIRED;;pressed fire  DOMOVE;;move cursor*!LOOP;;and loop....4FIRED%>;;zero out move>:}Q>;;tableHFR1PMOVES8R1\IFR1f%TABPOS;;get table posp'OLDPOS;;and save itzQGAMBRD8;;get piecePOLDPCE;;};save it.GLOOP;;blank. loop.R>;;trying to moveELOOP;;on terrain?$PLAYER;;get playerHPL2;;have player 2<}R> ;;trying to moveDCHOK;;on yourself?ELOOP;;yes!PL2R> ;;same thing. DLOOPX;X;Now we see if the piece=}X;selection was a good oneX;CHOK%>;;check 4$MCK0QGTABH8;;inset table.PMCHECK;;position8QGTABL8;;in p>}rogramBPMCHECKL'SAVEY;;save YV%TABPOS;;get pos.`MCHECKQ8;;and piecej TESTIT;;test playerstEUPLP;;bad ?}one~%SAVEY;;restore YC;;possible moveT?;;* 2 andPMOVES8;;save moveUPLP%SAVEY;;get Y again1;;and loop aga@}in IMCK0X;X;Now see if any move isX;possible this time.X;%>SMVQMOVES8IHAVMOV;;got one! 1ISA}MVQ>4ALAS;;print can't(%>5ALAS;;move.2 EPRINT< ERMYLN;;erase lineF!LOOP;;loop again.PHAVMOV BEEP;;beep!ZB}TRYMOV STICK;;read stickd QMOVEDnGTRYMOV;;mask out buttonx%>;;test againstCMVRMOVES8;;possible movesFGMOC}VE;;good move!1ICMV BOOP;;Error!!TRYMOV;;try againGMOVE DOMOVE STICKDBEP$PLAYER;;player #%D}>;;wait 1/2 secondGVMQ>;;and check forPRTCLOK;;press of fireGVM1QSTRIG09;;buttonFBEPQRTCLOK;;get cloE}ck"FGVM1;;=0? yes.,GVM21;;loop again6IGVM@%OMOVE;;now we moveJQNEGTAB8;;the cursorTPUNJSR;;back to its^F}QNEGTAB8;;originalhPUNJSR;;position.r UNJSR |!TRYMOV;;go againBEP BEEP;;signal move%TABPOS;;get pG}ositQGAMBRD8;;and pieceIDOBATTLE;;do a combat!QOLDPCE;;just move oldPGAMBRD8;;piece on the%OLDPOS;;boardH}Q>;;remove previousPGAMBRD8;;character SWITCH;;flip player!LOOP0;;and loopX; DOBATTLE?R> ;;player >I}10? DGP1;;no.'PLRTYPE;;player type&1;;decrease index0QHTAB8;;get hit points:PHTS;;save emDHINH0;;playJ}er 1 hitsNGP1'PLRTYPE;;player 1X1;;down indexbQHTAB8;;hit pointslPHTS;;savevINH0%OLDPCE;;old piece )> ;;>1K}0?DGP11;;no.'PLRTYPE;;move player 11;;hits out ofQHTAB8;;table PHTSHINH1;;play gameGP11'PLRTL}YPE;;player #11;;and get outQHTAB8;;their hitsPHTSINH1 TURNOFF;;screen offX;Q>@ PNMIEN;;kill DLI'sM} BATTLE;;Do battle! $>;;do 2 players*UH0%PLRTYPE9;;type #4QHTS9;;new hit points>1HPHTAB8;;save in tableRN}0\IUH0;;do nextfQPLAYER;;get the playerp>;;X holds plr #zRWINNER;;same as winner?HCHANGE;;no. lost.N>>O}QOLDPCE;;old piece%TABPOS;;and move toPGAMBRD8;;the new squareX;CHANGEQ>;;erase old guy %OLDPOSPGP}AMBRD8;;save in board. SWITCH;;flip players"MEN19;;lower men leftQHTAB;;check if kingsFDEATH;;are dead yetQ}. QHTAB FDEATH$!CHESS;;and play chess.X;8X;Handle Death of a teamBX;LDEATHA;;get playerVN>;;flip it`R},;;make scr memjO>tPTROPHY;;save in string~ CLRSCR MENLEFT;;show # left ADDBORD;;add border SETSCRS} POSPM;;put on P/M TURNONQ>4TROPHY;;print trophy%>5TROPHY;;message. EPRINT PRL5;;wait 10 sec CLRPT}M;;remove P/MQ>@ PNMIEN TURNOFF !BEGIN;;start over.X;X;Introduction Screen(X;2INTROQ>;;screen off<U} PSDMCTLFQ>4IDLST;;install disp.PPSDLSTL;;list.Z Q>5IDLSTdPSDLSTLnQRANDOM;;random #xM>;;hit nybblePV}INTC;;save in colorQ> ;;and add charac.PCHBAS;;set. CLRPM;;remove players CLRSCRQ>4DLI1;;install DLIPW}VDSLST;;address inQ>5DLI1;;vector.PVDSLSTQ>;;fire DLI! PNMIEN%>;;copy 4 nums.ICQICLR8;;get numbX}erPCOLOR08;;save in color1;;dec loopIIC;;do again"X;,X;Now add text to intro6X;@Q>4SLN1 ;;start adrJY}PSCR;;of where textTQ>5SLN1 ;;goes in^PSCR;;memory.h$>;;zero XrPTILQSTXT9;;get a position|FLINFD;Z};if 0 line feed?;;in Y regPTIL22;;up XQSTXT9;;next charR>;;if $FF lin feed FLINFDR>;;if $FE then end[} FSTITLP@SCR7;;in memory 3;;up YHPTIL2;;and do againLINFDQSCR;;now add a 32,;;to memoryO> ;;pointer \}PSCR;;save it. QSCR;;get hi byte O>;;and add carry& PSCR;;save it.0 2;;up X: !PTIL;;do again.D X;N X;Sc]}roll Title ScreenX X;b STITLQ>=;;turn on narrowl PSDMCTL;;screen.v Q>5SLN1;;set LMS to my PDVC;;memory. Q>^} PDVC PATRACT;;kill atract PLINES;;lines = 0 DOLNQ>;;scroll counter PSCROLC;;is zero. LNL WAIT;;wait 1_} jiffy #SCROLC;;inc scrol count QSCROLC;;get it. R>;;done 8 yet? FLNDN;;yes. line done PVSCROL;;in VSCROL!Q`}CONSOL;;check START key !R>!FSTARTUP;;if pressed go! !HLNL;;loop again.*!LNDN%>;;zero Y4!'SCROLC;;counter nil>a}!'VSCROL;;same for VSCROLH!QDVC;;now add 32 toR! ,;;the LMS\!O> ;;instructionf! PDVCp!QDVC;;and take carez!b}O>;;of hi byte.! PDVC!#LINES;;inc lines done!QLINES;;get it.!R>%;;37 lines yet?!FSTITL;;yes. start over!c}%>;;check if this!CLNRPLINS8;;line is one!FWSEC;;we pause on.!1;;not this one!ICLN;;try next.!GDOLN;;do nexd}t line.!WSECQ>;;zero clock! PRTCLOK"WSC1QRTCLOK;;get it and"R>x;;wait 2 seconds" FDOLN$"QCONSOL;;check CONSe}OL."R>;;START?8"HWSC1;;no. loop.B"STARTUPQ>@;;kill DLIL" PNMIENV"!TURNOFF;;and play game.`"X;j"X;DLI for intro cf}olorst"X;~"DLI15;;save A"&DLIX;;and X regis."DLL0QINTC;;color"PDCLOR;;save it"$>;;loop 8 times"DLL1QDCLOg}R;;get color"PWSYNC;;wait sync"PCOLPF3;;store it",;;add for next"O>;;luminance"PDCLOR;;and save it."0;;dec lq}B%DOS SYSB*)DUP SYSB SRAMDISK COMBy\MAC65 COMBKINGEQU M65B|KING1 M65BRvKING2 M65BHKING DATB+KING COM"KERNCODEM65zKERNEL M65SKERNMAC M65PMGR M65!SCROLL M65B"MEM LIS)dIOMAC LIBoop count"IDLL1;;and do again#X; #$>;;loop 8 more#DLL2QDCLOR;;get color#;;;and subtract 2(#S>;;from luminancr}e2#PWSYNC;;wait for sync<#PCOLPF3;;store itF#PDCLOR;;save colorP#0;;dec loopZ#IDLL2;;and do againd#7;;restore An#$s}DLIX;;and X regs.x# 9;;done.#X;#X;Game board DLI1#X;# GDLI5#Q># PWSYNC# PCOLPF2# Q>4GDLI2# PVDSLST# Q>5t}GDLI2#PVDSLST#7#9$X;$X;Game board DLI2$X;"$ GDLI25,$Q>6$ PWSYNC@$ PCOLPF2J$ Q>4GDLIT$ PVDSLST^$ Q>5u}GDLIh$PVDSLSTr$7|$9$>D:KING2.M65$$ BEGIN$LI25,$Q>6$ PWSYNC@$ PCOLPF2J$ Q>4GDLIT$ PVDSLST^$ Q>5@'dX;nX;Battle portion ofxX;CLASH OF KINGSX;X;Written by: Barry KolbeX;MAKSCR%>;;set up screenQ>BOw}RD;;do top borderSQ1PSCMEM8PSCMEM81ISQ1Q>4SCMEM;;now doPPMTO;;sides Q>5SCMEM PPMTO$>x}SQ2 ADD20;;add 20Q>BORD;;do edge"%>, P@PMTO76%>@ P@PMTO7J0TISQ2^:;;border donehX;rADD20QPMTy}O;;add 20 to scr|,;;memory ptr.O> PPMTO QPMTOO> PPMTO:X;BATTLEQSTRIG0;;wait untilFBz}ATTLE;;players releaseQSTRIG0;;buttons FBATTLE$>5VBLAN;;set up%>4VBLAN;;vblankQ> SETVBVQ>;;tu{}rn off vblank& PEXEC0START2 CLRSCR;;start here:Q>;;turn allDPCOLOR0;;colors blackNPCOLOR1;;at firstX PCOLOR|}2b PCOLOR3lQ>4DLIST;;installvP0;;gr.2 displayQ>5DLIST;;listP1X; PUTMAZE;;put maze scrn MAKSCR;;d}}o border SHOWSC;;show hits SETCL;;fade colors PMINIT;;init. pm CLRPM;;clear pm DEFPLR;;define plyrs I~}NITGM;;intial gamePHITCLR;;clear collisionMAIN CHKHIT;;chk hits CHKZAP;;check if hit QRFLG;;restart flgFM}AIN;;no hit  REMMIS;;rem miss*"RFLG;;get plyr #4$RFLG;;0 or 1> EXPLOD;;do explosionH$RFLG;;get x backR"HTS9};;1 less hit\QHTS9;;done yet?fFQUIT;;yesp REMPLR;;plyrs offz!START2;;set up again QUITAN>;;flip loser to}PWINNER;;winner REMMIS;;all done REMPLR;;no miss/plrysQ>$>5XITVBV;;get rid%>4XITVBV;;of vblan SET}VBV !TURNOFFX;X;turn colors onX; SETCL%>QS1QBFCLR8 PCOLOR08$1.IQS18:BX;LX;initialize plyr}sVX;`PMINITQ>>;;single linejPSDMCTL;;res.tQ>~ PGPRIORQ>:;;drk orange PPCOLR0 PPCOLR2Q>;;blue gr}ay PPCOLR1 PPCOLR3Q>5PMB;;pmbase PPMBASEQ>PGRACTL;;turn on pmQ>$>;;put plyrs offPM1PHPOS}P09;;screen PSIZEP09;;normal size0IPM1(Q>;;clear zap2PZAP;;registers< PZAPF:PX;ZCLRM0Q>;;clear} miss 0d%>;;i.e. plyr 2nMC1PPLR28x1HMC1:X;CLRM1Q>;;clear miss 1%>;;i.e. plyr 3MC2PPLR38}1HMC2:X;X;define playersX;DEFPLR%>o$> DFQPLY19 PPLR08" QPLY29,PPLR0861@0JID}FTQ>8;;init x pos^PHPOSP0;;plyr 0h PXPOS0rQ>;;ditto plyr 1| PHPOSP1 PXPOS1Q>`;;init y pos. PYPOS0Q}>p PYPOS1:X;X; move playrsX;MOVEPQ>;;clear collisions PHITCLRQHSCL9;;moving lft or rt?FTRYUD};;no try up-dnQSAVST9;;which direction R>;;rt? HLFM;;no&QHSCL9;;first time to0R>;;scroll?: HRTOK;;noD }WALLCK;;check if wallNQWC9;;or starXFNOHS;;no moveb CHKPLR;;is other plyrlQPFLG;;there?v HRT;;noNOHSQ>;;d}o not scrollPHSCL9;;plyr:RT#SCX9;;change screen posRTOK#XPOS09;;chng horz.pos QXPOS09PHPOSP09;;do mov}e"HSCL9;;scroll reg.-1:LFMR> ;;try leftHTRYUD;;nopeQHSCL9;;moving?R>;;first time?HLFOK;;nope  }WALLCK;;check wallQWC9;;& star FNOHS;;no move* CHKPLR;;plyr in way?4 QPFLG>FNOHS;;yupH"SCX9;;ok scrn pos -}1RLFOK"XPOS09;;do lft move\ QXPOS09f PHPOSP09p"HSCL9;;scroll reg.-1z:TRYUDQVSCL9;;try movingFGETST;;up-}dnQSAVST9;;get direct. R>;;up?HTRDN;;try dnQVSCL9;;moving yet?R>HUPOK;;yup WALLCK;;chk wall & st}arQWC9FNOVS;;no move CHKPLR;;chk plyrQPFLG;;in way HUL;;ok NOVSQ>;;no move PVSCL9$ :. ULQSCX9;};subt. 20 from8 ;;;scrn. pos.B S>L PSCX9V UPOK UPDOWN;;get pmg page` 1;;set up to movej 'PMFRt %>~ UPLQ@PMT}O7;;move 17 bytes P@PMFR7;;down in memry 3 )> HUPL "YPOS09;;chng y pos ptr "VSCL9;;scrll -1 : TRDNR> };;down? HGETST;;no get stick QVSCL9;;moving? R> HDNOK  WALLCK;;chk wall & star QWC9 FNOVS  CHKPLR;;c}hk other guy( QPFLG;;he there?2 FNOVS;;yup< QSCX9;;add 20 to scrnF ,;;memry locationP O>Z PSCX9d DNOK UPDOWN;;}set up pagesn 3;;to movex 'PMFR;;player up in %>;;memry DNLQ@PMTO7 P@PMFR7 1 IDNL 3 Q>;;knock out th}e P@PMTO7;;last byte #YPOS09;;new y pos. "VSCL9;;scroll-1 :;;all done moving GETSTQSTICK09 PSAVST9 R> }HT11 T7Q>" PHSCL9, :6 T11R> @ HT14J FT7T T14R>^ HT13h T15Q>r PVSCL9| : T13R> FT15 : }X; X; UPDOWNQUDTAB9;;set up pages PPMTO;;for plyr moves PPMFR QYPOS09 ? 'PMTO : X; X;Initial}ize variables X; INITGMQ>Q& PSCX0 Q>v: PSCXD Q>N PWSRX PSTIMEb Q>l PZTIMEv Q> PMZR Q> }PMISM PMISM PHSCL PHSCL PVSCL PVSCL PRFLG PBSR;;no blowup PMSR;;no missile snd PEXEC :} X; X;do the maze X; MAZE%>* PCK1 RND4 PMZTAB8> 1H HPCK1R :\ X;f X;p RNDQRANDOMz R> DRND R>} ERND $> CRNRMZCK9 FRND 0 ICRN : X; X; X;put maze on screen X;PUTMAZE MAZE$>MZ1Q}MZTAB9$?.&X18 QRANDOMBM>L>V QMZCOL9`$X1j PSCMEM8t0~HMZ1:X;X;X;X;check if wallX;}WALLCK&XTEMQ>;;0=no movePWC9QSCX9;;pos. in sc.memPTEMP;;0-239 QSAVST9$>;;get dir WCKRWALLTAB9} FWCK10(IWCK2WCK1QADDER9<,F OTEMPP?Z'TEMP;;hang on to locd $XTEMnQSCMEM8;;get bytexHRT1;;not 0 >}no moveQ>;;ok to movePWC9;;move flagRT1:X;X;move missile routineX;MOVEMPHITCLRQMISM9;;directio}n orHMOK;;0=not moving QSTRIG09FPMIS;;0=pressed:;;not pressedPMISQSAVST9;;get direct&TEMP;;save x$>}CKMDRWALLTAB9;;chk direct"FPMOK;;ok valid,06 ICKMD@Q>;;not validJ$TEMP;;directT PMISM9^:hPMOK$TE}MPrPMISM9;;save direction|Q>;;set up missilePMSR;;snd rout.Q>  PMTIME PUTMIS MOK&XTEMQMISM9;;ge}t dir R>;;rt?HN1 QXPOS29,O> PXPOS29 PHPOSP29: N1R> HN2& QXPOS290;:S>D PXPOS29N} PHPOSP29X:bN2R>;;up?lHN3vQ> PUDFLUPAGN MSUPDN1 'MIST%>N5Q@MISF7 P@MIST73)>}HN5 "YPOS29 "UDFL QUDFL HUPAGN : N3R> FN7*:4 N7Q>> PUDFLHDNAGN MSUPDNR3\ 'MISTf%>};;only 8 bytespN6Q@MISF7z P@MIST71IN6%>C P@MISF7 #YPOS29 "UDFL QUDFL HDNAGN:X;}X;set page ptrs missX;MSUPDNQMSUP9 PMISF PMIST$ %YPOS29. 'MISF8:;;rtn with yBX;LX;VX;put miss}ile on scn`X;jPUTMISQXPOS09t PXPOS29~ QYPOS09,O> PYPOS29X;X;define missilesX; &XTEM(>;;}miss 0 or 1HMM1;;do miss1 CLRM0%YPOS29;;get y pos$>MM2QMISS09  PPLR2832((>2HMM2< $XTEM}FMM4QXPOS29P PHPOSP29Z:dMM1 CLRM1n %YPOS29x$>MM3QMISS19 PPLR3832(>HMM3 $XTEM!}MM4:X; X; delaysX; DELAYQ>x PTIMER DEL2Q> PTIMER"DEL3"TIMER, QTIMER6 HDEL3@ "TIMERJ} QTIMERT HDEL2^:hX;rX;longer delay|X;DELAY1Q>F PTIMER HDEL2X;X;vblank routineX;VBLA}NQBSRFVNS BLOWUP !XITVBV VNSQEXECFVOK SNDOFF !XITVBVVOK#VTIME QVTIME&R> 0FVB1:!TR}YMIS;;doneD VB1Q>N PVTIMEX#PTYPE;;next defb QPTYPElR>vDPTQ> PTPPTYPEQPTYPE;;plyr type 0/1H}VB3 Q>4PLY1 PVB2 Q>5PLY1 PVB2 Q>4PLY2 PVB4 Q>5PLY2 PVB4!VB5 VB3R> HVB6 Q>4}PLY3  PVB2* Q>5PLY34 PVB2> Q>4PLY4H PVB4R Q>5PLY4\ PVB4f!VB5pVB6Q>4PLY5z PVB2 Q>5PLY}5 PVB2 Q>4PLY6 PVB4 Q>5PLY6 PVB4VB5%YPOS0;;plyr 0$>;; 16 bytesVB2QPLY39 PPLR083}2(>HVB2%YPOS1;;plyr 1 $>;;16$VB4QPLY49. PPLR1883B2L(>VHVB4`Q>jPM;;kill attractt}TRYMISPHITCLR~ VB7$> MOVEM2 MOVEM$> MOVEP2 MOVEP WHIRLY MISHOT CHMAZE !XITVBV}X;X;check for hits X;CHKHITQ;;plyr2=miss0 FK1;;no(K3Q>;;yes2PMISM;;don't move<PHPOSP2;;get off sc}nF K1QP FK2;;noZQ>d PMISMn PHPOSP3x K2QЂM>;;hit plyr1? FK4;;noQ> PZAPPEXEC;;kill}vblank K4QоM>;;hit plyr0?FK5Q>PZAPPEXEC;;kill vblankK5PHITCLR:X;X;check zapX;"}CHKZAP$>,&RFLG;;defalt =06%>@ QZAP9JFZP1T ZP2'RFLG^:hZP12r3| QZAP9HZP2:X;X;show score}X;SHOWSC$> %HTS91 Q>BARSH1PSCMEM81ISH12 %HTS91SH2PSCMEM8&10ISH2::DX};NX;remove misslsXX;bREMMISQ>l PMISMv PMISM PHPOSP2 PHPOSP3:X;X;remove plrsX;REMPLRQ>} PHPOSP0 PHPOSP1:X;X;whirlybird sndX;WHIRLY"STIME  QSTIME FDOSND :* DOSNDQ>4 PSTIME>$W}SRH FCHWSRQ>\ PAUDC1f QWSN9p PAUDF1z"WSR: CHWS$>&WSR:X;X;miss shotX;MISHOTQMSR }HSNOK: SNOK$MSRQ> PAUDC2 QMSN9 PAUDF2"MSR$:.X;8X;explosionBX;LEXPLOD%YPOS09;;get y posV}Q>C`PBSRj 'PMFRtQ>~ PTEMP Q>5EXPLRPPMTO;;hi byteQ>4EXPLR;;low PPMTO QUDTAB9 PPMFR }EX1%>EXQ@PMTO7 P@PMFR73)>HEX DELAY , QPMTOO>( PPMTO2 QPMTO<O>;;add 16F PPMTO}P"TEMP;;1 less def.Z QTEMPdHEX1n DELAYx:X;X;explosion sndX; BLOWUP$BSR;;blowup snd reg.HBOK}:;;no blowupBOK$BSR;;blowup snd reg.Q> PAUDC2QEXF9;;get freq. PAUDF2"BSR:X;X;check if run }into plyrX;"CHKPLR&PCX;;save x,Q>6PPFLG;;flag@(>;;which plyr?J HCP2;;1T2^QTEMP;;test poshRSCX9;;=} other guy?r HCKPOK|FRT3CKPOK#PFLG;;now 1 RT3$PCX:CP20;;now 0QTEMP;;other guyRSCX9;;= ? HCKPO}KFRT3X;X;change mazeX;CHMAZE"ZTIME;;maze timer QZTIME FMZ4 :;;not yet MZ4Q>& PZTIME;;reset t}imer0 $MZR: QMZTAB9D ?N Q>;;get rid ofX PSCMEM8;;starb  RNDl $MZRv PMZTAB9;;new ?;;position QRANDOM M>} > QMZCOL9 PSCMEM8;;put new * "MZR QMZR HMZ5 Q> PMZR MZ5:TAB9;;new ?;;position QRANDOM M>V #dX;n!X;Redefined Character Set DataxX;X;by: Bryan Schappel withX; Barry Kolbe (c) 1985X; ===} === === === === === =J=4= ;=,=R= =~=<= ~}==<= === === ===" ===, ===6 ===@ ===J ==}=T ===^ ===h ===r ===| === === === ===8} === === === =<=<= === === ==f= v=f=~= }==x=x ==~= =|=f=L =6=~= =~==&  =f=>=0 = ==<: l== =D ==}`=N =f=|=X =|==|b =f=~=l ==f= v =0=0= =<=f=< =f== ==f=} = =8= ==<=< =<=<= === === = = =<  = == === }=== `=0=0=< 0=0=`=  === ===  ===* ===4 ==<=f> f=~=}=H ==f=R f=f=|=\ ==f=`f =f=~=p ==l=fz =l=|= ==`=| =f=~=} ==c= l=`=`= ==f=` =f=~= =v=6=~ 6=6=v= =~==< ==~= }=== =f=<= ==n= x=n=f= ==`= `=v=~=$ ==w=. k=c=w=8 =f=}v=~B ~=n=v=L ==f=V f=f=~=` ==f=j |=`=p=t ==f=~ f=l=v= ==f=} |=l=v= ==`=~ =f=~= =~== === ==f= f=~=|= ==f= f}=~== ==c= =w=c= ==f=<  <=f=v= ==f=< =8=8=( ==l=2 0=f=}~=< ===F ?====P ===Z ===d ===n ===x === = ==0} =0=`= === === === === === === p=p=p=p }=== === === === ==~=f f=~== == =" ===, ==}=6 ===@ ===J p=`=`=pT ===^ ===h ===r ===| ===} === === ==c= === === === === === }=== === ===g =0== === === === ===& ==}=0 ===: ===D ===N ===X ===gb g==w=l =o=f=v ==g=} ===` `=== === = = =( === = == === === }=== @=@=P=P ===  = =*=* === ===  === ===  ==}=* ===4 ===> 0=0=<=H ==0=0R 8===\ ===f ===p `=l=l=lz} o=`== ===̎ = == === == = === =0=0=< q===? 0}=0=8= === === ===0 6=== ===  n===  ==c=  ==}=$  ===.  ===8  ===B   ==<=L  ===V  =`==`  =c==j   = =<=t}  ===~  =`==  ===?  ?===  ===~  ~==0=  U=U=U=U  U=U=U=U  }===  ===  ===  ===  ===  ===  ===  ===  "=(=} =  ===(  == =2  ===<  ===F  ===P  ===Z  =@==d  ===n}  ===x  ===  ===  ===  === X; X;Game board display list X; DLIST1 p}=p=p=B PNAME =p=p  B=4MYSCRN=5MYSCRN  ===  ===  ===p =p=F PLAER } p"  F=4MENL=5MENL,  A=4DLIST1=5DLIST16 X;@ X;Intro Display ListJ X;T IDLST p=p=p=p^  B=4PRES=5PRESh  }p=p==r PNAM2|   p=p= DVC =4SLN1=5SLN1  "="="="=" "="=  A=4IDLST=5IDLST X; X;}Battle Display List X; DLIST p=p=p=G SCMEM  ====  ==== =A DLIST X; X;Scree}n Memory& X;0 5PNAME A THE CLASH OF KINGS ANALOG 1985 A: 'PLAER A playerA==A i AD 3MENL A menA=}===A menA====A AN 0PRES =A ANALOG COMPUTING PRESENTS: AX !PNAM2 =A THE^_CLASH Ab  =A []} OF KINGS [] Al X;v X;Player 1 Pieces X; CHARS === X;HUMAN W/ PACK #1-2  @=A=`=a  @=A=`=a X;SC}ORPION #3-5  B=C=b=c  B=C=b=c  B=C=b=c X;VIPER #6-7  D=E=d=e  D=E=d=e X;CANINE #8  H=I=}h=i X;KING #9  F=G=f=g X;* X;Player 2 Pieces4 X;> X;TANK DROID #10-11H  J=K=j=kR  J=K=j=k\ X;PLANE }#12-14f  L=M=l=mp  L=M=l=mz  L=M=l=m X;SERVICE DROID #15-16  N=O=n=o  N=O=n=o X;TRANSPORT #17}  R=S=r=s X;CYBORG #18  P=Q=p=q X;TERRAIN PIECES #19-21  Y=Z=y=z  [=\={=|  ]=^=}=~ X; X;}Game board initial set-upX;structure DATA tableX; BRDSET$X;. X;Line #18X;B ====L ====V} == =`X;j X;Line #2tX;~ ==== ==== == =X; X;Line #3X; === =} ==== == =X; X;Line #4X; ==== ====  == =X; X;Line #5(}X;2 ====< ====F ===PX;ZX;Path positionsdX;nPATHS 3=2=$=#="x 0=/=. };=<===>=0 1=2=3 .=/=0=1=? @=A=BX;X;Cursor DefinitionX;DEFPL1 ==== ===}= ==== ====X;X;Game table vectors (LSB)X;GTABL 4GAMBRD ;;Left 4GAMBRD} " 4GAMBRD ;;Up, 4GAMBRD ;;Down6X;@X;Game table (MSB)JX;TGTABH 5GAMBRD ^ 5GAMBRD h 5GA}MBRD r 5GAMBRD |X;X;Table of movement routinesX;MOVTAB LEFT RIGHT UP DOWNX;X;Un-move} vector tableX;NEGTAB RIGHT LEFT DOWN UPX;X;Move holderX;&MOVES ===0X;:X;Hit poin}t tableDX;N%HITTAB ======== X ======== bX;lX;Intro colorsvX;ICLR ===}=X; X;TextX;"ALAS AALAS, YOU CANNOT MOVEA&TROPHY APLAYER , YOU WIN THE $ASTXT == AFROM:A=} =;;blanks ;;BBK enter Aˠ ENTERPRISES A A1985A= ==;;blank lines   ACRAFTED BY:A}= =;;blank   * ABARRY KOLBEA=4 > H AA=R \  f ABRYAN SCHAPPELA=p ;;blankz } ;;blank    A PRESS Ԡ  A   A`afg TO BEGIN pqjkA X; X;Lines} to pause scrolling onX;PLINS ==X;X;battle field colorsX;BFCLR ==t=F=$X;.X;whirly snd d}ata8X;BWSN ==VLX;VX;plyr explode data`X;jEXPLR == =t )=h==~ "=a=R=  =d==} === ===0 ===$ ==L=0 === === ==j= d===@ =}== === =@= =  ===  === === ===( ===2X;<X;exp}losion snd dataFX;PEXF ===Z ===d ===n ===x === === ==}= =~={=w s=o=k=g d=`=\=X T=P=M=I E=A=9=6 2=.=*=& "=== == =} === t=h=]=Q F=:=.=# = =X;X;maze color table"X;,MZCOL =C==6X;@X;stick d}irectionsJX;TWALLTAB = == ^X;h$X;adder table to add 1 left-rightrX;up or down|X;ADDER ===X; }X;missile pagesX;MSUP 5PLR2=5PLR3X;X;missile snd dataX;MSN ===x n=d=x=d ZX;X; }plyr pagesX;UDTAB 5PLR0=5PLR1X;&X;table to check maze0X;:MZCK '=(=;= <===HP}LY6 === 0123./01?@ABf)))))"}f)))  !,!3 %&9/5#!../4-/6%0,!9%2 9/57).4(%&2/-%.4%202)3%3 #2!"}&4%$"9 "!229+/,"%UVWX "29!.3#(!00%,@AFG02%33PQJK`afg4/"%').pqjktFV )h"}"aR d0$آL0jd@&'@  ÿ~{wsokgd`\XTPMIEA9"}62.*&" th]QF:.# C  xndxdZ'(;/`/L)o 'ԩ Ѝ ЍЩ>(),Щ`I``0"#}  `8`Ф%`%d)%e)Lƃ ) 0)Ƃ` ) 0)"$}`82Ƅ ) 0)`i ) 0)`x)*x"  "%}ݩ8`` Ti(i` Q ⥎i׭ ) %"&}`0$1? $i(i$F*+`ة * ҩD"'}Ң E>%%,iiȑ饀iii4i A- J* "(}(e( \ ( * * ( (NF$ i$ T( * 0) ) U)L+%+,0צ  ɠ")}%,% , ) %ܠ%% *( (L+ l( )0%  p(L:, U) )(𤑹%|,%"*}}, L:, l( )L+ ¤  (@ .ˆ,-Ř I"+} )֒L+Ii& ( T( * * ( (% *( K( '@ (L*/$0$1 )  ' (!.",}Ԡ%&& 聾i iL-=/7$6$M )懥 ԭ?-.ԭ6$"-}i 6$7$i7$攥%٧&0x@L(H ԍi8 ԍЅh@H ԍЩe.h".}@H ԍЩP.h@ .`ii`2X \ (C./0"/}$1 1 z. `3 6/ B/ ' / 0 3 L3 x3Ơ 3µ 3L.I x3 3b \L(&`>/o:"0}ԩЩН```ov''8ЅЅ`p`еO% &1"1}/0 4``  &1 4ֱ֩`t6 &1 4`8 0֭"2}` 4 &1 4Ƶi 0Ȅȩ`x` ` `d'`QvΩ"3}ϩ01ąŅƅDžɅ` 0'` ɲf'` 0' )M'`Q'U'e"4}`е*`Q' `ɩ 1 i` 8` 1֯ȥ"5}` `12 1Ȅȥ`Y'`i z/'` /'L2"6}`xƛƜ`F饻 4Lb䥡 }(Lb来 L2查v2'22'2L22'22'"7}2L22'2ƍ232'2''MТ Q1 Q1 / / 3 3 94LbЭЭ)"8})``ȵ`ˆˆ`Ѝ`Ѝ`ƞ`ҽ&Ƣ`"9}``ɩҽ['`3n4C&d' =2iiƨ =2``ҽ'ƻ`̩襨ձ":}˦`ʥձΥ`ΦϽ' 0ϝ' )M'ϥ`*ƨ =2``ҽ'ƻ`̩襨ձ MED ;get move2390 LDA MOVTAB,Y ;load and store2400 STA MOVJMP+1 ;vector in2410 LDA MOVTAB+1,Y ;the table2420 "<} STA MOVJMP+22430 MOVJMP JMP $FFFF ;Move it!2440 ;2450 ;Move LEFT2460 ;2470 LEFT LDY TABPOS ;get pos2480 LDA GAMB"=}RD-1,Y ;look left2490 BEQ DN1 ;bad move!2500 LDY #7 ;okeh move it2510 LLP STY SAVEY ;back 8 pixels2520">} DEC PLRX2530 JSR WAIT ;wait a jiffy2540 JSR DEFINE2550 LDY SAVEY2560 DEY 2570 BPL LLP2580 "?} DEC TABPOS ;new posit2590 DN1 RTS ;done.2600 ;2610 ;Move RIGHT2620 ;2630 RIGHT LDY TABPOS ;position2640 "@} LDA GAMBRD+1,Y ;look right2650 BEQ DN1 ;bad one2660 LDY #7 ;move right2670 RLP STY SAVEY ;8 pixels.26"A}80 INC PLRX2690 JSR WAIT2700 JSR DEFINE2710 LDY SAVEY2720 DEY 2730 BPL RLP2740 INC TABPOS2"B}750 RTS 2760 ;2770 ;Move UP2780 ;2790 UP LDA TABPOS ;posit2800 SEC ;up one line2810 SBC #142820 "C} TAY 2830 LDA GAMBRD,Y ;look in board2840 BEQ DN2 ;bad move!2850 STY TABPOS ;save posit2860 LDY #"D}15 ;move player2870 ULP STY SAVEY ;up 16 pixels2880 DEC PLRY2890 JSR WAIT2900 JSR DEFINE2910 LDY S"E}AVEY2920 DEY 2930 BPL ULP2940 RTS 2950 ;2960 ;Move DOWN2970 ;2980 DOWN LDA TABPOS ;posit2990 CLC "F} ;add 13 for line3000 ADC #14 ;down3010 TAY 3020 LDA GAMBRD,Y ;get piece3030 BEQ DN2 ;bad3040"G} STY TABPOS ;save posit3050 LDY #15 ;move player3060 DLP STY SAVEY ;down 16 pixels3070 INC PLRY3080 "H} JSR WAIT3090 JSR DEFINE3100 LDY SAVEY3110 DEY 3120 BPL DLP3130 DN2 RTS ;all done3140 ;3150 ;"I}Read Stick + button3160 ;3170 ;MOVED = 0 for left3180 ; = 2 for right3190 ; = 4 for up3200 ; = 6 for down"J}3210 ;3220 STICK LDX PLAYER ;get player3230 LDA #15 ;and reset3240 STA STICK0,X ;stick values3250 LDA #1"K}3260 STA STRIG0,X3270 LDA MOVED ;put last move3280 STA OMOVE ;in hold area3290 STCK LDA #$FF3300 STA"L} MOVED ;no move made3310 CSTK LDA STICK0,X ;read stick3320 CMP #15 ;no move3330 BEQ TRYTRG ;try trigger334"M}0 CMP #11 ;left?3350 BNE ST0 ;no.3360 LDA #0 ;move is 03370 BEQ STDN3380 ST0 CMP #7 ;ri"N}ght?3390 BNE ST1 ;no.3400 LDA #2 ;table offset3410 BNE STDN ;=23420 ST1 CMP #14 ;up?3430 "O} BNE ST2 ;no.3440 LDA #4 ;offset = 43450 BNE STDN3460 ST2 CMP #13 ;down?3470 BNE CSTK ;no. re"P}ad again3480 LDA #6 ;make a 63490 STDN STA MOVED ;save move3500 SEC ;signal move3510 RTS 3520 "Q}TRYTRG LDA STRIG0,X ;trigger3530 BNE CSTK ;read stick3540 CLC ;signal fire3550 RTS 3560 ;3570 ;Ad"R}d border to game board3580 ;3590 ADDBORD LDX #11 ;12 lines3600 LDA #0 ;make the3610 STA COLOR2 ;screen blac"S}k3620 STA COLOR43630 LDA # <[MYSCRN+7]3640 STA SCR3650 LDA # >[MYSCRN+7]3660 STA SCR+13670 BOR0 LDY"T} #25 ;26 chars3680 LDA #84 ;red space3690 BOR1 STA (SCR),Y ;on screen3700 DEY ;down loop3710 B"U}PL BOR1 ;and run again3720 LDA SCR ;now add 403730 CLC ;to screen3740 ADC #40 ;pointer to3"V}750 STA SCR ;get to next3760 LDA SCR+1 ;screen line3770 ADC #03780 STA SCR+13790 DEX ;d"W}ec outer loop3800 BPL BOR0 ;do again3810 RTS ;all done3820 ;3830 ;Randomize terrain features3840 ;38"X}50 TERRAIN LDY #20 ;21 features3860 TERR1 LDA RANDOM ;number3870 CMP #153880 BCC TERR13890 CMP #813900 B"Y}CS TERR13910 TAX 3920 TERR2 LDA RANDOM ;next number3930 CMP #1 ;check if piece3940 BCC TERR23950 CM"Z}P #43960 BCS TERR23970 STA SAVEA ;save it3980 LDA GAMBRD,X ;get piece3990 BPL TERR1 ;<128 no good400"[}0 LDA SAVEA ;get feature4010 CLC ;and add 184020 ADC #184030 STA GAMBRD,X ;put in4040 DEY "\} ;board4050 BPL TERR1 ;do again4060 ;4070 ;Now assure a path through4080 ;4090 DOPATH LDA RANDOM4100 AN"]}D #3 ;only 0-34110 CMP #3 ;=3?4120 BEQ DOPATH ;yes do again4130 ASL A ;times 84140 ASL A"^}4150 ASL A4160 TAY 4170 LDX #7 ;do 8 spaces4180 PATH2 LDA PATHS,Y ;get posit4190 STY SAVEY ;save "_}Y4200 TAY 4210 LDA #$80 ;get blank4220 STA GAMBRD,Y ;put in4230 LDY SAVEY ;board. get Y4240 INY"`} ;up posit4250 DEX ;dec loop4260 BPL PATH2 ;and loop again4270 RTS ;all done4280 ;"a}4290 ;Fill play field4300 ;4310 SETSCR LDY #04320 LDA # DLIST14350 STA SDLSTL+14360 SE1 LDA GAMBRD+14,Y ;get a piece4370 BEQ SNXT ;leave alone4380 BPL SE"c}2 ;have character4390 LDA #0 ;get empty4400 SE2 ASL A ;* 24410 ASL A ;* 44420 STY SAVEY "d} ;save y4430 TAX ;char index4440 TYA ;screen posit4450 ASL A ;* 24460 TAY 4470 "e} LDA SCRTAB,Y ;look up addr4480 STA INDR ;and save it4490 LDA SCRTAB+1,Y4500 STA INDR+14510 LDY #045"f}20 SE3 LDA CHARS,X ;get char4530 STA (INDR),Y ;on screen4540 INX ;up count4550 INY 4560 CPY #2 "g} ;2 yet?4570 BNE SE3 ;no.4580 LDY #04590 LDA INDR ;add 40 to scrn4600 CLC ;position4610"h} ADC #404620 STA INDR4630 LDA INDR+14640 ADC #04650 STA INDR+14660 SE4 LDA CHARS,X ;next half of467"i}0 STA (INDR),Y ;character4680 INX ;goes on screen4690 INY 4700 CPY #24710 BNE SE44720 LD"j}Y SAVEY ;restore Y4730 SNXT INY ;up it.4740 CPY #70 ;70 yet?4750 BNE SE1 ;no.4760 RTS "k} ;done.4770 ;4780 ;Copy game board4790 ;4800 BEGIN CLD ;no decimal4810 LDA #1 ;fix boot status4820 "l}STA BOOT?4830 LDA # BEGIN4860 STA DOSINI+14"m}870 LDA #3 ;init sound4880 STA SKCTL ;stuff4890 LDA #0 ;kill cold start4900 STA COLDST4910 "n} STA AUDCTL4920 LDX #$80 ;erase bottom4930 ERZPG STA ZPAGE,X ;half of4940 INX ;page zero4950 BNE "o}ERZPG4960 TAY 4970 ZGB STA GAMBRD,Y ;erase GAMBRD4980 INY 4990 BNE ZGB5000 LDA #9 ;set # of men501"p}0 STA MEN15020 STA MEN25030 LDY #69 ;now copy in5040 BEG1 LDA BRDSET,Y ;the new5050 STA GAMBRD+14,Y ;"q}board5060 DEY 5070 BPL BEG15080 LDY #17 ;copy in the5090 HTB LDA HITTAB,Y ;hit point5100 STA HTAB,Y "r} ;table5110 DEY 5120 BPL HTB5130 LDA # SCRTAB ;definition5160 STA INDR+1 ;table.5170 LDX #05180 LDA # <[MYSCRN+44] ;start5190 STA IND2 ;sc"t}reen posit5200 LDA # >[MYSCRN+44]5210 STA IND2+15220 SC1 LDY #05230 SC2 LDA IND2 ;get scrn5240 CLC "u} ;and add 25250 ADC #25260 STA IND25270 STA (INDR),Y ;save in table5280 LDA IND2+15290 ADC #0 "v};now do hi byte5300 INY 5310 STA (INDR),Y ;in table5320 STA IND2+15330 INY 5340 CPY #28 ;28 yet?"w}5350 BNE SC2 ;no.5360 LDA INDR ;now add offset5370 CLC ;to table5380 ADC #28 ;position"x}5390 STA INDR ;and store it.5400 LDA INDR+15410 ADC #05420 STA INDR+15430 LDA IND2 ;now update"y}5440 CLC ;screen pointer5450 ADC #52 ;52 chars later5460 STA IND25470 LDA IND2+15480 ADC"z} #05490 STA IND2+15500 INX ;up line count5510 CPX #5 ;5 yet?5520 BNE SC1 ;no.5530 J"{}SR INTRO ;display intro5540 JSR TERRAIN5550 ;5560 ;Start of game5570 ;5580 CHESS JSR TURNOFF5590 LDY # VBLANK1 ;vector5610 LDA #6 ;Immediate mode5620 JSR SETVBV ;set it!5630 JS"}}R CLRSCR ;erase screen5640 JSR ADDBORD ;add border5650 JSR SETSCR ;set board up5660 JSR POSPM ;add P/M567"~}0 JSR TURNON ;turn it on5680 ;5690 LOOP0 LDA #78 ;position player5700 STA PLRX5710 LDA #705720 STA PL"}RY5730 LDA #15 ;set tabpos.5740 STA TABPOS5750 LDA #0 ;make player 15760 STA PLAER+145770 L"}DA PLAYER ;get player5780 BEQ SCRON5790 LDA #166 ;player 25800 STA PLRX ;reset cursor5810 LDA #26 "} ;and tabpos5820 STA TABPOS ;pntrs.5830 LDA #105 ;player II5840 STA PLAER+145850 ;5860 SCRON JSR MENL"}EFT ;# men left5870 JSR SETSCR ;update scrn5880 LOOP JSR DEFINE ;put on cursor5890 LDX PLAYER ;player num5900 "} JSR STCK ;read stick5910 BCC FIRED ;pressed fire5920 JSR DOMOVE ;move cursor5930 JMP LOOP ;and loo"}p....5940 FIRED LDY #3 ;zero out move5950 LDA #$FF ;table5960 FR1 STA MOVES,Y5970 DEY 5980 BPL FR1599"}0 LDY TABPOS ;get table pos6000 STY OLDPOS ;and save it6010 LDA GAMBRD,Y ;get piece6020 STA OLDPCE ;sav"}e it.6030 BMI LOOP ;blank. loop.6040 CMP #19 ;trying to move6050 BCS LOOP ;on terrain?6060 LDX "}PLAYER ;get player6070 BNE PL2 ;have player 26080 CMP #10 ;trying to move6090 BCC CHOK ;on yoursel"}f?6100 BCS LOOP ;yes!6110 PL2 CMP #10 ;same thing.6120 BCC LOOP6130 ;6140 ;Now we see if the piece6150 ;"}selection was a good one6160 ;6170 CHOK LDY #3 ;check 46180 MCK0 LDA GTABH,Y ;inset table6190 STA MCHECK+2 ;posit"}ion6200 LDA GTABL,Y ;in program6210 STA MCHECK+16220 STY SAVEY ;save Y6230 LDY TABPOS ;get pos.6240 M"}CHECK LDA $FFFF,Y ;and piece6250 JSR TESTIT ;test players6260 BCS UPLP ;bad one6270 LDY SAVEY ;restore Y"}6280 TYA ;possible move6290 ASL A ;* 2 and6300 STA MOVES,Y ;save move6310 UPLP LDY SAVEY ;get "}Y again6320 DEY ;and loop again6330 BPL MCK06340 ;6350 ;Now see if any move is6360 ;possible this time."}6370 ;6380 LDY #36390 SMV LDA MOVES,Y6400 BPL HAVMOV ;got one!6410 DEY 6420 BPL SMV6430 LDA # ALAS ;move.6450 JSR EPRINT6460 JSR ERMYLN ;erase line6470 JMP LOOP ;loop ag"}ain.6480 HAVMOV JSR BEEP ;beep!6490 TRYMOV JSR STICK ;read stick6500 LDA MOVED6510 BMI TRYMOV ;mask out button6"}520 LDY #3 ;test against6530 CMV CMP MOVES,Y ;possible moves6540 BEQ GMOVE ;good move!6550 DEY 6560 "} BPL CMV6570 JSR BOOP ;Error!6580 JMP TRYMOV ;try again6590 GMOVE JSR DOMOVE6600 JSR STICK6610 BCC "}BEP6620 LDX PLAYER ;player #6630 LDY #29 ;wait 1/2 second6640 GVM LDA #0 ;and check for6650 STA RTC"}LOK ;press of fire6660 GVM1 LDA STRIG0,X ;button6670 BEQ BEP6680 LDA RTCLOK ;get clock6690 BEQ GVM1 ;=0?"} yes.6700 GVM2 DEY ;loop again6710 BPL GVM6720 LDY OMOVE ;now we move6730 LDA NEGTAB,Y ;the cursor6"}740 STA UNJSR+1 ;back to its6750 LDA NEGTAB+1,Y ;original6760 STA UNJSR+2 ;position.6770 UNJSR JSR $FFFF6780 "} JMP TRYMOV ;go again6790 BEP JSR BEEP ;signal move6800 LDY TABPOS ;get posit6810 LDA GAMBRD,Y ;and piece"}6820 BPL DOBATTLE ;do a combat!6830 LDA OLDPCE ;just move old6840 STA GAMBRD,Y ;piece on the6850 LDY OLDP"}OS ;board6860 LDA #$80 ;remove previous6870 STA GAMBRD,Y ;character6880 JSR SWITCH ;flip player6890 "}JMP LOOP0 ;and loop6900 ;6910 DOBATTLE TAY 6920 CMP #10 ;player >10?6930 BCC GP1 ;no.6940 STY PLRT"}YPE+1 ;player type6950 DEY ;decrease index6960 LDA HTAB,Y ;get hit points6970 STA HTS+1 ;save em69"}80 BNE INH0 ;player 1 hits6990 GP1 STY PLRTYPE ;player 17000 DEY ;down index7010 LDA HTAB,Y ;hit p"}oints7020 STA HTS ;save7030 INH0 LDY OLDPCE ;old piece7040 CPY #10 ;>10?7050 BCC GP11 ;no.7060 "} STY PLRTYPE+1 ;move player 17070 DEY ;hits out of7080 LDA HTAB,Y ;table7090 STA HTS+17100 BNE "}INH1 ;play game7110 GP11 STY PLRTYPE ;player #17120 DEY ;and get out7130 LDA HTAB,Y ;their hits7140 "} STA HTS7150 INH1 JSR TURNOFF ;screen off7160 ;7170 LDA #$407180 STA NMIEN ;kill DLI's7190 JSR BATTLE ;"}Do battle!7200 LDX #1 ;do 2 players7210 UH0 LDY PLRTYPE,X ;type #7220 LDA HTS,X ;new hit points7230 DE"}Y 7240 STA HTAB,Y ;save in table7250 DEX 7260 BPL UH0 ;do next7270 LDA PLAYER ;get the player7280 "} TAX ;X holds plr #7290 CMP WINNER ;same as winner?7300 BNE CHANGE ;no. lost.7310 EOR #17320 "} TAX 7330 LDA OLDPCE ;old piece7340 LDY TABPOS ;and move to7350 STA GAMBRD,Y ;the new square7360 ;7370 CHA"}NGE LDA #$80 ;erase old guy7380 LDY OLDPOS7390 STA GAMBRD,Y ;save in board.7400 JSR SWITCH ;flip players7410"} DEC MEN1,X ;lower men left7420 LDA HTAB+8 ;check if kings7430 BEQ DEATH ;are dead yet.7440 LDA HTAB+1"}77450 BEQ DEATH7460 JMP CHESS ;and play chess7470 ;7480 ;Handle Death of a team7490 ;7500 DEATH TXA ;ge"}t player7510 EOR #1 ;flip it7520 CLC ;make scr mem7530 ADC #177540 STA TROPHY+7 ;save in str"}ing7550 JSR CLRSCR7560 JSR MENLEFT ;show # left7570 JSR ADDBORD ;add border7580 JSR SETSCR7590 JSR P"}OSPM ;put on P/M7600 JSR TURNON7610 LDA # TROPHY ;message.7630 JSR EPR"}INT7640 JSR PRL5 ;wait 10 sec7650 JSR CLRPM ;remove P/M7660 LDA #$407670 STA NMIEN7680 JSR TURN"}OFF7690 JMP BEGIN ;start over.7700 ;7710 ;Introduction Screen7720 ;7730 INTRO LDA #0 ;screen off7740 STA S"}DMCTL7750 LDA # IDLST7780 STA SDLSTL+17790 L"}DA RANDOM ;random #7800 AND #$F0 ;hit nybble7810 STA INTC ;save in color7820 LDA #$20 ;and add chara"}c.7830 STA CHBAS ;set.7840 JSR CLRPM ;remove players7850 JSR CLRSCR7860 LDA # DLI1 ;vector.7890 STA VDSLST+17900 LDA #$C0 ;fire DLI!7910 STA"} NMIEN7920 LDY #4 ;copy 4 nums.7930 IC LDA ICLR,Y ;get number7940 STA COLOR0,Y ;save in color7950 DEY "} ;dec loop7960 BPL IC ;do again7970 ;7980 ;Now add text to intro7990 ;8000 LDA # <[SLN1+256] ;start "}adr8010 STA SCR ;of where text8020 LDA # >[SLN1+256] ;goes in8030 STA SCR+1 ;memory.8040 LDX #0 "} ;zero X8050 PTIL LDA STXT,X ;get a position8060 BEQ LINFD ;if 0 line feed8070 TAY ;in Y reg8080 PTIL2"} INX ;up X8090 LDA STXT,X ;next char8100 CMP #$FF ;if $FF lin feed8110 BEQ LINFD8120 CMP #$FE "} ;if $FE then end8130 BEQ STITL8140 STA (SCR),Y ;in memory8150 INY ;up Y8160 BNE PTIL2 ;and do"} again8170 LINFD LDA SCR ;now add a 328180 CLC ;to memory8190 ADC #$20 ;pointer8200 STA SCR "};save it.8210 LDA SCR+1 ;get hi byte8220 ADC #0 ;and add carry8230 STA SCR+1 ;save it.8240 INX "} ;up X8250 JMP PTIL ;do again.8260 ;8270 ;Scroll Title Screen8280 ;8290 STITL LDA #61 ;turn on narrow830"}0 STA SDMCTL ;screen.8310 LDA # >SLN1 ;set LMS to my8320 STA DVC+2 ;memory.8330 LDA #08340 STA DVC"}+18350 STA ATRACT ;kill atract8360 STA LINES ;lines = 08370 DOLN LDA #0 ;scroll counter8380 STA SCROLC"} ;is zero.8390 LNL JSR WAIT ;wait 1 jiffy8400 INC SCROLC ;inc scrol count8410 LDA SCROLC ;get it.8420 C"}MP #8 ;done 8 yet?8430 BEQ LNDN ;yes. line done8440 STA VSCROL ;in VSCROL8450 LDA CONSOL ;check STAR"}T key8460 CMP #68470 BEQ STARTUP ;if pressed go!8480 BNE LNL ;loop again.8490 LNDN LDY #0 ;zero Y850"}0 STY SCROLC ;counter nil8510 STY VSCROL ;same for VSCROL8520 LDA DVC+1 ;now add 32 to8530 CLC "} ;the LMS8540 ADC #$20 ;instruction8550 STA DVC+18560 LDA DVC+2 ;and take care8570 ADC #0 ;of h"}i byte.8580 STA DVC+28590 INC LINES ;inc lines done8600 LDA LINES ;get it.8610 CMP #37 ;37 lines "}yet?8620 BEQ STITL ;yes. start over8630 LDY #2 ;check if this8640 CLN CMP PLINS,Y ;line is one8650 BEQ"} WSEC ;we pause on.8660 DEY ;not this one8670 BPL CLN ;try next.8680 BMI DOLN ;do next line."}8690 WSEC LDA #0 ;zero clock8700 STA RTCLOK8710 WSC1 LDA RTCLOK ;get it and8720 CMP #120 ;wait 2 seconds8"}730 BEQ DOLN8740 LDA CONSOL ;check CONSOL8750 CMP #6 ;START?8760 BNE WSC1 ;no. loop.8770 STARTUP"} LDA #$40 ;kill DLI8780 STA NMIEN8790 JMP TURNOFF ;and play game.8800 ;8810 ;DLI for intro colors8820 ;8830 DLI"}1 PHA ;save A8840 STX DLIX ;and X regis.8850 DLL0 LDA INTC ;color8860 STA DCLOR ;save it8870 LD"}X #7 ;loop 8 times8880 DLL1 LDA DCLOR ;get color8890 STA WSYNC ;wait sync8900 STA COLPF3 ;store it8910 "} CLC ;add for next8920 ADC #2 ;luminance8930 STA DCLOR ;and save it.8940 DEX ;dec loo"}p count8950 BPL DLL1 ;and do again8960 ;8970 LDX #7 ;loop 8 more8980 DLL2 LDA DCLOR ;get color8990 "}SEC ;and subtract 29000 SBC #2 ;from luminance9010 STA WSYNC ;wait for sync9020 STA COLPF3 ;st"}ore it9030 STA DCLOR ;save color9040 DEX ;dec loop9050 BPL DLL2 ;and do again9060 PLA "} ;restore A9070 LDX DLIX ;and X regs.9080 RTI ;done.9090 ;9100 ;Game board DLI19110 ;9120 GDLI PHA "}9130 LDA #29140 STA WSYNC9150 STA COLPF29160 LDA # GDLI29190 "} STA VDSLST+19200 PLA 9210 RTI 9220 ;9230 ;Game board DLI29240 ;9250 GDLI2 PHA 9260 LDA #09270 STA }LX;M+X; BLOAD -- load a binary file to memoryNX;O BLOAD P PHR Q CLOSE ROPEN === S QQLOADT P.}LR UA. CONTROL macrosAX;0X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;X;&X; The control macros of KER.}NEL.M65X;0X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;X;X;0X; GOSUB -- same as JSR except saves X&Y regsX;.} GOSUB  PUSHX  PUSHY   PULLY  PULLX X;X; IFEQ, IFNE, IFGT, IFLT --/X; compare two int.}eger values and branchX; if condition is metX; IFEQ DEQCMP =  H@THEN!  @THEN IFNE .}DEQCMP =  F@THEN!  @THEN IFLT DCMP =  I@THEN!  @THEN IFGT DCMP.} =  I@THEN!  @THENX;7X; DOI, LOOPI -- loop control using the 'I' variableX; DOI DPOKE Q.}QLOOP= DPOKE QQLOOP= Q>4?K PQQLOOP Q>5?K PQQLOOP ?K LOOPI DINC QQL.}OOP!IFGT QQLOOP=QQLOOP=@LIQQQLOOP 5QQQLOOP 5:@LIX;7X; DOJ, LOOPJ -- loop control .}using the 'J' variableX; DOJ DPOKE QQLOOP= DPOKE QQLOOP= Q>4?K PQQLOOPQ>5?K.} PQQLOOP?K LOOPJ DINC QQLOOP$IFGT QQLOOP=QQLOOP=@LJQQQLOOP5QQQLOOP.}5:@LJX;7X; DOK, LOOPK -- loop control using the 'K' variableX; DOK DPOKE QQLOOP= D.}POKE QQLOOP = Q>4?K PQQLOOPQ>5?K PQQLOOP?K LOOPK DINC QQLOOP$IFGT.} QQLOOP=QQLOOP =@LKQQQLOOP5QQQLOOP5:@LK TRAP VPOKE QQTRAP= p#A. .} MISCellaneous macrosAqX;r0X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sX;t*X; Miscellaneous macros from KERNEL.M65u.}X;v0X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wX;x(X; DINC -- increment a word (2 bytes)yX;z DINC {# |H?.}K} # ~?KX;2X; VPOKE -- poke an immediate value into a wordX; VPOKE  Q>4 P  Q>5  P .}X;+X; DPOKE -- could be better called DMOVEX; DPOKE    Q P  Q  P Q.}> P Q> P X; X; POKE -- a single byte pokeX; POKE  PLDA P X;.X; WA.}IT -- wait a certain number of jiffiesX; WAIT POKE  = ?KQ H?KX;(X; STOP -- stop until S.}TART is pushedX; STOP  QQSTOPX;&X; SOUND -- just like BASIC's soundX; SOUND POKE =Q>.}PҶP2   $>   PLDA T?> 2 Q>   PLDA  T16 .}P PLDA M>LP9 PLDA P9X;%X; BMOVE -- move a block of memoryX; BMOV.}E VPOKE QQPASS= VPOKE = VPOKE =  QQBMOVX;9X; PGMOVE -- special move of a single pag.}e (256 bytes)X; PGMOVE POKE =  PLDA  QQPGMVX;3X; BCLR -- clear (set to zero) a block of m.}emoryX; BCLR VPOKE = VPOKE QQPASS=  QQBCLRX;-X; PGCLR -- fast clear of a page of memo.}ryX;X; PGCLR  PUSHY POKE = POKE =??L1P@73H?L1 PULLY a page of memo,o QQVBVR bQQHTM QQHTP  QQVM  QQHP  QQVP QQOVP QQPBAS  QQMBAS 2}QQPFLG  QQMFLG QQSHAP QQPSAV  QQHT QQMASK = =0= QQSMSZ 9QQMSM ===2}========@== =0=QQMBIT === PLDX   $> $  PMGR  PH2}R  PLDA  QQPMGR PLR  SETVEC VPOKE QQVBVR=    SHAPE  PUSHX  PLDA  T?> Q2}>5 PQQSHAP9 Q>4  PQQSHAP9 PULLX  PMCOLR  PUSHX  PLDX  PLDA  T16  PQQCMP2} PLDA , OQQCMPP9 PULLX ! PMOVE " PUSHX # PLDX $ PLDA % PQQHP9& PLDA ' P2}QQVP9(Q>) PQQPFLG9* PULLX +, MMOVE - PUSHX . PLDX / PLDA 0P91 PLDA 2 PQQVM93Q>2}4 PQQMFLG5 PULLX 67 PSIZE 8 PUSHX 9 PLDX :0;A< PLDX =P9> PLDA ? PQQHTP9@ PULLX 2}AB MSIZE C PUSHX D PLDX E0FAGT?HT?I PQQCMPJ PLDA K,L OQQCMPM>N QQQMSM9O LQQSMSZP P2}QQSMSZQP R PLDX S PLDA T PQQHTM9U PULLX VW MPLC X&Y PLDX Z QQQMBIT9[ PLDX \M2}9]5^$_7`a MPFC b&c PLDX d QQQMBIT9e PLDX fM9g5h$i7jk PPLC l&m PLDX2} n QQQMBIT9o PLDX pM 9q5r$s7tu PPFC v&w PLDX x QQQMBIT9y PLDX zM9{5|$2}}7~)X;************************************X; PMGR RUNTIME CODE)X;************************************2} QQPMGRPԅ,O>> PQQMBAS2 &QQPBAS2&QQPBAS2&QQPBAS2&QQPBASQ>P2}ГQ>>P/Q> %>4QQAPMM $>5QQAPMM \: QQAPMM%>?AL1Q8 PQQPSAV83)> H?AL12}$>?AL2 QQQHP9P9 QQQOVP9 RQQVP9 FQQNPX QQQPFLG9 FQQNPX QQQPBAS9Pέ QQQOVP9Pͯ QQ2}QHTP9 PQQHT%>C?AL3P@73 )QQHT H?AL3AT?? QQQSHAP8P˽QQQSHAP8P̿ QQQVP92}P PQQOVP9%>?AL4Q@7P@73 )QQHT H?AL4 QQNPX2(> H?AL2 QQQMFLG FQQRET Q2}QQMBASPQ>P??AL8P@73 H?AL8$>?AL5 QQQHTM9 PQQHT QQQVM9P%>?AL62}Q@7 LQQMASK9P@73 )QQHT H?AL62(> H?AL5 QQRET$>?AL7 QQQPSAV9P9Q> PQ3}QMFLG PQQPFLG92(> H?AL7 !@QQVBVR:2(> H?AL5 QQRET$>?AL7 QQQPSAV9P9Q> PQ02X;/X; The fine scroll macro library and support5X; subroutines. They are heavily interdependent,X; so must 7}always be .INCLUDEd togetherX; XDIM  YDIM  SCRBAS  CSRBAS  SDSPL  SHSROL  SVSROL  HS7}PEED  VSPEED  X0LIM  Y0LIM  LINES  JMPBYT  RVBIV  XLOC  YLOC  CWIDE  CHIGH 7} MLINES  SRBYTW  DIR  HCOUNT  VCOUNT  SCROLL  MODE 0OLDVBV ;; Will hold previous vb7}lank vector'VVBLKD$;; Deferred vblank vector0SETVBV\;; OS routine to set vblank vector X;  SCRDIM  PLDA 7}  > L>p PJMPBYT00 &MODEPOKE XDIM= POKE YDIM= VPOKE SCRBAS= VPOKE SDSPL= 7} QQDSRL SETXY POKE XLOC= POKE YLOC=  QQSXYSTOPSCROLL $OLDVBV %OLDVBV Q>!7} SETVBV"#QQCWID =====$QQCHIG = ====%QQMLIN === == & QQDSRL'DPOKE CSRBA7 }S=SCRBAS( $MODE) QQQCWID9* PCWIDE+ QQQCHIG9, PCHIGH- QQQMLIN9. PMLINES/Q>0 PXLOC1 PYLOC2 PVSPEED3 P7 }HSPEED4Q>5 PSCROLL6Q>7 PSHSROL8 PSVSROL9 QCWIDE:>;Q><(>= HQQSL2>V?? QQSL2@V?AV?B PSRBY7 }TWC QXDIMD;E SSRBYTWF PX0LIMG "X0LIMH QYDIMI;J SMLINESK PY0LIML "Y0LIMM QMLINESNT?O,P OMLINESQ P7 }LINESR #LINESS #LINEST #LINESU$X; WRITE BEGINING & END OF D LISTVDPOKE =SDSPLWQ>pX%>YP@7Z3[P@7 }7\3]P@7^ %LINES_3`3a3bQ>BcP@7d3eQfP@7g3hQiP@7jQ>k3lP@7m3nP@7o3p7}P@7qQ>Ar3sP@7t QSDSPLu3vP@7w QSDSPLx3yP@7zDPOKE RVBIV=${3DPOKE OLDVBV=VVBLKD;; Sav7}e old vblank vector| %>4QQAUTS} $>5QQAUTS~Q> SETVBV;; SETVBVQ>P QQSL3Q HQQSL3DPOKE 07}=SDSPLQ>P: QQAUTSX; SAVE 212 & 204 ON STACK-Qԍ5 Q5Q̑5 Q5DPOKE7} =CSRBASDPOKE =SDSPL%> QQTL1 QJMPBYTP@73QԜP@73 QP@7X; ADD XDIM TO 217}2,Qԣ OXDIMPԥ QO> P3 )LINES HQQTL1X; WRITE LAST MODE LINE QJMPBYTM>WP@7}73QԱP@73 QP@7X; WRITE SHADOWS QSHSROLP;; HSCROL QSVSROLPԺ7 P77}P̾7 P7P QSCROLLPDIRVDIREQQTNU;; NO UPWARD SCROL #VCOUNT QVSPEED RVCOUNT EQQTNU7}Q> PVCOUNT "SVSROL IQQTNU QYLOC HQQTASNQ> PSVSROL FQQTNU QQTASN QCHIGH PSVSROL "YLO7}C; QCSRBAS SXDIM PCSRBAS EQQTNU"CSRBAS QQTNU X; DOWN ?VDIR EQQTNV #VCOUNT QVSPEED R7}VCOUNT EQQTNVQ> PVCOUNT #SVSROL QCHIGH RSVSROL EQQTNVX; CHECK LIMIT QYLOC RY0LIM HQQTASN27} QCHIGH PSVSROL HQQTNV QQTASN2Q> PSVSROL #YLOC, QCSRBAS OXDIM PCSRBAS DQQTNV#CSRBAS7} QQTNV X; LEFT?VDIR EQQTNL #HCOUNT QHSPEED RHCOUNT EQQTNLQ> PHCOUNT #SHSROL QCWIDE7} RSHSROL  EQQTNL X; CHECK LIMIT  QXLOC  HQQTASN3  QCWIDE PSHSROL HQQTNL QQTASN3Q> PSHSROL "XLO7}C "CSRBASQ> RCSRBAS HQQTNL"CSRBAS QQTNL X; RIGHT ?VDIR EQQTNR #HCOUNT QHSPEED RHCOU7}NT  EQQTNR!Q>" PHCOUNT# "SHSROL$ IQQTNR%X; CHECK LIMIT& QXLOC' RX0LIM( HQQTASN4)Q>* PSHSROL+ FQQT7}NR, QQTASN4- QCWIDE. PSHSROL/ #XLOC0 #CSRBAS1 DQQTNR2#CSRBAS3 QQTNR4 !@RVBIV:5 QQSXY6 QX0LIM7 RXL7}OC8BGT QQSX19 PXLOC: QQSX1; QY0LIM< RYLOC=BGT QQSX2> PYLOC? QQSX2@DPOKE CSRBAS=SCRBASA %YLOCB 7}FQQSXL6C QQSXL4D,E QCSRBASF OXDIMG PCSRBASH DQQSXL5I#CSRBASJ QQSXL5K1L HQQSXL4M QQSXL6NX; ADD IN7 } XLOCO,P QCSRBASQ OXLOCR PCSRBASS DQQSXL7T#CSRBASU QQSXL7VX; CLEAR SHADOWSWQ>X PSHSROLY PSVSROLZ7!}7!@OLDVBV:;; Exit through old vertical blank vector.#CSRBASU QQSXL7VX; CLEAR SHADOWSWQ>X PSHSROLY PSVSROLZ4510 .OPT NOLIST0980 .OPT NOEJECT0990 .TITLE "A sample device driver for Atari's OS"1000 .PAGE "--- general remarks -;#}--"1010 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1020 ;1030 ; The "M:" driver --1040 ; Using memory as a device1050 ;1060 ; In;$}cludes installation program1070 ;1080 ; Written by Bill Wilkinson1090 ; for January, 1982, COMPUTE!1100 ;1110 ;;;;;;;;;%};;;;;;;;;;;;;;;;;;;;;;;1120 ;1130 ; EQUATES INTO ATARI'S OS, ETC.1140 ;1150 ICAUX1 = $34A ; The AUX1 byte of IOCB1160 ;;&}1170 OPOUT = 8 ; Mode 8 is OPEN for OUTPUT1180 ;1190 MEMLO = $2E7 ; pointer to bottom of free RAM1200 MEMTOP = $2E5 ; poin;'}ter to top of free RAM1210 ;1220 FR1 = $E0 ; Fltg Pt Register 1, scratch1230 ;1240 STATUSOK = 1 ; I/O was good1250 STATU;(}SEOF = $88 ; reached an end-of-file1260 ;1270 HATABS = $31A1280 ;1290 HIGH = $100 ; divisor for high byte1300 LOW = $FF ;)}; mask for low byte1310 ;1320 .PAGE "The installation routine"1330 ;====== CHANGE NEXT LINE TO SUIT YOUR MEMORY ======13;*}40 *= $30001350 ; This first routine is simply1360 ; used to connect the driver1370 ; to Atari's handler address1380 ; ;+}table.1390 ;1400 LOADANDGO1410 LDX #0 ; We begin at start of table1420 SEARCHING1430 LDA HATABS,X ; Check device name;,}1440 BEQ EMPTYFOUND ; Found last one1450 CMP #'M' ; Already have M: ?1460 BEQ MINSTALLED ; Yes, don't reinstall1470 IN;-}X1480 INX1490 INX ; Point to next entry1500 BNE SEARCHING ; and keep looking1510 RTS ; Huh? Impossible!!!1520 ;1530;.} ; We found the current end of the1540 ; table...so extend it.1550 ;1560 EMPTYFOUND1570 LDA #'M' ; Our device name, "M:";/}1580 STA HATABS,X ; is first byte of entry1590 LDA #MDRIVER&LOW1600 STA HATABS+1,X ; LSB of driver addr1610 LDA #MDRI;0}VER/HIGH1620 STA HATABS+2,X ; and MSB of addr1630 LDA #01640 STA HATABS+3,X ; A new end for the table1650 ;1660 ; now;1} change LOMEM so BASIC won't1670 ; overwrite us.1680 ;1690 MINSTALLED1700 LDA #DRIVERTOP&LOW1710 STA MEMLO ; LSB of to;2}p addr1720 LDA #DRIVERTOP/HIGH1730 STA MEMLO+1 ; and MSB therof1740 ;1750 ; and that's all we have to do!1760 ;1770 ;3}RTS1780 ;1790 ;1800 ;;;;;;;;;;;;;;;;;;;;;;;;;;;1810 ;1820 ; This entry point is provided1830 ; so that BASIC can reconn;4}ect1840 ; the driver via a USR(RECONNECT)1850 ;1860 RECONNECT1870 PLA1880 BEQ LOADANDGO ; No parameters, I hope1890 ;5}TAY1900 PULLTHEM1910 PLA1920 PLA ; get rid of a parameter1930 DEY1940 BNE PULLTHEM ; and pull another1950 BEQ LOAD;6}ANDGO ; go reconnect1960 ;1970 .PAGE "The driver itself"1980 ;1990 ; Recall that all drivers must2000 ; be connected to;7} OS through2010 ; a driver routines address table.2020 ;2030 MDRIVER2040 .WORD MOPEN-1 ; The addresses must2050 .WORD ;8}MCLOSE-1 ; ...be given in this2060 .WORD MGETB-1 ; ...order and must2070 .WORD MPUTB-1 ; ...be one (1) less2080 .WORD M;9}STATUS-1 ; ...than the actual2090 .WORD MXIO-1 ; ...address2100 JMP MINIT ; This is for safety only2110 ;2120 ; For man;:}y drivers, some of these2130 ; routines are not needed, and2140 ; can effectively be null routines2150 ;2160 ; A null rou;;}tine should return2170 ; a one (1) in the Y-register2180 ; to indicate success.2190 ;2200 MXIO2210 MINIT2220 LDY #1 ; ;<}success2230 RTS2240 ;2250 ; If a routine is omitted because2260 ; it is illegal (reading from a2270 ; printer, etc.), s;=}imply pointing2280 ; to an RTS is adequate, since2290 ; Atari OS preloads Y with a2300 ; 'Function Not Implemented' error;>}2310 ; return code.2320 ;2330 .PAGE "The driver function routines"2340 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2350 ;2360 ; Now;?} we begin the code for the2370 ; routines that do the actual2380 ; work2390 ;2400 MOPEN2410 LDA ICAUX1,X ; Check type o;@}f open2420 AND #OPOUT ; Open for output?2430 BEQ OPENFORREAD ; No...assume for input2440 LDA MEMTOP2450 STA MSTART ; ;A}We start storing2460 LDY MEMTOP+1 ; ...the bytes2470 DEY ; ...one page below2480 STY MSTART+1 ; the supposed top of mem;B}2490 ;2500 ; now we join up with mode 4 open2510 ;2520 OPENFORREAD2530 LDA MSTART ; simply move the2540 STA MCURRENT ;C}; ...start pointer2550 LDA MSTART+1 ; ...to the current2560 STA MCURRENT+1 ; ...pointer, both bytes2570 ;2580 LDY #STA;D}TUSOK2590 RTS ; we don't acknowledge failure2600 ;2610 ;2620 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2630 ;2640 ; the routine ;E}for CLOSE of M:2650 ;2660 MCLOSE2670 LDA ICAUX1,X ; check mode of open2680 AND #OPOUT ; was for output?2690 BEQ MCLRE;F}AD ; no...close input 'file'2700 ;2710 LDA MCURRENT ; we establish our2720 STA MSTOP ; ...limit so that2730 LDA MCURRE;G}NT+1 ; ...next use can't2740 STA MSTOP+1 ; ...go too far2750 ;2760 MCLREAD2770 LDY #STATUSOK2780 RTS ; and guaranteed;H} to be ok2790 ;2800 ;2810 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2820 ;2830 ; This routine puts one byte2840 ; to the memory for;I} later2850 ; retrieval.2860 ;2870 MPUTB2880 PHA ; save the byte to be PUT2890 JSR MOVECURRENT ; get ptr to zero page2;J}900 PLA ; the byte again2910 LDY #02920 STA (FR1),Y ; put the byte, indirectly2930 JSR DECCURRENT ; point to nxt byte;K}2940 RTS ; that's all2950 ;2960 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2970 ;2980 ; routine to get a byte put2990 ; in memory bef;L}ore.3000 ;3010 MGETB3020 JSR MSTATUS ; any more bytes?3030 BCS MGETRTS ; no...error3040 LDY #03050 LDA (FR1),Y ; ye;M}s...get a byte3060 JSR DECCURRENT ; and point to next byte3070 MGETRTS3080 RTS3090 ;3100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;N};;3110 ;3120 ; check the status of the driver3130 ;3140 ; this routine is only valid3150 ; when READing the 'file'...31;O}60 ; "M:" never gets errors when3170 ; writing.3180 ;3190 MSTATUS3200 JSR MOVECURRENT ; current ptr to zero page3210 C;P}MP MSTOP ; any more bytes to get?3220 BNE MSTOK ; yes3230 CPY MSTOP+1 ; double chk3240 BNE MSTOK ; yes, again3250 LDY;Q} #STATUSEOF ; oops...3260 SEC ; no more bytes3270 RTS3280 ;3290 MSTOK3300 LDY #STATUSOK ; all is okay3310 CLC ; fla;R}g for MGETB3320 RTS3330 .PAGE "Miscellaneous subroutines"3340 ;3350 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3360 ;3370 ; final;S}ly, we have a couple of3380 ; short and simple routines to3390 ; manipulate MCURRENT, the ptr3400 ; to the currently acces;T}sed byte3410 ;3420 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3430 ;3440 ; MOVECURRENT simply moves3450 ; MCURRENT to the floating;U}3460 ; point register, FR1, in3470 ; zero page. FR1 is always3480 ; safe to use except in the3490 ; middle of an expr;V}ession.3500 ;3510 MOVECURRENT3520 LDA MCURRENT3530 STA FR1 ; notice that we use3540 LDY MCURRENT+1 ; both the A and3;W}550 STY FR1+1 ; Y registers...this3560 RTS ; is for MSTATUS use3570 ;3580 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3590 ;3600 ;;X} DECCURRENT simply does a two3610 ; byte decrement of the MCURRENT3620 ; pointer and returns with the3630 ; Y register ;Y}indicating OK status.3640 ; NOTE that the A register is3650 ; left undisturbed.3660 ;3670 DECCURRENT3680 LDY MCURRENT ;Z}; check LSB's value3690 BNE DECLOW ; if non-zero, MSB is ok3700 DEC MCURRENT+1 ; if zero, need to bump MSB3710 DECLOW37;[}20 DEC MCURRENT ; now bump the LSB3730 LDY #STATUSOK ; as promised3740 RTS3750 .PAGE "RAM usage and clean up"3760 ;3;\}770 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3780 ;3790 ; END OF CODE3800 ;3810 ;3820 ; Now we define our storage3830 ; locations.;]}3840 ;3850 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3860 ;3870 ;3880 ; MCURRENT holds the pointer to3890 ; the next byte to be PUT;^} or GET3900 MCURRENT .WORD 03910 ;3920 ; MSTOP is set by CLOSE to point3930 ; to the last byte PUT, so GET3940 ; won't t;_}ry to go past the end3950 ; of data.3960 MSTOP .WORD 03970 ;3980 ; MSTART is derived from MEMTOP3990 ; and points to the;`} first byte4000 ; stored. The bytes are stored4010 ; in descending addresses until4020 ; MSTOP is set by CLOSE.4030 MSTA;a}RT .WORD 04040 ;4050 ; DRIVERTOP becomes the new4060 ; contents of MEMLO4070 DRIVERTOP = *+$FF&$FF004080 ; (sets to next;b} page boundary)4090 ;4100 ;4110 ; The following is how you make4120 ; a LOAD-AND-GO file under4130 ; Atari's DOS 24140 ;c};4150 *= $2E04160 .WORD LOADANDGO4170 ;4180 ;4190 .END4120 ; a LOAD-AND-GO file under4130 ; Atari's DOS 24140 8B)AIOMAC.LIB -- OSS system I/O macrosAA Support MacrosA 10IOCB2 AYou must include SYSEQU.M65 ahead of th?e}is!!AX;$6X; These macros are called by the actual I/O macros.9X; to perform the rudimentary register load functions.?f}8X;BX;LX; MACRO: @CHVX;`6X; Loads IOCB number (parameter 1) into X register.jX;t 7 then a memory location1X; is assumed to?h} contain the channel number.X; @CH   Q T?T?T?T?>  $> (X;2X;<X; MAC?i}RO: @CVFX;P:X; Loads Constant or Value into accumultor (A-register)ZX;d+X; If value of parameter 1 is 0-255, @CVn+X; ?j}assumes it's an (immediate) constant.xX;'X; Otherwise the value is assumed to+X; be a memory location (non-zero page).?k}X;X;X; @CV   Q> Q X;X;X;X;"X; MACRO: @FL,X;65X; @FL is used to e?l}stablish a filespec (file name)@X;J-X; If a literal string is passed, @FL willT'X; generate the string in line, jump^&X;?m} around it, and place its addressh/X; in the IOCB pointed to by the X-register.rX;|(X; If a non-zero page label is passed?n}*X; the MACRO assumes it to be the label.X; of a valid filespec and uses it instead.X;X;X; @FL   ?o} !   @F = Q>4@F PICBADR9 Q>5@FPICBADR9 Q>4  PICBADR9& Q>5 0PICBADR9:D?p}NA XIO macroAXX;bX; MACRO: XIOlX;v/X; FORM: XIO cmd,ch[,aux1,aux2][,filespec]X;%X; ch is given as in the?q} @CH macro3X; cmd, aux1, aux2 are given as in the @CV macro+X; filespec is given as in the @FL macroX;5X; performs f?r}amiliar XIO operations with/for OS/A+X;/X; If aux1 is given, aux2 must also be given8X; If aux1 and aux2 are omitted, ?s}they are set to zero1X; If the filespec is omitted, "S:" is assumedX; XIO  3 % AXIO: wrong number o?t}f argumentsA  @CH   @CV *PICCOM9;; COMMAND4  > @CV H PICAUX19R @CV \ PICAUX29fp?u}Q>z PICAUX19 PICAUX29 3 @FL AS:A @@IO @FL @@@IO: CIOA ?v} OPEN macroAX; X; MACRO: OPEN X; (X; FORM: OPEN ch,aux1,aux2,filespec$ X;. %X; ch is given as in the @CH macro8 1?w}X; aux1 and aux2 are given as in the @CV macroB +X; filespec is given as in the @FL macroL X;V 1X; will attempt to open the ?x}given file name on` /X; the given channel, using the open "modes"j X; specified by aux1 and aux2t X;~ OPEN   &?y} AOPEN: wrong number of argumentsA    XIO COPN= = = =   XIO COPN= = = =    ?z} A BGET and BPUT macrosA X; X; MACROS: BGET and BPUT X; X; FORM: BGET ch,buf,len X; BPUT ch,buf,le?{}n( X;2 %X; ch is given as in the @CH macro< .X; len is ALWAYS assumed to be an immediateF 1X; and actual value...never a m?|}emory addressP /X; buf must be the address of an appropriateZ X; buffer in memoryd X;n +X; puts or gets length bytes to/f?}}rom thex 0X; specified buffer, uses binary read/write X; X; X; first: a common macro X; @GP @CH  Q> ?~} PICCOM9 Q>4  PICBADR9 Q>5  PICBADR9 Q>4  PICBLEN9 Q>5  PICBLEN9"  CIO, 6 X;@ B?}GET J  T ' ABGET: wrong number of parametersA^ h @GP = = =CGBINRr |  X; BPUT   ' AB?}PUT: wrong number of parametersA  @GP = = =CPBINR   X; A PRINT macroA X; X; MACRO: PRINT ?}X; (X; FORM: PRINT ch[,buffer[,length]] X; !X; ch is as given in @CH macro& (X; if no buffer, prints just a RETURN0 %X;?} if no length given, 255 assumed: X;D 8X; used to print text. To print text without RETURN,N -X; length must be given. See?} OS/A+ manualX X;b 2X; EXCEPTION: second parameter may be a literall .X; string (e.g., PRINT 0,"test"), in whichv -X; case?} the length (if given) is ignored. X; PRINT  3  ( APRINT: wrong number of parametersA    ?}  !   @IO = @GP =@IO= =CPTXTR    @GP = ==CPTXTR  @GP = ?}= =CPTXTR  * 4 ! > @IO H @GP =@IO==CPTXTRR \ f p X;z A INPUT macroA X; X; MACRO:?} INPUT X; X; FORM: INPUT ch,buf,len X; %X; ch is given as in the @CH macro )X; buf MUST be a proper buffer address?} 6X; len may be omitted, in which case 255 is assumed X; ,X; gets a line of text input to the given 'X; buffer, maximu?}m of length bytes X; INPUT  3 ( AINPUT: wrong number of parametersA$  .@GP = ==?}CGTXTR8B@GP = = =CGTXTRLV`jA CLOSE macroAtX;~X; MACRO: CLOSEX;X; FORM: CLOSE ch?}X;%X; ch is given as in the @CH macroX;X; closes channel chX; CLOSE   ( ACLOSE: wrong number of par?}ametersA @CH  Q>CCLOSE  PICCOM9 CIO(2X;<-X;;;;;;;;;;; END OF IOMAC.LIB ;;;;;;;;;;;;FX; of par<vs