Initial import. master
authorSimon Morgan <sjm@sjm.io>
Mon, 22 Jun 2015 23:33:10 +0000 (00:33 +0100)
committerSimon Morgan <sjm@sjm.io>
Mon, 22 Jun 2015 23:33:10 +0000 (00:33 +0100)
25 files changed:
CDEF.S [new file with mode: 0644]
CDOIT.S [new file with mode: 0644]
CDOITK.S [new file with mode: 0644]
CHKSUM.S [new file with mode: 0644]
CKERNEL.S [new file with mode: 0644]
CMAIN.S [new file with mode: 0644]
CSTAMPS.S [new file with mode: 0644]
CTABLES.S [new file with mode: 0644]
CTUNES.S [new file with mode: 0644]
DEATH.S [new file with mode: 0644]
FLEA.S [new file with mode: 0644]
GETDISP.S [new file with mode: 0644]
GETELSE.S [new file with mode: 0644]
GETGAME.S [new file with mode: 0644]
GETIT.S [new file with mode: 0644]
GLOBAL.S [new file with mode: 0644]
HEX.S [new file with mode: 0644]
JOYSTICK.S [new file with mode: 0644]
LOADER.S [new file with mode: 0644]
MAKCENTI.S [new file with mode: 0644]
MAKEPRNT.S [new file with mode: 0644]
MOVCENTI.S [new file with mode: 0644]
OLDSTMPS.S [new file with mode: 0644]
SPIDER.S [new file with mode: 0644]
SSET.S [new file with mode: 0644]

