mads 1.9.7 build 53 (29 Sep 13) Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 ;Atari 8-bit Scorched Earth source code 3 ;--------------------------------------------------- 4 ;by Tomasz 'pecus' Pecko and Pawel 'pirx' Kalinowski 5 ;Warsaw 2000,2001,2002,2003,2009,2012,2013 6 ;you can contact us at pecus@poczta.fm or pirx@91.pl 7 ;home page of this project is http://pecus.pigwa.net/pliki/Atari/scorch/ 8 9 ;this source code was compiled under OMC65 crossassembler 10 ;and on 2012-06-21 translated to mads 11 ; 12 ;game source code is split into 5 parts: 13 ;program.s65 is the main game code (with many assorted routines) 14 ;grafproc.s65 - graphics routines like line or circle 15 ;textproc.s65 - text routines like list of weapons and shop 16 ;variables.s65 - all non-zero page variables and constans 17 ;display.s65 - display lists and text screen definitions 18 19 ;we were trying to use as much macros and pseudoops as possible 20 ;they are defined in atari.hea and macro.hea files together with many 21 ;atari constans. This way it shoud be relatively easy to 22 ;port this code to e.g. C64 23 ; 24 ;After those N years of working on this piece of code 25 ;we are sure it would be much wiser to write it in C or 26 ;Action!, but on the other hand it is so much fun to type 150 chars 27 ;where you want to have y=ax+b :) 28 ; 29 ;originally most variables were in Polish, comments were rare 30 ;but we wanted to release this piece of code to public 31 ;and due to being always short of time (to finish the game) 32 ;we decided it must go in 'English' to let other people work on it 33 34 .zpvar xdraw .word = $80 ;variable X for plot 35 .zpvar ydraw .word;variable Y for plot (like in Atari Basic - Y=0 in upper right corner of the screen) 36 .zpvar xbyte .word 37 38 .zpvar ybyte .word 39 .zpvar CharCode .byte 40 .zpvar fontind .word 41 .zpvar tanknr .byte 42 .zpvar TankSequencePointer .byte 43 .zpvar oldplot .word 44 .zpvar xc .word 45 .zpvar temp .word ;temporary word for the most embeded loops only 46 .zpvar temp2 .word;same as above 47 .zpvar tempXROLLER .word;same as above for XROLLER routine 48 ;(used also in result display routine) 49 .zpvar xtempDRAW .word ;same as above for XDRAW routine 50 .zpvar ytempDRAW .word ;same as above for XDRAW routine 51 ;--------------temps used in circle routine 52 .zpvar xi .word ;X (word) in draw routine 53 .zpvar fx .byte ;circle drawing variables 54 .zpvar yi .word ;Y (word) in draw routine 55 .zpvar fy .byte 56 .zpvar xk .word 57 .zpvar fs .byte 58 .zpvar yc .byte ;ycircle - temporary for circle 59 .zpvar dx .word 60 .zpvar tempor2 .byte 61 .zpvar dy .word 62 .zpvar tempor3 .word 63 .zpvar dd .word 64 .zpvar di .word 65 .zpvar dp .word 66 .zpvar modify .word 67 .zpvar weaponPointer .word 68 69 ;------------------------------- 70 ;constants 71 = 0096 FlyDelay=150 72 = 00C8 screenheight=200 73 = 0028 screenBytes = 40 74 = 0140 screenwidth=screenBytes*8 75 = 0030 margin=48 ;mountain drawing Y variable margin 76 = 1010 display=$1010 ;kill dos with the casette recorder! 77 = 0006 MaxPlayers = 6 78 79 icl '../lib/atari.hea' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\atari.hea 1 /* 2 scr48 = %00111111 ;screen 48b 3 scr40 = %00111110 ;screen 40b 4 scr32 = %00111101 ;screen 32b 5 */ 5 6 7 * --------------------------------------------------------------------------------------------- 8 * --- GTIA 9 * --------------------------------------------------------------------------------------------- 10 = D000 hposp0 = $D000 ; pozioma pozycja gracza 0 (Z) 11 = D001 hposp1 = $D001 ; pozioma pozycja gracza 1 (Z) 12 = D002 hposp2 = $D002 ; pozioma pozycja gracza 2 (Z) 13 = D003 hposp3 = $D003 ; pozioma pozycja gracza 3 (Z) 14 = D004 hposm0 = $D004 ; pozioma pozycja pocisku 0 (Z) 15 = D005 hposm1 = $D005 ; pozioma pozycja pocisku 1 (Z) 16 = D006 hposm2 = $D006 ; pozioma pozycja pocisku 2 (Z) 17 = D007 hposm3 = $D007 ; pozioma pozycja pocisku 3 (Z) 18 = D008 sizep0 = $D008 ; poziomy rozmiar gracza 0 (Z) 19 = D009 sizep1 = $D009 ; poziomy rozmiar gracza 1 (Z) 20 = D00A sizep2 = $D00A ; poziomy rozmiar gracza 2 (Z) 21 = D00B sizep3 = $D00B ; poziomy rozmiar gracza 3 (Z) 22 = D00C sizem = $D00C ; poziomy rozmiar pocisków (Z) 23 = D00D grafp0 = $D00D ; rejestr grafiki gracza 0 (Z) 24 = D00E grafp1 = $D00E ; rejestr grafiki gracza 1 (Z) 25 = D00F grafp2 = $D00F ; rejestr grafiki gracza 2 (Z) 26 = D010 grafp3 = $D010 ; rejestr grafiki gracza 3 (Z) 27 = D011 grafm = $D011 ; rejestr grafiki pocisków (Z) 28 = D012 colpm0 = $D012 ; rejestr koloru gracza i pocisku 0 (Z) 29 = D013 colpm1 = $D013 ; rejestr koloru gracza i pocisku 1 (Z) 30 = D014 colpm2 = $D014 ; rejestr koloru gracza i pocisku 2 (Z) 31 = D015 colpm3 = $D015 ; rejestr koloru gracza i pocisku 3 (Z) 32 = D016 colpf0 = $D016 ; rejestr koloru pola gry 0 (Z) 33 = D017 colpf1 = $D017 ; rejestr koloru pola gry 1 (Z) 34 = D018 colpf2 = $D018 ; rejestr koloru pola gry 2 (Z) 35 = D019 colpf3 = $D019 ; rejestr koloru pola gry 3 (Z) 36 = D01A colbak = $D01A ; rejestr koloru tła (Z) 37 38 = D016 color0 = colpf0 39 = D017 color1 = colpf1 40 = D018 color2 = colpf2 41 = D019 color3 = colpf3 42 43 = D000 kolm0pf = $D000 ; kolizja pocisku 0 z polem gry (O) 44 = D001 kolm1pf = $D001 ; kolizja pocisku 1 z polem gry (O) 45 = D002 kolm2pf = $D002 ; kolizja pocisku 2 z polem gry (O) 46 = D003 kolm3pf = $D003 ; kolizja pocisku 3 z polem gry (O) 47 = D004 kolp0pf = $D004 ; kolizja gracza 0 z polem gry (O) 48 = D005 kolp1pf = $D005 ; kolizja gracza 1 z polem gry (O) 49 = D006 kolp2pf = $D006 ; kolizja gracza 2 z polem gry (O) 50 = D007 kolp3pf = $D007 ; kolizja gracza 3 z polem gry (O) 51 = D008 kolm0p = $D008 ; kolizja pocisku 0 z graczem (O) 52 = D009 kolm1p = $D009 ; kolizja pocisku 1 z graczem (O) 53 = D00A kolm2p = $D00A ; kolizja pocisku 2 z graczem (O) 54 = D00B kolm3p = $D00B ; kolizja pocisku 3 z graczem (O) 55 = D00C kolp0p = $D00C ; kolizja gracza 0 z innym graczem (O) 56 = D00D kolp1p = $D00D ; kolizja gracza 1 z innym graczem (O) 57 = D00E kolp2p = $D00E ; kolizja gracza 2 z innym graczem (O) 58 = D00F kolp3p = $D00F ; kolizja gracza 3 z innym graczem (O) 59 = D010 trig0 = $D010 ; stan przycisku joysticka 0 (O) 60 = D011 trig1 = $D011 ; stan przycisku joysticka 1 (O) 61 = D013 trig3 = $D013 ; znacznik dołączenia cartridge-a (O) 62 = D014 pal = $D014 ; znacznik systemu TV (O) 63 64 = D01B gtictl = $D01B ; rejestr kontroli układu GTIA 65 = D01B gtiactl = gtictl 66 67 = D01C vdelay = $D01C ; licznik opóźnienia pionowego P/MG 68 = D01D pmcntl = $D01D ; rejestr kontroli graczy i pocisków 69 = D01E hitclr = $D01E ; rejestr kasowania rejestrów kolizji 70 = D01F consol = $D01F ; rejestr stanu klawiszy konsoli Start (bit 0), Select (bit 1), Option (bit 2) 71 72 * --------------------------------------------------------------------------------------------- 73 * --- POKEY 74 * --------------------------------------------------------------------------------------------- 75 76 = 0010 irqens = $0010 ; rejestr-cień IRQEN 77 = 0011 irqstat = $0011 ; rejestr-cień IRQST 78 79 = D204 audf3 = $D204 ; częstotliwość pracy generatora 3 (Z) 80 = D208 audctl = $D208 ; rejestr kontroli generatorów dźwięku (Z) 81 = D209 stimer = $D209 ; rejestr zerowania liczników (Z) 82 = D209 kbcode = $D209 ; kod ostatnio naciśniętego klawisza (O) 83 = D20A skstres = $D20A ; rejestr statusu złącza szeregowego (Z) 84 = D20A random = $D20A ; rejestr liczby losowej (O) 85 = D20D serout = $D20D ; szeregowy rejestr wyjściowy (Z) 86 = D20D serin = $D20D ; szeregowy rejestr wejściowy (O) 87 = D20E irqen = $D20E ; zezwolenie przerwań IRQ (Z) 88 = D20E irqst = $D20E ; status przerwań IRQ (O) 89 = D20F skctl = $D20F ; rejestr kontroli złącza szeregowego (Z) 90 = D20F skstat = $D20F ; rejestr statusu złącza szeregowego (O) 91 92 * --------------------------------------------------------------------------------------------- 93 * --- PIA 94 * --------------------------------------------------------------------------------------------- 95 = D300 porta = $D300 ; port A układu PIA 96 = D301 portb = $D301 ; port B układu PIA 97 = D302 pactl = $D302 ; rejestr kontroli portu A 98 = D303 pbctl = $D303 ; rejestr kontroli portu B 99 100 * --------------------------------------------------------------------------------------------- 101 * --- ANTIC 102 * --------------------------------------------------------------------------------------------- 103 = D400 dmactl = $D400 ; rejestr kontroli dostępu do pamięci 104 = D401 chrctl = $D401 ; rejestr kontroli wyświetlania znaków 105 = D402 dlptr = $D402 ; adres programu ANTIC-a 106 = D404 hscrol = $D404 ; znacznik poziomego przesuwu obrazu 107 = D405 vscrol = $D405 ; znacznik pionowego przesuwu obrazu 108 = D407 pmbase = $D407 ; adres pamięci graczy i pocisków 109 = D409 chbase = $D409 ; adres zestawu znaków 110 = D40A wsync = $D40A ; znacznik oczekiwania na synchronizację poziomą 111 = D40B vcount = $D40B ; licznik linii obrazu 112 = D40C lpenh = $D40C ; poziome położenie pióra świetlengo 113 = D40D lpenv = $D40D ; pionowe położenie pióra świetlnego 114 = D40E nmien = $D40E ; rejestr zezwoleń na przerwania NMI 115 = D40F nmist = $D40F ; rejestr statusu przerwań NMI 116 117 ;------------------------------------- 118 ;additional system variables 119 ;------------------------------------- 120 = 02C0 COLPM0S = $02C0 ;- - rejestr-cień COLPM0 121 = 02C1 COLPM1S = $02C1 ;- - rejestr-cień COLPM1 122 = 02C2 COLPM2S = $02C2 ;- - rejestr-cień COLPM2 123 = 02C3 COLPM3S = $02C3 ;- - rejestr-cień COLPM3 124 = 02C4 COLPF0S = $02C4 ;- - rejestr-cień COLPF0 125 = 02C5 COLPF1S = $02C5 ;- - rejestr-cień COLPF1 126 = 02C6 COLPF2S = $02C6 ;- - rejestr-cień COLPF2 127 = 02C7 COLPF3S = $02C7 ;- - rejestr-cień COLPF3 128 129 = 02C8 COLBAKS = $02C8 130 = 026F GTICTLS = $026F ;- - rejestr-cień GTIACTL 131 132 = 022F DMACTLS = $022F ;- - rejestr kontroli dostępu do pamięci - cień 133 = 0230 DLPTRS = $0230 ;- - adres programu ANTIC-a - cień 134 = 02F4 CHBAS = $02F4 ;- - rejestr-cień CHBASE 135 = 02FC KBCODES = $02FC ;- - rejestr-cień KBCODE 136 137 = E45C SETVBV = $E45C 138 = E462 XITVBV = $E462 139 = E45F SYSVBV = $E45F 140 = 0012 RTCLOK = $0012 141 142 = 02E5 MEMTOP = $02E5 ;- - adres górnej granicy wolnej pamięci RAM 143 = 02E7 MEMLO = $02E7 ;- - adres dolnej granicy wolnej pamięci RAM 144 145 = 0278 JSTICK0 = $0278 ;- - położenie joysticka 0 146 = 0279 JSTICK1 = $0279 ;- JSTICK1 - położenie joysticka 1 147 = 027A JSTICK2 = $027A ;- JSTICK2 - położenie joysticka 0 148 = 027B JSTICK3 = $027B ;- JSTICK3 - położenie joysticka 1 149 = 027C PTRIG0 = $027C ;- PTRIG0 - przycisk potencjometru 0 150 = 027D PTRIG1 = $027D ;- PTRIG1 - przycisk potencjometru 1 151 = 0284 TRIG0S = $0284 ;- TRIG0S - przycisk joysticka 0, rejestr-cień TRIG0 152 = 0285 TRIG1S = $0285 ;- TRIG1S - przycisk joysticka 1, rejestr-cień TRIG1 153 = 0286 TRIG2S = $0286 ;- TRIG2S - rejestr-cień TRIG0 154 = 0287 TRIG3S = $0287 ;- TRIG3S - rejestr-cień TRIG1 155 156 157 /* 158 Rejestry OS w pamięci RAM 159 160 $08 - WARMST - znacznik gorącego startu 161 $0E - APPMHI - najwyższy adres RAM zajęty przez program 162 $10 - IRQENS - rejestr-cień IRQEN 163 $11 - IRQSTAT - rejestr-cień IRQST 164 $12 - RTCLOK - zegar czasu rzeczywistego 165 $15 - BUFADR - adres bufora dla operacji dyskowych 166 $17 - ICCOMT - rejestr przejściowy kodu operacji I/O 167 $20 - ZIOCB - zerostronicowy blok kontroli I/O 168 $20 - ICHIDZ - indeks wpisu urządzenia w HATABS 169 $21 - ICDNOZ - numer urządzenia 170 $22 - ICCOMZ - kod operacji wejścia/wyjścia 171 $23 - ICSTZ - status operacji wejścia/wyjścia 172 $24 - ICBAZ - adres bufora danych dla operacji I/O 173 $26 - ICPTZ - adres procedury obsługi dla operacji 174 $28 - ICBLZ - długość bufora danych dla operacji I/O 175 $2A - ICAX1Z - rejestr pomocniczy ZIOCB 176 $2B - ICAX2Z - rejestr pomocniczy ZIOCB 177 $2C - ICAX3Z - rejestr pomocniczy ZIOCB 178 $2D - ICAX4Z - rejestr pomocniczy ZIOCB 179 $2E - ICAX5Z - rejestr pomocniczy ZIOCB 180 $2F - ICAX6Z - rejestr pomocniczy ZIOCB 181 $30 - STATUS - status aktualnej operacji SIO 182 $31 - CHKSUM - suma kontrolna dla operacji SIO 183 $32 - BUFR - adres bufora danych dla SIO 184 $34 - BUFEN - adres końca bufora danych dla SIO 185 $36 - LTEMP - pomocniczy wektor odczytu listy liniowej 186 $38 - BUFRFL - znacznik zapełnienia bufora SIO 187 $39 - RECVND - znacznik końca odczytu 188 $3A - XMTDON - znacznik końca transmisji 189 $3B - CHKSNT - znacznik nadania sumy kontrolnej 190 $3C - NOCKSM - znacznik braku sumy kontrolnej 191 $3D - BPTR - licznik bufora magnetofonu 192 $3E - GAPTYP - znacznik długości przerwy między blokami 193 $3F - FEOF - znacznik końca zbioru 194 $40 - FREQ - licznik dźwięku przy otwarciu magnetofonu 195 $41 - IOSNDEN - znacznik dźwięku przy transmisji 196 $42 - CRITIC - znacznik krytycznych czasowo operacji I/O 197 $4A - ZCHAIN - rejestr następstwa listy liniowej 198 $4C - DSTAT - status klawiatury i ekranu 199 $50 - TEMP - pomocniczy rejestr przejściowy 200 $51 - HOLD1 - pomocniczy rejestr przejściowy 201 $52 - LMARGIN - lewy margines obrazu 202 $53 - RMARGIN - prawy margines obrazu 203 $54 - ROWCRS - pionowa pozycja kursora 204 $55 - COLCRS - pozioma pozycja kursora 205 $57 - DINDEX - numer trybu graficznego OS 206 $58 - SAVMSC - adres pamięci obrazu 207 $5A - OLDROW - poprzednia pionowa pozycja kursora 208 $5B - OLDCOL - poprzednia pozioma pozycja kursora 209 $5D - OLDCHR - poprzedni znak na ekranie 210 $5E - OLDADR - poprzedni adres znaku na ekranie 211 $60 - FKDEFP - wektor tabeli definicji klawiszy F1-F4 212 $62 - PALNTS - wskaźnik systemu TV 213 $63 - LOGCOL - adres kursora w wierszu logicznym 214 $64 - ADRESS - rejestr adresowy dla procedur edytora 215 $66 - MLTTMP - pomocniczy rejestr przejściowy 216 $68 - SAVADR - pomocniczy rejestr adresowy 217 $6A - RAMTOP - liczba stron pamięci RAM 218 $6B - BUFCNT - licznik bufora edytora 219 $6C - BUFSTR - adres bufora dla edytora 220 $6E - BITMSK - maska bitowa do wyświetlenia znaku 221 $6F - SHFAMT - liczba przesunięć punktu 222 $70 - ROWAC - aktualny wiersz przy rysowaniu 223 $72 - COLAC - aktualna kolumna przy rysowaniu 224 $74 - ENDPT - znacznik końca rysowanej linii 225 $76 - DELTAR - przyrost pionowej pozycji kursora 226 $77 - DELTAC - przyrost poziomej pozycji kursora 227 $79 - KEYDEFP - wektor tabeli definicji klawiszy 228 $7B - SWPFLG - znacznik kursora w trybach z oknem 229 $7C - HOLDCH - przechowywanie wartości znaku 230 $7D - INSDAT - rejestr pomocniczy edytora 231 $7E - COUNTR - licznik pamięci obrazu dla DOSCR i DRAW 232 $0100 - STACK - stos mikroprocesora 6502 233 $0200 - DLIV - wektor przerwania programu ANTIC-a 234 $0210 - VTIMR1 - wektor przerwania licznika 1 POKEY-a 235 $0212 - VTIMR2 - wektor przerwania licznika 2 POKEY-a 236 $0214 - VTIMR4 - wektor przerwania licznika 4 POKEY-a 237 $0218 - TIMCNT1 - pierwszy licznik systemu 238 $0226 - TIMVEC1 - wektor przerwania licznika TIMCNT1 239 $022A - TIMFLG3 - znacznik wyzerowania licznika TIMCNT3 240 $022F - DMACTLS - rejestr-cień DMACTL 241 $0230 - DLPTRS - rejestr-cień DLPTR 242 $0232 - SKCTLS - rejestr-cień SKCTL 243 $0233 - LCOUNT - licznik odczytu dla nowego urządzenia 244 $0234 - LPENHS - rejestr-cień LPENH 245 $0235 - LPENVS - rejestr-cień LPENV 246 $023A - CDEVIC - kod urządzenia dla SIO 247 $023B - CCMND - kod operacji dla SIO 248 $023C - CAUX1 - pierwszy bajt pomocniczy dla SIO 249 $023D - CAUX2 - drugi bajt pomocniczy dla SIO 250 $023E - TEMP - tymczasowy rejestr odpowiedzi urządzenia 251 $023F - ERRFLG - znacznik błędu operacji SIO 252 $0244 - COLDST - znacznik zimnego startu systemu 253 $0245 - RECLEN - długość rekordu z nowego urządzenia 254 $0246 - DSKTIM - wartość Timeout dla stacji dysków 255 $0247 - PDVMSK - maska obecności nowych urządzeń 256 $0248 - PDVRS - rejestr-cień PDVREG 257 $024A - RELADR - adres procedury przemieszczalnej 258 $024C - PPTMPA - rejestr przechowania zawartości akumulatora 259 $024D - PPTMPX - rejestr przechowania zawartości rejestru X 260 $026B - CHSPTR - wektor nieużywanego zestawu znaków 261 $026C - VSFLAG - znacznik przesuwu pionowego obrazu 262 $026E - FINE - znacznik delikatnego przesuwu obrazu 263 $026F - GTICTLS - rejestr-cień GTIACTL 264 $0270 - PADDL0 - rejestr-cień POT0 265 $0278 - JSTICK0 - położenie joysticka 0 266 $0279 - JSTICK1 - położenie joysticka 1 267 $027A - JSTICK2 - położenie joysticka 0 268 $027B - JSTICK3 - położenie joysticka 1 269 $027C - PTRIG0 - przycisk potencjometru 0 270 $027D - PTRIG1 - przycisk potencjometru 1 271 $0284 - TRIG0S - przycisk joysticka 0, rejestr-cień TRIG0 272 $0285 - TRIG1S - przycisk joysticka 1, rejestr-cień TRIG1 273 $0286 - TRIG2S - rejestr-cień TRIG0 274 $0287 - TRIG3S - rejestr-cień TRIG1 275 $0288 - HIBYTE - indeks operacji nowego urządzenia 276 $0289 - WMODE - znacznik sposobu dostępu do magnetofonu 277 $028A - BLIM - długość bufora magnetofonu 278 $028E - NEWADR - adres procedury nowego urządzenia 279 $0290 - TXTROW - wiersz kursora w oknie tekstowym 280 $0291 - TXTCOL - kolumna kursora w oknie tekstowym 281 $0293 - TINDEX - tryb graficzny OS w oknie tekstowym 282 $0294 - TXTMSC - adres pamięci okna tekstowego 283 $029C - CRETRY - liczba powtórzeń rozkazu operacji 284 $029D - HOLD3 - pomocniczy rejestr przejściowy 285 $029E - SUBTMP - pomocniczy rejestr przejściowy 286 $02A0 - DMASK - maska punktów obrazu 287 $02A2 - ESCFLG - znacznik klawisza ESC 288 $02A3 - TABMAP - mapa pozycji tabulacji 289 $02B2 - LOGMAP - mapa linii logicznych 290 $02B6 - INVFLG - znacznik klawisza inverse video 291 $02B7 - FILFLG - znacznik wypełniania obrazu 292 $02B8 - TMPROW - tymczasowy rejestr pozycji kursora 293 $02B9 - TMPCOL - tymczasowy rejestr pozycji kursora 294 $02BB - SCRFLG - znacznik przesuwu obrazu 295 $02BC - HOLD4 - pomocniczy rejestr przejściowy 296 $02BD - DRETRY - liczba powtórzeń wywołań urządzenia 297 $02BE - SHFLOK - znacznik klawiszy SHIFT i CONTROL 298 $02BF - BOTSCR - liczba wierszy tekstu 299 $02C0 - COLPM0S - rejestr-cień COLPM0 300 $02C1 - COLPM1S - rejestr-cień COLPM1 301 $02C2 - COLPM2S - rejestr-cień COLPM2 302 $02C3 - COLPM3S - rejestr-cień COLPM3 303 $02C4 - COLPF0S - rejestr-cień COLPF0 304 $02C5 - COLPF1S - rejestr-cień COLPF1 ;gr.8 letters 305 $02C6 - COLPF2S - rejestr-cień COLPF2 ;gr.8 background 306 $02C7 - COLPF3S - rejestr-cień COLPF3 307 $02C8 - COLBAKS - rejestr-cień COLBAK 308 $02C9 - RUNADR - adres procedury nowego urządzenia 309 $02CB - HIUSED - adres końcowy procedury nowego urządzenia 310 $02CF - GBYTEA - adres procedury nowego urządzenia 311 $02D1 - LOADAD - adres wczytywania z nowego urządzenia 312 $02D3 - ZLOADA - pomocniczy rejestr adresu wczytywania 313 $02D5 - DSCTLN - długość sektora dyskowego 314 $02DB - NOCLIK - znacznik dźwięku klawiatury 315 $02DE - PBPNT - licznik bufora drukarki 316 $02DF - PBUFSZ - długość bufora drukarki 317 $02E5 - MEMTOP - adres górnej granicy wolnej pamięci RAM 318 $02E7 - MEMLO - adres dolnej granicy wolnej pamięci RAM 319 $02E9 - HNDLOD - znacznik relokowalnej procedury obsługi I/O 320 $02EA - DVSTAT - dodatkowy rejestr statusu urządzenia 321 $02EC - DVTMOT - dodatkowy rejestr Timeout urządzenia 322 $02ED - REVNUM - numer wersji nowego urządzenia 323 $02EE - CBAUD - prędkość transmisji z magnetofonu 324 $02F0 - CRSINH - znacznik widoczności kursora 325 $02F3 - CHACT - rejestr-cień CHRCTL 326 $02F4 - CHBAS - rejestr-cień CHBASE 327 $02F5 - NEWROW - nowa pozycja pionowa kursora 328 $02F6 - NEWCOL - nowa pozycja pozioma kursora 329 $02F8 - ROWINC - zmiana pionowej pozycji kursora 330 $02F9 - COLINC - zmiana poziomej pozycji kursora 331 $02FA - CHAR - kod wewnętrzny znaku 332 $02FB - ATACHR - kod ATASCII znaku 333 $02FC - KBCODES - rejestr-cień KBCODE 334 $02FD - FILDAT - numer koloru dla wypełniania 335 $02FE - DSPFLG - znacznik wyświetlania znaków kontrolnych 336 $02FF - SSFLAG - znacznik start/stop dla przesuwu obrazu 337 $0300 - DDEVIC - kod identyfikacyjny urządzenia 338 $0301 - DUNIT - numer identyfikacyjny urządzenia 339 $0302 - DCMND - bajt rozkazu dla urządzenia 340 $0303 - DSTATS - status urządzenia 341 $0304 - DBUFA - adres bufora danych 342 $0306 - DTIMLO - wartość Timeout dla urządzenia 343 $0308 - DBYT - długość bufora danych 344 $030A - DAUX1 - rejestr pomocniczy dla operacji I/O 345 $030B - DAUX2 - rejestr pomocniczy dla operacji I/O 346 $030C - INTIM1 - rejestr czasu przy odczycie z magnetofonu 347 $030F - CASFLG - znacznik operacji z magnetofonem 348 $0310 - INTIM2 - rejestr czasu przy odczycie z magnetofonu 349 $0312 - TEMP1 - pomocniczy rejestr przejściowy 350 $0313 - TEMP2 - pomocniczy rejestr przejściowy 351 $0314 - PTIMOT - wartość Timeout dla drukarki 352 $0315 - TEMP3 - pomocniczy rejestr przejściowy 353 $0316 - SAVIO - rejestr przejściowy dla operacji SIO 354 $0317 - TIMFLG - znacznik upłynięcia czasu Timeout 355 $0318 - STACKP - rejestr wskaźnika stosu dla SIO 356 $0319 - TSTAT - przejściowy rejestr statusu SIO 357 $031A - HATABS - tabela wektorów procedur obsługi 358 $0340 - IOCB0 - blok kontroli I/O numer 0 359 $0350 - IOCB1 - blok kontroli I/O numer 1 360 $0360 - IOCB2 - blok kontroli I/O numer 2 361 $0370 - IOCB3 - blok kontroli I/O numer 3 362 $0380 - IOCB4 - blok kontroli I/O numer 4 363 $0390 - IOCB5 - blok kontroli I/O numer 5 364 $03A0 - IOCB6 - blok kontroli I/O numer 6 365 $03B0 - IOCB7 - blok kontroli I/O numer 7 366 $0340 - ICCHID - indeks wpisu urządzenia w HATABS 367 $0341 - ICDNO - numer urządzenia 368 $0342 - ICCMD - kod rozkazu operacji I/O 369 $0343 - ICSTAT - status operacji I/O 370 $0344 - ICBUFA - adres bufora danych dla operacji I/O 371 $0346 - ICPUTB - adres procedury przesyłania danych 372 $0348 - ICBUFL - długość bufora danych dla operacji I/O 373 $034A - ICAX1 - rejestr pomocniczy dla operacji I/O 374 $034B - ICAX2 - rejestr pomocniczy dla operacji I/O 375 $034C - ICAX3 - rejestr pomocniczy dla operacji I/O 376 $034D - ICAX4 - rejestr pomocniczy dla operacji I/O 377 $034E - ICAX5 - rejestr pomocniczy dla operacji I/O 378 $034F - ICAX6 - rejestr pomocniczy dla operacji I/O 379 $03C0 - PRNBUF - bufor drukarki 380 $03E8 - SUPERF - znacznik stosowany przy odczycie klawiatury 381 $03E9 - CKEY - znacznik klawisza START przy zimnym starcie 382 $03EC - DERRF - znacznik błędu przy otwieraniu edytora 383 $03FB - CHLINK - rejestr elementów listy liniowej 384 $03FD - CSCB - bajty kontroli szybkości magnetofonu 385 $03FF - CRCB - bajt długości rekordu magnetofonowego 386 $0400 - CASBUF - bufor magnetofonu 387 $047F - CASBEN - koniec bufora magnetofonu 388 $D000 - HPOSP0 - pozioma pozycja gracza 0 (Z) 389 $D000 - KOLM0PF - kolizja pocisku 0 z polem gry (O) 390 $D001 - HPOSP1 - pozioma pozycja gracza 1 (Z) 391 $D001 - KOLM1PF - kolizja pocisku 1 z polem gry (O) 392 $D002 - HPOSP2 - pozioma pozycja gracza 2 (Z) 393 $D002 - KOLM2PF - kolizja pocisku 2 z polem gry (O) 394 $D003 - HPOSP3 - pozioma pozycja gracza 3 (Z) 395 $D003 - KOLM3PF - kolizja pocisku 3 z polem gry (O) 396 $D004 - HPOSM0 - pozioma pozycja pocisku 0 (Z) 397 $D004 - KOLP0PF - kolizja gracza 0 z polem gry (O) 398 $D005 - HPOSM1 - pozioma pozycja pocisku 1 (Z) 399 $D005 - KOLP1PF - kolizja gracza 1 z polem gry (O) 400 $D006 - HPOSM2 - pozioma pozycja pocisku 2 (Z) 401 $D006 - KOLP2PF - kolizja gracza 2 z polem gry (O) 402 $D007 - HPOSM3 - pozioma pozycja pocisku 3 (Z) 403 $D007 - KOLP3PF - kolizja gracza 3 z polem gry (O) 404 $D008 - SIZEP0 - poziomy rozmiar gracza 0 (Z) 405 $D008 - KOLM0P - kolizja pocisku 0 z graczem (O) 406 $D009 - SIZEP1 - poziomy rozmiar gracza 1 (Z) 407 $D009 - KOLM1P - kolizja pocisku 1 z graczem (O) 408 $D00A - SIZEP2 - poziomy rozmiar gracza 2 (Z) 409 $D00A - KOLM2P - kolizja pocisku 2 z graczem (O) 410 $D00B - SIZEP3 - poziomy rozmiar gracza 3 (Z) 411 $D00B - KOLM3P - kolizja pocisku 3 z graczem (O) 412 $D00C - SIZEM - poziomy rozmiar pocisków (Z) 413 $D00C - KOLP0P - kolizja gracza 0 z innym graczem (O) 414 $D00D - GRAFP0 - rejestr grafiki gracza 0 (Z) 415 $D00D - KOLP1P - kolizja gracza 1 z innym graczem (O) 416 $D00E - GRAFP1 - rejestr grafiki gracza 1 (Z) 417 $D00E - KOLP2P - kolizja gracza 2 z innym graczem (O) 418 $D00F - GRAFP2 - rejestr grafiki gracza 2 (Z) 419 $D00F - KOLP3P - kolizja gracza 3 z innym graczem (O) 420 $D010 - GRAFP3 - rejestr grafiki gracza 3 (Z) 421 $D010 - TRIG0 - stan przycisku joysticka 0 (O) 422 $D011 - GRAFM - rejestr grafiki pocisków (Z) 423 $D011 - TRIG1 - stan przycisku joysticka 1 (O) 424 $D012 - COLPM0 - rejestr koloru gracza i pocisku 0 (Z) 425 $D013 - COLPM1 - rejestr koloru gracza i pocisku 1 (Z) 426 $D013 - TRIG3 - znacznik dołączenia cartridge'a (O) 427 $D014 - COLPM2 - rejestr koloru gracza i pocisku 2 (Z) 428 $D014 - PAL - znacznik systemu TV (O) 429 $D015 - COLPM3 - rejestr koloru gracza i pocisku 3 (Z) 430 $D016 - COLPF0 - rejestr koloru pola gry 0 (Z) 431 $D017 - COLPF1 - rejestr koloru pola gry 1 (Z) 432 $D018 - COLPF2 - rejestr koloru pola gry 2 (Z) 433 $D019 - COLPF3 - rejestr koloru pola gry 3 (Z) 434 $D01A - COLBAK - rejestr koloru tła (Z) 435 $D01B - GTIACTL - rejestr kontroli układu GTIA 436 $D01C - VDELAY - licznik opóźnienia pionowego P/MG 437 $D01D - PMCNTL - rejestr kontroli graczy i pocisków 438 $D01E - HITCLR - rejestr kasowania rejestrów kolizji 439 $D01F - CONSOL - rejestr stanu klawiszy konsoli 440 $D1FF - PDVREG - rejestr wyboru nowego urządzenia 441 $D200 - AUDF1 - częstotliwość pracy generatora 1 (Z) 442 $D200 - POT0 - rejestr położenia potencjometru 0 (O) 443 $D201 - AUDC1 - rejestr kontroli dźwięku generatora 1 (Z) 444 $D201 - POT1 - rejestr położenia potencjometru 1 (O) 445 $D202 - AUDF2 - częstotliwość pracy generatora 2 (Z) 446 $D202 - POT2 - rejestr położenia potencjometru 2 (O) 447 $D203 - AUDC2 - rejestr kontroli dźwięku generatora 2 (Z) 448 $D203 - POT3 - rejestr położenia potencjometru 3 (O) 449 $D204 - AUDF3 - częstotliwość pracy generatora 3 (Z) 450 $D205 - AUDC3 - rejestr kontroli dźwięku generatora 3 (Z) 451 $D206 - AUDF4 - częstotliwość pracy generatora 4 (Z) 452 $D207 - AUDC4 - rejestr kontroli dźwięku generatora 4 (Z) 453 $D208 - AUDCTL - rejestr kontroli generatorów dźwięku (Z) 454 $D208 - POTST - status odczytu potencjometrów (O) 455 $D209 - STIMER - rejestr zerowania liczników (Z) 456 $D209 - KBCODE - kod ostatnio naciśniętego klawisza (O) 457 $D20A - SKSTRES - reset statusu złącza szeregowego (Z) 458 $D20A - RANDOM - rejestr liczby losowej (O) 459 $D20B - POTG0 - znacznik przetwornika analogowo-cyfrowego (Z) 460 $D20D - SEROUT - szeregowy rejestr wyjściowy (Z) 461 $D20D - SERIN - szeregowy rejestr wejściowy (O) 462 $D20E - IRQEN - zezwolenia przerwań IRQ (Z) 463 $D20E - IRQST - status przerwań IRQ (O) 464 $D20F - SKCTL - rejestr kontroli złącza szeregowego (Z) 465 $D20F - SKSTAT - rejestr statusu złącza szeregowego (O) 466 $D300 - PORTA - port A układu PIA 467 $D301 - PORTB - port B układu PIA 468 $D302 - PACTL - rejestr kontroli portu A 469 $D303 - PBCTL - rejestr kontroli portu B 470 $D400 - DMACTL - rejestr kontroli dostępu do pamięci 471 $D401 - CHRCTL - rejestr kontroli wyświetlania znaków 472 $D402 - DLPTR - adres programu ANTIC-a 473 $D404 - HSCROL - znacznik poziomego przesuwu obrazu 474 $D405 - VSCROL - znacznik pionowego przesuwu obrazu 475 $D407 - PMBASE - adres pamięci graczy i pocisków 476 $D409 - CHBASE - adres zestawu znaków 477 $D40A - WSYNC - znacznik oczekiwania na synchronizację poziomą 478 $D40B - VCOUNT - licznik linii obrazu 479 $D40C - LPENH - poziome położenie pióra świetlengo 480 $D40D - LPENV - pionowe położenie pióra świetlnego 481 $D40E - NMIEN - rejestr zezwoleń na przerwania NMI 482 $D40F - NMIST - rejestr statusu przerwań NMI 483 */ 483 483 = 0080 XDRAW 483 = 0082 YDRAW 483 = 0084 XBYTE 483 = 0086 YBYTE 483 = 0088 CHARCODE 483 = 0089 FONTIND 483 = 008B TANKNR 483 = 008C TANKSEQUENCEPOINTER 483 = 008D OLDPLOT 483 = 008F XC 483 = 0091 TEMP 483 = 0093 TEMP2 483 = 0095 TEMPXROLLER 483 = 0097 XTEMPDRAW 483 = 0099 YTEMPDRAW 483 = 009B XI 483 = 009D FX 483 = 009E YI 483 = 00A0 FY 483 = 00A1 XK 483 = 00A3 FS 483 = 00A4 YC 483 = 00A5 DX 483 = 00A7 TEMPOR2 483 = 00A8 DY 483 = 00AA TEMPOR3 483 = 00AC DD 483 = 00AE DI 483 = 00B0 DP 483 = 00B2 MODIFY 483 = 00B4 WEAPONPOINTER 80 icl '../lib/macro.hea' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea 1 ;------------------------------------- 2 .MACRO ROLW 3 ROL :1 4 ROL :1+1 5 .ENDM 6 ;------------------------------------- 7 .MACRO ASLW 8 ASL :1 9 ROL :1+1 10 .ENDM 11 ;------------------------------------- 12 .MACRO RORW 13 ROR :1+1 14 ROR :1 15 .ENDM 16 ;------------------------------------- 17 .MACRO LSRW 18 LSR :1+1 19 ROR :1 20 .ENDM 21 22 ;------------------------------------- 23 .MACRO VMAIN 24 ; VMAIN #WORD,interrupt.vector 25 ; interrupt.vector: 26 ; 0 - VIMIRQ 27 ; 1 - TIMCNT1 28 ; 2 - TIMCNT2 29 ; 3 - TIMCNT3 30 ; 4 - TIMCNT4 31 ; 5 - TIMCNT5 32 ; 6 - VVBLKI 33 ; 7 - VVBLKD 34 ; 8 - TIMVEC1 35 ; 9 - TIMVEC2 36 ; Initialises Vertical Blank Interrupts 37 ; (works only with system interrupts ON) 38 LDY # <:1 39 LDX # >:1 40 LDA #:2 41 JSR SETVBV 42 .ENDM 43 ;------------------------------------- 44 .MACRO VDLI 45 ; VDLI #WORD 46 ; Initialises Display List Interrupts 47 LDY # <:1 48 LDX # >:1 49 LDA #$C0 50 STY $0200 51 STX $0201 52 STA NMIEN 53 .ENDM 54 ;------------------------------------- 55 .MACRO halt 56 ?stop 57 /* 58 lda RANDOM 59 and #$05 60 sta COLBAK 61 */ 62 jmp ?stop 63 .ENDM 64 ;------------------------------------- 65 .MACRO KEY 66 ; KEY 67 ; waits for releasing and pressing "any key" 68 PHA 69 ?CK1 LDA SKSTAT 70 AND #$04 71 BEQ ?CK1 72 ?CK LDA SKSTAT 73 AND #$04 74 BNE ?CK 75 PLA 76 .ENDM 77 ;------------------------------------- 78 .MACRO WAIT 79 ; WAIT 80 ; waits one frame (1/50 s(PAL) or 1/60s(NTSC)) 81 LDA VCOUNT 82 STA WSYNC 83 STA WSYNC 84 STA WSYNC 85 ?WA CMP VCOUNT 86 BNE ?WA 87 .ENDM 88 ;------------------------------------- 89 .macro negw 90 ; negate the given word (0-a) 91 ;------------------------------------- 92 sec 93 lda #$00 94 sbc :1 95 sta :1 96 lda #$00 97 sbc :1+1 98 sta :1+1 99 .endm 100 ;------------------------------------- 101 .macro randomize 102 ;usage: randomize floor ceiling 103 ;returns (in A) a random .byte between "floor" and "ceiling" 104 ?rand 105 lda random 106 cmp #:1 ;floor 107 bcc ?rand 108 cmp #:2+1 ;ceiling 109 bcs ?rand 110 .endm 111 ;------------------------------------- 112 .macro phx 113 txa 114 pha 115 .endm 116 ;------------------------------------- 117 .macro phy 118 tya 119 pha 120 .endm 121 ;------------------------------------- 122 .macro plx 123 pla 124 tax 125 .endm 126 ;------------------------------------- 127 .macro ply 128 pla 129 tay 130 .endm 131 ;------------------------------------- 132 .macro pause 133 ;waits :1 number (byte) of frames 134 ldx #:1 135 ?PAUSELOOP 136 wait 137 dex 138 bne ?PAUSELOOP 139 .ENDM 140 81 82 ;Game loading address 83 ORG $3010 ;two hex thousands for screen 84 ;----------------------------------------------- 85 ;Screen displays go first to avoid crossing 4kb barrier 86 ;----------------------------------------------- 87 icl 'display.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\display.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 3 .IF *>0 ;this is a trick that prevents compiling this file alone 4 5 ;----------------------------------------------------- 6 ;-------------display-lists--------------------------- 7 ;----------------------------------------------------- 8 PurchaseDL 9 FFFF> 3010-9329> 70 70 + .byte $70,$70,$20 10 3013 42 .byte $42 11 3014 C9 3C .word textbuffer2 12 3016 02 10 42 .byte $02,$10,$42 13 3019 MoreUpdl 14 3019 51 3C .word EmptyLine 15 301B 00 42 .byte 0,$42 16 301D WeaponsListDL 17 301D E3 33 .word ListOfWeapons 18 301F 00 02 00 02 00 02 + .byte 0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0 19 303E 42 .byte $42 20 303F MoreDownDL 21 303F 51 3C .word EmptyLine 22 3041 10 42 .byte $10,$42 23 3043 03 3C .word WeaponsDescription 24 3045 02 .byte 2 25 3046 41 .byte $41 26 3047 10 30 .word PurchaseDL 27 ;------------------------ 28 3049 OptionsDL 29 3049 70 70 70 70 70 .byte $70,$70,$70,$70,$70 30 304E 42 .byte $42 31 304F 7B 31 .word OptionsScreen 32 3051 02 02 70 02 00 02 + .byte $02,$02,$70,$02,0,$02,0,$2,0,$2 33 305B 41 .byte $41 34 305C 49 30 .word OptionsDL 35 ;------------------------ 36 ;Enter names of tanks DL 37 305E NameDL 38 305E 70 70 70 70 70 .byte $70,$70,$70,$70,$70 39 3063 42 .byte $42 40 3064 93 32 .word NameScreen 41 3066 30 .byte $30 42 3067 02 30 02 .byte $02,$30,$2 43 306A 10 02 02 02 30 02 + .byte $10,2,2,2,$30,2,2 44 3071 41 .byte $41 45 3072 5E 30 .word NameDL 46 ; ------------------------------------------------- 47 48 3074 dl ; MAIN game display list 49 3074 70 00 .byte $70,$00 50 3076 42 .byte $42 51 3077 79 3C .word textbuffer 52 3079 82 .byte $02 +$80 ;DLI 53 307A 00 .byte $00 54 55 307B 4F .byte $4f 56 307C 53 31 .word WhiteLine 57 307E 4F .byte $4f 58 307F 50 2F .word PlotLine 59 3081 4F .byte $4f 60 3082 53 31 .word WhiteLine 61 62 3084 4F .byte $4f 63 3085 10 10 .word display 64 65 3087 0F 0F 0F 0F 0F 0F + :100 .by $0f 66 30EB 0F .by $0f 67 30EC 4F .by $4f 68 30ED 00 20 .wo display+$0ff0 69 30EF 0F 0F 0F 0F 0F 0F + :97 .byte $0f 70 3150 41 .byte $41 71 3151 74 30 .word dl 72 ; horizontal line 73 3153 WhiteLine 74 3153 FF FF FF FF FF FF + :screenBytes .by $ff 75 = 2F50 PlotLine = display + screenHeight*screenBytes ; the last line is plot pointer 76 ;----------------------------------------------- 77 ;Screen displays go first to avoid crossing 4kb barrier 78 ;----------------------------------------------- 79 317B OptionsScreen 80 317B 37 65 6C 63 6F 6D + dta d"Welcome to Scorch ver. 124 (cc)2000-2013" 81 31A3 00 30 6C 65 61 73 + dta d" Please select option with cursor keys " 82 31CB 00 00 00 00 00 61 + dta d" and press (Return) to proceed " 83 31F3 OptionsHere 84 ; 0123456789012345678901234567890123456789 85 31F3 30 6C 61 79 65 72 + dta d"Players : 2 3 4 5 6 " 86 321B 23 61 73 68 00 00 + dta d"Cash : none 2K 5K 8K 10K " 87 3243 27 72 61 76 69 74 + dta d"Gravity : 0.2G 0.5G 1G 2G 4G " 88 326B 37 69 6E 64 00 00 + dta d"Wind : 1B 3B 5B 7B 9B " 89 3293 OptionsScreenEnd 90 ; ------------------------------------------------- 91 3293 NameScreen 92 3293 00 00 00 00 25 6E + dta d" Enter names of players " 93 32B3 00 00 00 34 61 6E + dta d" Tank 01 Name:" 94 32C7 NameAdr 95 32C7 00 00 00 00 00 00 + dta d" " 96 32D3 00 28 75 6D 61 6E + dta d" Human/Atari (difficulty level) " 97 32F3 00 dta d" " 98 32F4 NamesOfLevels 99 32F4 00 28 35 2D 21 2E + dta d" HUMAN Moron Shooter " 100 3313 00 00 30 6F 6F 6C + dta d" Poolshark Toosser Chooser " 101 3333 00 00 33 70 6F 69 + dta d" Spoiler Cyborg Unknown " 102 3353 00 00 dta d" " 103 3355 B4 E1 E2 dta d"Tab"* 104 3358 00 0D 00 30 6C 61 + dta d" - Player/Difficulty level " 105 3373 00 00 00 00 00 00 + dta d" " 106 337A B2 E5 F4 F5 F2 EE dta d"Return"* 107 3380 00 0D 00 30 72 6F + dta d" - Proceed " 108 ;--------------------------------------------------- 109 3393 MoreUp 110 3393 00 00 00 00 00 00 + dta d" " 111 33A0 5C 5C 5C dta 92,92,92 112 33A3 00 00 6D 6F 72 65 + dta d" more " 113 33AB 5C 5C 5C dta 92,92,92 114 33AE 00 00 00 00 00 00 + dta d" " 115 33BB MoreDown 116 33BB 00 00 00 00 00 00 + dta d" " 117 33C8 5D 5D 5D dta 93,93,93 118 33CB 00 00 6D 6F 72 65 + dta d" more " 119 33D3 5D 5D 5D dta 93,93,93 120 33D6 00 00 00 00 00 00 + dta d" " 121 33E3 ListOfWeapons 122 33E3 00 00 00 00 00 00 + dta d" " 123 340B 00 00 00 00 00 00 + dta d" " 124 3433 00 00 00 00 00 00 + dta d" " 125 345B 00 00 00 00 00 00 + dta d" " 126 3483 00 00 00 00 00 00 + dta d" " 127 34AB 00 00 00 00 00 00 + dta d" " 128 34D3 00 00 00 00 00 00 + dta d" " 129 34FB 00 00 00 00 00 00 + dta d" " 130 3523 00 00 00 00 00 00 + dta d" " 131 354B 00 00 00 00 00 00 + dta d" " 132 3573 00 00 00 00 00 00 + dta d" " 133 359B 00 00 00 00 00 00 + dta d" " 134 35C3 00 00 00 00 00 00 + dta d" " 135 35EB 00 00 00 00 00 00 + dta d" " 136 3613 00 00 00 00 00 00 + dta d" " 137 363B 00 00 00 00 00 00 + dta d" " 138 3663 00 00 00 00 00 00 + dta d" " 139 368B 00 00 00 00 00 00 + dta d" " 140 36B3 00 00 00 00 00 00 + dta d" " 141 36DB 00 00 00 00 00 00 + dta d" " 142 3703 00 00 00 00 00 00 + dta d" " 143 372B 00 00 00 00 00 00 + dta d" " 144 3753 00 00 00 00 00 00 + dta d" " 145 377B 00 00 00 00 00 00 + dta d" " 146 37A3 00 00 00 00 00 00 + dta d" " 147 37CB 00 00 00 00 00 00 + dta d" " 148 37F3 00 00 00 00 00 00 + dta d" " 149 381B 00 00 00 00 00 00 + dta d" " 150 3843 00 00 00 00 00 00 + dta d" " 151 386B 00 00 00 00 00 00 + dta d" " 152 3893 00 00 00 00 00 00 + dta d" " 153 38BB 00 00 00 00 00 00 + dta d" " 154 38E3 00 00 00 00 00 00 + dta d" " 155 390B 00 00 00 00 00 00 + dta d" " 156 3933 00 00 00 00 00 00 + dta d" " 157 395B 00 00 00 00 00 00 + dta d" " 158 3983 ListOfWeapons1End 159 3983 ListOfDefensiveWeapons 160 3983 00 00 00 00 00 00 + dta d" " 161 39AB 00 00 00 00 00 00 + dta d" " 162 39D3 00 00 00 00 00 00 + dta d" " 163 39FB 00 00 00 00 00 00 + dta d" " 164 3A23 00 00 00 00 00 00 + dta d" " 165 3A4B 00 00 00 00 00 00 + dta d" " 166 3A73 00 00 00 00 00 00 + dta d" " 167 3A9B 00 00 00 00 00 00 + dta d" " 168 3AC3 00 00 00 00 00 00 + dta d" " 169 3AEB 00 00 00 00 00 00 + dta d" " 170 3B13 00 00 00 00 00 00 + dta d" " 171 3B3B 00 00 00 00 00 00 + dta d" " 172 3B63 00 00 00 00 00 00 + dta d" " 173 3B8B 00 00 00 00 00 00 + dta d" " 174 3BB3 00 00 00 00 00 00 + dta d" " 175 3BDB 00 00 00 00 00 00 + dta d" " 176 3C03 ListOfDefensiveWeaponsEnd ;constant useful when clearing 177 3C03 WeaponsDescription 178 3C03 00 00 dta d" " 179 3C05 B4 E1 E2 dta d"Tab"* 180 3C08 00 0D 00 24 65 66 + dta d" - Defensive/Offensive weapon " 181 3C29 00 00 00 dta d" " 182 3C2C B3 F0 E1 E3 E5 dta d"Space"* 183 3C31 00 0D 00 30 75 72 + dta d" - Purchase " 184 3C3E B2 E5 F4 F5 F2 EE dta d"Return"* 185 3C44 00 0D 00 26 69 6E + dta d" - Finish " 186 3C51 EmptyLine 187 3C51 00 00 00 00 00 00 + dta d" " 188 ;----------------------------------------------- 189 3C79 textbuffer 190 3C79 30 6C 61 79 65 72 + dta d"Player: " 191 3CA1 00 00 00 00 00 00 + dta d" " 192 3CC9 textbuffer2 193 3CC9 30 6C 61 79 65 72 + dta d"Player: ******** Cash: 00000 " 194 3CF1 0D 0D 0D 0D 0D 0D + dta d"----------------------------------------" 195 196 197 .endif 88 ;---------------------------------------------- 89 3D19 icl 'variables.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\variables.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 3 .IF *>0 ;this is a trick that prevents compiling this file alone 4 5 ;===================================================== 6 ; most important non-zero page variables 7 ; zero page variables are declared in program.s65 module 8 ;===================================================== 9 3D19 00 NumberOfPlayers .byte 0 ;current number of players (counted from 1) 10 3D1A 00 00 00 00 00 00 TankSequence :MaxPlayers .by 0 ;sequence of shooting during the Round 11 ;----------------------------------- 12 3D20 skilltable ; computer controlled players' skills (1-8), 0 - human 13 3D20 00 00 00 00 00 00 :MaxPlayers .by 0 14 ;----------------------------------- 15 3D26 moneyH ;we place zero at the end of prices and money 16 ;and have range from 0 to 99990 (not too much) 17 ;money players have (maybe one more byte is needed?) 18 3D26 00 00 00 00 00 00 :MaxPlayers .by 0 19 3D2C moneyL 20 3D2C 00 00 00 00 00 00 :MaxPlayers .by 0 21 ;----------------------------------- 22 3D32 gainH ;how much money player gets after the round 23 ;it is gathered during the round basing on energy 24 ;opponents loose after player's shoots 25 3D32 00 00 00 00 00 00 :MaxPlayers .by 0 26 3D38 gainL 27 3D38 00 00 00 00 00 00 :MaxPlayers .by 0 28 ;----------------------------------- 29 3D3E looseH ;how much player looses after the round 30 ;calculated from REAL energy loss 31 ;(not only to zero energy) 32 3D3E 00 00 00 00 00 00 :MaxPlayers .by 0 33 3D44 looseL 34 3D44 00 00 00 00 00 00 :MaxPlayers .by 0 35 ;----------------------------------- 36 3D4A Energy 37 3D4A 00 00 00 00 00 00 :MaxPlayers .by 0 38 3D50 00 EnergyDecrease .by 0 39 3D51 eXistenZ 40 3D51 00 00 00 00 00 00 :MaxPlayers .by 0 41 3D57 LASTeXistenZ ; eXistenZ before shoot 42 3D57 00 00 00 00 00 00 :MaxPlayers .by 0 43 44 3D5D ResultsTable ;the results in the gameeeeee 45 3D5D 00 00 00 00 00 00 :MaxPlayers .by 0 46 3D63 TempResults 47 3D63 00 00 00 00 00 00 :MaxPlayers .by 0 48 3D69 CurrentResult 49 3D69 00 .byte 0 50 ;----------------------------------- 51 3D6A EnergyTableL ;shooting Force of the tank during the round 52 3D6A 00 00 00 00 00 00 :MaxPlayers .by 0 53 3D70 EnergyTableH 54 3D70 00 00 00 00 00 00 :MaxPlayers .by 0 ;maxplayers=6 55 3D76 MaxEnergyTableL ;Energy of the tank during the round 56 ;(limes superior force of the Shoot) 57 3D76 00 00 00 00 00 00 :MaxPlayers .by 0 ;1000 is the default 58 3D7C MaxEnergyTableH 59 3D7C 00 00 00 00 00 00 :MaxPlayers .by 0 60 ;----------------------------------- 61 62 3D82 AngleTable ;Angle of the barrel of each tank during the round 63 3D82 A5 A5 A5 A5 A5 A5 .by (255-90),(255-90),(255-90),(255-90),(255-90),(255-90) 64 3D88 NewAngle 65 3D88 00 .by 0 66 ;----------------------------------- 67 68 3D89 ActiveWeapon ;number of the selected weapon 69 3D89 00 00 00 00 00 00 :MaxPlayers .by 0 70 ;----------------------------------- 71 72 ;format of the static point number used in the game 73 ; 20203.5 = 128 : <20203 : >20203 74 ;----------------------------------- 75 76 3D8F 00 L1 .by 0 ; variable used in multiplications (by 10:) 77 3D90 19 gravity .by 25 ;only the decimal part (1/10 = 25) 78 ;----------------------------------- 79 80 3D91 80 00 Wind .wo $0080 ;walue displayed on the screen 81 ;multiplied by 16 (decimal part only) 82 ;----------------------------------- 83 3D93 40 MaxWind .byte $40 ; 84 3D94 00 WindOrientation .byte 0 ;(0-right,1-left) 85 ;----------------------------------- 86 3D95 00 Counter .byte 0 ;temporary Counter for outside loops 87 3D96 00 HitFlag .byte 0 ;1 when missile hit anything 88 ;----------------------------------- 89 3D97 xtankstableL ;X positions of tanks (lower left point) 90 3D97 00 00 00 00 00 00 :MaxPlayers .by 0 91 3D9D xtankstableH 92 3D9D 00 00 00 00 00 00 :MaxPlayers .by 0 93 3DA3 ytankstable ;Y positions of tanks (lower left point) 94 3DA3 00 00 00 00 00 00 :MaxPlayers .by 0 95 3DA9 LowResDistances ; coarse stank positions divided by 4 (to be in just one byte) 96 3DA9 00 00 00 00 00 00 :MaxPlayers .by 0 97 ;----------------------------------- 98 3DAF keycodes ;tables for calculating KeyCode to Screen Code (38 characters) 99 3DAF 3F 15 12 3A 2A 38 + .byte $3f,$15,$12,$3a,$2a,$38,$3d,$39 100 3DB7 0D 01 05 00 25 23 + .byte $0d,$01,$05,$00,$25,$23,$08,$0a 101 3DBF 2F 28 3E 2D 0B 10 + .byte $2f,$28,$3e,$2d,$0b,$10,$2e,$16 102 3DC7 2B 17 1F 1E 1A 18 + .byte $2b,$17,$1f,$1e,$1a,$18,$1d,$1b 103 3DCF 33 35 30 32 22 0E .byte $33,$35,$30,$32,$22,$0e 104 3DD5 scrcodes 105 3DD5 61 62 63 64 65 66 + dta d"abcdefgh" 106 3DDD 69 6A 6B 6C 6D 6E + dta d"ijklmnop" 107 3DE5 71 72 73 74 75 76 + dta d"qrstuvwx" 108 3DED 79 7A 11 12 13 14 + dta d"yz123456" 109 3DF5 17 18 19 10 0E 0D dta d"7890.-" 110 ;----------------------------------- 111 3DFB 00 Erase .byte 0 ; if 1 only mask of the character is printed 112 ; on the graphics screen. if 0 character is printed normally 113 114 ;----------------------------------- 115 3DFC 00 00 RangeLeft .wo 0 ;range of the soil to be fallen down 116 ;it is being set by all Explosions 117 3DFE 00 00 RangeRight .wo 0 118 ;----------------------------------- 119 3E00 00 00 WeaponRangeLeft .wo 0 ;Range of the Explosion of the given weapon 120 3E02 00 00 WeaponRangeRight .wo 0 121 ;-------------------------------------------------- 122 ;-------------------------------------------------- 123 ;Variables used by the given subroutines 124 ;moved to one place for easier 125 ;compilation to e.g. cartridge 126 ;-------------------------------------------------- 127 ;xroller 128 3E04 FF HowMuchToFall .byte $FF 129 3E05 00 HeightRol .byte 0 130 ;digger 131 3E06 00 00 digstartx .word 0 132 3E08 00 00 digstarty .word 0 133 3E0A 00 diggery .byte 0 134 3E0B 00 DigLong .byte 0 135 3E0C 00 00 00 00 00 00 + digtabxL :8 .by 0 136 3E14 00 00 00 00 00 00 + digtabxH :8 .by 0 137 3E1C 00 00 00 00 00 00 + digtabyL :8 .by 0 138 3E24 00 00 00 00 00 00 + digtabyH :8 .by 0 139 ;sandhog 140 3E2C 00 sandhogflag .byte 0 ; (0 digger, 8 sandhog) 141 ;ofdirt 142 3E2D 00 00 magic .word 0 ; was tempor2, but it was not compiling!!! (bug in OMC65) 143 ;draw 144 3E2F 00 00 DrawJumpAddr .word 0 145 3E31 00 HowToDraw .byte 0 146 ; bits here mean 147 ; 0 - negative X (go up) 148 ; 1 - negative Y (left) 149 ; 2 - directional value > 1 (more than 45 degrees) 150 ; if all 0 then standart routine 151 3E32 00 00 XHit .word 0 152 3E34 00 00 YHit .word 0 153 3E36 00 00 LineLength .word 0 154 ;circle 155 3E38 00 radius .byte 0 156 3E39 00 00 xcircle .word 0 157 3E3B 00 ycircle .byte 0 158 3E3C 00 00 tempcir .word 0 159 ;TankFalls 160 3E3E 00 IfFallDown .byte 0 161 3E3F 00 PreviousFall .byte 0 162 3E40 00 EndOfTheFallFlag .byte 0 ; in case of the infinite fall 163 3E41 00 Parachute .byte 0 ; are you insured with parachute? 164 ; ------------------------------------------------- 165 ;Flight 166 ;variables for 5 missiles (used for mirv) 167 3E42 00 00 00 00 00 xtraj00 :5 .by 0 168 3E47 00 00 00 00 00 xtraj01 :5 .by 0 169 3E4C 00 00 00 00 00 xtraj02 :5 .by 0 170 3E51 00 00 00 00 00 vx00 :5 .by 0 171 3E56 00 00 00 00 00 vx01 :5 .by 0 172 3E5B 00 00 00 00 00 vx02 :5 .by 0 173 3E60 00 00 00 00 00 vx03 :5 .by 0 174 3E65 00 00 00 00 00 MirvDown :5 .by 0 ; is given missile down? 175 3E6A 00 MirvMissileCounter .byte 0 ; missile Counter (mainly for X) 176 3E6B 00 SmokeTracerFlag .byte 0 ; if Smoketracer 177 ; ------------------------------------------------- 178 ;CheckCollisionWithTank 179 3E6C 00 00 00 00 vx .byte 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA) 180 3E70 00 00 00 00 vy .byte 0,0,0,0 181 3E74 00 00 00 xtraj .byte 0,0,0 182 3E77 00 00 00 ytraj .byte 0,0,0 183 3E7A 00 00 00 xtrajold .byte 0,0,0 184 3E7D 00 00 00 ytrajold .byte 0,0,0 185 3E80 00 Angle .byte 0 186 3E81 00 00 00 Force .byte 0,0,0 187 3E84 00 00 00 Multiplier .byte 0,0,0 188 3E87 00 00 Multiplee .byte 0,0 189 3E89 00 00 00 Result .byte 0,0,0 190 3E8C 00 goleft .byte 0 ;if 1 then flights left 191 ;-------------------------------------------------- 192 ;SoilDown2 193 3E8D 00 IsEndOfTheFallFlag .byte 0 194 ; ------------------------------------------------- 195 ;unPlot 196 3E8E 00 WhichUnPlot .byte 0 197 ; max 5 concurrent unPlots 198 3E8F 00 00 00 00 00 oldplotH :5 .by 0 199 3E94 00 00 00 00 00 oldplotL :5 .by 0 200 3E99 00 00 00 00 00 oldora :5 .by 0 201 3E9E 00 00 00 00 00 oldply :5 .by 0 202 3EA3 00 OldOraTemp .byte 0 203 3EA4 00 FunkyBombCounter .byte 0 204 3EA5 00 00 xtrajfb .word 0 205 3EA7 00 00 ytrajfb .word 0 206 ; 207 3EA9 00 tracerflag .byte 0 208 ; ------------------------------------------------- 209 ;TypeChar 210 3EAA 00 00 00 00 00 00 + mask1 :8 .by 0 211 3EB2 00 00 00 00 00 00 + mask2 :8 .by 0 212 213 3EBA 00 00 00 00 00 00 + char1 :8 .by 0 214 3EC2 00 00 00 00 00 00 + char2 :8 .by 0 215 3ECA 01 color .byte 1 216 3ECB 00 ybit .byte 0 217 3ECC 00 tempbyte01 .byte 0 218 3ECD 00 00 delta .word 0 219 3ECF 00 00 yfloat .word 0 220 3ED1 00 deltaX .byte 0 221 3ED2 00 UpNdown .byte 0 222 223 224 3ED3 00 00 temptankX .word 0 225 3ED5 00 temptankNr .byte 0 226 227 ; ------------------------------------------------- 228 ;Variables from textproc.s65 229 ; tables with numbers of weapons on the right lists 230 ; to be honest - I do not know at the moment what the above 231 ; comment was supposed to mean... 232 3ED6 NubersOfWeaponsL1 233 3ED6 FF FF FF FF FF FF + :(8*5) .by $ff 234 3EFE NubersOfWeaponsL2 235 3EFE FF FF FF FF FF FF + :(8*2) .by $ff 236 ; ------------------------------------------------- 237 238 ; variables storing amount of weapons on the first and second 239 ; list and pointer position 240 241 3F0E HowManyOnTheList1 242 3F0E 00 .byte 0 243 3F0F HowManyOnTheList2 244 3F0F 00 .byte 0 245 3F10 PositionOnTheList ; pointer position on the list being displayed 246 3F10 00 .byte 0 247 3F11 LastWeapon ; number of the last previously purchased weapon 248 ; it is necessary when after purchase some weapon 249 ; is removed from the list (because too expensive) 250 ; and the cursor must be placed elsewhere 251 252 3F11 FF .byte $ff 253 3F12 WhichList ; list currently on the screen 254 ; (0-offensive, 1-defensive) 255 3F12 00 .byte 0 256 3F13 OffsetDL1 ; offset of the list screen (how many lines).... 257 3F13 00 .byte 0 258 259 ; ------------------------------------------------- 260 ;Options 261 3F14 00 00 02 02 OptionsTable .byte 0,0,2,2 262 3F18 00 OptionsY .byte 0 ;vertical position of cursor on Options screen 263 = 0004 maxoptions = 4 ;number of all options (4 in 0.01) 264 3F19 CashOptionH ;(one zero less than on the screen) 265 3F19 00 00 01 03 03 .byte 0,>200,>500,>800,>1000 266 3F1E CashOptionL 267 3F1E 00 C8 F4 20 E8 .byte 0,<200,<500,<800,<1000 268 3F23 0A 14 19 1E 28 GravityTable .byte 10,20,25,30,40 269 3F28 05 14 28 3C 50 MaxWindTable .byte 5,20,40,60,80 270 ;------------------------------------------------ 271 272 ;mark the level 273 3F2D PositionInName ; cursor position in name of the player when name input 274 3F2D 00 .byte 0 275 3F2E DifficultyLevel ; Difficulty Level (human/cpu) 276 3F2E 00 .byte 0 277 3F2F LevelNameBeginL ; begins of level names 278 3F2F F4 FE 08 .byte NamesOfLevels,>(NamesOfLevels+10),>(NamesOfLevels+20) 283 3F3B 33 33 33 .byte >(NamesOfLevels+32),>(NamesOfLevels+42),>(NamesOfLevels+52) 284 3F3E 33 33 33 .byte >(NamesOfLevels+64),>(NamesOfLevels+74),>(NamesOfLevels+84) 285 ;------------------------------------------------- 286 ;displaydecimal 287 3F41 00 00 decimal .word 0 288 3F43 00 00 displayposition .word 0 289 3F45 10 10 10 10 decimalresult dta d"0000" 290 291 ;xmissile 292 3F49 00 00 ExplosionRadius .word 0 ;because when adding in xdraw it is double byte 293 ;round 294 3F4B 00 CurrentRoundNr .byte 0 295 3F4C 00 FallDown1 .byte 0 296 3F4D 00 FallDown2 .byte 0 297 ;leapfrog 298 3F4E 00 LeapFrogAngle .byte 0 299 ;laser 300 3F4F 00 00 00 00 00 00 + LaserCoordinate .word 0,0,0,0 301 3F57 TanksNames 302 3F57 11 73 74 00 34 61 + dta d"1st Tank" 303 3F5F 12 6E 64 00 34 61 + dta d"2nd Tank" 304 3F67 13 72 64 00 34 61 + dta d"3rd Tank" 305 3F6F 14 74 68 00 34 61 + dta d"4th Tank" 306 3F77 15 74 68 00 34 61 + dta d"5th Tank" 307 3F7F 16 74 68 00 34 61 + dta d"6th Tank" 308 ; ------------------------------------------------- 309 ; Here go tables with weapons possesed by a given tank 310 ; Index in the table means weapon type 311 ; number entered means ammo for given weapon possessed (max 99) 312 ; Let 0 be "baby missile" 313 ; from $30 the defensive weapons begin 314 3F87 TanksWeapons 315 3F87 TanksWeapon1 316 3F87 63 .by 99 317 3F88 00 00 00 00 00 00 + :63 .by 0 318 3FC7 TanksWeapon2 319 3FC7 63 .by 99 320 3FC8 00 00 00 00 00 00 + :63 .by 0 321 4007 TanksWeapon3 322 4007 63 .by 99 323 4008 00 00 00 00 00 00 + :63 .by 0 324 4047 TanksWeapon4 325 4047 63 .by 99 326 4048 00 00 00 00 00 00 + :63 .by 0 327 4087 TanksWeapon5 328 4087 63 .by 99 329 4088 00 00 00 00 00 00 + :63 .by 0 330 40C7 TanksWeapon6 331 40C7 63 .by 99 332 40C8 00 00 00 00 00 00 + :63 .by 0 333 4107 TanksWeaponsTableL 334 4107 87 C7 07 47 87 C7 .by TanksWeapon1,>TanksWeapon2,>TanksWeapon3,>TanksWeapon4,>TanksWeapon5,>TanksWeapon6 337 338 4113 mountaintable ;table of mountains (size=screenwidth) 339 4113 00 00 00 00 00 00 + :screenwidth .by 0 340 4253 00 .by 0 ; additional byte for fallout (sometimes 1 pixel) 341 4254 mountaintable2 ;table of mountains (size=screenwidth) 342 4254 00 00 00 00 00 00 + :screenwidth .by 0 343 4394 00 .by 0 ; additional byte for fallout (sometimes 1 pixel) 344 4395 mountaintable3 345 4395 00 00 00 00 00 00 + :screenwidth .by 0 346 44D5 00 .by 0 ; additional byte for fallout (sometimes 1 pixel) 347 44D6 MountaintableEnd ;good for table clearing 348 ;---------------------------------------------- 349 44D6 00 00 TextPositionX .word 0 350 44D8 00 TextPositionY .byte 0 351 44D9 00 00 TextAddress .word 0 352 44DB 00 TextCounter .byte 0 353 44DC 00 TextNumberOff .byte 0 354 ;-------------- 355 44DD TankTempY 356 44DD 00 .byte 0 357 ;---------------------------------------------- 358 44DE LineAddress4x4 359 44DE 00 00 .word 0 360 44E0 LineCharNr 361 44E0 00 .byte 0 362 44E1 LineXdraw 363 44E1 00 00 .word 0 364 44E3 LineYdraw 365 44E3 00 .byte 0 366 44E4 LineTop 367 44E4 08 05 05 05 05 05 + dta d"(%%%%%%%%%%%)" 368 44F1 FF .byte $ff 369 ;# - pion, () * +, % - poziom 370 44F2 LineBottom 371 44F2 0A 05 05 05 05 05 + dta d"*%%%%%%%%%%%+" 372 44FF FF .byte $ff 373 4500 LineEmpty 374 4500 03 00 00 00 00 00 + dta d"# #" 375 450D FF .byte $ff 376 450E LineHeader1 377 450E 03 00 32 2F 35 2E + dta d"# ROUND: " 378 4517 RoundNrDisplay 379 4517 00 00 00 03 dta d" #" 380 451B FF .byte $ff 381 451C LineHeader2 382 451C 03 00 00 32 25 33 + dta d"# RESULTS #" 383 4529 FF .byte $ff 384 385 386 387 ;----------- 388 452A ResultLineBuffer 389 452A 00 00 00 00 00 00 + dta d" " 390 453C FF .byte $ff 391 453D ResultX 392 453D 00 00 .word 0 393 453F ResultY 394 453F 00 .byte 0 395 4540 ResultOfTankNr 396 4540 00 .byte 0 397 398 ;----------- 399 4541 pmtableL ; addressess of the P/M memory for 5 tanks (6th is without P/M background) 400 4541 00 .byte <(pmgraph+$400) 401 4542 00 .byte <(pmgraph+$500) 402 4543 00 .byte <(pmgraph+$600) 403 4544 00 .byte <(pmgraph+$700) 404 4545 00 .byte <(pmgraph+$300) ; this is a missile background 405 4546 pmtableH 406 4546 9C .byte >(pmgraph+$400) 407 4547 9D .byte >(pmgraph+$500) 408 4548 9E .byte >(pmgraph+$600) 409 4549 9F .byte >(pmgraph+$700) 410 454A 9B .byte >(pmgraph+$300) 411 ;----------- 412 ; this table changes Angle to the appropriate tank character 413 454B BarrelTableL 414 454B 02 02 02 02 02 02 + .byte $02,$02,$02,$02,$02,$02,$02,$02 415 4553 04 04 04 04 04 04 + .byte $04,$04,$04,$04,$04,$04,$04,$04 416 455B 06 06 06 06 06 06 + .byte $06,$06,$06,$06,$06,$06,$06,$06,$06 417 4564 08 08 08 08 08 08 + .byte $08,$08,$08,$08,$08,$08,$08,$08 418 456C 0A 0A 0A 0A 0A 0A + .byte $0a,$0a,$0a,$0a,$0a,$0a,$0a,$0a 419 4574 0C 0C 0C 0C 0C 0C + .byte $0c,$0c,$0c,$0c,$0c,$0c,$0c,$0c,$0c 420 457D 0E 0E 0E 0E 0E 0E + .byte $0e,$0e,$0e,$0e,$0e,$0e,$0e,$0e 421 4585 10 10 10 10 10 10 + .byte $10,$10,$10,$10,$10,$10,$10,$10 422 458D 12 12 12 12 12 12 + .byte $12,$12,$12,$12,$12,$12,$12,$12,$12 423 4596 14 14 14 14 14 14 + .byte $14,$14,$14,$14,$14,$14,$14,$14 424 459E 16 16 16 16 16 16 + .byte $16,$16,$16,$16,$16,$16,$16,$16 425 45A6 BarrelTableR 426 45A6 2C 2C 2C 2C 2C 2C + .byte $2c,$2c,$2c,$2c,$2c,$2c,$2c,$2c 427 45AE 2A 2A 2A 2A 2A 2A + .byte $2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a 428 45B6 28 28 28 28 28 28 + .byte $28,$28,$28,$28,$28,$28,$28,$28,$28 429 45BF 26 26 26 26 26 26 + .byte $26,$26,$26,$26,$26,$26,$26,$26 430 45C7 24 24 24 24 24 24 + .byte $24,$24,$24,$24,$24,$24,$24,$24 431 45CF 22 22 22 22 22 22 + .byte $22,$22,$22,$22,$22,$22,$22,$22,$22 432 45D8 20 20 20 20 20 20 + .byte $20,$20,$20,$20,$20,$20,$20,$20 433 45E0 1E 1E 1E 1E 1E 1E + .byte $1e,$1e,$1e,$1e,$1e,$1e,$1e,$1e 434 45E8 1C 1C 1C 1C 1C 1C + .byte $1c,$1c,$1c,$1c,$1c,$1c,$1c,$1c,$1c 435 45F1 1A 1A 1A 1A 1A 1A + .byte $1a,$1a,$1a,$1a,$1a,$1a,$1a,$1a 436 45F9 18 18 18 18 18 18 + .byte $18,$18,$18,$18,$18,$18,$18,$18 437 438 4601 sintable 439 4601 00 .byte 0 440 4602 04 .byte 4 441 4603 08 .byte 8 442 4604 0D .byte 13 443 4605 11 .byte 17 444 4606 16 .byte 22 445 4607 1A .byte 26 446 4608 1F .byte 31 447 4609 23 .byte 35 448 460A 28 .byte 40 449 460B 2C .byte 44 450 460C 30 .byte 48 451 460D 35 .byte 53 452 460E 39 .byte 57 453 460F 3D .byte 61 454 4610 42 .byte 66 455 4611 46 .byte 70 456 4612 4A .byte 74 457 4613 4F .byte 79 458 4614 53 .byte 83 459 4615 57 .byte 87 460 4616 5B .byte 91 461 4617 5F .byte 95 462 4618 64 .byte 100 463 4619 68 .byte 104 464 461A 6C .byte 108 465 461B 70 .byte 112 466 461C 74 .byte 116 467 461D 78 .byte 120 468 461E 7C .byte 124 469 461F 80 .byte 128 470 4620 83 .byte 131 471 4621 87 .byte 135 472 4622 8B .byte 139 473 4623 8F .byte 143 474 4624 92 .byte 146 475 4625 96 .byte 150 476 4626 9A .byte 154 477 4627 9D .byte 157 478 4628 A1 .byte 161 479 4629 A4 .byte 164 480 462A A7 .byte 167 481 462B AB .byte 171 482 462C AE .byte 174 483 462D B1 .byte 177 484 462E B5 .byte 181 485 462F B8 .byte 184 486 4630 BB .byte 187 487 4631 BE .byte 190 488 4632 C1 .byte 193 489 4633 C4 .byte 196 490 4634 C6 .byte 198 491 4635 C9 .byte 201 492 4636 CC .byte 204 493 4637 CF .byte 207 494 4638 D1 .byte 209 495 4639 D4 .byte 212 496 463A D6 .byte 214 497 463B D9 .byte 217 498 463C DB .byte 219 499 463D DD .byte 221 500 463E DF .byte 223 501 463F E2 .byte 226 502 4640 E4 .byte 228 503 4641 E6 .byte 230 504 4642 E8 .byte 232 505 4643 E9 .byte 233 506 4644 EB .byte 235 507 4645 ED .byte 237 508 4646 EE .byte 238 509 4647 F0 .byte 240 510 4648 F2 .byte 242 511 4649 F3 .byte 243 512 464A F4 .byte 244 513 464B F6 .byte 246 514 464C F7 .byte 247 515 464D F8 .byte 248 516 464E F9 .byte 249 517 464F FA .byte 250 518 4650 FB .byte 251 519 4651 FC .byte 252 520 4652 FC .byte 252 521 4653 FD .byte 253 522 4654 FE .byte 254 523 4655 FE .byte 254 524 4656 FF .byte 255 525 4657 FF .byte 255 526 4658 FF .byte 255 527 4659 FF .byte 255 528 465A FF .byte 255 529 465B FF .byte 255 ;anti self destruction byte 530 531 465C costable 532 465C FF .byte 255 ;anti self destruction byte 533 465D FF .byte 255 534 465E FF .byte 255 535 465F FF .byte 255 536 4660 FF .byte 255 537 4661 FF .byte 255 538 4662 FE .byte 254 539 4663 FE .byte 254 540 4664 FD .byte 253 541 4665 FC .byte 252 542 4666 FC .byte 252 543 4667 FB .byte 251 544 4668 FA .byte 250 545 4669 F9 .byte 249 546 466A F8 .byte 248 547 466B F7 .byte 247 548 466C F6 .byte 246 549 466D F4 .byte 244 550 466E F3 .byte 243 551 466F F2 .byte 242 552 4670 F0 .byte 240 553 4671 EE .byte 238 554 4672 ED .byte 237 555 4673 EB .byte 235 556 4674 E9 .byte 233 557 4675 E8 .byte 232 558 4676 E6 .byte 230 559 4677 E4 .byte 228 560 4678 E2 .byte 226 561 4679 DF .byte 223 562 467A DD .byte 221 563 467B DB .byte 219 564 467C D9 .byte 217 565 467D D6 .byte 214 566 467E D4 .byte 212 567 467F D1 .byte 209 568 4680 CF .byte 207 569 4681 CC .byte 204 570 4682 C9 .byte 201 571 4683 C6 .byte 198 572 4684 C4 .byte 196 573 4685 C1 .byte 193 574 4686 BE .byte 190 575 4687 BB .byte 187 576 4688 B8 .byte 184 577 4689 B5 .byte 181 578 468A B1 .byte 177 579 468B AE .byte 174 580 468C AB .byte 171 581 468D A7 .byte 167 582 468E A4 .byte 164 583 468F A1 .byte 161 584 4690 9D .byte 157 585 4691 9A .byte 154 586 4692 96 .byte 150 587 4693 92 .byte 146 588 4694 8F .byte 143 589 4695 8B .byte 139 590 4696 87 .byte 135 591 4697 83 .byte 131 592 4698 80 .byte 128 593 4699 7C .byte 124 594 469A 78 .byte 120 595 469B 74 .byte 116 596 469C 70 .byte 112 597 469D 6C .byte 108 598 469E 68 .byte 104 599 469F 64 .byte 100 600 46A0 5F .byte 95 601 46A1 5B .byte 91 602 46A2 57 .byte 87 603 46A3 53 .byte 83 604 46A4 4F .byte 79 605 46A5 4A .byte 74 606 46A6 46 .byte 70 607 46A7 42 .byte 66 608 46A8 3D .byte 61 609 46A9 39 .byte 57 610 46AA 35 .byte 53 611 46AB 30 .byte 48 612 46AC 2C .byte 44 613 46AD 28 .byte 40 614 46AE 23 .byte 35 615 46AF 1F .byte 31 616 46B0 1A .byte 26 617 46B1 16 .byte 22 618 46B2 11 .byte 17 619 46B3 0D .byte 13 620 46B4 08 .byte 8 621 46B5 04 .byte 4 622 46B6 00 .byte 0 623 624 46B7 linetableL 625 46B7 10 38 60 88 B0 D8 + :screenheight .by <(display+screenBytes*#) 626 ;:20 .by <(display+screenBytes*#) 627 477F 50 .by (display+screenBytes*#) 630 ;:20 .by >(display+screenBytes*#) 631 4848 2F .by >PlotLine 632 ;---------------------------- 633 4849 oldPlotPointerX 634 4849 00 00 .wo 0 635 ;---------------------------- 636 ;PutChar4x4 637 484B 00 LoopCounter4x4 .byte 0 638 484C 00 y4x4 .byte 0 639 484D 00 StoreA4x4 .byte 0 640 484E 00 Xcounter4x4 .byte 0 641 484F 00 nibbler4x4 .byte 0 642 4850 00 CharCode4x4 .byte 0 643 4851 00 plot4x4color .byte 0 ;1-white, 0-background 644 645 4852 bittable 646 4852 80 40 20 10 08 04 + .byte $80,$40,$20,$10,$08,$04,$02,$01 647 485A bittable2 648 485A 7F BF DF EF F7 FB + .byte $7f,$bf,$df,$ef,$f7,$fb,$fd,$fe 649 ;---------------------------- 650 4862 disktance ;tanks distance 651 4862 00 00 .byte 0,0 652 4864 6A .byte screenwidth/3 653 4865 50 .byte screenwidth/4 654 4866 40 .byte screenwidth/5 655 4867 35 .byte screenwidth/6 656 4868 2D .byte screenwidth/7 657 ;max number of players=6 658 659 ; this table is for deciding where a tank should slide 660 ; accordingly to what is below the tank 661 ; there are 3 bits used here 662 ; bit 0 - go down 663 ; bit 1 - go left 664 ; bit 2 - go right 665 ; position in the table equals to bit pattern of soil below tank 666 667 4869 WhereToSlideTable 668 ; we have 3 bits: 0 - go down, 1 - go right, 2 - go left 669 ;original table 670 ;.BYTE 1,5,4,4,4,4,4,4,0,0,0,0,0,0,0,0 671 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 672 ;.BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 673 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 674 ;.BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 675 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 676 ;.BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 677 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 678 ;.BYTE 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 679 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 680 ;.BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 681 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 682 ;.BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 683 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 684 ;.BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 685 ;.BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 686 687 4869 01 05 04 04 04 04 + .BYTE 1,5,4,4,4,4,4,4,0,0,0,0,0,0,0,0 ;16 688 4879 04 00 00 00 00 00 + .BYTE 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;32 689 4889 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;48 690 4899 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;64 691 48A9 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;80 692 48B9 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;96 693 48C9 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;112 694 48D9 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;128 695 48E9 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 696 48F9 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 697 4909 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 698 4919 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 699 4929 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 700 4939 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 701 4949 02 00 00 00 00 00 + .BYTE 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 702 4959 00 00 00 00 00 00 + .BYTE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 703 704 4969 EndOfTheBarrelX 705 4969 04 04 04 04 04 04 + .byte 4,4,4,4,4,4,4,4,4,4,4 706 4974 05 05 05 05 05 05 + .byte 5,5,5,5,5,5,5,5,5,5 707 497E 06 06 06 06 06 06 + .byte 6,6,6,6,6,6,6,6,6 708 4987 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 709 4996 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7 710 499F 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7 711 49A9 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7,7,7 712 49B6 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7 713 714 49C4 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 715 49CE 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 716 49D8 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 717 49E2 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 718 49EC 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 719 49F6 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 720 4A00 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 721 4A0A 00 00 00 00 .byte 0,0,0,0 722 723 4A0E 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0 724 4A1C 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0 725 4A29 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 726 4A33 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0 727 4A3C 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 728 4A4B 01 01 01 01 01 01 + .byte 1,1,1,1,1,1,1,1,1 729 4A54 02 02 02 02 02 02 + .byte 2,2,2,2,2,2,2,2,2,2 730 4A5E 03 03 03 03 03 03 + .byte 3,3,3,3,3,3,3,3,3,3,3 731 732 4A69 EndOfTheBarrelY 733 4A69 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7 734 4A74 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7 735 4A7E 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7 736 4A87 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 737 4A96 06 06 06 06 06 06 + .byte 6,6,6,6,6,6,6,6,6 738 4A9F 05 05 05 05 05 05 + .byte 5,5,5,5,5,5,5,5,5,5 739 4AA9 04 04 04 04 04 04 + .byte 4,4,4,4,4,4,4,4,4,4,4,4,4 740 4AB6 03 03 03 03 03 03 + .byte 3,3,3,3,3,3,3,3,3,3,3,3,3,3 741 742 4AC4 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 743 4ACE 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 744 4AD8 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 745 4AE2 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 746 4AEC 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 747 4AF6 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 748 4B00 00 00 00 00 00 00 + .byte 0,0,0,0,0,0,0,0,0,0 749 4B0A 00 00 00 00 .byte 0,0,0,0 750 751 4B0E 03 03 03 03 03 03 + .byte 3,3,3,3,3,3,3,3,3,3,3,3,3,3 752 4B1C 04 04 04 04 04 04 + .byte 4,4,4,4,4,4,4,4,4,4,4,4,4 753 4B29 05 05 05 05 05 05 + .byte 5,5,5,5,5,5,5,5,5,5 754 4B33 06 06 06 06 06 06 + .byte 6,6,6,6,6,6,6,6,6 755 4B3C 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 756 4B4B 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7 757 4B54 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7 758 4B5E 07 07 07 07 07 07 + .byte 7,7,7,7,7,7,7,7,7,7,7 759 ;------------------------------------------------- 760 761 4B69 TanksNamesDefault 762 4B69 11 73 74 00 34 61 + dta d"1st Tank" 763 4B71 12 6E 64 00 34 61 + dta d"2nd Tank" 764 4B79 13 72 64 00 34 61 + dta d"3rd Tank" 765 4B81 14 74 68 00 34 61 + dta d"4th Tank" 766 4B89 15 74 68 00 34 61 + dta d"5th Tank" 767 4B91 16 74 68 00 34 61 + dta d"6th Tank" 768 769 4B99 WeaponPriceH ; weapons prices (tables with prices of weapons) 770 4B99 00 00 00 00 00 01 + .byte $00,$00,$00,$00,$00,$01,$01,$01 771 4BA1 01 01 00 01 02 02 + .byte $01,$01,$00,$01,$02,$02,$02,$01 772 4BA9 01 01 01 01 01 00 + .byte $01,$01,$01,$01,$01,$00,$00,$00 773 4BB1 01 00 00 00 02 02 + .byte $01,$00,$00,$00,$02,$02,$01,$01 774 4BB9 02 00 00 00 00 00 + .byte $02,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 775 4BC9 00 00 00 00 00 04 + .byte 0,0,0,0,0,$04,0,0,0,0,0,0,0,0,0,0 776 4BD9 WeaponPriceL 777 4BD9 00 60 6F 90 C0 25 + .byte $00,$60,$6F,$90,$c0,$25,$c8,$51 778 4BE1 F0 FF 66 23 B1 58 + .byte $f0,$ff,$66,$23,$b1,$58,$50,$4A 779 4BE9 55 71 42 50 14 FD + .byte $55,$71,$42,$50,$14,$fd,$da,$bf 780 4BF1 31 68 82 AB 12 45 + .byte $31,$68,$82,$ab,$12,$45,$ae,$12 781 4BF9 41 00 00 00 00 00 + .byte $41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 782 4C09 00 00 00 00 00 4C + .byte 0,0,0,0,0,$4c,0,0,0,0,0,0,0,0,0,0 783 ;------------------------------------------------- 784 ; how many units (bulletd) of a given weapon we get for a given price 785 ; This is a table of constans. 786 ; If on a given position is 0 it means that this weapon 787 ; is not present in the game. 788 ; This is the slot for adding new weapons. 789 4C19 WeaponUnits 790 4C19 0A 05 03 01 02 02 + .byte 10,5,3,1,2,2,3,1,10,2,20,10,10,5,2,10 791 4C29 05 05 02 0A 05 02 + .byte 5,5,2,10,5,2,10,5,2,10,5,2,2,10,10,5 792 4C39 05 00 00 00 00 00 + .byte 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 793 4C49 06 02 05 05 02 08 + .byte 6,2,5,5,2,8,10,2,3,3,2,2,1,10,25,0 794 795 ;------------------------------------------------- 796 ; Screen codes of icons (chars) representing a given weapon 797 4C59 WeaponSymbols 798 4C59 40 41 42 43 44 45 + .byte $40,$41,$42,$43,$44,$45,$46,$47 799 4C61 48 49 4A 4B 4C 4D + .byte $48,$49,$4a,$4b,$4c,$4d,$4e,$4f 800 4C69 50 51 52 53 54 55 + .byte $50,$51,$52,$53,$54,$55,$56,$57 801 4C71 58 59 5A 5B 60 7B + .byte $58,$59,$5a,$5b,$60,$7b,$7c,$7d 802 4C79 20 00 00 00 00 00 + .byte $20,$00,$00,$00,$00,$00,$00,$00 803 4C81 00 00 00 00 00 00 + .byte $00,$00,$00,$00,$00,$00,$00,$00 804 4C89 02 03 06 1D 0A 1B + .byte $02,$03,$06,$1d,$0a,$1b,$1c,$1e 805 4C91 3B 3C 3D 3E 3F 5E + .byte $3b,$3c,$3d,$3e,$3f,$5e,$5f,$00 806 807 ; Names of weapons (16 chars lon) 808 4C99 NamesOfWeapons ;the comment is an index in the tables 809 4C99 22 61 62 79 00 2D + dta d"Baby Missile " ; 0 810 4CA9 2D 69 73 73 69 6C + dta d"Missile " ; 1 811 4CB9 22 61 62 79 00 2E + dta d"Baby Nuke " ; 2 812 4CC9 2E 75 6B 65 00 00 + dta d"Nuke " ; 3 813 4CD9 2C 65 61 70 26 72 + dta d"LeapFrog " ; 4 814 4CE9 26 75 6E 6B 79 00 + dta d"Funky Bomb " ; 5 815 4CF9 2D 29 32 36 00 00 + dta d"MIRV " ; 6 816 4D09 24 65 61 74 68 07 + dta d"Death's Head " ; 7 817 4D19 2E 61 70 61 6C 6D + dta d"Napalm " ; 8 818 4D29 28 6F 74 00 2E 61 + dta d"Hot Napalm " ; 9 819 4D39 34 72 61 63 65 72 + dta d"Tracer " ; 10 820 4D49 33 6D 6F 6B 65 00 + dta d"Smoke Tracer " ; 11 821 4D59 22 61 62 79 00 32 + dta d"Baby Roller " ; 12 822 4D69 32 6F 6C 6C 65 72 + dta d"Roller " ; 13 823 4D79 28 65 61 76 79 00 + dta d"Heavy Roller " ; 14 824 4D89 32 69 6F 74 00 23 + dta d"Riot Charge " ; 15 825 4D99 32 69 6F 74 00 22 + dta d"Riot Blast " ; 16 826 4DA9 32 69 6F 74 00 22 + dta d"Riot Bomb " ; 17 827 4DB9 28 65 61 76 79 00 + dta d"Heavy Riot Bomb " ; 18 828 4DC9 22 61 62 79 00 24 + dta d"Baby Digger " ; 19 829 4DD9 24 69 67 67 65 72 + dta d"Digger " ; 20 830 4DE9 28 65 61 76 79 00 + dta d"Heavy Digger " ; 21 831 4DF9 22 61 62 79 00 33 + dta d"Baby Sandhog " ; 22 832 4E09 33 61 6E 64 68 6F + dta d"Sandhog " ; 23 833 4E19 28 65 61 76 79 00 + dta d"Heavy Sandhog " ; 24 834 4E29 24 69 72 74 00 23 + dta d"Dirt Clod " ; 25 835 4E39 24 69 72 74 00 22 + dta d"Dirt Ball " ; 26 836 4E49 34 6F 6E 00 6F 66 + dta d"Ton of Dirt " ; 27 837 4E59 2C 69 71 75 69 64 + dta d"Liquid Dirt " ; 28 838 4E69 24 69 72 74 00 23 + dta d"Dirt Charge " ; 29 839 4E79 25 61 72 74 68 00 + dta d"Earth Disrupter " ; 30 840 4E89 30 6C 61 73 6D 61 + dta d"Plasma Blast " ; 31 841 4E99 2C 61 73 65 72 00 + dta d"Laser " ; 32 842 4EA9 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 33 843 4EB9 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 34 844 4EC9 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 35 845 4ED9 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 36 846 4EE9 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 37 847 4EF9 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 38 848 4F09 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 39 849 4F19 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 40 850 4F29 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 41 851 4F39 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 42 852 4F49 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 43 853 4F59 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 44 854 4F69 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 45 855 4F79 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 46 856 4F89 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 47 857 858 4F99 28 65 61 74 00 27 + dta d"Heat Guidance " ; 48 ($30) 859 4FA9 22 61 6C 00 27 75 + dta d"Bal Guidance " ; 49 860 4FB9 28 6F 72 7A 00 27 + dta d"Horz Guidance " ; 50 861 4FC9 36 65 72 74 00 27 + dta d"Vert Guidance " ; 51 862 4FD9 2C 61 7A 79 00 22 + dta d"Lazy Boy " ; 52 863 4FE9 30 61 72 61 63 68 + dta d"Parachute " ; 53 864 4FF9 22 61 74 74 65 72 + dta d"Battery " ; 54 865 5009 2D 61 67 00 24 65 + dta d"Mag Deflector " ; 55 866 5019 33 68 69 65 6C 64 + dta d"Shield " ; 56 867 5029 26 6F 72 63 65 00 + dta d"Force Shield " ; 57 868 5039 28 65 61 76 79 00 + dta d"Heavy Shield " ; 58 869 5049 33 75 70 65 72 00 + dta d"Super Mag " ; 59 870 5059 21 75 74 6F 00 24 + dta d"Auto Defense " ; 60 871 5069 26 75 65 6C 00 34 + dta d"Fuel Tank " ; 61 872 5079 23 6F 6E 74 61 63 + dta d"Contact Trigger " ; 62 873 5089 0D 0D 0D 0D 0D 0D + dta d"----------------" ; 63 874 5099 joyToKeyTable 875 ; .by 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15 876 5099 FF FF FF FF FF FF + .by $ff,$ff,$ff,$ff,$ff,$ff,$ff,$07,$ff,$ff,$ff,$06,$ff,$0f,$0e,$ff 877 50A9 previousAngle 878 50A9 00 00 00 00 00 00 :MaxPlayers .by 0 879 50AF previousEnergyL 880 50AF 00 00 00 00 00 00 :MaxPlayers .by 0 881 50B5 previousLeftRange 882 50B5 00 00 00 00 00 00 :MaxPlayers .by 0 883 50BB previousEnergyH 884 50BB 00 00 00 00 00 00 :MaxPlayers .by 0 885 50C1 previousRightAngle 886 50C1 00 00 00 00 00 00 :MaxPlayers .by 0 887 50C7 RandBoundaryLow 888 50C7 00 00 .wo 0 889 50C9 RandBoundaryHigh 890 50C9 00 04 .wo 1024 891 50CB AngleTablePointer 892 50CB 00 .by 0 893 894 895 50CC clearEnd 896 897 .endif 898 90 ;-------------------------------------------------- 91 50CC OffensiveTexts 92 50CC icl 'artwork/talk.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\artwork\talk.asm 1 50CC .proc talk 2 50CC 49 4E 20 54 49 4D + L0 dta c"IN TIMES OF TROUBLE, GO WITH WHAT YOU KNOW." 3 50F7 44 49 45 21 L1 dta c"DIE!" 4 50FB 45 41 54 20 4D 59 + L2 dta c"EAT MY SHORTS!" 5 5109 59 4F 55 27 52 45 + L3 dta c"YOU'RE TOAST!" 6 5116 42 41 4E 5A 41 49 + L4 dta c"BANZAI!" 7 511D 46 52 4F 4D 20 48 + L5 dta c"FROM HELL'S HEART I STAB AT THEE..." 8 5140 49 20 44 49 44 4E + L6 dta c"I DIDN'T DO IT. NOBODY SAW ME DO IT." 9 5165 54 41 4B 45 20 41 + L7 dta c"TAKE A HIKE!" 10 5171 59 4F 55 27 52 45 + L8 dta c"YOU'RE DEAD MEAT." 11 5182 4D 41 4B 45 20 4D + L9 dta c"MAKE MY DAY." 12 518E 43 48 41 52 47 45 + L10 dta c"CHARGE!" 13 5195 41 54 54 41 43 4B + L11 dta c"ATTACK!" 14 519C 59 4F 55 27 52 45 + L12 dta c"YOU'RE OUTTA HERE." 15 51AE 57 41 54 54 53 41 + L13 dta c"WATTSA MATTA YOU?" 16 51BF 46 52 45 45 5A 45 + L14 dta c"FREEZE, OR I'LL SHOOT!" 17 51D5 48 41 20 48 41 20 + L15 dta c"HA HA HA." 18 51DE 57 45 20 43 4F 4D + L16 dta c"WE COME IN PEACE - SHOOT TO KILL!" 19 51FF 49 4E 20 59 4F 55 + L17 dta c"IN YOUR FACE!" 20 520C 44 49 45 20 43 4F + L18 dta c"DIE COMMIE PIG!" 21 521B 49 20 4C 4F 56 45 + L19 dta c"I LOVE THE SMELL OF NAPALM IN THE MORNING." 22 5245 56 49 43 54 4F 52 + L20 dta c"VICTORY!" 23 524D 53 48 4F 57 20 53 + L21 dta c"SHOW SOME RESPECT." 24 525F 4A 55 53 54 20 57 + L22 dta c"JUST WHO DO YOU THINK YOU ARE?" 25 527D 4C 4F 4F 4B 20 4F + L23 dta c"LOOK OUT BELOW!" 26 528C 4B 4E 4F 43 4B 2C + L24 dta c"KNOCK, KNOCK." 27 5299 4C 4F 4F 4B 20 4F + L25 dta c"LOOK OVER THERE." 28 52A9 47 55 45 53 53 20 + L26 dta c"GUESS WHAT'S COMING FOR DINNER?" 29 52C8 4D 45 52 52 59 20 + L27 dta c"MERRY CHRISTMAS." 30 52D8 4F 50 45 4E 20 57 + L28 dta c"OPEN WIDE!" 31 52E2 48 45 52 45 20 47 + L29 dta c"HERE GOES NOTHING..." 32 52F6 44 4F 4E 27 54 20 + L30 dta c"DON'T WORRY, IT ISN'T A LIVE ROUND." 33 5319 42 4C 4F 4F 44 2C + L31 dta c"BLOOD, PAIN, VIOLENCE!" 34 532F 54 41 4B 45 20 54 + L32 dta c"TAKE THIS, SISSY!" 35 5340 49 20 53 48 41 4C + L33 dta c"I SHALL FLATTEN YOU!" 36 5354 49 20 53 48 41 4C + L34 dta c"I SHALL SMASH YOUR UGLY TANK!" 37 5371 49 20 57 4F 4E 44 + L35 dta c"I WONDER WHAT THIS BUTTON DOES?" 38 5390 44 4F 4E 27 54 20 + L36 dta c"DON'T TAKE THIS PERSONALLY." 39 53AB 57 4F 55 4C 44 20 + L37 dta c"WOULD THIS MAKE YOU MAD?" 40 53C3 49 20 54 4F 4C 44 + L38 dta c"I TOLD YOU TO LEAVE MY SISTER ALONE!" 41 53E7 49 20 43 4F 55 4C + L39 dta c"I COULD SPARE YOU, BUT WHY?" 42 5402 4D 59 20 42 4F 4D + L40 dta c"MY BOMB IS BIGGER THAN YOURS." 43 541F 44 4F 4E 27 54 20 + L41 dta c"DON'T FORGET ABOUT ME!" 44 5435 48 41 53 54 41 20 + L42 dta c"HASTA LA VISTA, BABY!" 45 544A 54 48 49 53 20 49 + L43 dta c"THIS IS YOUR BRAIN ON SCORCH." 46 5467 54 41 4B 45 20 54 + L44 dta c"TAKE THIS!" 47 5471 54 48 49 53 20 53 + L45 dta c"THIS SCREEN AIN'T BIG ENOUGH FOR THE BOTH OF US." 48 54A1 44 49 45 2C 20 41 + L46 dta c"DIE, ALIEN SWINE!" 49 54B2 53 41 59 20 41 52 + L47 dta c"SAY ARRGGHHHHH...." 50 54C4 49 20 53 48 41 4C + L48 dta c"I SHALL OIL MY TURRET WITH YOUR BLOOD." 51 54EA 44 49 45 2C 20 54 + L49 dta c"DIE, TANK-SCUM!" 52 54F9 49 27 4D 20 47 4F + L50 dta c"I'M GONNA BREAK YOUR FACE!" 53 5513 4D 41 4D 41 20 53 + L51 dta c"MAMA SAID KNOCK YOU OUT!" 54 552B 49 20 48 4F 50 45 + L52 dta c"I HOPE YOU ENJOY PAIN!" 55 ;-------------------------------- 56 5541 50 41 52 54 49 4E + L53 dta c"PARTING IS SUCH SWEET SORROW... NOT!" 57 5565 55 47 48 21 L54 dta c"UGH!" 58 5569 41 41 52 47 48 21 L55 dta c"AARGH!" 59 556F 41 41 41 47 47 48 + L56 dta c"AAAGGHHH!" 60 5578 49 27 4D 20 4D 45 + L57 dta c"I'M MELTING!" 61 5584 4F 4F 46 2E 2E L58 dta c"OOF.." 62 5589 4F 48 21 L59 dta c"OH!" 63 558C 45 45 45 4B 21 L60 dta c"EEEK!" 64 5591 41 41 43 43 48 21 L61 dta c"AACCH!" 65 5597 49 20 48 41 54 45 + L62 dta c"I HATE IT WHEN THAT HAPPENS." 66 55B3 4F 4E 45 20 44 49 + L63 dta c"ONE DIRECT HIT CAN RUIN YOUR WHOLE DAY." 67 55DA 4F 48 20 4E 4F 21 L64 dta c"OH NO!" 68 55E0 4E 4F 54 20 4D 45 + L65 dta c"NOT ME!" 69 55E7 4F 55 43 48 2E L66 dta c"OUCH." 70 55EC 4F 48 20 4E 4F 2C + L67 dta c"OH NO, NOT AGAIN." 71 55FD 41 4E 4F 54 48 45 + L68 dta c"ANOTHER ONE BITES THE DUST." 72 5618 47 4F 4F 44 42 59 + L69 dta c"GOODBYE." 73 5620 48 45 4C 50 20 4D + L70 dta c"HELP ME!" 74 5628 46 41 52 45 57 45 + L71 dta c"FAREWELL, CRUEL WORLD." 75 563E 52 45 4D 45 4D 42 + L72 dta c"REMEMBER THE ALAMO!" 76 5651 4F 48 20 4D 41 4E + L73 dta c"OH MAN!" 77 5658 44 4F 4F 55 47 48 + L74 dta c"DOOUGH!" 78 565F 41 4E 4F 54 48 45 + L75 dta c"ANOTHER DAY, ANOTHER BOMB." 79 5679 54 48 49 53 20 49 + L76 dta c"THIS IS THE END, MY ONLY FRIEND." 80 5699 49 54 27 53 20 41 + L77 dta c"IT'S ALL OVER." 81 56A7 54 48 45 20 46 41 + L78 dta c"THE FAT LADY SANG." 82 56B9 57 48 59 20 44 4F + L79 dta c"WHY DOES EVERYTHING HAPPEN TO ME?" 83 56DA 49 27 4D 20 47 4F + L80 dta c"I'M GOING DOWN." 84 56E9 49 27 56 45 20 47 + L81 dta c"I'VE GOT A BAD FEELING ABOUT THIS." 85 570B 43 52 41 50 4F 4C + L82 dta c"CRAPOLA." 86 5713 50 4F 57 21 L83 dta c"POW!" 87 5717 42 49 46 21 L84 dta c"BIF!" 88 571B 42 41 4D 21 L85 dta c"BAM!" 89 571F 5A 4F 4E 4B 21 L86 dta c"ZONK!" 90 5724 49 20 53 48 4F 55 + L87 dta c"I SHOULD'VE LISTENED TO MY MOTHER..." 91 5748 4E 4F 2E 2E 2E 20 + L88 dta c"NO... A BUD LIGHT!" 92 575A 57 48 41 54 20 57 + L89 dta c"WHAT WAS THAT NOISE?" 93 576E 4D 41 4D 41 20 53 + L90 dta c"MAMA SAID THERE'D BE DAYS LIKE THIS." 94 5792 49 54 53 20 4A 55 + L91 dta c"ITS JUST ONE OF THOSE DAYS..." 95 57AF 49 20 53 45 45 20 + L92 dta c"I SEE A BRIGHT LIGHT..." 96 57C6 4D 4F 4D 4D 59 3F + L93 dta c"MOMMY? IS THAT YOU?" 97 57D9 49 20 4C 45 54 20 + L94 dta c"I LET YOU HIT ME!" 98 57EA 53 55 43 4B 45 52 + L95 dta c"SUCKER SHOT!" 99 57F6 49 20 44 49 44 4E + L96 dta c"I DIDN'T WANT TO LIVE ANYWAY." 100 5813 2D 3C 53 4F 42 3E + L97 dta c"--" 101 581A 57 41 53 20 54 48 + L98 dta c"WAS THAT AS CLOSE AS I THINK IT WAS?" 102 583E 4A 4F 49 4E 20 54 + L99 dta c"JOIN THE ARMY, SEE THE WORLD THEY SAID." 103 5865 49 54 20 57 41 53 + L100 dta c"IT WASN'T JUST A JOB IT WAS AN ADVENTURE!" 104 588E 49 20 44 49 44 4E + L101 dta c"I DIDN'T LIKE VIOLENCE ANYWAY!" 105 58AC 49 20 54 48 4F 55 + L102 dta c"I THOUGHT YOU LIKED ME?" 106 58C3 53 55 43 48 20 53 + L103 dta c"SUCH SENSELESS VIOLENCE! I DON'T UNDERSTAND IT." 107 58F3 49 20 54 48 49 4E + L104 dta c"I THINK THIS GUY'S A LITTLE CRAZY." 108 5915 53 4F 4D 45 48 4F + L105 dta c"SOMEHOW I DON'T FEEL LIKE KILLING ANYMORE." 109 593F 48 45 59 21 20 20 + L106 dta c"HEY! KILLIN' AIN'T COOL." 110 5958 47 45 45 2E 2E 2E + L107 dta c"GEE... THANKS." 111 5966 49 27 56 45 20 46 + L108 dta c"I'VE FALLEN AND I CAN'T GET UP!" 112 5985 39 31 31 3F L109 dta c"911?" 113 5989 4F 48 20 4E 4F 21 + L110 dta c"OH NO! HERE I BLOW AGAIN!" 114 59A3 49 27 4C 4C 20 42 + L111 dta c"I'LL BE BACK..." 115 59B2 48 45 59 20 2D 20 + L112 dta c"HEY - I'VE GOT LAWYERS." 116 59C9 54 49 4D 45 20 54 + L113 dta c"TIME TO CALL 1-900-SUE-TANK." 117 59E5 OffensiveTextTableL 118 59E5 CC F7 FB 09 16 1D + dta L0,>L1,>L2,>L3,>L4,>L5,>L6,>L7,>L8,>L9,>L10,>L11,>L12,>L13,>L14,>L15,>L16,>L17,>L18,>L19,>L20,>L21,>L22,>L23,>L24,>L25,>L26,>L27,>L28,>L29,>L30,>L31,>L32,>L33,>L34,>L35,>L36,>L37,>L38,>L39,>L40,>L41,>L42,>L43,>L44,>L45,>L46,>L47,>L48,>L49,>L50,>L51,>L52,>L53,>L54,>L55,>L56,>L57,>L58,>L59,>L60,>L61,>L62,>L63,>L64,>L65,>L66,>L67,>L68,>L69,>L70,>L71,>L72,>L73,>L74,>L75,>L76,>L77,>L78,>L79,>L80,>L81,>L82,>L83,>L84,>L85,>L86,>L87,>L88,>L89,>L90,>L91,>L92,>L93,>L94,>L95,>L96,>L97,>L98,>L99,>L100,>L101,>L102,>L103,>L104,>L105,>L106,>L107,>L108,>L109,>L110,>L111,>L112,>L113 121 5AC9 OffensiveTextLengths 122 5AC9 2B 04 0E 0D 07 23 + dta 43,4,14,13,7,35,37,12,17,12,7,7,18,17,22,9,33,13,15,42,8,18,30,15,13,16,31,16,10,20,35,22,17,20,29,31,27,24,36,27,29,22,21,29,10,48,17,20,38,15,26,24,22,36,4,6,9,12,5,3,5,6,28,39,6,7,5,17,27,8,8,22,19,7,7,26,32,14,18,33,15,34,8,4,4,4,5,36,18,20,36,29,23,19,17,12,29,7,36,39,41,30,23,48,34,42,25,14,31,4,26,15,23,28 123 = 0036 NumberOfOffensiveTexts=54 124 = 003C NumberOfDeffensiveTexts=60 125 .endp 93 ;-------------------------------------------------- 94 ; Game Code 95 ;-------------------------------------------------- 96 5B3B START 97 98 ; Startup sequence 99 5B3B 20 A1 72 jsr Initialize 100 101 5B3E A9 49 8D 30 02 A9 + mwa #OptionsDL dlptrs 102 5B48 AD 2F 02 lda dmactls 103 5B4B 29 FC and #$fc 104 5B4D 09 02 ora #$02 ; normal screen width 105 5B4F 8D 2F 02 sta dmactls 106 107 5B52 20 DD 74 jsr Options ;startup screen 108 109 ;entering names of players 110 5B55 A9 5E 8D 30 02 A9 + mwa #NameDL dlptrs 111 5B5F AD 2F 02 lda dmactls 112 5B62 29 FC and #$fc 113 5B64 09 01 ora #$01 ; narrow screen (32 chars) 114 5B66 8D 2F 02 sta dmactls 115 116 5B69 A9 00 85 8B mva #0 TankNr 117 118 5B6D loop01 119 5B6D 20 30 7A jsr EnterPlayerName 120 5B70 E6 8B inc TankNr 121 5B72 A5 8B lda TankNr 122 5B74 CD 19 3D cmp NumberOfPlayers 123 5B77 D0 F4 bne loop01 124 125 5B79 A9 74 8D 30 02 A9 + mwa #dl dlptrs 126 5B83 AD 2F 02 lda dmactls 127 5B86 29 FC and #$fc 128 5B88 09 02 ora #$02 ; normal screen width 129 5B8A 8D 2F 02 sta dmactls 130 131 5B8D 20 54 73 jsr RandomizeSequence 132 ; for the round #1 shooting sequence is random 133 134 5B90 MainGameLoop 135 136 5B90 20 2C 76 jsr CallPurchaseForEveryTank 137 138 5B93 20 39 73 jsr SetDLI 139 5B96 A9 74 8D 30 02 A9 + mwa #dl dlptrs 140 5BA0 AD 2F 02 lda dmactls 141 5BA3 29 FC and #$fc 142 5BA5 09 02 ora #$02 ; 2=normal, 3 = wide screen width 143 5BA7 8D 2F 02 sta dmactls 144 145 5BAA 20 35 72 jsr GetRandomWind 146 147 5BAD 20 55 5C jsr Round 148 149 5BB0 20 20 74 jsr SortSequence 150 151 ; Hide all (easier than hide last ;) ) tanks 152 5BB3 A9 01 8D FB 3D mva #1 Erase 153 5BB8 20 E2 84 jsr drawtanks 154 5BBB A9 00 8D FB 3D mva #0 Erase 155 5BC0 20 66 72 jsr PMoutofScreen ;let P/M disappear 156 157 ; here gains and looses should be displayed (dollars) 158 ; finally we have changed our minds and money of players 159 ; is displayed only in weapons shop 160 161 ; Results are number of other deaths 162 ; before the player dies itself 163 164 ; add gains and substract looses 165 ; gain is what player gets for lost energy of opponents 166 ; energy lost by opponents is added during Round and 167 ; little below in source multiplied by 2 to get "dollars". 168 ; By analogy, loose is energy that given player looses during 169 ; each Round. 170 ; Important! If player has 10 energy and gets central hit 171 ; from nuke that would take 90 energy point his loose 172 ; is 90, not 10 173 5BC3 20 37 7D jsr DisplayResults 174 175 ;check demo mode 176 5BC6 AE 19 3D ldx numberOfPlayers 177 5BC9 CA dex 178 5BCA checkForHuman ; if all in skillTable other than 0 then switch to DEMO MODE 179 5BCA BD 20 3D lda skillTable,x 180 5BCD F0 1D beq peopleAreHere 181 5BCF CA dex 182 5BD0 10 F8 bpl checkForHuman 183 5BD2 A8 tay 184 ; no people, just wait a bit 185 5BD3 pause 150 Macro: PAUSE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 2 5BD3 A2 96 ldx #150 3 5BD5 ?PAUSELOOP 3 5BD5 AD 0B D4 LDA VCOUNT 4 5BD8 8D 0A D4 STA WSYNC 5 5BDB 8D 0A D4 STA WSYNC 6 5BDE 8D 0A D4 STA WSYNC 7 5BE1 CD 0B D4 ?WA CMP VCOUNT 8 5BE4 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 5 5BE6 CA dex 6 5BE7 D0 EC bne ?PAUSELOOP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 186 5BE9 4C FF 5B jmp noKey 187 188 5BEC peopleAreHere 189 ;key ; only if there is a human player 190 5BEC AD 0F D2 lda SKSTAT 191 5BEF C9 FF cmp #$ff 192 5BF1 F0 07 beq checkFire 193 5BF3 C9 F7 cmp #$f7 194 5BF5 F0 03 beq checkFire 195 5BF7 4C FF 5B jmp noKey ;key pressed, so go 196 5BFA checkFire 197 ;------------JOY------------- 198 ;happy happy joy joy 199 ;check for joystick now 200 ;fire 201 5BFA AD 10 D0 lda TRIG0 202 5BFD D0 ED bne peopleAreHere ;fire not pressed, so loop 203 204 5BFF noKey 205 5BFF AE 19 3D ldx NumberOfPlayers 206 5C02 CA dex 207 5C03 CalculateGains 208 ; add gain * 2 209 5C03 1E 38 3D asl gainL,x 210 5C06 3E 32 3D rol gainH,x 211 5C09 18 clc 212 5C0A BD 2C 3D lda moneyL,x 213 5C0D 7D 38 3D adc gainL,x 214 5C10 9D 2C 3D sta moneyL,x 215 5C13 BD 26 3D lda moneyH,x 216 5C16 7D 32 3D adc gainH,x 217 5C19 9D 26 3D sta moneyH,x 218 ; substract loose 219 ; if loose is greater than money then zero money 220 5C1C BD 26 3D lda moneyH,x 221 5C1F DD 3E 3D cmp looseH,x 222 5C22 90 20 bcc zeromoney 223 5C24 D0 08 bne substractloose 224 5C26 BD 2C 3D lda moneyL,x 225 5C29 DD 44 3D cmp looseL,x 226 5C2C 90 16 bcc zeromoney 227 5C2E substractloose 228 5C2E 38 sec 229 5C2F BD 2C 3D lda moneyL,x 230 5C32 FD 44 3D sbc looseL,x 231 5C35 9D 2C 3D sta moneyL,x 232 5C38 BD 26 3D lda moneyH,x 233 5C3B FD 3E 3D sbc looseH,x 234 5C3E 9D 26 3D sta moneyH,x 235 5C41 4C 4C 5C jmp skipzeroing 236 5C44 zeromoney 237 5C44 A9 00 lda #0 238 5C46 9D 2C 3D sta moneyL,x 239 5C49 9D 26 3D sta moneyH,x 240 241 5C4C skipzeroing 242 5C4C CA dex 243 5C4D 10 B4 bpl CalculateGains 244 245 246 247 5C4F EE 4B 3F inc CurrentRoundNr 248 5C52 4C 90 5B jmp MainGameLoop 249 250 251 ;-------------------------------------------------- 252 5C55 Round .proc ; 253 ;-------------------------------------------------- 254 ; at the beginning of each Round we set energy 255 ; of all players to 100 256 ; the maximum shooting energy to 1000 (it is 10*energy) 257 ; the default shooting energy to 350 258 ; the default shooting angle to 45 degrees 259 ; of course gains an looses are zeroed 260 261 5C55 A9 00 lda #0 262 5C57 AA tax 263 5C58 loop 264 5C58 9D A9 50 sta previousAngle,x 265 5C5B E8 inx 266 5C5C E0 23 cpx #(clearEnd-PreviousAngle) 267 5C5E D0 F8 bne loop 268 .endp 269 270 5C60 A2 05 ldx #5 271 5C62 SettingEnergies 272 5C62 A9 00 lda #$00 273 5C64 9D 38 3D sta gainL,x 274 5C67 9D 32 3D sta gainH,x 275 5C6A 9D 44 3D sta looseL,x 276 5C6D 9D 3E 3D sta looseH,x 277 5C70 A9 63 lda #99 278 5C72 9D 4A 3D sta Energy,x 279 5C75 9D 51 3D sta eXistenZ,x 280 5C78 9D 57 3D sta LASTeXistenZ,x 281 ; anything in eXistenZ table means that this tank exist 282 ; in the given round 283 5C7B A9 E8 lda #232 284 5C7D 9D 76 3D sta MaxEnergyTableL,x 285 5C80 A9 03 lda #3 286 5C82 9D 7C 3D sta MaxEnergyTableH,x 287 5C85 A9 5E lda #94 288 5C87 9D 6A 3D sta EnergyTableL,x 289 5C8A A9 01 lda #1 290 5C8C 9D 70 3D sta EnergyTableH,x 291 ;lda #(255-45) 292 ;it does not look good when all tanks have 293 ;barrels pointing the same direction 294 ;so it would be nice to have more or less random 295 ;angles 296 297 5C8F 20 89 73 jsr RandomizeAngle 298 5C92 9D 82 3D sta AngleTable,x 299 300 301 5C95 CA dex 302 5C96 10 CA bpl SettingEnergies 303 304 5C98 A9 00 8D 69 3D mva #0 CurrentResult 305 306 ;generating the new landscape 307 5C9D 20 66 72 jsr PMoutofScreen ;let P/M disappear 308 5CA0 20 CB 83 jsr clearscreen ;let the screen be clean 309 5CA3 20 32 84 jsr placetanks ;let the tanks be evenly placed 310 5CA6 20 8B 87 jsr calculatemountains ;let mountains be nice for the eye 311 5CA9 20 83 85 jsr drawmountains ;draw them 312 5CAC 20 E2 84 jsr drawtanks ;finally draw tanks 313 314 ;--------------------round screen is ready--------- 315 316 ;mva #0 TankNr 317 5CAF A9 00 85 8C mva #0 TankSequencePointer 318 319 5CB3 MainRoundLoop 320 ; here we must check if by a chance there is only one 321 ; tank with energy greater than 0 left 322 323 5CB3 A0 00 ldy #0 ; number of tanks with energy greater than zero 324 5CB5 AE 19 3D ldx NumberOfPlayers 325 5CB8 CA dex 326 5CB9 CheckingIfRoundIsFinished 327 5CB9 BD 51 3D lda eXistenZ,x 328 5CBC F0 01 beq NoEnergy 329 5CBE C8 iny 330 5CBF NoEnergy 331 5CBF CA dex 332 5CC0 10 F7 bpl CheckingIfRoundIsFinished 333 334 5CC2 C0 02 cpy #2 ; is it less than 2 tanks have energy >0 ? 335 5CC4 B0 18 bcs DoNotFinishTheRound 336 337 ;points for the last living tank 338 5CC6 AE 19 3D ldx NumberOfPlayers 339 5CC9 CA dex 340 5CCA WhichTankWonLoop 341 5CCA BD 51 3D lda eXistenZ,x 342 5CCD D0 04 bne ThisOneWon 343 5CCF CA dex 344 5CD0 10 F8 bpl WhichTankWonLoop 345 ;error here!!! 346 ;stop 347 ; somehow I believed program will be never here 348 ; but it was a bad assumption 349 ; gode goes here when there is such a situation 350 ; (we've got a SITUATION here, it you know what I mean) 351 ; there are two tanks left. 352 ; one of them is killed by the second tank 353 ; second tank explodes and kills the first one. 354 ; and code lands here... 355 ; looks like no one won! 356 357 5CD2 60 rts 358 359 5CD3 ThisOneWon 360 5CD3 AD 69 3D lda CurrentResult 361 5CD6 18 clc 362 5CD7 7D 5D 3D adc ResultsTable,x 363 5CDA 9D 5D 3D sta ResultsTable,x 364 365 5CDD 60 rts ; this Round is finished 366 367 5CDE DoNotFinishTheRound 368 ;ldx TankNr 369 370 5CDE A6 8C ldx TankSequencePointer 371 5CE0 BD 1A 3D lda TankSequence,x 372 5CE3 85 8B sta TankNr 373 5CE5 AA tax 374 5CE6 BD 4A 3D lda Energy,x ;skip if no energy 375 5CE9 D0 03 4C 7A 5D jeq NextPlayerShoots 376 377 378 5CEE A9 01 8D CA 3E mva #1 color ;to display flying point 379 380 5CF3 BD A4 8E lda TankColoursTable,x 381 5CF6 8D C6 02 sta colpf2s ; set color of status line 382 383 5CF9 BD 20 3D lda SkillTable,x 384 5CFC F0 0F beq ManualShooting 385 386 ; robotanks shoot here 387 5CFE 20 4F 8C jsr ArtificialIntelligence 388 5D01 20 E8 73 jsr MoveBarrelToNewPosition 389 5D04 20 4B 7F jsr DisplayingSymbols ;all digital values like force, angle, wind, etc. 390 5D07 20 55 80 jsr PutTankNameOnScreen 391 ; let's move the tank's barrel so it points the right 392 ; direction 393 5D0A 4C 13 5D jmp AfterManualShooting 394 395 5D0D ManualShooting 396 397 5D0D 20 BF 83 jsr WaitForKeyRelease 398 5D10 20 92 66 jsr BeforeFire 399 400 5D13 AfterManualShooting 401 ; lower energy to eventually let tanks commit suicide 402 5D13 A6 8B ldx TankNr 403 5D15 DE 4A 3D dec Energy,x 404 5D18 BD 89 3D lda ActiveWeapon,x 405 406 5D1B 20 24 68 jsr Shoot 407 5D1E AD 96 3D lda HitFlag ;0 if missed 408 5D21 F0 4A beq missed 409 5D23 A9 00 lda #0 410 5D25 8D 4C 3F sta FallDown1 411 5D28 8D 4D 3F sta FallDown2 412 5D2B 20 63 5E jsr Explosion 413 414 ;here we clear offensive text (after a shoot) 415 5D2E A4 8B ldy TankNr 416 5D30 A9 00 8D 51 48 mva #0 plot4x4color 417 5D35 20 10 7C jsr DisplayOffensiveTextNr 418 419 420 5D38 AfterExplode 421 ;temporary tanks removal (would fall down with soil) 422 5D38 A5 8B 85 A7 mva TankNr tempor2 423 5D3C A9 01 8D FB 3D mva #1 Erase 424 5D41 20 E2 84 jsr drawtanks 425 5D44 A5 A7 85 8B mva tempor2 TankNr 426 5D48 A9 00 8D FB 3D mva #0 Erase 427 5D4D AD 4D 3F lda FallDown2 428 5D50 F0 03 beq NoFallDown2 429 5D52 20 F7 85 jsr SoilDown2; 430 431 5D55 NoFallDown2 432 ;here tanks are falling down 433 5D55 A5 8B 85 A7 mva tankNr tempor2 434 5D59 A9 00 85 8B mva #0 TankNr 435 436 5D5D TanksFallDown 437 5D5D 20 B8 68 jsr TankFalls 438 5D60 E6 8B A5 8B inc:lda TankNr 439 5D64 CD 19 3D cmp NumberOfPlayers 440 5D67 D0 F4 bne TanksFallDown 441 5D69 A5 A7 85 8B mva tempor2 TankNr 442 5D6D missed 443 444 ;here we clear offensive text (after a shoot) 445 ;shit -- it's second time, but it must be like this 446 5D6D A4 8B ldy TankNr 447 5D6F A9 00 8D 51 48 mva #0 plot4x4color 448 5D74 20 10 7C jsr DisplayOffensiveTextNr 449 450 5D77 20 C4 71 jsr DecreaseWeaponAfterShoot ; or before??? 451 5D7A NextPlayerShoots 452 5D7A A9 01 8D FB 3D mva #1 Erase 453 5D7F 20 E2 84 jsr drawtanks 454 455 ;before it shoots, the eXistenZ table must be 456 ;updated accordingly to actual energy (was forgotten, sorry to ourselves) 457 458 5D82 A2 05 ldx #5 459 5D84 SeteXistenZ 460 5D84 BD 4A 3D lda Energy,x 461 5D87 9D 51 3D sta eXistenZ,x 462 5D8A 8D 8F 3D sta L1 463 464 ;DATA L1,L2 465 ;RESULT WH*256+L1 466 ;Multiplication 8bit*8bit, 467 ;result 16bit 468 ;this algiorithm is a little longer than in Ruszczyc 6502 book 469 ;but it is faster 470 471 5D8D A0 08 LDy #8 472 5D8F A9 00 LDA #0 473 5D91 18 CLC 474 5D92 LP0 475 5D92 6A ror 476 5D93 6E 8F 3D ROR L1 477 5D96 90 03 BCC B0 478 5D98 18 CLC 479 5D99 69 0A ADC #10 ; multiplication by 10 480 5D9B 88 B0 DEy 481 5D9C D0 F4 BNE LP0 482 5D9E 6A ror 483 5D9F 6E 8F 3D ROR L1 484 5DA2 9D 7C 3D STA MaxEnergyTableH,x 485 5DA5 AD 8F 3D lda L1 486 5DA8 9D 76 3D sta MaxEnergyTableL,x 487 488 5DAB CA dex 489 5DAC 10 D6 bpl SeteXistenZ 490 491 ;was setup of maximum energy for players 492 493 5DAE A9 00 8D FB 3D mva #0 Erase 494 5DB3 20 E2 84 jsr drawtanks 495 496 ;inc TankNr 497 ;lda TankNr 498 5DB6 E6 8C A5 8C inc:lda TankSequencePointer 499 5DBA CD 19 3D cmp NumberOfPlayers 500 5DBD D0 04 bne PlayersAgain 501 ;mva 0 TankNr 502 5DBF A9 00 85 8C mva #0 TankSequencePointer 503 504 5DC3 PlayersAgain .proc 505 506 ; In LASTeXistenZ there are values of eXistenZ before shoot 507 ; from the next tank. 508 ; Now it must be checked if by a chance something that had 509 ; LASTeXistenZ>0 is not equal to 0 right now, 510 ; because it means this tank died during this round. 511 ; Most important thing is: 512 ; after each explosion of the tank these operations must be 513 ; performed from the beginning! 514 ; (it is made by another jump into the after explosion routines) 515 ; It is because exploding tank can destroy their neighbours, 516 ; additionally this tank just have had LASTeXistenZ set to 0, 517 ; otherwise it would explode again and again. 518 ; OK, text how to do it is ready, now comes coding . 519 ; Aaaah! - in main loop we have to set eXistenZ and LASTeXistenZ 520 521 5DC3 AE 19 3D ldx NumberOfPlayers 522 5DC6 CA dex 523 5DC7 CheckingPlayersDeath 524 5DC7 BD 57 3D lda LASTeXistenZ,x 525 5DCA F0 05 beq NoPlayerNoDeath 526 5DCC BD 51 3D lda eXistenZ,x 527 5DCF F0 06 beq PlayerXdeath 528 5DD1 NoPlayerNoDeath 529 5DD1 CA dex 530 5DD2 10 F3 bpl CheckingPlayersDeath 531 ; if processor is here it means there are no more explosions 532 5DD4 4C B3 5C jmp MainRoundLoop 533 .endp 534 ;--------------------------------- 535 5DD7 PlayerXdeath .proc 536 ; first we inform that this tank should not explode anymore: 537 ; there is 0 in A, and Tank Number in X, so... 538 539 5DD7 9D 57 3D sta LASTeXistenZ,x 540 ; save x somewhere 541 5DDA 8E DD 44 stx TankTempY 542 543 ; display defensive text here (well, defensive 544 ; is not the real meaning, it should be pre-death, 545 ; but I am too lazy to change names of variables) 546 547 ; in X there is a number of tank that died 548 549 5DDD AD 69 3D lda CurrentResult 550 5DE0 18 clc 551 5DE1 7D 5D 3D adc ResultsTable,x 552 5DE4 9D 5D 3D sta ResultsTable,x 553 5DE7 EE 69 3D inc CurrentResult 554 .endp 555 556 ;RandomizeDeffensiveText 557 5DEA randomize talk.NumberOfOffensiveTexts (talk.NumberOfDeffensiveTexts+talk.NumberOfOffensiveTexts-1) Macro: RANDOMIZE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 5DEA ?rand 4 5DEA AD 0A D2 lda random 5 5DED C9 36 cmp #TALK.NUMBEROFOFFENSIVETEXTS ;floor 6 5DEF 90 F9 bcc ?rand 7 5DF1 C9 72 cmp #(TALK.NUMBEROFDEFFENSIVETEXTS+TALK.NUMBEROFOFFENSIVETEXTS-1)+1 ;ceiling 8 5DF3 B0 F5 bcs ?rand Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 558 5DF5 8D DC 44 sta TextNumberOff 559 5DF8 AC DD 44 ldy TankTempY 560 5DFB A9 01 8D 51 48 mva #1 plot4x4color 561 5E00 20 10 7C jsr DisplayOffensiveTextNr 562 563 5E03 PAUSE 75 Macro: PAUSE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 2 5E03 A2 4B ldx #75 3 5E05 ?PAUSELOOP 3 5E05 AD 0B D4 LDA VCOUNT 4 5E08 8D 0A D4 STA WSYNC 5 5E0B 8D 0A D4 STA WSYNC 6 5E0E 8D 0A D4 STA WSYNC 7 5E11 CD 0B D4 ?WA CMP VCOUNT 8 5E14 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 5 5E16 CA dex 6 5E17 D0 EC bne ?PAUSELOOP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 564 ;Deffensive text cleanup 565 ;here we clear Deffensive text (after a shoot) 566 5E19 AC DD 44 ldy TankTempY 567 5E1C A9 00 8D 51 48 mva #0 plot4x4color 568 5E21 20 10 7C jsr DisplayOffensiveTextNr 569 570 571 ; calculate position of the explosion (the post-death one?) 572 5E24 AE DD 44 ldx TankTempY 573 5E27 18 clc 574 5E28 BD 97 3D lda xtankstableL,x 575 5E2B 69 04 adc #4 ; more or less in the middle of the tank 576 5E2D 85 80 sta xdraw 577 5E2F BD 9D 3D lda xtankstableH,x 578 5E32 69 00 adc #0 579 5E34 85 81 sta xdraw+1 580 5E36 38 sec 581 5E37 BD A3 3D lda ytankstable,x 582 5E3A E9 04 sbc #4 583 5E3C 85 82 sta ydraw 584 5E3E A9 00 lda #0 585 5E40 85 83 sta ydraw+1 ; there is 0 left in A, so... 586 587 ;cleanup of the soil fall down ranges (left and right) 588 5E42 8D FE 3D sta RangeRight 589 5E45 8D FF 3D sta RangeRight+1 590 5E48 8D 4C 3F sta FallDown1 591 5E4B 8D 4D 3F sta FallDown2 592 5E4E A9 40 8D FC 3D A9 + mwa #screenwidth RangeLeft 593 594 595 596 ; We are randomizing the weapon now. 597 ; As we are jumping into the middle of the weapon 598 ; routine we are preparing the number *2 - 599 ; - to make it easier and because we are using only 600 ; first 32 weapons we are doing this with just one AND 601 602 5E58 AD 0A D2 lda random 603 5E5B 29 3E and #$3e ; range (0-31 number multiplied by 2) 604 5E5D 20 7B 5E jsr Explosion2 605 606 ; jump to after explosion routines (soil fallout, etc.) 607 ; After going through these routines we are back 608 ; to checking if a tank exploded and maybe we have 609 ; a deadly shot here again. 610 611 612 5E60 4C 38 5D jmp AfterExplode 613 614 615 ;-------------------------------------------------- 616 5E63 Explosion .proc 617 ;-------------------------------------------------- 618 ;cleanup of the soil fall down ranges (left and right) 619 5E63 A9 40 8D FC 3D A9 + mwa #screenwidth RangeLeft 620 5E6D A9 00 lda #0 621 5E6F 8D FE 3D sta RangeRight 622 5E72 8D FF 3D sta RangeRight+1 623 624 5E75 A6 8B ldx TankNr 625 5E77 BD 89 3D lda ActiveWeapon,x 626 5E7A 0A asl 627 .endp 628 5E7B Explosion2 .proc 629 5E7B AA tax 630 5E7C BD 86 5E lda ExplosionRoutines+1,x 631 5E7F 48 pha 632 5E80 BD 85 5E lda ExplosionRoutines,x 633 5E83 48 pha 634 5E84 60 rts 635 5E85 ExplosionRoutines 636 5E85 C7 5E .word babymissile-1 637 5E87 D5 5E .word missile-1 638 5E89 E3 5E .word babynuke-1 639 5E8B F1 5E .word nuke-1 640 5E8D FF 5E .word leapfrog-1 641 5E8F 82 5F .word funkybomb-1 642 5E91 7E 5F .word mirv-1 643 5E93 26 60 .word deathshead-1 644 5E95 C6 5E .word VOID-1 ;napalm 645 5E97 C6 5E .word VOID-1 ;hotnapalm 646 5E99 96 60 .word tracer-1 647 5E9B C6 5E .word VOID-1 ;smoketracer 648 5E9D 97 60 .word babyroller-1 649 5E9F A2 60 .word roller-1 650 5EA1 AD 60 .word heavyroller-1 651 5EA3 C6 5E .word VOID-1 ;riotcharge 652 5EA5 C6 5E .word VOID-1 ;riotblast 653 5EA7 B8 60 .word riotbomb-1 654 5EA9 C6 60 .word heavyriotbomb-1 655 5EAB D4 60 .word babydigger-1 656 5EAD E9 60 .word digger-1 657 5EAF FE 60 .word heavydigger-1 658 5EB1 07 62 .word babysandhog-1 659 5EB3 1C 62 .word sandhog-1 660 5EB5 31 62 .word heavysandhog-1 661 5EB7 46 62 .word dirtclod-1 662 5EB9 54 62 .word dirtball-1 663 5EBB 62 62 .word tonofdirt-1 664 5EBD C6 5E .word VOID-1 ;liquiddirt 665 5EBF 70 62 .word dirtcharge-1 666 5EC1 C6 5E .word VOID-1 ;earthdisrupter 667 5EC3 C6 5E .word VOID-1 ;plasmablast 668 5EC5 7E 62 .word laser-1 669 670 5EC7 VOID 671 5EC7 60 rts 672 .endp 673 ; ------------------------ 674 675 5EC8 icl 'weapons.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 3 .IF *>0 ;this is a trick that prevents compiling this file alone 4 5 ; ------------------------ 6 5EC8 babymissile 7 5EC8 EE 4D 3F inc FallDown2 8 5ECB A9 0B 8D 49 3F mva #11 ExplosionRadius 9 5ED0 20 44 71 jsr CalculateExplosionRange 10 5ED3 4C 96 63 jmp xmissile 11 ; ------------------------ 12 5ED6 missile ; 13 5ED6 EE 4D 3F inc FallDown2 14 5ED9 A9 11 8D 49 3F mva #17 ExplosionRadius 15 5EDE 20 44 71 jsr CalculateExplosionRange 16 5EE1 4C 96 63 jmp xmissile 17 ; ------------------------ 18 5EE4 babynuke 19 5EE4 EE 4D 3F inc FallDown2 20 5EE7 A9 19 8D 49 3F mva #25 ExplosionRadius 21 5EEC 20 44 71 jsr CalculateExplosionRange 22 5EEF 4C 96 63 jmp xmissile 23 ; ------------------------ 24 5EF2 nuke 25 5EF2 EE 4D 3F inc FallDown2 26 5EF5 A9 1F 8D 49 3F mva #31 ExplosionRadius 27 5EFA 20 44 71 jsr CalculateExplosionRange 28 5EFD 4C 96 63 jmp xmissile 29 ; ------------------------ 30 5F00 leapfrog 31 5F00 EE 4D 3F inc FallDown2 32 5F03 A9 11 8D 49 3F mva #17 ExplosionRadius 33 5F08 20 44 71 jsr CalculateExplosionRange 34 5F0B 20 96 63 jsr xmissile 35 36 ; soil must fall down now! there is no other way... 37 ; hide tanks or they fall down with soil 38 39 5F0E A5 8B lda TankNr 40 5F10 48 pha 41 5F11 A9 01 8D FB 3D mva #1 Erase 42 5F16 20 E2 84 jsr drawtanks 43 5F19 A9 00 8D FB 3D mva #0 Erase 44 5F1E 20 F7 85 jsr SoilDown2 45 5F21 20 E2 84 jsr drawtanks 46 5F24 68 pla 47 5F25 85 8B sta TankNr 48 49 ; it looks like force is divided by 4 here BUT" 50 ; in Flight routine force is multiplied by 2 and left 51 ; so, we have Force divided by 2 here (not accurately) 52 53 5F27 4E 82 3E lsr Force+1 54 5F2A 6E 81 3E ror Force 55 ;lsr Force+1 56 ;ror Force 57 5F2D AD 4E 3F lda LeapFrogAngle 58 5F30 8D 80 3E sta Angle 59 5F33 20 75 6A jsr Flight 60 5F36 AD 96 3D lda HitFlag 61 5F39 F0 43 beq EndOfLeapping 62 5F3B A9 0F 8D 49 3F mva #15 ExplosionRadius 63 5F40 20 2D 71 jsr CalculateExplosionRange0 64 5F43 20 96 63 jsr xmissile 65 66 ; soil must fall down now! there is no other way... 67 ; hide tanks or they fall down with soil 68 5F46 A5 8B lda TankNr 69 5F48 48 pha 70 5F49 A9 01 8D FB 3D mva #1 Erase 71 5F4E 20 E2 84 jsr drawtanks 72 5F51 A9 00 8D FB 3D mva #0 Erase 73 5F56 20 F7 85 jsr SoilDown2 74 5F59 20 E2 84 jsr drawtanks 75 5F5C 68 pla 76 5F5D 85 8B sta TankNr 77 78 ; it looks like force is divided by 4 here BUT" 79 ; in Flight routine force is multiplied by 2 and left 80 ; so, we have Force divided by 2 here (not accurately) 81 ;lsr Force+1 82 ;ror Force 83 5F5F 4E 82 3E lsr Force+1 84 5F62 6E 81 3E ror Force 85 5F65 AD 4E 3F lda LeapFrogAngle 86 5F68 8D 80 3E sta Angle 87 5F6B 20 75 6A jsr Flight 88 5F6E AD 96 3D lda HitFlag 89 5F71 F0 0B beq EndOfLeapping 90 5F73 A9 0D 8D 49 3F mva #13 ExplosionRadius 91 5F78 20 2D 71 jsr CalculateExplosionRange0 92 5F7B 4C 96 63 jmp xmissile 93 5F7E EndOfLeapping 94 5F7E 60 rts 95 ; ------------------------ 96 5F7F mirv ; the whole mirv is performed by Flight routine 97 5F7F EE 4D 3F inc FallDown2 98 5F82 60 rts 99 ; ------------------------ 100 5F83 funkybomb ; 101 5F83 A9 01 8D A9 3E mva #1 tracerflag 102 5F88 AD 75 3E 8D A5 3E + mwa xtraj+1 xtrajfb 103 5F94 AD 78 3E 8D A7 3E + mwa ytraj+1 ytrajfb 104 5FA0 EE 4D 3F inc FallDown2 105 ;central Explosion 106 5FA3 A9 15 8D 49 3F mva #21 ExplosionRadius 107 5FA8 20 2D 71 jsr CalculateExplosionRange0 108 5FAB 20 96 63 jsr xmissile 109 110 5FAE A5 8B lda TankNr 111 5FB0 48 pha 112 5FB1 A9 01 8D FB 3D mva #1 Erase 113 5FB6 20 E2 84 jsr drawtanks 114 5FB9 A9 00 8D FB 3D mva #0 Erase 115 116 5FBE 20 F7 85 jsr SoilDown2 117 ; 118 5FC1 A9 01 8D FB 3D mva #1 Erase 119 5FC6 20 E2 84 jsr drawtanks 120 5FC9 A9 00 8D FB 3D mva #0 Erase 121 5FCE 68 pla 122 5FCF 85 8B sta TankNr 123 124 5FD1 A9 05 8D A4 3E mva #5 FunkyBombCounter 125 5FD6 FunkyBombLoop 126 ;force randomization (range: 256-511) 127 5FD6 AD 0A D2 lda random 128 5FD9 8D 81 3E sta Force 129 5FDC A9 01 lda #1 130 5FDE 8D 82 3E sta Force+1 131 ;Angle randomization Range: (-16..+16) 132 5FE1 AD 0A D2 lda random 133 5FE4 4A lsr 134 5FE5 29 1F and #%00011111 135 5FE7 90 02 bcc DoNotEor 136 5FE9 49 FF eor #$ff 137 5FEB DoNotEor 138 5FEB 8D 80 3E sta Angle 139 140 5FEE A9 00 lda #0 141 5FF0 8D 74 3E sta xtraj 142 5FF3 8D 77 3E sta ytraj 143 5FF6 AD A5 3E 8D 75 3E + mwa xtrajfb xtraj+1 144 6002 AD A7 3E 8D 78 3E + mwa ytrajfb ytraj+1 145 600E 20 75 6A jsr Flight 146 147 6011 AD 96 3D lda HitFlag 148 6014 F0 06 beq NoExplosionInFunkyBomb 149 6016 20 44 71 jsr CalculateExplosionRange 150 6019 20 96 63 jsr xmissile 151 601C NoExplosionInFunkyBomb 152 601C CE A4 3E dec FunkyBombCounter 153 601F D0 B5 bne FunkyBombLoop 154 6021 A9 00 8D A9 3E mva #0 tracerflag 155 6026 60 rts 156 ; ------------------------ 157 6027 deathshead 158 6027 EE 4D 3F inc FallDown2 159 602A A9 1F 8D 49 3F mva #31 ExplosionRadius 160 602F 20 44 71 jsr CalculateExplosionRange 161 6032 20 96 63 jsr xmissile 162 6035 38 A5 80 E9 23 85 + sbw xdraw #35 163 6040 20 44 71 jsr CalculateExplosionRange 164 6043 20 96 63 jsr xmissile 165 6046 18 A5 80 69 46 85 + adw xdraw #70 166 6051 20 44 71 jsr CalculateExplosionRange 167 6054 20 96 63 jsr xmissile 168 6057 38 A5 80 E9 23 85 + sbw xdraw #35 169 ; 170 6062 38 A5 82 E9 23 85 + sbw ydraw #35 171 ;jsr CalculateExplosionRange 172 606D A5 83 C9 00 D0 04 + cpw ydraw #screenHeight 173 6077 B0 03 bcs NoUpperCircle 174 6079 20 96 63 jsr xmissile 175 607C NoUpperCircle 176 607C 18 A5 82 69 46 85 + adw ydraw #70 177 ;jsr CalculateExplosionRange 178 6087 A5 83 C9 00 D0 04 + cpw ydraw #screenHeight 179 6091 B0 03 bcs NoLowerCircle 180 6093 20 96 63 jsr xmissile 181 6096 NoLowerCircle 182 6096 60 rts 183 ; ------------------------ 184 6097 tracer 185 6097 60 rts 186 ; ------------------------ 187 6098 babyroller 188 6098 EE 4D 3F inc FallDown2 189 609B A9 0B 8D 49 3F mva #11 ExplosionRadius 190 60A0 4C 64 64 jmp xroller 191 ; ------------------------ 192 60A3 roller ; 193 60A3 EE 4D 3F inc FallDown2 194 60A6 A9 15 8D 49 3F mva #21 ExplosionRadius 195 60AB 4C 64 64 jmp xroller 196 ; ------------------------ 197 60AE heavyroller 198 60AE EE 4D 3F inc FallDown2 199 60B1 A9 1F 8D 49 3F mva #31 ExplosionRadius 200 60B6 4C 64 64 jmp xroller 201 ; ------------------------ 202 60B9 riotbomb 203 60B9 EE 4D 3F inc FallDown2 204 60BC A9 11 8D 49 3F mva #17 ExplosionRadius 205 60C1 20 44 71 jsr CalculateExplosionRange 206 60C4 4C 48 64 jmp xriotbomb 207 ; ------------------------ 208 60C7 heavyriotbomb 209 60C7 EE 4D 3F inc FallDown2 210 60CA A9 1D 8D 49 3F mva #29 ExplosionRadius 211 60CF 20 44 71 jsr CalculateExplosionRange 212 60D2 4C 48 64 jmp xriotbomb 213 ; ------------------------ 214 60D5 babydigger 215 60D5 A9 00 8D 2C 3E mva #0 sandhogflag 216 60DA EE 4D 3F inc FallDown2 217 60DD A9 0D 8D 0B 3E mva #13 DigLong 218 60E2 A9 01 8D 0A 3E mva #1 diggery ; how many branches (-1) 219 60E7 4C 14 61 jmp xdigger 220 ; ------------------------ 221 60EA digger ; 222 60EA A9 00 8D 2C 3E mva #0 sandhogflag 223 60EF EE 4D 3F inc FallDown2 224 60F2 A9 0D 8D 0B 3E mva #13 DigLong 225 60F7 A9 03 8D 0A 3E mva #3 diggery ; how many branches (-1) 226 60FC 4C 14 61 jmp xdigger 227 ; ------------------------ 228 60FF heavydigger 229 60FF A9 00 8D 2C 3E mva #0 sandhogflag 230 6104 EE 4D 3F inc FallDown2 231 6107 A9 0D 8D 0B 3E mva #13 DigLong 232 610C A9 07 8D 0A 3E mva #7 diggery ; how many branches (-1) 233 6111 4C 14 61 jmp xdigger 234 ; ------------------------ 235 6114 xdigger 236 6114 A5 80 8D 06 3E A5 + mwa xdraw digstartx 237 611E A5 82 8D 08 3E A5 + mwa ydraw digstarty 238 6128 AE 0A 3E ldx diggery 239 612B WriteToBranches 240 612B A5 80 lda xdraw 241 612D 9D 0C 3E sta digtabxL,x 242 6130 A5 81 lda xdraw+1 243 6132 9D 14 3E sta digtabxH,x 244 6135 A5 82 lda ydraw 245 6137 9D 1C 3E sta digtabyL,x 246 613A A5 83 lda ydraw+1 247 613C 9D 24 3E sta digtabyH,x 248 613F CA dex 249 6140 10 E9 bpl WriteToBranches 250 6142 20 EB 61 jsr DiggerCharacter ; start character 251 252 6145 18 A5 80 69 04 85 + adw xdraw #4 253 6150 AD 0B 3E lda DigLong 254 ; looks strange, but it is (DigLong+2)*4 255 6153 18 clc 256 6154 69 02 adc #$2 257 6156 0A asl 258 6157 0A asl 259 6158 8D 49 3F sta ExplosionRadius 260 615B 20 44 71 jsr CalculateExplosionRange 261 615E BranchNotFinished 262 615E AE 0A 3E ldx diggery 263 6161 CalculateBranches 264 6161 8A txa 265 6162 29 01 and #$01 266 6164 D0 14 bne DigRight 267 6166 diglewy ; even branches go left 268 6166 38 sec 269 6167 BD 0C 3E lda digtabxL,x 270 616A E9 04 sbc #$04 271 616C 9D 0C 3E sta digtabxL,x 272 616F BD 14 3E lda digtabxH,x 273 6172 E9 00 sbc #$00 274 6174 9D 14 3E sta digtabxH,x 275 6177 4C 8B 61 jmp DigRandomize 276 617A DigRight ; odd go right (everytime 4 pixels) 277 617A 18 clc 278 617B BD 0C 3E lda digtabxL,x 279 617E 69 04 adc #$04 280 6180 9D 0C 3E sta digtabxL,x 281 6183 BD 14 3E lda digtabxH,x 282 6186 69 00 adc #$00 283 6188 9D 14 3E sta digtabxH,x 284 618B DigRandomize 285 618B AD 0A D2 lda random 286 618E 29 87 and #$87 287 6190 30 14 bmi DigUp 288 6192 digwdol 289 6192 29 07 and #$07 290 6194 18 clc 291 6195 7D 1C 3E adc digtabyL,x 292 6198 9D 1C 3E sta digtabyL,x 293 619B BD 24 3E lda digtabyH,x 294 619E 69 00 adc #$00 295 61A0 9D 24 3E sta digtabyH,x 296 61A3 4C BB 61 jmp DigCalculateNext 297 61A6 DigUp 298 61A6 29 07 and #$07 299 61A8 85 91 sta temp 300 61AA 38 sec 301 61AB BD 1C 3E lda digtabyL,x 302 61AE E5 91 sbc temp 303 61B0 9D 1C 3E sta digtabyL,x 304 61B3 BD 24 3E lda digtabyH,x 305 61B6 E9 00 sbc #$00 306 61B8 9D 24 3E sta digtabyH,x 307 61BB DigCalculateNext 308 61BB CA dex 309 61BC 10 A3 bpl CalculateBranches 310 ; here we draw... 311 61BE AE 0A 3E ldx diggery 312 61C1 DigDrawing 313 61C1 BD 0C 3E lda digtabxL,x 314 61C4 85 80 sta xdraw 315 61C6 BD 14 3E lda digtabxH,x 316 61C9 85 81 sta xdraw+1 317 61CB BD 1C 3E lda digtabyL,x 318 61CE 85 82 sta ydraw 319 61D0 BD 24 3E lda digtabyH,x 320 61D3 85 83 sta ydraw+1 321 61D5 phx Macro: PHX [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 61D5 8A txa 2 61D6 48 pha Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 322 61D7 20 EB 61 jsr DiggerCharacter 323 61DA plx Macro: PLX [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 61DA 68 pla 2 61DB AA tax Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 324 61DC CA dex 325 61DD 10 E2 bpl DigDrawing 326 61DF CE 0B 3E AD 0B 3E dec:lda DigLong 327 61E5 30 03 4C 5E 61 jpl BranchNotFinished 328 61EA 60 rts 329 61EB DiggerCharacter 330 61EB AD 0A D2 lda random 331 61EE 29 06 and #$06 332 61F0 18 clc 333 61F1 69 36 adc #$36 334 61F3 6D 2C 3E adc sandhogflag 335 61F6 85 88 sta CharCode 336 61F8 A5 81 C9 01 D0 04 + cpw xdraw #(screenwidth-6) 337 6202 B0 03 bcs DoNotPutDig 338 6204 4C FE 89 jmp TypeChar 339 6207 DoNotPutDig 340 6207 60 rts 341 ; ------------------------ 342 6208 babysandhog 343 6208 A9 08 8D 2C 3E mva #8 sandhogflag 344 620D EE 4D 3F inc FallDown2 345 6210 A9 0D 8D 0B 3E mva #13 DigLong 346 6215 A9 01 8D 0A 3E mva #1 diggery ; how many branches (-1) 347 621A 4C 14 61 jmp xdigger 348 ; ------------------------ 349 621D sandhog 350 621D A9 08 8D 2C 3E mva #8 sandhogflag 351 6222 EE 4D 3F inc FallDown2 352 6225 A9 0D 8D 0B 3E mva #13 DigLong 353 622A A9 03 8D 0A 3E mva #3 diggery ; how many branches (-1) 354 622F 4C 14 61 jmp xdigger 355 ; ------------------------ 356 6232 heavysandhog 357 6232 A9 08 8D 2C 3E mva #8 sandhogflag 358 6237 EE 4D 3F inc FallDown2 359 623A A9 0D 8D 0B 3E mva #13 DigLong 360 623F A9 05 8D 0A 3E mva #5 diggery ; how many branches (-1) 361 6244 4C 14 61 jmp xdigger 362 ; ------------------------ 363 6247 dirtclod 364 6247 EE 4D 3F inc FallDown2 365 624A A9 0C 8D 49 3F mva #12 ExplosionRadius 366 624F 20 44 71 jsr CalculateExplosionRange 367 6252 4C 2A 64 jmp xdirt 368 ; ------------------------ 369 6255 dirtball 370 6255 EE 4D 3F inc FallDown2 371 6258 A9 16 8D 49 3F mva #22 ExplosionRadius 372 625D 20 44 71 jsr CalculateExplosionRange 373 6260 4C 2A 64 jmp xdirt 374 ; ------------------------ 375 6263 tonofdirt 376 6263 EE 4D 3F inc FallDown2 377 6266 A9 1F 8D 49 3F mva #31 ExplosionRadius 378 626B 20 44 71 jsr CalculateExplosionRange 379 626E 4C 2A 64 jmp xdirt 380 ; ------------------------ 381 6271 dirtcharge 382 6271 EE 4D 3F inc FallDown2 383 6274 A9 3D 8D 49 3F mva #61 ExplosionRadius 384 6279 20 44 71 jsr CalculateExplosionRange 385 627C 4C 0D 66 jmp ofdirt 386 ; ------------------------ 387 627F laser 388 627F A6 8B ldx TankNr 389 6281 BD 82 3D lda AngleTable,x 390 6284 A8 tay 391 6285 18 clc 392 6286 BD 97 3D lda xtankstableL,x 393 6289 79 69 49 adc EndOfTheBarrelX,y ; correction of the end of the barrel point 394 628C 85 84 sta xbyte 395 628E BD 9D 3D lda xtankstableH,x 396 6291 69 00 adc #0 397 6293 85 85 sta xbyte+1 398 6295 38 sec 399 6296 BD A3 3D lda ytankstable,x 400 6299 F9 69 4A sbc EndOfTheBarrelY,y 401 629C 85 86 sta ybyte 402 629E A9 00 85 87 mva #0 ybyte+1 403 62A2 A9 56 8D 2F 3E A9 + mwa #Drawplot DrawJumpAddr 404 62AC A5 80 8D 4F 3F A5 + mwa xdraw LaserCoordinate 405 62B6 A5 82 8D 51 3F A5 + mwa ydraw LaserCoordinate+2 406 62C0 A5 84 8D 53 3F A5 + mwa xbyte LaserCoordinate+4 407 62CA A5 86 8D 55 3F A5 + mwa ybyte LaserCoordinate+6 408 409 62D4 20 6A 80 jsr draw 410 62D7 A9 00 8D CA 3E mva #0 color 411 62DC AD 4F 3F 85 80 AD + mwa LaserCoordinate xdraw 412 62E6 AD 51 3F 85 82 AD + mwa LaserCoordinate+2 ydraw 413 62F0 AD 53 3F 85 84 AD + mwa LaserCoordinate+4 xbyte 414 62FA AD 55 3F 85 86 AD + mwa LaserCoordinate+6 ybyte 415 6304 20 6A 80 jsr draw 416 6307 A9 01 8D CA 3E mva #1 color 417 630C AD 4F 3F 85 80 AD + mwa LaserCoordinate xdraw 418 6316 AD 51 3F 85 82 AD + mwa LaserCoordinate+2 ydraw 419 6320 AD 53 3F 85 84 AD + mwa LaserCoordinate+4 xbyte 420 632A AD 55 3F 85 86 AD + mwa LaserCoordinate+6 ybyte 421 6334 20 6A 80 jsr draw 422 6337 A9 00 8D CA 3E mva #0 color 423 633C AD 4F 3F 85 80 AD + mwa LaserCoordinate xdraw 424 6346 AD 51 3F 85 82 AD + mwa LaserCoordinate+2 ydraw 425 6350 AD 53 3F 85 84 AD + mwa LaserCoordinate+4 xbyte 426 635A AD 55 3F 85 86 AD + mwa LaserCoordinate+6 ybyte 427 6364 20 6A 80 jsr draw 428 6367 A9 01 8D CA 3E mva #1 color 429 636C AD 4F 3F 85 80 AD + mwa LaserCoordinate xdraw 430 6376 AD 51 3F 85 82 AD + mwa LaserCoordinate+2 ydraw 431 6380 20 0C 89 jsr plot 432 6383 A9 00 8D 96 3D mva #0 HitFlag 433 6388 20 D4 70 jsr CheckCollisionWithTank 434 638B AD 96 3D lda HitFlag 435 638E F0 05 beq LaserMisses 436 ; here we hit a tank (X) 437 6390 A0 64 ldy #100 438 6392 20 F5 71 jsr DecreaseEnergyX 439 6395 LaserMisses 440 6395 60 rts 441 442 ; ----------------- 443 6396 xmissile ; 444 ; ----------------- 445 6396 A9 01 lda #1 446 6398 8D 38 3E sta radius 447 639B 8D CA 3E sta color 448 ;ora ExplosionRadius ;making sure the ExplosionRadius is odd 449 ;sta ExplosionRadius 450 639E ExplosionLoop 451 639E 20 BB 82 jsr circle 452 63A1 E6 82 inc ydraw 453 63A3 20 BB 82 jsr circle 454 63A6 C6 82 dec ydraw 455 63A8 EE 38 3E EE 38 3E inc:inc radius 456 63AE AD 38 3E lda radius 457 63B1 CD 49 3F cmp ExplosionRadius 458 63B4 D0 E8 bne ExplosionLoop 459 63B6 A9 00 lda #0 460 63B8 8D CA 3E sta color 461 63BB ExplosionLoop2 462 63BB 20 BB 82 jsr circle 463 63BE E6 82 inc ydraw 464 63C0 20 BB 82 jsr circle 465 63C3 C6 82 dec ydraw 466 63C5 CE 38 3E dec radius 467 63C8 AD 38 3E lda radius 468 63CB D0 EE bne ExplosionLoop2 469 63CD A9 01 lda #1 470 63CF 8D CA 3E sta color 471 472 ;check tanks' distance from the centre of the explosion 473 474 63D2 A9 59 8D 2F 3E A9 + mwa #DrawLen DrawJumpAddr 475 ;the above switches Draw to measuring length 476 ;trick is easy - how many pixels does it take to draw 477 ;a line from one point to another 478 ;it must be somehow easier than regular Pitagoras 479 ;calculation 480 481 63DC AE 19 3D ldx NumberOfPlayers 482 63DF DistanceCheckLoop 483 63DF CA dex 484 63E0 BD 51 3D lda eXistenZ,x 485 63E3 F0 41 beq EndOfDistanceCheckLoop 486 ;here the tank exist 487 63E5 BD 97 3D lda XtankstableL,x 488 63E8 18 clc 489 63E9 69 03 adc #3 ;measure from middle of the tank 490 63EB 85 84 sta xbyte 491 63ED BD 9D 3D lda XtankstableH,x 492 63F0 18 clc 493 63F1 69 00 adc #0 ;measure from middle of the tank 494 63F3 85 85 sta xbyte+1 495 63F5 BD A3 3D lda Ytankstable,x 496 63F8 38 sec 497 63F9 E9 02 sbc #2 ;measure from middle of the tank 498 63FB 85 86 sta ybyte 499 63FD A9 00 lda #0 500 63FF 85 87 sta ybyte+1 501 6401 phx Macro: PHX [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 6401 8A txa 2 6402 48 pha Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 502 6403 20 6A 80 jsr draw 503 6406 plx Macro: PLX [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 6406 68 pla 2 6407 AA tax Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 504 ;if tank within range of the explosion? 505 6408 AD 37 3E lda LineLength+1 506 640B D0 19 bne TankIsNotWithinTheRange 507 640D AD 36 3E lda LineLength 508 6410 CD 49 3F cmp ExplosionRadius 509 6413 B0 11 bcs TankIsNotWithinTheRange 510 6415 AD 49 3F lda ExplosionRadius 511 6418 38 sec 512 6419 ED 36 3E sbc LineLength 513 ;multiply difference by 8 514 641C 18 clc 515 641D 69 01 adc #1 516 641F 0A asl 517 6420 0A asl 518 6421 0A asl 519 6422 A8 tay 520 6423 20 F5 71 jsr DecreaseEnergyX 521 522 6426 TankIsNotWithinTheRange 523 6426 EndOfDistanceCheckLoop 524 6426 8A txa 525 6427 D0 B6 bne DistanceCheckLoop 526 6429 60 rts 527 ; ----------------- 528 642A xdirt ; 529 ; ----------------- 530 642A A9 01 lda #1 531 642C 8D 38 3E sta radius 532 642F 8D CA 3E sta color 533 6432 dirtLoop 534 6432 20 BB 82 jsr circle 535 6435 E6 82 inc ydraw 536 6437 20 BB 82 jsr circle 537 643A C6 82 dec ydraw 538 643C EE 38 3E inc radius 539 643F AD 38 3E lda radius 540 6442 CD 49 3F cmp ExplosionRadius 541 6445 D0 EB bne dirtLoop 542 6447 60 rts 543 ; ----------------- 544 6448 xriotbomb ; 545 ; ----------------- 546 6448 A9 00 lda #0 547 644A 8D 38 3E sta radius 548 644D 8D CA 3E sta color 549 6450 rbombLoop 550 6450 20 BB 82 jsr circle 551 6453 EE 38 3E inc radius 552 6456 AD 38 3E lda radius 553 6459 CD 49 3F cmp ExplosionRadius 554 645C D0 F2 bne rbombLoop 555 645E A9 01 8D CA 3E mva #1 color 556 6463 60 rts 557 558 ; ---------------- 559 560 6464 xroller ; 561 ; now collisions are detected with modified draw routine 562 ; therefore YDRAW value must be taken from mountaintable 563 6464 A0 00 ldy #0 564 6466 A9 13 85 95 A9 41 + mwa #mountaintable tempXROLLER 565 566 646E 18 A5 95 65 80 85 + adw tempXROLLER xdraw 567 647B B1 95 lda (tempXROLLER),y 568 647D 85 82 sta ydraw 569 570 647F AD 6F 3E lda vx+3 571 ; if horizontal velocity is negative then change the direction 572 6482 10 08 bpl PositiveVelocity 573 6484 AD 8C 3E lda goleft 574 6487 09 01 ora #$01 575 6489 8D 8C 3E sta goleft 576 648C PositiveVelocity 577 ; first we look for the left slope 578 ; then righ slope and set the flag 579 ; $FF - we are in a hole (flighting in missile direction) 580 ; 1 - right, 2 - left 581 648C A9 FF 8D 04 3E mva #$ff HowMuchToFall 582 6491 A5 82 8D 05 3E mva ydraw HeightRol 583 6496 A9 13 85 95 A9 41 + mwa #mountaintable tempXROLLER 584 585 649E 18 A5 95 65 80 85 + adw tempXROLLER xdraw 586 64AB SeekLeft 587 64AB 38 A5 95 E9 01 85 + sbw tempXROLLER #1 588 64B6 B1 95 lda (tempXROLLER),y ;fukk! beware of Y value 589 64B8 CD 05 3E cmp HeightRol 590 64BB D0 0C bne HowMuchToFallLeft 591 64BD A5 95 lda tempXROLLER 592 64BF C9 13 cmp #mountaintable 596 64C7 F0 07 beq GoRightNow 597 64C9 HowMuchToFallLeft 598 64C9 B0 05 bcs GoRightNow 599 64CB A9 01 8D 04 3E mva #1 HowMuchToFall 600 64D0 GoRightNow 601 64D0 A9 13 85 95 A9 41 + mwa #mountaintable tempXROLLER 602 64D8 18 A5 95 65 80 85 + adw tempXROLLER xdraw 603 64E5 SeekRight 604 64E5 18 A5 95 69 01 85 + adw tempXROLLER #1 605 64F0 B1 95 lda (tempXROLLER),y 606 64F2 CD 05 3E cmp HeightRol 607 64F5 D0 0C bne HowMuchToFallRight 608 64F7 A5 95 lda tempXROLLER 609 64F9 C9 53 cmp #<(mountaintable+screenwidth) 610 64FB D0 E8 bne SeekRight 611 64FD A5 96 lda tempXROLLER+1 612 64FF C9 42 cmp #>(mountaintable+screenwidth) 613 6501 F0 13 beq HowMuchToFallKnown 614 6503 HowMuchToFallRight 615 ; check if up or down 616 6503 B0 11 bcs HowMuchToFallKnown 617 6505 AD 04 3E lda HowMuchToFall 618 6508 10 07 bpl ItIsLeftAlready 619 650A A9 02 8D 04 3E mva #2 HowMuchToFall 620 650F D0 05 bne HowMuchToFallKnown 621 6511 ItIsLeftAlready 622 6511 A9 FF 8D 04 3E mva #$ff HowMuchToFall 623 6516 HowMuchToFallKnown 624 6516 AD 04 3E lda HowMuchToFall 625 6519 10 09 bpl Rollin 626 651B A9 01 lda #1 627 651D 18 clc 628 651E 6D 8C 3E adc goleft 629 6521 8D 04 3E sta HowMuchToFall 630 6524 Rollin 631 6524 18 A5 80 69 13 85 + adw xdraw #mountaintable tempXROLLER 632 6531 A0 00 ldy #0 633 6533 B1 95 lda (tempXROLLER),y 634 6535 8D 05 3E sta HeightRol ; relative point 635 636 6538 RollinContinues 637 6538 wait Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 6538 AD 0B D4 LDA VCOUNT 4 653B 8D 0A D4 STA WSYNC 5 653E 8D 0A D4 STA WSYNC 6 6541 8D 0A D4 STA WSYNC 7 6544 CD 0B D4 ?WA CMP VCOUNT 8 6547 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 638 6549 wait Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 6549 AD 0B D4 LDA VCOUNT 4 654C 8D 0A D4 STA WSYNC 5 654F 8D 0A D4 STA WSYNC 6 6552 8D 0A D4 STA WSYNC 7 6555 CD 0B D4 ?WA CMP VCOUNT 8 6558 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 639 ; new point is set 640 655A 18 A5 80 69 13 85 + adw xdraw #mountaintable tempXROLLER 641 6567 A0 00 ldy #0 642 6569 B1 95 lda (tempXROLLER),y 643 656B 85 82 sta ydraw 644 656D F0 6C beq ExplodeNow 645 656F CD 05 3E cmp HeightRol 646 6572 F0 02 beq UpNotYet 647 6574 90 65 bcc ExplodeNow 648 6576 UpNotYet 649 6576 38 sec ;clc 650 6577 8D 05 3E sta HeightRol 651 657A E9 01 sbc #1 652 657C 85 82 sta ydraw 653 ;check tank collision prior to PLOT 654 657E 8C 96 3D sty HitFlag 655 656 6581 A5 80 8D 75 3E A5 + mwa xdraw xtraj+1 657 658B A5 82 8D 78 3E A5 + mwa ydraw ytraj+1 658 6595 20 D4 70 jsr CheckCollisionWithTank 659 660 6598 AD 96 3D lda HitFlag 661 659B D0 3E bne ExplodeNow 662 659D 20 46 88 jsr unPlot 663 ; let's go the right direction 664 65A0 AD 04 3E lda HowMuchToFall 665 65A3 C9 01 cmp #1 666 65A5 F0 18 beq HowMuchToFallRight2 667 65A7 38 A5 80 E9 01 85 + sbw xdraw #1 668 65B2 A5 80 lda xdraw 669 65B4 D0 82 bne RollinContinues 670 65B6 A5 81 lda xdraw+1 671 65B8 F0 03 4C 38 65 jne RollinContinues 672 65BD F0 1C beq ExplodeNow 673 65BF HowMuchToFallRight2 674 65BF 18 A5 80 69 01 85 + adw xdraw #1 675 65CA A5 81 CD 41 01 D0 + cpw xdraw screenwidth 676 65D6 F0 03 4C 38 65 jne RollinContinues 677 65DB ExplodeNow 678 65DB A5 80 8D 39 3E A5 + mwa xdraw xcircle ; we must store somewhere (BAD) 679 65E5 A5 82 8D 3B 3E mva ydraw ycircle ; xdraw and ydraw (BAD) 680 65EA A9 00 85 80 85 81 mwa #0 xdraw 681 65F0 A9 C7 85 82 mva #screenheight-1 ydraw 682 65F4 20 46 88 jsr unPlot 683 65F7 AD 39 3E 85 80 AD + mwa xcircle xdraw ;(bad) 684 6601 AD 3B 3E 85 82 mva ycircle ydraw ;(bad) 685 686 ; finally a little explosion 687 6606 20 44 71 jsr CalculateExplosionRange 688 6609 4C 96 63 jmp xmissile 689 660C 60 rts 690 ; -------------------------------------------------- 691 660D ofdirt ; 692 ; -------------------------------------------------- 693 ; makes dirt on xdraw,ydraw position and of ExplosionRadius height 694 660D A5 80 8D 39 3E A5 + mwa xdraw xcircle 695 6617 A5 82 8D 3B 3E mva ydraw ycircle 696 661C A9 01 lda #1 697 ; current dirt width 698 661E 8D 2D 3E sta magic 699 6621 8D CA 3E sta color 700 6624 NextRow 701 6624 wait Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 6624 AD 0B D4 LDA VCOUNT 4 6627 8D 0A D4 STA WSYNC 5 662A 8D 0A D4 STA WSYNC 6 662D 8D 0A D4 STA WSYNC 7 6630 CD 0B D4 ?WA CMP VCOUNT 8 6633 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 702 6635 AC 2D 3E ldy magic 703 6638 NextLine 704 6638 AD 0A D2 lda random 705 663B 29 01 and #$01 706 663D F0 09 beq DoNotPlot 707 663F 8C 2E 3E sty magic+1 708 6642 20 0C 89 jsr plot 709 6645 AC 2E 3E ldy magic+1 710 6648 DoNotPlot 711 6648 18 A5 80 69 01 85 + adw xdraw #1 712 6653 88 dey 713 6654 D0 E2 bne NextLine 714 6656 C6 82 dec ydraw ; 1 line up 715 6658 A5 82 lda ydraw 716 665A C9 FF cmp #$ff 717 665C F0 24 beq EndOfTheDirt ;if horizontal Counter wraps 718 665E EE 2D 3E inc magic ; width+2 719 6661 EE 2D 3E inc magic 720 6664 AD 2D 3E lda magic 721 6667 8D 2E 3E sta magic+1 ; just for a second 722 666A 4E 2E 3E lsr magic+1 723 666D 38 sec 724 666E AD 39 3E lda xcircle 725 6671 ED 2E 3E sbc magic+1 726 6674 85 80 sta xdraw 727 6676 AD 3A 3E lda xcircle+1 728 6679 E9 00 sbc #0 729 667B 85 81 sta xdraw+1 ; new starting coordinate in a given row 730 667D CE 49 3F dec ExplosionRadius 731 6680 D0 A2 bne NextRow 732 6682 EndOfTheDirt 733 6682 AD 39 3E 85 80 AD + mwa xcircle xdraw 734 668C AD 3B 3E 85 82 mva ycircle ydraw 735 6691 60 rts 736 ;-------------------------------------------------- 737 6692 BeforeFire .proc ;TankNr (byte) 738 ;-------------------------------------------------- 739 ;this nice routine makes the whole shooting 740 ;preparation: aiming and displaying 741 ;angle and shooting force values 742 ; 743 744 ;first, get current parameters (angle+force) 745 ;for an active tank and display them 746 ;(these values are taken from the previous round) 747 748 6692 A6 8B ldx TankNr 749 750 ;Checking the maximal force 751 6694 BD 7C 3D lda MaxEnergyTableH,x 752 6697 DD 70 3D cmp EnergyTableH,x 753 669A D0 06 bne ContinueToCheckMaxForce2 754 669C BD 76 3D lda MaxEnergyTableL,x 755 669F DD 6A 3D cmp EnergyTableL,x 756 66A2 ContinueToCheckMaxForce2 757 66A2 B0 0C bcs skip15 758 759 66A4 BD 7C 3D lda MaxEnergyTableH,x 760 66A7 9D 70 3D sta EnergyTableH,x 761 66AA BD 76 3D lda MaxEnergyTableL,x 762 66AD 9D 6A 3D sta EnergyTableL,x 763 764 66B0 skip15 765 66B0 20 4B 7F jsr DisplayingSymbols ;all digital values like force, angle, wind, etc. 766 66B3 20 55 80 jsr PutTankNameOnScreen 767 768 66B6 20 F9 84 jsr DrawTankNr 769 770 66B9 wait ; best after drawing a tank Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 66B9 AD 0B D4 LDA VCOUNT 4 66BC 8D 0A D4 STA WSYNC 5 66BF 8D 0A D4 STA WSYNC 6 66C2 8D 0A D4 STA WSYNC 7 66C5 CD 0B D4 ?WA CMP VCOUNT 8 66C8 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 771 ;wait 772 773 774 ;keyboard reading 775 ; KBCODE keeps code of last keybi 776 ; SKSTAT $ff - nothing pressed 777 ; $FB - any key 778 ; $f7 - shift 779 ; $f3 - shift+key 780 781 66CA notpressed 782 66CA AD 0F D2 lda SKSTAT 783 66CD C9 FF cmp #$ff 784 66CF F0 47 beq checkJoy 785 66D1 C9 F7 cmp #$f7 786 66D3 F0 43 beq checkJoy 787 788 66D5 AD 09 D2 lda kbcode 789 66D8 29 BF and #$Bf 790 66DA C9 8E cmp #$8e 791 66DC D0 03 4C 61 67 jeq CTRLPressedUp 792 66E1 C9 8F cmp #$8f 793 66E3 D0 03 4C 90 67 jeq CTRLPressedDown 794 66E8 C9 AC cmp #$ac 795 66EA D0 03 4C 09 68 jeq CTRLPressedTAB 796 797 66EF 29 3F and #$3f ;CTRL and SHIFT ellimination 798 66F1 jumpFromStick 799 66F1 C9 0E cmp #$e 800 66F3 F0 40 jeq pressedUp 801 66F5 C9 0F cmp #$f 802 66F7 F0 7B jeq pressedDown 803 66F9 C9 06 cmp #$6 804 66FB D0 03 4C A8 67 jeq pressedLeft 805 6700 C9 07 cmp #$7 806 6702 D0 03 4C CA 67 jeq pressedRight 807 6707 C9 21 cmp #$21 808 6709 D0 03 4C 23 68 jeq pressedSpace 809 670E C9 2C cmp #$2c 810 6710 D0 03 4C EA 67 jeq pressedTAB 811 6715 4C CA 66 jmp notpressed 812 6718 checkJoy 813 ;------------JOY------------- 814 ;happy happy joy joy 815 ;check for joystick now 816 6718 AD 78 02 lda JSTICK0 817 671B 29 0F and #$0f 818 671D C9 0F cmp #$0f 819 671F F0 07 beq notpressedJoy 820 6721 A8 tay 821 6722 B9 99 50 lda joyToKeyTable,y 822 6725 4C F1 66 jmp jumpFromStick 823 6728 notpressedJoy 824 ;fire 825 6728 AD 10 D0 lda TRIG0 826 672B D0 05 bne JNotFire 827 672D A9 21 lda #$21 828 672F 4C F1 66 jmp jumpFromStick 829 6732 JNotFire 830 6732 4C CA 66 jmp notpressed 831 ; 832 6735 pressedUp 833 ;force increaseeee! 834 6735 A6 8B ldx TankNr 835 6737 FE 6A 3D inc EnergyTableL,x 836 673A D0 03 bne CheckingMaxForce 837 673C FE 70 3D inc EnergyTableH,x 838 673F CheckingMaxForce 839 673F BD 7C 3D lda MaxEnergyTableH,x 840 6742 DD 70 3D cmp EnergyTableH,x 841 6745 D0 06 bne FurtherCheckMaxForce 842 6747 BD 76 3D lda MaxEnergyTableL,x 843 674A DD 6A 3D cmp EnergyTableL,x 844 674D FurtherCheckMaxForce 845 674D 90 03 4C 92 66 jcs BeforeFire 846 847 6752 BD 7C 3D lda MaxEnergyTableH,x 848 6755 9D 70 3D sta EnergyTableH,x 849 6758 BD 76 3D lda MaxEnergyTableL,x 850 675B 9D 6A 3D sta EnergyTableL,x 851 852 675E 4C 92 66 jmp BeforeFire 853 854 6761 CTRLPressedUp 855 6761 A6 8B ldx TankNr 856 6763 BD 6A 3D lda EnergyTableL,x 857 6766 18 clc 858 6767 69 0A adc #10 859 6769 9D 6A 3D sta EnergyTableL,x 860 676C 90 D1 bcc CheckingMaxForce 861 676E FE 70 3D inc EnergyTableH,x 862 6771 4C 3F 67 jmp CheckingMaxForce 863 864 865 6774 pressedDown 866 6774 A6 8B ldx TankNr 867 6776 DE 6A 3D dec EnergyTableL,x 868 6779 BD 6A 3D lda EnergyTableL,x 869 677C C9 FF cmp #$ff 870 677E D0 0D bne skip04 871 6780 DE 70 3D dec EnergyTableH,x 872 6783 10 08 bpl skip04 873 6785 ForceGoesZero 874 6785 A9 00 lda #0 875 6787 9D 70 3D sta EnergyTableH,x 876 678A 9D 6A 3D sta EnergyTableL,x 877 678D skip04 878 678D 4C 92 66 jmp BeforeFire 879 880 6790 CTRLPressedDown 881 6790 A6 8B ldx TankNr 882 6792 38 sec 883 6793 BD 6A 3D lda EnergyTableL,x 884 6796 E9 0A sbc #10 885 6798 9D 6A 3D sta EnergyTableL,x 886 679B 90 03 4C 92 66 jcs BeforeFire 887 67A0 DE 70 3D dec EnergyTableH,x 888 67A3 30 E0 bmi ForceGoesZero 889 67A5 4C 92 66 jmp BeforeFire 890 891 67A8 pressedLeft 892 67A8 A6 8B ldx TankNr 893 67AA DE 82 3D dec AngleTable,x 894 67AD BD 82 3D lda AngleTable,x 895 67B0 C9 FF cmp #$ff ; if angle goes through 0 we clear the barrel 896 67B2 D0 07 bne NotThrough90DegreesLeft 897 67B4 A9 2E 85 88 mva #$2e CharCode 898 67B8 20 23 85 jsr drawtankNrX 899 67BB NotThrough90DegreesLeft 900 67BB C9 A4 cmp #(255-91) 901 67BD F0 03 4C 92 66 jne BeforeFire 902 67C2 A9 5A lda #90 903 67C4 9D 82 3D sta AngleTable,x 904 67C7 4C 92 66 jmp BeforeFire 905 906 67CA pressedRight 907 67CA A6 8B ldx TankNr 908 67CC FE 82 3D INC AngleTable,x 909 67CF BD 82 3D lda AngleTable,x 910 67D2 D0 07 bne NotThrough90DegreesRight 911 67D4 A9 30 85 88 mva #$30 CharCode ; if angle goes through 0 we clear the barrel 912 67D8 20 23 85 jsr drawtankNrX 913 67DB NotThrough90DegreesRight 914 67DB C9 5B cmp #91 915 67DD F0 03 4C 92 66 jne BeforeFire 916 67E2 A9 A5 lda #(255-90) 917 67E4 9D 82 3D sta AngleTable,x 918 67E7 4C 92 66 jmp BeforeFire 919 920 67EA pressedTAB 921 67EA A6 8B ldx TankNr 922 67EC FE 89 3D inc ActiveWeapon,x 923 67EF BD 89 3D lda ActiveWeapon,x 924 67F2 C9 30 cmp #$30 ; number of offensive weapons 925 67F4 D0 05 bne skip14 926 67F6 A9 00 lda #0 927 67F8 9D 89 3D sta ActiveWeapon,x 928 67FB skip14 929 67FB BD 89 3D lda ActiveWeapon,x 930 67FE 20 E5 71 jsr HowManyBullets ; and we have qty of owned shells. Ufff.... 931 6801 F0 E7 beq pressedTAB 932 6803 20 BF 83 jsr WaitForKeyRelease 933 6806 4C 92 66 jmp BeforeFire 934 935 6809 CTRLpressedTAB 936 6809 A6 8B ldx TankNr 937 680B DE 89 3D dec ActiveWeapon,x 938 680E 10 05 bpl skip14CT 939 6810 A9 2F lda #$2f ; the last possible offensive weapon 940 6812 9D 89 3D sta ActiveWeapon,x 941 6815 skip14CT 942 6815 BD 89 3D lda ActiveWeapon,x 943 6818 20 E5 71 jsr HowManyBullets ; and we have qty of owned shells. Ufff.... 944 681B F0 EC beq CTRLpressedTAB 945 681D 20 BF 83 jsr WaitForKeyRelease 946 6820 4C 92 66 jmp BeforeFire 947 948 949 6823 pressedSpace 950 ;================================= 951 ;we shoot here!!! 952 6823 60 RTS 953 .endp 954 955 ;-------------------------------------------------- 956 6824 Shoot .proc ;TankNr (byte) 957 ;-------------------------------------------------- 958 ;it looks like this routine is too big - 959 ;- more and more functions were being added... 960 ;good idea would be to rewrite it completely 961 ;with much more separate blocks, but you know - 962 ;- do not touch it if it works... 963 964 ;the latest addition to this routine is 965 ;displaying offensive texts! 966 967 6824 RandomizeOffensiveText 968 6824 AD 0A D2 lda random 969 6827 C9 36 cmp #talk.NumberOfOffensiveTexts 970 6829 B0 F9 bcs RandomizeOffensiveText 971 972 682B 8D DC 44 sta TextNumberOff 973 682E A4 8B ldy TankNr 974 6830 A9 01 8D 51 48 mva #1 plot4x4color 975 6835 20 10 7C jsr DisplayOffensiveTextNr 976 977 978 6838 A6 8B ldx TankNr 979 683A BD 89 3D lda ActiveWeapon,x 980 683D C9 20 cmp #$20 ; laser 981 683F D0 0F bne NotStrongShoot 982 6841 A9 00 8D CA 3E mva #0 color 983 6846 A9 07 lda #7 984 6848 8D 81 3E sta Force 985 684B 8D 82 3E sta Force+1 986 684E D0 0C bne AfterStrongShoot 987 6850 NotStrongShoot 988 6850 BD 6A 3D lda EnergyTableL,x 989 6853 8D 81 3E sta Force 990 6856 BD 70 3D lda EnergyTableH,x 991 6859 8D 82 3E sta Force+1 992 685C AfterStrongShoot 993 685C A9 00 lda #$0 994 685E 8D 83 3E sta Force+2 995 6861 BD 82 3D lda AngleTable,x 996 6864 8D 80 3E sta Angle 997 998 6867 A9 00 lda #0 999 6869 8D 74 3E sta xtraj 1000 686C 8D 77 3E sta ytraj 1001 1002 ; Shoots tank nr X !!! :) 1003 ;ldx TankNr 1004 686F BD 97 3D lda xtankstableL,x 1005 6872 8D 75 3E sta xtraj+1 1006 6875 BD 9D 3D lda xtankstableH,x 1007 6878 8D 76 3E sta xtraj+2 1008 687B BD A3 3D lda ytankstable,x 1009 687E 8D 78 3E sta ytraj+1 1010 6881 A9 00 lda #$00 1011 6883 8D 79 3E sta ytraj+2 1012 1013 ; correction of the starting coordinates of bullet 1014 ; to start where the tank's barrel ends 1015 ; (without it bullet would go from the left lower corner of the tank) 1016 6886 AC 80 3E ldy Angle 1017 6889 18 clc 1018 688A AD 75 3E lda xtraj+1 1019 688D 79 69 49 adc EndOfTheBarrelX,y ; correction of X 1020 ;adc #4 1021 6890 8D 75 3E sta xtraj+1 1022 6893 AD 76 3E lda xtraj+2 1023 6896 69 00 adc #0 1024 6898 8D 76 3E sta xtraj+2 1025 689B 38 sec 1026 689C AD 78 3E lda ytraj+1 1027 689F F9 69 4A sbc EndOfTheBarrelY,y ; correction of Y 1028 ;sbc #7 1029 68A2 8D 78 3E sta ytraj+1 1030 68A5 AD 79 3E lda ytraj+2 1031 68A8 E9 00 sbc #0 1032 68AA 8D 79 3E sta ytraj+2 1033 1034 68AD A0 64 ldy #100 1035 1036 68AF 20 75 6A jsr Flight 1037 68B2 A9 01 8D CA 3E mva #1 color 1038 ;jsr WaitForKeyRelease 1039 68B7 60 rts 1040 .endp 1041 1042 1043 ;-------------------------------------------------- 1044 68B8 TankFalls .proc; 1045 ;-------------------------------------------------- 1046 68B8 A9 00 lda #0 1047 68BA 8D 3F 3E sta PreviousFall 1048 68BD 8D 40 3E sta EndOfTheFallFlag 1049 68C0 8D 41 3E sta Parachute 1050 1051 ; let's check if the given tank has got the parachute 1052 68C3 A9 35 lda #$35 ; parachute 1053 68C5 20 E5 71 jsr HowManyBullets 1054 68C8 F0 03 beq TankFallsX 1055 68CA EE 41 3E inc Parachute 1056 68CD TankFallsX 1057 ; coordinates of the first pixel under the tank 1058 68CD A6 8B ldx TankNr 1059 68CF BD 97 3D lda XtankstableL,x 1060 68D2 85 80 sta xdraw 1061 68D4 BD 9D 3D lda XtankstableH,x 1062 68D7 85 81 sta xdraw+1 1063 68D9 BD A3 3D lda Ytankstable,x 1064 68DC 18 clc 1065 68DD 69 01 adc #1 ; in this point the comment helped us! For the very first 1066 ; time in our lives! Tada! It opens a new chapter!!! 1067 68DF 85 82 sta ydraw 1068 ; 1069 68E1 A9 08 lda #08 1070 68E3 8D B2 3E sta mask2 ; Loop Counter 1071 68E6 ByteBelowTank 1072 68E6 20 5F 89 jsr point 1073 68E9 F0 03 beq EmptyPoint2 1074 68EB 38 sec 1075 68EC B0 01 bcs ROLPoint2 1076 68EE EmptyPoint2 1077 68EE 18 clc 1078 68EF ROLPoint2 1079 68EF 2E AA 3E rol mask1 1080 68F2 18 A5 80 69 01 85 + adw xdraw #1 1081 68FD CE B2 3E dec mask2 1082 6900 D0 E4 bne ByteBelowTank 1083 6902 AE AA 3E ldx mask1 1084 6905 BD 69 48 lda WhereToSlideTable,x 1085 6908 8D 3E 3E sta IfFallDown ; taking directions of falling down from the table 1086 690B D0 15 bne ItStillFalls 1087 ; Tank falling down already finished, but it is not sure that 1088 ; the horizontal coordinate is even. 1089 ; If it is odd then it must be corrected because otherwise 1090 ; P/M graphics background would not look OK 1091 690D A6 8B ldx TankNr 1092 690F BD 97 3D lda XtanksTableL,x 1093 6912 29 01 and #$01 1094 6914 D0 03 4C 40 6A jeq EndOfFall ; if it is even then it is the end 1095 ; and if not, we push it one pixel the way it was falling before 1096 6919 AD 3F 3E lda PreviousFall 1097 691C 8D 3E 3E sta IfFallDown 1098 691F EE 40 3E inc EndOfTheFallFlag ; because after this correction is shouldn't fall anymore 1099 1100 ; we have 3 bits: 0 - go down, 1 - go right, 2 - go left 1101 ;--- 1102 6922 ItStillFalls 1103 6922 AD 41 3E lda Parachute 1104 6925 29 01 and #1 1105 6927 D0 1A bne ParachutePresent 1106 ; decreasing energy - if the vertical fall, substract 2 1107 ; and if at an angle then substract 1 1108 6929 A0 01 ldy #1 ; how much energy to substract 1109 692B AD 3E 3E lda IfFallDown 1110 692E 29 01 and #1 1111 6930 F0 11 beq NoFallingDown 1112 6932 A6 8B ldx TankNr 1113 6934 20 F5 71 jsr DecreaseEnergyX 1114 6937 AD 3E 3E lda IfFallDown 1115 693A 29 06 and #6 1116 693C D0 05 bne FallDiagonally 1117 693E A6 8B ldx TankNr 1118 6940 20 F5 71 jsr DecreaseEnergyX 1119 6943 FallDiagonally 1120 6943 NoFallingDown 1121 6943 ParachutePresent 1122 ; we must set flag meaning that the tank was falling down 1123 ; because later maybe the number of parachutes will decrease 1124 ; (if there were parachutes and they were ON) 1125 1126 6943 AD 41 3E lda Parachute 1127 6946 09 02 ora #2 ; we set bit nr 1 (nr 0 means that parachute is present) 1128 6948 8D 41 3E sta Parachute 1129 1130 ; storing last direction of falling 1131 ; (it is not necessarily the direction from the previous 1132 ; iteraction, so we must check directional bits before storing) 1133 694B AD 3E 3E lda IfFallDown 1134 694E 29 06 and #$06 1135 6950 F0 03 beq FallStraightDown 1136 6952 8D 3F 3E sta PreviousFall 1137 6955 FallStraightDown 1138 6955 AD 41 3E lda Parachute 1139 6958 29 01 and #01 1140 695A F0 11 beq RapidFalling 1141 695C wait Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 695C AD 0B D4 LDA VCOUNT 4 695F 8D 0A D4 STA WSYNC 5 6962 8D 0A D4 STA WSYNC 6 6965 8D 0A D4 STA WSYNC 7 6968 CD 0B D4 ?WA CMP VCOUNT 8 696B D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 1142 696D RapidFalling 1143 ; we finish falling down if the tank reached the edge of the screen 1144 ; but if it falls straight down or the other way than the edge, 1145 ; then continue falling! 1146 696D A6 8B ldx TankNr 1147 696F BD 97 3D lda XtanksTableL,x 1148 6972 D0 0F bne NotLeftEdge 1149 6974 BD 9D 3D lda XtanksTableH,x 1150 6977 D0 0A bne NotLeftEdge 1151 6979 AD 3E 3E lda IfFallDown 1152 697C 29 04 and #$04 ; check if it does not fall left 1153 697E F0 03 4C 40 6A jne EndOfFall ; if so then maybe we finish 1154 6983 NotLeftEdge 1155 6983 18 clc 1156 6984 BD 97 3D lda XtanksTableL,x 1157 6987 69 08 adc #$08 ; we'll check right side of the char 1158 6989 85 91 sta temp 1159 698B BD 9D 3D lda XtanksTableH,x 1160 698E 69 00 adc #0 1161 6990 85 92 sta temp+1 1162 6992 A5 92 C9 01 D0 04 + cpw temp #screenwidth 1163 699C D0 0A bne NotRightEdge 1164 699E AD 3E 3E lda IfFallDown 1165 69A1 29 02 and #$02 ; check if it does not fall right 1166 69A3 F0 03 4C 40 6A jne EndOfFall ; if so then maybe we finish 1167 69A8 NotRightEdge 1168 ; clear previous position 1169 69A8 A9 01 8D FB 3D mva #1 Erase 1170 69AD 20 F9 84 jsr DrawTankNr 1171 ; and the parachute (if present) 1172 69B0 AD 41 3E lda Parachute 1173 69B3 29 01 and #01 1174 69B5 F0 1B beq DoNotClearParachute 1175 ; here we clear the parachute 1176 69B7 A6 8B ldx TankNr 1177 69B9 A9 34 lda #$34 1178 69BB 85 88 sta CharCode 1179 69BD BD A3 3D lda Ytankstable,x 1180 69C0 38 sec 1181 69C1 E9 08 sbc #8 1182 69C3 85 82 sta ydraw 1183 69C5 BD 97 3D lda XtanksTableL,x 1184 69C8 85 80 sta xdraw 1185 69CA BD 9D 3D lda XtanksTableH,x 1186 69CD 85 81 sta xdraw+1 1187 69CF 20 FE 89 jsr TypeChar 1188 69D2 DoNotClearParachute 1189 69D2 A9 00 8D FB 3D mva #0 Erase 1190 69D7 A6 8B ldx TankNr 1191 69D9 4E 3E 3E lsr IfFallDown ; bit nr 0 (down) 1192 69DC 90 09 bcc DoesNotFallDown 1193 ; tank is falling down 1194 69DE BD A3 3D lda Ytankstable,x 1195 69E1 18 clc 1196 69E2 69 01 adc #1 1197 69E4 9D A3 3D sta Ytankstable,x 1198 69E7 DoesNotFallDown 1199 69E7 4E 3E 3E lsr IfFallDown ; bit nr 1 (right) 1200 69EA 90 11 bcc DoesNotFallLeft 1201 ; tank is falling left 1202 69EC 18 clc 1203 69ED BD 97 3D lda XtankstableL,x 1204 69F0 69 01 adc #1 1205 69F2 9D 97 3D sta XtankstableL,x 1206 69F5 BD 9D 3D lda XtankstableH,x 1207 69F8 69 00 adc #0 1208 69FA 9D 9D 3D sta XtankstableH,x 1209 69FD DoesNotFallLeft 1210 69FD 4E 3E 3E lsr IfFallDown ; bit nr 2 (left) 1211 6A00 90 11 bcc DoesNotFallRight 1212 ; tank is falling right 1213 6A02 38 sec 1214 6A03 BD 97 3D lda XtankstableL,x 1215 6A06 E9 01 sbc #1 1216 6A08 9D 97 3D sta XtankstableL,x 1217 6A0B BD 9D 3D lda XtankstableH,x 1218 6A0E E9 00 sbc #0 1219 6A10 9D 9D 3D sta XtankstableH,x 1220 6A13 DoesNotFallRight 1221 6A13 20 F9 84 jsr DrawTankNr 1222 1223 ; checking is parachute present and if so, draw it 1224 6A16 AD 41 3E lda Parachute 1225 6A19 29 01 and #01 1226 6A1B F0 1B beq DoNotDrawParachute 1227 1228 ; here we draw parachute 1229 6A1D A6 8B ldx TankNr 1230 6A1F A9 34 lda #$34 1231 6A21 85 88 sta CharCode 1232 6A23 BD A3 3D lda Ytankstable,x 1233 6A26 38 sec 1234 6A27 E9 08 sbc #8 1235 6A29 85 82 sta ydraw 1236 6A2B BD 97 3D lda XtanksTableL,x 1237 6A2E 85 80 sta xdraw 1238 6A30 BD 9D 3D lda XtanksTableH,x 1239 6A33 85 81 sta xdraw+1 1240 6A35 20 FE 89 jsr TypeChar 1241 6A38 DoNotDrawParachute 1242 6A38 AD 40 3E lda EndOfTheFallFlag 1243 6A3B D0 03 4C CD 68 jeq TankFallsX 1244 1245 6A40 EndOfFall 1246 6A40 20 F9 84 jsr DrawTankNr 1247 1248 ; if tank was falling down having parachute, 1249 ; we must deduct one parachute 1250 6A43 AD 41 3E lda Parachute 1251 6A46 C9 03 cmp #$03 ; was falling down and the parachute 1252 6A48 D0 2A bne ThereWasNoParachute 1253 ; first we clear parachute on the screen 1254 6A4A A9 01 8D FB 3D mva #1 Erase 1255 6A4F A6 8B ldx TankNr 1256 6A51 A9 34 lda #$34 1257 6A53 85 88 sta CharCode 1258 6A55 BD A3 3D lda Ytankstable,x 1259 6A58 38 sec 1260 6A59 E9 08 sbc #8 1261 6A5B 85 82 sta ydraw 1262 6A5D BD 97 3D lda XtanksTableL,x 1263 6A60 85 80 sta xdraw 1264 6A62 BD 9D 3D lda XtanksTableH,x 1265 6A65 85 81 sta xdraw+1 1266 6A67 20 FE 89 jsr TypeChar 1267 6A6A A9 00 8D FB 3D mva #0 Erase 1268 ; now we can deduct one parachute from the list of weapons 1269 1270 6A6F A9 35 lda #$35 ; parachute 1271 6A71 20 DC 71 jsr DecreaseWeapon 1272 6A74 ThereWasNoParachute 1273 6A74 60 rts 1274 .endp 1275 ;-------------------------------------------------- 1276 6A75 Flight .proc ;Force(byte.byte), Angle(byte), Wind(.byte) 128=0, 255=maxright, 0=maxleft 1277 ;-------------------------------------------------- 1278 1279 ;g=-0.1 1280 ;vx=Force*sin(Angle) 1281 ;vy=Force*cos(Angle) 1282 ; 1283 ;:begin 1284 ;ytraj=ytray-vy 1285 ;vy=vy-g 1286 ;xtraj=xtraj+vx - without Wind 1287 ;vx=vx+Wind (Wind is a small fraction) 1288 ;plot xtraj,ytraj - there is clearing in plot 1289 ;goto begin 1290 1291 ; smoke tracer :) 1292 6A75 A0 00 ldy #0 1293 6A77 A6 8B ldx TankNr 1294 6A79 BD 89 3D lda ActiveWeapon,x 1295 6A7C C9 0B cmp #11 ; Smoke tracer 1296 6A7E D0 01 bne noSmokeTracer 1297 6A80 C8 iny 1298 6A81 noSmokeTracer 1299 6A81 8C 6B 3E sty SmokeTracerFlag 1300 1301 6A84 RepeatIfSmokeTracer 1302 6A84 AD 78 3E 8D 7E 3E + mwa ytraj+1 Ytrajold+1 1303 6A90 AD 75 3E 8D 7B 3E + mwa xtraj+1 Xtrajold+1 1304 6A9C A9 68 8D 2F 3E A9 + mwa #DrawCheck DrawJumpAddr 1305 1306 6AA6 A9 00 lda #0 1307 6AA8 8D 89 3E sta Result 1308 6AAB 8D 8A 3E sta Result+1 1309 6AAE 8D 8B 3E sta Result+2 1310 6AB1 8D 96 3D sta HitFlag 1311 6AB4 85 80 sta xdraw 1312 6AB6 85 81 sta xdraw+1 1313 6AB8 85 82 sta ydraw 1314 6ABA 85 83 sta ydraw+1 1315 1316 ;vx calculation 1317 6ABC aslw Force ;Force=Force*4 ... *2 Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 6ABC 0E 81 3E ASL FORCE 2 6ABF 2E 82 3E ROL FORCE+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 1318 ;aslw Force 1319 1320 ;sin(Angle) 1321 6AC2 AE 80 3E ldx Angle 1322 6AC5 8E 4E 3F stx LeapFrogAngle ; we will need it later 1323 1324 ;Angle works like this: 1325 ;0 'degrees' is sraight up 1326 ;90 'degrees' is horizontally right 1327 ;255 is straight up (same as 0) 1328 ;255-90 (165) horizontally left 1329 1330 6AC8 10 15 bpl FlightRight 1331 1332 ;and if the highest bit is set then 1333 ;Flight to LEFT 1334 ;calculate Angle with this formula: 1335 ;Angle=90-(Angle-165) 1336 1337 6ACA 38 sec 1338 6ACB 8A txa 1339 6ACC E9 A5 sbc #165 ;(Angle-165) 1340 6ACE 85 91 sta temp ;dirty trick with selfmodifying code (REMOVED) 1341 6AD0 A9 5A lda #90 ; 1342 6AD2 E5 91 sbc temp ;90-(Angle-165) 1343 ;and we have rady angle here ... and we go LEFT! 1344 6AD4 AA tax 1345 6AD5 8D 80 3E sta Angle 1346 6AD8 A9 01 8D 8C 3E mva #1 goleft 1347 ; and now we contine as if nothing happened 1348 ; (but we have goleft set to 1!!!) 1349 6ADD D0 05 bne dontzerogoleft 1350 1351 6ADF FlightRight 1352 6ADF A9 00 8D 8C 3E mva #0 goleft 1353 1354 6AE4 dontzerogoleft 1355 1356 6AE4 BD 01 46 lda sintable,x ;sin(Angle) 1357 6AE7 8D 87 3E sta Multiplee ;sin(Angle)*Force 1358 6AEA AD 81 3E 8D 84 3E + mwa Force Multiplier 1359 6AF6 A9 00 lda #$0 1360 6AF8 8D 86 3E sta Multiplier+2 1361 6AFB A2 08 ldx #8 1362 6AFD MultiplyLoop 1363 6AFD 6E 87 3E ror Multiplee 1364 6B00 90 1C bcc DoNotAdd 1365 6B02 18 clc 1366 6B03 AD 84 3E lda Multiplier 1367 6B06 6D 89 3E adc Result 1368 6B09 8D 89 3E sta Result 1369 6B0C AD 85 3E lda Multiplier+1 1370 6B0F 6D 8A 3E adc Result+1 1371 6B12 8D 8A 3E sta Result+1 1372 6B15 AD 86 3E lda Multiplier+2 1373 6B18 6D 8B 3E adc Result+2 1374 6B1B 8D 8B 3E sta Result+2 1375 6B1E DoNotAdd 1376 ;clc ;carry always cleared here (anyway we hope so :) 1377 6B1E 2E 84 3E rol Multiplier 1378 6B21 2E 85 3E rol Multiplier+1 1379 6B24 2E 86 3E rol Multiplier+2 1380 6B27 CA dex 1381 6B28 D0 D3 bne MultiplyLoop 1382 ; here in Result there is a number xxxx.yyy = sin(Angle)*Force 1383 1384 6B2A AD 89 3E lda Result ;vx=sin(Angle)*Force 1385 6B2D 8D 6C 3E sta vx 1386 6B30 AD 8A 3E lda Result+1 1387 6B33 8D 6D 3E sta vx+1 1388 6B36 AD 8B 3E lda Result+2 1389 6B39 8D 6E 3E sta vx+2 1390 6B3C A9 00 8D 6F 3E mva #0 vx+3 1391 1392 ;======vy 1393 6B41 A9 00 lda #0 ;cos(Angle) 1394 6B43 8D 89 3E sta Result 1395 6B46 8D 8A 3E sta Result+1 1396 6B49 8D 8B 3E sta Result+2 1397 ;-- 1398 6B4C AE 80 3E ldx Angle 1399 6B4F BD 5C 46 lda costable,x 1400 1401 6B52 8D 87 3E sta Multiplee ;cos(Angle)*Force 1402 6B55 AD 81 3E 8D 84 3E + mwa Force Multiplier 1403 6B61 A9 00 lda #$0 1404 6B63 8D 86 3E sta Multiplier+2 1405 6B66 A2 08 ldx #8 1406 6B68 MultiplyLoopY 1407 6B68 6E 87 3E ror Multiplee 1408 6B6B 90 1C bcc DoNotAddY 1409 6B6D 18 clc 1410 6B6E AD 84 3E lda Multiplier 1411 6B71 6D 89 3E adc Result 1412 6B74 8D 89 3E sta Result 1413 6B77 AD 85 3E lda Multiplier+1 1414 6B7A 6D 8A 3E adc Result+1 1415 6B7D 8D 8A 3E sta Result+1 1416 6B80 AD 86 3E lda Multiplier+2 1417 6B83 6D 8B 3E adc Result+2 1418 6B86 8D 8B 3E sta Result+2 1419 6B89 DoNotAddY 1420 ;clc ;carry always cleared here (anyway we hope so :) 1421 6B89 2E 84 3E rol Multiplier 1422 6B8C 2E 85 3E rol Multiplier+1 1423 6B8F 2E 86 3E rol Multiplier+2 1424 6B92 CA dex 1425 6B93 D0 D3 bne MultiplyLoopY 1426 ; here in Result there is a number xxxx.yyy=cos(Angle)*Force 1427 1428 6B95 AD 89 3E lda Result ;vy=cos(Angle)*Force 1429 6B98 8D 70 3E sta vy 1430 6B9B AD 8A 3E lda Result+1 1431 6B9E 8D 71 3E sta vy+1 1432 6BA1 AD 8B 3E lda Result+2 1433 6BA4 8D 72 3E sta vy+2 1434 6BA7 A9 00 8D 73 3E mva #0 vy+3 1435 1436 6BAC Loopi 1437 ;ytraj=ytraj-vy (skipping least significant byte of vy) 1438 6BAC 38 sec 1439 6BAD AD 77 3E lda ytraj 1440 6BB0 ED 71 3E sbc vy+1 1441 6BB3 8D 77 3E sta ytraj 1442 6BB6 AD 78 3E lda ytraj+1 1443 6BB9 ED 72 3E sbc vy+2 1444 6BBC 8D 78 3E sta ytraj+1 1445 6BBF AD 79 3E lda ytraj+2 1446 6BC2 ED 73 3E sbc vy+3 1447 6BC5 8D 79 3E sta ytraj+2 1448 1449 ;vy=vy-g (again without least significant byte of vy) 1450 6BC8 38 sec 1451 6BC9 AD 71 3E lda vy+1 1452 6BCC ED 90 3D sbc gravity 1453 6BCF 8D 71 3E sta vy+1 1454 6BD2 AD 72 3E lda vy+2 1455 6BD5 E9 00 sbc #0 1456 6BD7 8D 72 3E sta vy+2 1457 6BDA AD 73 3E lda vy+3 1458 6BDD E9 00 sbc #0 1459 6BDF 8D 73 3E sta vy+3 1460 6BE2 10 0C bpl StillUp 1461 ; where we know that the bullet starts to fall down 1462 ; we check if it is MIRV and if so, jump to MIRV routine 1463 6BE4 A6 8B ldx TankNr 1464 6BE6 BD 89 3D lda ActiveWeapon,x 1465 6BE9 C9 06 cmp #6 ; MIRV 1466 6BEB D0 03 4C D9 6D jeq MIRVdownLoop 1467 6BF0 StillUp 1468 6BF0 AD 8C 3E lda goleft 1469 6BF3 D0 1F bne FlightLeft 1470 1471 6BF5 18 clc ;xtraj=xtraj+vx (skipping least significant byte of vx) 1472 6BF6 AD 74 3E lda xtraj ;here of course Fight to right 1473 6BF9 6D 6D 3E adc vx+1 1474 6BFC 8D 74 3E sta xtraj 1475 6BFF AD 75 3E lda xtraj+1 1476 6C02 6D 6E 3E adc vx+2 1477 6C05 8D 75 3E sta xtraj+1 1478 6C08 AD 76 3E lda xtraj+2 1479 6C0B 6D 6F 3E adc vx+3 1480 6C0E 8D 76 3E sta xtraj+2 1481 6C11 4C 30 6C jmp skip07 ;skipping substracting for Flight to left 1482 1483 6C14 FlightLeft 1484 6C14 38 sec ;xtraj=xtraj-vx (skipping least significant byte of vx) 1485 6C15 AD 74 3E lda xtraj ;here of course Fight to left 1486 6C18 ED 6D 3E sbc vx+1 1487 6C1B 8D 74 3E sta xtraj 1488 6C1E AD 75 3E lda xtraj+1 1489 6C21 ED 6E 3E sbc vx+2 1490 6C24 8D 75 3E sta xtraj+1 1491 6C27 AD 76 3E lda xtraj+2 1492 6C2A ED 6F 3E sbc vx+3 1493 6C2D 8D 76 3E sta xtraj+2 1494 1495 6C30 skip07 1496 ;vx=vx-Wind (also without least significan byte of vx) 1497 6C30 AD 8C 3E lda goleft 1498 6C33 D0 07 bne FlightsLeft ;blow on bullet flighting left 1499 6C35 AD 94 3D lda WindOrientation 1500 6C38 D0 2D bne WindToLeft 1501 6C3A F0 05 beq LWindToLeft 1502 6C3C FlightsLeft 1503 6C3C AD 94 3D lda WindOrientation 1504 6C3F F0 26 beq LWindToRight 1505 6C41 LWindToLeft 1506 1507 ; here Wind to right, bullet goes right as well, so vx=vx+Wind 1508 ; here Wind to left, bullet goes left as well, so vx=vx+Wind 1509 6C41 18 clc 1510 6C42 AD 6C 3E lda vx 1511 6C45 6D 91 3D adc Wind 1512 6C48 8D 6C 3E sta vx 1513 6C4B AD 6D 3E lda vx+1 1514 6C4E 6D 92 3D adc Wind+1 1515 6C51 8D 6D 3E sta vx+1 1516 6C54 AD 6E 3E lda vx+2 1517 6C57 69 00 adc #0 1518 6C59 8D 6E 3E sta vx+2 1519 6C5C AD 6F 3E lda vx+3 1520 6C5F 69 00 adc #0 1521 6C61 8D 6F 3E sta vx+3 1522 6C64 4C 8A 6C Jmp skip08 1523 6C67 WindToLeft 1524 6C67 LWindToRight 1525 1526 ;Wind to left, bullet right, so vx=vx-Wind 1527 ;Wind to right, bullet left, so vx=vx-Wind 1528 6C67 38 sec 1529 6C68 AD 6C 3E lda vx 1530 6C6B ED 91 3D sbc Wind 1531 6C6E 8D 6C 3E sta vx 1532 6C71 AD 6D 3E lda vx+1 1533 6C74 ED 92 3D sbc Wind+1 1534 6C77 8D 6D 3E sta vx+1 1535 6C7A AD 6E 3E lda vx+2 1536 6C7D E9 00 sbc #0 1537 6C7F 8D 6E 3E sta vx+2 1538 6C82 AD 6F 3E lda vx+3 1539 6C85 E9 00 sbc #0 1540 6C87 8D 6F 3E sta vx+3 1541 6C8A skip08 1542 6C8A AD 7B 3E 85 80 AD + mwa xtrajold+1 xdraw 1543 6C94 AD 7E 3E 85 82 AD + mwa ytrajold+1 ydraw 1544 6C9E AD 75 3E 85 84 AD + mwa xtraj+1 xbyte 1545 6CA8 AD 78 3E 85 86 AD + mwa ytraj+1 ybyte 1546 6CB2 20 6A 80 jsr draw 1547 ;key 1548 6CB5 AD 75 3E 8D 7B 3E + mwa xtraj+1 XtrajOld+1 1549 6CC1 AD 78 3E 8D 7E 3E + mwa ytraj+1 YtrajOld+1 1550 1551 6CCD AD A9 3E lda tracerflag 1552 6CD0 D0 0D bne nowait 1553 6CD2 AD CA 3E lda color 1554 6CD5 F0 08 beq nowait 1555 ;wait 1556 ;this is where program slows down the flight of a missile 1557 ;possibly it is too slow to wait till next frame... 1558 ;we will see. 1559 ;---2003-08-01 yes, it is too slow!!! shorter delay 1560 ; must be here like few sta wsync's 1561 ; half a frame would be the best... 1562 6CD7 A2 96 ldx #FlyDelay 1563 6CD9 DelayLoop 1564 6CD9 8D 0A D4 sta wsync 1565 6CDC CA dex 1566 6CDD D0 FA bne DelayLoop 1567 1568 6CDF nowait 1569 6CDF AD 96 3D lda HitFlag 1570 6CE2 D0 35 bne Hit 1571 1572 6CE4 AD 79 3E C9 00 D0 + cpw ytraj+1 #screenheight 1573 6CF0 90 05 bcc YTrayLowerThanScreenHeight 1574 6CF2 AD 79 3E lda ytraj+2 1575 6CF5 10 39 bpl EndOfFlight 1576 1577 6CF7 YTrayLowerThanScreenHeight ; it means it is still on screen and not above 1578 1579 6CF7 SkipCollisionCheck 1580 1581 6CF7 AD 75 3E 85 80 AD + mwa xtraj+1 xdraw 1582 6D01 AD 78 3E 85 82 AD + mwa ytraj+1 ydraw 1583 1584 6D0B AD A9 3E lda tracerflag 1585 6D0E D0 03 bne NoUnPlot 1586 1587 6D10 20 46 88 jsr UnPlot 1588 1589 6D13 NoUnPlot 1590 6D13 20 8B 89 jsr PlotPointer 1591 1592 6D16 4C AC 6B jmp Loopi 1593 1594 6D19 Hit 1595 6D19 AD 32 3E 85 80 AD + mwa XHit xdraw 1596 6D23 AD 34 3E 85 82 AD + mwa YHit ydraw 1597 1598 6D2D 20 46 88 jsr unPlot 1599 6D30 EndOfFlight 1600 6D30 A5 80 8D 39 3E A5 + mwa xdraw xcircle ; we must store for a little while 1601 6D3A A5 82 8D 3B 3E mva ydraw ycircle ; xdraw and ydraw 1602 6D3F A9 00 85 80 85 81 mwa #0 xdraw 1603 6D45 A9 C7 85 82 mva #screenheight-1 ydraw 1604 6D49 20 46 88 jsr unPlot 1605 6D4C AD 39 3E 85 80 AD + mwa xcircle xdraw 1606 6D56 AD 3B 3E 85 82 mva ycircle ydraw 1607 1608 6D5B AC 6B 3E ldy SmokeTracerFlag 1609 6D5E F0 07 beq EndOfFlight2 1610 6D60 88 dey 1611 6D61 8C 6B 3E sty SmokeTracerFlag 1612 6D64 4C 6D 6D jmp SecondFlight 1613 6D67 EndOfFlight2 1614 6D67 A9 00 lda #0 ; nie wiem czemu 1615 6D69 8D A9 3E sta tracerflag ; 1616 6D6C 60 rts 1617 .endp 1618 1619 6D6D SecondFlight .proc 1620 ; ---------------- przekopiowany fragment sprzed odpalenie strzału malo kulturalne..... 1621 ; ---------------- ponownie wyznacza parametry strzału 1622 6D6D A6 8B ldx TankNr 1623 6D6F BD 6A 3D lda EnergyTableL,x 1624 6D72 8D 81 3E sta Force 1625 6D75 BD 70 3D lda EnergyTableH,x 1626 6D78 8D 82 3E sta Force+1 1627 6D7B A9 00 lda #$0 1628 6D7D 8D 83 3E sta Force+2 1629 6D80 BD 82 3D lda AngleTable,x 1630 6D83 8D 80 3E sta Angle 1631 1632 6D86 A9 00 lda #0 1633 6D88 8D CA 3E sta color 1634 6D8B 8D 74 3E sta xtraj 1635 6D8E 8D 77 3E sta ytraj 1636 1637 6D91 BD 97 3D lda xtankstableL,x 1638 6D94 8D 75 3E sta xtraj+1 1639 6D97 BD 9D 3D lda xtankstableH,x 1640 6D9A 8D 76 3E sta xtraj+2 1641 6D9D BD A3 3D lda ytankstable,x 1642 6DA0 8D 78 3E sta ytraj+1 1643 6DA3 A9 00 lda #$00 1644 6DA5 8D 79 3E sta ytraj+2 1645 1646 6DA8 AC 80 3E ldy Angle 1647 6DAB 18 clc 1648 6DAC AD 75 3E lda xtraj+1 1649 6DAF 79 69 49 adc EndOfTheBarrelX,y ; correction of X 1650 6DB2 8D 75 3E sta xtraj+1 1651 6DB5 AD 76 3E lda xtraj+2 1652 6DB8 69 00 adc #0 1653 6DBA 8D 76 3E sta xtraj+2 1654 6DBD 38 sec 1655 6DBE AD 78 3E lda ytraj+1 1656 6DC1 F9 69 4A sbc EndOfTheBarrelY,y ; correction of Y 1657 6DC4 8D 78 3E sta ytraj+1 1658 6DC7 AD 79 3E lda ytraj+2 1659 6DCA E9 00 sbc #0 1660 6DCC 8D 79 3E sta ytraj+2 1661 1662 6DCF A0 64 ldy #100 1663 6DD1 A9 01 lda #1 ; nie wiem (to znaczy wydaje mi sie ze wiem ;) ) 1664 6DD3 8D A9 3E sta tracerflag ; ..... 1665 6DD6 4C 84 6A jmp Flight.RepeatIfSmokeTracer 1666 .endp 1667 1668 ; ------------------------------------------------- 1669 6DD9 MIRVdownLoop .proc 1670 ; MIRV loop - here mirv bullets fall down 1671 ; ------------------------------------------------- 1672 ; copy Flight parameters to the table 1673 6DD9 A2 04 ldx #4 1674 6DDB MIRVcopyParameters 1675 6DDB AD 74 3E lda xtraj 1676 6DDE 9D 42 3E sta xtraj00,x 1677 6DE1 AD 75 3E lda xtraj+1 1678 6DE4 9D 47 3E sta xtraj01,x 1679 6DE7 AD 76 3E lda xtraj+2 1680 6DEA 9D 4C 3E sta xtraj02,x 1681 6DED AD 6C 3E lda vx 1682 6DF0 9D 51 3E sta vx00,x 1683 6DF3 AD 6D 3E lda vx+1 1684 6DF6 9D 56 3E sta vx01,x 1685 6DF9 AD 6E 3E lda vx+2 1686 6DFC 9D 5B 3E sta vx02,x 1687 6DFF AD 6F 3E lda vx+3 1688 6E02 9D 60 3E sta vx03,x 1689 6E05 A9 00 lda #0 1690 6E07 9D 65 3E sta MirvDown,x 1691 6E0A CA dex 1692 6E0B 10 CE bpl MIRVcopyParameters 1693 ; modification (to make bullets "split away" and go different directions) 1694 ; bullet indexed 0 is in the middle 1695 1696 ; bullet 1 1697 6E0D 18 clc 1698 6E0E AD 6D 3E lda vx+1 1699 6E11 69 64 adc #100 1700 6E13 8D 57 3E sta vx01+1 1701 6E16 AD 6E 3E lda vx+2 1702 6E19 69 00 adc #0 1703 6E1B 8D 5C 3E sta vx02+1 1704 6E1E AD 6F 3E lda vx+3 1705 6E21 69 00 adc #0 1706 6E23 8D 61 3E sta vx03+1 1707 ; bullet 2 1708 6E26 38 sec 1709 6E27 AD 6D 3E lda vx+1 1710 6E2A E9 64 sbc #100 1711 6E2C 8D 58 3E sta vx01+2 1712 6E2F AD 6E 3E lda vx+2 1713 6E32 E9 00 sbc #0 1714 6E34 8D 5D 3E sta vx02+2 1715 6E37 AD 6F 3E lda vx+3 1716 6E3A E9 00 sbc #0 1717 6E3C 8D 62 3E sta vx03+2 1718 ; bullet 3 1719 6E3F 18 clc 1720 6E40 AD 6D 3E lda vx+1 1721 6E43 69 C8 adc #200 1722 6E45 8D 59 3E sta vx01+3 1723 6E48 AD 6E 3E lda vx+2 1724 6E4B 69 00 adc #0 1725 6E4D 8D 5E 3E sta vx02+3 1726 6E50 AD 6F 3E lda vx+3 1727 6E53 69 00 adc #0 1728 6E55 8D 63 3E sta vx03+3 1729 ; bullet 4 1730 6E58 38 sec 1731 6E59 AD 6D 3E lda vx+1 1732 6E5C E9 C8 sbc #200 1733 6E5E 8D 5A 3E sta vx01+4 1734 6E61 AD 6E 3E lda vx+2 1735 6E64 E9 00 sbc #0 1736 6E66 8D 5F 3E sta vx02+4 1737 6E69 AD 6F 3E lda vx+3 1738 6E6C E9 00 sbc #0 1739 6E6E 8D 64 3E sta vx03+4 1740 1741 ; clearing ranges of soil down registers 1742 6E71 A9 40 8D FC 3D A9 + mwa #screenwidth RangeLeft 1743 6E7B A9 00 lda #0 1744 6E7D 8D FE 3D sta RangeRight 1745 6E80 8D FF 3D sta RangeRight+1 1746 1747 6E83 A2 FF ldx #$FF ; it will turn 0 in a moment anyway 1748 6E85 8E 6A 3E stx MirvMissileCounter 1749 6E88 mrLoopi 1750 6E88 EE 6A 3E inc MirvMissileCounter 1751 6E8B AD 6A 3E lda MirvMissileCounter 1752 6E8E C9 05 cmp #5 1753 6E90 D0 05 bne mrLoopix 1754 6E92 A9 00 8D 6A 3E mva #0 MirvMissileCounter 1755 6E97 mrLoopix 1756 6E97 AE 6A 3E ldx MirvMissileCounter 1757 ; Y changes only for bullet number 0 1758 ; because rest of the bullets have the same Y (height) 1759 1760 6E9A D0 58 bne MIRVdoNotChangeY 1761 ; Y is the same for all falling bullets 1762 ;ytraj=ytraj-vy (skipping least significant byte of vy) 1763 6E9C 38 sec 1764 6E9D AD 77 3E lda ytraj 1765 6EA0 ED 71 3E sbc vy+1 1766 6EA3 8D 77 3E sta ytraj 1767 6EA6 AD 78 3E lda ytraj+1 1768 6EA9 ED 72 3E sbc vy+2 1769 6EAC 8D 78 3E sta ytraj+1 1770 6EAF AD 79 3E lda ytraj+2 1771 6EB2 ED 73 3E sbc vy+3 1772 6EB5 8D 79 3E sta ytraj+2 1773 1774 ;vy=vy-g (also without least significan byte of vy) 1775 6EB8 38 sec 1776 6EB9 AD 71 3E lda vy+1 1777 6EBC ED 90 3D sbc gravity 1778 6EBF 8D 71 3E sta vy+1 1779 6EC2 AD 72 3E lda vy+2 1780 6EC5 E9 00 sbc #0 1781 6EC7 8D 72 3E sta vy+2 1782 6ECA AD 73 3E lda vy+3 1783 6ECD E9 00 sbc #0 1784 6ECF 8D 73 3E sta vy+3 1785 1786 ; 3 waits for 5 bullets (will be faster) 1787 6ED2 wait Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 6ED2 AD 0B D4 LDA VCOUNT 4 6ED5 8D 0A D4 STA WSYNC 5 6ED8 8D 0A D4 STA WSYNC 6 6EDB 8D 0A D4 STA WSYNC 7 6EDE CD 0B D4 ?WA CMP VCOUNT 8 6EE1 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 1788 ;wait 1789 6EE3 wait Macro: WAIT [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 6EE3 AD 0B D4 LDA VCOUNT 4 6EE6 8D 0A D4 STA WSYNC 5 6EE9 8D 0A D4 STA WSYNC 6 6EEC 8D 0A D4 STA WSYNC 7 6EEF CD 0B D4 ?WA CMP VCOUNT 8 6EF2 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\weapons.asm 1790 1791 6EF4 MIRVdoNotChangeY 1792 1793 6EF4 BD 65 3E lda MirvDown,x ; if bullet is already down we go with the next one 1794 6EF7 F0 03 4C 79 70 jne MIRVnextBullet 1795 6EFC AD 8C 3E lda goleft 1796 6EFF D0 1F bne mrFlightLeft 1797 1798 6F01 18 clc ;xtraj=xtraj+vx (skipping the least significant byte of vx) 1799 6F02 BD 42 3E lda xtraj00,x ;and here of course Flight to the right 1800 6F05 7D 56 3E adc vx01,x 1801 6F08 9D 42 3E sta xtraj00,x 1802 6F0B BD 47 3E lda xtraj01,x 1803 6F0E 7D 5B 3E adc vx02,x 1804 6F11 9D 47 3E sta xtraj01,x 1805 6F14 BD 4C 3E lda xtraj02,x 1806 6F17 7D 60 3E adc vx03,x 1807 6F1A 9D 4C 3E sta xtraj02,x 1808 6F1D 4C 3C 6F jmp mrskip07 ;skip substracting for Flight to the left 1809 1810 6F20 mrFlightLeft 1811 6F20 38 sec ;xtraj=xtraj-vx (skipping the least significant byte of vx) 1812 6F21 BD 42 3E lda xtraj00,x ;here of course Flight to the left 1813 6F24 FD 56 3E sbc vx01,x 1814 6F27 9D 42 3E sta xtraj00,x 1815 6F2A BD 47 3E lda xtraj01,x 1816 6F2D FD 5B 3E sbc vx02,x 1817 6F30 9D 47 3E sta xtraj01,x 1818 6F33 BD 4C 3E lda xtraj02,x 1819 6F36 FD 60 3E sbc vx03,x 1820 6F39 9D 4C 3E sta xtraj02,x 1821 1822 1823 6F3C mrskip07 1824 ;vx=vx-Wind (also without least significan byte of vx) 1825 1826 6F3C AD 8C 3E lda goleft 1827 6F3F D0 07 bne mrFlightsLeft ;blow on bullet flighting left 1828 6F41 AD 94 3D lda WindOrientation 1829 6F44 D0 2D bne mrWindToLeft 1830 6F46 F0 05 beq mrLWindToLeft 1831 6F48 mrFlightsLeft 1832 6F48 AD 94 3D lda WindOrientation 1833 6F4B F0 26 beq mrLWindToRight 1834 6F4D mrLWindToLeft 1835 ; here Wind to right, bullet goes right as well, so vx=vx+Wind 1836 ; here Wind to left, bullet goes left as well, so vx=vx+Wind 1837 6F4D 18 clc 1838 6F4E BD 51 3E lda vx00,x 1839 6F51 6D 91 3D adc Wind 1840 6F54 9D 51 3E sta vx00,x 1841 6F57 BD 56 3E lda vx01,x 1842 6F5A 6D 92 3D adc Wind+1 1843 6F5D 9D 56 3E sta vx01,x 1844 6F60 BD 5B 3E lda vx02,x 1845 6F63 69 00 adc #0 1846 6F65 9D 5B 3E sta vx02,x 1847 6F68 BD 60 3E lda vx03,x 1848 6F6B 69 00 adc #0 1849 6F6D 9D 60 3E sta vx03,x 1850 6F70 4C 96 6F Jmp mrskip08 1851 6F73 mrWindToLeft 1852 6F73 mrLWindToRight 1853 ;Wind to left, bullet right, so vx=vx-Wind 1854 ;Wind to right, bullet left, so vx=vx-Wind 1855 6F73 38 sec 1856 6F74 BD 51 3E lda vx00,x 1857 6F77 ED 91 3D sbc Wind 1858 6F7A 9D 51 3E sta vx00,x 1859 6F7D BD 56 3E lda vx01,x 1860 6F80 ED 92 3D sbc Wind+1 1861 6F83 9D 56 3E sta vx01,x 1862 6F86 BD 5B 3E lda vx02,x 1863 6F89 E9 00 sbc #0 1864 6F8B 9D 5B 3E sta vx02,x 1865 6F8E BD 60 3E lda vx03,x 1866 6F91 E9 00 sbc #0 1867 6F93 9D 60 3E sta vx03,x 1868 6F96 mrskip08 1869 1870 ; isn't it over the screen???? 1871 6F96 AD 79 3E lda ytraj+2 ;attention! this checks getting out of the screen through bottom 1872 6F99 30 0A bmi MIRVcheckX ;but not that accurately.... 1873 6F9B AD 78 3E lda ytraj+1 1874 6F9E C9 C8 cmp #screenheight 1875 6FA0 90 03 4C 61 70 jcs mrEndOfFlight ; if smaller than screenheight then continue (and it will always fall down...) 1876 6FA5 MIRVcheckX 1877 6FA5 BD 4C 3E lda xtraj02,x 1878 6FA8 C9 01 cmp #>screenwidth 1879 6FAA F0 12 beq MIRVcheckLowerX 1880 6FAC 90 27 bcc MIRVcheckCollision 1881 ; it's over the screen horizontally (to the left or right) 1882 6FAE A9 00 85 80 85 81 mwa #0 xdraw 1883 6FB4 A9 C7 85 82 mva #screenheight-1 ydraw 1884 6FB8 20 48 88 jsr unPlot.unPlotAfterX 1885 6FBB 4C 88 6E jmp mrLoopi 1886 6FBE MIRVcheckLowerX 1887 6FBE BD 47 3E lda xtraj01,x 1888 6FC1 C9 40 cmp #mountaintable 1919 7003 85 92 sta temp+1 1920 ; adw mountaintable --- it does not work!!!!!!!! and should! (OMC bug?) #temp 1921 7005 A0 00 ldy #0 1922 7007 AD 78 3E lda ytraj+1 1923 700A D1 91 cmp (temp),y 1924 700C B0 25 bcs mrHit 1925 1926 1927 1928 700E mrSkipCollisionCheck 1929 1930 ;mwa xtraj01 xdraw 1931 700E BD 47 3E lda xtraj01,x 1932 7011 85 80 sta xdraw 1933 7013 BD 4C 3E lda xtraj02,x 1934 7016 85 81 sta xdraw+1 1935 7018 AD 78 3E 85 82 AD + mwa ytraj+1 ydraw 1936 1937 7022 20 48 88 jsr unPlot.unPlotAfterX 1938 7025 AE 6A 3E ldx MirvMissileCounter 1939 7028 F0 03 4C 88 6E jne mrLoopi 1940 702D 20 8B 89 jsr PlotPointer ; pointer only for bullet nr 0 1941 1942 7030 4C 88 6E jmp mrLoopi 1943 1944 7033 mrHit 1945 ; we have to make unPlot over the screen (to initialise it) 1946 ; before actual explosion 1947 7033 A9 00 85 80 85 81 mwa #0 xdraw 1948 7039 A9 C7 85 82 mva #screenheight-1 ydraw 1949 703D 20 48 88 jsr unPlot.unPlotAfterX 1950 7040 AE 6A 3E ldx MirvMissileCounter 1951 7043 A0 00 ldy #0 1952 ; concurrent moving xtraj+1 -> xdraw and calculating temp 1953 7045 18 clc 1954 7046 BD 47 3E lda xtraj01,x 1955 7049 85 80 sta xdraw 1956 704B 69 13 adc #mountaintable 1961 7056 85 92 sta temp+1 1962 7058 B1 91 lda (temp),y 1963 705A 85 82 sta ydraw 1964 705C 84 83 sty ydraw+1 ;we know that y=0 1965 705E 20 D6 5E jsr missile ; explode .... 1966 7061 mrEndOfFlight 1967 7061 AE 6A 3E ldx MirvMissileCounter 1968 7064 A9 00 85 80 85 81 mwa #0 xdraw 1969 706A A9 C7 85 82 mva #screenheight-1 ydraw 1970 706E 20 48 88 jsr unPlot.unPlotAfterX 1971 7071 AE 6A 3E ldx MirvMissileCounter 1972 7074 A9 01 lda #1 1973 7076 9D 65 3E sta MirvDown,x 1974 7079 MIRVnextBullet 1975 ; checking if all bullets already fallen down 1976 7079 A2 04 ldx #4 1977 707B MIRVcheckIfEnd 1978 707B BD 65 3E lda MirvDown,x 1979 707E F0 05 beq MIRVstillNotAll 1980 7080 CA dex 1981 7081 10 F8 bpl MIRVcheckIfEnd 1982 7083 30 03 bmi MIRValreadyAll 1983 7085 MIRVstillNotAll 1984 7085 4C 88 6E jmp mrLoopi 1985 7088 MIRValreadyAll 1986 7088 A5 80 8D 39 3E A5 + mwa xdraw xcircle ; we must store them (for a while) 1987 7092 A5 82 8D 3B 3E mva ydraw ycircle ; xdraw and ydraw 1988 7097 A9 00 85 80 85 81 mwa #0 xdraw 1989 709D A9 C7 85 82 mva #screenheight-1 ydraw 1990 70A1 AE 6A 3E ldx MirvMissileCounter 1991 70A4 20 48 88 jsr unPlot.unPlotAfterX 1992 70A7 AD 39 3E 85 80 AD + mwa xcircle xdraw 1993 70B1 AD 3B 3E 85 82 mva ycircle ydraw 1994 1995 ; we must do it manually because of the VOID pointer 1996 1997 ; temporary removing tanks from the screen (otherwise they will fall down with soil) 1998 70B6 A5 8B 85 A7 mva TankNr tempor2 1999 70BA A9 01 8D FB 3D mva #1 Erase 2000 70BF 20 E2 84 jsr drawtanks 2001 70C2 A5 A7 85 8B mva tempor2 TankNr 2002 70C6 A9 00 8D FB 3D mva #0 Erase 2003 70CB 20 F7 85 jsr SoilDown2 2004 70CE A9 01 8D 96 3D mva #1 HitFlag 2005 ;jsr drawtanks 2006 70D3 60 rts 2007 .endp 2008 2009 ; ------------------------------------------------- 2010 70D4 CheckCollisionWithTank .proc 2011 ; ------------------------------------------------- 2012 70D4 A2 00 ldx #0 2013 70D6 CheckCollisionWithTankLoop 2014 2015 70D6 BD 9D 3D lda xtankstableH,x 2016 70D9 CD 76 3E cmp xtraj+2 2017 70DC D0 06 bne Condition01 2018 70DE BD 97 3D lda xtankstableL,x 2019 70E1 CD 75 3E cmp xtraj+1 2020 70E4 Condition01 2021 70E4 B0 40 bcs LeftFromTheTank ;add 8 double byte 2022 70E6 18 clc 2023 70E7 69 08 adc #8 2024 70E9 A8 tay 2025 70EA BD 9D 3D lda xtankstableH,x 2026 70ED 69 00 adc #0 2027 70EF CD 76 3E cmp xtraj+2 2028 70F2 D0 03 bne Condition02 2029 70F4 CC 75 3E cpy xtraj+1 2030 70F7 Condition02 2031 70F7 90 2D bcc RightFromTheTank 2032 2033 70F9 BD A3 3D lda ytankstable,x 2034 70FC CD 78 3E cmp ytraj+1 ; check range 2035 70FF 90 25 bcc BelowTheTank ;(ytankstable,ytankstable+3) 2036 7101 E9 04 sbc #4 2037 7103 CD 78 3E cmp ytraj+1 2038 7106 B0 1E bcs OverTheTank 2039 7108 A9 01 8D 96 3D mva #1 HitFlag 2040 710D AD 75 3E 8D 32 3E + mwa xtraj+1 XHit 2041 7119 AD 78 3E 8D 34 3E + mwa ytraj+1 YHit 2042 7125 60 rts ; in X there is an index of the hit tank 2043 7126 RightFromTheTank 2044 7126 LeftFromTheTank 2045 7126 OverTheTank 2046 7126 BelowTheTank 2047 7126 E8 inx 2048 7127 EC 19 3D cpx NumberOfPlayers 2049 712A D0 AA bne CheckCollisionWithTankLoop 2050 712C 60 rts 2051 .endp 2052 ;-------------------------------------------------- 2053 712D CalculateExplosionRange0 2054 ;-------------------------------------------------- 2055 2056 ;the same as below, but without summing up 2057 ;(for the first or single explosion) 2058 2059 ;zero soil fall out ranges 2060 712D A9 40 8D FC 3D A9 + mwa #screenwidth RangeLeft 2061 7137 A9 00 lda #0 2062 7139 8D FE 3D sta RangeRight 2063 713C 8D FF 3D sta RangeRight+1 2064 713F A9 0B 8D 49 3F mva #11 ExplosionRadius 2065 ;-------------------------------------------------- 2066 7144 CalculateExplosionRange .proc 2067 ;-------------------------------------------------- 2068 ;calculates total horizontal range of explosion by 2069 ;"summing up" ranges of all separate explosions 2070 2071 7144 18 A5 80 6D 49 3F + adw xdraw ExplosionRadius WeaponRangeRight 2072 7155 AD 03 3E C9 01 D0 + cpw WeaponRangeRight #screenwidth-1 2073 7161 90 0A bcc NotOutOfTheScreenRight 2074 7163 A9 3F 8D 02 3E A9 + mwa #screenwidth-1 WeaponRangeRight 2075 2076 716D NotOutOfTheScreenRight 2077 716D 38 A5 80 ED 49 3F + sbw xdraw ExplosionRadius WeaponRangeLeft 2078 717E AD 01 3E lda WeaponRangeLeft+1 2079 7181 10 08 bpl NotOutOfTheScreenLeft 2080 7183 A9 00 lda #0 2081 7185 8D 00 3E sta WeaponRangeLeft 2082 7188 8D 01 3E sta WeaponRangeLeft+1 2083 718B NotOutOfTheScreenLeft 2084 2085 718B AD FD 3D CD 01 3E + cpw RangeLeft WeaponRangeLeft 2086 7199 90 0C bcc CheckRangeRight 2087 719B AD 00 3E 8D FC 3D + mwa WeaponRangeLeft RangeLeft 2088 71A7 CheckRangeRight 2089 71A7 AD FF 3D CD 03 3E + cpw RangeRight WeaponRangeRight 2090 71B5 B0 0C bcs RangesChecked 2091 71B7 AD 02 3E 8D FE 3D + mwa WeaponRangeRight RangeRight 2092 71C3 RangesChecked 2093 2094 71C3 60 rts 2095 .endp 2096 2097 ;-------------------------------------------------- 2098 71C4 DecreaseWeaponAfterShoot .proc 2099 ;-------------------------------------------------- 2100 71C4 A6 8B ldx TankNr 2101 71C6 BD 89 3D lda ActiveWeapon,x 2102 71C9 20 DC 71 jsr DecreaseWeapon 2103 ; and here we have amount of possessed ammo for given weapon 2104 2105 71CC C9 00 cmp #0 2106 71CE D0 05 bne AmmunitionDecreased 2107 71D0 A9 00 lda #0 ;if ammo for given weapon ends 2108 71D2 9D 89 3D sta ActiveWeapon,x ;then set to default weapon (baby missile) 2109 71D5 AmmunitionDecreased 2110 71D5 A9 63 lda #99 2111 71D7 A0 00 ldy #0 2112 71D9 91 B4 sta (weaponPointer),y ;baby missile - always 99 pieces 2113 2114 ;there is a good value in temp after jsr DecreaseWeapon 2115 2116 71DB 60 rts 2117 .endp 2118 2119 ;-------------------------------------------------- 2120 71DC DecreaseWeapon .proc 2121 ; in: A <-- Weapon number, TankNr 2122 ; decreases 1 bullet from a weapon(A) of tank(TankNr) 2123 ;-------------------------------------------------- 2124 71DC 20 E5 71 jsr HowManyBullets 2125 71DF 38 sec 2126 71E0 E9 01 sbc #1 2127 71E2 91 B4 sta (weaponPointer),y ; we have good values after HowManyBullets 2128 71E4 60 rts 2129 .endp 2130 2131 ;-------------------------------------------------- 2132 71E5 HowManyBullets .proc 2133 ; in: A <-- Weapon number, TankNr 2134 ; out: A <-- How many bullets in the weapon 2135 ; how many bullets weapon of tank(TankNr) has, Result w A 2136 ;-------------------------------------------------- 2137 71E5 A8 tay 2138 71E6 A6 8B ldx TankNr 2139 71E8 BD 07 41 lda TanksWeaponsTableL,x 2140 71EB 85 B4 sta weaponPointer 2141 71ED BD 0D 41 lda TanksWeaponsTableH,x 2142 71F0 85 B5 sta weaponPointer+1 2143 2144 ;ldy #$35 ; parachute 2145 71F2 B1 B4 lda (weaponPointer),y ; and we have number of bullets in A 2146 71F4 60 rts 2147 .endp 2148 2149 2150 2151 .ENDIF 2152 676 677 678 ;-------------------------------------------------- 679 71F5 DecreaseEnergyX .proc 680 ;Decreases energy of player nr X 681 ;increases his financial loss 682 ;increases gain of tank TankNr 683 ;-------------------------------------------------- 684 71F5 8C 50 3D sty EnergyDecrease 685 ; Loose increase 686 71F8 BD 44 3D lda looseL,x 687 71FB 18 clc 688 71FC 6D 50 3D adc EnergyDecrease 689 71FF 9D 44 3D sta looseL,x 690 7202 BD 3E 3D lda looseH,x 691 7205 69 00 adc #$00 692 7207 9D 3E 3D sta looseH,x 693 ; Energy now, not less than 0 694 720A BD 4A 3D lda Energy,x 695 720D CD 50 3D cmp EnergyDecrease 696 7210 90 05 bcc ldahashzero 697 ;sec 698 7212 ED 50 3D sbc EnergyDecrease 699 7215 10 02 bpl NotNegativeEnergy 700 7217 ldahashzero 701 7217 A9 00 lda #0 702 7219 NotNegativeEnergy 703 7219 9D 4A 3D sta Energy,x 704 ;now increase the gain of the shooting tank 705 721C phx Macro: PHX [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 721C 8A txa 2 721D 48 pha Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 706 721E A6 8B ldx TankNr 707 7220 18 clc 708 7221 BD 38 3D lda gainL,x 709 7224 6D 50 3D adc EnergyDecrease 710 7227 9D 38 3D sta gainL,x 711 722A BD 32 3D lda gainH,x 712 722D 69 00 adc #$00 713 722F 9D 32 3D sta gainH,x 714 7232 plx Macro: PLX [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 7232 68 pla 2 7233 AA tax Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 715 7234 60 rts 716 .endp 717 718 ;-------------------------------------------------- 719 7235 GetRandomWind .proc 720 ;-------------------------------------------------- 721 7235 AD 0A D2 lda random 722 7238 CD 93 3D cmp MaxWind 723 723B B0 F8 bcs GetRandomWind ; if more than MaxWind then randomize again 724 723D 8D 91 3D sta Wind 725 7240 A9 00 8D 92 3D mva #$00 Wind+1 726 ; multiply Wind by 16 and take it as a decimal part (0.Wind) 727 7245 aslw Wind Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 7245 0E 91 3D ASL WIND 2 7248 2E 92 3D ROL WIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 728 724B aslw Wind Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 724B 0E 91 3D ASL WIND 2 724E 2E 92 3D ROL WIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 729 7251 aslw Wind Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 7251 0E 91 3D ASL WIND 2 7254 2E 92 3D ROL WIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 730 7257 aslw Wind Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 7257 0E 91 3D ASL WIND 2 725A 2E 92 3D ROL WIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 731 725D AD 0A D2 lda random 732 7260 29 01 and #$01 733 7262 8D 94 3D sta WindOrientation 734 7265 60 rts 735 .endp 736 737 ;-------------------------------------------------- 738 7266 PMoutofScreen .proc 739 ;-------------------------------------------------- 740 7266 A9 00 lda #$00 ; let all P/M disappear 741 7268 8D 00 D0 sta hposp0 742 726B 8D 01 D0 sta hposp0+1 743 726E 8D 02 D0 sta hposp0+2 744 7271 8D 03 D0 sta hposp0+3 745 7274 8D 04 D0 sta hposp0+4 746 7277 8D 05 D0 sta hposp0+5 747 727A 8D 06 D0 sta hposp0+6 748 727D 8D 07 D0 sta hposp0+7 749 7280 60 rts 750 .endp 751 752 ;-------------------------------------------------- 753 7281 .nowarn .proc WeaponCleanup; 754 ; cleaning of the weapon possesion tables 755 ; (99 of Baby Missles, all other weapons=0) 756 ;-------------------------------------------------- 757 7281 A2 3F ldx #$3f 758 7283 A9 00 lda #$0 759 7285 loop05 760 7285 9D 87 3F sta TanksWeapon1,x 761 7288 9D C7 3F sta TanksWeapon2,x 762 728B 9D 07 40 sta TanksWeapon3,x 763 728E 9D 47 40 sta TanksWeapon4,x 764 7291 9D 87 40 sta TanksWeapon5,x 765 7294 9D C7 40 sta TanksWeapon6,x 766 7297 CA dex 767 7298 D0 04 bne skip13 768 729A A9 63 lda #99 769 729C D0 E7 bne loop05 770 729E 10 E5 skip13 bpl loop05 771 72A0 60 rts 772 .endp 773 774 ;-------------------------------------------------- 775 72A1 Initialize .proc 776 ;Initialization sequence 777 ;-------------------------------------------------- 778 ;jsr GenerateOffensiveTextTables 779 ;jsr GenerateDeffensiveTextTables 780 781 72A1 A9 00 lda #0 782 72A3 8D FB 3D sta Erase 783 72A6 8D A9 3E sta tracerflag 784 72A9 8D 49 48 sta oldPlotPointerX 785 72AC 8D 4A 48 sta oldPlotPointerX+1 786 787 72AF A9 02 8D C6 02 mva #$2 colpf2s 788 72B4 A9 0C 8D C7 02 mva #12 colpf3s 789 72B9 A9 A4 8D F4 02 mva #>WeaponFont chbas 790 791 ;parameter for old plot (unPlot) max 5 points 792 72BE A2 04 ldx #4 793 72C0 SetunPlots 794 72C0 A9 10 lda #display 797 72C7 9D 8F 3E sta oldplotH,x 798 72CA A9 00 lda #0 799 72CC 9D 9E 3E sta oldply,x 800 72CF 9D 99 3E sta oldora,x 801 72D2 CA dex 802 72D3 10 EB bpl SetunPlots 803 804 ;setting up P/M graphics 805 72D5 A9 98 lda #>pmgraph 806 72D7 8D 07 D4 sta pmbase 807 72DA AD 2F 02 lda dmactls 808 72DD 09 38 ora #$38 ; Players and Missiles single lined 809 72DF 8D 2F 02 sta dmactls 810 72E2 A9 03 lda #$03 ; P/M on 811 72E4 8D 1D D0 sta pmcntl 812 72E7 A9 01 lda #$01 813 72E9 8D 0C D0 sta sizem ; there will be only M0, double width 814 72EC 8D 08 D0 sta sizep0 ; P0-P3 widths 815 72EF 8D 09 D0 sta sizep0+1 816 72F2 8D 0A D0 sta sizep0+2 817 72F5 8D 0B D0 sta sizep0+3 818 72F8 A9 10 lda #$10 ; P/M priorities (bit 4 joins missiles) 819 72FA 8D 6F 02 sta gtictls 820 72FD 20 66 72 jsr PMoutofScreen 821 7300 A9 50 lda #$50 ; temporary colours of sprites under tanks 822 7302 8D C0 02 sta $2c0 823 7305 A9 30 lda #$30 824 7307 8D C1 02 sta $2c1 825 730A A9 70 lda #$70 826 730C 8D C2 02 sta $2c2 827 730F A9 90 lda #$90 828 7311 8D C3 02 sta $2c3 829 7314 A9 B0 LDA #$B0 830 7316 8D C7 02 STA COLPF3S 831 7319 A9 00 8D 04 D4 mva #0 hscrol 832 833 834 ;let the tanks be visible! 835 731E A2 05 ldx #5 836 7320 A9 01 lda #1 ; tank is visible 837 7322 MakeTanksVisible 838 7322 9D 51 3D sta eXistenZ,x 839 7325 CA dex 840 7326 10 FA bpl MakeTanksVisible 841 842 843 7328 A2 00 ldx #0 844 732A 8A txa 845 732B ClearResults 846 732B 9D 5D 3D sta ResultsTable,x 847 732E E8 inx 848 732F E0 06 cpx #MaxPlayers 849 7331 D0 F8 bne ClearResults 850 851 7333 A9 01 8D 4B 3F mva #1 CurrentRoundNr ;we start from round 1 852 853 7338 60 rts 854 .endp 855 856 7339 SetDLI .proc 857 7339 VDLI DLIinterrupt Macro: VDLI [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 7339 A0 49 LDY # DLIINTERRUPT 5 733D A9 C0 LDA #$C0 6 733F 8C 00 02 STY $0200 7 7342 8E 01 02 STX $0201 8 7345 8D 0E D4 STA NMIEN Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\program.asm 858 7348 60 rts 859 .endp 860 7349 DLIinterrupt .proc 861 7349 48 pha 862 734A A9 02 lda #$02 ; color of playground 863 734C 8D 0A D4 sta WSYNC 864 734F 8D 18 D0 sta COLPF2 865 7352 68 pla 866 7353 40 rti 867 .endp 868 ;---------------------------------------------- 869 7354 RandomizeSequence .proc 870 ; in: NumberOfPlayers 871 ; out: TankSequence 872 ; how: get random number lower than NumberOfPlayers 873 ; put it in the first slot. 874 ; get another random number lower than NumberOfPlayers 875 ; check if was previously saved in first slot 876 ; if not then save it in second slot 877 ; repeat untill NumberOfPlayers 878 879 7354 A2 00 ldx #0 880 7356 GetRandomAgain0 881 7356 AD 0A D2 lda RANDOM 882 7359 29 07 and #$07 ;NumberOfPlayers < 7 883 735B CD 19 3D cmp NumberOfPlayers 884 735E B0 F6 bcs GetRandomAgain0 885 7360 9D 1A 3D sta TankSequence,x 886 ;now first slot is ready, nexts slots are handled 887 ;in a more complicated way 888 889 7363 GetRandomAgainX 890 7363 AD 0A D2 lda RANDOM 891 7366 29 07 and #$07 ;NumberOfPlayers < 7 892 7368 CD 19 3D cmp NumberOfPlayers 893 736B B0 F6 bcs GetRandomAgainX 894 895 ;now we have to check if the value was not used 896 ;in previous slots 897 898 736D 86 91 stx temp 899 736F A4 91 ldy temp 900 7371 UsageLoop 901 7371 D9 1A 3D cmp TankSequence,y 902 7374 F0 ED beq GetRandomAgainX ;apparently we have already used this value 903 7376 88 dey 904 7377 10 F8 bpl UsageLoop 905 906 ;well, looks like this value is new! 907 7379 E8 inx 908 737A 9D 1A 3D sta TankSequence,x 909 910 737D 86 91 stx temp 911 737F E6 91 A5 91 inc:lda temp ;x+1 912 913 7383 CD 19 3D cmp NumberOfPlayers 914 7386 D0 DB bne GetRandomAgainX 915 7388 60 rts 916 .endp 917 ;---------------------------------------------- 918 7389 RandomizeAngle .proc ; 919 ; routine returns in A 920 ; a valid angle for the tank's barrel. 921 ; X is not changed 922 ;---------------------------------------------- 923 924 ;valid angle values are ((256-90)..255) and (0..90) 925 ;it means that values 91..165 must be elliminated... 926 ;so, lets randomize someting between 0 and 180 927 ;and substract this value from 90 928 7389 AD 0A D2 lda RANDOM 929 930 738C C9 B4 cmp #180 931 738E B0 F9 bcs RandomizeAngle 932 933 934 7390 85 91 sta temp 935 7392 A9 5A lda #90 ; CARRY=0 here 936 7394 E5 91 sbc temp 937 938 7396 60 rts 939 .endp 940 ;---------------------------------------------- 941 7397 RandomizeForce .proc 942 ; routine returns in EnergyTable/L/H 943 ; valid force of shooting for TankNr 944 ; in X must be TankNr 945 ; low and high randomize boundary passed as word value 946 ; RandBoundaryLow 947 ; RandBoundaryHigh 948 ;---------------------------------------------- 949 950 951 7397 BD 76 3D lda MaxEnergyTableL,x 952 739A 85 91 sta temp 953 739C BD 7C 3D lda MaxEnergyTableH,x 954 739F 85 92 sta temp+1 955 73A1 GetRandomAgain 956 73A1 AD 0A D2 lda RANDOM 957 ; gets values in range(256,765) 958 73A4 85 93 sta temp2 959 73A6 AD 0A D2 lda RANDOM ; :) 960 73A9 29 03 and #%00000011 ;(0..1023) 961 73AB 85 94 sta temp2+1 962 963 73AD AD C8 50 C5 94 D0 + cpw RandBoundaryLow temp2 964 73B9 B0 E6 bcs GetRandomAgain 965 966 73BB AD CA 50 C5 94 D0 + cpw RandBoundaryHigh temp2 967 73C7 90 D8 bcc GetRandomAgain 968 969 73C9 A5 92 C5 94 D0 04 + cpw temp temp2 970 73D3 B0 08 bcs EnergyInRange 971 972 73D5 A5 91 85 93 A5 92 + mwa temp temp2 973 974 73DD EnergyInRange 975 976 73DD A5 93 lda temp2 977 73DF 9D 6A 3D sta EnergyTableL,x 978 73E2 A5 94 lda temp2+1 979 73E4 9D 70 3D sta EnergyTableH,x 980 981 73E7 60 rts 982 .endp 983 984 ;---------------------------------------------- 985 73E8 MoveBarrelToNewPosition .proc 986 73E8 20 F9 84 jsr DrawTankNr 987 73EB A6 8B ldx TankNr 988 73ED BD 82 3D lda AngleTable,x 989 73F0 18 clc 990 73F1 69 5A adc #90 ;shift angle to the positive values 991 73F3 85 91 sta temp 992 73F5 AD 88 3D lda NewAngle 993 73F8 18 clc 994 73F9 69 5A adc #90 995 73FB C5 91 cmp temp 996 73FD F0 20 beq BarrelPositionIsFine 997 73FF 90 0F bcc rotateLeft ; older is bigger 998 7401 rotateRight;older is lower 999 7401 FE 82 3D inc angleTable,x 1000 7404 D0 E2 bne MoveBarrelToNewPosition 1001 1002 7406 A9 30 85 88 mva #$30 CharCode ; if angle goes through 0 we clear the barrel 1003 740A 20 23 85 jsr drawtankNrX 1004 1005 740D 4C E8 73 jmp MoveBarrelToNewPosition 1006 7410 rotateLeft 1007 7410 DE 82 3D dec angleTable,x 1008 7413 10 D3 bpl MoveBarrelToNewPosition 1009 7415 A9 2E 85 88 mva #$2e CharCode 1010 7419 20 23 85 jsr drawtankNrX 1011 1012 741C 4C E8 73 jmp MoveBarrelToNewPosition 1013 1014 741F BarrelPositionIsFine 1015 741F 60 rts 1016 1017 .endp 1018 1019 ;---------------------------------------------- 1020 7420 SortSequence .proc ; 1021 ;---------------------------------------------- 1022 ; here we try to get a sequence of tanks for two 1023 ; purposes: 1024 ; 1. to make up shooting sequence for the next round (from down to top) 1025 ; 2. to display game results more nicely (from top to down) 1026 ; 1027 ; I think I will go for a stupid bubble sort... 1028 ; it is easy to test :) 1029 ; 1030 ; Results are in ResultsTable, in SortedTable we want to 1031 ; have numbers of tanks from the worst to the best. 1032 ; in other words, if ResultsTable=(5,4,65,23,3,6) 1033 ; the SortedTable=(4,1,0,5,3,2) 1034 ; let's assume initially the TankSequence=(0,1,2,3,4,5) 1035 1036 7420 A2 00 ldx #0 1037 7422 SequenceStart 1038 7422 8A txa 1039 7423 9D 1A 3D sta TankSequence,x 1040 7426 E8 inx 1041 7427 E0 06 cpx #MaxPlayers 1042 7429 D0 F7 bne SequenceStart 1043 1044 ; we will need a TempResults (TR) table to fiddle with 1045 742B A2 00 ldx #0 1046 742D movetotemp 1047 742D BD 5D 3D lda ResultsTable,x 1048 7430 9D 63 3D sta TempResults,x 1049 7433 E8 inx 1050 7434 EC 19 3D cpx NumberOfPlayers 1051 7437 D0 F4 bne movetotemp 1052 1053 ; i=0:sortflag=0 1054 ;loop: 1055 ; if TR(i) < TX(i+1) then i=i+1: here quit if i=numberofplayers 1056 ; or goto loop: 1057 ; else 1058 ; temp=TR(i): tempo=TankSequence(i) 1059 ; TR(i)=TR(i+1): TankSequence(i)=TankSequence(i+1) 1060 ; TR(i+1)=temp: TankSequence(i+1)=tempo 1061 ; i=i+1 1062 ; sortflag=sortflag+1 1063 ; go loop: 1064 ; if sortflag=0 then finished, else repeat... 1065 ; 1066 ; or something like this :) 1067 7439 AE 19 3D ldx NumberOfPlayers 1068 743C CA dex 1069 743D 86 92 stx temp+1 ; for checking end of the loop only 1070 1071 743F Bubble 1072 743F A2 00 ldx #0 ;i=x 1073 7441 86 93 stx temp2 ; sortflag=temp2 1074 1075 7443 BubbleBobble 1076 7443 BD 63 3D lda TempResults,x 1077 7446 DD 64 3D cmp TempResults+1,x 1078 7449 F0 21 beq nextishigher ; this is to block hangs when 2 same values meet 1079 744B 90 1F bcc nextishigher 1080 ;here we must swap values 1081 ;because next is smaller than previous 1082 744D 85 91 sta temp 1083 744F BD 64 3D lda TempResults+1,x 1084 7452 9D 63 3D sta TempResults,x 1085 7455 A5 91 lda temp 1086 7457 9D 64 3D sta TempResults+1,x 1087 ; 1088 745A BD 1A 3D lda TankSequence,x 1089 745D 85 91 sta temp 1090 745F BD 1B 3D lda TankSequence+1,x 1091 7462 9D 1A 3D sta TankSequence,x 1092 7465 A5 91 lda temp 1093 7467 9D 1B 3D sta TankSequence+1,x 1094 746A E6 93 inc temp2 1095 746C nextishigher 1096 746C E8 inx 1097 746D E4 92 cpx temp+1 ;cpx ^NumberOfPlayers-1 1098 746F D0 D2 bne BubbleBobble 1099 1100 7471 A5 93 lda temp2 1101 1102 7473 D0 CA bne Bubble 1103 1104 7475 60 rts 1105 .endp 1106 ;---------------------------------------------- 1107 7476 icl 'textproc.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 3 4 .IF *>0 5 ;---------------------------------------- 6 ; this module contains routines used in text mode 7 ; like shop and start-up options 8 ;---------------------------------------- 9 ;-------------------------------------------------- 10 7476 getkey .proc; waits for pressing a key and returns pressed value in A 11 ;-------------------------------------------------- 12 7476 pause 5 Macro: PAUSE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 2 7476 A2 05 ldx #5 3 7478 ?PAUSELOOP 3 7478 AD 0B D4 LDA VCOUNT 4 747B 8D 0A D4 STA WSYNC 5 747E 8D 0A D4 STA WSYNC 6 7481 8D 0A D4 STA WSYNC 7 7484 CD 0B D4 ?WA CMP VCOUNT 8 7487 D0 FB BNE ?WA Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 5 7489 CA dex 6 748A D0 EC bne ?PAUSELOOP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 13 748C AD 0F D2 lda SKSTAT 14 748F C9 FF cmp #$ff 15 7491 F0 12 beq lopx01 16 7493 C9 F7 cmp #$f7 17 7495 D0 DF bne getkey ; I guess it waits for RELEASING a key 18 7497 AD 78 02 lda JSTICK0 19 749A 29 0F and #$0f 20 749C C9 0F cmp #$0f 21 749E D0 D6 bne getkey ; waits for not moving the joy 22 74A0 AD 10 D0 lda TRIG0 23 74A3 F0 D1 beq getkey ; waits for releasing FIRE 24 25 26 74A5 AD 0F D2 lopx01 lda SKSTAT 27 74A8 C9 FF cmp #$ff 28 74AA F0 0A beq checkJoyGetKey ; key not pressed, check Joy 29 74AC C9 F7 cmp #$f7 30 74AE F0 06 beq checkJoyGetKey ; key not pressed, check Joy 31 32 74B0 AD 09 D2 lda kbcode 33 74B3 29 3F and #$3f ;CTRL and SHIFT ellimination 34 74B5 60 rts 35 74B6 checkJoyGetKey 36 ;------------JOY------------- 37 ;happy happy joy joy 38 ;check for joystick now 39 74B6 AD 78 02 lda JSTICK0 40 74B9 29 0F and #$0f 41 74BB C9 0F cmp #$0f 42 74BD F0 05 beq notpressedJoyGetKey 43 74BF A8 tay 44 74C0 B9 99 50 lda joyToKeyTable,y 45 74C3 60 rts 46 74C4 notpressedJoyGetKey 47 ;fire 48 74C4 AD 10 D0 lda TRIG0 49 74C7 D0 DC bne lopx01 50 74C9 A9 0C lda #$0c ;Return key 51 74CB 60 rts 52 .endp 53 ;-------------------------------------------------- 54 74CC getkeynowait .proc; 55 ;-------------------------------------------------- 56 74CC AD 0F D2 lda SKSTAT 57 74CF C9 FF cmp #$ff 58 74D1 F0 F9 beq getkeynowait 59 74D3 C9 F7 cmp #$f7 60 74D5 F0 F5 beq getkeynowait ; I guess it waits for RELEASING a key 61 74D7 AD 09 D2 lda kbcode 62 74DA 29 3F and #$3f ;CTRL and SHIFT ellimination 63 74DC 60 rts 64 .endp 65 ;-------------------------------------------------- 66 74DD Options .proc 67 ;-------------------------------------------------- 68 ; start-up screen - options, etc. 69 ; this function returns: 70 ; - number of players (NumberOfPlayers) 71 ; - money each player has on the beginning of the game (moneyL i moneyH) 72 ; - and I am sure maxwind, gravity, ???? 73 74 74DD A9 00 8D 18 3F mva #0 OptionsY 75 76 74E2 OptionsMainLoop 77 78 74E2 20 77 75 jsr OptionsInversion 79 74E5 20 76 74 jsr getkey 80 74E8 C9 0F cmp #$f ;cursor down 81 74EA D0 12 bne OptionsNoDown 82 74EC EE 18 3F AD 18 3F inc:lda OptionsY 83 74F2 C9 04 cmp #maxoptions 84 74F4 D0 EC bne OptionsMainLoop 85 74F6 A9 03 8D 18 3F mva #3 OptionsY 86 74FB 4C E2 74 jmp OptionsMainLoop 87 88 74FE OptionsNoDown 89 74FE C9 0E cmp #$e ;cursor up 90 7500 D0 0D bne OptionsNoUp 91 7502 CE 18 3F dec OptionsY 92 7505 10 DB bpl OptionsMainLoop 93 7507 A9 00 8D 18 3F mva #0 OptionsY 94 750C 4C E2 74 jmp OptionsMainLoop 95 96 750F OptionsNoUp 97 750F C9 06 cmp #$6 ;cursor left 98 7511 D0 11 bne OptionsNoLeft 99 7513 AE 18 3F ldx OptionsY 100 7516 DE 14 3F dec OptionsTable,X 101 7519 BD 14 3F lda OptionsTable,X 102 751C 10 C4 bpl OptionsMainLoop 103 751E FE 14 3F inc OptionsTable,X 104 7521 4C E2 74 jmp OptionsMainLoop 105 106 7524 OptionsNoLeft 107 7524 C9 07 cmp #$7 ;cursor right 108 7526 D0 13 bne OptionsNoRight 109 110 7528 AE 18 3F ldx OptionsY 111 752B FE 14 3F inc OptionsTable,X 112 752E BD 14 3F lda OptionsTable,X 113 7531 C9 05 cmp #5 114 7533 D0 AD bne OptionsMainLoop 115 7535 DE 14 3F dec OptionsTable,X 116 7538 4C E2 74 jmp OptionsMainLoop 117 118 753B OptionsNoRight 119 753B C9 0C cmp #$c ;Return key 120 753D D0 03 bne OptionsNoReturn 121 753F 4C 45 75 jmp OptionsFinished 122 7542 OptionsNoReturn 123 7542 4C E2 74 jmp OptionsMainLoop 124 125 7545 OptionsFinished 126 ;first option 127 7545 AC 14 3F ldy OptionsTable 128 7548 C8 iny 129 7549 C8 iny 130 754A 8C 19 3D sty NumberOfPlayers ;1=1 player (but minimum is 2) 131 132 ;second option (cash) 133 134 135 754D AC 15 3F ldy OptionsTable+1 136 7550 A2 00 ldx #0 137 7552 skip10 138 7552 B9 1E 3F lda CashOptionL,y 139 7555 9D 2C 3D sta moneyL,x 140 7558 B9 19 3F lda CashOptionH,y 141 755B 9D 26 3D sta moneyH,x 142 755E E8 inx 143 755F EC 19 3D cpx NumberOfPlayers 144 7562 D0 EE bne skip10 145 146 ;third option (gravity) 147 7564 AC 16 3F ldy OptionsTable+2 148 7567 B9 23 3F lda GravityTable,y 149 756A 8D 90 3D sta gravity 150 151 ;fourth option (wind) 152 153 756D AC 17 3F ldy OptionsTable+3 154 7570 B9 28 3F lda MaxWindTable,y 155 7573 8D 93 3D sta MaxWind 156 7576 60 rts 157 ;-------- 158 ; inversing choosed option (cursor) 159 ;-------- 160 7577 OptionsInversion 161 7577 A9 F3 85 91 A9 31 + mwa #OptionsHere temp 162 757F A0 00 ldy #0 163 7581 OptionsInversionLoop1 164 7581 B1 91 lda (temp),y 165 7583 29 7F and #$7F 166 7585 91 91 sta (temp),y 167 7587 18 A5 91 69 01 85 + adw temp #1 168 7592 A5 92 C9 32 D0 04 + cpw temp #OptionsScreenEnd 169 759C D0 E3 bne OptionsInversionLoop1 170 ;here all past inversions are gone... 171 172 759E A9 F3 85 91 A9 31 + mwa #OptionsHere temp 173 75A6 A9 00 85 93 mva #0 temp2 ;option number pointer 174 75AA 18 A5 91 69 0B 85 + adw temp #11 ;offset of the first option=11 175 75B5 OptionsSetMainLoop 176 75B5 A6 93 ldx temp2 177 75B7 BD 14 3F lda OptionsTable,x 178 75BA 0A asl 179 75BB 0A asl 180 75BC 7D 14 3F adc OptionsTable,x ;OptionsTable value * 5 181 75BF A8 tay 182 75C0 A2 04 ldx #4 183 75C2 OptionSetLoop 184 75C2 B1 91 lda (temp),y 185 75C4 09 80 ora #$80 186 75C6 91 91 sta (temp),y 187 75C8 C8 iny 188 75C9 CA dex 189 75CA 10 F6 bpl OptionSetLoop ;here option is highlighted 190 ; 191 ; next option 192 75CC 18 A5 91 69 28 85 + adw temp #40 ;jump to next line 193 75D7 E6 93 A5 93 inc:lda temp2 194 75DB C9 04 cmp #4 ;number of options 195 75DD D0 D6 bne OptionsSetMainLoop 196 197 ;inversing the first few chars of the selected line (OptionsY) 198 75DF AD 18 3F 85 91 mva OptionsY temp 199 75E4 A9 00 85 92 85 93 mwa #0 temp+1 200 75EA 06 91 asl temp 201 75EC 26 92 rol temp+1 202 75EE 06 91 asl temp 203 75F0 26 92 rol temp+1 204 75F2 06 91 asl temp 205 75F4 26 92 rol temp+1 206 75F6 A5 91 85 93 A5 92 + mwa temp temp2 ;here is OptionsY*8 207 75FE 06 91 asl temp 208 7600 26 92 rol temp+1 209 7602 06 91 asl temp 210 7604 26 92 rol temp+1 211 ;here is 32*OptionsY 212 7606 18 A5 91 65 93 85 + adw temp temp2 213 ;in temp is 40*OptionsY 214 7613 18 A5 91 69 F3 85 + adw temp #OptionsHere 215 ;now in temp is adres of the line to be inversed 216 7620 A0 07 ldy #7 ;8 letters to invers 217 7622 OptionsYLoop 218 7622 B1 91 lda (temp),y 219 7624 09 80 ora #$80 220 7626 91 91 sta (temp),y 221 7628 88 dey 222 7629 10 F7 bpl OptionsYLoop 223 224 225 762B 60 rts 226 .endp 227 228 ;------------------------------------------- 229 ; call of the purchase screens for each tank 230 762C CallPurchaseForEveryTank 231 762C A9 02 8D C6 02 mva #$2 colpf2s ; set normal color 232 7631 A9 10 8D 30 02 A9 + mwa #PurchaseDL dlptrs 233 763B AD 2F 02 lda dmactls 234 763E 29 FC and #$fc 235 7640 09 02 ora #$02 ; normal screen width 236 7642 8D 2F 02 sta dmactls 237 238 7645 A9 00 85 8B mva #0 TankNr 239 7649 loop03 240 7649 A6 8B ldx TankNr 241 764B BD 20 3D lda SkillTable,x 242 764E F0 06 beq ManualPurchase 243 7650 20 D6 8D jsr PurchaseAI 244 7653 4C 59 76 jmp AfterManualPurchase 245 246 7656 ManualPurchase 247 7656 20 63 76 jsr Purchase 248 7659 AfterManualPurchase 249 250 7659 E6 8B inc TankNr 251 765B A5 8B lda TankNr 252 765D CD 19 3D cmp NumberOfPlayers 253 7660 D0 E7 bne loop03 254 7662 60 rts 255 256 ;-------------------------------------------------- 257 7663 Purchase ; 258 ;-------------------------------------------------- 259 ; In tanknr there is a number of the tank (player) 260 ; that is buying weapons now (from 0). 261 ; Rest of the data is taken from appropriate tables 262 ; and during the purchase these tables are modified. 263 264 265 7663 A9 E3 8D 1D 30 A9 + mwa #ListOfWeapons WeaponsListDL ;switch to the list of offensive weapons 266 766D 20 66 72 jsr PMoutofScreen 267 268 ; we are clearing list of the weapons 269 7670 A9 FF 8D 11 3F mva #$ff LastWeapon 270 7675 A9 00 8D 12 3F mva #$00 WhichList 271 ; offensive weapon - 0, deffensive - 1 272 273 ; there is a tank (player) number in tanknr 274 ; we are displaying name of the player 275 276 767A A8 tay ; from 0 to y 277 767B A5 8B lda tanknr 278 767D 0A asl 279 767E 0A asl 280 767F 0A asl ; 8 chars per name 281 7680 AA tax 282 7681 NextChar03 283 7681 BD 57 3F lda tanksnames,x 284 7684 99 D1 3C sta textbuffer2+8,y 285 7687 E8 inx 286 7688 C8 iny 287 7689 C0 08 cpy #$08 288 768B D0 F4 bne NextChar03 289 ; and we display cash of the given player 290 291 ; here we must jump in after each purchase 292 ; to generate again list of available weapons 293 768D AfterPurchase 294 768D A6 8B ldx tanknr 295 768F BD 2C 3D lda moneyL,x 296 7692 8D 41 3F sta decimal 297 7695 BD 26 3D lda moneyH,x 298 7698 8D 42 3F sta decimal+1 299 769B A9 E6 8D 43 3F A9 + mwa #textbuffer2+29 displayposition 300 76A5 20 5E 7B jsr displaydec 301 302 ; in xbyte there is the address of the line that 303 ; is being processed now 304 76A8 A9 E3 85 84 A9 33 + mwa #ListOfWeapons xbyte 305 76B0 A2 00 ldx #$00 ; number of the checked weapon 306 76B2 8E 0E 3F stx HowManyOnTheList1 ; amounts of weapons (shells, bullets) in both lists 307 76B5 8E 0F 3F stx HowManyOnTheList2 308 76B8 8E 10 3F stx PositionOnTheList 309 310 ; Creating full list of the available weapons for displaying 311 ; in X there is a number of the weapon to be checked, 312 ; in 'Xbyte' address of the first char in filled screen line 313 314 76BB CreateList 315 ; checking if the weapon of the given number is present 316 76BB BD 19 4C lda WeaponUnits,x 317 76BE D0 03 4C C3 77 jeq NoWeapon 318 ; checking if we can afford buying this weapon 319 76C3 A4 8B ldy tanknr 320 76C5 B9 26 3D lda moneyH,y 321 76C8 DD 99 4B cmp WeaponPriceH,x 322 76CB D0 06 bne CheckWeapon01 323 76CD B9 2C 3D lda moneyL,y 324 76D0 DD D9 4B cmp WeaponPriceL,x 325 76D3 CheckWeapon01 326 76D3 B0 03 4C C3 77 jcc TooLittleCash 327 328 ; we have enough cash and the weapon can be 329 ; added to the list 330 76D8 86 91 stx temp ; number of weapon will be necessary later 331 332 ; first parentheses and other special chars 333 ; (it's easier this way) 334 76DA A0 16 ldy #22 335 76DC A9 08 lda #08 ; "(" 336 76DE 91 84 STA (XBYTE),y 337 76E0 A0 20 ldy #32 338 76E2 A9 09 lda #09 ; ")" 339 76E4 91 84 sta (xbyte),y 340 76E6 A0 19 ldy #25 341 76E8 A9 0F lda #15 ; "/" 342 76EA 91 84 sta (xbyte),y 343 76EC C8 iny 344 76ED A9 04 lda #04 ; "$" 345 76EF 91 84 sta (xbyte),y 346 76F1 A0 1F ldy #31 347 76F3 A9 10 lda #16 ; "0" 348 76F5 91 84 sta (xbyte),y 349 350 ; now symbol of the weapon 351 76F7 BD 59 4C lda WeaponSymbols,x 352 76FA A0 04 ldy #$4 ; 4 chars from the beginning of the line 353 76FC 91 84 sta (xbyte),y 354 355 ;now number of purchased units (bullets) 356 76FE 18 clc 357 76FF A5 84 lda xbyte 358 7701 69 17 adc #23 ; 23 chars from the beginning of the line 359 7703 8D 43 3F sta displayposition 360 7706 A5 85 lda xbyte+1 361 7708 69 00 adc #$00 362 770A 8D 44 3F sta displayposition+1 363 770D BD 19 4C lda WeaponUnits,x 364 7710 8D 41 3F sta decimal 365 7713 20 C0 7B jsr displaybyte 366 7716 A6 91 ldx temp ;getting back number of the weapon 367 368 ; and now price of the weapon 369 7718 18 clc 370 7719 A5 84 lda xbyte 371 771B 69 1B adc #27 ; 27 chars from the beginning of the line 372 771D 8D 43 3F sta displayposition 373 7720 A5 85 lda xbyte+1 374 7722 69 00 adc #$00 375 7724 8D 44 3F sta displayposition+1 376 7727 BD D9 4B lda WeaponPriceL,x 377 772A 8D 41 3F sta decimal 378 772D BD 99 4B lda WeaponPriceH,x 379 7730 8D 42 3F sta decimal+1 380 7733 20 5E 7B jsr displaydec 381 382 7736 A5 91 lda temp ;getting back number of the weapon 383 7738 48 pha ;and saving it on the stack 384 385 7739 20 E5 71 jsr HowManyBullets 386 773C 8D 41 3F sta decimal 387 388 773F 68 pla 389 7740 85 91 sta temp ; let's store weapon number again 390 391 7742 18 clc 392 7743 A5 84 lda xbyte 393 7745 69 01 adc #1 ; 1 char from the beginning of the screen 394 7747 8D 43 3F sta displayposition 395 774A A5 85 lda xbyte+1 396 774C 69 00 adc #$00 397 774E 8D 44 3F sta displayposition+1 398 7751 20 C0 7B jsr displaybyte 399 400 ; and now name of the weapon and finisheeeedd !!!! 401 7754 A6 91 ldx temp ;weapon number 402 7756 A9 00 85 92 mva #0 temp+1 ; this number is only in X 403 ; times 16 (it's length of the names of weapons) 404 775A A0 03 ldy #3 ; Rotate 4 times 405 775C Rotate02 406 775C 06 91 asl temp 407 775E 26 92 rol temp+1 408 7760 88 dey 409 7761 10 F9 bpl Rotate02 410 ; Hmmm..... Interesting why there is no CLC here? 411 412 7763 18 A5 91 69 99 85 + adw temp #NamesOfWeapons modify 413 7770 38 A5 B2 E9 06 85 + sbw modify #6 ; from 6th char 414 415 777B A0 06 ldy #6 ; from 6th char 416 417 777D modyf1 418 777D B1 B2 lda (modify),y 419 777F 91 84 sta (xbyte),y 420 7781 C8 iny 421 7782 C0 16 cpy #(16+6) 422 7784 D0 F7 bne modyf1 423 424 425 ; in X there is what we need 426 427 ; If on screen after the purchase there is still 428 ; present the weapon purchased recently, 429 ; the pointer must point to it. 430 431 7786 EC 11 3F cpx LastWeapon 432 7789 D0 14 bne NotTheSameAsLastTime 433 778B AD 12 3F lda WhichList 434 778E D0 09 bne ominx06 435 7790 AD 0E 3F lda HowManyOnTheList1 436 7793 8D 10 3F sta PositionOnTheList 437 7796 4C 9F 77 jmp NotTheSameAsLastTime 438 7799 ominx06 439 7799 AD 0F 3F lda HowManyOnTheList2 440 779C 8D 10 3F sta PositionOnTheList 441 779F NotTheSameAsLastTime 442 ; increase appropriate counter 443 779F 8A txa 444 77A0 E0 30 cpx #$30 445 77A2 B0 0B bcs SecondList 446 77A4 AC 0E 3F ldy HowManyOnTheList1 447 77A7 99 D6 3E sta NubersOfWeaponsL1,y 448 77AA EE 0E 3F inc HowManyOnTheList1 449 77AD D0 09 bne NextLineOfTheList 450 77AF SecondList 451 77AF AC 0F 3F ldy HowManyOnTheList2 452 77B2 99 FE 3E sta NubersOfWeaponsL2,y 453 77B5 EE 0F 3F inc HowManyOnTheList2 454 ; If everything is copied then next line 455 77B8 NextLineOfTheList 456 77B8 18 clc 457 77B9 A5 84 lda xbyte 458 77BB 69 28 adc #40 459 77BD 85 84 sta xbyte 460 77BF 90 02 bcc TooLittleCash 461 77C1 E6 85 inc xbyte+1 462 77C3 TooLittleCash 463 77C3 NoWeapon 464 465 ; next weapon. If no more weapons then finish! 466 77C3 E8 inx 467 77C4 E0 30 cpx #$30 468 77C6 D0 08 bne NoDefense 469 470 ; if we got to the defense weapons, 471 ; we switch address to the second table. 472 77C8 A9 83 85 84 A9 39 + mwa #ListOfDefensiveWeapons xbyte 473 77D0 NoDefense 474 77D0 E0 40 cpx #$40 475 77D2 F0 03 4C BB 76 jne CreateList 476 477 ; offset may be only too big 478 ; (because after purchase list will never be longer) 479 ; check it and modify if necessary. 480 ; If offset is larger than position of the pointer, 481 ; it must be equal. 482 77D7 AD 10 3F lda PositionOnTheList 483 77DA CD 13 3F cmp OffsetDL1 484 77DD B0 03 bcs WeHaveOffset ; do not modify offset 485 77DF 8D 13 3F sta OffsetDL1 486 77E2 WeHaveOffset 487 488 ; now we have to erase empty position of both lists. 489 490 ; Multiply number on list 1 by 40 and set address 491 ; of the first erased char. 492 ; (multiplying taken from book of Ruszczyc 'Assembler 6502' 493 494 77E2 AD 0E 3F lda HowManyOnTheList1 495 77E5 85 85 sta xbyte+1 ; multiplier (temporarily here, it will be erased anyway) 496 77E7 A9 00 lda #$00 ; higher byte of the Result 497 77E9 85 84 sta xbyte ; lower byte of the Result 498 77EB A2 08 ldx #$08 499 77ED Rotate04 500 77ED 46 85 lsr xbyte+1 501 77EF 90 03 bcc DoNotAddX01 502 77F1 18 clc 503 77F2 69 28 adc #40 504 77F4 DoNotAddX01 505 77F4 6A ror 506 77F5 66 84 ror xbyte 507 77F7 CA dex 508 77F8 D0 F3 bne Rotate04 509 77FA 85 85 sta xbyte+1 510 511 ; add to the address of the list 512 77FC 18 clc 513 77FD A5 84 lda xbyte 514 77FF 69 E3 adc #ListOfWeapons 518 7806 85 85 sta xbyte+1 519 7808 86 84 stx xbyte 520 780A 8A txa ; now there is zero here 521 780B ClearList1 522 780B 91 84 sta (xbyte),y 523 780D C8 iny 524 780E D0 02 bne DoNotIncHigher1 525 7810 E6 85 inc xbyte+1 526 7812 DoNotIncHigher1 527 7812 C0 83 cpy #ListOfWeapons1End 531 781A D0 EF bne ClearList1 532 533 ; And the same we do with the second list 534 535 ; Multiply number on list 1 by 40 and set address 536 ; of the first erased char. 537 781C AD 0F 3F lda HowManyOnTheList2 538 781F 85 85 sta xbyte+1 ; multiplier 539 7821 A9 00 lda #$00 ; higher byte of the Result 540 7823 85 84 sta xbyte ; lower byte of the Result 541 7825 A2 08 ldx #$08 542 7827 Rotate05 543 7827 46 85 lsr xbyte+1 544 7829 90 03 bcc DoNotAddX02 545 782B 18 clc 546 782C 69 28 adc #40 547 782E DoNotAddX02 548 782E 6A ror 549 782F 66 84 ror xbyte 550 7831 CA dex 551 7832 D0 F3 bne Rotate05 552 7834 85 85 sta xbyte+1 553 554 ; add to the address of the list 555 7836 18 clc 556 7837 A5 84 lda xbyte 557 7839 69 83 adc #ListOfDefensiveWeapons 561 7840 85 85 sta xbyte+1 562 7842 86 84 stx xbyte 563 7844 8A txa ; now there is zero here 564 7845 ClearList2 565 7845 91 84 sta (xbyte),y 566 7847 C8 iny 567 7848 D0 02 bne DoNotIncHigher2 568 784A E6 85 inc xbyte+1 569 784C DoNotIncHigher2 570 784C C0 03 cpy #ListOfDefensiveWeaponsEnd 574 7854 D0 EF bne ClearList2 575 576 ; here we have pretty cool lists and there is no brute force 577 ; screen clearing at each list refresh 578 ; (it was very ugly - I checked it :) 579 580 581 ; Here we have all we need 582 ; So choose the weapon for purchase ...... 583 ;-------------------------------------------------- 584 7856 ChoosingItemForPurchase 585 ;-------------------------------------------------- 586 7856 20 6A 79 jsr PutLitteChar ; Places pointer at the right position 587 7859 20 76 74 jsr getkey 588 785C C9 2C cmp #$2c ; Tab 589 785E D0 03 4C E4 78 jeq ListChange 590 7863 C9 0C cmp #$0c ; Return 591 7865 F0 0F beq EndOfPurchase 592 7867 C9 0E cmp #$e 593 7869 F0 0C beq PurchaseKeyUp 594 786B C9 0F cmp #$f 595 786D F0 32 beq PurchaseKeyDown 596 786F C9 21 cmp #$21 ; Space 597 7871 D0 E3 bne ChoosingItemForPurchase 598 7873 4C 10 79 jmp PurchaseWeaponNow 599 7876 EndOfPurchase 600 7876 60 rts 601 7877 PurchaseKeyUp 602 7877 AD 12 3F lda WhichList 603 787A F0 0D beq GoUp1 604 787C CE 10 3F dec PositionOnTheList 605 787F 10 1D bpl EndUpX 606 7881 A9 00 lda #$00 607 7883 8D 10 3F sta PositionOnTheList 608 7886 4C 56 78 jmp ChoosingItemForPurchase 609 7889 GoUp1 610 7889 CE 10 3F dec PositionOnTheList 611 788C 10 05 bpl MakeOffsetUp 612 788E A9 00 lda #$00 613 7890 8D 10 3F sta PositionOnTheList 614 615 7893 MakeOffsetUp 616 ; If offset is larger than pointer position, 617 ; it must be equal then. 618 7893 AD 10 3F lda PositionOnTheList 619 7896 CD 13 3F cmp OffsetDL1 620 7899 B0 03 bcs EndUpX ; do not modify the offset 621 789B 8D 13 3F sta OffsetDL1 622 789E EndUpX 623 789E 4C 56 78 jmp ChoosingItemForPurchase 624 78A1 PurchaseKeyDown 625 78A1 AD 12 3F lda WhichList 626 78A4 F0 15 beq GoDown1 627 78A6 EE 10 3F inc PositionOnTheList 628 78A9 AD 10 3F lda PositionOnTheList 629 78AC CD 0F 3F cmp HowManyOnTheList2 630 78AF D0 30 bne EndGoDownX 631 78B1 AC 0F 3F ldy HowManyOnTheList2 632 78B4 88 dey 633 78B5 8C 10 3F sty PositionOnTheList 634 78B8 4C 56 78 jmp ChoosingItemForPurchase 635 78BB GoDown1 636 78BB EE 10 3F inc PositionOnTheList 637 78BE AD 10 3F lda PositionOnTheList 638 78C1 CD 0E 3F cmp HowManyOnTheList1 639 78C4 D0 07 bne MakeOffsetDown 640 78C6 AC 0E 3F ldy HowManyOnTheList1 641 78C9 88 dey 642 78CA 8C 10 3F sty PositionOnTheList 643 78CD MakeOffsetDown 644 78CD AD 13 3F lda OffsetDL1 645 78D0 18 clc 646 78D1 69 0F adc #15 647 ;if offset+16 is lower than the position then it must =16 648 78D3 CD 10 3F cmp PositionOnTheList 649 78D6 B0 09 bcs EndGoDownX 650 78D8 38 sec 651 78D9 AD 10 3F lda PositionOnTheList 652 78DC E9 0F sbc #15 653 78DE 8D 13 3F sta OffsetDL1 654 78E1 EndGoDownX 655 78E1 4C 56 78 jmp ChoosingItemForPurchase 656 657 ; swapping the displayed list and setting pointer to position 0 658 78E4 ListChange 659 78E4 AD 12 3F lda WhichList 660 78E7 49 01 eor #$01 661 78E9 8D 12 3F sta WhichList 662 78EC D0 0D bne SecondSelected 663 78EE A9 E3 8D 1D 30 A9 + mwa #ListOfWeapons WeaponsListDL 664 78F8 4C 05 79 jmp dalejx01 665 78FB SecondSelected 666 78FB A9 83 8D 1D 30 A9 + mwa #ListOfDefensiveWeapons WeaponsListDL 667 7905 dalejx01 668 7905 A9 00 lda #$00 669 7907 8D 10 3F sta PositionOnTheList 670 790A 8D 13 3F sta OffsetDL1 671 790D 4C 56 78 jmp ChoosingItemForPurchase 672 673 ; weapon purchase routne increases number of possessed bullets 674 ; decreases cash and jumps to screen refresh 675 ;-------------------------------------------------- 676 7910 PurchaseWeaponNow 677 ;-------------------------------------------------- 678 7910 AD 12 3F lda WhichList 679 7913 D0 09 bne PurchaseDeffensive 680 681 ; here we purchase the offensive weapon 682 7915 AC 10 3F ldy PositionOnTheList 683 7918 B9 D6 3E lda NubersOfWeaponsL1,y 684 791B 4C 24 79 jmp PurchaseAll 685 791E PurchaseDeffensive 686 791E AC 10 3F ldy PositionOnTheList 687 7921 B9 FE 3E lda NubersOfWeaponsL2,y 688 7924 PurchaseAll 689 ; after getting weapon number the routine is common for all 690 7924 A6 8B ldx tanknr 691 7926 A8 tay ; weapon number is in Y 692 7927 38 sec 693 7928 BD 2C 3D lda moneyL,x ; substracting from posessed money 694 792B F9 D9 4B sbc WeaponPriceL,y ; of price of the given weapon 695 792E 9D 2C 3D sta moneyL,x 696 7931 BD 26 3D lda moneyH,x 697 7934 F9 99 4B sbc WeaponPriceH,y 698 7937 9D 26 3D sta moneyH,x 699 ; now we have get address of 700 ; the table of the weapon of the tank 701 ; and add appropriate number of bullets 702 793A 86 91 stx temp ;we will multiply by 64 703 793C A9 00 85 92 mva #0 temp+1 704 ; times 64 705 ; (because it is the lenght of one record in weapon table) 706 7940 A2 05 ldx #5 ; Rotate 6 times 707 ; (in Y there is a weapon number, we do not touch it!!!) 708 7942 Rotate03 709 7942 06 91 asl temp 710 7944 26 92 rol temp+1 711 7946 CA dex 712 7947 10 F9 bpl Rotate03 713 7949 A9 87 lda #TanksWeapon1 717 7951 65 92 adc temp+1 718 7953 85 92 sta temp+1 719 720 7955 B1 91 lda (temp),y ; and we have number of posessed bullets of the weapon 721 7957 79 19 4C adc WeaponUnits,y 722 795A 91 91 sta (temp),y ; and we added appropriate number of bullets 723 795C C9 64 cmp #100 ; but there should be no more than 99 bullets 724 795E 90 04 bcc LessThan100 725 7960 A9 63 lda #99 726 7962 91 91 sta (temp),y 727 7964 LessThan100 728 7964 8C 11 3F sty LastWeapon ; store last purchased weapon 729 ; because we must put screen pointer next to it 730 7967 4C 8D 76 jmp AfterPurchase 731 732 733 796A PutLitteChar 734 ; first let's cleat both lists from little chars 735 796A A9 E3 85 84 A9 33 + mwa #ListOfWeapons xbyte 736 7972 A2 34 ldx #52 ; there are 52 lines total 737 7974 A0 00 ldy #$00 738 7976 EraseLoop 739 7976 A9 00 lda #$00 740 7978 91 84 sta (xbyte),y 741 797A 18 clc 742 797B A5 84 lda xbyte 743 797D 69 28 adc #40 744 797F 85 84 sta xbyte 745 7981 90 02 bcc ominx02 746 7983 E6 85 inc xbyte+1 747 7985 ominx02 748 7985 CA dex 749 7986 10 EE bpl EraseLoop 750 ; now let's check which list is active now 751 7988 AD 12 3F lda WhichList 752 798B F0 30 beq CharToList1 753 ; we are on the second list (deffensive) 754 ; so there is no problem with scrolling 755 798D A9 83 85 84 A9 39 + mwa #ListOfDefensiveWeapons xbyte 756 7995 AE 10 3F ldx PositionOnTheList 757 7998 F0 0E beq SelectList2 ; if there is 0 we add nothing 758 799A AddLoop2 759 799A 18 clc 760 799B A5 84 lda xbyte 761 799D 69 28 adc #40 762 799F 85 84 sta xbyte 763 79A1 90 02 bcc ominx03 764 79A3 E6 85 inc xbyte+1 765 79A5 ominx03 766 79A5 CA dex 767 79A6 D0 F2 bne AddLoop2 768 79A8 SelectList2 769 79A8 A9 7F lda #$7f ; little char (tab) - this is the pointer 770 79AA 91 84 sta (xbyte),y 771 ; now we clear flags of presence of list "out of screen" 772 ; unfortunately I am now sure what it means... :( 773 79AC A2 51 ldx #EmptyLine 775 79B0 8E 19 30 stx MoreUpdl 776 79B3 8C 1A 30 sty MoreUpdl+1 777 79B6 8E 3F 30 stx MoreDowndl 778 79B9 8C 40 30 sty MoreDowndl+1 779 79BC 60 rts 780 79BD CharToList1 781 ; we putchar on list 1 782 ; and later set-up list itself 783 79BD A9 E3 85 84 A9 33 + mwa #ListOfWeapons xbyte 784 79C5 AE 10 3F ldx PositionOnTheList 785 79C8 F0 0E beq SelectList1 ; if there is 0 we add nothing 786 79CA AddLoop1 787 79CA 18 clc 788 79CB A5 84 lda xbyte 789 79CD 69 28 adc #40 790 79CF 85 84 sta xbyte 791 79D1 90 02 bcc ominx04 792 79D3 E6 85 inc xbyte+1 793 79D5 ominx04 794 79D5 CA dex 795 79D6 D0 F2 bne AddLoop1 796 79D8 SelectList1 797 79D8 A9 7F lda #$7f ; pointer = little char = (tab) 798 79DA 91 84 sta (xbyte),y 799 ; now moving the window basing on given offset 800 79DC A9 E3 85 84 A9 33 + mwa #ListOfWeapons xbyte 801 79E4 AE 13 3F ldx OffsetDL1 802 79E7 F0 0E beq SetWindowList1 ; if zero then add nothing 803 79E9 LoopWindow1 804 79E9 18 clc 805 79EA A5 84 lda xbyte 806 79EC 69 28 adc #40 807 79EE 85 84 sta xbyte 808 79F0 90 02 bcc ominx05 809 79F2 E6 85 inc xbyte+1 810 79F4 ominx05 811 79F4 CA dex 812 79F5 D0 F2 bne LoopWindow1 813 79F7 SetWindowList1 814 79F7 A5 84 8D 1D 30 A5 + mwa xbyte WeaponsListDL ; and we change Display List 815 816 ; we show screen line with arrows meaning that 817 ; you can scroll the list up 818 7A01 A2 51 ldx #EmptyLine 820 7A05 AD 13 3F lda OffsetDL1 821 7A08 F0 04 beq NoArrowUp 822 7A0A A2 93 ldx #MoreUp 824 7A0E NoArrowUp 825 7A0E 8E 19 30 stx MoreUpdl 826 7A11 8C 1A 30 sty MoreUpdl+1 827 ; the same, bu scrolling down 828 7A14 AD 0E 3F lda HowManyOnTheList1 829 7A17 A2 51 ldx #EmptyLine 831 7A1B 38 sec 832 7A1C E9 11 sbc #17 833 7A1E 30 09 bmi NoArrowDown 834 7A20 CD 13 3F cmp OffsetDL1 835 7A23 90 04 bcc NoArrowDown 836 7A25 A2 BB ldx #MoreDown 838 7A29 NoArrowDown 839 7A29 8E 3F 30 stx MoreDowndl 840 7A2C 8C 40 30 sty MoreDowndl+1 841 7A2F 60 rts 842 843 ; ----------------------------------------------------- 844 7A30 EnterPlayerName 845 ; in: TankNr 846 ; Out: TanksNames, SkillTable 847 848 ; this little thing is for choosing Player's skill (if computer) 849 ; and entering his name 850 ; If no name entered, there should be name "1st Tank", etc. 851 ; Default tanks names are in table TanksNamesDefault 852 ; ----------------------------------------------------- 853 854 7A30 20 66 72 jsr PMoutofScreen 855 ; display tank number 856 7A33 A6 8B ldx tanknr 857 7A35 E8 inx 858 7A36 8E 41 3F stx decimal 859 7A39 A9 BC 8D 43 3F A9 + mwa #(NameScreen+41) displayposition 860 7A43 20 C0 7B jsr displaybyte 861 7A46 20 33 7B jsr SelectLevel ; setting choosen level of the opponent (Moron, etc) 862 ; clear the name and place cursor at position 0 863 7A49 A9 00 lda #0 864 7A4B 8D 2D 3F sta PositionInName 865 7A4E A2 08 ldx #$08 ; one more because cursor could be there 866 7A50 LoopName01 867 7A50 9D C7 32 sta NameAdr,x 868 7A53 CA dex 869 7A54 D0 FA bne LoopName01 870 7A56 A9 80 lda #$80 ; place cursor on the beginning 871 7A58 8D C7 32 sta NameAdr 872 7A5B CheckKeys 873 7A5B 20 76 74 jsr getkey 874 ; is if the char to be recorded? 875 7A5E A2 25 ldx #37 ; table is 38 chars long 876 7A60 IsLetter 877 7A60 DD AF 3D cmp keycodes,x 878 7A63 F0 05 beq YesLetter 879 7A65 CA dex 880 7A66 10 F8 bpl IsLetter 881 7A68 30 1D bmi CheckFurtherX01 ; if not in the table 882 ; we check cursors and (Return) 883 7A6A YesLetter 884 7A6A BD D5 3D lda scrcodes,x ; we have screen code of the char 885 7A6D AE 2D 3F ldx PositionInName 886 7A70 D0 02 bne NotFirstLetter 887 7A72 29 3F and #$3f ; First letter should be Capital letter 888 ; (nice trick does not affect digits) 889 7A74 NotFirstLetter 890 7A74 9D C7 32 sta NameAdr,x 891 7A77 E8 inx 892 7A78 A9 80 lda #$80 ; cursor behind the char 893 7A7A 9D C7 32 sta NameAdr,x 894 7A7D E0 08 cpx #$08 ; is there 8 characters? 895 7A7F F0 DA beq CheckKeys ; if so, nothing increased 896 7A81 8E 2D 3F stx PositionInName ; if not, we store 897 ; position incremented by 1 898 899 7A84 4C 5B 7A jmp CheckKeys 900 7A87 CheckFurtherX01 ; here we check Tab, Return and Del 901 7A87 C9 0C cmp #$0c ; Return 902 7A89 F0 76 beq EndOfNick 903 7A8B C9 2C cmp #$2c ; Tab 904 7A8D F0 29 beq ChangeOfLevelUp 905 7A8F C9 07 cmp #$7 ;cursor right 906 7A91 F0 25 beq ChangeOfLevelUp 907 7A93 C9 06 cmp #$6 ;cursor left 908 7A95 F0 36 beq ChangeOfLevelDown 909 7A97 C9 0F cmp #$f ;cursor down 910 7A99 F0 45 beq ChangeOfLevel3Up 911 912 7A9B C9 34 cmp #$34 ; Backspace (del) 913 7A9D D0 BC bne CheckKeys 914 ; handling backing one char 915 7A9F AE 2D 3F ldx PositionInName 916 7AA2 F0 01 beq FirstChar 917 7AA4 CA dex 918 7AA5 FirstChar 919 7AA5 A9 80 lda #$80 920 7AA7 9D C7 32 sta NameAdr,x 921 7AAA A9 00 lda #$00 922 7AAC 9D C8 32 sta NameAdr+1,x 923 7AAF 9D C9 32 sta NameAdr+2,x 924 7AB2 8E 2D 3F stx PositionInName 925 7AB5 4C 5B 7A jmp CheckKeys 926 7AB8 ChangeOfLevelUp ; change difficulty level of computer opponent 927 7AB8 EE 2E 3F AD 2E 3F inc:lda DifficultyLevel 928 7ABE C9 09 cmp #9 ; 9 levels are possible 929 7AC0 D0 05 bne DoNotLoopLevelUp 930 7AC2 A9 00 8D 2E 3F mva #$0 DifficultyLevel 931 7AC7 DoNotLoopLevelUp 932 7AC7 20 33 7B jsr SelectLevel 933 7ACA 4C 5B 7A jmp CheckKeys 934 ;---- 935 7ACD ChangeOfLevelDown 936 7ACD CE 2E 3F AD 2E 3F dec:lda DifficultyLevel 937 7AD3 10 05 bpl DoNotLoopLevelDown 938 7AD5 A9 08 8D 2E 3F mva #$8 DifficultyLevel 939 7ADA DoNotLoopLevelDown 940 7ADA 20 33 7B jsr SelectLevel 941 7ADD 4C 5B 7A jmp CheckKeys 942 ;---- 943 7AE0 ChangeOfLevel3Up 944 ;adw DifficultyLevel #3 945 7AE0 18 clc 946 7AE1 AD 2E 3F lda DifficultyLevel 947 7AE4 69 03 adc #3 948 7AE6 8D 2E 3F sta DifficultyLevel 949 950 7AE9 C9 09 cmp #9 951 7AEB 90 0E bcc DoNotLoopLevel3Up 952 953 7AED 38 AD 2E 3F E9 09 + sbw DifficultyLevel #9 954 955 7AFB DoNotLoopLevel3Up 956 7AFB 20 33 7B jsr SelectLevel 957 7AFE 4C 5B 7A jmp CheckKeys 958 ;---- 959 7B01 EndOfNick 960 ; storing name of the player and its level 961 962 ; level of the computer opponent goes to 963 ; the table of levels (difficulties) 964 7B01 A6 8B ldx tanknr 965 7B03 AD 2E 3F lda DifficultyLevel 966 7B06 9D 20 3D sta skilltable,x 967 ; storing name of the tank in the right space 968 ; (without cursor!) 969 7B09 A0 00 ldy #$00 970 7B0B 8A txa ; ldx TankNr 971 7B0C 0A asl 972 7B0D 0A asl 973 7B0E 0A asl ; 8 chars per name 974 7B0F AA tax ; in X where to put new name 975 976 7B10 AD C7 32 lda NameAdr ; check if first char is " " 977 7B13 29 7F and #$7F ; remove inverse (Cursor) 978 7B15 F0 0F beq MakeDefaultName 979 980 7B17 nextchar04 981 7B17 B9 C7 32 lda NameAdr,y 982 7B1A 29 7F and #$7f ; remove inverse (Cursor) 983 7B1C 9D 57 3F sta tanksnames,x 984 7B1F E8 inx 985 7B20 C8 iny 986 7B21 C0 08 cpy #$08 987 7B23 D0 F2 bne nextchar04 988 7B25 60 rts 989 7B26 MakeDefaultName 990 7B26 nextchar05 991 7B26 BD 69 4B lda tanksnamesDefault,x 992 7B29 9D 57 3F sta tanksnames,x 993 7B2C E8 inx 994 7B2D C8 iny 995 7B2E C0 08 cpy #$08 996 7B30 D0 F4 bne nextchar05 997 7B32 60 rts 998 999 1000 1001 1002 7B33 SelectLevel 1003 ; this routine highlights the choosen 1004 ; level of the computer opponent 1005 7B33 A2 09 ldx #$9 ; 9 possible levels 1006 7B35 CheckNextLevel01 1007 7B35 BD 2F 3F lda LevelNameBeginL,x ; address on the screen 1008 7B38 85 91 sta temp 1009 7B3A BD 38 3F lda LevelNameBeginH,x 1010 7B3D 85 92 sta temp+1 1011 7B3F A0 09 ldy #9 ; flip 10 chars to inverse video 1012 7B41 EC 2E 3F cpx DifficultyLevel ; is it the choosen level? 1013 7B44 D0 0B bne NotThisLevel 1014 ; change to inverse, because it is it! 1015 7B46 InverseFurther 1016 7B46 B1 91 lda (temp),y 1017 7B48 09 80 ora #$80 1018 7B4A 91 91 sta (temp),y 1019 7B4C 88 dey 1020 7B4D 10 F7 bpl InverseFurther 1021 7B4F 30 09 bmi CheckNextLevel ; Check Next Level 1022 7B51 NotThisLevel 1023 7B51 B1 91 lda (temp),y 1024 7B53 29 7F and #$7f 1025 7B55 91 91 sta (temp),y 1026 7B57 88 dey 1027 7B58 10 F7 bpl NotThisLevel 1028 7B5A CheckNextLevel 1029 7B5A CA dex 1030 7B5B 10 D8 bpl CheckNextLevel01 1031 7B5D 60 rts 1032 ;-------------------------------------------------- 1033 7B5E displaydec ;decimal (word), displayposition (word) 1034 ;-------------------------------------------------- 1035 ; displays decimal number as in parameters (in text mode) 1036 ; leading zeores are removed 1037 ; the range is (0000..9999 - two bytes) 1038 1039 7B5E A0 03 ldy #3 ; there will be 4 digits 1040 7B60 NextDigit 1041 7B60 A2 10 ldx #16 ; 16-bit dividee so Rotate 16 times 1042 7B62 A9 00 lda #$00 1043 7B64 Rotate000 1044 7B64 aslw decimal Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 7B64 0E 41 3F ASL DECIMAL 2 7B67 2E 42 3F ROL DECIMAL+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1045 7B6A 2A rol ; scroll dividee 1046 ; (as highest byte - additional - byte is A) 1047 7B6B C9 0A cmp #10 ; divider 1048 7B6D 90 05 bcc TooLittle000 ; if A is smaller than divider 1049 ; there is nothing to substract 1050 7B6F E9 0A sbc #10 ; divider 1051 7B71 EE 41 3F inc decimal ; lowest bit set to 1 1052 ; because it is 0 and this is the fastest way 1053 7B74 CA TooLittle000 dex 1054 7B75 D0 ED bne Rotate000 ; and Rotate 16 times, Result will be in decimal 1055 7B77 AA tax ; and the rest in A 1056 ; (and it goes to X because 1057 ; it is our decimal digit) 1058 7B78 BD 03 7C lda digits,x 1059 7B7B 99 45 3F sta decimalresult,y 1060 7B7E 88 dey 1061 7B7F 10 DF bpl NextDigit ; Result again /10 and we have next digit 1062 1063 1064 7B81 rightnumber 1065 ; now cut leading zeroes (002 goes 2) 1066 7B81 AD 45 3F lda decimalresult 1067 7B84 CD 0D 7C cmp zero 1068 7B87 D0 22 bne decimalend 1069 7B89 AD 0F 7C lda space 1070 7B8C 8D 45 3F sta decimalresult 1071 1072 7B8F AD 46 3F lda decimalresult+1 1073 7B92 CD 0D 7C cmp zero 1074 7B95 D0 14 bne decimalend 1075 7B97 AD 0F 7C lda space 1076 7B9A 8D 46 3F sta decimalresult+1 1077 1078 7B9D AD 47 3F lda decimalresult+2 1079 7BA0 CD 0D 7C cmp zero 1080 7BA3 D0 06 bne DecimalEnd 1081 7BA5 AD 0F 7C lda space 1082 7BA8 8D 47 3F sta decimalresult+2 1083 1084 7BAB DecimalEnd 1085 ; displaying 1086 7BAB AD 43 3F 85 B2 AD + mwa displayposition modify 1087 7BB5 A0 03 ldy #3 1088 7BB7 displayloop 1089 7BB7 B9 45 3F lda decimalresult,y 1090 7BBA 91 B2 sta (modify),y 1091 7BBC 88 dey 1092 7BBD 10 F8 bpl displayloop 1093 1094 7BBF 60 rts 1095 1096 1097 ;-------------------------------------------------- 1098 7BC0 displaybyte ;decimal (byte), displayposition (word) 1099 ;-------------------------------------------------- 1100 ; displays decimal number as in parameters (in text mode) 1101 ; leading zeores are removed 1102 ; the range is (00..99 - one byte) 1103 1104 7BC0 A0 01 ldy #1 ; there will be 2 digits 1105 7BC2 NextDigit2 1106 7BC2 A2 08 ldx #8 ; 8-bit dividee so Rotate 8 times 1107 7BC4 A9 00 lda #$00 1108 7BC6 Rotate001 1109 7BC6 0E 41 3F asl decimal 1110 7BC9 2A rol ; scroll dividee 1111 ; (as highest byte - additional - byte is A) 1112 7BCA C9 0A cmp #10 ; divider 1113 7BCC 90 05 bcc TooLittle001 ; if A is smaller than divider 1114 ; there is nothing to substract 1115 7BCE E9 0A sbc #10 ; divider 1116 7BD0 EE 41 3F inc decimal ; because it is 0 and this is the fastest way 1117 7BD3 CA TooLittle001 dex 1118 7BD4 D0 F0 bne Rotate001 ; and Rotate 8 times, Result will be in decimal 1119 7BD6 AA tax ; and the rest in A 1120 ; (and it goes to X because 1121 ; it is our decimal digit) 1122 7BD7 BD 03 7C lda digits,x 1123 7BDA 99 45 3F sta decimalresult,y 1124 7BDD 88 dey 1125 7BDE 10 E2 bpl NextDigit2 ; Result again /10 and we have next digit 1126 1127 ; now cut leading zeroes (02 goes 2) 1128 7BE0 AD 45 3F lda decimalresult 1129 7BE3 CD 0D 7C cmp zero 1130 7BE6 D0 06 bne decimalend1 1131 7BE8 AD 0F 7C lda space 1132 7BEB 8D 45 3F sta decimalresult 1133 1134 7BEE decimalend1 1135 ; displaying 1136 7BEE AD 43 3F 85 B2 AD + mwa displayposition modify 1137 7BF8 A0 01 ldy #1 1138 7BFA displayloop1 1139 7BFA B9 45 3F lda decimalresult,y 1140 7BFD 91 B2 sta (modify),y 1141 7BFF 88 dey 1142 7C00 10 F8 bpl displayloop1 1143 1144 7C02 60 rts 1145 ;-------decimal constans 1146 7C03 10 11 12 13 14 15 + digits dta d"0123456789" 1147 7C0D 10 zero dta d"0" 1148 7C0E nineplus ;.sbyte ('9+1) 1149 7C0E 1A dta d"9"+1 1150 7C0F 00 space dta d" " 1151 1152 ;-------------------------------------------------------- 1153 7C10 DisplayOffensiveTextNr ; 1154 ;This routine displays texts using PutChar4x4 1155 ;pretty cool, eh 1156 ;parameters are: 1157 ;Y - number of tank above which text is displayed 1158 ;TextNumber - number of offensive text to display 1159 1160 ;lets calculate position of the text first! 1161 ;that's easy because we have number of tank 1162 ;and xtankstableL and H keep X position of a given tank 1163 1164 7C10 B9 97 3D lda xtankstableL,y 1165 7C13 85 91 sta temp 1166 7C15 B9 9D 3D lda xtankstableH,y 1167 7C18 85 92 sta temp+1 1168 ;now we should substract length of the text 1169 7C1A AE DC 44 ldx TextNumberOff 1170 7C1D BD C9 5A lda talk.OffensiveTextLengths,x 1171 7C20 0A asl 1172 7C21 85 93 sta temp2 1173 7C23 A9 00 85 94 mva #0 temp2+1 1174 ;here we assume max length of text 1175 ;to display is 127 chars! 1176 1177 ;now we have HALF length in pixels 1178 ;stored in temp2 1179 7C27 38 A5 91 E5 93 85 + sbw temp temp2 ; here begin of the text is in TEMP !!!! 1180 ;now we should check overflows 1181 7C34 A5 92 lda temp+1 1182 7C36 10 08 bpl DOTNnotLessThanZero 1183 ;less than zero, so should be zero 1184 7C38 A9 00 85 91 85 92 mwa #0 temp 1185 7C3E F0 30 beq DOTNnoOverflow 1186 1187 7C40 DOTNnotLessThanZero 1188 ;so check if end larger than screenwidth 1189 1190 1191 7C40 BD C9 5A lda talk.OffensiveTextLengths,x 1192 7C43 0A asl 1193 7C44 0A asl 1194 ;length in pixels - 1195 ;text length max 63 chars !!!!!!!! 1196 1197 1198 7C45 18 clc 1199 7C46 65 91 adc temp 1200 7C48 85 93 sta temp2 1201 7C4A A9 00 lda #0 1202 7C4C 65 92 adc temp+1 1203 7C4E 85 94 sta temp2+1 1204 ;now in temp2 is end of the text in pixels 1205 ;so check if not greater than screenwitdth 1206 7C50 A5 94 C9 01 D0 04 + cpw temp2 #screenwidth 1207 7C5A 90 14 bcc DOTNnoOverflow 1208 ;if end is greater than screenwidth 1209 ;then screenwidth - length is fine 1210 1211 1212 7C5C BD C9 5A lda talk.OffensiveTextLengths,x 1213 7C5F 0A asl 1214 7C60 0A asl 1215 7C61 85 91 sta temp 1216 1217 7C63 38 sec 1218 7C64 A9 3F lda #<(screenwidth-1) 1219 7C66 E5 91 sbc temp 1220 7C68 85 91 sta temp 1221 7C6A A9 01 lda #>(screenwidth-1) 1222 7C6C E5 92 sbc temp+1 1223 7C6E 85 92 sta temp+1 1224 7C70 DOTNnoOverflow 1225 ;here in temp we have really good x position of text 1226 1227 7C70 A5 91 8D D6 44 A5 + mwa temp TextPositionX 1228 1229 ;now let's get y position 1230 ;we will try to put text as low as possible 1231 ;just above mountains (so mountaintable will be checked) 1232 7C7A BD C9 5A lda talk.OffensiveTextLengths,x 1233 7C7D 0A asl 1234 7C7E 0A asl 1235 7C7F A8 tay 1236 ;in temp there still is X position of text 1237 ;if we add temp and Y we will get end of the text 1238 ;so, lets go through mountaintable and look for 1239 ;the lowest value within 1240 ;Mountaitable+temp and Mountaitable+temp+Y 1241 1242 7C80 18 A5 91 69 13 85 + adw temp #MountainTable 1243 1244 7C8D A9 C8 85 93 mva #screenheight temp2 ;initialisation of the lowest value 1245 1246 7C91 DOTLowestMountainValueLoop 1247 7C91 B1 91 lda (temp),y 1248 7C93 C5 93 cmp temp2 1249 7C95 B0 02 bcs DOTOldLowestValue ;old lowest value 1250 ;new lowest value 1251 7C97 85 93 sta temp2 1252 7C99 DOTOldLowestValue 1253 7C99 88 dey 1254 7C9A C0 FF cpy #$ff 1255 7C9C D0 F3 bne DOTLowestMountainValueLoop 1256 1257 1258 1259 7C9E 38 sec 1260 7C9F A5 93 lda temp2 1261 7CA1 E9 0D sbc #(4+9) ;9 pixels above ground (and tanks...) 1262 7CA3 8D D8 44 sta TextPositionY 1263 1264 1265 7CA6 BD E5 59 lda talk.OffensiveTextTableL,x 1266 7CA9 8D D9 44 sta TextAddress 1267 7CAC BD 57 5A lda talk.OffensiveTextTableH,x 1268 7CAF 8D DA 44 sta TextAddress+1 1269 7CB2 A9 00 8D DB 44 mva #0 TextCounter 1270 7CB7 DOTNcharloop 1271 7CB7 AD D9 44 85 91 AD + mwa TextAddress temp 1272 7CC1 AC DB 44 ldy TextCounter 1273 1274 7CC4 B1 91 lda (temp),y 1275 7CC6 38 SEC 1276 7CC7 E9 20 sbc #32 ;conversion from ASCII to .sbyte 1277 1278 7CC9 8D 50 48 sta CharCode4x4 1279 7CCC AD DB 44 lda TextCounter 1280 7CCF 0A asl 1281 7CD0 0A asl 1282 7CD1 18 clc 1283 7CD2 6D D6 44 adc TextPositionX 1284 7CD5 85 80 sta Xdraw 1285 7CD7 A9 00 lda #0 1286 7CD9 6D D7 44 adc TextPositionX+1 1287 7CDC 85 81 sta Xdraw+1 1288 7CDE AD D8 44 lda TextPositionY 1289 7CE1 85 82 sta ydraw 1290 7CE3 20 23 8B jsr PutChar4x4 1291 1292 7CE6 EE DB 44 inc TextCounter 1293 7CE9 AE DC 44 ldx TextNumberOff 1294 7CEC BD C9 5A lda talk.OffensiveTextLengths,x 1295 7CEF CD DB 44 cmp TextCounter 1296 7CF2 D0 C3 bne DOTNcharloop 1297 1298 7CF4 60 rts 1299 1300 ;------------------------------- 1301 7CF5 TypeLine4x4 ; 1302 ;------------------------------- 1303 ;this routine prints line ending with $ff 1304 ;address in LineAddress4x4 1305 ;starting from LineXdraw, LineYdraw 1306 1307 7CF5 A0 00 ldy #0 1308 7CF7 8C E0 44 sty LineCharNr 1309 1310 1311 7CFA TypeLine4x4Loop 1312 7CFA AC E0 44 ldy LineCharNr 1313 1314 1315 7CFD AD DE 44 85 91 AD + mwa LineAddress4x4 temp 1316 7D07 B1 91 lda (temp),y 1317 7D09 C9 FF cmp #$ff 1318 7D0B F0 29 beq EndOfTypeLine4x4 1319 1320 7D0D 8D 50 48 sta CharCode4x4 1321 7D10 AD E1 44 85 80 AD + mwa LineXdraw Xdraw 1322 7D1A AD E3 44 85 82 mva LineYdraw Ydraw 1323 7D1F 20 A0 8B jsr PutChar4x4FULL ;type empty pixels as well! 1324 7D22 18 AD E1 44 69 04 + adw LineXdraw #4 1325 7D30 EE E0 44 inc LineCharNr 1326 7D33 4C FA 7C jmp TypeLine4x4Loop 1327 1328 7D36 EndOfTypeLine4x4 1329 7D36 60 rts 1330 1331 ;-------------------------------- 1332 7D37 DisplayResults ; 1333 ;displays results of the round 1334 ;using 4x4 font 1335 1336 ;centering the result screen 1337 7D37 A9 84 8D 3D 45 A9 + mwa #((ScreenWidth/2)-(7*4)) ResultX 1338 7D41 A9 44 8D 3F 45 mva #((ScreenHeight/2)-(8*4)) ResultY 1339 1340 1341 ;upper frame 1342 7D46 A9 E4 8D DE 44 A9 + mwa #LineTop LineAddress4x4 1343 7D50 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1344 7D5C AD 3F 45 8D E3 44 mva ResultY LineYdraw 1345 7D62 A9 01 8D 51 48 mva #1 plot4x4color 1346 7D67 20 F5 7C jsr TypeLine4x4 1347 1348 7D6A 18 AD 3F 45 69 04 + adw ResultY #4 ;next line 1349 1350 ;Header1 1351 ;Displays round number 1352 7D78 AD 4B 3F lda CurrentRoundNr 1353 7D7B 8D 41 3F sta decimal 1354 7D7E A9 17 8D 43 3F A9 + mwa #RoundNrDisplay displayposition 1355 7D88 20 C0 7B jsr displaybyte ;decimal (byte), displayposition (word) 1356 1357 7D8B A9 0E 8D DE 44 A9 + mwa #LineHeader1 LineAddress4x4 1358 7D95 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1359 7DA1 AD 3F 45 8D E3 44 mva ResultY LineYdraw 1360 7DA7 A9 01 8D 51 48 mva #1 plot4x4color 1361 7DAC 20 F5 7C jsr TypeLine4x4 1362 1363 7DAF 18 AD 3F 45 69 04 + adw ResultY #4 ;next line 1364 1365 ;Empty line 1366 7DBD A9 00 8D DE 44 A9 + mwa #LineEmpty LineAddress4x4 1367 7DC7 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1368 7DD3 AD 3F 45 8D E3 44 mva ResultY LineYdraw 1369 7DD9 A9 01 8D 51 48 mva #1 plot4x4color 1370 7DDE 20 F5 7C jsr TypeLine4x4 1371 1372 7DE1 18 AD 3F 45 69 02 + adw ResultY #2 ;next line 1373 1374 1375 ;Header2 1376 7DEF A9 1C 8D DE 44 A9 + mwa #LineHeader2 LineAddress4x4 1377 7DF9 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1378 7E05 AD 3F 45 8D E3 44 mva ResultY LineYdraw 1379 7E0B A9 01 8D 51 48 mva #1 plot4x4color 1380 7E10 20 F5 7C jsr TypeLine4x4 1381 1382 7E13 18 AD 3F 45 69 04 + adw ResultY #4 ;next line 1383 1384 ;Empty line 1385 7E21 A9 00 8D DE 44 A9 + mwa #LineEmpty LineAddress4x4 1386 7E2B AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1387 7E37 AD 3F 45 8D E3 44 mva ResultY LineYdraw 1388 7E3D A9 01 8D 51 48 mva #1 plot4x4color 1389 7E42 20 F5 7C jsr TypeLine4x4 1390 1391 7E45 38 AD 3F 45 E9 02 + sbw ResultY #2 ;next line (was empty) 1392 1393 7E53 AE 19 3D ldx NumberOfPlayers ;we start from the highest (best) tank 1394 7E56 CA dex ;and it is the last one 1395 7E57 8E 40 45 stx ResultOfTankNr ;in TankSequence table 1396 1397 7E5A A9 57 85 95 A9 3F + mwa #TanksNames tempXROLLER 1398 1399 7E62 ResultOfTheNextPlayer 1400 7E62 AE 40 45 ldx ResultOfTankNr ;we are after a round, so we can use TankNr 1401 7E65 BD 1A 3D lda TankSequence,x ;and we keep here real number if the tank 1402 7E68 85 8B sta TankNr ;for which we are displaying results 1403 1404 1405 1406 1407 7E6A 18 AD 3F 45 69 04 + adw ResultY #4 ;next line 1408 1409 ;there are at least 2 players, so we can safely 1410 ;start displaying the result 1411 1412 7E78 A2 00 ldx #0 1413 7E7A A9 03 lda #3 ;it means | 1414 7E7C 9D 2A 45 sta ResultLineBuffer,x 1415 1416 1417 7E7F A5 8B lda TankNr 1418 7E81 0A asl 1419 7E82 0A asl ; times 8, because it is lengtgh 1420 7E83 0A asl ; of the names of the tanks 1421 7E84 A8 tay 1422 1423 7E85 TankNameCopyLoop 1424 7E85 B1 95 lda (tempXROLLER),y ;XROLLER is not working now 1425 7E87 29 3F and #$3f ;always CAPITAL letters 1426 7E89 E8 inx 1427 7E8A 9D 2A 45 sta ResultLineBuffer,x 1428 7E8D C8 iny 1429 7E8E E0 08 cpx #8 ; end of name 1430 7E90 D0 F3 bne TankNameCopyLoop 1431 1432 7E92 E8 inx 1433 7E93 A9 1A lda #26 ;it means ":" 1434 7E95 9D 2A 45 sta ResultLineBuffer,x 1435 1436 7E98 A4 8B ldy TankNr 1437 7E9A B9 5D 3D lda ResultsTable,y 1438 7E9D 8D 41 3F sta decimal 1439 7EA0 A9 34 8D 43 3F A9 + mwa #(ResultLineBuffer+10) displayposition 1440 7EAA 20 C0 7B jsr displaybyte ;decimal (byte), displayposition (word) 1441 1442 7EAD A2 0C ldx #12 ;justafter the digits 1443 7EAF A9 03 lda #3 ;it means | 1444 7EB1 9D 2A 45 sta ResultLineBuffer,x 1445 1446 7EB4 E8 inx 1447 7EB5 A9 FF lda #$ff ;it means end of line 1448 7EB7 9D 2A 45 sta ResultLineBuffer,x 1449 1450 1451 1452 ;result line display 1453 7EBA A9 2A 8D DE 44 A9 + mwa #ResultLineBuffer LineAddress4x4 1454 7EC4 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1455 7ED0 AD 3F 45 8D E3 44 mva ResultY LineYdraw 1456 7ED6 A9 01 8D 51 48 mva #1 plot4x4color 1457 7EDB 20 F5 7C jsr TypeLine4x4 1458 1459 7EDE 18 AD 3F 45 69 04 + adw ResultY #4 ;next line 1460 1461 ;Empty line 1462 7EEC A9 00 8D DE 44 A9 + mwa #LineEmpty LineAddress4x4 1463 7EF6 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1464 7F02 AD 3F 45 8D E3 44 mva ResultY LineYdraw 1465 7F08 A9 01 8D 51 48 mva #1 plot4x4color 1466 7F0D 20 F5 7C jsr TypeLine4x4 1467 1468 1469 1470 7F10 CE 40 45 dec ResultOfTankNr 1471 1472 7F13 30 11 bmi FinishResultDisplay 1473 1474 7F15 38 AD 3F 45 E9 02 + sbw ResultY #2 ;distance between lines is smaller 1475 1476 7F23 4C 62 7E jmp ResultOfTheNextPlayer 1477 1478 7F26 FinishResultDisplay 1479 1480 ;bottom of the frame 1481 7F26 A9 F2 8D DE 44 A9 + mwa #LineBottom LineAddress4x4 1482 7F30 AD 3D 45 8D E1 44 + mwa ResultX LineXdraw 1483 7F3C AD 3F 45 8D E3 44 mva ResultY LineYdraw 1484 7F42 A9 01 8D 51 48 mva #1 plot4x4color 1485 7F47 20 F5 7C jsr TypeLine4x4 1486 7F4A 60 rts 1487 1488 1489 ;------------------------------------------------- 1490 7F4B DisplayingSymbols 1491 ;------------------------------------------------- 1492 1493 ;--------------------- 1494 ;displaying symbol of the weapon 1495 ;--------------------- 1496 ;display name and symbol of the weapon 1497 ;textbuffer+18 - symbol (1 char) 1498 ;textbuffer+20 - quantity left 1499 ;textbuffer+23 - name 1500 1501 1502 1503 ;ldx TankNr 1504 7F4B BC 89 3D ldy ActiveWeapon,x 1505 7F4E B9 59 4C lda WeaponSymbols,y 1506 7F51 8D 8B 3C sta TextBuffer+18 1507 1508 ;--------------------- 1509 ;displaying the energy of a tank 1510 ;--------------------- 1511 1512 7F54 BD 4A 3D lda Energy,x 1513 1514 7F57 8D 41 3F sta decimal 1515 7F5A A9 A1 8D 43 3F A9 + mwa #textbuffer+40 displayposition 1516 7F64 20 C0 7B jsr displaybyte 1517 ;--------------------- 1518 ;displaying quantity of the given weapon 1519 ;--------------------- 1520 7F67 A6 8B ldx TankNr 1521 7F69 BD 89 3D lda ActiveWeapon,x 1522 7F6C 20 E5 71 jsr HowManyBullets 1523 7F6F 8D 41 3F sta decimal 1524 7F72 A9 8D 8D 43 3F A9 + mwa #textbuffer+20 displayposition 1525 7F7C 20 C0 7B jsr displaybyte 1526 1527 ;--------------------- 1528 ;displaying name of the weapon 1529 ;--------------------- 1530 7F7F A6 8B ldx TankNr 1531 7F81 BD 89 3D lda ActiveWeapon,x 1532 7F84 85 91 sta temp ;get back number of the weapon 1533 7F86 A9 00 85 92 mva #0 temp+1 1534 ; times 16 (because this is length of weapon name) 1535 7F8A A0 03 ldy #3 ; rotate 4 times 1536 7F8C RotateDISP02 1537 7F8C aslw temp Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 7F8C 06 91 ASL TEMP 2 7F8E 26 92 ROL TEMP+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1538 7F90 88 dey 1539 7F91 10 F9 bpl RotateDISP02 1540 7F93 18 A5 91 69 99 85 + adw temp #NamesOfWeapons 1541 7FA0 A0 06 ldy #6 ; from 6th character 1542 1543 7FA2 A0 0F ldy #15 1544 7FA4 loop06 1545 7FA4 B1 91 lda (temp),y 1546 7FA6 99 90 3C sta textbuffer+23,y 1547 7FA9 88 dey 1548 7FAA 10 F8 bpl loop06 1549 1550 ;========================= 1551 ;display Force 1552 ;========================= 1553 7FAC A6 8B ldx TankNr 1554 7FAE BD 6A 3D lda EnergyTableL,x 1555 7FB1 8D 41 3F sta decimal 1556 7FB4 BD 70 3D lda EnergyTableH,x 1557 7FB7 8D 42 3F sta decimal+1 1558 7FBA A9 B8 8D 43 3F A9 + mwa #textbuffer+63 displayposition 1559 7FC4 20 5E 7B jsr displaydec 1560 1561 ;========================= 1562 ;display Angle 1563 ;========================= 1564 ; additionally we are getting charcode of the tank 1565 ; (for future display) 1566 7FC7 A6 8B ldx TankNr 1567 7FC9 BD 82 3D lda AngleTable,x 1568 7FCC 30 1C bmi AngleToLeft 1569 7FCE A9 7F lda #$7f ; (tab) character 1570 7FD0 8D AD 3C sta textbuffer+52 1571 7FD3 A9 00 lda #0 ;space 1572 7FD5 8D AA 3C sta textbuffer+49 1573 7FD8 A9 5A lda #90 1574 7FDA 38 sec 1575 7FDB FD 82 3D sbc AngleTable,x 1576 7FDE 8D 41 3F sta decimal 1577 7FE1 A8 tay 1578 7FE2 B9 A6 45 lda BarrelTableR,y 1579 7FE5 85 88 sta CharCode 1580 7FE7 4C 00 80 jmp AngleDisplay ;like jp, because code always <>0 1581 7FEA AngleToLeft 1582 7FEA 38 sec 1583 7FEB E9 A5 sbc #(255-90) 1584 7FED 8D 41 3F sta decimal 1585 7FF0 A8 tay 1586 7FF1 B9 4B 45 lda BarrelTableL,y 1587 7FF4 85 88 sta CharCode 1588 7FF6 A9 7E lda #$7e ;(del) char 1589 7FF8 8D AA 3C sta textbuffer+49 1590 7FFB A9 00 lda #0 ;space 1591 7FFD 8D AD 3C sta textbuffer+52 1592 1593 8000 AngleDisplay 1594 8000 A9 AB 8D 43 3F A9 + mwa #textbuffer+50 displayposition 1595 800A 20 C0 7B jsr displaybyte 1596 1597 1598 ;========================= 1599 ;display Wind 1600 ;========================= 1601 800D AD 94 3D lda WindOrientation 1602 8010 D0 0C bne DisplayLeftWind 1603 8012 A9 7F lda #$7f ; (tab) char 1604 8014 8D C8 3C sta textbuffer+79 1605 8017 A9 00 lda #0 ;space 1606 8019 8D C5 3C sta textbuffer+76 1607 801C F0 0A beq DisplayWindValue 1608 801E DisplayLeftWind 1609 801E A9 7E lda #$7e ;(del) char 1610 8020 8D C5 3C sta textbuffer+76 1611 8023 A9 00 lda #0 ;space 1612 8025 8D C8 3C sta textbuffer+79 1613 8028 DisplayWindValue 1614 8028 AD 91 3D 85 91 AD + mwa Wind temp 1615 8032 lsrw temp ;divide by 16 to have Macro: LSRW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8032 46 92 LSR TEMP+1 2 8034 66 91 ROR TEMP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1616 8036 lsrw temp ;a nice view on a screen Macro: LSRW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8036 46 92 LSR TEMP+1 2 8038 66 91 ROR TEMP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1617 803A lsrw temp Macro: LSRW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 803A 46 92 LSR TEMP+1 2 803C 66 91 ROR TEMP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1618 803E lsrw temp Macro: LSRW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 803E 46 92 LSR TEMP+1 2 8040 66 91 ROR TEMP Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\textproc.asm 1619 8042 A5 91 lda temp 1620 8044 8D 41 3F sta decimal 1621 8047 A9 C6 8D 43 3F A9 + mwa #textbuffer+77 displayposition 1622 8051 20 C0 7B jsr displaybyte 1623 8054 60 rts 1624 ;------------------------------------------------- 1625 8055 PutTankNameOnScreen 1626 ; puts name of the tan on the screen 1627 8055 A0 00 ldy #$00 1628 8057 A5 8B lda tanknr 1629 8059 0A asl 1630 805A 0A asl 1631 805B 0A asl ; 8 chars per name 1632 805C AA tax 1633 805D NextChar02 1634 805D BD 57 3F lda tanksnames,x 1635 8060 99 80 3C sta textbuffer+7,y 1636 8063 E8 inx 1637 8064 C8 iny 1638 8065 C0 08 cpy #$08 1639 8067 D0 F4 bne NextChar02 1640 8069 60 rts 1641 ;------------------------------------------------- 1642 1643 .endif 1108 ;---------------------------------------------- 1109 806A icl 'grafproc.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 3 .IF *>0 ;this is a trick that prevents compiling this file alone 4 5 6 ;-------------------------------------------------- 7 806A draw .proc ;;fuxxing good draw :) 8 ;-------------------------------------------------- 9 ;creditz to Dr Jankowski / MIM U.W. 10 ; (xi,yi)-----(xk,yk) 11 ;20 DX=XK-XI 12 ;30 DY=YK-YI 13 ;40 DP=2*DY 14 ;50 DD=2*(DY-DX) 15 ;60 DI=2*DY-DX 16 ;70 REPEAT 17 ;80 IF DI>=0 18 ;90 DI=DI+DD 19 ;100 YI=YI+1 20 ;110 ELSE 21 ;120 DI=DI+DP 22 ;130 ENDIF 23 ;140 plot XI,YI 24 ;150 XI=XI+1 25 ;160 UNTIL XI=XK 26 27 28 ; begin: xdraw,ydraw - end: xbyte,ybyte 29 ; let's store starting coordinates 30 ; will be needed, because everything is calculated relatively 31 806A A9 00 8D 36 3E 8D + mwa #0 LineLength 32 8072 A5 80 85 97 A5 81 + mwa xdraw xtempDRAW 33 807A A5 82 85 99 A5 83 + mwa ydraw ytempDRAW 34 35 ; if line goes our of the screen we are not drawing it, but... 36 37 8082 A5 81 C9 01 D0 04 + cpw xdraw #screenwidth 38 808C B0 14 bcs DrawOutOfTheScreen 39 808E A5 85 C9 01 D0 04 + cpw xbyte #screenwidth 40 8098 B0 08 bcs DrawOutOfTheScreen 41 ;cpw ydraw #screenheight 42 ;bcs DrawOutOfTheScreen 43 ;cpw ybyte #screenheight 44 ;bcc DrawOnTheScreen 45 809A A5 83 lda ydraw+1 46 809C D0 04 bne DrawOutOfTheScreen 47 809E A5 87 lda ybyte+1 48 80A0 F0 01 beq DrawOnTheScreen 49 80A2 DrawOutOfTheScreen 50 ;jsr DrawJumpPad 51 80A2 60 rts 52 80A3 DrawOnTheScreen 53 ; constant parameters 54 ; XI=0 ,YI=0 55 80A3 A9 00 lda #0 56 80A5 85 9B sta XI 57 80A7 85 9C sta XI+1 58 80A9 85 9E sta YI 59 80AB 85 9F sta YI+1 60 61 ; setting the direction controll bits 62 80AD A5 83 C5 87 D0 04 + cpw ydraw ybyte 63 80B7 90 15 bcc LineDown 64 ; here one line up 65 ; we are setting bit 0 66 80B9 A9 01 8D 31 3E mva #1 HowToDraw ;here we can because it's first operation 67 ; we are subctracting Yend from Ybegin (reverse order) 68 ; DY=YI-YK 69 80BE 38 A5 82 E5 86 85 + sbw ydraw ybyte DY 70 80CB 4C E0 80 jmp CheckDirectionX 71 80CE LineDown 72 ; one line down here 73 ; we are setting bit 0 74 80CE A9 00 8D 31 3E mva #0 HowToDraw ;here we can because it's first operation 75 ; substract Ybegin from Yend (normal order) 76 ; DY=YK-YI 77 80D3 38 A5 86 E5 82 85 + sbw ybyte ydraw DY 78 80E0 CheckDirectionX 79 80E0 A5 81 C5 85 D0 04 + cpw xdraw xbyte 80 80EA 90 18 bcc LineRight 81 ; here goes line to the left 82 ; we set bit 1 83 84 80EC AD 31 3E lda HowToDraw 85 80EF 09 02 ora #$02 86 80F1 8D 31 3E sta HowToDraw 87 ; substract Xend from Xbegin (reverse) 88 ; DX=XI-XK 89 80F4 38 A5 80 E5 84 85 + sbw xdraw xbyte DX 90 8101 4C 11 81 jmp CheckDirectionFactor 91 8104 LineRight 92 ; here goes one line to the right 93 ; we clear bit 0 94 ; we can do nothing because the bit is cleared! 95 96 ;lda HowToDraw 97 ;and #$FD 98 ;sta HowToDraw 99 100 ; substracting Xbegin from Xend (normal way) 101 ; DX=XK-XI 102 8104 38 A5 84 E5 80 85 + sbw xbyte xdraw DX 103 8111 CheckDirectionFactor 104 ; here we check Direction Factor 105 ; I do not know if we are using proper English word 106 ; but the meaning is 'a' in y=ax+b 107 108 ; lda DX 109 ; we already have DX in A 110 8111 A5 A6 C5 A9 D0 04 + cpw DX DY 111 112 811B 90 0B bcc SwapXY 113 ; 'a' factor is fire, so we copy parameters 114 ; XK=DX 115 811D A5 A5 85 A1 A5 A6 + mwa DX XK 116 ; i kasowanie bitu 2 117 ; and bit 2 clear 118 ; (is not needed because already cleared) 119 ;lda HowToDraw 120 ;and #$FB 121 ;sta HowToDraw 122 8125 4C 48 81 jmp LineParametersReady 123 8128 SwapXY 124 ; not this half of a quarter! - parameters must be swapped 125 ; XK=DY 126 ; DY=DX 127 ; DX=XK - because DY is there so DY and DX are swapped 128 ; YK ... not used 129 8128 A5 A8 85 A1 A5 A9 + mwa DY XK 130 8130 A5 A5 85 A8 A5 A6 + mwa DX DY 131 8138 A5 A1 85 A5 A5 A2 + mwa XK DX 132 133 ; and let's set bit 2 134 8140 AD 31 3E lda HowToDraw 135 8143 09 04 ora #$04 136 8145 8D 31 3E sta HowToDraw 137 8148 LineParametersReady 138 ; let's check if length is not zero 139 8148 A5 A5 lda DX 140 814A 05 A6 ora DX+1 141 814C 05 A8 ora DY 142 814E 05 A9 ora DY+1 143 8150 D0 03 4C 46 82 jeq EndOfDraw 144 145 ; here we have DX,DY,XK and we know which operations 146 ; are to be performed with these factors when doing PLOT 147 ; (accordingly to given bits of 'HowToDraw') 148 ; Now we must calculate DP, DD and DI 149 ; DP=2*DY 150 ; DD=2*(DY-DX) 151 ; DI=2*DY-DX 152 153 8155 A5 A8 85 B0 A5 A9 + mwa DY DP 154 815D aslw DP Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 815D 06 B0 ASL DP 2 815F 26 B1 ROL DP+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 155 156 8161 38 A5 A8 E5 A5 85 + sbw DY DX DD 157 816E aslw DD Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 816E 06 AC ASL DD 2 8170 26 AD ROL DD+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 158 159 8172 A5 A8 85 AE A5 A9 + mwa DY DI 160 817A aslw DI Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 817A 06 AE ASL DI 2 817C 26 AF ROL DI+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 161 817E 38 A5 AE E5 A5 85 + sbw DI DX 162 163 818B DrawLoop 164 ; REPEAT 165 ; IF DI>=0 166 818B A5 AF lda DI+1 167 818D 30 1B bmi DINegative 168 ; DI=DI+DD 169 ; YI=YI+1 170 818F 18 A5 AE 65 AC 85 + adw DI DD 171 819C 18 A5 9E 69 01 85 + adw YI #1 172 81A7 4C B7 81 jmp drplot 173 81AA DINegative 174 ; ELSE 175 ; DI=DI+DP 176 81AA 18 A5 AE 65 B0 85 + adw DI DP 177 178 81B7 drplot ; Our plot that checks how to calculate pixels. 179 ; In xtempDRAW and ycircle there are begin coordinates 180 ; of our line 181 ; First we check the 'a' factor (like in y=ax+b) 182 ; If necessary we swap XI and YI 183 ; (as we can not change XI and YI we move XI to temp2 184 ; and YI to temp) 185 186 187 81B7 AD 31 3E lda HowToDraw 188 81BA 29 04 and #$04 189 81BC D0 13 bne SwappedXY 190 81BE A5 9B 85 91 A5 9C + mwa XI temp 191 81C6 A5 9E 85 93 A5 9F + mwa YI temp2 192 81CE 4C E1 81 jmp CheckPlotY 193 81D1 SwappedXY 194 81D1 A5 9B 85 93 A5 9C + mwa XI temp2 195 81D9 A5 9E 85 91 A5 9F + mwa YI temp 196 81E1 CheckPlotY 197 81E1 AD 31 3E lda HowToDraw 198 81E4 29 01 and #01 199 81E6 D0 10 bne LineGoesUp 200 ; here we know that line goes down and we are not changing Y 201 81E8 18 A5 93 65 99 85 + adw temp2 ytempDRAW ydraw ; YI 202 81F5 4C 05 82 jmp CheckPlotX 203 81F8 LineGoesUp 204 ; line goes up here - we are reversing Y 205 81F8 38 A5 99 E5 93 85 + sbw ytempDRAW temp2 ydraw ; YI 206 8205 CheckPlotX 207 8205 AD 31 3E lda HowToDraw 208 8208 29 02 and #02 209 820A D0 10 bne LineGoesLeft 210 ; here we know that line goes right and we are not changing X 211 820C 18 A5 91 65 97 85 + adw temp xtempDRAW xdraw ; XI 212 8219 4C 29 82 jmp PutPixelinDraw 213 821C LineGoesLeft 214 ; line goes left - we are reversing X 215 821C 38 A5 97 E5 91 85 + sbw xtempDRAW temp xdraw ; XI 216 8229 PutPixelinDraw 217 8229 20 53 82 jsr DrawJumpPad 218 ; end of the special PLOT for DRAW 219 220 ; XI=XI+1 221 ; UNTIL XI=XK 222 822C 18 A5 9B 69 01 85 + adw XI #1 223 8237 A5 9C C5 A2 D0 04 + cpw XI XK 224 8241 F0 03 4C 8B 81 jne DrawLoop 225 226 8246 EndOfDraw 227 8246 A5 97 85 80 A5 98 + mwa xtempDRAW xdraw 228 824E A5 99 85 82 mva ytempDRAW ydraw 229 8252 60 rts 230 .endp 231 232 8253 DrawJumpPad 233 8253 6C 2F 3E jmp (DrawJumpAddr) 234 8256 Drawplot 235 8256 4C 0C 89 jmp plot 236 8259 DrawLen 237 8259 18 AD 36 3E 69 01 + adw LineLength #1 238 8267 60 rts 239 240 8268 DrawCheck .proc 241 ; lda SmokeTracerFlag 242 ; bne yestrace ; jakie to głupie.... 243 8268 AD A9 3E lda tracerflag 244 826B 0D 6B 3E ora SmokeTracerFlag 245 826E yestrace 246 826E F0 03 beq notrace 247 8270 20 0C 89 jsr plot 248 8273 notrace 249 ;aftertrace 250 8273 AD 96 3D lda HitFlag 251 8276 D0 42 bne StopHitChecking 252 253 8278 CheckCollisionDraw 254 ; checking collision! 255 8278 A5 83 lda ydraw+1 256 827A D0 3E bne StopHitChecking 257 258 827C 20 D4 70 jsr CheckCollisionWithTank 259 827F AD 96 3D lda HitFlag 260 8282 D0 36 bne StopHitChecking 261 262 8284 A5 80 85 91 A5 81 + mwa xdraw temp 263 ;adw temp --- it does not work!!!!!!!! and should? OMC ??? #mountaintable 264 828C 18 clc 265 828D A5 91 lda temp 266 828F 69 13 adc #mountaintable 270 8297 85 92 sta temp+1 271 272 8299 A0 00 ldy #0 273 829B A5 82 lda ydraw 274 829D D1 91 cmp (temp),y 275 829F 90 19 bcc StopHitChecking 276 277 82A1 A9 01 8D 96 3D mva #1 HitFlag 278 82A6 A5 80 8D 32 3E A5 + mwa xdraw XHit 279 82B0 A5 82 8D 34 3E A5 + mwa ydraw YHit 280 281 282 82BA StopHitChecking 283 82BA 60 rts 284 .endp 285 286 ;-------------------------------------------------- 287 82BB circle .proc ;fxxxing good circle drawing :) 288 ;-------------------------------------------------- 289 ;Turbo Basic source 290 ; R=30 291 ; XC=0:YC=R 292 ; FX=0:FY=8*R:FS=4*R+3 293 ; WHILE FX0 298 ; FS=FS-FX-4 299 ; ELSE 300 ; YC=YC-1 301 ; FY=FY-8 302 ; FS=FS-FX-4+FY 303 ; ENDIF 304 ; WEND 305 ; splot8 306 307 82BB A5 80 8D 39 3E A5 + mwa xdraw xcircle 308 82C5 A5 82 8D 3B 3E mva ydraw ycircle 309 310 82CA A9 00 85 8F 85 90 mwa #0 xc 311 82D0 AD 38 3E 85 A4 mva radius yc 312 82D5 A9 00 85 9D mva #0 fx 313 82D9 AD 38 3E 85 A0 mva radius fy 314 82DE 06 A0 asl FY 315 82E0 06 A0 asl FY 316 82E2 A5 A0 85 A3 mva FY FS 317 82E6 06 A0 asl FY 318 82E8 18 clc 319 82E9 A5 A3 lda FS 320 82EB 69 03 adc #3 321 82ED 85 A3 sta FS 322 323 82EF circleloop 324 82EF A5 9D lda FX 325 82F1 C5 A0 cmp FY 326 82F3 B0 34 bcs endcircleloop 327 82F5 20 3C 83 jsr splot8 328 82F8 E6 8F inc XC 329 330 82FA 18 clc 331 82FB A5 9D lda FX 332 82FD 69 08 adc #8 333 82FF 85 9D sta FX 334 335 8301 A5 A3 lda FS 336 8303 F0 0C beq else01 337 8305 30 0A bmi else01 338 8307 38 sec 339 8308 E5 9D sbc FX 340 830A E9 04 sbc #4 341 830C 85 A3 sta FS 342 830E 4C 26 83 jmp endif01 343 8311 else01 344 8311 C6 A4 dec YC 345 8313 38 sec 346 8314 A5 A0 lda FY 347 8316 E9 08 sbc #8 348 8318 85 A0 sta FY 349 350 831A A5 A3 lda FS 351 831C 38 sec 352 831D E5 9D sbc FX 353 831F E9 04 sbc #4 354 8321 18 clc 355 8322 65 A0 adc FY 356 8324 85 A3 sta FS 357 8326 endif01 358 8326 4C EF 82 jmp circleloop 359 8329 endcircleloop 360 361 8329 20 3C 83 jsr splot8 362 363 832C AD 39 3E 85 80 AD + mwa xcircle xdraw 364 8336 AD 3B 3E 85 82 mva ycircle ydraw 365 833B 60 rts 366 .endp 367 ;---- 368 833C splot8 .proc 369 ; plot xcircle+XC,ycircle+YC 370 ; plot xcircle+XC,ycircle-YC 371 ; plot xcircle-XC,ycircle-YC 372 ; plot xcircle-XC,ycircle+YC 373 374 ; plot xcircle+YC,ycircle+XC 375 ; plot xcircle+YC,ycircle-XC 376 ; plot xcircle-YC,ycircle-XC 377 ; plot xcircle-YC,ycircle+XC 378 379 833C 18 clc 380 833D AD 39 3E lda xcircle 381 8340 65 8F adc XC 382 8342 85 80 sta xdraw 383 8344 AD 3A 3E lda xcircle+1 384 8347 69 00 adc #0 385 8349 85 81 sta xdraw+1 386 ;clc 387 834B AD 3B 3E lda ycircle 388 834E 65 A4 adc YC 389 8350 85 82 sta ydraw 390 8352 8D 3C 3E sta tempcir 391 8355 20 0C 89 jsr plot 392 393 8358 38 sec 394 8359 AD 3B 3E lda ycircle 395 835C E5 A4 sbc YC 396 835E 85 82 sta ydraw 397 8360 20 0C 89 jsr plot 398 399 8363 38 sec 400 8364 AD 39 3E lda xcircle 401 8367 E5 8F sbc XC 402 8369 85 80 sta xdraw 403 836B AD 3A 3E lda xcircle+1 404 836E E9 00 sbc #0 405 8370 85 81 sta xdraw+1 406 8372 20 0C 89 jsr plot 407 408 8375 AD 3C 3E lda tempcir 409 8378 85 82 sta ydraw 410 837A 20 0C 89 jsr plot 411 ;--- 412 837D 18 clc 413 837E AD 39 3E lda xcircle 414 8381 65 A4 adc yC 415 8383 85 80 sta xdraw 416 8385 AD 3A 3E lda xcircle+1 417 8388 69 00 adc #0 418 838A 85 81 sta xdraw+1 419 ;clc 420 838C AD 3B 3E lda ycircle 421 838F 65 8F adc xC 422 8391 85 82 sta ydraw 423 8393 8D 3C 3E sta tempcir 424 8396 20 0C 89 jsr plot 425 426 8399 38 sec 427 839A AD 3B 3E lda ycircle 428 839D E5 8F sbc xC 429 839F 85 82 sta ydraw 430 83A1 20 0C 89 jsr plot 431 432 83A4 38 sec 433 83A5 AD 39 3E lda xcircle 434 83A8 E5 A4 sbc yC 435 83AA 85 80 sta xdraw 436 83AC AD 3A 3E lda xcircle+1 437 83AF E9 00 sbc #0 438 83B1 85 81 sta xdraw+1 439 83B3 20 0C 89 jsr plot 440 441 83B6 AD 3C 3E lda tempcir 442 83B9 85 82 sta ydraw 443 83BB 20 0C 89 jsr plot 444 445 83BE 60 RTS 446 .endp 447 448 ;-------------------------------------------------- 449 83BF WaitForKeyRelease .proc 450 ;-------------------------------------------------- 451 83BF AD 0F D2 lda SKSTAT 452 83C2 C9 FF cmp #$ff 453 83C4 F0 04 beq KeyIsReleased 454 83C6 C9 F7 cmp #$f7 455 83C8 D0 F5 bne WaitForKeyRelease 456 83CA KeyIsReleased 457 83CA 60 rts 458 .endp 459 460 ;-------------------------------------------------- 461 83CB clearscreen .proc 462 ;-------------------------------------------------- 463 83CB A9 00 lda #0 464 83CD AA tax 465 83CE Loopi1 466 83CE 9D 10 10 sta display,x 467 83D1 9D 10 11 sta display+$100,x 468 83D4 9D 10 12 sta display+$200,x 469 83D7 9D 10 13 sta display+$300,x 470 83DA 9D 10 14 sta display+$400,x 471 83DD 9D 10 15 sta display+$500,x 472 83E0 9D 10 16 sta display+$600,x 473 83E3 9D 10 17 sta display+$700,x 474 83E6 9D 10 18 sta display+$800,x 475 83E9 9D 10 19 sta display+$900,x 476 83EC 9D 10 1A sta display+$a00,x 477 83EF 9D 10 1B sta display+$b00,x 478 83F2 9D 10 1C sta display+$c00,x 479 83F5 9D 10 1D sta display+$d00,x 480 83F8 9D 10 1E sta display+$e00,x 481 83FB 9D 10 1F sta display+$f00,x 482 83FE 9D 10 20 sta display+$1000,x 483 8401 9D 10 21 sta display+$1100,x 484 8404 9D 10 22 sta display+$1200,x 485 8407 9D 10 23 sta display+$1300,x 486 840A 9D 10 24 sta display+$1400,x 487 840D 9D 10 25 sta display+$1500,x 488 8410 9D 10 26 sta display+$1600,x 489 8413 9D 10 27 sta display+$1700,x 490 8416 9D 10 28 sta display+$1800,x 491 8419 9D 10 29 sta display+$1900,x 492 841C 9D 10 2A sta display+$1a00,x 493 841F 9D 10 2B sta display+$1b00,x 494 8422 9D 10 2C sta display+$1c00,x 495 8425 9D 10 2D sta display+$1d00,x 496 8428 9D 10 2E sta display+$1e00,x 497 842B 9D 10 2F sta display+$1f00,x 498 842E E8 inx 499 842F D0 9D bne Loopi1 500 8431 60 rts 501 .endp 502 ;-------------------------------*------------------ 503 8432 placetanks .proc 504 ;-------------------------------------------------- 505 8432 A2 05 ldx #(MaxPlayers-1) ;maxNumberOfPlayers-1 506 8434 A9 00 lda #0 507 8436 skip09 508 ; clearing the tables with coordinates of the tank 509 ; it is necessary, because randomizing checks 510 ; if the given tank is already placed 511 ; after check if its position is not (0,0) 512 513 ; I will be honest with you - I have no idea 514 ; what the above comment was intending to mean :) 515 516 8436 9D 97 3D sta XtankstableL,x 517 8439 9D 9D 3D sta XtankstableH,x 518 843C 9D A3 3D sta Ytankstable,x 519 843F CA dex 520 8440 10 F4 bpl skip09 521 522 523 8442 A9 00 8D D3 3E 8D + mwa #0 temptankX 524 844A A9 00 8D D5 3E mva #0 temptankNr ;player number 525 844F StillRandomize 526 844F AE 19 3D ldx NumberOfPlayers 527 8452 AD 0A D2 lda random 528 8455 29 07 and #$07 529 8457 A8 tay 530 8458 CC 19 3D cpy NumberOfPlayers 531 845B B0 F2 bcs StillRandomize 532 845D B9 97 3D lda xtankstableL,y 533 8460 D0 ED bne StillRandomize 534 8462 B9 9D 3D lda xtankstableH,y 535 8465 D0 E8 bne StillRandomize 536 ; here we know that we got a random number 537 ; of the tank that is not in use 538 ; this number is in Y 539 540 8467 18 clc 541 8468 AD D3 3E lda temptankX 542 846B 7D 62 48 adc disktance,x 543 846E 8D D3 3E sta temptankX 544 8471 99 97 3D sta xtankstableL,y 545 8474 90 03 bcc NotHigherByte03 546 8476 EE D4 3E inc temptankX+1 547 8479 NotHigherByte03 548 8479 AD D4 3E lda temptankX+1 549 847C 99 9D 3D sta xtankstableH,y 550 847F EE D5 3E INC temptankNr 551 8482 AE D5 3E ldx temptankNr 552 8485 EC 19 3D Cpx NumberOfPlayers 553 8488 D0 C5 bne StillRandomize 554 555 ; getting random displacements relative to even positions 556 848A A2 00 ldx #$00 557 848C StillRandomize02 558 848C AD 0A D2 lda random 559 848F 29 1F and #$1f ; maximal displacement is 31 pixels 560 561 8491 18 clc 562 8492 7D 97 3D adc xtankstableL,x 563 8495 9D 97 3D sta xtankstableL,x 564 8498 90 03 bcc NotHigherByte02 565 849A FE 9D 3D inc xtankstableH,x 566 849D NotHigherByte02 567 ; and we deduct 15 to make the displacement work two ways 568 849D 38 sec 569 849E BD 97 3D lda xtankstableL,x 570 84A1 E9 0F sbc #$0f 571 84A3 9D 97 3D sta xtankstableL,x 572 84A6 B0 03 bcs NotHigherByte01 573 84A8 DE 9D 3D dec xtankstableH,x 574 84AB NotHigherByte01 575 576 ; and clear lowest bit to be sure that the X coordinate is even 577 ; (this is to have P/M background look nice) 578 84AB BD 97 3D lda xtankstableL,x 579 84AE 29 FE and #$fe 580 84B0 9D 97 3D sta xtankstableL,x 581 84B3 E8 inx 582 84B4 EC 19 3D Cpx NumberOfPlayers 583 84B7 D0 D3 bne StillRandomize02 584 84B9 60 rts 585 586 ; during calculating heights of thw mountains 587 ; check if the tank is not somewhere around 588 ; if so, make horizontal line 8 pixels long 589 84BA CheckTank 590 84BA AE 19 3D ldx NumberOfPlayers 591 84BD CA dex 592 84BE CheckNextTank 593 84BE BD 97 3D lda xtankstableL,x 594 84C1 C5 80 cmp xdraw 595 84C3 D0 19 bne UnequalTanks 596 84C5 BD 9D 3D lda xtankstableH,x 597 84C8 C5 81 cmp xdraw+1 598 84CA D0 12 bne UnequalTanks 599 84CC A5 82 lda ydraw 600 ;sec 601 ;sbc #$01 ; minus 1, because it was 1 pixel too high 602 84CE 9D A3 3D sta ytankstable,x ; what's the heck is that????!!!! 603 84D1 A9 07 8D D1 3E mva #7 deltaX 604 84D6 A9 00 8D CD 3E 8D + mwa #0 delta 605 84DE UnequalTanks 606 84DE CA dex 607 84DF 10 DD bpl CheckNextTank 608 84E1 60 rts 609 .endp 610 ;------------------------------------------------- 611 84E2 drawtanks 612 ;------------------------------------------------- 613 614 615 84E2 A5 8B lda tanknr 616 84E4 48 pha 617 84E5 A2 00 ldx #$00 618 84E7 86 8B stx tanknr 619 620 84E9 DrawNextTank 621 84E9 20 F9 84 jsr drawtanknr 622 84EC E6 8B inc tanknr 623 84EE A6 8B ldx tanknr 624 84F0 EC 19 3D Cpx NumberOfPlayers 625 84F3 D0 F4 bne DrawNextTank 626 627 84F5 68 pla 628 84F6 85 8B sta tankNr 629 630 84F8 60 rts 631 ;--------- 632 84F9 drawtanknr 633 84F9 A6 8B ldx tanknr 634 ; let's check the energy 635 84FB BD 51 3D lda eXistenZ,x 636 84FE D0 08 bne SkipRemovigPM ; if energy=0 then no tank 637 638 ; hide P/M 639 8500 A9 00 lda #0 640 8502 9D 00 D0 sta hposp0,x 641 8505 4C 82 85 jmp DoNotDrawTankNr 642 8508 SkipRemovigPM 643 644 645 8508 BD 82 3D lda AngleTable,x 646 850B 30 0D bmi AngleToLeft01 647 850D A9 5A lda #90 648 850F 38 sec 649 8510 FD 82 3D sbc AngleTable,x 650 8513 A8 tay 651 8514 B9 A6 45 lda BarrelTableR,y 652 8517 4C 21 85 jmp CharacterAlreadyKnown 653 851A AngleToLeft01 654 851A 38 sec 655 851B E9 A5 sbc #(255-90) 656 851D A8 tay 657 851E B9 4B 45 lda BarrelTableL,y 658 8521 CharacterAlreadyKnown 659 8521 85 88 sta CharCode 660 8523 DrawTankNrX 661 8523 A6 8B ldx tanknr 662 8525 BD 97 3D lda xtankstableL,x 663 8528 85 80 sta xdraw 664 852A BD 9D 3D lda xtankstableH,x 665 852D 85 81 sta xdraw+1 666 852F BD A3 3D lda ytankstable,x 667 8532 85 82 sta ydraw 668 669 8534 20 FE 89 jsr TypeChar 670 671 ; now P/M graphics on the screen (only for 5 tanks) 672 ; horizontal position 673 8537 A5 80 85 84 A5 81 + mwa xdraw xbyte 674 853F A6 8B ldx tanknr 675 8541 E0 05 cpx #$5 676 8543 B0 3D bcs NoPlayerMissile 677 8545 rorw xbyte ; divide by 2 (carry does not matter) Macro: RORW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8545 66 85 ROR XBYTE+1 2 8547 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 678 8549 A5 84 lda xbyte 679 854B 18 clc 680 854C 69 24 adc #$24 ; P/M to graphics offser 681 854E E0 04 cpx #$4 ; 5th tank are joined missiles and offset is defferent 682 8550 D0 03 bne NoMissile 683 8552 18 clc 684 8553 69 0C adc #$0C 685 8555 NoMissile 686 8555 9D 00 D0 sta hposp0,x 687 ; vertical position 688 8558 BD 41 45 lda pmtableL,x 689 855B 85 84 sta xbyte 690 855D BD 46 45 lda pmtableH,x 691 8560 85 85 sta xbyte+1 692 693 ; calculate start position of the tank 694 8562 A5 82 lda ydraw 695 8564 18 clc 696 8565 69 25 adc #$25 ; P/M to graphics offset 697 8567 85 91 sta temp 698 ; clear sprite and put 3 lines on the tank at the same time 699 8569 A0 00 ldy #$00 700 856B 98 tya 701 856C C4 91 ClearPM cpy temp 702 856E D0 0D bne ZeroesToGo 703 8570 A9 03 lda #$03 ; (2 bits set) we set on two pixels in three lines 704 8572 91 84 sta (xbyte),y 705 8574 88 dey 706 8575 91 84 sta (xbyte),y 707 8577 88 dey 708 8578 91 84 sta (xbyte),y 709 857A 88 dey 710 857B A9 00 lda #$00 711 857D ZeroesToGo 712 857D 91 84 sta (xbyte),y 713 857F 88 dey 714 8580 D0 EA bne ClearPM 715 716 8582 NoPlayerMissile 717 8582 DoNotDrawTankNr 718 8582 60 rts 719 720 ;-------------------------------------------------- 721 8583 drawmountains .proc 722 ;-------------------------------------------------- 723 8583 A9 00 85 80 85 81 mwa #0 xdraw 724 8589 A9 13 85 B2 A9 41 + mwa #mountaintable modify 725 726 727 8591 drawmountainsloop 728 8591 A0 00 ldy #0 729 8593 B1 B2 lda (modify),y 730 8595 85 82 sta ydraw 731 8597 20 D4 89 jsr DrawLine 732 859A 18 A5 B2 69 01 85 + adw modify #1 733 85A5 18 A5 80 69 01 85 + adw xdraw #1 734 85B0 A5 81 C9 01 D0 04 + cpw xdraw #screenwidth 735 85BA D0 D5 bne drawmountainsloop 736 737 85BC 60 rts 738 ;-------------------------------------------------- 739 85BD drawmountainspixel 740 ;-------------------------------------------------- 741 85BD A9 00 85 80 85 81 mwa #0 xdraw 742 85C3 A9 13 85 B2 A9 41 + mwa #mountaintable modify 743 744 745 85CB drawmountainspixelloop 746 85CB A0 00 ldy #0 747 85CD B1 B2 lda (modify),y 748 85CF 85 82 sta ydraw 749 85D1 20 0C 89 jsr plot 750 85D4 18 A5 B2 69 01 85 + adw modify #1 751 85DF 18 A5 80 69 01 85 + adw xdraw #1 752 85EA A5 81 C9 01 D0 04 + cpw xdraw #screenwidth 753 85F4 D0 D5 bne drawmountainspixelloop 754 755 85F6 60 rts 756 .endp 757 ;-------------------------------------------------- 758 85F7 SoilDown2 .proc 759 ;-------------------------------------------------- 760 761 ; how it is supposed to work: 762 ; first loop is looking for the highest pixels 763 ; and fills with their Y coordinates both temporary tables 764 ; 765 ; second (main) loop works this way: 766 ; sets end-of-soil-fall-down-flag to 1 ( IsEndOfTheFallFlag=1 ) 767 ; goes through the horizontal line checking if 768 ; Y coordinate from the first table equals to height of the peak 769 ; if so, it goes further 770 ; if not: 771 ; sets end-of-soil-fall-down-flag to 0 772 ; increases Y from the first table 773 ; if there is no pixel there it plots here and 774 ; zeroes pixel from the second table and after that 775 ; increases Y of the second table 776 ; repeats with next pixels au to the end of the line 777 ; if the flag is 0 then repeat the main loop 778 ; and that's it :) 779 ; 780 ; I am sorry but after these 4 years I have no idea 781 ; how it works. I have just translated Polish comment 782 ; but I do not understand a word of it :) 783 ; If you know how it works, please write here :)))) 784 785 85F7 20 66 72 jsr PMoutofscreen 786 787 ; First we look for highest pixels and fill with their coordinates 788 ; both tables 789 790 85FA AD FC 3D 85 80 AD + mwa RangeLeft xdraw 791 8604 18 AD FC 3D 69 54 + adw RangeLeft #mountaintable2 tempor2 792 8613 18 AD FC 3D 69 95 + adw RangeLeft #mountaintable3 tempor3 793 794 8622 NextColumn1 795 8622 A9 00 85 82 mva #0 ydraw 796 8626 NextPoint1 797 8626 20 5F 89 jsr point 798 8629 F0 0B beq StillNothing 799 862B A0 00 ldy #0 800 862D A5 82 lda ydraw 801 862F 91 A7 sta (tempor2),y 802 8631 91 AA sta (tempor3),y 803 8633 4C 3E 86 jmp FoundPeek1 804 8636 StillNothing 805 8636 E6 82 inc ydraw 806 8638 A5 82 lda ydraw 807 863A C9 C8 cmp #screenheight 808 863C D0 E8 bne NextPoint1 809 863E FoundPeek1 810 863E 18 A5 A7 69 01 85 + adw tempor2 #1 811 8649 18 A5 AA 69 01 85 + adw tempor3 #1 812 8654 18 A5 80 69 01 85 + adw xdraw #1 813 ;vcmp xdraw,screenwidth,NextColumn1 814 865F A5 81 CD FF 3D D0 + cpw xdraw RangeRight 815 866B 90 B5 bcc NextColumn1 816 866D F0 B3 beq NextColumn1 817 ; we have both tables filled with starting values 818 819 ; main loop starts here 820 866F MainFallout2 821 866F AD FC 3D 85 80 AD + mwa RangeLeft xdraw 822 8679 18 AD FC 3D 69 13 + adw RangeLeft #mountaintable temp 823 8688 18 AD FC 3D 69 54 + adw RangeLeft #mountaintable2 tempor2 824 8697 18 AD FC 3D 69 95 + adw RangeLeft #mountaintable3 tempor3 825 826 86A6 A9 01 8D 8D 3E A9 + mwa #1 IsEndOfTheFallFlag 827 86B0 FalloutOfLine 828 86B0 A0 00 ldy #0 829 830 ; is Y coordinate from the first table 831 ; equal to peak height, if so, go ahead 832 86B2 B1 A7 lda (tempor2),y 833 86B4 C9 C7 cmp #screenheight-1 ;cmp (temp),y 834 86B6 B0 2A bcs ColumnIsReady 835 ; in the other case there are things to be done 836 86B8 8C 8D 3E sty IsEndOfTheFallFlag ; flag to 0 837 ; we are increasing Y in the first table 838 ;lda (tempor2),y 839 86BB 18 clc 840 86BC 69 01 adc #1 841 86BE 91 A7 sta (tempor2),y 842 ; and checking if there is a pixel there 843 86C0 85 82 sta ydraw 844 86C2 20 5F 89 jsr point 845 86C5 D0 1B bne ThereIsPixelHere 846 ; if no pixel we plot it 847 86C7 A9 01 8D CA 3E mva #1 color 848 86CC 20 24 89 jsr plot.MakePlot 849 ; zeroing pixel from the second table 850 ; and increase Y in second table 851 86CF A0 00 ldy #0 852 86D1 B1 AA lda (tempor3),y 853 86D3 85 82 sta ydraw 854 86D5 B1 AA lda (tempor3),y 855 86D7 18 clc 856 86D8 69 01 adc #1 857 86DA 91 AA sta (tempor3),y 858 86DC 8C CA 3E sty color 859 86DF 20 24 89 jsr plot.MakePlot 860 861 86E2 ThereIsPixelHere 862 86E2 ColumnIsReady 863 86E2 18 A5 91 69 01 85 + adw temp #1 864 86ED 18 A5 A7 69 01 85 + adw tempor2 #1 865 86F8 18 A5 AA 69 01 85 + adw tempor3 #1 866 8703 18 A5 80 69 01 85 + adw xdraw #1 867 ;vcmp xdraw,screenwidth,FalloutOfLine 868 870E A5 81 CD FF 3D D0 + cpw xdraw RangeRight 869 871A 90 94 bcc FalloutOfLine 870 871C F0 92 beq FalloutOfLine 871 872 871E AD 8D 3E lda IsEndOfTheFallFlag 873 ; we repeat untill at some point first table reaches 874 ; level of the mountains 875 8721 D0 03 4C 6F 86 jeq MainFallout2 876 ; now correct heights are in the second temporary table 877 ; so we copy 878 8726 AD FC 3D 85 80 AD + mwa RangeLeft xdraw 879 8730 18 AD FC 3D 69 13 + adw RangeLeft #mountaintable temp 880 873F 18 AD FC 3D 69 95 + adw RangeLeft #mountaintable3 tempor3 881 882 874E A0 00 ldy #0 883 8750 CopyHeights 884 8750 B1 AA lda (tempor3),y 885 8752 91 91 sta (temp),y 886 8754 18 A5 91 69 01 85 + adw temp #1 887 875F 18 A5 AA 69 01 85 + adw tempor3 #1 888 876A 18 A5 80 69 01 85 + adw xdraw #1 889 ;vcmp xdraw,screenwidth,CopyHeights 890 8775 A5 81 CD FF 3D D0 + cpw xdraw RangeRight 891 8781 90 CD bcc CopyHeights 892 8783 F0 CB beq CopyHeights 893 8785 A9 01 8D CA 3E mva #1 color 894 878A 60 rts 895 .endp 896 ;-------------------------------------------------- 897 878B calculatemountains .proc 898 ;-------------------------------------------------- 899 878B A9 00 85 80 85 81 mwa #0 xdraw 900 901 ; starting point 902 8791 getrandomY ;getting random Y coordinate 903 8791 38 sec 904 8792 AD 0A D2 lda random 905 8795 C9 08 cmp #screenheight-(margin*4) ;it means that max line=199 906 8797 B0 F8 bcs getrandomY 907 8799 18 clc 908 879A 69 60 adc #(margin*2) 909 879C 85 82 sta ydraw 910 879E 8D D0 3E sta yfloat+1 911 87A1 A9 00 8D CF 3E mva #0 yfloat ;yfloat equals to e.g. 140.0 912 913 ; how to make nice looking mountains? 914 ; randomize points and join them with lines 915 ; Here we do it simpler way - we randomize X (or deltaX) 916 ; and "delta" (change of Y coordinate) 917 918 87A6 NextPart 919 87A6 AD 0A D2 lda random 920 87A9 8D CD 3E sta delta ; it is after the dot (xxx.delta) 921 87AC AD 0A D2 lda random 922 87AF 29 03 and #$03 ;(max delta) 923 87B1 8D CE 3E sta delta+1 ; before the dot (delta+1.delta) 924 925 87B4 AD 0A D2 lda random 926 87B7 29 01 and #$01 ;random sign (+/- or up/down) 927 87B9 8D D2 3E sta UpNdown 928 929 ; theoretically we have here ready 930 ; fixed-point delta value 931 ; (-1*(UpNdown))*(delta+1.delta) 932 933 ;loop drawing one line 934 935 87BC ChangingDirection 936 87BC AD 0A D2 lda random ;length of the line 937 87BF 29 0F and #$0f ;max line length 938 87C1 AA tax 939 87C2 E8 inx 940 87C3 E8 inx 941 87C4 E8 inx 942 87C5 8E D1 3E stx deltaX 943 944 87C8 OnePart 945 87C8 20 BA 84 jsr placeTanks.CheckTank 946 ; checks if at a given X coordinate 947 ; is any tank and if so 948 ; changes parameters of drawing 949 ; to generate flat 8 pixels 950 ; (it will be the place for the tank) 951 ; it also stores Y position of the tank 952 87CB 18 A5 80 69 13 85 + adw xdraw #mountaintable modify 953 954 87D8 A5 82 lda ydraw 955 87DA A0 00 ldy #0 956 87DC 91 B2 sta (modify),y 957 958 ; Up or Down 959 87DE AD D2 3E lda UpNdown 960 87E1 F0 22 beq ToBottom 961 962 87E3 ToTop ;it means substracting 963 964 87E3 38 AD CF 3E ED CD + sbw yfloat delta 965 87F6 AD D0 3E lda yfloat+1 966 87F9 C9 30 cmp #margin 967 87FB B0 27 bcs Skip01 968 ; if smaller than 10 969 87FD A2 00 ldx #$00 970 87FF 8E D2 3E stx UpNdown 971 8802 4C 24 88 jmp Skip01 972 973 8805 ToBottom 974 8805 18 AD CF 3E 6D CD + adw yfloat delta 975 8818 AD D0 3E lda yfloat+1 976 881B C9 98 cmp #screenheight-margin 977 881D 90 05 bcc Skip01 978 ; if higher than screen 979 881F A2 01 ldx #$01 980 8821 8E D2 3E stx UpNdown 981 8824 Skip01 982 8824 85 82 sta ydraw 983 984 8826 18 A5 80 69 01 85 + adw xdraw #1 985 986 8831 A5 81 C9 01 D0 04 + cpw xdraw #screenwidth 987 883B F0 08 beq EndDrawing 988 989 883D CE D1 3E dec deltaX 990 8840 D0 86 bne OnePart 991 992 8842 4C A6 87 jmp NextPart 993 8845 EndDrawing 994 995 8845 60 rts 996 .endp 997 ; ----------------------------------------- 998 8846 unPlot .proc 999 ; ----------------------------------------- 1000 8846 A2 00 ldx #0 ; only one pixel 1001 8848 unPlotAfterX 1002 8848 8E 8E 3E stx WhichUnPlot 1003 1004 ; first remake the oldie 1005 884B BD 94 3E lda oldplotL,x 1006 884E 85 8D sta oldplot 1007 8850 BD 8F 3E lda oldplotH,x 1008 8853 85 8E sta oldplot+1 1009 1010 8855 BD 9E 3E lda oldply,x 1011 8858 A8 tay 1012 8859 BD 99 3E lda oldora,x 1013 885C 91 8D sta (oldplot),y 1014 1015 1016 ; is it not out of the screen ???? 1017 885E A5 83 C9 00 D0 04 + cpw ydraw #screenheight 1018 8868 90 03 4C 0B 89 jcs EndOfUnPlot 1019 886D CheckX 1020 886D A5 81 C9 01 D0 04 + cpw xdraw #screenwidth 1021 8877 90 03 4C 0B 89 jcs EndOfUnPlot 1022 887C MakeUnPlot 1023 ; let's count coordinates taken from xdraw and ydraw 1024 887C A5 80 85 84 A5 81 + mwa xdraw xbyte 1025 1026 8884 A5 84 lda xbyte 1027 8886 29 07 and #$7 1028 8888 8D CB 3E sta ybit 1029 1030 888B lsrw xbyte Macro: LSRW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 888B 46 85 LSR XBYTE+1 2 888D 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1031 888F rorw xbyte Macro: RORW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 888F 66 85 ROR XBYTE+1 2 8891 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1032 8893 rorw xbyte Macro: RORW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8893 66 85 ROR XBYTE+1 2 8895 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1033 ;--- 1034 8897 A4 84 ldy xbyte 1035 1036 8899 AE 8E 3E ldx WhichUnPlot 1037 889C 98 tya 1038 889D 9D 9E 3E sta oldply,x 1039 1040 1041 88A0 A6 82 ldx ydraw 1042 88A2 BD B7 46 lda linetableL,x 1043 88A5 85 84 sta xbyte 1044 88A7 85 8D sta oldplot 1045 88A9 BD 80 47 lda linetableH,x 1046 88AC 85 85 sta xbyte+1 1047 88AE 85 8E sta oldplot+1 1048 88B0 AE CB 3E ldx ybit 1049 1050 1051 88B3 AD CA 3E lda color 1052 88B6 F0 0D beq ClearUnPlot 1053 1054 88B8 B1 84 lda (xbyte),y 1055 88BA 8D A3 3E sta OldOraTemp 1056 88BD 1D 52 48 ora bittable,x 1057 88C0 91 84 sta (xbyte),y 1058 88C2 4C CD 88 jmp ContinueUnPlot 1059 88C5 ClearUnPlot 1060 88C5 B1 84 lda (xbyte),y 1061 88C7 8D A3 3E sta OldOraTemp 1062 88CA 3D 5A 48 and bittable2,x 1063 ; sta (xbyte),y 1064 88CD ContinueUnPlot 1065 88CD AE 8E 3E ldx WhichUnPlot 1066 88D0 AD A3 3E lda OldOraTemp 1067 88D3 9D 99 3E sta oldora,x 1068 88D6 A5 8D lda oldplot 1069 88D8 9D 94 3E sta oldplotL,x 1070 88DB A5 8E lda oldplot+1 1071 88DD 9D 8F 3E sta oldplotH,x 1072 ; and now we must solve the problem of several plots 1073 ; in one byte 1074 88E0 A2 04 ldx #4 1075 88E2 AC 8E 3E ldy WhichUnPlot 1076 88E5 LetsCheckOverlapping 1077 88E5 EC 8E 3E cpx WhichUnPlot 1078 88E8 F0 1E beq SkipThisPlot 1079 88EA BD 94 3E lda oldplotL,x 1080 88ED D9 94 3E cmp oldplotL,y 1081 88F0 D0 16 bne NotTheSamePlot 1082 88F2 BD 8F 3E lda oldplotH,x 1083 88F5 D9 8F 3E cmp oldplotH,y 1084 88F8 D0 0E bne NotTheSamePlot 1085 88FA BD 9E 3E lda oldply,x 1086 88FD D9 9E 3E cmp oldply,y 1087 8900 D0 06 bne NotTheSamePlot 1088 ; the pixel is in the same byte so let's take correct contents 1089 8902 BD 99 3E lda oldora,x 1090 8905 99 99 3E sta oldora,y 1091 8908 NotTheSamePlot 1092 8908 SkipThisPlot 1093 8908 CA dex 1094 8909 10 DA bpl LetsCheckOverlapping 1095 890B EndOfUnPlot 1096 890B 60 rts 1097 .endp 1098 ; ----------------------------------------- 1099 890C plot .proc ;plot (xdraw, ydraw) 1100 ; this is one of the most important routines in the whole 1101 ; game. If you are going to speed up the game, start with 1102 ; plot - it is used by every single effect starting from explosions 1103 ; through line drawing and small text output!!! 1104 ; We tried to keep it clear and therefore it is far from 1105 ; optimal speed. 1106 1107 ; ----------------------------------------- 1108 ; is it not over the screen ??? 1109 890C A5 83 C9 00 D0 04 + cpw ydraw #(screenheight+1); changed for one additional line. cpw ydraw #(screenheight-1) 1110 8916 B0 F3 bcs unPlot.EndOfUnPlot 1111 8918 CheckX02 1112 8918 A5 81 C9 01 D0 04 + cpw xdraw #screenwidth 1113 8922 B0 32 bcs EndOfPlot ;nearest RTS 1114 8924 MakePlot 1115 ; let's calculate coordinates from xdraw and ydraw 1116 8924 A5 80 85 84 A5 81 + mwa xdraw xbyte 1117 1118 1119 892C A5 84 lda xbyte 1120 892E 29 07 and #$7 1121 8930 8D CB 3E sta ybit 1122 1123 ;xbyte = xbyte/8 1124 8933 A5 84 lda xbyte 1125 8935 46 85 lsr xbyte+1 1126 8937 6A ror ;just one bit over 256. Max screenwidht = 512!!! 1127 8938 4A lsr 1128 8939 4A lsr 1129 893A A8 tay ;save 1130 ;--- 1131 1132 1133 1134 1135 893B A6 82 ldx ydraw 1136 893D BD B7 46 lda linetableL,x 1137 8940 85 84 sta xbyte 1138 8942 BD 80 47 lda linetableH,x 1139 8945 85 85 sta xbyte+1 1140 1141 8947 AE CB 3E ldx ybit 1142 894A AD CA 3E lda color 1143 894D F0 08 beq ClearPlot 1144 1145 894F B1 84 lda (xbyte),y 1146 8951 1D 52 48 ora bittable,x 1147 8954 91 84 sta (xbyte),y 1148 8956 EndOfPlot 1149 8956 60 rts 1150 8957 ClearPlot 1151 8957 B1 84 lda (xbyte),y 1152 8959 3D 5A 48 and bittable2,x 1153 895C 91 84 sta (xbyte),y 1154 895E 60 rts 1155 .endp 1156 ; ----------------------------------------- 1157 895F point .proc 1158 ; ----------------------------------------- 1159 ; checks state of the pixel (coordinates in xdraw and ydraw) 1160 ; result is in A (zero or appropriate bit is set) 1161 1162 1163 ; let's calculate coordinates from xdraw and ydraw 1164 895F A5 80 85 84 A5 81 + mwa xdraw xbyte 1165 1166 1167 8967 A5 84 lda xbyte 1168 8969 29 07 and #$7 1169 896B 8D CB 3E sta ybit 1170 1171 ;xbyte = xbyte/8 1172 896E A5 84 lda xbyte 1173 8970 46 85 lsr xbyte+1 1174 8972 6A ror ;just one bit over 256. Max screenwidht = 512!!! 1175 8973 4A lsr 1176 8974 4A lsr 1177 8975 A8 tay ;save 1178 1179 ;--- 1180 1181 8976 A6 82 ldx ydraw 1182 8978 BD B7 46 lda linetableL,x 1183 897B 85 84 sta xbyte 1184 897D BD 80 47 lda linetableH,x 1185 8980 85 85 sta xbyte+1 1186 1187 8982 AE CB 3E ldx ybit 1188 1189 8985 B1 84 lda (xbyte),y 1190 8987 3D 52 48 and bittable,x 1191 898A 60 rts 1192 .endp 1193 1194 ; ----------------------------------------- 1195 898B PlotPointer .proc 1196 ; ----------------------------------------- 1197 ; draws pointer that shows where is the bullet 1198 ; when it is over the screen 1199 ; (it is on the top of the screen) 1200 1201 1202 898B A5 80 8D 3C 3E A5 + mwa xdraw tempCir 1203 1204 8995 A9 00 8D CA 3E mva #0 color 1205 899A A9 C8 85 82 A9 00 + mwa #screenHeight ydraw 1206 89A2 AD 49 48 85 80 AD + mwa oldPlotPointerX xdraw 1207 89AC 20 0C 89 jsr plot 1208 1209 1210 89AF AD 3C 3E 85 80 AD + mwa tempCir xdraw 1211 1212 89B9 A9 01 8D CA 3E mva #1 color 1213 89BE A9 C8 85 82 A9 00 + mwa #screenHeight ydraw 1214 89C6 20 0C 89 jsr plot 1215 1216 89C9 A5 80 8D 49 48 A5 + mwa xdraw oldPlotPointerX 1217 1218 89D3 60 rts 1219 1220 .endp 1221 ;-------------------------------------------------- 1222 89D4 DrawLine .proc 1223 ;-------------------------------------------------- 1224 89D4 A9 00 85 83 mva #0 ydraw+1 1225 89D8 A9 C8 lda #screenheight 1226 89DA 38 sec 1227 89DB E5 82 sbc ydraw 1228 89DD 8D CC 3E sta tempbyte01 1229 89E0 20 0C 89 jsr plot 1230 ;rts 1231 89E3 4C ED 89 jmp IntoDraw ; jumps inside Draw routine 1232 ; because one pixel is already plotted 1233 1234 1235 89E6 loopdraw 1236 1237 89E6 B1 84 lda (xbyte),y 1238 89E8 1D 52 48 ora bittable,x 1239 89EB 91 84 sta (xbyte),y 1240 89ED 18 A5 84 69 28 85 + IntoDraw adw xbyte #screenBytes 1241 1242 89F8 CE CC 3E dec tempbyte01 1243 89FB D0 E9 bne loopdraw 1244 89FD 60 rts 1245 .endp 1246 ; 1247 ; ------------------------------------------ 1248 89FE TypeChar .proc 1249 ; puts char on the graphics screen 1250 ; in: CharCode 1251 ; in: left LOWER corner of the char coordinates (xdraw, ydraw) 1252 ;-------------------------------------------------- 1253 ; char to the table 1254 89FE A5 88 lda CharCode 1255 8A00 85 89 sta fontind 1256 8A02 A9 00 lda #$00 1257 8A04 85 8A sta fontind+1 1258 ; char intex times 8 1259 8A06 aslw fontind Macro: ASLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8A06 06 89 ASL FONTIND 2 8A08 26 8A ROL FONTIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1260 8A0A rolw fontind Macro: ROLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8A0A 26 89 ROL FONTIND 2 8A0C 26 8A ROL FONTIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1261 8A0E rolw fontind Macro: ROLW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8A0E 26 89 ROL FONTIND 2 8A10 26 8A ROL FONTIND+1 Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1262 1263 8A12 18 A5 89 69 2A 85 + adw fontind #TankFont 1264 1265 ; and 8 bytes to the table 1266 8A1F A0 07 ldy #7 1267 8A21 CopyChar 1268 8A21 B1 89 lda (fontind),y 1269 8A23 99 BA 3E sta char1,y 1270 8A26 A9 00 lda #$00 1271 8A28 99 C2 3E sta char2,y 1272 8A2B 88 dey 1273 8A2C 10 F3 bpl CopyChar 1274 ; and 8 subsequent bytes as a mask 1275 8A2E 18 A5 89 69 08 85 + adw fontind #8 1276 8A39 A0 07 ldy #7 1277 8A3B CopyMask 1278 8A3B B1 89 lda (fontind),y 1279 8A3D 99 AA 3E sta mask1,y 1280 8A40 A9 FF lda #$ff 1281 8A42 99 B2 3E sta mask2,y 1282 8A45 88 dey 1283 8A46 10 F3 bpl CopyMask 1284 1285 ; calculating coordinates from xdraw and ydraw 1286 8A48 A5 80 85 84 A5 81 + mwa xdraw xbyte 1287 1288 8A50 A5 84 lda xbyte 1289 8A52 29 07 and #$7 1290 8A54 8D CB 3E sta ybit 1291 1292 8A57 lsrw xbyte Macro: LSRW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8A57 46 85 LSR XBYTE+1 2 8A59 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1293 8A5B rorw xbyte Macro: RORW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8A5B 66 85 ROR XBYTE+1 2 8A5D 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1294 8A5F rorw xbyte Macro: RORW [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 1 8A5F 66 85 ROR XBYTE+1 2 8A61 66 84 ROR XBYTE Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1295 1296 ;--- 1297 8A63 A4 84 ldy xbyte 1298 1299 8A65 A6 82 ldx ydraw 1300 .rept 7 1301 DEX 1302 .ENDR 1302 .endr Source: REPT 1301 8A67 CA DEX 1301 8A68 CA DEX 1301 8A69 CA DEX 1301 8A6A CA DEX 1301 8A6B CA DEX 1301 8A6C CA DEX 1301 8A6D CA DEX Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\grafproc.asm 1303 1304 8A6E BD B7 46 lda linetableL,x 1305 8A71 85 84 sta xbyte 1306 8A73 BD 80 47 lda linetableH,x 1307 8A76 85 85 sta xbyte+1 1308 ; mask preparation and character shifting 1309 8A78 AE CB 3E ldx ybit 1310 8A7B F0 6B beq MaskOK00 1311 8A7D MakeMask00 1312 8A7D 38 sec 1313 8A7E 6E AA 3E ror mask1 1314 8A81 6E B2 3E ror mask2 1315 8A84 38 sec 1316 8A85 6E AB 3E ror mask1+1 1317 8A88 6E B3 3E ror mask2+1 1318 8A8B 38 sec 1319 8A8C 6E AC 3E ror mask1+2 1320 8A8F 6E B4 3E ror mask2+2 1321 8A92 38 sec 1322 8A93 6E AD 3E ror mask1+3 1323 8A96 6E B5 3E ror mask2+3 1324 8A99 38 sec 1325 8A9A 6E AE 3E ror mask1+4 1326 8A9D 6E B6 3E ror mask2+4 1327 8AA0 38 sec 1328 8AA1 6E AF 3E ror mask1+5 1329 8AA4 6E B7 3E ror mask2+5 1330 8AA7 38 sec 1331 8AA8 6E B0 3E ror mask1+6 1332 8AAB 6E B8 3E ror mask2+6 1333 8AAE 38 sec 1334 8AAF 6E B1 3E ror mask1+7 1335 8AB2 6E B9 3E ror mask2+7 1336 8AB5 4E BA 3E lsr char1 1337 8AB8 6E C2 3E ror char2 1338 8ABB 6E BB 3E ror char1+1 1339 8ABE 6E C3 3E ror char2+1 1340 8AC1 6E BC 3E ror char1+2 1341 8AC4 6E C4 3E ror char2+2 1342 8AC7 6E BD 3E ror char1+3 1343 8ACA 6E C5 3E ror char2+3 1344 8ACD 6E BE 3E ror char1+4 1345 8AD0 6E C6 3E ror char2+4 1346 8AD3 6E BF 3E ror char1+5 1347 8AD6 6E C7 3E ror char2+5 1348 8AD9 6E C0 3E ror char1+6 1349 8ADC 6E C8 3E ror char2+6 1350 8ADF 6E C1 3E ror char1+7 1351 8AE2 6E C9 3E ror char2+7 1352 8AE5 CA dex 1353 8AE6 D0 95 bne MakeMask00 1354 8AE8 MaskOK00 1355 ; here x=0 1356 8AE8 AD FB 3D lda Erase 1357 8AEB F0 0F beq CharLoopi ; it works, because x=0 1358 8AED A9 00 lda #0 1359 8AEF A2 07 ldx #7 1360 8AF1 EmptyChar 1361 8AF1 9D BA 3E sta char1,x 1362 8AF4 9D C2 3E sta char2,x 1363 8AF7 CA dex 1364 8AF8 10 F7 bpl EmptyChar 1365 8AFA A2 00 ldx #0 1366 8AFC CharLoopi 1367 8AFC B1 84 lda (xbyte),y 1368 8AFE 3D AA 3E and mask1,x 1369 8B01 1D BA 3E ora char1,x 1370 8B04 91 84 sta (xbyte),y 1371 8B06 C8 iny 1372 8B07 B1 84 lda (xbyte),y 1373 8B09 3D B2 3E and mask2,x 1374 8B0C 1D C2 3E ora char2,x 1375 8B0F 91 84 sta (xbyte),y 1376 8B11 88 dey 1377 8B12 18 A5 84 69 28 85 + adw xbyte #screenBytes 1378 8B1D E8 inx 1379 8B1E E0 08 cpx #8 1380 8B20 D0 DA bne CharLoopi 1381 8B22 60 rts 1382 .endp 1383 ; ------------------------------------------ 1384 8B23 PutChar4x4 .proc ;puts 4x4 pixels char on the graphics screen 1385 ; in: xdraw, ydraw (upper left corner of the char) 1386 ; in: CharCode4x4 (.sbyte) 1387 ;-------------------------------------------------- 1388 8B23 AD 51 48 lda plot4x4color 1389 8B26 8D CA 3E sta color 1390 1391 1392 ; calculating address of the first byte 1393 8B29 A9 04 8D 4B 48 mva #4 LoopCounter4x4 1394 8B2E AD 50 48 lda CharCode4x4 1395 8B31 29 01 and #1 1396 8B33 8D 4F 48 sta nibbler4x4 1397 8B36 AD 50 48 lda CharCode4x4 1398 8B39 6A ror 1399 ; in carry there is which nibble of the byte is to be taken 1400 8B3A 18 clc 1401 8B3B 69 60 adc #(3*32) 1402 8B3D 8D 4C 48 sta y4x4 1403 8B40 nextline4x4 1404 8B40 A9 04 8D 4E 48 mva #4 Xcounter4x4 1405 8B45 AC 4C 48 ldy y4x4 1406 8B48 B9 AA 8E lda font4x4,y ;there was a problem with OMC here, but it works now 1407 1408 8B4B AE 4F 48 ldx nibbler4x4 1409 8B4E F0 04 beq uppernibble 1410 1411 8B50 0A asl 1412 8B51 0A asl 1413 8B52 0A asl 1414 8B53 0A asl 1415 8B54 uppernibble 1416 8B54 2A rol 1417 8B55 8D 4D 48 sta StoreA4x4 1418 8B58 B0 03 bcs EmptyPixel ; the font I drawn is in inverse ... 1419 ;lda plot4x4color ;these lines are not necessary 1420 ;sta color ;if a plots are one color only 1421 8B5A 20 0C 89 jsr plot 1422 ;jmp Loop4x4Continued 1423 8B5D EmptyPixel 1424 ;lda #1 ;reverse color (color==1-color) 1425 ;sec 1426 ;sbc plot4x4color 1427 ;sta color 1428 ;jsr plot 1429 ;this is turned off for speed 1430 ;anyway we assume the text is being drawn 1431 ;over an empty space 1432 8B5D Loop4x4Continued 1433 8B5D 18 A5 80 69 01 85 + adw xdraw #1 1434 8B68 AD 4D 48 lda StoreA4x4 1435 8B6B CE 4E 48 dec Xcounter4x4 1436 8B6E AE 4E 48 ldx Xcounter4x4 1437 8B71 D0 E1 bne uppernibble 1438 ; here we have on screen one line of the char 1439 8B73 18 A5 82 69 01 85 + adw ydraw #1 1440 8B7E 38 A5 80 E9 04 85 + sbw xdraw #4 1441 8B89 38 AD 4C 48 E9 20 + sbw y4x4 #32 1442 8B97 CE 4B 48 AD 4B 48 dec:lda LoopCounter4x4 1443 8B9D D0 A1 bne nextline4x4 1444 1445 8B9F 60 rts 1446 .endp 1447 ; ------------------------------------------ 1448 8BA0 PutChar4x4FULL .proc; 1449 ;this routine works just like PutChar4x4, 1450 ;but this time all pixels are being drawn 1451 ;(empty and not empty) 1452 ;-------------------------------------------------- 1453 8BA0 AD 51 48 lda plot4x4color 1454 8BA3 8D CA 3E sta color 1455 1456 ; calculating address of the first byte 1457 8BA6 A9 04 8D 4B 48 mva #4 LoopCounter4x4 1458 8BAB AD 50 48 lda CharCode4x4 1459 8BAE 29 01 and #1 1460 8BB0 8D 4F 48 sta nibbler4x4 1461 8BB3 AD 50 48 lda CharCode4x4 1462 8BB6 6A ror 1463 ; in carry there is which nibble of the byte is to be taken clc 1464 8BB7 18 clc 1465 8BB8 69 60 adc #(3*32) 1466 8BBA 8D 4C 48 sta y4x4 1467 8BBD nextline4x4FULL 1468 8BBD A9 04 8D 4E 48 mva #4 Xcounter4x4 1469 8BC2 AC 4C 48 ldy y4x4 1470 8BC5 B9 AA 8E lda font4x4,y 1471 1472 8BC8 AE 4F 48 ldx nibbler4x4 1473 8BCB F0 04 beq uppernibbleFULL 1474 1475 8BCD 0A asl 1476 8BCE 0A asl 1477 8BCF 0A asl 1478 8BD0 0A asl 1479 8BD1 uppernibbleFULL 1480 8BD1 2A rol 1481 8BD2 8D 4D 48 sta StoreA4x4 1482 8BD5 B0 0C bcs EmptyPixelFULL 1483 8BD7 AD 51 48 lda plot4x4color ;these lines are not necessary 1484 8BDA 8D CA 3E sta color ;if a plots are one color only 1485 8BDD 20 0C 89 jsr plot 1486 8BE0 4C EF 8B jmp Loop4x4ContinuedFULL 1487 8BE3 EmptyPixelFULL 1488 8BE3 A9 01 lda #1 ;reverse color (color==1-color) 1489 8BE5 38 sec 1490 8BE6 ED 51 48 sbc plot4x4color 1491 8BE9 8D CA 3E sta color 1492 8BEC 20 0C 89 jsr plot 1493 ;this is turned on now 1494 ;of course it is slower 1495 1496 8BEF Loop4x4ContinuedFULL 1497 8BEF 18 A5 80 69 01 85 + adw xdraw #1 1498 8BFA AD 4D 48 lda StoreA4x4 1499 8BFD CE 4E 48 dec Xcounter4x4 1500 8C00 AE 4E 48 ldx Xcounter4x4 1501 8C03 D0 CC bne uppernibbleFULL 1502 ; here we have on screen one line of the char 1503 8C05 18 A5 82 69 01 85 + adw ydraw #1 1504 8C10 38 A5 80 E9 04 85 + sbw xdraw #4 1505 8C1B 38 AD 4C 48 E9 20 + sbw y4x4 #32 1506 8C29 CE 4B 48 AD 4B 48 dec:lda LoopCounter4x4 1507 8C2F D0 8C bne nextline4x4FULL 1508 1509 8C31 60 rts 1510 .endp 1511 1512 .endif 1110 ;---------------------------------------------- 1111 8C32 icl 'ai.asm' Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\ai.asm 1 ; @com.wudsn.ide.asm.mainsourcefile=program.asm 2 3 ; artificial intelligence of tanks goes here! 4 ; in A there is a level of tank's intelligence 5 ; 1-moron, ..., 7-cyborg, 8-UNKNOWN (the best of all) 6 ; at the moment (2003-08-15) I have no idea how 7 ; to program better opponents, but moron is easy - 8 ; - shoots random direction and force 9 ; greeeting to myself 10 years older in 2013-11-09... still no idea 10 11 ;---------------------------------------------- 12 8C32 MakeLowResDistances .proc 13 ; create low precision table of positions 14 ; by dividing positions by 4 15 16 8C32 A0 05 ldy #MaxPlayers-1 17 8C34 loop 18 8C34 B9 97 3D lda xtankstableL,y 19 8C37 85 91 sta temp 20 8C39 B9 9D 3D lda xtankstableH,y 21 8C3C 85 92 sta temp+1 22 23 ;= /4 24 8C3E 46 92 66 91 46 92 + :2 lsrw temp 25 8C46 A5 91 lda temp 26 8C48 99 A9 3D sta LowResDistances,y 27 8C4B 88 dey 28 8C4C 10 E6 bpl loop 29 8C4E 60 rts 30 .endp 31 32 ;---------------------------------------------- 33 8C4F ArtificialIntelligence .proc ; 34 ; A - skill of the TankNr 35 ; returns shoot energy and angle in 36 ; EnergyTable/L/H and AngleTable 37 ;---------------------------------------------- 38 8C4F 0A asl 39 8C50 AA tax 40 8C51 CA CA :2 dex ;credit KK 41 8C53 BD 5D 8C lda AIRoutines+1,x 42 8C56 48 pha 43 8C57 BD 5C 8C lda AIRoutines,x 44 8C5A 48 pha 45 8C5B 60 rts 46 .endp 47 ;---------------- 48 8C5C AIRoutines 49 8C5C 6B 8C .word Moron-1 50 8C5E 8B 8C .word Shooter-1 ;Shooter 51 8C60 2A 8D .word Poolshark-1 ;Poolshark 52 8C62 2A 8D .word Poolshark-1 ;Toosser 53 8C64 2A 8D .word Poolshark-1 ;Chooser 54 8C66 2A 8D .word Poolshark-1 ;Spoiler 55 8C68 2A 8D .word Poolshark-1 ;Cyborg 56 8C6A 2A 8D .word Poolshark-1 ;Unknown 57 58 ;---------------------------------------------- 59 8C6C Moron .proc 60 8C6C A6 8B ldx TankNr 61 8C6E 20 89 73 jsr RandomizeAngle 62 8C71 8D 88 3D sta NewAngle 63 8C74 A9 50 8D C7 50 A9 + mwa #80 RandBoundaryLow 64 8C7E A9 20 8D C9 50 A9 + mwa #800 RandBoundaryHigh 65 8C88 20 97 73 jsr RandomizeForce 66 8C8B 60 rts 67 .endp 68 ;---------------------------------------------- 69 8C8C Shooter .proc 70 71 8C8C A6 8B ldx TankNr 72 8C8E BD A9 50 lda PreviousAngle,x 73 8C91 1D AF 50 ora PreviousEnergyL,x 74 8C94 1D BB 50 ora PreviousEnergyH,x 75 8C97 F0 22 beq firstShoot 76 77 8C99 BD A9 50 lda PreviousAngle,x 78 8C9C 18 clc 79 8C9D 69 05 adc #5 80 8C9F 30 08 bmi leftQuadrant 81 8CA1 C9 5A cmp #90 82 8CA3 90 04 bcc continue 83 8CA5 A9 A6 lda #(-90) 84 8CA7 D0 00 bne continue 85 8CA9 leftQuadrant 86 87 88 89 8CA9 continue 90 8CA9 8D 88 3D sta NewAngle 91 92 8CAC BD AF 50 lda PreviousEnergyL,x 93 8CAF 9D 6A 3D sta EnergyTableL,x 94 8CB2 BD BB 50 lda PreviousEnergyH,x 95 8CB5 9D 70 3D sta EnergyTableH,x 96 97 8CB8 4C 01 8D jmp endo 98 8CBB firstShoot 99 ; compare the x position with the middle of the screen 100 8CBB BD 97 3D lda xTanksTableL,x 101 8CBE 85 91 sta temp 102 8CC0 BD 9D 3D lda xTanksTableH,x 103 8CC3 85 92 sta temp+1 104 8CC5 A5 92 C9 00 D0 04 + cpw temp #(screenwidth/2) 105 8CCF B0 0E bcs tankIsOnTheRight 106 107 8CD1 AD 0A D2 lda RANDOM 108 8CD4 29 1F and #$1F 109 8CD6 18 clc 110 8CD7 69 05 adc #5 111 ;lda #45 112 113 8CD9 8D 88 3D sta NewAngle 114 8CDC 4C EA 8C jmp forceNow 115 8CDF tankIsOnTheRight 116 8CDF AD 0A D2 lda RANDOM 117 8CE2 29 1F and #$1F 118 8CE4 18 clc 119 8CE5 69 AB adc #(-85) 120 ;lda #-45 121 8CE7 8D 88 3D sta NewAngle 122 123 8CEA forceNow 124 8CEA A9 64 8D C7 50 A9 + mwa #100 RandBoundaryLow 125 8CF4 A9 20 8D C9 50 A9 + mwa #800 RandBoundaryHigh 126 8CFE 20 97 73 jsr RandomizeForce 127 128 8D01 endo 129 8D01 A6 8B ldx TankNr ;this is possibly not necessary 130 8D03 AD 88 3D lda NewAngle 131 8D06 9D A9 50 sta PreviousAngle,x 132 8D09 BD 6A 3D lda EnergyTableL,x 133 8D0C 9D AF 50 sta PreviousEnergyL,x 134 8D0F BD 70 3D lda EnergyTableH,x 135 8D12 9D BB 50 sta PreviousEnergyH,x 136 137 ; choose the best weapon 138 139 8D15 BD 07 41 lda TanksWeaponsTableL,x 140 8D18 85 91 sta temp 141 8D1A BD 0D 41 lda TanksWeaponsTableH,x 142 8D1D 85 92 sta temp+1 143 8D1F A0 20 ldy #32 ;the last weapon 144 8D21 loop 145 8D21 88 dey 146 8D22 B1 91 lda (temp),y 147 8D24 F0 FB beq loop 148 8D26 98 tya 149 8D27 9D 89 3D sta ActiveWeapon,x 150 8D2A 60 rts 151 .endp 152 ;---------------------------------------------- 153 8D2B Poolshark .proc 154 155 8D2B firstShoot 156 ;find nearest tank neighbour 157 8D2B 20 32 8C jsr MakeLowResDistances 158 8D2E A9 FF 85 93 mva #$ff temp2 ; min possible distance 159 160 8D32 A6 8B ldx TankNr 161 8D34 AC 19 3D ldy NumberOfPlayers 162 8D37 88 dey 163 164 8D38 loop01 165 8D38 C4 8B cpy TankNr 166 8D3A F0 43 beq skipThisPlayer 167 8D3C B9 51 3D lda eXistenZ,y 168 8D3F F0 3E beq skipThisPlayer 169 170 8D41 BD A9 3D lda LowResDistances,x 171 8D44 D9 A9 3D cmp LowResDistances,y 172 8D47 B0 1D bcs EnemyOnTheLeft 173 ;enemy on the right 174 8D49 38 sec 175 8D4A B9 A9 3D lda LowResDistances,y 176 8D4D FD A9 3D sbc LowResDistances,x 177 8D50 C5 93 cmp temp2 ; lowest 178 8D52 B0 2B bcs lowestIsLower 179 8D54 85 93 sta temp2 180 8D56 84 94 sty temp2+1 ; number of the closest tank 181 ; calculate index to shotangle table 182 8D58 4A 4A 4A :3 lsr @ 183 8D5B 29 07 and #%00000111 184 8D5D 18 clc 185 8D5E 69 08 adc #8 186 8D60 8D CB 50 sta AngleTablePointer 187 8D63 4C 7F 8D jmp lowestIsLower 188 189 8D66 EnemyOnTheLeft 190 8D66 38 sec 191 8D67 BD A9 3D lda LowResDistances,x 192 8D6A F9 A9 3D sbc LowResDistances,y 193 8D6D C5 93 cmp temp2 ; lowest 194 8D6F B0 0E bcs lowestIsLower 195 8D71 85 93 sta temp2 196 8D73 84 94 sty temp2+1 ; number of the closest tank 197 ; calculate index to shotangle table 198 8D75 4A 4A 4A :3 lsr @ 199 8D78 29 07 and #%00000111 200 8D7A 49 07 eor #%00000111 201 8D7C 8D CB 50 sta AngleTablePointer 202 203 8D7F lowestIsLower 204 8D7F skipThisPlayer 205 8D7F 88 dey 206 8D80 10 B6 bpl loop01 207 208 8D82 randomize 0 8 Macro: RANDOMIZE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 8D82 ?rand 4 8D82 AD 0A D2 lda random 5 8D85 C9 00 cmp #0 ;floor 6 8D87 90 F9 bcc ?rand 7 8D89 C9 09 cmp #8+1 ;ceiling 8 8D8B B0 F5 bcs ?rand Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\ai.asm 209 8D8D AC CB 50 ldy AngleTablePointer 210 8D90 18 clc 211 8D91 79 C6 8D adc AngleTable,y 212 8D94 8D 88 3D sta NewAngle 213 214 8D97 forceNow 215 8D97 A9 2C 8D C7 50 A9 + mwa #300 RandBoundaryLow 216 8DA1 A9 BC 8D C9 50 A9 + mwa #700 RandBoundaryHigh 217 8DAB 20 97 73 jsr RandomizeForce 218 219 8DAE endo 220 8DAE A6 8B ldx TankNr ;this is possibly not necessary 221 222 ; choose the best weapon 223 224 8DB0 BD 07 41 lda TanksWeaponsTableL,x 225 8DB3 85 91 sta temp 226 8DB5 BD 0D 41 lda TanksWeaponsTableH,x 227 8DB8 85 92 sta temp+1 228 8DBA A0 20 ldy #32 ;the last weapon 229 8DBC loop 230 8DBC 88 dey 231 8DBD B1 91 lda (temp),y 232 8DBF F0 FB beq loop 233 8DC1 98 tya 234 8DC2 9D 89 3D sta ActiveWeapon,x 235 8DC5 60 rts 236 237 ;---------------------------------------------- 238 8DC6 AngleTable ; 16 bytes ;ba w $348b L$3350 239 8DC6 B2 BA C2 CA D2 DA + .by 178,186,194,202,210,218,226,234 240 8DCE 10 18 20 28 30 38 + .by 16,24,32,40,48,56,64,72 241 .endp 242 ;---------------------------------------------- 243 8DD6 PurchaseAI .proc ; 244 ; A - skill of the TankNr 245 ; makes purchase for AI opponents 246 ; results of this routine are not visible on the screen 247 ;---------------------------------------------- 248 8DD6 0A asl 249 8DD7 AA tax 250 8DD8 CA CA :2 dex ;credit KK 251 8DDA BD E4 8D lda PurchaseAIRoutines+1,x 252 8DDD 48 pha 253 8DDE BD E3 8D lda PurchaseAIRoutines,x 254 8DE1 48 pha 255 8DE2 60 rts 256 .endp 257 258 ;---------------- 259 8DE3 PurchaseAIRoutines 260 8DE3 F2 8D .word MoronPurchase-1 261 8DE5 41 8E .word ShooterPurchase-1 ;ShooterPurchase 262 8DE7 5A 8E .word PoolsharkPurchase-1 ;PoolsharkPurchase 263 8DE9 5A 8E .word PoolsharkPurchase-1 ;ToosserPurchase 264 8DEB 5A 8E .word PoolsharkPurchase-1 ;ChooserPurchase 265 8DED 5A 8E .word PoolsharkPurchase-1 ;SpoilerPurchase 266 8DEF 5A 8E .word PoolsharkPurchase-1 ;CyborgPurchase 267 8DF1 5A 8E .word PoolsharkPurchase-1 ;UnknownPurchase 268 269 ;---------------------------------------------- 270 8DF3 MoronPurchase 271 ;Moron buys nothing 272 8DF3 60 rts 273 274 ;------- 275 8DF4 TryToPurchaseOnePiece .proc 276 ; A - weapon number, better it will be in range(1,32) 277 ; TankNr in X 278 8DF4 A8 tay 279 8DF5 B9 74 8E lda PurchaseMeTable,y 280 8DF8 F0 47 beq SorryNoPurchase 281 8DFA B9 D9 4B lda WeaponPriceL,y 282 8DFD 85 91 sta temp 283 8DFF B9 99 4B lda WeaponPriceH,y 284 8E02 85 92 sta temp+1 285 ;price of the weapon in temp 286 8E04 BD 2C 3D lda MoneyL,x 287 8E07 85 93 sta temp2 288 8E09 BD 26 3D lda MoneyH,x 289 8E0C 85 94 sta temp2+1 290 ;current monies in temp2 291 8E0E A5 94 C5 92 D0 04 + cpw temp2 temp 292 8E18 90 27 bcc SorryNoPurchase 293 ; deduct monies from the bank account 294 8E1A 38 sec 295 8E1B A5 93 lda temp2 296 8E1D E5 91 sbc temp 297 8E1F 9D 2C 3D sta MoneyL,x 298 8E22 A5 94 lda temp2+1 299 8E24 E5 92 sbc temp+1 300 8E26 9D 26 3D sta MoneyH,x 301 302 8E29 BD 07 41 lda TanksWeaponsTableL,x 303 8E2C 85 91 sta temp 304 8E2E BD 0D 41 lda TanksWeaponsTableH,x 305 8E31 85 92 sta temp+1 306 307 8E33 B9 19 4C lda WeaponUnits,y 308 8E36 18 clc 309 8E37 71 91 adc (temp),y 310 8E39 C9 63 cmp #99 ;max number of weapon units 311 8E3B 90 02 bcc NotExceeded 312 8E3D A9 63 lda #99 313 8E3F NotExceeded 314 8E3F 91 91 sta (temp),y 315 316 317 8E41 SorryNoPurchase 318 8E41 60 rts 319 .endp 320 321 322 ;---------------------------------------------- 323 8E42 ShooterPurchase .proc 324 8E42 A9 04 85 95 mva #4 tempXroller; number of purchases to perform 325 326 8E46 A6 8B ldx TankNr 327 8E48 loop 328 8E48 randomize 1 14 Macro: RANDOMIZE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 8E48 ?rand 4 8E48 AD 0A D2 lda random 5 8E4B C9 01 cmp #1 ;floor 6 8E4D 90 F9 bcc ?rand 7 8E4F C9 0F cmp #14+1 ;ceiling 8 8E51 B0 F5 bcs ?rand Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\ai.asm 329 8E53 20 F4 8D jsr TryToPurchaseOnePiece 330 8E56 C6 95 dec tempXroller 331 8E58 D0 EE bne loop 332 333 8E5A 60 rts 334 .endp 335 ;---------------------------------------------- 336 8E5B PoolsharkPurchase .proc 337 8E5B A9 08 85 95 mva #8 tempXroller; number of purchases to perform 338 339 8E5F A6 8B ldx TankNr 340 8E61 loop 341 8E61 randomize 1 30 Macro: RANDOMIZE [Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\..\lib\macro.hea] 3 8E61 ?rand 4 8E61 AD 0A D2 lda random 5 8E64 C9 01 cmp #1 ;floor 6 8E66 90 F9 bcc ?rand 7 8E68 C9 1F cmp #30+1 ;ceiling 8 8E6A B0 F5 bcs ?rand Source: C:\Users\Pawel\Dropbox\atari\projects\scorch_src\ai.asm 342 8E6C 20 F4 8D jsr TryToPurchaseOnePiece 343 8E6F C6 95 dec tempXroller 344 8E71 D0 EE bne loop 345 346 8E73 60 rts 347 .endp 348 349 350 8E74 PurchaseMeTable .proc ;weapons good to be purchased by the robot 351 ;the comment is an index in the tables 352 8E74 01 dta 1 ;"Baby Missile " ; 0 353 8E75 01 dta 1 ;"Missile " ; 1 354 8E76 01 dta 1 ;"Baby Nuke " ; 2 355 8E77 01 dta 1 ;"Nuke " ; 3 356 8E78 01 dta 1 ;"LeapFrog " ; 4 357 8E79 01 dta 1 ;"Funky Bomb " ; 5 358 8E7A 01 dta 1 ;"MIRV " ; 6 359 8E7B 01 dta 1 ;"Death's Head " ; 7 360 8E7C 00 dta 0 ;"Napalm " ; 8 361 8E7D 00 dta 0 ;"Hot Napalm " ; 9 362 8E7E 00 dta 0 ;"Tracer " ; 10 363 8E7F 00 dta 0 ;"Smoke Tracer " ; 11 364 8E80 01 dta 1 ;"Baby Roller " ; 12 365 8E81 01 dta 1 ;"Roller " ; 13 366 8E82 01 dta 1 ;"Heavy Roller " ; 14 367 8E83 00 dta 0 ;"Riot Charge " ; 15 368 8E84 00 dta 0 ;"Riot Blast " ; 16 369 8E85 00 dta 0 ;"Riot Bomb " ; 17 370 8E86 00 dta 0 ;"Heavy Riot Bomb " ; 18 371 8E87 00 dta 0 ;"Baby Digger " ; 19 372 8E88 00 dta 0 ;"Digger " ; 20 373 8E89 00 dta 0 ;"Heavy Digger " ; 21 374 8E8A 00 dta 0 ;"Baby Sandhog " ; 22 375 8E8B 00 dta 0 ;"Sandhog " ; 23 376 8E8C 00 dta 0 ;"Heavy Sandhog " ; 24 377 8E8D 00 dta 0 ;"Dirt Clod " ; 25 378 8E8E 00 dta 0 ;"Dirt Ball " ; 26 379 8E8F 00 dta 0 ;"Ton of Dirt " ; 27 380 8E90 01 dta 1 ;"Liquid Dirt " ; 28 381 8E91 00 dta 0 ;"Dirt Charge " ; 29 382 8E92 00 dta 0 ;"Earth Disrupter " ; 30 383 8E93 01 dta 1 ;"Plasma Blast " ; 31 384 8E94 01 dta 1 ;"Laser " ; 32 385 8E95 00 dta 0 ;"----------------" ; 33 386 8E96 00 dta 0 ;"----------------" ; 34 387 8E97 00 dta 0 ;"----------------" ; 35 388 8E98 00 dta 0 ;"----------------" ; 36 389 8E99 00 dta 0 ;"----------------" ; 37 390 8E9A 00 dta 0 ;"----------------" ; 38 391 8E9B 00 dta 0 ;"----------------" ; 39 392 8E9C 00 dta 0 ;"----------------" ; 40 393 8E9D 00 dta 0 ;"----------------" ; 41 394 8E9E 00 dta 0 ;"----------------" ; 42 395 8E9F 00 dta 0 ;"----------------" ; 43 396 8EA0 00 dta 0 ;"----------------" ; 44 397 8EA1 00 dta 0 ;"----------------" ; 45 398 8EA2 00 dta 0 ;"----------------" ; 46 399 8EA3 00 dta 0 ;"----------------" ; 47 400 401 .endp 402 1112 ;---------------------------------------------- 1113 1114 8EA4 52 32 72 92 B2 02 TankColoursTable .BYTE $52,$32,$72,$92,$B2,$02 1115 1116 8EAA font4x4 1117 8EAA FB F9 1F FF 99 FF + ins 'artwork/font4x4s.bmp',+62 1118 ;---------------------------------------------- 1119 8F2A TankFont 1120 8F2A 00 00 00 00 00 00 + ins 'artwork/tanks.fnt' 1121 932A TankFontend 1122 .if TankFontEnd>$9800 1123 .error memory conflict 1124 ;this is to warn if code and P/M graphics 1125 ;overlap! 1126 .endif 1127 ;---------------------------------------------- 1128 ; Player/missile memory 1129 ORG $9800 1130 9800 pmgraph 1131 1132 ;---------------------------------------------- 1133 ORG $a400 1134 A400 WeaponFont 1135 A400-A7FF> 00 00 00 00 + ins 'artwork/weapons.fnt' 1136 ;---------------------------------------------- 1137 A800 TheEnd 1138 .if TheEnd>$c000 1139 .error memory conflict 1140 1141 .endif 1142 1143 1144 02E0-02E1> 3B 5B run START