!!!Star Raiders source code by Lorenz Wiest Lorenz Wiest did a tremendous must see job with a complete commented Star Raiders source code at the highest level possible! Highly recommended!!!\\ Every assembly source code should look like this. The reader can take his work as a template on how to do it the right way! !!Source Code in TXT-Format * [StarRaiders.source.txt] ; size: 823 KB ; incredible source listing!!! Must see!!! !!Read Me from Lorenz Wiest Fully documented, reverse-engineered STAR RAIDERS source code\\ \\ During the last years, as a hobby afterhours project, I reverse-engineered a complete, extensively documented assembly language source code of STAR RAIDERS for the Atari 8-bit Home Computer System. I created it directly from the binary file of the ROM cartridge, finishing it in September 2015.\\ \\ You may find it useful if you are curious about the internals of STAR RAIDERS or if you are planning to make your own, modified version.\\ \\ After very positive reader feedback on the initial release of my reverse-engineered source code I reviewed it again, resulting in a minor update.\\ \\ Enjoy -- Lorenz\\ \\ PS: I was absolutely thrilled to learn that in October 2015 [scans of the original STAR RAIDERS source code|https://archive.org/details/AtariStarRaidersSourceCode] re-surfaced.\\ \\ To my delight, inspection of the original source code confirmed the findings of my reverse-engineered version and caused only a few trivial corrections.\\ \\ Even more, the documentation of my reverse-engineered version adds a substantial amount of information - from overall theory of operation down to some tricky details - to the understanding of the often sparsely commented original (quite expected for source code never meant for publication). So, if you are interested in learing how STAR RAIDERS works, my reverse-engineered source code could be of help to you.\\ !!References * [Original post of the source code|http://atariage.com/forums/topic/243904-star-raiders-source-code-to-be-released/page-9#entry3422364] * [Link at github of the source code|https://github.com/lwiest/StarRaiders] !!Source Code Listing {{{ 00001 ;******************************************************************************* 00002 ;* * 00003 ;* S T A R R A I D E R S * 00004 ;* * 00005 ;* for the Atari 8-bit Home Computer System * 00006 ;* * 00007 ;* Reverse-engineered and documented assembly language source code * 00008 ;* * 00009 ;* by * 00010 ;* * 00011 ;* Lorenz Wiest * 00012 ;* * 00013 ;* (lo.wiest(at)web.de) * 00014 ;* * 00015 ;* 22-SEP-2015 * 00016 ;* * 00017 ;* STAR RAIDERS was created by Douglas Neubauer * 00018 ;* STAR RAIDERS was published by Atari Inc. * 00019 ;* * 00020 ;******************************************************************************* 00021 00022 ; I wrote this document out of my own curiosity. When STAR RAIDERS was released 00023 ; in 1979 it became the killer app for the Atari 8-bit Home Computer System. 00024 ; Since then I have always been wondering what made it tick and how its (at that 00025 ; time) spectacular 3D graphics worked, especially the rotating star field. 00026 ; Impressed by "The Atari BASIC Source Book" I decided to reverse-engineer the 00027 ; STAR RAIDERS 8KB ROM cartridge to recreate a fully documented assembly 00028 ; language source code file. I had no access to the original source code, so the 00029 ; only way to succeed was a combination of educated guesses, trial-and-error, 00030 ; and patience. Eventually, I made it. 00031 ; 00032 ; Essential in preparing this document were three programs I wrote: 00033 ; 00034 ; (1) A 6502-cross-assembler based on the syntax of the MAC/65 assembler for the 00035 ; Atari 8-bit Home Computer System to create the binary file that I verified 00036 ; against the binary of the original ROM cartridge. 00037 ; 00038 ; (2) A text formatter to layout the source code file with its copious comment 00039 ; sections. This was a big time saver, because as the documentation grew the 00040 ; source code had to be reformatted over and over again. 00041 ; 00042 ; (3) A symbol checker to verify that the ubiquitous symbol-value pairs in the 00043 ; documentation match the corresponding symbol values produced by the 00044 ; assembler. 00045 ; 00046 ; This assembly language source code file is compatible with the MAC/65 00047 ; assembler for the Atari 8-bit Home Computer System. I was able to assemble it 00048 ; on an emulated Atari running MAC/65, producing the identical binary of the ROM 00049 ; cartridge. 00050 ; 00051 ; Your feedback is welcome! Send feedback to lo.wiest(at)web.de. 00052 ; 00053 ; Enjoy! -- Lorenz 00054 00055 ;******************************************************************************* 00056 ;* * 00057 ;* N O T A T I O N * 00058 ;* * 00059 ;******************************************************************************* 00060 00061 ; BITS AND BYTES 00062 ; 00063 ; o A "byte" consists of 8 bits. They are numbered B7..0. Bit B0 is the least 00064 ; significant bit. 00065 ; 00066 ; o A "word" consists of 16 bits. They are numbered B15..B0. Bit B0 is the 00067 ; least significant bit. A word is stored in low-order then high-order byte 00068 ; order. 00069 ; 00070 ; o The high-order byte ("high byte") of a word consists of bits B15..8 of the 00071 ; word. 00072 ; 00073 ; o The low-order byte ("low byte") of a word consists of bits B7..0 of the 00074 ; word. 00075 ; 00076 ; NUMBERS 00077 ; 00078 ; o The dollar sign ($) prefixes hexadecimal numbers. 00079 ; Example: $101 is the decimal number 257. 00080 ; 00081 ; o The percent sign (%) prefixes binary numbers. 00082 ; Example: %101 is the decimal number 5. 00083 ; 00084 ; o The asterisk (*) is a wildcard character for a single hexadecimal or 00085 ; binary digit. 00086 ; Example: $0*00 is a placeholder for the numbers $0000, $0100, ..., $0F00. 00087 ; 00088 ; o The lowercase R (r) is a wildcard character for a single random 00089 ; hexadecimal or binary digit. The random digit r is chosen by a random 00090 ; number generator. 00091 ; Example: %00r0 is a placeholder for the numbers %0000 or %0010. 00092 ; 00093 ; OPERATORS 00094 ; 00095 ; o The exclamation mark (!) is the binary OR operator. 00096 ; Example: $01!$02 is $03. 00097 ; 00098 ; o The less-than sign (<) indicates bits B7..0 of a word. 00099 ; Example: <$1234 is $34. 00100 ; 00101 ; o The greater-than sign (>) indicates bits B15..8 of a word. 00102 ; Example: >$1234 is $12. 00103 ; 00104 ; o A pair of brackets ([]) groups mathematical expressions. 00105 ; Example: [3-1]*4 is 8. 00106 ; 00107 ; ASSEMBLY LANGUAGE 00108 ; 00109 ; o The uppercase A (A) indicates the accumulator register of the 6502 CPU. 00110 ; 00111 ; o The uppercase X (X) indicates the X register of the 6502 CPU. 00112 ; 00113 ; o The uppercase Y (Y) indicates the Y register of the 6502 CPU. 00114 ; 00115 ; o The prefix uppercase L and dot (L.) indicates a local variable, a memory 00116 ; location used temporarily in a subroutine. 00117 ; 00118 ; PSEUDO-FUNCTIONS 00119 ; 00120 ; o The function ABS(<num>) returns the absolute value of <num>. 00121 ; Example: ABS(3) returns 3. 00122 ; Example: ABS(-3) returns 3. 00123 ; 00124 ; o The function RND(<num1>..<num2>) returns a random integer in 00125 ; <num1>..<num2>. 00126 ; Example: RND(3..5) returns a random number out of 3, 4, or 5. 00127 ; 00128 ; o The function MAX(<num1>, <num2>) returns the larger number of <num1> and 00129 ; <num2>. 00130 ; Example: MAX(2, 4) returns 4. 00131 ; 00132 ; VECTORS 00133 ; 00134 ; o The lowercase X (x) indicates the x-axis of the 3D coordinate system. 00135 ; 00136 ; o The lowercase Y (y) indicates the y-axis of the 3D coordinate system. 00137 ; 00138 ; o The lowercase Z (z) indicates the z-axis of the 3D coordinate system. 00139 ; 00140 ; o Components of a position vector (called "coordinates") have the arbitrary 00141 ; unit <KM> ("kilometers"). 00142 ; 00143 ; o Components of a velocity vector have the arbitrary unit <KM/H> 00144 ; ("kilometers per hour"). 00145 ; 00146 ; o A positive component of a position vector (coordinate) in hexadecimal 00147 ; notation is written in the form +$<hexNum> <KM>. <hexNum> is an unsigned 00148 ; integer value. 00149 ; Example: The starbase is +$1000 (or 4096) <KM> ahead of our starship. 00150 ; 00151 ; o A negative component of a position vector (coordinate) in hexadecimal 00152 ; notation is written in the form -($<hexNum>) <KM>. <hexNum> is an unsigned 00153 ; integer value. To calculate the actual bit pattern of this coordinate 00154 ; value compute the two's-complement of <hexNum>. See also "ON POSITION 00155 ; VECTORS". 00156 ; Example: The starbase is -($1000) (or -4096) <KM> behind our starship. 00157 ; 00158 ; o An absolute component of a position vector (coordinate) in hexadecimal 00159 ; notation is written in the form $<hexNum> <KM>. <hexNum> is an unsigned 00160 ; integer value. 00161 ; Example: The Zylon fighter fires when it is closer than $1000 (or 4096) 00162 ; <KM>. 00163 ; 00164 ; DISPLAY LIST 00165 ; 00166 ; o The following notation is used for Display List instructions: 00167 ; 00168 ; BLK<n> = Display <n> blank video lines (<n> in 1..8) 00169 ; GR1 = Display one GRAPHICS 1 row of 20 text characters 00170 ; GR2 = Display one GRAPHICS 2 row of 20 text characters 00171 ; GR7 = Display one GRAPHICS 7 row of 160 pixels 00172 ; DLI = Trigger a Display List Interrupt 00173 ; ... @ <addr> = Point to screen memory at address <addr> 00174 ; JMP @ <addr> = Jump to next Display List instruction at address <addr> 00175 ; WAITJMP @ <addr> = Wait for vertical blank phase, then jump to next 00176 ; Display List instruction at address <addr> 00177 ; 00178 ; MISCELLANEOUS 00179 ; 00180 ; o Probabilities are written in the form <percentage>% (<number of values out 00181 ; of the possible values>:<number of possible values>). 00182 ; Example: The probability to throw the number 3 with a die is 16% (1:6). 00183 ; 00184 ; o A "game loop iteration" (or "game loop") is a single execution of the game 00185 ; loop, the main program of the game. 00186 ; 00187 ; o A "TICK" is the time span it takes to update the TV screen (1/60 s on an 00188 ; NTSC TV system, 1/50 s on a PAL TV system). 00189 ; 00190 ; o A pair of braces ({}) encloses color names. 00191 ; Example: {BLACK} 00192 ; 00193 ; o A pair of parentheses enclosing a question mark ((?)) indicates code that 00194 ; is not well understood. 00195 ; 00196 ; o A pair of parentheses enclosing an exclamation mark ((!)) indicates a 00197 ; potential bug. 00198 00199 ;******************************************************************************* 00200 ;* * 00201 ;* O V E R V I E W * 00202 ;* * 00203 ;******************************************************************************* 00204 00205 ; ON POSITION VECTORS 00206 ; 00207 ; The program uses a 3D coordinate system with the position of our starship at 00208 ; its center and the following coordinate axes: 00209 ; 00210 ; o The x-axis points to the right. 00211 ; o The y-axis points up. 00212 ; o The z-axis points in flight direction. 00213 ; 00214 ; By the way, this is called a "left-handed" coordinate system. 00215 ; 00216 ; The locations of all space objects (Zylon ships, meteors, photon torpedoes, 00217 ; starbase, transfer vessel, Hyperwarp Target Marker, stars, and explosion 00218 ; fragments) are described by a "position vector". 00219 ; 00220 ; A "position vector" is composed of an x, y, and z component. The values of the 00221 ; position vector components are called the x, y, and z "coordinates". They have 00222 ; the arbitrary unit <KM>. 00223 ; 00224 ; Each coordinate is a signed 17-bit integer number, which fits into 3 bytes: 00225 ; 00226 ; Sign Mantissa 00227 ; B16 B15...B8 B7....B0 00228 ; | | | | | 00229 ; 0000000* ******** ******** 00230 ; 00231 ; o B16 contains the sign bit. Used values are: 00232 ; 1 -> Positive sign 00233 ; 0 -> Negative sign 00234 ; o B15..0 contain the coordinate value (or "mantissa") as a two's-complement 00235 ; integer number. 00236 ; 00237 ; The range of a position vector component is -65536..+65535 <KM>. 00238 ; 00239 ; Examples: 00240 ; 00241 ; 00000001 11111111 11111111 = +65535 <KM> 00242 ; 00000001 00010000 00000000 = +4096 <KM> 00243 ; 00000001 00001111 11111111 = +4095 <KM> 00244 ; 00000001 00000001 00000000 = +256 <KM> 00245 ; 00000001 00000000 11111111 = +255 <KM> 00246 ; 00000001 00000000 00010000 = +16 <KM> 00247 ; 00000001 00000000 00001111 = +15 <KM> 00248 ; 00000001 00000000 00000001 = +1 <KM> 00249 ; 00000001 00000000 00000000 = +0 <KM> 00250 ; 00251 ; 00000000 11111111 11111111 = -1 <KM> 00252 ; 00000000 11111111 11111110 = -2 <KM> 00253 ; 00000000 11111111 11110001 = -15 <KM> 00254 ; 00000000 11111111 11110000 = -16 <KM> 00255 ; 00000000 11111111 00000001 = -255 <KM> 00256 ; 00000000 11111111 00000000 = -256 <KM> 00257 ; 00000000 11110000 00000001 = -4095 <KM> 00258 ; 00000000 11110000 00000000 = -4096 <KM> 00259 ; 00000000 00000000 00000000 = -65536 <KM> 00260 ; 00261 ; The position vector for each space object is stored in 9 tables: 00262 ; 00263 ; o XPOSSIGN ($09DE..$0A0E), XPOSHI ($0A71..$0AA1), and XPOSLO ($0B04..$0B34) 00264 ; o YPOSSIGN ($0A0F..$0A3F), YPOSHI ($0AA2..$0AD2), and YPOSLO ($0B35..$0B65) 00265 ; o ZPOSSIGN ($09AD..$09DD), ZPOSHI ($0A40..$0A70), and ZPOSLO ($0AD3..$0B03) 00266 ; 00267 ; There are up to 49 space objects used in the program simultaneously, thus each 00268 ; table is 49 bytes long. 00269 ; 00270 ; o Position vectors 0..4 belong to space objects represented by PLAYERs 00271 ; (Zylon ships, meteors, photon torpedoes, starbase, transfer vessel, and 00272 ; Hyperwarp Target Marker). 00273 ; o Position vectors 5..48 belong to space objects represented by PLAYFIELD 00274 ; pixels. Position vectors 5..16 are used for stars, position vectors 17..48 00275 ; are used for explosion fragments and star trails. 00276 ; 00277 ; INFO: The x and y coordinates of space objects are converted and displayed by 00278 ; the THETA and PHI readouts of the Control Panel Display in "gradons". The 00279 ; z-coordinate is converted and displayed by the RANGE readout in "centrons". 00280 ; The conversion takes place in subroutine SHOWDIGITS ($B8CD) where the high 00281 ; byte of a coordinate (with values $00..$FF) is transformed with lookup table 00282 ; MAPTOBCD99 ($0EE9) into a BCD value of 00..99 in "gradons" or "centrons". 00283 ; 00284 ; 00285 ; ON VELOCITY VECTORS 00286 ; 00287 ; The velocities of all space objects are described by a "velocity vector". The 00288 ; velocity vector is relative to our starship. 00289 ; 00290 ; A "velocity vector" is composed of an x, y, and z component. The values of the 00291 ; velocity vector components are called the x, y, and z "velocities". They have 00292 ; the arbitrary unit <KM/H>. 00293 ; 00294 ; Each velocity vector component is a 8-bit integer number, which fits into 1 00295 ; byte: 00296 ; 00297 ; B7 Sign 00298 ; | 00299 ; |B6...B0 Mantissa 00300 ; || | 00301 ; ******** 00302 ; 00303 ; o B7 contains the sign bit. Used values are: 00304 ; 0 -> Positive sign, movement along the positive coordinate axis 00305 ; (x-velocity: right, y-velocity: up, z-velocity: in flight direction) 00306 ; 1 -> Negative sign, movement along the negative coordinate axis 00307 ; (x-velocity: left, y-velocity: down, z-velocity: in reverse flight 00308 ; direction) 00309 ; o B6..B0 contain the velocity value (or "mantissa"). It is an unsigned 00310 ; number. 00311 ; 00312 ; The range of a velocity vector component is -127..+127 <KM/H>. 00313 ; 00314 ; Examples: 00315 ; 00316 ; 01111111 = +127 <KM/H> 00317 ; 00010000 = +16 <KM/H> 00318 ; 00001111 = +15 <KM/H> 00319 ; 00000001 = +1 <KM/H> 00320 ; 00000000 = +0 <KM/H> 00321 ; 00322 ; 10000000 = -0 <KM/H> 00323 ; 10000001 = -1 <KM/H> 00324 ; 10001111 = +15 <KM/H> 00325 ; 10010000 = +16 <KM/H> 00326 ; 11111111 = -127 <KM/H> 00327 ; 00328 ; The velocity vector for each space object stored in 3 tables: 00329 ; 00330 ; o XVEL ($0B97..$0BC7) 00331 ; o YVEL ($0BC8..$0BF8) 00332 ; o ZVEL ($0B66..$0B96) 00333 ; 00334 ; There are up to 49 space objects used in the program simultaneously, thus each 00335 ; table is 49 bytes long. 00336 ; 00337 ; o Velocity vectors 0..4 belong to space objects represented by PLAYERs 00338 ; (Zylon ships, meteors, photon torpedoes, starbase, transfer vessel, and 00339 ; Hyperwarp Target Marker). 00340 ; o Velocity vectors 5..48 belong to space objects represented by PLAYFIELD 00341 ; pixels. Velocity vectors 5..16 are used for stars, velocity vectors 17..48 00342 ; are used for explosion fragments and star trails. 00343 ; 00344 ; INFO: The velocity of our starship is converted and displayed by the VELOCITY 00345 ; readout of the Control Panel Display in "metrons per second" units. The 00346 ; conversion takes place in subroutine SHOWDIGITS ($B8CD) where our starship's 00347 ; velocity VELOCITYL ($70) (with values $00..$FF) is transformed with lookup 00348 ; table MAPTOBCD99 ($0EE9) into a BCD value of 00..99 in "metrons per second". 00349 00350 ;******************************************************************************* 00351 ;* * 00352 ;* M E M O R Y M A P * 00353 ;* * 00354 ;******************************************************************************* 00355 ; 00356 ; The following variables are not changed by a SYSTEM RESET: 00357 ; 00358 ; $62 MISSIONLEVEL 00359 ; 00360 ; Mission level. Used values are: 00361 ; $00 -> NOVICE mission 00362 ; $01 -> PILOT mission 00363 ; $02 -> WARRIOR mission 00364 ; $03 -> COMMANDER mission 00365 ; 00366 ; $63 FKEYCODE 00367 ; 00368 ; Function key code. Used values are: 00369 ; $00 -> No function key pressed 00370 ; $01 -> START function key pressed 00371 ; $02 -> SELECT function key pressed 00372 ; 00373 ; $64 ISDEMOMODE 00374 ; 00375 ; Indicates whether the program is in game or demo mode. Used values 00376 ; are: 00377 ; $00 -> Game mode 00378 ; $FF -> Demo mode 00379 ; 00380 ; $65 NEWTITLEPHR 00381 ; 00382 ; New title phrase offset for the text in the title line. The new title 00383 ; phrase is not immediately displayed in the title line but only after 00384 ; the display time of the currently displayed title phrase has expired. 00385 ; Thus, setting a value to NEWTITLEPHR ($65) "enqueues" the display of 00386 ; new title phrase. Used values are: 00387 ; $00..$7B -> Title phrase offset into PHRASETAB ($BBAA) 00388 ; $FF -> Hide title line 00389 ; 00390 ; See also TITLEPHR ($D1). 00391 ; 00392 ; $66 IDLECNTHI 00393 ; 00394 ; Idle counter (high byte). Forms a 16-bit counter together with 00395 ; IDLECNTLO ($77), which is incremented during the execution of the 00396 ; Vertical Blank Interrupt handler VBIHNDLR ($A6D1). IDLECNTHI ($66) is 00397 ; reset to 0 when the joystick trigger or a keyboard key has been 00398 ; pressed, or to 1..3 when a function key has been pressed. When 00399 ; IDLECNTHI ($66) reaches a value of 128 (after about 10 min idle time) 00400 ; the program enters demo mode. 00401 ; 00402 ; The following variables are set to 0 after a SYSTEM RESET: 00403 ; 00404 ; $67 ISVBISYNC 00405 ; 00406 ; Indicates whether the Vertical Blank Interrupt handler VBIHNDLR 00407 ; ($A6D1) is executed. Used to synchronize the execution of a new game 00408 ; loop iteration in GAMELOOP ($A1F3) with the vertical blank phase. 00409 ; Used values are: 00410 ; $00 -> Halt execution at start of game loop and wait for VBI 00411 ; $FF -> Continue execution of game loop 00412 ; 00413 ; $68..$69 MEMPTR 00414 ; 00415 ; A 16-bit memory pointer. 00416 ; 00417 ; Also used as a local variable. 00418 ; 00419 ; $6A..$6B DIVIDEND 00420 ; 00421 ; A 16-bit dividend value passed in GAMELOOP ($A1F3) to subroutine 00422 ; PROJECTION ($AA21) to calculate a division. 00423 ; 00424 ; Also used as a local variable. 00425 ; 00426 ; $6C Used as a local variable. 00427 ; 00428 ; $6D JOYSTICKDELTA 00429 ; 00430 ; Used to pass joystick directions from GAMELOOP ($A1F3) to subroutine 00431 ; ROTATE ($B69B). Used values are: 00432 ; $01 -> Joystick pressed right or up 00433 ; $00 -> Joystick centered 00434 ; $FF -> Joystick pressed left or down 00435 ; 00436 ; Also used as a local variable. 00437 ; 00438 ; $6E Used as a local variable. 00439 ; 00440 ; $70 VELOCITYLO 00441 ; 00442 ; Our starship's current velocity (low byte) in <KM/H>. Forms a 16-bit 00443 ; value together with VELOCITYHI ($C1). In subroutine UPDPANEL ($B804), 00444 ; VELOCITYLO ($70) is mapped to a BCD-value in 00..99 and displayed by 00445 ; the VELOCITY readout of the Control Panel Display. See also 00446 ; NEWVELOCITY ($71). 00447 ; 00448 ; $71 NEWVELOCITY 00449 ; 00450 ; Our starship's new velocity (low byte) in <KM/H>. It is set by 00451 ; pressing one of the speed keys '0'..'9'. A pressed speed key is 00452 ; mapped to the new velocity value with VELOCITYTAB ($BAB4). 00453 ; 00454 ; $72 COUNT8 00455 ; 00456 ; Wrap-around counter. Counts from 0..7, then starts over at 0. It is 00457 ; incremented every game loop iteration. 00458 ; 00459 ; $73 EXPLLIFE 00460 ; 00461 ; Explosion lifetime. It is decremented every game loop iteration. Used 00462 ; values are: 00463 ; $00 -> Explosion is over 00464 ; < $18 -> Number of explosion fragment space objects is decremented 00465 ; < $70 -> HITBADNESS ($8A) is reset 00466 ; $80 -> Initial value at start of explosion 00467 ; 00468 ; $74 CLOCKTIM 00469 ; 00470 ; Star date clock delay timer. Counts down from 40 to 0. It is 00471 ; decremented every game loop iteration. When the timer falls below 0 00472 ; the last digit of the star date of the Galactic Chart Panel Display 00473 ; is increased and the timer is reset to a value of 40. 00474 ; 00475 ; $75 DOCKSTATE 00476 ; 00477 ; State of docking operation. Used values are: 00478 ; $00 -> NOT DOCKED 00479 ; $01 -> TRANSFER COMPLETE 00480 ; $81 -> RETURN TRANSFER VESSEL 00481 ; $FF -> ORBIT ESTABLISHED 00482 ; 00483 ; $76 COUNT256 00484 ; 00485 ; Wrap-around counter. Counts from 0..255, then starts over at 0. It is 00486 ; incremented every game loop iteration. 00487 ; 00488 ; $77 IDLECNTLO 00489 ; 00490 ; Idle counter (low byte). Forms a 16-bit counter together with 00491 ; IDLECNTHI ($66), which is incremented during the execution of the 00492 ; Vertical Blank Interrupt handler VBIHNDLR ($A6D1). 00493 ; 00494 ; NOTE: This variable is never properly initialized except at initial 00495 ; cartridge startup (cold start). 00496 ; 00497 ; $78 ZYLONUNITTIM 00498 ; 00499 ; Zylon unit movement timer. Triggers movement of Zylon units on the 00500 ; Galactic Chart. At the start of the game, the timer is initialized to 00501 ; a value of 100. It is decremented every 40 game loop iterations. When 00502 ; the timer falls below 0 the Zylon units move on the Galactic Chart 00503 ; and the timer value is reset to 49. If a starbase is surrounded the 00504 ; timer is reset to 99 to buy you some extra time to destroy one of the 00505 ; surrounding Zylon units. 00506 ; 00507 ; $79 MAXSPCOBJIND 00508 ; 00509 ; Maximum index of used space objects in the current game loop 00510 ; iteration. Frequently used values are: 00511 ; $10 -> During regular cruise (5 PLAYER space objects + 12 PLAYFIELD 00512 ; space objects (stars)) 00513 ; $30 -> During explosion or hyperwarp (5 PLAYER space objects + 12 00514 ; PLAYFIELD space objects (stars) + 32 PLAYFIELD space objects 00515 ; (explosion fragments or stars of star trails)) 00516 ; 00517 ; $7A SAVMAXSPCOBJIND 00518 ; 00519 ; Maximum index of used space objects in the previous game loop 00520 ; iteration. Frequently used values are: 00521 ; $10 -> During regular cruise (5 PLAYER space objects + 12 PLAYFIELD 00522 ; space objects (stars)) 00523 ; $30 -> During explosion or hyperwarp (5 PLAYER space objects + 12 00524 ; PLAYFIELD space objects (stars) + 32 PLAYFIELD space objects 00525 ; (explosion fragments or stars of star trails)) 00526 ; 00527 ; $7B ISSTARBASESECT 00528 ; 00529 ; Indicates whether a starbase is in this sector. Used values are: 00530 ; $00 -> Sector contains no starbase 00531 ; $FF -> Sector contains starbase 00532 ; 00533 ; $7C ISTRACKCOMPON 00534 ; 00535 ; Indicates whether the Tracking Computer is on or off. Used values 00536 ; are: 00537 ; $00 -> Tracking Computer is off 00538 ; $FF -> Tracking Computer is on 00539 ; 00540 ; $7D ISSHIELDSON 00541 ; 00542 ; Indicates whether the Shields are on or off. Used values are: 00543 ; $00 -> Shields are off 00544 ; $08 -> Shields are on 00545 ; 00546 ; If the Shields are on then the value of ISSHIELDSON ($7D) also 00547 ; indicates the number of energy subunits consumed per game loop 00548 ; iteration. See also subroutine UPDPANEL ($B804). 00549 ; 00550 ; $7E ISATTCOMPON 00551 ; 00552 ; Indicates whether the Attack Computer is on or off. Used values are: 00553 ; $00 -> Attack Computer off 00554 ; $02 -> Attack Computer on 00555 ; 00556 ; If the Attack Computer is on then the value of ISATTCOMPON ($7E) also 00557 ; indicates the number of energy subunits consumed per game loop 00558 ; iteration. See also subroutine UPDPANEL ($B804). 00559 ; 00560 ; $7F ENERGYCNT 00561 ; 00562 ; Running counter of consumed energy subunits (256 energy subunits = 1 00563 ; energy unit displayed by the 4-digit ENERGY readout of the Control 00564 ; Panel Display). Forms an invisible fractional or "decimals" part of 00565 ; the 4-digit ENERGY readout of the Control Panel Display. See also 00566 ; subroutine UPDPANEL ($B804). 00567 ; 00568 ; $80 DRAINRATE 00569 ; 00570 ; Energy drain rate of our starship's Engines per game loop iteration 00571 ; in energy subunits (256 energy subunits = 1 energy unit displayed by 00572 ; the 4-digit ENERGY readout of the Control Panel Display). Values are 00573 ; picked from table DRAINRATETAB ($BAD3). See also subroutine UPDPANEL 00574 ; ($B804). 00575 ; 00576 ; $81 SHIELDSCOLOR 00577 ; 00578 ; Shields color. Used values are: 00579 ; $00 -> {BLACK} (Shields are off) 00580 ; $A0 -> {DARK GREEN} (Shields are on) 00581 ; 00582 ; $82 PL3HIT 00583 ; 00584 ; Collision register of PLAYER3 (usually our starship's photon torpedo 00585 ; 0) with other PLAYERs. Used values are: 00586 ; $00 -> No collision 00587 ; > $00 -> PLAYER3 has collided with another PLAYER space object. See 00588 ; subroutine COLLISION ($AF3D) for details which PLAYER has 00589 ; been hit by PLAYER3. 00590 ; 00591 ; $83 PL4HIT 00592 ; 00593 ; Collision register of PLAYER4 (usually our starship's photon torpedo 00594 ; 1) with other PLAYERs. Used values are: 00595 ; $00 -> No collision 00596 ; > $00 -> PLAYER4 has collided with another PLAYER space object. See 00597 ; subroutine COLLISION ($AF3D) for details which PLAYER has 00598 ; been hit by PLAYER4. 00599 ; 00600 ; $84 OLDTRIG0 00601 ; 00602 ; Joystick trigger state. Used values are: 00603 ; $00 -> Joystick trigger was pressed 00604 ; $01 -> Joystick trigger was not pressed 00605 ; $AA -> Joystick trigger was "virtually" pressed (will launch 00606 ; another of our starship's photon torpedoes, see subroutine 00607 ; TRIGGER ($AE29). 00608 ; 00609 ; $86 ISTRACKING 00610 ; 00611 ; Indicates whether one of our starship's photon torpedoes is currently 00612 ; tracking (homing in on) the target space object. Used values are: 00613 ; $00 -> No target space object tracked. Our starship's photon 00614 ; torpedoes will fly just straight ahead. 00615 ; > $00 -> Tracking a target space object. Our starship's photon 00616 ; torpedoes will home in on the tracked space object. 00617 ; 00618 ; $87 BARRELNR 00619 ; 00620 ; Barrel from which our starship's next photon torpedo will be 00621 ; launched. Used values are: 00622 ; $00 -> Left barrel 00623 ; $01 -> Right barrel 00624 ; 00625 ; $88 LOCKONLIFE 00626 ; 00627 ; Lifetime of target lock-on. A target remains in lock-on while 00628 ; LOCKONLIFE ($88) counts down from 12 to 0. It is decremented every 00629 ; game loop iteration. 00630 ; 00631 ; $89 PLTRACKED 00632 ; 00633 ; Index of currently tracked PLAYER. It is copied in subroutine TRIGGER 00634 ; ($AE29) from TRACKDIGIT ($095C). Used values are: 00635 ; $00 -> Track Zylon ship 0 00636 ; $01 -> Track Zylon ship 1 00637 ; $02 -> Track starbase during docking operations 00638 ; $03 -> Track Hyperwarp Target Marker during hyperwarp 00639 ; 00640 ; $8A HITBADNESS 00641 ; 00642 ; Severeness of a Zylon photon torpedo hit. Used values are: 00643 ; $00 -> NO HIT 00644 ; $7F -> SHIELDS HIT 00645 ; $FF -> STARSHIP DESTROYED 00646 ; 00647 ; $8B REDALERTLIFE 00648 ; 00649 ; Lifetime of red alert. It decreases from 255 to 0. It is decremented 00650 ; every game loop iteration. 00651 ; 00652 ; $8C WARPDEPRROW 00653 ; 00654 ; Departure hyperwarp marker row number on the Galactic Chart. It is 00655 ; given in Player/Missile pixels relative to the top Galactic Chart 00656 ; border. It is initialized to a value of $47 (vertical center of 00657 ; Galactic Chart). Divide this value by 16 to get the departure sector 00658 ; row number. Used values are: $00..$7F. 00659 ; 00660 ; $8D WARPDEPRCOLUMN 00661 ; 00662 ; Departure hyperwarp marker column number on the Galactic Chart. It is 00663 ; given in Player/Missile pixels relative to the left Galactic Chart 00664 ; border and initialized to a value of $43 (horizontal center of 00665 ; Galactic Chart). Divide this value by 8 to get the departure sector 00666 ; column number. Used values are: $00..$7F. 00667 ; 00668 ; $8E WARPARRVROW 00669 ; 00670 ; Arrival hyperwarp marker row number on the Galactic Chart in 00671 ; Player/Missile pixels relative to top Galactic Chart border. It is 00672 ; initialized to a value of $47 (vertical center of Galactic Chart). 00673 ; Divide this value by 16 to get the arrival sector row number. Used 00674 ; values are: $00..$7F. 00675 ; 00676 ; $8F WARPARRVCOLUMN 00677 ; 00678 ; Arrival hyperwarp marker column number on the Galactic Chart in 00679 ; Player/Missile pixels relative to left Galactic Chart border. It is 00680 ; initialized to a value of $43 (horizontal center of Galactic Chart). 00681 ; Divide this value by 8 to get the arrival sector column number. Used 00682 ; values are: $00..$7F. 00683 ; 00684 ; $90 CURRSECTOR 00685 ; 00686 ; Galactic Chart sector of the current location of our starship. At the 00687 ; start of the game it is initialized to a value of $48. Used values 00688 ; are: $00..$7F with, for example, 00689 ; $00 -> NORTHWEST corner sector 00690 ; $0F -> NORTHEAST corner sector 00691 ; $70 -> SOUTHWEST corner sector 00692 ; $7F -> SOUTHWEST corner sector 00693 ; 00694 ; See also ARRVSECTOR ($92). 00695 ; 00696 ; $91 WARPENERGY 00697 ; 00698 ; Energy required to hyperwarp between the departure and arrival 00699 ; hyperwarp marker locations on the Galactic Chart divided by 10. 00700 ; Values are picked from table WARPENERGYTAB ($BADD). Multiply this 00701 ; value by 10 to get the actual value in energy units displayed by the 00702 ; Galactic Chart Panel Display. 00703 ; 00704 ; $92 ARRVSECTOR 00705 ; 00706 ; Galactic Chart arrival sector of our starship after hyperwarp. Used 00707 ; values are: $00..$7F with, for example, 00708 ; $00 -> NORTHWEST corner sector 00709 ; $0F -> NORTHEAST corner sector 00710 ; $70 -> SOUTHWEST corner sector 00711 ; $7F -> SOUTHWEST corner sector 00712 ; 00713 ; See also CURRSECTOR ($90). 00714 ; 00715 ; $93 HUNTSECTOR 00716 ; 00717 ; Galactic Chart sector of the starbase toward which the Zylon units 00718 ; are currently moving. Used values are: $00..$7F with, for example, 00719 ; $00 -> NORTHWEST corner sector 00720 ; $0F -> NORTHEAST corner sector 00721 ; $70 -> SOUTHWEST corner sector 00722 ; $7F -> SOUTHWEST corner sector 00723 ; 00724 ; $94 HUNTSECTCOLUMN 00725 ; 00726 ; Galactic Chart sector column number of the starbase toward which the 00727 ; Zylon units are currently moving. Used values are: 0..15. 00728 ; 00729 ; $95 HUNTSECTROW 00730 ; 00731 ; Galactic Chart sector row number of the starbase toward which the 00732 ; Zylon units are currently moving. Used values are: 0..7. 00733 ; 00734 ; $96..$9E NEWZYLONDIST 00735 ; 00736 ; Table of distances between a Zylon unit and the hunted starbase when 00737 ; the Zylon unit is tentatively moved in one of the 9 possible 00738 ; directions NORTH, NORTHWEST, WEST, SOUTHWEST, SOUTH, SOUTHEAST, EAST, 00739 ; NORTHEAST, CENTER. Used to decide into which sector the Zylon unit 00740 ; should move. 00741 ; 00742 ; $9E OLDZYLONDIST 00743 ; 00744 ; Current distance between the Zylon unit and the hunted starbase. 00745 ; 00746 ; $9F HUNTTIM 00747 ; 00748 ; This timer counts down from 7. It is decremented every game loop 00749 ; iteration. When the timer falls below 0 the Zylon units re-decide 00750 ; toward which starbase to move. 00751 ; 00752 ; $A0 BLIPCOLUMN 00753 ; 00754 ; Top-left screen pixel column number of blip shape displayed in the 00755 ; Attack Computer Display. Used in subroutine UPDATTCOMP ($A7BF). Used 00756 ; values are: 120..142. 00757 ; 00758 ; $A1 BLIPROW 00759 ; 00760 ; Top-left screen pixel row number of blip shape displayed in the 00761 ; Attack Computer Display. Used in subroutine UPDATTCOMP ($A7BF). Used 00762 ; values are: 71..81. 00763 ; 00764 ; $A2 BLIPCYCLECNT 00765 ; 00766 ; Blip cycle counter. It controls drawing the blip shape in the Attack 00767 ; Computer Display. This value is incremented every game loop 00768 ; iteration. Used in subroutine UPDATTCOMP ($A7BF). Used values are: 00769 ; $00..$04 -> Draw 0..4th row of blip shape 00770 ; $05..$09 -> Do not draw blip shape (delay) 00771 ; $0A -> Recalculate blip shape position, erase Attack Computer 00772 ; Display 00773 ; 00774 ; $A3 ISINLOCKON 00775 ; 00776 ; Indicates whether the tracked space object is currently in full 00777 ; lock-on (horizontally and vertically centered as well as in range) in 00778 ; the Attack Computer Display. If so, all lock-on markers show up on 00779 ; the Attack Computer Display and our starship's launched photon 00780 ; torpedoes will home in on the tracked space object. Used values are: 00781 ; $00 -> Not in lock-on 00782 ; $A0 -> In lock-on 00783 ; 00784 ; $A4 DIRLEN 00785 ; 00786 ; Used to pass the direction and length of a single line to be drawn in 00787 ; the PLAYFIELD. Used in subroutines DRAWLINES ($A76F), DRAWLINE 00788 ; ($A782), and UPDATTCOMP ($A7BF). Used values are: 00789 ; Bit B7 = 0 -> Draw left 00790 ; Bit B7 = 1 -> Draw down 00791 ; Bits B6..0 -> Length of line in pixels. 00792 ; 00793 ; See also PENROW ($A5) and PENCOLUMN ($A6). 00794 ; 00795 ; $A5 PENROW 00796 ; 00797 ; Used to pass the start screen pixel row number of the line to be 00798 ; drawn in the PLAYFIELD. Used in subroutines DRAWLINES ($A76F), 00799 ; DRAWLINE ($A782), and UPDATTCOMP ($A7BF). 00800 ; 00801 ; $A6 PENCOLUMN 00802 ; 00803 ; Used to pass the start screen pixel column number of the line to be 00804 ; drawn in the PLAYFIELD. Used in subroutines DRAWLINES ($A76F), 00805 ; DRAWLINE ($A782), and UPDATTCOMP ($A7BF). 00806 ; 00807 ; $A7 CTRLDZYLON 00808 ; 00809 ; Index of Zylon ship currently controlled by the program. Used in 00810 ; subroutine MANEUVER ($AA79). The value is toggled every other game 00811 ; loop iteration. Used values are: 00812 ; $00 -> Control Zylon ship 0. 00813 ; $01 -> Control Zylon ship 1. 00814 ; 00815 ; $A8 ZYLONFLPAT0 00816 ; 00817 ; Flight pattern of Zylon ship 0. Used in subroutine MANEUVER ($AA79). 00818 ; Used values are: 00819 ; $00 -> Attack flight pattern "0" 00820 ; $01 -> Flight pattern "1" 00821 ; $04 -> Flight pattern "4" 00822 ; 00823 ; $A9 ZYLONFLPAT1 00824 ; 00825 ; Flight pattern of Zylon ship 1. Compare ZYLONFLPAT0 ($A8). 00826 ; 00827 ; $AA MILESTTIM0 00828 ; 00829 ; Timer of the milestone velocity indices of Zylon ship 0. Used in 00830 ; subroutine MANEUVER ($AA79). 00831 ; 00832 ; When Zylon ship 0 is active, this value is decremented every game 00833 ; loop iteration. If it falls below 0 then the milestone velocity 00834 ; indices of Zylon ship 0 are recalculated. When Zylon ship 0 is 00835 ; controlled by the computer for the first time, the timer is set to an 00836 ; initial value of 1, later to an initial value of 120. 00837 ; 00838 ; $AB MILESTTIM1 00839 ; 00840 ; Timer of the milestone velocity index vector of Zylon ship 1. Compare 00841 ; MILESTTIM0 ($AA). 00842 ; 00843 ; $AC MILESTVELINDZ0 00844 ; 00845 ; Milestone z-velocity index of Zylon ship 0. Used in subroutine 00846 ; MANEUVER ($AA79). The current z-velocity index of Zylon ship 0 00847 ; ZYLONVELINDZ0 ($B2) is compared with this index and gradually 00848 ; adjusted to it. Used values are: 0..15. 00849 ; 00850 ; $AD MILESTVELINDZ1 00851 ; 00852 ; Milestone z-velocity index of Zylon ship 1. Compare MILESTVELINDZ0 00853 ; ($AC). 00854 ; 00855 ; $AE MILESTVELINDX0 00856 ; 00857 ; Milestone x-velocity index of Zylon ship 0. Used in subroutine 00858 ; MANEUVER ($AA79). The current x-velocity index of Zylon ship 0 00859 ; ZYLONVELINDX0 ($B4) is compared with this index and gradually 00860 ; adjusted to it. Used values are: 0..15. 00861 ; 00862 ; $AF MILESTVELINDX1 00863 ; 00864 ; Milestone x-velocity index of Zylon ship 1. Compare MILESTVELINDX0 00865 ; ($AE). 00866 ; 00867 ; $B0 MILESTVELINDY0 00868 ; 00869 ; Milestone y-velocity index of Zylon ship 0. Used in subroutine 00870 ; MANEUVER ($AA79). The current y-velocity index of Zylon ship 0 00871 ; ZYLONVELINDY0 ($B6) is compared with this index and gradually 00872 ; adjusted to it. Used values are: 0..15. 00873 ; 00874 ; $B1 MILESTVELINDY1 00875 ; 00876 ; Milestone y-velocity index of Zylon ship 1. Compare MILESTVELINDY0 00877 ; ($B0). 00878 ; 00879 ; $B2 ZYLONVELINDZ0 00880 ; 00881 ; Current z-velocity index of Zylon ship 0. Used in subroutine MANEUVER 00882 ; ($AA79). It indexes velocity values in ZYLONVELTAB ($BF99). Used 00883 ; values are: 0..15. 00884 ; 00885 ; $B3 ZYLONVELINDZ1 00886 ; 00887 ; Current z-velocity index of Zylon ship 1. Compare ZYLONVELINDZ0 00888 ; ($B2). 00889 ; 00890 ; $B4 ZYLONVELINDX0 00891 ; 00892 ; Current x-velocity index of Zylon ship 0. Compare ZYLONVELINDZ0 00893 ; ($B2). 00894 ; 00895 ; $B5 ZYLONVELINDX1 00896 ; 00897 ; Current x-velocity index of Zylon ship 1. Compare ZYLONVELINDZ0 00898 ; ($B2). 00899 ; 00900 ; $B6 ZYLONVELINDY0 00901 ; 00902 ; Current y-velocity index of Zylon ship 0. Compare ZYLONVELINDZ0 00903 ; ($B2). 00904 ; 00905 ; $B7 ZYLONVELINDY1 00906 ; 00907 ; Current y-velocity index of Zylon ship 1. Compare ZYLONVELINDZ0 00908 ; ($B2). 00909 ; 00910 ; $B8 ISBACKATTACK0 00911 ; 00912 ; Indicates whether Zylon ship 0 will attack our starship from the 00913 ; back. Used in subroutine MANEUVER ($AA79). Used values are: 00914 ; $00 -> Zylon ship 0 attacks from the front of our starship 00915 ; $01 -> Zylon ship 0 attacks from the front and back of our starship 00916 ; 00917 ; $B9 ISBACKATTACK1 00918 ; 00919 ; Indicates whether Zylon ship 1 will attack our starship from the 00920 ; back. Compare ISBACKATTACK0 ($B8). 00921 ; 00922 ; $BA ZYLONTIMX0 00923 ; 00924 ; Delay timer of the x-velocity index of Zylon ship 0. Used in 00925 ; subroutine MANEUVER ($AA79). It is decremented every game loop 00926 ; iteration. When the timer value falls below 0 the current velocity 00927 ; index ZYLONVELINDX0 ($B4) is adjusted depending on the current 00928 ; joystick position. The new timer value is set depending on the 00929 ; resulting new x-velocity index. Used values are: 0, 2, 4, ..., 14. 00930 ; 00931 ; $BB ZYLONTIMX1 00932 ; 00933 ; Delay timer of x-velocity index of Zylon ship 1. Compare ZYLONTIMX0 00934 ; ($BA). 00935 ; 00936 ; $BC ZYLONTIMY0 00937 ; 00938 ; Delay timer of y-velocity index of Zylon ship 0. Compare ZYLONTIMX0 00939 ; ($BA). 00940 ; 00941 ; $BD ZYLONTIMY1 00942 ; 00943 ; Delay timer of y-velocity index of Zylon ship 1. Compare ZYLONTIMX0 00944 ; ($BA). 00945 ; 00946 ; $BE TORPEDODELAY 00947 ; 00948 ; After a Zylon photon torpedo has hit our starship this timer is 00949 ; initialized to a value of 2. It is decremented every game loop 00950 ; iteration and so delays the launch of the next Zylon photon torpedo 00951 ; for 2 game loop iterations. 00952 ; 00953 ; $BF ZYLONATTACKER 00954 ; 00955 ; PLAYER index of the Zylon ship that launched the Zylon photon 00956 ; torpedo. It is used in GAMELOOP ($A1F3) to override the current 00957 ; tracking computer settings in order to track this Zylon ship first. 00958 ; Used values are: 00959 ; $00 -> Zylon photon torpedo was launched by Zylon ship 0 00960 ; $01 -> Zylon photon torpedo was launched by Zylon ship 1 00961 ; 00962 ; $C0 WARPSTATE 00963 ; 00964 ; Hyperwarp state. Used values are: 00965 ; $00 -> Hyperwarp not engaged 00966 ; $7F -> Hyperwarp engaged 00967 ; $FF -> In hyperspace 00968 ; 00969 ; $C1 VELOCITYHI 00970 ; 00971 ; Our starship's velocity (high byte) in <KM/H>. Used values are: 00972 ; $00 -> Not in hyperspace (regular cruise or accelerating to 00973 ; hyperspace velocity) 00974 ; $01 -> Hyperspace velocity 00975 ; 00976 ; See also VELOCITYLO ($70). 00977 ; 00978 ; $C2 TRAILDELAY 00979 ; 00980 ; Timer to delay the creation of the next star trail. This value is 00981 ; decremented from 3 to 0 every game loop iteration during the 00982 ; hyperwarp STAR TRAIL PHASE in subroutine INITTRAIL ($A9B4). 00983 ; 00984 ; $C3 TRAILIND 00985 ; 00986 ; Position vector index of the star trail's first star. Used in 00987 ; subroutine INITTRAIL ($A9B4) to initialize a star trail, which is 00988 ; then displayed during the hyperwarp STAR TRAIL PHASE. Used values 00989 ; are: 17..48 in wrap-around fashion. 00990 ; 00991 ; $C4 WARPTEMPCOLUMN 00992 ; 00993 ; Temporary arrival column number of our starship on the Galactic Chart 00994 ; at the begin of hyperspace. It is given in Player/Missile pixels 00995 ; relative to the left Galactic Chart border. Divide this value by 8 to 00996 ; get the sector column number. Used values are: $00..$7F. See also 00997 ; WARPARRVCOLUMN ($8F). 00998 ; 00999 ; $C5 WARPTEMPROW 01000 ; 01001 ; Temporary arrival row number of our starship on the Galactic Chart at 01002 ; the begin of hyperspace. It is given in Player/Missile pixels 01003 ; relative to top Galactic Chart border. Divide this value by 16 to get 01004 ; the sector row number. Used values are: $00..$7F. See also 01005 ; WARPARRVROW ($8E). 01006 ; 01007 ; $C6 VEERMASK 01008 ; 01009 ; Limits the veer-off velocity of the Hyperwarp Target Marker during 01010 ; the hyperwarp ACCELERATION PHASE in subroutine HYPERWARP ($A89B). 01011 ; Values are picked from table VEERMASKTAB ($BED7). 01012 ; 01013 ; Also used as a local variable. 01014 ; 01015 ; $C7 VICINITYMASK 01016 ; 01017 ; Mask to confine space objects' position vector components 01018 ; (coordinates) in a sector into a certain interval around our starship 01019 ; after its arrival from hyperspace. Values are picked from table 01020 ; VICINITYMASKTAB ($BFB3). 01021 ; 01022 ; $C8 JOYSTICKX 01023 ; 01024 ; Horizontal joystick direction. Values are picked from table 01025 ; STICKINCTAB ($BAF5). Used values are: 01026 ; $01 -> Right 01027 ; $00 -> Centered 01028 ; $FF -> Left 01029 ; 01030 ; $C9 JOYSTICKY 01031 ; 01032 ; Vertical joystick direction. Values are picked from table STICKINCTAB 01033 ; ($BAF5). Used values are: 01034 ; $01 -> Up 01035 ; $00 -> Centered 01036 ; $FF -> Down 01037 ; 01038 ; $CA KEYCODE 01039 ; 01040 ; Hardware keyboard code of the pressed key on the keyboard. Shift and 01041 ; Control key bits B7..6 are always set. 01042 ; 01043 ; $CB..$CC SCORE 01044 ; 01045 ; Internal 16-bit score of the game in low byte-high byte order 01046 ; 01047 ; $CD SCOREDRANKIND 01048 ; 01049 ; Scored Rank Index. It is translated with table RANKTAB ($BEE9) to a 01050 ; title phrase offset pointing to the rank string. Used values are: 01051 ; $00 -> GALACTIC COOK 01052 ; $01 -> GARBAGE SCOW CAPTAIN 01053 ; $02 -> GARBAGE SCOW CAPTAIN 01054 ; $03 -> ROOKIE 01055 ; $04 -> ROOKIE 01056 ; $05 -> NOVICE 01057 ; $06 -> NOVICE 01058 ; $07 -> ENSIGN 01059 ; $08 -> ENSIGN 01060 ; $09 -> PILOT 01061 ; $0A -> PILOT 01062 ; $0B -> ACE 01063 ; $0C -> LIEUTENANT 01064 ; $0D -> WARRIOR 01065 ; $0E -> CAPTAIN 01066 ; $0F -> COMMANDER 01067 ; $10 -> COMMANDER 01068 ; $11 -> STAR COMMANDER 01069 ; $12 -> STAR COMMANDER 01070 ; 01071 ; $CE SCOREDCLASSIND 01072 ; 01073 ; Scored Class Index. It is translated into a class number with table 01074 ; CLASSTAB ($BEFC). Used values are: 01075 ; $00 -> Class 5 01076 ; $01 -> Class 5 01077 ; $02 -> Class 5 01078 ; $03 -> Class 4 01079 ; $04 -> Class 4 01080 ; $05 -> Class 4 01081 ; $06 -> Class 4 01082 ; $07 -> Class 3 01083 ; $08 -> Class 3 01084 ; $09 -> Class 3 01085 ; $0A -> Class 2 01086 ; $0B -> Class 2 01087 ; $0C -> Class 2 01088 ; $0D -> Class 1 01089 ; $0E -> Class 1 01090 ; $0F -> Class 1 01091 ; 01092 ; $CF TITLELIFE 01093 ; 01094 ; Lifetime of title line. It is decremented every game loop iteration. 01095 ; Used initial values are: 01096 ; $3C -> When displaying regular title phrases 01097 ; $FE -> When displaying "STARBASE SURROUNDED", "STARBASE DESTOYED", 01098 ; and "RED ALERT" messages 01099 ; $FF -> Hide title line 01100 ; 01101 ; $D0 SHIPVIEW 01102 ; 01103 ; Current view of our starship. Values are picked from table 01104 ; VIEWMODETAB ($BE22). Used values are: 01105 ; $00 -> Front view 01106 ; $01 -> Aft view 01107 ; $40 -> Long-Range Scan view 01108 ; $80 -> Galactic Chart view 01109 ; 01110 ; $D1 TITLEPHR 01111 ; 01112 ; Title phrase offset for text phrase in title line. Used values are: 01113 ; $00..$7B -> Title phrase offset into PHRASETAB ($BBAA) 01114 ; $FF -> Hide title line 01115 ; 01116 ; See also NEWTITLEPHR ($65). 01117 ; 01118 ; $D2 BEEPFRQIND 01119 ; 01120 ; Beeper sound pattern: Running index into frequency table BEEPFRQTAB 01121 ; ($BF5C). See also BEEPFRQSTART ($D7). See also subroutines BEEP 01122 ; ($B3A6) and SOUND ($B2AB). 01123 ; 01124 ; $D3 BEEPREPEAT 01125 ; 01126 ; Beeper sound pattern: Number of times the beeper sound pattern is 01127 ; repeated - 1. See also subroutines BEEP ($B3A6) and SOUND ($B2AB). 01128 ; 01129 ; $D4 BEEPTONELIFE 01130 ; 01131 ; Beeper sound pattern: Lifetime of tone in TICKs - 1. See also 01132 ; subroutines BEEP ($B3A6) and SOUND ($B2AB). 01133 ; 01134 ; $D5 BEEPPAUSELIFE 01135 ; 01136 ; Beeper sound pattern: Lifetime of pause in TICKs - 1. Used values 01137 ; are: 01138 ; < $FF -> Number of TICKs - 1 to play 01139 ; $FF -> Skip playing pause 01140 ; 01141 ; See also subroutines BEEP ($B3A6) and SOUND ($B2AB). 01142 ; 01143 ; $D6 BEEPPRIORITY 01144 ; 01145 ; Beeper sound pattern: Pattern priority. Each beeper sound pattern has 01146 ; a priority. When a pattern of higher priority is about to be played 01147 ; the pattern that is currently playing is stopped. Used values are: 01148 ; $00 -> No pattern playing at the moment 01149 ; > $00 -> Pattern priority 01150 ; 01151 ; See also subroutines BEEP ($B3A6) and SOUND ($B2AB). 01152 ; 01153 ; $D7 BEEPFRQSTART 01154 ; 01155 ; Beeper sound pattern: Index to first byte of the pattern frequency in 01156 ; table BEEPFRQTAB ($BF5C). See also BEEPFRQIND ($D2). See also 01157 ; subroutines BEEP ($B3A6) and SOUND ($B2AB). 01158 ; 01159 ; $D8 BEEPLIFE 01160 ; 01161 ; Beeper sound pattern: Lifetime of the current tone or pause in TICKs. 01162 ; It is decremented every TICK. See also subroutines BEEP ($B3A6) and 01163 ; SOUND ($B2AB). 01164 ; 01165 ; $D9 BEEPTOGGLE 01166 ; 01167 ; Beeper sound pattern: Indicates that either a tone or a pause is 01168 ; currently played. Used values are: 01169 ; $00 -> Tone 01170 ; $01 -> Pause 01171 ; 01172 ; See also subroutines BEEP ($B3A6) and SOUND ($B2AB). 01173 ; 01174 ; $DA NOISETORPTIM 01175 ; 01176 ; Noise sound pattern: Timer for PHOTON TORPEDO LAUNCHED noise sound 01177 ; pattern. It is decremented every TICK. See also subroutines NOISE 01178 ; ($AEA8) and SOUND ($B2AB). 01179 ; 01180 ; $DB NOISEEXPLTIM 01181 ; 01182 ; Noise sound pattern: Timer for SHIP EXPLOSION and ZYLON EXPLOSION 01183 ; noise sound pattern. It is decremented every TICK. See also 01184 ; subroutines NOISE ($AEA8) and SOUND ($B2AB). 01185 ; 01186 ; $DC NOISEAUDC2 01187 ; 01188 ; Noise sound pattern: Audio channel 1/2 control shadow register. See 01189 ; also subroutines NOISE ($AEA8) and SOUND ($B2AB). 01190 ; 01191 ; $DD NOISEAUDC3 01192 ; 01193 ; Noise sound pattern: Audio channel 3 control shadow register. See 01194 ; also subroutines NOISE ($AEA8) and SOUND ($B2AB). 01195 ; 01196 ; $DE NOISEAUDF1 01197 ; 01198 ; Noise sound pattern: Audio channel 1 frequency shadow register. See 01199 ; also subroutines NOISE ($AEA8) and SOUND ($B2AB). 01200 ; 01201 ; $DF NOISEAUDF2 01202 ; 01203 ; Noise sound pattern: Audio channel 2 frequency shadow register. See 01204 ; also subroutines NOISE ($AEA8) and SOUND ($B2AB). 01205 ; 01206 ; $E0 NOISEFRQINC 01207 ; 01208 ; Noise sound pattern: Audio channel 1/2 frequency increment. See also 01209 ; subroutines NOISE ($AEA8) and SOUND ($B2AB). 01210 ; 01211 ; $E1 NOISELIFE 01212 ; 01213 ; Noise sound pattern: Noise sound pattern lifetime. It is decremented 01214 ; every TICK. See also subroutines NOISE ($AEA8) and SOUND ($B2AB). 01215 ; 01216 ; $E2 NOISEZYLONTIM 01217 ; 01218 ; Timer to trigger the ZYLON EXPLOSION noise sound pattern. It is set 01219 ; in subroutine COLLISION ($AF3D) when an impact of one of our 01220 ; starship's photon torpedoes into a target is imminent. The timer is 01221 ; decremented every TICK during the execution of the Vertical Blank 01222 ; Interrupt handler VBIHNDLR ($A6D1). When the timer value reaches 0 01223 ; the ZYLON EXPLOSION noise sound pattern is played in subroutine SOUND 01224 ; ($B2AB). 01225 ; 01226 ; $E3 NOISEHITLIFE 01227 ; 01228 ; Lifetime of special explosion noise when our starship was hit by a 01229 ; Zylon photon torpedo. It is set in routine GAMELOOP ($A1F3) to a 01230 ; value of 64 TICKs. It is decremented every TICK during the execution 01231 ; of the Vertical Blank Interrupt handler VBIHNDLR ($A6D1). 01232 ; 01233 ; $E4 PL0SHAPOFF 01234 ; 01235 ; PLAYER0 offset into shape table PLSHAP2TAB ($B9B1) 01236 ; 01237 ; $E5 PL1SHAPOFF 01238 ; 01239 ; PLAYER1 offset into shape table PLSHAP2TAB ($B9B1) 01240 ; 01241 ; $E6 PL2SHAPOFF 01242 ; 01243 ; PLAYER2 offset into shape table PLSHAP1TAB ($B8E4) 01244 ; 01245 ; $E7 PL3SHAPOFF 01246 ; 01247 ; PLAYER3 offset into shape table PLSHAP1TAB ($B8E4) 01248 ; 01249 ; $E8 PL4SHAPOFF 01250 ; 01251 ; PLAYER4 offset into shape table PLSHAP1TAB ($B8E4) 01252 ; 01253 ; $E9 PL0LIFE 01254 ; 01255 ; Lifetime of the space object represented by PLAYER0 (usually Zylon 01256 ; ship 0). Any value other than $FF is decremented with every game loop 01257 ; iteration. Used values are: 01258 ; $00 -> Space object not alive (= not in use) 01259 ; $01..$FE -> Values during lifetime countdown 01260 ; $FF -> Infinite lifetime (not counted down) 01261 ; 01262 ; $EA PL1LIFE 01263 ; 01264 ; Lifetime of a space object represented by PLAYER1 (usually Zylon ship 01265 ; 1). Compare PL0LIFE ($E9). 01266 ; 01267 ; $EB PL2LIFE 01268 ; 01269 ; Lifetime of a space object represented by PLAYER2 (usually the Zylon 01270 ; photon torpedo). Compare PL0LIFE ($E9). 01271 ; 01272 ; If this PLAYER represents a photon torpedo, its lifetime is 01273 ; decremented from an initial value of $FF. 01274 ; 01275 ; $EC PL3LIFE 01276 ; 01277 ; Lifetime of a space object represented by PLAYER3 (usually our 01278 ; starship's photon torpedo 0). Compare PL2LIFE ($EB). 01279 ; 01280 ; If this PLAYER represents a photon torpedo, its lifetime is 01281 ; decremented from an initial value of $FF. 01282 ; 01283 ; $ED PL4LIFE 01284 ; 01285 ; Lifetime of a space object represented by PLAYER4 (usually our 01286 ; starship's photon torpedo 1). Compare PL2LIFE ($EB). 01287 ; 01288 ; If this PLAYER represents a photon torpedo, its lifetime is 01289 ; decremented from an initial value of $FF. 01290 ; 01291 ; $EE PL0COLOR 01292 ; 01293 ; Color of PLAYER0 01294 ; 01295 ; $EF PL1COLOR 01296 ; 01297 ; Color of PLAYER1 01298 ; 01299 ; $F0 PL2COLOR 01300 ; 01301 ; Color of PLAYER2 01302 ; 01303 ; $F1 PL3COLOR 01304 ; 01305 ; Color of PLAYER3 01306 ; 01307 ; $F2 PF0COLOR 01308 ; 01309 ; Color of PLAYFIELD0 01310 ; 01311 ; $F3 PF1COLOR 01312 ; 01313 ; Color of PLAYFIELD1 01314 ; 01315 ; $F4 PF2COLOR 01316 ; 01317 ; Color of PLAYFIELD2 01318 ; 01319 ; $F5 PF3COLOR 01320 ; 01321 ; Color of PLAYFIELD3 01322 ; 01323 ; $F6 BGRCOLOR 01324 ; 01325 ; Color of BACKGROUND 01326 ; 01327 ; $F7 PF0COLORDLI 01328 ; 01329 ; Color of PLAYFIELD0 after DLI 01330 ; 01331 ; $F8 PF1COLORDLI 01332 ; 01333 ; Color of PLAYFIELD1 after DLI 01334 ; 01335 ; $F9 PF2COLORDLI 01336 ; 01337 ; Color of PLAYFIELD2 after DLI 01338 ; 01339 ; $FA PF3COLORDLI 01340 ; 01341 ; Color of PLAYFIELD3 after DLI 01342 ; 01343 ; $FB BGRCOLORDLI 01344 ; 01345 ; Color of BACKGROUND after DLI 01346 ; 01347 ; $0280..$02E9 DSPLST 01348 ; 01349 ; Display List 01350 ; 01351 ; $0300..$03FF PL4DATA 01352 ; 01353 ; PLAYER4 data area 01354 ; 01355 ; $0400..$04FF PL0DATA 01356 ; 01357 ; PLAYER0 data area 01358 ; 01359 ; $0500..$05FF PL1DATA 01360 ; 01361 ; PLAYER1 data area 01362 ; 01363 ; $0600..$06FF PL2DATA 01364 ; 01365 ; PLAYER2 data area 01366 ; 01367 ; $0700..$07FF PL3DATA 01368 ; 01369 ; PLAYER3 data area 01370 ; 01371 ; $0800..$0863 PFMEMROWLO 01372 ; 01373 ; Lookup table of start addresses (low byte) for each row of 01374 ; PLAYFIELD memory, which is located at PFMEM ($1000). The table 01375 ; contains 100 bytes for 100 rows (of which only 99 are shown by 01376 ; the Display List, the PLAYFIELD is 160 x 99 pixels). The 01377 ; addresses grow in increments of 40 (40 bytes = 160 pixels in 01378 ; GRAPHICS7 mode = 1 PLAYFIELD row of pixels). See also PFMEMROWHI 01379 ; ($0864). 01380 ; 01381 ; $0864..$08C7 PFMEMROWHI 01382 ; 01383 ; Lookup table of start addresses (high byte) of each row of 01384 ; PLAYFIELD memory. See also PFMEMROWLO ($0800). 01385 ; 01386 ; $08C9..$0948 GCMEMMAP 01387 ; 01388 ; Galactic Chart memory map (16 columns x 8 rows = 128 bytes) 01389 ; 01390 ; $0949..$0970 PANELTXT 01391 ; 01392 ; Memory of Control Panel Display (bottom text window) in Front 01393 ; view, Aft view, and Long-Range Scan view (20 characters x 2 rows 01394 ; = 40 bytes). 01395 ; 01396 ; $094A VELOCD1 01397 ; 01398 ; First digit (of 2) of the VELOCITY readout in Control Panel 01399 ; Display memory. 01400 ; 01401 ; $0950 KILLCNTD1 01402 ; 01403 ; First digit (of 2) of the KILL COUNTER readout in Control Panel 01404 ; Display memory. 01405 ; 01406 ; $0955 ENERGYD1 01407 ; 01408 ; First digit (of 4) of the ENERGY readout in Control Panel Display 01409 ; memory. 01410 ; 01411 ; $095A TRACKC1 01412 ; 01413 ; Character of the TRACKING readout 'T' or 'C' in Control Panel 01414 ; Display memory. 01415 ; 01416 ; $095C TRACKDIGIT 01417 ; 01418 ; Digit of the TRACKING readout in Control Panel Display memory. It 01419 ; is used to store the index of the currently tracked space object. 01420 ; Used values are: 01421 ; $00 -> Track Zylon ship 0 01422 ; $01 -> Track Zylon ship 1 01423 ; $02 -> Track starbase 01424 ; $03 -> Track Hyperwarp Target Marker 01425 ; 01426 ; $0960 THETAC1 01427 ; 01428 ; First character of the THETA readout in Control Panel Display 01429 ; memory. 01430 ; 01431 ; $0966 PHIC1 01432 ; 01433 ; First character of the PHI readout in Control Panel Display 01434 ; memory. 01435 ; 01436 ; $096C RANGEC1 01437 ; 01438 ; First character of the RANGE readout in Control Panel Display 01439 ; memory. 01440 ; 01441 ; $0971..$09AC GCTXT 01442 ; 01443 ; Memory of Galactic Chart Panel Display (bottom text window) of 01444 ; Galactic Chart view (20 characters x 3 rows = 60 bytes). 01445 ; 01446 ; $097D GCWARPD1 01447 ; 01448 ; First digit (of 4) of the HYPERWARP ENERGY readout in Galactic 01449 ; Chart Panel Display memory. 01450 ; 01451 ; $098D GCTRGCNT 01452 ; 01453 ; First target counter digit (of 2) in Galactic Chart Panel Display 01454 ; memory. 01455 ; 01456 ; $0992 GCSTATPHO 01457 ; 01458 ; Photon Torpedo status letter in Galactic Chart Panel Display 01459 ; memory. Used values are: 01460 ; %00****** -> OK 01461 ; %10****** -> Destroyed 01462 ; %11****** -> Damaged 01463 ; 01464 ; $0993 GCSTATENG 01465 ; 01466 ; Engines status letter in Galactic Chart Panel Display memory. 01467 ; Used values are: 01468 ; %00****** -> OK 01469 ; %10****** -> Destroyed 01470 ; %11****** -> Damaged 01471 ; 01472 ; $0994 GCSTATSHL 01473 ; 01474 ; Shields status letter in Galactic Chart Panel Display memory. 01475 ; Used values are: 01476 ; %00****** -> OK 01477 ; %10****** -> Destroyed 01478 ; %11****** -> Damaged 01479 ; 01480 ; $0995 GCSTATCOM 01481 ; 01482 ; Attack Computer status letter in Galactic Chart Panel Display 01483 ; memory. Used values are: 01484 ; %00****** -> OK 01485 ; %10****** -> Destroyed 01486 ; %11****** -> Damaged 01487 ; 01488 ; $0996 GCSTATLRS 01489 ; 01490 ; Long-Range Scan status letter in Galactic Chart Panel Display 01491 ; memory. Used values are: 01492 ; %00****** -> OK 01493 ; %10****** -> Destroyed 01494 ; %11****** -> Damaged 01495 ; 01496 ; $0997 GCSTATRAD 01497 ; 01498 ; Subspace Radio status letter in Galactic Chart Panel Display 01499 ; memory. Used values are: 01500 ; %00****** -> OK 01501 ; %10****** -> Destroyed 01502 ; %11****** -> Damaged 01503 ; 01504 ; $09A3 GCSTARDAT 01505 ; 01506 ; First (of 5) digits of the star date clock in the Galactic Chart 01507 ; Panel Display memory. 01508 ; 01509 ; $09AD..$09DD ZPOSSIGN 01510 ; 01511 ; Table containing the sign bit (B16) of position vector 01512 ; z-components (z-coordinate) (49 bytes). Bytes 0..4 belong to 01513 ; position vectors of PLAYER space objects (Zylon ships, photon 01514 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01515 ; PLAYFIELD space objects (stars, explosion fragments). Used values 01516 ; are: 01517 ; $00 -> Negative sign (behind our starship) 01518 ; $01 -> Positive sign (in front of our starship) 01519 ; 01520 ; See also "ON POSITION VECTORS". 01521 ; 01522 ; $09AD PL0ZPOSSIGN 01523 ; 01524 ; Sign bit (B16) of position vector z-component (z-coordinate) of 01525 ; PLAYER0. Compare ZPOSSIGN ($09AD). See also "ON POSITION 01526 ; VECTORS". 01527 ; 01528 ; $09AE PL1ZPOSSIGN 01529 ; 01530 ; Sign bit (B16) of position vector z-component (z-coordinate) of 01531 ; PLAYER1. Compare ZPOSSIGN ($09AD). See also "ON POSITION 01532 ; VECTORS". 01533 ; 01534 ; $09AF PL2ZPOSSIGN 01535 ; 01536 ; Sign bit (B16) of position vector z-component (z-coordinate) of 01537 ; PLAYER2. Compare ZPOSSIGN ($09AD). See also "ON POSITION 01538 ; VECTORS". 01539 ; 01540 ; $09B0 PL3ZPOSSIGN 01541 ; 01542 ; Sign bit (B16) of position vector z-component (z-coordinate) of 01543 ; PLAYER3. Compare ZPOSSIGN ($09AD). See also "ON POSITION 01544 ; VECTORS". 01545 ; 01546 ; $09B1 PL4ZPOSSIGN 01547 ; 01548 ; Sign bit (B16) of position vector z-component (z-coordinate) of 01549 ; PLAYER4. Compare ZPOSSIGN ($09AD). See also "ON POSITION 01550 ; VECTORS". 01551 ; 01552 ; $09DE..$0A0E XPOSSIGN 01553 ; 01554 ; Table containing the sign bit (B16) of position vector 01555 ; x-components (x-coordinate) (49 bytes). Bytes 0..4 belong to 01556 ; position vectors of PLAYER space objects (Zylon ships, photon 01557 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01558 ; PLAYFIELD space objects (stars, explosion fragments). Used values 01559 ; are: 01560 ; $00 -> Negative sign (left) 01561 ; $01 -> Positive sign (right) 01562 ; 01563 ; See also "ON POSITION VECTORS". 01564 ; 01565 ; $09DE PL0XPOSSIGN 01566 ; 01567 ; Sign bit (B16) of position vector x-component (x-coordinate) of 01568 ; PLAYER0. Compare XPOSSIGN ($09DE). See also "ON POSITION 01569 ; VECTORS". 01570 ; 01571 ; $09DF PL1XPOSSIGN 01572 ; 01573 ; Sign bit (B16) of position vector x-component (x-coordinate) of 01574 ; PLAYER1. Compare XPOSSIGN ($09DE). See also "ON POSITION 01575 ; VECTORS". 01576 ; 01577 ; $09E0 PL2XPOSSIGN 01578 ; 01579 ; Sign bit (B16) of position vector x-component (x-coordinate) of 01580 ; PLAYER2. Compare XPOSSIGN ($09DE). See also "ON POSITION 01581 ; VECTORS". 01582 ; 01583 ; $09E1 PL3XPOSSIGN 01584 ; 01585 ; Sign bit (B16) of position vector x-component (x-coordinate) of 01586 ; PLAYER3. Compare XPOSSIGN ($09DE). See also "ON POSITION 01587 ; VECTORS". 01588 ; 01589 ; $09E2 PL4XPOSSIGN 01590 ; 01591 ; Sign bit (B16) of position vector x-component (x-coordinate) of 01592 ; PLAYER4. Compare XPOSSIGN ($09DE). See also "ON POSITION 01593 ; VECTORS". 01594 ; 01595 ; $0A0F..$0A3F YPOSSIGN 01596 ; 01597 ; Table containing the sign bit (B16) of position vector 01598 ; y-components (y-coordinate) (49 bytes). Bytes 0..4 belong to 01599 ; position vectors of PLAYER space objects (Zylon ships, photon 01600 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01601 ; PLAYFIELD space objects (stars, explosion fragments). Used values 01602 ; are: 01603 ; $00 -> Negative sign (down) 01604 ; $01 -> Positive sign (up) 01605 ; 01606 ; See also "ON POSITION VECTORS". 01607 ; 01608 ; $0A0F PL0YPOSSIGN 01609 ; 01610 ; Sign bit (B16) of position vector y-component (y-coordinate) of 01611 ; PLAYER0. Compare YPOSSIGN ($0A0F). See also "ON POSITION 01612 ; VECTORS". 01613 ; 01614 ; $0A10 PL1YPOSSIGN 01615 ; 01616 ; Sign bit (B16) of position vector y-component (y-coordinate) of 01617 ; PLAYER1. Compare YPOSSIGN ($0A0F). See also "ON POSITION 01618 ; VECTORS". 01619 ; 01620 ; $0A11 PL2YPOSSIGN 01621 ; 01622 ; Sign bit (B16) of position vector y-component (y-coordinate) of 01623 ; PLAYER2. Compare YPOSSIGN ($0A0F). See also "ON POSITION 01624 ; VECTORS". 01625 ; 01626 ; $0A12 PL3YPOSSIGN 01627 ; 01628 ; Sign bit (B16) of position vector y-component (y-coordinate) of 01629 ; PLAYER3. Compare YPOSSIGN ($0A0F). See also "ON POSITION 01630 ; VECTORS". 01631 ; 01632 ; $0A13 PL4YPOSSIGN 01633 ; 01634 ; Sign bit (B16) of position vector y-component (y-coordinate) of 01635 ; PLAYER4. Compare YPOSSIGN ($0A0F). See also "ON POSITION 01636 ; VECTORS". 01637 ; 01638 ; $0A40..$0A70 ZPOSHI 01639 ; 01640 ; Table containing the high byte (B15..8) of position vector 01641 ; y-components (y-coordinate) (49 bytes). Bytes 0..4 belong to 01642 ; position vectors of PLAYER space objects (Zylon ships, photon 01643 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01644 ; PLAYFIELD space objects (stars, explosion fragments). See also 01645 ; "ON POSITION VECTORS". 01646 ; 01647 ; $0A40 PL0ZPOSHI 01648 ; 01649 ; High byte (B15..8) of position vector z-component (z-coordinate) 01650 ; of PLAYER0. Compare ZPOSHI ($0A40). See also "ON POSITION 01651 ; VECTORS". 01652 ; 01653 ; $0A41 PL1ZPOSHI 01654 ; 01655 ; High byte (B15..8) of position vector z-component (z-coordinate) 01656 ; of PLAYER1. Compare ZPOSHI ($0A40). See also "ON POSITION 01657 ; VECTORS". 01658 ; 01659 ; $0A42 PL2ZPOSHI 01660 ; 01661 ; High byte (B15..8) of position vector z-component (z-coordinate) 01662 ; of PLAYER2. Compare ZPOSHI ($0A40). See also "ON POSITION 01663 ; VECTORS". 01664 ; 01665 ; $0A43 PL3ZPOSHI 01666 ; 01667 ; High byte (B15..8) of position vector z-component (z-coordinate) 01668 ; of PLAYER3. Compare ZPOSHI ($0A40). See also "ON POSITION 01669 ; VECTORS". 01670 ; 01671 ; $0A44 PL4ZPOSHI 01672 ; 01673 ; High byte (B15..8) of position vector z-component (z-coordinate) 01674 ; of PLAYER4. Compare ZPOSHI ($0A40). See also "ON POSITION 01675 ; VECTORS". 01676 ; 01677 ; $0A71..$0AA1 XPOSHI 01678 ; 01679 ; Table containing the high byte (B15..8) of position vector 01680 ; x-components (x-coordinate) (49 bytes). Bytes 0..4 belong to 01681 ; position vectors of PLAYER space objects (Zylon ships, photon 01682 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01683 ; PLAYFIELD space objects (stars, explosion fragments). See also 01684 ; "ON POSITION VECTORS". 01685 ; 01686 ; $0A71 PL0XPOSHI 01687 ; 01688 ; High byte (B15..8) of position vector x-component (x-coordinate) 01689 ; of PLAYER0. Compare XPOSHI ($0A71). See also "ON POSITION 01690 ; VECTORS". 01691 ; 01692 ; $0A72 PL1XPOSHI 01693 ; 01694 ; High byte (B15..8) of position vector x-component (x-coordinate) 01695 ; of PLAYER1. Compare XPOSHI ($0A71). See also "ON POSITION 01696 ; VECTORS". 01697 ; 01698 ; $0A73 PL2XPOSHI 01699 ; 01700 ; High byte (B15..8) of position vector x-component (x-coordinate) 01701 ; of PLAYER2. Compare XPOSHI ($0A71). See also "ON POSITION 01702 ; VECTORS". 01703 ; 01704 ; $0A74 PL3XPOSHI 01705 ; 01706 ; High byte (B15..8) of position vector x-component (x-coordinate) 01707 ; of PLAYER3. Compare XPOSHI ($0A71). See also "ON POSITION 01708 ; VECTORS". 01709 ; 01710 ; $0A75 PL4XPOSHI 01711 ; 01712 ; High byte (B15..8) of position vector x-component (x-coordinate) 01713 ; of PLAYER4. Compare XPOSHI ($0A71). See also "ON POSITION 01714 ; VECTORS". 01715 ; 01716 ; $0AA2..$0AD2 YPOSHI 01717 ; 01718 ; Table containing the high byte (B15..8) of position vector 01719 ; y-components (y-coordinate) (49 bytes). Bytes 0..4 belong to 01720 ; position vectors of PLAYER space objects (Zylon ships, photon 01721 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01722 ; PLAYFIELD space objects (stars, explosion fragments). See also 01723 ; "ON POSITION VECTORS". 01724 ; 01725 ; $0AA2 PL0YPOSHI 01726 ; 01727 ; High byte (B15..8) of position vector y-component (y-coordinate) 01728 ; of PLAYER0. Compare YPOSHI ($0AA2). See also "ON POSITION 01729 ; VECTORS". 01730 ; 01731 ; $0AA3 PL1YPOSHI 01732 ; 01733 ; High byte (B15..8) of position vector y-component (y-coordinate) 01734 ; of PLAYER1. Compare YPOSHI ($0AA2). See also "ON POSITION 01735 ; VECTORS". 01736 ; 01737 ; $0AA4 PL2YPOSHI 01738 ; 01739 ; High byte (B15..8) of position vector y-component (y-coordinate) 01740 ; of PLAYER2. Compare YPOSHI ($0AA2). See also "ON POSITION 01741 ; VECTORS". 01742 ; 01743 ; $0AA5 PL3YPOSHI 01744 ; 01745 ; High byte (B15..8) of position vector y-component (y-coordinate) 01746 ; of PLAYER3. Compare YPOSHI ($0AA2). See also "ON POSITION 01747 ; VECTORS". 01748 ; 01749 ; $0AA6 PL4YPOSHI 01750 ; 01751 ; High byte (B15..8) of position vector y-component (y-coordinate) 01752 ; of PLAYER4. Compare YPOSHI ($0AA2). See also "ON POSITION 01753 ; VECTORS". 01754 ; 01755 ; $0AD3..$0B03 ZPOSLO 01756 ; 01757 ; Table containing the low byte (B7..0) of position vector 01758 ; z-components (z-coordinate) (49 bytes). Bytes 0..4 belong to 01759 ; position vectors of PLAYER space objects (Zylon ships, photon 01760 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01761 ; PLAYFIELD space objects (stars, explosion fragments). See also 01762 ; "ON POSITION VECTORS". 01763 ; 01764 ; $0AD3 PL0ZPOSLO 01765 ; 01766 ; Low byte (B7..0) of position vector z-component (z-coordinate) of 01767 ; PLAYER0. Compare ZPOSLO ($0AD3). See also "ON POSITION VECTORS". 01768 ; 01769 ; $0AD4 PL1ZPOSLO 01770 ; 01771 ; Low byte (B7..0) of position vector z-component (z-coordinate) of 01772 ; PLAYER1. Compare ZPOSLO ($0AD3). See also "ON POSITION VECTORS". 01773 ; 01774 ; $0AD5 PL2ZPOSLO 01775 ; 01776 ; Low byte (B7..0) of position vector z-component (z-coordinate) of 01777 ; PLAYER2. Compare ZPOSLO ($0AD3). See also "ON POSITION VECTORS". 01778 ; 01779 ; $0AD6 PL3ZPOSLO 01780 ; 01781 ; Low byte (B7..0) of position vector z-component (z-coordinate) of 01782 ; PLAYER3. Compare ZPOSLO ($0AD3). See also "ON POSITION VECTORS". 01783 ; 01784 ; $0AD7 PL4ZPOSLO 01785 ; 01786 ; Low byte (B7..0) of position vector z-component (z-coordinate) of 01787 ; PLAYER4. Compare ZPOSLO ($0AD3). See also "ON POSITION VECTORS". 01788 ; 01789 ; $0B04..$0B34 XPOSLO 01790 ; 01791 ; Table containing the low byte (B7..0) of position vector 01792 ; x-components (x-coordinate) (49 bytes). Bytes 0..4 belong to 01793 ; position vectors of PLAYER space objects (Zylon ships, photon 01794 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01795 ; PLAYFIELD space objects (stars, explosion fragments). See also 01796 ; "ON POSITION VECTORS". 01797 ; 01798 ; $0B04 PL0XPOSLO 01799 ; 01800 ; Low byte (B7..0) of position vector x-component (x-coordinate) of 01801 ; PLAYER0. Compare XPOSLO ($0B04). See also "ON POSITION VECTORS". 01802 ; 01803 ; $0B05 PL1XPOSLO 01804 ; 01805 ; Low byte (B7..0) of position vector x-component (x-coordinate) of 01806 ; PLAYER1. Compare XPOSLO ($0B04). See also "ON POSITION VECTORS". 01807 ; 01808 ; $0B06 PL2XPOSLO 01809 ; 01810 ; Low byte (B7..0) of position vector x-component (x-coordinate) of 01811 ; PLAYER2. Compare XPOSLO ($0B04). See also "ON POSITION VECTORS". 01812 ; 01813 ; $0B07 PL3XPOSLO 01814 ; 01815 ; Low byte (B7..0) of position vector x-component (x-coordinate) of 01816 ; PLAYER3. Compare XPOSLO ($0B04). See also "ON POSITION VECTORS". 01817 ; 01818 ; $0B08 PL4XPOSLO 01819 ; 01820 ; Low byte (B7..0) of position vector x-component (x-coordinate) of 01821 ; PLAYER4. Compare XPOSLO ($0B04). See also "ON POSITION VECTORS". 01822 ; 01823 ; $0B35..$0B65 YPOSLO 01824 ; 01825 ; Table containing the low byte (B7..0) of position vector 01826 ; y-components (y-coordinate) (49 bytes). Bytes 0..4 belong to 01827 ; position vectors of PLAYER space objects (Zylon ships, photon 01828 ; torpedoes, etc.). Bytes 5..48 belong to position vectors of 01829 ; PLAYFIELD space objects (stars, explosion fragments). See also 01830 ; "ON POSITION VECTORS". 01831 ; 01832 ; $0B35 PL0YPOSLO 01833 ; 01834 ; Low byte (B7..0) of position vector y-component (y-coordinate) of 01835 ; PLAYER0. Compare YPOSLO ($0B35). See also "ON POSITION VECTORS". 01836 ; 01837 ; $0B36 PL1YPOSLO 01838 ; 01839 ; Low byte (B7..0) of position vector y-component (y-coordinate) of 01840 ; PLAYER1. Compare YPOSLO ($0B35). See also "ON POSITION VECTORS". 01841 ; 01842 ; $0B37 PL2YPOSLO 01843 ; 01844 ; Low byte (B7..0) of position vector y-component (y-coordinate) of 01845 ; PLAYER2. Compare YPOSLO ($0B35). See also "ON POSITION VECTORS". 01846 ; 01847 ; $0B38 PL3YPOSLO 01848 ; 01849 ; Low byte (B7..0) of position vector y-component (y-coordinate) of 01850 ; PLAYER3. Compare YPOSLO ($0B35). See also "ON POSITION VECTORS". 01851 ; 01852 ; $0B39 PL4YPOSLO 01853 ; 01854 ; Low byte (B7..0) of position vector y-component (y-coordinate) of 01855 ; PLAYER4. Compare YPOSLO ($0B35). See also "ON POSITION VECTORS". 01856 ; 01857 ; $0B66..$0B96 ZVEL 01858 ; 01859 ; Table containing velocity vector z-components (z-velocities) (49 01860 ; bytes). Bytes 0..4 belong to velocity vectors of PLAYER space 01861 ; objects (Zylon ships, photon torpedoes, etc.). Bytes 5..48 belong 01862 ; to velocity vectors of PLAYFIELD space objects (stars, explosion 01863 ; fragments). Each z-velocity is stored in the binary format 01864 ; %sxxxxxxx where 01865 ; %s = 0 -> Positive sign (moving in flight direction) 01866 ; %s = 1 -> Negative sign (moving in reverse flight direction) 01867 ; %xxxxxxx -> Unsigned 7-bit velocity value in <KM/H> 01868 ; 01869 ; See also "ON VELOCITY VECTORS". 01870 ; 01871 ; $0B66 PL0ZVEL 01872 ; 01873 ; Velocity vector z-component (z-velocity) of PLAYER0. Compare ZVEL 01874 ; ($0B66). See also "ON VELOCITY VECTORS". 01875 ; 01876 ; $0B67 PL1ZVEL 01877 ; 01878 ; Velocity vector z-component (z-velocity) of PLAYER1. Compare ZVEL 01879 ; ($0B66). See also "ON VELOCITY VECTORS". 01880 ; 01881 ; $0B68 PL2ZVEL 01882 ; 01883 ; Velocity vector z-component (z-velocity) of PLAYER2. Compare ZVEL 01884 ; ($0B66). See also "ON VELOCITY VECTORS". 01885 ; 01886 ; $0B69 PL3ZVEL 01887 ; 01888 ; Velocity vector z-component (z-velocity) of PLAYER3. Compare ZVEL 01889 ; ($0B66). See also "ON VELOCITY VECTORS". 01890 ; 01891 ; $0B6A PL4ZVEL 01892 ; 01893 ; Velocity vector z-component (z-velocity) of PLAYER4. Compare ZVEL 01894 ; ($0B66). See also "ON VELOCITY VECTORS". 01895 ; 01896 ; $0B97..$0BC7 XVEL 01897 ; 01898 ; Table containing velocity vector x-components (x-velocities) (49 01899 ; bytes). Bytes 0..4 belong to velocity vectors of PLAYER space 01900 ; objects (Zylon ships, photon torpedoes, etc.). Bytes 5..48 belong 01901 ; to velocity vectors of PLAYFIELD space objects (stars, explosion 01902 ; fragments). Each x-velocity is stored in the binary format 01903 ; %sxxxxxxx where 01904 ; %s = 0 -> Positive sign (moving to the right) 01905 ; %s = 1 -> Negative sign (moving to the left) 01906 ; %xxxxxxx -> Unsigned 7-bit velocity value in <KM/H> 01907 ; 01908 ; See also "ON VELOCITY VECTORS". 01909 ; 01910 ; $0B97 PL0XVEL 01911 ; 01912 ; Velocity vector x-component (x-velocity) of PLAYER0. Compare XVEL 01913 ; ($0B97). See also "ON VELOCITY VECTORS". 01914 ; 01915 ; $0B98 PL1XVEL 01916 ; 01917 ; Velocity vector x-component (x-velocity) of PLAYER1. Compare XVEL 01918 ; ($0B97). See also "ON VELOCITY VECTORS". 01919 ; 01920 ; $0B99 PL2XVEL 01921 ; 01922 ; Velocity vector x-component (x-velocity) of PLAYER2. Compare XVEL 01923 ; ($0B97). See also "ON VELOCITY VECTORS". 01924 ; 01925 ; $0B9A PL3XVEL 01926 ; 01927 ; Velocity vector x-component (x-velocity) of PLAYER3. Compare XVEL 01928 ; ($0B97). See also "ON VELOCITY VECTORS". 01929 ; 01930 ; $0B9B PL4XVEL 01931 ; 01932 ; Velocity vector x-component (x-velocity) of PLAYER4. Compare XVEL 01933 ; ($0B97). See also "ON VELOCITY VECTORS". 01934 ; 01935 ; $0BC8..$0BF8 YVEL 01936 ; 01937 ; Table containing velocity vector y-components (y-velocities) (49 01938 ; bytes). Bytes 0..4 belong to velocity vectors of PLAYER space 01939 ; objects (Zylon ships, photon torpedoes, etc.). Bytes 5..48 belong 01940 ; to velocity vectors of PLAYFIELD space objects (stars, explosion 01941 ; fragments). Each y-velocity is stored in the binary format 01942 ; %sxxxxxxx where 01943 ; %s = 0 -> Positive sign (moving up) 01944 ; %s = 1 -> Negative sign (moving down) 01945 ; %xxxxxxx -> Unsigned 7-bit velocity value in <KM/H> 01946 ; 01947 ; See also "ON VELOCITY VECTORS". 01948 ; 01949 ; $0BC8 PL0YVEL 01950 ; 01951 ; Velocity vector y-component (y-velocity) of PLAYER0. Compare YVEL 01952 ; ($0BC8). See also "ON VELOCITY VECTORS". 01953 ; 01954 ; $0BC9 PL1YVEL 01955 ; 01956 ; Velocity vector y-component (y-velocity) of PLAYER1. Compare YVEL 01957 ; ($0BC8). See also "ON VELOCITY VECTORS". 01958 ; 01959 ; $0BCA PL2YVEL 01960 ; 01961 ; Velocity vector y-component (y-velocity) of PLAYER2. Compare YVEL 01962 ; ($0BC8). See also "ON VELOCITY VECTORS". 01963 ; 01964 ; $0BCB PL3YVEL 01965 ; 01966 ; Velocity vector y-component (y-velocity) of PLAYER3. Compare YVEL 01967 ; ($0BC8). See also "ON VELOCITY VECTORS". 01968 ; 01969 ; $0BCC PL4YVEL 01970 ; 01971 ; Velocity vector y-component (y-velocity) of PLAYER4. Compare YVEL 01972 ; ($0BC8). See also "ON VELOCITY VECTORS". 01973 ; 01974 ; $0BF9..$0C29 PIXELROWNEW 01975 ; 01976 ; Table containing the new pixel row number of space objects (49 01977 ; bytes). Bytes 0..4 belong to PLAYER space objects and contain 01978 ; Player/Missile (PM) pixel row numbers. They are counted from 01979 ; vertical PM position 0, which is offscreen. Bytes 5..48 belong to 01980 ; PLAYFIELD space objects (stars, explosion fragments) and contain 01981 ; PLAYFIELD pixel row numbers. They are counted from the top border 01982 ; of the PLAYFIELD and have values of 0..99. 01983 ; 01984 ; $0BF9 PL0ROWNEW 01985 ; 01986 ; New pixel row number of PLAYER0 in Player/Missile pixels. See 01987 ; also PIXELROWNEW ($0BF9). 01988 ; 01989 ; $0BFA PL1ROWNEW 01990 ; 01991 ; New pixel row number of PLAYER1 in Player/Missile pixels. See 01992 ; also PIXELROWNEW ($0BF9). 01993 ; 01994 ; $0BFB PL2ROWNEW 01995 ; 01996 ; New pixel row number of PLAYER2 in Player/Missile pixels. See 01997 ; also PIXELROWNEW ($0BF9). 01998 ; 01999 ; $0BFC PL3ROWNEW 02000 ; 02001 ; New pixel row number of PLAYER3 in Player/Missile pixels. See 02002 ; also PIXELROWNEW ($0BF9). 02003 ; 02004 ; $0BFD PL4ROWNEW 02005 ; 02006 ; New pixel row number of PLAYER4 in Player/Missile pixels. See 02007 ; also PIXELROWNEW ($0BF9). 02008 ; 02009 ; $0C2A..$0C5A PIXELCOLUMN 02010 ; 02011 ; Table containing the pixel column number of space objects (49 02012 ; bytes). Bytes 0..4 belong to PLAYER space objects and contain 02013 ; Player/Missile (PM) pixel column numbers. They are counted from 02014 ; horizontal PM position 0, which is offscreen. Bytes 5..48 belong 02015 ; to PLAYFIELD space objects (stars, explosion fragments) and 02016 ; contain PLAYFIELD pixel column numbers. They are counted from the 02017 ; left border of the PLAYFIELD and have values of 0..159. 02018 ; 02019 ; $0C2A PL0COLUMN 02020 ; 02021 ; Pixel column number of PLAYER0 in Player/Missile pixels. See also 02022 ; PIXELCOLUMN ($0C2A). 02023 ; 02024 ; $0C2B PL1COLUMN 02025 ; 02026 ; Pixel column number of PLAYER1 in Player/Missile pixels. See also 02027 ; PIXELCOLUMN ($0C2A). 02028 ; 02029 ; $0C2C PL2COLUMN 02030 ; 02031 ; Pixel column number of PLAYER2 in Player/Missile pixels. See also 02032 ; PIXELCOLUMN ($0C2A). 02033 ; 02034 ; $0C2D PL3COLUMN 02035 ; 02036 ; Pixel column number of PLAYER3 in Player/Missile pixels. See also 02037 ; PIXELCOLUMN ($0C2A). 02038 ; 02039 ; $0C2E PL4COLUMN 02040 ; 02041 ; Pixel column number of PLAYER4 in Player/Missile pixels. See also 02042 ; PIXELCOLUMN ($0C2A). 02043 ; 02044 ; $0C5B..$0C8B PIXELROW 02045 ; 02046 ; Table containing the pixel row number of space objects (49 02047 ; bytes). Bytes 0..4 belong to PLAYER space objects and contain 02048 ; Player/Missile (PM) pixel row numbers. They are counted from 02049 ; vertical PM position 0, which is offscreen. Bytes 5..48 belong to 02050 ; PLAYFIELD space objects (stars, explosion fragments) and contain 02051 ; PLAYFIELD pixel row numbers. They are counted from the top border 02052 ; of the PLAYFIELD and have values of 0..99. 02053 ; 02054 ; $0C5B PL0ROW 02055 ; 02056 ; Pixel row number of PLAYER0 in Player/Missile pixels. See also 02057 ; PIXELROW ($0C5B). 02058 ; 02059 ; $0C5C PL1ROW 02060 ; 02061 ; Pixel row number of PLAYER1 in Player/Missile pixels. See also 02062 ; PIXELROW ($0C5B). 02063 ; 02064 ; $0C5D PL2ROW 02065 ; 02066 ; Pixel row number of PLAYER2 in Player/Missile pixels. See also 02067 ; PIXELROW ($0C5B). 02068 ; 02069 ; $0C5E PL3ROW 02070 ; 02071 ; Pixel row number of PLAYER3 in Player/Missile pixels. See also 02072 ; PIXELROW ($0C5B). 02073 ; 02074 ; $0C5F PL4ROW 02075 ; 02076 ; Pixel row number of PLAYER4 in Player/Missile pixels. See also 02077 ; PIXELROW ($0C5B). 02078 ; 02079 ; $0C8C..$0CBC PIXELBYTEOFF 02080 ; 02081 ; Table containing a byte offset into PLAYFIELD memory for each 02082 ; PLAYFIELD space object (stars, explosion fragments) (49 bytes): 02083 ; the number of bytes from the start of the PLAYFIELD row to the 02084 ; byte containing the space object pixel in the same PLAYFIELD row. 02085 ; In other words, the pixel column modulo 4 (1 byte = 4 GRAPHICS7 02086 ; pixels). 02087 ; 02088 ; NOTE: Only bytes 5..48 are used for PLAYFIELD space objects in 02089 ; this way. Bytes 0..4 are used differently. See PL0SHAPTYPE 02090 ; ($0C8C)..PL4SHAPTYPE ($0C90). 02091 ; 02092 ; $0C8C PL0SHAPTYPE 02093 ; 02094 ; Shape type of PLAYER0. Used to index the PLAYER's set of shape 02095 ; cells in tables PLSHAPOFFTAB ($BE2F) and PLSHPHEIGHTTAB ($BE7F). 02096 ; Used values are: 02097 ; $00 -> PHOTON TORPEDO 02098 ; $10 -> ZYLON FIGHTER 02099 ; $20 -> STARBASE RIGHT 02100 ; $30 -> STARBASE CENTER 02101 ; $40 -> STARBASE LEFT 02102 ; $50 -> TRANSFER VESSEL 02103 ; $60 -> METEOR 02104 ; $70 -> ZYLON CRUISER 02105 ; $80 -> ZYLON BASESTAR 02106 ; $90 -> HYPERWARP TARGET MARKER 02107 ; 02108 ; $0C8D PL1SHAPTYPE 02109 ; 02110 ; Shape type of PLAYER1. Compare PL0SHAPTYPE ($0C8C). 02111 ; 02112 ; $0C8E PL2SHAPTYPE 02113 ; 02114 ; Shape type of PLAYER2. Compare PL0SHAPTYPE ($0C8C). 02115 ; 02116 ; $0C8F PL3SHAPTYPE 02117 ; 02118 ; Shape type of PLAYER3. Compare PL0SHAPTYPE ($0C8C). 02119 ; 02120 ; $0C90 PL4SHAPTYPE 02121 ; 02122 ; Shape type of PLAYER4. Compare PL0SHAPTYPE ($0C8C). 02123 ; 02124 ; $0CBD..$0CED PIXELSAVE 02125 ; 02126 ; Table containing the byte of PLAYFIELD memory before drawing the 02127 ; PLAYFIELD space object pixel into it (star, explosion fragments), 02128 ; for each PLAYFIELD space object (49 bytes). 02129 ; 02130 ; NOTE: Only bytes 5..48 are used for PLAYFIELD space objects in 02131 ; this way. Bytes 0..4 are used differently. See PL0HEIGHT 02132 ; ($0CBD)..PL4HEIGHT ($0CC1). 02133 ; 02134 ; $0CBD PL0HEIGHT 02135 ; 02136 ; Shape height of PLAYER0 02137 ; 02138 ; $0CBE PL1HEIGHT 02139 ; 02140 ; Shape height of PLAYER1 02141 ; 02142 ; $0CBF PL2HEIGHT 02143 ; 02144 ; Shape height of PLAYER2 02145 ; 02146 ; $0CC0 PL3HEIGHT 02147 ; 02148 ; Shape height of PLAYER3 02149 ; 02150 ; $0CC1 PL4HEIGHT 02151 ; 02152 ; Shape height of PLAYER4 02153 ; 02154 ; $0CEE..$0D1E PIXELBYTE 02155 ; 02156 ; Table containing a 1-byte bit pattern for 4 pixels in the color 02157 ; of the space object's pixel, for each PLAYFIELD space object (49 02158 ; bytes). 02159 ; 02160 ; NOTE: Only bytes 5..48 are used for PLAYFIELD space objects in 02161 ; this way. Bytes 0..4 are used differently. See PL0HEIGHTNEW 02162 ; ($0CEE)..PL4HEIGHTNEW ($0CF2). 02163 ; 02164 ; $0CEE PL0HEIGHTNEW 02165 ; 02166 ; New shape height of PLAYER0 02167 ; 02168 ; $0CEF PL1HEIGHTNEW 02169 ; 02170 ; New shape height of PLAYER1 02171 ; 02172 ; $0CF0 PL2HEIGHTNEW 02173 ; 02174 ; New shape height of PLAYER2 02175 ; 02176 ; $0CF1 PL3HEIGHTNEW 02177 ; 02178 ; New shape height of PLAYER3 02179 ; 02180 ; $0CF2 PL4HEIGHTNEW 02181 ; 02182 ; New shape height of PLAYER4 02183 ; 02184 ; $0D1F..$0D32 TITLETXT 02185 ; 02186 ; Title text line, contains ATASCII-coded characters (20 bytes) 02187 ; 02188 ; $0D35..$0DE8 GCPFMEM 02189 ; 02190 ; Galactic Chart PLAYFIELD memory (20 characters x 9 rows = 180 02191 ; bytes) 02192 ; 02193 ; $0DE9..$0EE8 MAPTO80 02194 ; 02195 ; Lookup table to convert values in $00..$FF to values of 0..80 02196 ; (255 bytes). Used to map position vector components (coordinates) 02197 ; to pixel row or column numbers relative to the PLAYFIELD center. 02198 ; 02199 ; $0EE9..$0FE8 MAPTOBCD99 02200 ; 02201 ; Lookup table to convert values in $00..$FF to BCD-values of 02202 ; 00..99 (255 bytes). Used in subroutines UPDPANEL ($B804) and 02203 ; SHOWDIGITS ($B8CD) to convert values to a 2-digit decimal readout 02204 ; value of the Control Panel Display. 02205 ; 02206 ; $1000..$1F77 PFMEM 02207 ; 02208 ; PLAYFIELD graphics memory (40 bytes x 100 rows = 4000 bytes, 1 02209 ; byte stores 4 pixels, 40 bytes = 160 pixels in GRAPHICS7 mode = 1 02210 ; PLAYFIELD row of pixels). 02211 ; 02212 ; NOTE: The Display List displays only PLAYFIELD rows 0..98. 02213 02214 ;******************************************************************************* 02215 ;* * 02216 ;* S Y S T E M S Y M B O L S * 02217 ;* * 02218 ;******************************************************************************* 02219 =0200 02220 VDSLST = $0200 ; Display List Interrupt (DLI) vector =0216 02221 VIMIRQ = $0216 ; Interrupt request (IRQ) immediate vector =0222 02222 VVBLKI = $0222 ; Vertical blank immediate vector =D000 02223 HPOSP0 = $D000 ; Horizontal position of PLAYER0 =D001 02224 HPOSP1 = $D001 ; Horizontal position of PLAYER1 =D002 02225 HPOSP2 = $D002 ; Horizontal position of PLAYER2 =D003 02226 HPOSP3 = $D003 ; Horizontal position of PLAYER3 =D004 02227 HPOSM0 = $D004 ; Horizontal position of MISSILE0 =D005 02228 HPOSM1 = $D005 ; Horizontal position of MISSILE1 =D006 02229 HPOSM2 = $D006 ; Horizontal position of MISSILE2 =D007 02230 HPOSM3 = $D007 ; Horizontal position of MISSILE3 =D008 02231 M0PL = $D008 ; MISSILE0 to PLAYER collisions =D009 02232 M1PL = $D009 ; MISSILE1 to PLAYER collisions =D00A 02233 M2PL = $D00A ; MISSILE2 to PLAYER collisions =D00B 02234 M3PL = $D00B ; MISSILE3 to PLAYER collisions =D00F 02235 P3PL = $D00F ; PLAYER3 to PLAYER collisions =D010 02236 TRIG0 = $D010 ; Joystick 0 trigger =D012 02237 COLPM0 = $D012 ; Color and brightness of PLAYER0 =D016 02238 COLPF0 = $D016 ; Color and brightness of PLAYFIELD0 =D01B 02239 PRIOR = $D01B ; Priority selection register =D01D 02240 GRACTL = $D01D ; Graphics control register =D01E 02241 HITCLR = $D01E ; Clear collision register =D01F 02242 CONSOL = $D01F ; Function keys register =D200 02243 AUDF1 = $D200 ; Audio channel 1 frequency =D202 02244 AUDF2 = $D202 ; Audio channel 2 frequency =D203 02245 AUDC2 = $D203 ; Audio channel 2 control =D204 02246 AUDF3 = $D204 ; Audio channel 3 frequency =D205 02247 AUDC3 = $D205 ; Audio channel 3 control =D206 02248 AUDF4 = $D206 ; Audio channel 4 frequency =D207 02249 AUDC4 = $D207 ; Audio channel 4 control =D208 02250 AUDCTL = $D208 ; Audio control =D209 02251 KBCODE = $D209 ; Keyboard code =D209 02252 STIMER = $D209 ; Start POKEY timers =D20A 02253 RANDOM = $D20A ; Random number generator =D20E 02254 IRQEN = $D20E ; Interrupt request (IRQ) enable =D20F 02255 SKCTL = $D20F ; Serial port control =D300 02256 PORTA = $D300 ; Port A =D302 02257 PACTL = $D302 ; Port A control =D400 02258 DMACTL = $D400 ; Direct Memory Access (DMA) control =D402 02259 DLIST = $D402 ; Display List pointer =D407 02260 PMBASE = $D407 ; Player/Missile base address (high byte) =D409 02261 CHBASE = $D409 ; Character set base address (high byte) =D40A 02262 WSYNC = $D40A ; Wait for horizontal synchronization =D40B 02263 VCOUNT = $D40B ; Vertical line counter =D40E 02264 NMIEN = $D40E ; Non-maskable interrupt (NMI) enable =E000 02265 ROMCHARSET = $E000 ; ROM character set 02266 02267 ;******************************************************************************* 02268 ;* * 02269 ;* G A M E S Y M B O L S * 02270 ;* * 02271 ;******************************************************************************* 02272 =0062 02273 MISSIONLEVEL = $62 =0063 02274 FKEYCODE = $63 =0064 02275 ISDEMOMODE = $64 =0065 02276 NEWTITLEPHR = $65 =0066 02277 IDLECNTHI = $66 =0067 02278 ISVBISYNC = $67 =0068 02279 MEMPTR = $68 02280 =006A 02281 DIVIDEND = $6A =006D 02282 JOYSTICKDELTA = $6D 02283 02284 =0070 02285 VELOCITYLO = $70 =0071 02286 NEWVELOCITY = $71 =0072 02287 COUNT8 = $72 =0073 02288 EXPLLIFE = $73 =0074 02289 CLOCKTIM = $74 =0075 02290 DOCKSTATE = $75 =0076 02291 COUNT256 = $76 =0077 02292 IDLECNTLO = $77 =0078 02293 ZYLONUNITTIM = $78 =0079 02294 MAXSPCOBJIND = $79 =007A 02295 SAVMAXSPCOBJIND = $7A =007B 02296 ISSTARBASESECT = $7B =007C 02297 ISTRACKCOMPON = $7C =007D 02298 ISSHIELDSON = $7D =007E 02299 ISATTCOMPON = $7E =007F 02300 ENERGYCNT = $7F =0080 02301 DRAINRATE = $80 =0081 02302 SHIELDSCOLOR = $81 =0082 02303 PL3HIT = $82 =0083 02304 PL4HIT = $83 =0084 02305 OLDTRIG0 = $84 02306 =0086 02307 ISTRACKING = $86 =0087 02308 BARRELNR = $87 =0088 02309 LOCKONLIFE = $88 =0089 02310 PLTRACKED = $89 =008A 02311 HITBADNESS = $8A =008B 02312 REDALERTLIFE = $8B =008C 02313 WARPDEPRROW = $8C =008D 02314 WARPDEPRCOLUMN = $8D =008E 02315 WARPARRVROW = $8E =008F 02316 WARPARRVCOLUMN = $8F =0090 02317 CURRSECTOR = $90 =0091 02318 WARPENERGY = $91 =0092 02319 ARRVSECTOR = $92 =0093 02320 HUNTSECTOR = $93 =0094 02321 HUNTSECTCOLUMN = $94 =0095 02322 HUNTSECTROW = $95 =0096 02323 NEWZYLONDIST = $96 =009E 02324 OLDZYLONDIST = $9E =009F 02325 HUNTTIM = $9F =00A0 02326 BLIPCOLUMN = $A0 =00A1 02327 BLIPROW = $A1 =00A2 02328 BLIPCYCLECNT = $A2 =00A3 02329 ISINLOCKON = $A3 =00A4 02330 DIRLEN = $A4 =00A5 02331 PENROW = $A5 =00A6 02332 PENCOLUMN = $A6 =00A7 02333 CTRLDZYLON = $A7 =00A8 02334 ZYLONFLPAT0 = $A8 =00A9 02335 ZYLONFLPAT1 = $A9 =00AA 02336 MILESTTIM0 = $AA =00AB 02337 MILESTTIM1 = $AB =00AC 02338 MILESTVELINDZ0 = $AC =00AD 02339 MILESTVELINDZ1 = $AD =00AE 02340 MILESTVELINDX0 = $AE =00AF 02341 MILESTVELINDX1 = $AF =00B0 02342 MILESTVELINDY0 = $B0 =00B1 02343 MILESTVELINDY1 = $B1 =00B2 02344 ZYLONVELINDZ0 = $B2 =00B3 02345 ZYLONVELINDZ1 = $B3 =00B4 02346 ZYLONVELINDX0 = $B4 =00B5 02347 ZYLONVELINDX1 = $B5 =00B6 02348 ZYLONVELINDY0 = $B6 =00B7 02349 ZYLONVELINDY1 = $B7 =00B8 02350 ISBACKATTACK0 = $B8 =00B9 02351 ISBACKATTACK1 = $B9 =00BA 02352 ZYLONTIMX0 = $BA =00BB 02353 ZYLONTIMX1 = $BB =00BC 02354 ZYLONTIMY0 = $BC =00BD 02355 ZYLONTIMY1 = $BD =00BE 02356 TORPEDODELAY = $BE =00BF 02357 ZYLONATTACKER = $BF =00C0 02358 WARPSTATE = $C0 =00C1 02359 VELOCITYHI = $C1 =00C2 02360 TRAILDELAY = $C2 =00C3 02361 TRAILIND = $C3 =00C4 02362 WARPTEMPCOLUMN = $C4 =00C5 02363 WARPTEMPROW = $C5 =00C6 02364 VEERMASK = $C6 =00C7 02365 VICINITYMASK = $C7 =00C8 02366 JOYSTICKX = $C8 =00C9 02367 JOYSTICKY = $C9 =00CA 02368 KEYCODE = $CA =00CB 02369 SCORE = $CB =00CD 02370 SCOREDRANKIND = $CD =00CE 02371 SCOREDCLASSIND = $CE =00CF 02372 TITLELIFE = $CF =00D0 02373 SHIPVIEW = $D0 =00D1 02374 TITLEPHR = $D1 =00D2 02375 BEEPFRQIND = $D2 =00D3 02376 BEEPREPEAT = $D3 =00D4 02377 BEEPTONELIFE = $D4 =00D5 02378 BEEPPAUSELIFE = $D5 =00D6 02379 BEEPPRIORITY = $D6 =00D7 02380 BEEPFRQSTART = $D7 =00D8 02381 BEEPLIFE = $D8 =00D9 02382 BEEPTOGGLE = $D9 =00DA 02383 NOISETORPTIM = $DA =00DB 02384 NOISEEXPLTIM = $DB =00DC 02385 NOISEAUDC2 = $DC =00DD 02386 NOISEAUDC3 = $DD =00DE 02387 NOISEAUDF1 = $DE =00DF 02388 NOISEAUDF2 = $DF =00E0 02389 NOISEFRQINC = $E0 =00E1 02390 NOISELIFE = $E1 =00E2 02391 NOISEZYLONTIM = $E2 =00E3 02392 NOISEHITLIFE = $E3 =00E4 02393 PL0SHAPOFF = $E4 =00E5 02394 PL1SHAPOFF = $E5 =00E6 02395 PL2SHAPOFF = $E6 =00E7 02396 PL3SHAPOFF = $E7 =00E8 02397 PL4SHAPOFF = $E8 =00E9 02398 PL0LIFE = $E9 =00EA 02399 PL1LIFE = $EA =00EB 02400 PL2LIFE = $EB =00EC 02401 PL3LIFE = $EC =00ED 02402 PL4LIFE = $ED =00EE 02403 PL0COLOR = $EE =00EF 02404 PL1COLOR = $EF =00F0 02405 PL2COLOR = $F0 =00F1 02406 PL3COLOR = $F1 =00F2 02407 PF0COLOR = $F2 =00F3 02408 PF1COLOR = $F3 =00F4 02409 PF2COLOR = $F4 =00F5 02410 PF3COLOR = $F5 =00F6 02411 BGRCOLOR = $F6 =00F7 02412 PF0COLORDLI = $F7 =00F8 02413 PF1COLORDLI = $F8 =00F9 02414 PF2COLORDLI = $F9 =00FA 02415 PF3COLORDLI = $FA =00FB 02416 BGRCOLORDLI = $FB =0280 02417 DSPLST = $0280 =0300 02418 PL4DATA = $0300 =0400 02419 PL0DATA = $0400 =0500 02420 PL1DATA = $0500 =0600 02421 PL2DATA = $0600 =0700 02422 PL3DATA = $0700 =0800 02423 PFMEMROWLO = $0800 =0864 02424 PFMEMROWHI = $0864 =08C9 02425 GCMEMMAP = $08C9 =0949 02426 PANELTXT = $0949 =094B 02427 VELOCD1 = $094B =0950 02428 KILLCNTD1 = $0950 =0955 02429 ENERGYD1 = $0955 =095A 02430 TRACKC1 = $095A =095C 02431 TRACKDIGIT = $095C =0960 02432 THETAC1 = $0960 =0966 02433 PHIC1 = $0966 =096C 02434 RANGEC1 = $096C =0971 02435 GCTXT = $0971 =097D 02436 GCWARPD1 = $097D =098D 02437 GCTRGCNT = $098D =0992 02438 GCSTATPHO = $0992 =0993 02439 GCSTATENG = $0993 =0994 02440 GCSTATSHL = $0994 =0995 02441 GCSTATCOM = $0995 =0996 02442 GCSTATLRS = $0996 =0997 02443 GCSTATRAD = $0997 =09A3 02444 GCSTARDAT = $09A3 =09AD 02445 ZPOSSIGN = $09AD =09AF 02446 PL2ZPOSSIGN = $09AF =09B0 02447 PL3ZPOSSIGN = $09B0 =09B1 02448 PL4ZPOSSIGN = $09B1 =09DE 02449 XPOSSIGN = $09DE =09E0 02450 PL2XPOSSIGN = $09E0 =09E1 02451 PL3XPOSSIGN = $09E1 =09E2 02452 PL4XPOSSIGN = $09E2 =0A0F 02453 YPOSSIGN = $0A0F =0A11 02454 PL2YPOSSIGN = $0A11 =0A12 02455 PL3YPOSSIGN = $0A12 =0A13 02456 PL4YPOSSIGN = $0A13 =0A40 02457 ZPOSHI = $0A40 =0A40 02458 PL0ZPOSHI = $0A40 =0A42 02459 PL2ZPOSHI = $0A42 =0A43 02460 PL3ZPOSHI = $0A43 =0A44 02461 PL4ZPOSHI = $0A44 =0A71 02462 XPOSHI = $0A71 =0A73 02463 PL2XPOSHI = $0A73 =0A74 02464 PL3XPOSHI = $0A74 =0A75 02465 PL4XPOSHI = $0A75 =0AA2 02466 YPOSHI = $0AA2 =0AA4 02467 PL2YPOSHI = $0AA4 =0AA5 02468 PL3YPOSHI = $0AA5 =0AA6 02469 PL4YPOSHI = $0AA6 =0AD3 02470 ZPOSLO = $0AD3 =0AD5 02471 PL2ZPOSLO = $0AD5 =0AD6 02472 PL3ZPOSLO = $0AD6 =0AD7 02473 PL4ZPOSLO = $0AD7 =0B04 02474 XPOSLO = $0B04 =0B06 02475 PL2XPOSLO = $0B06 =0B07 02476 PL3XPOSLO = $0B07 =0B08 02477 PL4XPOSLO = $0B08 =0B35 02478 YPOSLO = $0B35 =0B37 02479 PL2YPOSLO = $0B37 =0B38 02480 PL3YPOSLO = $0B38 =0B39 02481 PL4YPOSLO = $0B39 =0B66 02482 ZVEL = $0B66 =0B66 02483 PL0ZVEL = $0B66 =0B67 02484 PL1ZVEL = $0B67 =0B68 02485 PL2ZVEL = $0B68 =0B69 02486 PL3ZVEL = $0B69 =0B6A 02487 PL4ZVEL = $0B6A =0B97 02488 XVEL = $0B97 =0B97 02489 PL0XVEL = $0B97 =0B98 02490 PL1XVEL = $0B98 =0B99 02491 PL2XVEL = $0B99 =0B9A 02492 PL3XVEL = $0B9A =0B9B 02493 PL4XVEL = $0B9B =0BC8 02494 YVEL = $0BC8 =0BC8 02495 PL0YVEL = $0BC8 =0BC9 02496 PL1YVEL = $0BC9 =0BCA 02497 PL2YVEL = $0BCA =0BCB 02498 PL3YVEL = $0BCB =0BCC 02499 PL4YVEL = $0BCC =0BF9 02500 PIXELROWNEW = $0BF9 =0BF9 02501 PL0ROWNEW = $0BF9 =0BFA 02502 PL1ROWNEW = $0BFA =0BFB 02503 PL2ROWNEW = $0BFB =0BFC 02504 PL3ROWNEW = $0BFC =0BFD 02505 PL4ROWNEW = $0BFD =0C2A 02506 PIXELCOLUMN = $0C2A =0C2A 02507 PL0COLUMN = $0C2A =0C2B 02508 PL1COLUMN = $0C2B =0C2C 02509 PL2COLUMN = $0C2C =0C2D 02510 PL3COLUMN = $0C2D =0C2E 02511 PL4COLUMN = $0C2E =0C5B 02512 PIXELROW = $0C5B =0C5B 02513 PL0ROW = $0C5B =0C5C 02514 PL1ROW = $0C5C =0C5D 02515 PL2ROW = $0C5D =0C5E 02516 PL3ROW = $0C5E =0C5F 02517 PL4ROW = $0C5F =0C8C 02518 PIXELBYTEOFF = $0C8C =0C8C 02519 PL0SHAPTYPE = $0C8C =0C8D 02520 PL1SHAPTYPE = $0C8D =0C8E 02521 PL2SHAPTYPE = $0C8E =0C8F 02522 PL3SHAPTYPE = $0C8F =0C90 02523 PL4SHAPTYPE = $0C90 =0CBD 02524 PIXELSAVE = $0CBD =0CBD 02525 PL0HEIGHT = $0CBD =0CBE 02526 PL1HEIGHT = $0CBE =0CBF 02527 PL2HEIGHT = $0CBF =0CC0 02528 PL3HEIGHT = $0CC0 =0CC1 02529 PL4HEIGHT = $0CC1 =0CEE 02530 PIXELBYTE = $0CEE =0CEE 02531 PL0HEIGHTNEW = $0CEE =0CEF 02532 PL1HEIGHTNEW = $0CEF =0CF0 02533 PL2HEIGHTNEW = $0CF0 =0CF1 02534 PL3HEIGHTNEW = $0CF1 =0CF2 02535 PL4HEIGHTNEW = $0CF2 =0D1F 02536 TITLETXT = $0D1F =0D35 02537 GCPFMEM = $0D35 =0DE9 02538 MAPTO80 = $0DE9 =0EE9 02539 MAPTOBCD99 = $0EE9 =1000 02540 PFMEM = $1000 02541 02542 *= $A000 02543 02544 ;******************************************************************************* 02545 ;* * 02546 ;* G A M E D A T A ( P A R T 1 O F 2 ) * 02547 ;* * 02548 ;******************************************************************************* 02549 02550 ;*** Number of space objects *************************************************** 02551 =0010 02552 MAXSPCOBJIND.NL = 16 ; Max index of normal number of spc objs =0031 02553 MAXSPCOBJNUM = 49 ; Maximum number of space objects 02554 02555 ;*** PLAYER shape data offsets ************************************************* 02556 =0000 02557 SHAP.TORPEDO = $00 ; Photon torpedo =0010 02558 SHAP.ZFIGHTER = $10 ; Zylon fighter =0020 02559 SHAP.STARBASEL = $20 ; Starbase (left part) =0030 02560 SHAP.STARBASEC = $30 ; Starbase (center part) =0040 02561 SHAP.STARBASER = $40 ; Starbase (right part) =0050 02562 SHAP.TRANSVSSL = $50 ; Transfer vessel =0060 02563 SHAP.METEOR = $60 ; Meteor =0070 02564 SHAP.ZCRUISER = $70 ; Zylon cruiser =0080 02565 SHAP.ZBASESTAR = $80 ; Zylon basestar =0090 02566 SHAP.HYPERWARP = $90 ; Hyperwarp Target Marker 02567 02568 ;*** ROM character set constants *********************************************** =0000 02569 ROM.SPC = $00 ; ROM character ' ' =000E 02570 ROM.DOT = $0E ; ROM character '.' =0010 02571 ROM.0 = $10 ; ROM character '0' =0011 02572 ROM.1 = $11 ; ROM character '1' =0012 02573 ROM.2 = $12 ; ROM character '2' =0013 02574 ROM.3 = $13 ; ROM character '3' =0014 02575 ROM.4 = $14 ; ROM character '4' =0015 02576 ROM.5 = $15 ; ROM character '5' =0019 02577 ROM.9 = $19 ; ROM character '9' =001A 02578 ROM.COLON = $1A ; ROM character ':' =0021 02579 ROM.A = $21 ; ROM character 'A' =0023 02580 ROM.C = $23 ; ROM character 'C' =0024 02581 ROM.D = $24 ; ROM character 'D' =0025 02582 ROM.E = $25 ; ROM character 'E' =0027 02583 ROM.G = $27 ; ROM character 'G' =002C 02584 ROM.L = $2C ; ROM character 'L' =002E 02585 ROM.N = $2E ; ROM character 'N' =0030 02586 ROM.P = $30 ; ROM character 'P' =0032 02587 ROM.R = $32 ; ROM character 'R' =0033 02588 ROM.S = $33 ; ROM character 'S' =0034 02589 ROM.T = $34 ; ROM character 'T' =0037 02590 ROM.W = $37 ; ROM character 'W' =0039 02591 ROM.Y = $39 ; ROM character 'Y' 02592 02593 ;*** Custom character set constants ******************************************** =0040 02594 CCS.COL1 = $40 ; COLOR1 bits for text in GR1/2 text mode =0080 02595 CCS.COL2 = $80 ; COLOR2 bits for text in GR1/2 text mode =00C0 02596 CCS.COL3 = $C0 ; COLOR3 bits for text in GR1/2 text mode 02597 =0000 02598 CCS.0 = 0 ; Custom character '0' =0001 02599 CCS.1 = 1 ; Custom character '1' =0002 02600 CCS.2 = 2 ; Custom character '2' =0003 02601 CCS.3 = 3 ; Custom character '3' =0004 02602 CCS.4 = 4 ; Custom character '4' =0005 02603 CCS.5 = 5 ; Custom character '5' =0006 02604 CCS.6 = 6 ; Custom character '6' =0007 02605 CCS.7 = 7 ; Custom character '7' =0008 02606 CCS.8 = 8 ; Custom character '8' =0009 02607 CCS.9 = 9 ; Custom character '9' =000A 02608 CCS.SPC = 10 ; Custom character ' ' =000B 02609 CCS.COLON = 11 ; Custom character ':' =000C 02610 CCS.BORDERSW = 12 ; Custom character 'BORDER SOUTHWEST' =000D 02611 CCS.E = 13 ; Custom character 'E' =000E 02612 CCS.INF = 14 ; Custom character 'INFINITY' =000F 02613 CCS.MINUS = 15 ; Custom character '-' =0010 02614 CCS.PLUS = 16 ; Custom character '+' =0011 02615 CCS.PHI = 17 ; Custom character 'PHI' =0012 02616 CCS.V = 18 ; Custom character 'V' =0013 02617 CCS.R = 19 ; Custom character 'R' =0014 02618 CCS.THETA = 20 ; Custom character 'THETA' =0015 02619 CCS.K = 21 ; Custom character 'K' =0016 02620 CCS.T = 22 ; Custom character 'T' =0017 02621 CCS.C = 23 ; Custom character 'C' =0018 02622 CCS.BORDERS = 24 ; Custom character 'BORDER SOUTH' =0019 02623 CCS.BORDERW = 25 ; Custom character 'BORDER WEST' =001A 02624 CCS.CORNERSW = 26 ; Custom character 'CORNER SOUTHWEST' =001B 02625 CCS.STARBASE = 27 ; Custom character 'STARBASE SECTOR' =001C 02626 CCS.4ZYLONS = 28 ; Custom character '4-ZYLON SECTOR' =001D 02627 CCS.3ZYLONS = 29 ; Custom character '3-ZYLON SECTOR' =001E 02628 CCS.2ZYLONS = 30 ; Custom character '2-ZYLON SECTOR' 02629 02630 ;*** Custom character set ****************************************************** 02631 ; 02632 ; 0 1 2 3 4 5 6 7 02633 ; ........ ........ ........ ........ ........ ........ ........ ........ 02634 ; .####### ..##.... .####... .####... .##..... .####... .####... .#####.. 02635 ; .#...### ...#.... ....#... ....#... .##..... .#...... .#..#... .#...#.. 02636 ; .#...### ...#.... ....#... ....#... .##..... .#...... .#...... .....#.. 02637 ; .#...### ...#.... .####... .#####.. .##.##.. .####... .#...... ...###.. 02638 ; .#...### ..###... .#...... ....##.. .#####.. ....#... .######. ...#.... 02639 ; .#...### ..###... .#...... ....##.. ....##.. ....#... .#....#. ...#.... 02640 ; .####### ..###... .####... .#####.. ....##.. .####... .######. ...#.... 02641 ; 02642 ; 8 9 10 11 12 13 14 15 02643 ; ........ ........ ........ ..###... #....... ........ ........ ........ 02644 ; ..###... .#####.. ........ ..###... #....... ..####.. .##..##. ........ 02645 ; ..#.#... .#...#.. ........ ..###... #....... ..#..... #..##..# ........ 02646 ; ..#.#... .#...#.. ........ ........ #....... ..#..... #..##..# .######. 02647 ; .#####.. .#####.. ........ ........ #....... .####... #..##..# ........ 02648 ; .##.##.. ....##.. ........ ..###... #....... .##..... .##..##. ........ 02649 ; .##.##.. ....##.. ........ ..###... #....... .##..... ........ ........ 02650 ; .#####.. ....##.. ........ ..###... ######## .#####.. ........ ........ 02651 ; 02652 ; 16 17 18 19 20 21 22 23 02653 ; ........ ........ .##..##. ........ ........ ........ #######. ######.. 02654 ; ...##... ...##... .##..##. .#####.. ...###.. .#...##. #..#..#. #...##.. 02655 ; ...##... .######. .##..##. .#...#.. ..#####. .#...##. ...#.... #...##.. 02656 ; ...##... ##.##.## .##..##. .#...#.. .##...## .#...#.. ...##... #....... 02657 ; .######. #..##..# .##..##. .#####.. .#.###.# .#####.. ...##... #....... 02658 ; ...##... ##.##.## ..#.##.. .##.#... .##...## .##..#.. ...##... #....... 02659 ; ...##... .######. ..###... .##.##.. ..#####. .##..##. ...##... #....#.. 02660 ; ...##... ...##... ..##.... .##.##.. ...###.. .##..##. ...##... ######.. 02661 ; 02662 ; 24 25 26 27 28 29 30 02663 ; ........ #....... ........ #....... #....... #....... #....... 02664 ; ........ #....... ........ #.#.#.#. #..##... #...###. #.##.... 02665 ; ........ #....... ........ #..###.. #....... #....... #..##... 02666 ; ........ #....... ........ #.#####. #.##.##. #.###... #.#####. 02667 ; ........ #....... ........ #..###.. #....... #....... #..##... 02668 ; ........ #....... ........ #.#.#.#. #...##.. #..###.. #.##.... 02669 ; ........ #....... ........ #....... #....... #....... #....... 02670 ; ######## #....... #....... ######## ######## ######## ######## 02671 A000 007F4747 02672 CHARSET .BYTE $00,$7F,$47,$47,$47,$47,$47,$7F ; Custom character '0' A004 4747477F A008 00301010 02673 .BYTE $00,$30,$10,$10,$10,$38,$38,$38 ; Custom character '1' A00C 10383838 A010 00780808 02674 .BYTE $00,$78,$08,$08,$78,$40,$40,$78 ; Custom character '2' A014 78404078 A018 00780808 02675 .BYTE $00,$78,$08,$08,$7C,$0C,$0C,$7C ; Custom character '3' A01C 7C0C0C7C A020 00606060 02676 .BYTE $00,$60,$60,$60,$6C,$7C,$0C,$0C ; Custom character '4' A024 6C7C0C0C A028 00784040 02677 .BYTE $00,$78,$40,$40,$78,$08,$08,$78 ; Custom character '5' A02C 78080878 A030 00784840 02678 .BYTE $00,$78,$48,$40,$40,$7E,$42,$7E ; Custom character '6' A034 407E427E A038 007C4404 02679 .BYTE $00,$7C,$44,$04,$1C,$10,$10,$10 ; Custom character '7' A03C 1C101010 A040 00382828 02680 .BYTE $00,$38,$28,$28,$7C,$6C,$6C,$7C ; Custom character '8' A044 7C6C6C7C A048 007C4444 02681 .BYTE $00,$7C,$44,$44,$7C,$0C,$0C,$0C ; Custom character '9' A04C 7C0C0C0C A050 00000000 02682 .BYTE $00,$00,$00,$00,$00,$00,$00,$00 ; Custom character ' ' A054 00000000 A058 38383800 02683 .BYTE $38,$38,$38,$00,$00,$38,$38,$38 ; Custom character '.' A05C 00383838 A060 80808080 02684 .BYTE $80,$80,$80,$80,$80,$80,$80,$FF ; Custom character 'BORDER SOUTHWEST' A064 808080FF A068 003C2020 02685 .BYTE $00,$3C,$20,$20,$78,$60,$60,$7C ; Custom character 'E' A06C 7860607C A070 00669999 02686 .BYTE $00,$66,$99,$99,$99,$66,$00,$00 ; Custom character 'INFINITY' A074 99660000 A078 0000007E 02687 .BYTE $00,$00,$00,$7E,$00,$00,$00,$00 ; Custom character '-' A07C 00000000 A080 00181818 02688 .BYTE $00,$18,$18,$18,$7E,$18,$18,$18 ; Custom character '+' A084 7E181818 A088 00187EDB 02689 .BYTE $00,$18,$7E,$DB,$99,$DB,$7E,$18 ; Custom character 'PHI' A08C 99DB7E18 A090 66666666 02690 .BYTE $66,$66,$66,$66,$66,$2C,$38,$30 ; Custom character 'V' A094 662C3830 A098 007C4444 02691 .BYTE $00,$7C,$44,$44,$7C,$68,$6C,$6C ; Custom character 'R' A09C 7C686C6C A0A0 001C3E63 02692 .BYTE $00,$1C,$3E,$63,$5D,$63,$3E,$1C ; Custom character 'THETA' A0A4 5D633E1C A0A8 00464644 02693 .BYTE $00,$46,$46,$44,$7C,$64,$66,$66 ; Custom character 'K' A0AC 7C646666 A0B0 FE921018 02694 .BYTE $FE,$92,$10,$18,$18,$18,$18,$18 ; Custom character 'T' A0B4 18181818 A0B8 FC8C8C80 02695 .BYTE $FC,$8C,$8C,$80,$80,$80,$84,$FC ; Custom character 'C' A0BC 808084FC A0C0 00000000 02696 .BYTE $00,$00,$00,$00,$00,$00,$00,$FF ; Custom character 'BORDER SOUTH' A0C4 000000FF A0C8 80808080 02697 .BYTE $80,$80,$80,$80,$80,$80,$80,$80 ; Custom character 'BORDER WEST' A0CC 80808080 A0D0 00000000 02698 .BYTE $00,$00,$00,$00,$00,$00,$00,$80 ; Custom character 'CORNER SOUTHWEST' A0D4 00000080 A0D8 80AA9CBE 02699 .BYTE $80,$AA,$9C,$BE,$9C,$AA,$80,$FF ; Custom character 'STARBASE SECTOR' A0DC 9CAA80FF A0E0 809880B6 02700 .BYTE $80,$98,$80,$B6,$80,$8C,$80,$FF ; Custom character '4-ZYLON SECTOR' A0E4 808C80FF A0E8 808E80B8 02701 .BYTE $80,$8E,$80,$B8,$80,$9C,$80,$FF ; Custom character '3-CYCLON SECTOR' A0EC 809C80FF A0F0 80B098BE 02702 .BYTE $80,$B0,$98,$BE,$98,$B0,$80,$FF ; Custom character '2-ZYLON SECTOR' A0F4 98B080FF 02703 02704 ;*** Header text of Long-Range Scan view (shares spaces with following header) * A0F8 00006C6F 02705 LRSHEADER .BYTE $00,$00,$6C,$6F,$6E,$67,$00,$72 ; " LONG RANGE SCAN" A0FC 6E670072 A100 616E6765 02706 .BYTE $61,$6E,$67,$65,$00,$73,$63,$61 A104 00736361 A108 6E 02707 .BYTE $6E 02708 02709 ;*** Header text of Aft view (shares spaces with following header) ************* A109 00000000 02710 AFTHEADER .BYTE $00,$00,$00,$00,$00,$00,$61,$66 ; " AFT VIEW " A10D 00006166 A111 74007669 02711 .BYTE $74,$00,$76,$69,$65,$77,$00,$00 A115 65770000 A119 00 02712 .BYTE $00 02713 02714 ;*** Header text of Galactic Chart view **************************************** A11A 00000067 02715 GCHEADER .BYTE $00,$00,$00,$67,$61,$6C,$61,$63 ; " GALACTIC CHART " A11E 616C6163 A122 74696300 02716 .BYTE $74,$69,$63,$00,$63,$68,$61,$72 A126 63686172 A12A 74000000 02717 .BYTE $74,$00,$00,$00 02718 02719 ;*** Display List of Galactic Chart view *************************************** A12E 60 02720 DLSTGC .BYTE $60 ; BLK7 A12F 461AA1 02721 .BYTE $46,<GCHEADER,>GCHEADER ; GR2 @ GCHEADER A132 F0 02722 .BYTE $F0 ; BLK8 + DLI A133 47350D 02723 .BYTE $47,<GCPFMEM,>GCPFMEM ; GR1 @ GCPFMEM A136 07 02724 .BYTE $07 ; GR1 A137 07 02725 .BYTE $07 ; GR1 A138 07 02726 .BYTE $07 ; GR1 A139 07 02727 .BYTE $07 ; GR1 A13A 07 02728 .BYTE $07 ; GR1 A13B 07 02729 .BYTE $07 ; GR1 A13C 07 02730 .BYTE $07 ; GR1 A13D 07 02731 .BYTE $07 ; GR1 A13E 80 02732 .BYTE $80 ; BLK1 + DLI A13F 461F0D 02733 .BYTE $46,<TITLETXT,>TITLETXT ; GR2 @ TITLETXT A142 467109 02734 .BYTE $46,<GCTXT,>GCTXT ; GR2 @ GCTXT A145 06 02735 .BYTE $06 ; GR2 A146 06 02736 .BYTE $06 ; GR2 A147 418002 02737 .BYTE $41,<DSPLST,>DSPLST ; JMP @ DSPLST 02738 02739 ;******************************************************************************* 02740 ;* * 02741 ;* G A M E C O D E * 02742 ;* * 02743 ;******************************************************************************* 02744 02745 ;******************************************************************************* 02746 ;* * 02747 ;* INITCOLD * 02748 ;* * 02749 ;* Initialize program (Cold start) * 02750 ;* * 02751 ;******************************************************************************* 02752 02753 ; DESCRIPTION 02754 ; 02755 ; Initializes the program, then continues into the game loop at GAMELOOP 02756 ; ($A1F3). 02757 ; 02758 ; There are four entry points to initialization: 02759 ; 02760 ; (1) INITCOLD ($A14A) is entered at initial cartridge startup (cold start). 02761 ; This initializes POKEY, resets the idle counter, sets the mission level 02762 ; to NOVICE mission, and clears the function key code. POKEY is enabled to 02763 ; receive keyboard input. Code execution continues into INITSELECT ($A15A) 02764 ; below. 02765 ; 02766 ; (2) INITSELECT ($A15A) is entered from GAMELOOP ($A1F3) after the SELECT 02767 ; function key has been pressed. This loads the title phrase offset for the 02768 ; copyright notice. Code execution continues into INITDEMO ($A15C) below. 02769 ; 02770 ; (3) INITDEMO ($A15C) is entered when the program switches into demo mode. 02771 ; This loads the demo mode flag. Code execution continues into INITSTART 02772 ; ($A15E) below. 02773 ; 02774 ; (4) INITSTART ($A15E) is entered from GAMELOOP ($A1F3) after the START 02775 ; function key has been pressed. This enqueues the new title phrase and 02776 ; enables or disables demo mode, depending on the preloaded value. 02777 ; 02778 ; Initialization continues with the following steps: 02779 ; 02780 ; (1) Clear the custom chip registers and zero-page program variables from 02781 ; ISVBISYNC ($0067) on. 02782 ; 02783 ; NOTE: Because of loop jamming there is a loop index overshoot. Instead of 02784 ; clearing memory at addresses $0067..$00FB, the memory at addresses 02785 ; $0067..$0166 is cleared. This does no harm because $0100..$0166 is a yet 02786 ; unused part of the 6502 CPU stack. 02787 ; 02788 ; NOTE: At address $A175 a hack is necessary in the source code to fake a 02789 ; STA ISVBISYNC,X instruction with a 16-bit address. ISVBISYNC ($0067) is a 02790 ; zero-page address and regular assemblers would translate STA ISVBISYNC,X 02791 ; into the byte sequence $95 $67, not $9D $67 $00. This indicates that the 02792 ; original ROM was maybe created using a special assembler, perhaps a 02793 ; cross-assembler. 02794 ; 02795 ; (2) Initialize the 6502 CPU (reset the stack pointer, disable decimal mode). 02796 ; 02797 ; (3) Clear program memory from $0200..$1FFF in subroutine CLRMEM ($AE0F). 02798 ; 02799 ; (4) Set the address vectors of the IRQ, VBI, and DLI handlers. 02800 ; 02801 ; (5) Enable input from Joystick 0. 02802 ; 02803 ; (6) Enable Player/Missile graphics, providing a fifth PLAYER. 02804 ; 02805 ; BUG (at $A1A6): The set PLAYER-PLAYFIELD priority arranges PLAYERs in 02806 ; front of the PLAYFIELD. This makes sense as space objects represented by 02807 ; PLAYERs (for example, Zylon ships, photon torpedoes, and meteors) move in 02808 ; front of the stars, which are part of the PLAYFIELD. However, PLAYERs 02809 ; also move in front of the cross hairs, which are also part of the 02810 ; PLAYFIELD. Suggested fix: None, technically not possible. 02811 ; 02812 ; (7) Do more initialization in subroutine INITIALIZE ($B3BA). 02813 ; 02814 ; (8) Set display to Front view. 02815 ; 02816 ; (9) Show or hide the Control Panel Display (bottom text window) in subroutine 02817 ; MODDLST ($ADF1), depending on the demo mode flag. 02818 ; 02819 ; (10) Initialize our starship's velocity equivalent to speed key '6'. 02820 ; 02821 ; (11) Enable the Display List. 02822 ; 02823 ; (12) Initialize the number of space objects to 16 (5 PLAYER space objects + 12 02824 ; PLAYFIELD space objects (stars)). 02825 ; 02826 ; (13) Set the title phrase to the selected mission level in subroutine SETTITLE 02827 ; ($B223). 02828 ; 02829 ; (14) Enable the IRQ, DLI, and VBI interrupts. 02830 ; 02831 ; Code execution continues into the game loop at GAMELOOP ($A1F3). 02832 A14A A900 02833 INITCOLD LDA #0 ; A14C 8D0FD2 02834 STA SKCTL ; POKEY: Initialization A14F 8566 02835 STA IDLECNTHI ; Reset idle counter A151 8562 02836 STA MISSIONLEVEL ; Mission level := NOVICE mission A153 8563 02837 STA FKEYCODE ; Clear function key code A155 A903 02838 LDA #$03 ; POKEY: Enable keyboard scan and debounce A157 8D0FD2 02839 STA SKCTL ; 02840 02841 ;*** Entry point when SELECT function key was pressed ************************** A15A A02F 02842 INITSELECT LDY #$2F ; Prep title phrase "COPYRIGHT ATARI 1979" 02843 02844 ;*** Entry point when program switches into demo mode ************************** A15C A9FF 02845 INITDEMO LDA #$FF ; Prep demo mode flag 02846 02847 ;*** Entry point when START function key was pressed *************************** A15E 8465 02848 INITSTART STY NEWTITLEPHR ; Enqueue new title phrase A160 8564 02849 STA ISDEMOMODE ; Store demo mode flag 02850 02851 ;*** More initialization ******************************************************* A162 A900 02852 LDA #0 ; Clear custom chip registers, zero-page variables A164 AA 02853 TAX ; A165 9D00D0 02854 LOOP001 STA HPOSP0,X ; Clear $D000..$D0FF (GTIA registers) A168 9D00D4 02855 STA DMACTL,X ; Clear $D400..$D4FF (ANTIC registers) A16B E00F 02856 CPX #$0F ; A16D B003 02857 BCS SKIP001 ; A16F 9D00D2 02858 STA AUDF1,X ; Clear $D200..$D20E (POKEY registers) 02859 A172 9D00D3 02860 SKIP001 STA PORTA,X ; Clear $D300..$D3FF (PIA registers) 02861 ; Clear $0067..$0166 (zero-page program variables) A175 9D 02862 .BYTE $9D ; HACK: Fake STA ISVBISYNC,X with 16-bit address A176 6700 02863 .WORD ISVBISYNC ; A178 E8 02864 INX ; A179 D0EA 02865 BNE LOOP001 ; 02866 A17B CA 02867 DEX ; Reset 6502 CPU stack pointer A17C 9A 02868 TXS ; 02869 A17D D8 02870 CLD ; Clear 6502 CPU decimal mode 02871 A17E A902 02872 LDA #$02 ; Clear $0200..$1FFF (program memory) A180 200FAE 02873 JSR CLRMEM ; 02874 A183 A951 02875 LDA #<IRQHNDLR ; Set IRQ handler (VIMIRQ) A185 8D1602 02876 STA VIMIRQ ; A188 A9A7 02877 LDA #>IRQHNDLR ; A18A 8D1702 02878 STA VIMIRQ+1 ; 02879 A18D A9D1 02880 LDA #<VBIHNDLR ; Set VBI and DLI handler (VVBLKI and VDSLST) A18F 8D2202 02881 STA VVBLKI ; A192 A918 02882 LDA #<DLSTHNDLR ; A194 8D0002 02883 STA VDSLST ; A197 A9A6 02884 LDA #>VBIHNDLR ; A199 8D2302 02885 STA VVBLKI+1 ; A19C A9A7 02886 LDA #>DLSTHNDLR ; A19E 8D0102 02887 STA VDSLST+1 ; 02888 A1A1 A904 02889 LDA #$04 ; PIA: Enable PORTA (Joystick 0) A1A3 8D02D3 02890 STA PACTL ; A1A6 A911 02891 LDA #$11 ; GTIA: Enable PLAYER4, prio: PLs > PFs > BGR (!) A1A8 8D1BD0 02892 STA PRIOR ; (PLAYERs appear behind cross hairs) A1AB A903 02893 LDA #$03 ; GTIA: Enable DMA for PLAYERs and MISSILEs A1AD 8D1DD0 02894 STA GRACTL ; 02895 A1B0 20BAB3 02896 JSR INITIALIZE ; Init Display List, tables, Galactic Chart, etc. 02897 A1B3 A20A 02898 LDX #$0A ; Set Front view A1B5 2045B0 02899 JSR SETVIEW ; 02900 A1B8 A564 02901 LDA ISDEMOMODE ; If in/not in demo mode hide/show... A1BA 2980 02902 AND #$80 ; ...Control Panel Display (bottom text window) A1BC A8 02903 TAY ; A1BD A25F 02904 LDX #$5F ; A1BF A908 02905 LDA #$08 ; A1C1 20F1AD 02906 JSR MODDLST ; 02907 A1C4 A920 02908 LDA #$20 ; Init our starship's velocity (= speed key '6') A1C6 8571 02909 STA NEWVELOCITY ; 02910 A1C8 A980 02911 LDA #<DSPLST ; ANTIC: Set Display List A1CA 8D02D4 02912 STA DLIST ; A1CD A902 02913 LDA #>DSPLST ; A1CF 8D03D4 02914 STA DLIST+1 ; 02915 A1D2 A93E 02916 LDA #$3E ; ANTIC: Enable Display List DMA, single-line PM A1D4 8D00D4 02917 STA DMACTL ; resolution, PM DMA, normal-width PLAYFIELD 02918 A1D7 A900 02919 LDA #0 ; ANTIC: Set PM memory base address A1D9 8D07D4 02920 STA PMBASE ; 02921 A1DC A910 02922 LDA #MAXSPCOBJIND.NL ; Set normal number of space objects A1DE 8579 02923 STA MAXSPCOBJIND ; (5 PLAYER spc objs + 12 PLAYFIELD spc objs (stars)) 02924 A1E0 A662 02925 LDX MISSIONLEVEL ; Set title phrase A1E2 BC0CBF 02926 LDY MISSIONPHRTAB,X ; NOVICE, PILOT, WARRIOR, or COMMANDER MISSION A1E5 2023B2 02927 JSR SETTITLE ; 02928 A1E8 A940 02929 LDA #$40 ; POKEY: Enable keyboard interrupt (IRQ) A1EA 8D0ED2 02930 STA IRQEN ; 02931 A1ED 58 02932 CLI ; Enable all IRQs 02933 A1EE A9C0 02934 LDA #$C0 ; ANTIC: Enable DLI and VBI A1F0 8D0ED4 02935 STA NMIEN ; 02936 02937 ;******************************************************************************* 02938 ;* * 02939 ;* GAMELOOP * 02940 ;* * 02941 ;******************************************************************************* 02942 02943 ; DESCRIPTION 02944 ; 02945 ; The game loop is the main part of the program. It is basically an infinite 02946 ; loop that collects input, computes the game state, and updates the display. It 02947 ; executes the following steps: 02948 ; 02949 ; (1) Synchronize the start of the game loop with the vertical blank phase of 02950 ; the TV beam, which flagged by the Vertical Blank Interrupt handler 02951 ; VBIHNDLR ($A6D1). This prevents screen flicker while the PLAYFIELD is 02952 ; redrawn at the begin of the game loop, because during the vertical blank 02953 ; phase the TV beam is turned off and nothing is rendered on the TV 02954 ; display. 02955 ; 02956 ; (2) Erase all PLAYFIELD space objects (stars, explosion fragments) from the 02957 ; PLAYFIELD that were drawn in the previous game loop iteration. 02958 ; 02959 ; (3) Draw the updated PLAYFIELD space objects (stars, explosion fragments) 02960 ; into the PLAYFIELD (skip this if in hyperspace). 02961 ; 02962 ; (4) If the idle counter has reached its trigger value then clear the center 02963 ; of the PLAYFIELD, a 8 x 2 pixel rectangle with a top-left position at 02964 ; pixel column number 76 and pixel row number 49 (?). 02965 ; 02966 ; (5) Clear all PLAYER shapes. 02967 ; 02968 ; (6) Update the vertical position of all PLAYERs and update all PLAYER shapes. 02969 ; 02970 ; (7) Update the horizontal position of all PLAYERs. 02971 ; 02972 ; (8) Rotate the position vector of all space objects horizontally and 02973 ; vertically, according to the saved joystick position (skip this if in 02974 ; Galactic Chart view) using subroutine ROTATE ($B69B). 02975 ; 02976 ; (9) Move our starship forward in space. Our starship is always located at the 02977 ; center of the program's 3D coordinate system, so all space objects are 02978 ; moved along the z-axis toward our starship by subtracting a displacement 02979 ; from their z-coordinate. The amount of the displacement depends on our 02980 ; starship's velocity. 02981 ; 02982 ; BUG (at $A3C1): This operation is not applied to Photon torpedoes (?). 02983 ; Suggested fix: Remove LDA PL0SHAPTYPE,X and BEQ SKIP011. 02984 ; 02985 ; (10) Add the proper velocity vector of all space objects to their position 02986 ; vector (except for stars, which do not have any proper motion). 02987 ; 02988 ; BUG (at $A419): The correct maximum loop index is MAXSPCOBJNUM*3 = 147 02989 ; instead of 144. Suggested fix: Replace CMP #144 by CMP #147. 02990 ; 02991 ; (11) Correct the position vector components (coordinates) of all PLAYER space 02992 ; objects if they have over- or underflowed during the calculations of the 02993 ; previous steps. 02994 ; 02995 ; (12) Calculate the perspective projection of the position vectors of all space 02996 ; objects and from that their pixel row and column number (applies to Front 02997 ; and Aft view) using subroutines PROJECTION ($AA21), SCREENCOLUMN ($B6FB), 02998 ; and SCREENROW ($B71E). If a space object (star, explosion fragment) moved 02999 ; offscreen then a new space object is automatically created in subroutine 03000 ; SCREENCOLUMN ($B6FB). 03001 ; 03002 ; (13) Handle hyperwarp marker selection in the Galactic Chart view in 03003 ; subroutine SELECTWARP ($B162). 03004 ; 03005 ; (14) If in Long-Range Scan view, compute the pixel column number and the pixel 03006 ; row number of all PLAYFIELD space objects (stars, explosion fragments) on 03007 ; the plane established by the z and x axis of the 3D coordinate system 03008 ; using subroutines SCREENCOLUMN ($B6FB) and SCREENROW ($B71E). Our 03009 ; starship's shape is drawn using subroutine DRAWLINES ($A76F). If the 03010 ; Long-Range Scan is OK then PLAYFIELD space object pixel numbers are 03011 ; computed and drawn. This is skipped if the Long-Range Scan is destroyed. 03012 ; 03013 ; (15) Update all PLAYER shapes, heights, and colors (see detailed description 03014 ; below). 03015 ; 03016 ; (16) Flash a red alert when leaving hyperspace into a sector containing Zylon 03017 ; ships by setting appropriate colors to PLAYFIELD2 and BACKGROUND. 03018 ; 03019 ; (17) Update the color of all PLAYFIELD space objects (stars, explosion 03020 ; fragments). The color calculation is similar to that of the PLAYER color 03021 ; calculation in (15). It also computes a range index and uses the same 03022 ; color lookup table FOURCOLORPIXEL ($BA90). If a star in the Aft view 03023 ; became too distant (z-coordinate < -$F000 (-4096) <KM>) its position is 03024 ; re-initialized in subroutine INITPOSVEC ($B764). 03025 ; 03026 ; (18) If in demo mode skip input handling and jump directly to function key 03027 ; handling (28). 03028 ; 03029 ; (19) Handle keyboard input in subroutine KEYBOARD ($AFFE). 03030 ; 03031 ; (20) Handle joystick input. Store the current joystick directions in JOYSTICKX 03032 ; ($C8) and JOYSTICKY ($C9). 03033 ; 03034 ; (21) Check if our starship's photon torpedoes have hit a target in subroutine 03035 ; COLLISION ($AF3D). This subroutine triggers a game over if all Zylon 03036 ; ships have been destroyed. 03037 ; 03038 ; (22) Handle the joystick trigger in subroutine TRIGGER ($AE29). 03039 ; 03040 ; (23) Handle the Attack Computer and Tracking Computer. If the Attack Computer 03041 ; is neither destroyed nor switched off then execute the following steps: 03042 ; 03043 ; o Update the Attack Computer Display's blip and lock-on markers in 03044 ; subroutine UPDATTCOMP ($A7BF) (if in Front view). 03045 ; 03046 ; o Update the tracking index of the currently tracked PLAYER space 03047 ; object. If a Zylon ship is tracked, then make sure to always track 03048 ; the Zylon ship that launched the last Zylon photon torpedo. If this 03049 ; Zylon ship is not alive then track the other Zylon ship - if alive. 03050 ; 03051 ; o If the Tracking Computer is on then switch to the view that shows the 03052 ; tracked PLAYER space object by emulating pressing the 'F' (Front 03053 ; view) or 'A' (Aft view) key (only if in Front or Aft view). 03054 ; 03055 ; (24) Handle docking at a starbase in subroutine DOCKING ($ACE6). 03056 ; 03057 ; (25) Handle maneuvering both of our starship's photon torpedoes, the single 03058 ; Zylon photon torpedo, and the attacking Zylon ships in subroutine 03059 ; MANEUVER ($AA79). This subroutine also automatically creates meteors and 03060 ; new Zylon ships. 03061 ; 03062 ; (26) Check if our starship was hit by a Zylon photon torpedo (skip this if in 03063 ; a starbase sector): Its x, y, and z coordinates must be within a range of 03064 ; -($0100)..+$00FF (-256..+255) <KM> of our starship. 03065 ; 03066 ; (27) If our starship was hit then execute the following steps: 03067 ; 03068 ; o Damage or destroy one of our starship's subsystems in subroutine 03069 ; DAMAGE ($AEE1). 03070 ; 03071 ; o Trigger an explosion in subroutine INITEXPL ($AC6B), 03072 ; 03073 ; o Store the severity of the hit. 03074 ; 03075 ; o End the lifetime of the Zylon photon torpedo. 03076 ; 03077 ; o Subtract 100 energy units for being hit by the Zylon photon torpedo 03078 ; in subroutine DECENERGY ($B86F). 03079 ; 03080 ; o Trigger the noise sound pattern SHIP EXPLOSION in subroutine NOISE 03081 ; ($AEA8). 03082 ; 03083 ; If the Shields were down during the hit, our starship is destroyed. 03084 ; Execute the following steps: 03085 ; 03086 ; o Switch to Front view. 03087 ; 03088 ; o Flash the title phrase "SHIP DESTROYED BY ZYLON FIRE". 03089 ; 03090 ; o Add the mission bonus to the internal game score in subroutine 03091 ; GAMEOVER ($B10A). 03092 ; 03093 ; o Hide the Control Panel Display (bottom text window) in subroutine 03094 ; MODDLST ($ADF1). 03095 ; 03096 ; o Clear the PLAYFIELD in subroutine CLRPLAYFIELD ($AE0D). 03097 ; 03098 ; o Enable a special explosion sound. 03099 ; 03100 ; (28) Handle the function keys START and SELECT. If SELECT has been pressed 03101 ; cycle through the next of the 4 mission levels. If either START or SELECT 03102 ; have been pressed, reset the idle counter, then jump to the corresponding 03103 ; program initialization subroutines INITSTART ($A15E) or INITSELECT 03104 ; ($A15A), respectively. 03105 ; 03106 ; (29) Update the Control Panel Display in subroutine UPDPANEL ($B804). 03107 ; 03108 ; (30) Handle hyperwarp in subroutine HYPERWARP ($A89B). 03109 ; 03110 ; (31) Update the text in the title line in subroutine UPDTITLE ($B216). 03111 ; 03112 ; (32) Move Zylon units, decrease lifetime of photon torpedoes, elapse game 03113 ; time, etc. in subroutine FLUSHGAMELOOP ($B4E4). This subroutine also 03114 ; triggers a game over if our starship's energy is zero. 03115 ; 03116 ; (33) Jump back to the start of the game loop for the next game loop iteration. 03117 =006A 03118 L.HEIGHTCNT = $6A ; Height counter during copying a PLAYER shape =006E 03119 L.ZPOSOFF = $6E ; Offset to z-coordinate =006B 03120 L.VELOCITYHI = $6B ; Velocity vector component (high byte) =006A 03121 L.VECCOMPIND = $6A ; Position vector component index. Used values are: 03122 ; 0 -> z-component 03123 ; 1 -> x-component 03124 ; 2 -> y-component =006A 03125 L.RANGEINDEX = $6A ; Range index for space object, computed from the 03126 ; distance to our starship. Used to pick the shape 03127 ; cell index of the PLAYERs shape data and shape 03128 ; height. Used values are: 0..15. =006A 03129 L.FOURCOLORPIX = $6A ; 1-byte bit pattern for 4 pixels of same color =006B 03130 L.COLORMASK = $6B ; Color/brightness to modify PLAYER color 03131 03132 ;*** (1) Synchronize game loop with execution of VBI *************************** A1F3 A567 03133 GAMELOOP LDA ISVBISYNC ; Wait for execution of VBI A1F5 F0FC 03134 BEQ GAMELOOP ; 03135 A1F7 A900 03136 LDA #0 ; VBI is executed, clear VBI sync flag A1F9 8567 03137 STA ISVBISYNC ; 03138 03139 ;*** (2) Erase PLAYFIELD space objects (stars, explosion fragments) ************ A1FB A57A 03140 LDA SAVMAXSPCOBJIND ; Skip if no space objects in use A1FD F020 03141 BEQ SKIP002 ; 03142 A1FF A204 03143 LDX #4 ; Loop over all PLAYFIELD space objs (X index > 4) A201 E8 03144 LOOP002 INX ; A202 BC5B0C 03145 LDY PIXELROW,X ; Load pixel row number of PLAYFIELD space object 03146 A205 B90008 03147 LDA PFMEMROWLO,Y ; Point MEMPTR to start of pixel's row... A208 8568 03148 STA MEMPTR ; ...in PLAYFIELD memory A20A B96408 03149 LDA PFMEMROWHI,Y ; A20D 8569 03150 STA MEMPTR+1 ; 03151 A20F BC8C0C 03152 LDY PIXELBYTEOFF,X ; Get within-row-offset to byte with space obj pixel A212 BDBD0C 03153 LDA PIXELSAVE,X ; Load saved byte A215 9168 03154 STA (MEMPTR),Y ; Restore byte of PLAYFIELD memory 03155 A217 E47A 03156 CPX SAVMAXSPCOBJIND ; A219 90E6 03157 BCC LOOP002 ; Next PLAYFIELD space object 03158 A21B A900 03159 LDA #0 ; Clear number of space objects A21D 857A 03160 STA SAVMAXSPCOBJIND ; 03161 03162 ;*** (3) Draw PLAYFIELD space objects (stars, explosion fragments) ************* A21F A5C0 03163 SKIP002 LDA WARPSTATE ; Skip during hyperspace A221 302D 03164 BMI SKIP003 ; 03165 A223 A679 03166 LDX MAXSPCOBJIND ; Update number of space objects A225 867A 03167 STX SAVMAXSPCOBJIND ; 03168 A227 BDF90B 03169 LOOP003 LDA PIXELROWNEW,X ; Loop over all PLAYFIELD space objs (X index > 4) A22A 9D5B0C 03170 STA PIXELROW,X ; Update pixel row number of PLAYFIELD space object 03171 A22D A8 03172 TAY ; A22E B90008 03173 LDA PFMEMROWLO,Y ; Point MEMPTR to start of pixel's row... A231 8568 03174 STA MEMPTR ; ...in PLAYFIELD memory A233 B96408 03175 LDA PFMEMROWHI,Y ; A236 8569 03176 STA MEMPTR+1 ; 03177 A238 BD2A0C 03178 LDA PIXELCOLUMN,X ; Convert pixel column number to within-row-offset A23B 4A 03179 LSR A ; ...of byte with space obj pixel (4 pixels = 1 byte) A23C 4A 03180 LSR A ; A23D 9D8C0C 03181 STA PIXELBYTEOFF,X ; Store within-row-offset 03182 A240 A8 03183 TAY ; A241 B168 03184 LDA (MEMPTR),Y ; Load pixel's byte from PLAYFIELD memory A243 9DBD0C 03185 STA PIXELSAVE,X ; Save it (for restoring it in next game loop) A246 1DEE0C 03186 ORA PIXELBYTE,X ; Blend with pixel's color bit-pattern A249 9168 03187 STA (MEMPTR),Y ; Store byte in PLAYFIELD memory 03188 A24B CA 03189 DEX ; A24C E004 03190 CPX #4 ; A24E D0D7 03191 BNE LOOP003 ; Next PLAYFIELD space object 03192 03193 ;*** (4) Clear PLAYFIELD center if idle counter is up (?) ********************** 03194 ; PLAYFIELD addresses of... =17BB 03195 PFMEM.C76R49 = PFMEM+49*40+76/4 ; ...pixel column number 76, row number 49 =17BC 03196 PFMEM.C80R49 = PFMEM+49*40+80/4 ; ...pixel column number 80, row number 49 =17E3 03197 PFMEM.C76R50 = PFMEM+50*40+76/4 ; ...pixel column number 76, row number 50 =17E4 03198 PFMEM.C80R50 = PFMEM+50*40+80/4 ; ...pixel column number 80, row number 50 03199 A250 A566 03200 SKIP003 LDA IDLECNTHI ; Skip if idle counter not negative A252 100E 03201 BPL SKIP004 ; 03202 A254 A900 03203 LDA #0 ; Clear pixels of 8 x 2 pixel rectangle... A256 8DE317 03204 STA PFMEM.C76R50 ; ...@ column number 76, row number 49 A259 8DE417 03205 STA PFMEM.C80R50 ; A25C 8DBC17 03206 STA PFMEM.C80R49 ; A25F 8DBB17 03207 STA PFMEM.C76R49 ; 03208 03209 ;*** (5) Clear all PLAYER shapes *********************************************** A262 A900 03210 SKIP004 LDA #0 ; Clear shape of PLAYER4 A264 AC5F0C 03211 LDY PL4ROW ; A267 AEC10C 03212 LDX PL4HEIGHT ; A26A 990003 03213 LOOP004 STA PL4DATA,Y ; A26D C8 03214 INY ; A26E CA 03215 DEX ; A26F 10F9 03216 BPL LOOP004 ; 03217 A271 AC5E0C 03218 LDY PL3ROW ; Clear shape of PLAYER3 A274 AEC00C 03219 LDX PL3HEIGHT ; A277 990007 03220 LOOP005 STA PL3DATA,Y ; A27A C8 03221 INY ; A27B CA 03222 DEX ; A27C 10F9 03223 BPL LOOP005 ; 03224 A27E AC5D0C 03225 LDY PL2ROW ; Clear shape of PLAYER2 A281 AEBF0C 03226 LDX PL2HEIGHT ; A284 990006 03227 LOOP006 STA PL2DATA,Y ; A287 C8 03228 INY ; A288 CA 03229 DEX ; A289 10F9 03230 BPL LOOP006 ; 03231 A28B AC5C0C 03232 LDY PL1ROW ; Clear shape of PLAYER1 A28E AEBE0C 03233 LDX PL1HEIGHT ; A291 990005 03234 LOOP007 STA PL1DATA,Y ; A294 C8 03235 INY ; A295 CA 03236 DEX ; A296 10F9 03237 BPL LOOP007 ; 03238 A298 AC5B0C 03239 LDY PL0ROW ; Clear shape of PLAYER0 A29B AEBD0C 03240 LDX PL0HEIGHT ; A29E 990004 03241 LOOP008 STA PL0DATA,Y ; A2A1 C8 03242 INY ; A2A2 CA 03243 DEX ; A2A3 10F9 03244 BPL LOOP008 ; 03245 03246 ;*** (6) Update PLAYER vertical positions and update PLAYER shapes ************* A2A5 AD900C 03247 LDA PL4SHAPTYPE ; Prep: Is PLAYER4 a PHOTON TORPEDO (shape type 0)? A2A8 C901 03248 CMP #1 ; A2AA A4E8 03249 LDY PL4SHAPOFF ; Load PLAYER4 shape data offset 03250 A2AC AEFD0B 03251 LDX PL4ROWNEW ; Update vertical position of PLAYER4 A2AF 8E5F0C 03252 STX PL4ROW ; 03253 A2B2 ADF20C 03254 LDA PL4HEIGHTNEW ; Update PLAYER4 shape height A2B5 856A 03255 STA L.HEIGHTCNT ; A2B7 8DC10C 03256 STA PL4HEIGHT ; 03257 A2BA B9E4B8 03258 LOOP009 LDA PLSHAP1TAB,Y ; Load PLAYER4 shape byte from shape data table A2BD B003 03259 BCS SKIP005 ; Skip if PLAYER4 not PHOTON TORPEDO (shape type 0) A2BF 2D0AD2 03260 AND RANDOM ; AND random bits to shape byte A2C2 9D0003 03261 SKIP005 STA PL4DATA,X ; Store shape byte in PLAYER4 data area A2C5 C8 03262 INY ; A2C6 E8 03263 INX ; A2C7 C66A 03264 DEC L.HEIGHTCNT ; A2C9 10EF 03265 BPL LOOP009 ; Next row of PLAYER4 shape 03266 A2CB AD8F0C 03267 LDA PL3SHAPTYPE ; Repeat above with PLAYER3 A2CE C901 03268 CMP #1 ; A2D0 A4E7 03269 LDY PL3SHAPOFF ; A2D2 AEFC0B 03270 LDX PL3ROWNEW ; A2D5 8E5E0C 03271 STX PL3ROW ; A2D8 ADF10C 03272 LDA PL3HEIGHTNEW ; A2DB 856A 03273 STA L.HEIGHTCNT ; A2DD 8DC00C 03274 STA PL3HEIGHT ; A2E0 B9E4B8 03275 LOOP010 LDA PLSHAP1TAB,Y ; A2E3 B003 03276 BCS SKIP006 ; A2E5 2D0AD2 03277 AND RANDOM ; A2E8 9D0007 03278 SKIP006 STA PL3DATA,X ; A2EB E8 03279 INX ; A2EC C8 03280 INY ; A2ED C66A 03281 DEC L.HEIGHTCNT ; A2EF 10EF 03282 BPL LOOP010 ; 03283 A2F1 AD8E0C 03284 LDA PL2SHAPTYPE ; Repeat above with PLAYER2 A2F4 C901 03285 CMP #1 ; A2F6 A4E6 03286 LDY PL2SHAPOFF ; A2F8 AEFB0B 03287 LDX PL2ROWNEW ; A2FB 8E5D0C 03288 STX PL2ROW ; A2FE ADF00C 03289 LDA PL2HEIGHTNEW ; A301 856A 03290 STA L.HEIGHTCNT ; A303 8DBF0C 03291 STA PL2HEIGHT ; A306 B9E4B8 03292 LOOP011 LDA PLSHAP1TAB,Y ; A309 B003 03293 BCS SKIP007 ; A30B 2D0AD2 03294 AND RANDOM ; A30E 9D0006 03295 SKIP007 STA PL2DATA,X ; A311 E8 03296 INX ; A312 C8 03297 INY ; A313 C66A 03298 DEC L.HEIGHTCNT ; A315 10EF 03299 BPL LOOP011 ; 03300 A317 A4E5 03301 LDY PL1SHAPOFF ; Repeat above with PLAYER1 (without torpedo part) A319 AEFA0B 03302 LDX PL1ROWNEW ; A31C 8E5C0C 03303 STX PL1ROW ; A31F ADEF0C 03304 LDA PL1HEIGHTNEW ; A322 856A 03305 STA L.HEIGHTCNT ; A324 8DBE0C 03306 STA PL1HEIGHT ; A327 B9B1B9 03307 LOOP012 LDA PLSHAP2TAB,Y ; A32A 9D0005 03308 STA PL1DATA,X ; A32D E8 03309 INX ; A32E C8 03310 INY ; A32F C66A 03311 DEC L.HEIGHTCNT ; A331 10F4 03312 BPL LOOP012 ; 03313 A333 A4E4 03314 LDY PL0SHAPOFF ; Repeat above with PLAYER0 (without torpedo part) A335 AEF90B 03315 LDX PL0ROWNEW ; A338 8E5B0C 03316 STX PL0ROW ; A33B ADEE0C 03317 LDA PL0HEIGHTNEW ; A33E 856A 03318 STA L.HEIGHTCNT ; A340 8DBD0C 03319 STA PL0HEIGHT ; A343 B9B1B9 03320 LOOP013 LDA PLSHAP2TAB,Y ; A346 9D0004 03321 STA PL0DATA,X ; A349 E8 03322 INX ; A34A C8 03323 INY ; A34B C66A 03324 DEC L.HEIGHTCNT ; A34D 10F4 03325 BPL LOOP013 ; 03326 03327 ;*** (7) Update PLAYER horizontal positions ************************************ A34F AD2A0C 03328 LDA PL0COLUMN ; Update horizontal position of PLAYER0 A352 8D00D0 03329 STA HPOSP0 ; A355 AD2B0C 03330 LDA PL1COLUMN ; Update horizontal position of PLAYER1 A358 8D01D0 03331 STA HPOSP1 ; A35B AD2C0C 03332 LDA PL2COLUMN ; Update horizontal position of PLAYER2 A35E 8D02D0 03333 STA HPOSP2 ; A361 AD2D0C 03334 LDA PL3COLUMN ; Update horizontal position of PLAYER3 A364 8D03D0 03335 STA HPOSP3 ; A367 AD2E0C 03336 LDA PL4COLUMN ; Update horizontal position of PLAYER4 A36A 8D07D0 03337 STA HPOSM3 ; A36D 18 03338 CLC ; A36E 6902 03339 ADC #2 ; A370 8D06D0 03340 STA HPOSM2 ; A373 6902 03341 ADC #2 ; A375 8D05D0 03342 STA HPOSM1 ; A378 6902 03343 ADC #2 ; A37A 8D04D0 03344 STA HPOSM0 ; 03345 03346 ;*** (8) Rotate space objects horizontally and vertically ********************** A37D 24D0 03347 BIT SHIPVIEW ; Skip if in Galactic Chart view A37F 303A 03348 BMI SKIP009 ; 03349 03350 ;*** Rotate horizontally ******************************************************* A381 A5C8 03351 LDA JOYSTICKX ; Skip if joystick centered horizontally A383 F019 03352 BEQ SKIP008 ; 03353 A385 856D 03354 STA JOYSTICKDELTA ; Save JOYSTICKX (used in subroutine ROTATE) A387 A479 03355 LDY MAXSPCOBJIND ; Loop over all space objects in use A389 846E 03356 LOOP014 STY L.ZPOSOFF ; Save offset to z-coordinate A38B 18 03357 CLC ; 03358 A38C 98 03359 TYA ; A38D AA 03360 TAX ; X := offset to z-coordinate A38E 6931 03361 ADC #MAXSPCOBJNUM ; A390 A8 03362 TAY ; Y := offset to x-coordinate A391 209BB6 03363 JSR ROTATE ; Calc new x-coordinate (horizontal rot @ y-axis) 03364 A394 98 03365 TYA ; A395 AA 03366 TAX ; X := offset to x-coordinate A396 A46E 03367 LDY L.ZPOSOFF ; Y := offset to z-coordinate A398 209BB6 03368 JSR ROTATE ; Calc new z-coordinate (horizontal rot @ y-axis) A39B 88 03369 DEY ; A39C 10EB 03370 BPL LOOP014 ; Next space object 03371 03372 ;*** Rotate vertically ********************************************************* A39E A5C9 03373 SKIP008 LDA JOYSTICKY ; Skip if joystick centered vertically A3A0 F019 03374 BEQ SKIP009 ; 03375 A3A2 856D 03376 STA JOYSTICKDELTA ; Save JOYSTICKY (used in subroutine ROTATE) A3A4 A479 03377 LDY MAXSPCOBJIND ; Loop over all space objects in use A3A6 846E 03378 LOOP015 STY L.ZPOSOFF ; Save offset to z-coordinate A3A8 18 03379 CLC ; 03380 A3A9 98 03381 TYA ; A3AA AA 03382 TAX ; X := offset to z-coordinate A3AB 6962 03383 ADC #MAXSPCOBJNUM*2 ; A3AD A8 03384 TAY ; Y := offset to y-coordinate A3AE 209BB6 03385 JSR ROTATE ; Calc new y-coordinate (vertical rot @ x-axis) 03386 A3B1 98 03387 TYA ; A3B2 AA 03388 TAX ; X := offset to y-coordinate A3B3 A46E 03389 LDY L.ZPOSOFF ; Y := offset to z-coordinate A3B5 209BB6 03390 JSR ROTATE ; Calc new z-coordinate (vertical rot @ x-axis) A3B8 88 03391 DEY ; A3B9 10EB 03392 BPL LOOP015 ; Next space object 03393 03394 ;*** (9) Move all space objects along z-axis (toward our starship) ************* A3BB A679 03395 SKIP009 LDX MAXSPCOBJIND ; Loop over all space objects in use A3BD E005 03396 LOOP016 CPX #5 ; Skip if PLAYFIELD space object (X index > 4) A3BF B005 03397 BCS SKIP010 ; 03398 A3C1 BD8C0C 03399 LDA PL0SHAPTYPE,X ; Skip if next PLAYER space obj is PHOTON TORPEDO (!) A3C4 F019 03400 BEQ SKIP011 ; 03401 A3C6 38 03402 SKIP010 SEC ; New z-coordinate := old z-coordinate - A3C7 BDD30A 03403 LDA ZPOSLO,X ; ...our starship's velocity A3CA E570 03404 SBC VELOCITYLO ; (signed 24-bit subtraction) A3CC 9DD30A 03405 STA ZPOSLO,X ; A3CF BD400A 03406 LDA ZPOSHI,X ; A3D2 E5C1 03407 SBC VELOCITYHI ; A3D4 9D400A 03408 STA ZPOSHI,X ; A3D7 BDAD09 03409 LDA ZPOSSIGN,X ; A3DA E900 03410 SBC #0 ; A3DC 9DAD09 03411 STA ZPOSSIGN,X ; 03412 A3DF CA 03413 SKIP011 DEX ; A3E0 10DB 03414 BPL LOOP016 ; Next space object 03415 03416 ;*** (10) Add space object's velocity vector to space object's position vector * A3E2 A679 03417 LDX MAXSPCOBJIND ; Loop over all space objects in use A3E4 E010 03418 LOOP017 CPX #16 ; Skip if space object is star (X index 5..16)... A3E6 D002 03419 BNE SKIP012 ; ...because stars don't move by themselves A3E8 A204 03420 LDX #4 ; 03421 A3EA 8A 03422 SKIP012 TXA ; A3EB A8 03423 LOOP018 TAY ; Loop over all 3 coordinates 03424 A3EC A900 03425 LDA #0 ; Expand 8-bit velocity vector component to 16-bit: A3EE 856B 03426 STA L.VELOCITYHI ; ...16-bit velocity (high byte) = L.VELOCITYHI := 0 A3F0 B9660B 03427 LDA ZVEL,Y ; ...16-bit velocity (low byte) = A := ZVEL,Y A3F3 1009 03428 BPL SKIP013 ; Skip if 16-bit velocity >= 0 (positive) 03429 A3F5 497F 03430 EOR #$7F ; 16-bit velocity < 0 (negative)... A3F7 18 03431 CLC ; ...calculate two's-complement of 16-bit velocity A3F8 6901 03432 ADC #1 ; A3FA B002 03433 BCS SKIP013 ; A3FC C66B 03434 DEC L.VELOCITYHI ; 03435 A3FE 18 03436 SKIP013 CLC ; New coordinate := old coordinate + 16-bit velocity A3FF 79D30A 03437 ADC ZPOSLO,Y ; (signed 24-bit addition) A402 99D30A 03438 STA ZPOSLO,Y ; A405 B9400A 03439 LDA ZPOSHI,Y ; A408 656B 03440 ADC L.VELOCITYHI ; A40A 99400A 03441 STA ZPOSHI,Y ; A40D B9AD09 03442 LDA ZPOSSIGN,Y ; A410 656B 03443 ADC L.VELOCITYHI ; A412 99AD09 03444 STA ZPOSSIGN,Y ; 03445 A415 98 03446 TYA ; A416 18 03447 CLC ; A417 6931 03448 ADC #MAXSPCOBJNUM ; A419 C990 03449 CMP #144 ; (!) A41B 90CE 03450 BCC LOOP018 ; Next coordinate 03451 A41D CA 03452 DEX ; A41E 10C4 03453 BPL LOOP017 ; Next space object 03454 03455 ;*** (11) Correct over/underflow of PLAYER space objects' position vector ****** A420 A004 03456 LDY #4 ; A422 98 03457 LOOP019 TYA ; Loop over all PLAYER space objects (X index < 5) A423 AA 03458 TAX ; 03459 A424 A902 03460 LDA #2 ; Loop over all 3 coordinates A426 856A 03461 STA L.VECCOMPIND ; 03462 A428 BDAD09 03463 LOOP020 LDA ZPOSSIGN,X ; Load sign of coordinate A42B C902 03464 CMP #2 ; A42D 9010 03465 BCC SKIP015 ; Skip if sign = 0 (negative) or 1 (positive) 03466 A42F 0A 03467 ASL A ; SUMMARY: A430 A900 03468 LDA #0 ; If new coordinate > +65535 <KM> subtract 256 <KM> A432 9DAD09 03469 STA ZPOSSIGN,X ; ...until new coordinate <= +65535 <KM> A435 B005 03470 BCS SKIP014 ; If new coordinate < -65536 <KM> add 256 <KM> A437 FEAD09 03471 INC ZPOSSIGN,X ; ...until new coordinate >= -65536 <KM> A43A 49FF 03472 EOR #$FF ; A43C 9D400A 03473 SKIP014 STA ZPOSHI,X ; 03474 A43F 8A 03475 SKIP015 TXA ; A440 18 03476 CLC ; A441 6931 03477 ADC #MAXSPCOBJNUM ; A443 AA 03478 TAX ; A444 C66A 03479 DEC L.VECCOMPIND ; A446 10E0 03480 BPL LOOP020 ; Next coordinate 03481 A448 88 03482 DEY ; A449 10D7 03483 BPL LOOP019 ; Next space object 03484 03485 ;*** (12) Calc perspective projection of space objects ************************* A44B A5D0 03486 LDA SHIPVIEW ; Skip if in Long-Range Scan or Galactic Chart view A44D C902 03487 CMP #$02 ; A44F B05C 03488 BCS SKIP019 ; 03489 A451 A679 03490 LDX MAXSPCOBJIND ; Loop over all space objects in use A453 A9FF 03491 LOOP021 LDA #255 ; Prep magic offscreen pixel number value A455 BCAD09 03492 LDY ZPOSSIGN,X ; Compare sign of z-coordinate with view mode A458 C4D0 03493 CPY SHIPVIEW ; A45A F04B 03494 BEQ SKIP018 ; Equal? Space object is offscreen -> New space obj! 03495 A45C BD0F0A 03496 LDA YPOSSIGN,X ; Prepare projection division... A45F D012 03497 BNE SKIP016 ; DIVIDEND (16-bit value) := ABS(y-coordinate) A461 38 03498 SEC ; (used in subroutine PROJECTION) A462 A900 03499 LDA #0 ; A464 FD350B 03500 SBC YPOSLO,X ; A467 856A 03501 STA DIVIDEND ; A469 A900 03502 LDA #0 ; A46B FDA20A 03503 SBC YPOSHI,X ; A46E 856B 03504 STA DIVIDEND+1 ; A470 4C7DA4 03505 JMP JUMP001 ; A473 BD350B 03506 SKIP016 LDA YPOSLO,X ; A476 856A 03507 STA DIVIDEND ; A478 BDA20A 03508 LDA YPOSHI,X ; A47B 856B 03509 STA DIVIDEND+1 ; 03510 A47D 2021AA 03511 JUMP001 JSR PROJECTION ; Calc pixel row number rel. to screen center A480 201EB7 03512 JSR SCREENROW ; Calc pixel row number rel. to top-left of screen 03513 A483 BDDE09 03514 LDA XPOSSIGN,X ; Prepare projection division... A486 D012 03515 BNE SKIP017 ; DIVIDEND (16-bit value) := ABS(x-coordinate) A488 38 03516 SEC ; (used in subroutine PROJECTION) A489 A900 03517 LDA #0 ; A48B FD040B 03518 SBC XPOSLO,X ; A48E 856A 03519 STA DIVIDEND ; A490 A900 03520 LDA #0 ; A492 FD710A 03521 SBC XPOSHI,X ; A495 856B 03522 STA DIVIDEND+1 ; A497 4CA4A4 03523 JMP JUMP002 ; A49A BD040B 03524 SKIP017 LDA XPOSLO,X ; A49D 856A 03525 STA DIVIDEND ; A49F BD710A 03526 LDA XPOSHI,X ; A4A2 856B 03527 STA DIVIDEND+1 ; 03528 A4A4 2021AA 03529 JUMP002 JSR PROJECTION ; Calc pixel column number rel. to screen center A4A7 20FBB6 03530 SKIP018 JSR SCREENCOLUMN ; Calc pixel column number rel. to top-left of screen A4AA CA 03531 DEX ; A4AB 10A6 03532 BPL LOOP021 ; Next space object 03533 03534 ;*** (13) Handle hyperwarp marker selection in Galactic Chart view ************* A4AD 2062B1 03535 SKIP019 JSR SELECTWARP ; Handle hyperwarp marker in Galactic Chart view 03536 03537 ;*** (14) Compute and draw Long-Range Scan view star field on z-x plane ******** A4B0 24D0 03538 BIT SHIPVIEW ; Skip if not in Long-Range Scan view A4B2 5031 03539 BVC SKIP022 ; 03540 A4B4 A231 03541 LDX #$31 ; Draw our starship's shape A4B6 206FA7 03542 JSR DRAWLINES ; 03543 A4B9 2C9609 03544 BIT GCSTATLRS ; Skip if Long-Range Scan destroyed A4BC 7027 03545 BVS SKIP022 ; 03546 A4BE A679 03547 LDX MAXSPCOBJIND ; Loop over all space objects in use A4C0 BD400A 03548 LOOP022 LDA ZPOSHI,X ; Load z-coordinate (high byte) A4C3 BCAD09 03549 LDY ZPOSSIGN,X ; Load sign of z-coordinate A4C6 D002 03550 BNE SKIP020 ; A4C8 49FF 03551 EOR #$FF ; A := ABS(z-coordinate (high byte)) A4CA A8 03552 SKIP020 TAY ; A4CB B9E90D 03553 LDA MAPTO80,Y ; Calc pixel row number rel. to screen center A4CE 201EB7 03554 JSR SCREENROW ; Calc pixel row number rel. to top-left of screen 03555 A4D1 BD710A 03556 LDA XPOSHI,X ; Load x-coordinate (high byte) A4D4 BCDE09 03557 LDY XPOSSIGN,X ; Load sign of x-coordinate A4D7 D002 03558 BNE SKIP021 ; A4D9 49FF 03559 EOR #$FF ; A := ABS(x-coordinate (high byte)) A4DB A8 03560 SKIP021 TAY ; A4DC B9E90D 03561 LDA MAPTO80,Y ; Calc pixel column number rel. to screen center A4DF 20FBB6 03562 JSR SCREENCOLUMN ; Calc pixel column number rel. to top-left of screen 03563 A4E2 CA 03564 DEX ; A4E3 10DB 03565 BPL LOOP022 ; Next space object 03566 03567 ;*** (15) Update PLAYER shapes, heights, and colors **************************** 03568 03569 ; DESCRIPTION 03570 ; 03571 ; In a loop over all PLAYERs, the following steps are executed: 03572 ; 03573 ; o Clear the PLAYER shape offset and height. 03574 ; 03575 ; o If in Galactic Chart view or in Long-Range Scan view, preload a random 03576 ; color and a magic z-coordinate (distance value) for PLAYER3..4 03577 ; (representing hyperwarp markers in Galactic Chart view and blips in the 03578 ; Long-Range Scan view, like, for example, Zylon ships, meteors - or even 03579 ; the Hyperwarp Target Marker during hyperwarp!). 03580 ; 03581 ; o If in Front or Aft view, execute the following steps: 03582 ; 03583 ; o Skip dead PLAYERs. 03584 ; 03585 ; o Preload the distance value for the remaining live PLAYERs. 03586 ; 03587 ; o If we are in a starbase sector, combine PLAYER0..2 into a three-part 03588 ; starbase shape. Compute the pixel column numbers and pixel row 03589 ; numbers of PLAYER0..1 such that they are arranged left (PLAYER0) and 03590 ; right (PLAYER1) of PLAYER2. In addition, preload a color mask, a 03591 ; counter actually, that will make the starbase pulsate in brightness. 03592 ; 03593 ; BUG (at $A512): The code at $A512 that skips the combination operation for 03594 ; PLAYER2..4 jumps for PLAYER3..4 to SKIP025 at $A52A instead of SKIP026 at 03595 ; $A52E. Thus it stores a color mask which does not only make the starbase 03596 ; PLAYER0..2 pulsate in brightness but also PLAYER3..4 in a starbase sector, 03597 ; for example the transfer vessel, photon torpedoes, etc. - or even the 03598 ; Hyperwarp Target Marker when hyperwarping out of such a sector! Suggested 03599 ; fix: None, code hard to untwist. 03600 ; 03601 ; o After storing the color mask, check if the PLAYER shape is still above the 03602 ; bottom edge of the PLAYFIELD. 03603 ; 03604 ; BUG (at $A534): The test checks the vertical position of the top edge of 03605 ; the PLAYER against the bottom edge of the PLAYFIELD above the Console 03606 ; Panel Display (= Player/Missile pixel row number 204). This is not 03607 ; completely accurate as the Console Panel Display starts at PM pixel row 03608 ; number 208. For example, if you carefully navigate a starbase to the 03609 ; bottom edge of the PLAYFIELD, at a certain point the center of the 03610 ; starbase shape bleeds over the bottom edge of the PLAYFIELD (while 03611 ; sometimes even losing its left and right wings!). Suggested fix: None, as 03612 ; a more elaborate test may consume too many bytes of the cartridge ROM 03613 ; memory in order to fix a rarely noticed visual glitch. 03614 ; 03615 ; o Convert the preloaded distance value of a PLAYER space object closer than 03616 ; $2000 (8192) <KM> into a range index of 0..15. PLAYER space objects more 03617 ; distant than $2000 (8192) <KM> are skipped and not displayed. 03618 ; 03619 ; Later, this range index will pick not only the correct brightness for the 03620 ; PLAYER (the closer the space object the brighter its PLAYER) but also the 03621 ; correct PLAYER shape cell and height (the closer the space object the 03622 ; larger the PLAYER shape and height). 03623 ; 03624 ; o Update the PLAYER's shape offset and height. On the way to the shape 03625 ; offset and height add the PLAYER's shape type to the range index and 03626 ; divide it by 2 to arrive at the shape offset index and height index (the 03627 ; same value). Use this index to pick the correct shape data and shape 03628 ; heights from a set of shape cells and their corresponding heights, stored 03629 ; in tables PLSHAPOFFTAB ($BE2F) and PLSHPHEIGHTTAB ($BE7F), respectively. 03630 ; 03631 ; Remember that magic distance value used in the Galactic Chart and 03632 ; Long-Range Scan view? Its value of $F2 is actually part of a negative 03633 ; z-coordinate which is inverted to $0D00, leading to a range index of 13, 03634 ; which, after the division by 2, picks shape cell 6. Shape cell 6 (the 03635 ; seventh shape cell) of all space objects (except the starbase) is the 03636 ; Long-Range Scan blip's dot (see PLSHAPOFFTAB ($BE2F) and PLSHPHEIGHTTAB 03637 ; ($BE7F)). 03638 ; 03639 ; o Update the PLAYER's color/brightness by picking the appropriate values 03640 ; with the range index from lookup tables PLSHAPCOLORTAB ($BFD1) and 03641 ; PLSHAPBRITTAB ($BFDB). Apply some special effects to the color/brightness 03642 ; of certain PLAYERs, such as using random colors for Zylon basestars, or 03643 ; using the precomputed pulsating brightness value for a starbase. 03644 A4E5 A205 03645 SKIP022 LDX #5 ; Loop over all PLAYER space objects (X index < 5) A4E7 CA 03646 LOOP023 DEX ; A4E8 1003 03647 BPL SKIP023 ; Jump into loop body below A4EA 4C79A5 03648 JMP JUMP003 ; Loop is finished, skip loop body 03649 03650 ;*** Clear PLAYER shape offsets and heights ************************************ A4ED A900 03651 SKIP023 LDA #0 ; A4EF 95E4 03652 STA PL0SHAPOFF,X ; Clear PLAYER shape offset A4F1 9DEE0C 03653 STA PL0HEIGHTNEW,X ; Clear new PLAYER shape height 03654 03655 ;*** Preload stuff for hyperwarp markers and Long-Range Scan blips ************* A4F4 24D0 03656 BIT SHIPVIEW ; Skip if not in Galactic Chart view A4F6 100B 03657 BPL SKIP024 ; 03658 A4F8 E003 03659 CPX #3 ; Next PLAYER space object if not PLAYER3..4 A4FA 90EB 03660 BCC LOOP023 ; A4FC AD0AD2 03661 LOOP024 LDA RANDOM ; Prep random color mask for warp markers/LRS blips A4FF A0F2 03662 LDY #$F2 ; Prep magic z-coordinate for warp markers/LRS blips A501 302B 03663 BMI SKIP026 ; Unconditional jump 03664 A503 D5E9 03665 SKIP024 CMP PL0LIFE,X ; Next PLAYER space object if this PLAYER not alive A505 F0E0 03666 BEQ LOOP023 ; 03667 A507 70F3 03668 BVS LOOP024 ; Skip back if in Long-Range Scan view 03669 03670 ;*** Preload stuff for other views ********************************************* 03671 A509 BC400A 03672 LDY PL0ZPOSHI,X ; Prep z-coordinate (high byte) 03673 03674 ;*** Combine PLAYER0..2 to starbase shape ************************************** A50C 247B 03675 BIT ISSTARBASESECT ; Skip if no starbase in this sector A50E 501E 03676 BVC SKIP026 ; 03677 A510 E002 03678 CPX #2 ; Skip if not PLAYER0..1 A512 B016 03679 BCS SKIP025 ; (!) 03680 A514 AD2C0C 03681 LDA PL2COLUMN ; Calc new PM pixel column number for PLAYER0..1: A517 18 03682 CLC ; Load PLAYER2 (starbase center) pixel column number A518 7DDBBE 03683 ADC PLSTARBAOFFTAB,X ; ...add PLAYER left/right offset (starbase wings) A51B 9D2A0C 03684 STA PL0COLUMN,X ; Store new PM pixel column number of starbase wing 03685 A51E ADFB0B 03686 LDA PL2ROWNEW ; Calc new PM pixel row number for PLAYER0..1: A521 18 03687 CLC ; Add vertical offset (= 4 PM pixels) to PLAYER2's A522 6904 03688 ADC #4 ; A524 9DF90B 03689 STA PL0ROWNEW,X ; Store new PM pixel row number of starbase wing 03690 A527 AC420A 03691 LDY PL2ZPOSHI ; Prep Y with z-coordinate (high byte) of starbase A52A A576 03692 SKIP025 LDA COUNT256 ; Prep color mask with B3..0 of counter A52C 290F 03693 AND #$0F ; ...(= brightness bits cause pulsating brightness) 03694 A52E 856B 03695 SKIP026 STA L.COLORMASK ; Store color mask 03696 03697 ;*** Check if PLAYER is below PLAYFIELD bottom edge **************************** A530 98 03698 TYA ; A := z-coordinate (high byte) 03699 A531 BCF90B 03700 LDY PL0ROWNEW,X ; Next PLAYER space object if top of PM shape... A534 C0CC 03701 CPY #204 ; ...is below PLAYFIELD bottom... (!) A536 B0AF 03702 BCS LOOP023 ; ...(PM pixel row number >= 204) 03703 03704 ;*** Convert PLAYER z-coordinate to range index in 0..15 *********************** A538 A4D0 03705 LDY SHIPVIEW ; Skip if in Front view... A53A F002 03706 BEQ SKIP027 ; A53C 49FF 03707 EOR #$FF ; ...else invert z-coordinate (high byte) 03708 A53E C920 03709 SKIP027 CMP #$20 ; Next PLAYER space object if this one too far away A540 B0A5 03710 BCS LOOP023 ; ...(z-coordinate >= $20** (8192) <KM>) 03711 A542 C910 03712 CMP #16 ; Load z-coordinate (high byte) and... A544 9002 03713 BCC SKIP028 ; A546 A90F 03714 LDA #15 ; A548 856A 03715 SKIP028 STA L.RANGEINDEX ; ...trim to range index in 0..15 03716 03717 ;*** Update PLAYER shape offset and height ************************************* A54A 1D8C0C 03718 ORA PL0SHAPTYPE,X ; Calc offset to shape table (shape type+range index) A54D 4A 03719 LSR A ; A54E A8 03720 TAY ; Divide by 2 to get actual offset into shape data A54F B92FBE 03721 LDA PLSHAPOFFTAB,Y ; Update new PLAYER shape offset A552 95E4 03722 STA PL0SHAPOFF,X ; A554 B97FBE 03723 LDA PLSHPHEIGHTTAB,Y ; Update new PLAYER shape height A557 9DEE0C 03724 STA PL0HEIGHTNEW,X ; 03725 03726 ;*** Calculate PLAYER color/brightness value *********************************** A55A 98 03727 TYA ; Pick color (B7..4) using PLAYER shape type A55B 4A 03728 LSR A ; A55C 4A 03729 LSR A ; A55D 4A 03730 LSR A ; A55E A8 03731 TAY ; A55F B9D1BF 03732 LDA PLSHAPCOLORTAB,Y ; A562 C008 03733 CPY #8 ; Pick random color if ZYLON BASESTAR (shape type 8) A564 D003 03734 BNE SKIP029 ; A566 4D0AD2 03735 EOR RANDOM ; A569 A46A 03736 SKIP029 LDY L.RANGEINDEX ; A56B 59DBBF 03737 EOR PLSHAPBRITTAB,Y ; Pick brightness (B3..0) using range index and merge 03738 A56E 456B 03739 EOR L.COLORMASK ; Modify color/brightness of PLAYER 03740 A570 BCDFB8 03741 LDY PLCOLOROFFTAB,X ; Get PLAYER color offset A573 99EE00 03742 STA PL0COLOR,Y ; Store color in PLAYER color register A576 4CE7A4 03743 JMP LOOP023 ; Next PLAYER space object 03744 03745 ;*** (16) Flash red alert ****************************************************** A579 A0AF 03746 JUMP003 LDY #$AF ; Prep PLAYFIELD2 color {BRIGHT BLUE-GREEN} A57B A681 03747 LDX SHIELDSCOLOR ; Prep Shields color {DARK GREEN} or {BLACK} 03748 A57D A58B 03749 LDA REDALERTLIFE ; Skip if red alert is over A57F F00C 03750 BEQ SKIP030 ; 03751 A581 C68B 03752 DEC REDALERTLIFE ; Decrement lifetime of red alert A583 A04F 03753 LDY #$4F ; Prep PLAYFIELD2 color {BRIGHT ORANGE} 03754 A585 2920 03755 AND #$20 ; Switch colors every 64 game loops A587 F004 03756 BEQ SKIP030 ; 03757 A589 A242 03758 LDX #$42 ; Load BACKGROUND color {DARK ORANGE} A58B A060 03759 LDY #$60 ; Load PLAYFIELD2 color {DARK PURPLE BLUE} 03760 A58D 84F4 03761 SKIP030 STY PF2COLOR ; Store PLAYFIELD2 color A58F 86F6 03762 STX BGRCOLOR ; Store BACKGROUND color 03763 03764 ;*** (17) Update color of PLAYFIELD space objects (stars, explosion fragments) * A591 A679 03765 LDX MAXSPCOBJIND ; Loop over all PLAYFIELD space objs (X index > 4) A593 BD400A 03766 LOOP025 LDA ZPOSHI,X ; Prep z-coordinate (high byte) A596 A4D0 03767 LDY SHIPVIEW ; A598 C001 03768 CPY #1 ; Skip if not in Aft view A59A D009 03769 BNE SKIP032 ; 03770 A59C C9F0 03771 CMP #$F0 ; Skip if star not too far (z < $F0** (-4096) <KM> A59E B003 03772 BCS SKIP031 ; A5A0 2064B7 03773 JSR INITPOSVEC ; Re-init position vector A5A3 49FF 03774 SKIP031 EOR #$FF ; Invert z-coordinate (high byte) 03775 A5A5 C910 03776 SKIP032 CMP #16 ; Convert z-coordinate (high byte) A5A7 9002 03777 BCC SKIP033 ; ...into range index 0..15 A5A9 A90F 03778 LDA #15 ; 03779 A5AB 0A 03780 SKIP033 ASL A ; Compute index to pixel color table: A5AC 291C 03781 AND #$1C ; Use bits B3..1 from range index as B4..2. A5AE 0572 03782 ORA COUNT8 ; Combine with random bits B3..0 from counter 03783 A5B0 A8 03784 TAY ; A5B1 B990BA 03785 LDA FOURCOLORPIXEL,Y ; Load 1-byte bit pattern for 4 pixels of same color A5B4 856A 03786 STA L.FOURCOLORPIX ; ...and temporarily save it 03787 A5B6 BD2A0C 03788 LDA PIXELCOLUMN,X ; Load pixel mask to mask 1 pixel out of 4 pixels: A5B9 2903 03789 AND #$03 ; Use B1..0 from pixel column number... A5BB A8 03790 TAY ; A5BC B9B0BA 03791 LDA PIXELMASKTAB,Y ; ...to pick mask to filter pixel in byte A5BF 256A 03792 AND L.FOURCOLORPIX ; ...AND with 1-byte bit pattern for 4 pixels A5C1 9DEE0C 03793 STA PIXELBYTE,X ; ...store byte (used in repaint step of game loop) 03794 A5C4 CA 03795 DEX ; A5C5 E005 03796 CPX #5 ; A5C7 B0CA 03797 BCS LOOP025 ; Next PLAYFIELD space object 03798 03799 ;*** (18) Skip input handling if in demo mode ********************************** A5C9 2464 03800 BIT ISDEMOMODE ; If in demo mode skip to function keys A5CB 5003 03801 BVC SKIP034 ; A5CD 4C9BA6 03802 JMP SKIP040 ; 03803 03804 ;*** (19) Handle keyboard input ************************************************ A5D0 20FEAF 03805 SKIP034 JSR KEYBOARD ; Handle keyboard input 03806 03807 ;*** (20) Handle joystick input ************************************************ A5D3 AD00D3 03808 LDA PORTA ; Load Joystick 0 directions A5D6 A8 03809 TAY ; ...Bits B0..3 -> Right, left, down, up. A5D7 2903 03810 AND #$03 ; ...Bit = 0/1 -> Stick pressed/not pressed A5D9 AA 03811 TAX ; JOYSTICKY := +1 -> Up A5DA BDF5BA 03812 LDA STICKINCTAB,X ; JOYSTICKY := 0 -> Centered A5DD 85C9 03813 STA JOYSTICKY ; JOYSTICKY := -1 -> Down A5DF 98 03814 TYA ; A5E0 4A 03815 LSR A ; A5E1 4A 03816 LSR A ; A5E2 2903 03817 AND #$03 ; A5E4 AA 03818 TAX ; JOYSTICKX := -1 -> Left A5E5 BDF5BA 03819 LDA STICKINCTAB,X ; JOYSTICKX := 0 -> Centered A5E8 85C8 03820 STA JOYSTICKX ; JOYSTICKX := +1 -> Right 03821 03822 ;*** (21) Check if our starship's photon torpedoes have hit a target *********** A5EA 203DAF 03823 JSR COLLISION ; Check if our starship's photon torpedoes have hit 03824 03825 ;*** (22) Handle joystick trigger ********************************************** A5ED 2029AE 03826 JSR TRIGGER ; Handle joystick trigger 03827 03828 ;*** (23) Handle Attack Computer and Tracking Computer ************************* A5F0 2C9509 03829 BIT GCSTATCOM ; Skip if Attack Computer destroyed A5F3 7040 03830 BVS SKIP038 ; 03831 A5F5 A57E 03832 LDA ISATTCOMPON ; Skip if Attack Computer off A5F7 F03C 03833 BEQ SKIP038 ; 03834 A5F9 A5D0 03835 LDA SHIPVIEW ; Skip if not in Front view A5FB D003 03836 BNE SKIP035 ; 03837 A5FD 20BFA7 03838 JSR UPDATTCOMP ; Update Attack Computer Display 03839 A600 AE5C09 03840 SKIP035 LDX TRACKDIGIT ; Load index of tracked space object 03841 A603 A5BF 03842 LDA ZYLONATTACKER ; Skip if ship of current Zylon torpedo is tracked A605 3005 03843 BMI SKIP036 ; A607 AA 03844 TAX ; ...else override Tracking Computer... A608 0980 03845 ORA #$80 ; A60A 85BF 03846 STA ZYLONATTACKER ; ...and mark Zylon torpedo's ship as being tracked 03847 A60C B5E9 03848 SKIP036 LDA PL0LIFE,X ; Skip if tracked space object still alive A60E D00B 03849 BNE SKIP037 ; 03850 A610 8A 03851 TXA ; A611 4901 03852 EOR #$01 ; A613 AA 03853 TAX ; A614 B5E9 03854 LDA PL0LIFE,X ; Check if other Zylon ship still alive A616 D003 03855 BNE SKIP037 ; ...yes -> Keep new index A618 AE5C09 03856 LDX TRACKDIGIT ; ...no -> Revert to old index of tracked space obj 03857 A61B 8E5C09 03858 SKIP037 STX TRACKDIGIT ; Store index of tracked space object 03859 A61E A57C 03860 LDA ISTRACKCOMPON ; Skip if tracking computer is turned off A620 F013 03861 BEQ SKIP038 ; 03862 A622 A5D0 03863 LDA SHIPVIEW ; Skip if in Long-Range Scan or Galactic Chart view A624 C902 03864 CMP #2 ; A626 B00D 03865 BCS SKIP038 ; 03866 A628 4901 03867 EOR #$01 ; A62A DDAD09 03868 CMP ZPOSSIGN,X ; Compare tracked space obj's sign of z-coordinate... A62D F006 03869 BEQ SKIP038 ; ...with view direction. Skip if both are the same. 03870 A62F AA 03871 TAX ; A630 BDCFBE 03872 LDA TRACKKEYSTAB,X ; Pick 'F' or 'A' (Front or Aft view) keyboard code A633 85CA 03873 STA KEYCODE ; ...and store it (= emulate pressing 'F' or 'A' key) 03874 03875 ;*** (24) Handle docking to starbase ******************************************* A635 20E6AC 03876 SKIP038 JSR DOCKING ; Handle docking to starbase 03877 03878 ;*** (25) Handle maneuvering *************************************************** A638 2079AA 03879 JSR MANEUVER ; Handle maneuvering photon torpedoes and Zylon ships 03880 03881 ;*** (26) Was our starship hit by Zylon photon torpedo? ************************ A63B A57B 03882 LDA ISSTARBASESECT ; Skip hit check if in starbase sector A63D D05C 03883 BNE SKIP040 ; 03884 A63F A5EB 03885 LDA PL2LIFE ; Skip hit check if PLAYER2 (Zylon photon torpedo)... A641 F058 03886 BEQ SKIP040 ; ...not alive 03887 A643 AC420A 03888 LDY PL2ZPOSHI ; Our starship was not hit if Zylon photon torpedo's A646 C8 03889 INY ; ...z-coordinate is not in -256..255 <KM> or... A647 C002 03890 CPY #$02 ; A649 B050 03891 BCS SKIP040 ; 03892 A64B AC730A 03893 LDY PL2XPOSHI ; ...x-coordinate is not in -256..255 <KM> or... A64E C8 03894 INY ; A64F C002 03895 CPY #$02 ; A651 B048 03896 BCS SKIP040 ; 03897 A653 ACA40A 03898 LDY PL2YPOSHI ; ...y-coordinate is not in -256..255 <KM>. A656 C8 03899 INY ; A657 C002 03900 CPY #$02 ; A659 B040 03901 BCS SKIP040 ; 03902 03903 ;*** (27) Our starship was hit! ************************************************ A65B 20E1AE 03904 JSR DAMAGE ; Damage or destroy some subsystem 03905 A65E A002 03906 LDY #2 ; Trigger explosion at PLAYER2 (Zylon photon torpedo) A660 206BAC 03907 JSR INITEXPL ; 03908 A663 A27F 03909 LDX #$7F ; Prep HITBADNESS := SHIELDS HIT A665 A581 03910 LDA SHIELDSCOLOR ; Skip if Shields are up (SHIELDSCOLOR not {BLACK}). A667 D01E 03911 BNE SKIP039 ; 03912 A669 A20A 03913 LDX #$0A ; Set Front view A66B 2045B0 03914 JSR SETVIEW ; 03915 A66E A023 03916 LDY #$23 ; Set title phrase "SHIP DESTROYED BY ZYLON FIRE" A670 A208 03917 LDX #8 ; Set mission bonus offset A672 200AB1 03918 JSR GAMEOVER ; Game over 03919 A675 A25F 03920 LDX #$5F ; Hide Control Panel Display (bottom text window) A677 A080 03921 LDY #$80 ; A679 A908 03922 LDA #$08 ; A67B 20F1AD 03923 JSR MODDLST ; 03924 A67E 200DAE 03925 JSR CLRPLAYFIELD ; Clear PLAYFIELD 03926 A681 A240 03927 LDX #64 ; Enable special explosion noise in SOUND A683 86E3 03928 STX NOISEHITLIFE ; 03929 A685 A2FF 03930 LDX #$FF ; Prep HITBADNESS := STARSHIP DESTROYED 03931 A687 868A 03932 SKIP039 STX HITBADNESS ; Store HITBADNESS A689 A900 03933 LDA #0 ; Zylon photon torpedo lifetime := 0 game loops A68B 85EB 03934 STA PL2LIFE ; A68D A902 03935 LDA #2 ; Init Zylon photon torpedo trigger A68F 85BE 03936 STA TORPEDODELAY ; 03937 A691 A201 03938 LDX #1 ; ENERGY := ENERGY - 100 after photon torpedo hit A693 206FB8 03939 JSR DECENERGY ; 03940 A696 A20A 03941 LDX #$0A ; Play noise sound pattern SHIP EXPLOSION A698 20A8AE 03942 JSR NOISE ; 03943 03944 ;*** (28) Handle function keys ************************************************* A69B A463 03945 SKIP040 LDY FKEYCODE ; Prep old function key code A69D AD1FD0 03946 LDA CONSOL ; POKEY: Load function key code 03947 A6A0 49FF 03948 EOR #$FF ; Store inverted and masked function key code A6A2 2903 03949 AND #$03 ; A6A4 8563 03950 STA FKEYCODE ; A6A6 F01A 03951 BEQ SKIP042 ; Skip if no function key pressed 03952 A6A8 88 03953 DEY ; A6A9 1017 03954 BPL SKIP042 ; Skip if SELECT or START still pressed A6AB 8566 03955 STA IDLECNTHI ; Reset idle counter to a value in 1..3 (?) A6AD C902 03956 CMP #2 ; Skip if SELECT function key pressed A6AF B006 03957 BCS SKIP041 ; 03958 A6B1 A900 03959 LDA #0 ; START function key pressed: A6B3 A8 03960 TAY ; Prep empty title phrase offset A6B4 4C5EA1 03961 JMP INITSTART ; Reenter game loop via INITSTART 03962 A6B7 E662 03963 SKIP041 INC MISSIONLEVEL ; SELECT function key pressed: A6B9 A562 03964 LDA MISSIONLEVEL ; Cycle through next of 4 mission levels A6BB 2903 03965 AND #$03 ; A6BD 8562 03966 STA MISSIONLEVEL ; A6BF 4C5AA1 03967 JMP INITSELECT ; Reenter game loop via INITSELECT 03968 03969 ;*** (29) Update Control Panel Display ***************************************** A6C2 2004B8 03970 SKIP042 JSR UPDPANEL ; Update Control Panel Display 03971 03972 ;*** (30) Handle hyperwarp ***************************************************** A6C5 209BA8 03973 JSR HYPERWARP ; Handle hyperwarp 03974 03975 ;*** (31) Update title line **************************************************** A6C8 2016B2 03976 JSR UPDTITLE ; Update title line 03977 03978 ;*** (32) Flush game loop iteration ******************************************** A6CB 20E4B4 03979 JSR FLUSHGAMELOOP ; Move Zylon units, age torpedoes, elapse time 03980 03981 ;*** (33) Jump back to begin of game loop ************************************** A6CE 4CF3A1 03982 JMP GAMELOOP ; Next game loop iteration 03983 03984 ;******************************************************************************* 03985 ;* * 03986 ;* VBIHNDLR * 03987 ;* * 03988 ;* Vertical Blank Interrupt Handler * 03989 ;* * 03990 ;******************************************************************************* 03991 03992 ; DESCRIPTION 03993 ; 03994 ; This subroutine is executed during the Vertical Blank Interrupt (VBI) when the 03995 ; TV beam has reached the bottom-right corner of the TV screen and is switched 03996 ; off to return to the top-left position. This situation is called the "vertical 03997 ; blank phase". 03998 ; 03999 ; This subroutine signals its execution with flag ISVBISYNC ($67) (which is 04000 ; examined by GAMELOOP ($A1F3) to synchronize the execution of the game loop 04001 ; with the start of this subroutine). Then it switches the character set to the 04002 ; ROM character set, sets the BACKGROUND color depending on the severity of a 04003 ; Zylon photon torpedo hit and view mode, copies PLAYER and PLAYFIELD color 04004 ; registers to their corresponding hardware registers, clears the Player/Missile 04005 ; collision registers, calls the sound effects code in subroutine SOUND ($B2AB), 04006 ; and increments the idle counter. If the idle counter reaches the value $8000 04007 ; the title phrase is cleared and the program is switched to demo mode. 04008 ; 04009 ; BUG (at $A6EC): Because the values of SHIPVIEW ($D0) are $00, $01, $40, and 04010 ; $80, a value of 3 overspecifies the comparison. Suggested fix: Replace CMP #3 04011 ; with CMP #2, which may make the code clearer. 04012 ; 04013 ; BUG (at $A712): Demo mode is entered via a JMP instruction, which proceeds 04014 ; directly into GAMELOOP ($A1F3). Thus code execution never returns to pop the 04015 ; registers pushed on the stack during entry of this subroutine. Suggested fix: 04016 ; None. 04017 A6D1 A9FF 04018 VBIHNDLR LDA #$FF ; Signals entering Vertical Blank Interrupt A6D3 8567 04019 STA ISVBISYNC ; 04020 A6D5 A9E0 04021 LDA #>ROMCHARSET ; Switch character set to ROM character set A6D7 8D09D4 04022 STA CHBASE ; 04023 A6DA A6F6 04024 LDX BGRCOLOR ; Preload BACKGROUND color A6DC AD0AD2 04025 LDA RANDOM ; Preload random number A6DF 248A 04026 BIT HITBADNESS ; Check if our starship was hit A6E1 5007 04027 BVC SKIP044 ; If HITBADNESS has a value of... A6E3 3004 04028 BMI SKIP043 ; $00 -> NO HIT (BGR color := unchanged) A6E5 2972 04029 AND #$72 ; $7F -> SHIELDS HIT (BGR color := %01rr00r0) A6E7 0940 04030 ORA #$40 ; $FF -> STARSHIP DESTROYED (BGR color := %01rr00r0) A6E9 AA 04031 SKIP043 TAX ; A6EA A5D0 04032 SKIP044 LDA SHIPVIEW ; Skip if in Front or Aft view A6EC C903 04033 CMP #3 ; (!) A6EE 9002 04034 BCC SKIP045 ; A6F0 A2A0 04035 LDX #$A0 ; Preload BACKGROUND color {DARK BLUE GREEN}... A6F2 86F6 04036 SKIP045 STX BGRCOLOR ; Store BACKGROUND color 04037 A6F4 A208 04038 LDX #8 ; Copy all color registers to hardware registers A6F6 B5EE 04039 LOOP026 LDA PL0COLOR,X ; A6F8 9D12D0 04040 STA COLPM0,X ; A6FB CA 04041 DEX ; A6FC 10F8 04042 BPL LOOP026 ; 04043 A6FE 8D1ED0 04044 STA HITCLR ; Clear Player/Missile collision registers 04045 A701 20ABB2 04046 JSR SOUND ; Call sound effects 04047 A704 E677 04048 INC IDLECNTLO ; Increment 16-bit idle counter A706 D00D 04049 BNE SKIP046 ; A708 A566 04050 LDA IDLECNTHI ; A70A 3009 04051 BMI SKIP046 ; A70C E666 04052 INC IDLECNTHI ; A70E 1005 04053 BPL SKIP046 ; Skip if counter value of $8000 not reached yet 04054 A710 A000 04055 LDY #$00 ; Prep empty title phrase offset A712 4C5CA1 04056 JMP INITDEMO ; Enter demo mode (!) 04057 A715 4C4BA7 04058 SKIP046 JMP JUMP004 ; Return via DLI return code 04059 04060 ;******************************************************************************* 04061 ;* * 04062 ;* DLSTHNDLR * 04063 ;* * 04064 ;* Display List Interrupt Handler * 04065 ;* * 04066 ;******************************************************************************* 04067 04068 ; DESCRIPTION 04069 ; 04070 ; This subroutine is executed during the Display List Interrupt (DLI). It 04071 ; switches the character set to the ROM character set if the DLI occurs at ANTIC 04072 ; line 96 (video line 192), otherwise to the custom character set. The former 04073 ; happens in the Galactic Chart view where the ROM character set is used in the 04074 ; Galactic Chart Panel Display. 04075 ; 04076 ; Then, the DLI PLAYFIELD colors are copied to the corresponding hardware 04077 ; registers and the values of the collision hardware registers for PLAYER3..4 04078 ; (our starship's photon torpedoes) are copied to the corresponding zero-page 04079 ; variables PL3HIT ($82) and PL4HIT ($83). 04080 A718 48 04081 DLSTHNDLR PHA ; Push A A719 8A 04082 TXA ; A71A 48 04083 PHA ; Push X A71B 98 04084 TYA ; A71C 48 04085 PHA ; Push Y 04086 A71D A9E0 04087 LDA #>ROMCHARSET ; Switch to ROM charset if ANTIC line counter = 96 A71F AC0BD4 04088 LDY VCOUNT ; ...else switch to custom character set A722 C060 04089 CPY #96 ; A724 F002 04090 BEQ SKIP047 ; A726 A9A0 04091 LDA #>CHARSET ; A728 8D09D4 04092 SKIP047 STA CHBASE ; 04093 A72B A204 04094 LDX #4 ; Loop over all PLAYFIELD colors A72D 8D0AD4 04095 STA WSYNC ; Stop and wait for horizontal TV beam sync A730 B5F7 04096 LOOP027 LDA PF0COLORDLI,X ; Copy DLI PLAYFIELD colors to hardware registers A732 9D16D0 04097 STA COLPF0,X ; A735 CA 04098 DEX ; A736 10F8 04099 BPL LOOP027 ; Next PLAYFIELD color 04100 A738 AD08D0 04101 LDA M0PL ; Merge MISSILE-to-PLAYER collision registers... A73B 0D09D0 04102 ORA M1PL ; A73E 0D0AD0 04103 ORA M2PL ; A741 0D0BD0 04104 ORA M3PL ; A744 8583 04105 STA PL4HIT ; ...and store them in PL4HIT A746 AD0FD0 04106 LDA P3PL ; Copy PLAYER3-to-PLAYER coll. register to PL3HIT A749 8582 04107 STA PL3HIT ; 04108 A74B 68 04109 JUMP004 PLA ; Pop Y A74C A8 04110 TAY ; A74D 68 04111 PLA ; Pop X A74E AA 04112 TAX ; A74F 68 04113 PLA ; Pop A A750 40 04114 RTI ; Return from interrupt 04115 04116 ;******************************************************************************* 04117 ;* * 04118 ;* IRQHNDLR * 04119 ;* * 04120 ;* Interrupt Request (IRQ) Handler * 04121 ;* * 04122 ;******************************************************************************* 04123 04124 ; DESCRIPTION 04125 ; 04126 ; This subroutine is executed during immediate interrupt requests (IRQs), such 04127 ; as after pressing a key on the keyboard. It clears and disables all IRQs 04128 ; except the interrupt raised by a pressed key. If a key has been pressed, its 04129 ; hardware code is collected and the bits of the SHIFT and CONTROL keys are 04130 ; added. The resulting keyboard code is stored in KEYCODE ($CA). 04131 A751 48 04132 IRQHNDLR PHA ; Push A A752 A900 04133 LDA #0 ; POKEY: Disable all IRQs A754 8D0ED2 04134 STA IRQEN ; A757 A940 04135 LDA #$40 ; POKEY: Enable keyboard interrupt (IRQ) A759 8D0ED2 04136 STA IRQEN ; A75C AD09D2 04137 LDA KBCODE ; POKEY: Load keyboard key code A75F 09C0 04138 ORA #$C0 ; Combine with SHIFT and CONTROL key bits A761 85CA 04139 STA KEYCODE ; Store keyboard code A763 68 04140 PLA ; Pop A A764 40 04141 RTI ; Return from interrupt 04142 04143 ;******************************************************************************* 04144 ;* * 04145 ;* DRAWLINES * 04146 ;* * 04147 ;* Draw horizontal and vertical lines * 04148 ;* * 04149 ;******************************************************************************* 04150 04151 ; DESCRIPTION 04152 ; 04153 ; Draws the Attack Computer Display (in Front view), cross hairs (in Front and 04154 ; Aft view), and our starship's shape (in Long-Range Scan view) on the PLAYFIELD 04155 ; (if the Attack Computer is not destroyed) by being passed an offset to table 04156 ; DRAWLINESTAB ($BAF9). This table consists of a list of 3-byte elements, 04157 ; terminated by an end marker byte ($FE). Each such element defines a single 04158 ; horizontal or vertical line, and is passed via memory addresses DIRLEN ($A4), 04159 ; PENROW ($A5), and PENCOLUMN ($A6) to subroutine DRAWLINE ($A782), which 04160 ; executes the actual drawing. See subroutine DRAWLINE ($A782) and table 04161 ; DRAWLINESTAB ($BAF9) for a description of the 3-byte elements. 04162 ; 04163 ; With every call of this subroutine the blip cycle counter is initialized to 04164 ; the start of the DELAY phase (see subroutine UPDATTCOMP ($A7BF)). 04165 ; 04166 ; NOTE: The entry to this subroutine is in mid-code, not at the beginning. 04167 ; 04168 ; INPUT 04169 ; 04170 ; X = Offset into DRAWLINESTAB ($BAF9). Used values are: 04171 ; $00 -> Draw Attack Computer Display and cross hairs (Front view) 04172 ; $2A -> Draw Aft view cross hairs (Aft view) 04173 ; $31 -> Draw our starship's shape (Long-Range Scan view) 04174 A765 99A400 04175 LOOP028 STA DIRLEN,Y ; Store byte of 3-byte element A768 E8 04176 INX ; A769 88 04177 DEY ; A76A 100E 04178 BPL SKIP048 ; Next byte of 3-byte element until 3 bytes copied A76C 2082A7 04179 JSR DRAWLINE ; Draw line on PLAYFIELD 04180 A76F A905 04181 DRAWLINES LDA #5 ; Init blip cycle to DELAY phase... A771 85A2 04182 STA BLIPCYCLECNT ; ...delays drawing each row 04183 A773 2C9509 04184 BIT GCSTATCOM ; Return if Attack Computer destroyed A776 7009 04185 BVS SKIP049 ; 04186 A778 A002 04187 LDY #2 ; A77A BDF9BA 04188 SKIP048 LDA DRAWLINESTAB,X ; Load byte of 3-byte element A77D C9FE 04189 CMP #$FE ; Loop until end marker byte ($FE) encountered A77F D0E4 04190 BNE LOOP028 ; A781 60 04191 SKIP049 RTS ; Return 04192 04193 ;******************************************************************************* 04194 ;* * 04195 ;* DRAWLINE * 04196 ;* * 04197 ;* Draw a single horizontal or vertical line * 04198 ;* * 04199 ;******************************************************************************* 04200 04201 ; DESCRIPTION 04202 ; 04203 ; Draws a single horizontal or vertical transparent line. 04204 ; 04205 ; There are two entries to this subroutine: 04206 ; 04207 ; (1) DRAWLINE ($A782) is entered from subroutine DRAWLINES ($A76F) to draw a 04208 ; line in COLOR1. 04209 ; 04210 ; (2) DRAWLINE2 ($A784) is entered from subroutine UPDATTCOMP ($A7BF) to draw 04211 ; the blip in COLOR2 in the Attack Computer Display. 04212 ; 04213 ; The position, direction, and length of the line is defined by three bytes 04214 ; passed in memory addresses DIRLEN ($A4), PENROW ($A5), and PENCOLUMN ($A6). 04215 ; 04216 ; A drawing operation draws one transparent line. It uses both the color 04217 ; register number of the overwritten (old) and the overwriting (new) pixel to 04218 ; decide on the new pixel color register number. This results in a transparent 04219 ; drawing effect. See the table below for all resulting combinations of color 04220 ; registers. 04221 ; 04222 ; +-----------+---------------+ 04223 ; | | Old Color | 04224 ; | | Register | 04225 ; | New Color +---------------+ 04226 ; | Register | 0 | 1 | 2 | 3 | 04227 ; +-----------+---+---+---+---+ 04228 ; | 0 | 0 | 1 | 2 | 3 | 04229 ; +-----------+---+---+---+---+ 04230 ; | 1 | 1 | 1 | 3 | 3 | 04231 ; +-----------+---+---+---+---+ 04232 ; | 2 | 2 | 3 | 2 | 3 | 04233 ; +-----------+---+---+---+---+ 04234 ; | 3 | 3 | 3 | 3 | 3 | 04235 ; +-----------+---+---+---+---+ 04236 ; 04237 ; For example, COLOR1 overwritten by COLOR2 yields COLOR3. If you look closely 04238 ; at the blip (in COLOR2) on the Attack Computer Display (in COLOR1) the lines 04239 ; of the Attack Computer Display shine through (in COLOR3) where they overlap. 04240 ; 04241 ; INPUT 04242 ; 04243 ; DIRLEN ($A4) = B7 = 0 -> Draw line to the left 04244 ; B7 = 1 -> Draw line downward 04245 ; B6..0 -> Length of line in pixels 04246 ; PENROW ($A5) = Start pixel row number of line 04247 ; PENCOLUMN ($A6) = Start pixel column number of line 04248 =006A 04249 L.PIXELBYTEOFF = $6A ; Within-row-offset to byte with pixel in PLAYFIELD =006B 04250 L.BITPAT = $6B ; 1-byte bit pattern for 4 pixels of same color =006E 04251 L.DIRSAV = $6E ; Saves DIRLEN 04252 A782 A955 04253 DRAWLINE LDA #$55 ; Copy 1-byte bit pattern for 4 pixels of COLOR1 A784 856B 04254 DRAWLINE2 STA L.BITPAT ; A786 A5A4 04255 LDA DIRLEN ; Copy direction (and length) of line A788 856E 04256 STA L.DIRSAV ; A78A 297F 04257 AND #$7F ; Strip direction bit A78C 85A4 04258 STA DIRLEN ; Store length of line 04259 A78E A4A5 04260 LOOP029 LDY PENROW ; Loop over length of line to be drawn A790 B90008 04261 LDA PFMEMROWLO,Y ; Point MEMPTR to start of pen's pixel row... A793 8568 04262 STA MEMPTR ; ...in PLAYFIELD memory A795 B96408 04263 LDA PFMEMROWHI,Y ; A798 8569 04264 STA MEMPTR+1 ; 04265 A79A A5A6 04266 LDA PENCOLUMN ; Calc and store pen's byte-within-row offset A79C 4A 04267 LSR A ; A79D 4A 04268 LSR A ; A79E 856A 04269 STA L.PIXELBYTEOFF ; 04270 A7A0 A5A6 04271 LDA PENCOLUMN ; Calc pixel-within-byte index A7A2 2903 04272 AND #$03 ; A7A4 A8 04273 TAY ; 04274 A7A5 B9B0BA 04275 LDA PIXELMASKTAB,Y ; Pick mask to filter pixel in byte A7A8 256B 04276 AND L.BITPAT ; ...AND with bit pattern for 4 pixels of same color A7AA A46A 04277 LDY L.PIXELBYTEOFF ; A7AC 1168 04278 ORA (MEMPTR),Y ; Blend byte with new pixel and PLAYFIELD byte A7AE 9168 04279 STA (MEMPTR),Y ; ...and store it back in PLAYFIELD memory 04280 A7B0 246E 04281 BIT L.DIRSAV ; Check direction bit B7 A7B2 1004 04282 BPL SKIP050 ; A7B4 E6A5 04283 INC PENROW ; If B7 = 1 -> Increment pen's pixel row number A7B6 D002 04284 BNE SKIP051 ; A7B8 E6A6 04285 SKIP050 INC PENCOLUMN ; If B7 = 0 -> Increment pen's pixel column number 04286 A7BA C6A4 04287 SKIP051 DEC DIRLEN ; A7BC D0D0 04288 BNE LOOP029 ; Next pixel of line A7BE 60 04289 RTS ; Return 04290 04291 ;******************************************************************************* 04292 ;* * 04293 ;* UPDATTCOMP * 04294 ;* * 04295 ;* Update Attack Computer Display * 04296 ;* * 04297 ;******************************************************************************* 04298 04299 ; DESCRIPTION 04300 ; 04301 ; Draws the blip of the tracked space object and the lock-on markers into the 04302 ; Attack Computer Display. The actual drawing follows a cycle of 11 game loop 04303 ; iterations (numbered by this subroutine as "blip cycles" 0..10), which can be 04304 ; divided into three phases: 04305 ; 04306 ; (1) Blip cycle 0..4: Draw blip shape row-by-row 04307 ; 04308 ; Draw the blip's shape into the Attack Computer Display, one row each blip 04309 ; cycle. After 5 blip cycles the blip shape is complete and completely 04310 ; visible because between blip cycles, that is, game loop iterations, the 04311 ; PLAYFIELD is not erased (only the PLAYFIELD space objects are). Drawing 04312 ; is executed by branching to entry DRAWLINE2 ($A784) of subroutine 04313 ; DRAWLINE ($A782). The blip shape is retrieved from table BLIPSHAPTAB 04314 ; ($BF6E). 04315 ; 04316 ; (2) Blip cycle 5..9: Delay 04317 ; 04318 ; Delay the execution of blip cycle 10. 04319 ; 04320 ; (3) Blip cycle 10: Update Attack Computer Display 04321 ; 04322 ; After verifying that the tracked space object is alive, calculate the 04323 ; blip's relative top-left pixel column and row number. Resulting values 04324 ; are in -11..11 and -6..4, relative to the blip's top-left reference 04325 ; position at pixel column number 131 and pixel row number 77, 04326 ; respectively. 04327 ; 04328 ; Filter the Attack Computer Display area: Only pixels of COLOR1 within the 04329 ; inner frame area (a 28 pixel wide x 15 pixel high rectangle with its 04330 ; top-left corner at pixel column number 120 and pixel row number 71) pass 04331 ; the filter operation. This effectively erases the blip. 04332 ; 04333 ; If the blip is within -2..+2 pixels off its horizontal reference position 04334 ; (pixel column numbers 129..132) then the tracked space object is in x 04335 ; lock-on. Draw the x lock-on marker. 04336 ; 04337 ; If the tracked space object is in x lock-on and the blip is within -2..+1 04338 ; pixels off its vertical reference position (pixel column numbers 75..78) 04339 ; then the tracked space object is in x and y lock-on. Draw also the y 04340 ; lock-on marker. 04341 ; 04342 ; If the tracked space object is in x and y lock-on and the tracked space 04343 ; object's z-coordinate < +3072 (+$0C**) <KM> then the tracked space object 04344 ; is in x, y and z lock-on. Draw also the z lock-on marker. 04345 ; 04346 ; If the tracked space object is in x, y, and z lock-on (and thus in 04347 ; optimal firing range) set the ISINLOCKON ($A3) flag. 04348 ; 04349 ; The following sketches show the Attack Computer Display area overlaid 04350 ; with the Attack Computer Display frame: 04351 ; 04352 ; 119 119 04353 ; 70 ############################## 70 ############################## 04354 ; # ....#.... # # # # 04355 ; # ....#.... # # # # 04356 ; # ....#.... # # # # 04357 ; # ....#.... # # # # 04358 ; # ############### # #......###############.......# 04359 ; #XXXX # ......... # XXXX# #......#.............#.......# 04360 ; # # ..$...... # # #......#....$........#.......# 04361 ; ######## ......... ######### ########.............######### 04362 ; # # ......... # # #......#.............#.......# 04363 ; # # ......... # # #YYYY..#.............#...YYYY# 04364 ; # ############### # #......###############.......# 04365 ; # ....#.... # #.............#..............# 04366 ; # ....#.... # # # # 04367 ; # ....#.... # # # # 04368 ; # ....#.... # # # # 04369 ; ############################## ############################## 04370 ; 04371 ; X = x lock-on marker Y = y lock-on marker 04372 ; . = x lock-on blip zone . = y lock-on blip zone 04373 ; $ = Blip's top-left reference $ = Blip's top-left reference 04374 ; position position 04375 ; 04376 ; 119 04377 ; 70 ############################## 04378 ; # # # 04379 ; # # # 04380 ; # # # 04381 ; # # # 04382 ; # ############### # 04383 ; # # # # 04384 ; # # $ # # 04385 ; ######## ######### 04386 ; # # # # 04387 ; # # # # 04388 ; # ############### # 04389 ; # # # 04390 ; # # # 04391 ; # ZZ # ZZ # 04392 ; # ZZ # ZZ # 04393 ; ############################## 04394 ; 04395 ; Z = z lock-on marker 04396 ; $ = Blip's top-left reference 04397 ; position 04398 =006C 04399 L.SHIFTSHAPE = $6C ; Saves shifted byte of blip shape bit pattern 04400 A7BF AE5C09 04401 UPDATTCOMP LDX TRACKDIGIT ; Load index of tracked space object A7C2 A4A2 04402 LDY BLIPCYCLECNT ; Load blip cycle counter A7C4 C005 04403 CPY #5 ; A7C6 B024 04404 BCS SKIP054 ; Skip drawing blip if blip cycle > 5 04405 04406 ;*** Blip cycle 0..4: Draw blip shape one row each cycle *********************** A7C8 A5A0 04407 LDA BLIPCOLUMN ; Init pen's pixel column number... A7CA 85A6 04408 STA PENCOLUMN ; ...with top position of blip shape A7CC B96EBF 04409 LDA BLIPSHAPTAB,Y ; Load bit pattern of one row of blip shape A7CF 0A 04410 LOOP030 ASL A ; Shift bit pattern one position to the left A7D0 856C 04411 STA L.SHIFTSHAPE ; Temporarily save shifted shape byte A7D2 900D 04412 BCC SKIP052 ; Skip if shifted-out bit = 0 04413 A7D4 A981 04414 LDA #$81 ; Store "draw a line of 1 pixel length downward" A7D6 85A4 04415 STA DIRLEN ; ...for call to DRAWLINE2 04416 A7D8 A5A1 04417 LDA BLIPROW ; Init pen's pixel row number... A7DA 85A5 04418 STA PENROW ; ...with leftmost position of blip shape A7DC A9AA 04419 LDA #$AA ; Load 1-byte bit pattern for 4 pixels of COLOR2 A7DE 2084A7 04420 JSR DRAWLINE2 ; Draw pixel on PLAYFIELD 04421 A7E1 E6A6 04422 SKIP052 INC PENCOLUMN ; Move pen one pixel to the right A7E3 A56C 04423 LDA L.SHIFTSHAPE ; Reload shifted shape byte A7E5 D0E8 04424 BNE LOOP030 ; Next horizontal pixel of blip shape 04425 A7E7 E6A1 04426 INC BLIPROW ; Move pen one pixel downward A7E9 E6A2 04427 SKIP053 INC BLIPCYCLECNT ; Increment blip cycle counter A7EB 60 04428 RTS ; Return 04429 04430 ;*** Blip cycle 5..9: Delay **************************************************** A7EC C00A 04431 SKIP054 CPY #10 ; Return if blip cycle < 10 A7EE 90F9 04432 BCC SKIP053 ; 04433 04434 ;*** Blip cycle 10: Calculate new blip pixel row and column numbers ************ A7F0 B5E9 04435 LDA PL0LIFE,X ; Skip if tracked object not alive A7F2 F03C 04436 BEQ SKIP059 ; 04437 A7F4 BD710A 04438 LDA XPOSHI,X ; Map x-coordinate of tracked space obj to -11..11: A7F7 BCDE09 04439 LDY XPOSSIGN,X ; Skip if tracked object on left screen half (x >= 0) A7FA F008 04440 BEQ SKIP055 ; 04441 A7FC C90C 04442 CMP #12 ; Skip if x of tracked obj < +$0C** (< 3327) <KM> A7FE 900A 04443 BCC SKIP056 ; A800 A90B 04444 LDA #11 ; Prep relative pixel column number of 11, skip A802 1006 04445 BPL SKIP056 ; 04446 A804 C9F5 04447 SKIP055 CMP #-11 ; Skip if x of tracked obj >= -($0B**) (>=-2816) <KM> A806 B002 04448 BCS SKIP056 ; A808 A9F5 04449 LDA #-11 ; Prep relative pixel column number of -11 04450 A80A 18 04451 SKIP056 CLC ; Add 131 (= blip's top-left reference pixel column) A80B 6983 04452 ADC #131 ; A80D 85A0 04453 STA BLIPCOLUMN ; BLIPCOLUMN := 131 + -11..11 04454 A80F BDA20A 04455 LDA YPOSHI,X ; Map y-coordinate of tracked space obj to -6..4: A812 49FF 04456 EOR #$FF ; Mirror y-coordinate on y-axis (displacement of +1) A814 BC0F0A 04457 LDY YPOSSIGN,X ; Skip if tracked obj on lower screen half (y < 0) A817 D008 04458 BNE SKIP057 ; 04459 A819 C905 04460 CMP #5 ; Skip if mirrored y of tracked obj < +$05** <KM> A81B 900A 04461 BCC SKIP058 ; A81D A904 04462 LDA #4 ; Prep relative pixel row number of 4, skip A81F 1006 04463 BPL SKIP058 ; 04464 A821 C9FA 04465 SKIP057 CMP #-6 ; Skip if mirrored y of tracked obj >= -($06**) <KM> A823 B002 04466 BCS SKIP058 ; A825 A9FA 04467 LDA #-6 ; Prep relative pixel row number of -6 04468 A827 18 04469 SKIP058 CLC ; Add 77 (= blip's top-left ref. pixel row number) A828 694D 04470 ADC #77 ; A82A 85A1 04471 STA BLIPROW ; BLIPROW := 77 + -6..4 04472 A82C A900 04473 LDA #0 ; Reset blip cycle A82E 85A2 04474 STA BLIPCYCLECNT ; 04475 04476 ;*** Filter Attack Computer Display frame area ********************************* 04477 ; PLAYFIELD address of top-left of Attack Computer =1B36 04478 PFMEM.C120R71 = PFMEM+71*40+120/4 ; Display's inner frame @ pixel column 120, row 71 04479 A830 A936 04480 SKIP059 LDA #<PFMEM.C120R71 ; Point MEMPTR to start of frame's... A832 8568 04481 STA MEMPTR ; ...inner top-left corner at column 120, row 71... A834 A91B 04482 LDA #>PFMEM.C120R71 ; ...in PLAYFIELD memory A836 8569 04483 STA MEMPTR+1 ; 04484 A838 A20E 04485 LDX #14 ; Traverse a 28 x 15 pixel rect of PLAYFIELD memory A83A A006 04486 LOOP031 LDY #6 ; A83C B168 04487 LOOP032 LDA (MEMPTR),Y ; Load byte (4 pixels) from PLAYFIELD memory A83E 2955 04488 AND #$55 ; Filter COLOR1 pixels A840 9168 04489 STA (MEMPTR),Y ; Store byte (4 pixels) back to PLAYFIELD memory A842 88 04490 DEY ; A843 10F7 04491 BPL LOOP032 ; Next 4 pixels in x-direction 04492 A845 18 04493 CLC ; Add 40 to MEMPTR A846 A568 04494 LDA MEMPTR ; (40 bytes = 160 pixels = 1 PLAYFIELD row of pixels) A848 6928 04495 ADC #40 ; A84A 8568 04496 STA MEMPTR ; A84C 9002 04497 BCC SKIP060 ; A84E E669 04498 INC MEMPTR+1 ; 04499 A850 CA 04500 SKIP060 DEX ; A851 10E7 04501 BPL LOOP031 ; Next row of pixels in y-direction 04502 04503 ;*** Prepare lock-on marker checks ********************************************* A853 AE5C09 04504 LDX TRACKDIGIT ; Preload index of tracked space obj to check z-range A856 C8 04505 INY ; Y := 0, preloaded value of ISINLOCKON 04506 04507 ;*** Draw lock-on markers ****************************************************** 04508 ; PLAYFIELD addresses of =1BFE 04509 PFMEM.C120R76 = PFMEM+76*40+120/4 ; ...x lock-on marker @ pixel column 120, row 76 =1C04 04510 PFMEM.C144R76 = PFMEM+76*40+144/4 ; ...x lock-on marker @ pixel column 144, row 76 =1C9E 04511 PFMEM.C120R80 = PFMEM+80*40+120/4 ; ...y lock-on marker @ pixel column 120, row 80 =1CA4 04512 PFMEM.C144R80 = PFMEM+80*40+144/4 ; ...y lock-on marker @ pixel column 144, row 80 =1D40 04513 PFMEM.C128R84 = PFMEM+84*40+128/4 ; ...z lock-on marker @ pixel column 128, row 84 =1D68 04514 PFMEM.C128R85 = PFMEM+85*40+128/4 ; ...z lock-on marker @ pixel column 128, row 85 =1D42 04515 PFMEM.C136R84 = PFMEM+84*40+136/4 ; ...z lock-on marker @ pixel column 136, row 84 =1D6A 04516 PFMEM.C136R85 = PFMEM+85*40+136/4 ; ...z lock-on marker @ pixel column 136, row 85 04517 A857 A588 04518 LDA LOCKONLIFE ; If lock-on lifetime expired redraw lock-on markers A859 F004 04519 BEQ SKIP061 ; 04520 A85B C688 04521 DEC LOCKONLIFE ; else decr lock-on lifetime, skip drawing markers A85D D039 04522 BNE SKIP062 ; 04523 A85F A5A0 04524 SKIP061 LDA BLIPCOLUMN ; Skip x, y, and z lock-on marker if blip's... A861 C981 04525 CMP #129 ; ...top-left pixel column number not in 129..132 A863 9033 04526 BCC SKIP062 ; A865 C985 04527 CMP #133 ; A867 B02F 04528 BCS SKIP062 ; 04529 A869 A9AA 04530 LDA #$AA ; Draw x lock-on marker (4 horiz. pixels of COLOR2) A86B 8DFE1B 04531 STA PFMEM.C120R76 ; ...at pixel column 120, row 76 A86E 8D041C 04532 STA PFMEM.C144R76 ; ...at pixel column 144, row 76 04533 A871 A5A1 04534 LDA BLIPROW ; Skip y and z lock-on marker if blip's... A873 C94B 04535 CMP #75 ; ...top-left pixel row number not in 75...78 A875 9021 04536 BCC SKIP062 ; A877 C94F 04537 CMP #79 ; A879 B01D 04538 BCS SKIP062 ; 04539 A87B A9AA 04540 LDA #$AA ; Draw y lock-on marker (4 horiz. pixels of COLOR2) A87D 8D9E1C 04541 STA PFMEM.C120R80 ; ...at pixel column 120, row 80 A880 8DA41C 04542 STA PFMEM.C144R80 ; ...at pixel column 144, row 80 04543 A883 BD400A 04544 LDA ZPOSHI,X ; Skip z lock-on marker if z >= +$0C** (>= 3072) <KM> A886 C90C 04545 CMP #12 ; A888 B00E 04546 BCS SKIP062 ; 04547 A88A A0A0 04548 LDY #$A0 ; Draw z lock-on marker (2 horiz. pixels of COLOR2) A88C 8C401D 04549 STY PFMEM.C128R84 ; ...at pixel column 128, row 84 (prep lock-on flag) A88F 8C681D 04550 STY PFMEM.C128R85 ; ...at pixel column 128, row 85 A892 8C421D 04551 STY PFMEM.C136R84 ; ...at pixel column 136, row 84 A895 8C6A1D 04552 STY PFMEM.C136R85 ; ...at pixel column 136, row 85 04553 A898 84A3 04554 SKIP062 STY ISINLOCKON ; Store lock-on flag (> 0 -> Tracked obj locked on) A89A 60 04555 RTS ; Return 04556 04557 ;******************************************************************************* 04558 ;* * 04559 ;* HYPERWARP * 04560 ;* * 04561 ;* Handle hyperwarp * 04562 ;* * 04563 ;******************************************************************************* 04564 04565 ; DESCRIPTION 04566 ; 04567 ; Handles the hyperwarp sequence, which transports our starship from one sector 04568 ; to another. It can be divided into four phases: 04569 ; 04570 ; (1) ACCELERATION PHASE 04571 ; 04572 ; The ACCELERATION PHASE is entered after the hyperwarp sequence has been 04573 ; engaged in subroutine KEYBOARD ($AFFE) by pressing the 'H' key. The 04574 ; Hyperwarp Target Marker appears and our starship begins to accelerate. 04575 ; When our starship's velocity reaches 128 <KM/H> (the VELOCITY readout of 04576 ; the Control Panel Display displays "50"), the STAR TRAIL phase is 04577 ; entered. 04578 ; 04579 ; The Hyperwarp Target Marker is represented by a space object some fixed 04580 ; distance away in front of our starship as PLAYER3. It has a lifetime of 04581 ; 144 game loop iterations and is tracked. Thus, tracking handling in 04582 ; subroutine UPDATTCOMP ($A7BF) provides drawing the x and y lock-on 04583 ; markers in the Attack Computer Display when the Hyperwarp Target Marker 04584 ; is centered. 04585 ; 04586 ; A temporary arrival location on the Galactic Chart was saved when the 04587 ; hyperwarp was engaged in subroutine KEYBOARD ($AFFE). During the 04588 ; ACCELERATION PHASE (and the subsequent STAR TRAIL PHASE) this location is 04589 ; constantly updated depending on how much the Hyperwarp Target Marker 04590 ; veers off its center position. 04591 ; 04592 ; The actual arrival hyperwarp marker row and column numbers on the 04593 ; Galactic Chart are the sum of the temporary arrival hyperwarp marker row 04594 ; and column numbers stored when engaging the hyperwarp in subroutine 04595 ; KEYBOARD ($AFFE) and the number of Player/Missile (PM) pixels which the 04596 ; Hyperwarp Target Marker is off-center vertically and horizontally, 04597 ; respectively, at the end of the STAR TRAIL PHASE. 04598 ; 04599 ; NOTE: The used vertical center value of 119 PM pixels is the PM pixel row 04600 ; number of the top edge of the centered Hyperwarp Target Marker (from top 04601 ; to bottom: 8 PM pixels to the start of Display List + 16 PM pixels blank 04602 ; lines + 100 PM pixels to the vertical PLAYFIELD center - 5 PM pixels 04603 ; relative offset of the Hyperwarp Target Marker's shape center to the 04604 ; shape's top edge = 119 PM pixels). Recall also that PLAYERs at 04605 ; single-line resolution have PM pixels that are half as high as they are 04606 ; wide. 04607 ; 04608 ; NOTE: The used horizontal center value of 125 PM pixels is the PM pixel 04609 ; row number of the left edge of the centered Hyperwarp Target Marker (from 04610 ; left to right: 127 PM pixels to the PLAYFIELD center - 3 PM pixels 04611 ; relative offset of the Hyperwarp Target Marker's shape center to the 04612 ; shape's left edge = 125 PM pixels). 04613 ; 04614 ; If during the ACCELERATION PHASE (and the subsequent STAR TRAIL PHASE) 04615 ; you switch the Front view to another view, the Hyperwarp Target Marker 04616 ; changes to a random position which results in arriving at a random 04617 ; destination sector. 04618 ; 04619 ; During the ACCELERATION PHASE (and the subsequent STAR TRAIL PHASE) in 04620 ; all but NOVICE missions, the Hyperwarp Target Marker veers off with 04621 ; random velocity in x and y direction, which is changed during 6% of game 04622 ; loop iterations. Table VEERMASKTAB ($BED7) limits the maximum veer-off 04623 ; velocity depending on the mission level: 04624 ; 04625 ; +-----------+-----------------------------+ 04626 ; | Mission | Veer-Off Velocity | 04627 ; +-----------+-----------------------------+ 04628 ; | NOVICE | 0 <KM/H> | 04629 ; | PILOT | -63..-16, +16..+63 <KM/H> | 04630 ; | WARRIOR | -95..-16, +16..+95 <KM/H> | 04631 ; | COMMANDER | -127..-16, +16..+127 <KM/H> | 04632 ; +-----------+-----------------------------+ 04633 ; 04634 ; (2) STAR TRAIL PHASE 04635 ; 04636 ; When our starship's velocity reaches a velocity of 128 <KM/H> (the 04637 ; VELOCITY readout of the Control Panel Display displays "50"), in addition 04638 ; to all effects of the ACCELERATION PHASE, multiple star trails begin to 04639 ; appear while our starship continues to accelerate. Each star trail is 04640 ; initialized in subroutine INITTRAIL ($A9B4). 04641 ; 04642 ; (3) HYPERSPACE PHASE 04643 ; 04644 ; When our starship's velocity reaches a velocity of 254 <KM/H> (the 04645 ; VELOCITY readout of the Control Panel Display displays "99") our starship 04646 ; enters the HYPERSPACE PHASE (the VELOCITY readout of the Control Panel 04647 ; Display displays the infinity symbol). 04648 ; 04649 ; During the first pass of the HYPERSPACE PHASE the hyperwarp state is set 04650 ; to HYPERSPACE. This makes the stars and the Hyperwarp Target Marker 04651 ; disappear in GAMELOOP ($A1F3). Then, the beeper sound pattern HYPERWARP 04652 ; TRANSIT is played in subroutine BEEP ($B3A6), the hyperwarp distance and 04653 ; required hyperwarp energy is calculated in subroutine CALCWARP ($B1A7), 04654 ; and the title line is preloaded with "HYPERSPACE". Code execution returns 04655 ; via calling subroutine CLEANUPWARP ($A98D) where program variables are 04656 ; already initialized to their post-hyperwarp values. 04657 ; 04658 ; During subsequent passes of the HYPERSPACE PHASE, the calculated 04659 ; hyperwarp energy is decremented in chunks of 10 energy units. Code 04660 ; execution returns via calling subroutine DECENERGY ($B86F), which 04661 ; decrements our starship's energy. After the calculated hyperwarp energy 04662 ; is spent the DECELERATION PHASE is entered. 04663 ; 04664 ; (4) DECELERATION PHASE 04665 ; 04666 ; The title line flashes "HYPERWARP COMPLETE", the star field reappears and 04667 ; our starship decelerates to a stop. The Engines and the hyperwarp are 04668 ; disengaged and stopped in subroutine ENDWARP ($A987), the arrival 04669 ; coordinates on the Galactic Chart are initialized, as well as the 04670 ; vicinity mask. 04671 ; 04672 ; The vicinity mask limits the position vector components (coordinates) of 04673 ; space objects in the arrival sector relative to our starship. The 04674 ; vicinity mask is picked from table VICINITYMASKTAB ($BFB3) by an index 04675 ; calculated by the arrival y-coordinate modulo 8: The more you have placed 04676 ; the arrival hyperwarp marker in the vertical center of a sector on the 04677 ; Galactic Chart, the closer space objects in this sector will be to our 04678 ; starship. For example, if you placed the arrival hyperwarp marker exactly 04679 ; in the vertical middle of the sector the index will be 3, thus the space 04680 ; objects inside the arrival sector will be in the vicinity of <= 4095 <KM> 04681 ; of our starship. The following table lists the possible coordinates 04682 ; depending on the calculated index: 04683 ; 04684 ; +-------+-----------------------+ 04685 ; | Index | ABS(Coordinate) | 04686 ; +-------+-----------------------+ 04687 ; | 0 | <= 65535 ($FF**) <KM> | 04688 ; | 1 | <= 65535 ($FF**) <KM> | 04689 ; | 2 | <= 16383 ($3F**) <KM> | 04690 ; | 3 | <= 4095 ($0F**) <KM> | 04691 ; | 4 | <= 16383 ($3F**) <KM> | 04692 ; | 5 | <= 32767 ($7F**) <KM> | 04693 ; | 6 | <= 65535 ($FF**) <KM> | 04694 ; | 7 | <= 65535 ($FF**) <KM> | 04695 ; +-------+-----------------------+ 04696 ; 04697 ; If there is a starbase in the arrival sector, its x and y coordinates are 04698 ; initialized to random values within the interval defined by the vicinity 04699 ; mask by using subroutine RNDINVXY ($B7BE). Its z-coordinate is forced to 04700 ; a value >= +$71** (+28928) <KM>. Its velocity vector components are set 04701 ; to 0 <KM/H>. 04702 ; 04703 ; If there are Zylon ships in the arrival sector then a red alert is 04704 ; initialized by setting the red alert lifetime to 255 game loop 04705 ; iterations, playing the beeper sound pattern RED ALERT in subroutine BEEP 04706 ; ($B3A6) and setting the title phrase to "RED ALERT". 04707 A89B A4C0 04708 HYPERWARP LDY WARPSTATE ; Return if hyperwarp not engaged A89D F061 04709 BEQ SKIP066 ; 04710 A89F A570 04711 LDA VELOCITYLO ; If velocity >= 254 <KM/H> skip to HYPERSPACE PHASE A8A1 C9FE 04712 CMP #254 ; A8A3 B05C 04713 BCS SKIP067 ; 04714 A8A5 C980 04715 CMP #128 ; If velocity < 128 <KM/H> skip to ACCELERATION PHASE A8A7 9003 04716 BCC SKIP063 ; 04717 04718 ;*** STAR TRAIL PHASE ********************************************************** A8A9 20B4A9 04719 JSR INITTRAIL ; Init star trail 04720 04721 ;*** ACCELERATION PHASE ******************************************************** A8AC A903 04722 SKIP063 LDA #3 ; Track Hyperwarp Target Marker (PLAYER3) A8AE 8D5C09 04723 STA TRACKDIGIT ; 04724 A8B1 A990 04725 LDA #SHAP.HYPERWARP ; PLAYER3 is HYPERWARP TARGET MARKER (shape type 9) A8B3 8D8F0C 04726 STA PL3SHAPTYPE ; A8B6 85EC 04727 STA PL3LIFE ; PLAYER3 lifetime := 144 game loops 04728 A8B8 A91F 04729 LDA #$1F ; PLAYER3 z-coordinate := $1F** (7936..8191) <KM> A8BA 8D430A 04730 STA PL3ZPOSHI ; 04731 A8BD 38 04732 SEC ; New arrival hyperwarp marker row number is... A8BE ADFC0B 04733 LDA PL3ROWNEW ; WARPARRVROW := WARPTEMPROW + PL3ROWNEW... A8C1 E977 04734 SBC #119 ; ... - 119 PM pixels (top edge of centered... A8C3 18 04735 CLC ; ...Hyperwarp Target Marker) A8C4 65C5 04736 ADC WARPTEMPROW ; A8C6 297F 04737 AND #$7F ; Limit WARPARRVROW to 0..127 A8C8 858E 04738 STA WARPARRVROW ; 04739 A8CA 38 04740 SEC ; New arrival hyperwarp marker column number is... A8CB AD2D0C 04741 LDA PL3COLUMN ; WARPARRVCOLUMN := WARPTEMPCOLUMN + PL3COLUMN... A8CE E97D 04742 SBC #125 ; ... - 125 PM pixels (left edge of centered... A8D0 18 04743 CLC ; ...Hyperwarp Target Marker) A8D1 65C4 04744 ADC WARPTEMPCOLUMN ; A8D3 297F 04745 AND #$7F ; Limit WARPARRVCOLUMN to 0..127 A8D5 858F 04746 STA WARPARRVCOLUMN ; 04747 A8D7 A562 04748 LDA MISSIONLEVEL ; Skip if NOVICE mission A8D9 F011 04749 BEQ SKIP065 ; 04750 A8DB AD0AD2 04751 LDA RANDOM ; Prep random number A8DE A4D0 04752 LDY SHIPVIEW ; Skip if in Front view A8E0 F006 04753 BEQ SKIP064 ; 04754 A8E2 8D2D0C 04755 STA PL3COLUMN ; Randomize PM pixel row and column number... A8E5 8DFC0B 04756 STA PL3ROWNEW ; ...of Hyperwarp Target Marker 04757 A8E8 C910 04758 SKIP064 CMP #16 ; Return in 94% (240:256) of game loops A8EA B014 04759 BCS SKIP066 ; 04760 04761 ;*** Veer off Hyperwarp Target Marker and return ******************************* A8EC AD0AD2 04762 SKIP065 LDA RANDOM ; Prep random x-velocity of Hyperwarp Target Marker A8EF 0910 04763 ORA #$10 ; Velocity value >= 16 <KM/H> A8F1 25C6 04764 AND VEERMASK ; Limit velocity value by mission level A8F3 8D9A0B 04765 STA PL3XVEL ; PLAYER3 x-velocity := velocity value 04766 A8F6 AD0AD2 04767 LDA RANDOM ; Prep random y-velocity of Hyperwarp Target Marker A8F9 0910 04768 ORA #$10 ; Velocity value >= 16 <KM/H> A8FB 25C6 04769 AND VEERMASK ; Limit velocity value by mission level A8FD 8DCB0B 04770 STA PL3YVEL ; PLAYER3 y-velocity := velocity value A900 60 04771 SKIP066 RTS ; Return 04772 04773 ;*** HYPERSPACE PHASE ********************************************************** A901 98 04774 SKIP067 TYA ; Skip if already in HYPERSPACE PHASE A902 3011 04775 BMI SKIP068 ; 04776 04777 ;*** HYPERSPACE PHASE (First pass) ********************************************* A904 A9FF 04778 LDA #$FF ; Set hyperwarp state to HYPERSAPCE PHASE A906 85C0 04779 STA WARPSTATE ; 04780 A908 A200 04781 LDX #$00 ; Play beeper sound pattern HYPERWARP TRANSIT A90A 20A6B3 04782 JSR BEEP ; 04783 A90D 20A7B1 04784 JSR CALCWARP ; Calc hyperwarp energy 04785 A910 A01B 04786 LDY #$1B ; Prep title phrase "HYPERSPACE" A912 4C8DA9 04787 JMP CLEANUPWARP ; Return via CLEANUPWARP 04788 04789 ;*** HYPERSPACE PHASE (Second and later passes) ******************************** A915 C691 04790 SKIP068 DEC WARPENERGY ; Decrement energy in chunks of 10 energy units A917 F005 04791 BEQ SKIP069 ; Skip to DECELERATION PHASE if hyperwarp energy zero 04792 A919 A202 04793 LDX #2 ; ENERGY := ENERGY - 10 and return A91B 4C6FB8 04794 JMP DECENERGY ; 04795 04796 ;*** DECELERATION PHASE ******************************************************** A91E A019 04797 SKIP069 LDY #$19 ; Prep title phrase "HYPERWARP COMPLETE" A920 2087A9 04798 JSR ENDWARP ; Stop our starship 04799 A923 A58F 04800 LDA WARPARRVCOLUMN ; Make the arrival hyperwarp marker column number... A925 858D 04801 STA WARPDEPRCOLUMN ; ...the departure hyperwarp marker column number A927 A58E 04802 LDA WARPARRVROW ; Make the arrival hyperwarp marker row number... A929 858C 04803 STA WARPDEPRROW ; ...the departure hyperwarp marker row number 04804 A92B 4A 04805 LSR A ; B3..1 of arrival hyperwarp marker row number... A92C 2907 04806 AND #$07 ; ...pick vicinity mask A92E AA 04807 TAX ; A92F BDB3BF 04808 LDA VICINITYMASKTAB,X ; A932 85C7 04809 STA VICINITYMASK ; Store vicinity mask (limits space obj coordinates) 04810 A934 A492 04811 LDY ARRVSECTOR ; Make the arrival sector the current sector A936 8490 04812 STY CURRSECTOR ; 04813 04814 ;*** Init starbase in arrival sector ******************************************* A938 A900 04815 LDA #0 ; Clear starbase-in-sector flag A93A 857B 04816 STA ISSTARBASESECT ; 04817 A93C BEC908 04818 LDX GCMEMMAP,Y ; Skip if no starbase in arrival sector A93F 102E 04819 BPL SKIP070 ; 04820 A941 A9FF 04821 LDA #$FF ; Set starbase-in-sector flag A943 857B 04822 STA ISSTARBASESECT ; 04823 04824 ;*** Set position vector and velocity vector of starbase *********************** A945 A000 04825 LDY #0 ; A947 A900 04826 LOOP033 LDA #0 ; Loop over all coordinates of starbase A949 99680B 04827 STA PL2ZVEL,Y ; Starbase velocity vector component := 0 <KM/H> A94C A901 04828 LDA #1 ; A94E 99AF09 04829 STA PL2ZPOSSIGN,Y ; Starbase coordinate sign := + (positive) A951 AD0AD2 04830 LDA RANDOM ; Prep random number... A954 25C7 04831 AND VICINITYMASK ; ...limit number range by vicinity mask, then... A956 99420A 04832 STA PL2ZPOSHI,Y ; ...store in starbase coordinate (high byte) 04833 A959 98 04834 TYA ; A95A 18 04835 CLC ; A95B 6931 04836 ADC #MAXSPCOBJNUM ; A95D A8 04837 TAY ; A95E C993 04838 CMP #MAXSPCOBJNUM*3 ; A960 90E5 04839 BCC LOOP033 ; Next starbase coordinate 04840 A962 AD420A 04841 LDA PL2ZPOSHI ; Force starbase z-coordinate >= +$71** <KM> A965 0971 04842 ORA #$71 ; A967 8D420A 04843 STA PL2ZPOSHI ; A96A A202 04844 LDX #2 ; Randomly invert starbase x and y coordinates... A96C 4CBEB7 04845 JMP RNDINVXY ; ...and return 04846 04847 ;*** Flash red alert if Zylon sector entered *********************************** A96F F00E 04848 SKIP070 BEQ SKIP071 ; Skip if no Zylon ships in sector 04849 A971 A9FF 04850 LDA #255 ; Red alert lifetime := 255 game loops A973 858B 04851 STA REDALERTLIFE ; 04852 A975 A206 04853 LDX #$06 ; Play beeper sound pattern RED ALERT A977 20A6B3 04854 JSR BEEP ; 04855 A97A A075 04856 LDY #$75 ; Set title phrase "RED ALERT" A97C 2023B2 04857 JSR SETTITLE ; 04858 A97F 60 04859 SKIP071 RTS ; Return 04860 04861 ;******************************************************************************* 04862 ;* * 04863 ;* ABORTWARP * 04864 ;* * 04865 ;* Abort hyperwarp * 04866 ;* * 04867 ;******************************************************************************* 04868 04869 ; DESCRIPTION 04870 ; 04871 ; Aborts hyperwarp. 04872 ; 04873 ; This subroutine is entered from subroutine KEYBOARD ($AFFE). It subtracts 100 04874 ; energy units for aborting the hyperwarp and preloads the title phrase with 04875 ; "HYPERWARP ABORTED". Code execution continues into subroutine ENDWARP 04876 ; ($A987). 04877 A980 A201 04878 ABORTWARP LDX #1 ; ENERGY := ENERGY - 100 after hyperwarp abort A982 206FB8 04879 JSR DECENERGY ; 04880 A985 A017 04881 LDY #$17 ; Prep title phrase "HYPERWARP ABORTED" 04882 04883 ;******************************************************************************* 04884 ;* * 04885 ;* ENDWARP * 04886 ;* * 04887 ;* End hyperwarp * 04888 ;* * 04889 ;******************************************************************************* 04890 04891 ; DESCRIPTION 04892 ; 04893 ; Ends hyperwarp. 04894 ; 04895 ; This subroutine stops our starship's Engines and resets the hyperwarp state. 04896 ; Code execution continues into subroutine CLEANUPWARP ($A98D). 04897 A987 A900 04898 ENDWARP LDA #0 ; Stop Engines A989 8571 04899 STA NEWVELOCITY ; A98B 85C0 04900 STA WARPSTATE ; Disengage hyperwarp 04901 04902 ;******************************************************************************* 04903 ;* * 04904 ;* CLEANUPWARP * 04905 ;* * 04906 ;* Clean up hyperwarp variables * 04907 ;* * 04908 ;******************************************************************************* 04909 04910 ; DESCRIPTION 04911 ; 04912 ; Cleans up after a hyperwarp. 04913 ; 04914 ; This subroutine restores many hyperwarp related variables to their 04915 ; post-hyperwarp values: The number of used space objects is set to the regular 04916 ; value of 16 (5 PLAYER space objects + 12 PLAYFIELD space objects (stars)), our 04917 ; starship's velocity (high byte) is cleared as well as the explosion lifetime, 04918 ; the hit badness, the PLAYER3 shape type (Hyperwarp Target Marker), the Engines 04919 ; energy drain rate, and the lifetimes of the PLAYERs. The docking state is 04920 ; reset as well as the tracking digit. The title phrase is updated with either 04921 ; "HYPERSPACE" or "HYPERWARP ABORTED". 04922 ; 04923 ; INPUT 04924 ; 04925 ; Y = Title phrase offset. Used values are: 04926 ; $17 -> "HYPERWARP ABORTED" 04927 ; $1B -> "HYPERSPACE" 04928 A98D A910 04929 CLEANUPWARP LDA #MAXSPCOBJIND.NL ; Set normal number of space objects A98F 8579 04930 STA MAXSPCOBJIND ; (5 PLAYER spc objs + 12 PLAYFIELD spc objs (stars)) 04931 A991 A900 04932 LDA #0 ; A993 85C1 04933 STA VELOCITYHI ; Turn off hyperwarp velocity A995 8573 04934 STA EXPLLIFE ; Explosion lifetime := 0 game loops A997 858A 04935 STA HITBADNESS ; HITBADNESS := NO HIT A999 8D8F0C 04936 STA PL3SHAPTYPE ; Clear PLAYER3 shape type A99C 8580 04937 STA DRAINRATE ; Clear Engines energy drain rate A99E C017 04938 CPY #$17 ; Skip if hyperwarp was aborted A9A0 F004 04939 BEQ SKIP072 ; 04940 A9A2 85E9 04941 STA PL0LIFE ; Zylon ship 0 lifetime := 0 game loops A9A4 85EA 04942 STA PL1LIFE ; Zylon ship 1 lifetime := 0 game loops 04943 A9A6 85EB 04944 SKIP072 STA PL2LIFE ; Zylon photon torpedo lifetime := 0 game loops A9A8 85EC 04945 STA PL3LIFE ; Hyperwarp Target Marker lifetime := 0 game loops A9AA 85ED 04946 STA PL4LIFE ; Photon torpedo 1 lifetime := 0 game loops A9AC 8575 04947 STA DOCKSTATE ; DOCKSTATE := NO DOCKING A9AE 8D5C09 04948 STA TRACKDIGIT ; Clear index of tracked space object A9B1 4C23B2 04949 JMP SETTITLE ; Set title phrase and return 04950 04951 ;******************************************************************************* 04952 ;* * 04953 ;* INITTRAIL * 04954 ;* * 04955 ;* Initialize star trail during STAR TRAIL PHASE of hyperwarp * 04956 ;* * 04957 ;******************************************************************************* 04958 04959 ; DESCRIPTION 04960 ; 04961 ; BACKGROUND 04962 ; 04963 ; Star trails are displayed during the STAR TRAIL PHASE, that is, after the 04964 ; ACCELERATION PHASE and before the HYPERSPACE PHASE of the hyperwarp. 04965 ; 04966 ; A star trail is formed by 6 stars represented by 6 PLAYFIELD space objects 04967 ; with continuous position vector indices in 17..48 (indices are wrapped around 04968 ; when greater than 48). Between the creation of two star trails there is delay 04969 ; of 4 game loop iterations. 04970 ; 04971 ; DETAILS 04972 ; 04973 ; This subroutine first decrements this star trail creation delay, returning if 04974 ; the delay is still counting down. If the delay falls below 0 then it continues 04975 ; accelerating our starship's velocity toward hyperwarp speed and then creates a 04976 ; new star trail: 04977 ; 04978 ; First, it raises the maximum index of used space objects to 48 (increasing the 04979 ; number of displayed space objects to 49), resets the star trail creation delay 04980 ; to 4 game loop iterations, then forms a new star trail of 6 stars represented 04981 ; by 6 PLAYFIELD space objects. The x and y coordinates for all 6 stars are the 04982 ; same, picked randomly from tables WARPSTARXTAB ($BB3A) and WARPSTARYTAB 04983 ; ($BB3E), respectively, with their signes changed randomly. Their z-coordinates 04984 ; are computed in increasing depth from at least +4608 (+$12**) <KM> in 04985 ; intervals of +80 (+$0050) <KM>. Their velocity vector components are set to 0 04986 ; <KM/H>. 04987 =0068 04988 L.RANGE = $68 ; z-coordinate of star in star trail (16-bit value) =006E 04989 L.TRAILCNT = $6E ; Star's index in star trail. Used values are: 0..5. 04990 A9B4 C6C2 04991 INITTRAIL DEC TRAILDELAY ; Decrement star trail delay A9B6 1068 04992 BPL SKIP074 ; Return if delay still counting 04993 A9B8 A901 04994 LDA #1 ; Turn on hyperwarp velocity A9BA 85C1 04995 STA VELOCITYHI ; 04996 A9BC A930 04997 LDA #MAXSPCOBJNUM-1 ; Max index of space objects (for star trail stars) A9BE 8579 04998 STA MAXSPCOBJIND ; 04999 A9C0 A903 05000 LDA #3 ; Star trail delay := 3(+1) game loops A9C2 85C2 05001 STA TRAILDELAY ; 05002 A9C4 A6C3 05003 LDX TRAILIND ; Next avail. space obj index for star of star trail 05004 A9C6 A912 05005 LDA #$12 ; Star z-coordinate := >= +$12** (+4608) <KM> A9C8 8569 05006 STA L.RANGE+1 ; 05007 A9CA AD0AD2 05008 LDA RANDOM ; Calc random index to pick initial star coordinates A9CD 2903 05009 AND #$03 ; A9CF A8 05010 TAY ; A9D0 B93ABB 05011 LDA WARPSTARXTAB,Y ; Pick x-coordinate (high byte) of star from table A9D3 9D710A 05012 STA XPOSHI,X ; A9D6 B93EBB 05013 LDA WARPSTARYTAB,Y ; A9D9 9DA20A 05014 STA YPOSHI,X ; Pick y-coordinate (high byte) of star from table A9DC 20BEB7 05015 JSR RNDINVXY ; Randomize signs of x and y coordinates of star 05016 A9DF 8A 05017 TXA ; Save space object index A9E0 A8 05018 TAY ; A9E1 A905 05019 LDA #5 ; Loop over 5(+1) stars that form the star trail A9E3 856E 05020 STA L.TRAILCNT ; Store star counter of star trail 05021 A9E5 18 05022 LOOP034 CLC ; Place stars in z-coordinate intervals of +80 <KM> A9E6 A568 05023 LDA L.RANGE ; A9E8 6950 05024 ADC #80 ; A9EA 8568 05025 STA L.RANGE ; A9EC 9DD30A 05026 STA ZPOSLO,X ; A9EF A569 05027 LDA L.RANGE+1 ; A9F1 6900 05028 ADC #0 ; A9F3 8569 05029 STA L.RANGE+1 ; A9F5 9D400A 05030 STA ZPOSHI,X ; 05031 A9F8 A900 05032 LDA #0 ; Star's velocity vector components := 0 <KM/H> A9FA 9D660B 05033 STA ZVEL,X ; A9FD 9D970B 05034 STA XVEL,X ; AA00 9DC80B 05035 STA YVEL,X ; AA03 A901 05036 LDA #1 ; Star's z-coordinate sign := + (= ahead of starship) AA05 9DAD09 05037 STA ZPOSSIGN,X ; 05038 AA08 A963 05039 LDA #99 ; Init pixel row and column numbers to magic... AA0A 9DF90B 05040 STA PIXELROWNEW,X ; ...offscreen value (triggers automatic recalc in... AA0D 9D2A0C 05041 STA PIXELCOLUMN,X ; ...GAMELOOP's calls to SCREENCOLUMN and SCREENROW) 05042 AA10 20C1AC 05043 JSR COPYPOSXY ; Copy x and y coordinate from previous star in trail 05044 AA13 CA 05045 DEX ; Decrement space object index to next star AA14 E011 05046 CPX #MAXSPCOBJIND.NL+1 ; If index reaches minimum value... AA16 B002 05047 BCS SKIP073 ; AA18 A230 05048 LDX #MAXSPCOBJNUM-1 ; ...wrap-around to maximum space object index AA1A C66E 05049 SKIP073 DEC L.TRAILCNT ; AA1C 10C7 05050 BPL LOOP034 ; Next star of star trail 05051 AA1E 86C3 05052 STX TRAILIND ; Save space object index of star trail's last star AA20 60 05053 SKIP074 RTS ; Return 05054 05055 ;******************************************************************************* 05056 ;* * 05057 ;* PROJECTION * 05058 ;* * 05059 ;* Calculate pixel column (or row) number from position vector * 05060 ;* * 05061 ;******************************************************************************* 05062 05063 ; Calculates the pixel column (or row) number of a position vector x (or y) 05064 ; component relative to the PLAYFIELD center by computing the perspective 05065 ; projection quotient 05066 ; 05067 ; QUOTIENT := DIVIDEND / DIVISOR * 128 05068 ; 05069 ; with 05070 ; 05071 ; DIVIDEND := ABS(x-coordinate (or y-coordinate)) / 2 05072 ; DIVISOR := ABS(z-coordinate) / 2 05073 ; 05074 ; If the QUOTIENT is in 0..255, it is used as an index to pick the pixel column 05075 ; (or row) number from table MAPTO80 ($0DE9), returning values in 0..80. 05076 ; 05077 ; If the QUOTIENT is larger than 255 ("dividend overflow") or if the 05078 ; z-coordinate = 0 ("division by zero") then the error value 255 is returned. 05079 ; 05080 ; INPUT 05081 ; 05082 ; X = Position vector index. Used values are: 0..48. 05083 ; DIVIDEND ($6A..$6B) = Dividend (positive 16-bit value), contains the 05084 ; absolute value of the x (or y) coordinate. 05085 ; 05086 ; OUTPUT 05087 ; 05088 ; A = Pixel column (or row) number relative to PLAYFIELD center. Used values 05089 ; are: 05090 ; 0..80 -> Pixel number 05091 ; 255 -> Error value indicating "dividend overflow" or "division by zero" 05092 =0068 05093 L.DIVISOR = $68 ; Divisor (16-bit value) =006D 05094 L.QUOTIENT = $6D ; Division result (unsigned 8-bit value) =006E 05095 L.LOOPCNT = $6E ; Division loop counter. Used values are: 7..0. 05096 AA21 A900 05097 PROJECTION LDA #0 ; Init quotient result AA23 856D 05098 STA L.QUOTIENT ; 05099 AA25 A907 05100 LDA #7 ; Init division loop counter AA27 856E 05101 STA L.LOOPCNT ; 05102 AA29 466B 05103 LSR DIVIDEND+1 ; DIVIDEND := x-coordinate (or y-coordinate) / 2 AA2B 666A 05104 ROR DIVIDEND ; (division by 2 to make B15 = 0?) (?) 05105 AA2D A5D0 05106 LDA SHIPVIEW ; Skip if in Aft view AA2F D00F 05107 BNE SKIP075 ; 05108 AA31 BD400A 05109 LDA ZPOSHI,X ; If in Front view -> DIVISOR := z-coordinate / 2 AA34 4A 05110 LSR A ; (division by 2 to make B15 = 0?) (?) AA35 8569 05111 STA L.DIVISOR+1 ; AA37 BDD30A 05112 LDA ZPOSLO,X ; AA3A 6A 05113 ROR A ; AA3B 8568 05114 STA L.DIVISOR ; AA3D 4C52AA 05115 JMP LOOP035 ; 05116 AA40 38 05117 SKIP075 SEC ; If in Aft view -> DIVISOR := - z-coordinate / 2 AA41 A900 05118 LDA #0 ; (division by 2 to make B15 = 0?) (?) AA43 FDD30A 05119 SBC ZPOSLO,X ; AA46 8568 05120 STA L.DIVISOR ; AA48 A900 05121 LDA #0 ; AA4A FD400A 05122 SBC ZPOSHI,X ; AA4D 4A 05123 LSR A ; AA4E 8569 05124 STA L.DIVISOR+1 ; AA50 6668 05125 ROR L.DIVISOR ; 05126 AA52 066D 05127 LOOP035 ASL L.QUOTIENT ; QUOTIENT := DIVIDEND / DIVISOR * 128 AA54 38 05128 SEC ; AA55 A56A 05129 LDA DIVIDEND ; AA57 E568 05130 SBC L.DIVISOR ; AA59 A8 05131 TAY ; AA5A A56B 05132 LDA DIVIDEND+1 ; AA5C E569 05133 SBC L.DIVISOR+1 ; AA5E 9006 05134 BCC SKIP076 ; 05135 AA60 856B 05136 STA DIVIDEND+1 ; AA62 846A 05137 STY DIVIDEND ; AA64 E66D 05138 INC L.QUOTIENT ; 05139 AA66 066A 05140 SKIP076 ASL DIVIDEND ; AA68 266B 05141 ROL DIVIDEND+1 ; AA6A 9003 05142 BCC SKIP077 ; 05143 AA6C A9FF 05144 LDA #255 ; Return 255 if division by zero or dividend overflow AA6E 60 05145 RTS ; 05146 AA6F C66E 05147 SKIP077 DEC L.LOOPCNT ; AA71 10DF 05148 BPL LOOP035 ; Next division loop iteration 05149 AA73 A46D 05150 LDY L.QUOTIENT ; Prep with quotient AA75 B9E90D 05151 LDA MAPTO80,Y ; Pick and return pixel column (or row) number... AA78 60 05152 SKIP078 RTS ; ...relative to PLAYFIELD center 05153 05154 ;******************************************************************************* 05155 ;* * 05156 ;* MANEUVER * 05157 ;* * 05158 ;* Maneuver our starship's and Zylon photon torpedoes and Zylon ships * 05159 ;* * 05160 ;******************************************************************************* 05161 05162 ; DESCRIPTION 05163 ; 05164 ; This subroutine maneuvers both of our starship's photon torpedoes, the single 05165 ; Zylon photon torpedo, and the one or two Zylon ships that are simultaneously 05166 ; displayed on the screen. It also creates meteors and new Zylon ships. This 05167 ; subroutine is executed only if our starship is not in a starbase sector and 05168 ; hyperwarp is not engaged. 05169 ; 05170 ; BACKGROUND 05171 ; 05172 ; When a Zylon ship is initialized, a "flight pattern" is assigned to it. There 05173 ; are 3 flight patterns (0, 1, and 4) which are picked from table ZYLONFLPATTAB 05174 ; ($BF91). 05175 ; 05176 ; The flight pattern determines the maximum velocity with which a Zylon ship can 05177 ; move along each axis of the 3D coordinate system, that is the maximum value of 05178 ; a velocity vector component. Velocity vector components for Zylon ships are 05179 ; picked from the Zylon velocity table ZYLONVELTAB ($BF99): 05180 ; 05181 ; +-----------------+-----+-----+-----+-----+-----+-----+-----+-----+ 05182 ; | Velocity Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 05183 ; +-----------------+-----+-----+-----+-----+-----+-----+-----+-----+ 05184 ; | Velocity <KM/H> | +62 | +30 | +16 | +8 | +4 | +2 | +1 | 0 | 05185 ; +-----------------+-----+-----+-----+-----+-----+-----+-----+-----+ 05186 ; +-----------------+-----+-----+-----+-----+-----+-----+-----+-----+ 05187 ; | Velocity Index | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 05188 ; +-----------------+-----+-----+-----+-----+-----+-----+-----+-----+ 05189 ; | Velocity <KM/H> | 0 | -1 | -2 | -4 | -8 | -16 | -30 | -62 | 05190 ; +-----------------+-----+-----+-----+-----+-----+-----+-----+-----+ 05191 ; 05192 ; The index into the Zylon velocity table ZYLONVELTAB ($BF99) corresponding to 05193 ; the maximum velocity is called the "maximum velocity index". The following 05194 ; table shows the flight patterns, their maximum velocity indices, and their 05195 ; corresponding velocities: 05196 ; 05197 ; +----------------+------------------+------------------+ 05198 ; | Flight Pattern | Maximum Velocity | Maximum Velocity | 05199 ; | | Index | | 05200 ; +----------------+------------------+------------------+ 05201 ; | 0 | 0 | +62 <KM/H> | 05202 ; | 0 | 15 | -62 <KM/H> | 05203 ; | 1 | 1 | +30 <KM/H> | 05204 ; | 1 | 14 | -30 <KM/H> | 05205 ; | 4 | 4 | +4 <KM/H> | 05206 ; | 4 | 11 | -4 <KM/H> | 05207 ; +----------------+------------------+------------------+ 05208 ; 05209 ; Because flight pattern 0 produces the fastest-moving Zylon ships, which 05210 ; maneuver aggressively, it is called the "attack flight pattern". 05211 ; 05212 ; Each Zylon ship has a set of 3 maximum velocity indices, one for each of its 05213 ; velocity vector components. 05214 ; 05215 ; Each Zylon ship has also one more set of 3 velocity indices, called "Zylon 05216 ; velocity indices", one for each of its velocity vector components. They are 05217 ; used to pick the current values of the velocity vector components from the 05218 ; Zylon velocity table ZYLONVELTAB ($BF99). 05219 ; 05220 ; In order to maneuver Zylon ships this subroutine uses the concept of 05221 ; "milestone velocity indices". By using delay timers, called "Zylon timers", 05222 ; this subroutine gradually increases or decreases the Zylon velocity indices 05223 ; with every game loop iteration to eventually match the corresponding milestone 05224 ; velocity indices. By incrementing a Zylon velocity index a Zylon ship 05225 ; accelerates toward the negative direction of a coordinate axis. By 05226 ; decrementing a Zylon velocity index a Zylon ship accelerates toward the 05227 ; positive direction of a coordinate axis. If one milestone velocity index is 05228 ; matched or a "milestone timer" has counted down to 0, a new milestone velocity 05229 ; index is calculated and the matching of the current Zylon velocity indices 05230 ; with the new milestone velocity indices repeats. 05231 ; 05232 ; DETAILS 05233 ; 05234 ; For quick lookup, the following table lists the PLAYERs and what space objects 05235 ; they represent in this subroutine: 05236 ; 05237 ; +--------+---------------------------------+ 05238 ; | PLAYER | Represents | 05239 ; +--------+---------------------------------+ 05240 ; | 0 | Zylon Ship 0 | 05241 ; | 1 | Zylon Ship 1 | 05242 ; | 2 | Zylon Photon Torpedo, Meteor | 05243 ; | 3 | Our starship's Photon Torpedo 0 | 05244 ; | 4 | Our starship's Photon Torpedo 1 | 05245 ; +--------+---------------------------------+ 05246 ; 05247 ; This subroutine executes the following steps: 05248 ; 05249 ; (1) Update the x and y velocity vector components of both of our starship's 05250 ; photon torpedoes 0 and 1. 05251 ; 05252 ; The x and y velocity vector components of both of our starship's photon 05253 ; torpedoes 0 and 1 are only updated if they are tracking (homing in on) a 05254 ; target. 05255 ; 05256 ; To update the y-velocity vector components of both of our starship's 05257 ; photon torpedoes 0 and 1 the PLAYER row number difference between the 05258 ; PLAYER of tracked target sapce object and the current location of the 05259 ; PLAYER of our starship's photon torpedo 0 is passed to subroutine 05260 ; HOMINGVEL ($AECA). It returns the new y-velocity vector component value 05261 ; for both of our starship's photon torpedoes in <KM/H>. If the target is 05262 ; located below our starship's photon torpedo 0 a value of 0 <KM/H> is 05263 ; used. 05264 ; 05265 ; NOTE: The new y-velocity vector components depend only on the PLAYER row 05266 ; number of our starship's photon torpedo 0. 05267 ; 05268 ; To update the x-velocity vector components of both of our starship's 05269 ; photon torpedoes, the above calculation is repeated for the PLAYER column 05270 ; numbers of each of our starship's photon torpedoes 0 and 1. 05271 ; 05272 ; (2) Make the Zylon ships follow the rotation of our starship. 05273 ; 05274 ; If you rotate our starship away from Zylon ships they adjust their course 05275 ; such that they reappear in our starship's view. 05276 ; 05277 ; This is achieved by 4 Zylon timers, one for each of both Zylon ships' 05278 ; current x and y Zylon velocity indices. The Zylon timers are decremented 05279 ; every game loop iteration. If any of them reach a value of 0, the 05280 ; corresponding Zylon velocity index is incremented or decremented 05281 ; depending on the current joystick position. 05282 ; 05283 ; For example, if the Zylon timer for the x-velocity of Zylon ship 0 05284 ; reaches 0 and at the same time the joystick is pushed left then the 05285 ; x-Zylon velocity index of this Zylon ship is incremented. This 05286 ; accelerates the Zylon ship toward negative x-direction ("left"): The 05287 ; Zylon ship follows our starship's rotation. This works in Aft view, too, 05288 ; where the direction of change of the Zylon velocity index is reversed. 05289 ; After setting the new Zylon velocity index, it is used to pick a new 05290 ; Zylon timer value for this Zylon velocity index: 05291 ; 05292 ; +--------------------------------+----+----+----+----+----+----+----+----+ 05293 ; | Velocity Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 05294 ; +--------------------------------+----+----+----+----+----+----+----+----+ 05295 ; | Zylon Timer Value (Game Loops) | 0 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 05296 ; +--------------------------------+----+----+----+----+----+----+----+----+ 05297 ; +--------------------------------+----+----+----+----+----+----+----+----+ 05298 ; | Velocity Index | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 05299 ; +--------------------------------+----+----+----+----+----+----+----+----+ 05300 ; | Zylon Timer Value (Game Loops) | 14 | 12 | 10 | 8 | 6 | 4 | 2 | 0 | 05301 ; +--------------------------------+----+----+----+----+----+----+----+----+ 05302 ; 05303 ; (3) Update the x and y velocity vector components of the single Zylon photon 05304 ; torpedo. 05305 ; 05306 ; If a Zylon photon torpedo is moving toward our starship then update its x 05307 ; and y velocity vector components. They are picked from table 05308 ; ZYLONHOMVELTAB ($BF85) and depend on the mission level. The signs of the 05309 ; velocity vector components are always set such that the Zylon photon 05310 ; torpedo is guided toward our starship. 05311 ; 05312 ; (4) Create a meteor? 05313 ; 05314 ; If PLAYER2, the PLAYER to represent a meteor, is either initial or not 05315 ; alive, then attempt in 7 out of 8 game loop iterations to create a new 05316 ; meteor. 05317 ; 05318 ; With a probability of 2% (4:256) a new meteor is created: Its shape type 05319 ; is set to METEOR, its position vector components to random coordinates in 05320 ; subroutine INITPOSVEC ($B764), its lifetime to 60 game loop iterations, 05321 ; and its velocity vector components (velocities) to x-velocity: 0 <KM/H>, 05322 ; y-velocity: 0 <KM/H>, z-velocity: -8 <KM/H>. Then code execution returns. 05323 ; 05324 ; (5) Toggle Zylon ship control. 05325 ; 05326 ; Every other game loop iteration, the program takes control of and 05327 ; maneuvers the other Zylon ship. 05328 ; 05329 ; (6) Create new Zylon ship? 05330 ; 05331 ; If the program-controlled Zylon ship is not alive, check if both Zylon 05332 ; ships are not alive and this is an empty sector. If so, then attempt to 05333 ; create a meteor. Otherwise create a new Zylon ship with infinite 05334 ; lifetime. Randomly pick its shape type from table ZYLONSHAPTAB ($BF89) 05335 ; (BASESTAR, ZYLON CRUISER, or ZYLON FIGHTER) and its flight pattern from 05336 ; table ZYLONFLPATTAB ($BF91) (attack flight pattern 0 is always picked in 05337 ; a NOVICE mission). Then set the milestone timer to 1 game loop iteration 05338 ; and the position vector of the Zylon ship to a position of at least 05339 ; +28928 (+$71**) <KM> in front of our starship. The y-coordinate depends 05340 ; on the value of VICINITYMASK ($C7). The x-coordinate is the sum of the 05341 ; y-coordinate plus at least 4864..5119 ($13**) <KM>. Randomly choose the 05342 ; signs of the x and y coordinates. 05343 ; 05344 ; (7) Set the current flight pattern to attack flight pattern? 05345 ; 05346 ; The current flight pattern of the Zylon ship will change to attack flight 05347 ; pattern if it is close enough (z-coordinate < +8192 (+$20**) <KM>) and 05348 ; one of the following conditions is met: 05349 ; 05350 ; o The Zylon ship is located behind our starship. 05351 ; 05352 ; o The shape of the Zylon ship is not initial and does not currently 05353 ; appear as a blip in the Long-Range Scan view. 05354 ; 05355 ; (8) Update the back-attack flag and the milestone velocity indices. 05356 ; 05357 ; The milestone timer is decremented for the program-controlled Zylon ship. 05358 ; If this timer reaches a value of 0 the following steps are executed: 05359 ; 05360 ; o The milestone timer is reset to a value of 120 game loop iterations. 05361 ; 05362 ; o The back-attack flag is updated. It determines if the 05363 ; program-controlled Zylon ship not only attacks from the front of our 05364 ; starship but also from the back. A back-attack takes place with a 05365 ; probability of 19% (48:256) in WARRIOR or COMMANDER missions. 05366 ; 05367 ; o Course corrections are prepared for the program-controlled Zylon ship 05368 ; by computing the new milestone vector indices, resulting in new 05369 ; velocity vector components for this Zylon ship. The new milestone 05370 ; velocity indices for each velocity vector component are randomly 05371 ; chosen depending of the flight pattern. Recall that the Zylon 05372 ; velocity index is changed gradually to match the milestone velocity 05373 ; index. It corresponds to a maximum velocity vector component when 05374 ; using this index to pick a velocity vector component from Zylon 05375 ; velocity table ZYLONVELTAB ($BF99): 05376 ; 05377 ; +----------------+----------------+------------------+ 05378 ; | Flight Pattern | New Milestone | Maximum Velocity | 05379 ; | | Velocity Index | Vector Component | 05380 ; +----------------+----------------+------------------+ 05381 ; | 0 | 0 | +62 <KM/H> | 05382 ; | 0 | 15 | -62 <KM/H> | 05383 ; | 1 | 1 | +30 <KM/H> | 05384 ; | 1 | 14 | -30 <KM/H> | 05385 ; | 4 | 4 | +4 <KM/H> | 05386 ; | 4 | 11 | -4 <KM/H> | 05387 ; +----------------+----------------+------------------+ 05388 ; 05389 ; (9) Update milestone velocity indices in attack flight pattern. 05390 ; 05391 ; If a Zylon ship executes the attack flight pattern, its milestone 05392 ; velocity indices are changed depending on the current location of the 05393 ; Zylon ship as follows: 05394 ; 05395 ; +--------------+-------------+----------------+------------+----------------+ 05396 ; | x-Coordinate | Where on | Milestone | Velocity | Zylon Ship | 05397 ; | | Screen | Velocity Index | | Accelerates... | 05398 ; +--------------+-------------+----------------+------------+----------------+ 05399 ; | x < 0 <KM> | left half | 0 | +62 <KM/H> | to the right | 05400 ; | x >= 0 <KM> | right half | 15 | -62 <KM/H> | to the left | 05401 ; +--------------+-------------+----------------+------------+----------------+ 05402 ; +--------------+-------------+----------------+------------+----------------+ 05403 ; | y-Coordinate | Where on | Milestone | Velocity | Zylon Ship | 05404 ; | | Screen | Velocity Index | | Accelerates... | 05405 ; +--------------+-------------+----------------+------------+----------------+ 05406 ; | y < 0 <KM> | bottom half | 0 | +62 <KM/H> | up | 05407 ; | y >= 0 <KM> | top half | 15 | -62 <KM/H> | down | 05408 ; +--------------+-------------+----------------+------------+----------------+ 05409 ; 05410 ; Thus, with respect to its x and y coordinates, the Zylon ship oscillates 05411 ; around the center of the Front or Aft view. 05412 ; 05413 ; This is the behavior of the Zylon ship along the z-axis: 05414 ; 05415 ; If the Zylon ship attacks from the front: 05416 ; 05417 ; +--------------------------+----------------+------------+----------------+ 05418 ; | z-Coordinate | Milestone | Velocity | Zylon Ship | 05419 ; | | Velocity Index | | Accelerates... | 05420 ; +--------------------------+----------------+------------+----------------+ 05421 ; | z < +2560 (+$0A00) <KM> | 0 | +62 <KM/H> | outbound | 05422 ; | z >= +2560 (+$0A00) <KM> | 15 | -62 <KM/H> | inbound | 05423 ; +--------------------------+----------------+------------+----------------+ 05424 ; 05425 ; In other words, the Zylon ship accelerates into positive z-direction 05426 ; (outbound) up to a distance of +2560 (+$0A00) <KM>, then reverses its 05427 ; course and returns back to our starship (inbound). 05428 ; 05429 ; If the Zylon ship attacks from the back: 05430 ; 05431 ; +--------------------------+----------------+------------+----------------+ 05432 ; | z-Coordinate | Milestone | Velocity | Zylon Ship | 05433 ; | | Velocity Index | | Accelerates... | 05434 ; +--------------------------+----------------+------------+----------------+ 05435 ; | z < -2816 (-$F500) <KM> | 0 | +62 <KM/H> | inbound | 05436 ; | z >= -2816 (-$F500) <KM> | 15 | -62 <KM/H> | outbound | 05437 ; +--------------------------+----------------+------------+----------------+ 05438 ; 05439 ; In other words, the Zylon ship accelerates into negative z-direction 05440 ; (outbound) up to a distance of -2816 (-$(0B00)) <KM>, then reverses its 05441 ; course and returns back to our starship (inbound). 05442 ; 05443 ; (10) Change Zylon velocity index toward milestone velocity index. 05444 ; 05445 ; Compare all 3 Zylon velocity indices of the program-controlled Zylon ship 05446 ; with their corresponding milestone velocity indices. Increment or 05447 ; decrement the former to better match the latter. Use the new Zylon 05448 ; velocity indices to pick the current velocity values from Zylon velocity 05449 ; table ZYLONVELTAB ($BF99). 05450 ; 05451 ; (11) Launch a Zylon photon torpedo? 05452 ; 05453 ; Prepare launching a Zylon photon torpedo if either of the following 05454 ; conditions are met: 05455 ; 05456 ; o PLAYER2 is not used as a photon torpedo 05457 ; 05458 ; o The y-coordinate of the Zylon ship is in the range of -768..+767 05459 ; (-$0300..+$2FF) <KM>. 05460 ; 05461 ; or if 05462 ; 05463 ; o The Zylon photon torpedo is not alive 05464 ; 05465 ; o The corresponding Zylon photon torpedo delay timer has reached a 05466 ; value of 0 05467 ; 05468 ; o The y-coordinate of the Zylon ship is in the range of -768..+767 05469 ; (-$0300..+$2FF) <KM>. 05470 ; 05471 ; At this point the z-velocity vector component of the Zylon photon torpedo 05472 ; is preloaded with a value of -80 or +80 <KM/H> depending on the Zylon 05473 ; ship being in front or behind of our starship, respectively. 05474 ; 05475 ; Launch a Zylon photon torpedo if both of the following conditions are 05476 ; met: 05477 ; 05478 ; o The Zylon ship is in front or behind of our starship, with the 05479 ; exception of a Zylon ship behind our starship in a NOVICE mission 05480 ; (our starship will never be shot in the back in a NOVICE mission). 05481 ; 05482 ; o The z-coordinate of the Zylon ship (no matter if in front or behind 05483 ; our starship) is closer than 8192 ($20**) <KM>. 05484 ; 05485 ; Finally, the Zylon photon torpedo is launched with a lifetime of 62 game 05486 ; loop iterations. Its position vector is copied from the launching Zylon 05487 ; ship in subroutine COPYPOSVEC ($ACAF). In addition, the Zylon ship is 05488 ; earmarked for the tracking computer. 05489 =006A 05490 L.CTRLDZYLON = $6A ; Index of currently program-controlled Zylon ship. 05491 ; Used values are: 05492 ; 0 -> Control Zylon ship 0 05493 ; 1 -> Control Zylon ship 1 =0080 05494 NEG = $80 ; Negative sign bit for velocity vector component 05495 AA79 A5C0 05496 MANEUVER LDA WARPSTATE ; Return if in starbase sector or hyperwarp engaged AA7B 057B 05497 ORA ISSTARBASESECT ; AA7D D0F9 05498 BNE SKIP078 ; 05499 05500 ;*** Update x and y velocity of both our starship's photon torpedoes 0 and 1 *** AA7F A586 05501 LDA ISTRACKING ; Skip this if ship's torpedoes not tracking a target AA81 F030 05502 BEQ SKIP080 ; 05503 AA83 A689 05504 LDX PLTRACKED ; Load PLAYER index of tracked target space object 05505 AA85 38 05506 SEC ; Prep A := PLAYER row number of target... AA86 BDF90B 05507 LDA PL0ROWNEW,X ; ...- PLAYER row number photon torpedo 0 AA89 EDFC0B 05508 SBC PL3ROWNEW ; AA8C 9002 05509 BCC SKIP079 ; Skip if target above our starship's photon torpedo AA8E A900 05510 LDA #0 ; Prep A := 0 AA90 20CAAE 05511 SKIP079 JSR HOMINGVEL ; Get y-velocity for homing photon torpedo 0 and 1 AA93 8DCB0B 05512 STA PL3YVEL ; Store y-velocity photon torpedo 0 AA96 8DCC0B 05513 STA PL4YVEL ; Store y-velocity photon torpedo 1 05514 AA99 38 05515 SEC ; Prep A := PLAYER column number of target... AA9A AD2D0C 05516 LDA PL3COLUMN ; ...- PLAYER column number of photon torpedo 0 AA9D FD2A0C 05517 SBC PL0COLUMN,X ; AAA0 20CAAE 05518 JSR HOMINGVEL ; Get x-velocity for homing photon torpedo 0 AAA3 8D9A0B 05519 STA PL3XVEL ; Store x-velocity of photon torpedo 0 05520 AAA6 38 05521 SEC ; Prep A := PLAYER column number of target... AAA7 AD2E0C 05522 LDA PL4COLUMN ; ...- PLAYER column number of photon torpedo 1 AAAA FD2A0C 05523 SBC PL0COLUMN,X ; AAAD 20CAAE 05524 JSR HOMINGVEL ; Get x-velocity for homing photon torpedo 1 AAB0 8D9B0B 05525 STA PL4XVEL ; Store x-velocity of photon torpedo 1 05526 05527 ;*** Make Zylon ships follow rotation of our starship ************************** AAB3 A203 05528 SKIP080 LDX #3 ; Loop over x and y velocity indices of both Zylons AAB5 D6BA 05529 LOOP036 DEC ZYLONTIMX0,X ; Decrement Zylon timer AAB7 1027 05530 BPL SKIP085 ; Next timer if this one still counting down 05531 AAB9 8A 05532 TXA ; Prep joystick (x or y) value in -1, 0, +1 AABA 4A 05533 LSR A ; AABB A8 05534 TAY ; AABC B9C800 05535 LDA JOYSTICKX,Y ; 05536 AABF A4D0 05537 LDY SHIPVIEW ; Skip if in Front view AAC1 F005 05538 BEQ SKIP081 ; 05539 AAC3 49FF 05540 EOR #$FF ; Invert joystick value (when in Aft view) AAC5 18 05541 CLC ; (two's-complement) AAC6 6901 05542 ADC #1 ; 05543 AAC8 18 05544 SKIP081 CLC ; Add joystick value to Zylon velocity index AAC9 75B4 05545 ADC ZYLONVELINDX0,X ; AACB 1002 05546 BPL SKIP082 ; AACD A900 05547 LDA #0 ; AACF C910 05548 SKIP082 CMP #16 ; Limit new Zylon velocity index to 0..15 ... AAD1 9002 05549 BCC SKIP083 ; AAD3 A90F 05550 LDA #15 ; AAD5 95B4 05551 SKIP083 STA ZYLONVELINDX0,X ; ...and store new Zylon velocity index 05552 AAD7 C908 05553 CMP #8 ; Calc new Zylon timer value in 0, 2, ..., 14 AAD9 9002 05554 BCC SKIP084 ; AADB 490F 05555 EOR #$0F ; AADD 0A 05556 SKIP084 ASL A ; AADE 95BA 05557 STA ZYLONTIMX0,X ; ...and store new Zylon timer value 05558 AAE0 CA 05559 SKIP085 DEX ; AAE1 10D2 05560 BPL LOOP036 ; Next Zylon timer 05561 05562 ;*** Update x and y velocity of single Zylon photon torpedo ******************** AAE3 AD8E0C 05563 LDA PL2SHAPTYPE ; Skip if PLAYER2 not PHOTON TORPEDO (shape type 0) AAE6 D01B 05564 BNE SKIP088 ; 05565 AAE8 A462 05566 LDY MISSIONLEVEL ; Depending on mission level... AAEA B985BF 05567 LDA ZYLONHOMVELTAB,Y ; ...pick (initially negative) Zylon torpedo velocity 05568 AAED AEA40A 05569 LDX PL2YPOSHI ; If photon torpedo in upper screen half (y >= 0)... AAF0 1002 05570 BPL SKIP086 ; ...don't toggle velocity sign -> torpedo goes down AAF2 297F 05571 AND #$7F ; ...toggle velocity sign -> torpedo goes up AAF4 8DCA0B 05572 SKIP086 STA PL2YVEL ; Store new y-velocity of Zylon photon torpedo 05573 AAF7 0980 05574 ORA #NEG ; Restore negative sign bit of velocity 05575 AAF9 AE730A 05576 LDX PL2XPOSHI ; If photon torpedo in right screen half (x >= 0)... AAFC 1002 05577 BPL SKIP087 ; ...don't toggle velocity sign -> torpedo goes left AAFE 297F 05578 AND #$7F ; ...toggle velocity sign -> torpedo goes right AB00 8D990B 05579 SKIP087 STA PL2XVEL ; Store new x-velocity of Zylon photon torpedo 05580 05581 ;*** Create new meteor? ******************************************************** AB03 A576 05582 SKIP088 LDA COUNT256 ; Attempt meteor creation in 7 out of 8 game loops AB05 2903 05583 AND #$03 ; AB07 F02E 05584 BEQ SKIP092 ; 05585 AB09 A5E6 05586 SKIP089 LDA PL2SHAPOFF ; If PLAYER2 shape is initial try to create a meteor AB0B F004 05587 BEQ SKIP090 ; 05588 AB0D A5EB 05589 LDA PL2LIFE ; Return if PLAYER2 alive AB0F D025 05590 BNE SKIP091 ; 05591 AB11 AD0AD2 05592 SKIP090 LDA RANDOM ; Return in 98% (252:256) (do not create meteor) AB14 C904 05593 CMP #4 ; AB16 B01E 05594 BCS SKIP091 ; 05595 05596 ;*** Create new meteor! ******************************************************** AB18 A960 05597 LDA #SHAP.METEOR ; PLAYER2 is METEOR (shape type 6) AB1A 8D8E0C 05598 STA PL2SHAPTYPE ; AB1D A202 05599 LDX #2 ; Randomize position vector of meteor AB1F 2064B7 05600 JSR INITPOSVEC ; AB22 A93C 05601 LDA #60 ; Meteor lifetime := 60 game loops AB24 85EB 05602 STA PL2LIFE ; AB26 A988 05603 LDA #NEG!8 ; SUMMARY: AB28 8D680B 05604 STA PL2ZVEL ; x-velocity := 0 <KM/H> AB2B A900 05605 LDA #0 ; y-velocity := 0 <KM/H> AB2D 8D2C0C 05606 STA PL2COLUMN ; z-velocity := -8 <KM/H> AB30 8D990B 05607 STA PL2XVEL ; AB33 8DCA0B 05608 STA PL2YVEL ; PLAYER2 column number := 0 (offscreen) AB36 60 05609 SKIP091 RTS ; Return 05610 05611 ;*** Toggle Zylon ship control ************************************************* AB37 A5A7 05612 SKIP092 LDA CTRLDZYLON ; Toggle control to the other Zylon ship AB39 4901 05613 EOR #$01 ; AB3B 85A7 05614 STA CTRLDZYLON ; 05615 05616 ;*** Create a new Zylon ship? ************************************************** AB3D AA 05617 TAX ; Save index of controlled Zylon ship AB3E B5E9 05618 LDA PL0LIFE,X ; Skip creating Zylon ship if its PLAYER still alive AB40 D042 05619 BNE SKIP094 ; 05620 AB42 A5E9 05621 LDA PL0LIFE ; If both Zylon ships are not alive... AB44 05EA 05622 ORA PL1LIFE ; AB46 2901 05623 AND #$01 ; AB48 A490 05624 LDY CURRSECTOR ; ...and this an empty sector... AB4A D9C908 05625 CMP GCMEMMAP,Y ; AB4D B0BA 05626 BCS SKIP089 ; ...attempt to create meteor and return 05627 05628 ;*** Create a new Zylon ship! ************************************************** AB4F A9FF 05629 LDA #255 ; Zylon ship lifetime := 255 game loops (infinite) AB51 95E9 05630 STA PL0LIFE,X ; 05631 AB53 AD0AD2 05632 LDA RANDOM ; Pick a Zylon ship shape type (1 out of 8) AB56 2907 05633 AND #$07 ; AB58 A8 05634 TAY ; AB59 B989BF 05635 LDA ZYLONSHAPTAB,Y ; AB5C 9D8C0C 05636 STA PL0SHAPTYPE,X ; 05637 AB5F A562 05638 LDA MISSIONLEVEL ; Init Zylon's flight pattern (0 if NOVICE mission) AB61 F003 05639 BEQ SKIP093 ; AB63 B991BF 05640 LDA ZYLONFLPATTAB,Y ; AB66 95A8 05641 SKIP093 STA ZYLONFLPAT0,X ; 05642 AB68 A901 05643 LDA #1 ; Zylon ship's milestone timer := 1 game loop AB6A 95AA 05644 STA MILESTTIM0,X ; 05645 AB6C 9DAD09 05646 STA ZPOSSIGN,X ; Put Zylon ship in front of our starship AB6F AD0AD2 05647 LDA RANDOM ; AB72 25C7 05648 AND VICINITYMASK ; y-coordinate (high byte) := RND(0..VICINITYMASK) AB74 9DA20A 05649 STA YPOSHI,X ; AB77 6913 05650 ADC #19 ; x-coordinate (high byte) := y (high byte) + 19 AB79 9D710A 05651 STA XPOSHI,X ; AB7C 0971 05652 ORA #$71 ; z-coordinate (high byte) := >= +28928 (+$71**) <KM> AB7E 9D400A 05653 STA ZPOSHI,X ; AB81 20BEB7 05654 JSR RNDINVXY ; Randomly invert x and y coordinate of pos vector 05655 05656 ;*** Set current flight pattern to attack flight pattern? ********************** AB84 BD400A 05657 SKIP094 LDA ZPOSHI,X ; Skip if Zylon too distant (z >= +$20** <KM>) AB87 C920 05658 CMP #$20 ; AB89 B011 05659 BCS SKIP096 ; 05660 AB8B BDAD09 05661 LDA ZPOSSIGN,X ; Set attack flight pattern if Zylon is behind AB8E F008 05662 BEQ SKIP095 ; 05663 AB90 B5E4 05664 LDA PL0SHAPOFF,X ; Skip if Zylon shape initial AB92 F008 05665 BEQ SKIP096 ; 05666 AB94 C929 05667 CMP #$29 ; Skip if Zylon shape is Long-Range Scan blip AB96 F004 05668 BEQ SKIP096 ; 05669 AB98 A900 05670 SKIP095 LDA #0 ; Set attack flight pattern AB9A 95A8 05671 STA ZYLONFLPAT0,X ; 05672 05673 ;*** Update back-attack flag and milestone velocity indices ******************** AB9C D6AA 05674 SKIP096 DEC MILESTTIM0,X ; Skip if milestone timer still counting down AB9E 1024 05675 BPL SKIP099 ; 05676 ABA0 A978 05677 LDA #120 ; Milestone timer := 120 game loops ABA2 95AA 05678 STA MILESTTIM0,X ; 05679 ABA4 A562 05680 LDA MISSIONLEVEL ; Back-attack flag := 1 in 19% (48:256) of... ABA6 AC0AD2 05681 LDY RANDOM ; ...WARRIOR or COMMANDER missions ABA9 C030 05682 CPY #48 ; ... := 0 otherwise ABAB 9001 05683 BCC SKIP097 ; ABAD 4A 05684 LSR A ; ABAE 4A 05685 SKIP097 LSR A ; ABAF 95B8 05686 STA ISBACKATTACK0,X ; 05687 05688 ; Loop over all 3 milestone velocity indices ABB1 B5A8 05689 LDA ZYLONFLPAT0,X ; Set new milestone velocity index: ABB3 2C0AD2 05690 LOOP037 BIT RANDOM ; If Zylon flight pattern is... ABB6 1002 05691 BPL SKIP098 ; ...0 -> milestone velocity index := either 0 or 15 ABB8 490F 05692 EOR #$0F ; ...1 -> milestone velocity index := either 1 or 14 ABBA 95AC 05693 SKIP098 STA MILESTVELINDZ0,X ; ...4 -> milestone velocity index := either 4 or 11 ABBC E8 05694 INX ; ABBD E8 05695 INX ; ABBE E006 05696 CPX #6 ; ABC0 90F1 05697 BCC LOOP037 ; Next Zylon milestone velocity index 05698 05699 ;*** Update milestone velocity indices in attack flight pattern **************** ABC2 A6A7 05700 LDX CTRLDZYLON ; Reload index of controlled Zylon ship 05701 ABC4 B5A8 05702 SKIP099 LDA ZYLONFLPAT0,X ; Skip if not in attack flight pattern ABC6 D032 05703 BNE SKIP105 ; 05704 ABC8 A4A7 05705 LDY CTRLDZYLON ; Reload index of controlled Zylon ship 05706 05707 ; Loop over all 3 milestone velocity indices ABCA C031 05708 LOOP038 CPY #$31 ; Skip to handle x and y velocity index ABCC B013 05709 BCS SKIP101 ; 05710 ; SUMMARY: ABCE B9B800 05711 LDA ISBACKATTACK0,Y ; Handle z-velocity index: ABD1 4A 05712 LSR A ; ABD2 B9400A 05713 LDA ZPOSHI,Y ; If Zylon attacks from front... ABD5 B006 05714 BCS SKIP100 ; z < $0A00 <KM> -> mil vel index := 0 (+62 <KM/H>) ABD7 C90A 05715 CMP #$0A ; z >= $0A00 <KM> -> mil vel index := 15 (-62 <KM/H>) ABD9 900E 05716 BCC SKIP103 ; ABDB B004 05717 BCS SKIP101 ; If Zylon attacks from back... ABDD C9F5 05718 SKIP100 CMP #$F5 ; z >= $F500 <KM> -> mil vel index := 15 (-62 <KM/H>) ABDF B004 05719 BCS SKIP102 ; z < $F500 <KM> -> mil vel index := 0 (+62 <KM/H>) 05720 ABE1 B9AD09 05721 SKIP101 LDA ZPOSSIGN,Y ; Handle x and y velocity index: ABE4 4A 05722 LSR A ; ABE5 A90F 05723 SKIP102 LDA #15 ; x >= 0 <KM> -> mil vel index := 15 (-62 <KM/H>) ABE7 B002 05724 BCS SKIP104 ; x < 0 <KM> -> mil vel index := 0 (+62 <KM/H>) ABE9 A900 05725 SKIP103 LDA #0 ; y >= 0 <KM> -> mil vel index := 15 (-62 <KM/H>) ABEB 95AC 05726 SKIP104 STA MILESTVELINDZ0,X ; y < 0 <KM> -> mil vel index := 0 (+62 <KM/H>) 05727 ABED 18 05728 CLC ; Adjust position vector component index ABEE 98 05729 TYA ; ABEF 6931 05730 ADC #MAXSPCOBJNUM ; ABF1 A8 05731 TAY ; 05732 ABF2 E8 05733 INX ; ABF3 E8 05734 INX ; ABF4 E006 05735 CPX #6 ; ABF6 90D2 05736 BCC LOOP038 ; Next milestone velocity index 05737 05738 ;*** Change Zylon velocity index toward milestone velocity index *************** ABF8 A6A7 05739 LDX CTRLDZYLON ; Reload index of controlled Zylon ship ABFA A4A7 05740 SKIP105 LDY CTRLDZYLON ; Reload index of controlled Zylon ship 05741 05742 ; Loop over all 3 milestone velocity indices ABFC B5B2 05743 LOOP039 LDA ZYLONVELINDZ0,X ; Compare Zylon velocity index with milestone index ABFE D5AC 05744 CMP MILESTVELINDZ0,X ; AC00 F008 05745 BEQ SKIP107 ; Skip if equal AC02 B004 05746 BCS SKIP106 ; AC04 F6B2 05747 INC ZYLONVELINDZ0,X ; Increm. Zylon velocity index if < milestone index AC06 9002 05748 BCC SKIP107 ; AC08 D6B2 05749 SKIP106 DEC ZYLONVELINDZ0,X ; Decrem. Zylon velocity index if >= milestone index 05750 AC0A 866A 05751 SKIP107 STX L.CTRLDZYLON ; Save index of controlled Zylon ship AC0C AA 05752 TAX ; AC0D BD99BF 05753 LDA ZYLONVELTAB,X ; Pick new velocity value by Zylon velocity index AC10 A66A 05754 LDX L.CTRLDZYLON ; Reload index of controlled Zylon ship AC12 99660B 05755 STA ZVEL,Y ; Store new velocity vector component of Zylon ship 05756 AC15 98 05757 TYA ; Next velocity vector component AC16 18 05758 CLC ; AC17 6931 05759 ADC #MAXSPCOBJNUM ; AC19 A8 05760 TAY ; 05761 AC1A E8 05762 INX ; AC1B E8 05763 INX ; AC1C E006 05764 CPX #6 ; AC1E 90DC 05765 BCC LOOP039 ; Next milestone velocity index 05766 05767 ;*** Launch Zylon photon torpedo? ********************************************** 05768 05769 ;*** Check PLAYER2 shape and lifetime ****************************************** AC20 A6A7 05770 LDX CTRLDZYLON ; Reload index of controlled Zylon ship 05771 AC22 AD8E0C 05772 LDA PL2SHAPTYPE ; Skip if PLAYER2 not PHOTON TORPEDO (shape type 0) AC25 D00B 05773 BNE SKIP109 ; 05774 AC27 A5EB 05775 LDA PL2LIFE ; Return if Zylon photon torpedo still alive AC29 D006 05776 BNE SKIP108 ; 05777 AC2B A5BE 05778 LDA TORPEDODELAY ; Count down Zylon photon torpedo delay timer... AC2D F003 05779 BEQ SKIP109 ; ...before launching next Zylon photon torpedo AC2F C6BE 05780 DEC TORPEDODELAY ; AC31 60 05781 SKIP108 RTS ; Return 05782 05783 ;*** Check y-coordinate of Zylon ship ****************************************** AC32 18 05784 SKIP109 CLC ; Return if Zylon ship's y-coordinate not... AC33 BDA20A 05785 LDA YPOSHI,X ; ...in -768..+767 (-$(0300)..+$2FF) <KM>. AC36 6902 05786 ADC #2 ; AC38 C905 05787 CMP #5 ; AC3A B0F5 05788 BCS SKIP108 ; 05789 05790 ;*** Set Zylon photon torpedo's z-velocity ************************************* AC3C A0D0 05791 LDY #NEG!80 ; Prep Zylon torpedo's z-velocity := -80 <KM/H> 05792 AC3E BDAD09 05793 LDA ZPOSSIGN,X ; Prep Zylon ship's sign of z-coordinate AC41 4A 05794 LSR A ; AC42 BD400A 05795 LDA ZPOSHI,X ; Prep Zylon ship's z-coordinate AC45 B008 05796 BCS SKIP110 ; Skip if Zylon ship in front... AC47 49FF 05797 EOR #$FF ; ...else invert loaded Zylon ship's z-coordinate 05798 AC49 A462 05799 LDY MISSIONLEVEL ; Return (no torpedo from back) if NOVICE mission AC4B F0E4 05800 BEQ SKIP108 ; 05801 AC4D A050 05802 LDY #80 ; Preload Zylon torpedo's z-velocity := +80 <KM/H> 05803 05804 ;*** Is Zylon ship in range? *************************************************** AC4F C920 05805 SKIP110 CMP #$20 ; Return if Zylon ship too far... AC51 B0DE 05806 BCS SKIP108 ; ... (ABS(z-coordinate) > 8192 ($20**) <KM>) 05807 AC53 8C680B 05808 STY PL2ZVEL ; Store Zylon photon torpedo's z-velocity 05809 05810 ;*** Launch Zylon photon torpedo! ********************************************** 05811 AC56 A900 05812 LDA #0 ; PLAYER2 is PHOTON TORPEDO (shape type 0) AC58 8D8E0C 05813 STA PL2SHAPTYPE ; AC5B 8D2C0C 05814 STA PL2COLUMN ; Zylon torpedo PLAYER column number := 0 (offscreen) AC5E A93E 05815 LDA #62 ; AC60 85EB 05816 STA PL2LIFE ; Zylon torpedo lifetime := 62 game loops 05817 AC62 A202 05818 LDX #2 ; Prep source index for position vector copy AC64 A4A7 05819 LDY CTRLDZYLON ; Prep destination index for position vector copy AC66 84BF 05820 STY ZYLONATTACKER ; Save Zylon ship index for tracking computer AC68 4CAFAC 05821 JMP COPYPOSVEC ; Copy position vector from Zylon ship to its torpedo 05822 05823 ;******************************************************************************* 05824 ;* * 05825 ;* INITEXPL * 05826 ;* * 05827 ;* Initialize explosion * 05828 ;* * 05829 ;******************************************************************************* 05830 05831 ; DESCRIPTION 05832 ; 05833 ; Initializes the explosion's lifetime, the explosion fragments' position and 05834 ; velocity vectors as well as their pixel row and column numbers. 05835 ; 05836 ; An explosion has a lifetime of 128 game loop iterations. It consists of 32 05837 ; explosion fragment space objects with indices 17..48. The position vector of 05838 ; each explosion fragment is copied from the exploding PLAYER space object. 05839 ; 05840 ; The pixel column number of each explosion fragment is initialized to 05841 ; 05842 ; PIXEL COLUMN NUMBER := PLAYER column number - 48 + RND(0..15) 05843 ; 05844 ; To convert PLAYER column numbers (in Player/Missile (PM) pixels) into pixel 05845 ; column numbers, the PLAYER column number of the left PLAYFIELD border (= 48) 05846 ; is subtracted and a random number is added. 05847 ; 05848 ; BUG (at $AC76): The added random number should not be in 0..15 but in 0..7 05849 ; because the exploding PLAYER is 8 pixels wide. The PLAYER column number 05850 ; represents the left edge of the PLAYER shape. When using a random number in 05851 ; 0..15, half of the pixels are located off to the right of the PLAYER, outside 05852 ; the PLAYER area. Suggested fix: Replace instruction AND #$0F with AND #$07. 05853 ; 05854 ; The pixel row number of each explosion fragment is initialized to 05855 ; 05856 ; PIXEL ROW NUMBER := (PLAYER row number - RND(0..15)) / 2 - 16 05857 ; 05858 ; BUG (at $AC88): To convert PLAYER row numbers (in PM pixels) into pixel row 05859 ; numbers, the PLAYER row number to the top PLAYFIELD border (= 16) should be 05860 ; subtracted first, then the division by 2 (instruction LRS A) should be applied 05861 ; to reduce the double-line PM resolution to the single-line PLAYFIELD 05862 ; resolution. Suggested fix: Swap instruction LRS A with SBC #16 which leads to 05863 ; the following formula for the pixel row number: 05864 ; 05865 ; PIXEL ROW NUMBER := (PLAYER row number - 16 + RND(0..15)) / 2 05866 ; 05867 ; Incidentally, adding a random number in 0..15 is correct. PLAYER row number 05868 ; represents the top edge of the PLAYER shape, which is typically 16 PM pixels 05869 ; tall when representing a close space object. 05870 ; 05871 ; The velocity vector of explosion fragments is set to random x, y, and z 05872 ; velocity vector components in -7..+7 <KM/H>. 05873 ; 05874 ; INPUT 05875 ; 05876 ; Y = PLAYER index from which the explosion originates. Used values are: 05877 ; 0 -> Explosion of PLAYER0 (Zylon ship 0) 05878 ; 1 -> Explosion of PLAYER1 (Zylon ship 1) 05879 ; 2 -> Explosion of PLAYER2 (Zylon photon torpedo, starbase, or meteor) 05880 AC6B A980 05881 INITEXPL LDA #128 ; Explosion lifetime := 128 game loops AC6D 8573 05882 STA EXPLLIFE ; 05883 AC6F A230 05884 LDX #MAXSPCOBJNUM-1 ; Max index of space objects (for explosion frags) AC71 8679 05885 STX MAXSPCOBJIND ; 05886 05887 ; Loop over all explosion fragment position vectors 05888 ; (index 48..17) AC73 AD0AD2 05889 LOOP040 LDA RANDOM ; PIXEL COLUMN NUM := PLAYER column - 48 + RND(0..15) AC76 290F 05890 AND #$0F ; (!) AC78 792A0C 05891 ADC PL0COLUMN,Y ; AC7B E930 05892 SBC #48 ; AC7D 9D2A0C 05893 STA PIXELCOLUMN,X ; 05894 AC80 AD0AD2 05895 LDA RANDOM ; PIXEL ROW NUM := (PLAYER row + RND(0..15)) / 2 - 16 AC83 290F 05896 AND #$0F ; AC85 79F90B 05897 ADC PL0ROWNEW,Y ; AC88 4A 05898 LSR A ; (!) AC89 E910 05899 SBC #16 ; AC8B 9DF90B 05900 STA PIXELROWNEW,X ; 05901 AC8E 20AFAC 05902 JSR COPYPOSVEC ; Copy position vector of PLAYER to explosion frag 05903 AC91 AD0AD2 05904 LDA RANDOM ; z-velocity := RND(-7..+7) <KM/H> AC94 2987 05905 AND #NEG!7 ; AC96 9D660B 05906 STA ZVEL,X ; AC99 AD0AD2 05907 LDA RANDOM ; x-velocity := RND(-7..+7) <KM/H> AC9C 2987 05908 AND #NEG!7 ; AC9E 9D970B 05909 STA XVEL,X ; ACA1 AD0AD2 05910 LDA RANDOM ; y-velocity := RND(-7..+7) <KM/H> ACA4 2987 05911 AND #NEG!7 ; ACA6 9DC80B 05912 STA YVEL,X ; 05913 ACA9 CA 05914 DEX ; Next explosion fragment position vector ACAA E010 05915 CPX #16 ; ACAC D0C5 05916 BNE LOOP040 ; ACAE 60 05917 RTS ; Return 05918 05919 ;******************************************************************************* 05920 ;* * 05921 ;* COPYPOSVEC * 05922 ;* * 05923 ;* Copy a position vector * 05924 ;* * 05925 ;******************************************************************************* 05926 05927 ; DESCRIPTION 05928 ; 05929 ; Copies a position vector. 05930 ; 05931 ; Actually, this subroutine copies the z-coordinate only, then code execution 05932 ; continues into subroutine COPYPOSXY ($ACC1) to copy the x and y coordinate. 05933 ; 05934 ; INPUT 05935 ; 05936 ; X = Destination position vector index. Used values are: 0..48. 05937 ; Y = Source position vector index. Used values are: 0..48. 05938 ACAF B9AD09 05939 COPYPOSVEC LDA ZPOSSIGN,Y ; ACB2 9DAD09 05940 STA ZPOSSIGN,X ; ACB5 B9400A 05941 LDA ZPOSHI,Y ; ACB8 9D400A 05942 STA ZPOSHI,X ; ACBB B9D30A 05943 LDA ZPOSLO,Y ; ACBE 9DD30A 05944 STA ZPOSLO,X ; 05945 05946 ;******************************************************************************* 05947 ;* * 05948 ;* COPYPOSXY * 05949 ;* * 05950 ;* Copy x and y components (coordinates) of position vector * 05951 ;* * 05952 ;******************************************************************************* 05953 05954 ; DESCRIPTION 05955 ; 05956 ; Copies the x and y components (coordinates) of a position vector. 05957 ; 05958 ; INPUT 05959 ; 05960 ; X = Destination position vector index. Used values are: 0..48. 05961 ; Y = Source position vector index. Used values are: 0..48. 05962 ACC1 B9DE09 05963 COPYPOSXY LDA XPOSSIGN,Y ; ACC4 9DDE09 05964 STA XPOSSIGN,X ; ACC7 B9710A 05965 LDA XPOSHI,Y ; ACCA 9D710A 05966 STA XPOSHI,X ; ACCD B90F0A 05967 LDA YPOSSIGN,Y ; ACD0 9D0F0A 05968 STA YPOSSIGN,X ; ACD3 B9A20A 05969 LDA YPOSHI,Y ; ACD6 9DA20A 05970 STA YPOSHI,X ; ACD9 B9040B 05971 LDA XPOSLO,Y ; ACDC 9D040B 05972 STA XPOSLO,X ; ACDF B9350B 05973 LDA YPOSLO,Y ; ACE2 9D350B 05974 STA YPOSLO,X ; ACE5 60 05975 SKIP111 RTS ; Return 05976 05977 ;******************************************************************************* 05978 ;* * 05979 ;* DOCKING * 05980 ;* * 05981 ;* Handle docking at starbase, launch and return of transfer vessel * 05982 ;* * 05983 ;******************************************************************************* 05984 05985 ; DESCRIPTION 05986 ; 05987 ; Handles docking at a starbase, launching and returning the transfer vessel, 05988 ; and repairing our starship's subsystems. 05989 ; 05990 ; This subroutine changes, if in Front view, the PLAYER-PLAYFIELD priority such 05991 ; that PLAYERs like the starbase appear behind the cross hairs, which are part 05992 ; of the PLAYFIELD. 05993 ; 05994 ; BUG (at $ACEE): The starbase also appears behind the stars, which are also 05995 ; part of the PLAYFIELD - a rarely noticed glitch. In Aft view, the arrangement 05996 ; is reversed: PLAYERs are arranged in front of the PLAYFIELD. Then the starbase 05997 ; (and the transfer vessel) appear in front of the cross hairs! Suggested fix: 05998 ; None, technically not possible. 05999 ; 06000 ; The starbase is tracked and the PLAYER0..2 shape types are set to STARBASE 06001 ; RIGHT, STARBASE LEFT, and STARBASE CENTER, respectively, combining them into a 06002 ; 3-part starbase shape. 06003 ; 06004 ; If this sector is still marked as a starbase sector but no more so on the 06005 ; Galactic Chart (if in the meantime either Zylon units have surrounded this 06006 ; sector and destroyed the starbase or you have destroyed the starbase with a 06007 ; photon torpedo) then the noise sound pattern SHIP EXPLOSION is played in 06008 ; subroutine NOISE ($AEA8) and code execution returns. 06009 ; 06010 ; Otherwise a minimum distance to the starbase of +32 (+$0020) <KM> is enforced 06011 ; and the conditions for a successful docking are checked: 06012 ; 06013 ; DOCKING CONDITIONS 06014 ; 06015 ; A docking is successful if all of the following conditions are met: 06016 ; 06017 ; (1) The PLAYER2 (STARBASE CENTER) column number is in 120..135. 06018 ; 06019 ; BUG (at $AD39): At first glance, the PLAYER column interval of 120..135 06020 ; corresponds to an almost symmetric interval of -8..+7 PM pixels relative 06021 ; to the horizontal center of the PLAYFIELD, at PLAYER column number 128 06022 ; (48 PM pixels offset to left PLAYFIELD border + 80 PM pixels to the 06023 ; PLAYFIELD center). This is correct only if the PLAYER column number were 06024 ; to designate the horizontal center of the PLAYER. However it designates 06025 ; its left edge! Thus the used pixel column number range 120..135 creates 06026 ; an asymmetric horizontal docking position: A docking is successful if the 06027 ; horizontal position of the starbase shape's center is roughly -5..+10 PM 06028 ; pixels relative to the horizontal center of the PLAYFIELD. Suggested fix: 06029 ; Replace SBC #120 with SBC #117. This leads to an interval of -8..+7 06030 ; pixels relative to the horizontal center of the PLAYFIELD and better 06031 ; symmetry in the horizontal docking position. 06032 ; 06033 ; (2) The PLAYER2 (STARBASE CENTER) row number is in 104..119. 06034 ; 06035 ; BUG (at $AD43): The PLAYER row interval of 104..119 corresponds to an 06036 ; asymmetric interval of -20..-5 PM pixels relative to the vertical center 06037 ; of the PLAYFIELD, at pixel row number 80 or PLAYER row number 124. It 06038 ; lets you dock at a starbase that "sits" on top of the horizontal cross 06039 ; hairs but not at one that "hangs" from them. Suggested fix: Replace SBC 06040 ; #104 with SBC #108. This leads to an interval of -8..+7 pixels relative 06041 ; to the vertical center of the PLAYFIELD (assuming a PLAYER2 shape of 16 06042 ; pixel height, which is typical during docking) and better symmetry in the 06043 ; vertical docking position. 06044 ; 06045 ; (3) The starbase is in correct distance in front of our starship: The 06046 ; starbase's z-coordinate must be < +512 (+$02**) <KM>. 06047 ; 06048 ; (4) Our starship is horizontally level with the starbase: The starbase's 06049 ; y-coordinate must be < +256 (+$01**) <KM>. 06050 ; 06051 ; (5) Our starship is at a complete halt. 06052 ; 06053 ; DOCKING SUCCESSFUL 06054 ; 06055 ; If the conditions for a successful docking are met, the subsequent docking and 06056 ; transfer operation can be divided in the following states, starting with state 06057 ; NOT DOCKED: 06058 ; 06059 ; (1) NOT DOCKED 06060 ; 06061 ; The docking state is set to ORBIT ESTABLISHED and the title line is 06062 ; updated with "ORBIT ESTABLISHED". 06063 ; 06064 ; (2) ORBIT ESTABLISHED 06065 ; 06066 ; After waiting until the title line "ORBIT ESTABLISHED" has disappeared, 06067 ; the transfer vessel is initialized and launched: The PLAYER4 shape type 06068 ; is set to TRANSFER VESSEL. Its position vector is set to a position above 06069 ; and in front of our starship, but behind the starbase: 06070 ; 06071 ; x-coordinate := +0..+255 (+$00**) <KM> 06072 ; y-coordinate := +256..+511 (+$01**) <KM> 06073 ; z-coordinate := +4096..+4351 (+$10**) <KM> 06074 ; 06075 ; Its velocity vector is set to 06076 ; 06077 ; x-velocity := +1 <KM/H> 06078 ; y-velocity := -1 <KM/H> 06079 ; z-velocity := -7 <KM/H> 06080 ; 06081 ; This will move the transfer vessel from behind the starbase into a 06082 ; direction toward and a little to the lower right of our starship. The 06083 ; lifetime of the transfer vessel (and its return journey) is set to 129 06084 ; game loop iterations. Finally, the docking state is set to RETURN 06085 ; TRANSFER VESSEL. 06086 ; 06087 ; (3) RETURN TRANSFER VESSEL 06088 ; 06089 ; After checking if the transfer vessel has passed behind our starship, the 06090 ; beeper sound pattern ACKNOWLEDGE is played in subroutine BEEP ($B3A6), 06091 ; the title line is updated with "TRANSFER COMPLETE", our starship's 06092 ; subsystems are repaired, and our starship's ENERGY readout is restored to 06093 ; 9999 energy units. by inverting the z-velocity the velocity vector of the 06094 ; transfer vessel is changed to 06095 ; 06096 ; x-velocity := +1 <KM/H> 06097 ; y-velocity := -1 <KM/H> 06098 ; z-velocity := +7 <KM/H> 06099 ; 06100 ; thus launching the transfer vessel on its return journey to the starbase. 06101 ; The docking state is set to TRANSFER COMPLETE. Finally, the screen is 06102 ; updated in subroutine UPDSCREEN ($B07B). 06103 ; 06104 ; (4) TRANSFER COMPLETE 06105 ; 06106 ; This docking state marks the end of a successful docking and transfer 06107 ; operation. 06108 ; 06109 ; DOCKING ABORTED 06110 ; 06111 ; If the docking conditions above are not met and the docking state is already 06112 ; ORBIT ESTABLISHED or RETURN TRANSFER VESSEL then the message "DOCKING ABORTED" 06113 ; is displayed and the docking state is set to NOT DOCKED. 06114 ACE6 A57B 06115 DOCKING LDA ISSTARBASESECT ; Return if not in starbase sector ACE8 F0FB 06116 BEQ SKIP111 ; 06117 ACEA A5D0 06118 LDA SHIPVIEW ; Skip if not in Front view ACEC D005 06119 BNE SKIP112 ; ACEE A914 06120 LDA #$14 ; GTIA: enable PLAYER4, prio: PFs > PLs > BGR (!) ACF0 8D1BD0 06121 STA PRIOR ; (Cross hairs appear behind PLAYERs) 06122 ACF3 A902 06123 SKIP112 LDA #2 ; Track starbase (PLAYER2) ACF5 8D5C09 06124 STA TRACKDIGIT ; 06125 06126 ;** Initialize starbase shape ************************************************** ACF8 A930 06127 LDA #SHAP.STARBASEC ; PLAYER2 is STARBASE CENTER (shape type 3) ACFA 8D8E0C 06128 STA PL2SHAPTYPE ; ACFD A920 06129 LDA #SHAP.STARBASEL ; PLAYER1 is STARBASE LEFT (shape type 2) ACFF 8D8D0C 06130 STA PL1SHAPTYPE ; AD02 A940 06131 LDA #SHAP.STARBASER ; PLAYER0 is STARBASE RIGHT (shape type 4) AD04 8D8C0C 06132 STA PL0SHAPTYPE ; 06133 AD07 A9FF 06134 LDA #255 ; Prep starbase lifetime := 255 game loops (infinite) 06135 AD09 A690 06136 LDX CURRSECTOR ; Skip if starbase in current sector AD0B BCC908 06137 LDY GCMEMMAP,X ; AD0E 3002 06138 BMI SKIP113 ; 06139 AD10 A900 06140 LDA #0 ; Prep starbase lifetime := 0 game loops (fast death) 06141 AD12 85E9 06142 SKIP113 STA PL0LIFE ; PLAYER0 lifetime := either 0 or 255 game loops AD14 85EA 06143 STA PL1LIFE ; PLAYER1 lifetime := either 0 or 255 game loops AD16 85EB 06144 STA PL2LIFE ; PLAYER2 lifetime := either 0 or 255 game loops AD18 857B 06145 STA ISSTARBASESECT ; Store starbase-in-sector flag AD1A 300A 06146 BMI SKIP114 ; Skip if starbase in current sector 06147 AD1C A002 06148 LDY #2 ; Init explosion at PLAYER2 (STARBASE CENTER) AD1E 206BAC 06149 JSR INITEXPL ; 06150 AD21 A20A 06151 LDX #$0A ; Play noise sound pattern SHIP EXPLOSION and return AD23 4CA8AE 06152 JMP NOISE ; 06153 06154 ;*** Keep minimum distance to starbase ***************************************** AD26 AD420A 06155 SKIP114 LDA PL2ZPOSHI ; Skip if starbase z-coordinate > +255 (+$00**) <KM> AD29 D00A 06156 BNE SKIP115 ; 06157 AD2B ADD50A 06158 LDA PL2ZPOSLO ; Approach starbase not closer than +32 (+$0020) <KM> AD2E C920 06159 CMP #32 ; AD30 B003 06160 BCS SKIP115 ; AD32 EED50A 06161 INC PL2ZPOSLO ; ...else push starbase back 06162 06163 ;*** Check if in docking range ************************************************* AD35 AD2C0C 06164 SKIP115 LDA PL2COLUMN ; Abort docking if PLAYER column number of... AD38 38 06165 SEC ; ...PLAYER2 (STARBASE CENTER) not in 120..135. AD39 E978 06166 SBC #120 ; (!) AD3B C910 06167 CMP #16 ; AD3D B022 06168 BCS SKIP116 ; 06169 AD3F ADFB0B 06170 LDA PL2ROWNEW ; Abort docking if PLAYER row number of... AD42 38 06171 SEC ; ...PLAYER2 (STARBASE CENTER) not in 104..119. AD43 E968 06172 SBC #104 ; (!) AD45 C910 06173 CMP #16 ; AD47 B018 06174 BCS SKIP116 ; 06175 AD49 AD420A 06176 LDA PL2ZPOSHI ; Abort docking if... AD4C C902 06177 CMP #2 ; ... z-coordinate of starbase >= +512 (+$02**) <KM> AD4E B011 06178 BCS SKIP116 ; 06179 AD50 ADAF09 06180 LDA PL2ZPOSSIGN ; Abort docking... AD53 2D110A 06181 AND PL2YPOSSIGN ; ...if starbase not in front and upper screen half AD56 4901 06182 EOR #$01 ; AD58 0570 06183 ORA VELOCITYLO ; ...if our starship's velocity not zero AD5A 0DA40A 06184 ORA PL2YPOSHI ; ...if starbase not roughly vertically centered AD5D 0571 06185 ORA NEWVELOCITY ; ...if our starship's new velocity not zero AD5F F010 06186 BEQ SKIP119 ; Else skip and handle docking 06187 06188 ;*** Docking aborted *********************************************************** AD61 A575 06189 SKIP116 LDA DOCKSTATE ; Skip if DOCKSTATE is NOT DOCKED, TRANSFER COMPLETE AD63 C902 06190 CMP #2 ; AD65 9005 06191 BCC SKIP117 ; 06192 AD67 A01F 06193 LDY #$1F ; Set title phrase "DOCKING ABORTED" AD69 2023B2 06194 JSR SETTITLE ; 06195 AD6C A900 06196 SKIP117 LDA #0 ; DOCKSTATE := NOT DOCKED AD6E 8575 06197 STA DOCKSTATE ; AD70 60 06198 SKIP118 RTS ; Return 06199 06200 ;*** Docking successful, check docking state *********************************** AD71 2475 06201 SKIP119 BIT DOCKSTATE ; Check DOCKSTATE AD73 700D 06202 BVS SKIP120 ; If DOCKSTATE = ORBIT ESTABLISHED hide title line AD75 3042 06203 BMI SKIP122 ; If DOCKSTATE = RETURN TRANSFER VESSEL return it AD77 A575 06204 LDA DOCKSTATE ; AD79 D0F5 06205 BNE SKIP118 ; Return if DOCKSTATE not NOT DOCKED AD7B C675 06206 DEC DOCKSTATE ; DOCKSTATE := ORBIT ESTABLISHED 06207 AD7D A01C 06208 LDY #$1C ; Set title phrase "ORBIT ESTABLISHED" and return AD7F 4C23B2 06209 JMP SETTITLE ; 06210 06211 ;*** Orbit established ********************************************************* AD82 A200 06212 SKIP120 LDX #0 ; Enqueue new, empty title phrase AD84 8665 06213 STX NEWTITLEPHR ; 06214 AD86 A4D1 06215 LDY TITLEPHR ; Return if "ORBIT ESTABLISHED" still displayed AD88 D0E6 06216 BNE SKIP118 ; 06217 06218 ;*** Launch transfer vessel **************************************************** AD8A A950 06219 LDA #SHAP.TRANSVSSL ; PLAYER4 is TRANSFER VESSEL (shape 5) AD8C 8D900C 06220 STA PL4SHAPTYPE ; 06221 AD8F A901 06222 LDA #1 ; Place transfer vessel behind starbase: AD91 8DB109 06223 STA PL4ZPOSSIGN ; x-coordinate := +0..+255 (+$00**) <KM> AD94 8DE209 06224 STA PL4XPOSSIGN ; y-coordinate := +256..+511 (+$01**) <KM> AD97 8D130A 06225 STA PL4YPOSSIGN ; z-coordinate := +4096..+4351 (+$10**) <KM> AD9A 8DA60A 06226 STA PL4YPOSHI ; AD9D 8D9B0B 06227 STA PL4XVEL ; Move transfer vessel toward our starship: ADA0 A910 06228 LDA #$10 ; x-velocity := +1 <KM/H> ADA2 8D440A 06229 STA PL4ZPOSHI ; y-velocity := -1 <KM/H> ADA5 A900 06230 LDA #$00 ; z-velocity := -7 <KM/H> ADA7 8D750A 06231 STA PL4XPOSHI ; ADAA A987 06232 LDA #NEG!7 ; ADAC 8D6A0B 06233 STA PL4ZVEL ; ADAF A981 06234 LDA #NEG!1 ; DOCKSTATE := RETURN TRANSFER VESSEL ADB1 8575 06235 STA DOCKSTATE ; ADB3 8DCC0B 06236 STA PL4YVEL ; ADB6 85ED 06237 STA PL4LIFE ; Transfer vessel lifetime := 129 game loops ADB8 60 06238 SKIP121 RTS ; Return 06239 06240 ;*** Return transfer vessel **************************************************** ADB9 ADB109 06241 SKIP122 LDA PL4ZPOSSIGN ; Return if transfer vessel in front of our starship ADBC D0FA 06242 BNE SKIP121 ; 06243 ADBE A20C 06244 LDX #$0C ; Play beeper sound pattern ACKNOWLEGDE ADC0 20A6B3 06245 JSR BEEP ; 06246 ADC3 A021 06247 LDY #$21 ; Set title phrase "TRANSFER COMPLETE" ADC5 2023B2 06248 JSR SETTITLE ; 06249 ADC8 A205 06250 LDX #5 ; Repair all 6 subsystems ADCA BD8BBB 06251 LOOP041 LDA PANELTXTTAB+73,X ; ADCD 9D9209 06252 STA GCSTATPHO,X ; ADD0 CA 06253 DEX ; ADD1 10F7 06254 BPL LOOP041 ; 06255 ADD3 A989 06256 LDA #CCS.COL2!CCS.9 ; Set starship's ENERGY readout to "9999" in COLOR2 ADD5 A203 06257 LDX #3 ; ADD7 9D5509 06258 LOOP042 STA ENERGYD1,X ; ADDA CA 06259 DEX ; ADDB 10FA 06260 BPL LOOP042 ; 06261 ADDD A907 06262 LDA #7 ; Move transfer vessel back toward starbase: ADDF 8D6A0B 06263 STA PL4ZVEL ; x-velocity := -1 <KM/H> ADE2 A981 06264 LDA #NEG!1 ; y-velocity := +1 <KM/H> ADE4 8D9B0B 06265 STA PL4XVEL ; z-velocity := +7 <KM/H> ADE7 A901 06266 LDA #1 ; ADE9 8DCC0B 06267 STA PL4YVEL ; 06268 ADEC 8575 06269 STA DOCKSTATE ; DOCKSTATE := TRANSFER COMPLETE ADEE 4C7BB0 06270 JMP UPDSCREEN ; Update screen and return 06271 06272 ;******************************************************************************* 06273 ;* * 06274 ;* MODDLST * 06275 ;* * 06276 ;* Modify Display List * 06277 ;* * 06278 ;******************************************************************************* 06279 06280 ; DESCRIPTION 06281 ; 06282 ; Modifies the Display List to show and hide title, headers, and the Control 06283 ; Panel Display. 06284 ; 06285 ; INPUT 06286 ; 06287 ; A = Number of bytes to copy into the Display List 06288 ; X = Offset into Display List DSPLST ($0280) 06289 ; Y = Offset into Display List fragment table DLSTFRAG ($BA62). If Y = $80 06290 ; then no bytes are copied but the specified locations of the Display List 06291 ; are overwritten with Display List instruction $0D (one row of 06292 ; GRAPHICS7). 06293 ; 06294 ; Used values are: 06295 ; 06296 ; A X Y 06297 ; $08 $5F $00 -> Show Control Panel Display (bottom text window) 06298 ; $08 $5F $80 -> Hide Control Panel Display (bottom text window) 06299 ; $07 $0F $23 -> Show title line 06300 ; $07 $0F $80 -> Hide title line 06301 ; $08 $02 $1B -> Show Display List header line of Front view 06302 ; $08 $02 $13 -> Show Display List header line of Aft view 06303 ; $08 $02 $0B -> Show Display List header line of Long-Range Scan view 06304 ; $08 $02 $08 -> Show Display List header line of Galactic Chart view 06305 =006A 06306 L.NUMBYTES = $6A ; Number of bytes to copy 06307 ADF1 78 06308 MODDLST SEI ; Disable IRQ ADF2 856A 06309 STA L.NUMBYTES ; Save number of bytes to copy 06310 ADF4 AD0BD4 06311 LOOP043 LDA VCOUNT ; Wait for ANTIC line counter >= 124 (PLAYFIELD... ADF7 C97C 06312 CMP #124 ; ...bottom) before changing the Display List ADF9 90F9 06313 BCC LOOP043 ; 06314 ADFB B962BA 06315 LOOP044 LDA DLSTFRAG,Y ; Load byte from Display List fragment table ADFE C8 06316 INY ; ADFF 1002 06317 BPL SKIP123 ; Skip if fragment table index < $80 AE01 A90D 06318 LDA #$0D ; Prep Display List instruction $0D (GRAPHICS7) AE03 9D8002 06319 SKIP123 STA DSPLST,X ; Store byte in Display List AE06 E8 06320 INX ; AE07 C66A 06321 DEC L.NUMBYTES ; AE09 D0F0 06322 BNE LOOP044 ; Copy next byte 06323 AE0B 58 06324 CLI ; Enable IRQ AE0C 60 06325 RTS ; Return 06326 06327 ;******************************************************************************* 06328 ;* * 06329 ;* CLRPLAYFIELD * 06330 ;* * 06331 ;* Clear PLAYFIELD memory * 06332 ;* * 06333 ;******************************************************************************* 06334 06335 ; DESCRIPTION 06336 ; 06337 ; Clears PLAYFIELD memory from $1000 to $1FFF. 06338 ; 06339 ; This subroutine sets the start address of the memory to be cleared then code 06340 ; execution continues into subroutine CLRMEM ($AE0F) where the memory is 06341 ; actually cleared. 06342 AE0D A910 06343 CLRPLAYFIELD LDA #$10 06344 06345 ;******************************************************************************* 06346 ;* * 06347 ;* CLRMEM * 06348 ;* * 06349 ;* Clear memory * 06350 ;* * 06351 ;******************************************************************************* 06352 06353 ; DESCRIPTION 06354 ; 06355 ; Clears memory from a given start address to memory address $1FFF. This 06356 ; subroutine is called in the following situations: 06357 ; 06358 ; (1) In routine INITCOLD ($A14A) at the beginning of the program to initialize 06359 ; the program's variables 06360 ; 06361 ; (2) In subroutine CLRPLAYFIELD ($AE0D) to clear PLAYFIELD memory. 06362 ; 06363 ; As a side effect this subroutine also clears the saved number of space objects 06364 ; and the lock-on flag. 06365 ; 06366 ; INPUT 06367 ; 06368 ; A = Start address (high byte) of memory to be cleared. Used values are: 06369 ; $02 -> Clear memory $0200..$1FFF during program initialization 06370 ; $10 -> Clear PLAYFIELD memory $1000..$1FFF 06371 AE0F 8569 06372 CLRMEM STA MEMPTR+1 ; Store start address (high byte) to be cleared AE11 A900 06373 LDA #0 ; Store start address (low byte) to be cleared AE13 A8 06374 TAY ; AE14 8568 06375 STA MEMPTR ; 06376 AE16 85A3 06377 STA ISINLOCKON ; Clear lock-on flag AE18 857A 06378 STA SAVMAXSPCOBJIND ; Clear saved number of space objects 06379 AE1A 9168 06380 LOOP045 STA (MEMPTR),Y ; Clear memory location AE1C C8 06381 INY ; AE1D D0FB 06382 BNE LOOP045 ; 06383 AE1F E669 06384 INC MEMPTR+1 ; Next page (= 256-byte block) AE21 A469 06385 LDY MEMPTR+1 ; AE23 C020 06386 CPY #$20 ; AE25 A8 06387 TAY ; AE26 90F2 06388 BCC LOOP045 ; Loop until memory address $2000 reached AE28 60 06389 RTS ; Return 06390 06391 ;******************************************************************************* 06392 ;* * 06393 ;* TRIGGER * 06394 ;* * 06395 ;* Handle joystick trigger * 06396 ;* * 06397 ;******************************************************************************* 06398 06399 ; DESCRIPTION 06400 ; 06401 ; This subroutine handles the joystick trigger and launches one of our 06402 ; starship's photon torpedo. If a target is in full lock-on then a second photon 06403 ; torpedo is prepared for automatic launch in the next game loop iteration. 06404 ; 06405 ; DETAILS 06406 ; 06407 ; If the trigger is pressed then reset the idle counter and, if not in 06408 ; hyperwarp, launch a photon torpedo with the following steps: 06409 ; 06410 ; (1) If the trigger was pressed in this game loop iteration, a photon torpedo 06411 ; will be launched if a previously launched photon torpedo is already under 06412 ; way for at least 255 - 232 = 23 game loop iterations. This avoids firing 06413 ; photon torpedoes too rapidly. 06414 ; 06415 ; (2) Start tracking a space object. If it is in full lock-on, set up the 06416 ; lock-on timer, activate photon torpedo tracking, and tweak the last saved 06417 ; trigger state such that our other photon torpedo (if available) is 06418 ; launched automatically in the next game loop iteration. 06419 ; 06420 ; (3) If the Photon Torpedoes are destroyed, do nothing. 06421 ; 06422 ; (4) If the Photon Torpedoes are damaged, launch a photon torpedo from the 06423 ; same barrel than the previous one. 06424 ; 06425 ; (5) If the Photon Torpedoes are not damaged, launch a photon torpedo from the 06426 ; other barrel. 06427 ; 06428 ; (6) Set the lifetime of our starship's photon torpedo to infinite, set the 06429 ; PLAYER shape to PHOTON TORPEDO. 06430 ; 06431 ; (7) Initialize the position vector of our starship's photon torpedo to: 06432 ; 06433 ; x-coordinate := +256 (+$0100) <KM> (Right barrel) 06434 ; -256 (-$FF00) <KM> (Left barrel) 06435 ; y-coordinate := -256 (-$FF00) <KM> 06436 ; z-coordinate := +1 (+$0001) <KM> 06437 ; 06438 ; (8) Initialize the velocity vector of our starship's photon torpedo to: 06439 ; 06440 ; x-velocity := +0 <KM/H> 06441 ; y-velocity := +0 <KM/H> 06442 ; z-velocity := +102 <KM/H> (All views but Aft view) 06443 ; -102 <KM/H> (Aft view) 06444 ; 06445 ; (9) Subtract 10 energy units for launching our starship's photon torpedo. 06446 ; 06447 ; (10) Play the noise sound pattern PHOTON TORPEDO LAUNCHED by continuing code 06448 ; execution into subroutine NOISE ($AEA8). 06449 AE29 A584 06450 TRIGGER LDA OLDTRIG0 ; Prep last trigger state 06451 AE2B AC10D0 06452 LDY TRIG0 ; Copy current trigger state AE2E 8484 06453 STY OLDTRIG0 ; AE30 D00E 06454 BNE SKIP124 ; Return if trigger currently not pressed 06455 AE32 8466 06456 STY IDLECNTHI ; Reset idle counter 06457 AE34 A6C0 06458 LDX WARPSTATE ; Return if hyperwarp engaged AE36 D008 06459 BNE SKIP124 ; 06460 AE38 A687 06461 LDX BARRELNR ; Prep barrel number (0 -> left, 1 -> right) 06462 AE3A C901 06463 CMP #1 ; If trigger is newly pressed -> handle tracking... AE3C F003 06464 BEQ SKIP125 ; ...and launch our starship's photon torpedo... AE3E B018 06465 BCS SKIP127 ; ...else launch our starship's photon torpedo only AE40 60 06466 SKIP124 RTS ; Return 06467 06468 ;*** Set up our starship's photon torpedo tracking ***************************** AE41 B5EC 06469 SKIP125 LDA PL3LIFE,X ; Return if torpedo's lifetime >= 232 game loops AE43 C9E8 06470 CMP #232 ; AE45 B0F9 06471 BCS SKIP124 ; 06472 AE47 AC5C09 06473 LDY TRACKDIGIT ; Store index of tracked space object AE4A 8489 06474 STY PLTRACKED ; 06475 AE4C A90C 06476 LDA #12 ; Prep lock-on lifetime := 12 game loops AE4E A4A3 06477 LDY ISINLOCKON ; If target is in full lock-on... AE50 8486 06478 STY ISTRACKING ; ...activate photon torpedo tracking 06479 AE52 F002 06480 BEQ SKIP126 ; Skip if target not in full lock-on AE54 A900 06481 LDA #0 ; Prep lock-on lifetime := 0 game loops AE56 8588 06482 SKIP126 STA LOCKONLIFE ; Store lock-on lifetime (either 0 or 12 game loops) 06483 06484 ;*** Launch our starship's photon torpedo ************************************** AE58 8484 06485 SKIP127 STY OLDTRIG0 ; Update last trigger state AE5A 2C9209 06486 BIT GCSTATPHO ; Return if Photon Torpedoes are destroyed AE5D 70E1 06487 BVS SKIP124 ; 06488 AE5F 3005 06489 BMI SKIP128 ; If Photon Torpedoes damaged launch from same barrel AE61 8A 06490 TXA ; ...else switch barrel from which to launch torpedo AE62 4901 06491 EOR #$01 ; AE64 8587 06492 STA BARRELNR ; 06493 AE66 8A 06494 SKIP128 TXA ; SUMMARY: Our starship's photon torpedo's... AE67 9DE109 06495 STA PL3XPOSSIGN,X ; x-coordinate := +256 (+$0100) <KM> (right barrel) AE6A BD73BF 06496 LDA BARRELXTAB,X ; x-coordinate := -256 (-$FF00) <KM> (left barrel) AE6D 9D740A 06497 STA PL3XPOSHI,X ; y-coordinate := -256 (-$FF00) <KM> AE70 A9FF 06498 LDA #255 ; z-coordinate := +1 (+$0001) <KM> AE72 95EC 06499 STA PL3LIFE,X ; ...lifetime := 255 game loops AE74 9DA50A 06500 STA PL3YPOSHI,X ; AE77 A900 06501 LDA #0 ; AE79 9D8F0C 06502 STA PL3SHAPTYPE,X ; PLAYER3 or PLAYER4 is PHOTON TORPEDO (shape type 0) AE7C 9D430A 06503 STA PL3ZPOSHI,X ; AE7F 9D070B 06504 STA PL3XPOSLO,X ; AE82 9D120A 06505 STA PL3YPOSSIGN,X ; AE85 9D380B 06506 STA PL3YPOSLO,X ; AE88 A901 06507 LDA #1 ; AE8A 9DB009 06508 STA PL3ZPOSSIGN,X ; AE8D 9DD60A 06509 STA PL3ZPOSLO,X ; 06510 AE90 A5D0 06511 LDA SHIPVIEW ; SUMMARY: Our starship's photon torpedo's... AE92 4A 06512 LSR A ; x-velocity := +0 <KM/H> AE93 6A 06513 ROR A ; y-velocity := +0 <KM/H> AE94 0966 06514 ORA #102 ; z-velocity := +102 <KM/H> (Other views) AE96 9D690B 06515 STA PL3ZVEL,X ; z-velocity := -102 <KM/H> (Aft view) AE99 A900 06516 LDA #0 ; AE9B 9D9A0B 06517 STA PL3XVEL,X ; AE9E 9DCB0B 06518 STA PL3YVEL,X ; 06519 AEA1 A202 06520 LDX #2 ; ENERGY := ENERGY - 10 for launching photon torpedo AEA3 206FB8 06521 JSR DECENERGY ; 06522 AEA6 A200 06523 LDX #$00 ; Play noise sound pattern PHOTON TORPEDO LAUNCHED 06524 06525 ;******************************************************************************* 06526 ;* * 06527 ;* NOISE * 06528 ;* * 06529 ;* Copy noise sound pattern * 06530 ;* * 06531 ;******************************************************************************* 06532 06533 ; DESCRIPTION 06534 ; 06535 ; Copies a 10-byte noise sound pattern from table NOISEPATTAB ($BF20). The first 06536 ; 8 bytes are copied to the noise sound pattern area NOISETORPTIM 06537 ; ($DA)..NOISELIFE ($E1), the remaining 2 bytes are copied to audio registers 06538 ; AUDCTL ($D208) and AUDF3 ($D204). The noise sound pattern is automatically 06539 ; played in subroutine SOUND ($B2AB). 06540 ; 06541 ; NOTE: the first 8 bytes of each pattern in table NOISEPATTAB ($BF20) are 06542 ; copied in reverse order from memory. See subroutine SOUND ($B2AB) for details 06543 ; on the noise sound patterns stored in NOISEPATTAB ($BF20). 06544 ; 06545 ; Playing a SHIP EXPLOSION or ZYLON EXPLOSION noise sound pattern overrides a 06546 ; currently playing PHOTON TORPEDO LAUNCHED noise sound pattern. 06547 ; 06548 ; Playing a PHOTON TORPEDO LAUNCHED noise sound pattern overrides a currently 06549 ; playing PHOTON TORPEDO LAUNCHED noise sound pattern if the latter has < 24 06550 ; TICKs to play. 06551 ; 06552 ; INPUT 06553 ; 06554 ; X = Offset into table NOISEPATTAB ($BF20) to index noise sound patterns. 06555 ; Used values are: 06556 ; $00 -> PHOTON TORPEDO LAUNCHED 06557 ; $0A -> SHIP EXPLOSION (either our starship or a starbase explodes) 06558 ; $14 -> ZYLON EXPLOSION 06559 AEA8 8A 06560 NOISE TXA ; Skip if SHIP EXPLOSION or ZYLON EXPLOSION playing AEA9 D006 06561 BNE SKIP129 ; 06562 AEAB A5E1 06563 LDA NOISELIFE ; Return if PHOTON TORPEDO LAUNCHED noise sound pat. AEAD C918 06564 CMP #24 ; ...playing for yet more than 24 TICKs AEAF B018 06565 BCS SKIP130 ; 06566 AEB1 A007 06567 SKIP129 LDY #7 ; Copy noise sound pattern (in reverse order) AEB3 BD20BF 06568 LOOP046 LDA NOISEPATTAB,X ; AEB6 99DA00 06569 STA NOISETORPTIM,Y ; AEB9 E8 06570 INX ; AEBA 88 06571 DEY ; AEBB 10F6 06572 BPL LOOP046 ; 06573 AEBD BD20BF 06574 LDA NOISEPATTAB,X ; Copy AUDCTL from noise sound pattern table AEC0 8D08D2 06575 STA AUDCTL ; AEC3 BD21BF 06576 LDA NOISEPATTAB+1,X ; Copy AUDF3 from noise sound pattern table AEC6 8D04D2 06577 STA AUDF3 ; 06578 AEC9 60 06579 SKIP130 RTS ; Return 06580 06581 ;******************************************************************************* 06582 ;* * 06583 ;* HOMINGVEL * 06584 ;* * 06585 ;* Calculate homing velocity of our starship's photon torpedo 0 or 1 * 06586 ;* * 06587 ;******************************************************************************* 06588 06589 ; DESCRIPTION 06590 ; 06591 ; Calculates the x (or y) velocity vector component of our starship's photon 06592 ; torpedo 0 or 1 when it is tracking (homing in on) a target space object. 06593 ; 06594 ; Our starship's photon torpedo's x (or y) velocity vector component depends on 06595 ; the PLAYER column (or row) number difference between the target PLAYER and our 06596 ; starship's photon torpedo PLAYER in Player/Missile (PM) pixels. This 06597 ; difference is used as an index to pick the new x (or y) velocity vector 06598 ; component of out starship's photon torpedo from table HOMVELTAB ($BFC9): 06599 ; 06600 ; +---------------+--------------+ 06601 ; | Difference in | New Velocity | 06602 ; | PM Pixels | Component | 06603 ; +---------------+--------------+ 06604 ; | >= +7 | -64 <KM/H> | 06605 ; | +6 | -56 <KM/H> | 06606 ; | +5 | -48 <KM/H> | 06607 ; | +4 | -40 <KM/H> | 06608 ; | +3 | -24 <KM/H> | 06609 ; | +2 | -16 <KM/H> | 06610 ; | +1 | -8 <KM/H> | 06611 ; | 0 | 0 <KM/H> | 06612 ; | -1 | +8 <KM/H> | 06613 ; | -2 | +16 <KM/H> | 06614 ; | -3 | +24 <KM/H> | 06615 ; | -4 | +40 <KM/H> | 06616 ; | -5 | +48 <KM/H> | 06617 ; | -6 | +56 <KM/H> | 06618 ; | <= -7 | +64 <KM/H> | 06619 ; +---------------+--------------+ 06620 ; 06621 ; INPUT 06622 ; 06623 ; A = PLAYER column (or row) number difference between the target PLAYER 06624 ; and our starship's photon torpedo PLAYER in Player/Missile pixels 06625 ; CARRY = Sign of the PLAYER column (or row) number difference. Used values 06626 ; are: 06627 ; 0 -> Negative difference (target PLAYER column (or row) number < our 06628 ; starship's photon torpedo PLAYER column (or row) number 06629 ; 1 -> Positive difference (target PLAYER column (or row) number >= our 06630 ; starship's photon torpedo PLAYER column (or row) number 06631 ; 06632 ; OUTPUT 06633 ; 06634 ; A = New velocity vector component of our starship's photon torpedo in <KM/H> 06635 =006A 06636 L.VELSIGN = $6A ; Saves velocity sign 06637 AECA A080 06638 HOMINGVEL LDY #NEG ; Preload negative velocity sign AECC B004 06639 BCS SKIP131 ; Skip if difference is positive 06640 AECE 49FF 06641 EOR #$FF ; Invert to get absolute value of difference AED0 A000 06642 LDY #0 ; Preload positive velocity sign 06643 AED2 846A 06644 SKIP131 STY L.VELSIGN ; Save velocity sign AED4 C908 06645 CMP #8 ; AED6 9002 06646 BCC SKIP132 ; AED8 A907 06647 LDA #7 ; Limit difference to 0..7 AEDA A8 06648 SKIP132 TAY ; AEDB A56A 06649 LDA L.VELSIGN ; Reload velocity sign AEDD 19C9BF 06650 ORA HOMVELTAB,Y ; Combine with homing velocity from table AEE0 60 06651 RTS ; Return 06652 06653 ;******************************************************************************* 06654 ;* * 06655 ;* DAMAGE * 06656 ;* * 06657 ;* Damage or destroy one of our starship's subsystems * 06658 ;* * 06659 ;******************************************************************************* 06660 06661 ; DESCRIPTION 06662 ; 06663 ; Damages or destroys one of our starship's subsystems. There are 6 subsystems: 06664 ; 06665 ; (1) Photon Torpedoes 06666 ; (2) Engines 06667 ; (3) Shields 06668 ; (4) Attack Computer 06669 ; (5) Long-Range Scan 06670 ; (6) Subspace Radio 06671 ; 06672 ; Their status is stored and displayed in the Galactic Chart Panel Display by 06673 ; the colored letters PESCLR. The color of each letter represents the 06674 ; subsystem's status: 06675 ; 06676 ; +---------------+------------------+ 06677 ; | Letter Color | Subsystem Status | 06678 ; +---------------+------------------+ 06679 ; | {LIGHT GREEN} | OK | 06680 ; | {CORN YELLOW} | Damaged | 06681 ; | {PINK} | Destroyed | 06682 ; +---------------+------------------+ 06683 ; 06684 ; This subroutine first makes sure that we are not in demo mode. Then it picks a 06685 ; random value in 0..255 and the damage probability value. The latter value 06686 ; depends on the mission level and is picked from table DAMAGEPROBTAB ($BF10): 06687 ; 06688 ; +-----------+-------------------+---------------+ 06689 ; | Mission | Damage | Damage | 06690 ; | Level | Probability Value | Probability | 06691 ; +-----------+-------------------+---------------+ 06692 ; | NOVICE | 0 | 0% ( 0:256) | 06693 ; | PILOT | 80 | 31% ( 80:256) | 06694 ; | WARRIOR | 180 | 70% (180:256) | 06695 ; | COMMANDER | 254 | 99% (254:256) | 06696 ; +-----------+-------------------+---------------+ 06697 ; 06698 ; If the random number is lower than the damage probability value, a randomly 06699 ; picked subsystem is about to get damaged (or destroyed). There is a built-in 06700 ; upfront probability of 25% (2:8) that no subsystem gets harmed. 06701 ; 06702 ; If the picked subsystem is already destroyed then another subsystem is picked. 06703 ; 06704 ; Then the title phrase offset is picked from table DAMAGEPHRTAB ($BF14) to 06705 ; display the damaged subsystem in the title line. Next, color bits are picked 06706 ; that indicate a damaged system. 06707 ; 06708 ; If the Zylon photon torpedo's lifetime >= 30 game loop iterations the 06709 ; subsystem will not only be damaged but destroyed. 06710 ; 06711 ; NOTE: The Zylon photon torpedo lifetime decreases from 62 to 0 game loop 06712 ; iterations. With a remaining lifetime >= 30 game loop iterations it is 06713 ; considered strong enough to destroy one of our starship's subsystems. There 06714 ; are two exceptions to this rule: If the Attack Computer was picked to be 06715 ; destroyed it will be damaged only - not destroyed - if the Long-Range Scan has 06716 ; been already destroyed, and vice versa. 06717 ; 06718 ; Then the title phrase offset from table DESTROYPHRTAB ($BF1A) is picked to 06719 ; display the destroyed subsystem in the title line. Next, color bits are picked 06720 ; that indicate a destroyed system. 06721 ; 06722 ; The color of the subsystem's status letter is adjusted in the Galactic Chart 06723 ; Panel Display. Next, the title phrase describing the subsystem's status is 06724 ; enqueued for display in the title line. If the Attack Computer has been 06725 ; destroyed it is switched off and the PLAYFIELD is cleared. The title line is 06726 ; updated with the "DAMAGE CONTROL" message. Finally, the beeper sound pattern 06727 ; DAMAGE REPORT is played in subroutine BEEP ($B3A6). 06728 AEE1 2464 06729 DAMAGE BIT ISDEMOMODE ; Return if in demo mode AEE3 3057 06730 BMI SKIP137 ; 06731 06732 ;*** Damage some subsystem ***************************************************** AEE5 A662 06733 LDX MISSIONLEVEL ; Prep mission level AEE7 AD0AD2 06734 LOOP047 LDA RANDOM ; Return if random number >= damage probability AEEA DD10BF 06735 CMP DAMAGEPROBTAB,X ; ...(the latter depends on mission level) AEED B04D 06736 BCS SKIP137 ; 06737 AEEF 2907 06738 AND #$07 ; Randomly pick 1 of 6 subsystems AEF1 C906 06739 CMP #6 ; Return if no subsystem picked AEF3 B047 06740 BCS SKIP137 ; 06741 AEF5 AA 06742 TAX ; AEF6 BD9209 06743 LDA GCSTATPHO,X ; Get picked subsystem status letter AEF9 0A 06744 ASL A ; Check bit B6 (= destroyed) of letter code AEFA 30EB 06745 BMI LOOP047 ; Try again if subsystem already destroyed 06746 AEFC A5EB 06747 LDA PL2LIFE ; Load Zylon photon torpedo lifetime... AEFE C91E 06748 CMP #30 ; ...and compare it to 30 game loops 06749 AF00 A980 06750 LDA #CCS.COL2 ; Preload COLOR2 text color bits (= damaged status) AF02 BC14BF 06751 LDY DAMAGEPHRTAB,X ; Preload title phrase offset of damaged subsystem 06752 AF05 9017 06753 BCC SKIP135 ; Skip if Zylon torpedo lifetime < 30 game loops 06754 AF07 E003 06755 CPX #3 ; Skip if selected subsystem not Attack Computer AF09 D005 06756 BNE SKIP133 ; AF0B 2C9609 06757 BIT GCSTATLRS ; Skip if Long-Range Scan already destroyed AF0E 700E 06758 BVS SKIP135 ; AF10 E004 06759 SKIP133 CPX #4 ; Skip if selected subsystem is not Long-Range Scan AF12 D005 06760 BNE SKIP134 ; AF14 2C9509 06761 BIT GCSTATCOM ; Skip if Attack Computer already destroyed AF17 7005 06762 BVS SKIP135 ; 06763 AF19 A9C0 06764 SKIP134 LDA #CCS.COL3 ; Preload COLOR3 text color bits (= destroyed status) AF1B BC1ABF 06765 LDY DESTROYPHRTAB,X ; Preload title phrase offset of destroyed subsystem 06766 AF1E 1D9209 06767 SKIP135 ORA GCSTATPHO,X ; Combine status letter with new color AF21 9D9209 06768 STA GCSTATPHO,X ; AF24 8465 06769 STY NEWTITLEPHR ; Enqueue damage status title phrase AF26 2C9509 06770 BIT GCSTATCOM ; Skip if Attack Computer OK or damaged AF29 5007 06771 BVC SKIP136 ; 06772 AF2B A900 06773 LDA #0 ; Switch Attack Computer off AF2D 857E 06774 STA ISATTCOMPON ; AF2F 200DAE 06775 JSR CLRPLAYFIELD ; Clear PLAYFIELD 06776 AF32 A052 06777 SKIP136 LDY #$52 ; Set title phrase "DAMAGE CONTROL..." AF34 2023B2 06778 JSR SETTITLE ; 06779 AF37 A212 06780 LDX #$12 ; Play beeper sound pattern DAMAGE REPORT AF39 20A6B3 06781 JSR BEEP ; 06782 AF3C 60 06783 SKIP137 RTS ; Return 06784 06785 ;******************************************************************************* 06786 ;* * 06787 ;* COLLISION * 06788 ;* * 06789 ;* Detect a collision of our starship's photon torpedoes * 06790 ;* * 06791 ;******************************************************************************* 06792 06793 ; DESCRIPTION 06794 ; 06795 ; Both of our starship's photon torpedoes are checked if they have collided with 06796 ; a space object represented by PLAYER0..2, such as a Zylon ship, a Zylon photon 06797 ; torpedo, a starbase, or a meteor. 06798 ; 06799 ; For quick lookup, the following table lists the PLAYERs and what space objects 06800 ; they represent: 06801 ; 06802 ; +--------+--------------------------------------------------+ 06803 ; | PLAYER | Represents | 06804 ; +--------+--------------------------------------------------+ 06805 ; | 0 | Zylon ship 0, Starbase Left | 06806 ; | 1 | Zylon ship 1, Starbase Right | 06807 ; | 2 | Zylon photon torpedo, Starbase Center, Meteor | 06808 ; | 3 | Our starship's photon torpedo 0 | 06809 ; | 4 | Our starship's photon torpedo 1, Transfer Vessel | 06810 ; +--------+--------------------------------------------------+ 06811 ; 06812 ; NOTE: Only space objects represented by PLAYER0..2 are checked for collisions. 06813 ; The transfer vessel of the starbase, represented by PLAYER4, is not checked 06814 ; and therefore cannot be destroyed by one of our starship's photon torpedoes. 06815 ; 06816 ; This subroutine first checks if our starship's photon torpedoes are 06817 ; represented by alive PLAYERs with PHOTON TORPEDO shape. 06818 ; 06819 ; In order to detect a collision with a space object, our starship's photon 06820 ; torpedo must compare its x, y, and z coordinates with the ones of the space 06821 ; object. 06822 ; 06823 ; Instead of comparing the x and y coordinates, however, this subroutines uses a 06824 ; much more efficent method by inspecting the Player/Missile collision 06825 ; registers, as the x and y axis of the 3D coordinate system establish the plane 06826 ; in which the TV screen lies. Each of our starship's photon torpedoes has its 06827 ; own Player/Missile collision register: PL3HIT ($82) for our starship's photon 06828 ; torpedo 0 and PL4HIT ($83) for our starship's photon torpedo 1. By inspecting 06829 ; these registers the hit space object is determined: 06830 ; 06831 ; +---------------------------------------------------+-------------------------+ 06832 ; | Bits B2..0 of Collision Register | Hit PLAYER | 06833 ; | (0 -> Not Hit, 1 -> Hit) | | 06834 ; +-----------------+----------------+----------------+ | 06835 ; | PLAYER2 | PLAYER1 | PLAYER0 | | 06836 ; | (Zylon torpedo) | (Zylon ship 1) | (Zylon ship 0) | | 06837 ; +-----------------+----------------+----------------+-------------------------+ 06838 ; | 0 | 0 | 0 | None | 06839 ; | 0 | 0 | 1 | PLAYER0 (Zylon ship 0) | 06840 ; | 0 | 1 | 0 | PLAYER1 (Zylon ship 1) | 06841 ; | 0 | 1 | 1 | PLAYER1 (Zylon ship 1) | 06842 ; | 1 | 0 | 0 | PLAYER2 (Zylon torpedo) | 06843 ; | 1 | 0 | 1 | PLAYER2 (Zylon torpedo) | 06844 ; | 1 | 1 | 0 | PLAYER1 (Zylon ship 1) | 06845 ; | 1 | 1 | 1 | PLAYER1 (Zylon ship 1) | 06846 ; +-----------------+----------------+----------------+-------------------------+ 06847 ; 06848 ; If the lifetime of the hit space object has already expired, then the hit is 06849 ; ignored. 06850 ; 06851 ; A collision along the z-axis happens if the z-coordinate of our starship's 06852 ; photon torpedo is close enough to the z-coordinate of the space object: 06853 ; 06854 ; The absolute value of the z-coordinate of the space object is converted into a 06855 ; range index in 0..7. This index picks a minimum and a maximum z-coordinate 06856 ; from tables HITMINZTAB ($BF7D) and HITMAXZTAB ($BF75). If the absolute value 06857 ; of the z-coordinate of our starship's photon torpedo is inside this interval, 06858 ; then our starship's photon torpedo has hit the space object. The following 06859 ; table lists the relevant values: 06860 ; 06861 ; +-----------------------+-------+--------------------------+--------------------------+ 06862 ; | ABS(z-Coordinate) | Range | Min ABS(z-Coordinate) | Max ABS(z-Coordinate) | 06863 ; | of Space Object | Index | of Photon Torpedo to Hit | of Photon Torpedo to Hit | 06864 ; +-----------------------+-------+--------------------------+--------------------------+ 06865 ; | <= 511 ($01**) <KM> | 0 | 0 ($00**) <KM> | < 3328 ($0C**) <KM> | 06866 ; | <= 1023 ($03**) <KM> | 1 | 0 ($00**) <KM> | < 3328 ($0C**) <KM> | 06867 ; | <= 1535 ($05**) <KM> | 2 | 0 ($00**) <KM> | < 3328 ($0C**) <KM> | 06868 ; | <= 2047 ($07**) <KM> | 3 | 512 ($02**) <KM> | < 3328 ($0C**) <KM> | 06869 ; | <= 2559 ($09**) <KM> | 4 | 1024 ($04**) <KM> | < 3840 ($0E**) <KM> | 06870 ; | <= 3071 ($0B**) <KM> | 5 | 1536 ($06**) <KM> | < 3840 ($0E**) <KM> | 06871 ; | <= 3583 ($0D**) <KM> | 6 | 2048 ($08**) <KM> | < 3840 ($0E**) <KM> | 06872 ; | <= 65535 ($FF**) <KM> | 7 | 3072 ($0C**) <KM> | < 8448 ($20**) <KM> | 06873 ; +-----------------------+-------+--------------------------+--------------------------+ 06874 ; 06875 ; if a collision has been detected, the "age" (= initial lifetime - remaining 06876 ; lifetime) of our starship's photon torpedo is calculated. This age is used to 06877 ; delay playing the ZYLON EXPLOSION noise sound pattern but also to determine 06878 ; the strength of our starship's photon torpedo. Only photon torpedoes of an age 06879 ; < 15 game loop iterations can destroy a Zylon basestar. 06880 ; 06881 ; Some clean-up work is done before the actual explosion: The lock-on timer, our 06882 ; starship's photon torpedo lifetime, and the hit space object's PLAYER lifetime 06883 ; is set to 0. 06884 ; 06885 ; If a meteor or a Zylon photon torpedo have been hit, then the score is not 06886 ; changed, skipping right to the explosion part. Otherwise, our starship's 06887 ; photon torpedo tracking flag is cleared and the Galactic Chart Map is updated. 06888 ; If a starbase was destroyed, then 3 points are added to the score. If a Zylon 06889 ; ship was destroyed, then 6 points are added to the score and the Zylon KILL 06890 ; COUNTER readout of the Control Panel Display is incremented. Next, the 06891 ; explosion is initialized in subroutine INITEXPL ($AC6B). 06892 ; 06893 ; NOTE: This subroutine lacks proper explosion initialization if the starbase 06894 ; was hit. The actual explosion initialization is done in subroutine DOCKING 06895 ; ($ACE6) when the code finds out that the starbase sector is no more marked as 06896 ; such in the Galactic Chart. 06897 ; 06898 ; Finally, the Galactic Chart Map is searched for a remaining Zylon unit. If 06899 ; none is found then the mission is complete and code excecution continues into 06900 ; subroutine GAMEOVER2 ($B121), ending the game. 06901 =006B 06902 L.PLHIT = $6B ; Saves PLAYER (and space object) index of hit PLAYER =006C 06903 L.VIEWDIR = $6C ; Saves view direction. Used values are: 06904 ; $00 -> Front view 06905 ; $FF -> Aft view 06906 AF3D A202 06907 COLLISION LDX #2 ; Loop over our starship's two photon torpedoes AF3F CA 06908 LOOP048 DEX ; AF40 1001 06909 BPL SKIP138 ; Branch into loop body below AF42 60 06910 RTS ; Return 06911 06912 ;*** Photon torpedo sanity checks ********************************************** AF43 BD8F0C 06913 SKIP138 LDA PL3SHAPTYPE,X ; Next photon torpedo if PLAYER not a PHOTON TORPEDO AF46 D0F7 06914 BNE LOOP048 ; 06915 AF48 B5EC 06916 LDA PL3LIFE,X ; Next photon torpedo if PLAYER not alive AF4A F0F3 06917 BEQ LOOP048 ; 06918 06919 ;*** Check if our starship's photon torpedo has hit in x-y plane *************** AF4C B582 06920 LDA PL3HIT,X ; Check Player/Missile collision register AF4E 2907 06921 AND #$07 ; Next torpedo if no torpedo-to-PLAYER collision AF50 F0ED 06922 BEQ LOOP048 ; 06923 AF52 4A 06924 LSR A ; Find out which PLAYER was hit in PLAYFIELD AF53 C903 06925 CMP #3 ; AF55 D001 06926 BNE SKIP139 ; AF57 4A 06927 LSR A ; AF58 A8 06928 SKIP139 TAY ; Save resulting index of hit PLAYER 06929 AF59 B9E900 06930 LDA PL0LIFE,Y ; Next torpedo if PLAYER0..2 (= targets) not alive AF5C F0E1 06931 BEQ LOOP048 ; 06932 06933 ;*** Has our starship's photon torpedo hit within valid z-coordinate interval? * AF5E A5D0 06934 LDA SHIPVIEW ; Skip if in Front view AF60 F002 06935 BEQ SKIP140 ; AF62 A9FF 06936 LDA #$FF ; Calculate range index... AF64 856C 06937 SKIP140 STA L.VIEWDIR ; Saves view direction AF66 59400A 06938 EOR ZPOSHI,Y ; Calc ABS(z-coordinate (high byte)) of hit object AF69 C910 06939 CMP #16 ; Limit range index to 0..7 AF6B 9002 06940 BCC SKIP141 ; AF6D A90F 06941 LDA #15 ; AF6F 4A 06942 SKIP141 LSR A ; AF70 846B 06943 STY L.PLHIT ; Save index of hit PLAYER 06944 AF72 A8 06945 TAY ; AF73 A56C 06946 LDA L.VIEWDIR ; Reload view direction AF75 5D430A 06947 EOR PL3ZPOSHI,X ; Calc ABS(z-coordinate (high byte)) of torpedo 06948 AF78 D975BF 06949 CMP HITMAXZTAB,Y ; Next torpedo if torpedo >= max hit z-coordinate AF7B B0C2 06950 BCS LOOP048 ; 06951 AF7D D97DBF 06952 CMP HITMINZTAB,Y ; Next torpedo if torpedo < min hit z-coordinate AF80 90BD 06953 BCC LOOP048 ; 06954 06955 ;*** Our starship's photon torpedo has hit within valid z-coordinate interval! * AF82 A46B 06956 LDY L.PLHIT ; Reload index of hit PLAYER AF84 38 06957 SEC ; Calc "age" of photon torpedo in game loops to... AF85 A9FF 06958 LDA #255 ; delay playing ZYLON EXPLOSION noise sound pattern AF87 F5EC 06959 SBC PL3LIFE,X ; AF89 85E2 06960 STA NOISEZYLONTIM ; 06961 AF8B C90F 06962 CMP #15 ; Skip if photon torpedo "age" < 15 AF8D 9005 06963 BCC SKIP142 ; AF8F B98C0C 06964 LDA PL0SHAPTYPE,Y ; CARRY := PLAYER is ZYLON BASESTAR (shape type 8) AF92 C980 06965 CMP #SHAP.ZBASESTAR ; (and torpedo "age" good to destroy ZYLON BASESTAR) 06966 06967 ;*** Clean up our starship's photon torpedo and hit PLAYER ********************* AF94 A900 06968 SKIP142 LDA #0 ; Lock-on lifetime := 0 game loops AF96 8588 06969 STA LOCKONLIFE ; AF98 95EC 06970 STA PL3LIFE,X ; Photon torpedo's lifetime := 0 game loops AF9A B04B 06971 BCS SKIP144 ; If CARRY set do not score, just do explosion 06972 AF9C 99E900 06973 STA PL0LIFE,Y ; Hit PLAYER lifetime := 0 game loops 06974 AF9F B98C0C 06975 LDA PL0SHAPTYPE,Y ; If hit PLAYER is... AFA2 F043 06976 BEQ SKIP144 ; ...a PHOTON TORPEDO (shape type 0)... AFA4 C960 06977 CMP #SHAP.METEOR ; ...or a METEOR (shape type 6)... AFA6 F03F 06978 BEQ SKIP144 ; ...do not score, just do explosion 06979 AFA8 A900 06980 LDA #0 ; Clear photon torpedo tracking flag AFAA 8586 06981 STA ISTRACKING ; 06982 06983 ;*** Zylon ship (or starbase) destroyed! *************************************** AFAC A690 06984 LDX CURRSECTOR ; Decrement Zylon count on Galactic Chart AFAE DEC908 06985 DEC GCMEMMAP,X ; AFB1 1013 06986 BPL SKIP143 ; Skip if destroyed space object was Zylon ship 06987 06988 ;*** Starbase destroyed! ******************************************************* AFB3 A900 06989 LDA #0 ; Remove destroyed starbase from Galactic Chart AFB5 9DC908 06990 STA GCMEMMAP,X ; AFB8 38 06991 SEC ; SCORE := SCORE - 3 for destroying starbase AFB9 A5CB 06992 LDA SCORE ; AFBB E903 06993 SBC #3 ; AFBD 85CB 06994 STA SCORE ; AFBF A5CC 06995 LDA SCORE+1 ; AFC1 E900 06996 SBC #0 ; AFC3 85CC 06997 STA SCORE+1 ; AFC5 60 06998 RTS ; Return 06999 07000 ;*** Zylon ship destroyed! ***************************************************** AFC6 18 07001 SKIP143 CLC ; SCORE := SCORE + 6 for destroying Zylon ship AFC7 A5CB 07002 LDA SCORE ; AFC9 6906 07003 ADC #6 ; AFCB 85CB 07004 STA SCORE ; AFCD A5CC 07005 LDA SCORE+1 ; AFCF 6900 07006 ADC #0 ; AFD1 85CC 07007 STA SCORE+1 ; 07008 AFD3 A201 07009 LDX #1 ; Increment Zylon KILL COUNTER readout... AFD5 FE5009 07010 LOOP049 INC KILLCNTD1,X ; ...of Control Panel Display AFD8 BD5009 07011 LDA KILLCNTD1,X ; AFDB C94A 07012 CMP #[CCS.COL1!CCS.9]+1 ; AFDD 9008 07013 BCC SKIP144 ; AFDF A940 07014 LDA #[CCS.COL1!CCS.0] ; AFE1 9D5009 07015 STA KILLCNTD1,X ; AFE4 CA 07016 DEX ; AFE5 10EE 07017 BPL LOOP049 ; 07018 AFE7 206BAC 07019 SKIP144 JSR INITEXPL ; Init explosion at hit PLAYER 07020 07021 ;*** Any Zylon ships left? ***************************************************** AFEA A27F 07022 LDX #127 ; Scan all sectors of Galactic Chart AFEC BDC908 07023 LOOP050 LDA GCMEMMAP,X ; AFEF 3002 07024 BMI SKIP145 ; AFF1 D00A 07025 BNE SKIP146 ; Return if Zylon sector found AFF3 CA 07026 SKIP145 DEX ; AFF4 10F6 07027 BPL LOOP050 ; 07028 07029 ;*** Game over (Mission Complete) ********************************************** AFF6 A03F 07030 LDY #$3F ; Set title phrase "MISSION COMPLETE" AFF8 A200 07031 LDX #0 ; Set mission bonus offset AFFA 2021B1 07032 JSR GAMEOVER2 ; Game over AFFD 60 07033 SKIP146 RTS ; Return 07034 07035 ;******************************************************************************* 07036 ;* * 07037 ;* KEYBOARD * 07038 ;* * 07039 ;* Handle Keyboard Input * 07040 ;* * 07041 ;******************************************************************************* 07042 07043 ; DESCRIPTION 07044 ; 07045 ; If a keyboard code has been collected during a keyboard IRQ in the Immediate 07046 ; Interrupt Request handler IRQHNDLR ($A751), the idle counter is reset and the 07047 ; PLAYER-PLAYFIELD priority arranges the PLAYERs in front of the PLAYFIELD. 07048 ; Then, the keyboard code is compared with keyboard codes of table KEYTAB 07049 ; ($BABE). If no match is found the "WHAT'S WRONG" message is displayed in the 07050 ; title line and code execution returns. 07051 ; 07052 ; If one of the speed keys '0'..'9' has been pressed, a pending hyperwarp is 07053 ; aborted in subroutine ABORTWARP ($A980) and code execution returns. Otherwise 07054 ; the Engines drain rate is adjusted as well as the new velocity of our 07055 ; starship. If the Engines are damaged, a maximum speed is possible equivalent 07056 ; to speed key '5'. 07057 ; 07058 ; If one of our starship's view keys 'F' (Front), 'A' (Aft), 'G' (Galactic 07059 ; Chart), or 'L' (Long-Range Scan) have been pressed, the Display List is 07060 ; modified accordingly in subroutine MODDLST ($ADF1) and a new star field of 12 07061 ; stars is created with the help of subroutine INITPOSVEC ($B764). Code 07062 ; execution returns via subroutine UPDSCREEN ($B07B). 07063 ; 07064 ; If one of the 'T' (Tracking Computer), 'S' (Shields) or 'C' (Attack Computer) 07065 ; keys have been pressed, the corresponding status bits are toggled and the 07066 ; title line is updated with the corresponding title phrase. The beeper sound 07067 ; pattern ACKNOWLEDGE is played in subroutine BEEP ($B3A6). The tracking letter 07068 ; of the Control Panel Display is updated and the PLAYFIELD is cleared in 07069 ; subroutine CLRPLAYFIELD ($AE0D). If the Attack Computer is on, the Front or 07070 ; Aft view cross hairs are drawn, depending on the current view of our starship, 07071 ; via subroutine DRAWLINES ($A76F). 07072 ; 07073 ; If the 'H' (Hyperwarp) key has been pressed then the hyperwarp is engaged. Our 07074 ; starship's velocity is set to the maximum value, the Engines drain rate is 07075 ; increased to the equivalent of speed key '7'. Star trails are prepared. The 07076 ; position vector of the Hyperwarp Target Marker (PLAYER3) is set to the 07077 ; following values: 07078 ; 07079 ; x-coordinate := +0 (+$0000) <KM> 07080 ; y-coordinate := +256 (+$0100) <KM> 07081 ; z-coordinate := + (+$****) <KM> (sign only) 07082 ; 07083 ; The velocity vector is set to the following values: 07084 ; 07085 ; x-velocity := (not initialized) 07086 ; y-velocity := (not initialized) 07087 ; z-velocity := +0 <KM/H> 07088 ; 07089 ; The temporary arrival hyperwarp marker column and row numbers are saved. If 07090 ; not in a NOVICE mission, the maximum veer-off velocity of the Hyperwarp Target 07091 ; Marker during hyperwarp is picked from table VEERMASKTAB ($BED7). This value 07092 ; depends on the selected hyperwarp energy (and thus on the distance to 07093 ; hyperwarp). Finally, the title line displays the "HYPERWARP ENGAGED" message. 07094 ; 07095 ; If the 'M' (Manual target selector) key has been pressed, the tracked target 07096 ; space object is swapped and the corresponding digit of the Control Panel 07097 ; Display is toggled between 0 and 1. 07098 ; 07099 ; If the 'P' (Pause) key has been pressed, an endless loop waits until the 07100 ; joystick is pushed. 07101 ; 07102 ; BUG (at $B103): The endless loop branches back one instruction too far. 07103 ; Suggested fix: Branch to instruction LDA PORTA at $B0FE. 07104 ; 07105 ; If the 'INV' (Abort mission) key has been pressed, the mission is aborted by 07106 ; setting the mission bonus offset, then displaying the "MISSION ABORTED" 07107 ; message in the title line. Code execution continues into subroutine GAMEOVER 07108 ; ($B10A). 07109 ; 07110 ; NOTE: This subroutine has two additional entry points: 07111 ; 07112 ; (1) SETVIEW ($B045), which is used to enforce the Front view. It is entered 07113 ; from the game loop GAMELOOP ($A1F3) and subroutines INITSTART ($A15E) and 07114 ; DECENERGY ($B86F). 07115 ; 07116 ; (2) UPDSCREEN ($B07B), which draws the cross hairs, the Attack Computer 07117 ; Display and sets the tracking letter of the Control Panel Display. It is 07118 ; entered from subroutine DOCKING ($ACE6). 07119 =006A 07120 L.KEYCODE = $6A ; Saves pressed keyboard code 07121 AFFE A5CA 07122 KEYBOARD LDA KEYCODE ; Return if no keyboard code collected B000 F03E 07123 BEQ SKIP150 ; 07124 B002 A214 07125 LDX #20 ; Prep keyboard code table loop index B004 856A 07126 STA L.KEYCODE ; Save keyboard code 07127 B006 A900 07128 LDA #0 ; Reset idle counter B008 8566 07129 STA IDLECNTHI ; B00A 85CA 07130 STA KEYCODE ; Clear keyboard code 07131 B00C A911 07132 LDA #$11 ; GTIA: enable PLAYER4, prio: PLs > PFs > BGR B00E 8D1BD0 07133 STA PRIOR ; (PLAYERs appear behind cross hairs) 07134 07135 ;*** Search keyboard code in lookup table ************************************** 07136 B011 BDBEBA 07137 LOOP051 LDA KEYTAB,X ; Loop over all valid keyboard codes B014 C56A 07138 CMP L.KEYCODE ; B016 F008 07139 BEQ SKIP147 ; Branch if matching entry found B018 CA 07140 DEX ; B019 10F6 07141 BPL LOOP051 ; Next keyboard code 07142 B01B A010 07143 LDY #$10 ; No match found... B01D 4C23B2 07144 JMP SETTITLE ; ...set title phrase "WHATS WRONG?" and return 07145 07146 ;*** Handle '0'..'9' keyboard keys (speed) ************************************* B020 E00A 07147 SKIP147 CPX #10 ; Skip section if keyboard code does not match B022 B01D 07148 BCS SKIP151 ; 07149 B024 A5C0 07150 LDA WARPSTATE ; Skip if hyperwarp disengaged... B026 F003 07151 BEQ SKIP148 ; B028 4C80A9 07152 JMP ABORTWARP ; ...else abort hyperwarp 07153 B02B 2C9309 07154 SKIP148 BIT GCSTATENG ; Skip if Engines are OK or destroyed B02E 5006 07155 BVC SKIP149 ; B030 E006 07156 CPX #6 ; Allow max velocity equivalent to speed key '5' B032 9002 07157 BCC SKIP149 ; B034 A205 07158 LDX #5 ; 07159 B036 BDD3BA 07160 SKIP149 LDA DRAINRATETAB,X ; Set Engines drain rate B039 8580 07161 STA DRAINRATE ; B03B BDB4BA 07162 LDA VELOCITYTAB,X ; Set new velocity B03E 8571 07163 STA NEWVELOCITY ; B040 60 07164 SKIP150 RTS ; Return 07165 07166 ;*** Handle 'F', 'A', 'L', 'G' keyboard keys (our starship's views) ************ B041 E00E 07167 SKIP151 CPX #14 ; Skip section if keyboard code does not match B043 B01B 07168 BCS SKIP152 ; 07169 07170 ;*** Entry to force Front view after program init and failed missions ********** B045 BD18BE 07171 SETVIEW LDA VIEWMODETAB-10,X ; Store our starship's view type B048 85D0 07172 STA SHIPVIEW ; 07173 B04A BC82BA 07174 LDY DLSTFRAGOFFTAB-10,X ; Get DL fragment offset (Front, Aft, LRS, GC) B04D A202 07175 LDX #$02 ; Switch to corresponding view B04F A908 07176 LDA #$08 ; B051 20F1AD 07177 JSR MODDLST ; 07178 B054 A210 07179 LDX #16 ; Create new star field of 12 stars B056 2064B7 07180 LOOP052 JSR INITPOSVEC ; B059 CA 07181 DEX ; B05A E005 07182 CPX #5 ; B05C B0F8 07183 BCS LOOP052 ; 07184 B05E 901B 07185 BCC UPDSCREEN ; Return via updating screen (below) 07186 07187 ;*** Handle 'T', 'S', 'C' keyboard keys (Tracking, Shields, Attack Computer) *** B060 E011 07188 SKIP152 CPX #17 ; Skip section if keyboard code does not match B062 B035 07189 BCS SKIP156 ; 07190 B064 BC18BE 07191 LDY MSGOFFTAB-14,X ; Prep title phrase offset "... OFF" B067 B56E 07192 LDA ISTRACKCOMPON-14,X ; Toggle status bits (also energy consumption values) B069 5D1BBE 07193 EOR MSGBITTAB-14,X ; B06C 956E 07194 STA ISTRACKCOMPON-14,X ; B06E F003 07195 BEQ SKIP153 ; B070 BC1EBE 07196 LDY MSGONTAB-14,X ; Prep title phrase offset "... ON" B073 2023B2 07197 SKIP153 JSR SETTITLE ; Set title phrase to "... ON" or "... OFF" version 07198 B076 A20C 07199 LDX #$0C ; Play beeper sound pattern ACKNOWLEDGE B078 20A6B3 07200 JSR BEEP ; 07201 07202 ;*** Update PLAYFIELD (Cross hairs, Attack Computer, set tracking letter) ****** B07B A216 07203 UPDSCREEN LDX #CCS.T ; Get custom char 'T' (entry point TRANSFER COMPLETE) B07D A47C 07204 LDY ISTRACKCOMPON ; B07F F001 07205 BEQ SKIP154 ; Skip if Tracking Computer is on 07206 B081 E8 07207 INX ; Get custom char 'C' 07208 B082 8E5A09 07209 SKIP154 STX TRACKC1 ; Store tracking character in Control Panel Display B085 200DAE 07210 JSR CLRPLAYFIELD ; Clear PLAYFIELD B088 A57E 07211 LDA ISATTCOMPON ; Return if Attack Computer off B08A F0B4 07212 BEQ SKIP150 ; 07213 B08C A6D0 07214 LDX SHIPVIEW ; If Aft view -> Draw Aft cross hairs and return B08E F006 07215 BEQ SKIP155 ; If Front view -> Draw Front cross hairs and ... B090 E001 07216 CPX #$01 ; ...Attack Computer and return B092 D0AC 07217 BNE SKIP150 ; B094 A22A 07218 LDX #$2A ; B096 4C6FA7 07219 SKIP155 JMP DRAWLINES ; 07220 07221 ;*** Handle 'H' keyboard key (Hyperwarp) *************************************** B099 E011 07222 SKIP156 CPX #17 ; Skip if keyboard code does not match B09B D050 07223 BNE SKIP158 ; 07224 07225 ;*** Engage Hyperwarp ********************************************************** B09D A5C0 07226 LDA WARPSTATE ; Return if hyperwarp engaged B09F D05A 07227 BNE SKIP159 ; 07228 B0A1 A97F 07229 LDA #$7F ; Engage hyperwarp B0A3 85C0 07230 STA WARPSTATE ; B0A5 A9FF 07231 LDA #255 ; Set new velocity B0A7 8571 07232 STA NEWVELOCITY ; B0A9 A91E 07233 LDA #30 ; Set drain rate equivalent to speed key '7' B0AB 8580 07234 STA DRAINRATE ; 07235 B0AD A930 07236 LDA #48 ; Set space obj index of first star of star trail B0AF 85C3 07237 STA TRAILIND ; B0B1 A900 07238 LDA #0 ; Clear star trail delay B0B3 85C2 07239 STA TRAILDELAY ; 07240 B0B5 8D740A 07241 STA PL3XPOSHI ; Init position vector and velocity vector of... B0B8 8D070B 07242 STA PL3XPOSLO ; ... Hyperwarp Target Marker (PLAYER3): B0BB 8D380B 07243 STA PL3YPOSLO ; x-coordinate := +0 (+$0000) <KM> B0BE 8D690B 07244 STA PL3ZVEL ; y-coordinate := +256 (+$0100) <KM> B0C1 A901 07245 LDA #1 ; z-coordinate := + (+$****) <KM> (sign only) B0C3 8DB009 07246 STA PL3ZPOSSIGN ; z-velocity := +0 <KM/H> B0C6 8DE109 07247 STA PL3XPOSSIGN ; B0C9 8D120A 07248 STA PL3YPOSSIGN ; B0CC 8DA50A 07249 STA PL3YPOSHI ; 07250 B0CF A58F 07251 LDA WARPARRVCOLUMN ; Store temp arrival hyperwarp marker column number B0D1 85C4 07252 STA WARPTEMPCOLUMN ; B0D3 A58E 07253 LDA WARPARRVROW ; Store temp arrival hyperwarp marker row number B0D5 85C5 07254 STA WARPTEMPROW ; 07255 B0D7 A562 07256 LDA MISSIONLEVEL ; Skip if NOVICE mission B0D9 F00B 07257 BEQ SKIP157 ; 07258 B0DB A591 07259 LDA WARPENERGY ; Bits B0..1 of hyperwarp energy index a table... B0DD 2A 07260 ROL A ; ...containing the maximum value of how much the... B0DE 2A 07261 ROL A ; ...Hyperwarp Target Marker will veer off during... B0DF 2A 07262 ROL A ; ...hyperwarp B0E0 2903 07263 AND #$03 ; B0E2 A8 07264 TAY ; B0E3 B9D7BE 07265 LDA VEERMASKTAB,Y ; 07266 B0E6 85C6 07267 SKIP157 STA VEERMASK ; Store veer-off velocity limitation mask 07268 B0E8 A011 07269 LDY #$11 ; Set title phrase "HYPERWARP ENGAGED" and return B0EA 4C23B2 07270 JMP SETTITLE ; 07271 07272 ;*** Handle 'M' keyboard key (Manual Target Selector) key ********************** B0ED E013 07273 SKIP158 CPX #19 ; Skip if keyboard code does not match B0EF B00B 07274 BCS SKIP160 ; 07275 B0F1 AD5C09 07276 LDA TRACKDIGIT ; Toggle digit of tracked space object of... B0F4 4901 07277 EOR #$01 ; ... Control Panel Display B0F6 2901 07278 AND #$01 ; B0F8 8D5C09 07279 STA TRACKDIGIT ; B0FB 60 07280 SKIP159 RTS ; Return 07281 07282 ;*** Handle 'P' keyboard key (Pause) ******************************************* B0FC D008 07283 SKIP160 BNE SKIP161 ; Skip if keyboard code does not match 07284 B0FE AD00D3 07285 LDA PORTA ; Push joystick to resume action B101 C9FF 07286 CMP #$FF ; B103 F0F7 07287 BEQ SKIP160 ; (!) B105 60 07288 RTS ; Return 07289 07290 ;*** Handle 'INV' keyboard key (Abort Mission) ********************************* B106 A076 07291 SKIP161 LDY #$76 ; Preload title phrase "MISSION ABORTED..." B108 A204 07292 LDX #$04 ; Set mission bonus offset 07293 07294 ;******************************************************************************* 07295 ;* * 07296 ;* GAMEOVER * 07297 ;* * 07298 ;* Handle game over * 07299 ;* * 07300 ;******************************************************************************* 07301 07302 ; DESCRIPTION 07303 ; 07304 ; Handles game over, including calculating the scored rank and class. 07305 ; 07306 ; This subroutine has two entry points: 07307 ; 07308 ; (1) GAMEOVER ($B10A) is entered at the end of a failed mission (mission 07309 ; aborted, zero energy, or starship destroyed by Zylon fire). Essentially, 07310 ; our starship is shut down. Code execution continues into GAMEOVER2 07311 ; ($B121) below. 07312 ; 07313 ; (2) GAMEOVER2 ($B121) is entered at the end of a successful mission (all 07314 ; Zylon ships destroyed). It puts the program in demo mode, enqueues the 07315 ; corresponding game over message, and calculates the scored rank and 07316 ; class. 07317 ; 07318 ; The scored rank and class are based on the total score: the score 07319 ; accumulated during the game plus a mission bonus, which depends on the 07320 ; mission level and how the mission ended (mission complete, mission 07321 ; aborted, or starship destroyed by Zylon fire). The mission bonus is 07322 ; picked from table BONUSTAB ($BEDD). 07323 ; 07324 ; The scored rank index is taken from bits B8..4 of the total score and 07325 ; limited to values of 0..18. It indexes table RANKTAB ($BEE9) for the rank 07326 ; string. The rank string is displayed in subroutine SETTITLE ($B223). 07327 ; 07328 ; The scored class index is taken from bits B3..0 (for rank indices 0, 07329 ; 11..14) and computed from bits B4..1 (for rank indices 1..10 and 15..18). 07330 ; It takes values of 0..15. It indexes table CLASSTAB ($BEFC) for the class 07331 ; digit. The class digit is displayed in subroutine SETTITLE ($B223). 07332 ; 07333 ; For quick lookup, the following table lists rank and class from the total 07334 ; score. Pick the cell with the closest value <= your score then read the 07335 ; rank and class off the left and the top of the table, respectively. 07336 ; 07337 ; For example, a score of 90 results in a ranking of "Novice Class 4", a 07338 ; score of 161 results in a ranking of "Pilot Class 3". 07339 ; 07340 ; +------------------------------+---------------------------------------------------------------+ 07341 ; | Minimum Total Score | Class Index | 07342 ; | | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15| 07343 ; +-------+----------------------+---------------------------------------------------------------+ 07344 ; | Rank | | Class | 07345 ; | Index | Rank | 5 5 5 4 4 4 4 3 3 3 2 2 2 1 1 1| 07346 ; +-------+----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 07347 ; | 0 | Galactic Cook | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 07348 ; | 1 | Garbage Scow Captain | 16| 18| 20| 22| 24| 26| 28| 30| | | | | | | | | 07349 ; | 2 | Garbage Scow Captain | | | | | | | | | 32| 34| 36| 38| 40| 42| 44| 46| 07350 ; | 3 | Rookie | 48| 50| 52| 54| 56| 58| 60| 62| | | | | | | | | 07351 ; | 4 | Rookie | | | | | | | | | 64| 66| 68| 70| 72| 74| 76| 78| 07352 ; | 5 | Novice | 80| 82| 84| 86| 88| 90| 92| 94| | | | | | | | | 07353 ; | 6 | Novice | | | | | | | | | 96| 98|100|102|104|106|108|110| 07354 ; | 7 | Ensign |112|114|116|118|120|122|124|126| | | | | | | | | 07355 ; | 8 | Ensign | | | | | | | | |128|130|132|134|136|138|140|142| 07356 ; | 9 | Pilot |144|146|148|150|152|154|156|158| | | | | | | | | 07357 ; | 10 | Pilot | | | | | | | | |160|162|164|166|168|170|172|174| 07358 ; | 11 | Ace |176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191| 07359 ; | 12 | Lieutenant |192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207| 07360 ; | 13 | Warrior |208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|223| 07361 ; | 14 | Captain |224|225|226|227|228|229|230|231|232|233|234|235|236|237|238|239| 07362 ; | 15 | Commander |240|242|244|246|248|250|252|254| | | | | | | | | 07363 ; | 16 | Commander | | | | | | | | |256|258|260|262|264|266|268|270| 07364 ; | 17 | Star Commander |272|274|276|278|280|282|284|286| | | | | | | | | 07365 ; | 18 | Star Commander | | | | | | | | |288|290|292|294|296|298|300|302| 07366 ; +-------+----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 07367 ; 07368 ; NOTE: This subroutine also clears the vertical and horizontal joystick 07369 ; directions. 07370 ; 07371 ; INPUT 07372 ; 07373 ; Y = Title phrase offset. Used values are: 07374 ; $3F -> "MISSION COMPLETE" 07375 ; $31 -> "MISSION ABORTED ZERO ENERGY" 07376 ; $23 -> "SHIP DESTROYED BY ZYLON FIRE" 07377 ; 07378 ; X = Offset to index table BONUSTAB ($BEDD) of mission bonus values. Used 07379 ; values are: 07380 ; $00 -> Mission complete 07381 ; $04 -> Mission was aborted due to zero energy 07382 ; $08 -> Our starship was destroyed by Zylon fire 07383 07384 ;*** Game over (Mission failed) ************************************************ B10A A900 07385 GAMEOVER LDA #0 ; B10C 85EC 07386 STA PL3LIFE ; PLAYER3 lifetime := 0 game loops B10E 85D6 07387 STA BEEPPRIORITY ; Mute beeper B110 85D1 07388 STA TITLEPHR ; Clear title line B112 858B 07389 STA REDALERTLIFE ; Red alert flash lifetime := 0 game loops B114 8D07D2 07390 STA AUDC4 ; Mute audio channel 4 B117 8571 07391 STA NEWVELOCITY ; Shut down Engines B119 8581 07392 STA SHIELDSCOLOR ; Set Shields color to {BLACK} B11B 857D 07393 STA ISSHIELDSON ; Switch off Shields B11D 85C0 07394 STA WARPSTATE ; Disengage hyperwarp B11F 85C1 07395 STA VELOCITYHI ; Turn off hyperwarp velocity 07396 07397 ;*** Game over (Mission successful) ******************************************** B121 A9FF 07398 GAMEOVER2 LDA #$FF ; Enter demo mode B123 8564 07399 STA ISDEMOMODE ; 07400 B125 8465 07401 STY NEWTITLEPHR ; Enqueue title phrase 07402 07403 ;*** Calculate total score ***************************************************** B127 8A 07404 TXA ; B128 0562 07405 ORA MISSIONLEVEL ; B12A AA 07406 TAX ; B12B BDDDBE 07407 LDA BONUSTAB,X ; Retrieve mission bonus B12E 18 07408 CLC ; Add mission bonus and game score B12F 65CB 07409 ADC SCORE ; B131 AA 07410 TAX ; B132 A900 07411 LDA #0 ; 07412 B134 85C9 07413 STA JOYSTICKY ; Clear vertical joystick delta B136 85C8 07414 STA JOYSTICKX ; Clear horizontal joystick delta 07415 B138 65CC 07416 ADC SCORE+1 ; B13A 3025 07417 BMI SKIP165 ; Return if total score < 0 (= total score of 0) 07418 07419 ;*** Calculate scored rank ***************************************************** B13C 4A 07420 LSR A ; B13D 8A 07421 TXA ; B13E 6A 07422 ROR A ; B13F 4A 07423 LSR A ; B140 4A 07424 LSR A ; B141 4A 07425 LSR A ; Use bits B8..4 of total score as rank index B142 C913 07426 CMP #19 ; Limit scored rank index to 0..18 B144 9004 07427 BCC SKIP162 ; B146 A912 07428 LDA #18 ; B148 A20F 07429 LDX #15 ; Prep class index of 15 B14A 85CD 07430 SKIP162 STA SCOREDRANKIND ; Store scored rank index 07431 07432 ;*** Calculate scored class **************************************************** B14C A8 07433 TAY ; B14D 8A 07434 TXA ; B14E C000 07435 CPY #0 ; B150 F00B 07436 BEQ SKIP164 ; B152 C00B 07437 CPY #11 ; B154 9004 07438 BCC SKIP163 ; B156 C00F 07439 CPY #15 ; B158 9003 07440 BCC SKIP164 ; B15A 4A 07441 SKIP163 LSR A ; B15B 4908 07442 EOR #$08 ; B15D 290F 07443 SKIP164 AND #$0F ; B15F 85CE 07444 STA SCOREDCLASSIND ; Store scored class index, is 0..15 07445 B161 60 07446 SKIP165 RTS ; Return 07447 07448 ;******************************************************************************* 07449 ;* * 07450 ;* SELECTWARP * 07451 ;* * 07452 ;* Select hyperwarp arrival location on Galactic Chart * 07453 ;* * 07454 ;******************************************************************************* 07455 07456 ; DESCRIPTION 07457 ; 07458 ; This subroutine executes the following steps: 07459 ; 07460 ; (1) Check if we are in Galactic Chart view and not in hyperwarp. 07461 ; 07462 ; (2) Update the Galactic Chart in subroutine DRAWGC ($B4B9) if the Subspace 07463 ; Radio is not damaged. 07464 ; 07465 ; (3) Move the arrival hyperwarp marker (PLAYER4) across the Galactic Chart 07466 ; every other game loop iteration. The current location of our starship is 07467 ; indicated by the departure hyperwarp marker (PLAYER3). 07468 ; 07469 ; Code execution continues into subroutine CALCWARP ($B1A7) to calculate the 07470 ; required hyperwarp energy. 07471 ; 07472 ; NOTE: To calculate the horizontal position of PLAYER3..4 an offset of 61 is 07473 ; added (from left to right: 48 Player/Missile (PM) pixels to the left edge of 07474 ; the screen + 16 PM pixels to the left border of the Galactic Chart - 3 PM 07475 ; pixels relative offset of the PLAYER shape's horizontal center to its left 07476 ; edge = 61 PM pixels). 07477 ; 07478 ; NOTE: To calculate the vertical position of PLAYER3..4 an offset of 63 is 07479 ; added (from top to bottom: 8 Player/Missile (PM) pixels to the start of the 07480 ; Display List + 56 PM pixels to the first row of sectors - 1 PM pixel relative 07481 ; offset of the PLAYER shape's vertical center to its top edge (?) = 63 PM 07482 ; pixels). 07483 B162 A5C0 07484 SELECTWARP LDA WARPSTATE ; Return if hyperwarp engaged B164 D004 07485 BNE SKIP166 ; 07486 B166 A5D0 07487 LDA SHIPVIEW ; Return if not in Galactic Chart view B168 3001 07488 BMI SKIP167 ; B16A 60 07489 SKIP166 RTS ; Return 07490 B16B 2C9709 07491 SKIP167 BIT GCSTATRAD ; Skip if Subspace Radio is damaged or destroyed B16E 3003 07492 BMI SKIP168 ; 07493 B170 20B9B4 07494 JSR DRAWGC ; Redraw Galactic Chart 07495 B173 A572 07496 SKIP168 LDA COUNT8 ; Move hyperwarp markers only every other game loop B175 2901 07497 AND #$01 ; B177 D02E 07498 BNE CALCWARP ; 07499 07500 ;*** Calc arrival hyperwarp marker column and row numbers, update PLAYER4 pos ** B179 18 07501 CLC ; B17A A58F 07502 LDA WARPARRVCOLUMN ; Load arrival hyperwarp marker column number B17C 65C8 07503 ADC JOYSTICKX ; Add joystick x-delta B17E 297F 07504 AND #$7F ; Limit value to 0..127 B180 858F 07505 STA WARPARRVCOLUMN ; Save new arrival hyperwarp marker column number B182 18 07506 CLC ; B183 693D 07507 ADC #61 ; Add offset of 61 B185 8D2E0C 07508 STA PL4COLUMN ; Store as PLAYER4 column number 07509 B188 18 07510 CLC ; B189 A58E 07511 LDA WARPARRVROW ; Load arrival hyperwarp marker row number B18B 65C9 07512 ADC JOYSTICKY ; Add joystick y-delta B18D 297F 07513 AND #$7F ; Limit value to 0..127 B18F 858E 07514 STA WARPARRVROW ; Save new arrival hyperwarp marker row number B191 18 07515 CLC ; B192 693F 07516 ADC #63 ; Add offset of 63 B194 8DFD0B 07517 STA PL4ROWNEW ; Store as PLAYER4 row number 07518 07519 ;*** Calc departure hyperwarp marker column and row numbers, update PLAYER3 pos B197 A58C 07520 LDA WARPDEPRROW ; Load departure hyperwarp marker row number B199 18 07521 CLC ; B19A 693F 07522 ADC #63 ; Add offset of 63 B19C 8DFC0B 07523 STA PL3ROWNEW ; Store as PLAYER3 row number 07524 B19F A58D 07525 LDA WARPDEPRCOLUMN ; Load departure hyperwarp marker column number B1A1 18 07526 CLC ; B1A2 693D 07527 ADC #61 ; Add offset of 61 B1A4 8D2D0C 07528 STA PL3COLUMN ; Store as PLAYER3 column number 07529 07530 ;******************************************************************************* 07531 ;* * 07532 ;* CALCWARP * 07533 ;* * 07534 ;* Calculate and display hyperwarp energy * 07535 ;* * 07536 ;******************************************************************************* 07537 07538 ; DESCRIPTION 07539 ; 07540 ; Calculates and displays the hyperwarp energy in the Galactic Chart view. 07541 ; 07542 ; This subroutine executes the following steps: 07543 ; 07544 ; (1) Determine the arrival sector from the arrival hyperwarp marker position. 07545 ; 07546 ; (2) If the Subspace Radio is not destroyed, update the target number digit of 07547 ; the Galactic Chart Panel Display. 07548 ; 07549 ; (3) Calculate the hyperwarp energy that is required to hyperwarp from the 07550 ; departure hyperwarp marker to the arrival hyperwarp marker based on the 07551 ; "block-distance": 07552 ; 07553 ; DISTANCE := DELTAC + DELTAR / 2 07554 ; 07555 ; where 07556 ; 07557 ; DELTAC := ABS(WARPARRVCOLUMN - WARPDEPRCOLUMN) 07558 ; DELTAR := ABS(WARPARRVROW - WARPDEPRROW) 07559 ; 07560 ; NOTE: Dividing DELTAR by 2 is because PLAYERs at single-line resolution 07561 ; have Player/Missile pixels that are half as high as they are wide. 07562 ; 07563 ; The hyperwarp energy, divided by 10, is the sum of a value picked from 07564 ; the hyperwarp energy table WARPENERGYTAB ($BADD) indexed by DISTANCE / 8) 07565 ; plus a remainder computed from Bits B1..0 of DISTANCE. 07566 ; 07567 ; (4) Store the hyperwarp energy value in WARPENERGY ($91). 07568 ; 07569 ; (5) Update the HYPERWARP ENERGY readout of the Galactic Chart Panel Display. 07570 =006A 07571 L.WARPARRVCOL = $6A ; Saves arrival sector column number =006A 07572 L.DIFFC = $6A ; Saves diff column value 07573 07574 ;*** Calculate arrival sector ************************************************** B1A7 A58F 07575 CALCWARP LDA WARPARRVCOLUMN ; B1A9 4A 07576 LSR A ; B1AA 4A 07577 LSR A ; B1AB 4A 07578 LSR A ; B1AC 856A 07579 STA L.WARPARRVCOL ; A := arrival sector column 0..15 B1AE A58E 07580 LDA WARPARRVROW ; B1B0 2970 07581 AND #$70 ; A := arrival sector row (0..7) * 16 B1B2 056A 07582 ORA L.WARPARRVCOL ; B1B4 8592 07583 STA ARRVSECTOR ; Save arrival sector (format %0rrrcccc) 07584 07585 ;*** Update target number digit of Galactic Chart Panel Display **************** B1B6 AA 07586 TAX ; B1B7 BDC908 07587 LDA GCMEMMAP,X ; Get number of Zylon ships in arrival sector B1BA 1002 07588 BPL SKIP169 ; Skip if no starbase in arrival sector B1BC A900 07589 LDA #0 ; Clear number of Zylon ships B1BE 0990 07590 SKIP169 ORA #CCS.COL2!ROM.0 ; Merge COLOR2 bits with number of Zylon ships B1C0 2C9709 07591 BIT GCSTATRAD ; Skip if Subspace Radio destroyed B1C3 7003 07592 BVS SKIP170 ; 07593 B1C5 8D8D09 07594 STA GCTRGCNT ; Set target number digit of Galactic Chart Panel 07595 07596 ;*** Calculate energy to hyperwarp between hyperwarp markers ******************* B1C8 38 07597 SKIP170 SEC ; A := DIFFC := ABS(WARPARRVCOLUMN - WARPDEPRCOLUMN) B1C9 A58F 07598 LDA WARPARRVCOLUMN ; (Column value difference) B1CB E58D 07599 SBC WARPDEPRCOLUMN ; B1CD B004 07600 BCS SKIP171 ; B1CF 49FF 07601 EOR #$FF ; B1D1 6901 07602 ADC #1 ; B1D3 856A 07603 SKIP171 STA L.DIFFC ; 07604 B1D5 38 07605 SEC ; A := DIFFR := ABS(WARPARRVROW - WARPDEPRROW) B1D6 A58E 07606 LDA WARPARRVROW ; (Row value difference) B1D8 E58C 07607 SBC WARPDEPRROW ; B1DA B004 07608 BCS SKIP172 ; B1DC 49FF 07609 EOR #$FF ; B1DE 6901 07610 ADC #1 ; 07611 B1E0 4A 07612 SKIP172 LSR A ; A := DISTANCE := DIFFR / 2 + DIFFC B1E1 18 07613 CLC ; B1E2 656A 07614 ADC L.DIFFC ; 07615 B1E4 A8 07616 TAY ; Save DISTANCE B1E5 4A 07617 LSR A ; Calc index into hyperwarp energy table B1E6 4A 07618 LSR A ; B1E7 4A 07619 LSR A ; B1E8 AA 07620 TAX ; 07621 B1E9 98 07622 TYA ; Load DISTANCE value B1EA 2903 07623 AND #$03 ; Get DISTANCE bits B1..0 B1EC 18 07624 CLC ; B1ED 7DDDBA 07625 ADC WARPENERGYTAB,X ; Add hyperwarp energy from table B1F0 8591 07626 STA WARPENERGY ; Save hyperwarp energy 07627 07628 ;*** Update HYPERWARP ENERGY readout of Galactic Chart Panel Display *********** B1F2 A8 07629 TAY ; Prep with hyperwarp energy value 07630 B1F3 A910 07631 LDA #ROM.0 ; Set HYPERWARP ENERGY readout digit1..3 to '0' B1F5 8D7D09 07632 STA GCWARPD1 ; B1F8 8D7E09 07633 STA GCWARPD1+1 ; B1FB 8D7F09 07634 STA GCWARPD1+2 ; 07635 B1FE A202 07636 LOOP053 LDX #2 ; Loop over HYPERWARP ENERGY readout digit3..1 B200 FE7D09 07637 LOOP054 INC GCWARPD1,X ; Increment digit value B203 BD7D09 07638 LDA GCWARPD1,X ; B206 C91A 07639 CMP #ROM.9+1 ; B208 9008 07640 BCC SKIP173 ; Skip if energy digit <= '9' 07641 B20A A910 07642 LDA #ROM.0 ; Replace energy digit with '0' B20C 9D7D09 07643 STA GCWARPD1,X ; B20F CA 07644 DEX ; B210 10EE 07645 BPL LOOP054 ; Next energy digit 07646 B212 88 07647 SKIP173 DEY ; Decrement HYPERWARP ENERGY readout value B213 D0E9 07648 BNE LOOP053 ; B215 60 07649 RTS ; Return 07650 07651 ;******************************************************************************* 07652 ;* * 07653 ;* UPDTITLE * 07654 ;* * 07655 ;* Update title line * 07656 ;* * 07657 ;******************************************************************************* 07658 07659 ; DESCRIPTION 07660 ; 07661 ; Updates the title phrase displayed in the title line. 07662 ; 07663 ; If no title phrase has been set then fetch the offset of the next ("enqueued") 07664 ; title phrase to be displayed. If one has been set then code execution 07665 ; continues into subroutine SETTITLE ($B223), otherwise code execution returns. 07666 ; 07667 ; If a title phrase has been set then decrement the lifetime of the currently 07668 ; displayed title phrase segment. If its lifetime has reached a value of 0 then 07669 ; branch to subroutine SETTITLE ($B223) to display the next segment. 07670 B216 A5D1 07671 UPDTITLE LDA TITLEPHR ; Skip if no title phrase set B218 F005 07672 BEQ SKIP175 ; 07673 B21A C6CF 07674 DEC TITLELIFE ; Decrement title phrase segment lifetime B21C F010 07675 BEQ SKIP176 ; If lifetime expired show next title segment 07676 B21E 60 07677 SKIP174 RTS ; Return 07678 B21F A465 07679 SKIP175 LDY NEWTITLEPHR ; Prep enqueued new title phrase B221 F0FB 07680 BEQ SKIP174 ; Return if not set 07681 07682 ;******************************************************************************* 07683 ;* * 07684 ;* SETTITLE * 07685 ;* * 07686 ;* Set title phrase in title line * 07687 ;* * 07688 ;******************************************************************************* 07689 07690 ; DESCRIPTION 07691 ; 07692 ; Displays a title phrase in the title line. 07693 ; 07694 ; INTRODUCTION 07695 ; 07696 ; Title phrases are picked from the title phrase table PHRASETAB ($BBAA). They 07697 ; consist of one or more phrase tokens. Each token is a byte representing a word 07698 ; in word table WORDTAB ($BC2B). Two special tokens are placeholders for the 07699 ; scored class ($FC) and scored rank ($FD) strings. 07700 ; 07701 ; A title phrase is split up into one or more title phrase segments, each 07702 ; fitting into the title line. One title phrase segment is displayed after the 07703 ; other after a delay called the "title segment lifetime". 07704 ; 07705 ; Phrase tokens, except the tokens for the scored class ($FC) and for the scored 07706 ; rank ($FD), contain the number of a word in word table WORDTAB ($BC2B) and may 07707 ; contain an end-of-segment or end-of-phrase marker bit. 07708 ; 07709 ; DETAILS 07710 ; 07711 ; The Display List is modified by subroutine MODDLST ($ADF1) to display the 07712 ; title line. Then, the title line is cleared and the words of the title phrase 07713 ; are copied into it using the passed offset into title phrase table PHRASETAB 07714 ; ($BBAA). If the offset has a value of $FF the title line is hidden in 07715 ; subroutine MODDLST ($ADF1). 07716 ; 07717 ; INPUT 07718 ; 07719 ; Y = Offset into title phrase table PHRASETAB ($BBAA). Used values are: 07720 ; $FF -> Hide title line 07721 ; else -> Offset into title phrase table PHRASETAB ($BBAA), with explicitly 07722 ; used values: 07723 ; 07724 ; $01 -> "COMPUTER ON" 07725 ; $04 -> "COMPUTER OFF" 07726 ; $07 -> "SHIELDS ON" 07727 ; $09 -> "SHIELDS OFF" 07728 ; $0B -> "COMPUTER TRACKING ON" 07729 ; $0E -> "TRACKING OFF" 07730 ; $13 -> "STARBASE SURROUNDED" 07731 ; $15 -> "STARBASE DESTROYED" 07732 ; $1F -> "DOCKING ABORTED" 07733 ; $21 -> "TRANSFER COMPLETE" 07734 ; $4A -> "NOVICE MISSION" 07735 ; $4C -> "PILOT MISSION" 07736 ; $4E -> "WARRIOR MISSION" 07737 ; $50 -> "COMMANDER MISSION" 07738 ; $52 -> "DAMAGE CONTROL..." 07739 ; $75 -> "RED ALERT" 07740 =006A 07741 L.WORD = $6A ; Saves word number of WORDTAB ($BC2A). Used values 07742 ; are $00..$3F. =006B 07743 L.COLUMNPOS = $6B ; Saves cursor column position during copying text 07744 ; into title line =006C 07745 L.TOKEN = $6C ; Saves title phrase token, contains bit-encoded 07746 ; information about one word in the title phrase: 07747 ; B7..6 = %00 -> Copy next word to title line 07748 ; B7..6 = %01 -> End-of-phrase reached. Title 07749 ; segment lifetime = 60 game loops 07750 ; B7..6 = %10 -> End-of-segment reached. Title 07751 ; segment lifetime = 60 game loops 07752 ; B7..6 = %11 -> End-of-phrase reached. Title 07753 ; segment lifetime = 254 game loops 07754 ; Used with title phrases 07755 ; "STARBASE SURROUNDED" 07756 ; "STARBASE DESTROYED" 07757 ; "HYPERSPACE" 07758 ; "RED ALERT" 07759 ; B5..0 -> Word number of WORDTAB ($BC2A) 07760 B223 84D1 07761 SETTITLE STY TITLEPHR ; Save title phrase offset 07762 B225 A023 07763 LDY #$23 ; Show title line B227 A20F 07764 LDX #$0F ; B229 A907 07765 LDA #$07 ; B22B 20F1AD 07766 JSR MODDLST ; 07767 07768 ;*** Init cursor column position and clear title line ************************** B22E A213 07769 SKIP176 LDX #19 ; There are 19(+1) characters to clear B230 A900 07770 LDA #0 ; B232 856B 07771 STA L.COLUMNPOS ; Init cursor column position 07772 B234 9D1F0D 07773 LOOP055 STA TITLETXT,X ; Clear character in title line B237 CA 07774 DEX ; B238 10FA 07775 BPL LOOP055 ; 07776 07777 ;*** If title phrase offset = $FF then hide title line ************************* B23A A6D1 07778 SKIP177 LDX TITLEPHR ; Load title phrase offset B23C E6D1 07779 INC TITLEPHR ; Prepare title phrase offset for next word B23E D009 07780 BNE SKIP178 ; ...skip if it turned 0 07781 B240 A20F 07782 LDX #$0F ; Remove title line and return B242 A080 07783 LDY #$80 ; B244 A907 07784 LDA #$07 ; B246 4CF1AD 07785 JMP MODDLST ; 07786 B249 BDAABB 07787 SKIP178 LDA PHRASETAB,X ; Get phrase token 07788 07789 ;*** Display scrored class? **************************************************** B24C C9FC 07790 CMP #$FC ; Skip if not "scored class" token B24E D00F 07791 BNE SKIP179 ; 07792 B250 A4CE 07793 LDY SCOREDCLASSIND ; Get scored class index, is in 0..15 B252 B9FCBE 07794 LDA CLASSTAB,Y ; Load scored class number digit B255 A66B 07795 LDX L.COLUMNPOS ; Load cursor position B257 9D1F0D 07796 STA TITLETXT,X ; Store class in title line B25A A93C 07797 LDA #60 ; Title segment lifetime := 60 game loops B25C 85CF 07798 STA TITLELIFE ; B25E 60 07799 RTS ; Return 07800 07801 ;*** Display scdored rank? ***************************************************** B25F C9FD 07802 SKIP179 CMP #$FD ; Skip if not "scored rank" token B261 D005 07803 BNE SKIP180 ; 07804 B263 A4CD 07805 LDY SCOREDRANKIND ; Get scored rank index, is in 0..18 B265 B9E9BE 07806 LDA RANKTAB,Y ; Load rank word number 07807 07808 ;*** Search word of token in word table **************************************** B268 856C 07809 SKIP180 STA L.TOKEN ; Save phrase token B26A 293F 07810 AND #$3F ; Strip bits B6..7 from phrase token B26C 856A 07811 STA L.WORD ; Store word number (bits B5..0) 07812 B26E A92A 07813 LDA #<[WORDTAB-1] ; Point MEMPTR to WORDTAB-1 B270 8568 07814 STA MEMPTR ; B272 A9BC 07815 LDA #>[WORDTAB-1] ; B274 8569 07816 STA MEMPTR+1 ; 07817 B276 E668 07818 LOOP056 INC MEMPTR ; Increment MEMPTR B278 D002 07819 BNE SKIP181 ; B27A E669 07820 INC MEMPTR+1 ; 07821 B27C A000 07822 SKIP181 LDY #0 ; B27E B168 07823 LDA (MEMPTR),Y ; Load character of word B280 10F4 07824 BPL LOOP056 ; Loop until end-of-word marker (bit B7) found B282 C66A 07825 DEC L.WORD ; B284 D0F0 07826 BNE LOOP056 ; Loop until word found 07827 07828 ;*** Copy word to title line, add space **************************************** B286 293F 07829 LOOP057 AND #$3F ; Strip color bits B6..7 from character B288 49A0 07830 EOR #CCS.COL2!$20 ; Merge COLOR2 bits and convert to ATASCII B28A A66B 07831 LDX L.COLUMNPOS ; Copy character to title line B28C E66B 07832 INC L.COLUMNPOS ; Increment cursor column position B28E 9D1F0D 07833 STA TITLETXT,X ; B291 C8 07834 INY ; B292 B168 07835 LDA (MEMPTR),Y ; Load next character of word B294 10F0 07836 BPL LOOP057 ; Next character of word if no end-of-word marker B296 E66B 07837 INC L.COLUMNPOS ; Word was copied. Add space after word 07838 07839 ;*** Decide to copy another word, etc. ***************************************** B298 A93C 07840 LDA #60 ; SUMMARY: B29A 246C 07841 BIT L.TOKEN ; If bits B7..6 of phrase token... B29C 1004 07842 BPL SKIP182 ; %00 -> Copy next word to title line B29E 5008 07843 BVC SKIP183 ; %01 -> End-of-phrase reached. B2A0 A9FE 07844 LDA #254 ; Title segment lifetime := 60 game loops B2A2 5096 07845 SKIP182 BVC SKIP177 ; %10 -> End-of-segment reached. B2A4 A0FF 07846 LDY #$FF ; Title segment lifetime := 60 game loops B2A6 84D1 07847 STY TITLEPHR ; %11 -> End-of-phrase reached. B2A8 85CF 07848 SKIP183 STA TITLELIFE ; Title segment lifetime := 254 game loops B2AA 60 07849 RTS ; Return 07850 07851 ;******************************************************************************* 07852 ;* * 07853 ;* SOUND * 07854 ;* * 07855 ;* Handles sound effects * 07856 ;* * 07857 ;******************************************************************************* 07858 07859 ; DESCRIPTION 07860 ; 07861 ; This subroutine handles the sound effects. It is called every vertical blank 07862 ; phase, that is, every TICK (1/60 s on an NTSC ATARI Home Computer system, 1/50 07863 ; s on a PAL ATARI Home Computer system) from the Vertical Blank Interrupt 07864 ; handler VBIHNDLR ($A6D1). 07865 ; 07866 ; The program uses all of the available 4 audio channels: Audio channels 1, 2, 07867 ; and 3 are shared among the Engines sound effects and the "noise sound 07868 ; patterns" (explosion and photon torpedo sound effects), while audio channel 4 07869 ; is used for "beeper sound patterns" (status report sound effects). The 07870 ; following sections explain the beeper sound patterns and the noise sound 07871 ; patterns: 07872 ; 07873 ; o BEEPER SOUND PATTERNS 07874 ; 07875 ; There are the following beeper sound patterns: 07876 ; 07877 ; (1) HYPERWARP TRANSIT 07878 ; (2) RED ALERT 07879 ; (3) ACKNOWLEDGE 07880 ; (4) DAMAGE REPORT 07881 ; (5) MESSAGE FROM STARBASE 07882 ; 07883 ; They are encoded in table BEEPPATTAB ($BF3E) in 6-byte long "beeper sound 07884 ; patterns". 07885 ; 07886 ; Another table, BEEPFRQTAB ($BF5C), stores the frequencies for the tones 07887 ; of each beeper sound pattern, terminated by a marker byte ($FF). 07888 ; 07889 ; BUG (at $BF5C): The pattern frequencies in table BEEPFRQTAB ($BF5C) at 07890 ; offset $00 are unused. Suggested Fix: Remove from code. 07891 ; 07892 ; Whenever the program calls subroutine BEEP ($B3A6), that subroutine sets 07893 ; up a beeper sound pattern for playing by copying 6 bytes from the pattern 07894 ; table BEEPPATTAB ($BF3E) to BEEPFRQIND ($D2)..BEEPFRQSTART ($D7). 07895 ; Subroutine SOUND ($B2AB) detects the copied beeper sound pattern and plays 07896 ; the encoded tones and pauses. 07897 ; 07898 ; The relevant variables for playing a beeper sound pattern are the 07899 ; following (see also figures at BEEPPATTAB ($BF3E)): 07900 ; 07901 ; BEEPFRQIND ($D2) = Running index into table BEEPFRQTAB ($BF5C) 07902 ; BEEPREPEAT ($D3) = Number of times that the beeper sound pattern is 07903 ; repeated - 1 07904 ; BEEPTONELIFE ($D4) = Lifetime of tone in TICKs - 1 07905 ; BEEPPAUSELIFE ($D5) = Lifetime of pause in TICKs - 1 ($FF -> No pause) 07906 ; BEEPPRIORITY ($D6) = Beeper sound pattern priority. A playing beeper 07907 ; sound pattern is stopped if a beeper sound pattern 07908 ; of higher priority is about to be played. A value 07909 ; of 0 indicates that no beeper sound pattern is 07910 ; playing at the moment. 07911 ; BEEPFRQSTART ($D7) = Index to first byte of the beeper sound pattern in 07912 ; table BEEPFRQTAB ($BF5C) 07913 ; 07914 ; BEEPLIFE ($D8) = Lifetime of the current tone or pause in TICKs 07915 ; BEEPTOGGLE ($D9) = Indicates that either a tone (0) or a pause (not 07916 ; 0) is currently playing. 07917 ; 07918 ; o NOISE SOUND PATTERNS 07919 ; 07920 ; There are the following noise sound patterns: 07921 ; 07922 ; (1) PHOTON TORPEDO LAUNCHED 07923 ; (2) SHIP EXPLOSION 07924 ; (3) ZYLON EXPLOSION 07925 ; 07926 ; They are encoded in table NOISEPATTAB ($BF20) in 10-byte long "noise sound 07927 ; patterns". 07928 ; 07929 ; Whenever the program calls subroutine NOISE ($AEA8), that subroutine sets 07930 ; up a noise sound pattern for being played by copying 10 bytes from the 07931 ; pattern table NOISEPATTAB ($BF20) to NOISETORPTIM ($DA)..NOISELIFE ($E1) 07932 ; and hardware sound registers AUDCTL ($D208) and AUDF3 ($D204). 07933 ; 07934 ; The relevant variables for playing a noise sound pattern are the 07935 ; following: 07936 ; 07937 ; NOISETORPTIM ($DA) = Timer for PHOTON TORPEDO LAUNCHED noise sound 07938 ; pattern 07939 ; NOISEEXPLTIM ($DB) = Timer for SHIP EXPLOSION and ZYLON EXPLOSION noise 07940 ; sound patterns 07941 ; NOISEAUDC2 ($DC) = Audio channel 1/2 control shadow register 07942 ; NOISEAUDC3 ($DD) = Audio channel 3 control shadow register 07943 ; NOISEAUDF1 ($DE) = Audio channel 1 frequency shadow register 07944 ; NOISEAUDF2 ($DF) = Audio channel 2 frequency shadow register 07945 ; NOISEFRQINC ($E0) = Audio channel 1/2 frequency increment 07946 ; NOISELIFE ($E1) = Noise sound pattern lifetime 07947 ; 07948 ; AUDCTL ($D208) = POKEY: Audio control 07949 ; AUDF3 ($D204) = POKEY: Audio channel 3 frequency audio register 07950 ; 07951 ; There are two more variables that trigger noise effects. They are not part 07952 ; of the noise sound pattern table: 07953 ; 07954 ; NOISEZYLONTIM ($E2) = Timer to trigger the ZYLON EXPLOSION noise sound 07955 ; pattern. It is set in subroutine COLLISION ($AF3D) 07956 ; when the impact of one of our starship's photon 07957 ; torpedoes with a target is imminent. The timer is 07958 ; decremented every TICK. When it reaches a value of 07959 ; 0 the ZYLON EXPLOSION noise sound pattern is played 07960 ; in subroutine SOUND ($B2AB). 07961 ; NOISEHITLIFE ($E3) = Lifetime of a special explosion noise when our 07962 ; starship was hit by a Zylon photon torpedo. It is 07963 ; set in GAMELOOP ($A1F3) to a value of 64 TICKs. 07964 ; When it reaches a value of 0 a special ship 07965 ; explosion noise is played in subroutine SOUND 07966 ; ($B2AB). 07967 ; 07968 ; SUBROUTINE DETAILS 07969 ; 07970 ; This subroutine executes the following steps: 07971 ; 07972 ; (1) Play beeper sound pattern 07973 ; 07974 ; The playing of a beeper sound pattern is started, continued, or stopped. 07975 ; 07976 ; (2) Play ZYLON EXPLOSION noise sound pattern 07977 ; 07978 ; If the explosion of a target space object is imminent (subroutine 07979 ; COLLISION ($AF3D) has set NOISEZYLONTIM ($E2) to the number of game loop 07980 ; iterations that will pass until our starship's photon torpedo will hit 07981 ; the target), the timer NOISEZYLONTIM ($E2) is decremented every TICK. If 07982 ; it reaches a value of 0, then the noise sound pattern ZYLON EXPLOSION is 07983 ; played. 07984 ; 07985 ; (3) Play starship's Engines sound 07986 ; 07987 ; If the Engines are louder than the current noise sound pattern then the 07988 ; noise sound pattern is terminated and the values for the audio channels 07989 ; 1..3 are updated: 07990 ; 07991 ; The velocity of our starship determines the pitch and the volume of the 07992 ; Engines: the higher the velocity, the higher the pitch and the volume of 07993 ; the Engines. The incremented value of VELOCITYLO ($70) is used as a "base 07994 ; value" %abcdefgh. 07995 ; 07996 ; Audio channels 1 and 2 are combined to a 16-bit audio channel 1/2, 07997 ; clocked at 1.79 MHz. The inverted bits (represented by an overscore) 07998 ; B7..0 of the base value form bits B12..5 of the 16-bit frequency value of 07999 ; audio channel 1/2. Bits B7..4 of the base value form bits B3..0 of the 08000 ; volume of audio channel 1/2, with noise distortion bit B7 set: 08001 ; ________ 08002 ; AUDF1/2 ($D202..3) := %000abcdefgh00000 08003 ; AUDC2 ($D203) := %1000abcd 08004 ; 08005 ; Audio channel 3 is also clocked at 1.79 MHz. The inverted bits B7..0 of 08006 ; the base value form bits B7..0 of the frequency value of audio channel 3. 08007 ; Bits B6..4 of the base value form bits B3..0 of the volume of audio 08008 ; channel 3, with noise distortion bit B7 set: 08009 ; ________ 08010 ; AUDF3 ($D204) := %abcdefgh 08011 ; AUDC3 ($D205) := %10000bcd 08012 ; 08013 ; Code execution returns at this point. 08014 ; 08015 ; (4) Play ZYLON EXPLOSION or SHIP EXPLOSION noise sound pattern 08016 ; 08017 ; If the ZYLON EXPLOSION or SHIP EXPLOSION noise sound pattern was set up, 08018 ; the explosion noise timer NOISEEXPLTIM ($DB) is decremented every TICK. 08019 ; It starts either with a value of 4 TICKs with a ZYLON EXPLOSION noise 08020 ; sound pattern or with a value of 8 TICKs with a SHIP EXPLOSION noise 08021 ; sound pattern, set up in subroutine NOISE ($AEA8). If it reaches a value 08022 ; of 0, then the shadow control register of audio channel 1/2 switches to 08023 ; "noise distortion" at maximum volume. 08024 ; 08025 ; (5) Play PHOTON TORPEDO LAUNCHED noise sound pattern 08026 ; 08027 ; If the PHOTON TORPEDO LAUNCHED noise sound pattern was set up, the photon 08028 ; torpedo noise timer NOISETORPTIM ($DA) is decremented every TICK. It 08029 ; starts with a value of 8 TICKs, set in subroutine TRIGGER ($AE29). The 08030 ; noise distortion and volume for the shadow control register of audio 08031 ; channel 3 is picked from table NOISETORPVOLTAB ($BFEB), the noise 08032 ; frequency for audio channel 3 is picked from table NOISETORPFRQTAB 08033 ; ($BFF3). If the photon torpedo noise timer reaches a value of 0, then the 08034 ; shadow control registers of audio channel 1/2 switch to "tone distortion" 08035 ; at maximum volume and a frequency of $0202. 08036 ; 08037 ; NOTE: Using a real-time volume envelope stored in table NOISETORPVOLTAB 08038 ; ($BFEB) for a launched photon torpedo results in the distinctive 08039 ; "whooshing" photon torpedo sound. 08040 ; 08041 ; (6) Play special ship explosion noise 08042 ; 08043 ; If our starship was hit by a Zylon photon torpedo then NOISEHITLIFE ($E3) 08044 ; was set to 64 TICKs in routine GAMELOOP ($A1F3). While this value is 08045 ; decremented every TICK, a random frequency value is stored to audio 08046 ; channel 3 and the distortion bit of the shadow control register of audio 08047 ; channel 3 is randomly toggled. 08048 ; 08049 ; (7) Increase audio channels 1/2 frequency 08050 ; 08051 ; The 16-bit frequency value of audio channels 1/2 (both shadow registers 08052 ; and audio registers) is increased every TICK by an increment picked from 08053 ; the currently playing noise sound pattern. 08054 ; 08055 ; (8) Mute audio channels gradually 08056 ; 08057 ; Toward the end of a noise sound pattern's lifetime all audio channels 08058 ; gradually mute their volume every other TICK until completely silent. 08059 08060 ;*** Play beeper sound pattern ************************************************* B2AB A5D6 08061 SOUND LDA BEEPPRIORITY ; Skip if beeper sound pattern not in use B2AD F037 08062 BEQ SKIP185 ; 08063 B2AF C6D8 08064 DEC BEEPLIFE ; Decrement beeper lifetime B2B1 1033 08065 BPL SKIP185 ; Skip if beeper lifetime still counting down 08066 B2B3 A5D9 08067 LDA BEEPTOGGLE ; Load tone/pause toggle B2B5 F00A 08068 BEQ LOOP058 ; Skip if a tone is playing or is to be played 08069 B2B7 A5D5 08070 LDA BEEPPAUSELIFE ; Load pause lifetime B2B9 3006 08071 BMI LOOP058 ; Skip if duration = $FF (no pause) B2BB 85D8 08072 STA BEEPLIFE ; Store pause lifetime as beeper lifetime B2BD A000 08073 LDY #0 ; Prep AUDC4 (zero volume) B2BF F020 08074 BEQ SKIP184 ; Skip unconditionally 08075 B2C1 A5D4 08076 LOOP058 LDA BEEPTONELIFE ; Load tone lifetime B2C3 85D8 08077 STA BEEPLIFE ; Store tone lifetime as beeper lifetime B2C5 A6D2 08078 LDX BEEPFRQIND ; Load frequency index B2C7 E6D2 08079 INC BEEPFRQIND ; Increment frequency index B2C9 BD5CBF 08080 LDA BEEPFRQTAB,X ; Store tone frequency from frequency table in AUDF4 B2CC 8D06D2 08081 STA AUDF4 ; B2CF A0A8 08082 LDY #$A8 ; Prep AUDC4 (tone distortion + medium volume) B2D1 C9FF 08083 CMP #$FF ; Skip if frequency not $FF (there are more tones) B2D3 D00C 08084 BNE SKIP184 ; 08085 B2D5 A5D7 08086 LDA BEEPFRQSTART ; Rewind pattern frequency pointer B2D7 85D2 08087 STA BEEPFRQIND ; B2D9 C6D3 08088 DEC BEEPREPEAT ; Decrement sequence counter B2DB 10E4 08089 BPL LOOP058 ; Keep playing until sequence counter < 0 08090 B2DD A000 08091 LDY #0 ; Prep AUDC4 with zero volume B2DF 84D6 08092 STY BEEPPRIORITY ; Stop playing beeper sound pattern 08093 B2E1 8C07D2 08094 SKIP184 STY AUDC4 ; Store in AUDC4 B2E4 84D9 08095 STY BEEPTOGGLE ; Store in BEEPTOGGLE 08096 08097 ;*** Play ZYLON EXPLOSION noise sound pattern ********************************** B2E6 A5E2 08098 SKIP185 LDA NOISEZYLONTIM ; Skip if ZYLON EXPLOSION timer not in use B2E8 F009 08099 BEQ SKIP186 ; 08100 B2EA C6E2 08101 DEC NOISEZYLONTIM ; Decrement ZYLON EXPLOSION timer B2EC D005 08102 BNE SKIP186 ; Skip if ZYLON EXPLOSION timer still counting down 08103 B2EE A214 08104 LDX #$14 ; Play noise sound pattern ZYLON EXPLOSION B2F0 20A8AE 08105 JSR NOISE ; 08106 08107 ;*** Play our starship's Engines sound ***************************************** B2F3 A670 08108 SKIP186 LDX VELOCITYLO ; Skip if Engines softer than noise sound pattern B2F5 8A 08109 TXA ; B2F6 4A 08110 LSR A ; B2F7 4A 08111 LSR A ; B2F8 4A 08112 LSR A ; B2F9 4A 08113 LSR A ; B2FA 4A 08114 LSR A ; B2FB C5E1 08115 CMP NOISELIFE ; B2FD 902C 08116 BCC SKIP187 ; 08117 B2FF A900 08118 LDA #0 ; Terminate noise sound pattern B301 85E1 08119 STA NOISELIFE ; 08120 B303 E8 08121 INX ; B304 8A 08122 TXA ; A := %abcdefgh = VELOCITYLO + 1 B305 49FF 08123 EOR #$FF ; ________ B307 8D04D2 08124 STA AUDF3 ; AUDF3 := %abcdefgh 08125 B30A AA 08126 TAX ; ________ B30B 0A 08127 ASL A ; AUDF2/1 := %000abcdefgh00000 B30C 0A 08128 ASL A ; B30D 0A 08129 ASL A ; B30E 0A 08130 ASL A ; B30F 0A 08131 ASL A ; B310 8D00D2 08132 STA AUDF1 ; B313 8A 08133 TXA ; B314 4A 08134 LSR A ; B315 4A 08135 LSR A ; B316 4A 08136 LSR A ; B317 8D02D2 08137 STA AUDF2 ; 08138 B31A 4A 08139 LSR A ; AUDC2 := %1000abcd B31B 498F 08140 EOR #$8F ; (noise distortion + B7..B4 bits for volume) B31D 8D03D2 08141 STA AUDC2 ; 08142 B320 2987 08143 AND #$87 ; AUDC3 := %10000bcd B322 8D05D2 08144 STA AUDC3 ; (noise distortion + B6..B4 bits for volume) 08145 B325 A970 08146 LDA #$70 ; Clock audio channel 1 and 3 @ 1.79 MHz and... B327 8D08D2 08147 STA AUDCTL ; ...combine audio channel 1/2 to 16-bit channel 08148 B32A 60 08149 RTS ; Return 08150 08151 ;*** Play ZYLON EXPLOSION or SHIP EXPLOSION noise ****************************** B32B A5DB 08152 SKIP187 LDA NOISEEXPLTIM ; Skip if explosion noise timer not in use B32D F008 08153 BEQ SKIP188 ; 08154 B32F C6DB 08155 DEC NOISEEXPLTIM ; Decrement explosion noise timer (4 or 8 TICKs long) B331 D004 08156 BNE SKIP188 ; Skip if explosion noise timer still counting down 08157 B333 A98F 08158 LDA #$8F ; Shadow register AUDC2 := (noise dist. + max volume) B335 85DC 08159 STA NOISEAUDC2 ; 08160 08161 ;*** Play PHOTON TORPEDO LAUNCHED noise sound ********************************** B337 A6DA 08162 SKIP188 LDX NOISETORPTIM ; Skip if photon torpedo noise timer not in use B339 F01C 08163 BEQ SKIP190 ; 08164 B33B C6DA 08165 DEC NOISETORPTIM ; Decrement photon torpedo noise timer (8 TICKs long) B33D D00A 08166 BNE SKIP189 ; Skip if torpedo noise timer still counting down 08167 B33F A9AF 08168 LDA #$AF ; Shadow register AUDC2 := (tone dist. + max volume) B341 85DC 08169 STA NOISEAUDC2 ; B343 A902 08170 LDA #$02 ; Set frequency $0202 to AUDF1/2's shadow... B345 85DE 08171 STA NOISEAUDF1 ; ...registers B347 85DF 08172 STA NOISEAUDF2 ; 08173 B349 BDEABF 08174 SKIP189 LDA NOISETORPVOLTAB-1,X ; Pick torpedo noise + volume shape (X in 1..8)... B34C 85DD 08175 STA NOISEAUDC3 ; ...and store it in AUDC3's shadow register B34E BDF2BF 08176 LDA NOISETORPFRQTAB-1,X ; Pick photon torpedo noise frequency (X in 1..8)... B351 8D04D2 08177 STA AUDF3 ; ...and store it in AUDF3 B354 8D09D2 08178 STA STIMER ; Reset POKEY audio timers 08179 08180 ;*** Play special explosion noise when our starship is hit ********************* B357 A5E3 08181 SKIP190 LDA NOISEHITLIFE ; Skip if special explosion noise not in use B359 F00E 08182 BEQ SKIP191 ; 08183 B35B C6E3 08184 DEC NOISEHITLIFE ; Decrement special ship explosion noise lifetime B35D AD0AD2 08185 LDA RANDOM ; Set random frequency to AUDF3 B360 8D04D2 08186 STA AUDF3 ; B363 2920 08187 AND #$20 ; Toggle noise/tone dist. of AUDC3's shadow register B365 45DD 08188 EOR NOISEAUDC3 ; ...randomly B367 85DD 08189 STA NOISEAUDC3 ; 08190 08191 ;*** Increase 16-bit frequency of audio channels 1/2 (shadow registers also) *** B369 18 08192 SKIP191 CLC ; Increase 16-bit frequency value of AUDF1/2... B36A A5DE 08193 LDA NOISEAUDF1 ; ...and its shadow register by... B36C 65E0 08194 ADC NOISEFRQINC ; ...noise sound pattern frequency increment B36E 85DE 08195 STA NOISEAUDF1 ; AUDF1/2 := NOISEAUDF1/2 := ... B370 8D00D2 08196 STA AUDF1 ; ...NOISEAUDF1/2 + NOISEFRQINC B373 A5DF 08197 LDA NOISEAUDF2 ; B375 6900 08198 ADC #0 ; B377 85DF 08199 STA NOISEAUDF2 ; B379 8D02D2 08200 STA AUDF2 ; 08201 08202 ;*** Gradually mute audio channels while noise sound pattern expires *********** B37C A6DC 08203 LDX NOISEAUDC2 ; Prep AUDC2's shadow register value B37E A4DD 08204 LDY NOISEAUDC3 ; Prep AUDC3's shadow register value 08205 B380 A572 08206 LDA COUNT8 ; Decrement volumes every other TICK B382 4A 08207 LSR A ; B383 901A 08208 BCC SKIP193 ; 08209 B385 A5E1 08210 LDA NOISELIFE ; Skip if noise sound pattern not in use B387 F016 08211 BEQ SKIP193 ; 08212 B389 C6E1 08213 DEC NOISELIFE ; Decrement noise sound pattern lifetime 08214 B38B C911 08215 CMP #17 ; Mute noise sound pattern only in... B38D B010 08216 BCS SKIP193 ; ...the last 16 TICKs of its lifetime 08217 B38F 8A 08218 TXA ; Decrement volume of AUDC2's shadow register B390 290F 08219 AND #$0F ; B392 F003 08220 BEQ SKIP192 ; B394 CA 08221 DEX ; B395 86DC 08222 STX NOISEAUDC2 ; 08223 B397 98 08224 SKIP192 TYA ; Decrement volume of AUDC3's shadow register B398 290F 08225 AND #$0F ; B39A F003 08226 BEQ SKIP193 ; B39C 88 08227 DEY ; B39D 84DD 08228 STY NOISEAUDC3 ; 08229 B39F 8E03D2 08230 SKIP193 STX AUDC2 ; Store shadow register values to audio registers B3A2 8C05D2 08231 STY AUDC3 ; 08232 B3A5 60 08233 RTS ; Return 08234 08235 ;******************************************************************************* 08236 ;* * 08237 ;* BEEP * 08238 ;* * 08239 ;* Copy beeper sound pattern * 08240 ;* * 08241 ;******************************************************************************* 08242 08243 ; DESCRIPTION 08244 ; 08245 ; Copies a 6-byte beeper sound pattern from beeper sound pattern table 08246 ; BEEPPATTAB ($BF3E) to BEEPFRQIND ($D2)..BEEPFRQSTART ($D7), provided that no 08247 ; beeper sound pattern with higher priority is currently playing. The beeper 08248 ; sound pattern will then be automatically played in subroutine SOUND ($B2AB). 08249 ; See subroutine SOUND ($B2AB) for more information on beeper sound patterns. 08250 ; 08251 ; NOTE: The bytes from table BEEPPATTAB ($BF3E) are copied in reverse order. 08252 ; 08253 ; INPUT 08254 ; 08255 ; X = Offset to beeper sound pattern in table BEEPPATTAB ($BF3E). Used values 08256 ; are: 08257 ; $00 -> HYPERWARP TRANSIT 08258 ; $06 -> RED ALERT 08259 ; $0C -> ACKNOWLEDGE 08260 ; $12 -> DAMAGE REPORT 08261 ; $18 -> MESSAGE FROM STARBASE 08262 B3A6 BD3EBF 08263 BEEP LDA BEEPPATTAB,X ; Return if beeper sound pattern of... B3A9 C5D6 08264 CMP BEEPPRIORITY ; ...higher priority is playing B3AB 900C 08265 BCC SKIP194 ; 08266 B3AD A005 08267 LDY #5 ; Copy 6-byte beeper sound pattern (in reverse order) B3AF BD3EBF 08268 LOOP059 LDA BEEPPATTAB,X ; B3B2 99D200 08269 STA BEEPFRQIND,Y ; B3B5 E8 08270 INX ; B3B6 88 08271 DEY ; B3B7 10F6 08272 BPL LOOP059 ; 08273 B3B9 60 08274 SKIP194 RTS ; Return 08275 08276 ;******************************************************************************* 08277 ;* * 08278 ;* INITIALIZE * 08279 ;* * 08280 ;* More game initialization * 08281 ;* * 08282 ;******************************************************************************* 08283 08284 ; DESCRIPTION 08285 ; 08286 ; This subroutine executes the following initialization steps: 08287 ; 08288 ; (1) Set up Display List 08289 ; 08290 ; A Display List is created at DSPLST ($0280). It starts with 2 x 8 = 16 08291 ; blank video lines, followed by 90 GRAPHICS7 rows. After a deliberate gap 08292 ; in Display List instructions, which will be filled dynamically during the 08293 ; game by calls to subroutine MODDLST ($ADF1), it ends with a Display List 08294 ; wait-and-jump-back instruction to the start of the Display List at DSPLST 08295 ; ($0280). 08296 ; 08297 ; NOTE: The PLAYFIELD color table PFCOLORTAB ($BFA9) is copied to zero-page 08298 ; table PF0COLOR ($F2) by loop jamming. 08299 ; 08300 ; (2) Create lookup tables 08301 ; 08302 ; The first lookup table MAPTO80 ($0DE9) maps a byte value of 0..255 to 08303 ; 0..80. This table is used to map unsigned (absolute) position vector 08304 ; components (coordinates) to pixel (or PLAYER) row and column numbers. 08305 ; 08306 ; NOTE: The PLAYFIELD is 160 pixels wide. Pixel column numbers relative the 08307 ; horizontal PLAYFIELD center are in -80..79, hence the range of this 08308 ; lookup table. Pixel row numbers relative the vertical PLAYFIELD center 08309 ; are in -50..49, thus they also fit in the range of this lookup table. 08310 ; 08311 ; The second lookup table MAPTOBCD99 ($0EE9) maps a byte value of 0..255 to 08312 ; a BCD-encoded value in 00..99. This table is used to convert byte values 08313 ; into decimal 2-digit values displayed by the THETA (in "gradons"), PHI 08314 ; (in "gradons"), RANGE (in "centrons"), and VELOCITY (in "metrons per 08315 ; second") readouts of the Console Panel Display. 08316 ; 08317 ; The third and fourth lookup tables accelerate drawing of PLAYFIELD space 08318 ; objects: In combination they contain the 16-bit start addresses of each 08319 ; of the 100 rows of PLAYFIELD memory. The low bytes of the 16-bit 08320 ; addresses are stored in table PFMEMROWLO ($0800). The high bytes are 08321 ; stored in table PFMEMROWHI ($0864). 08322 ; 08323 ; NOTE: The address increment is 40 (40 bytes = 160 pixels in GRAPHICS7 08324 ; mode = 1 PLAYFIELD row of pixels). 08325 ; 08326 ; NOTE: The PLAYFIELD consists of 90 GRAPHICS7 rows when the Control Panel 08327 ; Display is displayed at the bottom. When the Control Panel Display is not 08328 ; displayed, for example in demo mode, the PLAYFIELD contains additional 08329 ; GRAPHICS7 rows. 08330 ; 08331 ; (3) Copy Control Panel Display and Galactic Chart Panel Display texts 08332 ; 08333 ; The texts of the Control Panel Display and the Galactic Chart Panel 08334 ; Display are copied to their respective locations in memory by loop 08335 ; jamming. 08336 ; 08337 ; (4) Initialize Zylon unit movement timer 08338 ; 08339 ; The timer that triggers the movement of Zylon units in the Galactic Chart 08340 ; is initialized to a value of 99. See subroutine FLUSHGAMELOOP ($B4E4) for 08341 ; more information on Zylon unit movement. 08342 ; 08343 ; (5) Create Galactic Chart 08344 ; 08345 ; The Galactic Chart memory map GCMEMMAP ($08C9) is initialized. It 08346 ; represents 16 columns x 8 rows of sectors. Each sector contains one of 08347 ; the 4 sector types stored in table SECTORTYPETAB ($BBA6) (starbase, 4 08348 ; Zylon ships, 3 Zylon ships, and 2 or 1 Zylon ships), and empty sectors. 08349 ; Before distributing the sector types, the initial position of our 08350 ; starship is blocked on the Galactic Chart at sector row 4, sector column 08351 ; 8, so that it will not be inadvertently occupied while other sector types 08352 ; are distributed. The number of each of the sector types to be distributed 08353 ; is the mission level plus 2. While Zylon units can be placed anywhere, 08354 ; starbases are placed neither at the borders of the Galactic Chart nor in 08355 ; a sector adjacent to an occupied sector. 08356 ; 08357 ; After having initialized the Galactic Chart memory map, the top border of 08358 ; the Galactic Chart is drawn with characters from the custom character 08359 ; set. 08360 ; 08361 ; Finally, the sector in which our starship is located and the arrival and 08362 ; departure hyperwarp marker column and row numbers are initialized. 08363 ; 08364 ; (6) Apply a final tweak 08365 ; 08366 ; The last entry of lookup table MAPTOBCD99 ($0EE9) is tweaked to a value 08367 ; of CCS.INF * 16 + CCS.SPC. It is used to display an infinity symbol by 08368 ; the RANGE readout of the Control Panel Display in subroutine SHOWCOORD 08369 ; ($B8A7). 08370 ; 08371 ; Code execution continues into subroutine DRAWGC ($B4B9), which draws the 08372 ; content of the Galactic Chart with characters from the custom character set. 08373 =0068 08374 L.MEMPTR1 = $68 ; 16-bit memory pointer =006A 08375 L.MEMPTR2 = $6A ; 16-bit memory pointer =006A 08376 L.SECTORTYPE = $6A ; Saves sector type. Used values are: 08377 ; $CF -> Sector contains starbase 08378 ; $04 -> Sector contains 4 Zylon ships 08379 ; $03 -> Sector contains 3 Zylon ships 08380 ; $02 -> Sector contains 2 or 1 Zylon ships =006B 08381 L.SECTORCNT = $6B ; Saves number of sectors of the current sector type 08382 08383 ;*** Initialize Display List and copy color table ****************************** B3BA A259 08384 INITIALIZE LDX #89 ; Set 89(+1) GRAPHICS7 rows from DSPLST+5 on B3BC A90D 08385 LOOP060 LDA #$0D ; Prep DL instruction $0D (one row of GRAPHICS7) B3BE 9D8502 08386 STA DSPLST+5,X ; DSPLST+5,X := one row of GRAPHICS7 B3C1 E00A 08387 CPX #10 ; B3C3 B005 08388 BCS SKIP195 ; B3C5 BDA9BF 08389 LDA PFCOLORTAB,X ; Copy PLAYFIELD color table to zero-page table B3C8 95F2 08390 STA PF0COLOR,X ; (loop jamming) B3CA CA 08391 SKIP195 DEX ; B3CB 10EF 08392 BPL LOOP060 ; 08393 B3CD A970 08394 LDA #$70 ; DSPLST := BLK8 B3CF 8D8002 08395 STA DSPLST ; DSPLST+1 := BLK8 B3D2 8D8102 08396 STA DSPLST+1 ; B3D5 A941 08397 LDA #$41 ; DSPLST+103 := WAITJMP @ DSPLST B3D7 8DE702 08398 STA DSPLST+103 ; B3DA A980 08399 LDA #<DSPLST ; B3DC 8DE802 08400 STA DSPLST+104 ; B3DF A902 08401 LDA #>DSPLST ; B3E1 8DE902 08402 STA DSPLST+105 ; 08403 08404 ;*** Calculate lookup tables *************************************************** B3E4 A200 08405 LDX #0 ; Clear both 16-bit memory pointers B3E6 8668 08406 STX L.MEMPTR1 ; B3E8 8669 08407 STX L.MEMPTR1+1 ; B3EA 866A 08408 STX L.MEMPTR2 ; B3EC 866B 08409 STX L.MEMPTR2+1 ; 08410 08411 ;*** Calc MAPTO80 map (converts value of $00..$FF to value in 0..80) *********** B3EE 18 08412 LOOP061 CLC ; B3EF A568 08413 LDA L.MEMPTR1 ; B3F1 6951 08414 ADC #81 ; B3F3 8568 08415 STA L.MEMPTR1 ; B3F5 A569 08416 LDA L.MEMPTR1+1 ; B3F7 9DE90D 08417 STA MAPTO80,X ; B3FA 6900 08418 ADC #0 ; B3FC 8569 08419 STA L.MEMPTR1+1 ; 08420 08421 ;*** Calc MAPTOBCD99 map (converts value of $00..$FF to BCD-value in 00..99) *** B3FE 18 08422 CLC ; B3FF A56A 08423 LDA L.MEMPTR2 ; B401 6964 08424 ADC #100 ; B403 856A 08425 STA L.MEMPTR2 ; B405 A56B 08426 LDA L.MEMPTR2+1 ; B407 9DE90E 08427 STA MAPTOBCD99,X ; B40A F8 08428 SED ; B40B 6900 08429 ADC #0 ; B40D D8 08430 CLD ; B40E 856B 08431 STA L.MEMPTR2+1 ; B410 E8 08432 INX ; B411 D0DB 08433 BNE LOOP061 ; 08434 08435 ;*** Calculate PLAYFIELD memory row addresses, copy Panel Display texts ******** B413 A200 08436 LDX #<PFMEM ; Point L.MEMPTR1 to start of PLAYFIELD memory B415 8668 08437 STX L.MEMPTR1 ; (X = 0, because PFMEM is at $1000) B417 A910 08438 LDA #>PFMEM ; B419 8569 08439 STA L.MEMPTR1+1 ; 08440 B41B 18 08441 LOOP062 CLC ; B41C A568 08442 LDA L.MEMPTR1 ; B41E 9D0008 08443 STA PFMEMROWLO,X ; Store 16-bit value of L.MEMPTR1 in PFMEMROWHI/LO B421 6928 08444 ADC #40 ; Add 40 to L.MEMPTR B423 8568 08445 STA L.MEMPTR1 ; (40 bytes = 160 pixels = 1 PLAYFIELD row) B425 A569 08446 LDA L.MEMPTR1+1 ; B427 9D6408 08447 STA PFMEMROWHI,X ; B42A 6900 08448 ADC #0 ; B42C 8569 08449 STA L.MEMPTR1+1 ; 08450 B42E BD42BB 08451 LDA PANELTXTTAB,X ; Copy Control and Galactic Chart Panel Display texts B431 9D4909 08452 STA PANELTXT,X ; (loop jamming) 08453 B434 E8 08454 INX ; B435 E064 08455 CPX #100 ; B437 90E2 08456 BCC LOOP062 ; Loop 100 times 08457 08458 ;*** Set Zylon unit movement timer ********************************************* B439 CA 08459 DEX ; B43A 8678 08460 STX ZYLONUNITTIM ; Init Zylon unit movement timer to 99 game loops 08461 08462 ;*** Create memory map of the Galactic Chart *********************************** B43C A203 08463 LDX #3 ; Loop over all 3(+1) sector types B43E 8E1109 08464 STX GCMEMMAP+4*16+8 ; Block our starship's initial position at center of 08465 ; ...Galactic Chart (sector row 4, sector column 8) 08466 B441 BDA6BB 08467 LOOP063 LDA SECTORTYPETAB,X ; Prep sector type B444 856A 08468 STA L.SECTORTYPE ; 08469 B446 A462 08470 LDY MISSIONLEVEL ; Number sectors of current type := mission level + 2 B448 C8 08471 INY ; B449 C8 08472 INY ; B44A 846B 08473 STY L.SECTORCNT ; 08474 B44C AD0AD2 08475 LOOP064 LDA RANDOM ; Load random sector 0..127 from GC memory map B44F 297F 08476 AND #$7F ; B451 A8 08477 TAY ; B452 B9C908 08478 LDA GCMEMMAP,Y ; B455 D0F5 08479 BNE LOOP064 ; If sector already occupied, pick another 08480 B457 A56A 08481 LDA L.SECTORTYPE ; Reload sector type B459 1021 08482 BPL SKIP196 ; Skip if sector not to be occupied by starbase 08483 B45B C010 08484 CPY #$10 ; Place starbase... B45D 90ED 08485 BCC LOOP064 ; ...not in first sector row of Galactic Chart B45F C070 08486 CPY #$70 ; B461 B0E9 08487 BCS LOOP064 ; ...not in last sector row of Galactic Chart B463 98 08488 TYA ; B464 290F 08489 AND #$0F ; B466 F0E4 08490 BEQ LOOP064 ; ...not in first sector column of Galactic Chart B468 C90F 08491 CMP #15 ; B46A F0E0 08492 BEQ LOOP064 ; ...not in last sector column of Galactic Chart B46C B9C808 08493 LDA GCMEMMAP-1,Y ; ...not east of an occupied sector B46F 19CA08 08494 ORA GCMEMMAP+1,Y ; ...not west of an occupied sector B472 19D908 08495 ORA GCMEMMAP+16,Y ; ...not south of an occupied sector B475 19B908 08496 ORA GCMEMMAP-16,Y ; ...not north of an occupied sector B478 D0D2 08497 BNE LOOP064 ; 08498 B47A A56A 08499 LDA L.SECTORTYPE ; Reload sector type 08500 B47C 99C908 08501 SKIP196 STA GCMEMMAP,Y ; Store sector type in Galactic Chart memory map B47F C66B 08502 DEC L.SECTORCNT ; B481 10C9 08503 BPL LOOP064 ; Next sector B483 CA 08504 DEX ; B484 10BB 08505 BPL LOOP063 ; Next sector type 08506 08507 ;*** Clear Galactic Chart and draw top border ********************************** B486 A2B4 08508 LDX #180 ; Clear Galactic Chart PLAYFIELD B488 A90A 08509 LOOP065 LDA #CCS.SPC ; B48A 9D340D 08510 STA GCPFMEM-1,X ; B48D CA 08511 DEX ; B48E D0F8 08512 BNE LOOP065 ; 08513 B490 A20F 08514 LDX #15 ; Draw top border (15(+1) characters) B492 A918 08515 LOOP066 LDA #CCS.BORDERS ; B494 9D370D 08516 STA GCPFMEM+2,X ; B497 CA 08517 DEX ; B498 10F8 08518 BPL LOOP066 ; 08519 B49A A91A 08520 LDA #CCS.CORNERSW ; Draw NORTHEAST corner (1 character) B49C 8D470D 08521 STA GCPFMEM+18 ; 08522 B49F A900 08523 LDA #0 ; Release starship's position at center of Galactic B4A1 8D1109 08524 STA GCMEMMAP+4*16+8 ; ...Chart (sector row 4, sector column 8) 08525 08526 ;*** Initialize current sector and hyperwarp marker column and row numbers ***** B4A4 A948 08527 LDA #$48 ; Place our starship's current sector at B4A6 8590 08528 STA CURRSECTOR ; ...sector row 4, sector column 8 B4A8 A943 08529 LDA #$43 ; Init departure & arrival hyperwarp marker column B4AA 858D 08530 STA WARPDEPRCOLUMN ; B4AC 858F 08531 STA WARPARRVCOLUMN ; B4AE A947 08532 LDA #$47 ; Init departure & arrival hyperwarp marker row B4B0 858E 08533 STA WARPARRVROW ; B4B2 858C 08534 STA WARPDEPRROW ; 08535 08536 ;*** Tweak last entry of MAPTOBCD99 ******************************************** B4B4 A9EA 08537 LDA #CCS.INF*16+CCS.SPC ; Last entry of MAPTOBCD99: 'INFINITY'+'SPACE' char B4B6 8DE80F 08538 STA MAPTOBCD99+255 ; 08539 08540 ;******************************************************************************* 08541 ;* * 08542 ;* DRAWGC * 08543 ;* * 08544 ;* Draw Galactic Chart * 08545 ;* * 08546 ;******************************************************************************* 08547 08548 ; DESCRIPTION 08549 ; 08550 ; Draws the content of the Galactic Chart memory map in GCMEMMAP ($08C9) to the 08551 ; Galactic Chart PLAYFIELD memory at GCPFMEM ($0D35). 08552 ; 08553 ; NOTE: CPU register X indexes the Galactic Chart memory map GCMEMMAP ($08C9) 08554 ; (16 x 8 bytes). CPU register Y indexes the Galactic Chart PLAYFIELD memory 08555 ; GCPFMEM ($0D35) (20 x 9 bytes). 08556 ; 08557 ; NOTE: Sectors with 1 or 2 Zylon ships display the same symbol in the Galactic 08558 ; Chart. 08559 =006A 08560 L.GCMEMMAPIND = $6A ; Saves Galactic Chart memory map index 08561 B4B9 A000 08562 DRAWGC LDY #0 ; Clear Galactic Chart PLAYFIELD memory index B4BB 846A 08563 STY L.GCMEMMAPIND ; Clear Galactic Chart memory map index 08564 B4BD A66A 08565 LOOP067 LDX L.GCMEMMAPIND ; Load sector of Galactic Chart memory map B4BF BDC908 08566 LDA GCMEMMAP,X ; B4C2 1002 08567 BPL SKIP197 ; Skip if not a starbase sector B4C4 A905 08568 LDA #5 ; Prep sector character index for starbase 08569 B4C6 AA 08570 SKIP197 TAX ; Load sector character index B4C7 BDD1BE 08571 LDA SECTORCHARTAB,X ; Load custom character set code from table... B4CA 994B0D 08572 STA GCPFMEM+22,Y ; ...and store it in Galactic Chart PLAYFIELD memory B4CD C8 08573 INY ; Increment Galactic Chart PLAYFIELD memory index B4CE E66A 08574 INC L.GCMEMMAPIND ; Increment Galactic Chart memory map index B4D0 A56A 08575 LDA L.GCMEMMAPIND ; B4D2 290F 08576 AND #$0F ; B4D4 D0E7 08577 BNE LOOP067 ; Next sector column until right border reached 08578 B4D6 A919 08579 LDA #CCS.BORDERW ; Draw right border B4D8 994B0D 08580 STA GCPFMEM+22,Y ; 08581 B4DB C8 08582 INY ; Adjust Galactic Chart PLAYFIELD memory index B4DC C8 08583 INY ; B4DD C8 08584 INY ; B4DE C8 08585 INY ; B4DF C0A0 08586 CPY #$A0 ; B4E1 90DA 08587 BCC LOOP067 ; Next sector until bottom-right sector reached 08588 B4E3 60 08589 RTS ; Return 08590 08591 ;******************************************************************************* 08592 ;* * 08593 ;* FLUSHGAMELOOP * 08594 ;* * 08595 ;* Handle remaining tasks at the end of a game loop iteration * 08596 ;* * 08597 ;******************************************************************************* 08598 08599 ; DESCRIPTION 08600 ; 08601 ; This subroutine handles at the end of a game loop iteration the following 08602 ; tasks: 08603 ; 08604 ; (1) Increment counters COUNT256 ($76) and COUNT8 ($72). 08605 ; 08606 ; (2) If our starship's energy has dropped below 1000 units then flash a {PINK} 08607 ; alert that changes to {DARK GREY BLUE} and back to {PINK} every 128 game 08608 ; loop iterations. 08609 ; 08610 ; (3) Set the Shields color and the Control Panel background color every 8 game 08611 ; loop iterations: 08612 ; 08613 ; o If the Shields are up and OK then set the Shields color to {DARK 08614 ; GREEN} and the Control Panel background color to {DARK BLUE}. 08615 ; 08616 ; o If the Shields are up and damaged there is a probability of 78% 08617 ; (200:256) that the Shield color is not changed. 08618 ; 08619 ; o If the Shields are down, damaged, or destroyed then set the Shields 08620 ; color to {BLACK}. 08621 ; 08622 ; o If the Shields are destroyed then set the Control Panel background 08623 ; color to {ORANGE}. 08624 ; 08625 ; (4) Decrement the lifetime of our starship's and Zylon photon torpedoes. 08626 ; 08627 ; (5) Decrement the lifetime of an explosion. If the explosion lifetime is less 08628 ; than 112 game loop iterations, clear HITBADNESS ($8A) (thus the explosion 08629 ; cannot destroy our starship). If the explosion lifetime is less than 24 08630 ; (?) game loops decrement the number of explosion fragments. This makes 08631 ; explosion fragments disappear gradually toward the end of an explosion. 08632 ; 08633 ; (6) Increment every 40 game loop iterations the stardate clock of the 08634 ; Galactic Chart Panel Display. 08635 ; 08636 ; (7) Move Zylon units in the Galactic Chart. 08637 ; 08638 ; Every 50 game loop iterations (or 100 game loop iterations when a 08639 ; starbase is surrounded by Zylon units) decrement the score. 08640 ; 08641 ; Code execution continues if the program is not in demo mode with the following 08642 ; steps: 08643 ; 08644 ; (1) Search the Galactic Chart for starbases surrounded by Zylon units. 08645 ; Destroy any such starbase: Replace it with a 2-Zylon sector and subtract 08646 ; 18 points from the score. If the Subspace Radio was not destroyed, then 08647 ; flash the title phrase "STARBASE DESTROYED" and play the beeper sound 08648 ; pattern MESSAGE FROM STARBASE in subroutine BEEP ($B3A6). 08649 ; 08650 ; (2) Every 8 game loop iterations the Zylon units decide, which starbase to 08651 ; hunt: First, 128 randomly picked sectors are searched for a starbase. If 08652 ; no starbase was found in this way, the sectors of the Galactic Chart are 08653 ; scanned systematically left-to-right, top-to-bottom. If a starbase was 08654 ; found then its sector, sector column, and sector row are saved, otherwise 08655 ; code execution returns. 08656 ; 08657 ; (3) Now the Zylon units converge toward the sector of the hunted starbase: 08658 ; All sectors of the Galactic Chart are scanned. For any sector with a 08659 ; Zylon unit that was not moved yet (its sector does not have the temporary 08660 ; "already-moved" bit B5 set) its movement probability value is picked from 08661 ; table MOVEPROBTAB ($BFBB): 08662 ; 08663 ; +---------------+-------------+----------------+ 08664 ; | Sector Type | Movement | Movement | 08665 ; | | Probability | Probability | 08666 ; | | Value | | 08667 ; +---------------+-------------+----------------+ 08668 ; | Empty sector | 0 | 0% ( 0:256) | 08669 ; | 1 Zylon ship | 255 | 100% (255:256) | 08670 ; | 2 Zylon ships | 255 | 100% (255:256) | 08671 ; | 3 Zylon ships | 192 | 75% (192:256) | 08672 ; | 4 Zylon ships | 32 | 13% ( 32:256) | 08673 ; +---------------+-------------+----------------+ 08674 ; 08675 ; If this value is less or equal than a random number in 0..255 then the 08676 ; Zylon unit is moved to another sector. A Zylon unit that currently 08677 ; occupies the sector of our starship is not moved. 08678 ; 08679 ; BUG (at $B620): The instruction to check the marker bit B5 of the sector 08680 ; is CPY #$0A. This works, as sectors containing Zylon units that need to 08681 ; be moved have values of 2..4, see table SECTORTYPETAB ($BBA6). Suggested 08682 ; fix: Replace CPY #$0A with CPY #$20, which may make the code clearer. 08683 ; 08684 ; (4) For every Zylon unit that is about to be moved, 9 distances ("block 08685 ; distances") between the Zylon unit and the starbase are calculated by 08686 ; tentatively moving the Zylon unit into each of its 8 adjacent sectors - 08687 ; and by moving it not at all. The sector offsets are taken from table 08688 ; COMPASSOFFTAB ($BFC0) which stores direction offsets in the following 08689 ; order: NORTH, NORTHWEST, WEST, SOUTHWEST, SOUTH, SOUTHEAST, EAST, 08690 ; NORTHEAST, CENTER. All 9 distances are stored in 9 consecutive bytes at 08691 ; NEWZYLONDIST ($96). 08692 ; 08693 ; NOTE: The last calculated distance is the current distance between Zylon 08694 ; unit and starbase. 08695 ; 08696 ; The Zylon unit moves to the first of the 8 adjacent sectors that matches 08697 ; the following conditions: 08698 ; 08699 ; (1) It is closer to the starbase than the Zylon unit's current sector. 08700 ; 08701 ; (2) It is located inside the Galactic Chart. 08702 ; 08703 ; (3) It is empty. 08704 ; 08705 ; (4) It is not the sector containing our starship. 08706 ; 08707 ; If a suitable new sector was found then the Zylon unit is moved to this 08708 ; sector, which is marked with the "already-moved" marker bit B5 in the 08709 ; Galactic Chart memory map. This marker bit prevents a Zylon unit that has 08710 ; been already moved from being moved again. The old Zylon unit sector is 08711 ; cleared. 08712 ; 08713 ; If no suitable new sector was found then the above distance calculations 08714 ; are repeated once again by adding 1 to the current distance between the 08715 ; Zylon unit and the starbase. This may provoke a Zylon unit to move that 08716 ; would not have moved in the previous set of distance calculations. 08717 ; 08718 ; After having moved all Zylon units the sectors are stripped of the 08719 ; "already-moved" marker bit B5. 08720 ; 08721 ; (5) If a starbase has been surrounded then the Zylon unit movement timer is 08722 ; reset to 99, buying our starship some time to destroy one of the 08723 ; surrounding Zylon units. If the Subspace Radio is not destroyed, then the 08724 ; message "STARBASE SURROUNDED" is flashed in the title line and the beeper 08725 ; sound pattern MESSAGE FROM STARBASE is played in subroutine BEEP ($B3A6). 08726 =006A 08727 L.ISDESTROYED = $6A ; Flags the destruction of a starbase. 08728 ; Used values are: 08729 ; $00 -> Starbase not destroyed 08730 ; $02 -> Starbase has been destroyed =006A 08731 L.NEWSECTOR = $6A ; Sector to which the Zylon unit is tentatively moved =006B 08732 L.ABSDIFFCOL = $6B ; Absolute difference between new Zylon and starbase 08733 ; column on Galactic Chart in PM pixels =006B 08734 L.LOOPCNT2 = $6B ; Loop counter. Used values are: 0..1. =006A 08735 L.DIRECTIONIND = $6A ; Compass rose direction index. 08736 ; Used values are: 0..7. 08737 08738 ;*** Increment counters and flash low-energy alert ***************************** B4E4 E676 08739 FLUSHGAMELOOP INC COUNT256 ; Increment COUNT256 counter 08740 B4E6 A290 08741 LDX #$90 ; Prep DLI background color {DARK GREY BLUE} B4E8 A576 08742 LDA COUNT256 ; B4EA 1009 08743 BPL SKIP198 ; Skip if counter < 128. 08744 B4EC AC5509 08745 LDY ENERGYD1 ; When energy drops below 1000 units... B4EF C080 08746 CPY #CCS.COL2!CCS.0 ; B4F1 D002 08747 BNE SKIP198 ; B4F3 A244 08748 LDX #$44 ; ...prep new DLI background color {PINK} 08749 B4F5 2903 08750 SKIP198 AND #$03 ; Increment COUNT8 B4F7 8572 08751 STA COUNT8 ; B4F9 D01F 08752 BNE SKIP202 ; Skip setting colors but every 8 game loops 08753 08754 ;*** Set Shields and Control Panel background color **************************** B4FB A47D 08755 LDY ISSHIELDSON ; Skip if Shields are off B4FD F017 08756 BEQ SKIP201 ; 08757 B4FF A0A0 08758 LDY #$A0 ; Prep Shields color {DARK GREEN} B501 2C9409 08759 BIT GCSTATSHL ; Skip if Shields are OK B504 100B 08760 BPL SKIP200 ; B506 7007 08761 BVS SKIP199 ; Skip if Shields are destroyed B508 AD0AD2 08762 LDA RANDOM ; If Shields are damaged, Shields colors are... B50B C9C8 08763 CMP #200 ; ...unchanged with probability of 78% (200:256) B50D 9007 08764 BCC SKIP201 ; 08765 B50F A000 08766 SKIP199 LDY #$00 ; Prep Shields color {BLACK} B511 98 08767 SKIP200 TYA ; B512 D002 08768 BNE SKIP201 ; 08769 B514 A226 08770 LDX #$26 ; Prep Control Panel background color {ORANGE} 08771 B516 8481 08772 SKIP201 STY SHIELDSCOLOR ; Store Shields color B518 86FB 08773 STX BGRCOLORDLI ; Store Control Panel background color 08774 08775 ;*** Decrement lifetime of our starship's and Zylon photon torpedoes *********** B51A A202 08776 SKIP202 LDX #2 ; Loop over PLAYER2..4 08777 B51C BD8E0C 08778 LOOP068 LDA PL2SHAPTYPE,X ; Next PLAYER if not PHOTON TORPEDO (shape type 0) B51F D006 08779 BNE SKIP203 ; 08780 B521 B5EB 08781 LDA PL2LIFE,X ; Next PLAYER if this PLAYER not alive B523 F002 08782 BEQ SKIP203 ; 08783 B525 D6EB 08784 DEC PL2LIFE,X ; Decrement photon torpedo PLAYER lifetime 08785 B527 CA 08786 SKIP203 DEX ; B528 10F2 08787 BPL LOOP068 ; Next PLAYER 08788 08789 ;*** Decrement lifetime of explosion ******************************************* B52A A573 08790 LDA EXPLLIFE ; Skip if explosion lifetime expired B52C F016 08791 BEQ SKIP206 ; 08792 B52E C673 08793 DEC EXPLLIFE ; Decrement explosion lifetime B530 D004 08794 BNE SKIP204 ; Skip if explosion lifetime still counting 08795 B532 A211 08796 LDX #MAXSPCOBJIND.NL+1 ; Explosion finished,... B534 8679 08797 STX MAXSPCOBJIND ; ...restore normal number of space objects 08798 B536 C970 08799 SKIP204 CMP #112 ; Skip if explosion lifetime >= 112 game loops B538 B004 08800 BCS SKIP205 ; 08801 B53A A200 08802 LDX #0 ; HITBADNESS := NO HIT B53C 868A 08803 STX HITBADNESS ; 08804 B53E C918 08805 SKIP205 CMP #24 ; Skip if explosion lifetime >= 24 game loops (?) B540 B002 08806 BCS SKIP206 ; 08807 B542 C679 08808 DEC MAXSPCOBJIND ; Decrement number of explosion fragment space objs 08809 08810 ;*** Increment stardate clock ************************************************** B544 C674 08811 SKIP206 DEC CLOCKTIM ; Decrement stardate clock timer B546 1021 08812 BPL SKIP209 ; Return if timer is still counting 08813 B548 A928 08814 LDA #40 ; Reset stardate clock timer to 40 game loops B54A 8574 08815 STA CLOCKTIM ; 08816 B54C A204 08817 LDX #4 ; Increment stardate clock of Galactic Chart Panel B54E FEA309 08818 LOOP069 INC GCSTARDAT,X ; B551 BDA309 08819 LDA GCSTARDAT,X ; B554 C9DA 08820 CMP #[CCS.COL3!ROM.9]+1 ; B556 900D 08821 BCC SKIP208 ; B558 A9D0 08822 LDA #[CCS.COL3!ROM.0] ; B55A 9DA309 08823 STA GCSTARDAT,X ; B55D E003 08824 CPX #3 ; B55F D001 08825 BNE SKIP207 ; B561 CA 08826 DEX ; B562 CA 08827 SKIP207 DEX ; B563 10E9 08828 BPL LOOP069 ; 08829 08830 ;*** Decrement Zylon unit movement timer *************************************** B565 C678 08831 SKIP208 DEC ZYLONUNITTIM ; Decrement Zylon unit movement timer B567 3001 08832 BMI SKIP210 ; If timer < 0 move Zylon units 08833 B569 60 08834 SKIP209 RTS ; Return 08835 08836 ;*** Restore Zylon unit movement timer and decrement score ********************* B56A A931 08837 SKIP210 LDA #49 ; Reset Zylon unit movement timer to 49 B56C 8578 08838 STA ZYLONUNITTIM ; 08839 B56E A5CB 08840 LDA SCORE ; SCORE := SCORE - 1 B570 D002 08841 BNE SKIP211 ; B572 C6CC 08842 DEC SCORE+1 ; B574 C6CB 08843 SKIP211 DEC SCORE ; 08844 B576 A664 08845 LDX ISDEMOMODE ; Return if in demo mode B578 D0EF 08846 BNE SKIP209 ; 08847 08848 ;*** Is starbase surrounded? *************************************************** B57A 866A 08849 STX L.ISDESTROYED ; Init L.ISDESTROYED with 0 (starbase not destroyed) B57C BDC908 08850 LOOP070 LDA GCMEMMAP,X ; Loop over all sectors, load sector type B57F 1019 08851 BPL SKIP212 ; Skip if not a starbase sector 08852 B581 20F1B7 08853 JSR ISSURROUNDED ; Skip if starbase sector not completely surrounded B584 F014 08854 BEQ SKIP212 ; 08855 08856 ;*** Starbase is surrounded, destroy starbase ********************************** B586 A902 08857 LDA #2 ; Replace starbase sector with 2-Zylon sector B588 9DC908 08858 STA GCMEMMAP,X ; B58B 856A 08859 STA L.ISDESTROYED ; Flag destruction of starbase 08860 B58D 38 08861 SEC ; SCORE := SCORE - 18 B58E A5CB 08862 LDA SCORE ; B590 E912 08863 SBC #18 ; B592 85CB 08864 STA SCORE ; B594 A5CC 08865 LDA SCORE+1 ; B596 E900 08866 SBC #0 ; B598 85CC 08867 STA SCORE+1 ; 08868 B59A E8 08869 SKIP212 INX ; B59B 10DF 08870 BPL LOOP070 ; Next sector 08871 08872 ;*** Report starbase destruction *********************************************** B59D A56A 08873 LDA L.ISDESTROYED ; Skip if no starbase has been destroyed B59F F00F 08874 BEQ SKIP213 ; 08875 B5A1 2C9709 08876 BIT GCSTATRAD ; Skip notification if Subspace Radio destroyed B5A4 700A 08877 BVS SKIP213 ; 08878 B5A6 A015 08879 LDY #$15 ; Set title phrase "STARBASE DESTROYED" B5A8 2023B2 08880 JSR SETTITLE ; 08881 B5AB A218 08882 LDX #$18 ; Play beeper sound pattern MESSAGE FROM STARBASE B5AD 20A6B3 08883 JSR BEEP ; 08884 08885 ;*** Pick new starbase to be hunted by Zylon units ***************************** B5B0 C69F 08886 SKIP213 DEC HUNTTIM ; Decrement hunting timer B5B2 3007 08887 BMI SKIP214 ; If timer < 0 decide which starbase to hunt 08888 B5B4 A693 08889 LDX HUNTSECTOR ; Skip if Zylon units already picked starbase to hunt B5B6 BDC908 08890 LDA GCMEMMAP,X ; B5B9 301F 08891 BMI SKIP215 ; 08892 B5BB A907 08893 SKIP214 LDA #7 ; Reset hunting timer B5BD 859F 08894 STA HUNTTIM ; 08895 B5BF A07F 08896 LDY #127 ; Loop over 127(+1) randomly picked sectors B5C1 AD0AD2 08897 LOOP071 LDA RANDOM ; B5C4 297F 08898 AND #$7F ; B5C6 AA 08899 TAX ; B5C7 BDC908 08900 LDA GCMEMMAP,X ; Skip if starbase sector found B5CA 300E 08901 BMI SKIP215 ; B5CC 88 08902 DEY ; B5CD 10F2 08903 BPL LOOP071 ; Next sector 08904 B5CF A27F 08905 LDX #127 ; Loop over all sectors of the Galactic Chart B5D1 BDC908 08906 LOOP072 LDA GCMEMMAP,X ; B5D4 3004 08907 BMI SKIP215 ; Skip if starbase sector found B5D6 CA 08908 DEX ; B5D7 10F8 08909 BPL LOOP072 ; Next sector 08910 B5D9 60 08911 RTS ; Return (no starbase sector found) 08912 08913 ;*** Store coordinates of starbase to be hunted ******************************** B5DA 8693 08914 SKIP215 STX HUNTSECTOR ; Store hunted starbase sector column and row B5DC 8A 08915 TXA ; B5DD 290F 08916 AND #$0F ; B5DF 8594 08917 STA HUNTSECTCOLUMN ; B5E1 8A 08918 TXA ; B5E2 4A 08919 LSR A ; B5E3 4A 08920 LSR A ; B5E4 4A 08921 LSR A ; B5E5 4A 08922 LSR A ; B5E6 8595 08923 STA HUNTSECTROW ; 08924 08925 ;*** Move all Zylon units toward hunted starbase ******************************* B5E8 A2FF 08926 LDX #$FF ; B5EA E8 08927 LOOP073 INX ; Loop over all sectors to move Zylon units B5EB 1030 08928 BPL SKIP218 ; Jump into loop body below 08929 08930 ;*** Strip marker bits from moved Zylon units ********************************** B5ED A200 08931 LDX #0 ; B5EF BDC908 08932 LOOP074 LDA GCMEMMAP,X ; Loop over all sectors B5F2 29DF 08933 AND #$DF ; B5F4 9DC908 08934 STA GCMEMMAP,X ; Strip marker bit B5 from moved Zylon units B5F7 E8 08935 INX ; B5F8 10F5 08936 BPL LOOP074 ; Next sector 08937 08938 ;*** Handle surrounded starbase ************************************************ B5FA 2C9709 08939 BIT GCSTATRAD ; Return if Subspace Radio is destroyed B5FD 701D 08940 BVS SKIP217 ; 08941 B5FF A200 08942 LDX #0 ; Loop over all sectors B601 BDC908 08943 LOOP075 LDA GCMEMMAP,X ; B604 1013 08944 BPL SKIP216 ; Skip if not a starbase sector B606 20F1B7 08945 JSR ISSURROUNDED ; Skip if starbase not surrounded B609 F00E 08946 BEQ SKIP216 ; 08947 B60B A963 08948 LDA #99 ; Yes, starbase surrounded... B60D 8578 08949 STA ZYLONUNITTIM ; ...set Zylon unit movement timer to 99 08950 B60F A013 08951 LDY #$13 ; Set title phrase "STARBASE SURROUNDED" B611 2023B2 08952 JSR SETTITLE ; 08953 B614 A218 08954 LDX #$18 ; Play beeper sound pattern MESSAGE FROM STARBASE... B616 4CA6B3 08955 JMP BEEP ; ...and return 08956 B619 E8 08957 SKIP216 INX ; B61A 10E5 08958 BPL LOOP075 ; Next sector 08959 B61C 60 08960 SKIP217 RTS ; Return 08961 08962 ;*** Move single Zylon unit **************************************************** B61D BCC908 08963 SKIP218 LDY GCMEMMAP,X ; X contains current sector B620 C00A 08964 CPY #$0A ; Next sector if it has marker bit B5 set (!) B622 B0C6 08965 BCS LOOP073 ; 08966 B624 AD0AD2 08967 LDA RANDOM ; Get random number B627 D9BBBF 08968 CMP MOVEPROBTAB,Y ; Get movement probability B62A B0BE 08969 BCS LOOP073 ; Next sector if movement probability < random number 08970 B62C E490 08971 CPX CURRSECTOR ; Next sector if this is our starship's sector B62E F0BA 08972 BEQ LOOP073 ; 08973 08974 ;*** Compute distance to starbase by moving Zylon unit into 9 directions ******* B630 A008 08975 LDY #8 ; Loop over 8(+1) possible directions B632 18 08976 LOOP076 CLC ; B633 8A 08977 TXA ; B634 79C0BF 08978 ADC COMPASSOFFTAB,Y ; Add direction offset to current sector B637 856A 08979 STA L.NEWSECTOR ; Store new sector 08980 B639 290F 08981 AND #$0F ; Calc distance ("block distance") between... B63B 38 08982 SEC ; ...starbase sector and tentative new Zylon sector B63C E594 08983 SBC HUNTSECTCOLUMN ; B63E B004 08984 BCS SKIP219 ; B640 49FF 08985 EOR #$FF ; B642 6901 08986 ADC #1 ; B644 856B 08987 SKIP219 STA L.ABSDIFFCOL ; B646 A56A 08988 LDA L.NEWSECTOR ; B648 4A 08989 LSR A ; B649 4A 08990 LSR A ; B64A 4A 08991 LSR A ; B64B 4A 08992 LSR A ; B64C 38 08993 SEC ; B64D E595 08994 SBC HUNTSECTROW ; B64F B004 08995 BCS SKIP220 ; B651 49FF 08996 EOR #$FF ; B653 6901 08997 ADC #1 ; B655 18 08998 SKIP220 CLC ; B656 656B 08999 ADC L.ABSDIFFCOL ; 09000 B658 999600 09001 STA NEWZYLONDIST,Y ; Store distance in distance array B65B 88 09002 DEY ; B65C 10D4 09003 BPL LOOP076 ; Next direction 09004 09005 ;*** Pick the shortest distance to starbase ************************************ B65E A901 09006 LDA #1 ; Loop over compass rose directions twice to... B660 856B 09007 STA L.LOOPCNT2 ; ...provoke movement regardless of truncation errors 09008 B662 A007 09009 LOOP077 LDY #7 ; B664 B99600 09010 LOOP078 LDA NEWZYLONDIST,Y ; Loop over all 7(+1) compass rose directions B667 C59E 09011 CMP OLDZYLONDIST ; B669 B024 09012 BCS SKIP222 ; Next direction if new distance > current distance 09013 B66B 18 09014 CLC ; Calc new Galactic Chart sector for Zylon unit B66C 8A 09015 TXA ; B66D 79C0BF 09016 ADC COMPASSOFFTAB,Y ; B670 301D 09017 BMI SKIP222 ; Next direction if new sector outside Galactic Chart 09018 B672 846A 09019 STY L.DIRECTIONIND ; Save compass rose direction index B674 A8 09020 TAY ; B675 B9C908 09021 LDA GCMEMMAP,Y ; B678 D013 09022 BNE SKIP221 ; Next direction if new sector not empty 09023 B67A BDC908 09024 LDA GCMEMMAP,X ; Preload Zylon sector type to be moved B67D C490 09025 CPY CURRSECTOR ; B67F F00C 09026 BEQ SKIP221 ; Next direction if sector is our starship's sector 09027 B681 0920 09028 ORA #$20 ; New sector for Zylon unit found! B683 99C908 09029 STA GCMEMMAP,Y ; Temporarily mark that sector with marker bit B5 B686 A900 09030 LDA #0 ; B688 9DC908 09031 STA GCMEMMAP,X ; Clear old Zylon unit sector B68B F00B 09032 BEQ SKIP223 ; Next sector (unconditional branch) 09033 B68D A46A 09034 SKIP221 LDY L.DIRECTIONIND ; Restore compass rose direction index B68F 88 09035 SKIP222 DEY ; Next compass rose direction B690 10D2 09036 BPL LOOP078 ; 09037 B692 E69E 09038 INC OLDZYLONDIST ; Increment center distance B694 C66B 09039 DEC L.LOOPCNT2 ; B696 10CA 09040 BPL LOOP077 ; Loop over all compass rose directions one more time 09041 B698 4CEAB5 09042 SKIP223 JMP LOOP073 ; Next sector 09043 09044 ;******************************************************************************* 09045 ;* * 09046 ;* ROTATE * 09047 ;* * 09048 ;* Rotate position vector component (coordinate) by fixed angle * 09049 ;* * 09050 ;******************************************************************************* 09051 09052 ; DESCRIPTION 09053 ; 09054 ; This subroutine rotates a position vector component (coordinate) of a space 09055 ; object by a fixed angle around the center of the 3D coordinate system, the 09056 ; location of our starship. This is used in the Front, Aft, and Long-Range Scan 09057 ; views to rotate space objects in and out of the view. Although the code is 09058 ; deceptively short, there is some interesting math involved, so a more detailed 09059 ; discussion is in order. 09060 ; 09061 ; ROTATION MATHEMATICS 09062 ; 09063 ; The program uses a left-handed 3D coordinate system with the positive x-axis 09064 ; pointing to the right, the positive y-axis pointing up, and the positive 09065 ; z-axis pointing into flight direction. 09066 ; 09067 ; A rotation in this coordinate system around the y-axis (horizontal rotation) 09068 ; can be expressed as 09069 ; 09070 ; x' := cos(ry) * x + sin(ry) * z (1a) 09071 ; z' := - sin(ry) * x + cos(ry) * z (1b) 09072 ; 09073 ; where ry is the clockwise rotation angle around the y-axis, x and z are the 09074 ; coordinates before the rotation, and the primed coordinates x' and z' the 09075 ; coordinates after the rotation. The y-coordinate is not changed by the 09076 ; rotation. 09077 ; 09078 ; A rotation in this coordinate system around the x-axis (vertical rotation) can 09079 ; be expressed as 09080 ; 09081 ; z' = cos(rx) * z + sin(rx) * y (2a) 09082 ; y' = - sin(rx) * z + cos(rx) * y (2b) 09083 ; 09084 ; where rx is the clockwise rotation angle around the x-axis, z and y are the 09085 ; coordinates before the rotation, and the primed coordinates z' and y' the 09086 ; coordinates after the rotation. The x-coordinate is not changed by the 09087 ; rotation. 09088 ; 09089 ; SUBROUTINE IMPLEMENTATION OVERVIEW 09090 ; 09091 ; A single call of this subroutine is able to compute one of the four 09092 ; expressions (1a)-(2b). To compute all four expressions to get the new set of 09093 ; coordinates, this subroutine has to be called four times. This is done twice 09094 ; in pairs in GAMELOOP ($A1F3) at $A391 and $A398, and at $A3AE and $A3B5, 09095 ; respectively. 09096 ; 09097 ; The first pair of calls calculates the new x and z coordinates of a space 09098 ; object due to a horizontal (left/right) rotation of our starship around the 09099 ; y-axis according to equations (1a) and (1b). 09100 ; 09101 ; The second pair of calls calculates the new y and z coordinates of the same 09102 ; space object due to a vertical (up/down) rotation around the x-axis according 09103 ; to equations (2a) and (2b). 09104 ; 09105 ; If you look at the code, you may be wondering how this calculation is actually 09106 ; executed, as there is neither a cos() nor sin() function call. What you'll 09107 ; actually find implemented are the following calculations: 09108 ; 09109 ; Joystick left Joystick right 09110 ; --------------------- --------------------- 09111 ; x := x + z / 64 (3a) x := x - z / 64 (4a) 09112 ; z := -x / 64 + z (3b) z := x / 64 + z (4b) 09113 ; 09114 ; Joystick down Joystick up 09115 ; --------------------- --------------------- 09116 ; y := y + z / 64 (5a) y := y - z / 64 (6a) 09117 ; z := -y / 64 + z (5b) z := y / 64 + z (6b) 09118 ; 09119 ; CORDIC ALGORITHM 09120 ; 09121 ; When you compare equations (1a)-(2b) with (3a)-(6b), notice the similarity 09122 ; between the equations if you substitute 09123 ; 09124 ; sin(ry) -> 1 / 64, 09125 ; cos(ry) -> 1, 09126 ; sin(rx) -> 1 / 64, and 09127 ; cos(rx) -> 1. 09128 ; 09129 ; From sin(ry) = 1 / 64 and sin(rx) = 1 / 64 you can derive that the rotation 09130 ; angles ry and rx by which the space object is rotated per game loop iteration 09131 ; have a constant value of 0.89 degrees, as arcsine(1 / 64) = 0.89 degrees. 09132 ; 09133 ; What about cos(ry) and cos(rx)? The substitution does not match our derived 09134 ; angle exactly, because cos(0.89 degrees) = 0.99988 and is not exactly 1. 09135 ; However, this value is so close to 1 that substituting cos(0.89 degrees) with 09136 ; 1 is a very good approximation, simplifying calculations significantly. 09137 ; 09138 ; Another significant simplification results from the division by 64, because 09139 ; the actual division operation can be replaced by a much faster bit shift 09140 ; operation. 09141 ; 09142 ; This calculation-friendly way of computing rotations is known as the "CORDIC 09143 ; (COordinate Rotation DIgital Computer)" algorithm. 09144 ; 09145 ; There is one more interesting mathematical subtlety: Did you notice that 09146 ; equations (1a)-(2b) use a new (primed) pair of variables to store the 09147 ; resulting coordinates, whereas in equations (3a)-(6b) the value of the first 09148 ; coordinate of a coordinate pair is overwritten with its new value and this 09149 ; value is used in the subsequent calculation of the second coordinate? For 09150 ; example, when the joystick is pushed left, the first call of this subroutine 09151 ; calculates the new value of x according to equation (3a), overwriting the old 09152 ; value of x. During the second call to calculate z according to equation (3b), 09153 ; the new value of x is used instead of the old one. So, why does the rotation 09154 ; calculation still work? Note, that this value is divided by 64 before it is 09155 ; added in equation (3b). And this is the trick: By dividing the value by 64 its 09156 ; contribution is made small enough so that it does not influence the overall 09157 ; sum significantly. 09158 ; 09159 ; SUBROUTINE IMPLEMENTATION DETAILS 09160 ; 09161 ; To better understand how this subroutine works, have again a look at equations 09162 ; (3a)-(6b). If you rearrange the expressions a little their structure is always 09163 ; of the form 09164 ; 09165 ; TERM2 := TERM2 SIGN TERM3 09166 ; 09167 ; where 09168 ; 09169 ; TERM3 := TERM1 / 64 09170 ; SIGN := + or - 09171 ; 09172 ; and where TERM1 and TERM2 are position vector components (coordinates). In 09173 ; fact, this is all this subroutine actually does: It simply adds or subtracts 09174 ; TERM1 divided by 64 to TERM2. 09175 ; 09176 ; When calling this subroutine the correct indices for the appropriate position 09177 ; vector components (coordinates) TERM1 and TERM2 are passed in the X and Y 09178 ; register. 09179 ; 09180 ; What about SIGN between TERM2 and TERM3? Have again a look at equations 09181 ; (3a)-(6b). To compute the two new coordinates after a rotation, the SIGN 09182 ; toggles from plus to minus and vice versa. The SIGN is initialized by 09183 ; JOYSTICKDELTA ($6D) before actually calling subroutine ROTATE ($B69B) and is 09184 ; toggled in every subsequent call of this subroutine. The initial value of SIGN 09185 ; should be positive (+) if the rotation is clockwise (the joystick is pushed 09186 ; right or up) and negative if the rotation is counter-clockwise (the joystick 09187 ; is pushed left or down), respectively. Because SIGN is always toggled you have 09188 ; to pass the already toggled value with the first call. 09189 ; 09190 ; NOTE: Unclear still are three instructions starting at address $B6AD. They 09191 ; seem to set the two least significant bits of TERM3 in a random fashion. Could 09192 ; this be some quick hack to avoid messing with lengthy two-complement's 09193 ; arithmetic here? 09194 ; 09195 ; INPUT 09196 ; 09197 ; X = Position vector component index of TERM1. Used values are: 09198 ; $00..$30 -> z-component (z-coordinate) of position vector 0..48 09199 ; $31..$61 -> x-component (x-coordinate) of position vector 0..48 09200 ; $62..$92 -> y-component (y-coordinate) of position vector 0..48 09201 ; 09202 ; Y = Position vector component index of TERM2. Used values are: 09203 ; $00..$30 -> z-component (z-coordinate) of position vector 0..48 09204 ; $31..$61 -> x-component (x-coordinate) of position vector 0..48 09205 ; $62..$92 -> y-component (y-coordinate) of position vector 0..48 09206 ; 09207 ; JOYSTICKDELTA ($6D) = Initial value of SIGN. Used values are: 09208 ; $01 -> (= Positive) Rotate right or up 09209 ; $FF -> (= Negative) Rotate left or down 09210 09211 ; TERM3 is a 24-bit value, represented by 3 bytes as 09212 ; $(sign)(high byte)(low byte) =006A 09213 L.TERM3LO = $6A ; TERM3 (high byte), where TERM3 := TERM1 / 64 =006B 09214 L.TERM3HI = $6B ; TERM3 (low byte), where TERM3 := TERM1 / 64 =006C 09215 L.TERM3SIGN = $6C ; TERM3 (sign), where TERM3 := TERM1 / 64 09216 B69B BDAD09 09217 ROTATE LDA ZPOSSIGN,X ; B69E 4901 09218 EOR #$01 ; B6A0 F002 09219 BEQ SKIP224 ; Skip if sign of TERM1 is positive B6A2 A9FF 09220 LDA #$FF ; 09221 B6A4 856B 09222 SKIP224 STA L.TERM3HI ; If TERM1 pos. -> TERM3 := $0000xx (= TERM1 / 256) B6A6 856C 09223 STA L.TERM3SIGN ; If TERM1 neg. -> TERM3 := $FFFFxx (= TERM1 / 256) B6A8 BD400A 09224 LDA ZPOSHI,X ; where xx := TERM1 (high byte) B6AB 856A 09225 STA L.TERM3LO ; 09226 B6AD AD0AD2 09227 LDA RANDOM ; (?) Hack to avoid messing with two-complement's B6B0 09BF 09228 ORA #$BF ; (?) arithmetic? Provides two least significant B6B2 5DD30A 09229 EOR ZPOSLO,X ; (?) bits B1..0 in TERM3. 09230 B6B5 0A 09231 ASL A ; TERM3 := TERM * 4 (= TERM1 / 256 * 4 = TERM1 / 64) B6B6 266A 09232 ROL L.TERM3LO ; B6B8 266B 09233 ROL L.TERM3HI ; B6BA 0A 09234 ASL A ; B6BB 266A 09235 ROL L.TERM3LO ; B6BD 266B 09236 ROL L.TERM3HI ; 09237 B6BF A56D 09238 LDA JOYSTICKDELTA ; Toggle SIGN for next call of ROTATE B6C1 49FF 09239 EOR #$FF ; B6C3 856D 09240 STA JOYSTICKDELTA ; B6C5 301A 09241 BMI SKIP225 ; If SIGN negative then subtract, else add TERM3 09242 09243 ;*** Addition ****************************************************************** B6C7 18 09244 CLC ; TERM2 := TERM2 + TERM3 B6C8 B9D30A 09245 LDA ZPOSLO,Y ; (24-bit addition) B6CB 656A 09246 ADC L.TERM3LO ; B6CD 99D30A 09247 STA ZPOSLO,Y ; 09248 B6D0 B9400A 09249 LDA ZPOSHI,Y ; B6D3 656B 09250 ADC L.TERM3HI ; B6D5 99400A 09251 STA ZPOSHI,Y ; 09252 B6D8 B9AD09 09253 LDA ZPOSSIGN,Y ; B6DB 656C 09254 ADC L.TERM3SIGN ; B6DD 99AD09 09255 STA ZPOSSIGN,Y ; B6E0 60 09256 RTS ; 09257 09258 ;*** Subtraction *************************************************************** B6E1 38 09259 SKIP225 SEC ; TERM2 := TERM2 - TERM3 B6E2 B9D30A 09260 LDA ZPOSLO,Y ; (24-bit subtraction) B6E5 E56A 09261 SBC L.TERM3LO ; B6E7 99D30A 09262 STA ZPOSLO,Y ; 09263 B6EA B9400A 09264 LDA ZPOSHI,Y ; B6ED E56B 09265 SBC L.TERM3HI ; B6EF 99400A 09266 STA ZPOSHI,Y ; 09267 B6F2 B9AD09 09268 LDA ZPOSSIGN,Y ; B6F5 E56C 09269 SBC L.TERM3SIGN ; B6F7 99AD09 09270 STA ZPOSSIGN,Y ; B6FA 60 09271 RTS ; 09272 09273 ;******************************************************************************* 09274 ;* * 09275 ;* SCREENCOLUMN * 09276 ;* * 09277 ;* Calculate pixel column number from centered pixel column number * 09278 ;* * 09279 ;******************************************************************************* 09280 09281 ; DESCRIPTION 09282 ; 09283 ; Converts a pixel column number relative to the horizontal screen center to a 09284 ; pixel column number relative to the top-left corner of the screen and stores 09285 ; the result in table PIXELCOLUMN ($0C2A). The passed relative pixel column 09286 ; number is always positive. The sign is picked from the corresponding 09287 ; x-component of the position vector (x-coordinate). 09288 ; 09289 ; If the passed relative pixel column number is offscreen horizontally the 09290 ; calculation is skipped and code execution returns. If the position vector 09291 ; corresponding to this pixel represents a PLAYFIELD space object (star, 09292 ; explosion fragments) a new position vector is initialized before code 09293 ; execution returns. If it represents a PLAYER space object the PLAYER is pushed 09294 ; offscreen before code execution returns. 09295 ; 09296 ; NOTE: The horizontal screen center's pixel column number for PLAYFIELD space 09297 ; objects has a value of 80 = 160 PLAYFIELD pixels / 2. For PLAYER space objects 09298 ; it has a value of 125 Player/Missile (PM) pixels (from left to right: 128 PM 09299 ; pixels to the horizontal screen center - 3 PM pixels relative offset of the 09300 ; PLAYER shape's horizontal center to its left edge = 125 PM pixels). 09301 ; 09302 ; INPUT 09303 ; 09304 ; A = Pixel column number relative to the horizontal screen center, always 09305 ; positive. Used values are: 09306 ; 0..80 -> Regular values, pixel is onscreen 09307 ; $FF -> Pixel is offscreen 09308 ; X = Position vector index. Used values are: 09309 ; 0..4 -> Position vector of a PLAYER space object 09310 ; 5..48 -> Position vector of a PLAYFIELD space object 09311 =006D 09312 L.PIXELCOLUMN = $6D ; Saves relative pixel column number 09313 B6FB C950 09314 SCREENCOLUMN CMP #80 ; If pixel is offscreen (A > 79)... B6FD B05B 09315 BCS SKIP233 ; ...return via initializing a new position vector 09316 B6FF 856D 09317 STA L.PIXELCOLUMN ; Save relative pixel column number B701 A950 09318 LDA #80 ; If PLAYFIELD space object -> A := CENTERCOL = 80 B703 E005 09319 CPX #5 ; If PLAYER space object -> A := CENTERCOL = 125 B705 B002 09320 BCS SKIP226 ; B707 A97D 09321 LDA #125 ; 09322 B709 BCDE09 09323 SKIP226 LDY XPOSSIGN,X ; Skip if x-coordinate positive B70C D009 09324 BNE SKIP227 ; 09325 B70E 38 09326 SEC ; Pixel in left screen half (x-coordinate negative) B70F E66D 09327 INC L.PIXELCOLUMN ; B711 E56D 09328 SBC L.PIXELCOLUMN ; B713 9D2A0C 09329 STA PIXELCOLUMN,X ; Pixel column := CENTERCOL - (rel. pixel column + 1) B716 60 09330 RTS ; Return 09331 B717 18 09332 SKIP227 CLC ; Pixel in right screen half (x-coordinate positive) B718 656D 09333 ADC L.PIXELCOLUMN ; B71A 9D2A0C 09334 STA PIXELCOLUMN,X ; Pixel column := CENTERCOL + relative pixel column B71D 60 09335 RTS ; Return 09336 09337 ;******************************************************************************* 09338 ;* * 09339 ;* SCREENROW * 09340 ;* * 09341 ;* Calculate pixel row number from centered pixel row number * 09342 ;* * 09343 ;******************************************************************************* 09344 09345 ; Converts a pixel row number relative to the vertical screen center to a pixel 09346 ; row number relative to the top-left corner of the screen and stores the result 09347 ; in table PIXELROWNEW ($0BF9). The passed relative pixel row number is always 09348 ; positive. The sign is picked from the corresponding y-component of the 09349 ; position vector (y-coordinate). 09350 ; 09351 ; If the passed relative pixel row number is offscreen vertically the 09352 ; calculation is skipped and code execution returns. If the position vector 09353 ; corresponding to this pixel represents a PLAYFIELD space object (star, 09354 ; explosion fragments) a new position vector is initialized in subroutine 09355 ; INITPOSVEC ($B764) before code execution returns. If it represents a PLAYER 09356 ; space object the PLAYER is pushed offscreen before code execution returns. 09357 ; 09358 ; NOTE: The vertical screen center's pixel row number for PLAYFIELD space 09359 ; objects has a value of 50 = 100 PLAYFIELD pixels / 2. For PLAYER space objects 09360 ; it has a value of 122 Player/Missile (PM) pixels (from top to bottom: 8 PM 09361 ; pixels to start of Display List + 16 PM pixels to begin of PLAYFIELD + 100 PM 09362 ; pixels to vertical screen center - 2 PM pixels (?) = 122 PM pixels). 09363 ; 09364 ; NOTE: If the position vector corresponding to the pixel represents a PLAYER 09365 ; space object the passed pixel row number is doubled because 1 PLAYFIELD pixel 09366 ; has the same height as 2 PM pixels at single-line resolution. 09367 ; 09368 ; When in Long-Range Scan view the z-coordinate takes the place of the 09369 ; y-coordinate of the Front or Aft view. If the Long-Range Scan is damaged the 09370 ; passed pixel row number is treated randomly as a negative or positive value 09371 ; (mirror effect). 09372 ; 09373 ; INPUT 09374 ; 09375 ; A = Pixel row number relative to the vertical screen center, always 09376 ; positive. Used values are: 09377 ; 0..50 -> Regular values, pixel is onscreen 09378 ; $FF -> Pixel is offscreen 09379 ; X = Position vector index. Used values are: 09380 ; 0..4 -> Position vector of a PLAYER space object 09381 ; 5..48 -> Position vector of a PLAYFIELD space object 09382 =006D 09383 L.PIXELROW = $6D ; Saves relative pixel row number 09384 B71E C932 09385 SCREENROW CMP #50 ; If pixel is offscreen (A > 49)... B720 B038 09386 BCS SKIP233 ; ...return via initializing a new position vector 09387 B722 856D 09388 STA L.PIXELROW ; Save relative pixel row number B724 A932 09389 LDA #50 ; If PLAYFIELD space object -> A := CENTERROW = 50 B726 E005 09390 CPX #5 ; B728 B004 09391 BCS SKIP228 ; B72A 066D 09392 ASL L.PIXELROW ; If PLAYER space object -> Double pixel row number B72C A97A 09393 LDA #122 ; If PLAYER space object -> A := CENTERROW = 122 09394 B72E 24D0 09395 SKIP228 BIT SHIPVIEW ; Skip if not in Long-Range Scan view B730 5013 09396 BVC SKIP230 ; 09397 B732 2C9609 09398 BIT GCSTATLRS ; Skip if Long-Range Scan OK B735 1007 09399 BPL SKIP229 ; 09400 B737 2C0AD2 09401 BIT RANDOM ; Long-Range Scan damaged... B73A 500E 09402 BVC SKIP231 ; ...branch randomly to pixel row number calculation B73C 7015 09403 BVS SKIP232 ; ...(mirror effect) 09404 B73E BCAD09 09405 SKIP229 LDY ZPOSSIGN,X ; B741 D007 09406 BNE SKIP231 ; Skip if z-coordinate pos. (Long-Range Scan view) B743 F00E 09407 BEQ SKIP232 ; Skip if z-coordinate neg. (Long-Range Scan view) 09408 B745 BC0F0A 09409 SKIP230 LDY YPOSSIGN,X ; B748 F009 09410 BEQ SKIP232 ; Skip if y-coordinate neg. (Front or Aft view) 09411 B74A 38 09412 SKIP231 SEC ; Pixel in upper screen half (z or y coordinate pos.) B74B E66D 09413 INC L.PIXELROW ; B74D E56D 09414 SBC L.PIXELROW ; B74F 9DF90B 09415 STA PIXELROWNEW,X ; Pixel row := CENTERROW - (rel. pixel row + 1) B752 60 09416 RTS ; Return 09417 B753 18 09418 SKIP232 CLC ; Pixel in lower screen half (y or z coordinate neg.) B754 656D 09419 ADC L.PIXELROW ; B756 9DF90B 09420 STA PIXELROWNEW,X ; Pixel row := CENTERROW + relative pixel row B759 60 09421 RTS ; Return 09422 B75A E005 09423 SKIP233 CPX #5 ; Space object is offscreen. If it is a... B75C B006 09424 BCS INITPOSVEC ; ...PLAYFIELD space object -> New position vector B75E A9FB 09425 LDA #251 ; ...PLAYER space object -> Push PLAYER offscreen B760 9DF90B 09426 STA PIXELROWNEW,X ; Why a value of 251 (?) B763 60 09427 SKIP234 RTS ; Return 09428 09429 ;******************************************************************************* 09430 ;* * 09431 ;* INITPOSVEC * 09432 ;* * 09433 ;* Initialize position vector of a space object * 09434 ;* * 09435 ;******************************************************************************* 09436 09437 ; DESCRIPTION 09438 ; 09439 ; Initializes the position vector of a space object. 09440 ; 09441 ; This subroutine executes the following steps: 09442 ; 09443 ; (1) Set the pixel row and column number to an offscreen value (= 99). 09444 ; 09445 ; (2) If the position vector represents an explosion fragment space object then 09446 ; return code execution immediately. This avoids generating new explosion 09447 ; fragment space objects. They are separately initialized in subroutine 09448 ; COPYPOSVEC ($ACAF), which is called from subroutine INITEXPL ($AC6B). 09449 ; 09450 ; (3) Assign default values (see below) to the position vector components 09451 ; (coordinates) depending on our starship's view. 09452 ; 09453 ; Code execution continues into subroutine RNDINVXY ($B7BE) where x and y 09454 ; coordinates are inverted randomly. 09455 ; 09456 ; After passing through this and the next subroutine RNDINVXY ($B7BE) the 09457 ; components of a position vector (coordinates) are assigned to one of the 09458 ; following values depending on our starship's view: 09459 ; 09460 ; o FRONT VIEW 09461 ; 09462 ; +------------+---------------------------------------+ 09463 ; | Coordinate | Values | 09464 ; +------------+---------------------------------------+ 09465 ; | x | -4095..+4095 (-($0***)..+$0***) <KM> | 09466 ; | y | -4095..+4095 (-($0***)..+$0***) <KM> | 09467 ; | z | +3840..+4095 ( +$0F**) <KM> | 09468 ; +------------+---------------------------------------+ 09469 ; 09470 ; o AFT VIEW 09471 ; 09472 ; +------------+---------------------------------------+ 09473 ; | Coordinate | Values | 09474 ; +------------+---------------------------------------+ 09475 ; | x | -3840..+3840 (-($0*00)..+$0*00) <KM> | 09476 ; | y | -3840..+3840 (-($0*00)..+$0*00) <KM> | 09477 ; | z | -3968.. -128 (-($0*80) ) <KM> | 09478 ; +------------+---------------------------------------+ 09479 ; Values of x, y, and z coordinates change in increments of 256. 09480 ; Second digit of z-coordinate is -MAX(RNDY,RNDX), where 09481 ; RNDY := RND($00..$0F), RNDX := RND($00..$0F). 09482 ; 09483 ; o LONG-RANGE SCAN VIEW 09484 ; 09485 ; +------------+---------------------------------------+ 09486 ; | Coordinate | Values | 09487 ; +------------+---------------------------------------+ 09488 ; | x | -65535..+65535 (-($****)..$****) <KM> | 09489 ; | y | -4095..+4095 (-($0***)..$0***) <KM> | 09490 ; | z | -65535..+65535 (-($****)..$****) <KM> | 09491 ; +------------+---------------------------------------+ 09492 ; 09493 ; INPUT 09494 ; 09495 ; X = Position vector index. Used values are: 0..48. 09496 =006A 09497 L.MAXRNDXY = $6A ; Saves MAX(new y-coordinate (high byte), ... 09498 ; ...new x-coordinate (high byte)) 09499 B764 A963 09500 INITPOSVEC LDA #99 ; Init to offscreen pixel row and column numbers B766 9DF90B 09501 STA PIXELROWNEW,X ; B769 9D2A0C 09502 STA PIXELCOLUMN,X ; 09503 B76C E011 09504 CPX #17 ; Return if pos vector is explosion frag space obj B76E B0F3 09505 BCS SKIP234 ; This avoids creating new explosion frag space objs 09506 B770 AD0AD2 09507 LDA RANDOM ; RNDY := RND($00..$0F) B773 290F 09508 AND #$0F ; B775 856A 09509 STA L.MAXRNDXY ; Save RNDY B777 9DA20A 09510 STA YPOSHI,X ; y-coordinate (high byte) := RNDY 09511 B77A AD0AD2 09512 LDA RANDOM ; RNDX := RND($00..$0F) B77D 290F 09513 AND #$0F ; B77F C56A 09514 CMP L.MAXRNDXY ; B781 9002 09515 BCC SKIP235 ; B783 856A 09516 STA L.MAXRNDXY ; Save MAX(RNDY, RNDX) B785 9D710A 09517 SKIP235 STA XPOSHI,X ; x-coordinate (high byte) := RNDX 09518 B788 A90F 09519 LDA #$0F ; z-coordinate (high byte) := $0F B78A 9D400A 09520 STA ZPOSHI,X ; 09521 B78D A5D0 09522 LDA SHIPVIEW ; z-coordinate (sign) := 1 or 0 (Front or Aft view) B78F 4901 09523 EOR #$01 ; B791 2901 09524 AND #$01 ; B793 9DAD09 09525 STA ZPOSSIGN,X ; B796 D011 09526 BNE SKIP236 ; Skip if in Front or Long-Range Scan view 09527 09528 ; Aft view only: B798 9D040B 09529 STA XPOSLO,X ; x-coordinate (low byte) := 0 B79B 9D350B 09530 STA YPOSLO,X ; y-coordinate (low byte) := 0 B79E 38 09531 SEC ; z-coordinate (high byte) := -MAX(RNDY, RNDX) B79F E56A 09532 SBC L.MAXRNDXY ; B7A1 9D400A 09533 STA ZPOSHI,X ; B7A4 A980 09534 LDA #$80 ; z-coordinate (low byte) := $80 B7A6 9DD30A 09535 STA ZPOSLO,X ; 09536 B7A9 24D0 09537 SKIP236 BIT SHIPVIEW ; If not in Long-Range Scan view skip to RNDINVXY B7AB 5011 09538 BVC RNDINVXY ; 09539 09540 ; Long-Range Scan view only: B7AD AD0AD2 09541 LDA RANDOM ; x-coordinate (high byte) := RND($00..$FF) B7B0 9D710A 09542 STA XPOSHI,X ; B7B3 AD0AD2 09543 LDA RANDOM ; z-coordinate (high byte) := RND($00..$FF) B7B6 9D400A 09544 STA ZPOSHI,X ; B7B9 2901 09545 AND #$01 ; Invert z-coordinate randomly B7BB 9DAD09 09546 STA ZPOSSIGN,X ; 09547 09548 ;******************************************************************************* 09549 ;* * 09550 ;* RNDINVXY * 09551 ;* * 09552 ;* Randomly invert the x and y components of a position vector * 09553 ;* * 09554 ;******************************************************************************* 09555 09556 ; DESCRIPTION 09557 ; 09558 ; Randomly inverts the x and y components of a position vector (x and y 09559 ; coordinates). See also subroutine INITPOSVEC ($B764). 09560 ; 09561 ; INPUT 09562 ; 09563 ; X = Position vector index. Used values are: 0..48. 09564 B7BE AD0AD2 09565 RNDINVXY LDA RANDOM ; Set sign of y-coordinate randomly B7C1 2901 09566 AND #$01 ; B7C3 9D0F0A 09567 STA YPOSSIGN,X ; B7C6 D00F 09568 BNE SKIP237 ; Skip if sign positive 09569 B7C8 38 09570 SEC ; Sign negative -> Calc negative y-coordinate B7C9 FD350B 09571 SBC YPOSLO,X ; (calculate two's-complement of 16-bit value) B7CC 9D350B 09572 STA YPOSLO,X ; B7CF A900 09573 LDA #0 ; B7D1 FDA20A 09574 SBC YPOSHI,X ; B7D4 9DA20A 09575 STA YPOSHI,X ; 09576 B7D7 AD0AD2 09577 SKIP237 LDA RANDOM ; Set sign of x-coordinate randomly B7DA 2901 09578 AND #$01 ; B7DC 9DDE09 09579 STA XPOSSIGN,X ; B7DF D00F 09580 BNE SKIP238 ; Skip if sign positive 09581 B7E1 38 09582 SEC ; Sign negative -> Calc negative x-coordinate B7E2 FD040B 09583 SBC XPOSLO,X ; (calculate two's-complement of 16-bit value) B7E5 9D040B 09584 STA XPOSLO,X ; B7E8 A900 09585 LDA #0 ; B7EA FD710A 09586 SBC XPOSHI,X ; B7ED 9D710A 09587 STA XPOSHI,X ; B7F0 60 09588 SKIP238 RTS ; Return 09589 09590 ;******************************************************************************* 09591 ;* * 09592 ;* ISSURROUNDED * 09593 ;* * 09594 ;* Check if a sector is surrounded by Zylon units * 09595 ;* * 09596 ;******************************************************************************* 09597 09598 ; DESCRIPTION 09599 ; 09600 ; Checks if a sector of the Galactic Chart is surrounded by Zylon units in the 09601 ; adjacent NORTH, EAST, SOUTH, and WEST sectors. 09602 ; 09603 ; INPUT 09604 ; 09605 ; X = Sector of Galactic Chart. Used values are: $00..$7F with, for example, 09606 ; $00 -> NORTHWEST corner sector 09607 ; $0F -> NORTHEAST corner sector 09608 ; $70 -> SOUTHWEST corner sector 09609 ; $7F -> SOUTHWEST corner sector 09610 ; 09611 ; OUTPUT 09612 ; 09613 ; A = Returns if the sector is surrounded by Zylon units in the adjacent 09614 ; NORTH, EAST, SOUTH, and WEST sectors. 09615 ; 0 -> Sector is not surrounded 09616 ; > 0 -> Sector is surrounded 09617 B7F1 BDC808 09618 ISSURROUNDED LDA GCMEMMAP-1,X ; Check WEST sector B7F4 F00D 09619 BEQ SKIP239 ; B7F6 BDCA08 09620 LDA GCMEMMAP+1,X ; Check EAST sector B7F9 F008 09621 BEQ SKIP239 ; B7FB BDB908 09622 LDA GCMEMMAP-16,X ; Check NORTH sector B7FE F003 09623 BEQ SKIP239 ; B800 BDD908 09624 LDA GCMEMMAP+16,X ; Check SOUTH sector B803 60 09625 SKIP239 RTS ; Return 09626 09627 ;******************************************************************************* 09628 ;* * 09629 ;* UPDPANEL * 09630 ;* * 09631 ;* Update Control Panel Display * 09632 ;* * 09633 ;******************************************************************************* 09634 09635 ; DESCRIPTION 09636 ; 09637 ; This subroutine executes the following steps: 09638 ; 09639 ; (1) Accelerate or decelerate our starship, update the VELOCITY readout 09640 ; 09641 ; If the new velocity value is different from the current one either 09642 ; increment or decrement the current velocity value toward the new one. 09643 ; 09644 ; If the Engines are damaged or destroyed (and hyperwarp is not engaged) 09645 ; then store a random value (less or equal than the current velocity) as 09646 ; the current velocity. 09647 ; 09648 ; Display the updated velocity by the VELOCITY readout of the Control Panel 09649 ; Display. 09650 ; 09651 ; (2) Update THETA, PHI, and RANGE readouts 09652 ; 09653 ; If the Attack Computer is working then display the x, y, and z 09654 ; coordinates of the currently tracked space object as THETA, PHI, and 09655 ; RANGE readout values of the Control Panel Display. 09656 ; 09657 ; (3) Calculate overall energy consumption 09658 ; 09659 ; Add the overall energy consumption per game loop iteration to the energy 09660 ; counter. This value is given in energy subunits (256 energy subunits = 1 09661 ; energy unit displayed by the 4-digit ENERGY readout of the Console Panel 09662 ; Display). It is the total of the following items: 09663 ; 09664 ; (1) 8 energy subunits if the Shields are up 09665 ; 09666 ; (2) 2 energy subunits if the Attack Computer is on 09667 ; 09668 ; (3) 1 energy subunit of the life support system 09669 ; 09670 ; (4) Our starship's Engines energy drain rate (depending on its velocity) 09671 ; 09672 ; If there is a carryover of the energy counter then decrement the ENERGY 09673 ; readout of the Control Panel Display by one energy unit after code 09674 ; execution has continued into subroutine DECENERGY ($B86F). 09675 ; 09676 ; NOTE: The values of ISSHIELDSON ($7D) and ISATTCOMPON ($7E) not only 09677 ; indicate if the Shields and the Attack Computer are on. They also store 09678 ; the number of energy subunits consumed by these subsystems when they are 09679 ; on (2 and 8, respectively). 09680 09681 ;*** Accelerate or decelerate our starship ************************************* B804 A670 09682 UPDPANEL LDX VELOCITYLO ; Skip if new velocity = current velocity B806 E471 09683 CPX NEWVELOCITY ; B808 F008 09684 BEQ SKIP241 ; 09685 B80A 9004 09686 BCC SKIP240 ; In/decrement current velocity toward new velocity B80C C670 09687 DEC VELOCITYLO ; B80E B012 09688 BCS SKIP242 ; B810 E670 09689 SKIP240 INC VELOCITYLO ; 09690 B812 A5C0 09691 SKIP241 LDA WARPSTATE ; Skip if hyperwarp engaged B814 D00C 09692 BNE SKIP242 ; 09693 B816 2C9309 09694 BIT GCSTATENG ; Skip if Engines are OK B819 1007 09695 BPL SKIP242 ; 09696 B81B A571 09697 LDA NEWVELOCITY ; Store RND(0..current velocity) to current velocity B81D 2D0AD2 09698 AND RANDOM ; B820 8570 09699 STA VELOCITYLO ; 09700 B822 A001 09701 SKIP242 LDY #VELOCD1-PANELTXT-1 ; Update digits of VELOCITY readout B824 20CDB8 09702 JSR SHOWDIGITS ; 09703 09704 ;*** Display coordinates of tracked space object of Control Panel Display ****** B827 2C9509 09705 BIT GCSTATCOM ; Skip if Attack Computer damaged or destroyed B82A 3030 09706 BMI SKIP243 ; 09707 B82C A931 09708 LDA #$31 ; Update THETA readout (x-coordinate) B82E A017 09709 LDY #THETAC1-PANELTXT ; B830 20A7B8 09710 JSR SHOWCOORD ; 09711 B833 A962 09712 LDA #$62 ; Update PHI readout (y-coordinate) B835 A01D 09713 LDY #PHIC1-PANELTXT ; B837 20A7B8 09714 JSR SHOWCOORD ; 09715 B83A A900 09716 LDA #$00 ; Update RANGE readout (z-coordinate) B83C A023 09717 LDY #RANGEC1-PANELTXT ; B83E 20A7B8 09718 JSR SHOWCOORD ; 09719 B841 AD6E09 09720 LDA RANGEC1+2 ; Hack to clear RANGE digit 3 when in hyperwarp: B844 8D6F09 09721 STA RANGEC1+3 ; Copy RANGE digit 2 to digit 3 B847 C90A 09722 CMP #CCS.9+1 ; Skip if digit character > '9' (= 'infinity' char) B849 B011 09723 BCS SKIP243 ; 09724 B84B AE5C09 09725 LDX TRACKDIGIT ; Get z-coordinate (low byte) of tracked space object B84E BDD30A 09726 LDA ZPOSLO,X ; B851 4A 09727 LSR A ; ...divide it by 16... B852 4A 09728 LSR A ; B853 4A 09729 LSR A ; B854 4A 09730 LSR A ; B855 AA 09731 TAX ; B856 BDE90E 09732 LDA MAPTOBCD99,X ; ...map value of $00..$0F to BCD value 0..9 B859 8D6F09 09733 STA RANGEC1+3 ; ...and store it to RANGE digit 3 09734 09735 ;*** Calculate overall energy consumption ************************************** B85C 18 09736 SKIP243 CLC ; B85D A57F 09737 LDA ENERGYCNT ; Load energy counter B85F 657D 09738 ADC ISSHIELDSON ; Add 8 energy subunits if Shields on B861 6580 09739 ADC DRAINRATE ; Add our starship's drain rate (in subunits) B863 657E 09740 ADC ISATTCOMPON ; Add 2 energy subunits if Attack Computer on B865 6901 09741 ADC #$01 ; Add 1 energy subunit consumed by life support system B867 C57F 09742 CMP ENERGYCNT ; B869 857F 09743 STA ENERGYCNT ; B86B B039 09744 BCS SKIP246 ; Return if no energy counter carryover 09745 B86D A203 09746 LDX #3 ; Will decrement third energy digit 09747 09748 ;******************************************************************************* 09749 ;* * 09750 ;* DECENERGY * 09751 ;* * 09752 ;* Decrease energy * 09753 ;* * 09754 ;******************************************************************************* 09755 09756 ; DESCRIPTION 09757 ; 09758 ; When not in demo mode, subtract energy from the 4-digit ENERGY readout of the 09759 ; Control Panel Display. If crossing a 100-energy-unit boundary during 09760 ; subtraction the score is decremented by one unit. If the energy is zero the 09761 ; game is over. 09762 ; 09763 ; INPUT 09764 ; 09765 ; X = ENERGY readout digit to be decremented. Used values are: 09766 ; 1 -> Subtract 100 units from ENERGY readout 09767 ; 2 -> Subtract 10 units from ENERGY readout 09768 ; 3 -> Subtract 1 unit from ENERGY readout 09769 09770 ;*** Display ENERGY readout **************************************************** B86F 2464 09771 DECENERGY BIT ISDEMOMODE ; Return if in demo mode B871 7033 09772 BVS SKIP246 ; 09773 B873 DE5509 09774 DEC ENERGYD1,X ; Decrement energy digit character B876 BD5509 09775 LDA ENERGYD1,X ; B879 C980 09776 CMP #CCS.COL2!CCS.0 ; B87B B029 09777 BCS SKIP246 ; Return if digit character >= '0' B87D A989 09778 LDA #CCS.COL2!CCS.9 ; B87F 9D5509 09779 STA ENERGYD1,X ; Store digit character '9' 09780 09781 ;*** Decrement score when crossing a 100-energy-unit boundary while subtracting B882 E002 09782 CPX #2 ; Skip if no crossing of 100-energy-unit boundary B884 D008 09783 BNE SKIP245 ; 09784 B886 A5CB 09785 LDA SCORE ; SCORE := SCORE - 1 B888 D002 09786 BNE SKIP244 ; B88A C6CC 09787 DEC SCORE+1 ; B88C C6CB 09788 SKIP244 DEC SCORE ; 09789 B88E CA 09790 SKIP245 DEX ; B88F 10DE 09791 BPL DECENERGY ; Next digit 09792 09793 ;*** Energy is zero, game over ************************************************* B891 A20A 09794 LDX #CCS.SPC ; Clear 4-digit ENERGY readout B893 8A 09795 TXA ; B894 A003 09796 LDY #3 ; B896 995509 09797 LOOP079 STA ENERGYD1,Y ; B899 88 09798 DEY ; B89A 10FA 09799 BPL LOOP079 ; 09800 B89C 2045B0 09801 JSR SETVIEW ; Set Front view 09802 B89F A031 09803 LDY #$31 ; Set title phrase "MISSION ABORTED ZERO ENERGY" B8A1 A204 09804 LDX #$04 ; Set mission bonus offset B8A3 200AB1 09805 JSR GAMEOVER ; Game over 09806 B8A6 60 09807 SKIP246 RTS ; Return 09808 09809 ;******************************************************************************* 09810 ;* * 09811 ;* SHOWCOORD * 09812 ;* * 09813 ;* Display a position vector component (coordinate) in Control Panel Display * 09814 ;* * 09815 ;******************************************************************************* 09816 09817 ; DESCRIPTION 09818 ; 09819 ; Displays a position vector component (coordinate) by one of the THETA, PHI, or 09820 ; RANGE readouts of the Control Panel Display. 09821 ; 09822 ; Write the sign to the Control Panel Display, then map the high byte of the 09823 ; respective coordinate (x -> THETA, y -> PHI, z -> RANGE) to a BCD-value in 09824 ; 00..99. Code execution continues into subroutine SHOWDIGITS ($B8CD) where the 09825 ; digits are actually stored in the Control Panel Display. 09826 ; 09827 ; NOTE: If the digits of either the THETA or PHI readout are to be displayed and 09828 ; the x or y position vector component (high byte) is $FF then tweak the value 09829 ; to $FE. This avoids accessing table MAPTOBCD99 ($0EE9) with an index of $FF 09830 ; that would return the special value $EA. This value represents the CCS.INF 09831 ; ($0E) and CCS.SPC ($0A) characters (see comments in subroutine INITIALIZE 09832 ; ($B3BA)) that are displayed by the RANGE readout only. 09833 ; 09834 ; INPUT 09835 ; 09836 ; A = Position vector component (coordinate) offset. Used values are: 09837 ; $00 -> z-coordinate 09838 ; $31 -> x-coordinate 09839 ; $62 -> y-coordinate 09840 ; Y = Offset into the Control Panel Display memory map. Used values are: 09841 ; $17 -> First character (sign) of THETA readout (x-coordinate of tracked 09842 ; space object) 09843 ; $1D -> First character (sign) of PHI readout (y-coordinate of tracked 09844 ; space object) 09845 ; $23 -> First character (sign) of RANGE readout (z-coordinate of tracked 09846 ; space object) 09847 =006A 09848 L.SIGNCHAR = $6A ; Saves sign character 09849 B8A7 18 09850 SHOWCOORD CLC ; Add index of tracked space object... B8A8 6D5C09 09851 ADC TRACKDIGIT ; ...to position vector component offset B8AB AA 09852 TAX ; Save position vector component index 09853 09854 ;*** Display sign in Control Panel Display ************************************* B8AC A910 09855 LDA #CCS.PLUS ; Save '+' (CCS.PLUS) to sign character B8AE 856A 09856 STA L.SIGNCHAR ; 09857 B8B0 BDAD09 09858 LDA ZPOSSIGN,X ; Prep sign of coordinate B8B3 4A 09859 LSR A ; B8B4 BD400A 09860 LDA ZPOSHI,X ; Prep coordinate (high byte) B8B7 B004 09861 BCS SKIP247 ; Skip if sign is positive 09862 B8B9 49FF 09863 EOR #$FF ; Invert coordinate (high byte) B8BB C66A 09864 DEC L.SIGNCHAR ; Change saved sign character to '-' (CCS.MINUS) 09865 B8BD AA 09866 SKIP247 TAX ; Save coordinate (high byte) B8BE A56A 09867 LDA L.SIGNCHAR ; Store sign character in Control Panel Display B8C0 994909 09868 STA PANELTXT,Y ; 09869 09870 ;*** Get RANGE digits ********************************************************** B8C3 98 09871 TYA ; Skip if RANGE is to be displayed B8C4 2910 09872 AND #$10 ; B8C6 F005 09873 BEQ SHOWDIGITS ; 09874 B8C8 E0FF 09875 CPX #$FF ; If coordinate (high byte) = $FF decrement value B8CA D001 09876 BNE SHOWDIGITS ; This avoids output of CCS.INFINITY in... B8CC CA 09877 DEX ; ...THETA and PHI readouts 09878 09879 ;******************************************************************************* 09880 ;* * 09881 ;* SHOWDIGITS * 09882 ;* * 09883 ;* Display a value by a readout of the Control Panel Display * 09884 ;* * 09885 ;******************************************************************************* 09886 09887 ; DESCRIPTION 09888 ; 09889 ; Converts a binary value in $00..$FF to a BCD-value in 0..99 and displays it as 09890 ; a 2-digit number in the Control Panel Display. 09891 ; 09892 ; INPUT 09893 ; 09894 ; X = Value to be displayed as a 2-digit BCD-value. Used values are: $00..$FF. 09895 ; Y = Offset into the Control Panel Display memory map relative to the first 09896 ; character of the Control Panel Display (the 'V' of the VELOCITY 09897 ; readout). Used values are: 09898 ; $01 -> Character before first digit of VELOCITY readout 09899 ; $17 -> First character (sign) of THETA readout (x-coordinate of tracked 09900 ; space object) 09901 ; $1D -> First character (sign) of PHI readout (y-coordinate of tracked 09902 ; space object) 09903 ; $23 -> First character (sign) of RANGE readout (z-coordinate of tracked 09904 ; space object) 09905 B8CD BDE90E 09906 SHOWDIGITS LDA MAPTOBCD99,X ; Map binary value to BCD-value B8D0 AA 09907 TAX ; B8D1 290F 09908 AND #$0F ; B8D3 994B09 09909 STA PANELTXT+2,Y ; Store 'ones' digit in Control Panel Display B8D6 8A 09910 TXA ; B8D7 4A 09911 LSR A ; B8D8 4A 09912 LSR A ; B8D9 4A 09913 LSR A ; B8DA 4A 09914 LSR A ; B8DB 994A09 09915 STA PANELTXT+1,Y ; Store 'tens' digit in Control Panel Display B8DE 60 09916 RTS ; Return 09917 09918 ;******************************************************************************* 09919 ;* * 09920 ;* G A M E D A T A ( P A R T 2 O F 2 ) * 09921 ;* * 09922 ;******************************************************************************* 09923 09924 ;*** Color register offsets of PLAYER0..4 ************************************** B8DF 00 09925 PLCOLOROFFTAB .BYTE 0 ; PLAYER0 B8E0 01 09926 .BYTE 1 ; PLAYER1 B8E1 02 09927 .BYTE 2 ; PLAYER2 B8E2 03 09928 .BYTE 3 ; PLAYER3 B8E3 07 09929 .BYTE 7 ; PLAYER4 09930 09931 ;*** Shape table 1 (PLAYER2..4) ************************************************ B8E4 00 09932 PLSHAP1TAB .BYTE $00 ; ........ B8E5 18 09933 .BYTE $18 ; ...##... B8E6 3C 09934 .BYTE $3C ; ..####.. B8E7 7E 09935 .BYTE $7E ; .######. B8E8 7E 09936 .BYTE $7E ; .######. B8E9 76 09937 .BYTE $76 ; .###.##. B8EA F7 09938 .BYTE $F7 ; ####.### B8EB DF 09939 .BYTE $DF ; ##.##### B8EC DF 09940 .BYTE $DF ; ##.##### B8ED FF 09941 .BYTE $FF ; ######## B8EE FF 09942 .BYTE $FF ; ######## B8EF F7 09943 .BYTE $F7 ; ####.### B8F0 76 09944 .BYTE $76 ; .###.##. B8F1 7E 09945 .BYTE $7E ; .######. B8F2 7E 09946 .BYTE $7E ; .######. B8F3 3C 09947 .BYTE $3C ; ..####.. B8F4 18 09948 .BYTE $18 ; ...##... B8F5 10 09949 .BYTE $10 ; ...#.... B8F6 38 09950 .BYTE $38 ; ..###... B8F7 7C 09951 .BYTE $7C ; .#####.. B8F8 7C 09952 .BYTE $7C ; .#####.. B8F9 FE 09953 .BYTE $FE ; #######. B8FA DE 09954 .BYTE $DE ; ##.####. B8FB DA 09955 .BYTE $DA ; ##.##.#. B8FC FA 09956 .BYTE $FA ; #####.#. B8FD EE 09957 .BYTE $EE ; ###.###. B8FE EE 09958 .BYTE $EE ; ###.###. B8FF 7C 09959 .BYTE $7C ; .#####.. B900 7C 09960 .BYTE $7C ; .#####.. B901 38 09961 .BYTE $38 ; ..###... B902 10 09962 .BYTE $10 ; ...#.... B903 18 09963 .BYTE $18 ; ...##... B904 3C 09964 .BYTE $3C ; ..####.. B905 3C 09965 .BYTE $3C ; ..####.. B906 7E 09966 .BYTE $7E ; .######. B907 6E 09967 .BYTE $6E ; .##.###. B908 7A 09968 .BYTE $7A ; .####.#. B909 7E 09969 .BYTE $7E ; .######. B90A 76 09970 .BYTE $76 ; .###.##. B90B 7E 09971 .BYTE $7E ; .######. B90C 3C 09972 .BYTE $3C ; ..####.. B90D 3C 09973 .BYTE $3C ; ..####.. B90E 18 09974 .BYTE $18 ; ...##... B90F 10 09975 .BYTE $10 ; ...#.... B910 38 09976 .BYTE $38 ; ..###... B911 38 09977 .BYTE $38 ; ..###... B912 7C 09978 .BYTE $7C ; .#####.. B913 74 09979 .BYTE $74 ; .###.#.. B914 7C 09980 .BYTE $7C ; .#####.. B915 6C 09981 .BYTE $6C ; .##.##.. B916 38 09982 .BYTE $38 ; ..###... B917 38 09983 .BYTE $38 ; ..###... B918 10 09984 .BYTE $10 ; ...#.... B919 10 09985 .BYTE $10 ; ...#.... B91A 18 09986 .BYTE $18 ; ...##... B91B 3C 09987 .BYTE $3C ; ..####.. B91C 2C 09988 .BYTE $2C ; ..#.##.. B91D 3C 09989 .BYTE $3C ; ..####.. B91E 3C 09990 .BYTE $3C ; ..####.. B91F 18 09991 .BYTE $18 ; ...##... B920 08 09992 .BYTE $08 ; ....#... B921 10 09993 .BYTE $10 ; ...#.... B922 38 09994 .BYTE $38 ; ..###... B923 38 09995 .BYTE $38 ; ..###... B924 28 09996 .BYTE $28 ; ..#.#... B925 38 09997 .BYTE $38 ; ..###... B926 10 09998 .BYTE $10 ; ...#.... B927 3C 09999 .BYTE $3C ; ..####.. B928 3C 10000 .BYTE $3C ; ..####.. B929 24 10001 .BYTE $24 ; ..#..#.. B92A 3C 10002 .BYTE $3C ; ..####.. B92B 7E 10003 .BYTE $7E ; .######. B92C 7E 10004 .BYTE $7E ; .######. B92D 7E 10005 .BYTE $7E ; .######. B92E 5A 10006 .BYTE $5A ; .#.##.#. B92F FF 10007 .BYTE $FF ; ######## B930 FF 10008 .BYTE $FF ; ######## B931 42 10009 .BYTE $42 ; .#....#. B932 42 10010 .BYTE $42 ; .#....#. B933 42 10011 .BYTE $42 ; .#....#. B934 42 10012 .BYTE $42 ; .#....#. B935 42 10013 .BYTE $42 ; .#....#. B936 42 10014 .BYTE $42 ; .#....#. B937 1C 10015 .BYTE $1C ; ...###.. B938 1C 10016 .BYTE $1C ; ...###.. B939 14 10017 .BYTE $14 ; ...#.#.. B93A 3E 10018 .BYTE $3E ; ..#####. B93B 3E 10019 .BYTE $3E ; ..#####. B93C 3E 10020 .BYTE $3E ; ..#####. B93D 2A 10021 .BYTE $2A ; ..#.#.#. B93E 7F 10022 .BYTE $7F ; .####### B93F 7F 10023 .BYTE $7F ; .####### B940 22 10024 .BYTE $22 ; ..#...#. B941 22 10025 .BYTE $22 ; ..#...#. B942 22 10026 .BYTE $22 ; ..#...#. B943 22 10027 .BYTE $22 ; ..#...#. B944 22 10028 .BYTE $22 ; ..#...#. B945 18 10029 .BYTE $18 ; ...##... B946 18 10030 .BYTE $18 ; ...##... B947 3C 10031 .BYTE $3C ; ..####.. B948 3C 10032 .BYTE $3C ; ..####.. B949 3C 10033 .BYTE $3C ; ..####.. B94A 3C 10034 .BYTE $3C ; ..####.. B94B 7E 10035 .BYTE $7E ; .######. B94C 24 10036 .BYTE $24 ; ..#..#.. B94D 24 10037 .BYTE $24 ; ..#..#.. B94E 24 10038 .BYTE $24 ; ..#..#.. B94F 24 10039 .BYTE $24 ; ..#..#.. B950 10 10040 .BYTE $10 ; ...#.... B951 10 10041 .BYTE $10 ; ...#.... B952 38 10042 .BYTE $38 ; ..###... B953 38 10043 .BYTE $38 ; ..###... B954 38 10044 .BYTE $38 ; ..###... B955 7C 10045 .BYTE $7C ; .#####.. B956 28 10046 .BYTE $28 ; ..#.#... B957 28 10047 .BYTE $28 ; ..#.#... B958 28 10048 .BYTE $28 ; ..#.#... B959 18 10049 .BYTE $18 ; ...##... B95A 18 10050 .BYTE $18 ; ...##... B95B 3C 10051 .BYTE $3C ; ..####.. B95C 18 10052 .BYTE $18 ; ...##... B95D 18 10053 .BYTE $18 ; ...##... B95E 10 10054 .BYTE $10 ; ...#.... B95F 10 10055 .BYTE $10 ; ...#.... B960 38 10056 .BYTE $38 ; ..###... B961 10 10057 .BYTE $10 ; ...#.... B962 18 10058 .BYTE $18 ; ...##... B963 7E 10059 .BYTE $7E ; .######. B964 FF 10060 .BYTE $FF ; ######## B965 FF 10061 .BYTE $FF ; ######## B966 FF 10062 .BYTE $FF ; ######## B967 FF 10063 .BYTE $FF ; ######## B968 FF 10064 .BYTE $FF ; ######## B969 E7 10065 .BYTE $E7 ; ###..### B96A E7 10066 .BYTE $E7 ; ###..### B96B FF 10067 .BYTE $FF ; ######## B96C FF 10068 .BYTE $FF ; ######## B96D FF 10069 .BYTE $FF ; ######## B96E FF 10070 .BYTE $FF ; ######## B96F FF 10071 .BYTE $FF ; ######## B970 7E 10072 .BYTE $7E ; .######. B971 7E 10073 .BYTE $7E ; .######. B972 00 10074 .BYTE $00 ; ........ B973 18 10075 .BYTE $18 ; ...##... B974 3C 10076 .BYTE $3C ; ..####.. B975 7E 10077 .BYTE $7E ; .######. B976 FF 10078 .BYTE $FF ; ######## B977 FF 10079 .BYTE $FF ; ######## B978 FF 10080 .BYTE $FF ; ######## B979 E7 10081 .BYTE $E7 ; ###..### B97A 66 10082 .BYTE $66 ; .##..##. B97B FF 10083 .BYTE $FF ; ######## B97C FF 10084 .BYTE $FF ; ######## B97D FF 10085 .BYTE $FF ; ######## B97E FF 10086 .BYTE $FF ; ######## B97F 7E 10087 .BYTE $7E ; .######. B980 7E 10088 .BYTE $7E ; .######. B981 00 10089 .BYTE $00 ; ........ B982 18 10090 .BYTE $18 ; ...##... B983 3C 10091 .BYTE $3C ; ..####.. B984 7E 10092 .BYTE $7E ; .######. B985 FF 10093 .BYTE $FF ; ######## B986 FF 10094 .BYTE $FF ; ######## B987 E7 10095 .BYTE $E7 ; ###..### B988 66 10096 .BYTE $66 ; .##..##. B989 FF 10097 .BYTE $FF ; ######## B98A FF 10098 .BYTE $FF ; ######## B98B FF 10099 .BYTE $FF ; ######## B98C FF 10100 .BYTE $FF ; ######## B98D 3C 10101 .BYTE $3C ; ..####.. B98E 18 10102 .BYTE $18 ; ...##... B98F 3C 10103 .BYTE $3C ; ..####.. B990 FF 10104 .BYTE $FF ; ######## B991 FF 10105 .BYTE $FF ; ######## B992 E7 10106 .BYTE $E7 ; ###..### B993 66 10107 .BYTE $66 ; .##..##. B994 FF 10108 .BYTE $FF ; ######## B995 FF 10109 .BYTE $FF ; ######## B996 7E 10110 .BYTE $7E ; .######. B997 3C 10111 .BYTE $3C ; ..####.. B998 00 10112 .BYTE $00 ; ........ B999 18 10113 .BYTE $18 ; ...##... B99A 3C 10114 .BYTE $3C ; ..####.. B99B FF 10115 .BYTE $FF ; ######## B99C FF 10116 .BYTE $FF ; ######## B99D FF 10117 .BYTE $FF ; ######## B99E 3C 10118 .BYTE $3C ; ..####.. B99F 18 10119 .BYTE $18 ; ...##... B9A0 18 10120 .BYTE $18 ; ...##... B9A1 3C 10121 .BYTE $3C ; ..####.. B9A2 FF 10122 .BYTE $FF ; ######## B9A3 3C 10123 .BYTE $3C ; ..####.. B9A4 18 10124 .BYTE $18 ; ...##... B9A5 28 10125 .BYTE $28 ; ..#.#... B9A6 28 10126 .BYTE $28 ; ..#.#... B9A7 28 10127 .BYTE $28 ; ..#.#... B9A8 28 10128 .BYTE $28 ; ..#.#... B9A9 EE 10129 .BYTE $EE ; ###.###. B9AA 00 10130 .BYTE $00 ; ........ B9AB 00 10131 .BYTE $00 ; ........ B9AC EE 10132 .BYTE $EE ; ###.###. B9AD 28 10133 .BYTE $28 ; ..#.#... B9AE 28 10134 .BYTE $28 ; ..#.#... B9AF 28 10135 .BYTE $28 ; ..#.#... B9B0 28 10136 .BYTE $28 ; ..#.#... 10137 10138 ;*** Shape table 2 (PLAYER0..1) ************************************************ B9B1 00 10139 PLSHAP2TAB .BYTE $00 ; ........ B9B2 81 10140 .BYTE $81 ; #......# B9B3 81 10141 .BYTE $81 ; #......# B9B4 81 10142 .BYTE $81 ; #......# B9B5 81 10143 .BYTE $81 ; #......# B9B6 BD 10144 .BYTE $BD ; #.####.# B9B7 FF 10145 .BYTE $FF ; ######## B9B8 FF 10146 .BYTE $FF ; ######## B9B9 BD 10147 .BYTE $BD ; #.####.# B9BA 81 10148 .BYTE $81 ; #......# B9BB 81 10149 .BYTE $81 ; #......# B9BC 81 10150 .BYTE $81 ; #......# B9BD 81 10151 .BYTE $81 ; #......# B9BE 82 10152 .BYTE $82 ; #.....#. B9BF 82 10153 .BYTE $82 ; #.....#. B9C0 BA 10154 .BYTE $BA ; #.###.#. B9C1 FE 10155 .BYTE $FE ; #######. B9C2 FE 10156 .BYTE $FE ; #######. B9C3 BA 10157 .BYTE $BA ; #.###.#. B9C4 82 10158 .BYTE $82 ; #.....#. B9C5 82 10159 .BYTE $82 ; #.....#. B9C6 42 10160 .BYTE $42 ; .#....#. B9C7 5A 10161 .BYTE $5A ; .#.##.#. B9C8 7E 10162 .BYTE $7E ; .######. B9C9 7E 10163 .BYTE $7E ; .######. B9CA 5A 10164 .BYTE $5A ; .#.##.#. B9CB 42 10165 .BYTE $42 ; .#....#. B9CC 44 10166 .BYTE $44 ; .#...#.. B9CD 54 10167 .BYTE $54 ; .#.#.#.. B9CE 7C 10168 .BYTE $7C ; .#####.. B9CF 7C 10169 .BYTE $7C ; .#####.. B9D0 54 10170 .BYTE $54 ; .#.#.#.. B9D1 44 10171 .BYTE $44 ; .#...#.. B9D2 24 10172 .BYTE $24 ; ..#..#.. B9D3 3C 10173 .BYTE $3C ; ..####.. B9D4 3C 10174 .BYTE $3C ; ..####.. B9D5 24 10175 .BYTE $24 ; ..#..#.. B9D6 28 10176 .BYTE $28 ; ..#.#... B9D7 38 10177 .BYTE $38 ; ..###... B9D8 38 10178 .BYTE $38 ; ..###... B9D9 28 10179 .BYTE $28 ; ..#.#... B9DA 18 10180 .BYTE $18 ; ...##... B9DB 18 10181 .BYTE $18 ; ...##... B9DC 10 10182 .BYTE $10 ; ...#.... B9DD 10 10183 .BYTE $10 ; ...#.... B9DE E0 10184 .BYTE $E0 ; ###..... B9DF F8 10185 .BYTE $F8 ; #####... B9E0 F8 10186 .BYTE $F8 ; #####... B9E1 FE 10187 .BYTE $FE ; #######. B9E2 57 10188 .BYTE $57 ; .#.#.### B9E3 FE 10189 .BYTE $FE ; #######. B9E4 F8 10190 .BYTE $F8 ; #####... B9E5 F8 10191 .BYTE $F8 ; #####... B9E6 C0 10192 .BYTE $C0 ; ##...... B9E7 C0 10193 .BYTE $C0 ; ##...... B9E8 F0 10194 .BYTE $F0 ; ####.... B9E9 C0 10195 .BYTE $C0 ; ##...... B9EA F0 10196 .BYTE $F0 ; ####.... B9EB F0 10197 .BYTE $F0 ; ####.... B9EC FC 10198 .BYTE $FC ; ######.. B9ED BE 10199 .BYTE $BE ; #.#####. B9EE FC 10200 .BYTE $FC ; ######.. B9EF F0 10201 .BYTE $F0 ; ####.... B9F0 80 10202 .BYTE $80 ; #....... B9F1 80 10203 .BYTE $80 ; #....... B9F2 C0 10204 .BYTE $C0 ; ##...... B9F3 C0 10205 .BYTE $C0 ; ##...... B9F4 F0 10206 .BYTE $F0 ; ####.... B9F5 BC 10207 .BYTE $BC ; #.####.. B9F6 F0 10208 .BYTE $F0 ; ####.... B9F7 C0 10209 .BYTE $C0 ; ##...... B9F8 07 10210 .BYTE $07 ; .....### B9F9 1F 10211 .BYTE $1F ; ...##### B9FA 1F 10212 .BYTE $1F ; ...##### B9FB 7F 10213 .BYTE $7F ; .####### B9FC EA 10214 .BYTE $EA ; ###.#.#. B9FD 7F 10215 .BYTE $7F ; .####### B9FE 1F 10216 .BYTE $1F ; ...##### B9FF 1F 10217 .BYTE $1F ; ...##### BA00 03 10218 .BYTE $03 ; ......## BA01 03 10219 .BYTE $03 ; ......## BA02 0F 10220 .BYTE $0F ; ....#### BA03 03 10221 .BYTE $03 ; ......## BA04 0F 10222 .BYTE $0F ; ....#### BA05 0F 10223 .BYTE $0F ; ....#### BA06 3F 10224 .BYTE $3F ; ..###### BA07 7D 10225 .BYTE $7D ; .#####.# BA08 3F 10226 .BYTE $3F ; ..###### BA09 0F 10227 .BYTE $0F ; ....#### BA0A 01 10228 .BYTE $01 ; .......# BA0B 01 10229 .BYTE $01 ; .......# BA0C 03 10230 .BYTE $03 ; ......## BA0D 03 10231 .BYTE $03 ; ......## BA0E 0F 10232 .BYTE $0F ; ....#### BA0F 3D 10233 .BYTE $3D ; ..####.# BA10 0F 10234 .BYTE $0F ; ....#### BA11 03 10235 .BYTE $03 ; ......## BA12 18 10236 .BYTE $18 ; ...##... BA13 3C 10237 .BYTE $3C ; ..####.. BA14 7E 10238 .BYTE $7E ; .######. BA15 7E 10239 .BYTE $7E ; .######. BA16 DB 10240 .BYTE $DB ; ##.##.## BA17 C3 10241 .BYTE $C3 ; ##....## BA18 81 10242 .BYTE $81 ; #......# BA19 81 10243 .BYTE $81 ; #......# BA1A 81 10244 .BYTE $81 ; #......# BA1B 10 10245 .BYTE $10 ; ...#.... BA1C 38 10246 .BYTE $38 ; ..###... BA1D 7C 10247 .BYTE $7C ; .#####.. BA1E 7C 10248 .BYTE $7C ; .#####.. BA1F D6 10249 .BYTE $D6 ; ##.#.##. BA20 C6 10250 .BYTE $C6 ; ##...##. BA21 82 10251 .BYTE $82 ; #.....#. BA22 82 10252 .BYTE $82 ; #.....#. BA23 18 10253 .BYTE $18 ; ...##... BA24 3C 10254 .BYTE $3C ; ..####.. BA25 3C 10255 .BYTE $3C ; ..####.. BA26 66 10256 .BYTE $66 ; .##..##. BA27 66 10257 .BYTE $66 ; .##..##. BA28 42 10258 .BYTE $42 ; .#....#. BA29 42 10259 .BYTE $42 ; .#....#. BA2A 10 10260 .BYTE $10 ; ...#.... BA2B 38 10261 .BYTE $38 ; ..###... BA2C 38 10262 .BYTE $38 ; ..###... BA2D 6C 10263 .BYTE $6C ; .##.##.. BA2E 44 10264 .BYTE $44 ; .#...#.. BA2F 44 10265 .BYTE $44 ; .#...#.. BA30 18 10266 .BYTE $18 ; ...##... BA31 3C 10267 .BYTE $3C ; ..####.. BA32 24 10268 .BYTE $24 ; ..#..#.. BA33 24 10269 .BYTE $24 ; ..#..#.. BA34 10 10270 .BYTE $10 ; ...#.... BA35 38 10271 .BYTE $38 ; ..###... BA36 28 10272 .BYTE $28 ; ..#.#... BA37 18 10273 .BYTE $18 ; ...##... BA38 3C 10274 .BYTE $3C ; ..####.. BA39 7E 10275 .BYTE $7E ; .######. BA3A FF 10276 .BYTE $FF ; ######## BA3B 18 10277 .BYTE $18 ; ...##... BA3C 18 10278 .BYTE $18 ; ...##... BA3D FF 10279 .BYTE $FF ; ######## BA3E 7E 10280 .BYTE $7E ; .######. BA3F 3C 10281 .BYTE $3C ; ..####.. BA40 18 10282 .BYTE $18 ; ...##... BA41 10 10283 .BYTE $10 ; ...#.... BA42 38 10284 .BYTE $38 ; ..###... BA43 7C 10285 .BYTE $7C ; .#####.. BA44 FE 10286 .BYTE $FE ; #######. BA45 38 10287 .BYTE $38 ; ..###... BA46 38 10288 .BYTE $38 ; ..###... BA47 FE 10289 .BYTE $FE ; #######. BA48 7C 10290 .BYTE $7C ; .#####.. BA49 38 10291 .BYTE $38 ; ..###... BA4A 10 10292 .BYTE $10 ; ...#.... BA4B 18 10293 .BYTE $18 ; ...##... BA4C 3C 10294 .BYTE $3C ; ..####.. BA4D 7E 10295 .BYTE $7E ; .######. BA4E 18 10296 .BYTE $18 ; ...##... BA4F 7E 10297 .BYTE $7E ; .######. BA50 3C 10298 .BYTE $3C ; ..####.. BA51 18 10299 .BYTE $18 ; ...##... BA52 10 10300 .BYTE $10 ; ...#.... BA53 38 10301 .BYTE $38 ; ..###... BA54 7C 10302 .BYTE $7C ; .#####.. BA55 10 10303 .BYTE $10 ; ...#.... BA56 7C 10304 .BYTE $7C ; .#####.. BA57 38 10305 .BYTE $38 ; ..###... BA58 10 10306 .BYTE $10 ; ...#.... BA59 18 10307 .BYTE $18 ; ...##... BA5A 3C 10308 .BYTE $3C ; ..####.. BA5B 18 10309 .BYTE $18 ; ...##... BA5C 3C 10310 .BYTE $3C ; ..####.. BA5D 18 10311 .BYTE $18 ; ...##... BA5E 10 10312 .BYTE $10 ; ...#.... BA5F 38 10313 .BYTE $38 ; ..###... BA60 38 10314 .BYTE $38 ; ..###... BA61 10 10315 .BYTE $10 ; ...#.... 10316 10317 ;*** Display List fragments **************************************************** 10318 ; 10319 ; LOCAL VARIABLES =1000 10320 PFMEM.C0R0 = PFMEM+0*40 ; Start address of PLAYFIELD row 0 =10C8 10321 PFMEM.C0R5 = PFMEM+5*40 ; Start address of PLAYFIELD row 5 =12A8 10322 PFMEM.C0R17 = PFMEM+17*40 ; Start address of PLAYFIELD row 17 10323 10324 ;*** Display List fragment for Control Panel Display (bottom text window) ****** BA62 8D 10325 DLSTFRAG .BYTE $8D ; GR7 + DLI BA63 00 10326 .BYTE $00 ; BLK1 BA64 464909 10327 .BYTE $46,<PANELTXT,>PANELTXT ; GR1 @ PANELTXT BA67 20 10328 .BYTE $20 ; BLK3 BA68 06 10329 .BYTE $06 ; GR1 BA69 00 10330 .BYTE $00 ; BLK1 10331 10332 ;*** Display List fragment for Galactic Chart view ***************************** BA6A 012EA1 10333 DLSTFRAGGC .BYTE $01,<DLSTGC,>DLSTGC ; JMP @ DLSTGC 10334 10335 ;*** Display List fragment for Long-Range Scan view **************************** BA6D 00 10336 DLSTFRAGLRS .BYTE $00 ; BLK1 BA6E 00 10337 .BYTE $00 ; BLK1 BA6F 46F8A0 10338 .BYTE $46,<LRSHEADER,>LRSHEADER ; GR1 @ LRSHEADER BA72 4DC810 10339 .BYTE $4D,<PFMEM.C0R5,>PFMEM.C0R5 ; GR7 @ PFMEM.C0R5 10340 10341 ;*** Display List fragment for Aft view **************************************** BA75 00 10342 DLSTFRAGAFT .BYTE $00 ; BLK1 BA76 00 10343 .BYTE $00 ; BLK1 BA77 4609A1 10344 .BYTE $46,<AFTHEADER,>AFTHEADER ; GR1 @ AFTHEADER BA7A 4DC810 10345 .BYTE $4D,<PFMEM.C0R5,>PFMEM.C0R5 ; GR7 @ PFMEM.C0R5 10346 10347 ;*** Display List fragment for Front view and Title text line ****************** BA7D 4D0010 10348 DLSTFRAGFRONT .BYTE $4D,<PFMEM.C0R0,>PFMEM.C0R0 ; GR7 @ PFMEM.C0R0 BA80 0D 10349 .BYTE $0D ; GR7 BA81 0D 10350 .BYTE $0D ; GR7 BA82 0D 10351 .BYTE $0D ; GR7 BA83 0D 10352 .BYTE $0D ; GR7 BA84 0D 10353 .BYTE $0D ; GR7 BA85 30 10354 .BYTE $30 ; BLK4 BA86 461F0D 10355 .BYTE $46,<TITLETXT,>TITLETXT ; GR1 @ TITLETXT BA89 4DA812 10356 .BYTE $4D,<PFMEM.C0R17,>PFMEM.C0R17 ; GR7 @ PFMEM.C0R17 10357 10358 ;*** Display List fragment offsets relative to DLSTFRAG ************************ BA8C 1B 10359 DLSTFRAGOFFTAB .BYTE DLSTFRAGFRONT-DLSTFRAG ; Front view BA8D 13 10360 .BYTE DLSTFRAGAFT-DLSTFRAG ; Aft view BA8E 0B 10361 .BYTE DLSTFRAGLRS-DLSTFRAG ; Long-Range Scan view BA8F 08 10362 .BYTE DLSTFRAGGC-DLSTFRAG ; Galactic Chart view 10363 10364 ;*** 1-byte bit patterns for 4 pixels of same color for PLAYFIELD space objects BA90 FF 10365 FOURCOLORPIXEL .BYTE $FF ; COLOR3 BA91 FF 10366 .BYTE $FF ; COLOR3 BA92 FF 10367 .BYTE $FF ; COLOR3 BA93 FF 10368 .BYTE $FF ; COLOR3 BA94 AA 10369 .BYTE $AA ; COLOR2 BA95 FF 10370 .BYTE $FF ; COLOR3 BA96 AA 10371 .BYTE $AA ; COLOR2 BA97 FF 10372 .BYTE $FF ; COLOR3 BA98 AA 10373 .BYTE $AA ; COLOR2 BA99 AA 10374 .BYTE $AA ; COLOR2 BA9A AA 10375 .BYTE $AA ; COLOR2 BA9B FF 10376 .BYTE $FF ; COLOR3 BA9C AA 10377 .BYTE $AA ; COLOR2 BA9D AA 10378 .BYTE $AA ; COLOR2 BA9E AA 10379 .BYTE $AA ; COLOR2 BA9F AA 10380 .BYTE $AA ; COLOR2 BAA0 AA 10381 .BYTE $AA ; COLOR2 BAA1 AA 10382 .BYTE $AA ; COLOR2 BAA2 AA 10383 .BYTE $AA ; COLOR2 BAA3 55 10384 .BYTE $55 ; COLOR1 BAA4 55 10385 .BYTE $55 ; COLOR1 BAA5 AA 10386 .BYTE $AA ; COLOR2 BAA6 55 10387 .BYTE $55 ; COLOR1 BAA7 AA 10388 .BYTE $AA ; COLOR2 BAA8 55 10389 .BYTE $55 ; COLOR1 BAA9 55 10390 .BYTE $55 ; COLOR1 BAAA 55 10391 .BYTE $55 ; COLOR1 BAAB AA 10392 .BYTE $AA ; COLOR2 BAAC 55 10393 .BYTE $55 ; COLOR1 BAAD 55 10394 .BYTE $55 ; COLOR1 BAAE 55 10395 .BYTE $55 ; COLOR1 BAAF 55 10396 .BYTE $55 ; COLOR1 10397 10398 ;*** Masks to filter 1 pixel (2 bits) from 4 pixels (1 byte of PLAYFIELD memory) BAB0 C0 10399 PIXELMASKTAB .BYTE $C0 ; ##...... BAB1 30 10400 .BYTE $30 ; ..##.... BAB2 0C 10401 .BYTE $0C ; ....##.. BAB3 03 10402 .BYTE $03 ; ......## 10403 10404 ;*** Velocity table ************************************************************ BAB4 00 10405 VELOCITYTAB .BYTE 0 ; Speed 0 = 0 <KM/H> BAB5 01 10406 .BYTE 1 ; Speed 1 = 1 <KM/H> BAB6 02 10407 .BYTE 2 ; Speed 2 = 2 <KM/H> BAB7 04 10408 .BYTE 4 ; Speed 3 = 4 <KM/H> BAB8 08 10409 .BYTE 8 ; Speed 4 = 8 <KM/H> BAB9 10 10410 .BYTE 16 ; Speed 5 = 16 <KM/H> BABA 20 10411 .BYTE 32 ; Speed 6 = 32 <KM/H> BABB 40 10412 .BYTE 64 ; Speed 7 = 64 <KM/H> BABC 60 10413 .BYTE 96 ; Speed 8 = 96 <KM/H> BABD 70 10414 .BYTE 112 ; Speed 9 = 112 <KM/H> 10415 10416 ;*** Keyboard code lookup table ************************************************ BABE F2 10417 KEYTAB .BYTE $F2 ; '0' - Speed 0 BABF DF 10418 .BYTE $DF ; '1' - Speed 1 BAC0 DE 10419 .BYTE $DE ; '2' - Speed 2 BAC1 DA 10420 .BYTE $DA ; '3' - Speed 3 BAC2 D8 10421 .BYTE $D8 ; '4' - Speed 4 BAC3 DD 10422 .BYTE $DD ; '5' - Speed 5 BAC4 DB 10423 .BYTE $DB ; '6' - Speed 6 BAC5 F3 10424 .BYTE $F3 ; '7' - Speed 7 BAC6 F5 10425 .BYTE $F5 ; '8' - Speed 8 BAC7 F0 10426 .BYTE $F0 ; '9' - Speed 9 BAC8 F8 10427 .BYTE $F8 ; 'F' - Front view BAC9 FF 10428 .BYTE $FF ; 'A' - Aft view BACA C0 10429 .BYTE $C0 ; 'L' - Long-Range Scan view BACB FD 10430 .BYTE $FD ; 'G' - Galactic Chart view BACC ED 10431 .BYTE $ED ; 'T' - Tracking on/off BACD FE 10432 .BYTE $FE ; 'S' - Shields on/off BACE D2 10433 .BYTE $D2 ; 'C' - Attack Computer on/off BACF F9 10434 .BYTE $F9 ; 'H' - Hyperwarp BAD0 E5 10435 .BYTE $E5 ; 'M' - Manual Target Selector BAD1 CA 10436 .BYTE $CA ; 'P' - Pause BAD2 E7 10437 .BYTE $E7 ; 'INV' - Abort Mission 10438 10439 ;*** Engines energy drain rates per game loop iteration in energy subunits ***** BAD3 00 10440 DRAINRATETAB .BYTE 0 ; BAD4 04 10441 .BYTE 4 ; BAD5 06 10442 .BYTE 6 ; BAD6 08 10443 .BYTE 8 ; BAD7 0A 10444 .BYTE 10 ; BAD8 0C 10445 .BYTE 12 ; BAD9 0E 10446 .BYTE 14 ; BADA 1E 10447 .BYTE 30 ; BADB 2D 10448 .BYTE 45 ; BADC 3C 10449 .BYTE 60 ; 10450 10451 ;*** Hyperwarp energy depending on distance ************************************ BADD 0A 10452 WARPENERGYTAB .BYTE 10 ; = 100 energy units BADE 0D 10453 .BYTE 13 ; = 130 energy units BADF 10 10454 .BYTE 16 ; = 160 energy units BAE0 14 10455 .BYTE 20 ; = 200 energy units BAE1 17 10456 .BYTE 23 ; = 230 energy units BAE2 32 10457 .BYTE 50 ; = 500 energy units BAE3 46 10458 .BYTE 70 ; = 700 energy units BAE4 50 10459 .BYTE 80 ; = 800 energy units BAE5 5A 10460 .BYTE 90 ; = 900 energy units BAE6 78 10461 .BYTE 120 ; = 1200 energy units BAE7 7D 10462 .BYTE 125 ; = 1250 energy units BAE8 82 10463 .BYTE 130 ; = 1300 energy units BAE9 87 10464 .BYTE 135 ; = 1350 energy units BAEA 8C 10465 .BYTE 140 ; = 1400 energy units BAEB 9B 10466 .BYTE 155 ; = 1550 energy units BAEC AA 10467 .BYTE 170 ; = 1700 energy units BAED B8 10468 .BYTE 184 ; = 1840 energy units BAEE C8 10469 .BYTE 200 ; = 2000 energy units BAEF D0 10470 .BYTE 208 ; = 2080 energy units BAF0 D8 10471 .BYTE 216 ; = 2160 energy units BAF1 DF 10472 .BYTE 223 ; = 2230 energy units BAF2 E8 10473 .BYTE 232 ; = 2320 energy units BAF3 F1 10474 .BYTE 241 ; = 2410 energy units BAF4 FA 10475 .BYTE 250 ; = 2500 energy units 10476 10477 ;*** Joystick increments ******************************************************* BAF5 00 10478 STICKINCTAB .BYTE 0 ; Centered BAF6 01 10479 .BYTE 1 ; Right or up BAF7 FF 10480 .BYTE -1 ; Left or down BAF8 00 10481 .BYTE 0 ; Centered 10482 10483 ;*** 3-byte elements to draw cross hairs and Attack Computer Display *********** 10484 ; Byte 1 : Pixel column number of line start 10485 ; Byte 2 : Pixel row number of line start 10486 ; Byte 3 : B7 = 0 -> Draw line leftward 10487 ; B7 = 1 -> Draw line downward 10488 ; B6..0 -> Length of line in pixels. Possible values are: 0..127. 10489 ; 10490 ; # 10491 ; # 4 10492 ; # ############################## 10493 ; #1 # # # 10494 ; # # #11 # 10495 ; # # # # 10496 ; # #5 # 8 #6 10497 ; # ############### # 10498 ; # # # # 10499 ; 15 16 # 7 # # 10 # 10500 ; ############### ############### ######## ######### 10501 ; # #12 # # 10502 ; # # #13 # 10503 ; # ############### # 10504 ; # # 9 # # 10505 ; # # # # 10506 ; # # #14 # 10507 ; # # 3 # # 10508 ; #2 ############################## 10509 ; # 10510 ; # 10511 ; 10512 ; Front/Aft Cross Hairs Attack Computer Display 10513 ; 10514 ; LOCAL VARIABLES =0080 10515 DOWN = $80 =0000 10516 LEFT = $00 10517 BAF9 502887 10518 DRAWLINESTAB .BYTE 80,40,DOWN!7 ; Line 1 BAFC 503687 10519 .BYTE 80,54,DOWN!7 ; Line 2 10520 BAFF 77461E 10521 .BYTE 119,70,LEFT!30 ; Line 3 BB02 77561E 10522 .BYTE 119,86,LEFT!30 ; Line 4 BB05 774691 10523 .BYTE 119,70,DOWN!17 ; Line 5 BB08 944691 10524 .BYTE 148,70,DOWN!17 ; Line 6 BB0B 784E06 10525 .BYTE 120,78,LEFT!6 ; Line 7 BB0E 7E4B0F 10526 .BYTE 126,75,LEFT!15 ; Line 8 BB11 7E510F 10527 .BYTE 126,81,LEFT!15 ; Line 9 BB14 8D4E07 10528 .BYTE 141,78,LEFT!7 ; Line 10 BB17 854784 10529 .BYTE 133,71,DOWN!4 ; Line 11 BB1A 7E4C85 10530 .BYTE 126,76,DOWN!5 ; Line 12 BB1D 8C4C85 10531 .BYTE 140,76,DOWN!5 ; Line 13 BB20 855284 10532 .BYTE 133,82,DOWN!4 ; Line 14 10533 BB23 3E320F 10534 .BYTE 62,50,LEFT!15 ; Line 15 BB26 54320F 10535 .BYTE 84,50,LEFT!15 ; Line 16 BB29 FE 10536 .BYTE $FE ; End marker 10537 10538 ;*** 3-byte elements to draw our starship's shape in Long-Range Scan view ****** 10539 ; 10540 ; Line 17 18 19 20 21 10541 ; ## 10542 ; ## 10543 ; ## ## ## 10544 ; ## ## ## ## ## 10545 ; ## ## ## 10546 BB2A 4E3582 10547 .BYTE 78,53,DOWN!2 ; Line 17 BB2D 4F3482 10548 .BYTE 79,52,DOWN!2 ; Line 18 BB30 503285 10549 .BYTE 80,50,DOWN!5 ; Line 19 BB33 513482 10550 .BYTE 81,52,DOWN!2 ; Line 20 BB36 523582 10551 .BYTE 82,53,DOWN!2 ; Line 21 BB39 FE 10552 .BYTE $FE ; End marker 10553 10554 ;*** Initial x and y coordinates of a star during hyperwarp ******************** 10555 ; The following two tables are used to determine the initial x and y coordinates 10556 ; (high byte) of a star during hyperwarp. An index in 0..3 picks both the x and 10557 ; y coordinate, thus 4 pairs of coordinates are possible: 10558 ; 10559 ; Y +-------+----------------------------+----------------------------+ 10560 ; ^ | Index | x-coordinate | y-coordinate | 10561 ; | +-------+----------------------------+----------------------------+ 10562 ; |.32. | 0 | +1024..+1279 (+$04**) <KM> | +512..+767 (+$02**) <KM> | 10563 ; |...1 | 1 | +1024..+1279 (+$04**) <KM> | +768..+1023 (+$03**) <KM> | 10564 ; |...0 | 2 | +768..+1023 (+$03**) <KM> | +1024..+1279 (+$04**) <KM> | 10565 ; |.... | 3 | +512..+767 (+$02**) <KM> | +1024..+1279 (+$04**) <KM> | 10566 ; 0----->X +-------+----------------------------+----------------------------+ 10567 10568 ;*** Initial x-coordinate (high byte) of star in hyperwarp ********************* BB3A 04 10569 WARPSTARXTAB .BYTE $04 ; +1024..+1279 (+$04**) <KM> BB3B 04 10570 .BYTE $04 ; +1024..+1279 (+$04**) <KM> BB3C 03 10571 .BYTE $03 ; +768..+1023 (+$03**) <KM> BB3D 02 10572 .BYTE $02 ; +512..+767 (+$02**) <KM> 10573 10574 ;*** Initial y-coordinate (high byte) of star in hyperwarp ********************* BB3E 02 10575 WARPSTARYTAB .BYTE $02 ; +512..+767 (+$02**) <KM> BB3F 03 10576 .BYTE $03 ; +768..+1023 (+$03**) <KM> BB40 04 10577 .BYTE $04 ; +1024..+1279 (+$04**) <KM> BB41 04 10578 .BYTE $04 ; +1024..+1279 (+$04**) <KM> 10579 10580 ;*** Text of Control Panel Display (encoded in custom character set) *********** 10581 ; Row 1: "V:00 K:00 E:9999 T:0" 10582 ; Row 2: " O:-00 O:-00 R:-000 " 10583 BB42 12 10584 PANELTXTTAB .BYTE CCS.V BB43 0B 10585 .BYTE CCS.COLON BB44 00 10586 .BYTE CCS.0 BB45 00 10587 .BYTE CCS.0 BB46 0A 10588 .BYTE CCS.SPC BB47 55 10589 .BYTE CCS.COL1!CCS.K BB48 4B 10590 .BYTE CCS.COL1!CCS.COLON BB49 40 10591 .BYTE CCS.COL1!CCS.0 BB4A 40 10592 .BYTE CCS.COL1!CCS.0 BB4B 0A 10593 .BYTE CCS.SPC BB4C 8D 10594 .BYTE CCS.COL2!CCS.E BB4D 8B 10595 .BYTE CCS.COL2!CCS.COLON BB4E 89 10596 .BYTE CCS.COL2!CCS.9 BB4F 89 10597 .BYTE CCS.COL2!CCS.9 BB50 89 10598 .BYTE CCS.COL2!CCS.9 BB51 89 10599 .BYTE CCS.COL2!CCS.9 BB52 0A 10600 .BYTE CCS.SPC BB53 16 10601 .BYTE CCS.T BB54 0B 10602 .BYTE CCS.COLON BB55 00 10603 .BYTE CCS.0 10604 BB56 0A 10605 .BYTE CCS.SPC BB57 14 10606 .BYTE CCS.THETA BB58 0B 10607 .BYTE CCS.COLON BB59 0F 10608 .BYTE CCS.MINUS BB5A 00 10609 .BYTE CCS.0 BB5B 00 10610 .BYTE CCS.0 BB5C 0A 10611 .BYTE CCS.SPC BB5D 51 10612 .BYTE CCS.COL1!CCS.PHI BB5E 4B 10613 .BYTE CCS.COL1!CCS.COLON BB5F 0F 10614 .BYTE CCS.MINUS BB60 00 10615 .BYTE CCS.0 BB61 00 10616 .BYTE CCS.0 BB62 0A 10617 .BYTE CCS.SPC BB63 93 10618 .BYTE CCS.COL2!CCS.R BB64 8B 10619 .BYTE CCS.COL2!CCS.COLON BB65 0F 10620 .BYTE CCS.MINUS BB66 00 10621 .BYTE CCS.0 BB67 00 10622 .BYTE CCS.0 BB68 00 10623 .BYTE CCS.0 BB69 0A 10624 .BYTE CCS.SPC 10625 10626 ;*** Text of Galactic Chart Panel Display ************************************** 10627 ; Row 1: "WARP ENERGY: 0 " 10628 ; Row 2: "TARGETS: DC:PESCLR " 10629 ; Row 3: "STAR DATE:00.00 " 10630 BB6A 37 10631 .BYTE ROM.W BB6B 21 10632 .BYTE ROM.A BB6C 32 10633 .BYTE ROM.R BB6D 30 10634 .BYTE ROM.P BB6E 00 10635 .BYTE ROM.SPC BB6F 25 10636 .BYTE ROM.E BB70 2E 10637 .BYTE ROM.N BB71 25 10638 .BYTE ROM.E BB72 32 10639 .BYTE ROM.R BB73 27 10640 .BYTE ROM.G BB74 39 10641 .BYTE ROM.Y BB75 1A 10642 .BYTE ROM.COLON BB76 00 10643 .BYTE ROM.SPC BB77 00 10644 .BYTE ROM.SPC BB78 00 10645 .BYTE ROM.SPC BB79 10 10646 .BYTE ROM.0 BB7A 00 10647 .BYTE ROM.SPC BB7B 00 10648 .BYTE ROM.SPC BB7C 00 10649 .BYTE ROM.SPC BB7D 00 10650 .BYTE ROM.SPC 10651 BB7E B4 10652 .BYTE CCS.COL2!ROM.T BB7F A1 10653 .BYTE CCS.COL2!ROM.A BB80 B2 10654 .BYTE CCS.COL2!ROM.R BB81 A7 10655 .BYTE CCS.COL2!ROM.G BB82 A5 10656 .BYTE CCS.COL2!ROM.E BB83 B4 10657 .BYTE CCS.COL2!ROM.T BB84 B3 10658 .BYTE CCS.COL2!ROM.S BB85 9A 10659 .BYTE CCS.COL2!ROM.COLON BB86 00 10660 .BYTE ROM.SPC BB87 00 10661 .BYTE ROM.SPC BB88 24 10662 .BYTE ROM.D BB89 23 10663 .BYTE ROM.C BB8A 1A 10664 .BYTE ROM.COLON BB8B 30 10665 .BYTE ROM.P BB8C 25 10666 .BYTE ROM.E BB8D 33 10667 .BYTE ROM.S BB8E 23 10668 .BYTE ROM.C BB8F 2C 10669 .BYTE ROM.L BB90 32 10670 .BYTE ROM.R BB91 00 10671 .BYTE ROM.SPC 10672 BB92 F3 10673 .BYTE CCS.COL3!ROM.S BB93 F4 10674 .BYTE CCS.COL3!ROM.T BB94 E1 10675 .BYTE CCS.COL3!ROM.A BB95 F2 10676 .BYTE CCS.COL3!ROM.R BB96 00 10677 .BYTE ROM.SPC BB97 E4 10678 .BYTE CCS.COL3!ROM.D BB98 E1 10679 .BYTE CCS.COL3!ROM.A BB99 F4 10680 .BYTE CCS.COL3!ROM.T BB9A E5 10681 .BYTE CCS.COL3!ROM.E BB9B DA 10682 .BYTE CCS.COL3!ROM.COLON BB9C D0 10683 .BYTE CCS.COL3!ROM.0 BB9D D0 10684 .BYTE CCS.COL3!ROM.0 BB9E CE 10685 .BYTE CCS.COL3!ROM.DOT BB9F D0 10686 .BYTE CCS.COL3!ROM.0 BBA0 D0 10687 .BYTE CCS.COL3!ROM.0 BBA1 00 10688 .BYTE ROM.SPC BBA2 00 10689 .BYTE ROM.SPC BBA3 00 10690 .BYTE ROM.SPC BBA4 00 10691 .BYTE ROM.SPC BBA5 00 10692 .BYTE ROM.SPC 10693 10694 ;*** Galactic Chart sector type table ****************************************** BBA6 CF 10695 SECTORTYPETAB .BYTE $CF ; Starbase BBA7 04 10696 .BYTE $04 ; 4 Zylon ships BBA8 03 10697 .BYTE $03 ; 3 Zylon ships BBA9 02 10698 .BYTE $02 ; 1 or 2 Zylon ships 10699 10700 ;*** Phrase table ************************************************************** 10701 ; Phrases consist of phrase tokens. These are bytes that encode words, segments 10702 ; (multiple words that fit into a single line of text), and how they are displayed. 10703 ; 10704 ; LOCAL VARIABLES =0040 10705 EOP = $40 ; End of phrase =0080 10706 EOS = $80 ; End of segment =00C0 10707 LONG = $C0 ; Display title phrase for a long time 10708 10709 ; Title Phrase Offset, Text BBAA 00 10710 PHRASETAB .BYTE $00 ; (unused) BBAB 050642 10711 .BYTE $05,$06,$02!EOP ; $01 "ATTACK COMPUTER ON" BBAE 050643 10712 .BYTE $05,$06,$03!EOP ; $04 "ATTACK COMPUTER OFF" BBB1 0442 10713 .BYTE $04,$02!EOP ; $07 "SHIELDS ON" BBB3 0443 10714 .BYTE $04,$03!EOP ; $09 "SHIELDS OFF" BBB5 060742 10715 .BYTE $06,$07,$02!EOP ; $0B "COMPUTER TRACKING ON" BBB8 0743 10716 .BYTE $07,$03!EOP ; $0E "TRACKING OFF" BBBA 48 10717 .BYTE $08!EOP ; $10 "WHATS WRONG?" BBBB 094A 10718 .BYTE $09,$0A!EOP ; $11 "HYPERWARP ENGAGED" BBBD 0BCD 10719 .BYTE $0B,$0D!LONG ; $13 "STARBASE SURROUNDED" BBBF 0BCC 10720 .BYTE $0B,$0C!LONG ; $15 "STARBASE DESTROYED" BBC1 094E 10721 .BYTE $09,$0E!EOP ; $17 "HYPERWARP ABORTED" BBC3 094F 10722 .BYTE $09,$0F!EOP ; $19 "HYPERWARP COMPLETE" BBC5 D0 10723 .BYTE $10!LONG ; $1B "HYPERSPACE" BBC6 1192 10724 .BYTE $11,$12!EOS ; $1C "ORBIT ESTABLISHED" BBC8 56 10725 .BYTE $16!EOP ; $1E "STANDBY" BBC9 134E 10726 .BYTE $13,$0E!EOP ; $1F "DOCKING ABORTED" BBCB 154F 10727 .BYTE $15,$0F!EOP ; $21 "TRANSFER COMPLETE" BBCD B8 10728 .BYTE $38!EOS ; $23 " " BBCE 97 10729 .BYTE $17!EOS ; $24 "STAR FLEET TO" BBCF 99 10730 .BYTE $19!EOS ; $25 "ALL UNITS" BBD0 98 10731 .BYTE $18!EOS ; $26 "STAR CRUISER 7" BBD1 8C 10732 .BYTE $0C!EOS ; $27 "DESTROYED" BBD2 9D 10733 .BYTE $1D!EOS ; $28 "BY ZYLON FIRE" BBD3 1E9F 10734 .BYTE $1E,$1F!EOS ; $29 "POSTHUMOUS RANK IS:" BBD5 FD 10735 .BYTE $FD ; $2B "<PLACEHOLDER FOR RANK>" BBD6 25FC 10736 .BYTE $25,$FC ; $2C "CLASS <PLACEHOLDER FOR CLASS>" BBD8 78 10737 .BYTE $38!EOP ; $2E " " BBD9 9B 10738 .BYTE $1B!EOS ; $2F "STAR RAIDERS" BBDA 60 10739 .BYTE $20!EOP ; $30 "COPYRIGHT ATARI 1979" BBDB B8 10740 .BYTE $38!EOS ; $31 " " BBDC 97 10741 .BYTE $17!EOS ; $32 "STAR FLEET TO" BBDD 98 10742 .BYTE $18!EOS ; $33 "STAR CRUISER 7" BBDE 1A8E 10743 .BYTE $1A,$0E!EOS ; $34 "MISSION ABORTED" BBE0 1C94 10744 .BYTE $1C,$14!EOS ; $36 "ZERO ENERGY" BBE2 249F 10745 .BYTE $24,$1F!EOS ; $38 "NEW RANK IS" BBE4 FD 10746 .BYTE $FD ; $3A "<PLACEHOLDER FOR RANK>" BBE5 25FC 10747 .BYTE $25,$FC ; $3B "CLASS <PLACEHOLDER FOR CLASS>" BBE7 A7 10748 .BYTE $27!EOS ; $3D "REPORT TO BASE" BBE8 68 10749 .BYTE $28!EOP ; $3E "FOR TRAINING" BBE9 B8 10750 .BYTE $38!EOS ; $3F " " BBEA 97 10751 .BYTE $17!EOS ; $40 "STAR FLEET TO" BBEB 98 10752 .BYTE $18!EOS ; $41 "STAR CRUISER 7" BBEC 1A8F 10753 .BYTE $1A,$0F!EOS ; $42 "MISSION COMPLETE" BBEE 249F 10754 .BYTE $24,$1F!EOS ; $44 "NEW RANK IS:" BBF0 FD 10755 .BYTE $FD ; $46 "<PLACEHOLDER FOR RANK>" BBF1 25FC 10756 .BYTE $25,$FC ; $47 "CLASS <PLACEHOLDER FOR CLASS>" BBF3 66 10757 .BYTE $26!EOP ; $49 "CONGRATULATIONS" BBF4 2C5A 10758 .BYTE $2C,$1A!EOP ; $4A "NOVICE MISSION" BBF6 2E5A 10759 .BYTE $2E,$1A!EOP ; $4C "PILOT MISSION" BBF8 315A 10760 .BYTE $31,$1A!EOP ; $4E "WARRIOR MISSION" BBFA 335A 10761 .BYTE $33,$1A!EOP ; $50 "COMMANDER MISSION" BBFC B8 10762 .BYTE $38!EOS ; $52 " " BBFD 3476 10763 .BYTE $34,$36!EOP ; $53 "DAMAGE CONTROL" BBFF 37B5 10764 .BYTE $37,$35!EOS ; $55 "PHOTONS DAMAGED" BC01 78 10765 .BYTE $38!EOP ; $57 " " BC02 378C 10766 .BYTE $37,$0C!EOS ; $58 "PHOTONS DESTROYED" BC04 78 10767 .BYTE $38!EOP ; $5A " " BC05 23B5 10768 .BYTE $23,$35!EOS ; $5B "ENGINES DAMAGED" BC07 78 10769 .BYTE $38!EOP ; $5D " " BC08 238C 10770 .BYTE $23,$0C!EOS ; $5E "ENGINES DESTROYED" BC0A 78 10771 .BYTE $38!EOP ; $60 " " BC0B 04B5 10772 .BYTE $04,$35!EOS ; $61 "SHIELDS DAMAGED" BC0D 78 10773 .BYTE $38!EOP ; $63 " " BC0E 048C 10774 .BYTE $04,$0C!EOS ; $64 "SHIELDS DESTROYED" BC10 78 10775 .BYTE $38!EOP ; $66 " " BC11 06B5 10776 .BYTE $06,$35!EOS ; $67 "COMPUTER DAMAGED" BC13 78 10777 .BYTE $38!EOP ; $69 " " BC14 068C 10778 .BYTE $06,$0C!EOS ; $6A "COMPUTER DESTROYED" BC16 78 10779 .BYTE $38!EOP ; $6C " " BC17 A2 10780 .BYTE $22!EOS ; $6D "SECTOR SCAN" BC18 75 10781 .BYTE $35!EOP ; $6E "DAMAGED" BC19 A2 10782 .BYTE $22!EOS ; $6F "SECTOR SCAN" BC1A 4C 10783 .BYTE $0C!EOP ; $70 "DESTROYED" BC1B A1 10784 .BYTE $21!EOS ; $71 "SUB-SPACE RADIO" BC1C 75 10785 .BYTE $35!EOP ; $72 "DAMAGED" BC1D A1 10786 .BYTE $21!EOS ; $73 "SUB-SPACE RADIO" BC1E 4C 10787 .BYTE $0C!EOP ; $74 "DESTROYED" BC1F C1 10788 .BYTE $01!LONG ; $75 "RED ALERT" BC20 B8 10789 .BYTE $38!EOS ; $76 " " BC21 97 10790 .BYTE $17!EOS ; $77 "STAR FLEET TO" BC22 98 10791 .BYTE $18!EOS ; $78 "STAR CRUISER 7" BC23 1A8E 10792 .BYTE $1A,$0E!EOS ; $79 "MISSION ABORTED" BC25 249F 10793 .BYTE $24,$1F!EOS ; $7B "NEW RANK IS:" BC27 FD 10794 .BYTE $FD ; $7D "<PLACEHOLDER FOR RANK>" BC28 25FC 10795 .BYTE $25,$FC ; $7E "CLASS <PLACEHOLDER FOR CLASS>" BC2A 66 10796 .BYTE $26!EOP ; $80 "CONGRATULATIONS" 10797 10798 ;*** Word table **************************************************************** 10799 ; Bit B7 of the first byte of a word is the end-of-word marker of the preceding 10800 ; word 10801 ; 10802 ; LOCAL VARIABLES =0080 10803 EOW = $80 ; End of word 10804 BC2B A0202020 10805 WORDTAB .BYTE EOW!$20," RED ALERT" ; Word $01 BC2F 20524544 BC33 20414C45 BC37 5254 BC39 CF4E 10806 .BYTE EOW!'O,"N" ; Word $02 BC3B CF4646 10807 .BYTE EOW!'O,"FF" ; Word $03 BC3E D3484945 10808 .BYTE EOW!'S,"HIELDS" ; Word $04 BC42 4C4453 BC45 C1545441 10809 .BYTE EOW!'A,"TTACK" ; Word $05 BC49 434B BC4B C34F4D50 10810 .BYTE EOW!'C,"OMPUTER" ; Word $06 BC4F 55544552 BC53 D4524143 10811 .BYTE EOW!'T,"RACKING" ; Word $07 BC57 4B494E47 BC5B D7484154 10812 .BYTE EOW!'W,"HATS WRONG?" ; Word $08 BC5F 53205752 BC63 4F4E473F BC67 C8595045 10813 .BYTE EOW!'H,"YPERWARP" ; Word $09 BC6B 52574152 BC6F 50 BC70 C54E4741 10814 .BYTE EOW!'E,"NGAGED" ; Word $0A BC74 474544 BC77 D3544152 10815 .BYTE EOW!'S,"TARBASE" ; Word $0B BC7B 42415345 BC7F C4455354 10816 .BYTE EOW!'D,"ESTROYED" ; Word $0C BC83 524F5945 BC87 44 BC88 D3555252 10817 .BYTE EOW!'S,"URROUNDED" ; Word $0D BC8C 4F554E44 BC90 4544 BC92 C1424F52 10818 .BYTE EOW!'A,"BORTED" ; Word $0E BC96 544544 BC99 C34F4D50 10819 .BYTE EOW!'C,"OMPLETE" ; Word $0F BC9D 4C455445 BCA1 C8595045 10820 .BYTE EOW!'H,"YPERSPACE" ; Word $10 BCA5 52535041 BCA9 4345 BCAB CF524249 10821 .BYTE EOW!'O,"RBIT" ; Word $11 BCAF 54 BCB0 C5535441 10822 .BYTE EOW!'E,"STABLISHED" ; Word $12 BCB4 424C4953 BCB8 484544 BCBB C44F434B 10823 .BYTE EOW!'D,"OCKING" ; Word $13 BCBF 494E47 BCC2 C54E4552 10824 .BYTE EOW!'E,"NERGY" ; Word $14 BCC6 4759 BCC8 D452414E 10825 .BYTE EOW!'T,"RANSFER" ; Word $15 BCCC 53464552 BCD0 D354414E 10826 .BYTE EOW!'S,"TANDBY" ; Word $16 BCD4 444259 BCD7 D3544152 10827 .BYTE EOW!'S,"TAR FLEET TO" ; Word $17 BCDB 20464C45 BCDF 45542054 BCE3 4F BCE4 D3544152 10828 .BYTE EOW!'S,"TAR CRUISER 7" ; Word $18 BCE8 20435255 BCEC 49534552 BCF0 2037 BCF2 C14C4C20 10829 .BYTE EOW!'A,"LL UNITS" ; Word $19 BCF6 554E4954 BCFA 53 BCFB CD495353 10830 .BYTE EOW!'M,"ISSION" ; Word $1A BCFF 494F4E BD02 A0202020 10831 .BYTE EOW!$20," STAR RAIDERS" ; Word $1B BD06 53544152 BD0A 20524149 BD0E 44455253 BD12 DA45524F 10832 .BYTE EOW!'Z,"ERO" ; Word $1C BD16 C259205A 10833 .BYTE EOW!'B,"Y ZYLON FIRE" ; Word $1D BD1A 594C4F4E BD1E 20464952 BD22 45 BD23 D04F5354 10834 .BYTE EOW!'P,"OSTHUMOUS" ; Word $1E BD27 48554D4F BD2B 5553 BD2D D2414E4B 10835 .BYTE EOW!'R,"ANK IS:" ; Word $1F BD31 2049533A BD35 C34F5059 10836 .BYTE EOW!'C,"OPYRIGHT ATARI 1979" ; Word $20 BD39 52494748 BD3D 54204154 BD41 41524920 BD45 31393739 BD49 D355422D 10837 .BYTE EOW!'S,"UB-SPACE RADIO" ; Word $21 BD4D 53504143 BD51 45205241 BD55 44494F BD58 D3454354 10838 .BYTE EOW!'S,"ECTOR SCAN" ; Word $22 BD5C 4F522053 BD60 43414E BD63 C54E4749 10839 .BYTE EOW!'E,"NGINES" ; Word $23 BD67 4E4553 BD6A CE4557 10840 .BYTE EOW!'N,"EW" ; Word $24 BD6D C34C4153 10841 .BYTE EOW!'C,"LASS" ; Word $25 BD71 53 BD72 C34F4E47 10842 .BYTE EOW!'C,"ONGRATULATIONS" ; Word $26 BD76 52415455 BD7A 4C415449 BD7E 4F4E53 BD81 D245504F 10843 .BYTE EOW!'R,"EPORT TO BASE" ; Word $27 BD85 52542054 BD89 4F204241 BD8D 5345 BD8F C64F5220 10844 .BYTE EOW!'F,"OR TRAINING" ; Word $28 BD93 54524149 BD97 4E494E47 BD9B C7414C41 10845 .BYTE EOW!'G,"ALACTIC COOK" ; Word $29 BD9F 43544943 BDA3 20434F4F BDA7 4B BDA8 C7415242 10846 .BYTE EOW!'G,"ARBAGE SCOW CAPTAIN" ; Word $2A BDAC 41474520 BDB0 53434F57 BDB4 20434150 BDB8 5441494E BDBC D24F4F4B 10847 .BYTE EOW!'R,"OOKIE" ; Word $2B BDC0 4945 BDC2 CE4F5649 10848 .BYTE EOW!'N,"OVICE" ; Word $2C BDC6 4345 BDC8 C54E5349 10849 .BYTE EOW!'E,"NSIGN" ; Word $2D BDCC 474E BDCE D0494C4F 10850 .BYTE EOW!'P,"ILOT" ; Word $2E BDD2 54 BDD3 C14345 10851 .BYTE EOW!'A,"CE" ; Word $2F BDD6 CC494555 10852 .BYTE EOW!'L,"IEUTENANT" ; Word $30 BDDA 54454E41 BDDE 4E54 BDE0 D7415252 10853 .BYTE EOW!'W,"ARRIOR" ; Word $31 BDE4 494F52 BDE7 C3415054 10854 .BYTE EOW!'C,"APTAIN" ; Word $32 BDEB 41494E BDEE C34F4D4D 10855 .BYTE EOW!'C,"OMMANDER" ; Word $33 BDF2 414E4445 BDF6 52 BDF7 C4414D41 10856 .BYTE EOW!'D,"AMAGE" ; Word $34 BDFB 4745 BDFD C4414D41 10857 .BYTE EOW!'D,"AMAGED" ; Word $35 BE01 474544 BE04 C34F4E54 10858 .BYTE EOW!'C,"ONTROL" ; Word $36 BE08 524F4C BE0B D0484F54 10859 .BYTE EOW!'P,"HOTONS" ; Word $37 BE0F 4F4E53 BE12 A0 10860 .BYTE EOW!$20 ; Word $38 BE13 D3544152 10861 .BYTE EOW!'S,"TAR COMMANDER" ; Word $39 BE17 20434F4D BE1B 4D414E44 BE1F 4552 BE21 80 10862 .BYTE EOW!$00 ; 10863 10864 ;*** View modes **************************************************************** BE22 00 10865 VIEWMODETAB .BYTE $00 ; Front view BE23 01 10866 .BYTE $01 ; Aft view BE24 40 10867 .BYTE $40 ; Long-Range Scan view BE25 80 10868 .BYTE $80 ; Galactic Chart view 10869 10870 ;*** Title phrase offsets of "TRACKING OFF", "SHIELDS OFF", "COMPUTER OFF" ***** BE26 0E 10871 MSGOFFTAB .BYTE $0E ; "TRACKING OFF" BE27 09 10872 .BYTE $09 ; "SHIELDS OFF" BE28 04 10873 .BYTE $04 ; "COMPUTER OFF" 10874 10875 ;*** Masks to test if Tracking Computer, Shields, or Attack Computer are on **** BE29 FF 10876 MSGBITTAB .BYTE $FF ; Mask Tracking Computer BE2A 08 10877 .BYTE $08 ; Mask Shields BE2B 02 10878 .BYTE $02 ; Mask Attack Computer 10879 10880 ;*** Title phrase offsets of "COMPUTER TRACKING ON", "SHIELDS ON", "COMPUTER ON" BE2C 0B 10881 MSGONTAB .BYTE $0B ; "COMPUTER TRACKING ON" BE2D 07 10882 .BYTE $07 ; "SHIELDS ON" BE2E 01 10883 .BYTE $01 ; "COMPUTER ON" 10884 10885 ;*** The following two tables encode the PLAYER shapes ************************* 10886 ; 10887 ; PHOTON TORPEDO (shape type 0, data in shape table PLSHAP1TAB) 10888 ; Numbers at top indicate the shape table offset of the first and last shape row 10889 ; 10890 ; $01..$10 $11..$1E $1F..$2A $2B..$34 $35..$3C $3D..$42 $75..$76 $7A..$7B 10891 ; ...##... ...#.... ...##... ...#.... ...#.... ...#.... ...##... ...#.... 10892 ; ..####.. ..###... ..####.. ..###... ...##... ..###... ...##... ...#.... 10893 ; .######. .#####.. ..####.. ..###... ..####.. ..###... 10894 ; .######. .#####.. .######. .#####.. ..#.##.. ..#.#... 10895 ; .###.##. #######. .##.###. .###.#.. ..####.. ..###... 10896 ; ####.### ##.####. .####.#. .#####.. ..####.. ...#.... 10897 ; ##.##### ##.##.#. .######. .##.##.. ...##... 10898 ; ##.##### #####.#. .###.##. ..###... ....#... 10899 ; ######## ###.###. .######. ..###... 10900 ; ######## ###.###. ..####.. ...#.... 10901 ; ####.### .#####.. ..####.. 10902 ; .###.##. .#####.. ...##... 10903 ; .######. ..###... 10904 ; .######. ...#.... 10905 ; ..####.. 10906 ; ...##... 10907 ; 10908 ; ZYLON FIGHTER (shape type 1, data in shape table PLSHAP2TAB) 10909 ; Numbers at top indicate the shape table offset of the first and last shape row 10910 ; 10911 ; $01..$0C $0D..$14 $15..$1A $1B..$20 $21..$24 $25..$28 $29..$2A $2B..$2C 10912 ; #......# #.....#. .#....#. .#...#.. ..#..#.. ..#.#... ...##... ...#.... 10913 ; #......# #.....#. .#.##.#. .#.#.#.. ..####.. ..###... ...##... ...#.... 10914 ; #......# #.###.#. .######. .#####.. ..####.. ..###... 10915 ; #......# #######. .######. .#####.. ..#..#.. ..#.#... 10916 ; #.####.# #######. .#.##.#. .#.#.#.. 10917 ; ######## #.###.#. .#....#. .#...#.. 10918 ; ######## #.....#. 10919 ; #.####.# #.....#. 10920 ; #......# 10921 ; #......# 10922 ; #......# 10923 ; #......# 10924 ; 10925 ; STARBASE RIGHT (shape type 2, data in shape table PLSHAP2TAB) 10926 ; Numbers at top indicate the shape table offset of the first and last shape row 10927 ; 10928 ; $2D..$36 $38..$40 $41..$46 $36..$38 $36 $00 $00 $00 10929 ; ###..... ##...... ##...... ##...... ##...... ........ ........ ........ 10930 ; #####... ####.... ##...... ####.... 10931 ; #####... ####.... ####.... ##...... 10932 ; #######. ######.. #.####.. 10933 ; #.#.### #.#####. ####.... 10934 ; #######. ######.. ##...... 10935 ; #####... ####.... 10936 ; #####... #....... 10937 ; ##...... #....... 10938 ; ##...... 10939 ; 10940 ; STARBASE CENTER (shape type 3, data in shape table PLSHAP1TAB) 10941 ; Numbers at top indicate the shape table offset of the first and last shape row 10942 ; 10943 ; $7E..$8D $8E..$9C $9D..$A9 $AA..$B3 $B4..$BB $BC..$C0 $7B..$7D $7A..$7B 10944 ; ...##... ........ ........ ...##... ........ ...##... ...#.... ...#.... 10945 ; .######. ...##... ...##... ..####.. ...##... ..####.. ..###... ...#.... 10946 ; ######## ..####.. ..####.. ######## ..####.. ######## ...#.... 10947 ; ######## .######. .######. ######## ######## ..####.. 10948 ; ######## ######## ######## ###..### ######## ...##... 10949 ; ######## ######## ######## .##..##. ######## 10950 ; ######## ######## ###..### ######## ..####.. 10951 ; ###..### ###..### .##..##. ######## ...##... 10952 ; ###..### .##..##. ######## .######. 10953 ; ######## ######## ######## ..####.. 10954 ; ######## ######## ######## 10955 ; ######## ######## ######## 10956 ; ######## ######## ..####.. 10957 ; ######## .######. 10958 ; .######. .######. 10959 ; .######. 10960 ; 10961 ; STARBASE LEFT (shape type 4, data in shape table PLSHAP2TAB) 10962 ; Numbers at top indicate the shape table offset of the first and last shape row 10963 ; 10964 ; $47..$50 $52..$5A $5B..$60 $50..$52 $50 $00 $00 $00 10965 ; .....### ......## ......## ......## ......## ........ ........ ........ 10966 ; ...##### ....#### ......## ....#### 10967 ; ...##### ....#### ....#### ......## 10968 ; .####### ..###### ..####.# 10969 ; ###.#.#. .#####.# ....#### 10970 ; .####### ..###### ......## 10971 ; ...##### ....#### 10972 ; ...##### .......# 10973 ; ......## .......# 10974 ; ......## 10975 ; 10976 ; TRANSFER VESSEL (shape type 5, data in shape table PLSHAP1TAB) 10977 ; Numbers at top indicate the shape table offset of the first and last shape row 10978 ; 10979 ; $43..$52 $53..$60 $61..$6B $6C..$74 $75..$79 $7A..$7D $75..$76 $7A..$7B 10980 ; ..####.. ...###.. ...##... ...#.... ...##... ...#.... ...##... ...#.... 10981 ; ..####.. ...###.. ...##... ...#.... ...##... ...#.... ...##... ...#.... 10982 ; ..#..#.. ...#.#.. ..####.. ..###... ..####.. ..###... 10983 ; ..####.. ..#####. ..####.. ..###... ...##... ...#.... 10984 ; .######. ..#####. ..####.. ..###... ...##... 10985 ; .######. ..#####. ..####.. .#####.. 10986 ; .######. ..#.#.#. .######. ..#.#... 10987 ; .#.##.#. .####### ..#..#.. ..#.#... 10988 ; ######## .####### ..#..#.. ..#.#... 10989 ; ######## ..#...#. ..#..#.. 10990 ; .#....#. ..#...#. ..#..#.. 10991 ; .#....#. ..#...#. 10992 ; .#....#. ..#...#. 10993 ; .#....#. ..#...#. 10994 ; .#....#. 10995 ; .#....#. 10996 ; 10997 ; METEOR (shape type 6, data in shape table PLSHAP1TAB) 10998 ; Numbers at top indicate the shape table offset of the first and last shape row 10999 ; 11000 ; $01..$10 $11..$1E $1F..$2A $2B..$34 $35..$3C $3D..$42 $75..$76 $7A..$7B 11001 ; ...##... ...#.... ...##... ...#.... ...#.... ...#.... ...##... ...#.... 11002 ; ..####.. ..###... ..####.. ..###... ...##... ..###... ...##... ...#.... 11003 ; .######. .#####.. ..####.. ..###... ..####.. ..###... 11004 ; .######. .#####.. .######. .#####.. ..#.##.. ..#.#... 11005 ; .###.##. #######. .##.###. .###.#.. ..####.. ..###... 11006 ; ####.### ##.####. .####.#. .#####.. ..####.. ...#.... 11007 ; ##.##### ##.##.#. .######. .##.##.. ...##... 11008 ; ##.##### #####.#. .###.##. ..###... ....#... 11009 ; ######## ###.###. .######. ..###... 11010 ; ######## ###.###. ..####.. ...#.... 11011 ; ####.### .#####.. ..####.. 11012 ; .###.##. .#####.. ...##... 11013 ; .######. ..###... 11014 ; .######. ...#.... 11015 ; ..####.. 11016 ; ...##... 11017 ; 11018 ; ZYLON CRUISER (shape type 7, data in shape table PLSHAP2TAB) 11019 ; Numbers at top indicate the shape table offset of the first and last shape row 11020 ; 11021 ; $61..$69 $6A..$71 $72..$78 $79..$7E $7F..$82 $83..$85 $29..$2A $2B..$2C 11022 ; ...##... ...#.... ...##... ...#.... ...##... ...#.... ...##... ...#.... 11023 ; ..####.. ..###... ..####.. ..###... ..####.. ..###... ...##... ...#.... 11024 ; .######. .#####.. ..####.. ..###... ..#..#.. ..#.#... 11025 ; .######. .#####.. .##..##. .##.##.. ..#..#.. 11026 ; ##.##.## ##.#.##. .##..##. .#...#.. 11027 ; ##....## ##...##. .#....#. .#...#.. 11028 ; #......# #.....#. .#....#. 11029 ; #......# #.....#. 11030 ; #......# 11031 ; 11032 ; ZYLON BASESTAR (shape type 8, data in shape table PLSHAP2TAB) 11033 ; Numbers at top indicate the shape table offset of the first and last shape row 11034 ; 11035 ; $86..$8F $90..$99 $9A..$A0 $A1..$A7 $A8..$AC $AD..$B0 $29..$2A $2B..$2C 11036 ; ...##... ...#.... ...##... ...#.... ...##... ...#.... ...##... ...#.... 11037 ; ..####.. ..###... ..####.. ..###... ..####.. ..###... ...##... ...#.... 11038 ; .######. .#####.. .######. .#####.. ...##... ..###... 11039 ; ######## #######. ...##... ...#.... ..####.. ...#.... 11040 ; ...##... ..###... .######. .#####.. ...##... 11041 ; ...##... ..###... ..####.. ..###... 11042 ; ######## #######. ...##... ...#.... 11043 ; .######. .#####.. 11044 ; ..####.. ..###... 11045 ; ...##... ...#.... 11046 ; 11047 ; HYPERWARP TARGET MARKER (shape type 9, data in shape table PLSHAP1TAB) 11048 ; Numbers at top indicate the shape table offset of the first and last shape row 11049 ; 11050 ; $C1..$CC $C1..$CC $C1..$CC $C1..$CC $C1..$CC $C1..$CC $75..$76 $C1..$CC 11051 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ...##... ..#.#... 11052 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ...##... ..#.#... 11053 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... 11054 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... 11055 ; ###.###. ###.###. ###.###. ###.###. ###.###. ###.###. ###.###. 11056 ; ........ ........ ........ ........ ........ ........ ........ 11057 ; ........ ........ ........ ........ ........ ........ ........ 11058 ; ###.###. ###.###. ###.###. ###.###. ###.###. ###.###. ###.###. 11059 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... 11060 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... 11061 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... 11062 ; ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... ..#.#... 11063 11064 ;*** Shape type 0..9 offset table (10 shape cell offsets of shape type...) ***** BE2F 01111F2B 11065 PLSHAPOFFTAB .BYTE $01,$11,$1F,$2B,$35,$3D,$75,$7A ; ...0 into PLSHAP1TAB BE33 353D757A BE37 010D151B 11066 .BYTE $01,$0D,$15,$1B,$21,$25,$29,$2B ; ...1 into PLSHAP2TAB BE3B 2125292B BE3F 2D384136 11067 .BYTE $2D,$38,$41,$36,$36,$00,$00,$00 ; ...2 into PLSHAP2TAB BE43 36000000 BE47 7E8E9DAA 11068 .BYTE $7E,$8E,$9D,$AA,$B4,$BC,$7B,$7A ; ...3 into PLSHAP1TAB BE4B B4BC7B7A BE4F 47525B50 11069 .BYTE $47,$52,$5B,$50,$50,$00,$00,$00 ; ...4 into PLSHAP2TAB BE53 50000000 BE57 4353616C 11070 .BYTE $43,$53,$61,$6C,$75,$7A,$75,$7A ; ...5 into PLSHAP1TAB BE5B 757A757A BE5F 01111F2B 11071 .BYTE $01,$11,$1F,$2B,$35,$3D,$75,$7A ; ...6 into PLSHAP1TAB BE63 353D757A BE67 616A7279 11072 .BYTE $61,$6A,$72,$79,$7F,$83,$29,$2B ; ...7 into PLSHAP2TAB BE6B 7F83292B BE6F 86909AA1 11073 .BYTE $86,$90,$9A,$A1,$A8,$AD,$29,$2B ; ...8 into PLSHAP2TAB BE73 A8AD292B BE77 C1C1C1C1 11074 .BYTE $C1,$C1,$C1,$C1,$C1,$C1,$75,$C1 ; ...9 into PLSHAP1TAB BE7B C1C175C1 11075 11076 ;*** Shape type 0..9 height table (10 shape cell heights of shape type...) ***** BE7F 0F0D0B09 11077 PLSHPHEIGHTTAB .BYTE $0F,$0D,$0B,$09,$07,$05,$01,$01 ; ...0 BE83 07050101 BE87 0B070505 11078 .BYTE $0B,$07,$05,$05,$03,$03,$01,$01 ; ...1 BE8B 03030101 BE8F 09080502 11079 .BYTE $09,$08,$05,$02,$00,$00,$00,$00 ; ...2 BE93 00000000 BE97 0F0E0C09 11080 .BYTE $0F,$0E,$0C,$09,$07,$04,$02,$01 ; ...3 BE9B 07040201 BE9F 09080502 11081 .BYTE $09,$08,$05,$02,$00,$00,$00,$00 ; ...4 BEA3 00000000 BEA7 0F0D0A08 11082 .BYTE $0F,$0D,$0A,$08,$04,$03,$01,$01 ; ...5 BEAB 04030101 BEAF 0F0D0B09 11083 .BYTE $0F,$0D,$0B,$09,$07,$05,$01,$01 ; ...6 BEB3 07050101 BEB7 08070605 11084 .BYTE $08,$07,$06,$05,$03,$02,$01,$01 ; ...7 BEBB 03020101 BEBF 09090606 11085 .BYTE $09,$09,$06,$06,$04,$03,$01,$01 ; ...8 BEC3 04030101 BEC7 0B0B0B0B 11086 .BYTE $0B,$0B,$0B,$0B,$0B,$0B,$01,$0B ; ...9 BECB 0B0B010B 11087 11088 ;*** Keyboard codes to switch to Front or Aft view when Tracking Computer is on BECF F8 11089 TRACKKEYSTAB .BYTE $F8 ; 'F' - Front view BED0 FF 11090 .BYTE $FF ; 'A' - Aft view 11091 11092 ;*** Galactic Chart sector character codes (encoded in custom character set) *** BED1 0C 11093 SECTORCHARTAB .BYTE CCS.BORDERSW ; Empty sector BED2 1E 11094 .BYTE CCS.2ZYLONS ; Sector contains 1 Zylon ship BED3 1E 11095 .BYTE CCS.2ZYLONS ; Sector contains 2 Zylon ships BED4 1D 11096 .BYTE CCS.3ZYLONS ; Sector contains 3 Zylon ships BED5 1C 11097 .BYTE CCS.4ZYLONS ; Sector contains 4 Zylon ships BED6 1B 11098 .BYTE CCS.STARBASE ; Sector contains starbase 11099 11100 ;*** Mask to limit veer-off velocity of Hyperwarp Target Marker in hyperwarp *** BED7 9F 11101 VEERMASKTAB .BYTE NEG!31 ; -31..+31 <KM/H> (unused) BED8 BF 11102 .BYTE NEG!63 ; -63..+63 <KM/H> PILOT mission BED9 DF 11103 .BYTE NEG!95 ; -95..+95 <KM/H> WARRIOR mission BEDA FF 11104 .BYTE NEG!127 ; -127..+127 <KM/H> COMMANDER mission 11105 11106 ;*** Horizontal PLAYER offsets for PLAYER0..1 (STARBASE LEFT, STARBASE RIGHT) ** BEDB F8 11107 PLSTARBAOFFTAB .BYTE -8 ; -8 Player/Missile pixels BEDC 08 11108 .BYTE 8 ; +8 Player/Missile pixels 11109 11110 ;*** Mission bonus table ******************************************************* BEDD 50 11111 BONUSTAB .BYTE 80 ; Mission complete NOVICE mission BEDE 4C 11112 .BYTE 76 ; Mission complete PILOT mission BEDF 3C 11113 .BYTE 60 ; Mission complete WARRIOR mission BEE0 6F 11114 .BYTE 111 ; Mission complete COMMANDER mission 11115 BEE1 3C 11116 .BYTE 60 ; Mission aborted NOVICE mission BEE2 3C 11117 .BYTE 60 ; Mission aborted PILOT mission BEE3 32 11118 .BYTE 50 ; Mission aborted WARRIOR mission BEE4 64 11119 .BYTE 100 ; Mission aborted COMMANDER mission 11120 BEE5 28 11121 .BYTE 40 ; Starship destroyed NOVICE mission BEE6 32 11122 .BYTE 50 ; Starship destroyed PILOT mission BEE7 28 11123 .BYTE 40 ; Starship destroyed WARRIOR mission BEE8 5A 11124 .BYTE 90 ; Starship destroyed COMMANDER mission 11125 11126 ;*** Title phrase offsets of scored class rank ********************************* BEE9 A9 11127 RANKTAB .BYTE $29!EOS ; "GALACTIC COOK" BEEA AA 11128 .BYTE $2A!EOS ; "GARBAGE SCOW CAPTAIN" BEEB AA 11129 .BYTE $2A!EOS ; "GARBAGE SCOW CAPTAIN" BEEC AB 11130 .BYTE $2B!EOS ; "ROOKIE" BEED AB 11131 .BYTE $2B!EOS ; "ROOKIE" BEEE AC 11132 .BYTE $2C!EOS ; "NOVICE" BEEF AC 11133 .BYTE $2C!EOS ; "NOVICE" BEF0 AD 11134 .BYTE $2D!EOS ; "ENSIGN" BEF1 AD 11135 .BYTE $2D!EOS ; "ENSIGN" BEF2 AE 11136 .BYTE $2E!EOS ; "PILOT" BEF3 AE 11137 .BYTE $2E!EOS ; "PILOT" BEF4 AF 11138 .BYTE $2F!EOS ; "ACE" BEF5 B0 11139 .BYTE $30!EOS ; "LIEUTENANT" BEF6 B1 11140 .BYTE $31!EOS ; "WARRIOR" BEF7 B2 11141 .BYTE $32!EOS ; "CAPTAIN" BEF8 B3 11142 .BYTE $33!EOS ; "COMMANDER" BEF9 B3 11143 .BYTE $33!EOS ; "COMMANDER" BEFA B9 11144 .BYTE $39!EOS ; "STAR COMMANDER" BEFB B9 11145 .BYTE $39!EOS ; "STAR COMMANDER" 11146 11147 ;*** Scored class number table ************************************************* BEFC 95 11148 CLASSTAB .BYTE CCS.COL2!ROM.5 ; Class 5 BEFD 95 11149 .BYTE CCS.COL2!ROM.5 ; Class 5 BEFE 95 11150 .BYTE CCS.COL2!ROM.5 ; Class 5 BEFF 94 11151 .BYTE CCS.COL2!ROM.4 ; Class 4 BF00 94 11152 .BYTE CCS.COL2!ROM.4 ; Class 4 BF01 94 11153 .BYTE CCS.COL2!ROM.4 ; Class 4 BF02 94 11154 .BYTE CCS.COL2!ROM.4 ; Class 4 BF03 93 11155 .BYTE CCS.COL2!ROM.3 ; Class 3 BF04 93 11156 .BYTE CCS.COL2!ROM.3 ; Class 3 BF05 93 11157 .BYTE CCS.COL2!ROM.3 ; Class 3 BF06 92 11158 .BYTE CCS.COL2!ROM.2 ; Class 2 BF07 92 11159 .BYTE CCS.COL2!ROM.2 ; Class 2 BF08 92 11160 .BYTE CCS.COL2!ROM.2 ; Class 2 BF09 91 11161 .BYTE CCS.COL2!ROM.1 ; Class 1 BF0A 91 11162 .BYTE CCS.COL2!ROM.1 ; Class 1 BF0B 91 11163 .BYTE CCS.COL2!ROM.1 ; Class 1 11164 11165 ;*** Title phrase offsets of mission level ************************************* BF0C 4A 11166 MISSIONPHRTAB .BYTE $4A ; "NOVICE MISSION" BF0D 4C 11167 .BYTE $4C ; "PILOT MISSION" BF0E 4E 11168 .BYTE $4E ; "WARRIOR MISSION" BF0F 50 11169 .BYTE $50 ; "COMMANDER MISSION" 11170 11171 ;*** Damage probability of subsystems depending on mission level *************** BF10 00 11172 DAMAGEPROBTAB .BYTE 0 ; 0% ( 0:256) NOVICE mission BF11 50 11173 .BYTE 80 ; 31% ( 80:256) PILOT mission BF12 B4 11174 .BYTE 180 ; 70% (180:256) WARRIOR mission BF13 FE 11175 .BYTE 254 ; 99% (254:256) COMMANDER mission 11176 11177 ;*** Title phrase offsets of damaged subsystems ******************************** BF14 55 11178 DAMAGEPHRTAB .BYTE $55 ; "PHOTON TORPEDOS DAMAGED" BF15 5B 11179 .BYTE $5B ; "ENGINES DAMAGED" BF16 61 11180 .BYTE $61 ; "SHIELDS DAMAGED" BF17 67 11181 .BYTE $67 ; "COMPUTER DAMAGED" BF18 6D 11182 .BYTE $6D ; "LONG RANGE SCAN DAMAGED" BF19 71 11183 .BYTE $71 ; "SUB-SPACE RADIO DAMAGED" 11184 11185 ;*** Title phrase offsets of destroyed subsystems ****************************** BF1A 58 11186 DESTROYPHRTAB .BYTE $58 ; "PHOTON TORPEDOS DESTROYED" BF1B 5E 11187 .BYTE $5E ; "ENGINES DESTROYED" BF1C 64 11188 .BYTE $64 ; "SHIELDS DESTROYED" BF1D 6A 11189 .BYTE $6A ; "COMPUTER DESTROYED" BF1E 6F 11190 .BYTE $6F ; "LONG RANGE SCAN DESTROYED" BF1F 73 11191 .BYTE $73 ; "SUB-SPACE RADIO DESTROYED" 11192 11193 ;*** 3 x 10-byte noise sound patterns (bytes 0..7 stored in reverse order) ***** 11194 ; 11195 ; (9) AUDCTL ($D208) POKEY: Audio control 11196 ; (8) AUDF3 ($D204) POKEY: Audio channel 3 frequency 11197 ; (7) NOISETORPTIM ($DA) Timer for PHOTON TORPEDO LAUNCHED noise sound patterns 11198 ; (6) NOISEEXPLTIM ($DB) Timer for SHIP EXPLOSION and ZYLON EXPLOSION noise sound patterns 11199 ; (5) NOISEAUDC2 ($DC) Audio channel 1/2 control shadow register 11200 ; (4) NOISEAUDC3 ($DD) Audio channel 3 control shadow register 11201 ; (3) NOISEAUDF1 ($DE) Audio channel 1 frequency shadow register 11202 ; (2) NOISEAUDF2 ($DF) Audio channel 2 frequency shadow register 11203 ; (1) NOISEFRQINC ($E0) Audio channel 1/2 frequency increment 11204 ; (0) NOISELIFE ($E1) Noise sound pattern lifetime 11205 ; 11206 ; (0),(1),(2),(3),(4),(5),(6),(7),(8),(9) BF20 18FF0200 11207 NOISEPATTAB .BYTE $18,$FF,$02,$00,$8A,$A0,$00,$08,$50,$00; PHOTON TORPEDO LAUNCHED BF24 8AA00008 BF28 5000 BF2A 40400103 11208 .BYTE $40,$40,$01,$03,$88,$AF,$08,$00,$50,$04; SHIP EXPLOSION BF2E 88AF0800 BF32 5004 BF34 30400103 11209 .BYTE $30,$40,$01,$03,$84,$A8,$04,$00,$50,$04; ZYLON EXPLOSION BF38 84A80400 BF3C 5004 11210 11211 ;*** 5 x 6-byte beeper sound patterns (bytes 0..5 stored in reverse order) ***** 11212 ; 11213 ; (5) BEEPFRQIND ($D2) Running index into frequency table BEEPFRQTAB ($BF5C) 11214 ; (4) BEEPREPEAT ($D3) Number of times the beeper sound pattern sequence is repeated - 1 11215 ; (3) BEEPTONELIFE ($D4) Lifetime of tone in TICKs - 1 11216 ; (2) BEEPPAUSELIFE ($D5) Lifetime of pause in TICKs - 1 ($FF -> No pause) 11217 ; (1) BEEPPRIORITY ($D6) Beeper sound pattern priority. A playing beeper sound pattern is 11218 ; stopped if a beeper sound pattern of higher priority is about to be 11219 ; played. A value of 0 indicates that no beeper sound pattern is 11220 ; playing at the moment. 11221 ; (0) BEEPFRQSTART ($D7) Index to first byte of the beeper sound pattern frequency in table 11222 ; BEEPFRQTAB ($BF5C) 11223 ; 11224 ; Frequency-over-TICKs diagrams for all beeper sound patterns: 11225 ; 11226 ; HYPERWARP TRANSIT 11227 ; 11228 ; FRQ 11229 ; | 11230 ; $18 |-4-- 11231 ; | 11232 ; $00 | -3- 11233 ; +-------> TICKS 11234 ; <13 x > 11235 ; 11236 ; RED ALERT 11237 ; 11238 ; FRQ 11239 ; | 11240 ; $60 | --------17------- 11241 ; | 11242 ; $40 |--------17------- 11243 ; | 11244 ; +----------------------------------> TICKS 11245 ; <-------------- 8 x -------------> 11246 ; 11247 ; ACKNOWLEDGE 11248 ; 11249 ; FRQ 11250 ; | 11251 ; $10 |-3- -3- -3- 11252 ; | 11253 ; $00 | -3- -3- -3- 11254 ; +------------------> TICKS 11255 ; <------ 1 x -----> 11256 ; 11257 ; DAMAGE REPORT (not to scale) 11258 ; 11259 ; FRQ 11260 ; | 11261 ; $40 |------------33------------- 11262 ; | 11263 ; $20 | ------------33------------- 11264 ; | 11265 ; +------------------------------------------------------> TICKS 11266 ; <------------------------ 3 x -----------------------> 11267 ; 11268 ; MESSAGE FROM STARBASE (not to scale) 11269 ; 11270 ; FRQ 11271 ; | 11272 ; $51 | -----33----- 11273 ; $48 |-----33----- 11274 ; $40 | -----33----- 11275 ; | 11276 ; $00 | --9-- --9-- --9-- 11277 ; +----------------------------------------------------> TICKS 11278 ; <---------------------- 1 x ----------------------> 11279 ; 11280 ; (0),(1),(2),(3),(4),(5) BF3E 02020203 11281 BEEPPATTAB .BYTE $02,$02,$02,$03,$0C,$02 ; HYPERWARP TRANSIT BF42 0C02 BF44 0403FF10 11282 .BYTE $04,$03,$FF,$10,$07,$04 ; RED ALERT BF48 0704 BF4A 07040202 11283 .BYTE $07,$04,$02,$02,$00,$07 ; ACKNOWLEDGE BF4E 0007 BF50 0B05FF20 11284 .BYTE $0B,$05,$FF,$20,$02,$0B ; DAMAGE REPORT BF54 020B BF56 0E060820 11285 .BYTE $0E,$06,$08,$20,$00,$0E ; MESSAGE FROM STARBASE BF5A 000E 11286 11287 ;*** Beeper sound pattern frequency table ************************************** BF5C 10FF 11288 BEEPFRQTAB .BYTE $10,$FF ; (unused) (!) BF5E 18FF 11289 .BYTE $18,$FF ; HYPERWARP TRANSIT BF60 4060FF 11290 .BYTE $40,$60,$FF ; RED ALERT BF63 101010FF 11291 .BYTE $10,$10,$10,$FF ; ACKNOWLEDGE BF67 4020FF 11292 .BYTE $40,$20,$FF ; DAMAGE REPORT BF6A 484051FF 11293 .BYTE $48,$40,$51,$FF ; MESSAGE FROM STARBASE 11294 11295 ;*** Shape of blip in Attack Computer Display ********************************** BF6E 84 11296 BLIPSHAPTAB .BYTE $84 ; #....#.. BF6F B4 11297 .BYTE $B4 ; #.##.#.. BF70 FC 11298 .BYTE $FC ; ######.. BF71 B4 11299 .BYTE $B4 ; #.##.#.. BF72 84 11300 .BYTE $84 ; #....#.. 11301 11302 ;*** Initial x-coordinate (high byte) of our starship's photon torpedo ********* BF73 FF 11303 BARRELXTAB .BYTE $FF ; Left barrel = -256 (-$FF00) <KM> BF74 01 11304 .BYTE $01 ; Right barrel = +256 (+$0100) <KM> 11305 11306 ;*** Maximum photon torpedo hit z-coordinate (high byte) *********************** BF75 0C 11307 HITMAXZTAB .BYTE $0C ; < 3328 ($0C**) <KM> BF76 0C 11308 .BYTE $0C ; < 3328 ($0C**) <KM> BF77 0C 11309 .BYTE $0C ; < 3328 ($0C**) <KM> BF78 0C 11310 .BYTE $0C ; < 3328 ($0C**) <KM> BF79 0E 11311 .BYTE $0E ; < 3840 ($0E**) <KM> BF7A 0E 11312 .BYTE $0E ; < 3840 ($0E**) <KM> BF7B 0E 11313 .BYTE $0E ; < 3840 ($0E**) <KM> BF7C 20 11314 .BYTE $20 ; < 8448 ($20**) <KM> 11315 11316 ;*** Minimum photon torpedo hit z-coordinate (high byte) *********************** BF7D 00 11317 HITMINZTAB .BYTE $00 ; >= 0 ($00**) <KM> BF7E 00 11318 .BYTE $00 ; >= 0 ($00**) <KM> BF7F 00 11319 .BYTE $00 ; >= 0 ($00**) <KM> BF80 02 11320 .BYTE $02 ; >= 512 ($02**) <KM> BF81 04 11321 .BYTE $04 ; >= 1024 ($04**) <KM> BF82 06 11322 .BYTE $06 ; >= 1536 ($06**) <KM> BF83 08 11323 .BYTE $08 ; >= 2048 ($08**) <KM> BF84 0C 11324 .BYTE $0C ; >= 3072 ($0C**) <KM> 11325 11326 ;*** Velocity of homing Zylon photon torpedo *********************************** BF85 81 11327 ZYLONHOMVELTAB .BYTE NEG!1 ; -1 <KM/H> NOVICE mission BF86 84 11328 .BYTE NEG!4 ; -4 <KM/H> PILOT mission BF87 88 11329 .BYTE NEG!8 ; -8 <KM/H> WARRIOR mission BF88 94 11330 .BYTE NEG!20 ; -20 <KM/H> COMMANDER mission 11331 11332 ;*** Zylon shape type table **************************************************** BF89 80 11333 ZYLONSHAPTAB .BYTE SHAP.ZBASESTAR ; ZYLON BASESTAR BF8A 10 11334 .BYTE SHAP.ZFIGHTER ; ZYLON FIGHTER BF8B 10 11335 .BYTE SHAP.ZFIGHTER ; ZYLON FIGHTER BF8C 10 11336 .BYTE SHAP.ZFIGHTER ; ZYLON FIGHTER BF8D 70 11337 .BYTE SHAP.ZCRUISER ; ZYLON CRUISER BF8E 70 11338 .BYTE SHAP.ZCRUISER ; ZYLON CRUISER BF8F 70 11339 .BYTE SHAP.ZCRUISER ; ZYLON CRUISER BF90 10 11340 .BYTE SHAP.ZFIGHTER ; ZYLON FIGHTER 11341 11342 ;*** Zylon flight pattern table ************************************************ BF91 04 11343 ZYLONFLPATTAB .BYTE 4 ; Flight pattern 4 BF92 04 11344 .BYTE 4 ; Flight pattern 4 BF93 00 11345 .BYTE 0 ; Attack Flight Pattern 0 BF94 00 11346 .BYTE 0 ; Attack Flight Pattern 0 BF95 00 11347 .BYTE 0 ; Attack Flight Pattern 0 BF96 01 11348 .BYTE 1 ; Flight pattern 1 BF97 00 11349 .BYTE 0 ; Attack Flight Pattern 0 BF98 00 11350 .BYTE 0 ; Attack Flight Pattern 0 11351 11352 ;*** Zylon velocity table ****************************************************** BF99 3E 11353 ZYLONVELTAB .BYTE 62 ; +62 <KM/H> BF9A 1E 11354 .BYTE 30 ; +30 <KM/H> BF9B 10 11355 .BYTE 16 ; +16 <KM/H> BF9C 08 11356 .BYTE 8 ; +8 <KM/H> BF9D 04 11357 .BYTE 4 ; +4 <KM/H> BF9E 02 11358 .BYTE 2 ; +2 <KM/H> BF9F 01 11359 .BYTE 1 ; +1 <KM/H> BFA0 00 11360 .BYTE 0 ; 0 <KM/H> BFA1 00 11361 .BYTE 0 ; 0 <KM/H> BFA2 81 11362 .BYTE NEG!1 ; -1 <KM/H> BFA3 82 11363 .BYTE NEG!2 ; -2 <KM/H> BFA4 84 11364 .BYTE NEG!4 ; -4 <KM/H> BFA5 88 11365 .BYTE NEG!8 ; -8 <KM/H> BFA6 90 11366 .BYTE NEG!16 ; -16 <KM/H> BFA7 9E 11367 .BYTE NEG!30 ; -30 <KM/H> BFA8 BE 11368 .BYTE NEG!62 ; -62 <KM/H> 11369 11370 ;*** PLAYFIELD colors (including PLAYFIELD colors during DLI) ****************** BFA9 A6 11371 PFCOLORTAB .BYTE $A6 ; PF0COLOR = {GREEN} BFAA AA 11372 .BYTE $AA ; PF1COLOR = {LIGHT GREEN} BFAB AF 11373 .BYTE $AF ; PF2COLOR = {VERY LIGHT GREEN} BFAC 00 11374 .BYTE $00 ; PF3COLOR = {BLACK} BFAD 00 11375 .BYTE $00 ; BGRCOLOR = {BLACK} BFAE B8 11376 .BYTE $B8 ; PF0COLORDLI = {LIGHT MINT} BFAF 5A 11377 .BYTE $5A ; PF1COLORDLI = {MEDIUM PINK} BFB0 FC 11378 .BYTE $FC ; PF2COLORDLI = {LIGHT ORANGE} BFB1 5E 11379 .BYTE $5E ; PF3COLORDLI = {LIGHT PINK} BFB2 90 11380 .BYTE $90 ; BGRCOLORDLI = {DARK BLUE} 11381 11382 ;*** Vicinity mask table. Confines coordinates of space objects in sector ****** BFB3 FF 11383 VICINITYMASKTAB .BYTE $FF ; <= 65535 ($FF**) <KM> BFB4 FF 11384 .BYTE $FF ; <= 65535 ($FF**) <KM> BFB5 3F 11385 .BYTE $3F ; <= 16383 ($3F**) <KM> BFB6 0F 11386 .BYTE $0F ; <= 4095 ($0F**) <KM> BFB7 3F 11387 .BYTE $3F ; <= 16383 ($3F**) <KM> BFB8 7F 11388 .BYTE $7F ; <= 32767 ($7F**) <KM> BFB9 FF 11389 .BYTE $FF ; <= 65535 ($FF**) <KM> BFBA FF 11390 .BYTE $FF ; <= 65535 ($FF**) <KM> 11391 11392 ;*** Movement probability of sector types in Galactic Chart ******************** BFBB 00 11393 MOVEPROBTAB .BYTE 0 ; Empty sector 0% ( 0:256) BFBC FF 11394 .BYTE 255 ; 1 Zylon ship 100% (255:256) BFBD FF 11395 .BYTE 255 ; 2 Zylon ships 100% (255:256) BFBE C0 11396 .BYTE 192 ; 3 Zylon ships 75% (192:256) BFBF 20 11397 .BYTE 32 ; 4 Zylon ships 13% ( 32:256) 11398 11399 ;*** Galactic Chart sector offset to adjacent sector *************************** BFC0 F0 11400 COMPASSOFFTAB .BYTE -16 ; NORTH BFC1 EF 11401 .BYTE -17 ; NORTHWEST BFC2 FF 11402 .BYTE -1 ; WEST BFC3 0F 11403 .BYTE 15 ; SOUTHWEST BFC4 10 11404 .BYTE 16 ; SOUTH BFC5 11 11405 .BYTE 17 ; SOUTHEAST BFC6 01 11406 .BYTE 1 ; EAST BFC7 F1 11407 .BYTE -15 ; NORTHEAST BFC8 00 11408 .BYTE 0 ; CENTER 11409 11410 ;*** Homing velocities of photon torpedoes 0..1 depending on distance to target BFC9 00 11411 HOMVELTAB .BYTE 0 ; +0 <KM/H> BFCA 08 11412 .BYTE 8 ; +8 <KM/H> BFCB 10 11413 .BYTE 16 ; +16 <KM/H> BFCC 18 11414 .BYTE 24 ; +24 <KM/H> BFCD 28 11415 .BYTE 40 ; +40 <KM/H> BFCE 30 11416 .BYTE 48 ; +48 <KM/H> BFCF 38 11417 .BYTE 56 ; +56 <KM/H> BFD0 40 11418 .BYTE 64 ; +64 <KM/H> 11419 11420 ;*** PLAYER shape color table (bits B7..4 of color/brightness) ***************** BFD1 50 11421 PLSHAPCOLORTAB .BYTE $50 ; PHOTON TORPEDO = {PURPLE} BFD2 00 11422 .BYTE $00 ; ZYLON FIGHTER = {GRAY} BFD3 20 11423 .BYTE $20 ; STARBASE RIGHT = {ORANGE} BFD4 20 11424 .BYTE $20 ; STARBASE CENTER = {ORANGE} BFD5 20 11425 .BYTE $20 ; STARBASE LEFT = {ORANGE} BFD6 00 11426 .BYTE $00 ; TRANSFER VESSEL = {GRAY} BFD7 A0 11427 .BYTE $A0 ; METEOR = {GREEN} BFD8 00 11428 .BYTE $00 ; ZYLON CRUISER = {GRAY} BFD9 00 11429 .BYTE $00 ; ZYLON BASESTAR = {GRAY} BFDA 9F 11430 .BYTE $9F ; HYPERWARP TARGET MARKER = {SKY BLUE} 11431 11432 ;*** PLAYER shape brightness table (bits B3..0 of color/brightness) ************ BFDB 0E 11433 PLSHAPBRITTAB .BYTE $0E ; ##############.. BFDC 0E 11434 .BYTE $0E ; ##############.. BFDD 0E 11435 .BYTE $0E ; ##############.. BFDE 0C 11436 .BYTE $0C ; ############.... BFDF 0C 11437 .BYTE $0C ; ############.... BFE0 0C 11438 .BYTE $0C ; ############.... BFE1 0A 11439 .BYTE $0A ; ##########...... BFE2 0A 11440 .BYTE $0A ; ##########...... BFE3 0A 11441 .BYTE $0A ; ##########...... BFE4 08 11442 .BYTE $08 ; ########........ BFE5 08 11443 .BYTE $08 ; ########........ BFE6 08 11444 .BYTE $08 ; ########........ BFE7 06 11445 .BYTE $06 ; ######.......... BFE8 06 11446 .BYTE $06 ; ######.......... BFE9 04 11447 .BYTE $04 ; ####............ BFEA 04 11448 .BYTE $04 ; ####............ 11449 11450 ;*** PHOTON TORPEDO LAUNCHED noise bit and volume (stored in reverse order) **** BFEB 8A 11451 NOISETORPVOLTAB .BYTE $8A ; ##########..... BFEC 8F 11452 .BYTE $8F ; ############### BFED 8D 11453 .BYTE $8D ; #############.. BFEE 8B 11454 .BYTE $8B ; ###########.... BFEF 89 11455 .BYTE $89 ; #########...... BFF0 87 11456 .BYTE $87 ; #######........ BFF1 85 11457 .BYTE $85 ; ######......... BFF2 83 11458 .BYTE $83 ; ###............ 11459 11460 ;*** PHOTON TORPEDO LAUNCHED noise frequency table (stored in reverse order) *** BFF3 00 11461 NOISETORPFRQTAB .BYTE $00 ; BFF4 04 11462 .BYTE $04 ; BFF5 01 11463 .BYTE $01 ; BFF6 04 11464 .BYTE $04 ; BFF7 01 11465 .BYTE $01 ; BFF8 04 11466 .BYTE $04 ; BFF9 01 11467 .BYTE $01 ; BFFA 04 11468 .BYTE $04 ; 11469 BFFB 07 11470 .BYTE $07 ; (unused) 11471 BFFC 00 11472 .BYTE $00 ; Always 0 for cartridges BFFD 80 11473 .BYTE $80 ; On SYSTEM RESET jump to INITCOLD via BFFE 4AA1 11474 .WORD INITCOLD ; Cartridge Initialization Address SYMBOLS (SORTED BY NAME): 896 A980 ABORTWARP A109 AFTHEADER =0092 ARRVSECTOR =D203 AUDC2 =D205 AUDC3 =D207 AUDC4 =D208 AUDCTL =D200 AUDF1 =D202 AUDF2 =D204 AUDF3 =D206 AUDF4 =0087 BARRELNR BF73 BARRELXTAB B3A6 BEEP =00D2 BEEPFRQIND =00D7 BEEPFRQSTART BF5C BEEPFRQTAB =00D8 BEEPLIFE BF3E BEEPPATTAB =00D5 BEEPPAUSELIFE =00D6 BEEPPRIORITY =00D3 BEEPREPEAT =00D9 BEEPTOGGLE =00D4 BEEPTONELIFE =00F6 BGRCOLOR =00FB BGRCOLORDLI =00A0 BLIPCOLUMN =00A2 BLIPCYCLECNT =00A1 BLIPROW BF6E BLIPSHAPTAB BEDD BONUSTAB B1A7 CALCWARP =0000 CCS.0 =0001 ?CCS.1 =0002 ?CCS.2 =001E CCS.2ZYLONS =0003 ?CCS.3 =001D CCS.3ZYLONS =0004 ?CCS.4 =001C CCS.4ZYLONS =0005 ?CCS.5 =0006 ?CCS.6 =0007 ?CCS.7 =0008 ?CCS.8 =0009 CCS.9 =0018 CCS.BORDERS =000C CCS.BORDERSW =0019 CCS.BORDERW =0017 ?CCS.C =0040 CCS.COL1 =0080 CCS.COL2 =00C0 CCS.COL3 =000B CCS.COLON =001A CCS.CORNERSW =000D CCS.E =000E CCS.INF =0015 CCS.K =000F CCS.MINUS =0011 CCS.PHI =0010 CCS.PLUS =0013 CCS.R =000A CCS.SPC =001B CCS.STARBASE =0016 CCS.T =0014 CCS.THETA =0012 CCS.V A000 CHARSET =D409 CHBASE BEFC CLASSTAB A98D CLEANUPWARP =0074 CLOCKTIM AE0F CLRMEM AE0D CLRPLAYFIELD AF3D COLLISION =D016 COLPF0 =D012 COLPM0 BFC0 COMPASSOFFTAB =D01F CONSOL ACAF COPYPOSVEC ACC1 COPYPOSXY =0076 COUNT256 =0072 COUNT8 =00A7 CTRLDZYLON =0090 CURRSECTOR AEE1 DAMAGE BF14 DAMAGEPHRTAB BF10 DAMAGEPROBTAB B86F DECENERGY BF1A DESTROYPHRTAB =00A4 DIRLEN =006A DIVIDEND =D402 DLIST BA62 DLSTFRAG BA75 DLSTFRAGAFT BA7D DLSTFRAGFRONT BA6A DLSTFRAGGC BA6D DLSTFRAGLRS BA8C DLSTFRAGOFFTAB A12E DLSTGC A718 DLSTHNDLR =D400 DMACTL ACE6 DOCKING =0075 DOCKSTATE =0080 DOWN =0080 DRAINRATE BAD3 DRAINRATETAB B4B9 DRAWGC A782 DRAWLINE A784 DRAWLINE2 A76F DRAWLINES BAF9 DRAWLINESTAB =0280 DSPLST A987 ENDWARP =007F ENERGYCNT =0955 ENERGYD1 =0040 EOP =0080 EOS =0080 EOW =0073 EXPLLIFE =0063 FKEYCODE B4E4 FLUSHGAMELOOP BA90 FOURCOLORPIXEL A1F3 GAMELOOP B10A GAMEOVER B121 GAMEOVER2 A11A GCHEADER =08C9 GCMEMMAP =0D35 GCPFMEM =09A3 GCSTARDAT =0995 GCSTATCOM =0993 GCSTATENG =0996 GCSTATLRS =0992 GCSTATPHO =0997 GCSTATRAD =0994 GCSTATSHL =098D GCTRGCNT =0971 GCTXT =097D GCWARPD1 =D01D GRACTL =008A HITBADNESS =D01E HITCLR BF75 HITMAXZTAB BF7D HITMINZTAB AECA HOMINGVEL BFC9 HOMVELTAB =D004 HPOSM0 =D005 HPOSM1 =D006 HPOSM2 =D007 HPOSM3 =D000 HPOSP0 =D001 HPOSP1 =D002 HPOSP2 =D003 HPOSP3 =0094 HUNTSECTCOLUMN =0093 HUNTSECTOR =0095 HUNTSECTROW =009F HUNTTIM A89B HYPERWARP =0066 IDLECNTHI =0077 IDLECNTLO A14A INITCOLD A15C INITDEMO AC6B INITEXPL B3BA INITIALIZE B764 INITPOSVEC A15A INITSELECT A15E INITSTART A9B4 INITTRAIL =D20E IRQEN A751 IRQHNDLR =007E ISATTCOMPON =00B8 ISBACKATTACK0 =00B9 ?ISBACKATTACK1 =0064 ISDEMOMODE =00A3 ISINLOCKON =007D ISSHIELDSON =007B ISSTARBASESECT B7F1 ISSURROUNDED =007C ISTRACKCOMPON =0086 ISTRACKING =0067 ISVBISYNC =006D JOYSTICKDELTA =00C8 JOYSTICKX =00C9 JOYSTICKY A47D JUMP001 A4A4 JUMP002 A579 JUMP003 A74B JUMP004 =D209 KBCODE AFFE KEYBOARD =00CA KEYCODE BABE KEYTAB =0950 KILLCNTD1 =006B L.ABSDIFFCOL =006B L.BITPAT =006B L.COLORMASK =006B L.COLUMNPOS =006A L.CTRLDZYLON =006A L.DIFFC =006A L.DIRECTIONIND =006E L.DIRSAV =0068 L.DIVISOR =006A L.FOURCOLORPIX =006A L.GCMEMMAPIND =006A L.HEIGHTCNT =006A L.ISDESTROYED =006A L.KEYCODE =006E L.LOOPCNT =006B L.LOOPCNT2 =006A L.MAXRNDXY =0068 L.MEMPTR1 =006A L.MEMPTR2 =006A L.NEWSECTOR =006A L.NUMBYTES =006A L.PIXELBYTEOFF =006D L.PIXELCOLUMN =006D L.PIXELROW =006B L.PLHIT =006D L.QUOTIENT =0068 L.RANGE =006A L.RANGEINDEX =006B L.SECTORCNT =006A L.SECTORTYPE =006C L.SHIFTSHAPE =006A L.SIGNCHAR =006B L.TERM3HI =006A L.TERM3LO =006C L.TERM3SIGN =006C L.TOKEN =006E L.TRAILCNT =006A L.VECCOMPIND =006B L.VELOCITYHI =006A L.VELSIGN =006C L.VIEWDIR =006A L.WARPARRVCOL =006A L.WORD =006E L.ZPOSOFF =0000 LEFT =0088 LOCKONLIFE =00C0 LONG A165 LOOP001 A201 LOOP002 A227 LOOP003 A26A LOOP004 A277 LOOP005 A284 LOOP006 A291 LOOP007 A29E LOOP008 A2BA LOOP009 A2E0 LOOP010 A306 LOOP011 A327 LOOP012 A343 LOOP013 A389 LOOP014 A3A6 LOOP015 A3BD LOOP016 A3E4 LOOP017 A3EB LOOP018 A422 LOOP019 A428 LOOP020 A453 LOOP021 A4C0 LOOP022 A4E7 LOOP023 A4FC LOOP024 A593 LOOP025 A6F6 LOOP026 A730 LOOP027 A765 LOOP028 A78E LOOP029 A7CF LOOP030 A83A LOOP031 A83C LOOP032 A947 LOOP033 A9E5 LOOP034 AA52 LOOP035 AAB5 LOOP036 ABB3 LOOP037 ABCA LOOP038 ABFC LOOP039 AC73 LOOP040 ADCA LOOP041 ADD7 LOOP042 ADF4 LOOP043 ADFB LOOP044 AE1A LOOP045 AEB3 LOOP046 AEE7 LOOP047 AF3F LOOP048 AFD5 LOOP049 AFEC LOOP050 B011 LOOP051 B056 LOOP052 B1FE LOOP053 B200 LOOP054 B234 LOOP055 B276 LOOP056 B286 LOOP057 B2C1 LOOP058 B3AF LOOP059 B3BC LOOP060 B3EE LOOP061 B41B LOOP062 B441 LOOP063 B44C LOOP064 B488 LOOP065 B492 LOOP066 B4BD LOOP067 B51C LOOP068 B54E LOOP069 B57C LOOP070 B5C1 LOOP071 B5D1 LOOP072 B5EA LOOP073 B5EF LOOP074 B601 LOOP075 B632 LOOP076 B662 LOOP077 B664 LOOP078 B896 LOOP079 A0F8 LRSHEADER =D008 M0PL =D009 M1PL =D00A M2PL =D00B M3PL AA79 MANEUVER =0DE9 MAPTO80 =0EE9 MAPTOBCD99 =0079 MAXSPCOBJIND =0010 MAXSPCOBJIND.NL =0031 MAXSPCOBJNUM =0068 MEMPTR =00AA MILESTTIM0 =00AB ?MILESTTIM1 =00AE ?MILESTVELINDX0 =00AF ?MILESTVELINDX1 =00B0 ?MILESTVELINDY0 =00B1 ?MILESTVELINDY1 =00AC MILESTVELINDZ0 =00AD ?MILESTVELINDZ1 =0062 MISSIONLEVEL BF0C MISSIONPHRTAB ADF1 MODDLST BFBB MOVEPROBTAB BE29 MSGBITTAB BE26 MSGOFFTAB BE2C MSGONTAB =0080 NEG =0065 NEWTITLEPHR =0071 NEWVELOCITY =0096 NEWZYLONDIST =D40E NMIEN AEA8 NOISE =00DC NOISEAUDC2 =00DD NOISEAUDC3 =00DE NOISEAUDF1 =00DF NOISEAUDF2 =00DB NOISEEXPLTIM =00E0 NOISEFRQINC =00E3 NOISEHITLIFE =00E1 NOISELIFE BF20 NOISEPATTAB BFF3 NOISETORPFRQTAB =00DA NOISETORPTIM BFEB NOISETORPVOLTAB =00E2 NOISEZYLONTIM =0084 OLDTRIG0 =009E OLDZYLONDIST =D00F P3PL =D302 PACTL =0949 PANELTXT BB42 PANELTXTTAB =00A6 PENCOLUMN =00A5 PENROW =00F2 PF0COLOR =00F7 PF0COLORDLI =00F3 ?PF1COLOR =00F8 ?PF1COLORDLI =00F4 PF2COLOR =00F9 ?PF2COLORDLI =00F5 ?PF3COLOR =00FA ?PF3COLORDLI BFA9 PFCOLORTAB =1000 PFMEM =1000 PFMEM.C0R0 =12A8 PFMEM.C0R17 =10C8 PFMEM.C0R5 =1B36 PFMEM.C120R71 =1BFE PFMEM.C120R76 =1C9E PFMEM.C120R80 =1D40 PFMEM.C128R84 =1D68 PFMEM.C128R85 =1D42 PFMEM.C136R84 =1D6A PFMEM.C136R85 =1C04 PFMEM.C144R76 =1CA4 PFMEM.C144R80 =17BB PFMEM.C76R49 =17E3 PFMEM.C76R50 =17BC PFMEM.C80R49 =17E4 PFMEM.C80R50 =0864 PFMEMROWHI =0800 PFMEMROWLO =0966 PHIC1 BBAA PHRASETAB =0CEE PIXELBYTE =0C8C PIXELBYTEOFF =0C2A PIXELCOLUMN BAB0 PIXELMASKTAB =0C5B PIXELROW =0BF9 PIXELROWNEW =0CBD PIXELSAVE =00EE PL0COLOR =0C2A PL0COLUMN =0400 PL0DATA =0CBD PL0HEIGHT =0CEE PL0HEIGHTNEW =00E9 PL0LIFE =0C5B PL0ROW =0BF9 PL0ROWNEW =00E4 PL0SHAPOFF =0C8C PL0SHAPTYPE =0B97 ?PL0XVEL =0BC8 ?PL0YVEL =0A40 PL0ZPOSHI =0B66 ?PL0ZVEL =00EF ?PL1COLOR =0C2B PL1COLUMN =0500 PL1DATA =0CBE PL1HEIGHT =0CEF PL1HEIGHTNEW =00EA PL1LIFE =0C5C PL1ROW =0BFA PL1ROWNEW =00E5 PL1SHAPOFF =0C8D PL1SHAPTYPE =0B98 ?PL1XVEL =0BC9 ?PL1YVEL =0B67 ?PL1ZVEL =00F0 ?PL2COLOR =0C2C PL2COLUMN =0600 PL2DATA =0CBF PL2HEIGHT =0CF0 PL2HEIGHTNEW =00EB PL2LIFE =0C5D PL2ROW =0BFB PL2ROWNEW =00E6 PL2SHAPOFF =0C8E PL2SHAPTYPE =0A73 PL2XPOSHI =0B06 ?PL2XPOSLO =09E0 ?PL2XPOSSIGN =0B99 PL2XVEL =0AA4 PL2YPOSHI =0B37 ?PL2YPOSLO =0A11 PL2YPOSSIGN =0BCA PL2YVEL =0A42 PL2ZPOSHI =0AD5 PL2ZPOSLO =09AF PL2ZPOSSIGN =0B68 PL2ZVEL =00F1 ?PL3COLOR =0C2D PL3COLUMN =0700 PL3DATA =0CC0 PL3HEIGHT =0CF1 PL3HEIGHTNEW =0082 PL3HIT =00EC PL3LIFE =0C5E PL3ROW =0BFC PL3ROWNEW =00E7 PL3SHAPOFF =0C8F PL3SHAPTYPE =0A74 PL3XPOSHI =0B07 PL3XPOSLO =09E1 PL3XPOSSIGN =0B9A PL3XVEL =0AA5 PL3YPOSHI =0B38 PL3YPOSLO =0A12 PL3YPOSSIGN =0BCB PL3YVEL =0A43 PL3ZPOSHI =0AD6 PL3ZPOSLO =09B0 PL3ZPOSSIGN =0B69 PL3ZVEL =0C2E PL4COLUMN =0300 PL4DATA =0CC1 PL4HEIGHT =0CF2 PL4HEIGHTNEW =0083 PL4HIT =00ED PL4LIFE =0C5F PL4ROW =0BFD PL4ROWNEW =00E8 PL4SHAPOFF =0C90 PL4SHAPTYPE =0A75 PL4XPOSHI =0B08 ?PL4XPOSLO =09E2 PL4XPOSSIGN =0B9B PL4XVEL =0AA6 PL4YPOSHI =0B39 ?PL4YPOSLO =0A13 PL4YPOSSIGN =0BCC PL4YVEL =0A44 PL4ZPOSHI =0AD7 ?PL4ZPOSLO =09B1 PL4ZPOSSIGN =0B6A PL4ZVEL B8DF PLCOLOROFFTAB B8E4 PLSHAP1TAB B9B1 PLSHAP2TAB BFDB PLSHAPBRITTAB BFD1 PLSHAPCOLORTAB BE2F PLSHAPOFFTAB BE7F PLSHPHEIGHTTAB BEDB PLSTARBAOFFTAB =0089 PLTRACKED =D407 PMBASE =D300 PORTA =D01B PRIOR AA21 PROJECTION =D20A RANDOM =096C RANGEC1 BEE9 RANKTAB =008B REDALERTLIFE B7BE RNDINVXY =0010 ROM.0 =0011 ROM.1 =0012 ROM.2 =0013 ROM.3 =0014 ROM.4 =0015 ROM.5 =0019 ROM.9 =0021 ROM.A =0023 ROM.C =001A ROM.COLON =0024 ROM.D =000E ROM.DOT =0025 ROM.E =0027 ROM.G =002C ROM.L =002E ROM.N =0030 ROM.P =0032 ROM.R =0033 ROM.S =0000 ROM.SPC =0034 ROM.T =0037 ROM.W =0039 ROM.Y =E000 ROMCHARSET B69B ROTATE =007A SAVMAXSPCOBJIND =00CB SCORE =00CE SCOREDCLASSIND =00CD SCOREDRANKIND B6FB SCREENCOLUMN B71E SCREENROW BED1 SECTORCHARTAB BBA6 SECTORTYPETAB B162 SELECTWARP B223 SETTITLE B045 SETVIEW =0090 SHAP.HYPERWARP =0060 SHAP.METEOR =0030 SHAP.STARBASEC =0020 SHAP.STARBASEL =0040 SHAP.STARBASER =0000 ?SHAP.TORPEDO =0050 SHAP.TRANSVSSL =0080 SHAP.ZBASESTAR =0070 SHAP.ZCRUISER =0010 SHAP.ZFIGHTER =0081 SHIELDSCOLOR =00D0 SHIPVIEW B8A7 SHOWCOORD B8CD SHOWDIGITS =D20F SKCTL A172 SKIP001 A21F SKIP002 A250 SKIP003 A262 SKIP004 A2C2 SKIP005 A2E8 SKIP006 A30E SKIP007 A39E SKIP008 A3BB SKIP009 A3C6 SKIP010 A3DF SKIP011 A3EA SKIP012 A3FE SKIP013 A43C SKIP014 A43F SKIP015 A473 SKIP016 A49A SKIP017 A4A7 SKIP018 A4AD SKIP019 A4CA SKIP020 A4DB SKIP021 A4E5 SKIP022 A4ED SKIP023 A503 SKIP024 A52A SKIP025 A52E SKIP026 A53E SKIP027 A548 SKIP028 A569 SKIP029 A58D SKIP030 A5A3 SKIP031 A5A5 SKIP032 A5AB SKIP033 A5D0 SKIP034 A600 SKIP035 A60C SKIP036 A61B SKIP037 A635 SKIP038 A687 SKIP039 A69B SKIP040 A6B7 SKIP041 A6C2 SKIP042 A6E9 SKIP043 A6EA SKIP044 A6F2 SKIP045 A715 SKIP046 A728 SKIP047 A77A SKIP048 A781 SKIP049 A7B8 SKIP050 A7BA SKIP051 A7E1 SKIP052 A7E9 SKIP053 A7EC SKIP054 A804 SKIP055 A80A SKIP056 A821 SKIP057 A827 SKIP058 A830 SKIP059 A850 SKIP060 A85F SKIP061 A898 SKIP062 A8AC SKIP063 A8E8 SKIP064 A8EC SKIP065 A900 SKIP066 A901 SKIP067 A915 SKIP068 A91E SKIP069 A96F SKIP070 A97F SKIP071 A9A6 SKIP072 AA1A SKIP073 AA20 SKIP074 AA40 SKIP075 AA66 SKIP076 AA6F SKIP077 AA78 SKIP078 AA90 SKIP079 AAB3 SKIP080 AAC8 SKIP081 AACF SKIP082 AAD5 SKIP083 AADD SKIP084 AAE0 SKIP085 AAF4 SKIP086 AB00 SKIP087 AB03 SKIP088 AB09 SKIP089 AB11 SKIP090 AB36 SKIP091 AB37 SKIP092 AB66 SKIP093 AB84 SKIP094 AB98 SKIP095 AB9C SKIP096 ABAE SKIP097 ABBA SKIP098 ABC4 SKIP099 ABDD SKIP100 ABE1 SKIP101 ABE5 SKIP102 ABE9 SKIP103 ABEB SKIP104 ABFA SKIP105 AC08 SKIP106 AC0A SKIP107 AC31 SKIP108 AC32 SKIP109 AC4F SKIP110 ACE5 SKIP111 ACF3 SKIP112 AD12 SKIP113 AD26 SKIP114 AD35 SKIP115 AD61 SKIP116 AD6C SKIP117 AD70 SKIP118 AD71 SKIP119 AD82 SKIP120 ADB8 SKIP121 ADB9 SKIP122 AE03 SKIP123 AE40 SKIP124 AE41 SKIP125 AE56 SKIP126 AE58 SKIP127 AE66 SKIP128 AEB1 SKIP129 AEC9 SKIP130 AED2 SKIP131 AEDA SKIP132 AF10 SKIP133 AF19 SKIP134 AF1E SKIP135 AF32 SKIP136 AF3C SKIP137 AF43 SKIP138 AF58 SKIP139 AF64 SKIP140 AF6F SKIP141 AF94 SKIP142 AFC6 SKIP143 AFE7 SKIP144 AFF3 SKIP145 AFFD SKIP146 B020 SKIP147 B02B SKIP148 B036 SKIP149 B040 SKIP150 B041 SKIP151 B060 SKIP152 B073 SKIP153 B082 SKIP154 B096 SKIP155 B099 SKIP156 B0E6 SKIP157 B0ED SKIP158 B0FB SKIP159 B0FC SKIP160 B106 SKIP161 B14A SKIP162 B15A SKIP163 B15D SKIP164 B161 SKIP165 B16A SKIP166 B16B SKIP167 B173 SKIP168 B1BE SKIP169 B1C8 SKIP170 B1D3 SKIP171 B1E0 SKIP172 B212 SKIP173 B21E SKIP174 B21F SKIP175 B22E SKIP176 B23A SKIP177 B249 SKIP178 B25F SKIP179 B268 SKIP180 B27C SKIP181 B2A2 SKIP182 B2A8 SKIP183 B2E1 SKIP184 B2E6 SKIP185 B2F3 SKIP186 B32B SKIP187 B337 SKIP188 B349 SKIP189 B357 SKIP190 B369 SKIP191 B397 SKIP192 B39F SKIP193 B3B9 SKIP194 B3CA SKIP195 B47C SKIP196 B4C6 SKIP197 B4F5 SKIP198 B50F SKIP199 B511 SKIP200 B516 SKIP201 B51A SKIP202 B527 SKIP203 B536 SKIP204 B53E SKIP205 B544 SKIP206 B562 SKIP207 B565 SKIP208 B569 SKIP209 B56A SKIP210 B574 SKIP211 B59A SKIP212 B5B0 SKIP213 B5BB SKIP214 B5DA SKIP215 B619 SKIP216 B61C SKIP217 B61D SKIP218 B644 SKIP219 B655 SKIP220 B68D SKIP221 B68F SKIP222 B698 SKIP223 B6A4 SKIP224 B6E1 SKIP225 B709 SKIP226 B717 SKIP227 B72E SKIP228 B73E SKIP229 B745 SKIP230 B74A SKIP231 B753 SKIP232 B75A SKIP233 B763 SKIP234 B785 SKIP235 B7A9 SKIP236 B7D7 SKIP237 B7F0 SKIP238 B803 SKIP239 B810 SKIP240 B812 SKIP241 B822 SKIP242 B85C SKIP243 B88C SKIP244 B88E SKIP245 B8A6 SKIP246 B8BD SKIP247 B2AB SOUND BAF5 STICKINCTAB =D209 STIMER =0960 THETAC1 =00CF TITLELIFE =00D1 TITLEPHR =0D1F TITLETXT =00BE TORPEDODELAY =095A TRACKC1 =095C TRACKDIGIT BECF TRACKKEYSTAB =00C2 TRAILDELAY =00C3 TRAILIND =D010 TRIG0 AE29 TRIGGER A7BF UPDATTCOMP B804 UPDPANEL B07B UPDSCREEN B216 UPDTITLE A6D1 VBIHNDLR =D40B VCOUNT =0200 VDSLST =00C6 VEERMASK BED7 VEERMASKTAB =094B VELOCD1 =00C1 VELOCITYHI =0070 VELOCITYLO BAB4 VELOCITYTAB =00C7 VICINITYMASK BFB3 VICINITYMASKTAB BE22 VIEWMODETAB =0216 VIMIRQ =0222 VVBLKI =008F WARPARRVCOLUMN =008E WARPARRVROW =008D WARPDEPRCOLUMN =008C WARPDEPRROW =0091 WARPENERGY BADD WARPENERGYTAB BB3A WARPSTARXTAB BB3E WARPSTARYTAB =00C0 WARPSTATE =00C4 WARPTEMPCOLUMN =00C5 WARPTEMPROW BC2B WORDTAB =D40A WSYNC =0A71 XPOSHI =0B04 XPOSLO =09DE XPOSSIGN =0B97 XVEL =0AA2 YPOSHI =0B35 YPOSLO =0A0F YPOSSIGN =0BC8 YVEL =0A40 ZPOSHI =0AD3 ZPOSLO =09AD ZPOSSIGN =0B66 ZVEL =00BF ZYLONATTACKER =00A8 ZYLONFLPAT0 =00A9 ?ZYLONFLPAT1 BF91 ZYLONFLPATTAB BF85 ZYLONHOMVELTAB BF89 ZYLONSHAPTAB =00BA ZYLONTIMX0 =00BB ?ZYLONTIMX1 =00BC ?ZYLONTIMY0 =00BD ?ZYLONTIMY1 =0078 ZYLONUNITTIM =00B4 ZYLONVELINDX0 =00B5 ?ZYLONVELINDX1 =00B6 ?ZYLONVELINDY0 =00B7 ?ZYLONVELINDY1 =00B2 ZYLONVELINDZ0 =00B3 ?ZYLONVELINDZ1 BF99 ZYLONVELTAB SYMBOLS (SORTED BY VALUE): 896 =0000 CCS.0 =0000 LEFT =0000 ROM.SPC =0000 ?SHAP.TORPEDO =0001 ?CCS.1 =0002 ?CCS.2 =0003 ?CCS.3 =0004 ?CCS.4 =0005 ?CCS.5 =0006 ?CCS.6 =0007 ?CCS.7 =0008 ?CCS.8 =0009 CCS.9 =000A CCS.SPC =000B CCS.COLON =000C CCS.BORDERSW =000D CCS.E =000E CCS.INF =000E ROM.DOT =000F CCS.MINUS =0010 CCS.PLUS =0010 MAXSPCOBJIND.NL =0010 ROM.0 =0010 SHAP.ZFIGHTER =0011 CCS.PHI =0011 ROM.1 =0012 CCS.V =0012 ROM.2 =0013 CCS.R =0013 ROM.3 =0014 CCS.THETA =0014 ROM.4 =0015 CCS.K =0015 ROM.5 =0016 CCS.T =0017 ?CCS.C =0018 CCS.BORDERS =0019 CCS.BORDERW =0019 ROM.9 =001A CCS.CORNERSW =001A ROM.COLON =001B CCS.STARBASE =001C CCS.4ZYLONS =001D CCS.3ZYLONS =001E CCS.2ZYLONS =0020 SHAP.STARBASEL =0021 ROM.A =0023 ROM.C =0024 ROM.D =0025 ROM.E =0027 ROM.G =002C ROM.L =002E ROM.N =0030 ROM.P =0030 SHAP.STARBASEC =0031 MAXSPCOBJNUM =0032 ROM.R =0033 ROM.S =0034 ROM.T =0037 ROM.W =0039 ROM.Y =0040 CCS.COL1 =0040 EOP =0040 SHAP.STARBASER =0050 SHAP.TRANSVSSL =0060 SHAP.METEOR =0062 MISSIONLEVEL =0063 FKEYCODE =0064 ISDEMOMODE =0065 NEWTITLEPHR =0066 IDLECNTHI =0067 ISVBISYNC =0068 L.DIVISOR =0068 L.MEMPTR1 =0068 L.RANGE =0068 MEMPTR =006A DIVIDEND =006A L.CTRLDZYLON =006A L.DIFFC =006A L.DIRECTIONIND =006A L.FOURCOLORPIX =006A L.GCMEMMAPIND =006A L.HEIGHTCNT =006A L.ISDESTROYED =006A L.KEYCODE =006A L.MAXRNDXY =006A L.MEMPTR2 =006A L.NEWSECTOR =006A L.NUMBYTES =006A L.PIXELBYTEOFF =006A L.RANGEINDEX =006A L.SECTORTYPE =006A L.SIGNCHAR =006A L.TERM3LO =006A L.VECCOMPIND =006A L.VELSIGN =006A L.WARPARRVCOL =006A L.WORD =006B L.ABSDIFFCOL =006B L.BITPAT =006B L.COLORMASK =006B L.COLUMNPOS =006B L.LOOPCNT2 =006B L.PLHIT =006B L.SECTORCNT =006B L.TERM3HI =006B L.VELOCITYHI =006C L.SHIFTSHAPE =006C L.TERM3SIGN =006C L.TOKEN =006C L.VIEWDIR =006D JOYSTICKDELTA =006D L.PIXELCOLUMN =006D L.PIXELROW =006D L.QUOTIENT =006E L.DIRSAV =006E L.LOOPCNT =006E L.TRAILCNT =006E L.ZPOSOFF =0070 SHAP.ZCRUISER =0070 VELOCITYLO =0071 NEWVELOCITY =0072 COUNT8 =0073 EXPLLIFE =0074 CLOCKTIM =0075 DOCKSTATE =0076 COUNT256 =0077 IDLECNTLO =0078 ZYLONUNITTIM =0079 MAXSPCOBJIND =007A SAVMAXSPCOBJIND =007B ISSTARBASESECT =007C ISTRACKCOMPON =007D ISSHIELDSON =007E ISATTCOMPON =007F ENERGYCNT =0080 CCS.COL2 =0080 DOWN =0080 DRAINRATE =0080 EOS =0080 EOW =0080 NEG =0080 SHAP.ZBASESTAR =0081 SHIELDSCOLOR =0082 PL3HIT =0083 PL4HIT =0084 OLDTRIG0 =0086 ISTRACKING =0087 BARRELNR =0088 LOCKONLIFE =0089 PLTRACKED =008A HITBADNESS =008B REDALERTLIFE =008C WARPDEPRROW =008D WARPDEPRCOLUMN =008E WARPARRVROW =008F WARPARRVCOLUMN =0090 CURRSECTOR =0090 SHAP.HYPERWARP =0091 WARPENERGY =0092 ARRVSECTOR =0093 HUNTSECTOR =0094 HUNTSECTCOLUMN =0095 HUNTSECTROW =0096 NEWZYLONDIST =009E OLDZYLONDIST =009F HUNTTIM =00A0 BLIPCOLUMN =00A1 BLIPROW =00A2 BLIPCYCLECNT =00A3 ISINLOCKON =00A4 DIRLEN =00A5 PENROW =00A6 PENCOLUMN =00A7 CTRLDZYLON =00A8 ZYLONFLPAT0 =00A9 ?ZYLONFLPAT1 =00AA MILESTTIM0 =00AB ?MILESTTIM1 =00AC MILESTVELINDZ0 =00AD ?MILESTVELINDZ1 =00AE ?MILESTVELINDX0 =00AF ?MILESTVELINDX1 =00B0 ?MILESTVELINDY0 =00B1 ?MILESTVELINDY1 =00B2 ZYLONVELINDZ0 =00B3 ?ZYLONVELINDZ1 =00B4 ZYLONVELINDX0 =00B5 ?ZYLONVELINDX1 =00B6 ?ZYLONVELINDY0 =00B7 ?ZYLONVELINDY1 =00B8 ISBACKATTACK0 =00B9 ?ISBACKATTACK1 =00BA ZYLONTIMX0 =00BB ?ZYLONTIMX1 =00BC ?ZYLONTIMY0 =00BD ?ZYLONTIMY1 =00BE TORPEDODELAY =00BF ZYLONATTACKER =00C0 CCS.COL3 =00C0 LONG =00C0 WARPSTATE =00C1 VELOCITYHI =00C2 TRAILDELAY =00C3 TRAILIND =00C4 WARPTEMPCOLUMN =00C5 WARPTEMPROW =00C6 VEERMASK =00C7 VICINITYMASK =00C8 JOYSTICKX =00C9 JOYSTICKY =00CA KEYCODE =00CB SCORE =00CD SCOREDRANKIND =00CE SCOREDCLASSIND =00CF TITLELIFE =00D0 SHIPVIEW =00D1 TITLEPHR =00D2 BEEPFRQIND =00D3 BEEPREPEAT =00D4 BEEPTONELIFE =00D5 BEEPPAUSELIFE =00D6 BEEPPRIORITY =00D7 BEEPFRQSTART =00D8 BEEPLIFE =00D9 BEEPTOGGLE =00DA NOISETORPTIM =00DB NOISEEXPLTIM =00DC NOISEAUDC2 =00DD NOISEAUDC3 =00DE NOISEAUDF1 =00DF NOISEAUDF2 =00E0 NOISEFRQINC =00E1 NOISELIFE =00E2 NOISEZYLONTIM =00E3 NOISEHITLIFE =00E4 PL0SHAPOFF =00E5 PL1SHAPOFF =00E6 PL2SHAPOFF =00E7 PL3SHAPOFF =00E8 PL4SHAPOFF =00E9 PL0LIFE =00EA PL1LIFE =00EB PL2LIFE =00EC PL3LIFE =00ED PL4LIFE =00EE PL0COLOR =00EF ?PL1COLOR =00F0 ?PL2COLOR =00F1 ?PL3COLOR =00F2 PF0COLOR =00F3 ?PF1COLOR =00F4 PF2COLOR =00F5 ?PF3COLOR =00F6 BGRCOLOR =00F7 PF0COLORDLI =00F8 ?PF1COLORDLI =00F9 ?PF2COLORDLI =00FA ?PF3COLORDLI =00FB BGRCOLORDLI =0200 VDSLST =0216 VIMIRQ =0222 VVBLKI =0280 DSPLST =0300 PL4DATA =0400 PL0DATA =0500 PL1DATA =0600 PL2DATA =0700 PL3DATA =0800 PFMEMROWLO =0864 PFMEMROWHI =08C9 GCMEMMAP =0949 PANELTXT =094B VELOCD1 =0950 KILLCNTD1 =0955 ENERGYD1 =095A TRACKC1 =095C TRACKDIGIT =0960 THETAC1 =0966 PHIC1 =096C RANGEC1 =0971 GCTXT =097D GCWARPD1 =098D GCTRGCNT =0992 GCSTATPHO =0993 GCSTATENG =0994 GCSTATSHL =0995 GCSTATCOM =0996 GCSTATLRS =0997 GCSTATRAD =09A3 GCSTARDAT =09AD ZPOSSIGN =09AF PL2ZPOSSIGN =09B0 PL3ZPOSSIGN =09B1 PL4ZPOSSIGN =09DE XPOSSIGN =09E0 ?PL2XPOSSIGN =09E1 PL3XPOSSIGN =09E2 PL4XPOSSIGN =0A0F YPOSSIGN =0A11 PL2YPOSSIGN =0A12 PL3YPOSSIGN =0A13 PL4YPOSSIGN =0A40 PL0ZPOSHI =0A40 ZPOSHI =0A42 PL2ZPOSHI =0A43 PL3ZPOSHI =0A44 PL4ZPOSHI =0A71 XPOSHI =0A73 PL2XPOSHI =0A74 PL3XPOSHI =0A75 PL4XPOSHI =0AA2 YPOSHI =0AA4 PL2YPOSHI =0AA5 PL3YPOSHI =0AA6 PL4YPOSHI =0AD3 ZPOSLO =0AD5 PL2ZPOSLO =0AD6 PL3ZPOSLO =0AD7 ?PL4ZPOSLO =0B04 XPOSLO =0B06 ?PL2XPOSLO =0B07 PL3XPOSLO =0B08 ?PL4XPOSLO =0B35 YPOSLO =0B37 ?PL2YPOSLO =0B38 PL3YPOSLO =0B39 ?PL4YPOSLO =0B66 ?PL0ZVEL =0B66 ZVEL =0B67 ?PL1ZVEL =0B68 PL2ZVEL =0B69 PL3ZVEL =0B6A PL4ZVEL =0B97 ?PL0XVEL =0B97 XVEL =0B98 ?PL1XVEL =0B99 PL2XVEL =0B9A PL3XVEL =0B9B PL4XVEL =0BC8 ?PL0YVEL =0BC8 YVEL =0BC9 ?PL1YVEL =0BCA PL2YVEL =0BCB PL3YVEL =0BCC PL4YVEL =0BF9 PIXELROWNEW =0BF9 PL0ROWNEW =0BFA PL1ROWNEW =0BFB PL2ROWNEW =0BFC PL3ROWNEW =0BFD PL4ROWNEW =0C2A PIXELCOLUMN =0C2A PL0COLUMN =0C2B PL1COLUMN =0C2C PL2COLUMN =0C2D PL3COLUMN =0C2E PL4COLUMN =0C5B PIXELROW =0C5B PL0ROW =0C5C PL1ROW =0C5D PL2ROW =0C5E PL3ROW =0C5F PL4ROW =0C8C PIXELBYTEOFF =0C8C PL0SHAPTYPE =0C8D PL1SHAPTYPE =0C8E PL2SHAPTYPE =0C8F PL3SHAPTYPE =0C90 PL4SHAPTYPE =0CBD PIXELSAVE =0CBD PL0HEIGHT =0CBE PL1HEIGHT =0CBF PL2HEIGHT =0CC0 PL3HEIGHT =0CC1 PL4HEIGHT =0CEE PIXELBYTE =0CEE PL0HEIGHTNEW =0CEF PL1HEIGHTNEW =0CF0 PL2HEIGHTNEW =0CF1 PL3HEIGHTNEW =0CF2 PL4HEIGHTNEW =0D1F TITLETXT =0D35 GCPFMEM =0DE9 MAPTO80 =0EE9 MAPTOBCD99 =1000 PFMEM =1000 PFMEM.C0R0 =10C8 PFMEM.C0R5 =12A8 PFMEM.C0R17 =17BB PFMEM.C76R49 =17BC PFMEM.C80R49 =17E3 PFMEM.C76R50 =17E4 PFMEM.C80R50 =1B36 PFMEM.C120R71 =1BFE PFMEM.C120R76 =1C04 PFMEM.C144R76 =1C9E PFMEM.C120R80 =1CA4 PFMEM.C144R80 =1D40 PFMEM.C128R84 =1D42 PFMEM.C136R84 =1D68 PFMEM.C128R85 =1D6A PFMEM.C136R85 A000 CHARSET A0F8 LRSHEADER A109 AFTHEADER A11A GCHEADER A12E DLSTGC A14A INITCOLD A15A INITSELECT A15C INITDEMO A15E INITSTART A165 LOOP001 A172 SKIP001 A1F3 GAMELOOP A201 LOOP002 A21F SKIP002 A227 LOOP003 A250 SKIP003 A262 SKIP004 A26A LOOP004 A277 LOOP005 A284 LOOP006 A291 LOOP007 A29E LOOP008 A2BA LOOP009 A2C2 SKIP005 A2E0 LOOP010 A2E8 SKIP006 A306 LOOP011 A30E SKIP007 A327 LOOP012 A343 LOOP013 A389 LOOP014 A39E SKIP008 A3A6 LOOP015 A3BB SKIP009 A3BD LOOP016 A3C6 SKIP010 A3DF SKIP011 A3E4 LOOP017 A3EA SKIP012 A3EB LOOP018 A3FE SKIP013 A422 LOOP019 A428 LOOP020 A43C SKIP014 A43F SKIP015 A453 LOOP021 A473 SKIP016 A47D JUMP001 A49A SKIP017 A4A4 JUMP002 A4A7 SKIP018 A4AD SKIP019 A4C0 LOOP022 A4CA SKIP020 A4DB SKIP021 A4E5 SKIP022 A4E7 LOOP023 A4ED SKIP023 A4FC LOOP024 A503 SKIP024 A52A SKIP025 A52E SKIP026 A53E SKIP027 A548 SKIP028 A569 SKIP029 A579 JUMP003 A58D SKIP030 A593 LOOP025 A5A3 SKIP031 A5A5 SKIP032 A5AB SKIP033 A5D0 SKIP034 A600 SKIP035 A60C SKIP036 A61B SKIP037 A635 SKIP038 A687 SKIP039 A69B SKIP040 A6B7 SKIP041 A6C2 SKIP042 A6D1 VBIHNDLR A6E9 SKIP043 A6EA SKIP044 A6F2 SKIP045 A6F6 LOOP026 A715 SKIP046 A718 DLSTHNDLR A728 SKIP047 A730 LOOP027 A74B JUMP004 A751 IRQHNDLR A765 LOOP028 A76F DRAWLINES A77A SKIP048 A781 SKIP049 A782 DRAWLINE A784 DRAWLINE2 A78E LOOP029 A7B8 SKIP050 A7BA SKIP051 A7BF UPDATTCOMP A7CF LOOP030 A7E1 SKIP052 A7E9 SKIP053 A7EC SKIP054 A804 SKIP055 A80A SKIP056 A821 SKIP057 A827 SKIP058 A830 SKIP059 A83A LOOP031 A83C LOOP032 A850 SKIP060 A85F SKIP061 A898 SKIP062 A89B HYPERWARP A8AC SKIP063 A8E8 SKIP064 A8EC SKIP065 A900 SKIP066 A901 SKIP067 A915 SKIP068 A91E SKIP069 A947 LOOP033 A96F SKIP070 A97F SKIP071 A980 ABORTWARP A987 ENDWARP A98D CLEANUPWARP A9A6 SKIP072 A9B4 INITTRAIL A9E5 LOOP034 AA1A SKIP073 AA20 SKIP074 AA21 PROJECTION AA40 SKIP075 AA52 LOOP035 AA66 SKIP076 AA6F SKIP077 AA78 SKIP078 AA79 MANEUVER AA90 SKIP079 AAB3 SKIP080 AAB5 LOOP036 AAC8 SKIP081 AACF SKIP082 AAD5 SKIP083 AADD SKIP084 AAE0 SKIP085 AAF4 SKIP086 AB00 SKIP087 AB03 SKIP088 AB09 SKIP089 AB11 SKIP090 AB36 SKIP091 AB37 SKIP092 AB66 SKIP093 AB84 SKIP094 AB98 SKIP095 AB9C SKIP096 ABAE SKIP097 ABB3 LOOP037 ABBA SKIP098 ABC4 SKIP099 ABCA LOOP038 ABDD SKIP100 ABE1 SKIP101 ABE5 SKIP102 ABE9 SKIP103 ABEB SKIP104 ABFA SKIP105 ABFC LOOP039 AC08 SKIP106 AC0A SKIP107 AC31 SKIP108 AC32 SKIP109 AC4F SKIP110 AC6B INITEXPL AC73 LOOP040 ACAF COPYPOSVEC ACC1 COPYPOSXY ACE5 SKIP111 ACE6 DOCKING ACF3 SKIP112 AD12 SKIP113 AD26 SKIP114 AD35 SKIP115 AD61 SKIP116 AD6C SKIP117 AD70 SKIP118 AD71 SKIP119 AD82 SKIP120 ADB8 SKIP121 ADB9 SKIP122 ADCA LOOP041 ADD7 LOOP042 ADF1 MODDLST ADF4 LOOP043 ADFB LOOP044 AE03 SKIP123 AE0D CLRPLAYFIELD AE0F CLRMEM AE1A LOOP045 AE29 TRIGGER AE40 SKIP124 AE41 SKIP125 AE56 SKIP126 AE58 SKIP127 AE66 SKIP128 AEA8 NOISE AEB1 SKIP129 AEB3 LOOP046 AEC9 SKIP130 AECA HOMINGVEL AED2 SKIP131 AEDA SKIP132 AEE1 DAMAGE AEE7 LOOP047 AF10 SKIP133 AF19 SKIP134 AF1E SKIP135 AF32 SKIP136 AF3C SKIP137 AF3D COLLISION AF3F LOOP048 AF43 SKIP138 AF58 SKIP139 AF64 SKIP140 AF6F SKIP141 AF94 SKIP142 AFC6 SKIP143 AFD5 LOOP049 AFE7 SKIP144 AFEC LOOP050 AFF3 SKIP145 AFFD SKIP146 AFFE KEYBOARD B011 LOOP051 B020 SKIP147 B02B SKIP148 B036 SKIP149 B040 SKIP150 B041 SKIP151 B045 SETVIEW B056 LOOP052 B060 SKIP152 B073 SKIP153 B07B UPDSCREEN B082 SKIP154 B096 SKIP155 B099 SKIP156 B0E6 SKIP157 B0ED SKIP158 B0FB SKIP159 B0FC SKIP160 B106 SKIP161 B10A GAMEOVER B121 GAMEOVER2 B14A SKIP162 B15A SKIP163 B15D SKIP164 B161 SKIP165 B162 SELECTWARP B16A SKIP166 B16B SKIP167 B173 SKIP168 B1A7 CALCWARP B1BE SKIP169 B1C8 SKIP170 B1D3 SKIP171 B1E0 SKIP172 B1FE LOOP053 B200 LOOP054 B212 SKIP173 B216 UPDTITLE B21E SKIP174 B21F SKIP175 B223 SETTITLE B22E SKIP176 B234 LOOP055 B23A SKIP177 B249 SKIP178 B25F SKIP179 B268 SKIP180 B276 LOOP056 B27C SKIP181 B286 LOOP057 B2A2 SKIP182 B2A8 SKIP183 B2AB SOUND B2C1 LOOP058 B2E1 SKIP184 B2E6 SKIP185 B2F3 SKIP186 B32B SKIP187 B337 SKIP188 B349 SKIP189 B357 SKIP190 B369 SKIP191 B397 SKIP192 B39F SKIP193 B3A6 BEEP B3AF LOOP059 B3B9 SKIP194 B3BA INITIALIZE B3BC LOOP060 B3CA SKIP195 B3EE LOOP061 B41B LOOP062 B441 LOOP063 B44C LOOP064 B47C SKIP196 B488 LOOP065 B492 LOOP066 B4B9 DRAWGC B4BD LOOP067 B4C6 SKIP197 B4E4 FLUSHGAMELOOP B4F5 SKIP198 B50F SKIP199 B511 SKIP200 B516 SKIP201 B51A SKIP202 B51C LOOP068 B527 SKIP203 B536 SKIP204 B53E SKIP205 B544 SKIP206 B54E LOOP069 B562 SKIP207 B565 SKIP208 B569 SKIP209 B56A SKIP210 B574 SKIP211 B57C LOOP070 B59A SKIP212 B5B0 SKIP213 B5BB SKIP214 B5C1 LOOP071 B5D1 LOOP072 B5DA SKIP215 B5EA LOOP073 B5EF LOOP074 B601 LOOP075 B619 SKIP216 B61C SKIP217 B61D SKIP218 B632 LOOP076 B644 SKIP219 B655 SKIP220 B662 LOOP077 B664 LOOP078 B68D SKIP221 B68F SKIP222 B698 SKIP223 B69B ROTATE B6A4 SKIP224 B6E1 SKIP225 B6FB SCREENCOLUMN B709 SKIP226 B717 SKIP227 B71E SCREENROW B72E SKIP228 B73E SKIP229 B745 SKIP230 B74A SKIP231 B753 SKIP232 B75A SKIP233 B763 SKIP234 B764 INITPOSVEC B785 SKIP235 B7A9 SKIP236 B7BE RNDINVXY B7D7 SKIP237 B7F0 SKIP238 B7F1 ISSURROUNDED B803 SKIP239 B804 UPDPANEL B810 SKIP240 B812 SKIP241 B822 SKIP242 B85C SKIP243 B86F DECENERGY B88C SKIP244 B88E SKIP245 B896 LOOP079 B8A6 SKIP246 B8A7 SHOWCOORD B8BD SKIP247 B8CD SHOWDIGITS B8DF PLCOLOROFFTAB B8E4 PLSHAP1TAB B9B1 PLSHAP2TAB BA62 DLSTFRAG BA6A DLSTFRAGGC BA6D DLSTFRAGLRS BA75 DLSTFRAGAFT BA7D DLSTFRAGFRONT BA8C DLSTFRAGOFFTAB BA90 FOURCOLORPIXEL BAB0 PIXELMASKTAB BAB4 VELOCITYTAB BABE KEYTAB BAD3 DRAINRATETAB BADD WARPENERGYTAB BAF5 STICKINCTAB BAF9 DRAWLINESTAB BB3A WARPSTARXTAB BB3E WARPSTARYTAB BB42 PANELTXTTAB BBA6 SECTORTYPETAB BBAA PHRASETAB BC2B WORDTAB BE22 VIEWMODETAB BE26 MSGOFFTAB BE29 MSGBITTAB BE2C MSGONTAB BE2F PLSHAPOFFTAB BE7F PLSHPHEIGHTTAB BECF TRACKKEYSTAB BED1 SECTORCHARTAB BED7 VEERMASKTAB BEDB PLSTARBAOFFTAB BEDD BONUSTAB BEE9 RANKTAB BEFC CLASSTAB BF0C MISSIONPHRTAB BF10 DAMAGEPROBTAB BF14 DAMAGEPHRTAB BF1A DESTROYPHRTAB BF20 NOISEPATTAB BF3E BEEPPATTAB BF5C BEEPFRQTAB BF6E BLIPSHAPTAB BF73 BARRELXTAB BF75 HITMAXZTAB BF7D HITMINZTAB BF85 ZYLONHOMVELTAB BF89 ZYLONSHAPTAB BF91 ZYLONFLPATTAB BF99 ZYLONVELTAB BFA9 PFCOLORTAB BFB3 VICINITYMASKTAB BFBB MOVEPROBTAB BFC0 COMPASSOFFTAB BFC9 HOMVELTAB BFD1 PLSHAPCOLORTAB BFDB PLSHAPBRITTAB BFEB NOISETORPVOLTAB BFF3 NOISETORPFRQTAB =D000 HPOSP0 =D001 HPOSP1 =D002 HPOSP2 =D003 HPOSP3 =D004 HPOSM0 =D005 HPOSM1 =D006 HPOSM2 =D007 HPOSM3 =D008 M0PL =D009 M1PL =D00A M2PL =D00B M3PL =D00F P3PL =D010 TRIG0 =D012 COLPM0 =D016 COLPF0 =D01B PRIOR =D01D GRACTL =D01E HITCLR =D01F CONSOL =D200 AUDF1 =D202 AUDF2 =D203 AUDC2 =D204 AUDF3 =D205 AUDC3 =D206 AUDF4 =D207 AUDC4 =D208 AUDCTL =D209 KBCODE =D209 STIMER =D20A RANDOM =D20E IRQEN =D20F SKCTL =D300 PORTA =D302 PACTL =D400 DMACTL =D402 DLIST =D407 PMBASE =D409 CHBASE =D40A WSYNC =D40B VCOUNT =D40E NMIEN =E000 ROMCHARSET }}}