diff --git a/CDEF.S b/CDEF.S
new file mode 100644 (file)
index 0000000..64c62a5
--- /dev/null
+++ b/CDEF.S
@@ -0,0 +1,372 @@
+*** CDEF.S ***\r
+\r
+;         MEMORY ALLOCATION AND CONSTANTS FOR 3600 CENTIPEDE\r
+\r
+NEWBOARD  EQU     1                      ;SET TO ZERO IF OLD BOARD\r
+                                         ;ONE FOR NEW BOARD\r
+; TIA REGISTERS\r
+VBLANK    EQU     $01\r
+\r
+INPT0     EQU     $08\r
+INPT1     EQU     $09\r
+INPT4     EQU     $0C\r
+INPT5     EQU     $0D\r
+AUDC0     EQU     $15      ;BITS     3210 AUDIO CONTROL 0\r
+AUDC1     EQU     $16      ;BITS     3210 AUDIO CONTROL 1\r
+AUDF0     EQU     $17      ;BITS     3210 AUDIO FREQUENCY 0\r
+AUDF1     EQU     $18      ;BITS     3210 AUDIO FREQUENCY 1\r
+AUDV0     EQU     $19      ;BITS     3210 AUDIO VOLUME 0\r
+AUDV1     EQU     $1A      ;BITS     3210 AUDIO VOLUME 1\r
+\r
+;MARIA REGISTERS\r
+          ORG     $20\r
+BACKGRND  EQU     $20                    ;BACKGROUND COLOR                  RW\r
+P0C1      EQU     $21                    ;PALETTE ZERO COLOR ONE            RW\r
+P0C2      EQU     $22                    ;PALETTE ZERO COLOR TWO            RW\r
+P0C3      EQU     $23                    ;PALETTE ZERO COLOR THREE          RW\r
+WSYNC     EQU     $24                    ;FAST MARIA WSYNC STROBE\r
+P1C1      EQU     $25                    ;PALETTE ONE COLOR ONE             RW\r
+P1C2      EQU     $26                    ;PALETTE ONE COLOR TWO             RW\r
+P1C3      EQU     $27                    ;PALETTE ONE COLOR THREE           RW\r
+MSTAT     EQU     $28                    ;BIT 6 IN VBLANK, BIT ? IN DISPLAY RO\r
+P2C1      EQU     $29                    ;PALETTE TWO COLOR ONE             RW\r
+P2C2      EQU     $2A                    ;PALETTE TWO COLOR TWO             RW\r
+P2C3      EQU     $2B                    ;PALETTE TWO COLOR THREE           RW\r
+DPH       EQU     $2C                    ;DISPLAY LIST POINTER HIGH         WO\r
+P3C1      EQU     $2D                    ;PALETTE THREE COLOR ONE           RW\r
+P3C2      EQU     $2E                    ;PALETTE THREE COLOR TWO           RW\r
+P3C3      EQU     $2F                    ;PALETTE THREE COLOR THREE         RW\r
+DPL       EQU     $30                    ;DISPLAY LIST POINTER LOW          WO\r
+P4C1      EQU     $31                    ;PALETTE FOUR COLOR ONE            RW\r
+P4C2      EQU     $32                    ;PALETTE FOUR COLOR TWO            RW\r
+P4C3      EQU     $33                    ;PALETTE FOUR COLOR THREE          RW\r
+CHARBASE  EQU     $34                    :CHARACTER MODE HIGH POINTER       WO\r
+P5C1      EQU     $35                    ;PALETTE FIVE COLOR ONE            RW\r
+P5C2      EQU     $36                    ;PALETTE FIVE COLOR TWO            RW\r
+P5C3      EQU     $37                    ;PALETTE FIVE COLOR THREE          RW\r
+OFFSET    EQU     $38                    ;GRAPHICS HIGH POINTER OFFSET      RW\r
+P6C1      EQU     $39                    ;PALETTE SIX COLOR ONE             RW\r
+P6C2      EQU     $3A                    ;PALETTE SIX COLOR TWO             RW\r
+P6C3      EQU     $3B                    ;PALETTE SIX COLOR THREE           RW\r
+CTRL      EQU     $3C                    ;BIT 7  CHARACTER WIDTH,BIT 6 BCNT WO\r
+P7C1      EQU     $3D                    ;PALETTE SEVEN COLOR ONE           RW\r
+P7C2      EQU     $3E                    ;PALETTE SEVEN COLOR TWO           RW\r
+P7C3      EQU     $3F                    ;PALETTE SEVEN COLOR THREE         RW\r
+\r
+\r
+;6532  TIMERS AND PORTS\r
+SWCHA     EQU     $280  ;PO, P1 JOYSTICKS\r
+;         BIT 7 PLAYER 0 EAST IF CLEAR\r
+;         BIT 6          WEST\r
+;         BIT 5          SOUTH\r
+;         BIT 4          NORTH\r
+;         BIT 3 PLAYER 1 EAST IF CLEAR\r
+;         BIT 2          WEST\r
+;         BIT 1          SOUTH\r
+;         BIT 0          NORTH\r
+\r
+SWCHB     EQU     $282  ;CONSOLE SWITCHES\r
+;         BIT 7   PLAYER 1 DIFFICULTY A IF SET B IF CLEAR\r
+;         BIT 6   PLAYER 0 DIFFICULTY A IF SET B IF CLEAR\r
+;         BIT 3   BLACK & WHITE/COLOR  COLOR WHEN SET\r
+;                 NOW IS PAUSE SWITCH    CLEAR WHEN PRESSED\r
+;         BIT 1   GAME SELECT  CLEAR WHEN PRESSED\r
+;         BIT 0   GAME RESET   CLEAR WHEN PRESSED\r
+\r
+CTLSWA    EQU     $281\r
+CTLSWB    EQU     $283\r
+INTIM     EQU     $284  ;INTERVAL TIMER IN\r
+TIM8T     EQU     $295  ;TIMER 8T WRITE OUT\r
+TIM64T    EQU     $296  ;TIMER 64T WRITE OUT\r
+TIM64TI   EQU     $29E  ;INTERUPT TIMER 64T\r
+\r
+\r
+******************************************\r
+*         CONSTANTS                      *\r
+******************************************\r
+INFLDZN   EQU     15                     ;ZONE NUMBER OF TOP LINE OF INFIELD\r
+                                         ;  (ZONE NUMBERING STARTS WITH 1)\r
+NSCORES   EQU     7\r
+BIT7MASK  EQU     $80\r
+NZONES    EQU     24\r
+ZONELEN   EQU     31\r
+DLLENGTH  EQU     18*4+5+2               ;79\r
+\r
+PWSHOOTR  EQU     $1E                    0=SHOOTER\r
+PWSHOT    EQU     $1F                    0=SHOT\r
+PWSPIDER  EQU     $7D                    3=SPIDER\r
+PWSCORP   EQU     $9E                    4=SCORPION AND FLEA\r
+PWCENTI   EQU     $BF                    5=CENTIPEDE SEGMENT\r
+PALWIDTH  EQU     $C1                    6=PALETTE, WIDTH FOR CHARACTER MAP\r
+PWTITLE   EQU     $C1                    6=PALETTE/WIDTH FOR TITLE PAGE GRAPHIC\r
+PWCOPYRT  EQU     $D4                    6=PALETTE/WIDTH FOR COPYRIGHT LINE\r
+\r
+TOPCOLOR  EQU     144\r
+CENTPCNT  EQU     2                      ;NUMBER OF CHAINS IN TITLE PAGE\r
+\r
+HORIZPOS  EQU     20\r
+MINX      EQU     20\r
+MAXX      EQU     MINX+ZONELEN*4         ;16+124=140\r
+CNTRCLMN  EQU     (MAXX-MINX)/2+MINX-2\r
+MINY      EQU     8\r
+MAXY      EQU     191\r
+\r
+SEGWDTH   EQU     4\r
+SPDRWDTH  EQU     9\r
+SCRPWDTH  EQU     8\r
+FLEAWDTH  EQU     5\r
+\r
+ATTRYBSE  EQU     40\r
+YBTMATTR  EQU     ATTRYBSE+24\r
+\r
+\r
+******************************************\r
+*         ZERO PAGE RAM                  *\r
+******************************************\r
+*                                        *\r
+* $40 TO $7F SHADOWED AT $2040 TO $207F  *\r
+* $80 TO $FF IS 6532 RAM                 *\r
+*                                        *\r
+******************************************\r
+\r
+          ORG     $0040\r
+GTEMP1    DS      1                      ;Temporaries used by game; don't use\r
+GTEMP2    DS      1                      ;   in loader\r
+GTEMP3    DS      1                      ;First four are also used as SCOREBLK\r
+GTEMP4    DS      1                      ;   for HSC\r
+GTEMP5    DS      1                      ;GTEMP6 at other end of page 0\r
+\r
+SCOREBLK  EQU     GTEMP1\r
+HSDATA    EQU     $2200\r
+\r
+DLOFFSTS  DS      23                     ;INDEX INTO DISPLAY LISTS   $5B\r
+\r
+OBJX      DS      18                     ;GAME'S OBJECT TABLE    $6D\r
+OBJY      DS      18                     ;$7F\r
+\r
+* ANYTHING FROM $80 TO ABOUT $C0 OR $D0 CAN'T BE USED IN MOVCENTI OR LOADER\r
+* SINCE THESE ROUTINES ARE CALLED DURING HSC DISPLAY, AND HSC USES THESE ZERO\r
+* PAGE ADDRESSES\r
+SCORE0    DS      3                      ;SCORES FOR PLAYER 0, 1, TEAM SCORE\r
+HSCORE0   DS      4\r
+SCORE1    DS      3\r
+HSCORE1   DS      4\r
+SCORE2    DS      3\r
+HSCORE2   DS      4\r
+SCORE3    DS      3                      ;EXTRA SCORE BYTES FOR HIGH SCORE CART\r
+\r
+          ORG     $00D0\r
+OBJSTAT   DS      18                     ;$E1\r
+OBJOFFST  DS      18                     ;$F3\r
+\r
+\r
+;OBJX2     DS      18                     ;GAME'S OBJECT TABLE\r
+;OBJY2     DS      18\r
+;OBJSTAT2  DS      18\r
+;OBJOFFS2  DS      18\r
+\r
+\r
+FLEAX     EQU     OBJX+13\r
+FLEAY     EQU     OBJY+13\r
+FLEAOFST  EQU     OBJOFFST+13\r
+FLEASTAT  EQU     OBJSTAT+13             ;BIT 7  1=LIVE, 0=DEAD\r
+                                         ;    6  1=FLEA, 0=SCORPION\r
+          ;IF FLEA, BITS 10 GIVE SPEED -1\r
+          ;IF SCORPION, BIT 1  1= FAST,  0= SLOW        BIT 0 1=LEFT, 0=RGHT\r
+\r
+\r
+SPDRX     EQU     OBJX+12\r
+SPDRY     EQU     OBJY+12\r
+SPDROFST  EQU     OBJOFFST+12\r
+SPDRSTAT  EQU     OBJSTAT+12             ;BIT 7   1=LIVE, 0=DEAD\r
+                                         ;    6   1 = HORIZ. MOVEMENT, 0 = NO\r
+                                         ;    5   1=LEFT, 0=RIGHT\r
+                                         ;    2   1=UP,0=DOWN\r
+                                         ;    0   1=FAST, 0=SLOW\r
+\r
+SHOOTERX  EQU     OBJX+14                ;LOCATION OF SHOOTER IN OBJECT TABLE\r
+SHOOTERY  EQU     OBJY+14\r
+SHTROFST  EQU     OBJOFFST+14\r
+SHTRSTAT  EQU     OBJSTAT+14             ;BIT 7   1=LIVE, 0=DEAD\r
+                                         ;    6   USED IN CHKEND\r
+                                         ;    5   RIGHT/LEFT\r
+                                         ;    4   1=RES MAN IN\r
+\r
+SHOTX     EQU     OBJX+16\r
+SHOTY     EQU     OBJY+16\r
+SHOTSTAT  EQU     OBJSTAT+16\r
+SHOTOFST  EQU     OBJOFFST+16\r
+\r
+VECTORI   DS      2                      ;$F5\r
+\r
+TEMPADDR  DS      2                      ;Temporaries used by loader; don't use\r
+MPTRL     EQU     TEMPADDR               ;   in game play\r
+MPTRH     EQU     TEMPADDR+1\r
+TEMP1     DS      1\r
+TEMP2     DS      1\r
+TEMP3     DS      1\r
+TEMP4     DS      1                      ;$FB\r
+\r
+GTEMP6    DS      1                      ;$FC\r
+\r
+********************************************************************************\r
+* RAM       (DONT USE 2040-20FF, OR 2140-21FF)\r
+********************************************************************************\r
+******************************************\r
+*         DISPLAY LISTS                  *\r
+******************************************\r
+\r
+          ORG     $1800                  ;TO $1F91\r
+HLINEDL   DS      12                     ;1 HEADER FOR A HORIZONTAL LINE\r
+TPDL      DS      2                      ;ALWAYS TWO ZEROES\r
+DL1       DS      17                     ; SCORE ZONE -- 3 HEADERS\r
+DL2       DS      DLLENGTH               ;2 + 17 + 23*79 + 28*3 = 1920 dec\r
+DL3       DS      DLLENGTH               ;                         780 hex\r
+DL4       DS      DLLENGTH\r
+DL5       DS      DLLENGTH\r
+DL6       DS      DLLENGTH\r
+DL7       DS      DLLENGTH\r
+DL8       DS      DLLENGTH\r
+DL9       DS      DLLENGTH\r
+DL10      DS      DLLENGTH\r
+DL11      DS      DLLENGTH\r
+DL12      DS      DLLENGTH\r
+DL13      DS      DLLENGTH\r
+DL14      DS      DLLENGTH\r
+DL15      DS      DLLENGTH\r
+DL16      DS      DLLENGTH\r
+DL17      DS      DLLENGTH\r
+DL18      DS      DLLENGTH\r
+DL19      DS      DLLENGTH\r
+DL20      DS      DLLENGTH\r
+DL21      DS      DLLENGTH\r
+DL22      DS      DLLENGTH\r
+DL23      DS      DLLENGTH\r
+DL24      DS      DLLENGTH\r
+DLL       DS      31*3+1\r
+* AND THEN 61 MORE MISCELLANEOUS\r
+LETTRNUM  DS      1\r
+TUNTEMP   DS      1\r
+SCRLONZN  DS      1\r
+TOPLINE   DS      1\r
+MINIMUMY  DS      1\r
+\r
+CLMNUSED  DS      4\r
+ATGMTMR   DS      2                      ;ONE OF EACH OF THESE FOR EACH PLAYER\r
+ATSITTMR  DS      2\r
+ATTSHTRY  DS      2\r
+ATTSHTRX  DS      2\r
+\r
+OBJPALWD  DS      18                     ;OBJECT PALETTE/WIDTH TABLE\r
+OBJTIMER  DS      18\r
+SPDRTIMR  EQU     OBJTIMER+12\r
+SHTRTIMR  EQU     OBJTIMER+14\r
+SHOTTIMR  EQU     OBJTIMER+16\r
+DIFLEVEL  DS      1                      ;DIFFICULTY LEVEL\r
+DEBOUNC2  DS      1                      ;DEBOUNCE FOR JOYSTICK IN TITLE PAGE\r
+OPTCNT1   DS      1                      ;COUNTER FOR JOYSTICK IN TITLE PAGE\r
+OPTCNT2   DS      1                      ;COUNTER FOR GAME SWITCH IN TITLE PAGE\r
+CENTLEFT  DS      1                      ;18 IN GAME PLAY, 19 IN TITLE PAGE\r
+CENTRGHT  DS      1                      ;135 IN GAME PLAY, 134 IN TITLE PAGE\r
+HSCFLAG   DS      1\r
+HSATRGM   DS      1                      ;WHICH GAME VERSION TO DISPLAY HS OF\r
+ALTCTRLS  DS      1                      ;IN ALTERNATING GAME, 0=USE 1 TRACK,\r
+                                         ;   1 JOYSICK        1=SHARE TRACKBALL\r
+\r
+******************************************\r
+* DON'T USE 2040-20FF\r
+******************************************\r
+\r
+          ORG     $2100                  ;USED TO BE $1000--MARIA 1 64 BYTES\r
+* 54 BYTES HAVE BEEN USED\r
+FRMCNT    DS      1\r
+RNDM      DS      2\r
+PAUSETMR  DS      2\r
+DEBOUNCE  DS      1\r
+DEBOUNC1  DS      1\r
+NLOOPS    DS      1\r
+OBJTBSEM  DS      1                      ;SEMAPHORE FOR OBJECT TABLE\r
+; BIT 7 SET IF OBJECT TABLE READY TO BE LOADED, 0 IF NOT\r
+\r
+PLAYER    DS      1                      ;PLAYER 0 OR 1\r
+\r
+BONUSL    DS      2                      ;NEXT BONUS LEVEL, LOW BYTE\r
+BONUSM    DS      2                      ;NEXT BONUS LEVEL, HIGH\r
+\r
+MENLEFT   DS      2\r
+\r
+RACKNUM   DS      2\r
+NHDCOUNT  DS      2\r
+NHDTIMER  DS      1\r
+NEWHDFLG  DS      1\r
+FASTWAVE  DS      2\r
+SPDCTRL   DS      1\r
+CHAINSIZ  DS      2\r
+MAXSGCNT  DS      1\r
+NUMSEG    DS      1\r
+MUSHCNT   DS      2                      ;NUMBER OF MUSHROOMS IN INFIELD\r
+CLRINDEX  DS      2                      ;SET OF COLORS OF EACH PLAYER GRAPHICS\r
+COLORFLG  DS      1                      ;FLAG FOR NEW COLORS TO BE LOADED\r
+GAMETYPE  DS      1                      ;BIT 0   1 PLAYER/2 PLAYER (0/1)\r
+; BIT 7 SET = 2 PLAYER SIMULTANEOUS      BIT 6 SET = 2 PLAYER TEAM PLAY\r
+DELAYSEG  DS      1\r
+ATTRACT   DS      2\r
+AXCOUNT   DS      2\r
+SCRTIMER  DS      1\r
+FLAGS     DS      1                      ;VARIOUS GAME FLAGS\r
+;         BIT 7   SOMEBODY'S GAME HAS ENDED IN A TWO PLAYER MODE (STAYS SET\r
+;                 UNTIL END OF GAME, AS OPPOSED TO BIT 7)\r
+;         BIT 6   1 = MUSHROOM RESTORATION IS CURRENTLY HAPPENING\r
+\r
+******************************************\r
+* DON'T USE 2140-21FF\r
+******************************************\r
+\r
+          ORG     $2200                  ;USED SO FAR--11 + 62 + 1395 = 5BC HEX\r
+\r
+******************************************\r
+* CHARACTER MAPS TOTAL 1395 dec OR 573 hex BYTES\r
+******************************************\r
+MAP2      DS      (NZONES-2)*ZONELEN     ;This map for other player\r
+MUSHMAP   DS      (NZONES-1)*ZONELEN     ;This map gets displayed\r
+MUSHEND   EQU     MUSHMAP+(NZONES-1)*ZONELEN\r
+\r
+GMTYPDSP  EQU     MUSHMAP+ZONELEN*15+5\r
+CTRLDSP   EQU     MUSHMAP+ZONELEN*16\r
+DFLVLDSP  EQU     MUSHMAP+ZONELEN*18\r
+\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\r
+CINDEX1   DS      1\r
+VINDEX0   DS      1\r
+VINDEX1   DS      1\r
+SCRPINDX  DS      1\r
+\r
+LIFETMP   DS      ZONELEN*2              ;62 BYTES -- ALLOWS TWO\r
+                                         ;LINES OF CHAR. MAP BUFFER FOR LIFE\r
+MSGSTORE  EQU     LIFETMP\r
+BUTNIB    DS      2                      ;TEMP STORAGE FOR BUTTON STATUS\r
+YCOUNT    DS      1\r
+XCOUNT    DS      1                      ;X COUNT BYTE\r
+YCOUNT1   DS      1                      ;PLAYER2\r
+XCOUNT1   DS      1\r
+OLDY      DS      1\r
+OLDX      DS      1                      ;KEEPS TRACK OF LAST XCOUNT\r
+OLDY1     DS      1\r
+OLDX1     DS      1\r
+DELTAY    DS      1\r
+DELTAY1   DS      1\r
+DELTAX    DS      1                      ;CHANGE IN X COUNT SINCE LAST FRAME\r
+DELTAX1   DS      1\r
+TRACKF    DS      2                      ;TRACKBALL FLAG 0=NOT TRACKBALL\r
+CRAP      DS      1\r
+TTEMP1    DS      1\r
+TTEMP2    DS      1\r
+SCHTICK   DS      1                      ;JOYSTICK SHADOW REGISTER\r
+PANEL     DS      1                      ;SWCHB SHADOW REGISTER\r
+ENDEF\r
diff --git a/CDOIT.S b/CDOIT.S
new file mode 100644 (file)
index 0000000..d4aedb8
--- /dev/null
+++ b/CDOIT.S
@@ -0,0 +1,47 @@
+JE\r
+WR:1:CENTI.S\r
+LGLOBAL.S\r
+LCDEF.S\r
+LCMAIN.S\r
+N\r
+LJOYSTICK.S\r
+N\r
+LDEATH.S\r
+N\r
+LFLEA.S\r
+N\r
+LSPIDER.S\r
+N\r
+LCTABLES.S\r
+N\r
+I\r
+          ORG     $C798\r
+\r
+LMOVCENTI.S\r
+N\r
+LMAKCENTI.S\r
+N\r
+LCTUNES.S\r
+A$\r
+I\r
+ENDCENTI\r
+          END\r
+\r
+N\r
+JA\r
+SE\r
+M1:CENTI.S\r
+\r
+R:M:CENTI.A\r
+\r
+\r
+JL\r
+SL\r
+CENTI.A\r
+CENTIS.A\r
+CENTIK.A\r
+\r
+R:CENTI.Z\r
+\r
+\r
+\r
diff --git a/CDOITK.S b/CDOITK.S
new file mode 100644 (file)
index 0000000..9bb4243
--- /dev/null
+++ b/CDOITK.S
@@ -0,0 +1,31 @@
+JE\r
+WR:1:CENTIK.S\r
+LGLOBAL.S\r
+LCDEF.S\r
+N\r
+LCKERNEL.S\r
+N\r
+LLOADER.S\r
+N\r
+I\r
+ENDLOAD\r
+          END\r
+\r
+W\r
+JA\r
+SE\r
+M1:CENTIK.S\r
+\r
+R:M:CENTIK.A\r
+\r
+\r
+JL\r
+SL\r
+CENTI.A\r
+CENTIS.A\r
+CENTIK.A\r
+\r
+R:CENTI.Z\r
+\r
+\r
+\r
diff --git a/CHKSUM.S b/CHKSUM.S
new file mode 100644 (file)
index 0000000..d3b03a7
--- /dev/null
+++ b/CHKSUM.S
@@ -0,0 +1,31 @@
+          ORG     $3000\r
+\r
+ZEROIT    LDA     #$80\r
+          STA     ZEROLP1+2\r
+\r
+          LDA     #$FF\r
+          LDX     #0\r
+ZEROLP1   STA     $8000,X\r
+          INX\r
+          BNE     ZEROLP1\r
+          INC     ZEROLP1+2\r
+          BNE     ZEROLP1\r
+ZERODONE  JMP     ZERODONE\r
+\r
+\r
+******************************************\r
+EORIT     LDA     #$80\r
+          STA     EORLP1+2\r
+\r
+          LDA     #0\r
+          LDX     #0\r
+EORLP1    EOR     $8000,X\r
+          INX\r
+          BNE     EORLP1\r
+          INC     EORLP1+2\r
+          BNE     EORLP1\r
+EORDONE   JMP     EORDONE\r
+\r
+\r
+\r
+          END\r
diff --git a/CKERNEL.S b/CKERNEL.S
new file mode 100644 (file)
index 0000000..1d25af9
--- /dev/null
+++ b/CKERNEL.S
@@ -0,0 +1,70 @@
+          ORG     $C298                  ;HOLE IN GRAPHICS DATA\r
+\r
+\r
+* INTERRUPT HANDLER TO SWITCH BACK INTO 160X2 MODE AFTER SCORE ZONE\r
+MORPHO    LDA     #L(VBLNK)\r
+          STA     VECTORI\r
+          LDA     #H(VBLNK)\r
+          STA     VECTORI+1\r
+\r
+          LDA     #$40\r
+          STA     WSYNC\r
+          STA     CTRL\r
+          LDA     #$80\r
+          STA     VBLANK\r
+\r
+RESTAIR   PLA\r
+RITS      RTI\r
+\r
+\r
+\r
+* INTERRUPT HANDLER TO RUN LOADER AT BOTTOM OF SCREEN\r
+VBLNK     TXA\r
+          PHA\r
+          TYA\r
+          PHA\r
+          CLD\r
+\r
+          LDA     #L(RVB)\r
+          STA     VECTORI\r
+          LDA     #H(RVB)\r
+          STA     VECTORI+1\r
+\r
+          LDA     #0\r
+          STA     VBLANK\r
+          STA     WSYNC\r
+          STA     WSYNC\r
+\r
+          LDA     #$43\r
+          STA     CTRL\r
+          JSR     TRACKIT\r
+          JSR     SCORIT\r
+          JSR     LOADER\r
+          JSR     LMST\r
+          JSR     TUNER\r
+\r
+MOO       PLA\r
+          TAY\r
+          PLA\r
+          TAX\r
+          PLA\r
+          RTI\r
+\r
+\r
+\r
+RVB\r
+          STA     WSYNC\r
+          TXA\r
+          PHA\r
+          TYA\r
+          PHA\r
+          STA     WSYNC\r
+          JSR     OFFSCRN\r
+*STORE COLORS HERE\r
+          LDA     #0\r
+          STA     BACKGRND\r
+          LDA     #L(MORPHO)\r
+          STA     VECTORI\r
+          LDA     #H(MORPHO)\r
+          STA     VECTORI+1\r
+          BNE     MOO                    ;RETURN FROM INT\r
diff --git a/CMAIN.S b/CMAIN.S
new file mode 100644 (file)
index 0000000..2b62013
--- /dev/null
+++ b/CMAIN.S
@@ -0,0 +1,1123 @@
+** CMAIN.S **\r
+\r
+* CENTIPEDE MAIN LOOP\r
+* DVP     4/26/84    ALL PAUSE MODE CODE FROM GAMELOOP MOVED INTO CHKSTRT\r
+\r
+          ORG     $FF76\r
+          DB      'GCC(C)1984'\r
+\r
+          ORG     $FFF8\r
+          DB      $FF,$C7\r
+          DB      L(BURP),H(BURP)\r
+          DB      L(RESET),H(RESET)\r
+          DB      L(RITS),H(RITS)\r
+\r
+          ORG     $D800\r
+\r
+BURP      PHA                            ;THE RUDE ISR\r
+          JMP     (VECTORI)\r
+\r
+\r
+RESET\r
+          SEI\r
+          CLD\r
+\r
+* NOW ALIEN DOES THIS ALSO\r
+          LDA     #$17                   ;ENCRYPTION CRAPOLA -- GO INTO MARIA\r
+          STA     $01                    ;   MODE.\r
+\r
+          LDX     #$7F\r
+          STX     CTRL\r
+          LDX     #$FF                   ;Initialize stack to be in PAGE ONE\r
+          TXS\r
+\r
+          INX\r
+          TXA\r
+          STA     CTLSWA                 ;A=0 -- MAKE PORTS READ ONLY\r
+          STA     CTLSWB\r
+          STA     OFFSET                 $0038\r
+          STA     INTIM\r
+\r
+ZEROMEM   STA     $1E00,X                KILL THAT LAST DL!!!!!\r
+          STA     $1F00,X\r
+          STA     $2000,X\r
+          STA     $2100,X\r
+          STA     $2700,X\r
+          DEX\r
+          BNE     ZEROMEM\r
+\r
+          JSR     CLRTRACK\r
+          JSR     INITALL\r
+          JSR     ONSCREEN\r
+          JSR     OFFSCRN\r
+          LDA     #$43\r
+          STA     CTRL\r
+\r
+******************************************\r
+* BEGIN MAIN LOOP OF GAME                *\r
+******************************************\r
+\r
+GAMELOOP\r
+          JSR     CHKSTRT                ALL PAUSE MODE CODE NOW IN CHKSTRT\r
+          JSR     CHKEND\r
+          JSR     LOOSENDS\r
+          JSR     JOYSTICK\r
+          JSR     RESTOR\r
+          JSR     EXPLODE\r
+          JSR     FLEASCRP\r
+          JSR     MOVCENTI\r
+          JSR     NEWHD\r
+          JSR     MVSPIDER\r
+          JSR     SHOOT\r
+\r
+GAMEWAIT  BIT     OBJTBSEM               ;WAIT UNTIL SEMAPHORE CLEARED BY LOADER\r
+          BMI     GAMEWAIT               ;   ENSURING THAT EVERY GAME PLAY GETS\r
+                                         ;   DISPLAYED AT LEAST ONCE\r
+          LDA     #$80                   ;SET SEMAPHORE\r
+          STA     OBJTBSEM\r
+          INC     FRMCNT\r
+          JMP     GAMELOOP\r
+\r
+******************************************\r
+*   END MAIN LOOP OF GAME                *\r
+******************************************\r
+\r
+\r
+;DEADEND   JMP     DEADEND                ;NONMASKABLE INTERRUPT VECTOR\r
+\r
+\r
+ONSCREEN  BIT     MSTAT\r
+          BMI     ONSCREEN\r
+          BIT     MSTAT\r
+          BMI     ONSCREEN\r
+          RTS\r
+\r
+OFFSCRN   BIT     MSTAT\r
+          BPL     OFFSCRN\r
+          BIT     MSTAT\r
+          BPL     OFFSCRN\r
+          RTS\r
+\r
+******************************************\r
+* Perform all initialization to get the system ready to do anything else -- sync\r
+*         Maria with TV screen, etc.\r
+******************************************\r
+INITALL\r
+          LDA     #L(MORPHO)\r
+          STA     VECTORI\r
+          LDA     #H(MORPHO)\r
+          STA     VECTORI+1\r
+\r
+          LDA     #H(STMPBASE)\r
+          STA     CHARBASE\r
+\r
+          LDX     #ENDLL-DLLTABLE        ;LOAD DLL\r
+LODUPT    LDA     DLLTABLE,X\r
+          STA     DLL,X\r
+          DEX\r
+          BPL     LODUPT\r
+\r
+          LDA     #L(DLL)\r
+          STA     DPL\r
+          LDA     #H(DLL)\r
+          STA     DPH\r
+\r
+          LDA     INPT4\r
+          STA     DEBOUNCE\r
+\r
+          LDA     #-12\r
+          STA     CLRINDEX\r
+\r
+          LDX     #$FF\r
+          STX     DEBOUNC1\r
+          STX     PANEL\r
+          INX\r
+          STX     AUDV0\r
+          STX     AUDV1\r
+          STX     TPDL+1\r
+          STX     BACKGRND\r
+          INX\r
+          STX     DIFLEVEL\r
+\r
+          LDA     #$80\r
+          STA     ATTRACT\r
+\r
+          LDA     #L(SHOT)               ;INITIAL SHOT OFFSET\r
+          STA     SHOTOFST\r
+          STA     SHOTOFST+1\r
+\r
+          LDA     #60                    ;ONE SECOND DELAYS\r
+          STA     OPTCNT2                ;NEXT OPTION\r
+          STA     SHOTTIMR               ;GAME START\r
+\r
+*******************\r
+INITGAME  LDA     #0                     ;GAME START INITIALIZATION, CLEAR\r
+          LDX     #2                     ;   SCORES\r
+CLRSCRLP  STA     SCORE0,X\r
+          STA     SCORE1,X\r
+          STA     SCORE2,X\r
+          STA     SCORE3,X\r
+          DEX\r
+          BPL     CLRSCRLP\r
+\r
+          JSR     CLRTRACK\r
+\r
+          LDX     DIFLEVEL\r
+          LDA     DFNSEGS,X              ;DFNSEGS DEFINED AT END OF INITALL\r
+          STA     MAXSGCNT\r
+          STA     CHAINSIZ\r
+          STA     CHAINSIZ+1\r
+\r
+*******************\r
+INITATGM  LDA     #0                     ;ATTRACT MODE INITIALIZATION ENTRY PT.\r
+          STA     PAUSETMR\r
+          STA     FLAGS\r
+          STA     PLAYER\r
+          STA     NUMSEG\r
+          STA     FASTWAVE\r
+          STA     NEWHDFLG\r
+          STA     CLRINDEX+1\r
+          STA     HSCFLAG\r
+          STA     SHTRTIMR\r
+\r
+          LDX     #17                    ;KILL ALL OBJECTS\r
+CLROBJLP  STA     OBJSTAT,X\r
+          DEX\r
+          BPL     CLROBJLP\r
+\r
+          STA     MENLEFT                ;CLEAR THE NUMBER OF MEN LEFT\r
+          STA     MENLEFT+1              ;   VARIABLES AND DISPLAY\r
+\r
+          STA     P7C1                   ;LOAD PALETTE 7 FOR BLANK\r
+          LDA     #$CA                   ;COLOR FOR HIGH SCORE\r
+          STA     P7C2\r
+          LDA     #$08\r
+          STA     P7C3                   ;BORDER COLOR\r
+\r
+          LDA     #$10\r
+          STA     FASTWAVE+1\r
+\r
+          LDX     #0\r
+          JSR     CLRMAPZN\r
+\r
+          LDA     #$20                   ;SET INITIAL BONUS VALUES\r
+          STA     BONUSL                 ;   (CURRENTLY FIRST BONUS AT 12,000)\r
+          STA     BONUSL+1\r
+          LDA     #1\r
+          STA     BONUSM\r
+          STA     BONUSM+1\r
+\r
+          LDA     #$C0\r
+          STA     NHDCOUNT\r
+          STA     NHDCOUNT+1\r
+\r
+          LDA     #-12\r
+          STA     CLRINDEX\r
+\r
+          LDA     #CENTPCNT\r
+          STA     LETTRNUM\r
+\r
+          JSR     SHTRCLRS               ;SUB. IN DEATH.S TO INIT. SHTR. COLORS\r
+\r
+* INITIAL SHOOTER, SHOT POSITION, STATUS, AND GRAPHICS\r
+          BIT     ATTRACT\r
+          BMI     NOPLRS\r
+          JSR     INITPLRS               ;THIS SUBROUTINE IS IN DEATH\r
+\r
+NOPLRS    JSR     SCRAPALL\r
+\r
+* SET THE FIRST HEADER IN EACH DISPLAY LIST TO POINT TO THE CHARACTER MAP\r
+LOGOINIT                                 ;LOGOINIT IS FOR HSC\r
+          JSR     SETATVAR\r
+          JSR     DLSTINIT               ;SET FIRST HDR. IN EACH DL TO MAP\r
+          JSR     LOADPLWD\r
+          JSR     MAPINIT\r
+\r
+          LDA     ATTRACT\r
+          BMI     ENDINIT\r
+          LDA     GAMETYPE\r
+          CMP     #1\r
+          BEQ     MAP2INIT\r
+ENDINIT   RTS\r
+\r
+DFNSEGS   DB      10,10,11,12\r
+\r
+MAP2INIT  LDA     MUSHCNT\r
+          STA     MUSHCNT+1\r
+          JSR     SWAP\r
+\r
+\r
+******************************************\r
+MAPINIT\r
+DSPLYOPT\r
+          LDX     #NZONES-2\r
+CLRMAPLP  JSR     CLRMAPZN\r
+          DEX\r
+          BNE     CLRMAPLP\r
+\r
+          LDA     ATTRACT\r
+          BPL     LDSHROOM\r
+\r
+************************************************************\r
+****      SUBROUTINE DSPLYOPT   - -  DISPLAY GAME OPTIONS IN MENU PAGE\r
+************************************************************\r
+          LDY     DIFLEVEL               ;DIFFICULTY LEVEL DISPLAY\r
+          LDA     DFLVLLOW,Y\r
+          STA     GTEMP1\r
+          LDA     DFLVLHGH,Y\r
+          STA     GTEMP2\r
+\r
+          LDA     DFPOS,Y\r
+          TAX\r
+          LDA     DFLNGTH,Y\r
+          TAY\r
+DFLVLLP   LDA     (GTEMP1),Y\r
+          STA     DFLVLDSP,X\r
+          DEX\r
+          DEY\r
+          BPL     DFLVLLP\r
+\r
+          LDX     GAMETYPE               ;GAME OPTION DISPLAY\r
+          LDA     ALOW,X\r
+          STA     GTEMP1\r
+          LDA     AHIGH,X\r
+          STA     GTEMP2\r
+\r
+          LDY     #22\r
+AOPTLP    LDA     (GTEMP1),Y\r
+          STA     GMTYPDSP,Y\r
+          DEY\r
+          BPL     AOPTLP\r
+\r
+;         CPX     #1\r
+;         BNE     ENDDSPOP\r
+;         LDA     #L(TWOCTRLS)\r
+;         LDX     #H(TWOCTRLS)\r
+;         LDY     ALTCTRLS\r
+;         BEQ     CTRLLN\r
+;         LDA     #L(SHRTRCKB)\r
+;         LDX     #H(SHRTRCKB)\r
+;TRLLN    STA     GTEMP1\r
+;         STX     GTEMP2\r
+;         LDY     #14\r
+;TRLLP    LDA     (GTEMP1),Y\r
+;         STA     CTRLDSP+9,Y\r
+;         DEY\r
+;         BPL     CTRLLP\r
+\r
+          LDA     ALTCTRLS\r
+          BEQ     ENDDSPOP\r
+          LDY     #14\r
+SHARELP   LDA     SHRTRCKB,Y\r
+          STA     CTRLDSP+9,Y\r
+          DEY\r
+          BPL     SHARELP\r
+ENDDSPOP  RTS\r
+\r
+\r
+******************************************\r
+* Fill a mushroom map randomly.\r
+* The top 2 lines of PF don't get any mushrooms, next 14 get one or two per row,\r
+* next 6 get 1 per row, last row gets none.\r
+* Starting address of mushroom map, +3*ZONELEN, assumed to be in (GTEMP+1,GTEMP)\r
+* MUSHCNT for current player gets count of mushrooms in infield (bottom N rows)\r
+******************************************\r
+LDSHROOM\r
+          LDA     #H(MUSHMAP+3*ZONELEN)\r
+          STA     GTEMP2\r
+          LDA     #L(MUSHMAP+3*ZONELEN)\r
+          STA     GTEMP1\r
+\r
+          LDA     #INFLDZN-4             ;First 9 lines, one or two mush. per\r
+          STA     NLOOPS                 ;line, no count\r
+RMLP1     LDX     #2\r
+          JSR     RNDMUSH\r
+          DEC     NLOOPS\r
+          BNE     RMLP1\r
+\r
+          LDA     #0                     ;PLAYER ALWAYS = 1 AT THIS POINT\r
+          STA     MUSHCNT                ;GOING INTO INFIELD, CLEAR MUSHCNT\r
+\r
+          LDA     #NZONES-6-INFLDZN      ;Next 5 lines, one or two per line but\r
+          STA     NLOOPS                 ;count\r
+RMLP2     LDX     #2\r
+          JSR     RNDMUSH\r
+          DEC     NLOOPS\r
+          BNE     RMLP2\r
+\r
+          LDA     #6                     ;Next 6 lines, one per row, count\r
+          STA     NLOOPS\r
+RMLP3     LDX     #1\r
+          JSR     RNDMUSH\r
+          DEC     NLOOPS\r
+          BNE     RMLP3\r
+\r
+          RTS\r
+\r
+******************************************\r
+* Place a mushroom randomly in a row; return 0 if mushroom was already there,\r
+* 1 if new mushroom was placed\r
+* On entering, (GTEMP1+1,GTEMP1) should contain starting address of row\r
+******************************************\r
+RNDMUSH   JSR     RANDOM                 ;Pick a random column between 1 and 32,\r
+          AND     #$1F\r
+          BEQ     ZNOMUSH\r
+          TAY\r
+          DEY                            ; then decrement onto line\r
+          LDA     (GTEMP1),Y             ;What's already there?\r
+          CMP     #L(EMPTY)\r
+          BNE     ZNOMUSH\r
+          LDA     #L(LIVE)               ;PUT IN MUSHROOM\r
+          STA     (GTEMP1),Y             ;RETURN TRUE (Z=1) IF NEW MUSHROOM\r
+          INC     MUSHCNT\r
+ZNOMUSH   DEX\r
+          BNE     RNDMUSH\r
+\r
+\r
+INCROW    LDA     GTEMP1\r
+          CLC\r
+          ADC     #ZONELEN\r
+          STA     GTEMP1\r
+          BCC     ZNR001\r
+          INC     GTEMP2\r
+ZNR001    RTS\r
+\r
+\r
+CLRMAPZN  LDA     MMAPTBLL,X\r
+          STA     GTEMP1\r
+          LDA     MMAPTBLH,X\r
+          STA     GTEMP2\r
+          LDY     #ZONELEN-1\r
+          LDA     #L(EMPTY)\r
+ZCLRZNLP  STA     (GTEMP1),Y\r
+          DEY\r
+          BPL     ZCLRZNLP\r
+          RTS\r
+\r
+\r
+***************************************************************************\r
+********  SUBROUTINE LOOSENDS\r
+********  HANDLE LOOSE ENDS (CHANGE WAVES AND PLAYERS, MAKE SHOOTERS AND\r
+********  CENTIPEDES, ETC.\r
+***************************************************************************\r
+\r
+LOOSENDS  LDA     SHTRTIMR\r
+          BNE     GOOP\r
+          LDA     DELAYSEG\r
+          BNE     SPDY\r
+          LDA     NUMSEG\r
+          BEQ     SPDY\r
+          LDA     #7\r
+          CMP     TUNNUM\r
+          BEQ     SPDY\r
+          CMP     TUNNUM1\r
+          BEQ     SPDY\r
+          JSR     TUNIN\r
+SPDY      BIT     SPDRSTAT\r
+          BPL     FLECK\r
+          LDA     SPDROFST\r
+          CMP     #L(POINT300)\r
+          BCS     FLECK\r
+          LDA     #1\r
+          CMP     TUNNUM\r
+          BEQ     FLECK\r
+          CMP     TUNNUM1\r
+          BEQ     FLECK\r
+          JSR     TUNIN\r
+FLECK     LDA     FLEAOFST\r
+          CMP     #L(EXPLOS)\r
+          BCS     GOOP\r
+          LDA     FLEASTAT\r
+          AND     #$C0\r
+          CMP     #$80\r
+          BNE     GOOP\r
+          LDA     #5\r
+          CMP     TUNNUM\r
+          BEQ     GOOP\r
+          CMP     TUNNUM1\r
+          BEQ     GOOP\r
+          JSR     TUNIN\r
+\r
+GOOP      LDA     NUMSEG\r
+          BEQ     SKPRTSS7\r
+ZSRTS1    RTS\r
+\r
+SKPRTSS7  BIT     ATTRACT\r
+          BPL     NRMLMKCN\r
+          LDA     #12\r
+          CLC\r
+          ADC     CLRINDEX\r
+          CMP     #TOPCOLOR\r
+          BNE     SKPRSTCL\r
+          LDA     #0\r
+SKPRSTCL  STA     CLRINDEX\r
+          LDA     #1\r
+          STA     COLORFLG\r
+          DEC     LETTRNUM\r
+          BMI     ATTROVER\r
+          JMP     NRML1234\r
+\r
+ATTROVER  JSR     HSATRACT\r
+          BMI     ZSRTS1                 ;RETURN IF BUTTON PRESSED IN HSC\r
+\r
+          LDA     #$40\r
+          STA     ATTRACT                ;CHANGE TO ATTRACT MODE GAME PLAY\r
+          LDA     #0\r
+          STA     ATGMTMR                ;COUNT FOR ENDING ATTRACT MODE GAME\r
+                                         ;BIT 7 OF ATGMTMR'S USED AS MOVEMENT\r
+                                         ;   FLAG IN JOYSTICK\r
+          LDA     #$80\r
+          STA     ATSITTMR               ;COUNT FOR SHOOTER TO SIT/MOVE\r
+          STA     ATGMTMR+1\r
+          LDA     #$40\r
+          STA     ATSITTMR+1\r
+          LDA     #-1\r
+          STA     ATTSHTRY               ;Y VECTOR FOR ATTRACT MODE SHOOTER\r
+          STA     ATTSHTRY+1\r
+\r
+          JSR     RANDOM\r
+          AND     #$01\r
+          BNE     SKPYDIR1\r
+          LDA     #-1\r
+SKPYDIR1  STA     ATTSHTRX               ;X VECTOR FOR ATTRACT MODE SHOOTER\r
+\r
+          JSR     RANDOM\r
+          AND     #$01\r
+          BNE     SKPYDIR2\r
+          LDA     #-1\r
+SKPYDIR2  STA     ATTSHTRX+1             ;X VECTOR FOR ATTRACT MODE SHOOTER\r
+\r
+          JMP     INITATGM\r
+\r
+NRMLMKCN  LDA     #7                     ;TURN OFF CENTIPEDE FEET SOUND\r
+          JSR     SCRAPONE\r
+\r
+          LDX     PLAYER                 ;ROTATE COLORS FOR NEXT CENTIEDE\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     ZNRMLMK1\r
+          LDX     #0\r
+ZNRMLMK1  LDA     CLRINDEX,X\r
+          CLC\r
+          ADC     #12\r
+          CMP     #TOPCOLOR\r
+          BNE     SKPCLRST\r
+          LDA     #0\r
+SKPCLRST  STA     CLRINDEX,X\r
+\r
+          LDA     #1                     ;SET FLAG TO CHANGE COLORS\r
+          STA     COLORFLG\r
+\r
+          LDA     FASTWAVE,X\r
+          BEQ     WVSPCHNG               ;IF NOT A FAST SPEED WAVE\r
+          DEC     CHAINSIZ,X             ;MAKE CENTIPEDE CHAIN ONE LINK SHORTER\r
+          BNE     SKPSGRST               ;IF CHAIN SIZE IS NOT TOO SMALL\r
+          LDA     MAXSGCNT\r
+          STA     CHAINSIZ,X             ;BACK TO FULL CENTIPEDE CHAIN\r
+\r
+SKPSGRST  LDY     PLAYER\r
+          LDA     GAMETYPE               ;USE CORRECT SCORE FOR GAME TO\r
+          CMP     #2                     ;   DETERMINE WHETHER TO HAVE FAST/SLOW\r
+          BCC     FASTSLOW               ;   CENTIPEDES\r
+          LDY     #2\r
+          CMP     #2\r
+          BNE     FASTSLOW\r
+          DEY\r
+          LDA     SCORE2+1\r
+          CMP     SCORE2\r
+          BCS     FASTSLOW\r
+          DEY\r
+\r
+FASTSLOW  LDA     SCORE2,Y\r
+          CMP     #4\r
+          LDA     #$10\r
+          BCS     WAVEFAST               ;IF SCORE IS >= 40,000\r
+WVSPCHNG  LDA     FASTWAVE,X\r
+          EOR     #$10\r
+WAVEFAST  STA     FASTWAVE,X             ;CHANGE SPEED OF THE NEXT WAVE\r
+NRML1234  JMP     MAKCENTI\r
+\r
+\r
+\r
+**************************************************************************\r
+********  SUBROUTINE DLSTINIT\r
+********  INITIALIZE DISPLAY LIST HEADERS TO POINT TO THE MUSHROOM MAP\r
+**************************************************************************\r
+\r
+DLSTINIT  LDX     #NZONES-2              ;MINUS 1 FOR INDEX, 1 FOR NO CHAR. MAP\r
+                                         ;   FOR LAST ROW\r
+NEXT      LDA     LDLTBL,X               ;ADDRESS OF DL FOR ZONE X\r
+          STA     GTEMP1\r
+          LDA     HDLTBL,X\r
+          STA     GTEMP2\r
+\r
+          LDY     #0                     ;WRITE HEADER\r
+          LDA     MMAPTBLL,X\r
+          STA     (GTEMP1),Y             ;STORE LOW ADDRESS\r
+\r
+          INY                            ;Y=1\r
+          LDA     #$60                   ;INDIRECT, 160X2 WRITE MODE\r
+          STA     (GTEMP1),Y\r
+\r
+          INY                            ;Y=2\r
+          LDA     MMAPTBLH,X\r
+          STA     (GTEMP1),Y             ;STORE HIGH ADDRESS\r
+\r
+          INY                            ;Y=3\r
+          LDA     #PALWIDTH\r
+          STA     (GTEMP1),Y             ;STORE PALETTE AND WIDTH\r
+\r
+          INY                            ;Y=4\r
+          LDA     #HORIZPOS\r
+          STA     (GTEMP1),Y             ;STORE HORIZONTAL POSITION\r
+\r
+          LDY     #6\r
+          LDA     #0                     ;END DL WITH 0 IN PALWIDTH\r
+          STA     (GTEMP1),Y\r
+          DEX\r
+          BNE     NEXT                   ;DO ALL ZONES EXCEPT SCORE -- ZONE 1\r
+\r
+          LDA     ATTRACT\r
+          BPL     SCOREDL\r
+\r
+******************************************\r
+* SET UP ATTRACT MODE DL'S\r
+******************************************\r
+MKATTRDL\r
+          LDX     #4                     ;BOTTOM HEADERS FOR LOGO DISPLAY LISTS\r
+NEXTATR   LDA     ATTRYBSE/8+LDLTBL,X\r
+          STA     GTEMP1\r
+          LDA     ATTRYBSE/8+HDLTBL,X\r
+          STA     GTEMP2\r
+\r
+          LDY     #0\r
+          LDA     LTITLGRP,X\r
+          STA     (GTEMP1),Y\r
+\r
+          INY\r
+          LDA     PWATTBL,X\r
+          STA     (GTEMP1),Y\r
+\r
+          INY\r
+          LDA     #H(TPG8LIN1)\r
+          STA     (GTEMP1),Y\r
+\r
+          INY\r
+          LDA     XPOSOFFS,X\r
+          CLC\r
+          ADC     #HORIZPOS\r
+          STA     (GTEMP1),Y\r
+\r
+          LDY     #5\r
+          LDA     #0\r
+          STA     (GTEMP1),Y\r
+\r
+SKPHDR2   DEX\r
+          BPL     NEXTATR\r
+\r
+\r
+;;;;;     LDA     #0\r
+          STA     DL1+1\r
+          LDA     SCRTIMER               ;IF NO PLAY FOR A WHILE, TURN SCORE OFF\r
+          BMI     NOSCRDL                ;DURING TITLE PAGE\r
+\r
+******************************************\r
+* SET UP SCORE ZONE DL'S\r
+******************************************\r
+SCOREDL   LDY     #33                    ;HIGH INDEX FOR GAME 3 SCORE DL\r
+          LDA     GAMETYPE\r
+          CMP     #3\r
+          BEQ     ZSCRDL\r
+          LDY     #16                    ;HIGH INDEX FOR GAME 0, 1, 2 SCORE DL\r
+\r
+ZSCRDL    LDX     #16\r
+SCRDLLP   LDA     DLSCR012,Y\r
+          STA     DL1,X\r
+          DEY\r
+          DEX\r
+          BPL     SCRDLLP\r
+NOSCRDL   RTS\r
+\r
+\r
+LTITLGRP  DB      L(TPG8LIN1),L(TPG8LIN2),L(TPG8LIN3),L(TPG8LIN4),L(TPG8LIN5)\r
+XPOSOFFS  DB      16,16,0,0,40\r
+PWATTBL   DB      $C5,$C5,$C2,$C5,PWCOPYRT\r
+\r
+DLSCR012  DB      L(MUSHMAP),$60,H(MUSHMAP),$14,HORIZPOS\r
+          DB      L(MUSHMAP+12),$60,H(MUSHMAP+12),$FA,12*4+HORIZPOS\r
+          DB      L(MUSHMAP+19),$60,H(MUSHMAP+19),$34,19*4+HORIZPOS,0,0\r
+\r
+DLSCR3    DB      L(MUSHMAP),$60,H(MUSHMAP),$1A,HORIZPOS\r
+          DB      L(MUSHMAP+9),$60,H(MUSHMAP+9),$F2,9*4+HORIZPOS\r
+          DB      L(MUSHMAP+25),$60,H(MUSHMAP+25),$3A,25*4+HORIZPOS,0,0\r
+\r
+\r
+\r
+***************************************************************************\r
+**********        SUBROUTINE  LOADPLWD    --    LOAD THE PALETTE/WIDTH TABLE\r
+***************************************************************************\r
+\r
+LOADPLWD\r
+          LDX     MAXSGCNT\r
+          DEX\r
+          BMI     ZNOCENTS               ;IF MAXSGCNT WAS ZERO\r
+\r
+          LDA     #PWCENTI               ;LOAD THE PAL/WD BYTES FOR CENTIPEDES\r
+ZLDPWCNT  STA     OBJPALWD,X\r
+          DEX\r
+          BPL     ZLDPWCNT\r
+\r
+ZNOCENTS  LDX     MAXSGCNT\r
+          LDA     #PWSPIDER              ;LOAD THE PAL/WD BYTE(S) FOR THE SPIDER\r
+ZLDPWSPI  STA     OBJPALWD,X\r
+          INX\r
+          CPX     #13\r
+          BNE     ZLDPWSPI\r
+\r
+          LDA     #PWSCORP\r
+          STA     OBJPALWD+13\r
+          LDA     #PWSHOOTR              ;LOAD THE PAL/WD BYTE FOR THE SHOOTER\r
+          STA     OBJPALWD+14\r
+          ORA     #$20\r
+          STA     OBJPALWD+15\r
+          LDA     #PWSHOT                ;LOAD THE PAL/WD BYTE FOR THE SHOT\r
+          STA     OBJPALWD+16\r
+          ORA     #$20\r
+          STA     OBJPALWD+17\r
+          RTS\r
+\r
+****************************************************************\r
+*         SET ATTRACT MODE DEPENDENT VARIABLES\r
+****************************************************************\r
+\r
+SETATVAR  LDA     ATTRACT\r
+          BMI     ATTRVAR\r
+\r
+          LDA     #MAXX-5\r
+          STA     CENTRGHT\r
+          LDA     #MINX+2\r
+          STA     CENTLEFT\r
+\r
+          LDA     #0\r
+          STA     SCRLONZN\r
+          STA     TOPLINE\r
+          LDA     #8\r
+          STA     MINIMUMY\r
+          RTS\r
+\r
+\r
+ATTRVAR   LDA     #MAXX-6\r
+          STA     CENTRGHT\r
+          LDA     #MINX+3\r
+          STA     CENTLEFT\r
+\r
+          LDA     #ATTRYBSE-8\r
+          STA     TOPLINE\r
+          LDA     #ATTRYBSE\r
+          STA     MINIMUMY\r
+          LDA     #ATTRYBSE/8-1\r
+          STA     SCRLONZN\r
+          RTS\r
+\r
+\r
+\r
+RANDOM    LDA     FRMCNT\r
+RANDOM2   ADC     RNDM\r
+          ADC     RNDM+1\r
+          LDY     RNDM\r
+          STY     RNDM+1\r
+          STA     RNDM\r
+          RTS\r
+\r
+\r
+******************************************\r
+* CHECK WHETHER WE'RE ABOUT TO MEET AN OBSTACLE (MUSHROOM)\r
+* ENTERED WITH    ACC. = VERT. POS. OF MOVING OBJECT\r
+*                 GTEMP1 = HORIZ. POSITION\r
+* RETURNS WITH PLAYFIELD ADDRESS IN (GTEMP4,GTEMP3), CONTENTS OF ADDRESS IN ACC.\r
+******************************************\r
+OBSTAC    LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          BPL     OBBOTH                 ;ALWAYS\r
+\r
+COBSTAC   LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          ADC     #0\r
+OBBOTH    CMP     #23\r
+          BEQ     OFFROWZZ\r
+          TAY\r
+          LDA     GTEMP1                 ; (X/4) - 4  , SAME AS (X-16)/4\r
+          LSR     A\r
+          LSR     A\r
+          SEC\r
+          SBC     #MINX/4                ;SUBTRACTING 4, LEAVING CARRY SET\r
+          BMI     OFFROWZZ\r
+          CMP     #$1F\r
+          BCC     OBSTAC2\r
+OFFROWZZ  LDA     #0                     ;SET Z FLAG\r
+          RTS\r
+\r
+* ENTRY POINT FROM RESTORE ROUTINE, COLUMN IN ACC., ROW IN Y\r
+OBSTAC2   CLC\r
+          ADC     MMAPTBLL,Y\r
+          STA     GTEMP3\r
+          LDA     MMAPTBLH,Y             ;INCREMENT HIGH BYTE IF NECESSARY\r
+          ADC     #0\r
+          STA     GTEMP4\r
+          LDY     #0\r
+          LDA     (GTEMP3),Y\r
+          CMP     #L(EMPTY)\r
+          RTS\r
+\r
+\r
+\r
+******************************************\r
+* ADD A MUSHROOM TO PLAYFIELD IF NOT ON LAST ROW\r
+* COUNT IF MUSHROOM ADDED TO INFIELD\r
+* ENTERED WITH    ACC. = VERT. POS. OF OBJECT IN QUESTION\r
+*                 (GTEMP4,GTEMP3) POINTING TO PLAYFIELD ADDRESS IN QUESTION\r
+******************************************\r
+MUSHER    LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          BPL     MUBOTH                 ;ALWAYS\r
+\r
+CMUSHER   LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          ADC     #0\r
+MUBOTH    BEQ     NOM001\r
+MUSHER1   CMP     #23\r
+          BEQ     NOM001\r
+          CMP     #INFLDZN-1\r
+          BCC     NEWM001\r
+\r
+          LDX     PLAYER\r
+          LDA     GAMETYPE\r
+          CMP     #1\r
+          BEQ     INCMUSHC\r
+          LDX     #0                     ;USE ONLY MUSHCNT, NOT MUSHCNT+1, IN\r
+                                         ;   DUAL PLAYER GAMES\r
+INCMUSHC  INC     MUSHCNT,X\r
+NEWM001   LDY     #0\r
+          LDA     #L(LIVE)\r
+          STA     (GTEMP3),Y\r
+NOM001    RTS\r
+\r
+\r
+\r
+******************************************\r
+* RESTORE MUSHROOMS AFTER PLAYER DIES    *\r
+*    FLAGS BIT 6 1=DO RESTORATION        *\r
+*    ROW COUNTER IN GTEMP5               *\r
+*    COLUMN COUNTER IN GTEMP6            *\r
+******************************************\r
+RESTOR    BIT     FLAGS\r
+          BVC     NOM001\r
+\r
+          LDA     FRMCNT\r
+          AND     #$07\r
+          BNE     NOM001\r
+\r
+          LDX     PLAYER\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     RSTRNEXT               ;NOT A DUAL PLAYER GAME\r
+\r
+          LDX     #1                     ;ASSUME PLAYER 1 DIED\r
+          LDA     SHTRSTAT+1\r
+          BNE     RSTRNEXT               ;YES -- PLAYER 2 DIDN'T DIE\r
+\r
+          LDA     SHTRSTAT               ;PLAYER 2 DID DIE\r
+          BNE     DRSTR2                 ;   BUT PLAYER 1 DIDN'T\r
+\r
+          LDA     FRMCNT                 ;BOTH PLAYERS DIED -- TRADE OFF WHO\r
+          AND     #$08                   ;   GETS POINTS\r
+          BEQ     RSTRNEXT\r
+DRSTR2    DEX\r
+\r
+* START LOOP\r
+RSTRNEXT  LDA     GTEMP5                 ;INCREMENT TO NEXT MUSHROOM\r
+          CLC\r
+          ADC     #1\r
+          CMP     #NZONES-1\r
+          BCC     ROWRSTR\r
+          INC     GTEMP6\r
+          LDA     #1\r
+ROWRSTR   STA     GTEMP5\r
+\r
+          TAY                            ;GET ROW\r
+          LDA     GTEMP6                 ;COL IN A, ROW IN Y FOR OBSTAC2\r
+          CMP     #ZONELEN\r
+          BCS     DONERSTR\r
+\r
+          JSR     OBSTAC2                ;GET CONTENTS OF MUSHROOM SLOT\r
+          CMP     #L(EMPTY+1)\r
+          BCC     RSTRNEXT\r
+          CMP     #L(POISONED+1)\r
+          BCS     RSTRNEXT\r
+          CMP     #L(LIVE)\r
+          BEQ     RSTRNEXT\r
+\r
+          LDA     #L(LIVE)\r
+          STA     (GTEMP3),Y\r
+          LDA     #2\r
+          JSR     SCRAPONE\r
+          LDA     #2\r
+          JSR     TUNIN\r
+\r
+          LDA     #5\r
+;         LDY     #0\r
+          JSR     ADDSCORE\r
+\r
+*PUT IN AN OBJECT EXPLOSION HERE\r
+          LDX     #14\r
+          LDA     SHTRSTAT\r
+          BEQ     USESHTR1\r
+          INX\r
+\r
+USESHTR1  LDA     #L(EXPLOS)\r
+          STA     OBJOFFST,X\r
+\r
+          LDA     GTEMP6\r
+          ASL     A\r
+          ASL     A\r
+;         CLC\r
+          ADC     #MINX\r
+          STA     OBJX,X\r
+\r
+          LDA     GTEMP5\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          STA     OBJY,X\r
+\r
+          LDA     #$80\r
+          STA     OBJSTAT,X\r
+RSTROK    RTS\r
+\r
+DONERSTR  LDA     FLAGS                  ;CLEAR MUSHROOM RESTORATION FLAG,\r
+          AND     #$BF                   ;   ALLOWING GAME TO CONTINUE\r
+          STA     FLAGS\r
+\r
+COMPOVER  LDA     GAMETYPE               ;DUAL PLAYER COMPETITION GAME?\r
+          CMP     #2\r
+          BNE     RSTROK                 ;NO\r
+\r
+          LDA     FLAGS                  ;EITHER PLAYER DEAD?\r
+          BPL     RSTROK                 ;NO\r
+\r
+          LDX     #0                     ;DEAD PLAYER'S SCORE >= LIVE PLAYER'S?\r
+          BIT     SHTRSTAT+1\r
+          BVC     HGHRYET\r
+          INX\r
+HGHRYET   JSR     CMPSCORE\r
+          BCS     RSTROK                 ;YES\r
+          LDA     #0                     ;NO, LIVE PLAYER AHEAD, AND WE HAVE A\r
+          STA     MENLEFT,Y              ;   DEFINITE WINNER\r
+          LDA     #15\r
+          STA     SHTRTIMR\r
+          RTS\r
+\r
+\r
+* ADD TO SCORE\r
+*         ENTERED WITH (A) = SCORE TO ADD TO TENS, ONES DIGITS\r
+*                      (Y) = SCORE TO ADD TO HUNDREDS, THOUSANDS\r
+*                      (X) = WHICH PLAYER GETS THE POINTS\r
+ADDSCORE  BIT     ATTRACT\r
+          BVS     RSTROK\r
+          SED\r
+          PHA\r
+          LDA     GAMETYPE\r
+          CMP     #3\r
+          BNE     ZADD1\r
+\r
+          PLA                            ;IN TWO PLAYER TEAM PLAY MODE,\r
+          PHA                            ;   ADD TO INDIVIDUAL PLAYER'S SCORE\r
+          CLC                            ;   FIRST, THEN DOWN BELOW ADD TO TEAM\r
+          ADC     SCORE0,X               ;   SCORE\r
+          STA     SCORE0,X               ;NO BONUSES OR ANYTHING ARE BASED ON\r
+          TYA                            ;   THE INDIVIDUAL SCORE\r
+          ADC     SCORE1,X\r
+          STA     SCORE1,X\r
+          BCC     TEAMADD\r
+          LDA     SCORE2,X\r
+          ADC     #0\r
+          STA     SCORE2,X\r
+TEAMADD   LDX     #2                     ;TEAM SCORE INDEX\r
+\r
+ZADD1     PLA\r
+          CLC\r
+          ADC     SCORE0,X\r
+          STA     SCORE0,X\r
+          TYA\r
+          ADC     SCORE1,X\r
+          STA     SCORE1,X\r
+          BCC     BONUSCHK\r
+          TXA\r
+          TAY\r
+          CPY     #2\r
+          BCC     NHDPLYR\r
+          LDY     #0\r
+NHDPLYR   LDA     NHDCOUNT,Y             ;CHANGE SPEED AT WHICH HEADS COME OUT\r
+          SEC\r
+          SBC     #2                     ;   YES -- DECIMAL MODE\r
+          CMP     #4\r
+          BCS     SKPNHRST               ;IF NEW HEAD TIMER IS ABOVE MINIMUM\r
+          LDA     #$C0\r
+SKPNHRST  STA     NHDCOUNT,Y             ;BACK TO ITS SLOWEST RATE. WHEW!!\r
+          LDA     SCORE2,X               ;NEED TO DO THIS DUE TO DECIMAL MODE\r
+          CLC\r
+          ADC     #1\r
+          STA     SCORE2,X\r
+          BCC     BONUSCHK\r
+          LDA     SCORE3,X\r
+          CLC\r
+          ADC     #1\r
+          STA     SCORE3,X\r
+\r
+BONUSCHK  CLD                            ;CHECK FOR BONUS\r
+          LDA     GAMETYPE\r
+          CMP     #3\r
+          BNE     ZBONUSCH\r
+          LDX     #0\r
+          LDA     SCORE1+2\r
+          CMP     BONUSL\r
+          LDA     SCORE2+2\r
+          JMP     ZBONUSZ\r
+\r
+ZBONUSCH  LDA     SCORE1,X\r
+          CMP     BONUSL,X\r
+          LDA     SCORE2,X\r
+ZBONUSZ   SBC     BONUSM,X\r
+          BCC     NOBONUS\r
+\r
+          CMP     #$90\r
+          BCS     NOBONUS\r
+\r
+          SED                            ;YES, GOT A BONUS--SET NEXT BONUS VALUE\r
+          LDA     #$20                   ;   (ONE EVERY 12,000 POINTS, NOW)\r
+;;;;      CLC\r
+          ADC     BONUSL,X\r
+          STA     BONUSL,X\r
+          LDA     #1\r
+          ADC     BONUSM,X\r
+          STA     BONUSM,X\r
+          CLD\r
+\r
+          LDA     MENLEFT,X              ;ADD A LIFE, IF POSSIBLE\r
+          CMP     #6\r
+          BCS     NOBONUS\r
+\r
+          LDY     GAMETYPE\r
+          CPY     #3\r
+          BNE     NORESMAN\r
+          BIT     FLAGS                  ;DURING MUSHROOM RESTORATION, JUST ADD\r
+          BVS     NORESMAN               ;   MAN TO TOTAL\r
+          LDA     SHTRSTAT               ;IN TEAM PLAY, IF ONLY ONE PLAYER ALIVE\r
+          AND     SHTRSTAT+1             ;   RES THE OTHER ONE IN\r
+          BPL     RESMAN\r
+\r
+NORESMAN  LDA     SHTRSTAT,X             ;ONCE HE'S DEAD IN NON-TEAM PLAY, DON'T\r
+          AND     #$40                   ;   EVER BRING HIM BACK\r
+          BNE     NOBONUS\r
+\r
+          LDA     MENLEFT,X\r
+          CLC\r
+          ADC     #1\r
+          STA     MENLEFT,X\r
+\r
+          CPX     #0\r
+          BEQ     ADDLIFE1\r
+\r
+ADDLIFE2  EOR     #$FF\r
+          CLC\r
+          ADC     #21\r
+ADDLIFE1 ;LDY     GAMETYPE\r
+          CPY     #3\r
+          BNE     ADD1\r
+          CLC\r
+          ADC     #TEAMMEN-6\r
+ADD1      TAY\r
+          LDA     #L(ELF320)\r
+          STA     MUSHMAP+6-1,Y\r
+\r
+MANSOUND  LDA     #6                     ;TURN ON EXTRA MAN SOUND\r
+          JSR     TUNIN\r
+\r
+NOBONUS   BIT     FLAGS\r
+          BVS     ENDBONUS\r
+          JMP     COMPOVER\r
+ENDBONUS  RTS\r
+\r
+\r
+\r
+\r
+RESMAN                                   ;RES A MAN INTO PLAY, TEAM PLAY\r
+          LDX     #0\r
+          LDA     SHTRSTAT\r
+          BPL     RESBACK\r
+          LDX     #1\r
+RESBACK   LDA     FLAGS\r
+          AND     #$7F\r
+          STA     FLAGS\r
+          LDA     #CNTRCLMN\r
+          STA     SHOOTERX,X\r
+          LDA     #CNTRCLMN+2\r
+          STA     SHOTX,X\r
+          LDY     #184\r
+          STY     SHOOTERY,X\r
+          DEY\r
+          STY     SHOTY,X\r
+          LDA     #L(ELF)\r
+          CPX     #0\r
+          BEQ     RESELF\r
+          LDA     #L(ELFB)\r
+RESELF    STA     SHTROFST,X\r
+          LDA     #$90                   ;TURN HIM BACK ON, RES HIM IN\r
+RESFRONT  STA     SHTRSTAT,X\r
+          JMP     MANSOUND\r
+\r
+SCALE     CLC\r
+          BPL     NOTNEG\r
+          EOR     #$FF\r
+          ADC     #2                     ;TWOS COMP AND ADD 1\r
+          LSR     A                      ;DIVIDED BY 2\r
+          CMP     #$3\r
+          BCC     OKDOKEY\r
+          LDA     #$3\r
+OKDOKEY\r
+          EOR     #$FF                   ;RENEGE\r
+          CLC\r
+          ADC     #1\r
+          RTS                            ;SCALED VALUE IN ACC\r
+NOTNEG\r
+          ADC     #1\r
+          LSR     A\r
+          CMP     #$3\r
+          BCC     RETUX\r
+          LDA     #$3\r
+RETUX     RTS\r
+\r
+\r
+\r
+CLRTRACK  LDX     #$06                   ;CLEAR OUT ALL TBALL STUFF\r
+          LDA     #$00\r
+TLOOPY    STA     DELTAY,X\r
+          DEX\r
+          BPL     TLOOPY\r
+          STX     BUTNIB\r
+          STX     BUTNIB+1\r
+          STX     SCHTICK\r
+          LDA     YCOUNT\r
+          STA     OLDY\r
+          LDA     YCOUNT1\r
+          STA     OLDY1\r
+          LDA     XCOUNT\r
+          STA     OLDX\r
+          LDA     XCOUNT1\r
+          STA     OLDX1\r
+          RTS\r
+\r
diff --git a/CSTAMPS.S b/CSTAMPS.S
new file mode 100644 (file)
index 0000000..44f8396
--- /dev/null
+++ b/CSTAMPS.S
@@ -0,0 +1,746 @@
+** GLOBAL.S **\r
+          GLBL    ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE\r
+          GLBL    HDLTBL,LDLTBL,COLORTBL,MMAPTBLH,MMAPTBLL,BITTABLE\r
+          GLBL    EMPTY,QDYING,HDYING,TDYING\r
+          GLBL    QLIVE,HLIVE,TLIVE,LIVE\r
+          GLBL    TGROWN,HGROWN,QGROWN,FLOWER\r
+          GLBL    QPOIS,HPOIS,TPOIS,POISONED\r
+          GLBL    SAMPLE\r
+          GLBL    STMPBASE\r
+          GLBL    DISPLAY\r
+          GLBL    ELF,ELFB,ELFWSHOT,ELF320\r
+          GLBL    FLEA,LSCRP,RSCRP,EXPLOS,SPIDER\r
+          GLBL    POINT300,POINT600,POINT900\r
+          GLBL    SHOT\r
+          GLBL    BLACKL,BLACKR\r
+          GLBL    A,B,C,D,E,G,H,I,K,L,M,N,O,P,R,S,T,U,V,W,X,Y\r
+          GLBL    DGT1,DGT2\r
+\r
+          GLBL    TOV,BLANKOFF,ZONE2\r
+          GLBL    TPG8LIN1,TPG8LIN2,TPG8LIN3,TPG8LIN4,TPG8LIN5\r
+          GLBL    TPG8CVR1,TPG8CVR2,TPG8CVR3,TPG8CVR4\r
+\r
+*** CSTAMPS.S ***\r
+\r
+STADDR    EQU     $B900\r
+*******************       LINE 8         ***************************************\r
+          ORG     STADDR+$700\r
+STMPBASE\r
+ZERO      DB      $00                    ;00\r
+ONE       DB      $00                    ;01\r
+TWO       DB      $00                    ;02\r
+THREE     DB      $00                    ;03\r
+FOUR      DB      $00                    ;04\r
+FIVE      DB      $00                    ;05\r
+SIX       DB      $00                    ;06\r
+SEVEN     DB      $00                    ;07\r
+EIGHT     DB      $00                    ;08\r
+NINE      DB      $00                    ;09\r
+A         DB      $00                    ;0A\r
+;;;;;B         DB      $00                    ;0B    LOOK AT $41\r
+C         DB      $00                    ;0B\r
+D         DB      $00                    ;0C\r
+E         DB      $00                    ;0D\r
+;;;;;F         DB      $00                    ;0F\r
+G         DB      $00                    ;0E\r
+H         DB      $00                    ;0F\r
+I         DB      $00                    ;10\r
+;;;;;J         DB      $00                    ;13\r
+K         DB      $00                    ;14\r
+L         DB      $00                    ;11\r
+M         DB      $00                    ;12\r
+N         DB      $00                    ;13\r
+O         DB      $00                    ;14\r
+P         DB      $00                    ;15\r
+;;;;;Q         DB      $00                    ;1A\r
+R         DB      $00                    ;16\r
+S         DB      $00                    ;17\r
+T         DB      $00                    ;18\r
+U         DB      $00                    ;19\r
+V         DB      $00                    ;1A\r
+W         DB      $00                    ;1B\r
+X         DB      $00                    ;1C\r
+Y         DB      $00                    ;1D\r
+;;;;;Z         DB      $00                    ;23\r
+DGT1      DB      $00                    ;1E\r
+DGT2      DB      $00                    ;1F\r
+BLACKR    DB      $D5                    ;20\r
+BLACKL    DB      $55,$57            ;21,22,23\r
+\r
+SPIDER    DB      $C3,$30,$C0            ;26\r
+          DB      $00,$C0,$00            ;29\r
+          DB      $CB,$33,$80            ;2C\r
+          DB      $B0,$C0,$C0            ;2F\r
+\r
+LSCRP     DB      $49,$10\r
+          DB      $49,$10\r
+          DB      $49,$10\r
+          DB      $49,$10\r
+RSCRP     DB      $04,$61\r
+          DB      $04,$61\r
+          DB      $04,$61\r
+          DB      $04,$61                ;3F\r
+\r
+          ORG     STADDR+$740\r
+EMPTY     DB      $00                    ;$XX00\r
+B         DB      $00\r
+          DB      $00                    ;FREE\r
+;LFWSHOT  DB      $2A,$00\r
+ELF320    DB      $00                    ;88\r
+\r
+QLIVE     DB      $00                    $XX04\r
+HLIVE     DB      $00\r
+TLIVE     DB      $00\r
+LIVE      DB      $00\r
+\r
+ELF       DB      $2A,$00                ;39\r
+ELFB      DB      $2A,$00                ;3B\r
+\r
+QPOIS     DB      $00                    $XX0C\r
+HPOIS     DB      $00\r
+TPOIS     DB      $00\r
+POISONED  DB      $00\r
+\r
+          ORG     STADDR+$750\r
+* CENTIPEDE GRAPHICS\r
+CENTBOD8  DB     $18,$04,$18,$48,$24,$10,$24,$21,$69,$32,$28,$88,$69,$8C,$28,$22\r
+CENTHED8  DB     $18,$04,$18,$48,$24,$10,$24,$21,$69,$30,$00,$08,$69,$0C,$00,$20\r
+\r
+LSCRP11   DB      $05,$40                ;70,71\r
+          DB      $01,$50\r
+          DB      $00,$54\r
+          DB      $05,$41\r
+RSCRP11   DB      $01,$50\r
+          DB      $05,$40\r
+          DB      $15,$00\r
+          DB      $41,$50                ;7F\r
+\r
+FLEA      DB      $00,$00,$00,$00,$00,$80,$08,$00        ;87\r
+\r
+SHOT      DB      $40                    ;88\r
+\r
+POINT300  DB      $00,$00,$00            ;8B\r
+POINT600  DB      $00,$00,$00            ;8E\r
+POINT900  DB      $00,$00,$00            ;91\r
+\r
+EXPLOS    DB      $3C,0,$00,0,$00,0      ;97\r
+\r
+*******************       LINE 7         ***************************************\r
+          ORG     STADDR+$800\r
+NUMBERS7  DB      $38,$7E,$FE,$7C,$0C,$78,$38,$30,$38,$78  ;EDITOR FONT\r
+;;;;;NUMBERS7  DB      $38,$7C,$7E,$7C,$04,$7C,$7C,$40,$7C,$78\r
+LETTERS7  DB      $11,$15,$14,$15        ;ACDE\r
+          DB      $15,$11,$15,$11        ;GHIK\r
+          DB      $15,$11,$11,$15        ;LMNO\r
+          DB      $10,$11,$15,$04        ;PRST\r
+          DB      $15,$04,$11,$11,$04    ;UVWXY\r
+          DB      $15,$15                ;DGT1,DGT2\r
+BLACK7R   DB      $D5\r
+BLACKL7   DB      $55,$57\r
+\r
+SPIDER7   DB      $C1,$50,$C0\r
+          DB      $C1,$50,$C0\r
+          DB      $C3,$30,$C0\r
+          DB      $C1,$50,$C0\r
+\r
+LSCRP2    DB      $85,$10\r
+          DB      $45,$20\r
+          DB      $85,$10\r
+          DB      $45,$20\r
+RSCRP2    DB      $04,$52\r
+          DB      $08,$51\r
+          DB      $04,$52\r
+          DB      $08,$51\r
+\r
+          ORG     STADDR+$840\r
+EMPTY7    DB      $00                    ;$XX00\r
+B7        DB      $14\r
+          DB      $00                    ;FREE\r
+;LFWSH7   DB      $2A,$00\r
+ELF3207   DB      $3E\r
+\r
+QLIVE7    DB      $00                    $XX04\r
+HLIVE7    DB      $00\r
+TLIVE7    DB      $00\r
+LIVE7     DB      $2C\r
+\r
+ELF7      DB      $2A,$00\r
+ELFB7     DB      $AA,$80\r
+\r
+QPOIS7    DB      $00                    $XX0C\r
+HPOIS7    DB      $00\r
+TPOIS7    DB      $00\r
+POISON7   DB      $14\r
+\r
+          ORG     STADDR+$850\r
+CENTBOD7  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$3C,$F8,$AA,$2A,$3C,$2F,$AA,$A8\r
+CENTHED7  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$3C,$F9,$28,$6A,$3C,$6F,$28,$A9\r
+\r
+LSCRP10   DB      $15,$54\r
+          DB      $05,$54\r
+          DB      $01,$55\r
+          DB      $15,$51\r
+RSCRP10   DB      $15,$54\r
+          DB      $15,$50\r
+          DB      $55,$40\r
+          DB      $45,$54\r
+\r
+FLEA7     DB      $28,$80,$A2,$80,$22,$80,$08,$80\r
+\r
+SHOT7     DB      $40\r
+\r
+POINT30A  DB      $00,$00,$00\r
+POINT60A  DB      $00,$00,$00\r
+POINT90A  DB      $00,$00,$00\r
+\r
+EXPLOS7   DB      $DD,0,$CD,0,$00,0\r
+\r
+*******************       LINE 6         ***************************************\r
+          ORG     STADDR+$900\r
+NUMBERS6  DB      $6C,$18,$C0,$CE,$0C,$EE,$EE,$30,$EE,$0C   ;EDITOR FONT\r
+;;;;;NUMBERS6  DB      $44,$10,$80,$82,$04,$82,$82,$20,$82,$04\r
+LETTERS6  DB      $11,$10,$11,$10        ;ACDE\r
+          DB      $11,$11,$04,$14        ;GHIK\r
+          DB      $10,$11,$11,$11        ;LMNO\r
+          DB      $10,$14,$01,$04        ;PRST\r
+          DB      $11,$04,$15,$11,$04    ;UVWXY\r
+          DB      $04,$10                ;DGT1,DGT2\r
+BLACK6R   DB      $D5\r
+BLACKL6   DB      $55,$57\r
+\r
+SPIDER6   DB      $FE,$6F,$C0\r
+          DB      $C2,$60,$C0\r
+          DB      $F1,$53,$C0\r
+          DB      $F2,$63,$C0\r
+\r
+LSCRP1    DB      $00,$20\r
+          DB      $80,$00\r
+          DB      $00,$20\r
+          DB      $80,$00\r
+RSCRP1    DB      $08,$00\r
+          DB      $00,$02\r
+          DB      $08,$00\r
+          DB      $00,$02\r
+\r
+          ORG     STADDR+$940\r
+EMPTY6    DB      $00                    ;$XX00\r
+B6        DB      $11\r
+          DB      $00                    ;FREE\r
+;LFWSH6   DB      $AA,$80\r
+ELF3206   DB      $3E\r
+\r
+QLIVE6    DB      $00                    $XX04\r
+HLIVE6    DB      $00\r
+TLIVE6    DB      $00\r
+LIVE6     DB      $2C\r
+\r
+ELF6      DB      $AA,$80\r
+ELFB6     DB      $AA,$80\r
+\r
+QPOIS6    DB      $00                    $XX0C\r
+HPOIS6    DB      $00\r
+TPOIS6    DB      $00\r
+POISON6   DB      $14\r
+\r
+          ORG     STADDR+$950\r
+CENTBOD6  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$E8,$AA,$2A,$AA,$2B,$AA,$A8\r
+CENTHED6  DB     $EE,$E6,$EE,$E6,$BB,$9B,$BB,$9B,$AA,$E8,$AA,$2A,$AA,$2B,$AA,$A8\r
+\r
+LSCRP9    DB      $14,$04\r
+          DB      $05,$05\r
+          DB      $05,$41\r
+          DB      $14,$1D\r
+RSCRP9    DB      $10,$14\r
+          DB      $50,$50\r
+          DB      $41,$50\r
+          DB      $74,$14\r
+\r
+FLEA6     DB      $3A,$80,$2A,$00,$2A,$00,$3A,$80\r
+\r
+SHOT6     DB      $40\r
+\r
+POINT30B  DB      $54,$54,$54\r
+POINT60B  DB      $54,$54,$54\r
+POINT90B  DB      $54,$54,$54\r
+\r
+EXPLOS6   DB      $DF,0,$FD,0,$1F,0\r
+\r
+*******************       LINE 5         ***************************************\r
+          ORG     STADDR+$A00\r
+NUMBERS5  DB      $C6,$18,$60,$04,$FE,$02,$C6,$30,$EE,$06   ;EDITOR FONT\r
+;;;;;NUMBERS5  DB      $82,$10,$40,$02,$FE,$02,$82,$10,$82,$02\r
+LETTERS5  DB      $15,$10,$11,$15        ;ACDE\r
+          DB      $11,$15,$04,$10        ;GHIK\r
+          DB      $10,$11,$15,$11        ;LMNO\r
+          DB      $15,$15,$15,$04        ;PRST\r
+          DB      $11,$11,$11,$04,$04    ;UVWXY\r
+          DB      $04,$15                ;DGT1,DGT2\r
+BLACK5R   DB      $D5\r
+BLACKL5   DB      $55,$57\r
+\r
+SPIDER5   DB      $01,$50,$00\r
+          DB      $FD,$5F,$C0\r
+          DB      $3E,$6F,$00\r
+          DB      $3D,$5F,$00\r
+\r
+          DB      0,0,0,0,0,0,0,0        ;SCORPION TOP ZONE\r
+          DB      0,0,0,0,0,0,0,0\r
+\r
+          ORG     STADDR+$A40\r
+EMPTY5    DB      $00                    ;$XX00\r
+B5        DB      $14\r
+          DB      $00                    ;FREE\r
+;LFWSH5   DB      $AA,$80\r
+ELF3205   DB      $7F\r
+\r
+QLIVE5    DB      $00                    $XX04\r
+HLIVE5    DB      $00\r
+TLIVE5    DB      $20\r
+LIVE5     DB      $2C\r
+\r
+ELF5      DB      $AA,$80\r
+ELFB5     DB      $BB,$80\r
+\r
+QPOIS5    DB      $00                    $XX0C\r
+HPOIS5    DB      $00\r
+TPOIS5    DB      $00\r
+POISON5   DB      $14\r
+\r
+          ORG     STADDR+$A50\r
+CENTBOD5  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$EA,$AA,$EA,$AA,$AB,$AA,$AB\r
+CENTHED5  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$EA,$69,$EA,$AA,$AB,$69,$AB\r
+\r
+LSCRP8    DB      $14,$05\r
+          DB      $05,$01\r
+          DB      $05,$11\r
+          DB      $05,$15\r
+RSCRP8    DB      $50,$54\r
+          DB      $40,$50\r
+          DB      $44,$50\r
+          DB      $54,$50\r
+\r
+FLEA5     DB      $3D,$C0,$3D,$C0,$3D,$C0,$3D,$C0\r
+\r
+SHOT5     DB      $40\r
+\r
+POINT30C  DB      $04,$44,$44\r
+POINT60C  DB      $44,$44,$44\r
+POINT90C  DB      $04,$44,$44\r
+\r
+EXPLOS5   DB      $FE,0,$4C,0,$0F,0\r
+\r
+*******************       LINE 4         ***************************************\r
+          ORG     STADDR+$B00\r
+NUMBERS4  DB      $C6,$18,$38,$38,$CC,$0E,$DC,$18,$38,$76   ;EDITOR FONT\r
+;;;;;NUMBERS4  DB      $82,$10,$3C,$1C,$44,$02,$BC,$08,$7C,$7A\r
+LETTERS4  DB      $11,$10,$11,$10        ;ACDE\r
+          DB      $10,$11,$04,$14        ;GHIK\r
+          DB      $10,$15,$15,$11        ;LMNO\r
+          DB      $11,$11,$10,$04        ;PRST\r
+          DB      $11,$11,$11,$11,$11    ;UVWXY\r
+          DB      $14,$01                ;DGT1,DGT2\r
+BLACK4R   DB      $D5\r
+BLACKL4   DB      $55,$57\r
+\r
+SPIDER4   DB      $C1,$50,$C0\r
+          DB      $31,$53,$00\r
+          DB      $01,$50,$C0\r
+          DB      $C1,$50,$00\r
+\r
+          DB      0,0,0,0,0,0,0,0        ;SCORPION TOP ZONE\r
+          DB      0,0,0,0,0,0,0,0\r
+\r
+          ORG     STADDR+$B40\r
+EMPTY4    DB      $00                    ;$XX00\r
+B4        DB      $11\r
+          DB      $00                    ;FREE\r
+;LFWSH4   DB      $BB,$80\r
+ELF3204   DB      $49\r
+\r
+QLIVE4    DB      $00                    $XX04\r
+HLIVE4    DB      $80\r
+TLIVE4    DB      $B3\r
+LIVE4     DB      $BF\r
+\r
+ELF4      DB      $BB,$80\r
+ELFB4     DB      $2A,$00\r
+\r
+QPOIS4    DB      $00                    $XX0C\r
+HPOIS4    DB      $00\r
+TPOIS4    DB      $7F\r
+POISON4   DB      $7F\r
+\r
+          ORG     STADDR+$B50\r
+CENTBOD4  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$EA,$AA,$EA,$AA,$AB,$AA,$AB\r
+CENTHED4  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$69,$EA,$AA,$EA,$69,$AB,$AA,$EA\r
+\r
+LSCRP7    DB      $05,$01\r
+          DB      $05,$01\r
+          DB      $05,$1D\r
+          DB      $05,$00\r
+RSCRP7    DB      $40,$50\r
+          DB      $40,$50\r
+          DB      $74,$50\r
+          DB      $00,$50\r
+\r
+FLEA4     DB      $F5,$40,$F5,$40,$F5,$40,$F5,$40\r
+\r
+SHOT4     DB      $40\r
+\r
+POINT30D  DB      $14,$44,$44\r
+POINT60D  DB      $54,$44,$44\r
+POINT90D  DB      $54,$44,$44\r
+\r
+EXPLOS4   DB      $4D,0,$EF,0,$1C,0\r
+\r
+*******************       LINE 3         ***************************************\r
+          ORG     STADDR+$C00\r
+NUMBERS3  DB      $C6,$18,$0C,$04,$6C,$F8,$C0,$0C,$EE,$C6   ;EDITOR FONT\r
+;;;;;NUMBERS3  DB      $82,$10,$02,$08,$24,$FC,$80,$04,$82,$82\r
+LETTERS3  DB      $15,$15,$14,$15        ;ACDE\r
+          DB      $15,$11,$15,$11        ;GHIK\r
+          DB      $10,$11,$11,$15        ;LMNO\r
+          DB      $15,$15,$15,$15        ;PRST\r
+          DB      $11,$11,$11,$11,$11    ;UVWXY\r
+          DB      $04,$15                ;DGT1,DGT2\r
+BLACK3R   DB      $D5\r
+BLACKL3   DB      $55,$57\r
+\r
+SPIDER3   DB      $C1,$50,$C0\r
+          DB      $C2,$60,$C0\r
+          DB      $C1,$53,$C0\r
+          DB      $F3,$70,$C0\r
+\r
+          DB      0,0,0,0,0,0,0,0        ;SCORPION TOP ZONE\r
+          DB      0,0,0,0,0,0,0,0\r
+\r
+          ORG     STADDR+$C40\r
+EMPTY3    DB      $00                    ;$XX00\r
+B3        DB      $14\r
+          DB      $00                    ;FREE\r
+;LFWSH3   DB      $3B,$00\r
+ELF3203   DB      $3E\r
+\r
+QLIVE3    DB      $80                    $XX04\r
+HLIVE3    DB      $83\r
+TLIVE3    DB      $AB\r
+LIVE3     DB      $AB\r
+\r
+ELF3      DB      $3B,$00\r
+ELFB3     DB      $2A,$00\r
+\r
+QPOIS3    DB      $00                    $XX0C\r
+HPOIS3    DB      $54\r
+TPOIS3    DB      $57\r
+POISON3   DB      $57\r
+\r
+          ORG     STADDR+$C50\r
+CENTBOD3  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$2A,$3C,$E8,$AA,$A8,$3C,$2B\r
+CENTHED3  DB     $EE,$E6,$EE,$E6,$BB,$9B,$BB,$9B,$AA,$2A,$A9,$E8,$AA,$A8,$A9,$E8\r
+\r
+LSCRP6    DB      $D5,$01\r
+          DB      $05,$75\r
+          DB      $D5,$04\r
+          DB      $05,$70\r
+RSCRP6    DB      $40,$57\r
+          DB      $5D,$50\r
+          DB      $10,$57\r
+          DB      $0D,$50\r
+\r
+FLEA3     DB      $B7,$40,$B7,$40,$B7,$40,$B7,$40\r
+\r
+SHOT3     DB      $40\r
+\r
+POINT30E  DB      $04,$44,$44\r
+POINT60E  DB      $40,$44,$44\r
+POINT90E  DB      $44,$44,$44\r
+\r
+EXPLOS3   DB      $3B,0,$3F,0,$1C,0\r
+\r
+*******************       LINE 2         ***************************************\r
+          ORG     STADDR+$D00\r
+NUMBERS2  DB      $6C,$78,$C6,$CE,$3C,$C0,$E0,$CE,$EE,$EC   ;EDITOR FONT\r
+;;;;;NUMBERS2  DB      $44,$50,$82,$04,$14,$80,$40,$02,$82,$82\r
+LETTERS2  DB      $00,$00,$00,$00,$00,$00,$00,$00,$00,$00\r
+          DB      $00,$00,$00,$00,$00,$00,$00,$00,$00,$00\r
+          DB      $00,$00,$00\r
+BLACK2R   DB      $D5\r
+BLACKL2   DB      $55,$57\r
+\r
+SPIDER2   DB      $EF,$3E,$C0\r
+          DB      $F3,$33,$C0\r
+          DB      $CF,$7F,$00\r
+          DB      $3F,$3C,$C0\r
+\r
+          DB      0,0,0,0,0,0,0,0        ;SCORPION TOP ZONE\r
+          DB      0,0,0,0,0,0,0,0\r
+\r
+          ORG     STADDR+$D40\r
+EMPTY2    DB      $00                    ;$XX00\r
+B2        DB      $00\r
+          DB      $00                    ;FREE\r
+;LFWSH2   DB      $2A,$00\r
+ELF3202   DB      $08\r
+\r
+QLIVE2    DB      $68                    $XX04\r
+HLIVE2    DB      $6A\r
+TLIVE2    DB      $6A\r
+LIVE2     DB      $6A\r
+\r
+ELF2      DB      $2A,$00\r
+ELFB2     DB      $08,$00\r
+\r
+QPOIS2    DB      $15                    $XX0C\r
+HPOIS2    DB      $95\r
+TPOIS2    DB      $95\r
+POISON2   DB      $95\r
+\r
+          ORG     STADDR+$D50\r
+CENTBOD2  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$28,$2A,$7D,$F8,$28,$A8,$7D,$2F\r
+CENTHED2  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$28,$6A,$3C,$F9,$28,$A9,$3C,$F9\r
+\r
+LSCRP5    DB      $55,$71\r
+          DB      $D5,$50\r
+          DB      $55,$70\r
+          DB      $D5,$50\r
+RSCRP5    DB      $4D,$55\r
+          DB      $05,$57\r
+          DB      $0D,$55\r
+          DB      $05,$57\r
+\r
+FLEA2     DB      $B7,$C0,$B7,$C0,$B7,$C0,$B7,$C0\r
+\r
+SHOT2     DB      $40\r
+\r
+POINT30F  DB      $54,$54,$54\r
+POINT60F  DB      $54,$54,$54\r
+POINT90F  DB      $54,$54,$54\r
+\r
+EXPLOS2   DB      $7F,0,$D9,0,$04,0\r
+\r
+*******************       LINE 1         ***************************************\r
+          ORG     STADDR+$E00\r
+NUMBERS1  DB      $38,$38,$7C,$7C,$1C,$FE,$38,$FE,$38,$38   ;EDITOR FONT\r
+;;;;;NUMBERS1  DB      $38,$30,$7C,$FE,$0C,$FE,$3C,$FE,$7C,$7C\r
+LETTERS1  DB      $00,$00,$00,$00,$00,$00,$00,$00,$00,$00\r
+          DB      $00,$00,$00,$00,$00,$00,$00,$00,$00,$00\r
+          DB      $00,$00,$00\r
+BLACK1R   DB      $D5\r
+BLACKL1   DB      $55,$57\r
+\r
+SPIDER1   DB      $F8,$0B,$C0\r
+          DB      $3F,$3F,$00\r
+          DB      $FE,$00,$00\r
+          DB      $00,$0F,$C0\r
+\r
+          DB      0,0,0,0,0,0,0,0        ;SCORPION TOP ZONE\r
+          DB      0,0,0,0,0,0,0,0\r
+\r
+          ORG     STADDR+$E40\r
+EMPTY1    DB      $00                    ;$XX00\r
+B1        DB      $00\r
+          DB      $00                    ;FREE\r
+;LFWSH1   DB      $0C,$00\r
+ELF3201   DB      $08\r
+\r
+QLIVE1    DB      $18                    $XX04\r
+HLIVE1    DB      $18\r
+TLIVE1    DB      $18\r
+LIVE1     DB      $18\r
+\r
+ELF1      DB      $08,$00\r
+ELFB1     DB      $08,$00\r
+\r
+QPOIS1    DB      $24                    $XX0C\r
+HPOIS1    DB      $24\r
+TPOIS1    DB      $24\r
+POISON1   DB      $24\r
+\r
+          ORG     STADDR+$E50\r
+CENTBOD1  DB     $18,$48,$18,$04,$24,$21,$24,$10,$00,$88,$00,$32,$00,$22,$00,$8C\r
+CENTHED1  DB     $18,$48,$18,$04,$24,$21,$24,$10,$00,$08,$7C,$30,$00,$20,$7C,$30\r
+\r
+LSCRP4    DB      $45,$50\r
+          DB      $55,$10\r
+          DB      $45,$50\r
+          DB      $55,$10\r
+RSCRP4    DB      $05,$51\r
+          DB      $04,$55\r
+          DB      $05,$51\r
+          DB      $04,$55\r
+\r
+FLEA1     DB      $0F,$00,$0F,$00,$0F,$00,$0F,$00\r
+\r
+SHOT1     DB      $40\r
+\r
+POINT30G  DB      $00,$00,$00\r
+POINT60G  DB      $00,$00,$00\r
+POINT90G  DB      $00,$00,$00\r
+\r
+EXPLOS1   DB      $37,0,$23,0,$00,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D000\r
+TPG8CVR1  DB      $40,$0A,$B0,$00,0,0,0,$0A,$AB,$00,0,0,0,$2A,$C0,$00\r
+          DB      0,$AB,$00,$3A,$B0,0,0,0,$AB,$00,$3A,$80,0,0,$01\r
+TPG8CVR2  DB      $40,$AB,$00,$00,0,0,0,$0A,$82,$AC,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$3A,$B0,$00,$00,$0A,$80,0,$03,$A8,$00,$00,$2A,$01\r
+TPG8CVR3  DB      $40,0,$00,$00,$2A,$00,$00,0,$00,$0A,$AA,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$00,$00,$02,$A0,$00,$00,0,$2A,$00,0,0,0,$01\r
+TPG8CVR4  DB     $05,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55\r
+          DB     $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$50\r
+TPG8LIN5  DB      $05,$01,$05,$01,$40,$04,$00,$40,$44,$40,$44,$11\r
+\r
+TPG8LIN1  DB      $2A,$C0,$00,$00,0,0,$2A,$C0,$EA,0,0,$02\r
+          DB      $A0,0,0,0,$02,$AC,$00,$00,0,0,0,$0A,$B0,$00,$00\r
+TPG8LIN2  DB      $00,$00,$A8,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG8LIN3  DB      $02,$AC,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$0A,$80,$00\r
+TPG8LIN4  DB      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D100\r
+TPG7CVR1  DB      $40,$0A,$AA,$AC,0,0,0,$0A,$A8,$00,0,0,0,$2A,$AA,$C0\r
+          DB      0,$AA,$AA,$AA,$A0,0,0,0,$AA,$AA,$AA,$80,0,0,$01\r
+TPG7CVR2  DB      $40,$AA,$00,$00,0,0,0,$0A,$8E,$A0,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$0A,$A0,$00,$3A,$AA,$80,0,$00,$A8,$00,$EA,$AA,$01\r
+TPG7CVR3  DB      $40,0,$00,$00,$2A,$C0,$00,0,$00,$3A,$AA,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$00,$00,$02,$AC,$00,$00,0,$3A,$C0,0,0,0,$01\r
+TPG7CVR4  DB   $10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,$04\r
+TPG7LIN5  DB      $10,$41,$10,$44,$10,$04,$00,$40,$44,$40,$44,$11\r
+\r
+TPG7LIN1  DB      $2A,$AA,$AB,$00,0,0,$2A,$AA,$AA,0,0,$02\r
+          DB      $A0,0,0,0,$02,$AA,$AA,$B0,0,0,0,$0A,$AA,$AA,$C0\r
+TPG7LIN2  DB      $02,$AA,$A8,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG7LIN3  DB      $02,$A0,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$0A,$B0,$00\r
+TPG7LIN4  DB      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D200\r
+TPG6CVR1  DB      $40,$0E,$AA,$AB,0,0,0,$0A,$AC,$00,0,0,0,$2A,$AA,$B0\r
+          DB      0,$AA,$AA,$AA,$A0,0,0,0,$AA,$AA,$AA,$C0,0,0,$01\r
+TPG6CVR2  DB      $40,$AA,$00,$00,0,0,0,$0A,$8A,$A0,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$0E,$AC,$00,$EA,$AA,$C0,0,$00,$A8,$03,$AA,$AB,$01\r
+TPG6CVR3  DB      $40,0,$00,$00,$3A,$AA,$C0,0,$00,$2A,$AA,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$00,$00,$03,$AA,$AC,$00,0,$0A,$80,0,0,0,$01\r
+TPG6CVR4  DB      $40,0,0,0,$0E,$AA,$AA,$AB,$00,0,0,$00,$0E,$AC,$00,0\r
+          DB      0,$20,$00,$00,$00,$EA,$AA,$AA,$B0,0,$00,$03,$AA,$AA,$C1\r
+TPG6LIN5  DB      $42,$11,$00,$44,$11,$54,$00,$55,$44,$55,$45,$11\r
+\r
+TPG6LIN1  DB      $3A,$AA,$AA,$C0,0,0,$2A,$AA,$AA,0,0,$02\r
+          DB      $A0,0,0,0,$03,$AA,$AA,$AC,0,0,0,$0E,$AA,$AA,$B0\r
+TPG6LIN2  DB      $0A,$AA,$AC,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG6LIN3  DB      $02,$A0,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$0E,$AA,$B0\r
+TPG6LIN4  DB      $00,$3A,$AA,$AC,0,0,0,0,0,$00,$EC,0,0,0,0,$00\r
+          DB      $80,0,0,0,0,0,0,0,0,$30,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D300\r
+TPG5CVR1  DB      $40,$02,$AA,$AB,0,0,0,$0A,$A0,$00,0,0,0,$2A,$AA,$B0\r
+          DB      0,$AA,$AA,$AA,$A0,0,0,0,$AA,$AA,$AA,$00,0,0,$01\r
+TPG5CVR2  DB      $40,$EA,$00,$00,0,0,0,$0A,$8A,$B0,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$02,$A8,$00,$AA,$AA,$00,0,$00,$AB,$02,$AA,$A8,$01\r
+TPG5CVR3  DB      $40,0,$00,$00,$3A,$AA,$B0,0,$00,$EA,$2A,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$38,$00,$03,$AA,$AB,$00,0,$0A,$80,0,0,0,$01\r
+TPG5CVR4  DB      $40,0,0,0,$0A,$AA,$AA,$AA,$C0,0,0,$00,$3A,$AB,$00,0\r
+          DB      0,$A8,$00,$00,$00,$AA,$AA,$AA,$AC,0,$00,$02,$AA,$AA,$B1\r
+TPG5LIN5  DB      $48,$11,$05,$41,$41,$04,$00,$11,$04,$11,$04,$41\r
+\r
+TPG5LIN1  DB      $3A,$AA,$AA,$C0,0,0,$2A,$AA,$AA,0,0,$02\r
+          DB      $A0,0,0,0,$03,$AA,$AA,$AC,0,0,0,$0E,$AA,$AA,$B0\r
+TPG5LIN2  DB      $0A,$AA,$A0,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG5LIN3  DB      $02,$AC,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$0E,$AA,$AC\r
+TPG5LIN4  DB      $00,$EA,$AA,$AB,0,0,0,0,0,$00,$AB,0,0,0,0,$02\r
+          DB      $A0,0,0,0,0,0,0,0,0,$EC,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D400\r
+TPG4CVR1  DB      $40,$03,$AA,$AB,0,0,0,$0E,$B0,$00,0,0,0,$3A,$AA,$B0\r
+          DB      0,$EA,$AA,$AA,$B0,0,0,0,$EA,$AA,$AB,$00,0,0,$01\r
+TPG4CVR2  DB      $40,$2A,$C0,$00,0,0,0,$0A,$BA,$80,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$03,$AB,$03,$AA,$AB,$00,0,$00,$EA,$0E,$AA,$AC,$01\r
+TPG4CVR3  DB      $40,0,$00,$00,$0A,$AA,$A0,0,$00,$AA,$2A,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$EB,$00,$00,$AA,$AA,$00,0,$0E,$B0,0,0,0,$01\r
+TPG4CVR4  DB      $40,0,0,0,$3A,$AA,$AA,$AA,$80,0,0,$00,$3A,$AA,$00,0\r
+          DB      0,$A8,$00,$00,$03,$AA,$AA,$AA,$A8,0,$00,$0E,$AA,$AA,$B1\r
+TPG4LIN5  DB      $42,$11,$10,$44,$10,$44,$00,$11,$04,$11,$04,$11\r
+\r
+TPG4LIN1  DB      $0A,$AA,$AA,$C0,0,0,$3A,$AA,$AB,0,0,$02\r
+          DB      $A0,0,0,0,$00,$AA,$AA,$AC,0,0,0,$02,$AA,$AA,$B0\r
+TPG4LIN2  DB      $3A,$AA,$B0,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG4LIN3  DB      $02,$A8,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$02,$AA,$A8\r
+TPG4LIN4  DB      $00,$EA,$AA,$AB,0,0,0,0,0,$00,$AB,0,0,0,0,$02\r
+          DB      $A0,0,0,0,0,0,0,0,0,$EC,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D500\r
+TPG3CVR1  DB      $40,$00,$EA,$AC,0,0,0,$03,$C0,$00,0,0,0,$0E,$AA,$C0\r
+          DB      0,$3A,$AA,$AA,$C0,0,0,0,$3A,$AA,$AC,$00,0,0,$01\r
+TPG3CVR2  DB      $40,$2A,$C0,$00,0,0,0,$0A,$AA,$C0,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$00,$AA,$03,$AA,$AC,$00,0,$00,$2A,$0E,$AA,$B0,$01\r
+TPG3CVR3  DB      $40,0,$00,$00,$0A,$AA,$AC,0,$00,$AB,$2A,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$EA,$00,$00,$EA,$AA,$C0,0,$02,$A0,0,0,0,$01\r
+TPG3CVR4  DB      $40,0,0,0,$3A,$AA,$AA,$AA,$80,0,0,$00,$2A,$AA,$00,0\r
+          DB      0,$A8,$00,$00,$03,$AA,$AA,$AA,$A8,0,$00,$0E,$AA,$AA,$B1\r
+TPG3LIN5  DB      $10,$41,$10,$44,$10,$14,$00,$11,$04,$11,$04,$11\r
+\r
+TPG3LIN1  DB      $0E,$AA,$AB,$00,0,0,$0E,$AA,$AC,0,0,$00\r
+          DB      $80,0,0,0,$00,$EA,$AA,$B0,0,0,0,$03,$AA,$AA,$C0\r
+TPG3LIN2  DB      $3A,$AA,$C0,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG3LIN3  DB      $02,$A8,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$03,$AA,$AB\r
+TPG3LIN4  DB      $03,$AA,$AA,$AB,0,0,0,0,0,$02,$AA,0,0,0,0,$02\r
+          DB      $A0,0,0,0,0,0,0,0,0,$A8,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D600\r
+TPG2CVR1  DB   $10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,$04\r
+TPG2CVR2  DB      $40,$2A,$80,$00,0,0,0,$0A,$AA,$00,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$00,$EA,$C2,$AC,$00,$00,0,$00,$2A,$0A,$B0,$00,$01\r
+TPG2CVR3  DB      $40,0,$00,$00,$02,$AA,$AC,0,$03,$A8,$2A,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$EA,$C0,$00,$3A,$AA,$C0,0,$02,$A0,0,0,0,$01\r
+TPG2CVR4  DB      $40,0,0,0,$2A,$AA,$AA,$AA,$80,0,0,$00,$2A,$EA,$00,0\r
+          DB      0,$A8,$00,$00,$02,$AA,$AA,$AA,$A8,0,$00,$0A,$AA,$AA,$C1\r
+TPG2LIN5  DB      $05,$01,$05,$01,$40,$04,$00,$04,$55,$44,$05,$41\r
+\r
+TPG2LIN1  DB      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\r
+TPG2LIN2  DB      $2A,$C0,$00,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG2LIN3  DB      $03,$A8,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$00,$EA,$AB\r
+TPG2LIN4  DB      $02,$AA,$AA,$AC,0,0,0,0,0,$02,$AA,0,0,0,0,$02\r
+          DB      $A0,0,0,0,0,0,0,0,0,$EB,0\r
+\r
+*******************                      ***************************************\r
+          ORG     $D700\r
+TPG1CVR1  DB     $05,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55\r
+          DB     $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$50\r
+TPG1CVR2  DB      $40,$3A,$80,$00,0,0,0,$0A,$AA,$00,0,$00,$2A,0,$00,$02\r
+          DB      $A0,0,$00,$2A,$82,$A0,$00,$00,0,$00,$2A,$CA,$80,$00,$01\r
+TPG1CVR3  DB      $40,0,$00,$00,$00,$00,$A8,0,$02,$A8,$2A,$00,0,$2A,$00,$02\r
+          DB      $A0,$0,$2A,$80,$00,$00,$0A,$80,0,$02,$AC,0,0,0,$01\r
+TPG1CVR4  DB      $40,0,0,0,$2A,$C0,$00,$3A,$80,0,0,$00,$2A,$2A,$00,0\r
+          DB      0,$A8,$00,$00,$02,$AC,$00,$03,$A8,0,$00,$0A,$B0,$00,$01\r
+TPG1LIN5  DB      $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00\r
+\r
+TPG1LIN1  DB      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\r
+TPG1LIN2  DB      $2A,$00,$00,0,0,0,$2A,0,0,$2A,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,0,0,0,0\r
+TPG1LIN3  DB      $00,$A8,0,0,0,0,0,$0A,$80,0,0,0,$2A,0,0,0\r
+          DB      0,$A8,0,0,0,0,0,0,$A8,0,0,$00,$00,$2A\r
+TPG1LIN4  DB      $02,$AB,$00,$00,0,0,0,0,0,$0E,$AA,0,0,0,0,$02\r
+          DB      $A0,0,0,0,0,0,0,0,0,$2A,0\r
+\r
+\r
+          END\r
+\r
diff --git a/CTABLES.S b/CTABLES.S
new file mode 100644 (file)
index 0000000..cdd62bd
--- /dev/null
+++ b/CTABLES.S
@@ -0,0 +1,307 @@
+*** CTABLES.S ***\r
+* KGO     8/30    TUNE TABLES\r
+\r
+COLORTBL\r
+          DB      $BA,$54,$57\r
+          DB      $17,$49,$15\r
+          DB      $6A,$C5,$C3            ;COLOR DEFINITIONS      1\r
+          DB      $89,$38,$31            ;RED\r
+\r
+          DB      $4B,$15,$17\r
+          DB      $64,$1A,$65\r
+          DB      $9A,$46,$43            ;COLOR DEFINITIONS      2\r
+          DB      $DA,$58,$52            ;\r
+\r
+          DB      $1C,$62,$64\r
+          DB      $C5,$6A,$84\r
+          DB      $4B,$36,$34            ;COLOR DEFINITIONS      3\r
+          DB      $69,$1C,$12            ;YELLOW\r
+\r
+          DB      $9A,$42,$45\r
+          DB      $85,$4A,$C6\r
+          DB      $1C,$26,$24            ;COLOR DEFINITIONS      4\r
+          DB      $1B,$88,$82            ;DARK BLUE\r
+\r
+          DB      $4A,$C3,$B6\r
+          DB      $E7,$69,$E7\r
+          DB      $6A,$C5,$C3            ;COLOR DEFINITIONS      5\r
+          DB      $EB,$67,$62            ;PURPLE?\r
+\r
+          DB      $6B,$C2,$C4\r
+          DB      $59,$39,$66\r
+          DB      $4A,$A7,$A5            ;COLOR DEFINITIONS      6\r
+          DB      $89,$36,$31            ;ORANGE\r
+\r
+          DB      $39,$E4,$E7\r
+          DB      $B7,$A9,$C8\r
+          DB      $6B,$57,$65            ;COLOR DEFINITIONS      7\r
+          DB      $1B,$99,$93            ;PURPLE?\r
+\r
+          DB      $AD,$56,$69\r
+          DB      $86,$59,$85\r
+          DB      $4B,$18,$15            ;COLOR DEFINITIONS      8\r
+          DB      $8C,$48,$21            ;RED\r
+\r
+          DB      $5B,$83,$86\r
+          DB      $D6,$1A,$D7\r
+          DB      $AA,$57,$65            ;COLOR DEFINITIONS      9\r
+          DB      $3C,$D9,$D2            ;GREEN\r
+\r
+          DB      $5D,$D3,$D6\r
+          DB      $1A,$AB,$18\r
+          DB      $5B,$98,$95            ;COLOR DEFINITIONS      10\r
+          DB      $CC,$26,$21            ;RED\r
+\r
+          DB      $5B,$87,$8A\r
+          DB      $46,$9A,$47\r
+          DB      $1B,$76,$74            ;COLOR DEFINITIONS      11\r
+          DB      $8C,$38,$51            ;RED\r
+\r
+          DB      $9A,$43,$46\r
+          DB      $97,$BA,$96\r
+          DB      $AB,$C6,$B4            ;COLOR DEFINITIONS      12\r
+          DB      $3B,$A9,$A3            ;PURPLE\r
+\r
+\r
+\r
+\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
+TBASE     DB      L(SHTSND),L(SPDRSND),L(EXP1SND),L(PLYDTHS),L(FLEASND)\r
+          DB      L(SCRPSND),L(XTRAMAN),L(PEDEWLK)\r
+TBASEH    DB      H(SHTSND),H(SPDRSND),H(EXP1SND),H(PLYDTHS),H(FLEASND)\r
+          DB      H(SCRPSND),H(XTRAMAN),H(PEDEWLK)\r
+VBASE     DB      L(SHTSNDV),L(SPDRSNDV),L(EXP1SNDV),L(PLYDTHSV),L(FLEASNDV)\r
+          DB      L(SCRPSNDV),L(XTRAMANV),L(PEDEWLKV)\r
+VBASEH    DB      H(SHTSNDV),H(SPDRSNDV),H(EXP1SNDV),H(PLYDTHSV),H(FLEASNDV)\r
+          DB      H(SCRPSNDV),H(XTRAMANV),H(PEDEWLKV)\r
+CBASE     DB      L(SHTSNDC),L(SPDRSNDC),L(EXP1SNDC),L(PLYDTHSC),L(FLEASNDC)\r
+          DB      L(SCRPSNDC),L(XTRAMANC),L(PEDEWLKC)\r
+CBASEH    DB      H(SHTSNDC),H(SPDRSNDC),H(EXP1SNDC),H(PLYDTHSC),H(FLEASNDC)\r
+          DB      H(SCRPSNDC),H(XTRAMANC),H(PEDEWLKC)\r
+DURTABL   DB      $00,$01,$00,$01,$06,$03,$07,$01\r
+PRYOR     DB      2,1,2,8,8,3,9,0\r
+\r
+FREQTABL\r
+SHTSND    DB      $01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F\r
+          DB      $10,$FF\r
+SPDRSND   DB      $00,$10,$00,$0E,$01,$09,$00,$00,$00,$09,$01,$0E,$00,$10,$01\r
+          DB      $0E,$00,$09,$00,$FE    ;REPEATS\r
+EXP1SND   DB      $1A,$1A,$1B,$1C,$1D,$1E,$1F,$1F,$FF\r
+PLYDTHS   DB      $14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F,$1F,$1F,$1F\r
+          DB      $1F,$FF\r
+FLEASND   DB      $0E,$0F,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C\r
+          DB      $1D,$1E,$1F,$FF\r
+SCRPSND   DB      $11,$1B,$11,$14,$18,$14,$FE    ;REPEATS\r
+XTRAMAN   DB      $1B,$14,$10,$0D,$0D,$10,$0D,$0D,$0D,$0D,$1F,$18,$14,$14,$18\r
+          DB      $14,$14,$FF\r
+PEDEWLK   DB      $1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$FE    ;REPEATS\r
+\r
+\r
+VOLTABL\r
+SHTSNDV   DB      $88\r
+\r
+SPDRSNDV  DB      $00,$08,$01,$08,$01,$08,$01,$00,$00,$08,$01,$08,$01,$08,$01\r
+          DB      $08,$01,$08,$01,$FE    ;REPEATS\r
+EXP1SNDV  DB      $0C,$0C,$0B,$0A,$09,$08,$07,$06,$FF\r
+PLYDTHSV  DB      $0C,$0C,$0C,$0B,$0A,$09,$08,$07,$07,$07,$07,$07,$06,$06,$06\r
+          DB      $06,$FF\r
+FLEASNDV  DB      $88\r
+\r
+SCRPSNDV  DB      $88\r
+XTRAMANV  DB      $8B\r
+\r
+PEDEWLKV  DB      $0A,$0A,$09,$00,$06,$00,$00,$00,$FE    ;REPEATS\r
+\r
+CTLTABL\r
+SHTSNDC   DB      $89\r
+\r
+SPDRSNDC  DB      $84\r
+\r
+EXP1SNDC  DB      $88\r
+PLYDTHSC  DB      $88\r
+\r
+FLEASNDC  DB      $8D\r
+\r
+SCRPSNDC  DB      $8D\r
+XTRAMANC  DB      $0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D,$0D,$04,$04,$04,$04,$04\r
+          DB      $04,$04,$FF\r
+PEDEWLKC  DB      $8F\r
+\r
+********************************************************************************\r
+*                         DLL TABLE FOR HSC LOGO                               *\r
+********************************************************************************\r
+\r
+\r
+;         PAD THE TOP\r
+HSCDLL    DB      $2E,H(TPDL),L(TPDL)\r
+          DB      $A8,H(TPDL),L(TPDL)\r
+\r
+          DB      $27,H(DL6),L(DL6)\r
+          DB      $27,H(DL7),L(DL7)\r
+          DB      $27,H(DL8),L(DL8)\r
+          DB      $27,H(DL9),L(DL9)\r
+          DB      $27,H(DL10),L(DL10)\r
+          DB      $26,H(DL16),L(DL16)    ;GAME TYPE\r
+          DB      $26,H(DL19),L(DL19)    ;DIFF. LEVEL\r
+          DB      $A0,H(TPDL),L(TPDL)\r
+\r
+\r
+\r
+******************************************\r
+* ASSEMBLE INTO GRAPHICS BLOCK\r
+******************************************\r
+          ORG     $C098                  ;TO $C0FF\r
+HDLTBL    DB      H(DL1),H(DL2),H(DL3),H(DL4)            ;24\r
+          DB      H(DL5),H(DL6),H(DL7),H(DL8)\r
+          DB      H(DL9),H(DL10),H(DL11),H(DL12)\r
+          DB      H(DL13),H(DL14),H(DL15),H(DL16)\r
+          DB      H(DL17),H(DL18),H(DL19),H(DL20)\r
+          DB      H(DL21),H(DL22),H(DL23),H(DL24)\r
+\r
+LDLTBL    DB      L(DL1),L(DL2),L(DL3),L(DL4)            ;24\r
+          DB      L(DL5),L(DL6),L(DL7),L(DL8)\r
+          DB      L(DL9),L(DL10),L(DL11),L(DL12)\r
+          DB      L(DL13),L(DL14),L(DL15),L(DL16)\r
+          DB      L(DL17),L(DL18),L(DL19),L(DL20)\r
+          DB      L(DL21),L(DL22),L(DL23),L(DL24)\r
+\r
+MMAPTBLH  DB      H(MUSHMAP),H(MUSHMAP+ZONELEN),H(MUSHMAP+2*ZONELEN)     ;24\r
+          DB      H(MUSHMAP+3*ZONELEN),H(MUSHMAP+4*ZONELEN),H(MUSHMAP+5*ZONELEN)\r
+          DB      H(MUSHMAP+6*ZONELEN),H(MUSHMAP+7*ZONELEN),H(MUSHMAP+8*ZONELEN)\r
+          DB      H(MUSHMAP+9*ZONELEN),H(MUSHMAP+10*ZONELEN)\r
+          DB      H(MUSHMAP+11*ZONELEN),H(MUSHMAP+12*ZONELEN)\r
+          DB      H(MUSHMAP+13*ZONELEN),H(MUSHMAP+14*ZONELEN)\r
+          DB      H(MUSHMAP+15*ZONELEN),H(MUSHMAP+16*ZONELEN)\r
+          DB      H(MUSHMAP+17*ZONELEN),H(MUSHMAP+18*ZONELEN)\r
+          DB      H(MUSHMAP+19*ZONELEN),H(MUSHMAP+20*ZONELEN)\r
+          DB      H(MUSHMAP+21*ZONELEN),H(MUSHMAP+22*ZONELEN)\r
+\r
+MMAPTBLL  DB      L(MUSHMAP),L(MUSHMAP+ZONELEN),L(MUSHMAP+2*ZONELEN)     ;24\r
+          DB      L(MUSHMAP+3*ZONELEN),L(MUSHMAP+4*ZONELEN),L(MUSHMAP+5*ZONELEN)\r
+          DB      L(MUSHMAP+6*ZONELEN),L(MUSHMAP+7*ZONELEN),L(MUSHMAP+8*ZONELEN)\r
+          DB      L(MUSHMAP+9*ZONELEN),L(MUSHMAP+10*ZONELEN)\r
+          DB      L(MUSHMAP+11*ZONELEN),L(MUSHMAP+12*ZONELEN)\r
+          DB      L(MUSHMAP+13*ZONELEN),L(MUSHMAP+14*ZONELEN)\r
+          DB      L(MUSHMAP+15*ZONELEN),L(MUSHMAP+16*ZONELEN)\r
+          DB      L(MUSHMAP+17*ZONELEN),L(MUSHMAP+18*ZONELEN)\r
+          DB      L(MUSHMAP+19*ZONELEN),L(MUSHMAP+20*ZONELEN)\r
+          DB      L(MUSHMAP+21*ZONELEN),L(MUSHMAP+22*ZONELEN)\r
+\r
+BITTABLE  DB      $01,$02,$04,$08,$10,$20,$40,$80\r
+\r
+\r
+********************************************************************************\r
+*                        MARIA 2 DLL INTIALIZATION TABLE                       *\r
+********************************************************************************\r
+******************************************\r
+* ASSEMBLE INTO GRAPHICS BLOCK\r
+******************************************\r
+          ORG     $C198                  ;TO $C1F5\r
+\r
+DLLTABLE  DB      $2F,H(TPDL),L(TPDL)    ;TOP OF SCREEN INTERRUPT(WHO NEEDS IT?)\r
+          DB      $27,H(TPDL),L(TPDL)\r
+; 25 LINES PADDING ON TOP AND BOTTOM FOR NOW. SOME STANDARD SHOULD BE SET.\r
+\r
+          DB      $27,H(DL1),L(DL1)\r
+          DB      $00,H(HLINEDL),L(HLINEDL)\r
+          DB      $A7,H(DL2),L(DL2)      ;CHANGE MODE TO 160 (AFTER SCORE)\r
+          DB      $27,H(DL3),L(DL3)\r
+          DB      $27,H(DL4),L(DL4)\r
+          DB      $27,H(DL5),L(DL5)\r
+          DB      $27,H(DL6),L(DL6)\r
+          DB      $27,H(DL7),L(DL7)\r
+          DB      $27,H(DL8),L(DL8)\r
+          DB      $27,H(DL9),L(DL9)\r
+          DB      $27,H(DL10),L(DL10)\r
+          DB      $27,H(DL11),L(DL11)\r
+          DB      $27,H(DL12),L(DL12)\r
+          DB      $27,H(DL13),L(DL13)\r
+          DB      $27,H(DL14),L(DL14)\r
+          DB      $27,H(DL15),L(DL15)\r
+          DB      $27,H(DL16),L(DL16)\r
+          DB      $27,H(DL17),L(DL17)\r
+          DB      $27,H(DL18),L(DL18)\r
+          DB      $27,H(DL19),L(DL19)\r
+          DB      $27,H(DL20),L(DL20)\r
+          DB      $27,H(DL21),L(DL21)\r
+          DB      $27,H(DL22),L(DL22)\r
+          DB      $27,H(DL23),L(DL23)\r
+          DB      $27,H(DL24),L(DL24)\r
+          DB      $00,H(HLINEDL),L(HLINEDL)\r
+          DB      $AE,H(TPDL),L(TPDL)    ;VERTICAL BLANK INTERRUPT\r
+          DB      $27,H(TPDL),L(TPDL)\r
+          DB      $A0,H(TPDL),L(TPDL)    ;REAL VB INTERRUPT\r
+          DB      0\r
+ENDLL\r
+\r
+\r
+\r
+******************************************\r
+* ASSEMBLE INTO GRAPHICS BLOCK\r
+******************************************\r
+          ORG     $C598                  ;100 BYTES\r
+ALOW      DB      L(A1PLYR),L(AALTERN),L(ACOMPET),L(ATEAM)\r
+AHIGH     DB      H(A1PLYR),H(AALTERN),H(ACOMPET),H(ATEAM)\r
+\r
+ACOMPET   DB      L(D),L(U),L(A),L(L),L(EMPTY),L(P),L(L),L(A),L(Y),L(E),L(R)\r
+          DB      L(EMPTY),L(C),L(O),L(M),L(P),L(E),L(T),L(I)\r
+          DB      L(T),L(I),L(O),L(N)\r
+AALTERN   DB      L(T),L(W),L(O),L(EMPTY),L(P),L(L),L(A),L(Y),L(E),L(R),L(EMPTY)\r
+          DB      L(A),L(L),L(T),L(E),L(R),L(N),L(A),L(T),L(I),L(N),L(G)\r
+ATEAM     DB      L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY)\r
+          DB      L(T),L(E),L(A),L(M),L(EMPTY),L(P),L(L),L(A),L(Y)\r
+          DB      L(EMPTY)\r
+A1PLYR    DB      L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY)\r
+          DB      L(O),L(N),L(E),L(EMPTY),L(P),L(L),L(A),L(Y),L(E),L(R)\r
+          DB      L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY),L(EMPTY)\r
+\r
+\r
+******************************************\r
+* ASSEMBLE INTO GRAPHICS BLOCK\r
+******************************************\r
+          ORG     $C698                  ;100 BYTES\r
+;WOCTRLS  DB      L(T),L(W),L(O),L(EMPTY),L(C),L(O),L(N),L(T),L(R),L(O),L(L)\r
+;         DB      L(L),L(E),L(R),L(S)\r
+SHRTRCKB  DB      L(S),L(H),L(A),L(R),L(E),L(EMPTY),L(T),L(R),L(A),L(C),L(K)\r
+          DB      L(B),L(A),L(L),L(L)\r
+\r
+DFLVLLOW  DB      L(DFNOVICE),L(DFINTRMD),L(DFADVNCD),L(DFEXPERT)\r
+DFLVLHGH  DB      H(DFNOVICE),H(DFINTRMD),H(DFADVNCD),H(DFEXPERT)\r
+\r
+DFNOVICE  DB      L(N),L(O),L(V),L(I),L(C),L(E)\r
+DFINTRMD  DB      L(S),L(T),L(A),L(N),L(D),L(A),L(R),L(D)\r
+DFADVNCD  DB      L(A),L(D),L(V),L(A),L(N),L(C),L(E),L(D)\r
+DFEXPERT  DB      L(E),L(X),L(P),L(E),L(R),L(T)\r
+\r
+DFPOS     DB      5,15,24,30\r
+DFLNGTH   DB      5,7,7,5\r
+\r
+\r
+******************************************\r
+* MESSAGES ("PLAYER", "ONE", "TWO", "GAME  OVER"\r
+* AND ROUTINES TO DISPLAY THEM\r
+******************************************\r
+MPLAYER   DB      L(P),L(L),L(A),L(Y),L(E),L(R)\r
+          DB      L(EMPTY),L(EMPTY),L(DGT1)\r
+          DB      L(W),L(I),L(N),L(S)\r
+MGMOVER   DB      L(G),L(A),L(M),L(E),L(EMPTY)\r
+          DB      L(O),L(V),L(E),L(R)\r
+MTIE      DB      L(Y),L(O),L(U),L(EMPTY),L(H),L(A),L(V),L(E),L(EMPTY)\r
+          DB      L(T),L(I),L(E),L(D)\r
+\r
+POINTSPR  DB      L(POINT300),L(POINT600),L(POINT900)\r
+MULT3SP   DB      3,6,9\r
+\r
diff --git a/CTUNES.S b/CTUNES.S
new file mode 100644 (file)
index 0000000..9965f48
--- /dev/null
+++ b/CTUNES.S
@@ -0,0 +1,261 @@
+*******************************************************************************\r
+*\r
+*         TUNES.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
+*<*     SCRAPONE -- KILL A PARTICULA*     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
+********************************************************************************\r
+* SCRAPALL\r
+*         KILL ALL TUNES. SHOULD BE CALLED AT POWERUP, CHANGING PLAYERS,\r
+*                AND GAME OVER\r
+SCRAPALL  TYA\r
+          PHA\r
+          LDA     TUNNUM\r
+          CMP     #6                     ;XTRAMAN\r
+          BEQ     CHK1CH\r
+          LDY     #0\r
+          STY     AUDV0\r
+          STY     SCRPINDX\r
+          DEY\r
+          STY     TUNNUM\r
+CHK1CH    LDA     TUNNUM1\r
+          CMP     #6\r
+          BEQ     ROTES\r
+          LDY     #0\r
+          STY     AUDV1\r
+          STY     SCRPINDX\r
+          DEY\r
+          STY     TUNNUM1\r
+ROTES     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
+          STA     SCRPINDX\r
+          LDA     #$FF\r
+          STA     TUNNUM\r
+          RTS\r
+CKCH1     SEC\r
+          SBC     TUNNUM1\r
+          BNE     REETS\r
+          STA     AUDV1\r
+          STA     SCRPINDX\r
+          LDA     #$FF\r
+          STA     TUNNUM1\r
+REETS     RTS\r
+\r
+********************************************************************************\r
+* TUNIN\r
+*         START THAT TUNE YOU PUT IN ACC.\r
+TUNIN     STA     TUNTEMP\r
+          TYA\r
+          PHA\r
+          TXA\r
+          PHA\r
+          LDY     #1\r
+          LDX     TUNTEMP\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        LDA     TUNNUM,Y\r
+          CMP     #5\r
+          BNE     IT\r
+          LDA     TINDEX0,Y\r
+          STA     SCRPINDX\r
+IT        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     BIT     ATTRACT\r
+          BMI     REETS\r
+          BVS     REETS\r
+          LDA     PAUSETMR\r
+          BNE     REETS\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     #$FF                   ;NEXT TIME THROUGH TUNER, TUNE WILL\r
+          STA     DCH0,X                 ;START\r
+          STA     TINDEX0,X\r
+          STA     CINDEX0,X\r
+          STA     VINDEX0,X\r
+          CPY     #5\r
+          BNE     BOOGIE\r
+          LDA     SCRPINDX\r
+          STA     TINDEX0,X\r
+          DEC     TINDEX0,X\r
+          LDA     #0\r
+          STA     SCRPINDX\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     NXTCH\r
+CKENL     CMP     #$FE\r
+          BEQ     FOOBEQ\r
+CKNXTT    CMP     #$FD\r
+          BNE     STFREQ\r
+          INY\r
+          LDA     (MPTRL),Y\r
+          STA     TUNNUM,X\r
+          TAY\r
+          LDA     TBASE,Y\r
+          STA     MPTRL\r
+          LDA     TBASEH,Y\r
+          STA     MPTRH\r
+\r
+FOOBEQ    LDY     #0                     ;REPEATREPEATREPEAT\r
+          TYA\r
+          STA     CINDEX0,X\r
+          STA     VINDEX0,X\r
+          LDA     (MPTRL),Y\r
+STFREQ    BPL     STIT\r
+          INY\r
+          LDA     (MPTRL),Y\r
+          STA     DCH0,X\r
+          INY\r
+          LDA     (MPTRL),Y\r
+STIT      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
+          LDY     TUNNUM,X\r
+\r
+          LDA     CBASE,Y\r
+          STA     MPTRL\r
+          LDA     CBASEH,Y\r
+          STA     MPTRH\r
+          LDY     CINDEX0,X\r
+          LDA     (MPTRL),Y\r
+          BPL     STCTRL\r
+          DEY\r
+STCTRL    STA     AUDC0,X\r
+          TYA\r
+          STA     CINDEX0,X\r
+\r
+NXTCH     DEX\r
+          BMI     ROTS\r
+          JMP     TUNLOP\r
+ROTS      RTS\r
+\r
+\r
diff --git a/DEATH.S b/DEATH.S
new file mode 100644 (file)
index 0000000..6b5e396
--- /dev/null
+++ b/DEATH.S
@@ -0,0 +1,1811 @@
+*** DEATH.S ***\r
+* DVP     4/26/84   ALL PAUSE MODE CODE NOW LOCALIZED IN CHKSTRT\r
+* DVP     8/12    CHECK FOR START AND END OF GAME, COLLISIONS WITH SHOOTER,\r
+*                 AND HANDLE FIRING AND EXPLOSIONS\r
+\r
+STRTMEN   EQU     3                      ;HOW MANY MEN DO WE START GAME WITH?\r
+STRTDUAL  EQU     6                      ;START DUAL GAME WITH 2 ON SCREEN, 4\r
+                                         ;   EXTRA\r
+TEAMMEN   EQU     17                     ;LEFTMOST MAN LOCATION IN TEAM MAN POOL\r
+\r
+\r
+CHKSTRT   JSR     STICKIT0               ;DO TRACKBALL CRAP\r
+          LDA     FRMCNT                 ;DISPLAY OF THE SCORE IS DISABLED\r
+          BNE     CHKSTRT1               ;   WHEN SCRTIMER IS NEGATIVE\r
+          LDA     ATTRACT                ;   THIS CHUNK INCREMENTS THE VALUE\r
+          BEQ     CHKSTRT1               ;   DURING ATTRACT MODE;  LATER IN THIS\r
+          LDX     SCRTIMER               ;   ROUTINE, ANY INPUT SETS SCRTIMER\r
+          BMI     CHKSTRT1               ;   BACK TO 0\r
+          INC     SCRTIMER\r
+\r
+CHKSTRT1  LDA     PANEL                  ;TEST RESET SWITCH\r
+          LSR     A\r
+          BCS     RSTDBNC\r
+          STA     DEBOUNC1\r
+          RTS\r
+\r
+RSTDBNC   LDA     #$FF\r
+          EOR     DEBOUNC1\r
+          BPL     SKPGMRST\r
+          STA     DEBOUNC1               DEBOUNC1 SHOULD BE NEGATIVE ON LEAVING\r
+          JMP     GMRESET\r
+\r
+SKPGMRST  LDA     ATTRACT                ;NO RESET -- IN GAME SELECT?\r
+          BPL     NOOPTSET\r
+          JMP     SETGMOPT\r
+\r
+* GAME PLAY OR ATTRACT\r
+NOOPTSET\r
+          LDA     PANEL                  ;TEST GAME SELECT SWITCH DURING GAME\r
+          AND     #$02\r
+          BNE     THATSALL               ;BRANCH IF SWITCH NOT PRESSED\r
+          JMP     GOINTOTP\r
+\r
+THATSALL  LDA     ATTRACT\r
+          BEQ     PAUSEME\r
+          JMP     SKPNORST\r
+\r
+* GAME PLAY\r
+* PAUSE HANDLING\r
+PAUSEME\r
+          LDA     PANEL\r
+          LDX     PAUSETMR               CURRENTLY PAUSED?\r
+          BNE     PAUSED                    YES\r
+\r
+*********** NOT CURRENTLY PAUSED\r
+          AND     #$08                   IS BUTTON PRESSED?\r
+          BEQ     STRTPAUS\r
+          RTS                               NO\r
+STRTPAUS  LDX     #1                     THIS DISABLES TUNER FROM RUNNING\r
+          STX     PAUSETMR\r
+          DEX\r
+          STX     AUDV0                  YES, START PAUSE\r
+          STX     AUDV1\r
+WAITPSE   LDA     PANEL                  AND WAIT FOR BUTTON TO BE RELEASED\r
+          AND     #$08                      (PANEL IS UPDATED AT 60 HZ.)\r
+          BEQ     WAITPSE\r
+STAYPSD   LDA     PANEL                  INTERNAL PAUSE LOOP CHECK OF RESET\r
+          LSR     A                         BUTTON\r
+          BCS     NOOPTSET               NOT PRESSED\r
+WAITRST   LDA     PANEL                  PRESSED, WAIT FOR RELEASE\r
+          LSR     A\r
+          BCC     WAITRST\r
+          JMP     GMRESET\r
+\r
+*********** CURRENTLY PAUSED WITH DMA STILL ON\r
+PAUSED    AND     #$08                   IS BUTTON PRESSED?\r
+          BEQ     ENDPAUSE                  YES, ENDPAUSE\r
+          JSR     ONSCREEN\r
+          JSR     OFFSCRN\r
+          INC     PAUSETMR+1             NO, INCREMENT TIME.  EVERY FRAME\r
+          BNE     STAYPSD\r
+          INC     PAUSETMR               EVERY 256 FRAMES\r
+          LDA     PAUSETMR\r
+          CMP     #$FF\r
+          BNE     STAYPSD\r
+\r
+*********** 18 MINUTE TIMEOUT\r
+          LDX     #$7F                   TURN DMA OFF\r
+          STX     CTRL\r
+          LDA     #L(MORPHO)             TOP OF SCREEN VECTOR\r
+          STA     VECTORI\r
+          LDA     #H(MORPHO)\r
+          STA     VECTORI+1\r
+\r
+BLANKLP   JSR     ONSCREEN\r
+          JSR     OFFSCRN                SINCE DMA IS OFF ...\r
+          JSR     TRACKIT                FOR COMING OUT OF PAUSE WITH TRACKBALL\r
+          LDX     #1                     RESET PAUSE TIMER AND TURN SCREEN BACK\r
+          JSR     STICKIT                   ON IF WE SEE ANY ...\r
+          CMP     #$F0                   JOYSTICK MOVEMENT\r
+          BMI     UNBLANK\r
+          JSR     STICKIT0\r
+          CMP     #$F0\r
+          BMI     UNBLANK\r
+          LDA     BUTNIB                 OR BUTTON PUSHES\r
+          AND     BUTNIB+1\r
+          BPL     UNBLANK\r
+          LDA     PANEL                  OR SELECT OR RESET PUSHES\r
+          AND     #$03\r
+          CMP     #$03\r
+          BNE     ENDBLANK\r
+          LDA     PANEL                  PAUSE BUTTON PRESSED?\r
+          AND     #$08\r
+          BNE     BLANKLP                   NO\r
+\r
+*********** RESTART GAME AFTER TIMEOUT\r
+ENDBLANK  JSR     TURNON                 TURN DMA ON\r
+ENDPAUSE  LDA     PANEL                  WAIT FOR BUTTON TO BE RELEASED\r
+          AND     #$08\r
+          BEQ     ENDPAUSE\r
+          LDA     PANEL                  DID RESET BRING US OUT OF BLANK?\r
+          LSR     A\r
+          BCS     RESUME                 NO\r
+WAITRST2  LDA     PANEL                  RESET PRESSED, WAIT FOR RELEASE\r
+          LSR     A                         DON'T TURN PAUSE OFF YET SO SOUND\r
+          BCC     WAITRST2                  STAYS OFF\r
+          JMP     GMRESET\r
+\r
+RESUME    LDA     #0                     TURN PAUSE OFF, RESUME GAME PLAY\r
+          STA     PAUSETMR\r
+          RTS\r
+\r
+*********** RESTART PAUSE AFTER SELECT OR RESET WHEN SCREEN BLANK\r
+UNBLANK   LDA     #1\r
+          STA     PAUSETMR\r
+          JSR     TURNON\r
+          JMP     STAYPSD\r
+\r
+*********** RESTART DISPLAY\r
+TURNON    JSR     ONSCREEN               TURN DMA ON\r
+          JSR     OFFSCRN\r
+          LDX     #$43\r
+          STX     CTRL\r
+          RTS\r
+\r
+\r
+* ATTRACT MODE\r
+SKPNORST\r
+          LDA     SCHTICK                ;CHECK JOYSTICK DURING ATTRACT GAME\r
+          ORA     #$0F                   ;   PLAY;  ANY MOVEMENT GOES INTO\r
+          EOR     #$FF                   ;   TITLE PAGE TO START GAME SELECT\r
+          BEQ     SWTCHCLR\r
+          LDA     #1\r
+          STA     DEBOUNC2\r
+SKMNPGJP  JMP     SKPMENPG               ;ALWAYS\r
+\r
+SWTCHCLR  LDA     DEBOUNC2\r
+          BEQ     SKMNPGJP\r
+GOINTOTP  LDA     #60\r
+          STA     OPTCNT2\r
+          LDA     #0\r
+          STA     DEBOUNC2\r
+\r
+;;;;;     LDA     #0\r
+          STA     SCRTIMER\r
+          JSR     SCOREDL                ;DISPLAY SCORES AGAIN IN TITLE PAGE\r
+\r
+          LDA     #$80\r
+          STA     ATTRACT\r
+          JMP     INITATGM\r
+\r
+\r
+* TITLE PAGE\r
+SETGMOPT  LDA     PANEL                  ;CHECK GAME SELECT SWITCH IN TITLE PAGE\r
+          AND     #$02\r
+          BEQ     SELECTIT\r
+          LDA     #$00                   ;SET NEXT CHANGE TO HAPPEN WHEN SWITCH\r
+          STA     OPTCNT2                ;   PRESSED\r
+          BEQ     NOGMSEL                ;ALWAYS\r
+\r
+SELECTIT  LDA     #0                     ;SWITCH WAS PRESSED\r
+          STA     SCRTIMER               ;   DISPLAY SCORES AGAIN IN TITLE PAGE\r
+          JSR     SCOREDL\r
+\r
+          DEC     OPTCNT2                ;DELAY BETWEEN CHANGES WHILE SWITCH\r
+          BPL     NOGMSEL                ;   DOWN\r
+          LDA     #45\r
+          STA     OPTCNT2\r
+          JSR     NXTGMOPT               ;SWITCH PRESSED, GO TO NEXT OPTION\r
+          JMP     UPDATDSP\r
+\r
+NOGMSEL   LDA     SCHTICK                ;CHECK FOR JOYSTICK MOVEMENT DURING\r
+          STA     GTEMP1                 ;   TITLE PAGE GAME SELECT\r
+          ORA     #$0F\r
+          EOR     #$FF\r
+          BNE     SKPOPCTZ\r
+\r
+          LDA     #0                     ;NO INPUT\r
+          STA     OPTCNT1\r
+GOSKPMN   JMP     LVMENUPG               ;ALWAYS\r
+\r
+SKPOPCTZ  LDA     #0\r
+          STA     SCRTIMER\r
+          JSR     SCOREDL                ;DISPLAY SCORE AGAIN IN TITLE PAGE\r
+\r
+          DEC     OPTCNT1                ;WHAT IS OPTCNT1, 2?\r
+          BPL     GOSKPMN\r
+          LDA     #30\r
+          STA     OPTCNT1\r
+          LDA     GTEMP1\r
+          BMI     NOATEAST\r
+          LDA     DIFLEVEL\r
+          CMP     #3\r
+          BEQ     UPDATDSP\r
+          INC     DIFLEVEL               ;INCREASE DIFFICULTY\r
+          BNE     UPDATDSP               ;ALWAYS\r
+NOATEAST  ASL     A\r
+          BMI     CHKPLYNM\r
+DFWEST    LDA     DIFLEVEL\r
+          BEQ     UPDATDSP\r
+          DEC     DIFLEVEL               ;DECREASE DIFFICULTY\r
+          BPL     UPDATDSP               ;ALWAYS\r
+\r
+CHKPLYNM ;LDA     GTEMP1\r
+         ;ASL     A\r
+          ASL     A\r
+          BMI     NOATSTH\r
+\r
+          LDA     GAMETYPE\r
+          AND     ALTCTRLS\r
+          CMP     #1\r
+          BNE     ALTTP2\r
+          LDA     #0\r
+          STA     ALTCTRLS\r
+          BEQ     UPDATDSP\r
+\r
+ALTTP2    LDA     GAMETYPE\r
+          CMP     #2\r
+          BNE     INCGMTP2\r
+          LDA     TRACKF\r
+          BEQ     INCGMTP2\r
+          LDA     TRACKF+1\r
+          BNE     INCGMTP2               ;TWO TRACKBALLS\r
+NXTGMTP2  LDA     #1                     ;SHARE THE TRACKBALL\r
+          STA     ALTCTRLS\r
+\r
+INCGMTP2  LDA     GAMETYPE\r
+          BEQ     UPDATDSP\r
+          DEC     GAMETYPE               ;DECREASE GAMETYPE\r
+          BPL     UPDATDSP\r
+\r
+NOATSTH   ASL     A\r
+          BMI     UPDATDSP\r
+\r
+          JSR     INCALT\r
+          BNE     UPDATDSP\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #3\r
+          BEQ     UPDATDSP\r
+          INC     GAMETYPE               ;INCREASE GAMETYPE\r
+\r
+UPDATDSP\r
+          LDA     #0\r
+          LDX     #2\r
+ZSCRLP    STA     SCORE0,X\r
+          STA     SCORE1,X\r
+          STA     SCORE2,X\r
+          DEX\r
+          BPL     ZSCRLP\r
+\r
+          LDX     #0\r
+          JSR     CLRMAPZN\r
+\r
+          LDA     #1                     ;WHEN AN INPUT HAS BEEN RECEIVED, KEEP\r
+          STA     LETTRNUM               ;   TITLE PAGE UP THERE LONGER\r
+\r
+LVMENUPG  JSR     DSPLYOPT\r
+\r
+SKPMENPG  LDA     SHOTTIMR               ;CHECK FOR BUTTON RESTART\r
+          BEQ     CHKBTTN\r
+          DEC     SHOTTIMR\r
+          BNE     NORESET\r
+\r
+CHKBTTN   LDA     BUTNIB                 ;GAME START WHEN BUTTON COMES UP\r
+          BMI     BTNUP\r
+          STA     DEBOUNCE               ;INPT4 LOW (BTN. DOWN), SET DEBOUNCE LO\r
+NORESET   RTS\r
+\r
+BTNUP     EOR     DEBOUNCE\r
+          BPL     NORESET\r
+          STA     DEBOUNCE               ;INPT4 HIGH (BTN. UP), DEBOUNCE LOW\r
+                                         ;   =START, DEBOUNCE HIGH\r
+\r
+******************************************\r
+* RESET -- START A NEW GAME\r
+******************************************\r
+GMRESET   LDA     #$00                   ;TURN ON GAME AND INITIALIZE\r
+          STA     SCRTIMER\r
+          STA     ATTRACT\r
+          JSR     INITGAME\r
+\r
+          LDX     #STRTMEN-1             ;SET THE NUMBER OF MEN LEFT IN GAME\r
+          STX     MENLEFT                ;   AND DISPLAY IT\r
+\r
+          LDY     GAMETYPE\r
+          BEQ     ZINITLV1               ;ONE PLAYER GAME\r
+          DEY\r
+          BEQ     ZINITLVX               ;TWO PLAYER ALTERNATING\r
+          DEY\r
+          BEQ     ZINITLV2               ;TWO PLAYER SIMULTANEOUS\r
+\r
+          LDX     #STRTDUAL-2            ;TEAM PLAY -- MEN LEFT POOL\r
+          STX     MENLEFT\r
+          LDA     #L(ELF320)\r
+INITLVB   STA     MUSHMAP+TEAMMEN-1,X\r
+          DEX\r
+          BNE     INITLVB\r
+          RTS\r
+\r
+ZINITLVX  INX\r
+ZINITLV2  STX     MENLEFT+1\r
+\r
+          LDY     #5\r
+          LDA     #L(ELF320)\r
+INITLV2   STA     MUSHMAP+ZONELEN-12,Y\r
+          DEY\r
+          DEX\r
+          BNE     INITLV2\r
+\r
+ZINITLV1  LDX     MENLEFT\r
+          LDA     #L(ELF320)\r
+INITLV1   STA     MUSHMAP+6-1,X\r
+          DEX\r
+          BNE     INITLV1\r
+\r
+          RTS\r
+\r
+\r
+******************************************\r
+***       CHANGE GAME OPTIONS\r
+******************************************\r
+\r
+NXTGMOPT\r
+          INC     DIFLEVEL\r
+          LDA     DIFLEVEL\r
+          CMP     #4\r
+          BNE     NOGMEND\r
+          LDX     #0\r
+          STX     DIFLEVEL\r
+\r
+          JSR     INCALT\r
+          BNE     NOGMEND\r
+\r
+INCGMTP   INC     GAMETYPE\r
+          LDA     GAMETYPE\r
+          CMP     #4\r
+          BNE     NOGMEND\r
+WRAPGMTP  STX     GAMETYPE\r
+NOGMEND   RTS\r
+\r
+INCALT    LDA     GAMETYPE\r
+          CMP     #1\r
+          BNE     NEXTGMTP\r
+          LDA     ALTCTRLS\r
+          BNE     NEXTGMTP\r
+          LDA     TRACKF\r
+          BEQ     NEXTGMTP\r
+          LDA     TRACKF+1\r
+          BNE     NEXTGMTP               ;TWO TRACKBALLS\r
+          LDA     #1\r
+          STA     ALTCTRLS               ;SHARE THE TRACKBALL\r
+          BNE     INCALTND\r
+\r
+NEXTGMTP  LDA     #0\r
+          STA     ALTCTRLS\r
+INCALTND  RTS\r
+\r
+********************************************************************************\r
+*         CHKEND                                                               *\r
+* CHECK FOR THE END OF A GAME AND THE END OF EACH PLAYER'S TURN                *\r
+********************************************************************************\r
+CHKEND    LDA     SHTRTIMR\r
+          BEQ     NOGMEND\r
+\r
+* CHECK TO MAKE SURE MUSHROOM RESTORATION HAS FINISHED BEFORE PROCEEDING\r
+          BIT     FLAGS\r
+          BVS     NOGMEND\r
+\r
+          SEC\r
+          SBC     #1\r
+          STA     SHTRTIMR\r
+          AND     #$7F\r
+          BNE     NOGMEND\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     CHKEND1                ;NOT A DUAL PLAYER MODE\r
+          LDX     #0\r
+          STX     PLAYER\r
+;;;;;     LDA     GAMETYPE\r
+          CMP     #3\r
+          BEQ     CHKEND1\r
+\r
+          LDA     MENLEFT                ;IS THERE A MESSAGE UP?\r
+          AND     #$C0\r
+          BNE     CHKEND1\r
+          LDA     MENLEFT+1\r
+          AND     #$C0\r
+          BNE     CHKEND2\r
+          LDA     SHTRSTAT               ;ONLY CHECK SHOOTER WITH POSITIVE\r
+          BEQ     CHKEND1                ;   STATUS (HAS BEEN BLOWN AWAY)\r
+CHKEND2   INC     PLAYER\r
+\r
+CHKEND1   BIT     ATTRACT\r
+          BMI     NOGMEND\r
+          BVC     SKPGMATR\r
+\r
+******************************************\r
+* ATTRACT MODE GAME OVER?\r
+******************************************\r
+          LDA     ATGMTMR\r
+          AND     #$7F\r
+          CMP     #20\r
+          BCC     ZGAME\r
+          JMP     GAMEDONE\r
+ZGAME     LDA     #-1\r
+          STA     ATTSHTRY\r
+          STA     ATTSHTRY+1\r
+          JMP     INATGAME\r
+\r
+******************************************\r
+* "PLAYER X" MESSAGE DISPLAYED LONG ENOUGH, START PLAYING AGAIN\r
+******************************************\r
+OTHERPLR                                 ;GET RID OF "PLAYER x " MESSAGE AT\r
+          LDA     MENLEFT,X              ;   START OF A PLAYER'S TURN\r
+          AND     #$07\r
+          STA     MENLEFT,X\r
+\r
+          LDA     #0\r
+          STA     SHTRTIMR\r
+\r
+ERSPLR    LDY     #8\r
+ERASEPLR  LDA     MSGSTORE+9,Y\r
+          STA     MUSHMAP+13*ZONELEN+11,Y\r
+          DEY\r
+          BPL     ERASEPLR\r
+          RTS\r
+\r
+******************************************\r
+* SOMEBODY DIED RECENTLY, DO SOMETHING ABOUT IT\r
+******************************************\r
+SKPGMATR\r
+          LDX     PLAYER\r
+          LDA     MENLEFT,X\r
+          BEQ     OUTOFGM                ;SOMEBODY'S GAME JUST ENDED\r
+          BPL     ZCONTGM\r
+          JMP     ZMSGOVER               ;"GAME OVER" MESSAGE DONE DISPLAYING\r
+ZCONTGM   AND     #$40\r
+          BNE     OTHERPLR               ;"PLAYER X" MESSAGE DONE, RESUME PLAY\r
+JMPINGM   JMP     INGAME                 ;GAME STILL IN PROGRESS\r
+\r
+******************************************\r
+* SOMEBODY'S GAME JUST ENDED, DISPLAY\r
+*   "GAME OVER ,  PLAYER X" MESSAGE\r
+******************************************\r
+OUTOFGM   LDA     GAMETYPE\r
+          CMP     #3\r
+          BNE     GAMEOUT\r
+\r
+          LDA     SHTRSTAT               ;A TEAM PLAY GAME DOESN'T END UNTIL\r
+          ORA     SHTRSTAT+1             ;   BOTH PLAYERS HAVE DIED\r
+          BPL     GAMEOUT\r
+          LDA     #$40\r
+          LDY     SHTRSTAT\r
+          BMI     NOTDEAD1\r
+          STA     SHTRSTAT\r
+          BPL     DEAD1                  ;ALWAYS\r
+NOTDEAD1  STA     SHTRSTAT+1\r
+DEAD1     LDA     FLAGS\r
+          ORA     #$80\r
+          STA     FLAGS\r
+          JMP     INATGAME\r
+\r
+GAMEOUT   LDY     #8                     ;DISPLAY "GAME  OVER"\r
+ZDSPGOVR  LDA     MUSHMAP+12*ZONELEN+11,Y\r
+          STA     MSGSTORE,Y\r
+          LDA     MGMOVER,Y\r
+          STA     MUSHMAP+12*ZONELEN+11,Y\r
+          DEY\r
+          BPL     ZDSPGOVR\r
+\r
+          LDY     GAMETYPE               ;IN ONE PLAYER OR TEAM PLAY GAMES,\r
+          DEY                            ;   DON'T CARE WHICH PLAYER\r
+          CPY     #2\r
+          BCS     STMSGTMR\r
+\r
+* ALTERNATING OR COMPETITION GAME\r
+          LDA     SHTRTIMR               ;DID BOTH PLAYERS LOSE A LIFE?\r
+          BPL     COMPCHK                ;NO\r
+\r
+          LDA     MENLEFT                ;DID BOTH PLAYERS GAMES END?\r
+          ORA     MENLEFT+1\r
+          BEQ     STBTHVR                ;YES\r
+\r
+          LDA     MENLEFT                ;IF OTHER PLAYER GOT BROUGHT BACK TO\r
+          AND     MENLEFT+1              ;   LIFE BY MY MUSHROOM RESTORATION,\r
+          BEQ     COMPCHK                ;   CLEAR THE FLAG\r
+          LDA     FLAGS\r
+          AND     #$7F\r
+          STA     FLAGS\r
+\r
+COMPCHK   DEY                            ;AFTER THIS, Y=#$FF=ALT, Y=0=COMP\r
+          BNE     PLRXOVER               ;ALTERNATING\r
+\r
+          BIT     FLAGS                  ;IS OTHER PLAYER ALSO DEAD?\r
+          BMI     WHOWINS                ;YES\r
+\r
+;;;;;     LDX     PLAYER                 ;IS SCORE OF PLAYER WHO DIED HIGHER\r
+          JSR     CMPSCORE               ;   THAN OR SAME AS PLAYER WHO LIVED?\r
+          BCS     PLRXOVER               ;YES--KEEP PLAYING\r
+          LDA     FLAGS                  ;NO, OTHER PLAYER WON AND GAME IS OVER\r
+          ORA     #$80\r
+          STA     FLAGS\r
+          BCC     OTHRWINS\r
+\r
+* DISPLAY "PLAYER X"\r
+PLRXOVER  JSR     SHOWPLR1               ;"PLAYER 1" MESSAGE\r
+          LDX     PLAYER                 ;GET CORRECT PLAYER NUMBER\r
+          TXA\r
+          CLC\r
+          ADC     #L(DGT1)\r
+          STA     MUSHMAP+13*ZONELEN+19  ;PUT CORRECT PLAYER NUMBER UP\r
+          JMP     STMSGTMR\r
+\r
+* SET BOTH-GAMES-OVER FLAG\r
+STBTHVR   LDA     FLAGS                  ;BOTH DIED, SET FLAG TO SHOW OTHER\r
+          ORA     #$80                   ;   PLAYER'S GAME HAS ENDED\r
+          STA     FLAGS\r
+\r
+* DECIDE WHICH PLAYER WON\r
+WHOWINS\r
+;;;;;     LDX     PLAYER\r
+          JSR     CMPSCORE\r
+          BCC     OTHRWINS               ;OTHER PLAYER DEFINITELY WON\r
+          TYA\r
+          TAX                            ;SWITCH PLAYERS\r
+          JSR     CMPSCORE\r
+          BCS     GAMETIED\r
+                                         ;SWITCH BACK\r
+OTHRWINS  TYA\r
+          TAX\r
+\r
+* DISPLAY "PLAYER X WINS"\r
+PLRXWINS  LDY     #12                    ;PUT UP "PLAYER  1WINS"\r
+ZDSPWINR  LDA     MPLAYER,Y\r
+          STA     MUSHMAP+14*ZONELEN+9,Y\r
+          DEY\r
+          BPL     ZDSPWINR\r
+\r
+          TXA\r
+          CLC\r
+          ADC     #L(DGT1)\r
+          STA     MUSHMAP+14*ZONELEN+16  ;PUT CORRECT PLAYER NUMBER UP\r
+          LDA     #L(EMPTY)\r
+          STA     MUSHMAP+14*ZONELEN+17\r
+\r
+* SET TIMER FOR MESSAGE\r
+STMSGTMR  DEC     MENLEFT,X              ;SET MENLEFT,X = #$FF AS "GAME OVER"\r
+                                         ;   DISPLAY FLAG\r
+          LDA     SHTRTIMR\r
+          ORA     #$7F                   ;SET TIMER TO LEAVE GAME OVER MESSAGE\r
+          STA     SHTRTIMR               ;   UP\r
+          RTS\r
+\r
+GAMETIED  LDY     #12                    ;PUT UP "YOU HAVE TIED"\r
+ZDSPTIE   LDA     MTIE,Y\r
+          STA     MUSHMAP+14*ZONELEN+9,Y\r
+          DEY\r
+          BPL     ZDSPTIE\r
+          BMI     STMSGTMR\r
+\r
+******************************************\r
+* "GAME OVER" MESSAGE DISPLAYED LONG ENOUGH\r
+******************************************\r
+ZMSGOVER  LDA     GAMETYPE\r
+          BEQ     DONEHSCR               ;ALWAYS HIGH SCORE IN ONE PLAYER\r
+\r
+          CMP     #3\r
+          BEQ     GMEDONE                ;NEVER HIGH SCORE AT TOP IN TEAM PLAY\r
+\r
+          LDA     FLAGS                  ;IN TWO PLAYER MODES, WE'RE STILL IN\r
+          BPL     NOTGMVR                ;   GAME IF OTHER PLAYER HADN'T ALREADY\r
+                                         ;   DIED\r
+\r
+******************************************\r
+* ALL GAMES HAVE ENDED -- DO SOMETHING ABOUT IT\r
+******************************************\r
+DONEHSCR  JSR     CHKHSCR                ;CHECK HIGH SCORE AT TOP OF DISPLAY\r
+\r
+GMEDONE   LDX     #0\r
+          LDA     GAMETYPE               ;TEAM PLAY?\r
+          BEQ     TMHSC0\r
+          CMP     #3\r
+          BNE     NOTMHSC\r
+          JSR     CMPSCORE               ;YES--IS PLAYER 1'S SCORE HIGHER?\r
+          BCS     TMHSC0                 ;   YES\r
+          BCC     TMHSC1                 ;   NO--USE PLAYER 2\r
+\r
+NOTMHSC   JSR     HSCNTR1\r
+TMHSC1    LDX     #1\r
+TMHSC0    JSR     HSCNTR1\r
+\r
+GAMEDONE  LDA     #$80\r
+          STA     ATTRACT\r
+          JMP     INITATGM               ;INITIALIZE GAME ATTRACT MODE\r
+\r
+******************************************\r
+* RESTART THE OTHER PLAYER IN A TWO PLAYER ALTERNATING OR SIMULTANEOUS GAME\r
+*   AFTER OTHER PLAYER'S GAME JUST ENDED\r
+******************************************\r
+NOTGMVR   ORA     #$80\r
+          STA     FLAGS                  ;SET THAT FLAG\r
+\r
+          LDA     #0                     ;DELETE "GAME OVER" DISPLAY FLAG\r
+          STA     MENLEFT,X\r
+          LDA     #$40                   ;INDICATE THAT THIS PLAYER'S GAME IS\r
+          STA     SHTRSTAT,X             ;   OVER\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BNE     ALTGM                  ;BRANCH IF ALTERNATING GAME\r
+\r
+          LDY     #8                     ;IN SIMULTANEOUS GAME, MUST ERASE\r
+ZERSGOVR  LDA     MSGSTORE,Y             ;   "GAME OVER" FROM MUSHROOM FIELD\r
+          STA     MUSHMAP+12*ZONELEN+11,Y\r
+          DEY\r
+          BPL     ZERSGOVR\r
+          BMI     SIMULTGM               ;"PLAYER  X" MESSAGE STAYS UP AS READY\r
+                                         ;   MESSAGE\r
+\r
+******************************************\r
+* ENTRY POINT FOR RESTARTING GAMES AFTER LOSING A LIFE, NOT A GAME\r
+******************************************\r
+INGAME    LDA     GAMETYPE\r
+          CMP     #1\r
+          BNE     INGAME1P\r
+\r
+* TWO PLAYER ALTERNATING GAME, SWITCH PLAYERS IF BOTH ALIVE\r
+          LDA     FLAGS\r
+          BMI     INGAME1P               ;BRANCH IF ONLY ONE ALIVE\r
+\r
+ALTGM     JSR     SWAP\r
+          JSR     SHOWPLR1               ;DISPLAY "PLAYER 1"\r
+\r
+SIMULTGM  LDA     #1\r
+          STA     COLORFLG\r
+          EOR     PLAYER\r
+          TAX\r
+          STX     PLAYER\r
+\r
+          CLC\r
+          ADC     #L(DGT1)\r
+          STA     MUSHMAP+13*ZONELEN+19  ;PUT CORRECT PLAYER NUMBER UP\r
+\r
+          LDA     MENLEFT,X              ;SET "PLAYER X" MESSAGE FLAG\r
+          ORA     #$40\r
+          STA     MENLEFT,X\r
+\r
+          LDA     SHTRTIMR\r
+          ORA     #$7F                   ;TIME TO LEAVE IT UP\r
+          STA     SHTRTIMR\r
+          BMI     KILL1                  ;HANDLES CASE OF BOTH PLAYERS DYING\r
+                                         ;   OTHER PLAYER LOST GAME, THIS ONE\r
+                                         ;   DIDN'T\r
+\r
+          LDA     GAMETYPE               ;AT THIS POINT IN SIMULT. GAME, OTHER\r
+          CMP     #2                     ;   PLAYER'S GAME JUST ENDED AND THIS\r
+          BEQ     INATGAME               ;   PLAYER SHOULDN'T LOSE A LIFE\r
+\r
+******************************************\r
+* REMOVE AN EXTRA MAN TO BE USED AS CURRENT MAN\r
+******************************************\r
+INGAME1P\r
+          LDA     SHTRTIMR               ;SHTRTIMR IS NEGATIVE IF BOTH PLAYERS\r
+          BPL     KILL1                  ;   DIED IN SAME FRAME\r
+\r
+* BOTH PLAYERS LOST A LIFE\r
+          LDA     GAMETYPE               ;TEAM PLAY?\r
+          CMP     #3\r
+          BNE     KILL2                  ;NO\r
+          LDA     MENLEFT\r
+          BNE     STILLTM\r
+          JMP     GAMEOUT                ;LOST TWO LIVES, ENDING THE GAME\r
+\r
+STILLTM\r
+;;;;;     LDX     #0                     ;YES\r
+          JSR     TAKEMAN\r
+          DEC     MENLEFT                ;IN GAME 3 PLAYER ALWAYS IS 0\r
+          BNE     KILL1\r
+* AT THIS POINT IN TEAM PLAY GAME, ONLY ONE PLAYER CONTINUES -- DECIDE WHICH\r
+          LDX     #1\r
+          JSR     CMPSCORE\r
+          LDA     #$40                   ;PLAYER 2 CONTINUES\r
+          LDY     #$80\r
+          BCS     GOPLR2\r
+          TAY                            ;PLAYER 1 CONTINUES\r
+          ASL     A\r
+GOPLR2    STA     SHTRSTAT\r
+          STY     SHTRSTAT+1\r
+          LDA     FLAGS\r
+          ORA     #$80\r
+          STA     FLAGS\r
+          BNE     INATGAME\r
+\r
+KILL2     LDX     #1                     ;DUAL PLAYER COMPETITION, BOTH PLAYERS\r
+          STX     PLAYER                 ;   LOST A LIFE.  WE KNOW PLAYER 1'S\r
+          LDA     MENLEFT+1              ;   GAME ISN'T OVER, HOW ABOUT PLAYER\r
+          BNE     DOKILL2                ;   2'S?\r
+          JMP     OUTOFGM\r
+DOKILL2   JSR     TAKEMAN\r
+          DEC     MENLEFT+1\r
+          LDX     #0\r
+          STX     PLAYER\r
+\r
+KILL1  ;  LDX     PLAYER\r
+          JSR     TAKEMAN\r
+          DEC     MENLEFT,X              ;DEDUCT A LIFE\r
+\r
+******************************************\r
+* INITIALIZE TO START PLAYING AGAIN\r
+******************************************\r
+INATGAME  LDA     #$00\r
+;;;;;     STA     SHOTSTAT               ;THIS IS ALWAYS SET TO $80 LATER\r
+          STA     SHOTSTAT+1\r
+\r
+          LDA     SHTRTIMR\r
+          AND     #$7F\r
+          STA     SHTRTIMR\r
+\r
+          JSR     MAKCENTI\r
+\r
+          LDA     #$00\r
+          STA     FLEASTAT\r
+\r
+          STA     SPDRSTAT\r
+          LDX     DIFLEVEL\r
+          LDA     SPDRWTDF,X\r
+          STA     SPDRTIMR\r
+\r
+\r
+* PUT THE SHOOTERS BACK TOGETHER\r
+INITPLRS  LDA     #CNTRCLMN              ;CALLED AS SUBROUTINE FROM CMAIN\r
+          STA     SHOOTERX\r
+          STA     SHOOTERX+1\r
+          LDA     #CNTRCLMN+2\r
+          STA     SHOTX\r
+          STA     SHOTX+1\r
+          LDY     #184\r
+          STY     SHOOTERY\r
+          STY     SHOOTERY+1\r
+          DEY\r
+          STY     SHOTY\r
+          STY     SHOTY+1\r
+          LDA     #L(ELF)\r
+          STA     SHTROFST\r
+          LDA     #L(ELFB)\r
+          STA     SHTROFST+1\r
+          JSR     SHTRCLRS\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     SNGLSHIT               ;GAMES 0 OR 1 -- NOT DUAL PLAY\r
+          BEQ     CHKFLAGS\r
+\r
+          LDX     #1                     ;TEAM PLAY\r
+          LDA     SHTRSTAT+1\r
+          BMI     SHTEMUP\r
+          LDX     #0\r
+SHTEMUP   STX     PLAYER\r
+\r
+CHKFLAGS  LDA     FLAGS                  ;IS EITHER PLAYER DEAD?\r
+          BPL     DUALSHIT               ;NO\r
+\r
+SNGLSHIT  LDX     PLAYER\r
+          LDA     #$80\r
+          STA     SHTRSTAT,X\r
+          STA     SHOTSTAT,X\r
+          TXA\r
+          EOR     #$01\r
+          TAX\r
+          LDA     #$40\r
+          STA     SHTRSTAT,X\r
+          LDA     #$00\r
+          STA     SHOTSTAT,X\r
+          RTS\r
+\r
+DUALSHIT  LDA     #$80\r
+          STA     SHTRSTAT\r
+          STA     SHTRSTAT+1\r
+          STA     SHOTSTAT\r
+          STA     SHOTSTAT+1\r
+\r
+          LDA     #CNTRCLMN-8\r
+          STA     SHOOTERX\r
+          LDA     #CNTRCLMN-8+2\r
+          STA     SHOTX\r
+          LDA     #CNTRCLMN+8\r
+          STA     SHOOTERX+1\r
+          LDA     #CNTRCLMN+8+2\r
+          STA     SHOTX+1\r
+          RTS\r
+\r
+\r
+SHTRCLRS  LDA     #$18                   ;SHOOTER1\r
+          STA     P0C1\r
+          STA     P0C2\r
+          LDA     #$6E\r
+          STA     P0C3\r
+\r
+          LDA     #$97                   ;SHOOTER2\r
+          STA     P1C1\r
+          STA     P1C2\r
+          LDA     #$0F\r
+          STA     P1C3\r
+          RTS\r
+\r
+******************************************\r
+SHOWPLR1  LDY     #8                     ;PUT UP "PLAYER 1 " OR "PLAYER 2 "\r
+ZDSPPLR1  LDA     MUSHMAP+13*ZONELEN+11,Y        ;MESSAGE AT THE START OF A\r
+          STA     MSGSTORE+9,Y           ;PLAYER'S TURN, AND GET RID OF IT\r
+          LDA     MPLAYER,Y              ;WITH OTHERPLR CODE ABOVE\r
+          STA     MUSHMAP+13*ZONELEN+11,Y\r
+          DEY\r
+          BPL     ZDSPPLR1\r
+          RTS\r
+\r
+******************************************\r
+* REMOVE A MAN FROM EXTRA MAN POOL\r
+******************************************\r
+TAKEMAN   LDX     PLAYER\r
+          LDA     MENLEFT,X\r
+          AND     #$07\r
+          CPX     #0\r
+          BEQ     SUBLIFE1\r
+\r
+SUBLIFE2  EOR     #$FF\r
+          CLC\r
+          ADC     #21\r
+SUBLIFE1  LDY     GAMETYPE\r
+          CPY     #3\r
+          BNE     SUB1\r
+SUBTEAM   CLC\r
+          ADC     #TEAMMEN-6\r
+SUB1      TAY\r
+          LDA     #L(EMPTY)\r
+          STA     MUSHMAP+6-1,Y\r
+          RTS\r
+\r
+******************************************\r
+* COMPARE THE TWO PLAYER'S SCORES\r
+******************************************\r
+CMPSCORE  TXA                            ;RETURNS CARRY SET IF PLAYER X'S SCORE\r
+          EOR     #$01                   ;   GREATER THAN OR EQUAL TO OTHER\r
+          TAY                            ;   PLAYER'S\r
+          LDA     SCORE0,X\r
+          CMP     SCORE0,Y\r
+          LDA     SCORE1,X\r
+          SBC     SCORE1,Y\r
+          LDA     SCORE2,X\r
+          SBC     SCORE2,Y\r
+          LDA     SCORE3,X\r
+          SBC     SCORE3,Y\r
+          RTS\r
+\r
+\r
+******************************************\r
+* CHECK HIGH SCORE, PUT INTO TOP ROW OF SCREEN\r
+******************************************\r
+;FIRST CHECK FOR THE PRESENSE OF HIGH SCORE CART\r
+CHKHSCR\r
+\r
+          LDY     DIFLEVEL               ;HIGH SCORE IN DIFFERENT GAME VERSIONS?\r
+          LDX     GAMETYPE               ;CHECK SCORES OF BOTH PLAYERS\r
+          BEQ     HSCORELP\r
+          LDX     #1\r
+\r
+HSCORELP  LDA     HSCORE0,Y\r
+          CMP     SCORE0,X\r
+          LDA     HSCORE1,Y\r
+          SBC     SCORE1,X\r
+          LDA     HSCORE2,Y\r
+          SBC     SCORE2,X\r
+          BCS     HSCNXTPL\r
+\r
+          LDA     SCORE0,X\r
+          STA     HSCORE0,Y\r
+          LDA     SCORE1,X\r
+          STA     HSCORE1,Y\r
+          LDA     SCORE2,X\r
+          STA     HSCORE2,Y\r
+\r
+HSCNXTPL  DEX\r
+          BPL     HSCORELP\r
+          RTS\r
+\r
+\r
+\r
+************************************************\r
+* SWAP THE MUSHROOM MAPS FOR TWO PLAYER GAME\r
+************************************************\r
+\r
+SWAP      LDX     #1                     ;IGNORE ROW 0 (SCORE ROW)\r
+\r
+          LDA     #L(MUSHMAP+ZONELEN)    ;INITIAL ROW, MUSHMAP\r
+          STA     GTEMP1\r
+          LDA     #H(MUSHMAP+ZONELEN)\r
+          STA     GTEMP2\r
+\r
+          LDA     #L(MAP2)               ;INITIAL ROW, MAP2\r
+          STA     GTEMP3\r
+          LDA     #H(MAP2)\r
+          STA     GTEMP4\r
+\r
+SWTCHLP1  LDY     #ZONELEN-1             ;LOOP THROUGH ROW\r
+SWTCHLP2  LDA     (GTEMP1),Y             ;READ OUT OF MUSHMAP, INTO A TEMP.\r
+          STA     GTEMP5\r
+          LDA     (GTEMP3),Y             ;READ OUT OF MAP2, INTO MUSHMAP\r
+          STA     (GTEMP1),Y\r
+          LDA     GTEMP5                 ;READ OUT OF TEMP., INTO MAP2\r
+          STA     (GTEMP3),Y\r
+          DEY\r
+          BPL     SWTCHLP2\r
+\r
+          INX                            ;NEXT ROW\r
+          CPX     #NZONES-1              ;THERE IS NO MAP FOR LAST ROW\r
+          BEQ     SWTCHOUT\r
+\r
+          LDA     GTEMP1\r
+          CLC\r
+          ADC     #ZONELEN\r
+          STA     GTEMP1\r
+          BCC     NROWMAP2\r
+          INC     GTEMP2\r
+\r
+NROWMAP2  LDA     GTEMP3\r
+          CLC\r
+          ADC     #ZONELEN\r
+          STA     GTEMP3\r
+          BCC     SWTCHLP1\r
+          INC     GTEMP4\r
+          BNE     SWTCHLP1\r
+\r
+SWTCHOUT  RTS\r
+\r
+\r
+\r
+******************************************\r
+* COLLISION DETECTION ROUTINE FOR SHOOTER\r
+*    CALLED BY THE INDIVIDUAL OBJECT MOVEMENT ROUTINES\r
+*    X = OBJECT NUMBER\r
+******************************************\r
+SHTRCOLL  BIT     ATTRACT\r
+          BMI     SWTCHOUT\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     ZSHTRCOL\r
+\r
+          LDA     #0\r
+          STA     PLAYER\r
+          LDA     SHTRSTAT+1\r
+          AND     #$D0\r
+          CMP     #$80\r
+          BNE     ZSHTRCOL\r
+          LDA     SHTRSTAT\r
+          AND     #$D0\r
+          CMP     #$80\r
+          BNE     SHTRCOL2\r
+\r
+          JSR     ZSHTRCOL\r
+SHTRCOL2  INC     PLAYER\r
+\r
+ZSHTRCOL  LDY     PLAYER\r
+          LDA     OBJX,X\r
+          SEC\r
+          SBC     SHOOTERX,Y\r
+\r
+          CPX     #SPDROBJ\r
+          CLC\r
+          BNE     NOTSPCLL\r
+\r
+          ADC     #SPDRWDTH-1            ;DO IF X=12\r
+          CMP     #SPDRWDTH+5-2\r
+          BCC     HITSHTRX\r
+          RTS\r
+\r
+NOTSPCLL  BPL     FLEAPLXX               ;BRANCH IF X=13\r
+          ADC     #SEGWDTH-1\r
+          CMP     #SEGWDTH+5-2\r
+          BCS     SHCLRTS\r
+          BCC     HITSHTRX\r
+\r
+* COLLISION RANGE FOR FLEA:   -2 <= (OBJX-SHTRX) <= 3\r
+*    SO ADD 2 AND COMPARE:     0 <= (OBJX-SHTRX) <= 5\r
+FLEAPLXX  ADC     #2                     ;FLEAWDTH-3\r
+          CMP     #6                     ;\r
+          BCS     SHCLRTS\r
+\r
+HITSHTRX\r
+          LDA     OBJY,X\r
+          SEC\r
+          SBC     SHOOTERY,Y\r
+          BPL     NOTNEGC2\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #$01\r
+NOTNEGC2  CMP     #6\r
+          BCS     SHCLRTS\r
+\r
+HITPLAY   LDA     SHTRTIMR\r
+          BEQ     ONEDEAD\r
+          LDA     #$80\r
+ONEDEAD   ORA     #$30\r
+          STA     SHTRTIMR\r
+\r
+          LDA     #L(EXPLOS)             ;DIFFERENT EXPLOSION?\r
+          STA     SHTROFST,Y\r
+* START PLAYER DEATH SOUND?\r
+          JSR     SCRAPALL\r
+          LDA     #3\r
+          JSR     TUNIN\r
+\r
+          LDA     #0\r
+          STA     SHOTSTAT,Y\r
+SHCLRTS   RTS\r
+\r
+\r
+\r
+******************************************\r
+*** SHOT.S ***\r
+******************************************\r
+\r
+* DVP     7/29\r
+\r
+SHOOT     BIT     ATTRACT\r
+          BMI     SHCLRTS\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     SHOOTZ\r
+\r
+          LDA     #0\r
+          STA     PLAYER\r
+          BIT     SHTRSTAT+1\r
+          BVS     SHOOTZ\r
+          BIT     SHTRSTAT\r
+          BVS     SHOOTHR\r
+\r
+          LDA     FRMCNT\r
+          AND     #$01\r
+          STA     PLAYER\r
+          JSR     SHOOTZ\r
+          LDA     PLAYER\r
+SHOOTHR   EOR     #$01\r
+          STA     PLAYER\r
+\r
+SHOOTZ    LDA     SHTRTIMR\r
+          BNE     SHOTOUT                ;IF SHOOTER IS DEAD\r
+          LDX     PLAYER\r
+          LDA     SHOTSTAT,X\r
+          LSR     A\r
+          BCS     SHOTCOLL               ;DID SHOT HIT ANYTHING?\r
+          LDA     SHTRSTAT,X             ;IS THE SHOOTER RESING IN?\r
+          AND     #$90\r
+          CMP     #$90\r
+          BNE     RESIN2\r
+          LDA     FRMCNT\r
+          AND     #$0F\r
+          ORA     #$10\r
+          CPX     #1\r
+          BNE     RESIN1\r
+          ORA     #$80\r
+          STA     P1C2\r
+          BNE     RESIN2\r
+RESIN1    STA     P0C2\r
+RESIN2    JMP     CHKSHOT\r
+\r
+*CHECK FOR COLLISION OF SHOT AND OBJECT\r
+SHOTCOLL ;LDX     PLAYER\r
+          LDA     SHOTX,X\r
+          STA     GTEMP1\r
+\r
+          LDA     SHOTY,X\r
+          CLC                            ;IF THIS IS CHANGED, ALSO CHANGE WHERE\r
+          ADC     #2                     ;   MUSHCNT IS DECREMENTED BELOW\r
+          JSR     OBSTAC                 ;CHECK FOR MUSHROOM\r
+          CMP     #L(EMPTY+1)\r
+          BCC     NOMSHHIT\r
+          CMP     #L(POISONED+1)\r
+          BCS     NOMSHHIT\r
+;;;;;     CMP     #L(FLOWER)             ;FLOWER STOPS THE SHOT\r
+;;;;;     BEQ     ENDSHOT\r
+\r
+          TAX                            ;GET VALUE FOR MUSHROOM AFTER HIT\r
+          LDA     MUSHHIT-$41,X\r
+          STA     (GTEMP3),Y\r
+          CMP     #L(EMPTY)\r
+          BNE     ENDSHOT\r
+\r
+          LDA     #1                     ;KILLED A MUSHROOM--ADD 1 TO SCORE\r
+;         LDY     #0\r
+          LDX     PLAYER\r
+          JSR     ADDSCORE\r
+\r
+          LDX     PLAYER                 ;X WAS TRASHED BY ADDSCORE, MAYBE\r
+          LDA     SHOTY,X                ;DECREMENT MUSHROOM COUNT, IF NECESSARY\r
+          CLC\r
+          ADC     #2\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          CMP     #INFLDZN-1\r
+          BCC     ENDSHOT\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #1\r
+          BEQ     ZDECMSH\r
+          LDX     #0                     ;USE ONLY MUSHCNT, NOT MUSHCNT+1, IN\r
+ZDECMSH   DEC     MUSHCNT,X              ;   DUAL PLAYER GAMES\r
+\r
+ENDSHOT   LDX     PLAYER\r
+          LDA     #$80\r
+          STA     SHOTSTAT,X\r
+          LDA     SHOOTERX,X\r
+          CLC\r
+          ADC     #2\r
+          STA     SHOTX,X\r
+          LDA     SHOOTERY,X\r
+          SEC\r
+          SBC     #1\r
+          STA     SHOTY,X\r
+;;;;;     LDA     #L(ELFWSHOT)\r
+;;;;;     STA     SHTROFST,X\r
+SHOTOUT   RTS\r
+\r
+;USHHIT   DB      L(EMPTY),L(QDYING),L(HDYING)\r
+;         DB      L(EMPTY),L(QLIVE),L(HLIVE),L(TLIVE)\r
+;         DB      L(HGROWN),L(QGROWN),L(EMPTY),L(FLOWER)\r
+;         DB      L(EMPTY),L(QPOIS),L(HPOIS),L(TPOIS)\r
+\r
+MUSHHIT   DB      L(ZERO),L(ZERO),L(ELF320)\r
+          DB      L(EMPTY),L(QLIVE),L(HLIVE),L(TLIVE)\r
+          DB      L(ZERO),L(ZERO),L(ZERO),L(ZERO)\r
+          DB      L(EMPTY),L(QPOIS),L(HPOIS),L(TPOIS)\r
+\r
+NOMSHHIT\r
+          LDA     PLAYER\r
+          CLC\r
+          EOR     #$01\r
+          ADC     #14\r
+          TAX\r
+SHOTOBJC  LDA     OBJSTAT,X\r
+          BPL     NXTOB                  ;NEXTOBJC\r
+          LDA     OBJOFFST,X\r
+          CMP     #L(POINT300)\r
+          BCS     NXTOB\r
+\r
+          LDY     PLAYER\r
+          LDA     SHOTY,Y                ;SHOTY-OBJY\r
+          SEC\r
+          SBC     OBJY,X\r
+          BPL     POSDIFF\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+\r
+POSDIFF   CMP     #8\r
+          BCS     NXTOB\r
+\r
+          LDA     SHOOTERY,Y             ;CHECK TO MAKE SURE OBJECT IS ABOVE\r
+          SEC                            ;SHOOTER\r
+          SBC     OBJY,X                 ;SHOOTERY-OBJY\r
+          SBC     #6\r
+          CMP     #200\r
+          BCS     NXTOB\r
+\r
+          LDA     SHOTX,Y\r
+          SEC\r
+          SBC     OBJX,X\r
+          CPX     #13\r
+          BEQ     FLSCSHOT\r
+          BCS     JMPPLRHT\r
+          CPX     #12\r
+          BCS     NOTSEGSH\r
+          JMP     SEGSHOT\r
+NOTSEGSH  CMP     #SPDRWDTH\r
+          BCC     SPDRPNTS\r
+NXTOB     JMP     NEXTOBJC\r
+JMPPLRHT  CMP     #FLEAWDTH\r
+          BCS     NXTOB\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BNE     NXTOB\r
+          TXA                            ;GET PLAYER NUMBER OF PLAYER WHO DIED\r
+          SEC\r
+          SBC     #14\r
+          TAY\r
+          JMP     HITPLAY\r
+\r
+SPDRPNTS  LDX     PLAYER\r
+          LDY     #0\r
+          LDA     SHOOTERY,X\r
+          SEC\r
+          SBC     SPDRY\r
+          CMP     #40\r
+          BCS     SPDREXPL\r
+          LDY     #2\r
+          CMP     #16\r
+          BCC     SPDREXPL\r
+          LDY     #1\r
+SPDREXPL  LDA     POINTSPR,Y\r
+          STA     SPDROFST\r
+\r
+* CHANGE PALETTE FOR SPIDER POINTS TO THAT OF PLAYER WHO SHOT IT\r
+          LDA     OBJPALWD+12\r
+          AND     #$1F\r
+          LDX     PLAYER\r
+          BEQ     PNTSCLR\r
+          ORA     #$20\r
+PNTSCLR   STA     OBJPALWD+12\r
+\r
+          LDA     FRMCNT\r
+          AND     #$18\r
+          EOR     #$80\r
+          STA     SPDRSTAT\r
+          LDA     #$10\r
+          STA     SPDRTIMR\r
+          LDA     #MINX\r
+          CMP     SPDRX\r
+          BCS     PNTSON\r
+          LDA     #MAXX-SPDRWDTH-3\r
+          CMP     SPDRX\r
+          BCS     GOSPOUT\r
+PNTSON    STA     SPDRX\r
+GOSPOUT   LDA     MULT3SP,Y\r
+          TAY\r
+          LDA     #1\r
+          JSR     SCRAPONE\r
+          JMP     SKER                   ;USED TO BE SHOTSCR\r
+\r
+FLSCSHOT  TAY\r
+          LDA     FLEASTAT\r
+          AND     #$40\r
+          BEQ     SCRPSHOT\r
+FLEASHOT  CPY     #FLEAWDTH\r
+          BCC     HITFLEA\r
+NXOB      JMP     NEXTOBJC\r
+HITFLEA   LDY     #2\r
+          LDA     DIFLEVEL\r
+          CMP     #2\r
+          BCC     ICPTYOG                ;ONLY ONE SHOT KILLS FLEA IN EASY\r
+          LDA     FLEASTAT\r
+          ORA     #$03\r
+          CMP     FLEASTAT\r
+          BEQ     ICPTYOG\r
+          STA     FLEASTAT\r
+          JMP     ENDSHOT\r
+ICPTYOG   LDA     #4\r
+          JMP     SHOTSCR\r
+\r
+SCRPSHOT  CPY     #SCRPWDTH\r
+          BCS     NXOB\r
+          INC     FLEAX                  ;ADJUST EXPLOSION POSITION\r
+          LDY     #10\r
+          LDA     #5                     ;TURN OFF SCORPION SOUND\r
+JMPSHTSC  JMP     SHOTSCR\r
+\r
+SEGSHOT   CMP     #SEGWDTH\r
+          BCS     NEXTOBJC\r
+          LDA     OBJY,X\r
+          CMP     #2\r
+          BCC     NEXTOBJC\r
+\r
+* WE HAVE HIT A SEGMENT\r
+* MIDDLE OF A CHAIN? -- IF SO, MAKE NEXT SEG. NEW HEAD\r
+          CPX     #11\r
+          BEQ     KILLSEGM\r
+          LDA     OBJOFFST+1,X\r
+          CMP     #L(EXPLOS)\r
+          BCS     KILLSEGM\r
+          LDA     OBJSTAT+1,X\r
+          AND     #$A0\r
+          CMP     #$80\r
+          BNE     KILLSEGM\r
+          LDA     OBJSTAT+1,X\r
+          ORA     #$20\r
+          STA     OBJSTAT+1,X\r
+          LDA     OBJOFFST+1,X\r
+          EOR     #$30\r
+          STA     OBJOFFST+1,X\r
+\r
+* PUT MUSHROOM UP, KILL SEGM\r
+KILLSEGM  LDA     OBJOFFST,X\r
+          AND     #$04\r
+          EOR     #$04\r
+          BNE     SKIPFC\r
+          LDA     #$FE\r
+SKIPFC    ORA     #$02                   ;X-2 OR X+6\r
+          CLC\r
+          ADC     OBJX,X                 ;PUT UP A MUSHROOM IN SEGMENT'S PLACE\r
+          CMP     #MINX\r
+          BCS     SEGML\r
+          LDA     #MINX\r
+SEGML     CMP     #MAXX\r
+          BCC     SEGMR\r
+          LDA     #MAXX-1\r
+SEGMR     STA     GTEMP1\r
+          LDA     OBJY,X\r
+          JSR     COBSTAC\r
+          BNE     KILLIT\r
+          TXA\r
+          PHA\r
+          LDA     OBJY,X\r
+          JSR     CMUSHER\r
+          PLA\r
+          TAX\r
+\r
+KILLIT    LDA     #L(EXPLOS)\r
+          STA     OBJOFFST,X\r
+          DEC     NUMSEG                 ;ONE LESS SEG. ON SCREEN\r
+          LDA     #2\r
+          JSR     TUNIN\r
+\r
+* SCORE A CENTIPEDE SEGMENT\r
+SEGSCORE  LDY     #$00                   ;ADDING SCORE FOR CENTIPEDE SEGMENT\r
+          LDA     OBJSTAT,X              ;IF BODY SEGMENT -- ADD 10 POINTS\r
+          AND     #$20\r
+          LSR     A\r
+          EOR     #$10\r
+          BNE     BODYSCR\r
+          INY                            ;HEAD -- ADD 100 POINTS\r
+BODYSCR   LDX     PLAYER\r
+          JSR     ADDSCORE\r
+          JMP     ENDSHOT\r
+\r
+NEXTOBJC  DEX\r
+          BMI     SHOTUP\r
+          CPX     #13\r
+          BCC     JUMPSHOT\r
+          LDX     #13\r
+JUMPSHOT  JMP     SHOTOBJC\r
+\r
+SHOTSCR\r
+* EXPLOSION PICTURE, SOUND\r
+          JSR     SCRAPONE\r
+          LDA     #L(EXPLOS)\r
+          STA     OBJOFFST,X\r
+SKER\r
+          LDA     #2\r
+          JSR     TUNIN\r
+          LDX     PLAYER\r
+          LDA     #0\r
+          JSR     ADDSCORE\r
+JENDS     JMP     ENDSHOT                ;JENDS CALLED FROM SHOTUP BELOW\r
+\r
+* CHECK FOR NEW SHOT\r
+CHKSHOT   LDX     PLAYER\r
+          BIT     ATTRACT\r
+          BMI     NOSHOT\r
+          BVS     ATTRSHOT\r
+          LDA     BUTNIB,X             ;CHECK FIRE BUTTON\r
+          BMI     NOSHOT\r
+\r
+ATTRSHOT ;LDA     #L(ELF)\r
+;;;;;     STA     SHTROFST,X\r
+\r
+          JSR     STOPRES\r
+\r
+          LDA     #$81                   ;MARK SHOT AS FIRED -- ALWAYS AT RIGHT\r
+          STA     SHOTSTAT,X             ;   POSITION\r
+\r
+          LDA     #0                     ;START A NEW SHOT\r
+          JSR     SCRAPONE\r
+          LDA     #0\r
+          JMP     TUNIN\r
+\r
+SHOTUP    LDX     PLAYER\r
+          LDA     SHOTY,X\r
+          CMP     #8                     ;AT TOP?\r
+          BCC     JENDS\r
+          SBC     #8                     ;SHOT NOT AT TOP -- MOVE UP\r
+          STA     SHOTY,X\r
+NOSHOT    RTS\r
+\r
+\r
+STOPRES   LDA     SHTRSTAT,X             ;TAKE OUT OF RES MODE\r
+          AND     #$EF\r
+          STA     SHTRSTAT,X\r
+          JMP     SHTRCLRS\r
+\r
+******************************************\r
+* ADVANCE ALL OBJECT EXPLOSION ANIMATIONS\r
+******************************************\r
+EXPLODE   LDA     FRMCNT\r
+          AND     #1\r
+          BNE     NOSHOT\r
+\r
+          LDX     #15\r
+EXPLLP    LDY     OBJOFFST,X\r
+          CPY     #L(POINT300)\r
+          BCC     EXPLNEXT               ;EXPLOSION STAMP PUNT, TRY NEXT\r
+          CPX     #12\r
+          BCC     NRMLEXPL               ;CENTIPEDE EXPLOSION\r
+          BEQ     SPIDEY                 ;SPIDER  EXPLOSION\r
+          CPX     #13\r
+          BEQ     NRMLEXPL               ;FLEA EXPLOSION\r
+;ELSE SHOOTER EXPLOSION\r
+\r
+          BIT     FLAGS                  ;IF MUSHROOM RESTORATION, USE NORMAL\r
+          BVS     NRMLEXPL               ;   EXPLOSION\r
+          LDA     FRMCNT                 ;SHOOTER EXPLOSION IS SLOWED DOWN\r
+          AND     #$07\r
+          BNE     EXPLNEXT\r
+\r
+          CPY     #L(EXPLOS+4)\r
+          BNE     ZNRMLEXP\r
+          LDA     FLAGS                  ;SHOOTER EXPLOSION DONE, TURN ON\r
+          ORA     #$40                   ;   MUSHROOM RESTORATION\r
+          STA     FLAGS\r
+          LDA     #0                     ;ROW, COLUMN OF FIRST MUSHROOM\r
+          STA     GTEMP5\r
+          STA     GTEMP6\r
+          BEQ     NOTHING                ;ALWAYS\r
+\r
+***********\r
+NRMLEXPL  CPY     #L(EXPLOS+4)\r
+          BEQ     NOTHING\r
+ZNRMLEXP  INC     OBJOFFST,X\r
+          INC     OBJOFFST,X\r
+          BNE     EXPLNEXT               ;ALWAYS\r
+\r
+***********\r
+SPIDEY    DEC     SPDRTIMR               ;LEAVE SPIDER POINTS UP FOR A WHILE\r
+          BNE     EXPLNEXT\r
+          LDY     DIFLEVEL               ;SET TIMER FOR REAPPEARANCE\r
+          LDA     SPDRWTDF,Y\r
+          STA     SPDRTIMR\r
+\r
+***********\r
+NOTHING   LDA     #0\r
+          STA     OBJOFFST,X\r
+          STA     OBJSTAT,X\r
+EXPLNEXT  DEX\r
+          BPL     EXPLLP\r
+          RTS\r
+\r
+\r
+\r
+;HSCSETUP FIRST DETERMINES IF THERE IS A HSC PLUGGED IN IF IT IS A ZERO IS\r
+;RETUNED AND THE ARGUMENT BLOCK IS SETUP. IF THE CART IS NOT PRESENT, THE ZERO\r
+;FLAG IS RESET. DURATION IS SET TO ZERO FOR HSCENTER. ANY OTHER VALUE MUST BE\r
+;STORED AFTER CALLING HSCSETUP. ACTUAL SCORES MUST BE MOVED INTO THE SCORE BLOCK\r
+;OUTSIDE THIS ROUTINE.\r
+;FIRST CHECK FOR THE PRESENSE OF HIGH SCORE CART\r
+\r
+HSCSETUP\r
+          LDA     $3900                  ;HSC THERE?\r
+          CMP     #$C6\r
+          BNE     NOHSC\r
+          LDA     $3904\r
+          CMP     #$FE\r
+          BNE     NOHSC\r
+\r
+          TXA\r
+          PHA\r
+\r
+          LDA     #$80\r
+          STA     ATTRACT\r
+\r
+          LDX     #14                    ;LOAD FIXED HSC ARGS INTO DATA BLOCK\r
+HSLOADLP  LDA     HSCARGS,X              ;this argument loading must come first\r
+          STA     HSDATA,X               ;in setup, since some args are\r
+          DEX                            ;variable and get reloaded\r
+          BPL     HSLOADLP\r
+\r
+          LDA     #$7F\r
+          STA     CTRL\r
+\r
+          LDA     #0\r
+          LDX     #5\r
+HSCOBJCL  STA     OBJSTAT+12,X\r
+          DEX\r
+          BPL     HSCOBJCL\r
+\r
+          LDA     #5                     ;SO THAT COLOR LOADING ROUTINE ONLY\r
+          STA     HSCFLAG                ;   DOES PAL.S 5,6\r
+          JSR     LOGOINIT               ;LOGO BOTTOM\r
+          LDA     #1\r
+          STA     COLORFLG\r
+\r
+          LDA     #L(HSTOPDLI)\r
+          STA     VECTORI\r
+          LDA     #H(HSTOPDLI)\r
+          STA     VECTORI+1\r
+\r
+          LDX     GAMETYPE               ;NO GAME TYPE DISPLAY IF IN A SINGLE\r
+          LDA     HSGMTYP,X              ;   PLAYER AT A TIME GAME\r
+          BNE     NOTYPDSP\r
+;;;;;     LDA     #0\r
+          STA     DL16+1\r
+\r
+NOTYPDSP  LDA     DIFLEVEL\r
+          ASL     A\r
+          ASL     A\r
+          ORA     HSGMTYP,X\r
+          ASL     A\r
+          ASL     A\r
+          STA     GTEMP3\r
+\r
+          PLA\r
+          TAX\r
+          ORA     GTEMP3\r
+          STA     HSDATA+2               ;DIFFY PLAYNUM\r
+\r
+          LDA     #0                     ;MAKE EQUAL ON RETURN\r
+                                         ;MUST RETURN WITH INITIAL X RESTORED\r
+NOHSC     RTS                            ;   AND ZERO FLAG SET\r
+\r
+\r
+\r
+HSCNTR1   ;ENTER THE INITIALS FOR PLAYER1\r
+          JSR     HSCSETUP\r
+          BNE     RHS1\r
+\r
+          TXA\r
+          PHA\r
+          JSR     MAKCENTI               ;CENTIPEDE FOR HSC LOGO\r
+          PLA\r
+          TAX\r
+\r
+          LDA     GAMETYPE\r
+          BEQ     DOSCREG                ;ONE PLAYER GAME\r
+          CMP     #3\r
+          BEQ     TMSCREG                ;TEAM\r
+          CPX     #0\r
+          BNE     DOSCREG\r
+          STX     HSDATA+$E              ;NO WAIT AFTER FIRST PLAYER IN TWO PLR\r
+          BEQ     DOSCREG\r
+TMSCREG   LDX     #2                     ;USE TEAM SCORE IN TEAM PLAY GAME\r
+DOSCREG   LDA     SCORE3,X\r
+          STA     SCOREBLK\r
+          LDA     SCORE2,X               ;INITIALIZE SCORE INFO TO BE PASSED\r
+          STA     SCOREBLK+1\r
+          LDA     SCORE1,X\r
+          STA     SCOREBLK+2\r
+          LDA     SCORE0,X\r
+          STA     SCOREBLK+3\r
+\r
+          LDY     #H(HSDATA)\r
+          JSR     $3FFD                  ;HSCENTER\r
+\r
+\r
+HSCREC    LDX     #$7F                   ;RECOVER FROM HSC\r
+          STX     CTRL\r
+          LDA     #H(DLL)\r
+          STA     DPH\r
+          LDA     #L(DLL)\r
+          STA     DPL\r
+          LDA     #H(STMPBASE)\r
+          STA     CHARBASE\r
+          LDA     #L(MORPHO)\r
+          STA     VECTORI\r
+          LDA     #H(MORPHO)\r
+          STA     VECTORI+1\r
+          JSR     TURNON                 WAIT FOR TOP OF SCREEN AND TURN DMA ON\r
+          LDX     #0\r
+          STX     HSCFLAG\r
+          INX\r
+          STX     COLORFLG\r
+RHS1      RTS\r
+\r
+\r
+\r
+\r
+HSATRACT  LDA     #11                    ;LOOP FOR ALL GAME LEVELS\r
+          STA     HSATRGM\r
+          JSR     MAKCENTI\r
+\r
+          LDA     GAMETYPE\r
+          PHA\r
+          LDA     DIFLEVEL\r
+          PHA\r
+\r
+HSATRLP   LDX     HSATRGM\r
+          LDA     GAMETBL,X\r
+          LSR     A\r
+          LSR     A\r
+          AND     #$03\r
+          TAY\r
+          BEQ     ZXABD\r
+          INY\r
+ZXABD     STY     GAMETYPE               ;GAMETYPE\r
+          LDA     GAMETBL,X\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          STA     DIFLEVEL               ;DIFLEVEL\r
+\r
+          LDX     #0\r
+          JSR     HSCSETUP\r
+          BNE     ATRREC\r
+\r
+          LDA     #0\r
+          STA     HSDATA+$E\r
+\r
+          LDY     #H(HSDATA)\r
+          JSR     $3FF7                  ;HSCSTAT\r
+\r
+          LDX     HSDATA+4\r
+          CPX     #5\r
+          BCC     ZNHSOK\r
+          LDX     #5\r
+ZNHSOK    LDA     HSTIME,X\r
+          STA     HSDATA+$E               ;DURATION OF HSC\r
+\r
+          LDA     #L(STICKIT)\r
+          STA     HSDATA+4\r
+          LDA     #H(STICKIT)\r
+          STA     HSDATA+5\r
+\r
+          LDY     #H(HSDATA)\r
+          JSR     $3FFA                  ;HSCATRCT\r
+\r
+          LDA     PANEL\r
+          LSR     A\r
+          BCC     ATRLEAVE               ;RESET SWITCH PRESSED\r
+          LSR     A\r
+          BCC     ATRREC                 ;SELECT SWITCH PRESSED\r
+\r
+          LDA     BUTNIB\r
+          BPL     ATRLEAVE\r
+\r
+          JSR     STICKIT0\r
+;;        LDA     SCHTICK\r
+          AND     #$F0\r
+          CMP     #$F0\r
+          BNE     ATRREC\r
+\r
+          DEC     HSATRGM\r
+          BPL     HSATRLP\r
+\r
+ATRREC    PLA\r
+          STA     DIFLEVEL\r
+          PLA\r
+          STA     GAMETYPE\r
+          JMP     HSCREC\r
+\r
+ATRLEAVE  LDA     #$60\r
+          STA     DL16+1\r
+          PLA\r
+          STA     DIFLEVEL\r
+          PLA\r
+          STA     GAMETYPE\r
+          JSR     HSCREC\r
+          LDA     #$FF                   ;MAKE FLAG NEG\r
+NOSOUND   RTS\r
+\r
+\r
+GAMETBL   DB      $38,$28,$18,$08,$34,$24,$14,$04,$30,$20,$10,$00\r
+\r
+HSTIME    DB      0,9,6,5,4,3\r
+\r
+HSCARGS   DB      1,1,0,2,L(STICKIT),H(STICKIT),0,0,L(SCOREBLK),H(SCOREBLK)\r
+          DB      L(HSCDLL),H(HSCDLL),L(NOSOUND),H(NOSOUND),9\r
+\r
+HSGMTYP   DB      0,0,1,2\r
+\r
+\r
+HSTOPDLI\r
+          TXA\r
+          PHA\r
+          TYA\r
+          PHA\r
+          CLD\r
+          LDA     #$40\r
+          STA     CTRL\r
+          LDA     #H(STMPBASE+$100)\r
+          STA     CHARBASE\r
+          LDA     #$80                   ;GROUND CAPS\r
+          STA     VBLANK\r
+          LDA     #L(HSBTMDLI)\r
+          LDY     #H(HSBTMDLI)\r
+ENDHSDLI  STA     VECTORI\r
+          STY     VECTORI+1\r
+          PLA\r
+          TAY\r
+          PLA\r
+          TAX\r
+          PLA\r
+          RTI\r
+\r
+HSBTMDLI\r
+          TXA\r
+          PHA\r
+          TYA\r
+          PHA\r
+          CLD\r
+          LDA     #0\r
+          STA     VBLANK                 ;UNGROUND CAPS\r
+          STA     WSYNC\r
+          STA     WSYNC\r
+          LDA     #$39\r
+          STA     CHARBASE\r
+          LDA     #$4B\r
+          STA     CTRL\r
+          INC     FRMCNT\r
+          JSR     LOADIT\r
+          JSR     MOVCENTI\r
+          JSR     TRACKIT\r
+\r
+          LDA     NUMSEG\r
+          BNE     HSLMST\r
+          LDA     #12\r
+          CLC\r
+          ADC     CLRINDEX\r
+          CMP     #TOPCOLOR\r
+          BNE     HSNOCLR\r
+          LDA     #0\r
+HSNOCLR   STA     CLRINDEX\r
+          LDA     #1\r
+          STA     COLORFLG\r
+          JSR     MAKCENTI\r
+\r
+HSLMST    JSR     LMST                   STUPID NAME FOR COLOR LOAD ROUTINE\r
+          LDA     #L(HSTOPDLI)\r
+          LDY     #H(HSTOPDLI)\r
+          JMP     ENDHSDLI\r
+\r
+\r
+STICKIT\r
+          CPX     #0\r
+          BEQ     ZSTICK                 ;IF PLAYER 0 GO AHEAD\r
+          LDX     #1                     ;ENSURE THAT IT'S PLAYER 1\r
+          LDA     ALTCTRLS               ;SHARE TRACKBALL?\r
+          BEQ     ZSTICK                 ;   NO\r
+                                         ;YES\r
+STICKIT0  LDX     #0\r
+ZSTICK    LDY     BUTNIB,X\r
+          LDA     TRACKF,X\r
+          BNE     DOMOVM                 ;DO TRACKBALL\r
+          CPX     #1\r
+          BNE     STIKI\r
+          LDA     ALTCTRLS\r
+          CMP     #$1\r
+          BNE     STIKI                  ;THE PLAYER WANTS TO SHARE TRACKBALL\r
+          LDX     #0                     ;coerce track0 for two play alt\r
+DOMOVM    LDA     FRMCNT\r
+          AND     #$7\r
+          BNE     ROTSI\r
+          LDA     DELTAX,X\r
+          BNE     CALCIT\r
+          LDA     DELTAY,X\r
+          BNE     CALCIT\r
+          LDA     #$FF\r
+          BMI     DITTY                  ;NO MOVEMENT\r
+CALCIT    LDA     DELTAX,X\r
+          BPL     POSIT\r
+          EOR     #$FF\r
+\r
+          CLC\r
+          ADC     #1\r
+POSIT     STA     TTEMP1\r
+          LDA     DELTAY,X\r
+          BPL     YSOT\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+YSOT      STA     TTEMP2\r
+          CMP     TTEMP1\r
+          BCC     EW\r
+NS        LDA     DELTAY,X               ;SET FLAGS\r
+          BPL     SOU\r
+          LDA     #$EF\r
+DITTY     STA     SCHTICK\r
+          RTS\r
+SOU\r
+          LDA     #$DF                   ;SOUTH JOYSTICK VALUE\r
+          STA     SCHTICK\r
+          RTS\r
+EW        LDA     DELTAX,X\r
+          BPL     EAS\r
+          LDA     #$BF\r
+          STA     SCHTICK\r
+          RTS\r
+EAS       LDA     #$7F\r
+          STA     SCHTICK\r
+          RTS\r
+STIKI     LDA     #0\r
+          STA     CTLSWA\r
+          LDA     SWCHA                  ;joystick\r
+          CPX     #0\r
+          BEQ     ZSTIKI\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+ZSTIKI    STA     SCHTICK\r
+          RTS\r
+ROTSI     LDA     SCHTICK\r
+          RTS\r
diff --git a/FLEA.S b/FLEA.S
new file mode 100644 (file)
index 0000000..924bff6
--- /dev/null
+++ b/FLEA.S
@@ -0,0 +1,268 @@
+*** FLEA.S ***\r
+\r
+* SMD     8/8     ATTRACT MODE CORRECTED\r
+* DVP     7/6     SCORPION MOVEMENT ADDED\r
+* DVP     6/29    FLEA MOVEMENT ROUTINE FOR CENTIPEDE\r
+\r
+FLEASCRP\r
+          LDA     ATTRACT\r
+          BPL     NRMLFLEA\r
+FLOUT     RTS\r
+\r
+NRMLFLEA  LDA     SHTRTIMR\r
+          BNE     FLOUT                  ;IF SHOOTER IS ALIVE\r
+          LDA     FLEAOFST               ;MOVE IF ON SCREEN\r
+          CMP     #L(EXPLOS)\r
+          BCS     FLOUT\r
+          BIT     FLEASTAT\r
+          BPL     TRYFLEA\r
+          BVS     MOVEFLEA\r
+          JMP     MVSCORP\r
+\r
+                                         ;OTHERWISE, DECIDE WHETHER TO START\r
+TRYFLEA   LDX     PLAYER                 ;FIRST RACK?\r
+          LDA     GAMETYPE\r
+          CMP     #1\r
+          BEQ     ZGMTPFL1\r
+          LDX     #0\r
+ZGMTPFL1  LDA     CHAINSIZ,X\r
+          CMP     MAXSGCNT\r
+          BCS     FLOUT                  ;YES\r
+\r
+          LDX     PLAYER\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     ZGMTPFL4\r
+          LDX     #2\r
+          CMP     #3\r
+          BEQ     ZGMTPFL4\r
+          DEX                            ;X=1 HERE\r
+          LDA     SCORE2+1               ;IN COMPETITION GAME, USE PLAYER WITH\r
+          CMP     SCORE2                 ;   HIGHER SCORE\r
+          BCS     ZGMTPFL4\r
+          DEX                            ;X=0 HERE\r
+\r
+ZGMTPFL4  LDA     SCORE2,X               ;DECIDE NUMBER OF MUSHROOMS IN INFIELD\r
+          STA     GTEMP5\r
+          LDY     #5                     ;  TO PREVENT FLEAS, MUST BE AT LEAST\r
+          CMP     #$02                   ;  5 UP TO 20K\r
+          BCC     ENOUGHM                ;  9 UP TO 120K\r
+          LDY     #9                     ;  12 UP TO 140K\r
+          CMP     #$12                   ;  13 UP TO 160K\r
+          BCC     ENOUGHM                ;  14 UP TO 180K\r
+          LSR     A                      ;  ONE MORE FOR EACH 20K\r
+          CLC\r
+          ADC     #6\r
+          TAY\r
+\r
+ENOUGHM   LDX     PLAYER                 ;ENOUGH MUSHROOMS?\r
+          LDA     GAMETYPE\r
+          CMP     #1\r
+          BEQ     ZGMTPFL2\r
+          LDX     #0\r
+ZGMTPFL2  TYA\r
+          CMP     MUSHCNT,X\r
+          BCS     NEWFLEA\r
+          JMP     TRYSCORP\r
+\r
+NEWFLEA   LDA     #4                     ;FLEASND\r
+          JSR     TUNIN\r
+          JSR     RANDOM                 ;TIME FOR A NEW FLEA -- PICK A RANDOM\r
+          AND     #$1F                   ; ROW\r
+          BEQ     FLOUT\r
+          CLC\r
+          ADC     #MINX/4-1              ;ADJUST FOR LEFT MARGIN\r
+          ASL     A\r
+          ASL     A\r
+          STA     FLEAX\r
+          LDA     #$C1                   ;INITIALIZE OTHER FLEA VARIABLES\r
+          STA     FLEASTAT\r
+          LDA     #L(FLEA)\r
+          STA     FLEAOFST\r
+          LDA     #MINY\r
+          STA     FLEAY\r
+\r
+MOVEFLEA  LDA     FRMCNT                 ;CHANGE GRAPHICS EVERY 4TH FRAME\r
+          LSR     A\r
+          AND     #$06\r
+          CLC\r
+          ADC     #L(FLEA)\r
+          STA     FLEAOFST\r
+\r
+          LDA     #0\r
+          LDX     DIFLEVEL\r
+          BEQ     SLOWFLEA\r
+          LDA     #2\r
+          CPX     #3\r
+          BEQ     SLOWFLEA               ;ALWAYS FAST IN EXPERT GAME\r
+          LDA     FLEASTAT               ;MOVE DOWN SCREEN\r
+          AND     #$03\r
+SLOWFLEA  SEC                            ;1 PIXEL/FRAME, NOVICE GAME\r
+          ADC     FLEAY\r
+          CMP     #MAXY                  ;AT BOTTOM?\r
+          BCS     ENDFLEA                ;YES\r
+          STA     FLEAY\r
+\r
+          LDX     #13                    ;CHECK FOR COLLISION WITH PLAYER\r
+          JSR     SHTRCOLL\r
+          LDA     SHTRTIMR\r
+          BNE     FLEAOUT\r
+\r
+          LDA     FRMCNT                 ;GENERATE A NEW MUSHROOM EVERY 4 FRAMES\r
+          AND     #$03                   ; AT MOST\r
+          BNE     FLEAOUT\r
+\r
+          JSR     RANDOM                 ;GENERATE ONLY 1/4 OF THE TIMES ALLOWED\r
+          AND     #$03\r
+          BNE     FLEAOUT\r
+\r
+                                         ;CHECK WHETHER MUSHROOM ALREADY THERE\r
+          LDA     FLEAX\r
+          STA     GTEMP1\r
+          LDA     FLEAY\r
+          CMP     #MAXY-ZONELEN\r
+          BCS     FLEAOUT\r
+;         CLC\r
+          SBC     #3                     ;CHECK 4 PIXELS BEHIND FLEA\r
+          JSR     OBSTAC\r
+          BNE     FLEAOUT                ;MUSHROOM THERE\r
+          LDA     FLEAY                  ;PLACE MUSHROOM 4 PIXELS BEHIND FLEA\r
+          SEC\r
+          SBC     #4\r
+          JSR     MUSHER                 ;INCREMENTS COUNT IF IN INFIELD\r
+FLEAOUT   RTS\r
+\r
+ENDFLEA   LDA     #0\r
+          STA     FLEAOFST\r
+          STA     FLEASTAT\r
+          LDA     #4\r
+          JSR     SCRAPONE\r
+          RTS\r
+\r
+*** START A SCORPION RATHER THAN A FLEA\r
+TRYSCORP\r
+          LDA     FRMCNT                 ;EVERY N FRAMES\r
+          CMP     #$93\r
+          BNE     FLEAOUT\r
+\r
+          LDX     PLAYER                 ;ONLY IN RACKS WITH SMALLER CENTIPEDES\r
+          LDA     GAMETYPE\r
+          CMP     #1\r
+          BEQ     ZGMTPFL3\r
+          LDX     #0\r
+ZGMTPFL3  LDY     CHAINSIZ,X\r
+          INY\r
+          CPY     MAXSGCNT\r
+          BCS     FLEAOUT\r
+\r
+          JSR     RANDOM                 ;ONLY 1/4 OF THE TIME\r
+          AND     #$03\r
+          BNE     FLEAOUT\r
+\r
+          LDA     #5\r
+          JSR     TUNIN\r
+                                         ;START A NEW SCORPION\r
+          LDA     GTEMP5                 ;IF SCORE < 20K USE SLOW\r
+          CMP     #2                     ;   (GTEMP5 SAVED IN TRYFLEA)\r
+          BCC     SLOWSCRP\r
+\r
+          JSR     RANDOM                 ;USE SLOW SCORPION 1/4 OF TIME\r
+          AND     #$03                   ; RANDOMLY OVER 20K\r
+          BEQ     SLOWSCRP\r
+\r
+          LDA     #$82                   ;BIT 2 SET, 1 CLEAR = FAST\r
+          BNE     SCRPRL\r
+\r
+SLOWSCRP  LDA     #$80                   ;BIT 2 CLEAR, 1 SET = SLOW\r
+SCRPRL    BIT     RNDM\r
+          BPL     RGHTSCRP\r
+\r
+LEFTSCRP  ORA     #$01                   ;BIT 0 SET FOR LEFT\r
+          LDX     #MAXX\r
+          BNE     SCRPDIR\r
+\r
+RGHTSCRP  LDX     #MINX-SCRPWDTH\r
+SCRPDIR   STX     FLEAX\r
+          STA     FLEASTAT\r
+\r
+          JSR     RANDOM                 ;PICK A VERTICAL POSITION\r
+          AND     #$1F\r
+          TAY\r
+          LDA     SCRPROW,Y\r
+          STA     FLEAY\r
+\r
+***********       SCORPION MAIN ENTRY POINT\r
+\r
+MVSCORP   LDA     FRMCNT                 ;CHANGE SCORPION ANIMATION EVERY 4\r
+          LSR     A\r
+          LSR     A\r
+          AND     #$03\r
+          TAX\r
+          LDA     FLEASTAT\r
+          LSR     A\r
+          BCC     SANM1\r
+          LDA     LSCRPANM,X\r
+          BCS     SANM2\r
+SANM1     LDA     RSCRPANM,X\r
+SANM2     STA     FLEAOFST\r
+\r
+SAMESCRP\r
+          LDA     FLEASTAT               ;ADJUST SCORPION'S HORZ. POS.\r
+          AND     #$03\r
+          LSR     A                      ;CARRY SET = LEFT, CLEAR = RIGHT\r
+          EOR     #$01                   ;CHECK SPEED (HOW OFTEN SHOULD SCORP.\r
+          AND     FRMCNT                 ;   MOVE)?\r
+          BNE     RSRSRS\r
+          BCC     MVSCRPRT\r
+          DEC     FLEAX                  ;CARRY SET, MOVE LEFT\r
+          BCS     RSRSRS\r
+\r
+MVSCRPRT  INC     FLEAX                  ;CARRY CLEAR, MOVE RIGHT\r
+\r
+RSRSRS    LDA     FLEAX\r
+          SEC\r
+          SBC     #HORIZPOS-SCRPWDTH     ;EDGE DETECTION\r
+          CMP     #MAXX-(HORIZPOS-SCRPWDTH-1)\r
+          BCS     ENDSCRP\r
+\r
+          LDA     FLEAX\r
+          SEC                            ;CHECK WHETHER IN BOUNDARY FOR POISON\r
+          SBC     #SCRPWDTH\r
+          CMP     #MAXX-(SCRPWDTH+4)\r
+          BCS     NOPOISON\r
+\r
+          LDA     FLEAX\r
+;;;;;     CLC\r
+          ADC     #4\r
+          STA     GTEMP1                 ;FOR OBSTAC SUBR.\r
+\r
+          LDA     FLEAY                  ;TEST FOR MUSHROOM\r
+;;;;;     CLC\r
+          ADC     #4\r
+          JSR     OBSTAC\r
+          CMP     #L(QLIVE)\r
+          BCC     NOPOISON\r
+          CMP     #L(LIVE+1)\r
+          BCS     NOPOISON\r
+          ORA     #$08                   ;IT'S THERE, POISON IT\r
+          STA     (GTEMP3),Y\r
+NOPOISON  RTS\r
+\r
+ENDSCRP   LDA     #0\r
+          STA     FLEASTAT\r
+          STA     FLEAOFST\r
+          LDA     #5\r
+          JSR     SCRAPONE\r
+          RTS\r
+\r
+\r
+\r
+\r
+SCRPROW   DB      12,20,28,36,44,52,60,68,76,84\r
+          DB      12,20,28,36,44,52,60,68,76,84\r
+          DB      12,20,28,36,44,52,60,68,76,84\r
+          DB      12,84\r
+\r
+LSCRPANM  DB      L(LSCRP),L(LSCRP+2),L(LSCRP+4),L(LSCRP+6)\r
+\r
+RSCRPANM  DB      L(RSCRP),L(RSCRP+2),L(RSCRP+4),L(RSCRP+6)
\ No newline at end of file
diff --git a/GETDISP.S b/GETDISP.S
new file mode 100644 (file)
index 0000000..d937cad
--- /dev/null
+++ b/GETDISP.S
@@ -0,0 +1,9 @@
+JU\r
+MMILLI;GLOBAL.S,R:$\r
+MMILLI;CDEF.S,R:$\r
+MMILLI;CKERNEL.S,R:$\r
+MMILLI;LOADER.S,R:$\r
+\r
+MMILLI;CDOITK,R:$\r
+MMILLI;GETDISP,R:$\r
+MMILLI;PUTDISP,R:$\r
diff --git a/GETELSE.S b/GETELSE.S
new file mode 100644 (file)
index 0000000..7efc0d1
--- /dev/null
+++ b/GETELSE.S
@@ -0,0 +1,6 @@
+JU\r
+MNH:CENTI;CENTIS.A,R:$\r
+MNH:CENTI;CENTIK.A,R:$\r
+MNH:CENTI;CENTI.A,R:$\r
+MNH:CENTI;CENTI.Z,R:$\r
+MNH:CENTI;SSET,R:$\r
diff --git a/GETGAME.S b/GETGAME.S
new file mode 100644 (file)
index 0000000..9895b38
--- /dev/null
+++ b/GETGAME.S
@@ -0,0 +1,16 @@
+JU\r
+MCENTI;GLOBAL.S,R:$\r
+MCENTI;CDEF.S,R:$\r
+MCENTI;CTABLES.S,R:$\r
+MCENTI;CMAIN.S,R:$\r
+MCENTI;JOYSTICK.S,R:$\r
+MCENTI;DEATH.S,R:$\r
+MCENTI;FLEA.S,R:$\r
+MCENTI;SPIDER.S,R:$\r
+MCENTI;MOVCENTI.S,R:$\r
+MCENTI;MAKCENTI.S,R:$\r
+MCENTI;CTUNES.S,R:$\r
+MCENTI;CDOIT,R:$\r
+MCENTI;PUTGAME,R:$\r
+MCENTI;GETGAME,R:$\r
+J^^CENTI;GETELSE\r
diff --git a/GETIT.S b/GETIT.S
new file mode 100644 (file)
index 0000000..65212a0
--- /dev/null
+++ b/GETIT.S
@@ -0,0 +1,2 @@
+J^^MILLI;GETGAME\r
+J^^MILLI;GETELSE\r
diff --git a/GLOBAL.S b/GLOBAL.S
new file mode 100644 (file)
index 0000000..b63ce5e
--- /dev/null
+++ b/GLOBAL.S
@@ -0,0 +1,26 @@
+** GLOBAL.S **\r
+          GLBL    CHECKUP\r
+          GLBL    ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE\r
+          GLBL    HDLTBL,LDLTBL,COLORTBL,MMAPTBLH,MMAPTBLL,BITTABLE\r
+          GLBL    EMPTY,QDYING,HDYING,TDYING\r
+          GLBL    QLIVE,HLIVE,TLIVE,LIVE\r
+          GLBL    TGROWN,HGROWN,QGROWN,FLOWER\r
+          GLBL    QPOIS,HPOIS,TPOIS,POISONED\r
+          GLBL    SAMPLE\r
+          GLBL    STMPBASE\r
+          GLBL    MORPHO,VBLNK\r
+          GLBL    BURP,RITS\r
+          GLBL    ELF,ELFB,ELF320\r
+          GLBL    FLEA,LSCRP,RSCRP,EXPLOS,SPIDER\r
+          GLBL    POINT300,POINT600,POINT900\r
+          GLBL    SHOT\r
+          GLBL    BLACKL,BLACKR,BTMLINGR\r
+          GLBL    A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z\r
+          GLBL    DGT1,DGT2,COLON,COLON2\r
+\r
+          GLBL    TOV,BLANKOFF,KERNFC,KERNFF,ONSCREEN,OFFSCRN\r
+          GLBL    TPG8LIN1,TPG8LIN2,TPG8LIN3,TPG8LIN4,TPG8LIN5\r
+          GLBL    TPG8CVR1,TPG8CVR2,TPG8CVR3,TPG8CVR4\r
+          GLBL    TUNER,SCRDSP\r
+          GLBL    LMST,LOADER,LOADIT\r
+          GLBL    LOGODLT,TRACKIT\r
diff --git a/HEX.S b/HEX.S
new file mode 100644 (file)
index 0000000..8ace7f5
--- /dev/null
+++ b/HEX.S
@@ -0,0 +1,284 @@
+QLIVE     DB      $00                    $XX04\r
+HLIVE     DB      $00\r
+TLIVE     DB      $00\r
+LIVE      DB      $00\r
+\r
+QPOIS     DB      $00                    $XX0C\r
+HPOIS     DB      $00\r
+TPOIS     DB      $00\r
+POISONED  DB      $00\r
+\r
+QLIVE7    DB      $00                    $XX04\r
+HLIVE7    DB      $00\r
+TLIVE7    DB      $00\r
+LIVE7     DB      $2C\r
+\r
+QPOIS7    DB      $00                    $XX0C\r
+HPOIS7    DB      $00\r
+TPOIS7    DB      $00\r
+POISON7   DB      $14\r
+\r
+QLIVE6    DB      $00                    $XX04\r
+HLIVE6    DB      $00\r
+TLIVE6    DB      $00\r
+LIVE6     DB      $2C\r
+\r
+QPOIS6    DB      $00                    $XX0C\r
+HPOIS6    DB      $00\r
+TPOIS6    DB      $00\r
+POISON6   DB      $14\r
+\r
+QLIVE5    DB      $00                    $XX04\r
+HLIVE5    DB      $00\r
+TLIVE5    DB      $20\r
+LIVE5     DB      $2C\r
+\r
+QPOIS5    DB      $00                    $XX0C\r
+HPOIS5    DB      $00\r
+TPOIS5    DB      $00\r
+POISON5   DB      $14\r
+\r
+QLIVE4    DB      $00                    $XX04\r
+HLIVE4    DB      $80\r
+TLIVE4    DB      $B3\r
+LIVE4     DB      $BF\r
+\r
+QPOIS4    DB      $00                    $XX0C\r
+HPOIS4    DB      $00\r
+TPOIS4    DB      $7F\r
+POISON4   DB      $7F\r
+\r
+QLIVE3    DB      $80                    $XX04\r
+HLIVE3    DB      $83\r
+TLIVE3    DB      $AB\r
+LIVE3     DB      $AB\r
+\r
+QPOIS3    DB      $00                    $XX0C\r
+HPOIS3    DB      $54\r
+TPOIS3    DB      $57\r
+POISON3   DB      $57\r
+\r
+QLIVE2    DB      $68                    $XX04\r
+HLIVE2    DB      $6A\r
+TLIVE2    DB      $6A\r
+LIVE2     DB      $6A\r
+\r
+QPOIS2    DB      $15                    $XX0C\r
+HPOIS2    DB      $95\r
+TPOIS2    DB      $95\r
+POISON2   DB      $95\r
+\r
+QLIVE1    DB      $18                    $XX04\r
+HLIVE1    DB      $18\r
+TLIVE1    DB      $18\r
+LIVE1     DB      $18\r
+\r
+QPOIS1    DB      $24                    $XX0C\r
+HPOIS1    DB      $24\r
+TPOIS1    DB      $24\r
+POISON1   DB      $24\r
+\r
+ELF       DB      $2A,$00                ;39\r
+ELFB      DB      $2A,$00                ;3B\r
+\r
+ELF7      DB      $2A,$00\r
+ELFB7     DB      $AA,$80\r
+\r
+ELF6      DB      $AA,$80\r
+ELFB6     DB      $AA,$80\r
+\r
+ELF5      DB      $AA,$80\r
+ELFB5     DB      $BB,$80\r
+\r
+ELF4      DB      $BB,$80\r
+ELFB4     DB      $2A,$00\r
+\r
+ELF3      DB      $3B,$00\r
+ELFB3     DB      $2A,$00\r
+\r
+ELF2      DB      $2A,$00\r
+ELFB2     DB      $08,$00\r
+\r
+ELF1      DB      $08,$00\r
+ELFB1     DB      $08,$00\r
+\r
+* CENTIPEDE GRAPHICS\r
+CENTBOD8  DB     $18,$04,$18,$48,$24,$10,$24,$21,$69,$32,$28,$88,$69,$8C,$28,$22\r
+CENTHED8  DB     $18,$04,$18,$48,$24,$10,$24,$21,$69,$30,$00,$08,$69,$0C,$00,$20\r
+\r
+CENTBOD7  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$3C,$F8,$AA,$2A,$3C,$2F,$AA,$A8\r
+CENTHED7  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$3C,$F9,$28,$6A,$3C,$6F,$28,$A9\r
+\r
+CENTBOD6  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$E8,$AA,$2A,$AA,$2B,$AA,$A8\r
+CENTHED6  DB     $EE,$E6,$EE,$E6,$BB,$9B,$BB,$9B,$AA,$E8,$AA,$2A,$AA,$2B,$AA,$A8\r
+\r
+CENTBOD5  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$EA,$AA,$EA,$AA,$AB,$AA,$AB\r
+CENTHED5  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$EA,$69,$EA,$AA,$AB,$69,$AB\r
+\r
+CENTBOD4  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$EA,$AA,$EA,$AA,$AB,$AA,$AB\r
+CENTHED4  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$69,$EA,$AA,$EA,$69,$AB,$AA,$EA\r
+\r
+CENTBOD3  DB     $EA,$EA,$EA,$EA,$AB,$AB,$AB,$AB,$AA,$2A,$3C,$E8,$AA,$A8,$3C,$2B\r
+CENTHED3  DB     $EE,$E6,$EE,$E6,$BB,$9B,$BB,$9B,$AA,$2A,$A9,$E8,$AA,$A8,$A9,$E8\r
+\r
+CENTBOD2  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$28,$2A,$7D,$F8,$28,$A8,$7D,$2F\r
+CENTHED2  DB     $2A,$2A,$2A,$2A,$A8,$A8,$A8,$A8,$28,$6A,$3C,$F9,$28,$A9,$3C,$F9\r
+\r
+CENTBOD1  DB     $18,$48,$18,$04,$24,$21,$24,$10,$00,$88,$00,$32,$00,$22,$00,$8C\r
+CENTHED1  DB     $18,$48,$18,$04,$24,$21,$24,$10,$00,$08,$7C,$30,$00,$20,$7C,$30\r
+\r
+FLEA      DB      $00,$00,$00,$00,$00,$80,$08,$00        ;87\r
+\r
+FLEA7     DB      $28,$80,$A2,$80,$22,$80,$08,$80\r
+\r
+FLEA6     DB      $3A,$80,$2A,$00,$2A,$00,$3A,$80\r
+\r
+FLEA5     DB      $3D,$C0,$3D,$C0,$3D,$C0,$3D,$C0\r
+\r
+FLEA4     DB      $F5,$40,$F5,$40,$F5,$40,$F5,$40\r
+\r
+FLEA3     DB      $B7,$40,$B7,$40,$B7,$40,$B7,$40\r
+\r
+FLEA2     DB      $B7,$C0,$B7,$C0,$B7,$C0,$B7,$C0\r
+\r
+FLEA1     DB      $0F,$00,$0F,$00,$0F,$00,$0F,$00\r
+\r
+SPIDER    DB      $C3,$30,$C0            ;26\r
+          DB      $00,$C0,$00            ;29\r
+          DB      $CB,$33,$80            ;2C\r
+          DB      $B0,$C0,$C0            ;2F\r
+\r
+SPIDER7   DB      $C1,$50,$C0\r
+          DB      $C1,$50,$C0\r
+          DB      $C3,$30,$C0\r
+          DB      $C1,$50,$C0\r
+\r
+SPIDER6   DB      $FE,$6F,$C0\r
+          DB      $C2,$60,$C0\r
+          DB      $F1,$53,$C0\r
+          DB      $F2,$63,$C0\r
+\r
+SPIDER5   DB      $01,$50,$00\r
+          DB      $FD,$5F,$C0\r
+          DB      $3E,$6F,$00\r
+          DB      $3D,$5F,$00\r
+\r
+SPIDER4   DB      $C1,$50,$C0\r
+          DB      $31,$53,$00\r
+          DB      $01,$50,$C0\r
+          DB      $C1,$50,$00\r
+\r
+SPIDER3   DB      $C1,$50,$C0\r
+          DB      $C2,$60,$C0\r
+          DB      $C1,$53,$C0\r
+          DB      $F3,$70,$C0\r
+\r
+SPIDER2   DB      $EF,$3E,$C0\r
+          DB      $F3,$33,$C0\r
+          DB      $CF,$7F,$00\r
+          DB      $3F,$3C,$C0\r
+\r
+SPIDER1   DB      $F8,$0B,$C0\r
+          DB      $3F,$3F,$00\r
+          DB      $FE,$00,$00\r
+          DB      $00,$0F,$C0\r
+\r
+LSCRP11   DB      $05,$40                ;70,71\r
+          DB      $01,$50\r
+          DB      $00,$54\r
+          DB      $05,$41\r
+RSCRP11   DB      $01,$50\r
+          DB      $05,$40\r
+          DB      $15,$00\r
+          DB      $41,$50                ;7F\r
+\r
+LSCRP10   DB      $15,$54\r
+          DB      $05,$54\r
+          DB      $01,$55\r
+          DB      $15,$51\r
+RSCRP10   DB      $15,$54\r
+          DB      $15,$50\r
+          DB      $55,$40\r
+          DB      $45,$54\r
+\r
+LSCRP9    DB      $14,$04\r
+          DB      $05,$05\r
+          DB      $05,$41\r
+          DB      $14,$1D\r
+RSCRP9    DB      $10,$14\r
+          DB      $50,$50\r
+          DB      $41,$50\r
+          DB      $74,$14\r
+\r
+LSCRP8    DB      $14,$05\r
+          DB      $05,$01\r
+          DB      $05,$11\r
+          DB      $05,$15\r
+RSCRP8    DB      $50,$54\r
+          DB      $40,$50\r
+          DB      $44,$50\r
+          DB      $54,$50\r
+\r
+LSCRP7    DB      $05,$01\r
+          DB      $05,$01\r
+          DB      $05,$1D\r
+          DB      $05,$00\r
+RSCRP7    DB      $40,$50\r
+          DB      $40,$50\r
+          DB      $74,$50\r
+          DB      $00,$50\r
+\r
+LSCRP6    DB      $D5,$01\r
+          DB      $05,$75\r
+          DB      $D5,$04\r
+          DB      $05,$70\r
+RSCRP6    DB      $40,$57\r
+          DB      $5D,$50\r
+          DB      $10,$57\r
+          DB      $0D,$50\r
+\r
+LSCRP5    DB      $55,$71\r
+          DB      $D5,$50\r
+          DB      $55,$70\r
+          DB      $D5,$50\r
+RSCRP5    DB      $4D,$55\r
+          DB      $05,$57\r
+          DB      $0D,$55\r
+          DB      $05,$57\r
+\r
+LSCRP4    DB      $45,$50\r
+          DB      $55,$10\r
+          DB      $45,$50\r
+          DB      $55,$10\r
+RSCRP4    DB      $05,$51\r
+          DB      $04,$55\r
+          DB      $05,$51\r
+          DB      $04,$55\r
+\r
+LSCRP     DB      $49,$10\r
+          DB      $49,$10\r
+          DB      $49,$10\r
+          DB      $49,$10\r
+RSCRP     DB      $04,$61\r
+          DB      $04,$61\r
+          DB      $04,$61\r
+          DB      $04,$61                ;3F\r
+\r
+LSCRP2    DB      $85,$10\r
+          DB      $45,$20\r
+          DB      $85,$10\r
+          DB      $45,$20\r
+RSCRP2    DB      $04,$52\r
+          DB      $08,$51\r
+          DB      $04,$52\r
+          DB      $08,$51\r
+\r
+LSCRP1    DB      $00,$20\r
+          DB      $80,$00\r
+          DB      $00,$20\r
+          DB      $80,$00\r
+RSCRP1    DB      $08,$00\r
+          DB      $00,$02\r
+          DB      $08,$00\r
+          DB      $00,$02\r
+\r
diff --git a/JOYSTICK.S b/JOYSTICK.S
new file mode 100644 (file)
index 0000000..d77fda8
--- /dev/null
@@ -0,0 +1,542 @@
+;PLAYER JOYSTICK MOVEMENT CONTROL\r
+WLIM      EQU     MINX\r
+ELIM      EQU     MAXX-5                 ;CHANGED FROM 135       DVP\r
+                                         ;CHANGED BACK TO 135 FROM 136  11/29\r
+TOPLIM    EQU     144\r
+BOTLIM    EQU     184\r
+\r
+JOYSTICK  LDA     SHTRTIMR\r
+          BEQ     SKPJOY1\r
+ENDOFJOY  RTS\r
+\r
+SKPJOY1   LDA     GAMETYPE               ;IS THIS A 2 PLAYER SIMULTANEOUS OR\r
+          CMP     #2                     ;   TEAM PLAY GAME?\r
+          BCC     HAVEJOY                ;NO, PROCEED NORMALLY\r
+\r
+          LDA     #0                     ;PLR 1 FIRST\r
+          STA     PLAYER\r
+          BIT     SHTRSTAT+1             ;ONLY PLR 1 IF 2 GAME OVER\r
+          BVS     HAVEJOY\r
+          BIT     SHTRSTAT               ;ONLY PLR 2 IF 1 GAME OVER\r
+          BVS     JOYPL2\r
+\r
+          JSR     HAVEJOY                ;RUN JOYSTICK CODE FOR PLR 1 THEN 2\r
+JOYPL2    INC     PLAYER\r
+\r
+HAVEJOY   BIT     ATTRACT\r
+          BMI     ENDOFJOY               ;RTS\r
+          BVS     SKPJOY2\r
+          JMP     NRMLJOYS\r
+\r
+******************************************\r
+* ATTRACT MODE MOVEMENT\r
+******************************************\r
+SKPJOY2   LDX     PLAYER                 ;INCREMENT THE ATTRACT MODE GAME TIMER\r
+          LDA     FRMCNT                 ;   EVERY SECOND OR SO\r
+          AND     #$3F\r
+          BNE     SKPCRSEC\r
+          LDA     ATGMTMR\r
+          AND     #$7F\r
+          CMP     #$7F\r
+          BEQ     SKPCRSEC\r
+          INC     ATGMTMR\r
+\r
+SKPCRSEC  DEC     ATSITTMR,X             ;COUNT FOR MOTION\r
+          BNE     CHKMVMNT\r
+          LDA     #$80\r
+          STA     ATSITTMR,X             ;RESET MOTION COUNT\r
+          LDA     ATGMTMR,X              ;FLIP MOTION FLAG\r
+          EOR     #$80\r
+          STA     ATGMTMR,X\r
+\r
+CHKMVMNT  LDA     ATGMTMR,X\r
+          BPL     YESMOVE\r
+          JMP     ENDATJOY               ;MOVING IF BIT 7 = 0\r
+YESMOVE   LDX     PLAYER                 ;MOVE HORIZONTALLY ON EVERY OTHER\r
+          LDA     SHOOTERY,X             ;   VERTICAL MOVEMENT\r
+          AND     #$01\r
+          BEQ     NOEWCHNG\r
+\r
+* CHECK FOR LEFT/RIGHT MOVEMENT IN ATTRACT MODE\r
+          LDA     #0\r
+          LDY     ATTSHTRX,X\r
+          BMI     SKPXADJ\r
+          LDA     #4\r
+SKPXADJ   CLC\r
+          ADC     SHOOTERX,X\r
+          STA     GTEMP1\r
+          LDA     SHOOTERY,X\r
+          ADC     #4\r
+          JSR     OBSTAC\r
+          BNE     NOEWCHNG\r
+\r
+          JSR     BUMPEW                 ;OTHER PLAYER IN THE WAY?\r
+          BEQ     NOATBMPE\r
+          STA     GTEMP1\r
+          LDA     ATTSHTRX,X\r
+          BPL     ATTEAST\r
+          LDA     GTEMP1\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+          JMP     ATTEW\r
+ATTEAST   LDA     GTEMP1\r
+ATTEW\r
+          CMP     #-4\r
+          BCS     NOEWCHNG               ;YES, OTHER PLAYER THERE\r
+\r
+NOATBMPE  JSR     STOPRES\r
+          LDA     SHOOTERX,X\r
+          CLC\r
+          ADC     ATTSHTRX,X\r
+          STA     SHOOTERX,X\r
+          CMP     #ELIM\r
+          BCS     CHNGEWDR\r
+          CMP     #WLIM+1\r
+          BCS     NOEWCHNG\r
+\r
+CHNGEWDR  LDA     ATTSHTRX,X\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+          STA     ATTSHTRX,X\r
+\r
+* CHECK FOR UP/DOWN MOVEMENT IN ATTRACT MODE\r
+NOEWCHNG\r
+          LDA     SHOOTERX,X\r
+          CLC\r
+          ADC     #2\r
+          STA     GTEMP1\r
+          LDA     #5\r
+          LDY     ATTSHTRY,X\r
+          BPL     SKPYADJ\r
+          LDA     #3\r
+SKPYADJ ; CLC\r
+          ADC     SHOOTERY,X\r
+          JSR     OBSTAC\r
+          BNE     ENDATJOY\r
+\r
+          JSR     BUMPNS                 ;OTHER PLAYER IN THE WAY?\r
+          BEQ     NOATBMPS\r
+          STA     GTEMP1\r
+          LDA     ATTSHTRY,X\r
+          BPL     ATTSOUTH\r
+          LDA     GTEMP1\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+          JMP     ATTNS\r
+ATTSOUTH  LDA     GTEMP1\r
+ATTNS\r
+          CMP     #-5\r
+          BCS     ENDATJOY\r
+\r
+NOATBMPS  JSR     STOPRES\r
+          LDA     SHOOTERY,X\r
+          CLC\r
+          ADC     ATTSHTRY,X\r
+          STA     SHOOTERY,X\r
+          CMP     #TOPLIM+1\r
+          BCC     CHNGVDIR\r
+          CMP     #BOTLIM\r
+          BCC     ENDATJOY\r
+\r
+CHNGVDIR  LDA     ATTSHTRY,X\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+          STA     ATTSHTRY,X\r
+\r
+ENDATJOY  LDA     SHOTSTAT,X\r
+          LSR     A\r
+          BCS     NOADJSHT               ;SHOT HAS BEEN FIRED\r
+          LDA     SHOOTERX,X\r
+;         CLC\r
+          ADC     #2\r
+          STA     SHOTX,X\r
+          LDA     SHOOTERY,X\r
+;         CLC\r
+          ADC     #-1\r
+          STA     SHOTY,X\r
+NOADJSHT  RTS\r
+\r
+******************************************\r
+* GAME PLAY MOVEMENT\r
+******************************************\r
+NRMLJOYS  LDA     #0\r
+          STA     CRAP\r
+          LDX     PLAYER\r
+          LDA     TRACKF,X\r
+          BEQ     NRML\r
+TRK2P                                    ;X COMING IN HERE IS NOT NECC. PLAYER\r
+          LDA     DELTAY,X               ;SHADOW THESE FOR TWO PLAYER WEIRDNESS\r
+          JSR     SCALE\r
+          STA     TTEMP2\r
+          LDA     DELTAX,X\r
+          BEQ     NORTACK                ;THIS BRANCH PREVENTS DE-REZZING\r
+          JSR     SCALE\r
+          STA     TTEMP1\r
+          LDX     PLAYER\r
+          TAY                            ;SET FLAGS\r
+          BPL     EAST\r
+          JMP     WEST\r
+\r
+NORTACK   LDA     TTEMP2\r
+          BEQ     ENDATJOY               ;THIS BRANCH PREVENTS DE-REZZING\r
+          BMI     JNORTH\r
+          JMP     SOUTH\r
+JNORTH    JMP     NORTH\r
+\r
+;          LDA     SHOOTERX,X\r
+;          CLC\r
+;          ADC     GTEMP1\r
+;          CMP     #WLIM\r
+;          BCS     CKMO\r
+;          LDA     #WLIM\r
+;          BNE     STSHX\r
+;CKMO      CMP     #ELIM\r
+;          BCC     STSHX\r
+;          LDA     #ELIM-1\r
+;STSHX\r
+;          STA     SHOOTERX,X\r
+\r
+\r
+;YCALC     LDA     SHOOTERY,X\r
+;          CLC\r
+;          ADC     GTEMP2\r
+;          CMP     #TOPLIM\r
+;          BCS     CKMOR\r
+;          LDA     #TOPLIM\r
+;          BNE     STSHY\r
+;CKMOR     CMP     #BOTLIM\r
+;          BCC     STSHY\r
+;          LDA     #BOTLIM\r
+;STSHY\r
+;          STA     SHOOTERY,X\r
+;JMEAT     JMP     ENDATJOY\r
+\r
+NRML      ;WATCH OUT FOR MAJOR KLUDGE HERE\r
+          LDA     TRACKF                 ;IF THERE WASN'T A TRACKBALL IN 0\r
+          BEQ     REALN                  ;NO NEED TO DO KLUDGOMATIC\r
+          CPX     #1\r
+          BNE     REALN\r
+          LDA     ALTCTRLS               ;DOES S/HE REALLY WANT TO SWAP?\r
+          CMP     #1\r
+          BNE     REALN\r
+          LDA     BUTNIB                 ;COERCE FIRING FOR PLAYER2 FROM JACK0\r
+          STA     BUTNIB+1\r
+          LDA     #1\r
+          STA     CRAP\r
+          LDX     #0                     ;COERCE FIRST TRACKBALL FOR TWO PLAY\r
+          BEQ     TRK2P\r
+\r
+REALN     LDA     FRMCNT\r
+          AND     #1\r
+          STA     GTEMP5\r
+          LDA     #0\r
+          STA     CTLSWA\r
+          LDA     SWCHA\r
+          LDX     PLAYER\r
+          BNE     PLAY1\r
+          AND     #$F0\r
+          BNE     STCTL                  ;JMP\r
+PLAY1     ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+STCTL     STA     GTEMP2\r
+          ASL     A\r
+          BCC     EAST\r
+          ASL     A\r
+          BCS     BLAH1\r
+          JMP     WEST\r
+BLAH1     ASL     A\r
+          BCS     BLAH\r
+          JMP     SOUTH\r
+BLAH      ASL     A\r
+          BCS     STOP\r
+          JMP     NORTH\r
+STOP      LDA     #1\r
+          STA     AXCOUNT,X\r
+          LDA     SHOOTERX,X\r
+          SEC\r
+          SBC     #16\r
+\r
+          LSR     A\r
+          BCS     GOONA\r
+          LSR     A\r
+          BCS     GOONA                  ;NOT EVENLY DIVISABLE BY FOUR\r
+          LDA     #0\r
+          STA     AXCOUNT,X\r
+RETJOY    RTS\r
+GOONA     LDA     SHTRSTAT,X\r
+          AND     #$20\r
+          BEQ     WEST\r
+\r
+\r
+******************************************\r
+EAST      LDA     #5                     ;IS A MUSHROOM THERE?\r
+          LDY     #5\r
+          JSR     CHECKMSH\r
+          BNE     NORTE                  ;YES, MUSHROOM IN THE WAY\r
+\r
+          LDA     SHTRSTAT,X\r
+          AND     #$20\r
+          BNE     ARCLEAR                ;GOING EAST LAST TIME\r
+          LDA     #0\r
+          STA     AXCOUNT,X              ;IF YOU WERE GOING WEST CLEAR ACCEL\r
+          LDA     SHTRSTAT,X\r
+          ORA     #$20\r
+          STA     SHTRSTAT,X             ;SET EAST BIT\r
+\r
+ARCLEAR   JSR     ACCEL                  ;DEAL WITH ACCELERATION\r
+          JSR     BUMPEW                 ;OTHER PLAYER IN THE WAY?\r
+          BEQ     NOBMPE\r
+          CLC\r
+          ADC     GTEMP6\r
+          CMP     #-4\r
+          BCS     NORTE                  ;YES, OTHER PLAYER THERE\r
+\r
+NOBMPE    LDA     GTEMP6\r
+          CLC\r
+;;;;;     LDX     PLAYER\r
+          ADC     SHOOTERX,X\r
+          CMP     #ELIM\r
+          BCC     STOX                   ;NOT AT LIMIT, STORE\r
+          LDA     #ELIM\r
+STOX      JMP     STOXW\r
+\r
+******************************************\r
+WEST      LDA     #0                     ;IS MUSHROOM IN THE WAY?\r
+          LDY     #5\r
+          JSR     CHECKMSH\r
+          BNE     NORTE                  ;YES, MUSHROOM THERE\r
+\r
+          LDA     SHTRSTAT,X\r
+          AND     #$20\r
+          BEQ     ACLEAR                ;GOING WEST LAST TIME\r
+          LDA     #0\r
+          STA     AXCOUNT,X              ;IF YOU WERE GOING EAST CLEAR ACCEL\r
+          LDA     SHTRSTAT,X\r
+          AND     #$DF\r
+          STA     SHTRSTAT,X             ;CLEAR WEST BIT\r
+\r
+ACLEAR    JSR     ACCEL                  ;DEAL WITH ACCELERATION\r
+          JSR     BUMPEW                 ;OTHER PLAYER IN THE WAY?\r
+          BEQ     NOBMPW\r
+          SEC\r
+          SBC     GTEMP6\r
+          CMP     #4\r
+          BCC     NORTE\r
+\r
+NOBMPW\r
+;;;;;     LDX     PLAYER\r
+          LDA     SHOOTERX,X\r
+          SEC\r
+          SBC     GTEMP6\r
+          CMP     #WLIM\r
+          BCS     STOXW                  ;NOT AT LIMIT, STORE\r
+          LDA     #WLIM\r
+STOXW     STA     SHOOTERX,X\r
+          JSR     STOPRES\r
+\r
+NORTE     LDA     TRACKF,X\r
+          BNE     JNRTE\r
+          LDA     CRAP\r
+          BEQ     NORAE\r
+JNRTE     JMP     NORTACK\r
+\r
+NORAE     LDA     GTEMP2\r
+          ASL     A\r
+          ASL     A\r
+          ASL     A\r
+          BCC     SOUTH\r
+          ASL     A\r
+          BCC     NORTH\r
+;NO MORE  MOVEMENT\r
+          JMP     ENDATJOY               ;ADJUST SHOT POSITION\r
+\r
+\r
+******************************************\r
+SOUTH     LDA     #2                     ;IS MUSHROOM IN THE WAY?\r
+          LDY     #5\r
+          JSR     CHECKMSH\r
+          BNE     RETS                   ;YES, MUSHROOM THERE\r
+\r
+          JSR     BUMPNS                 ;OTHER PLAYER IN THE WAY?\r
+          BEQ     NOBMPS\r
+          CMP     #-6\r
+          BCS     RETS\r
+\r
+NOBMPS    JSR     VMOVER                 ;DEAL WITH TRACKBALL\r
+          BNE     GAGA\r
+\r
+\r
+\r
+          LDY     SHOOTERY,X\r
+          INY\r
+          INY\r
+GAGA      CPY     #BOTLIM\r
+          BCC     STXYPOS\r
+          LDY     #BOTLIM\r
+STXYPOS   JMP     STYPOS\r
+\r
+******************************************\r
+NORTH     LDA     #2                     ;IS MUSHROOM IN THE WAY?\r
+          LDY     #3\r
+          JSR     CHECKMSH\r
+          BNE     RETS                   ;YES, MUSHROOM THERE\r
+\r
+          JSR     BUMPNS                 ;OTHER PLAYER IN THE WAY?\r
+          BEQ     NOBMPN\r
+          CMP     #7\r
+          BCC     RETS\r
+NOBMPN    JSR     VMOVER                 ;DEAL WITH TRACKBALL MOVEMENT\r
+          BNE     GOOGOO\r
+          LDY     SHOOTERY,X\r
+          DEY\r
+          DEY\r
+GOOGOO    CPY     #TOPLIM\r
+          BCS     STYPOS\r
+          LDY     #TOPLIM\r
+STYPOS    STY     SHOOTERY,X\r
+          JSR     STOPRES\r
+RETS      JMP     ENDATJOY               ;ADJUST SHOT POSITION\r
+\r
+\r
+\r
+CHECKMSH\r
+          CLC\r
+          ADC     SHOOTERX,X\r
+          STA     GTEMP1\r
+          TYA\r
+;;;;;     CLC\r
+          ADC     SHOOTERY,X\r
+          JSR     OBSTAC\r
+          RTS\r
+\r
+\r
+\r
+BUMPNS\r
+          LDX     PLAYER\r
+          LDY     #$FF                   ;FLAG FOR NO BUMP\r
+          LDA     SHTRSTAT\r
+          AND     SHTRSTAT+1\r
+          BPL     ENDBUMP\r
+\r
+          LDA     SHOOTERX\r
+          SEC\r
+          SBC     SHOOTERX+1\r
+          BPL     ABSBUMP\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+ABSBUMP   CMP     #4\r
+          BCS     ENDBUMP\r
+\r
+          TXA\r
+          EOR     #1\r
+          TAY\r
+          LDA     SHOOTERY,X\r
+          SEC\r
+          SBC     SHOOTERY,Y\r
+ENDBUMP   CPY     #$FF\r
+          RTS\r
+\r
+\r
+\r
+BUMPEW\r
+          LDX     PLAYER\r
+          LDY     #$FF                   ;FLAG FOR NO BUMP\r
+          LDA     SHTRSTAT\r
+          AND     SHTRSTAT+1\r
+          BPL     ENDBUMP\r
+\r
+          LDA     SHOOTERY\r
+          SEC\r
+          SBC     SHOOTERY+1\r
+          BPL     ABSBMPEW\r
+          EOR     #$FF\r
+          CLC\r
+          ADC     #1\r
+ABSBMPEW  CMP     #5\r
+          BCS     ENDBUMP\r
+\r
+          TXA\r
+          EOR     #1\r
+          TAY\r
+          LDA     SHOOTERX,X\r
+          SEC\r
+          SBC     SHOOTERX,Y\r
+          CPY     #$FF\r
+          RTS\r
+\r
+\r
+\r
+******************************************\r
+* ACCEL -- DEAL WITH SHOOTER ACCELERATION\r
+* RETURNS WITH NUMBER OF PIXELS TO MUSH IN GTEMP6\r
+******************************************\r
+ACCEL     LDA     TRACKF,X\r
+          BNE     THETHE\r
+          LDA     CRAP\r
+          BNE     THETHE\r
+          LDY     PLAYER\r
+          LDX     AXCOUNT,Y\r
+          LDA     GTEMP5\r
+          BNE     SKIPP\r
+\r
+          INX\r
+          CPX     #$10\r
+          BNE     NORM\r
+          DEX                            ;PEG IT AT F\r
+NORM      TXA\r
+          STA     AXCOUNT,Y\r
+SKIPP     TXA\r
+          ASL     A\r
+          ORA     GTEMP5\r
+          TAX\r
+          LDA     ADDTABL,X\r
+          STA     GTEMP6\r
+          RTS\r
+THETHE    LDA     TTEMP1\r
+          BPL     STGT6\r
+          EOR     #$FF                   ;MAKE THE ABSOLUTE VALUE HO HO\r
+          CLC\r
+          ADC     #1\r
+STGT6     STA     GTEMP6\r
+          LDX     PLAYER\r
+          RTS\r
+\r
+\r
+\r
+ADDTABL   DB      1,0                    ;0\r
+          DB      0,1                    ;1\r
+          DB      1,0                    ;2\r
+          DB      1,1                    ;3\r
+          DB      1,1                    ;4\r
+          DB      1,1                    ;5\r
+          DB      2,1                    ;6\r
+          DB      1,2                    ;7\r
+          DB      2,1                    ;8\r
+          DB      1,2                    ;9\r
+          DB      2,2                    ;10\r
+          DB      2,2                    ;11\r
+          DB      2,2                    ;12\r
+          DB      2,2                    ;13\r
+          DB      2,3                    ;14\r
+          DB      3,2                    ;15\r
+          DB      2,3                    ;16\r
+VMOVER    LDX     PLAYER\r
+          LDA     TRACKF,X\r
+          BNE     DOTHE\r
+          LDA     CRAP\r
+          BEQ     RETSE                  ;NO TRACKB THIS TIME\r
+DOTHE\r
+          LDA     SHOOTERY,X\r
+          CLC\r
+          ADC     TTEMP2\r
+          TAY\r
+          LDA     #1                     ;CLR ZFLAG\r
+RETSE     RTS                            ;ZFLAG APP SET\r
+\r
diff --git a/LOADER.S b/LOADER.S
new file mode 100644 (file)
index 0000000..cad772a
--- /dev/null
+++ b/LOADER.S
@@ -0,0 +1,593 @@
+*** LOADER.S ***  (CENTIPEDE)\r
+\r
+* 12/17   DVP\r
+\r
+\r
+******************************************\r
+          ORG     $C398                  ;103 BYTES\r
+SCORIT\r
+          LDX     #0+2*NSCORES\r
+          LDY     #0\r
+          JSR     SCRDSP\r
+\r
+          LDA     GAMETYPE\r
+          BEQ     SCRHIGH\r
+\r
+          LDX     #1+2*NSCORES\r
+          LDY     #25\r
+          JSR     SCRDSP\r
+\r
+          LDA     GAMETYPE\r
+          CMP     #3\r
+          BNE     SCRHIGH\r
+          LDX     #2+2*NSCORES           ;DISPLAY TOTAL SCORE IN TEAM PLAY\r
+          LDY     #9\r
+          BNE     SCRDSP\r
+\r
+SCRHIGH   LDA     DIFLEVEL\r
+          CLC\r
+          ADC     #3+2*NSCORES\r
+          TAX\r
+          LDY     #12\r
+\r
+SCRDSP    LDA     #L(EMPTY)\r
+          STA     MUSHMAP,Y\r
+          STA     MUSHMAP+1,Y\r
+          STA     MUSHMAP+2,Y\r
+          STA     MUSHMAP+3,Y\r
+          STA     MUSHMAP+4,Y\r
+\r
+          SEC\r
+SCRDSPLP  LDA     SCORE0,X\r
+          AND     #$F0\r
+          BCC     DOIT1\r
+          BEQ     NXTDGT1\r
+DOIT1     LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          STA     MUSHMAP,Y\r
+NXTDGT1   INY\r
+          LDA     SCORE0,X\r
+          AND     #$0F\r
+          BCC     DOIT2\r
+          BEQ     NXTDGT2\r
+          CLC\r
+DOIT2     STA     MUSHMAP,Y\r
+NXTDGT2   INY\r
+          DEX\r
+          DEX\r
+          DEX\r
+          DEX\r
+          DEX\r
+          DEX\r
+          DEX\r
+          BPL     SCRDSPLP\r
+\r
+          STA     MUSHMAP-1,Y\r
+SCRDONE   RTS\r
+\r
+\r
+\r
+\r
+******************************************\r
+          ORG     $C498                  ;103 BYTES (WITH HLINE)\r
+\r
+LMST      LDA     COLORFLG               ;DO NEW COLORS NEED TO BE DEFINED?\r
+          BMI     ENDLMST                ;NO, SO SKIP THE COLOR LOADING\r
+          DEC     COLORFLG\r
+          BPL     ENDLMST                ;YES, BUT FOR THE NEXT OBJECT TABLE\r
+\r
+          JSR     OFFSCRN\r
+\r
+          LDX     PLAYER                 ;COMPUTE ADDRESS OF NEW COLORS\r
+          LDA     GAMETYPE\r
+          CMP     #2\r
+          BCC     ZLOAD1\r
+          LDX     #0\r
+ZLOAD1    LDA     CLRINDEX,X\r
+          CLC\r
+          ADC     #L(COLORTBL)\r
+          STA     TEMPADDR\r
+          LDA     #H(COLORTBL)\r
+          ADC     #0\r
+          STA     TEMPADDR+1\r
+          LDX     #12                    ;LOAD PALETTES  6, 5, 4, AND 3\r
+          LDY     #11\r
+PALLOOP   LDA     (TEMPADDR),Y           ;LOAD A PALETTE WITH COLORS\r
+          STA     P3C3,X\r
+          DEY\r
+          LDA     (TEMPADDR),Y\r
+          STA     P3C2,X\r
+          DEY\r
+          LDA     (TEMPADDR),Y\r
+          STA     P3C1,X\r
+          DEY\r
+          DEX\r
+          DEX\r
+          DEX\r
+          DEX\r
+          CPX     HSCFLAG\r
+          BPL     PALLOOP\r
+\r
+ENDLMST   RTS\r
+\r
+\r
+\r
+\r
+\r
+\r
+******************************************\r
+          ORG     $CD10\r
+\r
+LOADER    BIT     OBJTBSEM               ;IS LOADER'S OBJ. TBL. READY?\r
+          BMI     LOADIT\r
+          RTS\r
+\r
+LOADIT    LDY     #5                     ;INITIALIZE DISPLAY LIST OFFSETS TO 5\r
+          LDX     #22\r
+INITDLOF  STY     DLOFFSTS-1,X\r
+          DEX\r
+          BNE     INITDLOF\r
+\r
+          BIT     ATTRACT\r
+          BPL     GOLOAD\r
+          DEY\r
+          STY     DLOFFSTS+4\r
+          STY     DLOFFSTS+5\r
+          STY     DLOFFSTS+6\r
+          STY     DLOFFSTS+7\r
+;;;;;     LDX     #0\r
+          STX     DL2+6\r
+          STX     DL3+6\r
+          STX     DL4+6\r
+          STX     DL5+6\r
+          STX     DL10+6\r
+          STX     DL11+6\r
+          STX     DL12+6\r
+          STX     DL13+6\r
+          STX     DL14+6\r
+          STX     DL15+6\r
+          STX     DL16+6\r
+          STX     DL17+6\r
+          STX     DL18+6\r
+          STX     DL19+6\r
+          STX     DL20+6\r
+          STX     DL21+6\r
+          STX     DL22+6\r
+          STX     DL23+6\r
+          STX     DL24+1\r
+GOLOAD    STX     DLOFFSTS+22\r
+\r
+INITBFLG ;LDX     #0\r
+LOADOBJ   LDA     OBJSTAT,X\r
+          BPL     SKPOBJMP               ;DON'T LOAD DEAD OBJECTS\r
+\r
+DOOBJ     LDA     OBJY,X                 ;COMPUTE OBJECT'S ZONE\r
+          CMP     TOPLINE\r
+          BCS     ZDOOBJ\r
+SKPOBJMP  JMP     SKIPOBJ                ;IF AT VERY TOP OF SCREEN\r
+ZDOOBJ    LSR     A\r
+          LSR     A\r
+          LSR     A\r
+          STA     TEMP2\r
+          TAY                            ;STORE ZONE # IN Y\r
+          CMP     SCRLONZN\r
+          BNE     DOOBJ123\r
+          INY                            ;SCROLLING ON FROM TOP, DISPLAY BOTTOM\r
+                                         ;    ZONE ONLY\r
+\r
+DOOBJ123                                 ;COMPUTE LOW BYTE OF HEADER ADDRESS\r
+          LDA     DLOFFSTS-1,Y\r
+          CMP     #5+16*4                ;CHECK TO MAKE SURE DL NOT FULL\r
+          BCS     SKPOBJMP\r
+;;;;;     CLC\r
+          ADC     LDLTBL,Y\r
+          STA     TEMPADDR\r
+          LDA     HDLTBL,Y               ;COMPUTE HIGH BYTE OF HEADER ADDRESS\r
+          ADC     #0\r
+          STA     TEMPADDR+1\r
+\r
+          LDA     #4                     ;UPDATE ZONE'S DISPLAY LIST OFFSET\r
+          ADC     DLOFFSTS-1,Y\r
+          STA     DLOFFSTS-1,Y\r
+\r
+          LDA     OBJY,X                 ;DOES OBJECT CROSS ZONE BOUNDARY?\r
+          CMP     MINIMUMY\r
+          AND     #$07\r
+          BCC     TOPSCRLL               ;SCROLLING ON, BOTTOM ZONE ONLY\r
+          STA     TEMP1\r
+          BEQ     INONEZNE\r
+          LDA     ATTRACT\r
+          BPL     SKPATTR5               ;IF NOT IN ATTRACT MODE\r
+          CPY     #YBTMATTR/8\r
+          BEQ     INONEZNE               ;SPECIAL ATTRACT MODE DISAPPEARENCE\r
+          BCS     SKIPOBJ\r
+SKPATTR5  CPY     #23\r
+          BCS     INONEZNE               ;SCROLLING OFF, TOP ZONE ONLY\r
+\r
+* INTWOZNS\r
+          INY                            ;NOW WORK ON THE ZONE BELOW\r
+          LDA     LDLTBL,Y               ;COMPUTE LOW BYTE OF HEADER ADDRESS\r
+;         CLC                            ;CLEARED BY CPY #23\r
+          ADC     DLOFFSTS-1,Y\r
+          STA     TEMP3\r
+          LDA     HDLTBL,Y               ;COMPUTE HIGH BYTE OF HEADER ADDRESS\r
+          ADC     #0\r
+          STA     TEMP4\r
+\r
+          LDA     #4                     ;ALSO UPDATE THIS ZONE'S DSPY LST OFST\r
+          ADC     DLOFFSTS-1,Y\r
+          STA     DLOFFSTS-1,Y\r
+\r
+          LDY     #0                     ;LOAD THE TWO HEADERS\r
+          LDA     OBJOFFST,X              ;LOW ADDRESS BYTE\r
+          STA     (TEMPADDR),Y\r
+          CMP     #L(LSCRP)\r
+          BCC     SCRP2ZN\r
+          CMP     #L(LSCRP+16)\r
+          BCS     SCRP2ZN\r
+          DEY\r
+          STY     TEMP1\r
+          INY\r
+;         CLC\r
+          ADC     #$40\r
+SCRP2ZN   STA     (TEMP3),Y\r
+\r
+          INY                            ;Y=1\r
+          LDA     OBJPALWD,X             ;PALETTE/WIDTH BYTE\r
+          STA     (TEMPADDR),Y\r
+          STA     (TEMP3),Y\r
+\r
+          INY                            ;Y=2\r
+          LDA     TEMP1                  ;HIGH ADDRESS BYTE\r
+          BMI     HISCORP\r
+          CLC                            ;(CARRY IS CLEAR AFTER ADD 4 TO OFST.)\r
+          ADC     #H(STMPBASE)\r
+          STA     (TEMPADDR),Y\r
+;         CLC\r
+          SBC     #7\r
+          BNE     NOHIGHS\r
+\r
+HISCORP   LDA     #H(STMPBASE)\r
+          STA     (TEMPADDR),Y\r
+NOHIGHS   STA     (TEMP3),Y\r
+\r
+          INY                            ;Y=3\r
+          LDA     OBJX,X                 ;HORIZONTAL POSITION BYTE\r
+          STA     (TEMP3),Y\r
+SKIPOBJ2  STA     (TEMPADDR),Y\r
+\r
+SKIPOBJ   INX\r
+          CPX     #18\r
+          BEQ     LOADDONE\r
+          JMP     LOADOBJ\r
+\r
+*******************\r
+TOPSCRLL  ;CLC\r
+          SBC     #7\r
+          STA     TEMP1\r
+\r
+INONEZNE  LDY     #0                     ;LOAD HEADER FOR NO ZONE CROSSING\r
+          LDA     OBJOFFST,X             ;LOW ADDRESS BYTE\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY                            ;Y=1\r
+          LDA     OBJPALWD,X             ;PALETTE/WIDTH BYTE\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY                            ;Y=2\r
+          LDA     TEMP1                  ;HIGH ADDRESS BYTE\r
+          CLC\r
+          ADC     #H(STMPBASE)\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY                            ;Y=3\r
+          LDA     OBJX,X                 ;HORIZONTAL POSITION BYTE\r
+          JMP     SKIPOBJ2\r
+\r
+******************\r
+LOADDONE\r
+          LDA     #$00                   ;SET FOR NO LINES AT TOP OR BOTTOM\r
+          STA     HLINEDL+1\r
+          BIT     ATTRACT\r
+          BMI     LDATTRHD\r
+\r
+          LDX     #11                    ;SET UP DL FOR HORIZONTAL LINES\r
+HLNLP     LDA     HLNDL,X\r
+          STA     HLINEDL,X\r
+          DEX\r
+          BPL     HLNLP\r
+\r
+          LDX     #23\r
+BLNKLP    LDA     LDLTBL,X               ;GET ADDRESS OF DL\r
+          STA     TEMPADDR\r
+          LDA     HDLTBL,X\r
+          STA     TEMPADDR+1\r
+\r
+          LDY     DLOFFSTS-1,X\r
+\r
+          LDA     #L(BLACKL)             ;BLNKLEFT\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #$FE                   ;PALETTE 7, WIDTH 2 BYTES\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #H(STMPBASE)\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #MINX-8\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #L(BLACKR)             ;BLNKRGHT\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #$FE                   ;PALETTE 7, WIDTH 2 BYTES\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #H(STMPBASE)\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #MAXX\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY                            ;ENDDL\r
+          INY\r
+          LDA     #0\r
+          STA     (TEMPADDR),Y\r
+\r
+          DEX                            ;NOBLNK\r
+          BNE     BLNKLP\r
+          BEQ     LOADOUT\r
+\r
+\r
+LDATTRHD\r
+          LDX     #3                     ;TOP HEADERS FOR LOGO DISPLAY LISTS\r
+NEXTATCV  LDA     ATTRYBSE/8+LDLTBL,X\r
+          STA     TEMPADDR\r
+          LDA     ATTRYBSE/8+HDLTBL,X\r
+          STA     TEMPADDR+1\r
+\r
+          LDY     DLOFFSTS+4,X\r
+          LDA     HTITLGRP,X\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #PWTITLE\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #H(TPG8LIN1)\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          LDA     #MINX\r
+          STA     (TEMPADDR),Y\r
+\r
+          INY\r
+          INY\r
+          LDA     #0\r
+          STA     (TEMPADDR),Y\r
+\r
+          DEX\r
+          BPL     NEXTATCV\r
+\r
+LOADOUT   LDA     #0                     ;RESET SEMAPHORE\r
+          STA     OBJTBSEM\r
+          RTS\r
+\r
+HTITLGRP  DB   L(TPG8CVR1),L(TPG8CVR2),L(TPG8CVR3),L(TPG8CVR4)\r
+\r
+\r
+HLNDL     DB      L(HLINE),$E1,H(HLINE),MINX\r
+          DB      L(BLACKL),$FE,H(BLACKL),MINX-8\r
+          DB      L(BLACKR),$FE,H(BLACKR),MAXX\r
+\r
+HLINE     DB      $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF\r
+          DB      $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF\r
+          DB      $FF\r
+\r
+\r
+*******************************************************************************\r
+************************ START OF TRACKBALL STUFF ******************************\r
+\r
+\r
+TRACKIT   LDY     #$00                   ;INITIALIZE LOOP FLAG\r
+          STY     TRACKF                 ;ASSUME JOYSTICK\r
+          STY     TRACKF+1\r
+          STY     CTLSWB\r
+          LDA     SWCHB\r
+          STA     PANEL\r
+          INY\r
+BIGLOOP   LDA     INPT4,Y\r
+          STA     BUTNIB,Y\r
+          IF      NEWBOARD\r
+          TYA\r
+          ASL     A\r
+          TAY\r
+          LDA     INPT0,Y                ;THESE FOUR LINES MUST BE INCLUDED IN\r
+                                         ;THE FINAL VERSION\r
+          AND     INPT1,Y                ;REMEMBER\r
+          BMI     FUCKBAR                ;REMEMBER,. . ., ROSEBUD\r
+          TYA\r
+          LSR     A\r
+          TAY\r
+JEXIT     JMP     EXIT\r
+          ENDIF\r
+FUCKBAR   TYA\r
+          LSR     A\r
+          TAY\r
+          LDX     #0\r
+IDAGAIN   LDA     CLOCK,Y\r
+          STA     CTLSWB                 ;FORCE CLOCK TO OUTPUT\r
+          IF      NEWBOARD\r
+          LDA     #0                     ;ON NEWBOARD PULL CLOCK LOW FIRST\r
+          ENDIF\r
+          STA     SWCHB                  ;FORCE CLOCK HIGH\r
+          LDA     PMASK,Y\r
+          STA     CTLSWA                 ;FORCE PADDLE LINES TO OUTPUT\r
+\r
+          LDA     #0\r
+          STA     SWCHA                  ;FORCE PADDLE LINES LOW\r
+\r
+          IF      NEWBOARD\r
+          LDA     CLOCK,Y                ;CLOCK HIGH\r
+          ELSE\r
+          LDA     #$00                   ;CLOCK LOW\r
+          ENDIF\r
+\r
+          STA     SWCHB\r
+          STA     CTLSWA                 ;CONFIGURE PADDLES TO READ\r
+          LDA     SWCHA                  ;READ PADDLES FOR ID\r
+          AND     PMASK,Y                ;MASK OFF PLAYER 2 PADDLE INPUTS\r
+          CMP     PID,Y                  ;SEE IF TRACKBALL\r
+          BEQ     IDFOUND                ;IF TRACKBALL THEN SERVICE\r
+          ;****************** ID SYNC LOOP *******************\r
+          TXA                            ;SEE IF THROUGH ID LOOP TWICE\r
+          BMI     JEXIT                  ;IF SO NO ID TO BE FOUND\r
+          DEX                            ;SET THROUGH LOOP FLAG\r
+          BNE     IDAGAIN                ;TRY TO GET ID AGAIN ALWAYS A JUMP\r
+          ;*************** CLOCK OUT NIBBLES ********************\r
+IDFOUND   LDA     CLOCK,Y                ;CLOCKHIGH\r
+          STA     TRACKF,Y               ;TELL US ITS TRACKBALL TIME\r
+          IF      NEWBOARD\r
+          EOR     #$FF                   ;CLOCK LOW\r
+     &n