Initial import. master
authorSimon Morgan <sjm@sjm.io>
Fri, 26 Jun 2015 16:43:00 +0000 (17:43 +0100)
committerSimon Morgan <sjm@sjm.io>
Fri, 26 Jun 2015 16:43:00 +0000 (17:43 +0100)
15 files changed:
GDAC1.S [new file with mode: 0644]
GDAC2.S [new file with mode: 0644]
GDAC3.S [new file with mode: 0644]
GDAC4.S [new file with mode: 0644]
GLOAD.S [new file with mode: 0644]
GLOADER.S [new file with mode: 0644]
GMAIN.S [new file with mode: 0644]
GMIV.S [new file with mode: 0644]
GRAPHA.S [new file with mode: 0644]
GRAPHB.S [new file with mode: 0644]
GSAVE.S [new file with mode: 0644]
GSCORE.S [new file with mode: 0644]
PALDAC4.S [new file with mode: 0644]
PALGLDR.S [new file with mode: 0644]
PALGRPHA.S [new file with mode: 0644]

diff --git a/GDAC1.S b/GDAC1.S
new file mode 100644 (file)
index 0000000..378d5ac
--- /dev/null
+++ b/GDAC1.S
@@ -0,0 +1,1660 @@
+;GDAC1.S\r
+;THIS SUBROUTINE GIVES BIRTH TO A SINGLE SHIP OR PAIR OF SHIPS\r
+;IT GIVES BIRTH ACCORDING TO SHIPCNT AND RACK NUMBER\r
+;IT ALSO RESETS BORNCNT\r
+;IT ALSO INCREMENTS SHIPCNT APPROPRIATELY\r
+;\r
+;THE TEMPORARY VARIBLES IT USES ARE\r
+;TEMP1    DS      2                      ;0 PAGE\r
+;TEMP2    DS      2                      ;0 PAGE\r
+;LOOPCNT  DS      1\r
+;\r
+;THE CONSTANTS USED\r
+;TIBTNBIR EQU     ??                     ;FRAMES BETWEEN BIRTHS\r
+;TIBTNWAV EQU     ??                     ;SIZE OF EACH ENTRY IN ENEMY LIST\r
+;NOTFOSH  EQU     ??\r
+;\r
+BIRTH     LDA     ABORT\r
+          BEQ     BIRTH9\r
+          RTS                            ;RETURN IF ABORT = 1\r
+BIRTH9    LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BEQ     BIRTH7                 ;IF NOT, GO ON\r
+          LDA     CHALWAVE               ;SEE IF NEW CHALLENGING WAVE\r
+          BEQ     BIRTH7                 ;ONLY CARE ABOUT START OF NEW WAVE\r
+          LDA     AIRBORNE               ;SEE IF AIRBORNE = 0\r
+          BEQ     BIRTH10\r
+          RTS\r
+BIRTH10   LDA     #0\r
+          STA     CHALWAVE               ;USED FOR LONG CHALLENGING WAVES\r
+BIRTH7    LDA     NEWWAVE\r
+          BEQ     BIRTH1\r
+          LDA     TYPE+41\r
+          CLC\r
+          ADC     TYPE+42\r
+          ADC     TYPE+43\r
+          ADC     TYPE+44\r
+          BEQ     BIRTH1\r
+          LDA     #4\r
+          STA     BORNCNT\r
+          RTS\r
+BIRTH1    LDA     SHIPCNT\r
+          CMP     #13\r
+          BEQ     STRTWV\r
+          CMP     #25\r
+          BEQ     STRTWV\r
+          CMP     #37\r
+          BEQ     STRTWV\r
+          CMP     #49\r
+          BEQ     STRTWV\r
+          BNE     BIRTH8\r
+STRTWV    LDA     #0\r
+          STA     WAVECNT                ;INDICATE TIME FOR NEW WAVE\r
+          STA     WAVESCR                ;RESET SCORE FOR CHALLENGING WAVE\r
+          STA     SHPERWAV               ;RESET # OF SHIPS BORN THIS WAVE\r
+BIRTH8    LDA     WAVECNT\r
+          BEQ     INCWVREG\r
+          LDA     CHALSTG\r
+          BEQ     BIRTH11\r
+          LDA     CHALINDX\r
+          JMP     NOCHNG\r
+BIRTH11   LDA     WAVEREG\r
+          JMP     NOCHNG\r
+INCWVREG  LDA     #$FF\r
+          STA     WAVECNT                ;RESET WAVECNT\r
+          LDA     CHALSTG\r
+          BEQ     INCWVRG\r
+          LDA     CHALINDX               ;GET INDEX FOR CHALLENGING STAGES\r
+          CMP     #39                    ;SEE IF NEED TO RESET IT\r
+          BNE     INDXOK\r
+          LDA     #0\r
+          STA     CHALINDX\r
+          BEQ     NOCHNG\r
+INDXOK    CLC\r
+          ADC     #1\r
+          STA     CHALINDX\r
+          BNE     NOCHNG\r
+INCWVRG   LDA     WAVEREG\r
+          CMP     #14                    ;SEE IF NEED TO RESET IT\r
+          BNE     INDXOK1\r
+          LDA     #0\r
+          STA     WAVEREG\r
+          BEQ     NOCHNG\r
+INDXOK1   CLC\r
+          ADC     #1\r
+          STA     WAVEREG\r
+NOCHNG    TAY\r
+          LDA     RACK                   ;SEE IF LOW RACK\r
+          CMP     #3\r
+          BCS     UPPERRK\r
+          LDA     LOWPAIR,Y\r
+          BNE     STRLPCNT\r
+UPPERRK   LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BEQ     HIPAIR\r
+          LDA     CHALPAIR,Y             ;GET CHALLENGING PAIR CODE\r
+          BNE     STRLPCNT\r
+HIPAIR    LDA     HIGHPAIR,Y\r
+STRLPCNT  STA     LOOPCNT\r
+DOSISTER\r
+          LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BEQ     REGSTG\r
+          LDA     CHALNUM                ;GET # OF THIS CHALLENGING STAGE\r
+          ASL     A                      ;MULT BY 2\r
+          TAY\r
+          LDA     CHALTBL,Y              ;GET LOW BYTE OF ADDRESS\r
+          STA     TEMP1\r
+          INY\r
+          LDA     CHALTBL,Y\r
+          STA     TEMP1+1\r
+GETINDX   LDA     SHIPCNT\r
+          SEC\r
+          SBC     #1                     ;1ST SHIP IS ZEROTH ENTRY\r
+          TAY\r
+          LDA     SHIPINDX,Y\r
+          TAY\r
+          LDA     (TEMP1),Y              ;GET ADDRESS OF SHIP DATA AND PLACE\r
+          STA     TEMP2                  ;IN 0 PAGE, TEMP2\r
+          INY\r
+          LDA     (TEMP1),Y\r
+          STA     TEMP2+1\r
+          LDA     SHIPCNT                ;LOOKUP THE SHIP NUMBER\r
+          CMP     #61                    ;FIRST, SEE IF IS INVISO SHIP\r
+          BNE     NOTINV\r
+          JMP     FOINVISO\r
+REGSTG    LDA     RACK\r
+          CMP     #3\r
+          BCC     LOWRK\r
+FIXRK     SEC\r
+          SBC     #4\r
+          CMP     #3\r
+          BCS     FIXRK                  ;GET INDEX OF 0,1, OR 2\r
+          ASL     A\r
+          TAY\r
+          LDA     HIREGTB,Y\r
+          STA     TEMP1\r
+          INY\r
+          LDA     HIREGTB,Y\r
+          STA     TEMP1+1\r
+          BNE     GETINDX\r
+LOWRK     SEC\r
+          SBC     #1\r
+          ASL     A\r
+          TAY\r
+          LDA     LOWREGTB,Y\r
+          STA     TEMP1\r
+          INY\r
+          LDA     LOWREGTB,Y\r
+          STA     TEMP1+1\r
+          BNE     GETINDX\r
+NOTINV    SEC\r
+          SBC     #1\r
+          TAY\r
+          LDA     SHPNUTB,Y\r
+          CMP     #L(NOTFOSH)            ;SEE IF ENEMY TO BE BORN IS A FORM\r
+          BNE     NFIMPTY                ;SHIP\r
+          JMP     FIEMPTY\r
+NFIMPTY   TAX                            ;SHIP NUMBER IS INDEX FOR FORM SHIP\r
+FOEMPTY   LDY     #6\r
+          LDA     (TEMP2),Y              ;NEXT LOOKUP AND STORE REST OF DATA\r
+          STA     MODE,X\r
+          DEY\r
+          LDA     (TEMP2),Y\r
+          STA     MH,X\r
+          DEY\r
+          LDA     (TEMP2),Y\r
+          STA     ML,X\r
+          DEY\r
+          LDA     (TEMP2),Y\r
+          STA     ANGLE,X\r
+          DEY\r
+          LDA     (TEMP2),Y\r
+          STA     YCORD,X\r
+          DEY\r
+          LDA     (TEMP2),Y\r
+          STA     XCORD,X\r
+          DEY\r
+          LDA     #0\r
+          STA     MOMENTUM,X             ;GIVE ZERO MOMENTUM TO START\r
+          LDA     (TEMP2),Y\r
+          STA     TYPE,X\r
+          BEQ     NOAIR\r
+          CMP     #6\r
+          BEQ     NOAIR\r
+          LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BEQ     CHKEXTRA               ;IF NOT, CHECK NORMALLY\r
+          BNE     NOEXTRA                ;IF SO, NO EXTRAS\r
+CHKEXTRA\r
+          LDA     HEROREAP               ;SEE IF HERO MUST REAPPEAR\r
+          BEQ     CHECKRAK\r
+          BPL     CHKCPHER\r
+          LDA     #0\r
+          STA     HEROREAP               ;RESET REGISTER\r
+          BEQ     NOAIR                  ;DONT CHANGE NUMFLY\r
+CHKCPHER  LDA     SHPERWAV               ;SEE IF READY FOR EXTRA\r
+          CMP     #8\r
+          BNE     CHECKRAK               ;DO NORMAL PROCESSING\r
+          DEC     HEROREAP\r
+          BNE     CHECKRAK\r
+          LDA     #0\r
+          STA     TYPE,X                 ;BOOT EXTRA MAN JUST CREATED\r
+          LDA     #L(SHTY52)\r
+          STA     TEMP2\r
+          LDA     #H(SHTY52)\r
+          STA     TEMP2+1\r
+          LDA     #$FF\r
+          STA     HEROREAP\r
+          LDX     #40\r
+          BNE     FOEMPTY\r
+\r
+CHECKRAK  LDA     RACK\r
+          CMP     #3                     ;SEE IF EXTRA MAN RACK\r
+          BCS     CHECKFST\r
+NOEXTRA   LDA     SHPERWAV\r
+          CMP     #8\r
+          BMI     GIVEXTRA\r
+          LDA     #0\r
+          STA     TYPE,X\r
+          BEQ     NOAIR\r
+CHECKFST  CMP     #10\r
+          BMI     GIVEXTRA               ;3<X<10=GIVE EXTRA MEN\r
+          CMP     #16\r
+          BMI     NOEXTRA                ;10<X<16=NO EXTRA\r
+GIVEXTRA  INC     AIRBORNE\r
+NOAIR     INC     SHIPCNT\r
+          INC     SHPERWAV\r
+          LDA     SHIPCNT                ;SEE IF JUST DID LAST SHIP TO ENTER\r
+          CMP     #61                    ;AND SHOULD DO INVISO SHIP\r
+          BNE     NODO\r
+          JMP     DOSISTER\r
+NODO      DEC     LOOPCNT\r
+          BEQ     NOJMP\r
+          JMP     DOSISTER               ;SEE IF FINISHED WITH THE PAIR\r
+NOJMP     LDA     SHIPCNT\r
+          CMP     #13\r
+          BEQ     ENDWAV\r
+          CMP     #25\r
+          BEQ     ENDWAV\r
+          CMP     #37\r
+          BEQ     ENDWAV\r
+          CMP     #49\r
+          BEQ     ENDWAV\r
+          LDA     #0\r
+          STA     NEWWAVE\r
+          LDA     RACK\r
+          CMP     #10                    ;GO FASTER AT RACK 10\r
+          BCC     STCNT1\r
+          LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BNE     STCNT1                 ;KEEP NORMAL BIRTH IF SO\r
+          LDA     LEVELSEL               ;SEE IF IN BONZO MODE\r
+          BMI     STCNT1                 ;IF SO, LEAVE BORNCNT ALONE\r
+          LDA     #9\r
+          STA     BORNCNT\r
+          RTS\r
+\r
+FOINVISO  LDA     #0\r
+          STA     WAVECNT\r
+          LDX     #45                    ;GIVING BIRTH TO INVISO SHIP, SO SET\r
+                                         ;PTR TO INVISO SHIP LOCATION, AND SHIP\r
+          JMP     FOEMPTY                ;TO PROPER NUMBER\r
+\r
+FIEMPTY   LDX     #40                    ;FIND 1ST EMPTY SPOT FOR NON-FORM SHIP\r
+KEEPLOOK  INX                            ;INC PTR\r
+          LDA     TYPE,X                 ;NOW SEE IF SPOT IS EMPTY\r
+          BNE     KEEPLOOK\r
+          JMP     FOEMPTY\r
+\r
+STCNT1    LDA     #L(TIBTNBIR)           ;THESE ARE REARRANGED TO HANDLE\r
+          STA     BORNCNT                ;A BRANCH OUT OF RANGE\r
+          RTS\r
+ENDWAV    LDA     #$FF\r
+          STA     NEWWAVE\r
+          STA     CHALWAVE               ;INDICATE START OF CHALLENGING WAVE\r
+          LDA     LEVELSEL               ;SEE IF IN BONZO MODE\r
+          BMI     BONZO4\r
+          LDA     RACK\r
+          CMP     #10\r
+          BCC     BONZO4                 ;IF LESS THAN 5,DONT INCREASE SPEED\r
+          LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BNE     BONZO4                 ;IF SO,  DONT INCREASE SPEED\r
+          LDA     #L(TIBTNFWV)\r
+          BNE     BONZO5\r
+BONZO4    LDA     #L(TIBTNWAV)\r
+BONZO5    STA     BORNCNT\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE SEES IF IT IS TIME TO FIRE A MISSLE\r
+;\r
+TOFIRE    LDA     MODE+40                ;SEE IF CAPTD HERO IS RELEASED\r
+          CMP     #8                     ;SEE IF IN SPIN MODE\r
+          BEQ     ENDFIRE6               ;RETURN\r
+          CMP     #9                     ;SEE IF IN REUNITE MODE\r
+          BEQ     ENDFIRE6               ;RETURN\r
+          LDY     #0                     ;SET ELISTPTR TO BEGINNING OF ENMYLSTF\r
+NXFIRE    LDA     TYPE,Y                 ;SEE IF ENEMY EXISTS\r
+          AND     #$7F\r
+          BEQ     NXPOSI\r
+          LDA     ARRIVED\r
+          BNE     FIRE1                  ;IF ALREADY ARRIVED, GO ON\r
+          LDA     RACK                   ;SEE IF NON FIRING RACK\r
+          CMP     #1\r
+          BEQ     ENDFIRE6\r
+          CMP     #10\r
+          BEQ     ENDFIRE6\r
+          CMP     #18\r
+          BEQ     ENDFIRE6\r
+FIRE1\r
+          LDA     ANGLE,Y\r
+          CMP     #3\r
+          BMI     NXPOSI\r
+          CMP     #6\r
+          BPL     NXPOSI                 ;ONLY FIRE IF ANGLE=3,4,OR 5\r
+          LDA     ARRIVED                ;SEE IF HAVE ARRIVED YET\r
+          BEQ     BLUEFIRE               ;NOT ARRIVED, SO FIRE LOWER\r
+          LDA     TYPE,Y                 ;CHECK OUT TYPE\r
+          AND     #$7F                   ;BOOT HIGH BIT\r
+          CMP     #1\r
+          BEQ     BLUEFIRE\r
+          LDA     YCORD,Y\r
+          CMP     #52\r
+          BEQ     FIREIT\r
+          CMP     #57\r
+          BEQ     FIREIT\r
+          LDA     BULLSHT                ;SEE IF SHOULD GET TOUGH\r
+          BMI     BLUEFIRE\r
+          BPL     NXPOSI\r
+BLUEFIRE  LDA     YCORD,Y\r
+          CMP     #72                    ;SEE IF ENEMY IS AT Y=72\r
+          BEQ     FIREIT\r
+          CMP     #77\r
+          BEQ     FIREIT\r
+          BIT     BULLSHT\r
+          BPL     NXPOSI\r
+          CMP     #8\r
+          BEQ     FIREIT\r
+          CMP     #37\r
+          BEQ     FIREIT\r
+          BNE     NXPOSI\r
+FIREIT    LDA     MODE,Y                 ;MAKE SURE NOT IN CAPTURE MODE\r
+          BPL     NXPOSI\r
+          AND     #$F                    ;OR IN GO HOME MODE\r
+          CMP     #1\r
+          BEQ     NXPOSI\r
+          JSR     BIRMIS\r
+          RTS\r
+NXPOSI    INY                            ;INC ELISTPTR TO NEXT ENEMY\r
+          CPY     #40\r
+          BNE     NXFIRE\r
+ENDFIRE6  RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE GIVES BIRTH TO A MISSLE AT THE LOCATION OF THE ENEMY POINTED\r
+;TO BY THE Y REG.  THE MISSLE IS PLACED IN THE FIRST EMPTY LOCATION IN THE\r
+;MISSLE LIST.  EACH MISSLE LIST ENTRY TAKES 5 BYTES: TYPE, XPOS, YPOS, XTOGO,\r
+;YTOGO.  XTOGO AND YTOGO ARE INITIALLY SET AS (HERO POS AT CONCEPTION)-(BIRTH\r
+;POSITION).\r
+;THE FOLLOWING REGISTERS AND CONSTANTS ARE USED\r
+;MISTYPE  EQU     ?                      ;MISSLE TYPE\r
+;TEMP1    DS      1                      ;TEMPORARY ZERO PAGE REGISTER\r
+;\r
+BIRMIS    LDA     RACK                   ;FIGURE MAX NUMBER OF MISSLES THAT\r
+          AND     #$1F                   ;CAN EXIST\r
+          TAX\r
+          LDA     NUMMIS,X\r
+          STA     TEMP1\r
+          LDA     BULLSHT                SEE IF IN BULLSHIT MODE\r
+          BPL     NORMBIR\r
+          INC     TEMP1\r
+          INC     TEMP1\r
+NORMBIR   LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BNE     NOTBONZ1               ;DONT BONZ IF SO\r
+          LDA     LEVELSEL               ;CHECK IF IN BONZO MODE\r
+          BPL     NOTBONZ1\r
+          LDA     #47\r
+          STA     TEMP1                  ;ALLOW ONE MISSILE ON SCREEN\r
+NOTBONZ1  LDX     #46                    ;MAKE PTR POINT TO FIRST MISSLE SPOT\r
+NOSP      CPX     TEMP1\r
+          BNE     FINSPA\r
+          RTS                            ;NO SPACE, SO RETURN\r
+FINSPA    LDA     TYPE,X                 ;SEE IF POSITION IS EMPTY\r
+          BEQ     FOSP\r
+          INX\r
+          JMP     NOSP\r
+FOSP      LDA     #L(MISTYPE)            ;FOUND SPACE, SO GIVE BIRTH TO MISSLE\r
+          STA     TYPE,X                 ;BY STORING MISSLE-TYPE, AND X AND Y\r
+          LDA     XCORD,Y                ;POSITION INTO MISSLE LIST\r
+          STA     XCORD,X\r
+          LDA     YCORD,Y\r
+          STA     YCORD,X\r
+          LDA     #4                     ;ORIENTATION OF ENEMY MISSLES\r
+          STA     ANGLE,X\r
+          INC     BULLSHT                ;INC MISSILE COUNTER\r
+          LDA     XCORD+63               ;NOW CALCULATE TRAJECTORY\r
+          CMP     XCORD,X                ;SEE WHO IS BIGGER\r
+          BCC     HEROLESS\r
+          SEC\r
+          SBC     XCORD,X\r
+          BIT     BULLSHT                ;SEE IF HE'S WASTING TIME\r
+          BPL     XLT78\r
+          CMP     #100\r
+          BCC     XLT88\r
+          LDA     #10\r
+          BNE     YGOMIS\r
+XLT88     CMP     #70\r
+          BCC     XLT78\r
+          LDA     #8\r
+          BNE     YGOMIS\r
+XLT78     CMP     #45\r
+          BCC     XLT56\r
+          LDA     #4\r
+          BNE     YGOMIS\r
+XLT56     CMP     #27\r
+          BCC     XLT33\r
+          LDA     #3\r
+          BNE     YGOMIS\r
+XLT33     CMP     #11\r
+          BCC     XLT11\r
+          LDA     #2\r
+          BNE     YGOMIS\r
+XLT11     CMP     #5\r
+          BCC     XLT5\r
+          LDA     #1\r
+          BNE     YGOMIS\r
+XLT5      LDA     #0\r
+YGOMIS    STA     MODE,X                 ;STORE XTOGO\r
+          STA     ML,X\r
+          LDA     #4                     ;STORE YTOGO\r
+          STA     COUNTXY,X\r
+          STA     MH,X\r
+          RTS\r
+\r
+HEROLESS  LDA     XCORD,X\r
+          SEC\r
+          SBC     XCORD+63\r
+          BIT     BULLSHT\r
+          BPL     XLTN78\r
+          CMP     #100\r
+          BCC     XLTN88\r
+          LDA     #$F6\r
+          BNE     YGOMIS\r
+XLTN88    CMP     #70\r
+          BCC     XLTN78\r
+          LDA     #$F8\r
+          BNE     YGOMIS\r
+XLTN78    CMP     #45\r
+          BCC     XLTN56\r
+          LDA     #$FC\r
+          BNE     YGOMIS\r
+XLTN56    CMP     #27\r
+          BCC     XLTN33\r
+          LDA     #$FD\r
+          BNE     YGOMIS\r
+XLTN33    CMP     #11\r
+          BCC     XLTN11\r
+          LDA     #$FE\r
+          BNE     YGOMIS\r
+XLTN11    CMP     #5\r
+          BCC     XLT5\r
+          LDA     #$FF\r
+          BNE     YGOMIS\r
+\r
+\r
+;\r
+;THE FOLLOWING SUBROUTINE MOVES A MISSLE ONE 'STEP'.  THE SIZE OF THE 'STEP'\r
+;DEPENDS ON THE RATIO OF XTOGO TO YTOGO:\r
+;THE MISSLE MOVED IS POINTED TO BY Y REG\r
+;IF THE MISSLE IS THE HERO'S, THEN THE YPOS IS JUST DECREMENTED\r
+;Y REG IS SAVED\r
+;\r
+MOVMIS    LDA     ANGLE,Y                ;SEE IF HERO MISSLE\r
+          BNE     ENMIS\r
+          LDA     RACK                   ;SEE IF FASTER\r
+          CMP     #10\r
+          BCC     SLOWER\r
+          LDA     #$FB\r
+          BNE     SLOWER1\r
+SLOWER    LDA     #$FC                   ;IS HERO MISSLE, SO ONLY MOVEMENT IS\r
+SLOWER1   CLC                            ;TO DECREMENT YPOS\r
+          ADC     YCORD,Y\r
+          CMP     #192                   ;NOW SEE IF OFF SCREEN\r
+          BCC     DOMOV                  ;YES, SO ERASE MISSLE\r
+          LDA     PLAYER\r
+          BEQ     INNC5                  ;DO PLAYER 1\r
+          LDA     MISCNT22\r
+          SEC\r
+          SBC     #1                     ;MISSILE WAS NOT A HIT\r
+          STA     MISCNT22\r
+          LDA     MISCNT22+1\r
+          SBC     #0\r
+          STA     MISCNT22+1\r
+          JMP     INNC6\r
+INNC5\r
+          LDA     MISCNT21\r
+          SEC\r
+          SBC     #1                     ;MISSILE WAS NOT A HIT\r
+          STA     MISCNT21\r
+          LDA     MISCNT21+1\r
+          SBC     #0\r
+          STA     MISCNT21+1\r
+INNC6     LDA     #0\r
+          STA     TYPE,Y\r
+          RTS\r
+DOMOV     STA     YCORD,Y\r
+          RTS\r
+\r
+ENMIS     TYA                            ;TRANSFER POINTER FROM Y REG TO X REG\r
+          TAX\r
+          LDA     ML,X                   ;GET XTOGOING\r
+          BEQ     MOVMISY                ;SEE IF ZERO\r
+          BMI     MISMINX                ;SEE IF NEGATIVE\r
+          DEC     ML,X                   ;XTOGOING IS POSITIVE\r
+          INC     XCORD,X\r
+          LDA     MODE,X                 ;GET XTOGO\r
+          CMP     #$A                    ;SEE IF BULLSHT SET\r
+          BNE     MOVMISY\r
+          INC     XCORD,X\r
+          BNE     MOVMISY\r
+MISMINX   INC     ML,X                   ;XTOGOING IS NEGATIVE\r
+          DEC     XCORD,X\r
+          LDA     MODE,X                 ;GET XTOGO\r
+          CMP     #$F6\r
+          BNE     MOVMISY\r
+          DEC     XCORD,X\r
+MOVMISY   LDA     YCORD,X\r
+          CLC\r
+          ADC     #2\r
+          STA     YCORD,X\r
+          CMP     #192\r
+          BCS     ERAMIS\r
+          DEC     MH,X                   ;DEC YTOGOING\r
+          BEQ     REMISXY                ;SEE IF NEC. TO RESET X AND Y-TOGOING\r
+          RTS\r
+REMISXY   LDA     MODE,X                 ;RESET X AND Y-TOGOING\r
+          STA     ML,X\r
+          LDA     COUNTXY,X\r
+          STA     MH,X\r
+          RTS\r
+ERAMIS    LDA     #0                     ;MISSLE OFF THE SCREEN, SO ERASE\r
+          STA     TYPE,X\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE MOVES A ENEMY SHIP POINTED TO BY Y REG ONE STEP BY CALLING\r
+;A SUBROUTINE THAT USES A MOTION TABLE\r
+;\r
+;IT HAS NO PERMANENT LOCAL VARIBLES\r
+;ITS TEMPORARY VARIBLES ARE:\r
+;TEMP1    DS      2                      ;0 PAGE\r
+;\r
+;CONSTANTS ARE\r
+;NOTFOSH  EQU     ?                      ;SHIP NUMBER FOR NON-FORMATION SHIPS\r
+;Y REGISTER IS SAVED, ALL OTHER\r
+;REGISTERS ARE DESTROYED\r
+;\r
+TABLEINC  JSR     MSHBTBL                ;CALL SUBROUTINE TO MOVE SHIP BY TABLE\r
+          TXA                            ;SEE IF END OF TABLE\r
+          BNE     ENDTBL\r
+          RTS\r
+ENDTBL    LDA     MODE,Y\r
+          AND     #$F\r
+          CMP     #9\r
+          BNE     NOTCHAL\r
+          LDA     #0                     ;YES, END OF TABLE, SO GET RID OF\r
+          STA     TYPE,Y\r
+          CPY     #40\r
+          BPL     INVSHIP\r
+          DEC     AIRBORNE\r
+          BNE     INVSHIP                SEE IF ALL SHIPS ARE OFF\r
+          LDA     #80\r
+          STA     BORNCNT                DELAY NEXT WAVE\r
+INVSHIP   RTS\r
+NOTCHAL\r
+          LDA     TYPE,Y\r
+          AND     #$7F\r
+          CMP     #13                    ;SEE IF EXTRA SCORPION SHIPS\r
+          BNE     NOTSCORP\r
+          LDA     #0\r
+          STA     TYPE,Y\r
+          DEC     AIRBORNE\r
+          RTS\r
+NOTSCORP  CPY     #41                    ;IS END, SO FIRST SEE IF FORMATION SHIP\r
+          BMI     FORMSH\r
+          CPY     #45\r
+          BNE     NFORMSH\r
+FORMSH    LDA     #$81                   ;IS FORMATION SHIP, SO CHANGE MODE TO\r
+          STA     MODE,Y                 ;'GO HOME'\r
+          RTS\r
+NFORMSH   JSR     ATTKBL                 ;NOT FORM. SHIP AND COMING SO CHANGE\r
+          DEC     AIRBORNE               ;THIS CANCELS THE INC AIRBORNE DONE\r
+                                         ;IN ATTKBL\r
+          RTS                            ;MTBLPTR AND MODE TO BE BLUE ATTACK\r
+\r
+\r
+;\r
+;THIS SUBROUTINE ACTUALLY MOVES A SHIP POINTED TO BY Y REG VIA A MOTION TABLE\r
+;IT ALSO INCREMENTS THE MOTION TABLE POINTER\r
+;\r
+;THE TEMPORARY VARIBLES ARE:\r
+;TEMP1    DS      2                      ;0 PAGE\r
+;\r
+MSHBTBL   LDA     #$FF\r
+          STA     MSHCNT\r
+CNTMSHIP  LDX     #0                     ;INITIALIZATION\r
+          LDA     MOMENTUM,Y             ;SEE IF SHIP HAS MOMENTUM\r
+          BEQ     NORMTN\r
+          CMP     #$80\r
+          BEQ     NORMTN                 ;ONLY HAS FAST REAPPEAR SET\r
+          SEC\r
+          SBC     #1\r
+          STA     MOMENTUM,Y             ;DECREASE MOMENTUM\r
+          LDA     ML,Y\r
+          STA     TEMP1\r
+          LDA     MH,Y\r
+          STA     TEMP1+1\r
+          JMP     CONTMSH                ;CONTINUE WITH PROCESSING\r
+NORMTN    LDA     ML,Y                   ;GET ML\r
+          STA     TEMP1                  ;AND STORE IT IN 0 PAGE\r
+          CLC                            ;INC BY 1\r
+          ADC     #1\r
+          STA     ML,Y                   ;AND UPDATE INTO ENEMY LIST\r
+          LDA     MH,Y                   ;GET MH\r
+          STA     TEMP1+1                ;AND STORE IT IN 0 PAGE\r
+          ADC     #0                     ;INC MH\r
+          STA     MH,Y                   ;AND UPDATE\r
+          LDA     (TEMP1,X)              ;SEE IF END OF TABLE AND SHOULD DO\r
+          TAX                            ;STORE TEMP1 VALUE\r
+          AND     #3                     ;NOTHING BUT RETURN\r
+          CMP     #2\r
+          BNE     CONTMSH\r
+          TXA                            ;GET TEMP1 AGAIN\r
+          AND     #$0F                   ;BOOT HIGH NIBBLE\r
+          CMP     #6                     ;SEE IF IS SETTING MOMENTUM\r
+          BNE     NOTMMTM\r
+          TXA\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A                      ;NOW HAVE HIGH NIBBLE ONLY\r
+          BEQ     NOTMMTM                ;IF MOMENTUM IS ZERO, MUST BE BLUATK\r
+          CLC\r
+          ADC     MOMENTUM,Y             ;IN CASE FAST REAPPEAR IS SET\r
+          STA     MOMENTUM,Y             ;STORE NEW MOMENTUM\r
+          JMP     MSHBTBL\r
+NOTMMTM   LDX     #$FF\r
+          RTS\r
+\r
+CONTMSH   LDX     #0\r
+          LDA     MODE,Y                 ;GET MODE BYTE\r
+          AND     #$40                   ;SEE IF IN NEGATE MODE\r
+          BEQ     NONEG1A\r
+          LDA     (TEMP1,X)              ;GET DELTAS\r
+          EOR     #3                     ;NEGATE DELTA ANGLE\r
+          CLC\r
+          ADC     #1\r
+          JMP     NONEG1\r
+NONEG1A   LDA     (TEMP1,X)              ;GET DELTAS\r
+NONEG1    TAX                            ;ISOLATE ANGLE\r
+          AND     #2\r
+          BEQ     APLS                   ;ATTACH LEADING ONES IF DELTA ANGLE\r
+          TXA\r
+          ORA     #$FC                   ;IS NEG\r
+          JMP     ANEG\r
+APLS      TXA\r
+          AND     #3\r
+ANEG      CLC\r
+          ADC     ANGLE,Y                ;AND UPDATE ANGLE\r
+          AND     #07\r
+          STA     ANGLE,Y\r
+          LDX     #0\r
+          LDA     (TEMP1,X)              ;GET DELTA Y\r
+          LSR     A\r
+          LSR     A\r
+          TAX                            ;ATTACH LEADING ONES IF DELTA Y\r
+          AND     #4\r
+          BEQ     YPLS                   ;IS NEG\r
+          TXA\r
+          ORA     #$F8\r
+          JMP     YNEG\r
+YPLS      TXA\r
+          AND     #7\r
+YNEG      CLC\r
+          ADC     YCORD,Y                ;AND UPDATE Y\r
+          STA     YCORD,Y\r
+          LDX     #0\r
+          LDA     MODE,Y                 ;GET MODE BYTE\r
+          AND     #$40                   ;SEE IF IN NEGATE MODE\r
+          BEQ     NONEG2A\r
+          LDA     (TEMP1,X)              ;GET DELTAS\r
+          EOR     #$E0                   ;NEGATE DELTA X\r
+          CLC\r
+          ADC     #$20\r
+          JMP     NONEG2\r
+NONEG2A   LDA     (TEMP1,X)              ;GET DELTAS\r
+NONEG2    ROL     A                      ;ISOLATE DELTA X\r
+          ROL     A\r
+          ROL     A\r
+          ROL     A\r
+          TAX                            ;ATTACH LEADING ONES IF DELTA X\r
+          AND     #4\r
+          BEQ     XPLS                   ;IS NEG\r
+          TXA\r
+          ORA     #$F8\r
+          JMP     XNEG\r
+XPLS      TXA\r
+          AND     #7\r
+XNEG      CLC\r
+          ADC     XCORD,Y                ;AND UPDATE X\r
+          STA     XCORD,Y\r
+          LDA     RACK\r
+          CMP     #10                    ;DON'T GO FASTER IF LOW RACK\r
+          BCC     ENDMSHIP\r
+          LDA     MOMENTUM,Y\r
+          BMI     MOVAGAIN\r
+          LDA     LEVELSEL               ;CHECK IF BONZO MODE\r
+          BMI     ENDMSHIP               ;DONT SPEED UP IF SO\r
+          LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BNE     ENDMSHIP               ;DONT SPEED UP IF SO\r
+          LDA     ARRIVED\r
+          BNE     ENDMSHIP\r
+MOVAGAIN  INC     MSHCNT\r
+          BEQ     CNTMSHP1\r
+ENDMSHIP  LDX     #0\r
+          RTS\r
+CNTMSHP1  JMP     CNTMSHIP\r
+\r
+;\r
+;THIS SUBROUTINE DETERMINES IF THE INVISO SHIP HAS ARRIVED.\r
+;IF IT HAS ALL FORMATION SHIPS ARE CHANGED TO EXPANSION MODE\r
+;\r
+ARRIVE    LDA     TYPE+45                ;SET PTR TO INVISO SHIP\r
+          CMP     #6                     ;AND SEE IF PRESENT\r
+          BEQ     CHANGE2\r
+          RTS\r
+CHANGE2   LDA     MODE+45                ;GET INVISO SHIP MODE\r
+          BEQ     CHANGE                 ;SEE IF IN SHIFTING MODE YET\r
+          RTS\r
+CHANGE    LDA     COLPOS+5\r
+          CMP     #78\r
+          BEQ     CHANGE3\r
+          LDA     CHALSTG                SEE IF CHALLENGING STAGE\r
+          BNE     CHANGE1                IF SO, END THE STAGE\r
+          RTS\r
+CHANGE3   LDA     TYPE+41                ;SEE IF ALL EXTRA SHIPS GONE\r
+          CLC\r
+          ADC     TYPE+42\r
+          ADC     TYPE+43\r
+          ADC     TYPE+44\r
+          BEQ     CHANGE1\r
+          RTS\r
+CHANGE1                                  ;FINAL SHIP ARRIVED AND FORMATION IS\r
+                                         ;CENTERED\r
+          LDA     #0                     ;INVISO SHIP WORK DONE, SO GET RID OF\r
+          STA     EXPANCC\r
+          STA     TYPE+45\r
+;         STA     NUMFLY                 ;SET NUMBER FLYING TO ZERO\r
+          LDA     #$FF\r
+          STA     ARRIVED\r
+          STA     EXPANR\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE CAUSES SHIPS TO PEELOFF AND ATTACK.\r
+;\r
+ATTACK    LDA     RDYREG                 ;SEE IF READY IS BEING DISPLAYED\r
+          BEQ     ATAC1\r
+          RTS\r
+ATAC1     LDA     ABORT\r
+          BEQ     ATTACK7\r
+          RTS                            ;RETURN IF ABORT = 1\r
+ATTACK7   LDA     ARRIVED                ;SEE IF ALL SHIPS ARRIVED\r
+          BNE     CONTAT\r
+          RTS\r
+\r
+CONTAT    LDA     TYPE+63\r
+          BNE     ATT00\r
+          RTS\r
+ATT00     LDA     MODE+40                ;GET MODE OF CAPTURED HERO\r
+          CMP     #8\r
+          BEQ     ATT01\r
+          CMP     #9\r
+          BNE     ATT0\r
+ATT01     RTS                            ;IF IN SPIN OR REUNITE MODE, RETURN\r
+ATT0      LDA     LEVELSEL               ;CHECK IF IN BONZO MODE\r
+          BPL     NOTBONZ2\r
+          LDA     AIRBORNE               ;WAS NUMFLY\r
+          BEQ     NOTBONZ2\r
+          RTS                            ;RETURN IF ONE SHIP ATTACKING\r
+NOTBONZ2  LDA     RACK                   ;SEE IF ANY MORE SHIPS NEEDED TO\r
+          AND     #$1F                   ;ATTACK\r
+          TAY\r
+          LDX     NUMATTK,Y\r
+          CPX     AIRBORNE\r
+          BPL     ATT1\r
+          LDA     RACK\r
+          CMP     #32\r
+          BCS     MASSATTK\r
+          RTS\r
+MASSATTK  INX                            TWO MORE ATTACKING THAN BEFORE\r
+          INX\r
+          CPX     AIRBORNE\r
+          BPL     ATT1\r
+          RTS\r
+ATT1      LDA     #0                     ;SET ELISTPTR TO FIRST SHIP OF FORM\r
+          STA     SHIPLEFT               ;RESET SHIPLEFT FLAG\r
+          TAX                            THIS COUNTS THE NO. OF ATTACK ATTEMPS\r
+          LDY     ATTEMPT\r
+          CPY     #39                    INC ATTEMPT TO NEXT ENTRY IN LIST\r
+          BMI     NXATT\r
+          LDY     #$FF\r
+NXATT     INY\r
+          LDA     TYPE,Y                 ;SEE IF SHIP IS PRESENT\r
+          BEQ     NOGOT\r
+          STA     SHIPLEFT               ;A SHIP PRESENT, SO SET SHIPLEFT FLAG\r
+          BPL     NOGOT1                 ;1ST TEST TO SEE IF SHIP JUST ARRIVED\r
+          LDA     MODE,Y                 ;2ND TEST TO SEE IF SHIP JUST ARRIVED\r
+          CMP     #5\r
+          BNE     NOGOT1\r
+          LDA     EXPANCC                ;RANDOM FACTOR IF SHIP JUST ARRIVED\r
+          AND     #1\r
+          BNE     NOGOT1\r
+          JMP     GOTONE1\r
+NOGOT1    LDA     MODE,Y                 ;SEE IF SHIP IS IN EXPANSION MODE\r
+          BEQ     GOTONE\r
+NOGOT     INX                            INC COUNTER OF ATTACK ATTEMPTS\r
+          CPX     #40\r
+          BEQ     NONELEFT               NO SHIPS LEFT\r
+          CPY     #39                    ;IF CAPTD HERO IS ALONE, SET ATTACK\r
+          BNE     NXATT\r
+          LDY     #$FF                   GO TO BEGINNING OF LIST AGAIN\r
+          BNE     NXATT\r
+NONELEFT  LDA     SHIPLEFT               ;NO MORE SHIPS TO PEELOFF, SO SEE IF\r
+          BNE     NOATT                  ;IF ANY SHIPS FLYING AROUND\r
+          JSR     NEWRACK                ;NO SHIPS LEFT, SO START NEW RACK\r
+          RTS\r
+GOTONE    STY     ATTEMPT\r
+          LDA     TUNNUM\r
+          AND     #$7F                   ;BOOT HIGH BIT\r
+          CMP     #25\r
+          BEQ     HASBACK                ;ALREADY HAS BACKGROUND MUSIC\r
+          LDA     TUNNUM1\r
+          AND     #$7F                   ;BOOT HIGH BIT\r
+          CMP     #25\r
+          BEQ     HASBACK\r
+          LDA     #25                    ;DIDN'T HAVE IT, SO START IT\r
+          JSR     TUNIN                  ;TEMPORARILY OUT OF ACTION\r
+HASBACK   LDA     TYPE,Y\r
+          AND     #$7F\r
+          CMP     #1                     ;SEE IF BLUE SHIP\r
+          BNE     NOTBLUE\r
+          JSR     ATTKBL                 ;IS BLUE, MAKE BLUE ATTACK\r
+          JMP     YATT1\r
+NOTBLUE   CMP     #2                     ;SEE IF RED SHIP\r
+          BNE     NOTRED\r
+          LDA     TYPE,Y                 ;IS RED, MAKE RED ATTACK\r
+          ORA     #$80\r
+          STA     TYPE,Y\r
+;         INC     NUMFLY\r
+          INC     AIRBORNE\r
+          LDA     #L(PEELOFF)\r
+          STA     ML,Y\r
+          LDA     #H(PEELOFF)\r
+          STA     MH,Y\r
+          CPY     #40                    ;SEE IF CAPTD HERO\r
+          BNE     GOMIN1\r
+          LDA     CHTAB40\r
+          BPL     GOMIN2\r
+GOMIN1    LDA     CHTAB,Y\r
+GOMIN2    CMP     #5\r
+          BMI     GOMINUS\r
+          LDA     #$84\r
+          JMP     YATT\r
+GOMINUS   LDA     #$C4\r
+          JMP     YATT\r
+NOTRED    JSR     ATTKBO                 ;MUST BE BOSS, MAKE BOSS ATTACK\r
+          JMP     YATT1\r
+YATT      STA     MODE,Y                 ;CHANGE TO ATTACK MODE\r
+YATT1     LDA     #8                     ;BIRD SWOOP SOUND\r
+          JSR     TUNIN\r
+NOATT     RTS\r
+\r
+GOTONE1   STY     ATTEMPT\r
+          LDA     TYPE,Y\r
+          AND     #$7F\r
+          CMP     #1                     ;SEE IF BLUE SHIP\r
+          BNE     NOTBLUE1\r
+          LDA     #L(BATBL1B)            ;MAKE MTBLPTR AND MODE TO BE A\r
+          STA     ML,Y                   ;CONTINUED BLUE ATTACK\r
+          LDA     #H(BATBL1B)\r
+          STA     MH,Y\r
+          LDA     XCORD,Y                ;SEE IF ON LEFT OR RIGHT SIDE OF\r
+          CMP     #80                    ;SCREEN AND THUS WHICH WAY TO ATTACK\r
+          BCS     NEGATK1\r
+          LDA     #$83\r
+          JMP     CHMODE1\r
+NEGATK1   LDA     #$C3\r
+CHMODE1   STA     MODE,Y\r
+;         INC     AIRBORNE               ;DONT INC IF CONTINUED ATTACK\r
+;         INC     NUMFLY\r
+          RTS\r
+NOTBLUE1  CMP     #2                     ;SEE IF RED SHIP\r
+          BNE     NOTRED1\r
+          LDA     TYPE,Y                 ;IS RED, MAKE CONTINUED RED ATTACK\r
+          AND     #$7F\r
+          STA     TYPE,Y\r
+;         INC     AIRBORNE               ;DONT INC IF CONTINUED ATTACK\r
+;         INC     NUMFLY\r
+          LDA     #L(REDTAB)\r
+          STA     ML,Y\r
+          LDA     #H(REDTAB)\r
+          STA     MH,Y\r
+          CPY     #40                    ;SEE IF CAPTD HERO\r
+          BNE     GOMIN3\r
+          LDA     CHTAB40\r
+          BPL     GOMIN4\r
+GOMIN3    LDA     CHTAB,Y\r
+GOMIN4    CMP     #5\r
+          BPL     GOMINUS1\r
+          LDA     #$84\r
+          JMP     XATT\r
+GOMINUS1  LDA     #$C4\r
+XATT      STA     MODE,Y                 ;CHANGE TO ATTACK MODE\r
+          RTS\r
+NOTRED1   JSR     ATTKBO1                ;MUST BE BOSS, MAKE CONT. BOSS ATTACK\r
+          RTS\r
+\r
+\r
+INITCOLS\r
+          LDA     #1\r
+          STA     TOGGLEM\r
+          STA     SHIPCNT\r
+          STA     BORNCNT\r
+          STA     COL0\r
+          STA     COL1\r
+          STA     COL2\r
+          STA     COL3\r
+          STA     COL4\r
+          STA     EXPANC\r
+          LDA     #25\r
+          STA     COUNT\r
+          LDA     #8\r
+          STA     DECCNT\r
+          LDY     #0\r
+          LDA     #28\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #38\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #48\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #58\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #68\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #77\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #87\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #97\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #107\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          INY\r
+          LDA     #117\r
+          STA     COLPOS,Y\r
+          STA     NEWCOLS,Y\r
+          RTS\r
+;\r
+;THIS SUBROUTINE IS CALLED TO START A NEW RACK\r
+;\r
+NEWRACK   LDA     TYPE+40                ;SEE IF CAPTD HERO ACTIVE\r
+          BEQ     NWRCK1\r
+          RTS\r
+NWRCK1    DEC     RACKREG\r
+          BNE     NEWRACK1\r
+          LDA     #0\r
+          STA     WAVESCR                CLEAR CHAL WAVE SCORE COUNTER\r
+          STA     SHPERWAV               ;RESET NUMBER OF SHIPS PER WAVE\r
+          STA     EXPANR\r
+          STA     TOGGLEM0\r
+          STA     ARRIVED\r
+          STA     AIRBORNE               ;WILL BE 0 ANYWAY EXCEPT FOR CH. STG\r
+          STA     METAREG                ;RESET ABILITY TO METAMORPHOSIZE\r
+          STA     SCORPCNT               ;INDICATES 3 SCORPIONS HIT\r
+          STA     CAPQUAN                RESET BOSS CAPTURING REGISTER\r
+          JSR     INITCOLS\r
+          LDA     #25                    ;KILL BACKGROUND MUSIC\r
+          JSR     SCRAPONE\r
+          LDA     #2                     ;SOUND FOR NEW RACK\r
+          JSR     TUNIN\r
+          LDA     #$80                   ;RESET RACKREG\r
+          STA     RACKREG\r
+          LDA     #70                    ;INIT ANTI-STALLING DEVICE\r
+          STA     BULLSHT\r
+          INC     RACK\r
+          LDA     GASTONHK\r
+          SED\r
+          CLC\r
+          ADC     #1\r
+          STA     GASTONHK\r
+          CLD\r
+          BCC     RACKOK\r
+          LDA     #1\r
+          STA     RACK\r
+          STA     GASTONHK               ;RACK WRAPS AROUND AT 100\r
+;MUST RESET VARIOUS STARTUP REGISTERS HERE\r
+          LDA     #0\r
+          STA     STRSPEED               ;SLOW DOWN STARS AGAIN\r
+          STA     CHALNUM\r
+          STA     WAVEREG\r
+          STA     CHALINDX               ;RESET ALL BIRTH PARAMETERS\r
+RACKOK\r
+          RTS\r
+NEWRACK1  LDA     RACKREG\r
+          CMP     #$60                    ;SEE IF HALF WAY DONE WITH WAIT\r
+          BNE     ENDRACK\r
+          LDA     RACK\r
+          CLC\r
+          ADC     #2\r
+          SEC\r
+NEWRACK2  SBC     #4\r
+          BEQ     CHALRACK\r
+          BCS     NEWRACK2\r
+          BCC     CLRCHSTG\r
+CHALRACK  LDA     #$4F\r
+          STA     CHLNGREG\r
+          STA     CHALSTG\r
+          LDA     #15\r
+          JSR     TUNIN                  ;SET UP CHALLENGING STAGE TUNE\r
+          LDA     #16\r
+          JSR     TUNIN\r
+ENDRACK   RTS\r
+CLRCHSTG  LDA     CHALSTG\r
+          BEQ     ENDRACK\r
+          LDA     #0\r
+          STA     CHALSTG\r
+          LDA     #1                     SHORTEN DELAY FOR STATS MUSIC\r
+          STA     RACKREG\r
+          LDA     #$FF\r
+          STA     SCRTIME                ;TIME TO DISPLAY SCORE\r
+          INC     CHALNUM                ;NEXT CHALLENGING STAGE WILL BE HIGHER\r
+          LDA     CHALNUM\r
+          CMP     #8\r
+          BMI     ENDRACK                ;LEAVE ALONE\r
+          LDA     #0                     ;ONLY 8 DIFFERENT CHALLENGING STAGES\r
+          STA     CHALNUM\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE INITIATES A SHIP POINTED TO BY Y REG ON BLUE ATTACK\r
+;\r
+ATTKBL\r
+          LDA     METAREG                ;INCREMENT METAMORPHOSIS REGISTER\r
+          BMI     META2                  ;NEGATIVE INDICATES DISABLED\r
+          CLC\r
+          ADC     #1\r
+          STA     METAREG\r
+          CMP     #14                    ;SEE IF ALREADY HAVE MADE 20 ATTACKS\r
+          BMI     META2\r
+          LDA     #$FF\r
+          STA     METAREG                ;DISABLE FURTHER METAS\r
+          LDA     RACK\r
+          CMP     #4                     ;NO METAMORF ON LOWEST RACKS\r
+          BCC     META2\r
+;LOOK FOR AVAILABLE BLUE BUG\r
+          LDX     #0\r
+META1     LDA     TYPE,X\r
+          CMP     #1\r
+          BEQ     META14\r
+META15    INX\r
+          CPX     #15\r
+          BMI     META1\r
+          BPL     META2                  ;NO SHIPS AVAILABLE, ABORT ATTEMPT\r
+META14    LDA     MODE,X                 ;CHECK THAT IT'S IN EXPANSION MODE\r
+          CMP     #1\r
+          BEQ     META3\r
+          CMP     #0\r
+          BNE     META15\r
+;STORE NEW SCORPION TYPES\r
+META3     LDA     #40\r
+          STA     METACNT                ;COUNTER BETWEEN NEW SCORPION BIRTHS\r
+          LDA     #13\r
+          STA     TYPE,X                 ;13 IS SCORPION TYPE AND TUNE NUMBER\r
+          JSR     TUNIN\r
+          LDA     #0\r
+          STA     MOMENTUM,X             BIRTH MUST BE SLOW\r
+          LDA     XCORD,X\r
+          STA     XCORD+42\r
+          STA     XCORD+43\r
+          LDA     YCORD,X\r
+          STA     YCORD+42\r
+          STA     YCORD+43\r
+          TXA\r
+          TAY                            SWITCH TO THE NEW SHIP NUMBER\r
+META2     LDA     #L(BATBL1)             ;MAKE\r
+          STA     ML,Y                   ;MTBLPTR AND MODE TO BE BLUE ATTACK\r
+          LDA     #H(BATBL1)\r
+          STA     MH,Y\r
+          LDA     XCORD,Y                ;SEE IF ON LEFT OR RIGHT SIDE OF\r
+          CMP     #80                    ;SCREEN AND THUS WHICH WAY TO ATTACK\r
+          BCS     NEGATK\r
+          LDA     #$83\r
+          BNE     CHMODE\r
+NEGATK    LDA     #$C3\r
+CHMODE    STA     MODE,Y\r
+          INC     AIRBORNE               ;WAS IN SHIFTING OR EXPANSION MODE\r
+;         INC     NUMFLY\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE MOVES A BLUE SHIP POINTED TO BY Y REG ONE STEP BY CALLING\r
+;A SUBROUTINE THAT USES A MOTION TABLE\r
+;\r
+;IT HAS NO PERMANENT LOCAL VARIBLES\r
+;ITS TEMPORARY VARIBLES ARE:\r
+;TEMP1    DS      2\r
+;\r
+;CONSTANTS ARE\r
+;\r
+;Y REGISTER IS SAVED, ALL OTHER\r
+;REGISTERS ARE DESTROYED\r
+;\r
+BLUATK    JSR     MSHBTBL                ;CALL SUBROUTINE TO MOVE SHIP BY TABLE\r
+          TXA                            ;SEE IF END OF TABLE\r
+          BNE     NOEND\r
+          RTS\r
+NOEND     LDA     MODE,Y                 ;IS END\r
+          AND     #$20                   ;SO FIRST SEE IF JUST FINISHED FIRST\r
+          BNE     BAPH2                  ;PHASE\r
+          LDA     XCORD,Y                ;JUST FINISHED FIRST PHASE, SEE IF\r
+          CMP     XCORD+63               ;HERO TO LEFT OR RIGHT\r
+          BCC     NNEGATT\r
+          LDA     MODE,Y                 ;HERO TO THE LEFT, SO DO NEGATE\r
+          ORA     #$60                   ;AND CHANGE MODE TO START PHASE 2\r
+          STA     MODE,Y\r
+          JMP     PHA1\r
+NNEGATT   LDA     MODE,Y                 ;HERO TO THE RIGHT, SO DONT NEGATE\r
+          AND     #$BF\r
+          ORA     #$20                   ;AND CHANGE MODE TO START PHASE 2\r
+          STA     MODE,Y\r
+PHA1      LDA     #H(BATBL1A)            ;NOW CHANGE MOTION TABLE POINTER\r
+          STA     MH,Y                   ;TO START PHASE 2\r
+          LDA     #L(BATBL1A)\r
+          STA     ML,Y\r
+          RTS\r
+BAPH2     LDX     #0\r
+          LDA     (TEMP1,X)              ;SEE IF JUST FINISHED PHASE 2 OR 3\r
+          AND     #$FC\r
+          BNE     BAPH3\r
+          CPY     #40                    ;JUST FINISHED PHASE 2, NOW SEE IF\r
+          BMI     META5                  ;ENEMY STARTED ON LEFT OR RIGHT\r
+          LDA     TYPE,Y                 ;SEE IF SCORPION\r
+          CMP     #13\r
+          BNE     STRAIGHT               ;IF NOT, MAKE GO STRAIGHT\r
+META5     LDA     TYPE,Y                 ;GET SHIP TYPE\r
+          CMP     #13                    ;SEE IF SCORPION\r
+          BNE     META12                 ;HANDLE NORMALLY\r
+          CPY     #40                    ;SEE IF EXTRA SCORPS\r
+          BMI     CURVE                  ;IF ORIGINAL SHIP, GO HOME\r
+          BPL     STRAIGHT               ;IF NOT, GO STRAIGHT DOWN\r
+META12    LDA     CHTAB,Y                ;FIRST SEE IF NOT FORM SHIP, IF SO\r
+          CMP     #5                     ;JUST GO STRAIGHT DOWN\r
+          BPL     RIGHT\r
+          LDA     MODE,Y                 ;STARTED ON LEFT SIDE, NOW SEE IF\r
+          AND     #$40                   ;IS IN NEGATE MODE SO SHOULD DO A\r
+          BEQ     CIRCLE                 ;CURVE, OR NOT NEGATE (CIRCLE)\r
+CURVE     LDA     MOMENTUM,Y             ;SEE IF IN FASTER MODE\r
+          BMI     CIRCLE                 ;DO A CIRCLE IF SO\r
+          LDA     #H(BATBL2)             ;NEGATED SO DO A CURVE (LEFT SIDE)\r
+          STA     MH,Y\r
+          LDA     #L(BATBL2)\r
+          STA     ML,Y\r
+          RTS\r
+CIRCLE    LDA     #H(BATBL3)             ;NOT NEGATED SO DO A CIRCLE (LEFT SIDE)\r
+          STA     MH,Y\r
+          LDA     #L(BATBL3)\r
+          STA     ML,Y\r
+          RTS\r
+STRAIGHT  LDA     #H(BATBL3A)            ;NOT FORM SHIP, AND JUST FINISHED 2ND\r
+          STA     MH,Y                   ;PHASE, SO CAUSE TO GO STRAIGHT DOWN\r
+          LDA     #L(BATBL3A)\r
+          STA     ML,Y\r
+          RTS\r
+RIGHT     LDA     MODE,Y                 ;STARTED ON RIGHT SIDE, SO IF NOT\r
+          AND     #$40                   ;NEGATED DO A CURVE\r
+          BEQ     CURVE\r
+          JMP     CIRCLE\r
+BAPH3     CPY     #40                    ;JUST FINISHED PHASE 3, NOW SEE IF\r
+          BMI     REGUL                  ;NOT FORM SHIP\r
+          LDA     #0                     ;NOT FORM SHIP, SO GET RID OF\r
+          STA     TYPE,Y\r
+          DEC     AIRBORNE\r
+          RTS\r
+REGUL     CMP     #$04                   ;REAL BLUE SHIP, SO SEE IF\r
+          BEQ     UP                     ;SHOULD 'GOHOME' OR 'REAPPEAR'\r
+          LDA     #$82                   ;DID A CIRCLE SO SET MODE TO REAPPEAR\r
+          STA     MODE,Y\r
+          RTS\r
+UP        LDA     #$81                   ;DID A CURVE SO SET MODE TO GOHOME\r
+          STA     MODE,Y\r
+          LDA     TYPE,Y\r
+          AND     #$7F\r
+          STA     TYPE,Y                 ;BOOT THE NEGATIVE SIGN\r
+          RTS\r
+END4      DB      $00                    NEXT CODE SECTION GOES HERE\r
+\r
+          ORG     $CC00\r
+\r
+;\r
+;THIS SUBROUTINE INITIALIZES A SHIP TO CAUSE A BOSS ATTACK\r
+;THE SHIP IS POINTED TO BY THE Y REGISTER\r
+;THE Y REG IS SAVED\r
+;\r
+ATTKBO    LDA     CAPQUAN                ;SEE IF CAN DO A CAPTURE\r
+          BEQ     DONTCAP\r
+          LDA     HEROREAP               ;SEE IF HERO IS SET TO REAPPEAR\r
+          BNE     DONTCAP\r
+          LDA     TYPE+40                ;SEE IF HERO ALREADY CAPTURED\r
+          BNE     DONTCAP\r
+          LDA     TYPE+62\r
+          BNE     DONTCAP\r
+\r
+          LDX     #6                     ;POINT X TO FIRST BOSS\r
+          JSR     TESTBOSS\r
+          LDX     #17\r
+          JSR     TESTBOSS\r
+          LDX     #26\r
+          JSR     TESTBOSS\r
+          LDX     #35\r
+          JSR     TESTBOSS\r
+          JMP     INITCAPX\r
+\r
+TESTBOSS  LDA     TYPE,X                 ;SEE IF BOSS ALIVE\r
+          BNE     TESTBOS1\r
+          RTS\r
+TESTBOS1  LDA     MODE,X\r
+          BPL     TESTBOS2\r
+          RTS\r
+TESTBOS2  AND     #$F\r
+          CMP     #2\r
+          BPL     TESTBOS3\r
+          RTS\r
+TESTBOS3  CMP     #5\r
+          BPL     TESTBOS4\r
+          PLA\r
+          PLA                            ;BOOT THE RTS\r
+          JMP     DONTCAP\r
+TESTBOS4  RTS\r
+\r
+\r
+DONTCAP\r
+          LDA     #$FF\r
+          STA     CAPQUAN                ;RESET ABILITY TO CAPTURE\r
+          TAX\r
+          STA     BOZO8\r
+\r
+\r
+ESCLOOP   LDX     BOZO8\r
+          INX\r
+          CPX     #4\r
+          BNE     BIGBIRD\r
+          RTS\r
+BIGBIRD\r
+          LDA     ESCARG0,X\r
+          STA     BOZO0\r
+\r
+          LDA     ESCARG1,X\r
+          STA     BOZO1\r
+\r
+          LDA     ESCARG2,X\r
+          STA     BOZO2\r
+\r
+          LDA     ESCARG3,X\r
+          STA     BOZO3\r
+\r
+          LDA     ESCARG4,X\r
+          STA     BOZO4\r
+\r
+          LDA     ESCARG5,X\r
+          STA     BOZO5\r
+\r
+          LDA     ESCARG6,X\r
+          STA     BOZO6\r
+\r
+          LDA     ESCARG7,X\r
+          STA     BOZO7\r
+\r
+          STX     BOZO8\r
+\r
+\r
+          CPY     BOZO0                  ;*0 SEE IF FIRST BOSS TO GET ESCORTS\r
+          BNE     ESCLOOP\r
+          LDX     #40                    ;SEE IF OWNS CAPTURED HERO SHIP\r
+          LDA     TYPE,X\r
+          BEQ     NOESC1\r
+          LDA     CHTAB40\r
+          CMP     BOZO1                  ; *1\r
+          BNE     NOESC1\r
+          LDA     MODE,X\r
+          BEQ     YES1\r
+          RTS\r
+\r
+YES1\r
+          JSR     STRTESCB               ;YES, OWNS CAPTURED HERO SHIP\r
+          LDA     #$FF\r
+          STA     COUNTXY,X\r
+NOESC1    LDX     BOZO2                  ;*2 CAUSE BOSS TO ATTACK\r
+          JSR     STRTESCB\r
+          LDA     #$0F\r
+          STA     COUNTXY,X\r
+          INC     AIRBORNE\r
+          LDX     BOZO3                  ;*3 SEE IF FIRST ESCORT AROUND\r
+          LDA     TYPE,X\r
+          BEQ     NOESC1A\r
+          LDA     MODE,X\r
+          BNE     NOESC1A\r
+          JSR     STRTESCB\r
+          LDA     BOZO4                  ;*4 SAY IS LEFT ESCORT GOING TO LEFT\r
+          STA     COUNTXY,X\r
+          INC     AIRBORNE\r
+          LDA     #$10                   ;SAY HAS ONE MORE ESCORT\r
+          CLC\r
+          ADC     COUNTXY,Y\r
+          STA     COUNTXY,Y\r
+NOESC1A   LDX     BOZO5                  ;*5 SEE IF SECOND ESCORT AROUND\r
+          LDA     TYPE,X\r
+          BEQ     NOESC1B\r
+          LDA     MODE,X\r
+          BNE     NOESC1B\r
+          JSR     STRTESCB\r
+          LDA     BOZO6                  ;*6 SAY IS RIGHT ESCORT GOING TO LEFT\r
+          STA     COUNTXY,X\r
+          INC     AIRBORNE\r
+          LDA     #$10                   ;SAY HAS ONE MORE ESCORT\r
+          CLC\r
+          ADC     COUNTXY,Y\r
+          STA     COUNTXY,Y\r
+          JMP     ESCLOOP\r
+\r
+STRTESCB\r
+          BIT     BOZO7\r
+          BPL     SNUFFY\r
+          JSR     STRTESCN\r
+          RTS\r
+SNUFFY    JSR     STRTESCP\r
+NOESC1B   RTS\r
+\r
+\r
+ESCARG0   DC      6,26,35,17\r
+ESCARG1   DC      3,4,5,6\r
+ESCARG2   DC      6,26,35,17\r
+ESCARG3   DC      20,29,38,39\r
+ESCARG4   DC      0,0,2,2\r
+ESCARG5   DC      38,39,30,21\r
+ESCARG6   DC      1,1,3,3\r
+ESCARG7   DC      0,0,$80,$80             ; P OR N\r
+\r
+INITCAPX  LDA     #0\r
+          STA     CAPQUAN                ;DISABLE FURTHER CAPTURES\r
+          LDA     #L(PEELOFF)\r
+          STA     ML,Y\r
+          LDA     #H(PEELOFF)\r
+          STA     MH,Y\r
+          LDA     TYPE,Y\r
+          ORA     #$80\r
+          STA     TYPE,Y\r
+          LDA     #2\r
+          STA     MODE,Y\r
+          INC     AIRBORNE\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE INITIATES A SHIP POINTED TO BY THE X REG TO A POSITIVE BOSS\r
+;ATTACK\r
+;\r
+STRTESCP  LDA     #L(BOTBL1)             ;INIT TABLE POINTERS TO PEELOFF\r
+          STA     ML,X\r
+          LDA     #H(BOTBL1)\r
+          STA     MH,X\r
+          LDA     #$85\r
+          STA     MODE,X\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE INITIATES A SHIP POINTED TO BY THE X REG TO A NEGATIVE BOSS\r
+;ATTACK\r
+;\r
+STRTESCN  LDA     #L(BOTBL1)             ;INIT TABLE POINTERS TO PEELOFF\r
+          STA     ML,X\r
+          LDA     #H(BOTBL1)\r
+          STA     MH,X\r
+          LDA     #$C5\r
+          STA     MODE,X\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE INITIALIZES A SHIP TO CAUSE A CONTINUED BOSS ATTACK\r
+;THE SHIP IS POINTED TO BY THE Y REGISTER\r
+;THE Y REG IS SAVED\r
+;\r
+ATTKBO1\r
+DONTCAP1  LDX     #40                    ;SEE IF OWNS CAPTURED HERO\r
+          LDA     TYPE,X\r
+          BEQ     FINIBOAT\r
+          CPY     #40\r
+          BNE     DONTCCC\r
+          LDA     CHTAB40\r
+          BPL     DONTCCC1\r
+DONTCCC   LDA     CHTAB,Y\r
+DONTCCC1  CMP     CHTAB40\r
+          BNE     FINIBOAT\r
+          LDA     MODE,X                 ;SEE IF HERO READY\r
+          CMP     #5\r
+          BEQ     YEHP\r
+          RTS\r
+YEHP      JSR     COTBOATK\r
+FINIBOAT  TYA                            ;CAUSE BOSS TO CONTINUE REGULAR BOSS\r
+          TAX                            ;ATTACK\r
+          JSR     COTBOATK\r
+          RTS\r
+\r
+;\r
+;THIS SUBROUTINE INITIATES A CONTINUED REGULAR BOSS ATTACK\r
+;THE SHIP INITIATED IS IN THE X REG\r
+;\r
+COTBOATK\r
+          CPX     #40\r
+          BNE     COTB1\r
+          LDA     CHTAB40\r
+          BPL     COTB2\r
+COTB1     LDA     CHTAB,X                ;SEE IF STARTED ON LEFT\r
+COTB2     CMP     #5                     ;OR RIGHT\r
+          BPL     RIGATK2\r
+          LDA     #72                    ;LEFT SIDE, SO GO TO LEFT CORNER\r
+          SEC\r
+          SBC     XCORD,X\r
+          JMP     YGO2\r
+RIGATK2   LDA     #88                    ;RIGHT SIDE, SO GO TO RIGHT CORNER\r
+          SEC\r
+          SBC     XCORD,X\r
+YGO2      STA     ML,X\r
+          LDA     #79\r
+          STA     MH,X\r
+          LDA     #$86\r
+          STA     MODE,X\r
+          LDA     #$0F\r
+          STA     COUNTXY,X\r
+          RTS\r
+\r
+\r
+;\r
+;\r
+;THIS SUBROUTINE MOVES A BOSS SHIP POINTED TO BY Y REG ONE STEP BY CALLING\r
+;A SUBROUTINE THAT USES A MOTION TABLE.  IT IS PHASE ONE OF BOSS ATTACK.\r
+;\r
+;IT HAS NO PERMANENT LOCAL VARIBLES\r
+;ITS TEMPORARY VARIBLES ARE:\r
+;TEMP1    DS      2                      ;0 PAGE\r
+;\r
+;CONSTANTS ARE\r
+;\r
+;Y REGISTER IS SAVED, ALL OTHER\r
+;REGISTERS ARE DESTROYED\r
+;\r
+BOSSATK1  JSR     MSHBTBL                ;CALL SUBROUTINE TO MOVE SHIP BY TABLE\r
+          TXA                            ;SEE IF END OF TABLE\r
+          BNE     ISEND\r
+          RTS\r
+ISEND     LDA     COUNTXY,Y              ;SEE IF IS BOSS SHIP\r
+          CMP     #$0F\r
+          BCC     ESCORT1\r
+          CPY     #40\r
+          BNE     RIG1\r
+          LDA     CHTAB40\r
+          BPL     RIG2\r
+RIG1      LDA     CHTAB,Y                ;BOSS SHIP, SEE IF STARTED ON LEFT\r
+RIG2      CMP     #5                     ;OR RIGHT\r
+          BPL     RIGATK\r
+          LDA     #72                    ;LEFT SIDE, SO GO TO LEFT CORNER\r
+          JMP     YGO\r
+RIGATK    LDA     #88                    ;RIGHT SIDE, SO GO TO RIGHT CORNER\r
+YGO       SEC\r
+          SBC     XCORD,Y\r
+          STA     ML,Y\r
+          LDA     #79\r
+          STA     MH,Y\r
+          LDA     #$86\r
+          STA     MODE,Y\r
+          RTS\r
+ESCORT1   CMP     #0                     ;SEE IF LEFT ESCORT GOING TO LEFT\r
+          BNE     NOTLL\r
+          LDA     #65\r
+          JMP     YGO\r
+NOTLL     CMP     #1                     ;SEE IF RIGHT ESCORT GOING TO LEFT\r
+          BNE     NOTRL\r
+          LDA     #79\r
+          JMP     YGO\r
+NOTRL     CMP     #2                     ;SEE IF LEFT ESCORT GOING TO RIGHT\r
+          BNE     NOTLR\r
+          LDA     #81\r
+          JMP     YGO\r
+NOTLR     LDA     #95                    ;IS RIGHT ESCORT GOING RIGHT\r
+          JMP     YGO\r
+\r
+\r
+;\r
+;THIS SUBROUTINE OPERATES PHASE TWO OF BOSS ATTACK. IT BRINGS THE SHIP TO THE\r
+;LOOP\r
+;THE SHIP IS POINTED TO BY THE Y REGISTER\r
+;THE Y REGISTER IS SAVED\r
+;\r
+BOSSATK2  JSR     MOVBOS                 ;CALL SUBROUTINE TO MOVE SHIP BY STEPS\r
+          LDA     MH,Y                   ;SEE IF FINISHED PHASE 2\r
+          BEQ     CHAGAT\r
+          RTS\r
+CHAGAT    LDA     #L(BOTBL2)             ;FINISHED PHASE 2, INITIALIZE FOR LOOP\r
+          STA     ML,Y\r
+          LDA     #H(BOTBL2)\r
+          STA     MH,Y\r
+          LDA     COUNTXY,Y              ;SEE IF IS BOSS SHIP\r
+          CMP     #$0F\r
+          BCC     ESCORT2\r
+          CPY     #40\r
+          BNE     POSS1\r
+          LDA     CHTAB40\r
+          BPL     POSS2\r
+POSS1     LDA     CHTAB,Y                ;BOSS SHIP, SEE IF STARTED ON LEFT\r
+POSS2     CMP     #5                     ;OR RIGHT\r
+          BPL     NEGATTK1\r
+POSATTK1  LDA     #$87\r
+          JMP     MAKEATK1\r
+NEGATTK1  LDA     #$C7\r
+MAKEATK1  STA     MODE,Y\r
+          RTS\r
+ESCORT2   CMP     #2                     ;ESCORTS, SEE IF GOING LEFT\r
+          BPL     NEGATTK1\r
+          JMP     POSATTK1\r
+\r
+\r
+;\r
+;\r
+;THIS SUBROUTINE MOVES A BOSS SHIP POINTED TO BY Y REG ONE STEP BY CALLING\r
+;A SUBROUTINE THAT USES A MOTION TABLE.  IT IS PHASE THREE OF BOSS ATTACK.\r
+;IT IS THE LOOP.\r
+;IT HAS NO PERMANENT LOCAL VARIBLES\r
+;ITS TEMPORARY VARIBLES ARE:\r
+;TEMP1    DS      2                      ;0 PAGE\r
+;\r
+;CONSTANTS ARE\r
+;\r
+;Y REGISTER IS SAVED, ALL OTHER\r
+;REGISTERS ARE DESTROYED\r
+;\r
+BOSSATK3  JSR     MSHBTBL                ;CALL SUBROUTINE TO MOVE SHIP BY TABLE\r
+          TXA                            ;SEE IF END OF TABLE\r
+          BNE     ISEND1\r
+          RTS\r
+ISEND1    LDA     COUNTXY,Y              ;SEE IF IS BOSS SHIP\r
+          CMP     #$0F\r
+          BCC     ESCORT3\r
+          CPY     #40\r
+          BNE     POOT1\r
+          LDA     CHTAB40\r
+          BPL     POOT2\r
+POOT1     LDA     CHTAB,Y                ;BOSS SHIP, SEE IF STARTED ON LEFT\r
+POOT2     CMP     #5                     ;OR RIGHT\r
+          BPL     RIGATK1\r
+          LDA     #10                    ;LEFT SIDE, SO GO TO LEFT CORNER\r
+          JMP     YGO1\r
+RIGATK1   LDA     #150                   ;RIGHT SIDE, SO GO TO RIGHT CORNER\r
+YGO1      SEC\r
+          SBC     XCORD,Y\r
+          STA     ML,Y\r
+          LDA     #100\r
+          STA     MH,Y\r
+          LDA     #$88\r
+          STA     MODE,Y\r
+          RTS\r
+ESCORT3   CMP     #0                     ;SEE IF LEFT ESCORT GOING TO LEFT\r
+          BNE     NOTLL1\r
+          LDA     #3\r
+          JMP     YGO1\r
+NOTLL1    CMP     #1                     ;SEE IF RIGHT ESCORT GOING TO LEFT\r
+          BNE     NOTRL1\r
+          LDA     #17\r
+          JMP     YGO1\r
+NOTRL1    CMP     #2                     ;SEE IF LEFT ESCORT GOING TO RIGHT\r
+          BNE     NOTLR1\r
+          LDA     #143\r
+          JMP     YGO1\r
+NOTLR1    LDA     #157                   ;IS RIGHT ESCORT GOING RIGHT\r
+          JMP     YGO1\r
+\r
+\r
+;\r
+;THIS SUBROUTINE OPERATES PHASE FOUR OF BOSS ATTACK. IT BRINGS THE SHIP TO THE\r
+;END\r
+;THE SHIP IS POINTED TO BY THE Y REGISTER\r
+;THE Y REGISTER IS SAVED\r
+;\r
+BOSSATK4  JSR     MOVBOS                 ;CALL SUBROUTINE TO MOVE SHIP BY STEPS\r
+          LDA     MH,Y                   ;SEE IF FINISHED PHASE 4\r
+          BEQ     CHAGAT1\r
+          RTS\r
+CHAGAT1   LDA     #$82                   ;FINISHED PHASE 4, RETURN SHIP TO TOP\r
+          STA     MODE,Y\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE IS FOR BOSS GALAGAS, IT MOVES THE SHIP BY STEPS\r
+;\r
+MOVBOS\r
+          LDA     #$FF\r
+          STA     BOZO0                  ;USED AS A TEMP COUNTER\r
+MOVBOS2   TYA                            ;TRANSFER Y REG TO X REG\r
+          TAX\r
+          LDA     ML,X                   ;GET XTOGO\r
+          BEQ     MBOSZER1               ;SEE IF XTOGO IS ZERO\r
+          BPL     MBOSPOS                ;SEE IF XTOGO IS POSITIVE\r
+          DEC     XCORD,X                ;XTOGO IS NEGATIVE\r
+          INC     ML,X\r
+          LDA     #5                     ;SET ANGLE\r
+          JMP     MBOSZER\r
+MBOSPOS   INC     XCORD,X                ;XTOGO IS POSITIVE\r
+          DEC     ML,X\r
+          LDA     #3                     ;SET ANGLE\r
+          JMP     MBOSZER\r
+MBOSZER1  LDA     #4                     ;SET ANGLE\r
+MBOSZER   STA     ANGLE,X                ;STORE ANGLE\r
+          INC     YCORD,X                ;MAKE SHIP GO DOWN ONE STEP\r
+          DEC     MH,X\r
+          BEQ     ENDMBOS\r
+          LDA     MOMENTUM,Y             ;SEE IF TWICE AS FAST\r
+          BPL     ENDMBOS\r
+          INC     BOZO0\r
+          BEQ     MOVBOS2\r
+ENDMBOS   RTS\r
diff --git a/GDAC2.S b/GDAC2.S
new file mode 100644 (file)
index 0000000..3d8b5b5
--- /dev/null
+++ b/GDAC2.S
@@ -0,0 +1,1250 @@
+;  GDAC2.S\r
+;THIS SUBROUTINE DETECTS A COLLISION BETWEEN A HERO MISSLE AND AN ENEMY SHIP\r
+;\r
+;\r
+COLDET1   LDX     #56                    ;INIT PTR TO BEGINNING OF HERO MISSLES\r
+NEWMIS    LDA     TYPE,X                 ;SEE IF MISSLE EXISTS\r
+          BEQ     NXMIS\r
+          LDY     #0\r
+NXEN      LDA     TYPE,Y                 ;SEE IF ENEMY EXISTS\r
+          BEQ     NXENMY\r
+          LDA     YCORD,X                ;TEST FOR COLLISION\r
+          CLC                            ;IF: (YSHIP < YMIS+7) AND\r
+          ADC     #4                     ;    (YSHIP+10 > YMIS) AND\r
+          CMP     YCORD,Y                ;    (XSHIP < XMIS+4 < XSHIP+7)\r
+          BCC     NXENMY\r
+          LDA     YCORD,Y\r
+          CLC\r
+          ADC     #6\r
+          CMP     YCORD,X\r
+          BCC     NXENMY\r
+          LDA     TYPE+62                ;SEE IF SECOND SHIP ACTIVE\r
+          BEQ     MONODTCT\r
+          LDA     XCORD,Y\r
+          CLC\r
+          ADC     #3\r
+          CMP     XCORD,X\r
+          BCC     NXENMY\r
+          LDA     XCORD,X\r
+          CLC\r
+          ADC     #3                     ;SEE IF SHIP IS BETWEEN MISSILES\r
+          CMP     XCORD,Y\r
+          BEQ     NXENMY\r
+          ADC     #6\r
+          CMP     XCORD,Y\r
+          BCC     NXENMY\r
+          JSR     COLLIS1\r
+          RTS\r
+;         JMP     NXMIS\r
+MONODTCT  LDA     XCORD,X\r
+          CLC\r
+          ADC     #3\r
+          CMP     XCORD,Y\r
+          BCC     NXENMY\r
+          LDA     XCORD,Y\r
+          CLC\r
+          ADC     #2\r
+          CMP     XCORD,X\r
+          BCC     NXENMY\r
+          JSR     COLLIS1                ;FOUND A COLLISION\r
+          RTS\r
+;         JMP     NXMIS\r
+NXENMY    INY                            ;INC ELISTPTR TO NEXT ENEMY\r
+          CPY     #40                    ;SEE IF CAPTD HERO\r
+          BNE     CHKPHERO\r
+          LDA     MODE+40\r
+          CMP     #6\r
+          BCC     CHKPHERO\r
+          CMP     #10                    ;MODES 6 - 9 ARE SAFE FROM EXPLOSION\r
+          BCS     CHKPHERO\r
+SKIPHERO  INY                            ;IF SO, DON'T CHECK FOR COLLISION\r
+CHKPHERO  CPY     #45                    ;AND SEE IF AT END OF ENMYLIST\r
+          BNE     NXEN\r
+NXMIS     CPX     #57                    ;INC MISPTR TO NEXT MISSLE AND SEE\r
+          BNE     NDONCOL                ;IF AT END OF HMISLST\r
+          RTS                            ;YES, SO RETURN FROM SUBROUTINE\r
+NDONCOL   LDX     #57                    ;NO, SO CHECK NEW MISSLE AGAINST ALL\r
+          JMP     NEWMIS                 ;OF ENMYLIST\r
+\r
+\r
+;\r
+;\r
+;THIS SUBROUTINE IS CALLED BY COLDET1 WHEN A COLLISION IS FOUND BETWEEN A HERO\r
+;MISSLE (POINTED TO BY X REG) AND AN ENEMY SHIP (POINTED TO BY Y REG).\r
+;\r
+COLLIS1   LDA     TYPE,Y                 ;SEE IF IS BOSS SHIP AND FIRST SHOT\r
+          AND     #$7F                   ;TO HIT IT\r
+          CMP     #3\r
+          BEQ     COLLIXY\r
+          CMP     #4                     ;SEE IF BLUE BOSS\r
+          BNE     COLLIXZ\r
+          LDA     MODE,Y                 ;SEE IF IN BOSS WAIT MODE\r
+          AND     #$8F                   ;LOOK AT MSB AND LOW 4 BITS\r
+          CMP     #3\r
+          BNE     COLLIXZ\r
+          LDA     #0\r
+          STA     WAITCNT                ;CLEAR WAITCNT\r
+          JSR     SCRAPALL               ;KILL TRACTOR BEAM\r
+          JMP     COLLIXX                ;NOW HANDLE EXPLOSION\r
+COLLIXY   LDA     TYPE,Y                 ;CHANGE TO BLUE BOSS\r
+          CLC\r
+          ADC     #1\r
+          STA     TYPE,Y\r
+          LDA     #14                    ;BOSS HIT SOUND\r
+          JSR     TUNIN\r
+          LDA     #0                     ;ZERO OUT MISSLE\r
+          STA     TYPE,X\r
+          RTS\r
+COLLIXZ\r
+          CMP     #16                    ;GREEN BOSS W/ CAPTURED HERO\r
+          BNE     DAK1\r
+          LDA     TYPE,Y\r
+          CLC\r
+          ADC     #1\r
+          STA     TYPE,Y                 ;CHANGE TYPE TO BLUE BOSS W/ HERO\r
+          LDA     #14\r
+          JSR     TUNIN\r
+          LDA     #0\r
+          STA     TYPE,X                 ;ZERO OUT MISSILE\r
+          RTS\r
+DAK1      CMP     #17                    ;BLUE BOSS W/ CAPTURED HERO\r
+          BNE     COLLIXX\r
+          LDA     WAITCNT                ;SEE IF FIRST PICKED UP\r
+          BEQ     NOTRACTR\r
+          LDA     #0\r
+          STA     WAITCNT                ;BOOT TRACTOR BEAM IF FIRST PICKED UP\r
+          JSR     SCRAPALL               ;BOOT TRACTOR BEAM TUNE\r
+          LDA     #11                    ;PUT IN 'PUT HERO BACK DOWN' MODE\r
+          STA     MODE+40\r
+          BNE     BIRDBUG1\r
+NOTRACTR\r
+          LDA     MODE,Y                 ;GET MODE OF BOSS\r
+          BEQ     HREAPR\r
+          CMP     #1\r
+          BNE     NOTHRP\r
+HREAPR    LDA     #5\r
+          STA     HEROREAP               ;SET HERO REAPPEAR MODE\r
+;MAY NEED TO STORE A 5 TO THE MODE HERE\r
+          STX     BOZO0\r
+          LDX     #40\r
+          JSR     COTBOATK\r
+          LDX     BOZO0                  ;NEED TO SAVE THE X VALUE\r
+          JMP     BIRDBUG1               ;CONTINUE TO KILL BOSS\r
+NOTHRP    LDA     #8                     ;HERO SPIN MODE\r
+          STA     MODE+40\r
+          LDA     #5\r
+          JSR     TUNIN                 ;TUNE 5 IS RELEASED HERO TUNE\r
+          LDA     #6\r
+          JSR     TUNIN                 ;TUNE 6 IS OTHER CHANNEL OF TUNE\r
+BIRDBUG1  LDA     #4\r
+          STA     TYPE,Y                 ;HANDLE LIKE REGULAR BLUE BOSS\r
+COLLIXX   CPY     #40                    ;SEE IF CAPTURED HERO SHIP\r
+          BEQ     NOATC\r
+;         DEC     NUMFLY\r
+          LDA     MODE,Y                 ;SEE IF IN SHIFT OR EXPAND MODE\r
+          BEQ     NOATC\r
+          CMP     #1                     ;DEC AIRBORNE IF WAS FLYING\r
+          BEQ     NOATC\r
+;NOW, DEC IF SHOT WHILE IN ORIENT MODE\r
+          DEC     AIRBORNE\r
+NOATC     CPY     #40                    ;SEE WHAT TYPE ENEMY SHIP WAS KILLED\r
+          BNE     NOTHER                 ;SEE IF HERO SHIP\r
+          LDA     #27                    ;HERO DEATH SOUND\r
+          JSR     TUNIN\r
+          LDA     #28                    ;HERO DEATH SOUND\r
+          JSR     TUNIN\r
+          LDA     #$00                   ;HERO DEATH SCORE\r
+          STA     HEROREAP\r
+          STA     MODE+40                ;RESET MODE OF DEAD HERO\r
+          JSR     CLEARBOS               ;CLEAR BOSS WHICH CARRIED HERO\r
+          LDA     #$01\r
+          STA     TEMP4\r
+          LDA     #11                    ;ONE THOUSAND TYPE\r
+          STA     SCRTEMP\r
+          JMP     NOATCX\r
+NOTHER    LDA     CHALSTG                ;SEE IF CHALLENGING STAGE\r
+          BEQ     NOTHER0\r
+          SED\r
+          LDA     CHALSCR\r
+          CLC\r
+          ADC     #1                     ;INCREMENT SCORE FOR CHLNGING STAGE\r
+          STA     CHALSCR\r
+          CLD\r
+          INC     WAVESCR                ;INCREMENT SCORE FOR THIS WAVE\r
+NOTHER0   LDA     TYPE,Y\r
+          AND     #$7F\r
+          CMP     #1                     ;SEE IF BLUE SHIP\r
+          BEQ     META10\r
+          CMP     #13\r
+          BNE     NOTBLU\r
+          LDA     CHALSTG\r
+          BNE     META10                 DONT GIVE 1000 BONUS IF CHAL STAGE\r
+          INC     SCORPCNT\r
+          LDA     SCORPCNT\r
+          CMP     #3                     ;SEE IF HAVE 2 ALREADY\r
+          BNE     META10\r
+          LDA     #11\r
+          STA     SCRTEMP                ;GIVE THOUSAND BONUS\r
+          LDA     #$01\r
+          STA     TEMP4\r
+          BNE     NOATCX\r
+META10    LDA     #12                    ;BLUE DEATH SOUND\r
+          JSR     TUNIN\r
+          LDA     MODE,Y                 ;GET MODE OF DEAD SHIP\r
+          BEQ     LOWBLUE                ;SEE IF IN SHIFTING MODE\r
+          CMP     #1                     ;SEE IF IN EXPANSION MODE\r
+          BEQ     LOWBLUE                ;IF SO, SCORE = 50\r
+          LDA     #$10                   ;BLUE DEATH SCORE\r
+          STA     TEMP5\r
+          BNE     NOATCX\r
+LOWBLUE   LDA     #$05\r
+          STA     TEMP5                  ;GIVE SCORE OF 50\r
+          BNE     NOATCX\r
+NOTBLU    CMP     #2                     ;SEE IF RED SHIP\r
+          BEQ     ISREDX\r
+          CMP     #50\r
+          BNE     NOTREDX\r
+ISREDX    LDA     #11                    ;RED DEATH SOUND\r
+          JSR     TUNIN\r
+          LDA     MODE,Y                 ;GET MODE OF DEAD SHIP\r
+          BEQ     LOWRED\r
+          CMP     #1\r
+          BEQ     LOWRED                 ;SEE IF IN SHIFT OR EXPAND MODE\r
+          LDA     #$16                   ;RED DEATH SCORE\r
+          STA     TEMP5\r
+          BNE     NOATCX\r
+LOWRED    LDA     #$08\r
+          STA     TEMP5                  ;GIVE SCORE OF 80\r
+          BNE     NOATCX\r
+\r
+NOTREDX\r
+          LDA     #10                    ;BOSS DEATH SOUND (MUST BE BOSS)\r
+          JSR     TUNIN\r
+          JSR    ABOSSHIT\r
+\r
+;         ENTRY POINT FROM OTHER CODE SEGMENTS (I'M SORRY TO SAY)\r
+NOATCX\r
+          LDA     WAVESCR                ;CHECK SCORE OF WAVE\r
+          CMP     #8                     ;SEE IF PERFECT\r
+          BNE     NOTHOBON               ;NO THOUSAND BONUS\r
+          LDA     #0\r
+          STA     WAVESCR\r
+          LDA     #$80\r
+          STA     BORNCNT                PUT DELAY BEFORE NEXT WAVE\r
+          LDA     #$01\r
+          STA     TEMP4\r
+          LDA     CHALNUM                ;SEE WHAT STAGE THIS IS\r
+          CMP     #4\r
+          BMI     THOBON\r
+          LDA     #$60\r
+          STA     TEMP5\r
+          LDA     #12\r
+          BNE     SIXTNBON\r
+THOBON    LDA     #11\r
+SIXTNBON  STA     SCRTEMP                ;STORE 1000 SCORE BONUS\r
+NOTHOBON  LDA     #0                     ;ZERO OUT MISSLE\r
+          STA     TYPE,X\r
+          STA     TYPE,Y                 ;ZERO OUT ENEMY SHIP\r
+\r
+          JSR    ENMYBOOM\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE DETECTS A COLLISION BETWEEN THE HERO SHIP AND ANY ENEMY\r
+;SHIP\r
+;\r
+COLDET2   LDA     TYPE+63                ;SEE IF HERO SHIP EXISTS\r
+          BNE     CONTC2\r
+NONIE     RTS\r
+CONTC2    LDA     FARREN\r
+          BMI     NONIE\r
+          LDA     CHALSTG                DONT DETECT IF CHALLENGING STAGE\r
+          BNE     NONIE\r
+          LDY     #0                     ;INIT PTR TO BEGINNING OF ENEMY SHIPS\r
+NXSHP     LDA     TYPE,Y                 ;SEE IF ENEMY SHIP EXISTS\r
+          BEQ     NXESHIP\r
+          LDA     YCORD,Y                ;TEST FOR COLLISION\r
+          CMP     #162                   ;IF: 161 < YSHIP < 181 AND\r
+          BCC     NXESHIP                ;    (HEROX + 7) > XSHIP AND\r
+          CMP     #181                   ;    (XSHIP + 7) > HEROX\r
+          BCS     NXESHIP\r
+          LDA     XCORD+63               ;(HEROX)\r
+          CLC\r
+          ADC     #6\r
+          CMP     XCORD,Y\r
+          BCC     HERO2TST\r
+          LDA     XCORD,Y\r
+          CLC\r
+          ADC     #6\r
+          CMP     XCORD+63               ;(HEROX)\r
+          BCC     NXESHIP\r
+          JSR     COLLIS2\r
+          RTS                            NEW CODE\r
+HERO2TST  LDA     TYPE+62\r
+          BEQ     NXESHIP\r
+          LDA     XCORD+62\r
+          CLC\r
+          ADC     #6\r
+          CMP     XCORD,Y                ;MAKE SURE Y ISN'T TRASHED\r
+          BCC     NXESHIP\r
+          LDA     XCORD,Y\r
+          CLC\r
+          ADC     #6\r
+          CMP     XCORD+62               ;(HEROX)\r
+          BCC     NXESHIP\r
+          JSR     COLLIS2A\r
+          RTS\r
+NXESHIP   INY                            ;INC ELISTPTR TO NEXT ENEMY\r
+          CPY     #45                    ;AND SEE IF AT END OF ENMYLIST\r
+          BMI     NXSHP\r
+;THIS CHECKS FOR COLLISION BETWEEN AN ENEMY MISSILE AND THE HERO SHIP\r
+          LDY     #46\r
+NXEMIS1   LDA     TYPE,Y                 ;SEE IF ENEMY MISSLE EXISTS\r
+          BEQ     NXEMIS\r
+          LDA     YCORD,Y                ;TEST FOR COLLISION\r
+          CLC                            ;IF:  (171 < YMIS+7) AND\r
+          ADC     #6                           (181 > YMIS) AND\r
+          CMP     #171                   ;     (XHERO < XMIS+4 < XHERO+7)\r
+          BCC     NXEMIS\r
+          LDA     #180\r
+          CMP     YCORD,Y\r
+          BCC     NXEMIS\r
+          LDA     XCORD,Y\r
+          CLC\r
+          ADC     #4\r
+          CMP     XCORD+63\r
+          BCC     NXEMIS                 ;MISSILE TOO FAR TO LEFT OF SHIP\r
+          LDA     XCORD+63\r
+          CLC\r
+          ADC     #4\r
+          CMP     XCORD,Y\r
+          BCC     HERO2CHK               ;MISSILE TOO FAR TO RIGHT OF SHIP\r
+          JSR     COLLIS3\r
+          RTS\r
+HERO2CHK  LDA     TYPE+62                ;SEE IF 2ND HERO ACTIVE\r
+          BEQ     NXEMIS\r
+          LDA     XCORD+62               ;CHECK FOR HIT ON 2ND HERO\r
+          SEC\r
+          SBC     #4\r
+          CMP     XCORD,Y\r
+          BCS     NXEMIS\r
+          CLC\r
+          ADC     #7\r
+          CMP     XCORD,Y\r
+          BCC     NXEMIS\r
+          JSR     COLLIS3A\r
+          RTS\r
+NXEMIS    INY                            ;INC ELISTPTR TO NEXT ENEMY\r
+          CPY     #56                    ;AND SEE IF AT END OF ENMYLIST\r
+          BNE     NXEMIS1\r
+          RTS\r
+\r
+H2BOOM    LDA     #0                     ;ZERO OUT SECOND SHIP\r
+          STA     TYPE+62\r
+          STA     MODE+63                ;RESET DUAL MODE\r
+          LDA     #52                    ;STORE HERO EXPLOSION TYPE\r
+          STA     TYPE+65\r
+          LDA     XCORD+62\r
+          SEC\r
+          SBC     #4\r
+          STA     XCORD+65               ;STORE XCORD FOR EXPLOSION\r
+          LDA     #7\r
+          STA     ANGLE+65\r
+          LDA     #168\r
+          STA     YCORD+65\r
+          LDA     #5\r
+          STA     ML+65\r
+          LDA     #0\r
+          STA     MODE+65\r
+          RTS\r
+\r
+H1BOOM    LDA     #0                     ;ZERO OUT HERO SHIP\r
+          STA     TYPE+63\r
+          LDA     #52                    ;STORE HERO EXPLOSION TYPE\r
+          STA     TYPE+66\r
+          LDA     XCORD+63\r
+          SEC\r
+          SBC     #4\r
+          STA     XCORD+66               ;STORE XCORD FOR EXPLOSION\r
+          LDA     #7\r
+          STA     ANGLE+66\r
+          LDA     #168\r
+          STA     YCORD+66\r
+          LDA     #5\r
+          STA     ML+66\r
+          LDA     #0\r
+          STA     MODE+66\r
+          RTS\r
+;\r
+;THIS SUBROUTINE IS CALLED WHEN AN ENEMY SHIP RUNS INTO THE HERO SHIP\r
+;\r
+COLLIS2A  JSR     H2BOOM\r
+          JMP     COLLIS2B\r
+COLLIS2   CPY     #40\r
+          BNE     COLLIS2M\r
+          LDA     MODE+40                ;GET MODE OF SHIP\r
+          CMP     #9                     ;SEE IF IN REUNITE MODE\r
+          BNE     COLLIS2M\r
+          RTS                            ;DON'T DO ANYTHING\r
+COLLIS2M  JSR     H1BOOM\r
+          LDA     TYPE+62                ;SEE IF 2ND HERO ACTIVE\r
+          BEQ     COLLIS2B               ;NO, GO ON\r
+          LDA     #5                     ;RESET HERO SHIP\r
+          STA     TYPE+63\r
+          LDA     XCORD+62\r
+;         STA     XCORD+63               ;SWITCH XCORDS\r
+          STA     HEROX\r
+          LDA     #0\r
+          STA     TYPE+62                ;KILL 2ND SHIP\r
+          STA     MODE+63                ;RESET DUAL MODE\r
+COLLIS2B  LDA     TYPE,Y                 ;SEE IF IS BOSS SHIP AND FIRST TIME\r
+          AND     #$7F                   ;HIT\r
+          CMP     #3\r
+          BEQ     COLL21\r
+          CMP     #16                    ;SEE IF GREEN BOSS W/ HERO\r
+          BNE     COLLIS2G\r
+          LDA     #17\r
+          STA     TYPE,Y                 ;CHANGE TO BLUE BOSS W/ HERO\r
+          JMP     COLL22\r
+COLL21    LDA     #4\r
+          STA     TYPE,Y                 ;CHANGE TO BLUE BOSS\r
+COLL22    LDA     #9                     ;HERO DEATH SOUND\r
+          JSR     TUNIN\r
+          LDA     #14                    ;CHANGE TO BLUE BOSS SOUND\r
+          JSR     TUNIN\r
+          LDX     #58\r
+          JMP     TRYNXSP1\r
+COLLIS2G  CMP     #17                    ;SEE IF IS BLUE BOSS W/ HERO\r
+          BNE     COLLIS2H\r
+          LDA     #8\r
+          STA     MODE+40                ;SET TO HERO SPIN MODE\r
+          LDA     #4                     ;SET TO REG BLUE BOSS\r
+          STA     TYPE,Y\r
+          LDA     #5\r
+          JSR     TUNIN\r
+          LDA     #6\r
+          JSR     TUNIN                  ;HERO RELEASE SOUND\r
+COLLIS2H  CPY     #40                    ;SEE IF IS CAPTURED HERO SHIP\r
+          BNE     NOTCAPH\r
+          JSR     CLEARBOS               ;CLEAR BOSS THAT CARRIED HERO\r
+          LDA     #$01\r
+          STA     TEMP4\r
+          LDA     #11                    ;ONE THOUSAND TYPE\r
+          STA     SCRTEMP\r
+          LDA     #0\r
+          STA     HEROREAP\r
+          JMP     ZAPHERO\r
+NOTCAPH\r
+;         DEC     NUMFLY                 ;DEC NUMBER SHPS FLYING\r
+          DEC     AIRBORNE\r
+          LDA     TYPE,Y                 ;SEE WHAT TYPE OF ENEMY SHIP IT WAS\r
+          AND     #$7F\r
+          CMP     #1                     ;SEE IF BLUE SHIP\r
+          BEQ     META11\r
+          CMP     #13\r
+          BNE     NOTBLUG\r
+META11    LDA     #$10                   ;BLUE DEATH SCORE\r
+          STA     TEMP5\r
+          LDA     FARREN\r
+          CMP     #4\r
+          BNE     DSBLFAR\r
+          LDA     SWCHA\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          BCS     DSBLFAR\r
+          LDA     #$FF\r
+          STA     FARREN\r
+          JMP     ZAPHERO\r
+DSBLFAR   LDA     #0\r
+          STA     FARREN\r
+          JMP     ZAPHERO\r
+\r
+NOTBLUG\r
+          CMP     #2                     ;SEE IF RED SHIP\r
+          BNE     NOTREDXG\r
+          LDA     #$16                   ;RED DEATH SCORE\r
+          STA     TEMP5\r
+          JMP     ZAPHERO\r
+NOTREDXG\r
+          JSR    ABOSSHIT               ; HOW YOU PRONOUNCE IT IS YOUR OWN\r
+                                         ; BUSINESS\r
+\r
+;         THIS IS AN ENTRY POINT FOR BIZARRE CODE SEGMENTS ABOVE\r
+ZAPHERO   LDA     #0                     ; FORMERLY COLLIS2X\r
+          STA     TYPE,Y                 ;ZERO OUT ENEMY SHIP\r
+          LDA     #9                     ;HERO DEATH SOUND\r
+          JSR     TUNIN\r
+\r
+TRYNXSP1\r
+          JSR     ENMYBOOM\r
+          RTS                            ;\r
+\r
+;         COMBINED NOTREDXG AND NOTREDX\r
+ABOSSHIT\r
+          LDA     MODE,Y                 ;MUST BE BOSS\r
+          BPL     FOURHX                 ;SEE IF WAS ATTACKING WITH ESCORTS\r
+          AND     #$0F\r
+          CMP     #5\r
+          BMI     FOURHX\r
+          CMP     #9\r
+          BPL     FOURHX\r
+          LDA     COUNTXY,Y              ;SEE HOW MANY ESCORTS IT HAD\r
+          CMP     #$0F\r
+          BEQ     FOURHX                 ;GO TO NO ESCORT\r
+          CMP     #$1F\r
+          BNE     SIXTENHX\r
+          LDA     #$80                   ;ONE ESCORT\r
+          STA     TEMP5\r
+          LDA     #10                    ;EIGHT HUNDRED TYPE\r
+          STA     SCRTEMP\r
+          RTS\r
+SIXTENHX  LDA     #$60                   ;TWO ESCORTS\r
+          STA     TEMP5\r
+          LDA     #$01\r
+          STA     TEMP4\r
+          LDA     #12                    ;SIXTEEN HUNDRED TYPE\r
+          STA     SCRTEMP\r
+          RTS\r
+\r
+FOURHX    LDA     YCORD,Y                ;GET YCORD OF BOSS\r
+          CMP     #13                    ;SEE IF AT RESTING YCORD\r
+          BEQ     FOURH1                 ;SCORE IS 150 IF SO\r
+          LDA     #$40                   ;NO ESCORTS\r
+          STA     TEMP5                  ;SCORE\r
+          LDA     #9                     ;FOUR HUNDRED TYPE\r
+          STA     SCRTEMP\r
+          RTS\r
+FOURH1    LDA     #$15\r
+          STA     TEMP5                  ;GIVE SCORE OF 150\r
+          RTS\r
+\r
+;         ENEMY BOOM !\r
+ENMYBOOM  LDX     #58\r
+BOOMLOOP  LDA     TYPE,X                 ; IT IS NOW TIME FOR THE GALAGA ON\r
+          BEQ     GOTSP1                 ; YOUR TELEVISION TO EXPLODE\r
+          INX\r
+          CPX     #62\r
+          BNE     BOOMLOOP\r
+          LDX     #58                    ;ALL SPACES TAKEN, JUST USE FIRST SPACE\r
+BOMLOP    LDA     TYPE,X                 ;FIND A USABLE SPOT\r
+          CMP     #9\r
+          BPL     GOTSP1                 USE A 'NUMBER' SPOT\r
+          INX\r
+          CPX     #62\r
+          BNE     BOMLOP\r
+          LDX     #58\r
+GOTSP1    LDA     #8                     ;CHANGE ENEMY SHIP INTO EXPLOSION\r
+          STA     TYPE,X\r
+          LDA     XCORD,Y\r
+          SEC\r
+          SBC     #3                     ;CENTER THE EXPLOSION\r
+          STA     XCORD,X\r
+          LDA     YCORD,Y\r
+          STA     YCORD,X\r
+          LDA     #5\r
+          STA     ML,X\r
+          LDA     #7\r
+          STA     ANGLE,X\r
+          LDA     SCRTEMP\r
+          STA     MODE,X\r
+          LDA     #0\r
+          STA     SCRTEMP\r
+          RTS\r
+\r
+\r
+;\r
+;THIS SUBROUTINE IS CALLED WHEN AN ENEMY MISSLE RUNS INTO THE HERO SHIP\r
+;\r
+COLLIS3A  JSR     H2BOOM                 ;ZERO OUT 2ND HERO\r
+          JMP     COLLIS3B\r
+COLLIS3   JSR     H1BOOM                 ;ZERO OUT HERO SHIP\r
+          LDA     TYPE+62                ;SEE IF 2ND SHIP ACTIVE\r
+          BEQ     COLLIS3B               ;NO, GO ON\r
+          LDA     #0\r
+          STA     MODE+63                ;PUT BACK IN SINGLE MODE\r
+          STA     TYPE+62                ;KILL 2ND SHIP\r
+          LDA     #5\r
+          STA     TYPE+63                ;SWITCH TO HERO SHIP\r
+          LDA     XCORD+62\r
+;         STA     XCORD+63               ;SET NEW XCORD\r
+          STA     HEROX\r
+COLLIS3B  LDA     #0\r
+          STA     TYPE,Y                 ;ZERO OUT MISSLE\r
+          LDA     #9                     ;HERO DEATH SOUND\r
+          JSR     TUNIN\r
+          LDA     FARREN\r
+          BEQ     NON1\r
+          LDA     SWCHA\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          BCS     DISFAR\r
+          INC     FARREN\r
+          BNE     NON1\r
+DISFAR    LDA     #0\r
+          STA     FARREN\r
+NON1      RTS\r
+\r
+;THIS SUBROUTINE CLEARS THE BOSS GALAGA WHICH WAS CARRYING A HERO SHIP\r
+; IT IS CALLED WHEN THE CAPTURED HERO IS KILLED\r
+CLEARBOS  STY     KEEPY\r
+          LDY     CAPBOS1\r
+          LDA     TYPE,Y                 ;GET TYPE OF CAPTURING HERO\r
+          AND     #$7F                   ;BOOT HIGH BIT\r
+          CMP     #16                    ;SEE IF HAS HERO\r
+          BMI     ENDCLRBS\r
+          LDA     TYPE,Y\r
+          SEC\r
+          SBC     #13\r
+          STA     TYPE,Y\r
+ENDCLRBS  LDY     KEEPY\r
+          RTS\r
+;\r
+;THIS SUBROUTINE HANDLES EXPLOSIONS.  THE EXPLOSION IS POINTED TO BY THE\r
+;Y REG\r
+;THE Y REG IS SAVED\r
+;\r
+EXPLO     TYA                            ;TRANSFER Y REG TO X REG\r
+          TAX\r
+          LDA     TYPE,X                 ;CHECK TYPE\r
+          CMP     #8                     ;SEE IF EXPLOSION\r
+          BEQ     BUGEXPLO\r
+          CMP     #52\r
+          BNE     SHOWNUM\r
+BUGEXPLO  DEC     ML,X\r
+          BPL     ENDNUM\r
+          CPY     #60                    ;SEE IF IS HERO EXPLOSION\r
+          BMI     BUGEX1\r
+          LDA     #7\r
+          BNE     BUGEX2\r
+BUGEX1    LDA     #3\r
+BUGEX2    STA     ML,X\r
+          DEC     ANGLE,X\r
+          BNE     ENDNUM\r
+          LDA     MODE,X\r
+          STA     TYPE,X\r
+          LDA     #100\r
+          STA     ML,X\r
+          LDA     #1\r
+          STA     ANGLE,X                ;PREVENT FLAPPING\r
+          BNE     ENDNUM\r
+SHOWNUM   CMP     #9\r
+          BMI     ENDNUM                 ;NOT A SCORE\r
+          CMP     #13\r
+          BPL     ENDNUM                 ;NOT A SCORE\r
+          DEC     ML,X\r
+          BNE     ENDNUM\r
+          LDA     #0\r
+          STA     TYPE,X\r
+          STA     MODE,X\r
+ENDNUM    RTS\r
+\r
+\r
+*******************************************************************************\r
+*\r
+*         SOUND.S       by Kevin G. Osborn\r
+*         Contains subroutines\r
+*                 TUNER\r
+*                 SCRAPALL\r
+*                 SCRAPONE\r
+*                 TUNIN\r
+*******************************************************************************\r
+********************************************************************************\r
+* SIMPSONG VERSION 0.03\r
+*\r
+* THIS SIMPLE SOUND DRIVER HAS, IN SOME WAYS, FEWER FEATURES BUT USES LESS RAM\r
+* AND ROM AND DOES NOT BACK UP SOUNDS FOR LATER (SOMETIMES MUCH LATER)\r
+* CONTINUATION. IT FEATURES 256 NOTE TUNES, SINGLE DURATION PER TUNE, ENDLESS\r
+* TUNES. IF A VALUE IN THE CONTROL OR VOLUME TABLES HAS THE HIGH BIT SET, THAT\r
+* VOLUME OR CONTROL WILL REMAIN IN EFFECT TILL THE END OF THE TUNE.\r
+* AN FF IN THE FREQUENCY TABLE WILL TERMINATE THE TUNE, AN FE WILL CAUSE IT TO\r
+* RESTART.  AN FD WILL CALL THE TUNE NUMBER FOLLOWING (IN THE FREQ TABLE).\r
+*\r
+* SUBROUTINES:\r
+*     SCRAPALL -- KILL ALL TUNES. SHOULD BE CALLED AT POWERUP, CHANGING PLAYERS,\r
+*                AND GAME OVER\r
+*\r
+*     SCRAPONE -- KILL A PARTICULAR TUNE. PUT THE NUMBER OF THE TUNE YA WANNA\r
+*                 AXE IN THE ACCUMULATOR.\r
+*\r
+*     TUNIN   --  START THAT TUNE YOU PUT IN ACC.\r
+*\r
+* THE ABOVE ROUTINES PRESERVE THE X AND Y REGS\r
+*\r
+* TABLES NEEDED ARE:\r
+* RAM:\r
+*DCH0      DS      1                      ONE BYTE--DURATION CNTR CHAN. 0\r
+*DCH1      DS      1                      ONE BYTE--DURATION CNTR CHAN. 1\r
+*TUNNUM    DS      1                      ONE BYTE--TUNE NUM FOR CHAN. 0\r
+*TUNNUM1   DS      1                      ONE BYTE--TUNE NUM FOR CHAN. 1\r
+*TINDEX0   DS      1                      ONE BYTE--NOTE POINTER 0\r
+*TINDEX1   DS      1                      ONE BYTE--NOTE POINTER 1\r
+*CINDEX0   DS      1                      CONTROL INDEX\r
+*CINDEX1   DS      1\r
+*VINDEX0   DS      1                      VOLUME INDEX\r
+*VINDEX1   DS      1\r
+*MPTRL     EQU     KTEMP0                 ZERO PAGE TEMP(NOT GAMEPLAY)\r
+*MPTRH     EQU     KTEMP1                 ZERO PAGE TEMP(NOT GAMEPLAY)\r
+*TUNTEMP   EQU     TEMP0                  ANY GAMEPLAY TEMP\r
+* ROM:\r
+*   DURTABL       ONE DURATION IN FRAMES PER TUNE\r
+*   TBASE         LOW ADDRESS OF THE START OF FREQ DATA BY TUNE NUMBER\r
+*   TBASEH        DITTO FOR HIGH ADDRESS\r
+*   VBASE         LOW ADDRESS OF THE START OF VOL DATA BY TUNE NUMBER\r
+*   VBASEH        DITTO FOR HIGH ADDRESS\r
+*   CBASE         LOW ADDRESS OF THE START OF CTRL DATA BY TUNE NUMBER\r
+*   CBASEH        DITTO FOR HIGH ADDRESS\r
+*   PRYOR         PRIORITY BY TUNE NUMBERS  --  ZERO THE LOWEST\r
+*   VOLTABL       VOLUMES\r
+*   FREQTABL      FREQUENCIES\r
+*   CTLTABL       CONTROLS\r
+\r
+********************************************************************************\r
+* SCRAPALL\r
+*         KILL ALL TUNES. SHOULD BE CALLED AT POWERUP, CHANGING PLAYERS,\r
+*                AND GAME OVER\r
+*   ALSO BEFORE INITIATING A TUNE WITH TWO VOICES\r
+\r
+SCRAPALL  TYA\r
+          PHA\r
+          TXA\r
+          PHA\r
+          LDY     #0\r
+          STY     AUDV0\r
+          STY     AUDV1\r
+          DEY\r
+          STY     TUNNUM\r
+          STY     TUNNUM1\r
+          PLA\r
+          TAX\r
+          PLA\r
+          TAY\r
+          RTS\r
+\r
+; IF YOU WANT, LOOP THIS UP\r
+\r
+********************************************************************************\r
+* SCRAPONE\r
+*         KILL A PARTICULAR TUNE. PUT THE NUMBER OF THE TUNE YA WANNA\r
+*                 AXE IN THE ACCUMULATOR.\r
+SCRAPONE  CMP     TUNNUM\r
+         BNE     CKCH1\r
+         LDA     #0\r
+         STA     AUDV0\r
+         LDA     #$FF\r
+         STA     TUNNUM\r
+         RTS\r
+CKCH1     SEC\r
+         SBC     TUNNUM1\r
+         BNE     REETS\r
+         STA     AUDV1\r
+         LDA     #$FF\r
+         STA     TUNNUM1\r
+REETS     RTS\r
+\r
+********************************************************************************\r
+* TUNIN\r
+*         START THAT TUNE YOU PUT IN ACC.\r
+\r
+TUNIN     STA     TUNTEMP\r
+          TYA\r
+          PHA\r
+          TXA\r
+          PHA\r
+\r
+          LDY     #1\r
+          LDX     TUNTEMP\r
+\r
+TROIK1    LDA     TUNNUM,Y\r
+          CMP     TUNTEMP                ;SEE IF TUNE IS ALREADY IN\r
+          BEQ     DO                     ;GO AHEAD AND LOAD\r
+          DEY\r
+          BPL     TROIK1\r
+\r
+          LDY     #1\r
+TROIKA    LDA     TUNNUM,Y               ;FIRST CHECK FOR AN EMPTY CHANNEL\r
+          CMP     #$FF\r
+          BEQ     DO\r
+TRKNX     DEY\r
+          BPL     TROIKA\r
+          LDA     TUNNUM1                ;THIS IS DONE TO PREVENT GLITCHINESS\r
+          AND     #$7F\r
+          TAY\r
+          LDA     PRYOR,X\r
+          CMP     PRYOR,Y               ;CHECK FOR LOWEST PRIORITY\r
+          LDY     #1\r
+          BCS     DO\r
+          LDA     TUNNUM                ;THIS IS DONE TO PREVENT GLITCHINESS\r
+          AND     #$7F\r
+          TAY\r
+          LDA     PRYOR,X\r
+          CMP     PRYOR,Y               ;CHECK FOR LOWEST PRIORITY\r
+          BCC     ROOTS\r
+          LDY     #0\r
+DO        TXA\r
+          ORA     #$80\r
+          STA     TUNNUM,Y\r
+ROOTS     PLA\r
+          TAX\r
+          PLA\r
+          TAY\r
+          RTS\r
+\r
+********************************************************************************\r
+*TUNER SHOULD BE CALLED ONCE PER FRAME, NO INPUTS, AND IT OPERATES WITH\r
+*A TOTAL DISREGARD FOR REGISTER SANCTITY. EACH TUNE CAN BE 256 NOTES LONG\r
+*IF YOUR TUNES ARE VERY SMALL, YOU COULD DO AWAY WITH ALL THE INDIRECT STUFF\r
+TUNER\r
+; TEST FOR ATTRACT\r
+          LDA     AUTOPLAY\r
+          BNE     REETS\r
+; TEST FOR PAUSE\r
+          LDA     PAUSE\r
+          BMI     REETS                  ;MINUS IF IN PAUSE\r
+\r
+          LDX     #1\r
+TUNLOP    LDY     TUNNUM,X\r
+          INY\r
+          BNE     NETN                   ;TUNNUM=FF DO NEXT CHANNEL\r
+JNXTCH    JMP     NXTCH\r
+NETN      DEY\r
+          BPL     BOOGIE\r
+          TYA                            ;NEW TUNE--INTITIATE\r
+          AND     #$7F\r
+          STA     TUNNUM,X\r
+          TAY\r
+          LDA     CTRLTABL,Y\r
+          STA     AUDC0,X                ; IN EFFECT UNTIL CHANGED\r
+          LDA     #$FF\r
+          STA     DCH0,X                 ;START\r
+          STA     TINDEX0,X\r
+*         STA     CINDEX0,X\r
+          STA     VINDEX0,X\r
+BOOGIE    LDA     TBASE,Y\r
+          STA     MPTRL\r
+          LDA     TBASEH,Y\r
+          STA     MPTRH\r
+          DEC     DCH0,X\r
+          BPL     JNXTCH\r
+          LDA     DURTABL,Y\r
+          STA     DCH0,X\r
+          LDY     TINDEX0,X\r
+*         INC     CINDEX0,X\r
+          INC     VINDEX0,X\r
+          INY\r
+          LDA     (MPTRL),Y              ;FREQ\r
+          CMP     #$FF\r
+          BNE     CKENL\r
+          STA     TUNNUM,X               ;END THIS FUNKY TUNE\r
+          LDA     #0\r
+          STA     AUDV0,X\r
+          BEQ     JNXTCH\r
+CKENL     CMP     #$FE                  ; TEST FOR REPEATS\r
+          BEQ     FOOBEQ\r
+CKNXTT    CMP     #$FD                   ; CONTINUE WITH THE NEXT TUNE\r
+          BNE     STFREQ\r
+          INY                            ; NEXT BYTE IS TUNE INDEX\r
+          LDA     (MPTRL),Y\r
+          TAY\r
+          ORA     #$80                   ; SO THAT NEW CTRL AND VOLUME GET READ\r
+          STA     TUNNUM,X\r
+          LDA     TBASE,Y                ; GET ADDRESS OF NEW TUNE\r
+          STA     MPTRL\r
+          LDA     TBASEH,Y\r
+          STA     MPTRH\r
+FOOBEQ    LDY     #0                     ; JUMP HERE FOR REPEAT\r
+          TYA                            ; Y MUST BE 0, IT'S THE FREQ. INDEX\r
+*         STA     CINDEX0,X\r
+          STA     VINDEX0,X\r
+FRQLOOP   LDA     (MPTRL),Y\r
+STFREQ  ; BPL     SKIP0                  ; IF BIT 7 SET, GET NEW DURATION\r
+;         INY\r
+ ;        LDA     (MPTRL),Y              ;DURATION CHANGES ARE DISABLED\r
+  ;       STA     DCH0,X\r
+   ;      DEY\r
+    ;     LDA     (MPTRL),Y\r
+     ;    INY\r
+      ;   JMP     STIT0\r
+SKIP0     ASL     A\r
+          BPL     SKIP1                  ; IF BIT 6 SET, THIS IS A REST\r
+          LSR     A\r
+          AND     #$BF\r
+          STA     DCH0,X\r
+          TYA\r
+          STA     TINDEX0,X\r
+          DEC     VINDEX0,X\r
+*         DEC     CINDEX0,X\r
+          LDA     #0\r
+          STA     AUDV0,X\r
+          BEQ     NXTCH\r
+SKIP1     ASL     A\r
+          BPL     STIT                   ; IF BIT 5 IS SET, THIS IS A NEW CTRL\r
+          LSR     A\r
+          LSR     A\r
+          AND     #$1F\r
+          STA     AUDC0,X\r
+          INY\r
+          JMP     FRQLOOP                ; DO NEXT BYTE BEFORE RETURNING\r
+STIT      LSR     A\r
+          LSR     A\r
+STIT0     STA     AUDF0,X\r
+          TYA\r
+          STA     TINDEX0,X\r
+          LDY     TUNNUM,X\r
+          LDA     VBASE,Y\r
+          STA     MPTRL\r
+          LDA     VBASEH,Y\r
+          STA     MPTRH\r
+          LDY     VINDEX0,X\r
+          LDA     (MPTRL),Y\r
+          BPL     STVL\r
+          DEY\r
+STVL      STA     AUDV0,X\r
+          TYA\r
+          STA     VINDEX0,X\r
+NXTCH     DEX\r
+          BMI     ROTS\r
+          JMP     TUNLOP\r
+ROTS      RTS\r
+\r
+\r
+********************************************************************************\r
+\r
+\r
+********************************************************************************\r
+*         POINTER TABLES.\r
+\r
+TBASE     DB      L(TTITLE0),L(TTITLE1),L(TSTACHA),L(TFREE1),L(TFREE2)\r
+          DB      L(TRELEAS1),L(TRELEAS2),L(THERSHOT),L(TBIRDSWO)\r
+          DB      L(THERDEA),L(TBOSDEA),L(TREDDEA),L(TBLUDEA)\r
+          DB      L(TTRANSFM),L(TBOSCHNG),L(TCHALNG1),L(TCHALNG2)\r
+          DB      L(TPERFEC1),L(TPERFEC2),L(TSTATS1),L(TSTATS2)\r
+          DB      L(TTRACTOR),L(TCAPTURE),L(TKIDNAP1),L(TKIDNAP2)\r
+          DB      L(TBACMUS),L(TTRAC2),L(TSUIC),L(TSUIC2)\r
+\r
+TBASEH    DB      H(TTITLE0),H(TTITLE1),H(TSTACHA),H(TFREE1),H(TFREE2)\r
+          DB      H(TRELEAS1),H(TRELEAS2),H(THERSHOT),H(TBIRDSWO)\r
+          DB      H(THERDEA),H(TBOSDEA),H(TREDDEA),H(TBLUDEA)\r
+          DB      H(TTRANSFM),H(TBOSCHNG),H(TCHALNG1),H(TCHALNG2)\r
+          DB      H(TPERFEC1),H(TPERFEC2),H(TSTATS1),H(TSTATS2)\r
+          DB      H(TTRACTOR),H(TCAPTURE),H(TKIDNAP1),H(TKIDNAP2)\r
+          DB      H(TBACMUS),H(TTRAC2),H(TSUIC),H(TSUIC2)\r
+\r
+VBASE     DB      L(TTITLE0V),L(TTITLE1V),L(TSTACHAV),L(TFREE1V),L(TFREE2V)\r
+          DB      L(TRELES1V),L(TRELES2V),L(THERSHOV),L(TBIRDSWV)\r
+          DB      L(THERDEAV),L(TBOSDEAV),L(TREDDEAV),L(TBLUDEAV)\r
+          DB      L(TTRNSFMV),L(TBOSCHGV),L(TCHLNG1V),L(TCHLNG2V)\r
+          DB      L(TPERFC1V),L(TPERFC2V),L(TSTATS1V),L(TSTATS2V)\r
+          DB      L(TTRACTRV),L(TCAPTURV),L(TKIDNP1V),L(TKIDNP2V)\r
+          DB      L(TBACMUSV),L(TTRAC2V),L(TSUICV),L(TSUIC2V)\r
+\r
+VBASEH    DB      H(TTITLE0V),H(TTITLE1V),H(TSTACHAV),H(TFREE1V),H(TFREE2V)\r
+          DB      H(TRELES1V),H(TRELES2V),H(THERSHOV),H(TBIRDSWV)\r
+          DB      H(THERDEAV),H(TBOSDEAV),H(TREDDEAV),H(TBLUDEAV)\r
+          DB      H(TTRNSFMV),H(TBOSCHGV),H(TCHLNG1V),H(TCHLNG2V)\r
+          DB      H(TPERFC1V),H(TPERFC2V),H(TSTATS1V),H(TSTATS2V)\r
+          DB      H(TTRACTRV),H(TCAPTURV),H(TKIDNP1V),H(TKIDNP2V)\r
+          DB      H(TBACMUSV),H(TTRAC2V),H(TSUICV),H(TSUIC2V)\r
+\r
+\r
+********************************************************************************\r
+CTRLTABL  DB      $0D,$0D,4,4,4\r
+          DB      4,$D,4,4\r
+          DB      8,4,1,1\r
+          DB      4,4,4,4\r
+          DB      4,$D,$D,$D\r
+          DB      4,4,4,$D\r
+          DB      $D,4,4,$D       ;29 TUNES\r
+\r
+DURTABL   DB      $08,$08,$00,$03,$03\r
+          DB      $02,$02,$00,$03\r
+          DB      $09,$02,$01,$01\r
+          DB      $03,$00,$05,$05\r
+          DB      $02,$02,$08,$08\r
+          DB      $01,$02,$02,$02\r
+          DB      $03,$01,$00,$00\r
+\r
+\r
+PRYOR     DB      6,5,7,8,7\r
+          DB      13,12,3,4\r
+          DB      7,5,5,5\r
+          DB      9,5,8,7\r
+          DB      15,14,15,14\r
+          DB      9,9,11,10\r
+          DB      1,8,8,1\r
+********************************************************************************\r
+\r
+* FREQTABL\r
+;TUNE 0: TITLE SONG\r
+TTITLE0   DB      $0D,$0D,$24,$1F,$1B,$1B,$17,$18,$18,$1F,$1B,$1B,$12,$14,$14\r
+          DB      $1F,$1B,$1B,$17,$18,$18,$1F,$1B,$1B,$10,$0F,$0F,$11,$13,$13\r
+          DB      $14,$17,$17,$1A,$1B,$1B,$2D,$0B,$24,$11,$11,$0F,$11,$11,$14\r
+          DB      $12,$17,$1B,$14,$14,$14,$FF\r
+\r
+TREDDEAV\r
+TBLUDEAV\r
+TTITLE0V\r
+TBIRDSWV\r
+TBOSDEAV\r
+TBOSCHGV\r
+TCHLNG1V\r
+TCHLNG2V\r
+TPERFC1V\r
+TSTATS1V\r
+TTRACTRV\r
+TSUICV    DB      $89\r
+\r
+;TUNE1: TITLE SONG\r
+TTITLE1   DB      $10,$51,$0F,$51,$0D,$51,$0F,$51,$10,$51\r
+          DB      $0F,$51,$0D,$51,$0F,$48,$0F,$11,$11,$12,$14,$14\r
+          DB      $17,$1A,$1A,$1B,$1F,$1F,$1B,$12,$12,$11,$12,$12,$16,$18,$18\r
+          DB      $18,$1B,$1B,$1B,$FF\r
+\r
+TTITLE1V\r
+TTRAC2V\r
+TSUIC2V   DB      $84\r
+\r
+;TUNE2: STAGE CHANGE\r
+TSTACHA   DB      $0F,$40,$13,$40,$11,$43\r
+          DB      $0F,$40,$13,$40,$11,$FF\r
+\r
+TSTACHAV\r
+TKIDNP1V\r
+TFREE2V   DB      $87\r
+\r
+;TUNE3: EXTRA SHIP FANFARE\r
+TFREE1    DB      $13,$17,$13,$0E,$0B,$09,$FF\r
+\r
+TFREE1V   DB      $8A\r
+TBACMUSV  DB      $83                    ;LOWERED THIS VOLUME\r
+\r
+;TUNE4: EXTRA SHIP FANFARE\r
+TFREE2    DB      $17,$1D,$17,$13,$0F,$11,$FF\r
+\r
+\r
+;TUNE5: CAPTURED SHIP RELEASED, PLAYS UNTIL UNITED\r
+TRELEAS1  DB      $D,$42,$10,$42,$F,$42,$12,$42\r
+          DB      $10,$42,$14,$42,$12,$42,$15,$42\r
+          DB      $14,$42,$19,$42,$1C,$42,$1F,$42\r
+          DB      $2D,$A,$42,$C,$42,$D,$42,$E,$42\r
+          DB      $D,$42,$A,$42,$C,$42,$24,$1F,$42\r
+          DB      $2D,$A,$42,$24,$1C,$42,$1F,$42,$19,$42\r
+          DB      $1C,$42,$14,$42,$15,$42,$14,$42\r
+          DB      $12,$42,$1C,$42,$19,$42,$16,$42,$FE\r
+\r
+\r
+TRELES1V\r
+TTRNSFMV  DB      $88\r
+\r
+;TUNE6: SAME AS 4\r
+TRELEAS2  DB      $1C,$1C,$1C,$1C,$12,$12,$12,$12\r
+          DB      $D,$D,$D,$D,$D,$D,$10,$10\r
+          DB      $12,$12,$14,$14,$15,$15,$18,$18\r
+          DB      $1C,$1C,$1D,$1D,$1C,$1C,$18,$18\r
+          DB      $15,$15,$45,$14,$14,$45\r
+          DB      $12,$12,$45,$10,$10,$45\r
+          DB      $12,$12,$12,$41,$14,$14,$15,$15\r
+          DB      $18,$18,$1C,$1C,$1D,$1D,$18,$18,$FE\r
+\r
+TPERFC2V\r
+TRELES2V\r
+TSTATS2V\r
+TKIDNP2V  DB      $85\r
+\r
+;TUNE7: HERO SHOT\r
+THERSHOT  DB      6,7,8,9,$A,$B,$C,$D        ;FREQ\r
+          DB      $F,$11,$13,$15,$17,$19,$1C,$1F\r
+          DB      $FF\r
+\r
+THERSHOV  DB      3,4,5,5,5,5,5,5,5,5,4,4,3,3,4,4,$FF\r
+\r
+;TUNE8: BIRDSWOOPING SOUND\r
+TBIRDSWO  DB      $0A,$0B,$0C,$0D,$0E        ;FREQ\r
+          DB      $0F,$10,$11,$12,$13\r
+          DB      $14,$15,$17,$18,$1A\r
+          DB      $1B,$1D,$1F,$2D,$0B,$0C\r
+          DB      $0D,$0E,$0F,$10,$11\r
+          DB      $12,$13,$14,$15,$FF\r
+\r
+\r
+;TUNE9: HERO DEATH SOUND\r
+THERDEA   DB      $1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$FF\r
+\r
+THERDEAV  DB      $B,$D,$C,$B,$A,9,7,5,3,2,1,$FF\r
+\r
+;TUNE10: BOSS DEATH SOUND\r
+TBOSDEA   DB      $1F,$1C,$1A,$1C,$1A\r
+          DB      $19,$1A,$19,$18,$FF\r
+\r
+\r
+;TUNE11: RED DEATH SOUND\r
+TREDDEA   DB      $09,$08,$07,$05,$41        ;FREQ\r
+          DB      $06,$07,$08,$0B,$FF\r
+\r
+\r
+;TUNE12: BLUE DEATH SOUND\r
+TBLUDEA   DB      $0D,$0B,$0A,$09,$41        ;FREQ\r
+          DB      $0A,$0B,$0D,$0F,$FF\r
+\r
+\r
+;TUNE13: ONE BIRD INTO THREE BIRDS\r
+TTRANSFM  DB      $1D,$1A,$1D,$1A,$16,$13,$16,3,$FF\r
+\r
+\r
+;TUNE14: BOSS GOING TO BLUE\r
+TBOSCHNG  DB      $1F,$1E,$40,$1C,$1B\r
+          DB      $40,$19,$18,$FF\r
+\r
+\r
+;TUNE15: CHALLENGING STAGE CHANNEL 1\r
+TCHALNG1  DB      $13,$4B,$13,$12\r
+          DB      $10,$0E,$0E,$0E,$FF\r
+\r
+\r
+;TUNE16: CHALLENGING STAGE CHANNEL 2\r
+TCHALNG2  DB      $1F,$4B,$1F,$1D\r
+          DB      $1A,$17,$17,$17,$FF\r
+\r
+\r
+;TUNE17: PERFECT SCORE FANFARE\r
+TPERFEC1  DB      $12,$12,$12,$12,$12,$00,$12,$00\r
+          DB      $12,$12,$12,$12,$14,$14,$14,$14\r
+          DB      $14,$14,$14,$00,$14,$14,$14,$14\r
+          DB      $14,$14,$14,$00,$14,$14,$14,$14\r
+          DB      $11,$11,$11,$11,$11,$00,$11,$00\r
+          DB      $11,$11,$11,$11,$12,$12,$12,$12\r
+          DB      $12,$12,$12,$00,$12,$12,$12,$12\r
+          DB      $12,$12,$12,$00,$12,$12,$12,$00\r
+          DB      $11,$00,$11,$11,$11,$00,$11,$00\r
+          DB      $11,$11,$11,$11,$0F,$00,$0F,$0F\r
+          DB      $0F,$00,$0F,$00,$0F,$0F,$0F,$00\r
+          DB      $0F,$0F,$0F,$00,$0F,$0F,$0F,$00\r
+          DB      $0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D\r
+          DB      $0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D\r
+          DB      $FD,8  ;CALL BIRD SWOOP SOUND\r
+\r
+;TUNE18: PERFECT SCORE FANFARE\r
+TPERFEC2  DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1F,$1F,$18,$18,$14,$14,$0F,$0F\r
+          DB      $1D,$42,$1D,$1D,$1D,$42,$1D,$42\r
+          DB      $1D,$1D,$1D,$1D,$1A,$42,$1A,$1A\r
+          DB      $1A,$42,$1A,$42,$1A,$1A,$1A,$42\r
+          DB      $1A,$1A,$1A,$42,$1A,$1A,$1A,$42\r
+          DB      $17,$17,$14,$14,$12,$12,$0F,$0F\r
+          DB      $12,$12,$12,$12,$17,$17,$17,$17,$FF\r
+\r
+;TUNE19: STATISTICS DISPLAY SOUND\r
+TSTATS1   DB      $D,$D,$24,$1F,$1B,$1B,$17,$18,$18\r
+          DB      $1F,$1B,$1B,$12,$14,$14,$1F,$1B\r
+          DB      $1B,$17,$18,$18,$1F,$1B,$1B,$10\r
+          DB      $F,$F,$11,$13,$13,$14,$17,$17\r
+          DB      $1A,$1B,$1B,$2D,$B,$24,$11,$11,$F,$11\r
+          DB      $11,$14,$12,$17,$1B,$14,$14,$14\r
+ABCD      DB      $14,$14,$14,$FF\r
+\r
+\r
+;TUNE20: STATISTICS DISPLAY SOUND\r
+TSTATS2   DB      $51,$D,$D,$24,$1F,$1B,$1B,$17\r
+          DB      $18,$18,$1F,$1B,$1B,$12,$14,$14\r
+          DB      $1F,$1B,$1B,$17,$18,$18,$1F,$1B\r
+          DB      $1B,$10,$F,$F,$11,$13,$13,$14\r
+          DB      $17,$17,$1A,$1B,$1B,$2D,$B,$24,$11,$11\r
+          DB      $F,$11,$11,$14,$12,$17,$1B,$14\r
+ABCDE     DB      $14,$14,$14,$FF\r
+\r
+\r
+;TUNE21: TRACTOR BEAM\r
+TTRACTOR  DB      $0E,$41,$0F,$41,$11,$41,$13,$41,$FE          ;REPEATS\r
+\r
+;TUNE26   SECOND CHANNEL OF TRACTOR BEAM SOUND\r
+TTRAC2    DB      $41,$11,$41,$13,$41,$16,$41,$17,$FE    ;REPEATS\r
+\r
+\r
+;TUNE22: HERO SHIP BEING CAPTURED\r
+TCAPTURE  DB      $17,$13,$10,$0D,$0B\r
+          DB      $0D,$10,$13,$FE        ;REPEATS\r
+\r
+TCAPTURV  DB      $02,$04,$06,$08,$08,$06,$04,$02\r
+          DB      $03,$03,$03,$03,$03,$03,$03,$03\r
+          DB      $07,$09,$0A,$0A,$0A,$0A,$09,$07\r
+          DB      $04,$04,$04,$04,$04,$04,$04,$04\r
+          DB      $03,$05,$07,$09,$09,$07,$05,$03\r
+          DB      $04,$04,$04,$04,$04,$04,$04,$04\r
+          DB      $0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A\r
+          DB      $03,$FE                ;REPEATS\r
+\r
+;TUNE23: HERO BEING TAKEN TO TOP OF SCREEN\r
+TKIDNAP1  DB      $0D,$42,$11,$42,$0F,$42,$12,$42\r
+          DB      $11,$42,$14,$42,$12,$42,$15\r
+          DB      $42,$14,$42,$1A,$42,$1C,$42,$1F\r
+          DB      $42,$2D,$0B,$42,$0C,$42,$0D,$42\r
+          DB      $0E,$42,$0D,$42,$0B,$42,$0C,$42\r
+          DB      $24,$1F,$42,$2D,$0B,$42,$24,$1C,$42,$1F\r
+          DB      $42,$1A,$42,$1C,$42,$14,$42,$16\r
+          DB      $42,$14,$42,$12,$42,$1C,$42\r
+          DB      $19,$42,$16,$42,$FF    ;MAY END ABRUPTLY???\r
+\r
+\r
+;TUNE24: HERO BEING TAKEN TO TOP OF SCREEN\r
+TKIDNAP2  DB      $1C,$1C,$1C,$1C,$12,$12,$12,$12\r
+          DB      $0D,$0D,$0D,$0D,$0D,$0D,$11\r
+          DB      $11,$12,$12,$14,$14,$17,$17,$18\r
+          DB      $18,$1C,$1C,$1E,$1E,$1C,$1C\r
+          DB      $18,$18,$17,$17,$17,$17,$14,$14\r
+          DB      $14,$14,$12,$12,$12,$12,$11\r
+          DB      $11,$11,$11,$12,$12,$12,$12,$14\r
+          DB      $14,$17,$17,$18,$18,$1C,$1C\r
+          DB      $1D,$1D,$18,$18,$FF    ;MAY END ABRUPTLY???\r
+\r
+\r
+;TUNE25: BACKGROUND MUSIC\r
+TBACMUS   DB      $1F,$1D,$1B,$1A,$18        ;FREQ\r
+          DB      $17,$15,$14,$13,$12\r
+          DB      $15,$14,$13,$12,$1F\r
+          DB      $1D,$1B,$1A,$18,$17\r
+          DB      $15,$14,$13,$12,$1F\r
+          DB      $1D,$1B,$1A,$18,$17\r
+          DB      $15,$14,$13,$12,$1F\r
+          DB      $1D,$1B,$1A,$18,$17\r
+          DB      $15,$14,$13,$12,$13\r
+          DB      $14,$15,$17,$12,$13\r
+          DB      $14,$15,$17,$18,$1A\r
+          DB      $1B,$1D,$1F,$12,$13\r
+          DB      $14,$15,$17,$18,$1A\r
+          DB      $1B,$1D,$1F,$12,$13\r
+          DB      $14,$15,$17,$18,$1A\r
+          DB      $1B,$1D,$1F,$12,$13\r
+          DB      $14,$15,$17,$18,$1A\r
+          DB      $1B,$1D,$1F,$FE\r
+\r
+\r
+;TUNE27   SUICIDE CHANNEL 1\r
+TSUIC     DB      $0D,$40,$11,$40,$F,$40,$12,$40\r
+          DB      $11,$40,$14,$40,$12,$40,$15,$40\r
+          DB      $14,$40,$1C,$40,$1A,$40,$1F,$40\r
+          DB      $1C,$40,$2D,$0B,$40,$24,$15,$40,$1A,$40\r
+          DB      $14,$40,$1C,$40,$1A,$40,$1F,$40\r
+          DB      $1C,$40,$2D,$0B,$40,$15,$40,$1F,$40\r
+          DB      $14,$40,$FF\r
+\r
+\r
+;TUNE28   SUICIDE CHANNEL 2\r
+TSUIC2    DB      $1C,$1C,$1C,$1C,$12,$12,$12,$12\r
+          DB      $D,$D,$D,$D,$D,$D,$11,$11\r
+          DB      $12,$12,$12,$12,$14,$14,$14,$14\r
+          DB      $17,$17,$17,$17,$18,$18,$18,$18\r
+          DB      $17,$17,$17,$17,$14,$14,$14,$14\r
+          DB      $12,$12,0,0,$12,$12,0,0\r
+          DB      $1C,$1C\r
+          DB      $FF\r
+\r
+\r
diff --git a/GDAC3.S b/GDAC3.S
new file mode 100644 (file)
index 0000000..0dd867d
--- /dev/null
+++ b/GDAC3.S
@@ -0,0 +1,717 @@
+;GDAC3.S\r
+;\r
+;THE FOLLOWING TABLE GIVES SINGLE OR DOUBLE BIRTH INFORMATION\r
+LOWPAIR   DB      0,2,1,1,1,1         ;2,2,2,2,2\r
+HIGHPAIR  DB      2,2,2,2,2,2,2,1,1,1,1,2,2        ;,2,2\r
+CHALPAIR  DB      2,2,1,1,1,1\r
+          DB      2,2,2,1,1\r
+          DB      1,2,2,1,1\r
+          DB      2,1,1,2,2\r
+          DB      1,1,1,1,1\r
+          DB      1,2,2,1,1\r
+          DB      1,1,1,1,1\r
+          DB      2,1,1,2                ;LAST MEMBER IS @ LOCATION ZERO\r
+\r
+;THE FOLLOWING TABLE INDEXED BY SHIPCNT GIVES THE SHIP NUMBER OF EACH SHIP\r
+;AS IT IS BORN.  NON-FORMATION SHIPS HOLD A SPECIAL CODE\r
+SHPNUTB   DB      38                     ;1\r
+          DB      36                     ;\r
+          DB      39                     ;\r
+          DB      37                     ;\r
+          DB      33                     ;\r
+          DB      31                     ;\r
+          DB      34                     ;\r
+          DB      32                     ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;10\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      6                      ;\r
+          DB      29                     ;\r
+          DB      26                     ;\r
+          DB      30                     ;\r
+          DB      35                     ;\r
+          DB      24                     ;\r
+          DB      17                     ;\r
+          DB      25                     ;20\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      12                     ;\r
+          DB      21                     ;\r
+          DB      16                     ;\r
+          DB      5                      ;\r
+          DB      11                     ;\r
+          DB      20                     ;30\r
+          DB      15                     ;\r
+          DB      4                      ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      19                     ;\r
+          DB      28                     ;\r
+          DB      14                     ;\r
+          DB      23                     ;40\r
+          DB      27                     ;\r
+          DB      18                     ;\r
+          DB      22                     ;\r
+          DB      13                     ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      2                      ;\r
+          DB      9                      ;50\r
+          DB      0                      ;\r
+          DB      7                      ;\r
+          DB      10                     ;\r
+          DB      3                      ;\r
+          DB      8                      ;\r
+          DB      1                      ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;\r
+          DB      L(NOTFOSH)             ;60\r
+          DB      1                      ;\r
+\r
+;THIS TABLE GIVES THE INDEX INTO THE CHALTBL, LOWREGTBL, OR HIREGTBL\r
+;  ACCORDING TO THE SHIP'S SHIPCNT\r
+SHIPINDX  DB      0,2,0,2,0,2,0,2,0,2,22,22\r
+          DB      4,6,4,6,4,6,4,6,4,6,22,22\r
+          DB      8,10,8,10,8,10,8,10,8,10,22,22\r
+          DB      12,14,12,14,12,14,12,14,12,14,22,22\r
+          DB      16,18,16,18,16,18,16,18,18,16,22,22\r
+          DB      20\r
+\r
+;THIS TABLE GIVES A CHALLENGING STAGE SEQUENCE\r
+CHALTBL   DB      L(RACK3),H(RACK3)\r
+          DB      L(RACK7),H(RACK7)\r
+          DB      L(RACK11),H(RACK11)\r
+          DB      L(RACK15),H(RACK15)\r
+          DB      L(RACK19),H(RACK19)\r
+          DB      L(RACK23),H(RACK23)\r
+          DB      L(RACK27),H(RACK27)\r
+          DB      L(RACK31),H(RACK31)\r
+\r
+RACK3     DB      L(SHTY9),H(SHTY9)\r
+          DB      L(SHTY8),H(SHTY8)\r
+          DB      L(SHTY11),H(SHTY11)\r
+          DB      L(SHTY12),H(SHTY12)\r
+          DB      L(SHTY13),H(SHTY13)\r
+          DB      L(SHTY13),H(SHTY13)\r
+          DB      L(SHTY8),H(SHTY8)\r
+          DB      L(SHTY8),H(SHTY8)\r
+          DB      L(SHTY10),H(SHTY10)\r
+          DB      L(SHTY10),H(SHTY10)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK7     DB      L(SHTY18),H(SHTY18)\r
+          DB      L(SHTY19),H(SHTY19)\r
+          DB      L(SHTY20),H(SHTY20)\r
+          DB      L(SHTY21),H(SHTY21)\r
+          DB      L(SHTY53),H(SHTY53)\r
+          DB      L(SHTY21),H(SHTY21)\r
+          DB      L(SHTY19),H(SHTY19)\r
+          DB      L(SHTY19),H(SHTY19)\r
+          DB      L(SHTY18),H(SHTY18)\r
+          DB      L(SHTY18),H(SHTY18)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK11    DB      L(SHTY22),H(SHTY22)\r
+          DB      L(SHTY23),H(SHTY23)\r
+          DB      L(SHTY24),H(SHTY24)\r
+          DB      L(SHTY25),H(SHTY25)\r
+          DB      L(SHTY54),H(SHTY54)\r
+          DB      L(SHTY25),H(SHTY25)\r
+          DB      L(SHTY22),H(SHTY22)\r
+          DB      L(SHTY23),H(SHTY23)\r
+          DB      L(SHTY26),H(SHTY26)\r
+          DB      L(SHTY27),H(SHTY27)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK15    DB      L(SHTY29),H(SHTY29)\r
+          DB      L(SHTY28),H(SHTY28)\r
+          DB      L(SHTY30),H(SHTY30)\r
+          DB      L(SHTY50),H(SHTY50)\r
+          DB      L(SHTY31),H(SHTY31)\r
+          DB      L(SHTY51),H(SHTY51)\r
+          DB      L(SHTY28),H(SHTY28)\r
+          DB      L(SHTY29),H(SHTY29)\r
+          DB      L(SHTY32),H(SHTY32)\r
+          DB      L(SHTY33),H(SHTY33)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK19    DB      L(SHTY34),H(SHTY34)\r
+          DB      L(SHTY34),H(SHTY34)\r
+          DB      L(SHTY35),H(SHTY35)\r
+          DB      L(SHTY55),H(SHTY55)\r
+          DB      L(SHTY36),H(SHTY36)\r
+          DB      L(SHTY36),H(SHTY36)\r
+          DB      L(SHTY34),H(SHTY34)\r
+          DB      L(SHTY34),H(SHTY34)\r
+          DB      L(SHTY37),H(SHTY37)\r
+          DB      L(SHTY37),H(SHTY37)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK23    DB      L(SHTY38),H(SHTY38)\r
+          DB      L(SHTY38),H(SHTY38)\r
+          DB      L(SHTY39),H(SHTY39)\r
+          DB      L(SHTY40),H(SHTY40)\r
+          DB      L(SHTY56),H(SHTY56)\r
+          DB      L(SHTY40),H(SHTY40)\r
+          DB      L(SHTY41),H(SHTY41)\r
+          DB      L(SHTY41),H(SHTY41)\r
+          DB      L(SHTY38),H(SHTY38)\r
+          DB      L(SHTY38),H(SHTY38)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK27    DB      L(SHTY42),H(SHTY42)\r
+          DB      L(SHTY42),H(SHTY42)\r
+          DB      L(SHTY43),H(SHTY43)\r
+          DB      L(SHTY57),H(SHTY57)\r
+          DB      L(SHTY44),H(SHTY44)\r
+          DB      L(SHTY44),H(SHTY44)\r
+          DB      L(SHTY45),H(SHTY45)\r
+          DB      L(SHTY45),H(SHTY45)\r
+          DB      L(SHTY42),H(SHTY42)\r
+          DB      L(SHTY42),H(SHTY42)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK31    DB      L(SHTY46),H(SHTY46)\r
+          DB      L(SHTY47),H(SHTY47)\r
+          DB      L(SHTY58),H(SHTY58)\r
+          DB      L(SHTY48),H(SHTY48)\r
+          DB      L(SHTY49),H(SHTY49)\r
+          DB      L(SHTY49),H(SHTY49)\r
+          DB      L(SHTY46),H(SHTY46)\r
+          DB      L(SHTY47),H(SHTY47)\r
+          DB      L(SHTY46),H(SHTY46)\r
+          DB      L(SHTY47),H(SHTY47)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+LOWREGTB  DB      L(RACK1),H(RACK1)\r
+          DB      L(RACK2),H(RACK2)\r
+\r
+HIREGTB   DB      L(RACK4),H(RACK4)\r
+          DB      L(RACK5),H(RACK5)\r
+          DB      L(RACK6),H(RACK6)\r
+\r
+RACK6\r
+RACK1     DB      L(SHTY3),H(SHTY3)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY5),H(SHTY5)\r
+          DB      L(SHTY6),H(SHTY6)\r
+          DB      L(SHTY7),H(SHTY7)\r
+          DB      L(SHTY7),H(SHTY7)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY4),H(SHTY4)\r
+          DB      L(SHTY4),H(SHTY4)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK5\r
+RACK2     DB      L(SHTY3),H(SHTY3)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY14),H(SHTY14)\r
+          DB      L(SHTY6),H(SHTY6)\r
+          DB      L(SHTY15),H(SHTY15)\r
+          DB      L(SHTY7),H(SHTY7)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY16),H(SHTY16)\r
+          DB      L(SHTY17),H(SHTY17)\r
+          DB      L(SHTY4),H(SHTY4)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+\r
+RACK4     DB      L(SHTY3),H(SHTY3)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY5),H(SHTY5)\r
+          DB      L(SHTY7),H(SHTY7)\r
+          DB      L(SHTY6),H(SHTY6)\r
+          DB      L(SHTY7),H(SHTY7)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY4),H(SHTY4)\r
+          DB      L(SHTY2),H(SHTY2)\r
+          DB      L(SHTY4),H(SHTY4)\r
+          DB      L(SHTY1),H(SHTY1)\r
+          DB      L(SHTY0),H(SHTY0)\r
+;\r
+;THE FOLLOWING ARE THE DEFINITIONS OF THE SHIP TYPES\r
+;\r
+SHTY0     DB      $00                    ;SHIP TYPE  (DOESN'T EXIST)\r
+;\r
+SHTY1     DB      $06                    ;SHIP TYPE  (INVISO)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY2     DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      88                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $80                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY3     DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY4     DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY5     DB      $03                    ;SHIP TYPE  (BIG)\r
+          DB      $F8    ;               ;BEGINNING X POS  (SIDE)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      $01                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION2)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION2)             ;MOTION TBL PTR HIGH\r
+          DB      $80                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY6     DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      $F8   ;                ;BEGINNING X POS  (SIDE)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      $01                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION2)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION2)             ;MOTION TBL PTR HIGH\r
+          DB      $80                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY7     DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      159                    ;BEGINNING X POS  (SIDE)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      $07                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION2)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION2)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY8     DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      88                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK3A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK3A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY9     DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK3A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK3A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+;\r
+SHTY10    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK3A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK3A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+;\r
+SHTY11    DB      $03                    ;SHIP TYPE  (BIG)\r
+          DB      $F8    ;               ;BEGINNING X POS  (SIDE)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      $02                    ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK3B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK3B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+;\r
+SHTY12    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      $F8  ;                 ;BEGINNING X POS  (SIDE)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      $02                    ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK3B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK3B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+;\r
+SHTY13    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      160                    ;BEGINNING X POS  (SIDE)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      $06                    ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK3B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK3B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY14    DB      $03                    ;SHIP TYPE  (BIG)\r
+          DB      $F8                    ;BEGINNING X POS  (SIDE)\r
+          DB      148                    ;BEGINNING Y POS\r
+          DB      $01                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION2)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION2)             ;MOTION TBL PTR HIGH\r
+          DB      $80                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY15    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      159                    ;BEGINNING X POS  (SIDE)\r
+          DB      148                    ;BEGINNING Y POS\r
+          DB      $07                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION2)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION2)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY16    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      78                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $80                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY17    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      82                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY18    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY19    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      88                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+;\r
+SHTY20    DB      3                      ;SHIP TYPE  (BOS)\r
+          DB      $F8                    ;BEGINNING X POS  (TOP)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+;\r
+SHTY21    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      159                    ;BEGINNING X POS  (TOP)\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      6                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY22    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      70                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY23    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      70                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY24    DB      $03                    ;SHIP TYPE  (BOSS)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK11B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK11B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY25    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      162                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      6                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK11B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK11B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY26    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      90                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY27    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      90                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY28    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      70                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY29    DB      13                    ;SHIP TYPE  (SCORPION)\r
+          DB      70                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY30    DB      $03                    ;SHIP TYPE  (BOSS)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      1                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY31    DB      50                     ;SHIP TYPE  (NEWBIRD)\r
+          DB      160                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      7                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY32    DB      13                     ;SHIP TYPE  (RED)\r
+          DB      92                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY33    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      92                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY34    DB      50                     ;SHIP TYPE  (NEWBIRD)\r
+          DB      90                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      5                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK19A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK19A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY35    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      140                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK19B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK19B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY36    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      160                    ;BEGINNING X POS\r
+          DB      140                    ;BEGINNING Y POS\r
+          DB      6                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK19B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK19B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY37    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      70                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      3                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK19A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK19A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY38    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      76                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK23A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK23A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY39    DB      $03                    ;SHIP TYPE  (BOSS)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK23B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK23B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY40    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      160                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      6                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK23B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK23B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY41    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      84                     ;BEGINNING X POS\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK23A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK23A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY42    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      76                     ;BEGINNING X POS\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK27A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK27A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY43    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK27B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK27B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY44    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      160                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      6                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK27B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK27B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY45    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      84                     ;BEGINNING X POS\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK27A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK27A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY46    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      88                     ;BEGINNING X POS\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK31A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK31A)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY47    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      68                     ;BEGINNING X POS\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      4                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK31A)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK31A)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY48    DB      $01                    ;SHIP TYPE  (BLUE)\r
+          DB      $FA                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      1                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK31B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK31B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY49    DB      $02                    ;SHIP TYPE  (RED)\r
+          DB      160                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      7                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK31B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK31B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY50    DB      2                      ;SHIP TYPE  (RED)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      1                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY51    DB      2                      ;SHIP TYPE  (RED)\r
+          DB      160                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      7                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK15B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK15B)            ;MOTION TBL PTR HIGH\r
+          DB      $C9                    ;MODE BYTE  (INV)\r
+\r
+SHTY52    DB      5                      ;SHIP TYPE  (HERO)\r
+          DB      72                     ;BEGINNING X POS  (TOP)\r
+          DB      $FA                    ;BEGINNING Y POS\r
+          DB      $04                    ;BEGINNING ORIENTATION\r
+          DB      L(MOTION1)             ;MOTION TBL PTR LOW\r
+          DB      H(MOTION1)             ;MOTION TBL PTR HIGH\r
+          DB      $C0                    ;MODE BYTE  (INV)\r
+;\r
+SHTY53    DB      1                      ;SHIP TYPE\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRACK7B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRACK7B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY54    DB      1                      ;SHIP TYPE\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK11B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK11B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY55    DB      $03                    ;SHIP TYPE\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      140                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK19B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK19B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY56    DB      2                      ;SHIP TYPE  (RED)\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK23B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK23B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY57    DB      3                      ;SHIP TYPE\r
+          DB      $F8                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      2                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK27B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK27B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
+SHTY58    DB      $03                    ;SHIP TYPE\r
+          DB      $FA                    ;BEGINNING X POS\r
+          DB      160                    ;BEGINNING Y POS\r
+          DB      1                      ;BEGINNING ORIENTATION\r
+          DB      L(CHRCK31B)            ;MOTION TBL PTR LOW\r
+          DB      H(CHRCK31B)            ;MOTION TBL PTR HIGH\r
+          DB      $89                    ;MODE BYTE  (NORMAL)\r
+\r
diff --git a/GDAC4.S b/GDAC4.S
new file mode 100644 (file)
index 0000000..24b0f4c
--- /dev/null
+++ b/GDAC4.S
@@ -0,0 +1,448 @@
+;GDAC4.S\r
+;\r
+;\r
+;\r
+;THIS TABLE IS A MOTION TABLE WHICH CAUSES A SHIP TO ENTER IN THE FIRST, FOURTH,\r
+;AND FIFTH WAVES.  X AND ANGLE MUST BE NEGATED FOR HALF OF THE FIRST WAVE AND\r
+;THE FIFTH WAVE.\r
+;THERE ARE 110 ENTRIES.\r
+;\r
+MOTION1   DB      $F6,$04\r
+          DB      $56,$04\r
+          DB      $E5,$04,$E4,$04,$E4,$04,$E4,$04\r
+          DB      $56,$E4,$C4,$E4,$C4,$E4\r
+          DB      $C4,$E4,$C4,$E4,$C4,$E4,$C4,$E4,$C4,$E4\r
+          DB      $C4,$E4,$C4,$E4,$C4,$F6,$E4\r
+          DB      $E4,$E4,$04,$E4,$04,$46\r
+          DB      $E4,$04,$E4,$04,$E4,$04,$E4,$04,$E4,$04\r
+          DB      $E4,$04,$E4,$04,$E4,$26,$04,$E7,$04\r
+          DB      $E4,$C6\r
+          DB      $04,$27,$04,$24,$04,$36,$24\r
+          DB      $44,$24,$44,$24,$24,$20,$24,$40\r
+          DB      $27,$20,$24\r
+          DB      $F6,$20\r
+          DB      $26,$20,$3F,$20,$3C,$20,$3C,$20,$3C,$20\r
+          DB      $5C,$3C,$5C,$36,$3C,$1C,$3C\r
+          DB      $66,$1C,$1F,$26,$1C\r
+          DB      $3C,$1C,$3C,$A6\r
+          DB      $1C,$02\r
+\r
+;\r
+;THIS IS THE TABLE WHICH CAUSES A SHIP TO ENTER IN THE SECOND AND THIRD WAVES.\r
+;X AND ANGLE MUST BE NEGATED FOR THE THIRD WAVE.\r
+;141 ENTRIES\r
+MOTION2   DB      $3C,$20,$3C,$20,$3C,$20,$3C,$20,$3C,$20\r
+          DB      $3C,$20,$3C,$20,$3C,$20,$3C,$20,$3C,$20\r
+          DB      $3C,$20,$3C,$20,$3C,$20,$3C,$20,$3C,$20\r
+          DB      $3C,$20,$3C,$20,$3C,$20,$3C,$20,$3C,$20\r
+          DB      $3C,$3C,$3C,$20,$3C,$20,$3C,$3C,$3C,$20\r
+          DB      $3C,$20\r
+          DB      $F6,$3C\r
+          DB      $46,$3C,$1C,$3C,$1C,$3C,$1C,$3F,$66,$1C\r
+          DB      $FC,$1C,$FC,$26\r
+          DB      $1C,$FC,$1C,$FF,$1C,$26,$FC,$E0\r
+          DB      $FC,$E0,$E3,$86\r
+          DB      $E0,$E7,$E0,$E4,$E0,$E4,$E0,$E4,$E0\r
+          DB      $E4,$04,$E4,$04,$E4,$04,$E7,$86\r
+          DB      $04,$27,$04,$24,$04\r
+          DB      $24,$04,$24,$04,$26,$24,$20,$24,$20\r
+          DB      $23\r
+          DB      $A6,$20,$3F,$20,$3C,$20,$26,$3C,$1C\r
+          DB      $3C,$1C,$3C,$1C,$3C,$1C,$3C,$1C,$3C\r
+          DB      $46,$1C,$1F,$26,$1C,$3C,$1C\r
+          DB      $3C\r
+          DB      $C6,$1C,$02\r
+\r
+\r
+;THIS TABLE IS A MOTION TABLE WHICH IS FOLLOWED BY AN ATTACKING BLUE SHIP.\r
+;IT IS GONE THROUGH TWICE.\r
+;THERE ARE TWO PARTS, ONLY THE SECOND PART IS REPEATED.\r
+;THERE ARE A TOTAL OF 58 ENTRIES\r
+;\r
+BATBL1    DB      $FF,$1C,$DF,$FC,$C7,$E4,$E7\r
+BATBL1B   DB      $F6,$04\r
+          DB      $D6,$04\r
+BATBL1A   DB      $56,$04,$24,$04,$27,$04\r
+          DB      $24,$04,$24,$04,$26,$24,$00,$24,$00\r
+          DB      $27,$20,$24,$66,$20\r
+          DB      $24,$20,$25,$20,$24,$20,$24,$20,$24,$20\r
+          DB      $24,$20,$24,$20,$28,$24,$28,$24,$24,$04\r
+          DB      $24,$04,$25,$04,$24,$04,$02\r
+\r
+;THIS TABLE INDEXED BY RACK TELLS HOW MANY MISSLES CAN EXIST AT A TIME\r
+;DURING THE SPECIFIC RACK\r
+;32 ENTRIES\r
+NUMMIS    DB      53,47,48,46,48,49,49,46      ;46=0,47=1,ETC\r
+          DB      49,49,49,46,49,50,50,46\r
+          DB      48,49,49,46,49,49,50,46\r
+          DB      49,49,49,46,50,50,51\r
+          DB      46\r
+\r
+;THESE TABLES ARE THE MOTION TABLES FOR BOSS ATTACK\r
+;9 ENTRIES\r
+BOTBL1    DB      $FF,$1C,$DF,$FC,$C7,$E4,$E7,$04,$02\r
+\r
+;THIS IS A HSC GAMEPOLL ROUTINE\r
+GAMEPOLL\r
+          LDX     SWCHA\r
+          INX\r
+          BNE     FUCKYES                YES, THERE IS AN INPUT\r
+          LDA     SWCHB\r
+          AND     #$03\r
+          CMP     #$03\r
+          BNE     FUCKYES                YES, THERE IS AN INPUT\r
+          LDA     INPT4\r
+          AND     INPT5\r
+          BPL     FUCKYES\r
+          CLC                            SIGNAL NO INPUT\r
+          RTS\r
+FUCKYES   SEC                            SIGNAL INPUT FOUND\r
+          RTS\r
+\r
+; THIS TABLE IS COPIED INTO RAM WHEN HSC IS CALLED.  IT'S THE ARGUMENT BLOCK\r
+;         NEEDED BY THE HSC.\r
+\r
+HSCROM    DB      $86,$26                ; CARTRIDGE ID NUMBER\r
+                                         ; trailing zero bit set\r
+          DB      $00                    ; DIFFICULTY LEVEL\r
+                                         ;  + PLAYER NUMBER (BOTTOM 2 BITS)\r
+          DB      $00                    ; CONTROLLER TYPE\r
+\r
+          DB      0\r
+          DB      0                      ;USE ZEROS FOR GAMENAME\r
+          DB      L(DNAME0)            ; POINTER TO DIFFICULTY NAME\r
+          DB      H(DNAME0)              ;26 BYTES LONG\r
+          DB      L(HSCORE),H(HSCORE)  ; POINTER TO THE SCORE\r
+                                         ;   WILL BE PL0SCORE OR PL1SCORE\r
+          DB      L(HSCDLL),H(HSCDLL)    ; DLIST LIST POINTER FOR LOGO\r
+\r
+          DB      L(TWINKEL),H(TWINKEL) ; TWINKLE ROUTINE\r
+\r
+          DB      $04                    ; SECONDS TO WAIT BEFORE RETURNING\r
+                                         ;  (FOR EACH DIFFICULTY LEVEL)\r
+\r
+\r
+DNTABL    DB      L(DNAME0),L(DNAME1),L(DNAME2)  ;NOVICE,ADVANCED,EXPERT\r
+DNTABH    DB      H(DNAME0),H(DNAME1),H(DNAME2)\r
+TWINKY    DB      $43,$50,$41,$48,$52,$50,$5D\r
+END3      DB      $49\r
+\r
+\r
+          ORG     END4\r
+;\r
+;THIS IS THE MOTION TABLE WHICH CAUSES AN ATACKING BLUE SHIP TO CIRCLE AROUND.\r
+;THERE ARE 110 ENTRIES\r
+BATBL3    DB      $E4,$04,$E5,$04,$E4,$04,$E4,$04,$26\r
+          DB      $E4,$E0,$E4,$E0,$E4,$E0,$E4,$E0,$E5,$E0\r
+          DB      $E4,$C6\r
+          DB      $E0,$FC,$E0,$FD,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$E0,$FC,$E0,$46\r
+          DB      $FC,$1C,$FC,$1C,$FC,$1C,$FC,$1C,$FD,$1C\r
+          DB      $FC,$C6\r
+          DB      $1C,$3C,$1C,$3D,$1C,$3C,$1C\r
+          DB      $3C,$1C,$3C,$1C,$3C,$1C,$46\r
+          DB      $3C,$20,$3C,$20,$3C,$20,$3C,$20,$3D,$20\r
+          DB      $3C,$C6\r
+          DB      $20,$24,$20,$25,$20,$24,$20\r
+          DB      $24,$20,$24,$20,$24,$20,$46\r
+          DB      $24,$04,$24,$04,$24,$04,$24,$04,$25,$04\r
+          DB      $24\r
+          DB      $F6,$04,$F6,$04\r
+          DB      $F6,$04,$04\r
+BATBL3A   DB      $F6,$04\r
+          DB      $76,$04,$0E\r
+\r
+TWINKX    DB      $28,$3E,$47,$50,$30,$57,$5B,$72\r
+\r
+;THESE TABLES ARE THE MOTION TABLES FOR BOSS ATTACK\r
+;66 ENTRIES\r
+BOTBL2    DB      $05,$E4,$04,$E4,$04,$E4,$04,$26,$E4\r
+          DB      $E0,$E4,$E0,$E5,$A6\r
+          DB      $E0,$E1,$E0,$FC,$E0\r
+          DB      $26,$FC,$1C,$FC,$1C,$FC,$1C,$FC,$1C,$FD\r
+          DB      $86,$1C,$3D\r
+          DB      $1C,$3C,$1C,$3C,$1C,$3C,$20,$3C,$20,$3C\r
+          DB      $20,$3C,$20,$3D,$86\r
+          DB      $20,$21,$20,$24,$20,$26,$24\r
+          DB      $04,$24,$04,$24,$26,$04,$25,$04,$24\r
+          DB      $56,$04\r
+END5      DB      $02\r
+\r
+\r
+\r
+          ORG     $DF76\r
+;COPYRIGHT GCC 1984\r
+          DB      $47,$43,$43,$28,$63,$29,$31,$39,$38,$34\r
+\r
+;THIS NEXT SECTION GOES AFTER GLOADER.S\r
+          ORG     END01\r
+\r
+;\r
+;THIS IS THE MOTION TABLE WHICH CAUSES AN ATTACKING BLUE SHIP TO CURVE\r
+;UP TOWARD THE FORMATION.\r
+;THERE ARE 4 ENTRIES\r
+;\r
+BATBL2    DB      $E5,$04,$C5,$E4,$DD,$FC,$FD,$1C,$06\r
+\r
+;\r
+;\r
+;THIS TABLE INDEXED BY RACK TELLS HOW MANY SHIPS CAN BE FLYING AROUND\r
+;IN THE SPECIFIC RACK\r
+;\r
+NUMATTK   DB      4,2,2,1,3,3,3,1\r
+          DB      2,2,2,1,3,3,3,1\r
+          DB      3,3,3,1,3,3,3,1\r
+          DB      3,3,3,1,4,4,4,1\r
+\r
+;  THIS TABLE IS FOR THE RACK 3 CHALLENGING STAGE\r
+CHRACK3A  DB      $F6,$08\r
+          DB      $F6,$08\r
+          DB      $36,$08,$E8,$08,$08,$E9\r
+          DB      $E8,$08,$E8,$08,$26,$E8,$08,$36,$E8\r
+          DB      $E4,$E4,$36,$E8,$E4,$E4\r
+          DB      $E8,$E8,$E4,$E4,$E8,$E4,$E4,$E8,$56,$E4\r
+          DB      $C4,$26,$E4\r
+          DB      $26,$C4,$C0,$C0,$DC,$DD,$DC,$F8,$F9\r
+          DB      $18,$F8,$18,$38,$18,$38,$38,$39,$38,$20,$3C\r
+          DB      $58,$58,$20,$3C,$58,$20,$3D,$20,$3C,$20,$3C\r
+          DB      $20,$3C,$20,$3C,$58,$40,$20,$3C,$5C,$20\r
+          DB      $3C,$20,$3C,$40,$20,$3C,$20,$3C,$20,$3C,$40\r
+          DB      $20,$3C,$40,$40,$20,$3C,$40,$20,$3C,$40,$20\r
+          DB      $3C,$20,$3C,$40,$20,$3C,$40,$20,$3C,$20\r
+          DB      $3C,$40,$20,$3C,$40,$20,$3C,$20,$3C,$40\r
+          DB      $20,$3C,$40,$20,$3C,$20,$3C,$40,$20,$3C\r
+          DB      $40,$20,$3C,$20,$3C,$40,$20,$3C,$40,$20\r
+          DB      $3C,$20,$3C,$40,$20,$3C,$40,$20,$3C,$20\r
+          DB      $3C,$40,$20,$3C,$40,$20,$3C,$02\r
+\r
+CHRACK3B  DB      $E0,$E0,$FC,$26,$E0,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$E0,$D8,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$D8,$FC,$E0,$D8,$FC,$E0\r
+          DB      $D8,$FC,$E0,$D8,$FC,$E0,$FC,$E0\r
+          DB      $FC,$E0,$FC,$FC,$1C,$56\r
+          DB      $FC\r
+          DB      $1C,$26,$FC,$FD\r
+          DB      $FC,$1C,$FC,$FD,$F8\r
+          DB      $36,$1C,$F8,$F6,$1C\r
+          DB      $F6,$1C\r
+          DB      $B6,$1C\r
+          DB      $3D,$3C,$1C,$3C,$3C,$3D,$26,$20,$24\r
+          DB      $20,$25,$26,$24,$20,$24,$24,$04,$24\r
+          DB      $05,$F6,$04\r
+          DB      $F6,$04\r
+          DB      $B6,$04\r
+          DB      $E9\r
+          DB      $E0,$FC,$E0,$FC,$FD\r
+          DB      $FC,$FD\r
+          DB      $F6,$FC\r
+          DB      $F6,$FC\r
+          DB      $F6,$FC\r
+          DB      $F6,$FC\r
+          DB      $F6,$FC,$F2\r
+          DB      $02\r
+\r
+CHRACK7B  DB      $F6,$20\r
+          DB      $F6,$20\r
+          DB      $F6,$20\r
+          DB      $F6,$20\r
+          DB      $F6,$20\r
+          DB      $36,$20,$3C,$26,$20\r
+          DB      $3C,$26,$20,$3C,$20,$3C,$20,$3C,$20\r
+          DB      $36,$5C,$5F,$5C,$58,$5C,$58,$58\r
+          DB      $38,$58,$58,$38,$58,$26,$38,$58,$46\r
+          DB      $38,$3B,$18,$38,$38,$18,$38\r
+          DB      $18,$38,$26,$18,$38,$56,$18\r
+          DB      $F8,$26,$18,$F8,$18,$F8,$18\r
+          DB      $F8,$F8,$18,$F8,$FB,$66,$F8\r
+          DB      $26,$D8,$86,$DC\r
+          DB      $C3,$DC,$C0,$C0,$DC,$B6,$C0\r
+          DB      $C4,$C0,$C3,$C4\r
+          DB      $C0,$76,$C4,$36\r
+          DB      $C8,$46,$E8,$EB,$26\r
+          DB      $08,$E8,$E8,$08,$E8,$08,$E8,$26\r
+          DB      $08,$E8,$56,$08,$28\r
+          DB      $26,$08,$28,$08,$28,$08,$28,$28,$08\r
+          DB      $56,$28,$48,$28,$28,$2B\r
+          DB      $48,$28,$48,$48,$28,$48,$48,$44,$48,$44\r
+          DB      $24,$20,$24,$20,$27,$20,$24,$20,$24,$20\r
+          DB      $24,$20,$24,$20,$24,$26,$20,$24,$26\r
+          DB      $20,$24,$F6,$20\r
+          DB      $F6,$20\r
+          DB      $F6,$20,$F6,$20\r
+          DB      $F6,$20\r
+          DB      $26,$20,$02\r
+\r
+*THIS DATA IS ALSO USED FOR CHRACK11A\r
+CHRACK7A  DB      $F6,$08\r
+          DB      $F6,$08\r
+          DB      $A6,$08\r
+          DB      $28,$2B,$28,$56,$48\r
+          DB      $44,$48,$44,$48,$26,$44,$47\r
+          DB      $44,$40,$44,$40,$44,$40,$44,$41,$45,$41\r
+          DB      $C1,$DC,$C0,$DC,$C1,$DC,$C0,$DC,$C0\r
+          DB      $46,$DC,$D8,$DC,$D8,$DC,$56,$D8\r
+          DB      $F9,$F8,$F8,$F6,$18\r
+          DB      $F6,$18\r
+          DB      $A6,$18\r
+          DB      $02\r
+\r
+CHRCK11B  DB      $F6,$40\r
+          DB      $F6,$40\r
+          DB      $86,$40,$36,$03,$B6,$C0\r
+          DB      $DD\r
+          DB      $DC,$DC,$D8,$DC,$36,$D8,$36,$F8\r
+          DB      $18,$F8,$F8,$18,$F8,$F8,$18,$F9\r
+          DB      $18,$F8,$18,$F8,$18,$F8,$26,$18,$F8\r
+          DB      $36,$18,$F8,$66,$18\r
+          DB      $38,$18,$38,$38,$18,$66,$38\r
+          DB      $39,$86,$58\r
+          DB      $26,$5C,$5D,$5C,$5C\r
+          DB      $40,$45,$44,$48,$28,$29,$28,$28,$08,$08\r
+          DB      $28,$26,$08,$28,$F6,$08\r
+          DB      $46,$08,$2B,$28,$48,$48\r
+          DB      $47,$44,$F6,$40\r
+          DB      $F6,$40\r
+          DB      $86,$40\r
+          DB      $02\r
+\r
+CHRCK15A  DB      $76,$08,$0B,$03\r
+          DB      $40,$44,$40,$44,$45,$48,$48,$4C,$28,$29\r
+          DB      $28,$08,$28,$08,$E8,$08,$26,$E8,$C9\r
+          DB      $26,$C8,$C4,$C1,$C4,$36,$C0\r
+          DB      $36,$C4,$C7,$C8,$C8,$CC,$E8,$0B\r
+          DB      $E8,$36,$08,$28,$08,$28,$28,$4B\r
+          DB      $48,$48,$64,$40,$47,$46,$40\r
+          DB      $44,$40,$44,$48,$49,$48,$48,$28,$28,$09\r
+          DB      $28,$26,$08,$E8,$08,$26,$E8,$C9\r
+          DB      $C8,$A8,$C4,$C0,$C1,$C4,$26,$C0,$46\r
+          DB      $DC,$D9,$D8,$D4,$F8,$F8,$19\r
+          DB      $F8,$18,$18,$38,$18,$36,$38,$59\r
+          DB      $58,$26,$5C,$41,$5C,$26,$40,$5C\r
+          DB      $40,$26,$5C,$5B,$58,$58,$38,$38,$3B\r
+          DB      $18,$38,$18,$18,$F8,$18,$26,$F8,$DB\r
+          DB      $B4,$D8,$DC,$DC,$DF,$46,$C0\r
+          DB      $DC,$C0,$DC,$DC,$DD,$D8,$26,$F8,$F9\r
+          DB      $18,$F8,$18,$18,$38,$18,$38,$18,$38,$59\r
+          DB      $58,$58,$5C,$5C,$5D,$40,$5C,$40,$43,$03\r
+          DB      $86,$18,$02\r
+\r
+CHRCK15B  DB      $5C,$5C,$66,$58,$38\r
+          DB      $3B,$36,$38,$18,$38,$18,$38,$18\r
+          DB      $38,$18,$38,$18,$18,$38,$18,$38,$18,$38\r
+          DB      $18,$36,$38,$58,$38,$58,$38,$5D\r
+          DB      $58,$5C,$5C,$41,$5C\r
+*THIS IS THE FIRST LOOP\r
+CHRCK15C\r
+          DB      $46,$40,$44,$45,$44,$24\r
+          DB      $48,$26,$28,$09,$28,$08,$28,$08,$08\r
+          DB      $28,$08,$08,$C8,$08,$C8,$08,$C8,$08,$C8\r
+          DB      $C8,$C9,$C8,$C4,$C9,$C8,$C4,$C0,$D8,$D9\r
+          DB      $D8,$18,$F9,$46,$18,$38,$18\r
+          DB      $38,$18,$38,$18,$46,$38,$59\r
+          DB      $38,$26,$58,$59,$58,$40,$58,$40\r
+\r
+          DB      $46,$40,$44,$45,$44,$24\r
+          DB      $48,$26,$28,$09,$28,$08,$28,$08,$08\r
+          DB      $28,$08,$08,$C8,$08,$C8,$08,$C8,$08,$C8\r
+          DB      $C8,$C9,$C8,$C4,$C9,$C8,$C4,$C0,$D8,$D9\r
+          DB      $D8,$18,$F9,$46,$18,$38,$18\r
+          DB      $38,$18,$38,$18,$46,$38,$59\r
+          DB      $38,$26,$58,$59,$58,$40,$58,$40\r
+\r
+          DB      $46,$40,$44,$45,$44,$24\r
+          DB      $48,$26,$28,$09,$28,$08,$28,$08,$08\r
+          DB      $28,$08,$08,$C8,$08,$C8,$08,$C8,$08,$C8\r
+          DB      $C8,$C9,$C8,$C4,$C9,$C8,$C4,$C0,$D8,$D9\r
+          DB      $D8,$18,$F9,$46,$18,$38,$18\r
+          DB      $38,$18,$38,$18,$46,$38,$59\r
+          DB      $38,$26,$58,$59,$58,$40,$58,$40\r
+*THIS IS THE DEPARTING PATH\r
+CHRCK15D\r
+          DB      $40,$44,$45\r
+          DB      $48,$48,$26,$28,$48,$26,$28,$29\r
+          DB      $08,$28,$08,$28,$08,$28,$26,$08,$28\r
+          DB      $08,$28,$08,$28,$08,$28,$08,$28,$08,$28\r
+          DB      $08,$26,$28,$2B,$36,$28,$47\r
+          DB      $40,$40,$02\r
+\r
+CHRCK19A  DB      $F6,$E8,$F6,$E8,$F6,$E8,$46,$E8,$EB,$08,$2B\r
+          DB      $F6,$48,$48,$47,$40,$5F,$F6,$58,$58\r
+          DB      $3B,$38,$FB\r
+          DB      $F8,$F6,$D8,$26,$D8,$DF,$C7,$D6,$C8,$EB\r
+          DB      $08,$2B,$B6,$48,$47,$40,$5F,$B6\r
+          DB      $58,$3B,$18,$FB,$A6,$D8,$DF,$C7\r
+          DB      $A6,$C8,$EB,$08,$2B,$86,$48,$47\r
+          DB      $40,$5F,$86,$58,$3B,$18,$FB,$76\r
+          DB      $D8,$DF,$C7,$76,$C8,$EB,$2B,$66\r
+          DB      $48,$47,$5F,$56,$58,$5B,$1B,$F6\r
+          DB      $D8,$F6,$D8,$F6,$D8,$36,$D8,$02\r
+\r
+CHRCK19B\r
+          DB      $76,$40,$5F,$26,$5C,$F6,$58,$F6,$58,$96\r
+          DB      $58,$5D,$26,$5C,$36,$40,$45,$26,$44,$48\r
+          DB      $49,$36,$28,$36,$08,$E9,$26,$E8,$C8,$C8\r
+          DB      $C4,$C5,$76,$C0,$DD,$26,$DC,$F6,$D8,$D8\r
+          DB      $36,$DC,$C3,$26,$C0,$C7,$26,$C4,$C8,$C8\r
+          DB      $EB,$26,$E8,$36,$08,$2B,$26,$28,$48,$48\r
+          DB      $36,$44,$43,$26,$40,$5F,$26,$5C,$F6,$58\r
+          DB      $26,$58\r
+          DB      $3B,$26,$38,$36,$18,$FB,$26,$F8,$D8,$D8\r
+          DB      $36,$DC,$C3,$26,$C0,$C7,$26,$C4,$C8,$CB\r
+          DB      $36,$E8,$36,$08,$2B,$F6,$28,$F6,$28,$86\r
+          DB      $28,$36,$48,$76,$44,$43,$D6,$40,$02\r
+\r
+CHRCK23A  DB      $F6,$08,$36,$08,3,3,$B6,$40\r
+          DB      1,1,$F6,8,$36,8,3,3,$B6,$40,1,1\r
+          DB      $F6,8,$36,8,3,3,$F6,$40,$36,$40\r
+          DB      $02\r
+\r
+CHRCK23B  DB      $36,$40,$5F,$F6,$5C,$F6,$5C,$F6,$5C,$F6,$5C,$5C\r
+          DB      $58,$3B,$18,$FB,$D8,$96,$DC,$C3,$F6,$C0\r
+          DB      $F6,$C0,$DD,$26,$DC,$D8,$F9,$18\r
+          DB      $39,$58,$36,$5C,$41,$F6,$40,$76,$40,$5F\r
+          DB      $26,$5C,$58,$3B,$18,$FB,$D8,$36,$DC,$C3\r
+          DB      $F6,$C0,$C0,$C0,$DD,$26,$DC,$D8,$F9,$18\r
+          DB      $39,$48,$36,$5C,$41,$76,$40,$03,$03,$76\r
+          DB      $18,$02\r
+\r
+CHRCK27A  DB      $76,$08,$01,$01,$F6,$C0,$F6,$C0,$C0,$C3\r
+          DB      $03,$03,$F6,$24,$F6,$24,$F6,$24,$F6,$24\r
+          DB      $F6,$24,$F6,$24,$F6,$24,$F6,$24,$F6,$24\r
+          DB      $49,$01,$01,$F6,$C0,$F6,$C0,$F6,$C0,$F6\r
+          DB      $C0,$B6,$C0,$02\r
+\r
+CHRCK27B  DB      $F6,$20,$5F,$26,$5C,$36,$3C,$3B,$26,$38\r
+          DB      $F6,$18,$A6,$18,$39,$26,$38,$36,$3C,$21\r
+          DB      $3C,$20,$3C,$76,$20,$25,$20,$24,$20\r
+          DB      $24,$20,$24,$20,$24,$20,$24,$20,$24,$20,$96,$24\r
+          DB      $24,$20,$27,$20\r
+          DB      $B6,$20,$3F,$20,$3C,$20,$96,$3C\r
+          DB      $3C,$20,$3C,$20,$3C,$20,$3C,$20,$3C,$20,$3D,$20\r
+          DB      $76,$20,$25,$20,$24,$20,$36,$24,$36,$28\r
+          DB      $05,$F6,$08,$A6,$08,$2B,$26,$28,$36,$24\r
+          DB      $36,$44,$23,$A6,$20,$02\r
+\r
+CHRCK31A  DB      $F6,$08,$B6,$08,$2B,$26,$28,$48,$48,$26\r
+          DB      $44,$47,$56,$40,$5F,$26,$5C,$58,$5B,$36\r
+          DB      $38,$56,$18,$FB,$26,$F8,$D8,$DB,$36,$DC\r
+          DB      $56,$C0,$C7,$26,$C4,$C8,$C8,$F6,$E8,$F6\r
+          DB      $E8,$56,$E8,$C8,$C8,$36,$C4,$C1,$46,$C0\r
+          DB      $DD,$26,$DC,$D8,$D8,$36,$F8,$19,$46,$18\r
+          DB      $36,$38,$59,$58,$26,$5C,$5D,$56,$40\r
+          DB      $36,$44,$49,$48,$36,$28,$09,$46,$08,$E9\r
+          DB      $F6,$E8,$E8,$36,$C8,$B6,$C4,$C1,$76,$C0\r
+          DB      $02\r
+\r
+CHRCK31B  DB      $F6,$5C,$F6,$5C,$F6,$5C,$56,$5C,$36,$58\r
+          DB      $3B,$46,$38,$76,$18,$56,$F8,$DB,$26,$D8\r
+          DB      $56,$DC,$C3,$66,$C0,$56,$C4,$CB,$26,$C8\r
+          DB      $56,$E8,$0B,$66,$08,$56,$28,$4B,$26,$48\r
+          DB      $56,$44,$43,$66,$40,$5F,$F6,$5C,$F6,$5C\r
+          DB      $46,$5C,$02\r
+END2      DB      $02\r
+\r
+          END\r
diff --git a/GLOAD.S b/GLOAD.S
new file mode 100644 (file)
index 0000000..149cb82
--- /dev/null
+++ b/GLOAD.S
@@ -0,0 +1,14 @@
+JU\r
+MGG;GRAPHA.S,R:M1:$\r
+MGG;GRAPHB.S,R:M1:$\r
+MGG;GLOADER.S,R:$\r
+MGG;GMAIN.S,R:$\r
+MGG;GMIV.S,R:$\r
+MGG;GSCORE.S,R:$\r
+MGG;GDAC1.S,R:$\r
+MGG;GDAC2.S,R:$\r
+MGG;GDAC3.S,R:$\r
+MGG;GDAC4.S,R:$\r
+MGG;DOALL,R:M1:$\r
+MGG;SET,R:M1:$\r
+MGG;GAME.Z,R:$\r
diff --git a/GLOADER.S b/GLOADER.S
new file mode 100644 (file)
index 0000000..40abf94
--- /dev/null
+++ b/GLOADER.S
@@ -0,0 +1,1246 @@
+;*******************************************************************************\r
+*GLOADER.S\r
+          ORG     $B000                  ;ORG AFTER GRAPHICS\r
+\r
+ZERO      EQU     0\r
+HUNDRED   EQU     $100\r
+\r
+STARTUP   SEI                            ; STARTUP CODE\r
+          CLD\r
+          LDX     #$FF\r
+          TXS\r
+\r
+          LDA     #$17\r
+          STA     $01                    ;LOCK INTO MARIA MODE\r
+\r
+          STX     CTRLWT                 ;TURN OFF DMA\r
+\r
+\r
+          LDA     #0\r
+          STA     $38                    STORE ZERO INTO OFFSET\r
+;         LDX     #$FF                   ;ZERO OUT ZERO PAGE\r
+ZEROLOP1  STA     ZERO,X\r
+          DEX\r
+          CPX     #$3F\r
+          BNE     ZEROLOP1\r
+\r
+;         LDA     #0                   ; ZERO OUT ZERO PAGE\r
+          TAY                            SAVE A ZERO HERE\r
+          STA     1                      ;DECONFUSE 6532\r
+          STA     INPT4\r
+          STA     INPT5\r
+          STA     CHARBASE\r
+          STA     DUMYHDR\r
+          STA     DUMYHDR+4\r
+          STA     DUMYHDR+5\r
+          STA     DUMYHDR+6\r
+          STA     ZEROHDR\r
+          STA     ZEROHDR+1\r
+          LDA     #$40\r
+          STA     DUMYHDR+1\r
+          LDA     #$A0\r
+          STA     DUMYHDR+2\r
+          LDA     #$1F\r
+          STA     DUMYHDR+3\r
+\r
+; SET UP THE TWO DISPLAY LIST LISTS\r
+;         LDY     #0\r
+          LDA     #$48\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #H(DUMYHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #L(DUMYHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #$4F\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #H(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #L(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDX     #0\r
+INITDLST  LDA     #$4B\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     LISTTBH1,X\r
+          STA     DLSTLST1,Y\r
+          LDA     LISTTBH2,X\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     LISTTABL,X\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          INX\r
+          CPX     #16\r
+          BMI     INITDLST\r
+;NOW FINISH LAST TWO ZONES (OFF THE SCREEN)\r
+          LDA     #$4F\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #H(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #L(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #$47\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #H(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #L(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #$CF\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #H(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+          INY\r
+          LDA     #L(ZEROHDR)\r
+          STA     DLSTLST1,Y\r
+          STA     DLSTLST2,Y\r
+*INITIALIZE COLOR PALETTES\r
+          LDA     #0\r
+          STA     INTIM                  ;TEMPORARILY OUT OF ACTION\r
+          STA     P0C0                   ; MAKE THE SCREEN BLACK\r
+          STA     SELECT                 ;CLEAR SELECT MODE FLAG\r
+          STA     RSTRTREG               ;CLEAR RESTART MODE FLAG\r
+          STA     LEVELSEL\r
+          STA     TWOPLAYR\r
+          STA     FARREN\r
+          JSR     CLRSCORE               ;CLEAR ALL SCORES\r
+          LDX     #8\r
+          LDY     #30\r
+PLOOP     LDA     PTABL,Y\r
+          STA     P0C1,Y\r
+          DEY\r
+          LDA     PTABL,Y\r
+          STA     P0C1,Y\r
+          DEY\r
+          LDA     PTABL,Y\r
+          STA     P0C1,Y\r
+          DEY\r
+          DEY\r
+          DEX\r
+          BNE     PLOOP\r
+WGHTLOOP  LDA     CTRLRD                ;WAIT FOR VBLANK OFF\r
+          BMI     WGHTLOOP               ;LOOP UNTIL VBLANK OFF\r
+WGHTLOP2  LDA     CTRLRD                 ;LOOP UNTIL VBLANK ON\r
+          BPL     WGHTLOP2\r
+          LDA     CTRLRD\r
+          BPL     WGHTLOP2\r
+          JSR     CLEARDL1               CLEAR OUT DISPLAY LIST FIRST\r
+          LDA     #L(DLSTLST1)\r
+          STA     DPPL\r
+          LDA     #H(DLSTLST1)\r
+          STA     DPPH\r
+          LDA     #$40\r
+          STA     CTRLWT\r
+;CONTINUE WITH REMAINDER OF INITIALIZATION\r
+RESTART\r
+          JSR     SCRAPALL\r
+          LDA     #0\r
+          LDX     #$FF                   ;ZERO OUT ZERO PAGE\r
+ZEROLOOP  STA     ZERO,X\r
+          DEX\r
+          CPX     #$3F\r
+          BNE     ZEROLOOP\r
+          JSR     INITCOLS\r
+          LDA     #76\r
+          STA     HEROX\r
+          LDA     #20\r
+          STA     ANIMATE\r
+          STA     SELTIMER               ;SELECT TIMER\r
+          JMP     BEGIN\r
+\r
+;HANDLER  IS CALLED BY THE DLI AT THE END OF THE VISIBLE SCREEN\r
+HANDLER\r
+          ; NO PERMINANT LOCAL VARIABLES\r
+          ;TEMP VARIABLES\r
+          ; LISTSIZ   DS 16\r
+          ; ELISTPTR  DS 2     ZERO PAGE\r
+          ; LTYPE     DS 1\r
+          ; LY        DS 1\r
+          ; LA        DS 1\r
+          ; HEADER0   DS 1\r
+          ; HEADER1   DS 1\r
+          ; HEADER2   DS 1\r
+          ; HEADER3   DS 1\r
+          STA     SAVEB                  ;THIS IS FOR LOOPING INTERRUPTS\r
+\r
+          LDA     INHSC                  ;SEE IF IN HIGH SCORE CART\r
+          BEQ     NOTHSC\r
+          CMP     #1                     ;SEE IF FIRST DLI ON SCREEN\r
+          BNE     SCNDDLI\r
+          INC     INHSC\r
+          LDA     #0\r
+          STA     FLAP                   ;PREVENT FLAPPING WHILE IN HSC\r
+          LDA     #$40\r
+          STA     CTRLWT                 ;NEED $40 RATHER THAN THE $4B OF HSC\r
+          BNE     YESHSC\r
+SCNDDLI   LDA     #$4B\r
+          STA     CTRLWT\r
+          DEC     INHSC\r
+          INC     BOOTLDR\r
+          CLD                            ;CLEAR DECIMAL MODE, JUST IN CASE\r
+          LDA     #$FF\r
+          STA     DLSPTR                 ;USE FIRST DISPLAY LIST FOR GRAPHICS\r
+          LDA     SAVEB\r
+          STA     SAVEA\r
+          STX     SAVEX\r
+          STY     SAVEY\r
+          JMP     DOHNDLER               ;RUN THE HSC LOADER NOW\r
+\r
+NOTHSC    LDA     PAUSE                  ;SEE IF PAUSE\r
+          BPL     NOPAUSE\r
+          INC     FRAME                  ;INC FRAME COUNTER\r
+YESHSC    LDA     SAVEB\r
+          RTI\r
+\r
+NOPAUSE   LDA     BOOTLDR                ;SEE IF SHOULD BOOT LDR\r
+          BEQ     NBOOTLDR\r
+          LDA     SAVEB\r
+          RTI\r
+\r
+NBOOTLDR\r
+          LDA     SAVEB\r
+          STA     SAVEA                  ;THIS IS FOR LOOPING INTERRUPTS\r
+          STX     SAVEX\r
+          STY     SAVEY\r
+          CLD                            ;CLEAR DECIMAL MODE\r
+          JSR     TUNER\r
+\r
+;THIS SECTION FIGURES OUT THE STAR INC SPEED\r
+          LDA     RACK\r
+          CMP     #10\r
+          BCC     SLOWSTAR\r
+          CMP     #18\r
+          BCS     FASTAR\r
+          LDA     #1                     ;SPEED IS 1 UNCONDITIONALLY\r
+          STA     STRSPEED\r
+          BNE     SETBOOT\r
+SLOWSTAR  LDA     STRSPEED               ;DEC STRSPEED UNTIL ZERO, THEN INC\r
+          BEQ     INCSPD\r
+          LDA     #0\r
+          STA     STRSPEED\r
+          BEQ     SETBOOT\r
+INCSPD    LDA     #1\r
+          STA     STRSPEED\r
+          BNE     SETBOOT\r
+FASTAR\r
+          LDA     STRSPEED\r
+          CMP     #2\r
+          BPL     DECFSPD                ;IF 2 OR GREATER, DEC STRSPEED\r
+          LDA     #2\r
+          STA     STRSPEED\r
+          BNE     SETBOOT\r
+DECFSPD   LDA     #1\r
+          STA     STRSPEED\r
+SETBOOT   INC     BOOTLDR                ;INC FLAG FOR LOADER\r
+          LDA     FRAME\r
+          BMI     DOHNDLER\r
+;THIS CODE UPDATES THE STAR POINTERS ONLY\r
+          JSR     MOVSTARS\r
+          JMP     UPSHIP                 ;JUST UPDATE SHIP IF INSUF. TIME\r
+\r
+MOVSTARS  LDA     THREECNT               ;SEE IF TIME FOR NEW STAR\r
+          CLC\r
+          ADC     STRSPEED\r
+          STA     THREECNT\r
+          CMP     #3\r
+          BCC     SSTAR1\r
+          SEC\r
+          SBC     #3\r
+          STA     THREECNT\r
+          DEC     STARPTR                ;GO TO NEXT STAR\r
+          BMI     SSTARRES\r
+          RTS\r
+SSTARRES  LDA     #$7F\r
+          STA     STARPTR\r
+SSTAR1    RTS\r
+\r
+DOHNDLER\r
+          LDA     #16                    ;SAVE SPACE FOR THE STARS\r
+          LDY     #15\r
+LSTSIZLP  STA     LISTSIZ,Y\r
+          DEY\r
+          BPL     LSTSIZLP\r
+\r
+          LDA     #0                     ;ZEROS OUT SECOND LIST\r
+          LDY     #8\r
+LIST2LP   STA     LISTSIZ2,Y\r
+          DEY\r
+          BPL     LIST2LP\r
+\r
+          LDA     INHSC\r
+          BEQ     STARLDR\r
+          JMP     LSTSZOUT               ;IF IN HSC, DONT DO STARS\r
+\r
+STARLDR   LDA     #16\r
+          STA     TEMP6                  ;GET SET FOR 16 ZONES\r
+          LDA     #0\r
+          STA     STARCNTR               ;INC INTO HSTAR\r
+          LDA     #4\r
+          STA     FOURCNT                ;FOUR STARS PER ZONE\r
+          LDY     #0\r
+          LDA     #L(S1L1)               ;SAME AS S2L1\r
+          STA     LISTPTR\r
+          BIT     DLSPTR\r
+          BPL     SUSES2\r
+          LDA     #H(S1L1)\r
+          BNE     SUSES3\r
+SUSES2    LDA     #H(S2L1)\r
+SUSES3    STA     LISTPTR+1\r
+          JSR     MOVSTARS\r
+STAR1     LDA     STARPTR\r
+          CLC\r
+          ADC     STARCNTR\r
+          BVC     STAR3\r
+STAR2     AND     #$7F                   ;BOOT THE SIGN BIT\r
+STAR3     TAX                            ;X NOW HAS OFFSET INTO HSTAR\r
+          LDA     #L(STARGRAF)\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     #$DF\r
+          STA     (LISTPTR),Y            ;PALLET 0, WIDTH 1\r
+          INY\r
+          LDA     #H(MARIA2)\r
+          CLC\r
+          ADC     THREECNT\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HSTAR,X\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          INC     STARCNTR\r
+          LDA     THREECNT\r
+          CLC\r
+          ADC     #3\r
+          STA     THREECNT\r
+          DEC     FOURCNT\r
+          BNE     STAR1\r
+          LDA     THREECNT\r
+          SEC\r
+          SBC     #12\r
+          STA     THREECNT\r
+          DEC     TEMP6                  ;SEE IF ALL ZONES DONE\r
+          BEQ     LSTSZOUT               ;GO TO NEXT ROUTINE\r
+          LDA     LISTPTR\r
+          CLC\r
+          ADC     #DLSIZE\r
+          STA     LISTPTR\r
+          LDA     LISTPTR+1\r
+          ADC     #0\r
+          STA     LISTPTR+1\r
+          LDY     #0\r
+          LDA     #4\r
+          STA     FOURCNT\r
+          JMP     STAR1\r
+LSTSZOUT\r
+          LDA     #71                     ;SET POINTER TO THE FIRST ENEMY DATA\r
+          STA     TEMP6\r
+          TAY\r
+LREADL                                   ;READ THE ENEMY DATA\r
+          LDA     TYPE,Y\r
+          AND     #$7F\r
+          BNE     DOREAD                 ;IF THE TYPE IS ZERO THE ENEMY IS\r
+XXX       DEC     TEMP6                  ;NOTHING\r
+          LDY     TEMP6\r
+          BPL     LREADL\r
+          JMP     DONENMY\r
+DOREAD    CMP     #6\r
+          BEQ     XXX\r
+          STA     LTYPE\r
+          LDA     XCORD,Y\r
+          STA     HEADER3                ;HORIZONTAL POSITION\r
+          LDA     YCORD,Y                ;VERTICAL POSITION\r
+          CMP     #192\r
+          BCS     XXX\r
+DLFKJ     STA     LY\r
+          LDA     ANGLE,Y                ;ANGLE\r
+          CPY     #65\r
+          BPL     DLFKK\r
+          AND     #$07\r
+          STA     LA                     ;DON'T ROUND OFF ANGLE IF Y>64\r
+                                         ; OR FLAP\r
+          LDA     FLAP                   ; FIND THE LOW BYTE FOR THE STAMP\r
+          LSR     A\r
+          BCC     NOFLAP                 ;FLAP ONLY IF THE ANGLE IS ZERO\r
+          LDA     LA\r
+          BNE     NOFLAP\r
+          LDA     #8\r
+DLFKK     STA     LA\r
+NOFLAP    LDX     LTYPE\r
+          LDA     PALWDT,X               ;PALLET AND WIDTH\r
+          STA     HEADER1\r
+          LDA     TYPTOLT,X\r
+          CLC\r
+          ADC     LA\r
+          TAX\r
+          LDA     LSTPTBL,X\r
+          STA     HEADER0                ;LOW BYTE OF STAMP ADDRESS\r
+SZLP      LDA     LY\r
+          LSR     A\r
+          LSR     A\r
+          TAX\r
+          LDA     DIV3,X\r
+          TAX                            ;X NOW HAS CURRENT ZONE\r
+          LDY     LISTSIZ,X\r
+          CPY     #77                    ;NEED ROOM FOR ONE MORE HDR\r
+          BCC     CONT\r
+          LDY     LISTSIZ2,X             ;USE SECOND LIST\r
+CONT      LDA     TEMP6\r
+          CMP     #65\r
+          BCC     CONT1\r
+          LDA     LY\r
+          SEC\r
+          SBC     ZOFF,X\r
+          CLC\r
+          ADC     #$C0                   ;NEXT GRAPHICS AT $C000\r
+          JMP     CONT2\r
+CONT1     LDA     LY\r
+          SEC\r
+          SBC     ZOFF,X\r
+          CLC\r
+          ADC     #H(MARIA2)\r
+CONT2     STA     HEADER2\r
+          LDA     LISTTABL,X             ;GET POINTER TO THE ZONES LIST\r
+          STA     LISTPTR\r
+          LDA     LISTTBH1,X\r
+          BIT     DLSPTR\r
+          BMI     LUST1\r
+          LDA     LISTTBH2,X\r
+LUST1     STA     LISTPTR+1\r
+          LDA     HEADER0                ;STORE THE HEADER\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     LISTSIZ,X             ;SEE IF USING LIST 2\r
+          CMP     #77\r
+          BCC     LUST4\r
+          TYA\r
+          STA     LISTSIZ2,X             ;STORE NEW LIST SIZE\r
+          BNE     CROSSB1\r
+LUST4     TYA\r
+          STA     LISTSIZ,X              ;INCREMENT THE OFFSET\r
+CROSSB1   LDA     TEMP6                  ;SEE IF WORD\r
+          CMP     #65\r
+          BCS     XXXX\r
+          LDA     HEADER2                ;SEE IF GOES TO NEXT ZONE\r
+          CMP     #$A3                   ;GRAPHICS ORG'D AT $A000\r
+          BCC     XXXX\r
+          CPX     #$F\r
+          BEQ     XXXX\r
+          SEC\r
+          SBC     #$C\r
+          STA     HEADER2\r
+          INX\r
+          LDY     LISTSIZ,X\r
+          CPY     #77\r
+          BCC     LUST3\r
+          LDY     LISTSIZ2,X\r
+LUST3     LDA     LISTTABL,X             ;GET POINTER TO THE ZONES LIST\r
+          STA     LISTPTR\r
+          LDA     LISTTBH1,X\r
+          BIT     DLSPTR\r
+          BMI     LUST2\r
+          LDA     LISTTBH2,X\r
+LUST2     STA     LISTPTR+1\r
+          LDA     HEADER0                ;STORE THE HEADER\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     LISTSIZ,X\r
+          CMP     #77\r
+          BCC     LUST5\r
+          TYA\r
+          STA     LISTSIZ2,X\r
+          BNE     XXXX\r
+LUST5     TYA\r
+          STA     LISTSIZ,X              ;INCREMENT THE OFFSET\r
+XXXX      JMP     XXX\r
+DONENMY   LDX     #$FF\r
+          LDA     INHSC                  ;SEE IF IN HSC\r
+          BNE     ZHSCLEND\r
+          LDA     RLOGO\r
+          BNE     LPFZ0\r
+ZHSCLEND  JMP     LEND\r
+LPFZ0     LDY     LISTTABL+0\r
+          STY     LISTPTR\r
+          LDY     LISTTBH1+0\r
+          BIT     DLSPTR\r
+          BMI     LZL10\r
+          LDY     LISTTBH2+0\r
+LZL10     STY     LISTPTR+1\r
+SLOADER   INX\r
+          CPX     #16\r
+          BEQ     PUTRACK\r
+          LDA     SCORE,X\r
+          CMP     #$A\r
+          BEQ     SLOADER\r
+          ASL     A\r
+          CLC\r
+          ADC     #L(DIGIT)\r
+          STA     HEADER0\r
+          LDA     #$9E                   ;NUMBERS ON FIRST GRAPHICS PAGE\r
+          ADC     #0\r
+          STA     HEADER2\r
+          LDA     #$7E                   ;PALETTE AND WIDTH\r
+          STA     HEADER1\r
+          LDA     GETXSC,X\r
+          STA     HEADER3\r
+          LDY     LISTSIZ+0\r
+          CPY     #77\r
+          BCC     OVER1\r
+          LDY     LISTSIZ2+0\r
+OVER1\r
+          LDA     HEADER0\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          TYA\r
+          LDY     LISTSIZ+0\r
+          CPY     #77\r
+          BCC     OVER2\r
+          STA     LISTSIZ2+0\r
+          BCS     OVER3\r
+OVER2     STA     LISTSIZ+0\r
+OVER3     JMP     SLOADER\r
+*PUT UP RACK NUMBER HERE\r
+PUTRACK   LDY     LISTTABL+15\r
+          STY     LISTPTR\r
+          LDY     LISTTBH1+15\r
+          BIT     DLSPTR\r
+          BMI     LZL11\r
+          LDY     LISTTBH2+15\r
+LZL11     STY     LISTPTR+1\r
+          LDA     GASTONHK               ;BCD RACK NUMBER\r
+          AND     #$0F                   ;BOOT HIGH NIBBLE\r
+          STA     TEMP8+1                ;ONES DIGIT\r
+          LDA     GASTONHK\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          STA     TEMP8                  ;TENS DIGIT\r
+OUTRLOP\r
+;         LDA     TEMP8\r
+          BEQ     OUTRAL\r
+          ASL     A\r
+          CLC\r
+          ADC     #L(DIGIT)\r
+          STA     HEADER0\r
+          LDA     #$9E                   ;1ST GRAPHICS PAGE\r
+          ADC     #0\r
+          STA     HEADER2\r
+          LDA     #$7E\r
+          STA     HEADER1\r
+          LDA     #142\r
+          STA     HEADER3\r
+          LDY     LISTSIZ+15\r
+          LDA     HEADER0\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          STY     LISTSIZ+15\r
+OUTRAL    LDA     TEMP8+1\r
+          ASL     A\r
+          CLC\r
+          ADC     #L(DIGIT)\r
+          STA     HEADER0\r
+          LDA     #$9E                   ;FIRST GRAPHICS PAGE\r
+          ADC     #0\r
+          STA     HEADER2\r
+          LDA     #$7E\r
+          STA     HEADER1\r
+          LDA     #150\r
+          STA     HEADER3\r
+          LDY     LISTSIZ+15\r
+          LDA     HEADER0\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          STY     LISTSIZ+15\r
+INDLOAD\r
+          LDX     PLAYER\r
+          LDA     LIVES,X\r
+          TAX\r
+          DEX\r
+          BEQ     BEAMLOAD\r
+PUTIND    LDA     #H(MARIA2)\r
+          STA     HEADER2\r
+          LDA     #L(HEROS)\r
+          STA     HEADER0\r
+          LDA     #$1E\r
+          STA     HEADER1\r
+          LDA     INDX,X\r
+          STA     HEADER3\r
+          LDY     LISTSIZ+15\r
+          CPY     #77                    SEE IF HAVE EXCEEDED DISPLAY LIST SIZE\r
+          BCC     LSTLINOK\r
+          LDY     LISTSIZ2+8             USE SECOND LIST OF SIZES\r
+LSTLINOK  LDA     HEADER0\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     LISTSIZ+15             SEE IF LIST HAS BEEN EXCEEDED\r
+          CMP     #77\r
+          BCC     LASTLNOK\r
+          STY     LISTSIZ2+8\r
+          BNE     LASTLNOQ\r
+LASTLNOK  STY     LISTSIZ+15\r
+LASTLNOQ  DEX\r
+          BNE     PUTIND\r
+BEAMLOAD  LDA     WAITCNT                ;GRAB WAITCNT\r
+          BEQ     BEAM4                  ;IF ZERO, GO TO NEXT ROUTINE\r
+          CMP     #120\r
+          BCS     BEAM1\r
+          LDA     WAITCNT\r
+          STA     WAITCNT3               ;THIS IS THE ZONE OFFSET\r
+          JMP     BEAM2\r
+BEAM1     LDA     #181\r
+          SEC\r
+          SBC     WAITCNT\r
+          STA     WAITCNT3\r
+BEAM2     LDA     #0                     ;FIRST DISPLAY ALL FULL ZONES\r
+          STA     ZOFFSET                ;CLEAR ZOFFSET\r
+          LDX     #11                    ;SET INDEX TO ZONE 12\r
+BEAM3     LDA     WAITCNT3\r
+          SEC\r
+          SBC     #12\r
+          BCC     NEWZONE\r
+          STA     WAITCNT3\r
+          LDA     ZOFFSET\r
+          CLC\r
+          ADC     #12\r
+          STA     ZOFFSET                ;ADVANCE OFFSET TO NEXT ZONE\r
+          LDA     #12\r
+          STA     WAITCNT2\r
+          JSR     DISPLAYZ\r
+          INX\r
+          CPX     #15\r
+          BEQ     BEAM4                  ;ALL ZONES DISPLAYED\r
+          JMP     BEAM3\r
+NEWZONE   LDA     WAITCNT3               ;SEE IF NEW ZONE NEEDED\r
+          BEQ     BEAM4\r
+          CLC\r
+          ADC     ZOFFSET\r
+          STA     ZOFFSET                ;SET ZOFFSET FOR LAST DISPLAY\r
+          LDA     WAITCNT3               ;GET OFFSET INTO LAST ZONE\r
+          STA     WAITCNT2\r
+          JSR     DISPLAYZ               ;NOW DISPLAY NEW ZONE\r
+BEAM4     JMP     LEND\r
+DISPLAYZ  LDA     LISTTABL,X\r
+          STA     LISTPTR\r
+          LDA     LISTTBH1,X             ;GET HIGH @ BYTE\r
+          BIT     DLSPTR                 ;FIND CURRENT DISPLAY LIST\r
+          BMI     OTHERLST\r
+          LDA     LISTTBH2,X             ;GET OTHER HIGH @ BYTE\r
+OTHERLST  STA     LISTPTR+1              ;NOW LISTPTR POINTS TO THE DISPLAY\r
+                                         ;LIST OF THE CURRENT ZONE\r
+          LDA     #L(LSHIELD)            ;LOW @ FOR LEFT SHIELD\r
+          STA     HEADER0\r
+          LDY     ZOFFSET                ;GET TABLE OFFSET\r
+          LDA     BMWIDTH,Y              ;GET CURRENT BEAM WIDTH\r
+          ORA     #$80                   ;USE PALETTE 4\r
+          STA     HEADER1\r
+          LDA     #H(MARIA2)\r
+          SEC\r
+          SBC     #12\r
+          CLC\r
+          ADC     WAITCNT2\r
+          STA     HEADER2\r
+          STA     HEADER6                ;HIGH @ FOR RIGHT SHIELD\r
+          LDA     CAPTUREX\r
+          SEC\r
+          SBC     XCORDOFF,Y\r
+          STA     HEADER3\r
+          LDA     #L(RSHIELD)\r
+          STA     HEADER4\r
+          LDA     #$9F                    ;PALETTE AND WIDTH\r
+          STA     HEADER5\r
+          LDA     CAPTUREX\r
+          CLC\r
+          ADC     XCORDOFF,Y\r
+          CLC                            ;IN CASE OF NEGATIVE NO.\r
+          ADC     #4\r
+          STA     HEADER7\r
+;ALL HEADERS LOADED, NOW STORE IN DISPLAY LIST\r
+          LDY     LISTSIZ,X\r
+          LDA     HEADER0\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER1\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER2\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER3\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER4\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER5\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER6\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          LDA     HEADER7\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          TYA\r
+          STA     LISTSIZ,X              ;RESET LIST SIZE FOR CURRENT ZONE\r
+          RTS\r
+LEND      LDA     #0                     ; PUT TWO ZEROS AT THE ENDS OF THE\r
+          LDX     #15                    ; LISTS\r
+LPFZ      LDY     LISTTABL,X\r
+          STY     LISTPTR\r
+          LDY     LISTTBH1,X\r
+          BIT     DLSPTR\r
+          BMI     LZL1\r
+          LDY     LISTTBH2,X\r
+LZL1      STY     LISTPTR+1\r
+          LDY     LISTSIZ,X\r
+          STA     (LISTPTR),Y\r
+          INY\r
+          STA     (LISTPTR),Y\r
+          DEX\r
+          BPL     LPFZ\r
+;SET DLL TO  POINT TO NEW DISPLAY LIST LIST\r
+          LDA     INHSC                  ;SEE IF IN HSC\r
+          BNE     CONTB                  ;IF SO, BOOT THIS PART\r
+          LDA     #H(DLSTLST1)\r
+          BIT     DLSPTR\r
+          BMI     DLST1\r
+          LDA     #H(DLSTLST2)\r
+DLST1     STA     DPPH\r
+          LDA     #L(DLSTLST1)\r
+          BIT     DLSPTR\r
+          BMI     DLST11\r
+          LDA     #L(DLSTLST2)\r
+DLST11    STA     DPPL\r
+          LDA     DLSPTR\r
+          EOR     #$FF\r
+          STA     DLSPTR                 ;NEXT TIME, WILL USE OTHER DLL\r
+;VESTIGAL KERNEL REMAINS\r
+UPSHIP    LDY     #63\r
+          LDA     TYPE,Y\r
+          BEQ     UNTOUCH1\r
+          LDA     AUTOPLAY               ;NON ZERO IF IN AUTO\r
+          BEQ     NLOOKTAB\r
+          JMP     ALOOKTAB\r
+NLOOKTAB  LDA     MODE+40                ;SEE IF IN REUNITE MODE\r
+          CMP     #9\r
+          BEQ     UNTOUCH1\r
+          LDA     PLAYER                 ;SEE WHICH PLAYER IS UP\r
+          BEQ     NLOOKTB1\r
+          LDA     SWCHA\r
+          ROR     A\r
+          ROR     A\r
+          ROR     A                      ;W BIT IN CARRY\r
+          BCC     GOWEST\r
+          ROR     A\r
+          BCC     GOEAST                 ;E BIT IN CARRY\r
+          BCS     UNTOUCH1\r
+NLOOKTB1  BIT     SWCHA\r
+          BPL     GOEAST\r
+          BVC     GOWEST\r
+UNTOUCH1\r
+          INC     STARINC\r
+          LDA     STARINC\r
+          LSR     A\r
+          BCC     NODEC\r
+NODEC     DEC     ANIMATE\r
+          BNE     CONTA\r
+          LDA     #20\r
+          STA     ANIMATE\r
+          INC     FLAP\r
+CONTA     LDA     MISTIMER\r
+          BEQ     CONTB\r
+          DEC     MISTIMER\r
+CONTB\r
+          INC     FRAME\r
+          DEC     BOOTLDR                ;RESET LOADER FLAG\r
+          LDA     SAVEA\r
+          LDX     SAVEX\r
+          LDY     SAVEY\r
+SPURIOUS  RTI\r
+\r
+GOWEST    LDA     HEROX\r
+          BEQ     UNTOUCH1\r
+          DEC     HEROX\r
+          DEC     XCORD+62               ;BLINDLY MOVE THIS GUY\r
+          JMP     UNTOUCH1\r
+GOEAST    LDA     MODE+63                ;GET HERO SHIP MODE\r
+          CMP     #10                    ;SEE IF DUAL HERO MODE\r
+          BNE     GOEAST1\r
+          LDA     HEROX\r
+          CMP     #145\r
+          BEQ     UNTOUCH1\r
+          INC     HEROX\r
+          INC     XCORD+62               ;BLINDLY MOVE THIS GUY\r
+          BNE     UNTOUCH1\r
+GOEAST1   LDA     HEROX\r
+          CMP     #152\r
+          BEQ     UNTOUCH1\r
+          INC     HEROX\r
+          BNE     UNTOUCH1\r
+ALOOKTAB  LDY     TABPNT                 ;HANDLES AUTO GAME\r
+          LDA     AUTAB,Y                ;PICK X COORDINATE TO SHOOT FOR\r
+          CMP     HEROX\r
+          BEQ     TINCPNT                ;INCREMENT POINTER IF IT IS REACHED\r
+          BCS     GOEAST\r
+          BCC     GOWEST\r
+TINCPNT   INC     TABPNT\r
+          LDA     TABPNT\r
+          CMP     #16\r
+          BEQ     TINCPP\r
+          JMP     UNTOUCH1\r
+TINCPP    LDA     #0\r
+          STA     TABPNT\r
+          JMP     UNTOUCH1\r
+ATABL\r
+PTABL     DB      $0C,$48,$0E,$00        ; 0: HERO SHIP         (41,61,71)\r
+          DB      $1F,$94,$45,$00        ; 1: RED BUG\r
+          DB      $2C,$0F,$28,$00        ; 2: EXPLOSIONS, SMALL NUMBERS\r
+          DB      $09,$1F,$1D,$00        ; 3: MISSILES, WORDS, SCORES, RACK\r
+          DB      $9B,$E0,$1F,$00        ; 4: BLUE BOSS\r
+          DB      $D6,$40,$1C,$00        ; 5: REGULAR BOSS\r
+          DB      $E9,$E4,$87,$00        ; 6: LOGO\r
+          DB      $1F,$95,$40,$00        ; 7: BLUE BUG\r
+\r
+XCORDOFF  DB      0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3\r
+          DB      4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6\r
+          DB      7,7,7,7,7,7,8,8,8\r
+\r
+BMWIDTH   DB      $1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E\r
+          DB      $1E,$1E,$1E,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D\r
+          DB      $1D,$1C,$1C,$1C,$1C,$1C,$1C,$1C,$1C,$1C,$1C,$1C,$1C,$1B\r
+          DB      $1B,$1B,$1B,$1B,$1B,$1B,$1B,$1B\r
+\r
+INDX      DB      0,0,10,20,30,40,50,60,70,80,90,100,110,120\r
+\r
+DIV3      DB      0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7\r
+          DB      8,8,8,9,9,9,10,10,10,11,11,11,12,12,12,13,13,13\r
+          DB      14,14,14,15,15,15,16,16,16,17,17,17,18,18,18,19,19,19\r
+          DB      20,20,20,21,21,21,22,22,22\r
+ZOFF      DB      0,12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192\r
+          DB      $F4,$F4,$F4,$F4,$F4,$F4\r
+\r
+LISTTABL  DB      L(S1L1),L(S1L2),L(S1L3),L(S1L4),L(S1L5),L(S1L6)\r
+          DB      L(S1L7),L(S1L8),L(S1L9),L(S1L10),L(S1L11),L(S1L12)\r
+          DB      L(S1L13),L(S1L14),L(S1L15),L(S1L16)\r
+LISTTBH1  DB      H(S1L1),H(S1L2),H(S1L3),H(S1L4),H(S1L5),H(S1L6)\r
+          DB      H(S1L7),H(S1L8),H(S1L9),H(S1L10),H(S1L11),H(S1L12)\r
+          DB      H(S1L13),H(S1L14),H(S1L15),H(S1L16)\r
+LISTTBH2  DB      H(S2L1),H(S2L2),H(S2L3),H(S2L4),H(S2L5),H(S2L6)\r
+          DB      H(S2L7),H(S2L8),H(S2L9),H(S2L10),H(S2L11),H(S2L12)\r
+          DB      H(S2L13),H(S2L14),H(S2L15),H(S2L16)\r
+;GIVES PALETTE AND WIDTH INDEXED BY TYPE\r
+PALWDT    DB      0                      ;PALLET FOR NOTHING\r
+          DB      $FE                    ;PALLET FOR BLUE BUG\r
+          DB      $3E                    ;PALLET FOR RED BUG\r
+          DB      $BE                    ;PALLET FOR REG BOS-GALAGA\r
+          DB      $9E                    ;PALLET FOR BLUE BOS-GALAGA\r
+          DB      $1E                    ;PALLET FOR HERO SHIP\r
+          DB      0                      ;INVISO SHIP (NOT USED)\r
+          DB      $7E                    ;PALLET FOR MISSLES\r
+          DB      $5D                    ;PALLET FOR EXPLOSIONS\r
+          DB      $5C                    ;PALLET FOR SMALL NUMBERS\r
+          DB      $5C                    ;PALLET FOR SMALL NUMBERS\r
+          DB      $5C                    ;PALLET FOR SMALL NUMBERS\r
+          DB      $5C                    ;PALLET FOR SMALL NUMBERS\r
+          DB      $7E                    ;SCORPION,PAL=?,T=13\r
+          DB      0,0\r
+          DB      $BE                    ;PALLET FOR REG-BOSS GALAGA\r
+          DB      $9E                    ;PALLET FOR BLUE-BOSS GALAGA\r
+          DB      $D3                    ;LOGO SECTIONS, W=13,T=18\r
+          DB      $D3                    ;T=19\r
+          DB      $D3                    ;T=20\r
+          DB      $D3                    ;T=21\r
+          DB      $D7                    ;T=22\r
+          DB      $D7                    ;T=23\r
+          DB      $7E                    ;T=24, LINE, NOT USED\r
+          DB      $77                    ;THIS IS PLAYER\r
+          DB      $78                    ;WIDTH 8 FOR READY....\r
+          DB      $7C                    ;DOUBLE MISSILE  TYPE=27\r
+          DB      $73                    ;GAME OVER, WIDTH = 13\r
+          DB      $70                    ;CHALLENGING, WIDTH = 16\r
+          DB      $79                    ;STAGE, WIDTH = 7\r
+          DB      $7E                    ;"1", WIDTH = 2\r
+          DB      $7E                    ;"2", WIDTH = 2\r
+          DB      $76                    ;"FIGHTER" WIDTH = 10\r
+          DB      $74                    ;"CAPTURED" WIDTH = 12\r
+          DB      $9C                    ;TWINKLE, PAL 4, WIDTH = 4\r
+          DB      $6C                    ;NUMOFHTS, PAL3, W=20, TYPE=36\r
+          DB      $76                    ;PERFECT, W=10, PAL3, TYPE=37\r
+          DB      $6D                    ;SPECIAL BONUS, W=19, TYPE=38\r
+          DB      $78                    ;BONUS, W=8, TYPE=39\r
+          DB      $7E                    ;DIGIT, W=2, TYPE=40\r
+          DB      $7A                    ;TEN K, W=6, TYPE=41\r
+          DB      $7D                    ;DOUBLE ZERO, W=3, TYPE=42\r
+          DB      $74                    ;ADVANCED,W=12,T=43\r
+          DB      $77                    ;EXPERT,W=9,T=44\r
+          DB      $77                    ;NOVICE,W=9,T=45\r
+          DB      $78                    ;LEVEL,W=8,T=46\r
+          DB      $75                    ;PLAYERS,W=11?,T=47\r
+          DB      $7E                    ;SONE,W=2,T=48\r
+          DB      $7E                    ;TTWO,W=2,T=49\r
+          DB      $FE                    ;NEWBIRD,W=2,T=50\r
+          DB      $7E                    ;%,W=2,T=51\r
+          DB      $5D                    ;HERO EXPLOSION, W=3,T=52\r
+\r
+;THIS TABLE IS INDEXED BY THE TYPE OF THE GIVEN CHARACTER\r
+; IT GIVES AN INDEX INTO THE LSTPTBL\r
+TYPTOLT   DB      0                      ;CALL NO SHIP GRAPHICS (NOT USED)\r
+          DB      0                      ;CALL BLUE BUG GRAPHICS\r
+          DB      9                      ;CALL RED BUG GRAPHICS\r
+          DB      18                     ;CALL BOSS BUG GRAPHICS\r
+          DB      18                     ;CALL BOSS BUG GRAPHICS\r
+          DB      27                     ;CALL HERO GRAPHICS\r
+          DB      0                      ;CALL INVISO SHIP GRAPHICS (NOT USED)\r
+          DB      45                     ;CALL MISSLE GRAPHICS\r
+          DB      36                     ;CALL EXPLOSION GRAPHICS\r
+          DB      53                     ;CALL SMALL NUMBER GRAPHICS\r
+          DB      54                     ;CALL SMALL NUMBER GRAPHICS\r
+          DB      55                     ;CALL SMALL NUMBER GRAPHICS\r
+          DB      56                     ;CALL SMALL NUMBER GRAPHICS\r
+          DB      126                    ;SCORPION,T=13\r
+          DB      0,0\r
+          DB      18                     ;CALL BOSS BUG GRAPHICS\r
+          DB      18                     ;CALL BOSS BUG GRAPHICS\r
+          DB      69,70,71,72,73,74,75\r
+          DB      76                     ;THIS IS FOR PLAYER ANGLE IS 1\r
+          DB      77                     ;FOR READY\r
+          DB      45                     ;CALL MISSILE GRAPHICS\r
+          DB      78                     ;GAME OVER\r
+          DB      79                     ;CHALLENGING\r
+          DB      80                     ;STAGE\r
+          DB      81                     ;"1"\r
+          DB      82                     ;"2"\r
+          DB      83                     ;FIGHTER\r
+          DB      84                     ;CAPTURED\r
+          DB      86                     ;TWINKLE    TYPE=35\r
+          DB      93                     ;NUMOFHTS, T=36\r
+          DB      94                     ;PERFECT, T=37\r
+          DB      95                     ;SPECIAL BONUS, T=38\r
+          DB      96                     ;BONUS, T=39\r
+          DB      98                     ;DIGIT, T=40\r
+          DB      107                    ;TENK, T=41\r
+          DB      108                    ;DBLZERO, T=42\r
+          DB      109                    ;ADVANCED,T=43\r
+          DB      110                    ;EXPERT,T=44\r
+          DB      111                    ;NOVICE,T=45\r
+          DB      112                    ;LEVEL,T=46\r
+          DB      76                     ;PLAYERS,T=47\r
+          DB      113                    ;'1',T=48\r
+          DB      114                    ;'2',T=49\r
+          DB      116                    ;NEWBIRD,T=50\r
+          DB      124                    ;%,T=51\r
+          DB      135                    ;HERO EXPLOSION, T=52\r
+\r
+LSTPTBL   DB      L(BLUBUG),L(BLUBUG1),L(BLUBUG2),L(BLUBUG3)\r
+          DB      L(BLUBUG4),L(BLUBUG5),L(BLUBUG6),L(BLUBUG7),L(BLUBUGF)\r
+          DB      L(REDBUG),L(REDBUG1),L(REDBUG2),L(REDBUG3)\r
+          DB      L(REDBUG4),L(REDBUG5),L(REDBUG6),L(REDBUG7),L(REDBUGF)\r
+          DB      L(BOSGAL),L(BOSGAL1),L(BOSGAL2),L(BOSGAL3)             ;21\r
+          DB      L(BOSGAL4),L(BOSGAL5),L(BOSGAL6),L(BOSGAL7),L(BOSGALF)\r
+          DB      L(HEROS),L(HERO1),L(HERO2),L(HERO3)\r
+          DB      L(HERO4),L(HERO5),L(HERO6),L(HERO7),L(HEROS)           ;35\r
+          DB      L(EXPLO0),L(EXPLO1),L(EXPLO2),L(EXPLO3)\r
+          DB      L(EXPLO4),L(EXPLO5),L(EXPLO6),L(EXPLO7),L(EXPLO0)   ;44\r
+          DB      L(MISSLE),L(MISSLE),L(MISSLE),L(MISSLE)\r
+          DB      L(MISSLE4),L(MISSLE),L(MISSLE),L(MISSLE),L(MISSLE)       ;53\r
+          DB      L(SIXTYPE),L(THOTYPE),L(EIGTYPE),L(FOUTYPE)  ;NEW\r
+          DB      L(FOUTYPE),L(FOUTYPE),L(FOUTYPE),L(FOUTYPE),L(FOUTYPE)\r
+          DB      L(FOUTYPE),L(FOUTYPE),L(FOUTYPE),L(FOUTYPE)  ;NEW\r
+          DB      L(FOUTYPE),L(FOUTYPE),L(FOUTYPE)             ;NEW\r
+          DB      L(LULOGO),L(LILOGO),L(RULOGO),L(RILOGO)\r
+          DB      L(BULOGO),L(BILOGO)\r
+          DB      L(LINE)\r
+          DB      L(PLAYERG)             ;77\r
+          DB      L(READY)               ;78\r
+          DB      L(GMEOVER)             ;79\r
+          DB      L(CHLNGING)            ;80\r
+          DB      L(STAGE)               ;81\r
+          DB      L(PONE)                ;82\r
+          DB      L(PTWO)                ;83\r
+          DB      L(FIGHTER)             ;84\r
+          DB      L(CAPTD)               ;85\r
+          DB      L(TWINKLE)             ;86\r
+          DB      L(TWINKL1)             ;87\r
+          DB      L(TWINKL2)             ;88\r
+          DB      L(TWINKL3)             ;89\r
+          DB      L(TWINKL4)             ;90\r
+          DB      L(TWINKL5)             ;91\r
+          DB      L(TWINKL6)             ;92\r
+          DB      L(TWINKL7)             ;93\r
+          DB      L(NUMOFHTS)            ;94TH ENTRY, ANGLE =1\r
+          DB      L(PERFECT)             ;95\r
+          DB      L(SPECIALG)            ;96\r
+          DB      L(BONUS)               ;97\r
+          DB      L(DIGIT0)              ;98\r
+          DB      L(DIGIT1)              ;99\r
+          DB      L(DIGIT2)\r
+          DB      L(DIGIT3)\r
+          DB      L(DIGIT4)\r
+          DB      L(DIGIT5)\r
+          DB      L(DIGIT6)\r
+          DB      L(DIGIT7)\r
+          DB      L(DIGIT8)\r
+          DB      L(DIGIT9)              ;107\r
+          DB      L(TENK)                ;108\r
+          DB      L(DBLZERO)             ;109\r
+          DB      L(ADVANCED)            ;110\r
+          DB      L(EXPERT)              ;111\r
+          DB      L(NOVICE)              ;112\r
+          DB      L(LEVEL)               ;113\r
+          DB      L(SONE)                ;114TH ENTRY\r
+          DB      L(STWO)                ;115\r
+          DB      L(NEWBIRD0),L(NEWBIRD1),L(NEWBIRD2),L(NEWBIRD3)\r
+          DB      L(NEWBIRD4),L(NEWBIRD5),L(NEWBIRD6),L(NEWBIRD7)\r
+          DB      L(NEWBIRD0)            ;124\r
+          DB      L(PERCENT)             ;125\r
+          DB      L(SCORP0),L(SCORP1),L(SCORP2),L(SCORP3),L(SCORP4)\r
+          DB      L(SCORP5),L(SCORP6),L(SCORP7),L(SCORPF)   ;134\r
+          DB      L(HEXPLO0),L(HEXPLO1),L(HEXPLO2),L(HEXPLO3)\r
+          DB      L(HEXPLO4),L(HEXPLO5),L(HEXPLO6),L(HEXPLO7),L(HEXPLO0) ;143\r
+\r
+AUTAB     DB      $58,$19,$46,$30,$50,$5A,$40,$20,$50,$45\r
+          DB      $72,$1E,$31,$4C,$80,$30,$38\r
+\r
+GETXSC    DB      0,8,16,24,32,40,48,56,94,102,110,118,126,134,142,150\r
+\r
+***************************\r
+***** High Score Code *****\r
+***************************\r
+; THIS FILE CONTAINS THE HANDLERS FOR THE INTERFACE TO THE HISCORE\r
+;         MODULE.  "MKHISCOR" AND "MKENTER" INITIATE MODES;\r
+;         "HISCORE" AND "ENTER" JUST LOOP IN WAIT.\r
+; THIS CODE IS REACHED THROUGH A JSR\r
+\r
+HSCATRCT  EQU     $3FFA\r
+HSCINITL  EQU     $3FFD\r
+HSCRAM    EQU     $2200\r
+HSCSTAT   EQU     $3FF7\r
+\r
+HSCTEST   JSR     BUILDHSC\r
+          LDA     #0\r
+          STA     HSCRAM+14              SET WAITING TIME TO ZERO\r
+          JMP     HSCSTAT                SEE IF DISPLAY FOR THIS LEVEL\r
+\r
+HSCDSPLY  JSR     BUILDHSC\r
+          JMP     HSCATRCT               RETURN FROM THERE\r
+\r
+HSCENTER\r
+          JSR     BUILDHSC\r
+          LDA     PLAYER\r
+          BNE     HSC2PLR                IF SECOND PLAYER, LEAVE ALONE\r
+          LDA     TWOPLAYR               SEE IF TWO PLAYER GAME\r
+          BEQ     HSC2PLR                IF ONE PLAYER ONLY, LEAVE IT ALONE\r
+          LDA     #0\r
+          STA     HSCRAM+14              SET WAIT TIME TO 0 SECONDS\r
+HSC2PLR   JMP     HSCINITL               RETURN FROM THERE\r
+\r
+BUILDHSC\r
+          LDA     $3900\r
+          CMP     #$C6\r
+          BNE     HSCMISSS\r
+          LDA     $3904\r
+          CMP     #$FE\r
+HSCMISSS  BNE     HSCMISS\r
+\r
+;         LDX     #31\r
+;DLSTLD    LDA     HSCDLST1,X             ;MOVE LOGO DISPLAY LIST DOWN INTO RAM\r
+ ;        STA     S1L1,X\r
+  ;       DEX\r
+   ;      BPL     DLSTLD\r
+\r
+          LDX     #14                    COPY 15 BYTES FROM HSCROM TO HSCRAM\r
+HSCLOAD   LDA     HSCROM,X\r
+          STA     HSCRAM,X\r
+          DEX\r
+          BPL     HSCLOAD\r
+\r
+          LDA     DIFCULTY               ; DIFFICULTY LEVEL FOR THIS CALL\r
+          TAX\r
+          ASL     A                      ;  --CALLED 3 TIMES FROM "LOGO"\r
+          ASL     A                      ; ONCE FOR EACH DIFFICULTY LEVEL\r
+          ORA     PLAYER                 WHO'S ENTERING HIS INITIALS\r
+          STA     HSCRAM+2\r
+\r
+          LDA     DNTABL,X\r
+          STA     HSCRAM+6\r
+          LDA     DNTABH,X\r
+          STA     HSCRAM+7\r
+\r
+          LDA     PLAYER\r
+          BEQ     CONTINUE\r
+;         MOVEPTR SCORE2,HSCRAM+8        OTHER PLAYER\r
+          LDA     SCORE+8                HIGHEST BYTE OF P2 SCORE\r
+          CMP     #$A\r
+          BNE     NIBOK1\r
+          LDA     #0\r
+          BEQ     NXTNIB\r
+NIBOK1    ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+NXTNIB    ORA     SCORE+9                PUT IN BCD FORM\r
+          CMP     #$A\r
+          BNE     NIBOK2\r
+          LDA     #0\r
+NIBOK2    STA     HSCORE\r
+          LDX     #2\r
+LDSCORE   LDA     P2SCORE,X\r
+          STA     HSCORE+1,X\r
+          DEX\r
+          BPL     LDSCORE\r
+          BMI     SETXANDY\r
+CONTINUE\r
+          LDA     SCORE\r
+          CMP     #$A                    ;SEE IF BLANK\r
+          BNE     NIBOK3\r
+          LDA     #0\r
+          BEQ     NXTNIBL\r
+NIBOK3    ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+NXTNIBL   ORA     SCORE+1                ;PUT SCORE IN BCD FORM\r
+          CMP     #$A\r
+          BNE     NIBOKK\r
+          LDA     #0\r
+NIBOKK    STA     HSCORE\r
+          LDX     #2\r
+LDSCORE2  LDA     P1SCORE,X\r
+          STA     HSCORE+1,X\r
+          DEX\r
+          BPL     LDSCORE2\r
+;         COPY    HSCDLIST,ARAMZONE,40\r
+SETXANDY  LDX     #L(HSCRAM)\r
+          LDY     #H(HSCRAM)\r
+NOSOUND   RTS\r
+\r
+HSCMISS   PLA\r
+          PLA\r
+          RTS\r
+\r
+\r
+HSCDLL    DB      $C9,H(DUMYHDR),L(DUMYHDR)\r
+          DB      $43,H(ZEROHDR),L(ZEROHDR)\r
+          DB      $4B,H(S1L6),L(S1L6)\r
+*THIS STUFF IS OFF THE SCREEN ON MOST TV'S\r
+          DB      $4B,H(S1L7),L(S1L7)\r
+          DB      $4B,H(S1L8),L(S1L8)\r
+          DB      $4B,H(S1L9),L(S1L9)\r
+          DB      $4B,H(S1L10),L(S1L10)\r
+\r
+DNAME0    DB      $1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D    ; overlapped\r
+          DB      $1D,13,14,21,8,2,4,$1D      ; "NOVICE"\r
+          DB      $1D,$1D,$1D\r
+DNAME1    DB      $1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D    ; overlapped\r
+          DB      $0,$3,$15,$0,$D,$2,$4,$3        ; "ADVANCED"\r
+DNAME2    DB      $1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D ; overlapped\r
+          DB      $4,$17,$F,$4,$11,$13           ; "EXPERT"\r
+          DB      $1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D,$1D\r
+\r
+END01     DB      0\r
+\r
+;*******************************************************************************\r
+; VECTORS FOR STARTUP\r
+          ORG     $DFF8\r
+          DB      $FF,$E7                ;SECURITY ROM\r
+          DB      L(HANDLER),H(HANDLER)  ;NMI VECTOR FOR DLI\r
+          DB      L(STARTUP1+$2000),H(STARTUP1+$2000)  ;STARTUP VECTOR\r
+          DB      L(SPURIOUS),H(SPURIOUS)  ; HITS AN RTI\r
+;*******************************************************************************\r
+          ORG     $DF73\r
+STARTUP1  JMP     STARTUP\r
+\r
+          ORG     $FF73\r
+          JMP     STARTUP\r
+\r
+;*******************************************************************************\r
+; VECTORS FOR STARTUP\r
+          ORG     $FFF8\r
+          DB      $FF,$E7                ;SECURITY ROM\r
+          DB      L(HANDLER),H(HANDLER)  ;NMI VECTOR FOR DLI\r
+          DB      L(STARTUP1),H(STARTUP1)  ;STARTUP VECTOR\r
+          DB      L(SPURIOUS),H(SPURIOUS)  ; HITS AN RTI\r
+;*******************************************************************************\r
+;*******************************************************************************\r
diff --git a/GMAIN.S b/GMAIN.S
new file mode 100644 (file)
index 0000000..86e8ce1
--- /dev/null
+++ b/GMAIN.S
@@ -0,0 +1,1072 @@
+;*******************************************************************************\r
+;GMAIN.S\r
+          ORG     $8000\r
+BEGIN\r
+          LDX     #71                     ;ZERO OUT ENMYLIST (TYPE)\r
+XZERO     LDA     #0\r
+          STA     TYPE,X\r
+          LDA     #1\r
+          STA     ANGLE,X\r
+          DEX\r
+          BPL     XZERO\r
+          LDX     #40\r
+XAVIDSUX  LDA     #0\r
+          STA     NEWTYPE,X\r
+          DEX\r
+          BPL     XAVIDSUX\r
+          LDA     RSTRTREG               ;SEE IF A RESTART HAS OCCURED\r
+          BEQ     LOGO\r
+          LDA     #0\r
+          STA     RSTRTREG               ;CLEAR FLAG\r
+          JMP     GOTORES\r
+LOGO      JSR     SETLOGO\r
+          JSR     SCRAPALL\r
+          JMP     TITLPPP\r
+SETLOGO   LDA     #1\r
+          STA     TEMP1\r
+          LDA     #$F0\r
+          STA     TEMP2\r
+          LDX     #18\r
+          LDY     #65                    ;START WITH 2ND PAGE GRAPHICS\r
+LLOGO     TXA\r
+          STA     TYPE,Y\r
+          INX\r
+          INY\r
+          CPX     #24\r
+          BNE     LLOGO\r
+          LDA     #30\r
+          STA     XCORD+65\r
+          STA     XCORD+66\r
+          LDA     #82\r
+          STA     XCORD+67\r
+          STA     XCORD+68\r
+          LDA     #70\r
+          STA     XCORD+69\r
+          STA     XCORD+70\r
+          LDA     #72\r
+          STA     YCORD+65\r
+          STA     YCORD+67\r
+          LDA     #84\r
+          STA     YCORD+66\r
+          STA     YCORD+68\r
+          LDA     #96\r
+          STA     YCORD+69\r
+          LDA     #108\r
+          STA     YCORD+70\r
+          LDA     #0\r
+          STA     ANGLE\r
+          STA     TEMP3                  ;INITIALLY POSITIVE\r
+          LDA     #$48\r
+          STA     YCORD\r
+          LDA     #$50\r
+          STA     XCORD\r
+;THIS SECTION SETS UP THE TWINKLE\r
+          LDA     #35\r
+          STA     TYPE\r
+          LDA     #7                     ;USE Y AS A LOCATION VARIABLE\r
+          STA     BOZO0                  ;THIS SAVES THE Y VALUE\r
+          RTS                            ;END OF LOGO SETUP SUBROUTINE\r
+\r
+TITLPPP   LDA     #0\r
+          STA     FRAME                  ;SET UP FRAME\r
+TITLOOP   DEC     FRAME\r
+TITLP1    LDA     FRAME\r
+          BMI     TITLP1\r
+          JSR     TWINKEL                ;TWINKLE SUBROUTINE\r
+          LDA     SELECT                 ;SEE IF IN SELECT MODE\r
+          BEQ     NOTOSEL\r
+          JMP     GOTOSEL\r
+NOTOSEL   LDA     TEMP2\r
+          BEQ     DOHSC                  ;DO HSC AFTER TITLE PAGE\r
+\r
+ATIT      LDA     SWCHB                  ;GET LOCAL INPUTS\r
+          LSR     A\r
+          BCS     ATIT2\r
+          JMP     GOTORES\r
+ATIT2     LSR     A\r
+          BCS     ATIT3\r
+          JMP     GOTOSEL\r
+ATIT3     LDA     SWCHA                  ;LOOK AT JOYSTICK INPUT\r
+          ORA     #$0F                   ;BOOT PLAYER 2 INPUT\r
+          CMP     #$FF                   ;SEE IF ANY INPUT\r
+          BEQ     FUCKYOU\r
+          JMP     GOTOSEL                ;GO TO SELECT MODE\r
+FUCKYOU   BIT     INPT4                  ;LOOK AT FIRE BUTTON INPUT\r
+          BMI     ATIT4\r
+          JMP     GOTORES\r
+ATIT4     LDA     #0\r
+          STA     FLAP                   ;PREVENT FLAPPING IN LOADER\r
+          JMP     TITLOOP\r
+\r
+DOHSC     LDA     #0\r
+          STA     DIFCULTY               ;SET DIFFICULTY FOR NOVICE\r
+          JSR     SETLOGO                ;SETS UP THE LOGO DISPLAY\r
+          LDA     #1\r
+          STA     INHSC                  ;INDICATE IN HSC MODE\r
+          JSR     HSCTEST                SEE IF THERE IS A DISPLAY FOR THIS\r
+          BMI     NONOVICE\r
+          LDA     #1\r
+          STA     INHSC\r
+          JSR     HSCDSPLY               ;DISPLAY HISCORECART\r
+          JSR     GAMEPOLL               SEE IF ANY INPUT\r
+          BCS     NOEXPERT\r
+NONOVICE  INC     DIFCULTY\r
+          JSR     HSCTEST                SEE IF ADVANCED TABLE\r
+          BMI     NOADVNCD\r
+          LDA     #1\r
+          STA     INHSC\r
+          JSR     HSCDSPLY\r
+          JSR     GAMEPOLL               SEE IF ANY INPUT\r
+          BCS     NOEXPERT\r
+NOADVNCD  INC     DIFCULTY\r
+          JSR     HSCTEST                SEE IF EXPERT TABLE\r
+          BMI     NOEXPERT\r
+          LDA     #1\r
+          STA     INHSC\r
+          JSR     HSCDSPLY\r
+NOEXPERT  LDA     #$40\r
+          STA     CTRLWT                 RESET THE CORRECT CONTROL WORD\r
+          JSR     CLEARDL1\r
+          JMP     ENDCLEAR\r
+\r
+CLEARDL1                                 ;THIS SUBROUTINE CLEARS THE FIRST DLIST\r
+          LDA     #$18\r
+          STA     TEMP1+1                TEMP1 NOW HAS THE ADDRESS 1801\r
+          LDX     #15                    LOOP 16 TIMES\r
+          LDA     #0\r
+          STA     TEMP1\r
+DLST1CLR  LDY     #0\r
+          TYA\r
+          STA     (TEMP1),Y\r
+          INY\r
+          STA     (TEMP1),Y\r
+          LDA     TEMP1\r
+          CLC\r
+          ADC     #82                    INC TO NEXT DLST\r
+          STA     TEMP1\r
+          LDA     TEMP1+1\r
+          ADC     #0\r
+          STA     TEMP1+1\r
+          DEX\r
+          BPL     DLST1CLR\r
+          RTS\r
+\r
+ENDCLEAR  LDA     #L(DLSTLST1)\r
+          STA     DPPL\r
+          LDA     #H(DLSTLST1)\r
+          STA     DPPH\r
+          LDA     #0\r
+          STA     DLSPTR                 ;NEXT DLI WILL BUILD DISPLAY LIST 2\r
+;         STA     TWOPLAYR               ;SET TO ONE PLAYER MODE FOR AUTOPLAY\r
+          STA     INHSC\r
+          STA     AUTOPLAY               ;THIS JUST SETS UP AUTOPLAY NOW\r
+          LDA     #9\r
+          STA     AUTOPLAZ               ;ADDITIONAL COUNTER\r
+          STA     AUTOPLAY               ;NEEDS A NON-ZERO VALUE\r
+          JMP     ATITOUT                ;GO INTO GAME LOOP\r
+GOTOSEL\r
+          LDA     #$20\r
+          STA     MISTIMER               ;DONT ALLOW SHOT TO BE FIRED\r
+          STA     TEMP2                  ;KEEP STAR TWINKLING\r
+          STA     SELECT                 ;INDICATE IN SELECT MODE\r
+          LDA     #0\r
+          STA     AUTOPLAY               ;CLEAR AUTOPLAY MODE\r
+          STA     AUTOPLAZ\r
+          STA     FLAP                   ;PREVENT FLAPPING IN LOADER\r
+          BIT     INPT4                  ;SEE IF FIRE BUTTON HIT\r
+          BMI     CONTSEL                ;IF HIT, START GAME\r
+SELRES    JMP     GOTORES\r
+CONTSEL   LDA     SWCHB\r
+          LSR     A\r
+          BCC     SELRES                 ;SEE IF RESET HIT DURING SELECT\r
+*THIS SECTION KEEPS UP THE SELECTION DISPLAY\r
+          LDA     #47                    ;PLAYERS TYPE\r
+          STA     TYPE+71                ;STORE IN TYPE LIST\r
+          LDA     #40\r
+          STA     XCORD+71\r
+          LDA     #132\r
+          STA     YCORD+71\r
+          STA     YCORD+1\r
+          LDA     #1\r
+          STA     ANGLE+71\r
+          STA     ANGLE+1\r
+          LDY     #48\r
+          LDA     TWOPLAYR               ;GET TWOPLAYER REGISTER\r
+          BEQ     SHOWONE\r
+          INY\r
+SHOWONE                                  ;'1' TYPE\r
+          STY     TYPE+1\r
+          LDA     #90\r
+          STA     XCORD+1\r
+;THIS SECTION PUTS UP THE PLAY LEVEL\r
+          LDA     #46                    ;'LEVEL' TYPE\r
+          STA     TYPE+2\r
+          LDA     #40\r
+          STA     XCORD+2\r
+          LDA     #144\r
+          STA     YCORD+2\r
+          STA     YCORD+3\r
+          LDA     #1\r
+          STA     ANGLE+2\r
+          STA     ANGLE+3\r
+          LDY     #44\r
+          LDA     LEVELSEL               ;GET LEVEL SELECTION REGISTER\r
+          BMI     DONOVICE               ;$FF IS NOVICE\r
+          BNE     FINLEVEL               ;1 IS EXPERT, 0 IS ADVANCED\r
+          DEY\r
+          DEY                            ;43 IS ADVANCED\r
+DONOVICE  INY                            ;45 IS NOVICE\r
+FINLEVEL  STY     TYPE+3                 ;44 IS EXPERT\r
+          LDA     #80\r
+          STA     XCORD+3\r
+;THIS SECTION DOES THE SELECTION ADVANCE\r
+          DEC     SELTIMER               ;SEE IF TIME TO LOOK AT JOYSTICK\r
+          BNE     ENDSEL\r
+          LDA     #20\r
+          STA     SELTIMER               ;RESET SELTIMER\r
+          LDA     SWCHA                  ;GET JOYSTICK INPUT\r
+          ORA     #$0F                   ;BOOT PLAYER 2 INPUT\r
+          CMP     #$FF\r
+          BEQ     CHKSWB                 ;LOOK AT LOCAL INPUT\r
+          ASL     A\r
+          BCC     INCDIFF                ;INC DIFFICULTY\r
+          ASL     A\r
+          BCC     DECDIFF                ;DEC DIFFICULTY\r
+          ASL     A\r
+          BCS     INCPLYR\r
+          LDA     #0\r
+          STA     TWOPLAYR               ;SET PLAYERS TO 1\r
+          BEQ     ENDSEL\r
+INCPLYR   LDA     #1\r
+          STA     TWOPLAYR               ;SET PLAYERS TO 2\r
+          BNE     ENDSEL\r
+INCDIFF   LDA     LEVELSEL               ;GET LEVEL SELECTION REG\r
+          CMP&nb