]> github.com/historicalsource and other repositories - defender-1.git/commitdiff
Initial commit
authorRobert Hogan <robhogan@gmail.com>
Wed, 7 Jul 2021 12:49:34 +0000 (13:49 +0100)
committerRobert Hogan <robhogan@gmail.com>
Wed, 7 Jul 2021 12:49:34 +0000 (13:49 +0100)
Taken from https://github.com/historicalsource/defender

12 files changed:
src/AMODE1.SRC [new file with mode: 0755]
src/BLK71.SRC [new file with mode: 0755]
src/BRUTSUM2.SRC [new file with mode: 0755]
src/DEFA7.SRC [new file with mode: 0755]
src/DEFB6.SRC [new file with mode: 0755]
src/INFO.SRC [new file with mode: 0755]
src/MESS0.SRC [new file with mode: 0755]
src/PHR6.SRC [new file with mode: 0755]
src/ROMC0.SRC [new file with mode: 0755]
src/ROMC8.SRC [new file with mode: 0755]
src/ROMF8.SRC [new file with mode: 0755]
src/SAMEXAP7.SRC [new file with mode: 0755]

diff --git a/src/AMODE1.SRC b/src/AMODE1.SRC
new file mode 100755 (executable)
index 0000000..a9881db
--- /dev/null
@@ -0,0 +1,1312 @@
+*      TEXT EQUATES
+WTEXTB EQU     $C002
+WNUMBB EQU     $C00E
+LANDV  EQU     $C0DD
+MUTV   EQU     LANDV+2
+SWRMPV EQU     MUTV+2
+BOMBV  EQU     SWRMPV+2
+SWARMV EQU     BOMBV+2
+BAITV  EQU     SWARMV+2
+CREDV  EQU     BAITV+2
+SCANV  EQU     CREDV+2
+ELECV  EQU     SCANV+2
+HOFV   EQU     $C0FD
+INIT$V EQU     HOFV+2
+HALLDV EQU     INIT$V+2
+HALENV EQU     HALLDV+2
+
+*      STILOB PICT,X,Y CREATES AN OBJECT WITH NO VELOCITY AT X,Y
+STILOB MACRO   \0,\1,\2
+       JSR     GETOB   GET AN OBJECT
+       LDD     #0      VELOCITY
+       STD     OXV,X
+       STD     OYV,X
+       LDD     #\1     X
+       STD     OX16,X
+       LDD     #\2
+       STD     OY16,X
+       LDD     #\0     PICTURE
+       STD     OPICT,X
+       STX     OPTR    AND APPEND TO LIST
+       ENDM
+
+NAPP   MACRO   \0,\1
+       LDA     #\0
+       LDX     #\1
+       JMP     SLEEPP
+       ENDM
+* BSO BONER DOES NOT ALLOW MACRO AND SYMBOL FOR LJSR SO CHANGED TO MLJSR
+MLJSR  MACRO   \0,\1
+       JSR     LJSRV
+       FDB     \1
+       FCB     \0
+       ENDM
+
+*SAM EQUATES
+BLKLEN EQU     14
+INITS  EQU     $A000
+PNUMB  EQU     INITS+6
+INITDS EQU     PNUMB+2
+SCOREN EQU     INITDS+4
+
+       ORG     THTAB
+*
+***    SAMRAM
+*
+
+TEMPA  RMB     1
+TEMPB  RMB     1
+XTEMP$ RMB     2
+CURSR$ RMB     2
+CUREND RMB     2
+LGOFLG RMB     1
+LGOPTR RMB     2
+DEFSPT RMB     2
+DEFDPT RMB     2
+WX     RMB     2
+DEFRPT RMB     2
+DCOLOR RMB     1
+LEN    RMB     1
+PIX    RMB     1
+ENTFLG RMB     1
+INIDIR RMB     1
+INITN  RMB     1
+PSCORE RMB     2
+STALT  RMB     1
+UDDEL  RMB     1
+UDCNT  RMB     1
+UDSFLG RMB     1
+SPOINT RMB     2
+OCRED  RMB     1
+ICREDF RMB     1
+FIRFLG RMB     1
+FIRCNT RMB     1
+
+***    LEDRAM
+
+LASPRC RMB     2       LASER PROCESS
+MANPTR RMB     2       MAN OBJECT
+SHIPTR RMB     2       PLAYER OBJECT
+ENEMYP RMB     2       BAD GUY OBJECT
+MANFRF RMB     1       FRAMES OF FREE FALL
+P500OB RMB     2       500 PT. OBJECT
+OTABPT RMB     2       TABLE OF OBJECTS POINTER
+LSTATE RMB     2       EXTRA STATE FOR THE LASER ROUTINE
+TEXPTR RMB     2
+TEXTMP RMB     2
+
+       ORG     $B300   USE TERRAIN AREA
+
+DEFDSC RMB     4       "DEFENDER" WHOLE DESCRIPTER
+DEFRAM RMB     BLKLEN*15 "DEFENDER" OBJECT BLOCKS
+DEFPIC RMB     4*15    "DEFENDER" PICTURE DESCRIPTERS
+DEFBLK RMB     24*60   "DEFENDER" DATA
+
+
+*      EQUATES
+XMAN   EQU     $1E00
+YMAN   EQU     $DB00
+XSHIP  EQU     $0800
+YSHIP  EQU     $5000
+AMTYPE EQU     0
+
+       ORG     $C000
+       JMP     HALLOF  VECTORS
+       JMP     SCNR
+*
+*HALL OF FAME ENTRY
+*
+HALLOF JSR     GNCIDE  KILL ALL PROCESSES
+       LDA     #$FF    SYSTEM STATUS
+       STA     STATUS
+       JSR     STINIT  REINITIALIZE STARS
+       LDA     CREDIT  INITIALIZE OLD CREDITS
+       STA     OCRED
+       CLRA
+       STA     ICREDF  CLEAR CREDIT INCREASE FLAG
+       STA     ENTFLG  CLEAR ENTRY FLAG
+       LDA     PWRFLG  CHECK FOR POWER ON INITIALIZATION
+       LBEQ    AMODE$  YES?, SKIP TO WILLI PAGE
+       NEWP    CREDS,AMTYPE TURN ON CREDITS
+       LDY     #.P1SCR START WITH PLAYER 1
+       LDA     #1
+HALL1  STA     PNUMB   PLAYER NUMBER
+       STY     PSCORE  PLAYER SCORE ADDRESS
+       LDX     #THSTAB+12*7 TODAYS EIGHTH SCORE
+       JSR     CPXCY   COMPARE
+       LBHS    HALL12  NOT GOOD ENOUGH?, NEXT PLAYER
+       INC     ENTFLG  SET ENTRY FLAG
+       JSR     SCRCLR
+       LDA     PNUMB
+       DECA
+       BNE     HALL1A
+       JSR     P1SW    UPRIGHT SCREEN
+       BRA     HALL1B
+HALL1A JSR     P2SW
+HALL1B LDB     #$85    LIGHT BLUE LETTERS
+       STB     PCRAM+1
+       LDA     #$FE    TODAYS SOUND - PHANTOM
+       LDX     #THSTAB TODAYS TOP SCORE
+       JSR     CPXCY   COMPARE
+       BHS     HALL2   NOT THE BEST?
+       LDA     #$FD    HIGH SCORE SOUND - TOCCATA
+HALL2  LDX     #$CC02  SOUND PIAS
+       LDB     #$FF    CLEAR LINES
+       JSR     STBXBV
+       LDB     #$E4    SELECT ORGAN
+       JSR     STBXBV
+HALL3  DECB            DELAY
+       BNE     HALL3
+       LDB     #$FF    CLEAR LINES
+       JSR     STBXBV
+       TFR     A,B
+       JSR     STBXBV  PLAY SOUND
+       LDU     #PLYR1-2 "PLAYER 1" OR "PLAYER 2"
+       LDA     PNUMB
+       ASLA
+       LEAU    A,U
+       LDX     #$3E38  SCREEN ADDRESS
+       MLJSR   2,WTEXTB WRITE TO SCREEN
+       LDU     #HOFV   HALL OF FAME ENTRY INSTRUCTIONS
+       LDX     #$1458  SCREEN ADDRESS
+       MLJSR   2,WTEXTB WRITE TO SCREEN
+       LDD     #$412F  INITIALIZE INTIALS
+       STD     INITS
+       LDA     #$40
+       STD     INITS+2
+       STD     INITS+4
+       JSR     HOFIN   DISPLAY INITIALS
+       LDA     #40     FIRST INITIAL STALL TIME
+       STA     STALT
+       NEWP    HOFST,AMTYPE TURN ON STALL TIMER
+       NEWP    HOFBL,AMTYPE TURN ON BLINK
+       NEWP    HOFUD,AMTYPE TURN ON UP DOWN STICK
+       CLR     INITN   ZERO INITIALS COUNTER
+       JSR     HOFUL   UNDERLINE INITIALS
+*FIRE SWITCH
+HALL3A CLRA
+       STA     FIRCNT  ZERO SWITCH OPEN COUNTER
+       STA     FIRFLG  CLEAR SWITCH OPEN FLAG
+HALL3B NAPP    1,HALL4 SLEEP 1
+HALL4  LDA     PIA21   CHECK FIRE SWITCH
+       BITA    #1
+       BNE     HALL5   CLOSED?
+       TST     STALT   CHECK STALL TIMER
+       BEQ     HALL6   OUT OF TIME?, ENTER HIM
+       INC     FIRCNT  ADVANCE SWITCH OPEN COUNTER
+       LDA     FIRCNT  CHECK IF TIME
+       CMPA    #5
+       BNE     HALL3B  NO?, GO TO SLEEP
+       STA     FIRFLG  YES?, SET SWITCH OPEN FLAG
+       BRA     HALL3B  GO TO SLEEP
+HALL5  CLR     FIRCNT  ZERO SWITCH OPEN COUNTER
+       TST     FIRFLG  CHECK SWITCH OPEN FLAG
+       BEQ     HALL3B  NOT SET?, GO TO SLEEP
+       LDA     #20     RESET STALL TIMER
+       STA     STALT
+       INC     INITN   NEXT INITIAL
+       JSR     HOFUL   UPDATE UNDERLINES
+       LDA     INITN   CHECK IF LAST
+       CMPA    #3
+       BNE     HALL3A  WAIT FOR NEXT FIRE SWITCH
+HALL6  JSR     GNCIDE  KILL PROCESSES
+       LDX     #THSTAB+12*6 TODAYS SEVENTH SCORE
+       LDU     #THSTAB-12 ABOVE TODAYS TOP SCORE
+       JSR     HOFAS   ADD SCORE TO LIST
+       LDX     #CRHSTD+12*7 ALL TIME EIGHTH SCORE
+       BSR     CPXCY   COMPARE
+       BHS     HALL12  NOT THAT GOOD?, NEXT PLAYER
+       LDX     #CRHSTD+12*6 ALL TIME SEVENTH SCORE
+       LDU     #CRHSTD-12 ABOVE ALL TIME TOP SCORE
+       JSR     HOFAS   ADD SCORE TO LIST
+HALL12 LDY     #.P2SCR PLAYER TWO
+       LDA     PNUMB
+       INCA
+       CMPA    #3      CHECK IF DONE
+       LBNE    HALL1
+       TST     ENTFLG  CHECK IF ENTRY WAS MADE
+       BNE     HALL13
+       NAPP    $FF,HALL13 NO ENTRY, SLEEP 4 SECS
+HALL13 JMP     HALDIS  ATTRACT MODE NOW
+*
+*COMPARE NIBBLES AT X BLOCK 0 WITH SCORE AT Y
+*
+CPXCY  PSHS    D,X     SAVE REGISTERS
+       JSR     RCMOSD  READ NIBBLES AT X TO D
+       CMPD    1,Y     A DIFFERENCE?
+       BNE     CPXY1
+       JSR     RCMOSA  CHECK NEXT NIBBLES
+       CMPA    3,Y
+CPXY1  PULS    X,D,PC  RESTORE REGISTERS, RETURN
+*
+*HALL OF FAME INITIALS DISPLAY
+*
+HOFIN  LDX     #$46AC  TOP LEFT OF INITIALS
+       LDD     #$1408  SIZE OF INITIALS
+       JSR     BLKCLR  ERASE BLOCK
+       LDU     #INIT$V INITIALS TEXT VECTOR
+       MLJSR   2,WTEXTB WRITE TO SCREEN
+       RTS
+*
+*HALL OF FAME - UNDERLINE INITIALS
+*
+HOFUL  CLR     TEMPA   INITIAL COUNTER
+       LDX     #$45B7  STARTING ADDRESS
+HOFUL1 LDU     #$1111  NORMAL COLOR
+       LDA     TEMPA
+       CMPA    INITN   IS THIS ACTIVE INITIAL
+       BNE     HOFUL2
+       LDU     #$DDDD  BLINK COLOR FOR ACTIVE INITIAL
+HOFUL2 LDD     #$0400  LENGTH OF UNDER LINE
+HOFUL3 STU     D,X     DRAW UNDER LINE
+       DECA
+       BNE     HOFUL3
+       INC     TEMPA   NEXT INITIAL
+       LEAX    $800,X  CENTER SPACING BETWEEN UNDERLINES
+       CMPX    #$5DB7  DONE?
+       BNE     HOFUL1  NO?, NEXT UNDERLNE
+       RTS
+*
+*HALL OF FAME -        ADD SCORE AND INITIALS  X=BOTTOM OF LIST
+*              TO LIST         U=TOP OF LIST
+*
+HOFAS  STU     XTEMP$  SAVE TOP OF LIST ADDRESS
+       LDY     PSCORE  GET PLAYER SCORE ADDRESS
+HOFAS1 BSR     CPXCY   COMPARE
+       BHS     HOFAS2
+       BSR     HOFMD   MOVE SCORE DOWN ONE STEP
+       LEAX    -12,X   NEXT SCORE UP
+       CMPX    XTEMP$  ABOVE TOP SCORE?
+       BHI     HOFAS1
+HOFAS2 LEAX    12,X    ONE STEP DOWN
+       LDD     1,Y     STORE SCORE
+       JSR     WCMOSD
+       LDA     3,Y
+       JSR     WCMOSA
+       LDU     #INITS  GET INITIALS ADDRESS
+HOFAS3 LDA     ,U      GET INITIAL
+       JSR     WCMOSA  STORE IT
+       LEAU    2,U     NEXT INITIAL
+       CMPU    #INITS+6 DONE?
+       BNE     HOFAS3
+       RTS
+*
+*HALL OF FAME - MOVE A SCORE AND INITIALS
+*              DOWN ONE STEP   X=OLD ADDRESS
+*
+HOFMD  PSHS    X       SAVE OLD POSITION
+HOFMD1 JSR     RCMOSD  GET 4 NIBBLES
+       LEAX    8,X     MOVE POINTER TO DESTINATION
+       JSR     WCMOSD  STORE 4 NIBBLES
+       LEAX    -24,X   CHECK IF DONE
+       CMPX    ,S
+       BEQ     HOFMD2
+       LEAX    12,X    BACK FOR NEXT NIBBLES
+       BRA     HOFMD1
+HOFMD2 PULS    X,PC    RESTORE STACK, RETURN
+*
+*HALL OF FAME STALL TIMER
+*
+HOFST  DEC     STALT   COUNT DOWN STALL TIMER
+       NAPP    60,HOFST SLEEP 1 SECOND
+*
+*HALL OF FAME COLOR BLINK
+*
+HOFBL  LDA     PCRAM+$D GET BLINKING COLOR
+       BNE     HOFBL1  ON?
+       LDA     PCRAM+1 MAKE SAME AS NORMAL COLOR
+       BRA     HOFBL2
+HOFBL1 CLRA            TURN OFF
+HOFBL2 STA     PCRAM+$D CHANGE COLOR
+       NAPP    15,HOFBL BLINK PERIOD
+*
+*HALL OF FAME UP DOWN STICK HANDLER
+*
+HOFUD  CLR     INIDIR  ZERO INITIALS DIRECTION
+HOFUD1 LDA     PIA21   GET PIA DOWN SIDE
+       BITA    #$80    CHECK DOWN
+       BEQ     HOFUD2
+       LDA     #$FF    DOWN DIRECTION
+       BRA     HOFUD4
+HOFUD2 LDA     PIA31   GET PIA UP SIDE
+       BITA    #1      CHECK UP
+       BEQ     HOFUD3
+       LDA     #1      UP DIRECTION
+       BRA     HOFUD4
+HOFUD3 CLR     INIDIR  NO CHANGE
+       BRA     HOFUD8  SLEEP
+HOFUD4 CMPA    INIDIR  CHECK IF KNOWN
+       BNE     HOFUD9  NOT KNOWN?
+       DEC     UDCNT   KNOWN?, COUNT DELAY
+       BNE     HOFUD8  STILL COUNTING?, SLEEP
+*CHANGE LETTER
+HOFUD5 LDX     #INITS  GET ACTIVE INITIALS ADDRESS
+       LDB     INITN
+       ASLB
+       ABX
+       LDA     ,X      GET ACTIVE INITIAL
+       ADDA    INIDIR  CHANGE UP/DOWN
+       CMPA    #$3F    TOO LOW?
+       BNE     HOFUD6
+       LDA     #$5A    BACK TO Z
+HOFUD6 CMPA    #$5B    TOO HIGH?
+       BNE     HOFUD7
+       LDA     #$40    BACK TO SPACE
+HOFUD7 STA     ,X      SAVE NEW INITIAL
+       JSR     HOFIN   UPDATE INITIALS DISPLAY
+       LDA     UDDEL   GET LAST DELAY
+       LSRA            DECAY IT
+       ADDA    #5      TOP SPEED LIMIT
+       STA     UDDEL   SAVE NEW DELAY
+       STA     UDCNT   INITIALIZE COUNTER
+HOFUD8 NAPP    1,HOFUD1 SLEEP 1
+*NEW DIRECTION
+HOFUD9 STA     INIDIR  NEW DIRECTION
+       LDA     #55     PREINITIAL DELAY
+       STA     UDDEL
+       LDA     #3      FIRST LETTER DELAY
+       STA     UDCNT
+       BRA     HOFUD8  SLEEP 1
+*
+*CHECK BYTE
+*
+       FDB     $FFFF
+*
+*HALL OF FAME DISPLAY
+*
+HALDIS CLR     HSRFLG  CLEAR HIGH SCORE RESET FLAG
+       JSR     GNCIDE  KILL ALL PROCESSES
+       JSR     DEFNNN  EXPAND "DEFENDER" DATA
+       JSR     SCRCLR  CLEAR ACTIVE SCREEN
+       JSR     P1SW    ALWAYS UPRIGHT
+       CLR     PCRAM+1 BLACK LETTERS
+       NEWP    CREDS,AMTYPE TURN ON CREDITS
+       JSR     SCORES  DISPLAY SCORES
+       LDU     #HALLDV GET HEADINGS MESSAGE VECTOR
+       LDX     #$3854  SCREEN ADDRESS
+       MLJSR   2,WTEXTB WRITE TO SCREEN
+*UNDERLINE HEADINGS
+       LDU     #$1111  UNDERLINE COLOR
+       LDX     #$1E7B  LEFT ADDERSS
+       LDD     #$5F00  OFFSET OF RIGHT END, RIGHT UNDERLINE
+HALD1  STU     D,X
+       CMPA    #$41    OFFSET OF LEFT END, RIGHT UNDERLINE
+       BNE     HALD2
+       LDA     #$1F    OFFSET OF RIGHT END, LEFT UNDERLINE
+HALD2  DECA
+       BPL     HALD1
+*
+       LDA     #$2F    SLASH FOR PSEUDO-WORDS
+       STA     PNUMB+1 RANK NUMBER
+       STA     INITDS+3 INITIALS
+       STA     SCOREN+6 SCORE
+       LDU     #HALENV GET DATA LINE MESSAGE VECTOR
+       LDX     #$1886  SCREEN ADDRESS
+       STX     SPOINT
+       LDX     #THSTAB TODAYS GREATEST TABLE ADDRESS
+       STX     XTEMP$
+       BSR     HALDT   DISPLAY TABLE
+       LDX     #$5986  SCREEN ADDRESS
+       STX     SPOINT
+       LDX     #CRHSTD ALL TIME GREATEST TABLE ADDRESS
+       STX     XTEMP$
+       BSR     HALDT   DISPLAY TABLE
+       LDA     #$3F    YELLOW "DEFENDER"
+       STA     PCRAM+$C
+       LDY     #DEFDSC MAKE WHOLE DEFENDER DESCRIPTER
+       LDD     #$3C18
+       STD     ,Y
+       LDD     #DEFBLK
+       STD     2,Y
+       LDD     #$3038  SCREEN ADDRESS
+       JSR     CWRIT   WRITE TO SCREEN
+       NEWP    COLR,AMTYPE LASER COLOR LETTERS
+       LDA     #60     DELAY TIMER
+       STA     STALT
+HALD3  TST     ICREDF  CHECK FOR INCREASE IN CREDITS
+       BNE     HALD4   YES?, GIVE INSTRUCTIONS
+       TST     HSRFLG  CHECK FOR HIGH SCORE RESET
+       LBNE    HALDIS  YES?, HALL OF FAME AGAIN
+       DEC     STALT   TIME OUT?
+       BEQ     HALD4
+       NAPP    10,HALD3 NOPE, NOT YET
+HALD4  BRA     LEDRET  ON TO INSTUCTIONS
+*
+*HALL OF FAME DISPLAY ONE TABLE        U=DATA LINE MESSAGE VECTOR
+*      SPOINT=SCREEN ADDRESS   XTEMP$=TABLE DATA ADDRESS
+*
+HALDT  LDA     #$31    INITIALIZE RANK NUMBER
+       STA     PNUMB
+HALDT1 CLRA            CLEAR LEADING ZERO NOT FLAG
+       LDY     #SCOREN SCORE PSEUDO WORD ADDRESS
+       LDX     XTEMP$  GET TABLE DATA POINTER
+HALDT2 JSR     LDBXBV  GET SCORE NIBBLE
+       LEAX    1,X     ADVANCE DATA POINTER
+       ANDB    #$F     REMOVE GARBAGE
+       BNE     HALDT3  NOT ZERO?, DISPLAY
+       TSTA            CHECK LEADING ZERO NOT FLAG
+       BNE     HALDT3  SET?, DISPLAY ZERO
+       LDB     #$40    REPLACE LEADING ZERO WITH SPACE
+       BRA     HALDT4  DISPLAY
+HALDT3 INCA            SET LEADING ZERO FLAG NOT FLAG
+       ADDB    #$30    CHANGE TO ASCII NUMBER
+HALDT4 STB     ,Y+     STORE IN PSEUDO WORD
+       CMPY    #SCOREN+6 CHECK IF SCORE DONE?
+       BNE     HALDT2
+       JSR     RCMOSD  GET FIRST 2 INITIALS
+       STD     INITDS  STORE IN PSEUDO WORD
+       JSR     RCMOSA  GET LAST INITIAL
+       STA     INITDS+2 STORE IN PSEUDO WORD
+       STX     XTEMP$  SAVE DATA POINTER
+       LDX     SPOINT  GET SCREEN ADDRESS
+       MLJSR   2,WTEXTB WRITE DATA LINE TO SCREEN
+       LEAX    10,X    MOVE SCREEN POINTER ONE LINE DOWN
+       STX     SPOINT  SAVE SCREEN POINTER
+       INC     PNUMB   ADVANCE RANK NUMBER
+       LDA     PNUMB   CHECK IF DONE
+       CMPA    #$39
+       BNE     HALDT1
+       RTS
+
+*
+*INSTRUCTION PAGE
+*
+
+LEDRET JSR     GNCIDE  KILL ANY EXCESS
+       JSR     SCINIT  GET THE WORLD,SCANNER AND TERRAIN
+       LDA     #$D9    SET STATUS
+       STA     STATUS
+       JSR     SCORES
+       NEWP    CREDS,AMTYPE TURN ON CREDITS
+       JSR     BORDER
+       LDX     #TEXTAB+2
+       STX     TEXPTR
+       NEWP    COLR,AMTYPE
+       NEWP    CBOMB,AMTYPE
+       NEWP    TIECOL,AMTYPE
+       NEWP    SCPROC,AMTYPE
+       NEWP    TEXTP,AMTYPE
+       STILOB ASTP1,XMAN,YMAN ASTRONAUT
+       LDD     #$6666
+       STD     OBJCOL,X
+       STX     MANPTR  SAVE HIS OBJECT
+       STILOB PLAPIC,XSHIP,YSHIP PLAYER
+       LDD     #$0
+       STD     OBJCOL,X LEAVE SHIP
+       STX     SHIPTR  SAVE IT
+       JSR     GETOB   GET AN OBJECT
+       LDD     #LNDP1
+       STD     OPICT,X
+       LDD     #$1DA0
+       STD     OX16,X
+       LDD     #$4000
+       STD     OY16,X
+       LDD     #$A0
+       STD     OYV,X
+       LDD     #0
+       STD     OXV,X   MAKE HIM DESCEND.
+       LDD     #$4433
+       STD     OBJCOL,X BLIP
+       JSR     APVCT   MAKE HIM MATERIALIZE
+       STX     ENEMYP
+       NAPP    $E6,AMODE1 WAIT FOR HIM TO REACH MAN
+AMODE1 LDD     #$FF50  GOING UP!
+       LDX     ENEMYP  GET THE GUYS BLOCK
+       STD     OYV,X
+       LDX     MANPTR
+       STD     OYV,X   HIS TOO.
+       NAPP    $A0,AMODE2 WAIT FOR HIM TO BE IN LINE WITH THE LASER.
+AMODE2 NEWP    LASR$,AMTYPE
+       STX     LASPRC  SAVE NEW PROCESS ID.
+       NAPP    $15,AMODE3
+
+SCINIT LDA     #$FF
+       STA     STATUS
+       JSR     OINIT   INITIALIZE OBJEX PLEASE
+       JSR     SCRCLR
+       LDD     #0
+       STD     BGL
+       STD     BGLX
+       MLJSR   0,BGI
+       JSR     CRINIT
+       LDA     #$DB    THIS IS THE STATUS
+       STA     STATUS  WHY???  WHO KNOWS!
+       LDX     #$1030  CENTER
+       STX     PLAXC   FOR SCANNER
+       RTS
+
+KLASUB LDX     LASPRC  TIME TO KILL THE LASER
+       LDU     LSTATE  KILL A LASER CODE
+       CLRA
+AMODE6 STA     0,U
+       LEAU    $100,U
+       CMPU    PD,X
+       BLS     AMODE6
+       JMP     KILL    KILL THE LASER PROCESS
+
+AMODE3 BSR     KLASUB
+       LDX     ENEMYP  TIME TO BLOW UP THE ENEMY
+       JSR     KILLOB
+       JSR     XSVCT   BLOW UP THE BASTARD
+       LDX     SHIPTR  GET THE SHIP
+       LDD     #$0040  X
+       STD     OXV,X
+       LDD     #$00D4  Y
+       STD     OYV,X   MOVE TO THE MAN
+       LDA     #$2D    30 FRAMES TILL INTERSECTION
+       STA     MANFRF  COUNT IN RAM
+       LDX     MANPTR  MANS POINTER
+       LDD     #0      NO Y VEL
+       STD     OYV,X   FOR EUGENE.
+AMODE4 LDX     MANPTR  GET THE MANS PTR
+       LDD     OYV,X   GET HIS VELOCITY
+       ADDD    #0008   MAKE IT FASTER
+       STD     OYV,X   AND PUT IT BACK.
+       DEC     MANFRF  ONE LESS FRAME
+       BEQ     AMODE5
+       NAPP    2,AMODE4
+*
+*      INTERSECTION OF SHIP AND MAN
+*
+
+AMODE5 STILOB  C5P1,$1DFF,$9000 500 PTS.
+       LDD     #$0
+       STD     OBJCOL,X
+       STX     P500OB
+       LDD     #0
+       LDU     #$0C0
+       LDX     SHIPTR
+       STD     OXV,X
+       STU     OYV,X   DOWN TO TERRAIN
+       LDX     MANPTR
+       LDD     #$1E80
+       STD     OX16,X  HYPER THE MAN
+       LDD     #$A2E0
+       STD     OY16,X
+       STU     OYV,X
+       NAPP    $50,AMODE7
+AMODE7 LDX     P500OB
+       LDD     #$E000
+       STD     OY16,X  MOVE THE 500 DOWN
+       LDD     #$1C00
+       STD     OX16,X  BOTH COORDS
+       LDX     MANPTR
+       LDD     #0
+       STD     OYV,X   STOP THE MAN
+       LDX     SHIPTR  GET THE SHIP
+       LDD     #PLBPIC
+       STD     OPICT,X TURN AROUND
+       LDD     #$FFC0
+       STD     OXV,X
+       LDD     #$FE80
+       STD     OYV,X   MOVE SHIP BACK
+       NAPP    $60,AMODE8
+AMODE8 LDX     SHIPTR
+       LDD     #PLAPIC
+       STD     OPICT,X
+       LDD     #0
+       STD     OXV,X
+       STD     OYV,X
+       LDX     P500OB
+       LDD     OBJX,X  GET COORD
+       JSR     KILLOB  TRASH THE OBJECT
+       JSR     OFF66   AND REMOVE CORPSE
+*
+*      TIME TO START FORMING THE TABLE.
+*
+
+       LDU     #ENMYTB TABLE OF OBJECTS.
+
+AMOD12 JSR     GETOB   OBJECT PLEASE*****************BSO BONER***
+       FCB     $EC,$C9,$00,$0C (LDD OLEN,U)GET THE OBJECT PICTURE
+       STD     OPICT,X
+       FCB     $EC,$C9,$00,$24 (LDD 3*OLEN,U)
+       STD     OBJCOL,X BLIP
+       LDD     #$1F00  LARGE X
+       STD     OX16,X
+       LDD     #$A000  LOW Y
+       STD     OY16,X
+       LDD     #$FF40  NEG Y V
+       STD     OYV,X
+       LDD     #0      NO X
+       STD     OXV,X
+       JSR     APVCT   MAKE IT APPEAR
+       STU     OTABPT  SAVE OUR TABLE POINTER
+       STX     ENEMYP  SAVE THE GUYS POINTER.
+       NAPP    $5F,AMOD10 WAIT FOR IN LINE WITH LASER
+AMOD10 NEWP    LASR$,AMTYPE
+       STX     LASPRC  SAVE THE PROCESS POINTER.
+       NAPP    $17,AMOD11
+AMOD11 JSR     KLASUB  TRASH THE LASER
+       LDX     ENEMYP  GET THE GUY
+       JSR     KILLOB  FREE IT
+       JSR     GETOB   GET IT BACK
+       JSR     XSVCT   BYE
+       LDU     OTABPT  GET THE POINTER BACK****************BSO BONER*******
+       FCB     $EC,$C9,$00,$18 (LDD 2*OLEN,U) GET THE X****BSO BONER*******
+       STD     OX16,X
+       LDD     ,U++    MOVE TO NEXT AND FETCH Y
+       STD     OY16,X
+       LDD     #0
+       STD     OYV,X
+       STD     OXV,X   NO MOVEMENT PLEASE
+       JSR     APVCT   APPEARANCE HERE PLEASE.
+       STU     OTABPT
+       NAPP    $20,BMODE2
+BMODE2 LDX     TEXPTR
+       LEAX    2,X
+       STX     TEXPTR  PUT THE TEXT DOWN
+       NAPP    $20,BMODE3
+BMODE3 LDU     OTABPT
+       CMPU    #OTABND END
+       LBNE    AMOD12
+       NAPP    $FF,AMOD13
+AMOD13 NAPP    $FF,AMODE$ DO IT AGAIN!
+
+LASR$  LDX     SHIPTR  GET SHIP
+       LDX     OBJX,X  GET SCREEN COORDS
+LASRR  LEAX    $704,X
+       STX     PD,U
+       STX     PD+2,U
+       STX     LSTATE
+LAS0   LDA     #4
+       LDX     PD,U
+       LDB     #$11
+LAS1   STB     ,X
+       LEAX    $100,X
+       DECA
+       BNE     LAS1
+       LDB     #$99
+       STB     ,X
+       STX     PD,U
+       LDY     FISX
+       CMPY    #FISEND-3
+       BLO     LAS2
+       LDY     #FISTAB
+LAS2   LDX     PD+2,U
+       LDA     #3
+LAS3   LDB     ,Y+
+       STB     ,X
+       LEAX    $100,X
+       DECA
+       BNE     LAS3
+       STY     FISX
+       STX     PD+2,U
+       LDX     LSTATE
+LAS4   CLR     ,X
+       LEAX    $100,X
+       STX     LSTATE
+       NAPP    1,LAS0
+
+TEXTP  LDY     #TEXTAB START OF TABLE****************BSO BONER**********
+TEXTP1 FCB     $EE,$A9,$00,$0E (LDU TENT,Y) GET MESSAGE VECTOR**********
+       LDX     ,Y++    GET ADDRESS*******************BSO BONER**********
+       MLJSR   2,WTEXTB WRITE THIS ONE.
+       STY     TEXTMP  SAVE PTR
+       NAPP    6,TEXTP2
+TEXTP2 LDY     TEXTMP  GET IT BACK
+       CMPY    TEXPTR  ENOUGH???
+       BNE     TEXTP1  NOPE...DO ANOTHER
+       BRA     TEXTP   AND CONTINUE
+
+*
+*WILLIAMS PAGE
+*
+AMODE$ JSR     GNCIDE
+       CLR     ICREDF  CLEAR CREDIT INCREASE FLAG
+       LDA     #$FB
+       STA     STATUS
+       JSR     SCRCLR
+       CLR     MESPT
+       LDD     #$FFFF
+       STD     NUMBER
+       NEWP    COLR,AMTYPE
+       NEWP    TIECOL,AMTYPE
+       LDA     #$3F
+       STA     PCRAM+$C
+
+WILLI  JMP     LOGO    SAM STUFF
+
+*
+*WILLIAMS LOGO
+*
+LOGO   JSR     DEFNNN  EXPAND "DEFENDER" DATA
+       LDA     #3      #BYTES PER SCREEN
+       STA     LGOFLG
+       LDX     #LGOTAB
+       STX     LGOPTR
+LOGO0  LDA     LGOFLG
+       STA     TEMPB
+       LDY     LGOPTR
+LOGO1  LDA     ,Y+
+       CMPA    #$AA    DATA OR INSTRUCTION?
+       BLS     LOGO3
+*INSTRUCTION
+       COMA
+       BEQ     LOGO1   NULL BYTE
+       DECA
+       BNE     LOGO10  QUIT
+       LDD     ,Y++    HYPER
+       STD     CURSR$
+       CLRA
+       BRA     LOGO7
+*DATA
+LOGO3  ASLA            MOVE CURSER
+       BCC     LOGO4
+       DEC     CURSR$
+LOGO4  ASLA
+       BCC     LOGO5
+       INC     CURSR$
+LOGO5  ASLA
+       BCC     LOGO6
+       DEC     CURSR$+1
+LOGO6  ASLA
+       BCC     LOGO7
+       INC     CURSR$+1
+LOGO7  STA     TEMPA   SAVE DATA
+*WRITE TO SCEEN
+       LDD     CURSR$
+       LSRA
+       TFR     D,X
+       LDB     ,X      SAVE OTHER PIXEL
+       BCS     LOGO8
+       ORB     #$F0    LEFT
+       BRA     LOGO9
+LOGO8  ORB     #$F
+LOGO9  STB     ,X
+       LDA     TEMPA   GET DATA
+       BNE     LOGO3   OTHER PIXEL
+       DEC     TEMPB
+       BNE     LOGO1   NEXT BYTE
+       STY     LGOPTR  SLEEP
+       LDA     #2
+       LDX     #LOGO0
+       JSR     SLEEPP
+LOGO10 STX     CUREND  SAVE END OF CURSER
+       LDA     #3      SLOW?
+       CMPA    LGOFLG
+       BNE     LOGO1$  NOPE
+       LDA     #10     NOPE MAKE FAST
+       STA     LGOFLG
+       NEWP    PRES,AMTYPE CREATE THE NEXT ONE.
+LOGO1$ LDX     #LGOTAB
+       STX     LGOPTR
+       BRA     LOGO0   CONTINUE
+*
+*ELECTRONICS PRESENTS
+*
+PRES   NEWP    DEFEND,AMTYPE CREATE DEFEND.
+PRES1  LDX     #$3258
+       LDU     #ELECV
+       MLJSR   2,WTEXTB
+       LDA     #5
+       LDX     #PRES1
+       JSR     SLEEPP
+*
+*DEFENDER
+*
+DEFEND NAPP    $30,DEFEN$ START APPEARS
+DEFEN$ LDD     #DEFPIC INITIALIZE DESCRIPTER POINTER
+       STD     DEFSPT
+       LDD     #DEFBLK INITIALIZE DATA POINTER
+       STD     DEFDPT
+       LDD     #0      ZERO BGL
+       STD     BGL
+       LDD     #$0C00  INITIALIZE 16 BIT X COORINATE
+       STD     WX
+       LDD     #DEFRAM INITIALIZE OBJECT POINTER
+       STD     DEFRPT
+*START LOOP
+DEF1   LDX     DEFRPT
+       LDY     DEFSPT
+       LDD     #$040C  WIDTH, HEIGHT
+       STD     ,Y
+       LDD     DEFDPT  DATA ADDRESS
+       STD     2,Y
+       ADDD    #4*24
+       STD     DEFDPT
+       STY     OPICT,X DESCRIPTER ADDRESS
+       LDD     WX
+       STD     OX16,X  16 BIT X COORDINATE
+       ADDD    #$100
+       STD     WX
+       LDD     #$9800  16 BIT Y COORDINATE
+       STD     OY16,X
+       JSR     APVCT   START APPEAR
+       LEAX    BLKLEN,X NEXT OBJECT
+       STX     DEFRPT
+       LEAY    4,Y     NEXT DECSRIPTER
+       STY     DEFSPT
+       CMPY    #DEFPIC+4*15 DONE?
+       BNE     DEF1
+*
+DEF2   NAPP    $2E,DEF33
+DEF33  LDX     #DEFDSC MAKE WHOLE DEFENDER DESCRIPTER
+       LDD     #$3C18
+       STD     ,X
+       LDD     #DEFBLK
+       STD     2,X
+       NEWP    DEF50,AMTYPE START WHOLE DEFENDER RESTORE
+       NAPP    $28,DEF44
+DEF44  NEWP    CBOMB,AMTYPE
+*
+*COPYRIGHT
+*
+COPYRT LDU     CUREND  GET END OF "WILLIAMS" CURSER
+       LDY     #CPRTAB TABLE START
+       LDX     #$3BD0  TOP LEFT
+CPR1   LDD     ,Y++
+       STD     XTEMP$  SAVE DATA
+       LDA     #1      BIT POINTER
+CPR2   CLRB
+       BITA    XTEMP$
+       BEQ     CPR3
+       LDB     #$10
+CPR3   BITA    XTEMP$+1
+       BEQ     CPR4
+       ORB     #1
+CPR4   STB     ,X+
+       ASLA
+       BNE     CPR2
+       LEAX    $F8,X
+       CMPY    #CPREND
+       BNE     CPR1
+*"WILLIAMS" CHECK
+       LDX     #PCRAM  GET COLOR ZERO ADDRESS
+       LDB     LOGO8+1 GET WILLIAMS COLOR NUMBER
+       LDA     B,X     GET WILLIAMS COLOR
+       COMA            FULL RED PRESENT?
+       ANDA    #7
+       BNE     WILCK1  NO?, BOGUS
+       LDX     #WCURS!.$C35A CONFUSION
+       LDD     #WCURS!.$3CA5 MORE CONFUSION
+       STU     D,X     TRANSFER CURSER
+WILCK1 LDA     #1      SET POWER FLAG
+       STA     PWRFLG
+       NEWP    CREDS,AMTYPE TURN ON CREDITS
+       LDA     #60     DELAY TIMER
+       STA     STALT
+CPR55  TST     ICREDF  CHECK FOR INCREASE IN CREDITS
+       LBNE    LEDRET  YES?, GIVE INSTRUCTIONS
+       DEC     STALT   TIME OUT?
+       BEQ     CPR56
+       NAPP    10,CPR55 NOPE, NOT YET
+CPR56  JMP     HALDIS  DISPLAY HALL OF FAME
+*
+*"DEFENDER" WHOLE WRITING ROUTINE
+*
+DEF50  LDY     #DEFDSC DESCRIPTER
+       LDD     #$3090  SCREEN ADDRESS
+       JSR     CWRIT
+       TST     RAMALS  CHECK ONE SIZE
+       BNE     DEF51
+       TST     RAMALS+RAMSIZ CHECK ANOTHER TO BE SURE
+       BNE     DEF51
+       NEWP    WILLIR,AMTYPE APPEAR DONE, QUICK RSTORE LOGO
+       JMP     SUCIDE
+DEF51  NAPP    1,DEF50 SLEEP 1, REFRESH
+*
+*"DEFENDER" DATA EXPANDER
+*
+DEFNNN LDX     #DEFBLK INITIALIZE SERIAL POINTER
+       LDY     #DEFDAT DATA TABLE START
+       CLRA
+       STA     PIX     LEFT PIXEL FIRST
+       STA     LEN     ZERO LENGTH ACCUMULATOR
+DEFX1  LDA     ,Y      GET LEFT DATA NIBBLE
+       LSRA
+       LSRA
+       LSRA
+       LSRA
+       BSR     DEFX2   DECODE
+       LDA     ,Y+     GET RIGHT DATA NIBBLE
+       ANDA    #$F
+       BSR     DEFX2   DECODE
+       CMPY    #DEFDEN DONE?
+       BNE     DEFX1
+*
+DEFX2  BITA    #$C     DIRECT OR EXTENDED
+       BNE     DEFX3
+*EXTENDED
+       ADDA    LEN     INCLUDE UPPER BITS
+       ASLA            MULT BY 4
+       ASLA
+       STA     LEN     SAVE LENGTH
+       RTS             NEXT NIBBLE
+*DIRECT
+DEFX3  PSHS    A
+       ANDA    #3      EXTRACT LENGTH OF LINE
+       ADDA    LEN     INCLUDE EXTENDED BITS
+       STA     LEN
+       PULS    A
+       ANDA    #$C     EXTRACT COLOR
+       LSRA
+       LSRA
+       LDU     #DCOLRS-1 COLOR TABLE START
+       LDB     A,U
+       STB     DCOLOR
+       CMPX    #DEFBLK+24*60 CHECK FOR NEXT LINE
+       BLO     DEFX4
+       LEAX    1-24*60,X NEXT LINE
+DEFX4  LDA     PIX     CHECK RIGHT OR LEFT PIXEL
+       BEQ     DEFX5   LEFT FIRST?
+       LDA     ,X      RIGHT FIRST
+       ANDA    #$F0    SAVE OLD LEFT
+       STA     ,X
+       LDA     DCOLOR
+       ANDA    #$F     RIGHT COLOR ONLY
+       ORA     ,X
+       STA     ,X      SAVE NEW RIGHT PIXEL
+       LDA     DCOLOR
+       BRA     DEFX7
+DEFX5  COM     PIX
+       LDA     DCOLOR  MAIN LINE LOOP
+DEFX6  STA     ,X      SAVE NEW LEFT AND RIGHT
+       DEC     LEN     COUNT DOWN LENGTH
+       BMI     DEFX8   LINE DONE?
+DEFX7  LEAX    24,X
+       DEC     LEN     COUNT DOWN LENGTH
+       BPL     DEFX6   LINE NOT DONE?
+       CLR     PIX     LAST RIGHT
+DEFX8  CLR     LEN     ZERO LENGTH ACCUMULATOR
+       RTS
+*
+*CREDITS
+*
+CREDS  LDB     CREDIT  GET CREDITS
+       BEQ     CREDS2  NO CREDITS?, NO DISPLAY
+       CMPB    OCRED   CHECK IF COIN ADDED
+       BLS     CREDS1
+       STB     OCRED   YES?, UPDATE OLD CREDITS
+       INC     ICREDF  SET INCREASE CREDIT FLAG
+CREDS1 LDU     #CREDV  MESSAGE VECTOR
+       LDX     #$28E5  SCREEN ADDRESS
+       MLJSR   2,WTEXTB WRITE TO SCREEN
+       CLRA            NO HIGH
+       LDX     #$48E5  PLACE FOR NUMBERS
+       MLJSR   2,WNUMBB WRITE IT
+CREDS2 NAPP    16,CREDS SLEEP 16
+*
+*WILLIAMS LOGO FAST RESTORE
+*
+WILLIR LDA     #$FF    FAST RATE
+       STA     LGOFLG
+       NAPP    2,WILR1 SLEEP 2
+WILR1  LDA     #10     BACK TO OLD RATE
+       STA     LGOFLG
+       JMP     SUCIDE
+*
+*PLAYER SCORES
+*
+SCORES LDA     PLRCNT  GET PLAYER COUNT
+SCORS1 BEQ     SCORS2  DONE?
+       JSR     SCRTR0  DISPLAY SCORE
+       DECA
+       BRA     SCORS1  NEXT
+SCORS2 RTS
+*
+*LOGO DATA
+*
+NULL   EQU     $FF     NUL BYTE
+HYPERC EQU     $FE     HYPER TO NEW SCREEN ADDRESS
+QUIT   EQU     $FD     QUIT
+LGOTAB FCB     HYPERC,$74,$40
+       FCB     $11,$11,$85,$81,$81,$81,$88,$82
+       FCB     $82,$22,$24,$22,$42,$24,$24,$24
+       FCB     $44,$24,$44,$49,$44,$94,$41,$88
+       FCB     $14,$41,$88,$14,$41,$88,$94,$41
+       FCB     $88,$94,$49,$88,$14,$98,$58,$94
+       FCB     $98,$18,$94,$46,$66,$62,$42,$42
+       FCB     $42,$42,$25,$24,$24,$68,$24,$24
+       FCB     $24,$26,$11,$18,$18,$58,$18,$58
+       FCB     $81,$44,$98,$81,$44,$98,$81,$44
+       FCB     $98,$14,$94,$94,$16,$22,$24,$24
+       FCB     $A4,$24,$A4,$24,$24,$24,$24,$24
+       FCB     HYPERC,$81,$4A
+       FCB     $42,$42,$42,$42,$44,$99,$99,$41
+       FCB     $88,$14,$41,$88,$14,$46,$24,$24
+       FCB     $24,$24,$24,$24,$A4,$24,$24,$A4
+       FCB     $22,$42,$4A,$42,$42,$44,$99,$19
+       FCB     $91,$19,$91,$91,$81,$81,$41,$81
+       FCB     $49,$46,$42,$42,$42,$42,$42,$42
+       FCB     $24,$22,$42,$62,$62,$42,$24,$49
+       FCB     $19,$91,$91,$91,$91,$91,$85,$88
+       FCB     $14,$94,$14,$24,$24,$24,$24,$24
+       FCB     $24,$A4,$24,$24,$41,$81,$81,$18
+       FCB     $18,$94,$41,$88,$14,$14,$24,$42
+       FCB     $24,$24,$24,$24,$24,$24,$24,$44
+       FCB     $98,$18,$18,$18,$58,$89,$44,$18
+       FCB     $85,$14,$24,$14,$24,$A4,$24,$24
+       FCB     $24,$A4,$24,$28,$24,$44,$18,$19
+       FCB     $19,$81,$41,$81,$14,$24,$24,$24
+       FCB     $24,$22,$42,$42,$64,$41,$85,$81
+       FCB     $81,$18,$19,$41,$89,$44,$42,$22
+       FCB     $42,$24,$24,$24,$24,$24,$44,$18
+       FCB     $14,$98,$11,$81,$81,$41,$89,$44
+       FCB     $42,$22,$42,$24,$24,$24,$24,$24
+       FCB     $44,$18,$94,$41,$88,$89,$44,$49
+       FCB     $88,$14,$41,$88,$14,$14,$24,$24
+       FCB     $24,$26,$62,$66,$26,$24,$18,$91
+       FCB     $91,$19,$18,$14,$18,$14,$14,$24
+       FCB     $14,$2A,$45,$24,$68,$88,$24,$44
+       FCB     $42,$18,$A8,$82,$44,$A8,$22,$20
+       FCB     HYPERC,$87,$40
+       FCB     $44,$11,$88,$24
+       FCB     HYPERC,$9A,$3F
+       FCB     $44,$11,$88,$24
+       FCB     HYPERC,$C1,$3F
+       FCB     $44,$44,$44,$11,$11,$11,$11,$88
+       FCB     $88,$88,$22,$22,$22,$20
+       FCB     HYPERC,$C3,$45
+       FCB     $22,$22,$44,$11,$81,$50
+       FCB     QUIT
+*
+*"DEFENDER" DATA
+*
+DEFDAT FCB     $10,$D1,$BD,$29,$C2,$9C,$29,$CB
+       FCB     $EA,$C2,$8C,$29,$C2,$81,$0D,$10
+       FCB     $C2,$8D,$29,$C2,$9C,$29,$CB,$EA
+       FCB     $42,$94,$29,$42,$81,$0C,$3F,$29
+       FCB     $C2,$94,$C2,$9C,$29,$C1,$8D,$A4
+       FCB     $29,$42,$94,$29,$3F,$3E,$29,$42
+       FCB     $A4,$29,$4C,$29,$C1,$8D,$A4,$2A
+       FCB     $42,$94,$29,$3E,$3D,$B6,$B4,$A2
+       FCB     $4A,$17,$CA,$16,$C1,$9C,$B4,$A7
+       FCB     $A4,$B1,$7A,$7A,$3D,$3C,$B6,$B4
+       FCB     $B1,$71,$81,$6B,$16,$C1,$AC,$A4
+       FCB     $B6,$B4,$A2,$4A,$6B,$3C,$2F,$B6
+       FCB     $B4,$29,$62,$85,$C2,$85,$C1,$AC
+       FCB     $A4,$B6,$B4,$28,$62,$A2,$F2,$EB
+       FCB     $61,$84,$29,$62,$8E,$28,$E2,$A4
+       FCB     $B7,$B4,$28,$62,$A2,$E2,$DB,$7B
+       FCB     $42,$96,$28,$4E,$28,$E2,$B4,$B6
+       FCB     $B4,$29,$62,$92,$E2,$CB,$7B,$52
+       FCB     $96,$28,$4E,$28,$EB,$41,$A4,$B7
+       FCB     $B4,$28,$62,$92,$E1,$FB,$7B,$5B
+       FCB     $24,$B1,$6D,$18,$14,$EB,$51,$94
+       FCB     $B7,$B4,$18,$17,$29,$2D,$1E,$B1
+       FCB     $4B,$4B,$25,$B1,$6D,$B1,$5E,$B5
+       FCB     $1A,$4B,$61,$84,$B2,$4B,$41,$82
+       FCB     $C1,$DB,$14,$B5,$18,$17,$18,$16
+       FCB     $D1,$81,$4E,$B6,$19,$4B,$61,$84
+       FCB     $18,$24,$B4,$18,$1F,$1C,$38,$53
+       FCB     $84,$B1,$6E,$2B,$CB,$61,$94,$38
+       FCB     $42,$B4,$18,$41,$81,$EF,$39,$43
+       FCB     $85,$B1,$6E,$2B,$CB,$71,$84,$38
+       FCB     $43,$84,$B6,$18,$1C,$E3,$95,$38
+       FCB     $41,$81,$6D,$38,$CB,$C6,$19,$42
+       FCB     $B5,$38,$4B,$61,$8F,$D3,$95,$38
+       FCB     $5B,$51,$F3,$8C,$BD,$61,$84,$2A
+       FCB     $63,$85,$B6,$18,$ED,$38,$53,$94
+       FCB     $18,$51,$F3,$8C,$BD,$7B,$42,$91
+       FCB     $42,$B5,$18,$7B,$DC,$21,$51,$F3
+       FCB     $4C,$7E,$30,$6C,$C2,$14,$2C,$34
+       FCB     $C7,$E1,$07,$C1,$35,$CC,$21,$42
+       FCB     $C3,$4C,$7F,$10,$6C,$13,$5C,$C1
+       FCB     $35,$C1,$52,$C3,$4C,$7F,$15,$C2
+       FCB     $7D,$34,$C1,$5C,$17,$CC,$36,$C3
+       FCB     $5C,$14,$2D,$34,$C7,$1C,$14,$C2
+       FCB     $6E,$34,$D1,$4E,$15,$CC,$36,$C3
+       FCB     $5C,$14,$2D,$34,$C7,$1C,$14,$C2
+       FCB     $51,$C2,$7D,$14,$F1,$4C
+DEFDEN EQU     *
+*
+*"DEFENDER" COLOR TABLE
+*
+DCOLRS FCB     $22     SHADOW
+       FCB     $CC     LETTERS
+       FCB     0       BACKGROUND
+*
+*"COPYRIGHT[C][P] 1980" DATA
+*
+CPRTAB FCB     $3E,$41,$41,$22,$00,$3E,$41,$41
+       FCB     $3E,$00,$7F,$09,$09,$06,$00,$03
+       FCB     $04,$78,$04,$03,$00,$7F,$09,$19
+       FCB     $66,$00,$41,$7F,$41,$00,$3E,$41
+       FCB     $49,$3A,$00,$7F,$08,$08,$7F,$00
+       FCB     $01,$01,$7F,$01,$01,$00,$1C,$22
+       FCB     $5D,$63,$55,$22,$1C,$22,$7F,$4B
+       FCB     $45,$22,$1C,$00,$00,$00,$42,$7F
+       FCB     $40,$00,$26,$49,$49,$3E,$00,$36
+       FCB     $49,$49,$36,$00,$3E,$41,$41,$3E
+CPREND EQU     *
+
+TEXTAB FDB     $4330
+       FDB     $1C70
+       FDB     $3C70
+       FDB     $5F70
+       FDB     $1CA8
+       FDB     $40A8
+       FDB     $5CA8
+TENT   EQU     *-TEXTAB
+       FDB     SCANV
+       FDB     LANDV
+       FDB     MUTV
+       FDB     BAITV
+       FDB     BOMBV
+       FDB     SWRMPV
+       FDB     SWARMV
+
+YS     EQU     *
+ENMYTB FDB     $6000
+       FDB     $6000
+       FDB     $6200
+       FDB     $9800
+       FDB     $9800
+       FDB     $9A00
+OTABND EQU     *
+OLEN   EQU     *-ENMYTB
+PICTS  FDB     LNDP1
+       FDB     SCZP1
+       FDB     UFOP1
+       FDB     TIEP1
+       FDB     PRBP1
+       FDB     SWPIC1
+XS     FDB     $0900
+       FDB     $1100
+       FDB     $1980
+       FDB     $0960
+       FDB     $1160
+       FDB     $19E0
+BLIPS  FDB     $4433
+       FDB     $CC33
+       FDB     $3333
+       FDB     $8888
+       FDB     $CCCC
+       FDB     $2424
+*
+*SCANNER
+*OFF OLDE BOZOS+PLAYER
+SCNR   LDU     #0
+       LDB     #8
+       LDX     #SETAB
+SCNR0  STU     [,X]
+       STU     [2,X]
+       STU     [4,X]
+       STU     [6,X]
+       ABX
+       CMPX    SETEND
+       BLO     SCNR0
+*OFF PLAYER +
+       LDX     [SETEND]
+       BEQ     MT1
+       STU     ,X
+       CLR     2,X
+       STU     -$100,X
+*OUTPUT TERRAIN
+MT1    LDD     BGL     CALC SCANL
+       SUBD    #$8000-(150*32)
+       STD     XTEMP
+       LSRA
+       LSRA            GET 6 BITS
+       LDU     #MTERR
+       LDB     #3
+       MUL
+       LEAU    D,U     GET ADDR
+       LDA     STATUS
+       BITA    #2      NO TERRAIN???
+       BNE     MTX     NONE
+       LDA     #SCANER!>8
+       LDY     #STETAB ERASE TABLE
+MTLP   LDX     #0
+       STX     [,Y]    OFF OLD
+       PULU    B,X
+       STD     ,Y      SAVE NEW ADDR
+       STX     [,Y++]
+       INCA
+       LDX     #0
+       STX     [,Y]
+       PULU    B,X
+       STD     ,Y
+       STX     [,Y++]
+       INCA
+       CMPA    #(SCANER!>8)+64
+       BNE     MTLP
+*SCANNER BEZEL
+MTX    LDX     #SCANH+$4C01
+       LDD     #$9090
+       STD     ,X
+       STD     $1D,X
+       LDX     #SCANH+$5301
+       LDD     #$0909
+       STD     ,X
+       STD     $1D,X
+*OUTPUT BOZOS
+       LDX     #OPTR
+       LDU     #SETAB  ERASE TABLE
+       BSR     SCNR3
+       LDX     #IPTR
+       BSR     SCNR3
+       STU     SETEND  END OF ERASE TABLE
+*PLAYER BLIP OUTPUT
+       LDD     PLAXC
+       LSRA
+       LSRA
+       LSRA
+       LSRA
+       LSRB
+       LSRB
+       LSRB
+       ADDD    #$4B00+SCANH-1 PLAYER BASE
+       STD     ,U
+       LDX     ,U
+       LDD     #$9099
+       STD     ,X
+       STA     2,X
+       LDA     #$09
+       STA     -$FF,X
+       RTS
+*BLIP SCAN SUBROUTINE
+SCNR10 LDD     OX16,X  FIND OFFSET
+       SUBD    XTEMP   SUBTRACT SCANNER LEFT
+SCNR2  LSRA            SHIFT DOWN TO 6 BITS
+       LSRA
+       LDB     OY16,X
+       LSRB
+       LSRB
+       LSRB
+       ADDD    #SCANER-1
+       STD     ,U
+       LDD     OBJCOL,X STORE BLIP
+       STD     [,U++]
+SCNR3  LDX     ,X      DO THE REST
+       BNE     SCNR10
+       RTS
+*
+*MINI TERRAIN DATA TABLE
+*
+MTERR  FCB     $25,$70,$07,$26,$77,$00,$26,$07,$70,$24,$07,$70
+       FCB     $23,$07,$70,$23,$70,$07,$24,$07,$70,$25,$70,$07
+       FCB     $26,$77,$00,$25,$07,$70,$24,$07,$70,$23,$07,$70
+       FCB     $21,$07,$70,$22,$70,$07,$24,$77,$00,$24,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$25,$77,$00,$25,$70,$07
+       FCB     $26,$77,$00,$24,$07,$70,$23,$70,$07,$25,$77,$00
+       FCB     $26,$70,$07,$26,$77,$00,$26,$77,$00,$25,$07,$70
+       FCB     $23,$07,$70,$22,$07,$70,$21,$77,$00,$21,$70,$07
+       FCB     $23,$70,$07,$25,$70,$07,$25,$07,$70,$25,$77,$00
+       FCB     $25,$77,$00,$24,$77,$00,$22,$07,$70,$20,$07,$70
+       FCB     $1E,$07,$70,$1C,$07,$70,$1D,$70,$07,$1F,$70,$07
+       FCB     $21,$70,$07,$22,$70,$07,$24,$70,$07,$26,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$26,$77,$00,$26,$77,$00
+       FCB     $26,$77,$00,$25,$77,$00,$25,$70,$07,$26,$77,$00
+       FCB     $24,$07,$70,$23,$77,$00,$24,$77,$00,$22,$07,$70
+       FCB     $23,$70,$07,$22,$07,$70,$21,$70,$07,$23,$70,$07
+       FCB     $25,$70,$07,$26,$77,$00,$26,$07,$70,$24,$07,$70
+       FCB     $23,$07,$70,$23,$70,$07,$24,$07,$70,$25,$70,$07
+       FCB     $26,$77,$00,$25,$07,$70,$24,$07,$70,$23,$07,$70
+       FCB     $21,$07,$70,$22,$70,$07,$24,$77,$00,$24,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$25,$77,$00,$25,$70,$07
+       FCB     $26,$77,$00,$24,$07,$70,$23,$70,$07,$25,$77,$00
+       FCB     $26,$70,$07,$26,$77,$00,$26,$77,$00,$25,$07,$70
+       FCB     $23,$07,$70,$22,$07,$70,$21,$77,$00,$21,$70,$07
+       FCB     $23,$70,$07,$25,$70,$07,$25,$07,$70,$25,$77,$00
+       FCB     $25,$77,$00,$24,$77,$00,$22,$07,$70,$20,$07,$70
+       FCB     $1E,$07,$70,$1C,$07,$70,$1D,$70,$07,$1F,$70,$07
+       FCB     $21,$70,$07,$22,$70,$07,$24,$70,$07,$26,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$26,$77,$00,$26,$77,$00
+       FCB     $26,$77,$00,$25,$77,$00,$25,$70,$07,$26,$77,$00
+       FCB     $24,$07,$70,$23,$77,$00,$24,$77,$00,$22,$07,$70
+       FCB     $23,$70,$07,$22,$07,$70,$21,$70,$07,$23,$70,$07
+       ORG     $CF00
+       FCB     $C3     CHECKBYTE
+       END
diff --git a/src/BLK71.SRC b/src/BLK71.SRC
new file mode 100755 (executable)
index 0000000..bbbaf0d
--- /dev/null
@@ -0,0 +1,723 @@
+       TTL     D E F E N D E R   1.0
+       NMLIST
+       NOGEN
+***********************************************************
+*
+*              TERRAIN , MINI-TERRAIN DATA
+*              AND PLAYER EXPLOSION
+*
+***********************************************************
+*
+*SYSTEM EQUATES
+*
+SLEEPP EQU     $FFD1   LONG SLEEP VECTOR
+PD2    EQU     9
+*
+* TERRAIN EQUATES
+*
+TLEN   EQU     $100
+*
+* PLAYER EXPLOSION EQUATES
+*
+PXPOST EQU     2       X POSITION TABLE
+PYPOST EQU     4       Y POSITION TABLE
+PXVELT EQU     6       X VELOCITY TABLE
+PYVELT EQU     8       Y VELOCITY TABLE
+PNBITS EQU     $80     NUMBER OF PIECES
+*
+* TERRAIN VARIABLES
+*
+       SETDP   $A0
+       ORG     $A000
+TEMP1A RMB     1
+TEMP1B RMB     1
+TEMP1C RMB     1
+TEMP2A RMB     2
+TTBLP0 RMB     2       TERRAIN TABLE POINTER-FLAVOR 0
+TTBLP1 RMB     2       TERRAIN TABLE POINTER-FLAVOR 1
+LTPTR  RMB     2       LEFT TERRAIN DATA POINTER
+RTPTR  RMB     2       RIGHT TERRAIN DATA POINTER
+LTBYTE RMB     1       LEFT TERRAIN DATA BYTE
+RTBYTE RMB     1       RIGHT TERRAIN DATA BYTE
+LTCNT  RMB     1       LEFT TERRAIN BIT COUNTER
+RTCNT  RMB     1       RIGHT TERRAIN BIT COUNTER
+LOFF   RMB     1       LEFT VERTICAL OFFSET
+ROFF   RMB     1       RIGHT VERTICAL OFFSET
+SSTACK RMB     2       HARDWARE STACK
+BGLX   RMB     2       OLD SCREEN LEFT ADDRESS
+TEMP2B RMB     2
+*
+* PLAYER EXPLOSION VARIABLES
+*
+       ORG     $A000
+PCENT  RMB     1       PLAYER CENTER
+PCOLC  RMB     1       COLOR COUNTER
+PCOLP  RMB     2       COLOR POINTER
+PSED   RMB     1       RANDOM SEED MS BYTE
+LPSED  RMB     1       RANDOM SEED LS BYTE
+PSED2  RMB     1       RANDOM SEED 2 MS BYTE
+LPSED2 RMB     1       RANDOM SEED 2 LS BYTE
+*
+* SYSTEM VARIABLES
+*
+BGL    EQU     $A020   BACKGROUND LEFT
+IRQHK  EQU     $A024   IRQ HOOK
+PCRAM  EQU     $A026   COLOR RAM BUFFER TABLE
+*
+* TERRAIN TABLES
+*
+       ORG     $B300
+ALTTBL RMB     TLEN*4  ALTITUDE TABLE
+TERTF0 RMB     $390    TERRAIN TABLE FLAVOR 0
+TERTF1 RMB     $390    TERRAIN TABLE FLAVOR 1
+STBL   RMB     $130    SCREEN ADDRESS TABLE
+*
+* PLAYER EXPLOSION TABLE
+*
+       ORG     $B300
+TABLE  RMB     10*PNBITS
+*
+* VECTORS
+*
+       ORG     $C000
+       JMP     BGINIT  TERRAIN GENERATION
+       JMP     BGOUT   TERRAIN OUTPUT ROUTINE
+       JMP     BGALT   TERRAIN ALTITUDE TABLE GENERATOR
+       JMP     BGERAS  TERRAIN ERASE
+       FDB     MTERR   MINI TERRAIN DATA
+       JMP     PLEX    PLAYER EXPLOSION
+       FDB     WVTAB   WAVE DATA TABLE
+       FDB     WVTEND  "
+*********************************************************
+*
+* TERRAIN GENERATION
+*
+BGINIT LDD     BGL     GET LEFT TERRAIN POINTER
+       ANDB    #$E0    FIND NEAREST PIXEL
+       STD     TEMP2B
+       ADDD    #$2610  START ON RIGHT EDGE OF SCREEN
+       STD     BGLX
+       CLR     LTCNT   FIND TERRAIN POSITION
+       LDX     #TDATA-1
+       STX     LTPTR
+       LDA     #$E0    BASE OFFSET
+       STA     LOFF
+       JSR     RFONL1  SETUP LEFT BYTE
+       LDX     #$10    ROTATE PLANET TO FIND OFFSET
+TGEN1  CMPX    BGLX
+       BEQ     TGEN4
+       LDA     LTBYTE
+       BPL     TGEN2
+       DEC     LOFF
+       BRA     TGEN3
+TGEN2  INC     LOFF
+TGEN3  JSR     RFONL1
+       LEAX    $20,X
+       BRA     TGEN1
+TGEN4  LDD     LTPTR   SAVE TERRAIN POINTER
+       STD     TEMP2A
+       LDA     LTCNT   SAVE COUNTER
+       STA     TEMP1A
+       LDA     LTBYTE  SAVE TERRAIN DATA BYTE
+       STA     TEMP1B
+       LDA     LOFF    SAVE TERRAIN OFFSET
+       STA     TEMP1C
+       LDX     #TERTF0 INITIALIZE TERRAIN TABLE POINTERS
+       STX     TTBLP0
+       LDX     #TERTF1
+       STX     TTBLP1
+TGEN5  LDD     BGLX    INITIAL TERRAIN GENERATING LOOP
+       SUBD    #$20
+       STD     BGLX
+       CMPD    TEMP2B
+       BMI     TGEN6
+       JSR     ADDL01
+       BRA     TGEN5
+TGEN6  LDD     TEMP2A  SET RIGHT TERRAIN POINTER
+       STD     RTPTR
+       LDA     TEMP1A  SET RIGHT TERRAIN COUNTER
+       STA     RTCNT
+       LDA     TEMP1B  SET RIGHT TERRAIN BYTE
+       STA     RTBYTE
+       LDA     TEMP1C  SET RIGHT OFFSET
+       STA     ROFF
+       LDY     #STBL   ZERO SCREEN ADDRESS TABLE
+       LDX     #0
+TGEN10 STX     ,Y++
+       CMPY    #STBL+$130
+       BNE     TGEN10
+       RTS
+*********************************************************
+*
+* TERRAIN OUTPUT ROUTINE
+*
+BGOUT  LDD     BGL     UPDATE TABLES
+       ANDB    #$E0
+       SUBD    BGLX
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       STA     TEMP1A
+       BEQ     TTER08
+       BMI     TTER09
+TTER10 LDD     BGLX
+       ADDD    #$20
+       STD     BGLX
+       JSR     ADDR01
+       DEC     TEMP1A
+       BNE     TTER10
+       BRA     TTER08
+TTER09 LDD     BGLX
+       SUBD    #$20
+       STD     BGLX
+       JSR     ADDL01
+       INC     TEMP1A
+       BNE     TTER09
+TTER08 LDD     BGL
+       ANDB    #$E0
+       STD     BGLX
+       LDX     #0
+       LDY     #STBL
+       STS     SSTACK  SAVE HARDWARE STACK
+       LDS     TTBLP0  FOR FLAVOR 0
+       BITB    #$20    CHECK FLAVOR
+       BNE     TTER02
+       LDS     TTBLP1  CHANGE TO FLAVOR 1
+TTER02 LDA     #$98
+TTER03 STX     [,Y]    FAST OUTPUT
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       STX     [,Y]
+       PULS    B,U
+       STD     ,Y
+       STU     [,Y++]
+       DECA
+       BNE     TTER03
+TTER04 LDS     SSTACK  RECOVER HARDWARE STACK
+       RTS
+*
+* ADD LEFT PIXEL ROUTINE
+*
+ADDL01 JSR     LFONR1  LEFT FUNCTION ON RIGHT SIDE
+       BMI     ADDL07
+       DEC     ROFF    UP
+       BRA     ADDL08
+ADDL07 INC     ROFF    DOWN
+ADDL08 LDA     #$20    CHECK FLAVOR
+       BITA    BGLX+1
+       BNE     ADDL02
+       LDX     TTBLP1  FLAVOR 1
+       JSR     LFONL1  LEFT FUNCTION ON LEFT SIDE
+       BMI     ADDL04
+       DEC     LOFF    UP
+       LDA     LOFF
+       STA     ,X
+       STA     $1C8,X
+       LDD     #$7007
+       STD     1,X
+       STD     $1C9,X
+       LEAX    3,X     MOVE TABLE POINTER
+       CMPX    #TERTF1+$1C8
+       BNE     ADDL09
+       LDX     #TERTF1
+ADDL09 STX     TTBLP1
+       RTS
+ADDL04 LDA     LOFF    DOWN
+       STA     ,X
+       STA     $1C8,X
+       INCA
+       STA     LOFF
+       LDD     #$0770
+       STD     1,X
+       STD     $1C9,X
+       LEAX    3,X     MOVE TABLE POINTER
+       CMPX    #TERTF1+$1C8
+       BNE     ADDL03
+       LDX     #TERTF1
+ADDL03 STX     TTBLP1
+       RTS
+ADDL02 LDX     TTBLP0  FLAVOR 0
+       JSR     LFONL1  LEFT FUNCTION ON LEFT SIDE
+       BMI     ADDL06
+       DEC     LOFF    UP
+       LDA     LOFF
+       STA     ,X
+       STA     $1C8,X
+       LDD     #$7007
+       STD     1,X
+       STD     $1C9,X
+       LEAX    3,X     MOVE TABLE POINTER
+       CMPX    #TERTF0+$1C8
+       BNE     ADDL10
+       LDX     #TERTF0
+ADDL10 STX     TTBLP0
+       RTS
+ADDL06 LDA     LOFF    DOWN
+       STA     ,X
+       STA     $1C8,X
+       INCA
+       STA     LOFF
+       LDD     #$0770
+       STD     1,X
+       STD     $1C9,X
+       LEAX    3,X     MOVE TABLE POINTER
+       CMPX    #TERTF0+$1C8
+       BNE     ADDL05
+       LDX     #TERTF0
+ADDL05 STX     TTBLP0
+       RTS
+*
+* ADD RIGHT PIXEL ROUTINE
+*
+ADDR01 LDA     LTBYTE  CHECK LEFT SIDE
+       BPL     ADDR07
+       DEC     LOFF    UP
+       BRA     ADDR08
+ADDR07 INC     LOFF    DOWN
+ADDR08 JSR     RFONL1  RIGHT FUNCTION ON LEFT SIDE
+       LDA     #$20    CHECK FLAVOR
+       BITA    BGLX+1
+       BEQ     ADDR02
+       LDX     TTBLP1  FLAVOR 1
+       LEAX    -3,X    MOVE TABLE POINTER
+       CMPX    #TERTF1-3
+       BNE     ADDR03
+       LDX     #TERTF1+$1C5
+ADDR03 STX     TTBLP1
+       LDA     RTBYTE  CHECK ON RIGHT SIDE
+       BPL     ADDR04
+       DEC     ROFF    UP
+       LDA     ROFF
+       STA     ,X
+       STA     $1C8,X
+       LDD     #$0770
+       STD     1,X
+       STD     $1C9,X
+       JSR     RFONR1  RIGHT FUNCTION ON RIGHT SIDE
+       RTS
+ADDR04 LDA     ROFF    DOWN
+       STA     ,X
+       STA     $1C8,X
+       INCA
+       STA     ROFF
+       LDD     #$7007
+       STD     1,X
+       STD     $1C9,X
+       JSR     RFONR1  RIGHT FUNCTION ON RIGHT SIDE
+       RTS
+ADDR02 LDX     TTBLP0  FLAVOR 0
+       LEAX    -3,X    MOVE TABLE POINTER
+       CMPX    #TERTF0-3
+       BNE     ADDR05
+       LDX     #TERTF0+$1C5
+ADDR05 STX     TTBLP0
+       LDA     RTBYTE  CHECK RIGHT SIDE
+       BPL     ADDR06
+       DEC     ROFF    UP
+       LDA     ROFF
+       STA     ,X
+       STA     $1C8,X
+       LDD     #$0770
+       STD     1,X
+       STD     $1C9,X
+       JSR     RFONR1  RIGHT FUNCTION ON RIGHT SIDE
+       RTS
+ADDR06 LDA     ROFF    DOWN
+       STA     ,X
+       STA     $1C8,X
+       INCA
+       STA     ROFF
+       LDD     #$7007
+       STD     1,X
+       STD     $1C9,X
+       JSR     RFONR1  RIGHT FUNCTION ON RIGHT SIDE
+       RTS
+*********************************************************
+*
+* TERRAIN ALTITUDE TABLE GENERATOR
+*
+BGALT  LDX     #TDATA  SET DATA POINTER
+       STX     RTPTR
+       LDA     ,X      SET TERRAIN BYTE
+       STA     RTBYTE
+       LDA     #7      SET TERRAIN BIT COUNTER
+       STA     RTCNT
+       LDA     #$E0    SET BASE OFFSET
+       STA     ROFF
+       LDX     #ALTTBL SET ALTITUDE TABLE POINTER
+ALTT1  LDA     ROFF
+       STA     ,X+     STORE IN TABLE
+       LDA     RTBYTE  CHECK BYTE
+       BPL     ALTT2
+       DEC     ROFF    UP
+       BRA     ALTT3
+ALTT2  INC     ROFF    DOWN
+ALTT3  JSR     RFONR1  NEXT BIT
+       LDA     RTBYTE  CHECK BYTE
+       BPL     ALTT4
+       DEC     ROFF    UP
+       BRA     ALTT5
+ALTT4  INC     ROFF    DOWN
+ALTT5  JSR     RFONR1  NEXT BIT
+       CMPX    #ALTTBL+4*TLEN CHECK FOR DONE
+       BNE     ALTT1
+       RTS
+********************************************************
+*
+* TERRAIN ERASE
+*
+BGERAS LDX     #0      ZERO
+       LDY     #STBL   ERASE TABLE START
+ERAS1  STX     [Y++]   ERASE AT TABLE
+       CMPY    #STBL+$130 DONE?
+       BNE     ERAS1
+       RTS
+*
+* RIGHT TERRAIN FUNCTION ON LEFT SIDE
+*
+RFONL1 LDA     LTCNT
+       BEQ     RFONL2
+       DEC     LTCNT
+       LDA     LTBYTE
+       ASLA
+       ADCA    #0
+       STA     LTBYTE
+       RTS
+RFONL2 LDU     LTPTR
+       LEAU    1,U
+       CMPU    #TDATA+TLEN
+       BNE     RFONL3
+       LDU     #TDATA
+RFONL3 STU     LTPTR
+       LDA     #7
+       STA     LTCNT
+       LDA     ,U
+       STA     LTBYTE
+       RTS
+*
+* RIGHT TERRAIN FUNCTION ON RIGHT SIDE
+*
+RFONR1 LDA     RTCNT
+       BEQ     RFONR2
+       DEC     RTCNT
+       LDA     RTBYTE
+       ASLA
+       ADCA    #0
+       STA     RTBYTE
+       RTS
+RFONR2 LDU     RTPTR
+       LEAU    1,U
+       CMPU    #TDATA+TLEN
+       BNE     RFONR3
+       LDU     #TDATA
+RFONR3 STU     RTPTR
+       LDA     #7
+       STA     RTCNT
+       LDA     ,U
+       STA     RTBYTE
+       RTS
+*
+* LEFT TERRAIN FUNCTION ON LEFT SIDE
+*
+LFONL1 LDA     LTCNT
+       CMPA    #7
+       BEQ     LFONL3
+       INC     LTCNT
+       LDA     LTBYTE
+       LSRA
+       BCC     LFONL2
+       ADDA    #$80
+LFONL2 STA     LTBYTE
+       RTS
+LFONL3 LDU     LTPTR
+       CMPU    #TDATA
+       BNE     LFONL4
+       LDU     #TDATA+TLEN
+LFONL4 LEAU    -1,U
+       STU     LTPTR
+       CLR     LTCNT
+       LDA     ,U
+       LSRA
+       BCC     LFONL5
+       ADDA    #$80
+LFONL5 STA     LTBYTE
+       RTS
+*
+* LEFT TERRAIN FUNCTION ON RIGHT SIDE
+*
+LFONR1 LDA     RTCNT
+       CMPA    #7
+       BEQ     LFONR3
+       INC     RTCNT
+       LDA     RTBYTE
+       LSRA
+       BCC     LFONR2
+       ADDA    #$80
+LFONR2 STA     RTBYTE
+       RTS
+LFONR3 LDU     RTPTR
+       CMPU    #TDATA
+       BNE     LFONR4
+       LDU     #TDATA+TLEN
+LFONR4 LEAU    -1,U
+       STU     RTPTR
+       CLR     RTCNT
+       LDA     ,U
+       LSRA
+       BCC     LFONR5
+       ADDA    #$80
+LFONR5 STA     RTBYTE
+       RTS
+*
+* TERRAIN DATA TABLE
+*
+TDATA  FCB     $2A,$AA,$AA,$AA,$AA,$AA,$AB,$A1,$D5,$55,$55,$55,$55,$55,$AA,$BF
+       FCB     $FF,$FF,$FF,$C0,$00,$00,$00,$55,$55,$57,$FF,$C0,$01,$55,$55,$55
+       FCB     $55,$55,$55,$5F,$E0,$15,$55,$55,$57,$FF,$F0,$00,$15,$55,$5F,$FF
+       FCB     $FF,$FF,$FF,$00,$00,$00,$00,$05,$55,$7F,$FF,$E0,$00,$05,$55,$55
+       FCB     $55,$55,$FC,$05,$55,$55,$50,$01,$FF,$FF,$FF,$C0,$00,$0A,$AA,$AA
+       FCB     $AA,$FF,$00,$00,$FF,$FF,$FF,$FF,$F0,$00,$00,$1F,$E0,$00,$55,$55
+       FCB     $55,$40,$AA,$AA,$AA,$AA,$AA,$AA,$B5,$57,$AA,$AA,$AA,$F5,$7F,$D5
+       FCB     $55,$55,$57,$FF,$80,$07,$E0,$7F,$F1,$55,$7F,$FF,$FF,$00,$00,$00
+       FCB     $00,$00,$0F,$EF,$76,$91,$11,$11,$5E,$DB,$E9,$84,$77,$EC,$C4,$87
+       FCB     $47,$98,$08,$98,$3F,$C3,$CB,$DB,$9F,$C7,$5F,$2F,$C7,$7D,$EF,$BF
+       FCB     $FA,$4C,$57,$2B,$61,$EF,$EF,$FB,$F7,$E8,$00,$20,$40,$00,$14,$04
+       FCB     $04,$3C,$06,$00,$1D,$07,$3C,$E1,$A5,$55,$55,$45,$2A,$AA,$AA,$AA
+       FCB     $A8,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$56,$AA,$AA,$FE,$AA
+       FCB     $AA,$AA,$AA,$AA,$AA,$AA,$AA,$EA,$AA,$AA,$A8,$02,$AA,$AA,$AA,$AA
+       FCB     $BF,$BE,$3E,$63,$FF,$E0,$D8,$1C,$18,$2A,$AB,$1E,$77,$7A,$AF,$A8
+       FCB     $40,$70,$7D,$40,$0B,$FB,$FA,$FF,$C1,$53,$54,$75,$70,$03,$00,$00
+********************************************************
+*
+* MINI TERRAIN
+*
+MTERR  FCB     $25,$70,$07,$26,$77,$00,$26,$07,$70,$24,$07,$70
+       FCB     $23,$07,$70,$23,$70,$07,$24,$07,$70,$25,$70,$07
+       FCB     $26,$77,$00,$25,$07,$70,$24,$07,$70,$23,$07,$70
+       FCB     $21,$07,$70,$22,$70,$07,$24,$77,$00,$24,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$25,$77,$00,$25,$70,$07
+       FCB     $26,$77,$00,$24,$07,$70,$23,$70,$07,$25,$77,$00
+       FCB     $26,$70,$07,$26,$77,$00,$26,$77,$00,$25,$07,$70
+       FCB     $23,$07,$70,$22,$07,$70,$21,$77,$00,$21,$70,$07
+       FCB     $23,$70,$07,$25,$70,$07,$25,$07,$70,$25,$77,$00
+       FCB     $25,$77,$00,$24,$77,$00,$22,$07,$70,$20,$07,$70
+       FCB     $1E,$07,$70,$1C,$07,$70,$1D,$70,$07,$1F,$70,$07
+       FCB     $21,$70,$07,$22,$70,$07,$24,$70,$07,$26,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$26,$77,$00,$26,$77,$00
+       FCB     $26,$77,$00,$25,$77,$00,$25,$70,$07,$26,$77,$00
+       FCB     $24,$07,$70,$23,$77,$00,$24,$77,$00,$22,$07,$70
+       FCB     $23,$70,$07,$22,$07,$70,$21,$70,$07,$23,$70,$07
+       FCB     $25,$70,$07,$26,$77,$00,$26,$07,$70,$24,$07,$70
+       FCB     $23,$07,$70,$23,$70,$07,$24,$07,$70,$25,$70,$07
+       FCB     $26,$77,$00,$25,$07,$70,$24,$07,$70,$23,$07,$70
+       FCB     $21,$07,$70,$22,$70,$07,$24,$77,$00,$24,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$25,$77,$00,$25,$70,$07
+       FCB     $26,$77,$00,$24,$07,$70,$23,$70,$07,$25,$77,$00
+       FCB     $26,$70,$07,$26,$77,$00,$26,$77,$00,$25,$07,$70
+       FCB     $23,$07,$70,$22,$07,$70,$21,$77,$00,$21,$70,$07
+       FCB     $23,$70,$07,$25,$70,$07,$25,$07,$70,$25,$77,$00
+       FCB     $25,$77,$00,$24,$77,$00,$22,$07,$70,$20,$07,$70
+       FCB     $1E,$07,$70,$1C,$07,$70,$1D,$70,$07,$1F,$70,$07
+       FCB     $21,$70,$07,$22,$70,$07,$24,$70,$07,$26,$70,$07
+       FCB     $26,$77,$00,$26,$77,$00,$26,$77,$00,$26,$77,$00
+       FCB     $26,$77,$00,$25,$77,$00,$25,$70,$07,$26,$77,$00
+       FCB     $24,$07,$70,$23,$77,$00,$24,$77,$00,$22,$07,$70
+       FCB     $23,$70,$07,$22,$07,$70,$21,$70,$07,$23,$70,$07
+**********************************************************
+*
+* PLAYER EXPLOSION X = PLAYER CENTER
+*
+PLEX   PULS    D
+       STD     PD2,U   SAVE RETURN ADDR
+       STX     PCENT   SAVE PLAY CENTER
+       LDD     #$0808
+       STD     PSED    INITIALIZE SEED
+       LDD     #$1732
+       STD     PSED2   INITIALIZE SEED2
+* INITIALIZE PIECES
+       LDY     #TABLE
+PINIT1 LDA     PCENT   X POSITION
+       CLRB
+       STD     PXPOST,Y
+       LDA     PCENT+1 Y POSITION
+       STD     PYPOST,Y
+PINIT2 LDA     LPSED   RANDOM NUMBER
+       LSRA
+       EORA    LPSED
+       LSRA
+       LSRA
+       ROR     PSED
+       ROR     LPSED
+       LDA     PSED
+       ANDA    #1      TOP X VELOCITY
+       SUBA    #1      FOR FOUR QUADRANTS
+       LDB     LPSED
+       STD     PXVELT,Y
+       BPL     PINIT3  FIND ABSOLUTE X VELOCITY
+       COMA
+       COMB
+PINIT3 PSHS    D       SAVE ABSOLUTE VELOCITY
+       LDA     LPSED2  RANDOM NUMBER 2
+       LSRA
+       EORA    LPSED2
+       LSRA
+       LSRA
+       ROR     PSED2
+       ROR     LPSED2
+       LDA     PSED2
+       ANDA    #3      TOP Y VELOCITY
+       SUBA    #2      FOR FOUR QUADRANTS
+       LDB     LPSED2
+       STD     PYVELT,Y
+       BPL     PINIT4  FIND ABSOLUTE Y VELOCITY
+       COMA
+       COMB
+PINIT4 LSRA            DIVIDE BY 2
+       RORB
+       ADDD    ,S++    ADD TO ABSOLUTE X VELOCITY
+       CMPD    #$016A  CHECK FOR CORNERS
+       BHS     PINIT1  IF CORNER GET ANOTHER RANDOM NUMBER
+       LDX     #0
+       STX     ,Y      ZERO SCREEN ADDRESS
+       LEAY    10,Y    NEXT POINT
+       CMPY    #TABLE+10*PNBITS
+       BNE     PINIT1
+* PLAYER EXPLOSION
+       LDX     #PXCOL  INITIALIZE COLOR POINTER
+       STX     PCOLP
+       LDA     #56     INITIALIZE COLOR COUNTER
+       STA     PCOLC
+PX1    LDA     #1      SLEEEP!!!!!!
+       LDX     #PX1A
+       JMP     SLEEPP
+PX1A   LDX     #0      ALWAYS ZERO
+       LDY     #TABLE  INITIALIZE TABLE POINTER
+       LDA     [PCOLP] GET COLOR
+       STA     PCRAM+$B SET IN PSEUDO COLOR RAM
+       BEQ     PX8     ZERO COLOR, QUIT
+PX2    LDU     ,Y      ERASE OLD PIECE
+       STX     ,U
+       STX     $100,U
+       LDD     PYVELT,Y GET Y VELOCITY
+       ADDD    PYPOST,Y ADD Y POSITION
+       CMPA    #$2A    CHECK IF OFF SCREEN
+       BLO     PX7     OFF SCREEN, NEXT PIECE
+       STD     PYPOST,Y SAVE NEW Y POSITION
+       STA     1,Y     UPDATE Y SCREEN ADDRESS
+       LDD     PXVELT,Y GET X VELOCITY
+       ADDD    PXPOST,Y ADD X POSITION
+       CMPA    #$98    CHECK IF OFF SCREEN
+       BHI     PX7     OFF SCREEN, NEXT PIECE
+       STD     PXPOST,Y SAVE NEW X POSITION
+       STA     ,Y      UPDATE X SCREEN ADDRESS
+       TSTB            CHECK LEFT OR RIGHT FLAVOR
+       BMI     PX6
+       LDD     #$BBBB  LEFT FLAVOR
+       STD     [Y]
+       BRA     PX7
+PX6    LDU     ,Y
+       LDD     #$0B0B  RIGHT FLAVOR
+       STD     ,U
+       LDD     #$B0B0
+       STD     $100,U
+PX7    LEAY    10,Y    NEXT PIECE
+       CMPY    #TABLE+10*PNBITS CHECK FOR LAST PIECE
+       BNE     PX2     NO, LOOP
+       DEC     PCOLC   NEXT COLOR COUNT
+       BNE     PX1     NEXT PIECE
+       LDU     PCOLP   NEXT COLOR
+       LEAU    1,U
+       STU     PCOLP
+       LDA     #4      RE-INITIALIZE COLOR COUNTER
+       STA     PCOLC
+       BRA     PX1     CONTINUE
+PX8    JMP     [PD2,U] RETURN
+* PLAYER EXPLOSION COLOR TABLE
+PXCOL  FCB     $FF,$7F,$3F,$37,$2F,$27,$1F,$17,7,6,5,4,3,2,0
+*
+*WAVE DATA
+*MAX,MIN,INTRADELT,INTERDELT
+*W1,W2,W3,W4
+WVTAB  FCB     20,0,0,0
+       FCB     15,20,20,20 LANDERS
+       FCB     3,0,0,0
+       FCB     0,3,4,5 TIES
+       FCB     6,0,0,0
+       FCB     0,1,3,4 PROBES
+       FCB     10,0,0,0
+       FCB     0,0,0,0 SCHITZOS
+       FCB     10,0,0,0
+       FCB     0,0,0,0 SWARMERS
+       FCB     30,0,0,0
+       FCB     30,25,20,16 WAVE TIME
+       FCB     5,0,0,0
+       FCB     5,5,5,5 WAVE SIZE
+       FCB     $60,0,3,2
+       FCB     $16,$1E,$26,$2E LANDER XV
+       FCB     $01,0,0,0
+       FCB     $00,$00,$01,$01 LANDER YV MSB
+       FCB     $FF,0,$10,$00
+       FCB     $70,$B0,$00,$00 LSB
+       FCB     $80,$10,$FC,$FE
+       FCB     $4A,$3A,$2A,$2A LDSTIM
+       FCB     $30,0,0,0
+       FCB     $20,$28,$2C,$30 TIE XV
+       FCB     2,0,0,0
+       FCB     1,1,2,2 SZRY
+       FCB     1,0,0,0
+       FCB     $00,$00,$01,$01 SZYV MSB
+       FCB     $FF,$0,$08,$06
+       FCB     $62,$E0,$02,$12 " LSB
+       FCB     $60,$0,$8,$4
+       FCB     $0C,$1C,$24,$28 SZXV
+       FCB     $FF,$08,$FE,$FE
+       FCB     $2A,$22,$1E,$1C SZSTIM
+       FCB     $60,$0,$08,$02
+       FCB     $16,$1E,$20,$22 SWXV
+       FCB     40,10,-2,-1
+       FCB     25,25,25,25 SWSTIM
+       FCB     $3F,0,0,0
+       FCB     $1F,$1F,$1F,$3F SWAC
+       FCB     $C0,$18,$F4,$FC
+       FCB     $D4,$C4,$A4,$94 UFOTIM
+       FCB     10,3,$FF,$FF
+       FCB     15,13,12,10 UFSTIM
+       FCB     200,40,$F4,$F8
+       FCB     240,220,200,200 UFOSK
+WVTEND EQU     *
+       END
diff --git a/src/BRUTSUM2.SRC b/src/BRUTSUM2.SRC
new file mode 100755 (executable)
index 0000000..c6d926e
--- /dev/null
@@ -0,0 +1,19 @@
+       ORG     $8000
+BASE   RMB     2       STORE BASE ADDRESS OF 2K ROM
+LOCA   RMB     2       STORE CHECKSUM DESTINATION
+ROMN   RMB     1       STORE ROM NUMBER
+CSUM   CLR     [LOCA]  CHECKSUM PROGRAM START ADDRESS
+CSUMA  LDX     BASE            
+       LDY     #$800
+       LDA     ROMN
+       CLRB
+CSUM1  ADCA    ,X+
+       LEAY    -1,Y
+       BNE     CSUM1
+       CMPA    #$80
+       BEQ     CSUM2
+       INC     [LOCA]
+       BNE     CSUMA
+       BRA     *
+CSUM2  JMP     [$FF16]
+       END
diff --git a/src/DEFA7.SRC b/src/DEFA7.SRC
new file mode 100755 (executable)
index 0000000..036aaf2
--- /dev/null
@@ -0,0 +1,3375 @@
+*
+* PRAYAH 1:     P L O G L A M    S T A H T
+*
+       ORG     $D000
+       FCB     $4A     CKBYT CHECKSUM(ACTUAL)
+       SETDP   RAM!>8
+*
+*SLEEP
+*A=SLEEP TIME X 16MSEC
+*X=WAKEUP ADDR
+*
+SLEEP  LDU     CRPROC
+       STA     PTIME,U
+       STX     PADDR,U
+       JMP     DISP2
+*
+*SUICIDE
+*
+SUCIDE LDX     CRPROC
+       BSR     KILL
+       LEAU    ,X
+       JMP     DISP2   GET NEW CRPROC
+*
+*KILL OBJECT PROCESS
+*
+KILLOP LDX     OBJID,X
+*
+*KILL
+*X=PROCESS TO KILL
+*
+KILL   PSHS    D,U
+       LDU     #ACTIVE
+KILP1  CMPX    ,U
+       BNE     KILPLP  NO MATCH
+       LDD     ,X      GET FORWARD LINK OF DEAD GUY
+       STD     ,U
+       LDA     PCOD,X
+       BEQ     KILP2   REG PROCESS
+       LDD     SPFREE  SUPER PROCESS
+       STX     SPFREE
+       BRA     KILP3
+KILP2  LDD     FREE
+       STX     FREE    PUT HIM AT HEAD OF FREE
+KILP3  STD     ,X
+       LEAX    ,U      SAVE CRPROC FOR SUICIDE
+       PULS    D,U,PC
+KILPLP LDU     ,U
+       BNE     KILP1
+ERROR  NOP             ERROR TRAP
+       JMP     SINIT
+*
+*MAKE A SUPER PROCESS
+*X = START ADDR
+*A = USER TYPE
+*X =RETURNED WITH DATA BLOCK POINTER
+MSPROC PSHS    A,Y,U
+       LDU     SPFREE
+       BNE     *+3
+       JSR     ERROR   ERROR TRAP
+       LDY     ,U
+       STY     SPFREE
+       LDA     #1
+       STA     PCOD,U
+       LDA     ,S      GET TYPE
+       BRA     MKP1
+*
+*MAKE A PROCESS
+*X=START ADDR
+*A=USER TYPE
+*X RETURNED WITH DATA BLOCK PTR
+*
+MKPROC PSHS    A,Y,U
+       LDU     FREE
+       BNE     MKP0    NOT OUT
+       JSR     ERROR
+MKP0   LDY     ,U
+       STY     FREE    DELINK
+       CLR     PCOD,U
+MKP1   STX     PADDR,U
+       STA     PTYPE,U
+       LDA     #1
+       STA     PTIME,U INIT TIME
+       LDX     [CRPROC]
+       STU     [CRPROC]
+       STX     ,U      LINK IN
+       LEAX    ,U      SETUP X AS DATA BLOCK
+       PULS    A,Y,U,PC
+*
+*GENOCIDE : KILL EVERYONE EXCEPT FOR YOURSELF
+*
+GNCIDE PSHS    A,X
+       LDX     #ACTIVE
+GNC1   LDX     ,X
+       BEQ     GNCX
+       CMPX    CRPROC
+       BEQ     GNC1    DO NOT KILL SELF
+       LDA     PTYPE,X DONT KILL COINS
+       CMPA    #CTYPE
+       BEQ     GNC1
+       BSR     KILL
+       BRA     GNC1
+GNCX   PULS    A,X,PC
+*
+*INIT OBJECT
+*BSR GETOB
+*[RET]>OPICT
+*[RET+]>OCVECT
+*[RET+2]>OBJCOL
+*U>OBJID
+*RET<RET+6
+*
+OBINIT BSR     GETOB
+       PSHS    U,D,Y
+       STU     OBJID,X
+       LDU     6,S
+       PULU    D,Y
+       STD     OPICT,X
+       STY     OCVECT,X
+       PULU    D
+       STD     OBJCOL,X
+       STU     6,S
+       PULS    U,D,Y,PC
+*
+*GET OBJECT LIST CELL IN X
+*OBJX=0
+*CALLER MUST >STX OPTR< AFTER INITIALIZATION OF PARAMETERS
+GETOB  PSHS    U,D
+       LDX     OFREE
+       BNE     GETOB1  NOT OUT
+       JSR     ERROR
+GETOB1 LDD     OLINK,X
+       STD     OFREE
+       LDD     OPTR
+       STD     OLINK,X
+       CLRD
+       STD     OBJX,X
+       STA     OTYP,X  CLEAR TYPE
+       PULS    U,D,PC
+*
+*KILL OBJECT CELL IN X
+*
+KILLOB PSHS    X,Y,U
+       LDU     #OPTR
+KILO1  CMPX    ,U      MATCH?
+       BNE     KILOLP
+KILO2  LDY     [,U]    UNLINK
+       STY     ,U
+       LDY     OFREE
+       STX     OFREE
+       STY     ,X
+       PULS    X,Y,U,PC
+KILOLP LDU     ,U
+       BNE     KILO1   CONTINUE
+       LDU     #IPTR   SEARCH INACTIVE LIST
+KILO3  CMPX    ,U
+       BEQ     KILO2
+       LDU     ,U
+       BNE     KILO3
+       JSR     ERROR
+*
+*KILL A SHELL
+*X=SHELL
+*
+KILSHL PSHS    X,Y,U
+       LDU     #SPTR
+       BRA     KILO3
+*
+*OUTPUT 2X8
+*
+ON28   PSHS    X,DP
+       STS     TEMP48
+       BCC     ON280
+       LEAY    2,Y
+ON280  LDS     OBJP0,Y
+       ADDB    #8
+       TFR     D,U
+       BRA     ON281
+*
+*OFF2X8
+*
+OFF28  PSHS    X,DP
+       ADDB    #8
+       TFR     D,U
+       LDD     #0
+       LDX     #0
+       LEAY    ,X
+       TFR     A,DP
+       ANDCC   #0
+       BRA     OFF281
+*
+*OFF 5X8
+*
+OFF58  PSHS    X,DP
+       ADDB    #8
+       TFR     D,U
+       LDD     #0
+       LDX     #0
+       LEAY    ,X
+       TFR     A,DP
+       ANDCC   #0
+       PSHU    X,Y,D,DP,CC
+       LEAU    264,U
+       BRA     OFF481
+*
+*OUTPUT 4X8
+*STORED COL1-COLN
+*CALLED BY IRQ ONLY
+ON48   PSHS    X,DP
+       STS     TEMP48  SAVE STACK
+       BCC     ON480
+       LEAY    2,Y     ODD PHASE
+ON480  LDS     OBJP0,Y
+       ADDB    #8
+       TFR     D,U
+ON481  PULS    D,X,Y,DP,CC
+       PSHU    D,X,Y,DP,CC
+       LEAU    264,U
+       PULS    D,X,Y,DP,CC
+       PSHU    D,X,Y,DP,CC
+       LEAU    264,U
+ON281  PULS    D,X,Y,DP,CC
+       PSHU    D,X,Y,DP,CC
+       LEAU    264,U
+       PULS    D,X,Y,DP,CC
+       PSHU    D,X,Y,DP,CC
+       LDS     >TEMP48 STACK RESTORE, EXTENDED
+       PULS    X,DP,PC
+*
+*ERASE 4X8
+*COLUMNAR OBJECTS 8 LONG
+*
+*OFF 4X8
+*
+OFF48  PSHS    X,DP
+       ADDB    #8
+       TFR     D,U
+       LDD     #0
+       LDX     #0
+       LEAY    ,X
+       TFR     A,DP
+       ANDCC   #0
+OFF481 PSHU    X,Y,D,DP,CC
+       LEAU    264,U
+       PSHU    X,Y,D,DP,CC
+       LEAU    264,U
+OFF281 PSHU    X,Y,D,DP,CC
+       LEAU    264,U
+       PSHU    X,Y,D,DP,CC
+       PULS    X,DP,PC
+*
+*ON 5X8
+*
+ON58   PSHS    X,DP
+       STS     TEMP48
+       BCC     ON580
+       LEAY    2,Y
+ON580  LDS     OBJP0,Y
+       ADDB    #8
+       TFR     D,U
+       PULS    D,X,Y,DP,CC
+       PSHU    D,X,Y,DP,CC
+       LEAU    264,U
+       BRA     ON481
+*
+*ON 3X4 OBJECT
+*
+ON34   BCC     ON340
+       LEAY    2,Y     ODD GUY
+ON340  LDY     OBJP0,Y
+       TFR     D,U
+ON341  LDD     ,Y
+       STD     ,U
+       LDD     2,Y
+       STD     2,U
+       LDD     4,Y
+       STD     $100,U
+       LDD     6,Y
+       STD     $102,U
+       LDD     8,Y
+       STD     $200,U
+       LDD     10,Y
+       STD     $202,U
+       RTS
+*
+*OFF 3X4 OBJECT
+*
+OFF34  TFR     D,U
+       LDD     #0
+OFF341 STD     ,U
+       STD     2,U
+       STD     $100,U
+       STD     $102,U
+       STD     $200,U
+       STD     $202,U
+       RTS
+*
+*ON 2X3 OBJECT
+*
+ON23   BCC     ON230
+       LEAY    2,Y
+ON230  LDY     OBJP0,Y
+       TFR     D,U
+       LDD     ,Y
+       STD     ,U
+       LDD     2,Y
+       STA     2,U
+       STB     $100,U
+       LDD     4,Y
+       STD     $101,U
+       RTS
+*
+*OFF 2X3 OBJECT
+*
+OFF23  TFR     D,U
+       LDD     #0
+       STD     ,U
+       STA     2,U
+       STD     $100,U
+       STA     $102,U
+       RTS
+*
+*OUTPUT 6X4
+*IRQ CALLS ONLY
+*
+ON64   PSHS    X,U,D
+       STS     TEMP48
+       BCC     ON640
+       LEAY    2,Y
+ON640  LDS     OBJP0,Y
+       ADDB    #4
+       TFR     D,U
+ON641  PULS    X,D
+       PSHU    X,D
+       LEAU    260,U
+       PULS    X,D
+       PSHU    X,D
+       LEAU    260,U
+       PULS    X,D
+       PSHU    X,D
+       LEAU    260,U
+       PULS    X,D
+       PSHU    X,D
+       LEAU    260,U
+       PULS    X,D
+       PSHU    X,D
+       LEAU    260,U
+       PULS    X,D
+       PSHU    X,D
+       LDS     TEMP48
+       PULS    X,U,D,PC
+*
+*OFF 6X4
+*
+OFF64  PSHS    X,U,D
+       ADDB    #4
+       TFR     D,U
+       LDD     #0
+OFF641 LDX     #0
+       PSHU    X,D
+       LEAU    260,U
+       PSHU    X,D
+       LEAU    260,U
+       PSHU    X,D
+       LEAU    260,U
+       PSHU    X,D
+       LEAU    260,U
+       PSHU    X,D
+       LEAU    260,U
+       PSHU    X,D
+       PULS    X,U,D,PC
+*
+*OUTPUT 8X6
+*
+ON86   PSHS    X
+       STS     TEMP48
+       BCC     ON860
+       LEAY    2,Y
+ON860  LDS     OBJP0,Y
+       ADDB    #6
+       TFR     D,U
+       PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+       PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+ON661  PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+ON561  PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+       PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+       PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+       PULS    X,D,Y
+       PSHU    X,D,Y
+       LEAU    262,U
+       PULS    X,D,Y
+       PSHU    X,D,Y
+       LDS     TEMP48
+       PULS    X,PC
+*
+*OFF 8X6
+*
+OFF86  PSHS    X
+       ADDB    #6
+       TFR     D,U
+       LDD     #0
+       LDX     #0
+       LEAY    ,X
+       PSHU    X,D,Y
+       LEAU    262,U
+       PSHU    X,D,Y
+       LEAU    262,U
+OFF661 PSHU    X,D,Y
+       LEAU    262,U
+OFF561 PSHU    X,D,Y
+       LEAU    262,U
+       PSHU    X,D,Y
+       LEAU    262,U
+       PSHU    X,D,Y
+       LEAU    262,U
+       PSHU    X,D,Y
+       LEAU    262,U
+       PSHU    X,D,Y
+       PULS    X,PC
+*
+*OUTPUT 5X6
+*
+ON56   PSHS    X
+       STS     TEMP48
+       BCC     ON560
+       LEAY    2,Y
+ON560  LDS     OBJP0,Y
+       ADDB    #6
+       TFR     D,U
+       BRA     ON561
+*
+*OFF 5X6
+*
+OFF56  PSHS    X
+       ADDB    #6
+       TFR     D,U
+       LDD     #0
+       LDX     #0
+       LEAY    ,X
+       BRA     OFF561
+*
+*OUTPUT 6X6
+*
+ON66   PSHS    X
+       STS     TEMP48
+       BCC     ON660
+       LEAY    2,Y
+ON660  LDS     OBJP0,Y
+       ADDB    #6
+       TFR     D,U
+       JMP     ON661
+*
+*OFF 6X6
+*
+OFF66  PSHS    X
+       ADDB    #6
+       TFR     D,U
+       LDD     #0
+       LDX     #0
+       LEAY    ,X
+       BRA     OFF661
+*
+*SCORE ROUTINE
+*A=0-7EXP,B=0-99
+*
+SCORE  PSHS    A,B,X,U,Y
+       ORCC    #1      SET CARRY
+       ROL     SCRFLG  SET FLAG
+       LSRA
+       PSHS    A
+       LDA     #0
+       BCC     SCR1
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+SCR1   JSR     PLINDX
+       STD     XTEMP
+       LDB     #3
+       SUBB    ,S+
+       LDA     B,X
+       ADDA    XTEMP+1
+       DAA
+       STA     B,X
+       DECB
+       BMI     SCRX
+SCR2   LDA     B,X
+       ADCA    XTEMP
+       DAA
+       STA     B,X
+       LDA     #0
+       STA     XTEMP
+       DECB
+       BPL     SCR2
+*CHECK REPLAY
+SCRX   LDD     REPLA   REPLAYS AVAILABLE
+       BEQ     SCRXX   NO
+       LEAX    1,X
+       LEAY    3,X
+       BSR     RCHK
+       BLO     SCRXX   NO
+       LDA     1,Y     GET NEXT LEVEL
+       ADDA    REPLA+1
+       DAA
+       STA     1,Y
+       LDA     ,Y
+       ADCA    REPLA
+       DAA
+       STA     ,Y
+       INC     PLAS-1,X
+       INC     PSBC-1,X
+       JSR     LDISP   REWARD
+       JSR     SBDISP
+       LDD     #RPSND
+       JSR     SNDLD
+       LDB     #5
+       JSR     AUDIT
+SCRXX  BSR     SCRTRN
+       PULS    A,B,X,U,Y
+       RTS
+*
+*REPLAY CHECK
+*X=PLAYER SCORE MSB 6 DIGITS
+*Y=REPLAY LEVEL MSB 6 DIGITS
+*RETURNS CC FOR PSCOR-RLEVL
+RCHK   PSHS    D
+       LDD     ,X
+       CMPD    ,Y
+       BNE     RCHX
+       LDA     2,X
+       CMPA    2,Y
+RCHX   PULS    D,PC
+*
+*SCORE TRANSFER
+*
+SCRTRN LDA     CURPLR
+SCRTR0 PSHS    A
+       DECA
+       BNE     SCT1
+       LDX     #P1DISP
+       LDU     #.P1SCR+1
+       BRA     SCT2
+SCT1   LDX     #P2DISP
+       LDU     #.P2SCR+1
+SCT2   CLR     XTEMP   BLANKING FLAG
+       LDB     #6
+       LDA     MAPCR
+       PSHS    A
+       LDA     #2
+       STA     MAPCR
+       STA     MAPC
+SCTLP  LDA     ,U+     GET
+       LDY     N0V     GET CHAR ADDR
+       BITB    #1      PHASE
+       BNE     SCT3
+       LEAU    -1,U
+       LSRA
+       LSRA
+       LSRA
+       LSRA
+SCT3   ANDA    #$F
+       BNE     SCT3A
+       CMPB    #2      LAST 2
+       BLS     SCT3A
+       TST     XTEMP   BLANKING?
+       BNE     SCT3A
+       EXG     X,D
+       JSR     COFF
+       BRA     SCT40
+SCT3A  INC     XTEMP
+       ASLA
+       ASLA
+       LEAY    A,Y
+       EXG     X,D
+       JSR     CWRIT   ON DIGIT PICTURE
+SCT40  EXG     X,D
+SCT4   LEAX    DIGLTH,X
+       DECB
+       BNE     SCTLP   DO THE REST
+       PULS    A
+       STA     MAPCR
+       STA     MAPC
+       PULS    A,PC
+*
+*HI SCORE RESET SWITCH
+*
+HSRES  LDA     STATUS
+       BPL     SLAMX
+       JSR     MAPCH3
+       JSR     RHSTD$  RESET TODAYS HIGH SCORES
+       INC     HSRFLG  SET HIGH SCORE RESET FLAG
+       BRA     SLAMX
+*
+*ADVANCE SWITCH
+*
+ADVSW  LDA     STATUS
+       BPL     SLAMX
+       ORCC    #$90    SETUP FLAGS,+KILL INTS
+       CLR     MAPC
+       LDA     #4
+       STA     PIA1+1
+       LDA     PIA1
+       JSR     MAPCH3
+       LDA     PIA01   AUTO OR MAN?
+       LSRA
+       BCS     ADVSW1
+       JMP     VCROM0  MAN-DIAGNOSTICS
+ADVSW1 JMP     VUDITG  AUTO-AUDITS
+SLAMX  JMP     SUCIDE
+*
+*COIN SWITCHES
+*LEFT
+LCOIN  LDX     #LCCNT
+       LDB     #LCOINV!.$FF
+       BRA     COIN
+*RIGHT
+RCOIN  LDX     #RCCNT
+       LDB     #RCOINV!.$FF
+       BRA     COIN
+*CENTER
+CCOIN  LDX     #CCCNT
+       LDB     #CCOINV!.$FF
+*
+*COIN ROUTINE
+*X=DEBOUNCE COUNTER
+*B=ROUTINE
+COIN   LDA     SLMCNT
+       BNE     SLAMX
+       LDA     ,X
+       BNE     SLAMX
+       LDA     #$16    DEBOUNCE TIME
+       STA     ,X
+       LDA     #LCOINV!>8 ROUTINE ADDR
+       STD     PD2,U
+       NAP     10,CN1
+CN1    LDA     SLMCNT
+       BNE     SLAMX   SLAM, DITCH
+       LDD     #CNSND
+       JSR     SNDLD
+       JSR     MAPCH3
+       JSR     [PD2,U]
+       BRA     SLAMX
+*
+*SOUND TABLE
+*SNDPRI,N*(REPCNT,SNDTMR,SND#) N>=1
+*SNDTMR IN 16 MSEC
+*SNDPRI : HI=HI,INTERRUPTABLE BY EQUALS
+*END: REPCNT=0
+*
+CNSND  FCB     $FF,$01,$18,$19,0 COIN SOUND
+RPSND  FCB     $FF,$01,$20,$1E,0 FREE SHIP
+PDSND  FCB     $F0,$02,$08,$11,$01,$20,$17,0 PLAYER DEATH
+ST1SND FCB     $F0,$01,$40,$0A,0 START 1
+ST2SND FCB     $F0,$01,$10,$0B,0 START2
+TBSND  FCB     $E8,$01,$04,$14,$02,$06,$11
+       FCB     $02,$0A,$17,0 TERRAIN BLOW
+SBSND  FCB     $E8,$06,$04,$11,$01,$10,$17,00 SMART BOMB
+ACSND  FCB     $E0,$03,$0A,$08,0 ASTRO CATCH
+ALSND  FCB     $E0,$01,$18,$1F,0 ASTRO LAND
+AHSND  FCB     $E0,$01,$18,$11,0 ASTRO HIT
+ASCSND FCB     $D8,$01,$10,$1A,0 ASTRO SCREAM
+APSND  FCB     $D0,$01,$30,$15,0 APPEAR SOUND
+PRHSND FCB     $D0,$01,$10,$05,0 PROBE HIT
+SCHSND FCB     $D0,$01,$08,$17,0 SCHITZ HIT
+UFHSND FCB     $D0,$01,$08,$07,0 UFO HIT
+TIHSND FCB     $D0,$01,$0A,$01,0 TIE HIT
+LHSND  FCB     $D0,$01,$0A,$06,0 LANDER HIT
+LPKSND FCB     $D0,$01,$10,$0B,0 LANDER PICK UP
+LSKSND FCB     $C8,$0A,$01,$0E,0 LANDER SUCK
+SWHSND FCB     $C0,$01,$08,$07,0 SWARM HIT
+LASSND FCB     $C0,$01,$30,$14,0 LASER
+LGSND  FCB     $C0,$01,$20,$18,0 LANDER GRAB
+LSHSND FCB     $C0,$01,$08,$03,0 LANDER SHOOT
+SSHSND FCB     $C0,$01,$30,$09,0 SCHITZO SHOOT
+USHSND FCB     $C0,$01,$08,$03,0 UFO SHOOT
+SWSSND FCB     $C0,$01,$18,$0C,0 SWARM SHOOT
+*
+*SOUND OUTPUT
+*B=SND TO MAKE
+*
+SNDOUT PSHS    A,B,CC
+       ORCC    #$FF
+       CLR     MAPC
+       LDA     #$3F
+       STA     SOUND
+       COMB
+       ANDB    #$3F    DONT TURN ON LEDS
+       STB     SOUND
+       PULS    A,B,CC,PC
+*
+*SOUND LOADER
+*D=ADDR OF SOUND
+*
+SNDLD  PSHS    X,D,CC
+       CLR     THFLG   RESET THRUST
+       TFR     D,X
+       LDA     ,X
+       CMPA    SNDPRI
+       BLO     SNDLDX  PRIORITY NOT HI ENOUGH
+       STA     SNDPRI
+       LEAX    -2,X
+       ORCC    #$10    SEI
+       STX     SNDX
+       LDD     #$0101
+       STD     SNDTMR  INIT TIMER,REPCNT
+SNDLDX PULS    X,D,CC,PC
+*
+*SOUND SEQUENCER
+*
+SNDSEQ LDA     SNDTMR
+       BEQ     SNDS00
+       DEC     SNDTMR
+       BNE     SNDSX
+       LDX     SNDX
+       DEC     SNDREP
+       BNE     SNDS1
+       LEAX    3,X     GET NEXT
+       STX     SNDX
+       LDA     ,X
+       BNE     SNDS0   SOUND OVER?
+       STA     SNDPRI  YIP
+SNDS00 LDA     PIA21   THRUST ON?
+       BITA    #2
+       BNE     SNDS01  YES
+       LDA     THFLG   NO,ACTIVE?
+       BEQ     SNDSX   NO
+       CLR     THFLG   YES,TURN IT OFF
+       LDB     #$0F
+       BRA     SNDSX1
+SNDS01 LDA     THFLG   THRUST ALREADY ON?
+       BNE     SNDSX   YIP...
+       LDA     STATUS
+       BITA    #$98    PLAYER ALIVE?
+       BNE     SNDSX   NO
+       LDB     #$16    NO HIT IT
+       STB     THFLG
+       BRA     SNDSX1
+SNDS0  STA     SNDREP
+SNDS1  LDD     1,X
+       STA     SNDTMR
+SNDSX1 BSR     SNDOUT
+SNDSX  EQU     *
+*
+*SWITCH SCAN
+*TRIGGER=LAST 2 ZERO, NOW 1 GAME SWITCH
+*TRIGGER=LAST 1 ZERO, NOW 2 1'S COINS
+SSCAN  LDA     PIA0+1
+       BITA    #$40
+       BEQ     SSC00
+       LDA     #60
+       STA     SLMCNT
+*COIN + SLAM DEBOUNCERS
+SSC00  LDA     SLMCNT
+       BEQ     SSC0A
+       DEC     SLMCNT
+SSC0A  LDA     LCCNT
+       BEQ     SSC0B
+       DEC     LCCNT
+SSC0B  LDA     CCCNT
+       BEQ     SSC0C
+       DEC     CCCNT
+SSC0C  LDA     RCCNT
+       BEQ     SSC0
+       DEC     RCCNT
+SSC0   LDA     PIA21
+       ORA     PIA22
+       COMA
+       LDB     PIA21
+       STB     PIA22
+       LDB     PIA2
+       STB     PIA21
+       LDB     PIA3
+       STB     PIA31
+       ANDA    PIA21
+       BEQ     CSCAN
+       LDU     #SWTAB-4
+SWITCH CLRB
+SW0    ADDB    #4
+       LSRA
+       BCC     SW0
+       LEAU    B,U
+       PULU    D,X
+       LDU     SWPROC
+       BNE     SWTCH2
+       STD     SWPROC
+       STX     SWPROC+2
+       RTS
+SWTCH2 STD     SWPROC+4
+       STX     SWPROC+6
+SWTCHX RTS
+*
+*SCAN COIN SWITCHES
+*
+CSCAN  LDA     PIA01
+       ORA     PIA02
+       COMA
+       LDB     PIA01
+       STB     PIA02
+       LDB     PIA0
+       ANDB    #$3F
+       STB     PIA01
+       BITA    PIA01
+       BEQ     CSCX    NO HIT
+       LDX     #120
+CSC1   LEAX    -1,X    1 MSEC DELAY
+       BNE     CSC1
+       LDB     PIA0    DOUBLE CHECK
+       ANDB    PIA01
+       STB     PIA01
+       ANDA    PIA01
+       BEQ     CSCX    NOBODY THERE
+       LDU     #SWTAB1-4 HANDLE IT
+       BSR     SWITCH
+CSCX   RTS
+*
+*DISPLAY LASERS
+*
+LDISP  PSHS    D,X,Y,U PLAYER 1
+       LDX     #P1LAS
+       LDA     .P1LAS
+       BSR     LDSP
+       LDA     PLRCNT
+       DECA
+       BEQ     LDPX
+       LDX     #P2LAS
+       LDA     .P2LAS
+       BSR     LDSP
+LDPX   PULS    D,X,Y,U,PC
+LDSP   CMPA    #5      MAX DISPLAY
+       BLS     LDSP1
+       LDA     #5
+LDSP1  PSHS    A
+       LDD     #$2006
+       JSR     BLKCLR
+       LDA     ,S
+       BEQ     LDSPX
+       LDY     #PLAMIN MINI SHIP
+       TFR     X,D
+LDSP2  JSR     CWRIT
+       ADDA    #$06
+       DEC     ,S
+       BNE     LDSP2
+LDSPX  PULS    A,PC
+*
+*DISPLAY TOP OF SCREEN
+*
+TDISP  PSHS    D,X,Y,U
+       LDD     #$4020
+       LDX     #SCANER
+       JSR     BLKCLR
+       BSR     BORDER
+       BSR     LDISP
+       BSR     SBDISP
+       LDA     PLRCNT
+TD1    JSR     SCRTR0
+       DECA
+       BNE     TD1
+       PULS    D,X,Y,U,PC
+*
+*SMART BOMB DISPLAY
+*
+SBDISP PSHS    X,Y,D,U
+       LDX     #P1SBD
+       LDA     .P1SBC
+       BSR     SBDSP
+       LDA     PLRCNT
+       DECA
+       BEQ     SBDX
+       LDX     #P2SBD
+       LDA     .P2SBC
+       BSR     SBDSP
+SBDX   PULS    X,Y,D,U,PC
+SBDSP  CMPA    #3
+       BLS     SBDSP1
+       LDA     #3
+SBDSP1 PSHS    A
+       LDD     #$030B
+       JSR     BLKCLR
+       LDA     ,S
+       BEQ     SBDSPX
+       LDY     #SBPIC
+       TFR     X,D
+SBDSP2 JSR     CWRIT
+       ADDB    #4
+       DEC     ,S
+       BNE     SBDSP2
+SBDSPX PULS    A,PC
+*
+*DRAW BORDER
+*
+BORDER LDD     #$5555
+       LDX     #SCANH+$20
+BORDLP STD     ,X      DRAW BOTTOM LINE
+       LEAX    $100,X
+       CMPX    #$9C00
+       BLO     BORDLP
+       LDX     #SCANER-$100
+BORD1  STD     $4100,X L,R SCANNER BOUNDARIES
+       STD     ,X++
+       CMPX    #SCANER-$100+$20
+       BNE     BORD1
+       LDX     #SCANER-$101
+BORD2  STA     ,X      TOP SCANNER BOUNDARIES
+       LEAX    $100,X
+       CMPX    #SCANER-1+$4100
+       BNE     BORD2
+       LDX     #$4C00+SCANH-1 SCANNER SCREEN MARKER
+       LDD     #$9999
+BORD3  STD     ,X
+       STD     $21,X
+       LEAX    $100,X
+       CMPX    #$5400+SCANH-1
+       BNE     BORD3
+       RTS
+*
+*GET PLAYER STATE INDEX
+*
+PLINDX PSHS    A
+       LDA     CURPLR
+PLND1  LDX     #PLDATA
+       DECA
+       BEQ     PLINX
+       LDX     #.P2SCR
+PLINX  PULS    A,PC
+PLDX   PSHS    A
+       BRA     PLND1
+*
+*RANDOM NUMBER GENERATOR
+*
+RAND   PSHS    B
+       LDB     SEED
+       LDA     #3
+       MUL
+       ADDB    #17
+       LDA     LSEED
+       LSRA
+       LSRA
+       LSRA
+       EORA    LSEED
+       LSRA
+       ROR     HSEED
+       ROR     LSEED
+       ADDB    LSEED
+       ADCB    HSEED
+       STB     SEED
+       LDA     SEED
+       PULS    B,PC
+*
+*INITIIALIZE
+*
+*PIA INIT TAB
+PIATAB FCB     $C0,$FF,$00,$00 DDR0-3
+       FCB     $14,$05,$34,$3E CR0-3
+*
+SINIT  ORCC    #$FF    NO INTERRUPTS YET PLEASE
+       LDS     #HSTK   ONLY SETUP HARDWARE STACK
+       LDA     #RAM!>8 SETUP DIRECT PAGE
+       TFR     A,DP
+       CLR     MAPC
+* PIAS INITIALIZED HERE.
+       LDB     #4
+       LDU     #PIA0
+       LDX     #PIATAB
+INIT1  CLR     1,U
+       LDA     ,X+
+       STA     ,U++
+       LDA     3,X
+       STA     -1,U
+       DECB
+       BNE     INIT1
+       JSR     SCRCLR  CLEAR THE SCREEN
+*CLEAR RAM STORAGE
+       LDX     #$9C00
+INIT10 CLR     ,X+
+       LDB     #WDATA
+       STB     WDOG
+       CMPX    #HSTK+1
+       BNE     INIT10
+       CLR     PIA0    OFF LEDS
+       CLR     PIA1    OFF LEDS
+       LDX     #CREDST GET CREDITS IN CMOS
+       JSR     RCMOSB
+       TFR     B,A
+       CMPA    #$20    TOO HI??
+       BHI     INIT11
+       ANDA    #$F
+       CMPA    #9      NON BCD LSD???
+       BLS     INIT12
+INIT11 CLRB
+INIT12 STB     CREDIT  INTO RAM
+       LDD     #$A55A
+       STD     HSEED
+       LDD     #$FF70
+       STD     XXX1
+       CLR     XXX3
+       LDB     #$FF
+       STD     PIA01   COINS STUCK
+       JSR     P1SW    UPRIGHT SCREEN
+       JSR     MAPCH3
+       JSR     RHSTD$  SETUP TODAYS GREATS
+       BSR     PINIT   INIT PROCESSES
+       BSR     INIT20  MISC ROUTINES
+       JSR     INIT    INIT TEXT
+       NEWP    ATTR,ATYPE
+       COM     STATUS  FF---STATUS
+       ANDCC   #$00    ENABLE IRQ,FIRQ
+       JMP     EXEC
+*
+*MISC INIT ROUTINES
+*
+INIT20 BSR     CRINIT
+       JSR     FISS    INIT LASR EXHAUST TABLE
+       JSR     STINIT  INIT STARS
+       BSR     OINIT   INIT OBJECT LIST
+       JSR     FBINIT  FIRE BALL TABLE
+       JMP     THINIT  INIT THRUST
+*
+*INITIALIZE PROCESS DATA STRUCTURE
+*
+PINIT  PSHS    X,D
+       CLRD
+       LDX     #PTAB
+       STX     FREE
+PINIT1 LEAX    PSIZE,X
+       STX     -PSIZE,X
+       CMPX    #TABEND-PSIZE
+       BNE     PINIT1
+       STD     ,X
+       STD     ACTIVE
+*SUPER PROCESSES
+       LDX     #SPTAB
+       STX     SPFREE
+PINIT2 LEAX    SPSIZE,X
+       STX     -SPSIZE,X
+       CMPX    #SPTEND-SPSIZE
+       BNE     PINIT2
+       STD     ,X
+       LDX     #ACTIVE
+       STX     CRPROC
+       PULS    X,D,PC
+*INITIALIZE COLOR RAM
+CRINIT LDX     #CRTAB
+       LDU     #PCRAM
+       LDB     #16
+INITC  LDA     ,X+
+       STA     ,U+
+       DECB
+       BNE     INITC
+       RTS
+*
+*INITIALIZE OBJECT LIST
+*
+OINIT  PSHS    CC,X,D
+       ORCC    #$FF    OFF INTERRUPTS
+       LDX     #OLIST
+       STX     OFREE
+OINIT1 LEAX    OSIZE,X
+       STX     -OSIZE,X
+       CMPX    #OLEND-OSIZE
+       BNE     OINIT1
+       CLRD
+       STD     ,X      LAST LINK 0
+       STD     IPTR    INACTIVE LIST
+       STD     OPTR
+       STD     SPTR
+       PULS    CC,X,D,PC
+*
+*ATTRACT MODE
+*
+ATTR   JSR     MAPCH1
+       JMP     ATTRV
+*
+*CHECK FREE PLAY
+*
+FPLAY  LDX     #FREEPL
+       JSR     RCMOSA
+       DECA
+       BNE     FPLX    GOT TO PAY
+       LDA     #2
+       STA     CREDIT
+FPLX   RTS
+*
+*ONE PLAYER START
+*
+ST1    LDA     STATUS
+       BPL     ST1X
+       BSR     FPLAY
+       LDA     CREDIT
+       BEQ     ST1X
+       LDD     #ST1SND
+ST09   JSR     SNDLD
+       BSR     START
+ST1X   DIE
+*
+*TWO PLAYER START
+*
+ST2    LDA     STATUS
+       BPL     ST1X
+       BSR     FPLAY
+       LDA     CREDIT
+       CMPA    #2      NO CREDY NO GAMEY POOH
+       BLO     ST1X
+       BSR     START
+       LDD     #ST2SND
+       BRA     ST09
+*
+*START GAME
+*
+START  CLR     CUNITS  PATCH ONE
+       NOP
+       LDA     PWRFLG  WILLI PAGE CHECK
+       BEQ     STARTX
+       LDA     STATUS
+       BPL     START2
+       JSR     GNCIDE  KILL ALL
+       JSR     SCRCLR  CLEAN SCREEN
+       LDA     #$7F
+       STA     STATUS
+       LDA     #1
+       STA     CURPLR
+       STA     PDFLG   DISPLAY PROMPT
+       CLR     PLRCNT
+       LDX     #PLDATA
+START1 CLR     ,X+
+       CMPX    #PLDEND
+       BNE     START1
+       LDX     #NSHIP
+       JSR     RCMOSA
+       ANDA    #$F
+       STA     .P1LAS
+       LDB     #10
+       STD     .P1SBC  10-->.P1TRG ALSO PATCH 2
+       CLR     BUNITS
+       NOP
+       LDX     #PLDATA
+       JSR     GETWV
+       LDX     #REPLAY
+       JSR     RCMOSD
+       STD     REPLA
+       STD     .P1RP
+       CLR     .P1RP+2
+       LDX     #PLDATA
+STTRAN LDA     ,X+     COPY INTO SECOND PLAYER
+       STA     PLDLEN-1,X
+       CMPX    #.P1END
+       BNE     STTRAN
+       NEWP    PLSTRT,STYPE START PLAYER GOING
+START2 INC     PLRCNT
+       LDA     CREDIT
+       ADDA    #$99
+       DAA
+       STA     CREDIT
+       LDX     #CREDST BACKUP CREDITS
+       JSR     WCMOSA
+       LDA     PLRCNT  ELIMINATE GLITCH
+       DECA
+       BEQ     STARTX
+       JSR     TDISP   DISPLAY SCORE+LASERS
+DRTS   EQU     *
+STARTX RTS
+*
+*SCREEN SWITCHING
+*
+P1SW   PSHS    A,X     SAVE REGISTERS
+       LDA     MAPCR   SAVE MAP
+       PSHS    A
+P1SW0  LDX     #IRQ
+       LDD     #$383C
+       BRA     PSW1
+P2SW   PSHS    A,X     SAVE REGISTERS
+       LDA     MAPCR   SAVE MAP
+       PSHS    A
+       CLRA
+       JSR     MAPCHG
+       LDA     PIA3    COCKTAIL?
+       BPL     P1SW0   NO
+       LDX     #IRQB   SWITCH UPSIDE DOWN GUYS
+       LDD     #$3934
+PSW1   STX     IRQHK+1 IRQ SELECT
+       CLR     MAPCR
+       CLR     MAPC
+       STB     PIA3+1
+       STA     WDOG
+       LDA     #$7E
+       STA     IRQHK
+       PULS    A
+       STA     MAPCR   RESTORE MAP
+       STA     MAPC
+       PULS    A,X,PC
+*
+*PLAYER START PROCESS
+*
+PLSTRT LDB     #7      HIT SHIP COUNTER
+       JSR     AUDIT
+PLSTR0 JSR     INIT20  RE:INIT THE BOYS
+       JSR     GNCIDE
+       LDA     #$7F
+       STA     STATUS
+       LDX     CRPROC
+       CMPX    ACTIVE
+       BNE     PLSTR1
+       LDX     ,X
+       BEQ     PLSTR2
+PLSTR1 NAP     15,PLST1A WAIT FOR COINS TO FINISH
+PLST1A LDA     LCCNT
+       ORA     RCCNT
+       ORA     LCCNT
+       BNE     PLSTR1
+PLSTR2 JSR     PINIT   REINIT
+       NEWP    PLSTR3,STYPE
+       JMP     EXEC
+PLSTR3 CLRA
+       JSR     MAPCHG  SELECT 0
+       LDA     PIA3
+       BPL     PLSTR5  NO COCKTAIL
+       JSR     SCRCLR
+       LDA     CURPLR  PLAYER?
+       DECA
+       BNE     PLST3A
+       JSR     P1SW    PLAYER 1
+       BRA     PLSTR4
+PLST3A BSR     P2SW
+PLSTR4 LDA     #$FF    STICK SWITCHES
+       STA     PIA21
+       STA     PIA22
+PLSTR5 CLRA
+       CLRB
+       STD     BGL
+       STD     BGLX
+       JSR     MAPCH7
+       JSR     ALINIT
+       JSR     BGINIT
+       JSR     SCLR1   CLEAR SCREEN
+       LDD     #$0300
+       STD     PLADIR  THRUST+DIRECTION
+       STD     NPLAD
+       CLR     THFLG
+       CLR     LFLG
+       CLR     SCRFLG  NO SCORE
+       CLR     REVFLG
+       CLR     SBFLG
+       CLR     BMBCNT
+       LDX     #TLIST
+       STX     TPTR
+       JSR     PLINDX  REDUCE LASER COUNT
+       STX     PLRX    INDEX TO PLAYER STORE AREA
+       LDA     PWAV,X
+       ANDA    #7
+       LDU     #WCTAB-1
+       LDA     A,U
+       STA     PCRAM+5 GET WAVE COLORS
+       DEC     PLAS,X
+       JSR     TDISP
+       LDD     #$2080  INIT COORD
+       STD     NPLAXC
+       STD     PLAXC
+       LDD     #$2000
+       STD     PLAX16
+       LDD     #$2000!>2
+       ADDD    BGL
+       STD     PLABX
+       LDD     #$8000
+       STD     PLAY16
+       CLRD
+       STD     PLAXV
+       STA     PLAXV+2
+       STD     PLAYV
+       NEWP    SCPROC,STYPE
+       NEWP    COLR,STYPE
+       NEWP    FLPUP,STYPE
+       NEWP    THPROC,STYPE
+       NEWP    CBOMB,STYPE
+       NEWP    TIECOL,STYPE
+       LDA     PDFLG   NO CHANGE IN PLAYER
+       BEQ     PLS01
+       LDB     PLRCNT  2 PLAYER GAME?
+       DECB
+       BEQ     PLS01   NO
+       LDU     #PLYR1  YES, DISPLAY PROMPT
+       LDA     CURPLR
+       DECA
+       BEQ     PLS00
+       LDU     #PLYR2
+PLS00  LDX     #$3C80
+       JSR     MESS
+       LDA     #$80
+       LDX     #PLS01
+       JMP     SLEEP
+PLS01  JSR     SCLR1
+       LDB     #$05
+       LDX     PLRX
+       LDA     PTARG,X
+       BSR     STCHKA
+       LDA     #$60
+       LDX     #PLS1
+       JMP     SLEEP
+PLS1   JSR     PLRES
+       BSR     STCHK
+       CLR     PDFLG
+       JMP     GEXEC   GAME HANDLER
+*
+*TERRAIN STATUS UPDATE
+*
+STCHK  CLRB            CHECK TERRAIN ACTIVE
+STCHK0 LDA     ASTCNT
+STCHKA BNE     STCHK1
+       ORB     #2
+STCHK1 STB     STATUS
+       RTS
+*
+*PLAYER END
+*
+PLEND  LDB     #$58
+       BSR     STCHK0
+       LDD     BGL
+       STD     BGLX    NOMO SCROLL
+       LDX     PLAXC
+       LDD     #$0806
+       JSR     BLKCLR  OFF PLAYER
+       JSR     PLSAV
+       LDD     #PDSND
+       JSR     SNDLD
+*
+*PLAYER DEATH
+*
+PDEATH LDY     #PLAPIC
+       LDA     NPLAD
+       BPL     PDTH1
+       LDY     #PLBPIC
+PDTH1  LDX     #PXCTB  INIT COLOR
+       STX     PD,U
+       LDU     #MONOTB
+       JSR     MONO
+       TFR     U,X     PSEUDO VECTOR
+       LDU     CRPROC
+       STX     PD+4,U
+PDTHL  LDD     NPLAXC
+       LDY     PD+4,U
+       JSR     COFF    BLANK
+       LDA     #2
+       LDX     #PDTH2
+       JMP     SLEEP
+PDTH2  LDD     NPLAXC
+       LDY     PD+4,U
+       JSR     CWRIT
+       LDX     PD,U
+       LDA     ,X+
+       BEQ     PDTH4
+       STA     PCRAM+$B
+       CLR     PCRAM   BLACK SCREEN
+       STX     PD,U
+PDTH3  LDA     #2
+       LDX     #PDTHL
+       JMP     SLEEP
+PDTH4  LDA     #$7F
+       STA     STATUS
+       LDA     #$FF
+       STA     PCRAM
+       LDA     #2
+       LDX     #PDTH5
+       JMP     SLEEP
+PDTH5  CLR     PCRAM
+       JSR     GNCIDE
+       LDX     NPLAXC
+       LEAX    $0403,X BLOW HIM
+       JSR     MAPCH7
+       JSR     PXVCT
+       JSR     SCRTRN
+       CLR     SNDTMR  OFF SOUND
+       LDB     #$13
+       JSR     SNDOUT
+       JSR     WVCHK
+       BNE     PLE01
+       JSR     BONUS
+       JSR     SCLR1
+PLE01  LDA     CURPLR  SHIPS LEFT?
+       LDX     PLRX
+       LDB     PLAS,X
+       BNE     PLE02   YES
+       LDB     PLRCNT  1 PLAYER?
+       DECB
+       BEQ     PLE2    YES, GAME OVER
+       EORA    #$3     OTHER GUY HAS SHIPS?
+       JSR     PLDX
+       LDB     PLAS,X
+       BEQ     PLE2    NO,GAME OVER
+       LDU     #PLYR1  YES, DISPLA PLAYER N GAME OVER
+       CMPA    #2
+       BEQ     PLEM1
+       LDU     #PLYR2
+PLEM1  LDX     #$3C78
+       JSR     MESS
+       LDU     #GO
+       LDX     #$3E88
+       JSR     MESS
+       NAP     $60,PLE02
+PLE02  LDA     CURPLR
+PLELP  INCA
+       CMPA    PLRCNT
+       BLS     PLE1
+       LDA     #1
+PLE1   JSR     PLDX
+       LDB     PLAS,X
+       BEQ     PLELP
+       STA     CURPLR
+       INC     PDFLG
+       JMP     PLSTRT
+PLE2   LDU     #GO     GAME OVER
+       LDX     #$3E80
+       LDA     #$FF
+       STA     STATUS
+       JSR     MESS
+       CLR     SNDTMR  OFF SOUNDS
+       LDB     #$13
+       JSR     SNDOUT
+       NAP     40,PLE3
+PLE3   JMP     ATTR
+*PLAYER GLOW TABLE
+PXCTB  FCB     7,7,7,$F,$3F,$7F,$FF,$FF,0
+*WALL COLOR TABLE
+WCTAB  FCB     $81,$28,$07,$16,$2F,$84,$15,0
+*
+* MONOCHROMATIZER ROUTINE   Y = OBJECT PICTURE ADDRESS
+*                           U = MONOCHROMATIC PICTURE ADDRESS
+*   COLOR: $B
+*
+MONO   PSHS    U,X,D   SAVE REGISTERS
+       JSR     MAPCH2  SELECT MAP
+       LDD     OBJW,Y  GET PICTURE SIZE
+       STD     OBJW,U  COPY TO MONO DESCRIPTOR
+       MUL             COMPUTE NUMBER OF BYTES
+       LEAX    OBJL,U  GET START OF MONO DATA ADDRESS
+       STX     OBJP0,U SAVE IN MONO DESCRIPTOR
+       LEAX    D,X     ADD NUMBER OF BYTES OF ONE IMAGE
+       STX     OBJP1,U SAVE IN MONO DESCRIPTOR
+       PSHS    X       END OF FIRST MONO FLAVOR
+       LEAX    D,X     ADD NUMBER OF BYTES OF ONE IMAGE
+       PSHS    X       SAVE END OF SECOND MONO FLAVOR
+       LDD     OBJWRT,Y GET OBJECT WRITE ROUTINE
+       STD     OBJWRT,U COPY TO MONO DESCRIPTOR
+       LDD     OBJDEL,Y GET OBJECT ERASE ROUTINE
+       STD     OBJDEL,U COPY TO MONO DESCRIPTOR
+       LDX     OBJP0,Y GET START OF FIRST FLAVOR OBJECT DATA
+       LEAU    OBJL,U  GET START OF FIRST FLAVOR MONO
+       BSR     MONO1   MONOCHROMATIZE FIRST FLAVOR
+       LDX     OBJP1,Y GET START OF SECOND FLAVOR OBJECT DATA
+       LDU     2,S     GET START OF SECOND FLAVOR MONO
+       LDD     ,S      GET END OF SECOND FLAVOR MONO
+       STD     2,S     SET BOUNDARY
+       BSR     MONO1   MONOCHROMATIZE SECOND FLAVOR
+       LEAS    4,S     CLEAN THE STACK
+       PULS    D,X,U,PC RESTORE REGISTERS, RETURN
+* MONOCHROMATIZE LOOP
+MONO1  LDD     ,X++    GET TWO BYTES OF OBJECT, ADVANCE POINTER
+       BITA    #$F0    TEST FIRST NIBBLE
+       BEQ     MONO2   ZERO?, SKIP IT
+       ORA     #$F0    COLORED?, SET TO $F
+MONO2  BITA    #$0F    TEST SECOND NIBBLE
+       BEQ     MONO3   ZERO?, SKIP IT
+       ORA     #$0F    COLORED?, SET TO $F
+MONO3  BITB    #$F0    TEST THIRD NIBBLE
+       BEQ     MONO4   ZERO?, SKIP IT
+       ORB     #$F0    COLORED?, SET TO $F
+MONO4  BITB    #$0F    TEST FOURTH NIBBLE
+       BEQ     MONO5   ZERO?, SKIP IT
+       ORB     #$0F    COLORED?, SET TO $F
+MONO5  ANDA    #$BB    CHANGE COLOR TO $B
+       ANDB    #$BB
+       STD     ,U++    SAVE TWO BYTES MONO, ADVANCE POINTER
+       CMPU    4,S     CHECK FOR END OF OBJECT
+       BLO     MONO1   NO?, CONTINUE
+       RTS             YES?, RETURN
+*
+*SAVE PLAYER STATE
+*
+PLSAV  PSHS    D,X,U
+       LDU     PLRX
+       LEAU    PTARG,U
+       LDA     #PLDLEN-PTARG
+PLSAV1 CLR     ,U+     CLEAR AREA
+       DECA
+       BNE     PLSAV1
+*SAVE ASTROS
+       LDU     PLRX
+       LDA     ASTCNT
+       STA     PTARG,U
+*SAVE ENEMY COUNTS
+       LEAU    PENEMY,U
+       LDX     #ELIST
+PLSAV6 LDA     ,X+
+       CMPX    #ELIST1
+       BHI     PLSAV7
+       ADDA    ELEND-ELIST-1,X RES=ACT+RES
+PLSAV7 STA     ,U+
+       CMPX    #ELEND
+       BNE     PLSAV6
+       PULS    D,X,U,PC
+*
+*START ASTROS
+*A=#
+*B=BIT 6,7 OF XADDR
+ASTST  PSHS    D
+       STA     XTEMP+1
+ASTST1 OBI     ASTP1,ASTKIL,$6666
+       JSR     RAND
+       LDD     HSEED
+       ANDA    #$1F
+       ADDA    1,S
+       STD     OX16,X
+       LSRB
+       BCC     ASTS2
+       LDD     #ASTP3  OPPOSITE DIRECTION
+       STD     OPICT,X
+ASTS2  LDA     #$E0
+       STA     OY16,X
+       LDA     #$10
+       STA     OTYP,X  NON COLLIDE
+       CLRD
+       STD     OYV,X
+       STD     OXV,X
+       STD     OBJID,X
+       STX     OPTR
+       STX     ,Y++
+       DEC     XTEMP+1
+       BNE     ASTST1
+       PULS    D,PC
+       FCB     $0C     CKBYT CHECKSUM(ACTUAL)
+*
+*PLAYER RESTORE
+*START ASTROS+BASES
+*GET ENEMY COUNTS+PARAMS
+*
+PLRES  NEWP    ASTRO,STYPE
+       LDU     #TLIST
+       LEAY    ,U
+       STU     PD,X    INIT PTR
+ASTS1  CLR     ,U+     CLEAR LIST
+       CMPU    #TLEND
+       BNE     ASTS1
+       LDU     PLRX
+       LDA     PTARG,U
+       STA     ASTCNT
+       BEQ     ASTSX
+       CMPA    #7
+       BLS     ASTS1B
+       LSRA
+       LSRA
+       CLRB
+ASTS1A BSR     ASTST   QUADRANT AT AT TIME
+       ADDB    #$40
+       BNE     ASTS1A
+       ASLA
+       ASLA
+       NEGA
+       ADDA    PTARG,U GET LEFTOVERS
+       BEQ     ASTSX
+ASTS1B STA     XTEMP
+ASTS1C LDB     HSEED
+       LDA     #1
+       BSR     ASTST
+       DEC     XTEMP
+       BNE     ASTS1C
+*ENEMY COUNTS
+ASTSX  LDU     PLRX
+       LEAU    PENEMY,U
+       LDX     #ELIST
+ELS1   LDA     ,U+
+       STA     ,X+
+       CMPX    #ELEND
+       BNE     ELS1
+*CLEAR ACTIVE COUNTS
+       LDX     #ECNTS
+ELS2   CLR     ,X+
+       CMPX    #ECEND
+       BNE     ELS2
+*RESTORE YOUR SWARMERS
+RSW0   JSR     GETOB   GET PHONY OBJECT
+       LDA     SEED
+       LSRA
+       ADDA    #YMIN
+       STA     OY16,X
+       JSR     RAND
+       ANDA    #$3F
+       ADDA    #$80
+       ADDD    BGL
+       STD     OX16,X
+       LDA     SWMRES
+       BEQ     RSWX
+       CMPA    #6
+       BLS     RSW1
+       LDA     #6
+RSW1   LEAY    ,X
+       JSR     MMSW
+       LDX     OFREE
+       STX     ,Y      KILL THE PHONY
+       STY     OFREE
+       NEGA
+       ADDA    SWMRES
+       STA     SWMRES
+       BNE     RSW0
+*RESTORE SCHITZOS
+RSWX   LDA     SCZRES
+       BEQ     RSCZX
+       JSR     SCZST
+       CLR     SCZRES
+*RESTORE PROBES
+RSCZX  LDA     PRBRES
+       STA     PRBCNT
+       BEQ     TIER
+       CLR     PRBRES
+       JSR     PRBST
+*RESTORE TIES
+TIER   LDA     TIERES
+       STA     TIECNT
+       BEQ     TIERX
+TIER0  CMPA    #3
+       BLS     TIER1
+       LDA     #3
+TIER1  PSHS    A
+       JSR     TIEST
+       LDA     TIERES
+       SUBA    ,S+
+       STA     TIERES
+       BNE     TIER0
+TIERX  RTS
+*
+*GAME EXEC
+*CHECKS END OF WAVE
+*STAGES ATTACKS
+*DISPATCHES SPOILERS
+*
+GEXEC  LDU     CRPROC
+       LDA     #40     DELTA COUNTER
+       STA     PD,U
+       LDA     UFOTIM
+       STA     UFOTMR
+       LDA     #1
+       STA     WAVTMR
+GEX0   LDA     STATUS
+       BITA    #8
+       BNE     GEX3    PLAYER DEAD
+       JSR     WVCHK
+       BNE     GEX00
+       LDA     #$77
+       STA     STATUS
+       JSR     GNCIDE
+       JSR     PLSAV
+       JSR     BONUS
+       LDX     PLRX
+       INC     PLAS,X
+       JMP     PLSTR0
+GEX00  CMPA    #8      ACCELERATE?
+       BHI     GEX002
+       LDB     UFOTIM
+       LSRB
+       CMPA    #3
+       BHI     GEX001
+       LSRB
+GEX001 INCB
+       CMPB    UFOTMR
+       BHS     GEX002
+       STB     UFOTMR
+GEX002 DEC     UFOTMR
+       BNE     GEX11
+       CMPA    #4
+       LDA     UFOTIM
+       BHS     GEX003
+       LSRA
+       LSRA
+       JSR     RMAX
+GEX003 STA     UFOTMR
+       LDA     UFOCNT
+       CMPA    #12
+       BHS     GEX11
+       JSR     UFOST
+       INC     UFOCNT
+GEX11  DEC     WAVTMR
+       BEQ     GEX2
+       LDA     LNDCNT
+       BNE     GEX3
+GEX2   LDA     WAVTIM
+       STA     WAVTMR
+       LDA     LNDRES
+       BEQ     GEX3
+       LDA     LNDCNT
+       CMPA    #8
+       BHS     GEX3
+       LDA     WAVSIZ
+       CMPA    LNDRES
+       BLS     GEX20
+       LDA     LNDRES
+GEX20  JSR     LANDST  START A SQUAD
+       NEGA
+       ADDA    LNDRES
+       STA     LNDRES
+GEX3   LDA     STRCNT  GET STARS GOING AFTER OVERFLOW
+       CMPA    #16
+       BHS     GEX5
+       INC     STRCNT
+GEX5   LDA     GTIME
+       INCA
+       CMPA    #240
+       BLS     GEX50
+       LDB     #$06    METER 6
+       JSR     AUDIT
+       CLRA
+GEX50  STA     GTIME
+       LDU     CRPROC
+       DEC     PD,U
+       BNE     GEX6
+       LDB     #2
+       LDY     #ELIST
+       JSR     WDELT
+       LDA     #40
+       STA     PD,U
+GEX6   NAP     15,GEX0
+*
+*RANDOM MAX ROUTINE
+*A = RAND <=A
+RMAX   PSHS    A
+       JSR     RAND
+RMAX1  CMPA    ,S
+       BLS     RMAXX
+       LSRA
+       BRA     RMAX1
+RMAXX  INCA
+       LEAS    1,S
+       RTS
+*
+*
+*CHECK END OF WAVE
+*
+WVCHK  LDA     LNDCNT  END OF WAVE
+       ADDA    LNDRES
+       ADDA    TIECNT
+       ADDA    PRBCNT
+       ADDA    SWCNT
+       ADDA    SCZCNT
+       ADDA    SCZRES
+       RTS
+*
+*BCD-HEX CONVERT
+*A=BCD-HEX
+BCDHEX PSHS    B
+       CLRB
+BCH1   CMPA    #$10
+       BLO     BCH2
+       ADDB    #10
+       SUBA    #$10
+       BRA     BCH1
+BCH2   PSHS    B
+       ADDA    ,S+
+       PULS    B,PC
+*
+*HEX-BCD CONVERT
+*A=HEX-BCD
+HEXBCD PSHS    B
+       TFR     A,B
+       CLRA
+HBC1   CMPB    #10
+       BLO     HBC2
+       ADDA    #$10
+       DAA
+       SUBB    #10
+       BRA     HBC1
+HBC2   PSHS    B
+       ADDA    ,S+
+       DAA
+       PULS    B,PC
+*
+*BONUS COLLECT PROCESS
+*
+BONUS  CLR     PCRAM
+       LDU     CRPROC
+       PULS    X
+       STX     PD+6,U  SAVE RETURN
+       JSR     SCLR1
+       LDU     #ATWV   ATTACK WAVE N COMPLETED
+       LDX     #$3850
+       JSR     MESS
+       LDX     PLRX
+       LDA     PWAV,X
+       BSR     HEXBCD
+       TFR     A,B
+       CLRA
+       LDX     CURSER
+       JSR     WNBV
+       LDX     #$3D60
+       LDU     #COMPV
+       JSR     MESS
+       LDU     #BONSX
+       LDX     #$3C90
+       JSR     MESS
+       LDX     PLRX
+       CLRB
+       LDA     PWAV,X
+       CMPA    #5
+       BLS     BON1
+       LDA     #5
+BON1   LDX     CURSER
+       JSR     WNBV
+       LDU     CRPROC
+       LDX     #$3CA0  INITIAL ADDR
+       LDA     ASTCNT
+       STA     PD2,U
+       BEQ     BC2
+BCLP   TFR     X,D
+       LDY     #ASTP3
+       JSR     CWRIT
+       LEAX    $400,X
+       LDA     #$01
+       LDY     PLRX
+       LDB     PWAV,Y  MULTIPLIER
+       CMPB    #5
+       BLO     BCLPA
+       LDB     #5
+BCLPA  ASLB
+       ASLB
+       ASLB
+       ASLB
+       JSR     SCORE
+       STX     PD,U
+       NAP     4,BC1
+BC1    LDX     PD,U
+       DEC     PD2,U   ALL DONE?
+       BNE     BCLP    NO
+BC2    LDX     PLRX
+       JSR     GETWV
+       NAP     $80,BC3 HANG OUT
+BC3    JMP     [PD+6,U] RETURN
+*
+*GET NEW WAVE PARAMS
+*X=PLAYER INDEX
+GETWV  PSHS    X,U,D
+       INC     PWAV,X
+       LDX     #GA1+6  GET GA4=RESTORE WAVE
+       JSR     RCMOSA
+       STA     XTEMP
+       LDX     2,S     GET BACK X
+       TSTA            ZERO CASE TRAP OUT
+       BEQ     GTWV01
+       LDA     PWAV,X
+*NEW ASTROS
+GTWV00 SUBA    XTEMP   NEW GUYS EVERY NTH WAVE
+       BLO     GTWV01
+       BNE     GTWV00
+       LDA     #10
+       STA     PTARG,X
+GTWV01 JSR     MAPCH7
+       LDA     PWAV,X
+       PSHS    A
+       CMPA    #4
+       BLS     GETWV1
+       LDA     #4
+GETWV1 LDU     WVTAB
+       ADDA    #3      OFFSET ADJUST
+       LEAX    PENEMY,X
+GETWV2 LDB     A,U
+       STB     ,X+
+       LEAU    8,U
+       CMPU    WVTEND
+       BNE     GETWV2
+GETWV3 PULS    A       HIGHER THAN 4?
+       SUBA    #4
+       BHS     GTWV30
+       CLRA
+GTWV30 STA     XTEMP
+       LDX     #GA1
+       JSR     RCMOSD
+       JSR     BCDHEX
+       ADDA    XTEMP
+       STA     XTEMP   ADD INITIAL DELTA
+       BEQ     GETWVX
+       TFR     B,A
+       JSR     BCDHEX  CHECK CEILING
+       CMPA    XTEMP
+       BHS     GTWV31
+       STA     XTEMP
+GTWV31 LDA     XTEMP
+GETWV4 LDB     #3
+       JSR     PLINDX
+       LEAY    PENEMY,X
+       BSR     WDELT   GET YUR DELTAS
+       DECA
+       BNE     GETWV4
+GETWVX PULS    X,U,D,PC
+*
+*INTRA/INTER-WALL DELTA
+*B=2 FOR INTRA,3=INTER
+*Y=PENEMY FOR INTER-WALL
+*Y=ELIST FOR INTRA-WALL
+*
+WDELT  PSHS    A,X,Y
+       JSR     MAPCH7  SELECT DATA BLOCK
+       LDX     WVTAB
+WD0    LDA     B,X
+       BMI     WD1
+       ADDA    ,Y
+       BCS     WDL     OVERFLOW
+       CMPA    ,X
+       BHI     WDL     MAXXED OUT
+       BRA     WD2
+WD1    ADDA    ,Y
+       BCC     WDL     UNDERFLOW
+       CMPA    1,X
+       BLO     WDL     MINNED
+WD2    STA     ,Y
+WDL    LEAY    1,Y     STEP THRU
+       LEAX    8,X
+       CMPX    WVTEND
+       BNE     WD0
+       PULS    A,X,Y,PC
+*
+*INTERRUPT ROUTINE
+*
+IRQ    CLR     MAPC
+       LDA     #RAM!>8
+       TFR     A,DP
+       LDA     #4
+       STA     PIA1+1
+       LDA     PIA1
+       LDA     VERTCT  PAST 128
+       CMPA    #128
+       BLO     I0      NO
+       LDA     IFLG    ALREADY DONE ?
+       BNE     IRQX    NO
+       INC     IFLG
+       JSR     SNDSEQ  SOUNDS+SWITCHES
+       JSR     PLAYER
+       JSR     STOUT   OUTPUT STARS
+       LDA     VERTCT
+       SUBA    #8
+       CMPA    #$A8
+       BLS     IRQ1
+       LDA     #$A8
+IRQ1   STA     XXX2
+       LDA     #2
+       STA     MAPC    SELECT OBJECTS
+       LDD     XXX2
+       JSR     OPROC
+       LDD     XXX2
+       JSR     PRDISP
+       JSR     SHELL
+       BRA     IRQX
+I0     LDB     IFLG
+       BEQ     IRQX
+       CLR     IFLG
+       INC     TIMER
+       LDB     #WDATA
+       STB     WDOG
+       CMPA    #8      TOO LATE?
+       BHI     I01
+*COLOR MAPPING
+       LDU     #CRAM+16
+       LDD     PCRAM+10
+       LDX     PCRAM+12
+       LDY     PCRAM+14
+       PSHU    D,X,Y
+       LDD     PCRAM+4
+       LDX     PCRAM+6
+       LDY     PCRAM+8
+       PSHU    D,X,Y
+       LDD     PCRAM
+       LDX     PCRAM+2
+       PSHU    D,X
+I01    JSR     CSCAN   COIN SWITCHES
+       LDA     #7
+       STA     MAPC
+       LDA     STATUS
+       BITA    #$02
+       BNE     IRQ2
+       JSR     BGOUT
+IRQ2   LDA     #2
+       STA     MAPC    SELECT OBJECTS
+       LDD     XXX1
+       JSR     PRDISP
+       LDD     XXX1
+       JSR     OPROC
+       JSR     VELO    UPDATE VELOCITIES
+IRQX   ORCC    #$FF
+       CLR     MAPC
+       LDA     #5
+       STA     PIA1+1
+       LDA     MAPCR
+       STA     MAPC
+       LDA     ,S      E BIT FIX
+       ANDA    #$6F
+       STA     ,S
+       PULS    X,Y,D,U,PC,CC,DP
+*
+*INVERTED IRQ FOR SCREEN FLIP
+*
+IRQB   CLR     MAPC
+       LDA     #RAM!>8
+       TFR     A,DP
+       LDA     #4
+       STA     PIA1+1
+       LDA     PIA1
+       LDA     VERTCT
+       CMPA    #$58    CHECK A0 (COUNT RUNS BACKWARDS)
+       BLO     IB0
+       LDB     IFLG
+       BNE     IRQX
+       INC     IFLG
+       COMA
+       NOP
+       STA     XXX2    WRITING BOUNDARY
+       JSR     CSCAN
+       LDA     #7
+       STA     MAPC
+       LDA     STATUS
+       BITA    #$02
+       BNE     IRQB2
+       JSR     BGOUT
+IRQB2  LDA     #2      SELECT CHARS
+       STA     MAPC
+       LDD     XXX1
+       JSR     PRDISP
+       LDD     XXX1
+       JSR     OPROC
+       BRA     IRQX
+IB0    LDB     IFLG
+       BEQ     IRQX
+       CLR     IFLG
+       INC     TIMER
+       LDB     #$39
+       STB     WDOG
+       CMPA    #4
+       BHI     IB01
+*COLOR MAPPING
+       LDU     #CRAM+16
+       LDD     PCRAM+10
+       LDX     PCRAM+12
+       LDY     PCRAM+14
+       PSHU    D,X,Y
+       LDD     PCRAM+4
+       LDX     PCRAM+6
+       LDY     PCRAM+8
+       PSHU    D,X,Y
+       LDD     PCRAM
+       LDX     PCRAM+2
+       PSHU    D,X
+IB01   JSR     SNDSEQ
+       JSR     PLAYER
+       JSR     STOUT
+       LDA     #2
+       STA     MAPC
+       LDD     XXX2
+       JSR     PRDISP
+       LDD     XXX2
+       JSR     OPROC
+       JSR     SHELL
+       JSR     VELO
+       JMP     IRQX
+*
+*STAR INITIALIZE
+*
+STINIT LDX     #SMAP
+       LDB     #16
+       STB     STRCNT
+       CLRB
+STI0   JSR     RAND
+       CMPA    #$9C
+       BHS     STI0    NO GOOD
+       STA     SX,X    GET X
+STI1   JSR     RAND
+       CMPA    #$A8    LIMIT TEST
+       BHI     STI1
+       CMPA    #YMIN
+       BLS     STI1
+       STA     SY,X
+       STB     SCOL,X  COLOR
+       ADDB    #$11
+       ANDB    #$77
+       LEAX    SLGTH,X
+       CMPX    #SMEND
+       BNE     STI0
+STX    RTS
+*
+*OUTPUT STARS
+*
+STOUT  LDA     STATUS
+       BITA    #$20
+       BNE     STX     NO
+       LDX     #SMAP
+       LDD     BGL
+       ANDB    #$80
+       STD     ITEMP
+       LDD     BGLX
+       ANDB    #$80
+       SUBD    ITEMP
+       ASLB            GET DELTA
+       ROLA
+*
+*STAR OUTPUT
+*ITEMP2=PHASE MASK
+*X =ADDR OF STAR TABLE START
+*B=COUNT
+*ITEMP = MOVEMENT
+       STA     ITEMP
+       LDB     #$F0
+       LDA     BGL+1
+       BITA    #$40    GET PHASES
+       BNE     STOUT0
+       COMB
+STOUT0 STB     ITEMP2
+       CLRA
+       STA     [0,X]
+       STA     [4,X]
+       STA     [8,X]
+       STA     [12,X]
+       STA     [16,X]
+       STA     [20,X]
+       STA     [24,X]
+       STA     [28,X]
+       STA     [32,X]
+       STA     [36,X]
+       STA     [40,X]
+       STA     [44,X]
+       STA     [48,X]
+       STA     [52,X]
+       STA     [56,X]
+       STA     [60,X]
+       LDB     STRCNT
+STOUT1 LDA     SX,X
+       ADDA    ITEMP
+       CMPA    #$9C
+       BLO     STOUT3  NO OVERFLOW
+       CMPA    #$C0    WHICH WAY DID HE COME
+       BLS     STOUT2
+       LDA     #$9B
+       BRA     STOUT3
+STOUT2 LDA     #0
+STOUT3 STA     SX,X
+       LDA     SCOL,X
+       ANDA    ITEMP2  ******************************BSO BONER*******
+       FCB     $A7,$98,$00 (STA [SX,X]) ***********BSO BONER*******
+       LEAX    SLGTH,X *****************************BSO BONER*******
+       DECB
+       BNE     STOUT1
+*
+*STAR BLINK
+*
+SBLNK  LDB     SEED    GET A RANDOM GUY
+       ANDB    #$3C
+       LDX     #SMAP
+       ABX
+       LDA     SCOL,X  CHANGE COLOR
+       ADDA    #$11
+       ANDA    #$77
+       STA     SCOL,X
+       LDA     SEED
+       BITA    #$01    HYPER?
+       BNE     SBLNK1  NO
+       CMPA    #$98
+       BLO     SBLNK0
+       LDU     #$A102  CHECK STAR FUCK UP
+       LEAU    WCURS-$A102,U
+       LDU     ,U
+       CMPU    #$6245
+       BEQ     SBL00
+       TST     STATUS
+       BMI     SBL00   NO ATTRACT BOMB
+       CMPA    #$A0
+       BLO     SBL00
+       CMPA    #$A1
+       BHS     SBL00   BOMB BASE PAGE ONLY
+       LDB     LSEED
+       TFR     D,X
+       LDB     HSEED
+       STB     ,X      BLAST RAM
+SBL00  SUBA    #$84    *********************************BSO BONER
+SBLNK0 FCB     $6F,$98,$00 (CLR [SX,X]) HYPER***********BSO BONER
+       STA     SX,X    *********************************BSO BONER
+       LDA     STATUS
+       BITA    #2
+       BEQ     SBLNK1  TERRAIN ACTIVE, QUIT
+       LDA     LSEED   Y HYPER
+       ANDA    #$3F
+       LDB     #3
+       MUL
+       ADDB    #YMIN
+       STB     SY,X
+SBLNK1 RTS
+*
+*INIT THRUST TABLE
+*
+THINIT LDX     #THTAB
+       STX     THX
+THI1   JSR     RAND
+       STA     32,X
+       STA     ,X+
+       CMPX    #THTEND-31
+       BNE     THI1
+       RTS
+*
+*OUTPUT THRUST
+*
+THOUT  LDX     THX
+       LDU     PLAXC
+       LEAU    -$100+1,U
+       LDD     ,X
+       STD     ,U
+       LDA     5,X
+       LDB     9,X
+       STD     2,U
+       LDA     12,X
+       STA     4,U
+       LDA     PIA21
+       BITA    #$02
+       BEQ     THOUTX  IDLE
+       LDA     3,X
+       LDB     6,X
+       STD     -$100+1,U
+       LDA     10,X
+       STA     -$100+3,U
+       LDA     4,X
+       LDB     7,X
+       STD     -$200+1,U
+       LDA     11,X
+       STA     -$200+3,U
+       LDA     8,X
+       STA     -$300+2,U
+THOUTX RTS
+*
+*BACKWARDS THRUST
+*
+THOUT1 LDU     THX
+       LDX     PLAXC
+       LEAX    $801,X
+       PULU    D,Y
+       STD     ,X
+       STY     2,X
+       PULU    D,Y
+       STA     4,X
+       LDA     PIA21
+       BITA    #$02
+       BEQ     THT1X   NO THRUST
+       STB     $101,X
+       STY     $102,X
+       PULU    D,Y
+       STY     $201,X
+       STA     $203,X
+       STB     $302,X
+THT1X  RTS
+*
+*OFF BACKWARDS THRUST
+*
+THOFF1 LDU     PLAXC
+       CLRB
+       LDX     #0
+       LEAY    ,X
+       LEAU    $806,U
+       PSHU    B,X,Y
+       STX     $101,U
+       STB     $103,U
+       STX     $201,U
+       STB     $203,U
+       STB     $302,U
+       RTS
+*
+*OFF OLD THRUST
+*
+THOFF  LDU     PLAXC
+       CLRB
+       LDX     #0
+       LEAY    ,X
+       LEAU    -$100+6,U
+       PSHU    X,Y,B
+       STX     -$100+1,U
+       STB     -$100+3,U
+       STX     -$200+1,U
+       STB     -$200+3,U
+       STB     -$300+2,U
+       RTS
+*
+*PLAYER DISPLAY
+*
+PRDISP STA     TEMP48
+       LDA     STATUS
+       BITA    #$10
+       BNE     PRDX
+       LDA     TEMP48
+       CMPA    PLAYC
+       BLS     PRDX
+       CMPB    PLAYC
+       BHI     PRDX
+       LDA     PLADIR
+       BMI     PRDSP1
+       JSR     POFF
+       JSR     THOFF
+       BRA     PRDSP2
+PRDSP1 JSR     POFF1
+       JSR     THOFF1
+PRDSP2 LDD     NPLAD
+       STD     PLADIR
+       BMI     PRDSP3
+       JSR     POUT
+       JSR     THOUT
+PRDX   RTS
+PRDSP3 JSR     POUT1
+       JMP     THOUT1
+*
+*PLAYER ON
+*
+POUT   LDY     #PLAPIC
+POUT2  LDA     PLAX16+1
+       ASLA
+       LDD     NPLAXC
+       STD     PLAXC
+       JMP     ON86
+POUT1  LDY     #PLBPIC
+       BRA     POUT2
+*
+*PLAYER OFF
+*
+POFF   EQU     *
+POFF1  LDD     PLAXC
+       JMP     OFF86
+*
+*PLAYER PROCESS
+*CALLED FORM IRQ
+*
+PLAYER LDA     STATUS  ATTRACT?
+       BITA    #$40
+       LBNE    PLAYX   YES
+*X DAMPING
+       CLR     ITEMP
+       LDD     PLAXV
+       COMA
+       COMB
+       ADDD    #1      NEGD
+       BPL     PL00
+       COM     ITEMP   SIGN EXTEND
+PL00   ASLB    SHIFT
+       ROLA
+       ASLB
+       ROLA
+       ADDD    PLAXV+1
+       STD     PLAXV+1
+       LDA     ITEMP
+       ADCA    PLAXV
+       STA     PLAXV
+       LDD     PLAXV
+       LDA     PIA21   ACCEL?
+       BITA    #$02
+       BEQ     PLAY1   NO
+       CLR     ITEMP
+       LDD     PLADIR
+       BPL     PL02
+       COM     ITEMP
+PL02   ADDD    PLAXV+1
+       STD     PLAXV+1
+       LDA     ITEMP
+       ADCA    PLAXV
+       STA     PLAXV
+*VELOCITY MAPPING X MOTION
+PLAY1  LDD     PLAXV   GET 5 BIT VELOCITY
+       ASRA
+       RORB
+       ASRA
+       RORB
+       CLRA
+       ASRB
+       RORA
+       STA     PCX+1
+       STB     PCX
+       LDA     PLADIR  +DIR?
+       BMI     PV1     NO
+       LDA     #$20    +BASE
+       TSTB    +VEL?
+       BMI     PV1A    NO
+       BRA     PV2
+PV1    LDA     #$70    -BASE
+       TSTB    -VEL?
+       BMI     PV2     YES
+PV1A   CLR     PCX+1
+       CLR     PCX
+PV2    LDB     PCX+1
+       ADDA    PCX     CALCULATED POSITION
+       STA     PCX
+PV2A   SUBD    PLAX16  ACTUAL POS
+       BEQ     PV9     NO DIFF
+       BLO     PV3
+       CMPD    #$100   IN RANGE?
+       BLS     PV9
+       LDD     #$40
+       STD     BGDELT
+       LDD     #$100
+       ADDD    PLAX16
+       BRA     PV10
+PV3    CMPD    #-$100
+       BGT     PV9     YES IN RANGE
+       LDD     #-$40   NO
+       STD     BGDELT
+       LDD     #-$100
+       ADDD    PLAX16  ADJUST SLIDE
+       BRA     PV10
+PV9    CLRD
+       STD     BGDELT  NO ADJUST NEEDED
+       LDD     PCX     WERE OK
+PV10   STD     PLAX16
+       STA     NPLAXC
+       LDD     BGL
+       STD     BGLX
+       LDD     PLAXV
+       CMPD    #$0100  MAX VEL
+       BLT     PV11
+       LDD     #$0100
+PV11   CMPD    #-$0100
+       BGT     PV12
+       LDD     #-$0100
+PV12   STD     PLAXV
+       ADDD    BGL
+       SUBD    BGDELT
+       STD     BGL
+*PLAYER ABSOLUTE X COORD
+       LDD     PLAX16
+       LSRA
+       RORB
+       LSRA
+       RORB
+       ANDB    #$E0
+       ADDD    BGL
+       STD     PLABX
+*VERTICAL MOTION
+       LDB     PLAY16  GET ADDR FOR LIMIT CHK
+       LDA     PIA31   UP?
+       LSRA
+       BCS     PLAUP   YES
+       LDA     PIA21
+       BMI     PLADN   DOWN
+       LDD     #0
+       BRA     PYV1
+PLAUP  CMPB    #YMIN+1
+       BLS     PLAYX
+       LDD     PLAYV
+       BPL     PLAUP1
+       ADDD    #-8
+       CMPD    #-$200
+       BGE     PYV1
+       LDD     #-$200
+       BRA     PYV1
+PLAUP1 LDD     #-$100
+       BRA     PYV1
+PLADN  CMPB    #238
+       BHS     PLAYX
+       LDD     PLAYV
+       BLE     PLADN1
+       ADDD    #8
+       CMPD    #$200
+       BLS     PYV1
+       LDD     #$200
+       BRA     PYV1
+PLADN1 LDD     #$100
+       BRA     PYV1
+PYV1   STD     PLAYV
+       ADDD    PLAY16
+       STD     PLAY16
+       STA     NPLAYC
+PLAYX  RTS
+*
+*VELOCITY ADDITION
+*
+VELO   LDA     STATUS
+       BITA    #$20
+       BNE     VELOX   DISABLED
+       LDX     #OPTR
+       BRA     VELLP
+VELOLP LDD     OX16,X  UPDATE X
+       ADDD    OXV,X
+VELO2  STD     OX16,X
+       LDD     OY16,X
+       ADDD    OYV,X
+       CMPA    #YMIN
+       BHS     VELO3
+       LDA     #YMAX
+VELO3  CMPA    #YMAX
+       BLS     VELO4
+       LDA     #YMIN
+VELO4  STD     OY16,X
+VELLP  LDX     ,X
+       BNE     VELOLP
+VELOX  RTS
+*
+*OBJECT PROCESSING
+*
+OPROC  PSHS    D       SAVE LIMITS
+       LDA     STATUS
+       BITA    #$20
+       BNE     OPRX    NO
+       LDX     #OPTR
+       BRA     OPLP
+*ERASE OLD OBJECT
+OPLP0  LDD     OBJX,X
+       BEQ     OPON    ALREADY ERASED
+       CMPB    ,S      TOO HIGH Y?
+       BHI     OPLP    YES
+       CMPB    1,S     Y TOO LOW?
+       BLS     OPLP    YES
+       LDY     OPICT,X
+       JSR     [OBJDEL,Y]
+       CLRD
+       STD     OBJX,X  OFF OBJECT
+*ON NEW OBJECT
+OPON   LDB     OY16,X  CAN WE WRITE
+       CMPB    ,S      UPPER BOUND
+       BHI     OPLP
+       CMPB    1,S
+       BLS     OPLP    NO
+*CHECK ON SCREEN
+       LDD     OX16,X
+       SUBD    BGL
+       CMPD    #150*64
+       BHS     OPLP    OFF SCREEN
+       LDY     OPICT,X GET PICT
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ADDA    OBJW,Y  OVER WIDTH PROTECTION
+       CMPA    #$9C
+       BHI     OPLP
+       SUBA    OBJW,Y
+       ASLB            SAVE PHASE
+       LDB     OY16,X
+       STD     OBJX,X  STORE NEW COORDES
+       JSR     [OBJWRT,Y]
+OPLP   LDX     OLINK,X
+       BNE     OPLP0   CHECK THE REST
+OPRX   PULS    D,PC
+
+*
+*GET A SHELL
+*X=OBJECT FIRING, RETURNED PTR TO SHELL
+*U= OBJID
+*RET=OUPUT ROUTINE
+*RET+2=COLLISION PICT
+*RET+4= KILL ROUTINE
+*RET+6= RET
+*
+GETSHL PSHS    D,Y,U
+       LDA     BMBCNT  SHOT LIMIT
+       CMPA    #20
+       BHS     STSHX
+       LDD     OX16,X
+       SUBD    BGL
+       CMPD    #150*64
+       BHS     STSHX   OFF SCREEN CHECK
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       LDB     OY16,X
+       CMPB    #YMIN
+       BLS     STSHX
+       LDX     OFREE
+       BEQ     STSHX
+       STD     OBJX,X
+       STD     OX16,X
+       EXG     A,B
+       STD     OY16,X
+       STU     OBJID,X
+       CLRD
+       STD     OXV,X
+       STD     OYV,X
+       LDU     6,S
+       PULU    D,Y
+       STD     OBJCOL,X
+       STY     OPICT,X
+       PULU    D
+       STU     6,S     NEW RET ADDR
+       STD     OCVECT,X
+       LDA     #20     DEFAULT LIFETIME
+       STA     ODATA,X
+       STA     ODATA+1,X ALIVE
+       LDD     OLINK,X
+       STD     OFREE
+       LDD     SPTR
+       STD     OLINK,X
+       INC     BMBCNT  KICK COUNTER
+       STX     SPTR    LINK HIM IN
+       PULS    D,Y,U,PC
+STSHX  LDU     6,S     GET RETURN ADDR
+       LEAU    6,U
+       STU     6,S
+       CLRA
+       PULS    D,Y,U,PC
+*
+*SHELL OUTPUT
+*OBJCOL=OUTPUT ROUTINE
+*ODATA=TIMER
+*ODATA+1=DEAD OR NOT
+SHELL  LDA     STATUS
+       BITA    #$20
+       BNE     SHELLX
+       LDD     BGL     CLAC SCROLL
+       ANDB    #$E0
+       STD     SHTEMP
+       LDD     BGLX
+       ANDB    #$E0
+       SUBD    SHTEMP
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       STD     SHTEMP
+       LDX     #SPTR   PROC BUGGERS
+       BRA     SHELLP
+SHELL1 LDY     OBJX,X  ERASE ADDR
+       LDD     OYV,X
+       ADDD    OY16,X
+       CMPA    #YMIN
+       BLS     SHBD    DEAD
+       STD     OY16,X
+       LDD     OXV,X
+       ADDD    SHTEMP
+       ADDD    OX16,X
+       CMPA    #$98
+       BHS     SHBD    DEAD
+       STD     OX16,X
+       LDB     OY16,X
+       STD     OBJX,X  NEW X
+       LDU     OBJX,X
+       JMP     [OBJCOL,X] OUTPUT
+SHELLP LDX     ,X
+       BNE     SHELL1
+SHELLX RTS
+*BOMB OUTPUT
+BMBOUT LDU     BAX
+       LDB     OX16+1,X FLAVOR
+       BPL     SHB1    ODD?
+       LEAU    6,U
+SHB1   LDD     #0      CLEAR IT
+       STD     ,Y
+       STA     2,Y
+       STD     $100,Y
+       STA     $102,Y
+       LDY     OBJX,X
+       LDD     ,U
+       STD     ,Y
+       LDD     2,U
+       STA     2,Y
+       STB     $100,Y
+       LDD     4,U
+       STD     $101,Y
+       BRA     SHELLP
+SHBD   CLRD            KILL AND ERASE
+       STA     ODATA+1,X
+       STD     ,Y
+       STA     2,Y
+       STD     $100,Y
+       STA     $102,Y
+       BRA     SHELLP
+*FIREBALL MINI
+FBOUT  LDU     FBX
+       LDB     OX16+1,X
+       ASLB
+       LDD     #0
+       STD     ,Y
+       STA     2,Y
+       STD     $100,Y
+       STA     $102,Y
+       LDY     OBJX,X
+       BCS     SHFB1   ODD
+       LDD     ,U
+       ANDA    #$0F
+       STD     ,Y
+       LDD     2,U
+       ANDA    #$0F
+       STA     2,Y
+       ANDB    #$F0
+       STB     $101,Y
+       JMP     SHELLP
+SHFB1  LDD     ,U
+       ANDB    #$0F
+       STB     1,Y
+       ANDA    #$F0
+       STA     $102,Y
+       LDD     2,U
+       ANDA    #$F0
+       STD     $100,Y
+       JMP     SHELLP
+*BOMB COLLISION
+BKIL   LDD     #$25
+       JSR     SCORE
+       DEC     BMBCNT
+       JSR     KILSHL
+       JSR     OFSHIT
+       LDD     OX16,X
+       LSRA
+       RORB
+       LSRA
+       RORB
+       ADDD    BGL
+       STD     OX16,X
+       LDA     OY16,X
+       SUBA    #2
+       STA     OY16,X
+       LDD     #BXPIC
+       STD     OPICT,X
+       JSR     XSVCT
+       LDD     #AHSND
+       JMP     SNDLD
+       FCB     $5E     CKBYTCHECKSUM  E000-E800(ACTUAL)
+*
+*FIREBALL TABLE INIT
+*
+FBINIT LDX     #FBTAB
+       STX     FBX
+FBI0   LDB     #$0A
+       JSR     RAND
+       BMI     FBI1
+       LDB     #$09
+FBI1   LSRA
+       BCS     FBI2
+       ADDB    #$A0
+       BRA     FBIL
+FBI2   ADDB    #$90
+FBIL   STB     ,X+
+       CMPX    #FBTEND
+       BNE     FBI0
+       RTS
+*
+*SCAN SHELL LIST FOR INACTIVES
+*
+SHSCAN LDX     #SPTR
+       BRA     SHSCLP
+SHSC1  LDA     ODATA+1,X
+       BEQ     SHSCK
+       DEC     ODATA,X
+       BNE     SHSCLP
+SHSCK  LDU     OLINK,X
+       STU     ,Y
+       LDU     OFREE
+       STU     OLINK,X
+       STX     OFREE
+       JSR     OFSHIT
+       DEC     BMBCNT
+       LEAX    ,Y
+SHSCLP LEAY    ,X
+       LDX     ,X
+       BNE     SHSC1
+       RTS
+*
+*FIRE LASER
+*
+LFIRE  LDA     LFLG
+       CMPA    #4
+       BHS     LFIREX
+       INC     LFLG
+       LDD     #LASSND
+       JSR     SNDLD
+       LDX     NPLAXC
+       LDA     NPLAD
+       BPL     LASR
+       JMP     LASL
+LFIREX JMP     SUCIDE
+*
+*LASER COLLISION
+*D=TOP LEFT COORD
+*EQ=NO CRASH,NE=CRASH
+LCOL   PSHS    U,D
+       LDA     #2      SELECT CHARS
+       STA     MAPCR
+       STA     MAPC
+       PULS    D
+       NOP     PATCH   SPACE DECB FOR 3 WIDE
+       NOP
+       NOP
+       LDU     #LASP1
+       JSR     COLIDE
+       PULS    U,PC
+*
+*RIGHT LASER
+*
+LASR   LEAX    $704,X
+       STX     PD,U
+       STX     PD+2,U
+       STX     PD+4,U
+LASR0  LDA     STATUS
+       BITA    #$40
+       BNE     LRDIE
+       LDA     #4
+       LDX     PD,U
+       LDB     #$11
+       CMPX    #$9800
+       BHS     LRDIE
+LASR1  STB     ,X
+       LEAX    $100,X
+       DECA
+       BNE     LASR1
+       LDB     #$99
+       STB     ,X
+       STX     PD,U
+       LDY     FISX
+       CMPY    #FISEND-3
+       BLO     LASR2
+       LDY     #FISTAB
+LASR2  LDX     PD+2,U
+       LDA     #3
+LASR3  LDB     ,Y+
+       STB     ,X
+       LEAX    $100,X
+       DECA
+       BNE     LASR3
+       STY     FISX
+       STX     PD+2,U
+       CLR     [PD+4,U]
+       INC     PD+4,U
+       LDD     PD,U
+       SUBA    #$06
+       BSR     LCOL
+       BNE     LRDIE
+       NAP     1,LASR0
+LRDIE  LDX     PD+4,U
+       CLRA
+LRDLP  STA     ,X
+       LEAX    $100,X
+       CMPX    PD,U
+       BLS     LRDLP
+       BRA     LASD
+*
+*LEFT LASER
+*
+LASL   LEAX    4,X
+       STX     PD,U
+       STX     PD+2,U
+       STX     PD+4,U
+LASL0  LDA     STATUS
+       BITA    #$40
+       BNE     LLDIE
+       LDA     #4
+       LDX     PD,U
+       LDB     #$11
+       CMPX    #$0500
+       BLS     LLDIE
+LASL1  STB     ,X
+       LEAX    -$100,X
+       DECA
+       BNE     LASL1
+       LDB     #$99
+       STB     ,X
+       STX     PD,U
+       LDY     FISX
+       CMPY    #FISEND-3
+       BLO     LASL2
+       LDY     #FISTAB
+LASL2  LDX     PD+2,U
+       LDA     #3
+LASL3  LDB     ,Y+
+       STB     ,X
+       LEAX    -$100,X
+       DECA
+       BNE     LASL3
+       STY     FISX
+       STX     PD+2,U
+       CLR     [PD+4,U]
+       DEC     PD+4,U
+       LDD     PD,U
+       JSR     LCOL
+       BNE     LLDIE
+       NAP     1,LASL0
+LLDIE  LDX     PD+4,U
+       CLRA
+LLDLP  STA     ,X
+       LEAX    -$100,X
+       CMPX    PD,U
+       BHS     LLDLP
+LASD   DEC     LFLG
+       JMP     SUCIDE
+*
+*
+FISS   LDX     #FISTAB
+       STX     FISX
+FISS0  JSR     RAND
+       CLRB
+       LSRA
+       BCC     F1
+       ADDB    #$01
+F1     LSRA
+       BCC     F2
+       ADDB    #$10
+F2     STB     ,X+
+       CMPX    #FISEND
+       BNE     FISS0
+       RTS
+*
+*COLLISION DETECT
+*U=PICTURE DESC, D=UL COORD X,Y
+*X=OBJECT DESC
+COLIDE LDX     #OPTR
+COL0   STD     ULX     CALC LOWER RT
+       ADDD    OBJW,U
+       STD     LRX     LR CORNER OF PLAYER
+       BRA     COLLP
+COL1   LDD     OBJX,X
+       BEQ     COLLP   OFF SCREEN
+       CMPA    LRX
+       BHS     COLLP
+       CMPB    LRY
+       BHS     COLLP
+       ADDD    [OPICT,X] CALC LR
+       CMPA    ULX
+       BLS     COLLP
+       CMPB    ULY
+       BHI     IC1     CHECK INTERSECTION
+COLLP  LDX     OLINK,X
+       BNE     COL1
+       RTS             RET EQ
+*
+*COMPARE FOR PICTURE INTERSECTION
+*FIND UPPERMOST
+IC1    STU     CTEMP2  SAVE PLAYER DESC
+       LDY     OPICT,X
+       SUBD    ,Y      SAVE OBJX FROM IRQ
+       STD     XTEMP
+       CLRD            CLEAR OFFSETS
+       STD     OX1     GET OBJECT
+       STD     PX1     PLAYER
+       LDD     XTEMP
+       SUBB    ULY     FIND UPERMOST
+       BHI     IC10    PLAYER UPPERMOST
+       NEGB
+       STB     OY1     OBJECT UPPERMOST
+       BRA     IC2
+IC10   STB     PY1
+*FIND LEFTMOST
+IC2    SUBA    ULX
+       BHI     IC20    PLAYER LEFTMOST
+       NEGA
+       STA     OX1     OBJECT LEFTMOST
+       BRA     IC3
+IC20   STA     PX1
+*FIND LOWERMOST
+*CALC OY2
+IC3    LDD     XTEMP   GET OBJX
+       ADDD    OBJW,Y
+       SUBB    LRY
+       BHI     IC4     OBJECT LOWEST
+       CLRB            PLAYER LOWEST
+*FIND RIGHTMOST
+*CALC OX2
+IC4    SUBA    LRX
+       BHI     IC40    OBJECT RIGHTMOST
+       CLRA            PLAYER RIGHTMOST
+*CALC X,Y COUNT
+IC40   STD     CTEMP   SAVE
+       LDD     OBJW,Y  GET WIDTH,HEIGHT
+       SUBD    OX1     OX1,OY1
+       SUBD    CTEMP   OX2,OY2
+       STD     XCNT    XCNT,YCNT
+*INIT SCAN PARAMETERS
+*Y=OBJECT ADDR
+*U=PLAYER ADDR
+       LDA     OBJH,U
+       STA     PLHT
+       LDB     PX1
+       MUL
+       LDU     OBJP0,U
+       LEAU    D,U     INIT PLAYER INDEXSH
+       LDA     OBJH,Y
+       STA     OBHT
+       LDY     OBJP0,Y GET PICT DATA
+       LDB     OX1
+       MUL
+       LEAY    D,Y     INIT OBJECT INDEX
+       LDA     OY1
+       LEAY    A,Y
+       LDA     PY1
+       LEAU    A,U
+IC5    LDB     YCNT
+       DECB
+IC50   LDA     B,U
+       BEQ     IC6
+       LDA     B,Y     CHECK
+       BEQ     IC6
+*FIND CENTER OF EXPLOSION ON SCREEN
+       LEAY    B,Y
+       TFR     Y,D
+       LDU     OPICT,X GET ROM PTR
+       SUBD    OBJP0,U FIND DATA OFFSET
+       LDY     OBJX,X  SCREEN TOP LEFT
+*CALC COLUMN OFFSET
+FC1    SUBB    OBJH,U
+       SBCA    #0
+       BCS     FC2
+       LEAY    $100,Y
+       BRA     FC1
+FC2    ADDB    OBJH,U  CORRECT OVER SUBTRACT
+       ADCA    #0
+       LEAY    B,Y     VERT OFFSET
+       STY     CENTMP  SCREEN COLLISION ADDR
+       JSR     [OCVECT,X]
+       LDA     #1
+       RTS             HIT
+IC6    DECB
+       BPL     IC50    NOT FINISHED COLUMN
+       LDD     OBHT    GET OBHT,PLHT
+       LEAY    A,Y
+       LEAU    B,U
+       DEC     XCNT
+       BNE     IC5
+       LDU     CTEMP2
+       JMP     COLLP
+*
+*COLOR THE LASER
+*
+COLR   CLR     LCOLRX
+COLRLP LDX     #COLTAB
+       LDA     LCOLRX
+COLR0  LDB     A,X
+       BEQ     COLR
+COLR1  INC     LCOLRX
+       STB     PCRAM+1
+       LDA     #2
+       LDX     #COLRLP
+       JMP     SLEEP
+*
+*COLOR TABLE
+*
+COLTAB FCB     $38,$39,$3A,$3B,$3C
+       FCB     $3D,$3E,$3F,$37,$2F,$27,$1F,$17
+       FCB     $47,$47,$87,$87,$C7,$C7
+       FCB     $C6,$C5,$CC,$CB,$CA,$DA,$E8,$F8
+       FCB     $F9,$FA,$FB,$FD,$FF,$BF,$3F,$3E
+       FCB     $3C,0
+*
+*EXECUTIVE LOOP
+*
+EXEC   LDX     #ACTIVE
+       STX     CRPROC
+EXEC0  LDA     TIMER
+       BEQ     EXEC0
+       CLR     TIMER
+       LDB     STATUS
+       BITB    #$7D
+       BEQ     EXEC00
+       CLR     OVCNT
+       BRA     EXEC1
+EXEC00 ASLA
+       ADDA    OVCNT
+       SUBA    #4
+       BPL     EXEC01
+       CLRA
+EXEC01 STA     OVCNT
+       CMPA    #2
+       BLO     EXEC1
+       LDB     #3
+       STB     STRCNT  CUT DOWN STARS
+       CMPA    #2      OVERLOAD MAX
+       BLS     EXEC1
+       LDA     #2
+       STA     OVCNT
+*OVERLOAD WIPE OUT A GUY
+       LDY     #OPTR
+EXEC02 LDX     ,Y
+       BEQ     EXEC1
+       LDA     OTYP,X  DONT TOUCH THIS GUY
+       BEQ     EXEC03
+       LEAY    ,X
+       BRA     EXEC02
+EXEC03 LDU     ,X
+       STU     Y
+       LDD     SEED
+       ANDA    #$3F
+       ADDA    #$60
+       ADDD    OX16,X
+       STD     OX16,X  HYPER HIM OUT OF THERE
+       JSR     OFSHIT
+       LDD     #0
+       STD     OBJX,X
+       LDU     IPTR
+       STX     IPTR
+       STU     ,X      INTO INACTIVE LIST
+EXEC1  LDA     #2
+       STA     MAPCR
+       STA     MAPC
+       BSR     COLCHK
+       JSR     XUVCT
+       JSR     RAND    UPDATE RANDOMS
+*
+*SWITCH PROCESSING
+*
+SWP    LDX     SWPROC
+       BNE     SWP1
+       LDX     SWPROC+4
+       BEQ     SWPX
+       LDD     SWPROC+6
+       CLR     SWPROC+4
+       CLR     SWPROC+5
+       BRA     SWP3
+SWP1   LDD     SWPROC+2
+       CLR     SWPROC
+       CLR     SWPROC+1
+SWP3   ANDB    STATUS
+       BNE     SWP
+       JSR     MKPROC
+       BRA     SWP
+SWPX   EQU     *
+*
+*PROCESS DISPATCH
+*
+DISP   LDU     #ACTIVE
+       BRA     DISP2
+DISP1  DEC     PTIME,U
+       BNE     DISP2
+       STU     CRPROC
+       JMP     [PADDR,U]
+DISP2  LDU     ,U
+       BNE     DISP1
+       LDS     #HSTK
+       JMP     EXEC
+*
+*COLLISION CHECK
+*
+COLCHK LDA     STATUS
+       BITA    #$10
+       BNE     COLCX
+       LDD     PLAXC   PLAYER
+       LDU     #PLAPIC
+       TST     PLADIR
+       BPL     COLC1
+       LDU     #PLBPIC
+COLC1  PSHS    D,U
+       INC     PCFLG
+       JSR     COLIDE
+       PULS    D,U
+       BNE     COLC2
+       LDX     #SPTR
+       JSR     COL0
+       BEQ     COLCX
+COLC2  NEWP    PLEND,STYPE
+       LDA     STATUS
+       ORA     #$8
+       STA     STATUS
+COLCX  CLR     PCFLG
+       RTS
+*
+*REVERSE
+*
+REV    LDA     REVFLG
+       BNE     REVX
+       INC     REVFLG
+       LDD     PLADIR
+       COMB
+       COMA
+       ADDD    #1
+       STD     NPLAD
+REV1   NAP     2,REV2
+REV2   LDA     PIA21
+       BITA    #$40
+       BNE     REV1
+       NAP     5,REVX1
+REVX1  CLR     REVFLG
+REVX   JMP     SUCIDE
+*
+*SMART BOMB
+*
+SBOMB  LDA     SBFLG
+       BNE     SBMBX2
+       LDX     PLRX
+       LDA     PSBC,X
+       BEQ     SBMBX2
+       INC     SBFLG
+       DEC     PSBC,X
+       JSR     SBDISP
+       LDD     #SBSND
+       JSR     SNDLD
+SBMB00 LDX     OPTR
+SBMB0  BEQ     SBMBX
+       LDD     OBJX,X
+       BEQ     SBMB2
+       LDA     OTYP,X
+       CMPA    #$02
+       BHS     SBMB2
+       JSR     [OCVECT,X]
+       BRA     SBMB00
+SBMB2  LDX     ,X
+       BRA     SBMB0
+SBMBX  LDU     CRPROC
+       LDA     #4      SCREEN FLASHES/2
+       STA     PD,U
+SBMBX0 COM     PCRAM
+       NAP     2,SBMBX1
+SBMBX1 DEC     PD,U
+       BNE     SBMBX0
+SBX10  NAP     10,SBX1A SWITCH DEBOUNCE
+SBX1A  LDA     PIA21
+       BITA    #$4
+       BNE     SBX10
+       NAP     10,SBX2A
+SBX2A  CLR     SBFLG
+SBMBX2 JMP     SUCIDE
+*
+*HYPERSPACE
+*
+HYPER  LDA     STATUS
+       BITA    #$FD
+       LBNE    HYPX    NO GO
+       LDA     #$77
+       STA     STATUS
+       JSR     SCLR1
+       NAP     15,HYP02
+HYP02  LDX     SPTR    KILL BULLETS
+       BEQ     KB2
+       JSR     KILSHL
+       BRA     HYP02
+KB2    CLR     BMBCNT
+       LDD     SEED
+       STD     BGL
+       STD     BGLX
+*RANDOM HYPER DIRECTION
+       LSRB
+       BCC     HYP0
+       LDD     #$2000
+       LDX     #$0300
+       BRA     HYP00
+HYP0   LDX     #-$0300
+       LDD     #$7000
+HYP00  STD     PLAX16
+       STX     NPLAD
+       LDB     HSEED
+       LSRB
+       ADDB    #YMIN
+       STB     PLAY16
+       STD     NPLAXC
+       CLRD
+       STA     PLAXV+2
+       STD     PLAXV
+       STD     PLAYV
+       JSR     BGI
+*APPEAR PLAYER
+       LDB     #$50
+       JSR     STCHK0
+       OBI     PLAPIC,NOKILL,$0000 CREATE PHONY OBJECT
+       LDD     #0
+       STD     OXV,X
+       STD     OYV,X
+       LDD     PLAY16
+       STD     OY16,X
+       LDD     PLAX16
+       LSRA
+       RORB
+       LSRA
+       RORB
+       ADDD    BGL
+       STD     OX16,X
+       LDA     NPLAD
+       BPL     HYP1
+       LDU     #PLBPIC REV IMAGE
+       STU     OPICT,X
+HYP1   LDU     CRPROC
+       STX     PD,U
+       JSR     APVCT
+       NAP     $28,HYP2
+HYP2   LDX     PD,U
+       JSR     KILOFF
+       JSR     STCHK   RESET STATUS
+       LDA     LSEED   DEAD?
+       CMPA    #192
+       LBHI    PLEND   YAHMAHN
+HYPX   JMP     SUCIDE
+*
+*THRUST PROCESS
+*
+THPROC LDX     THX
+       LEAX    1,X
+       CMPX    #THTAB+32
+       BLS     THPR1
+       LDX     #THTAB
+THPR1  STX     THX
+       LDX     FBX
+       LEAX    1,X
+       CMPX    #FBTAB+24
+       BLS     THPR2
+       LDX     #FBTAB
+THPR2  STX     FBX
+       NAP     4,THPROC
+*
+*SCANNING PROCESS
+*MAINTAINANCE OF ACTIVE,INACTIVE OBJECT LISTS
+*SCANNER DISPLAY
+*
+SCPROC JSR     ISCAN
+       NAP     2,SCP1
+SCP1   JSR     OSCAN
+       JSR     SHSCAN
+       NAP     2,SCP2
+SCP2   JSR     MAPCH1
+       JSR     SCNRV
+       NAP     4,SCPROC
+*
+*SCAN ACTIVE OBJECTS FOR OFF SCREEN AREA
+*
+OSCAN  LDD     BGL
+       SUBD    #100*32
+       STD     XTEMP
+       LDX     #OPTR
+       BRA     OSCLP
+OSC1   LDD     OX16,X
+       SUBD    XTEMP
+       CMPD    #500*32
+       BLO     OSCLP   IN SCREEN AREA
+       LDU     OLINK,X NO,MOVE TO INACTIVE LIST
+       STU     ,Y
+       LDU     IPTR
+       STU     OLINK,X
+       STX     IPTR
+       LEAX    ,Y      X TO NEXT
+OSCLP  LEAY    ,X
+       LDX     ,X
+       BNE     OSC1
+       RTS
+*
+*SCAN INACTIVE OBJECTS FOR ON SCREEN
+*
+ISCAN  LDD     BGL
+       SUBD    #100*32 100 PIXEL LEFT BUFFER
+       STD     XTEMP
+       LDX     #IPTR
+       BRA     ISCLP
+ISC1   LDD     OYV,X
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ADDD    OY16,X
+       CMPA    #YMIN   WRAP AROUND
+       BHS     SCYV3
+       LDA     #YMAX
+SCYV3  CMPA    #YMAX
+       BLS     SCYV4
+       LDA     #YMIN
+SCYV4  STD     OY16,X  ADD 8 TIMES VELOCITY
+       LDD     OXV,X   UPDATE X POSITION
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ADDD    OX16,X
+       STD     OX16,X
+       SUBD    XTEMP
+       CMPD    #500*32 IN SCREEN AREA
+       BHS     ISCLP   NO
+       LDU     OLINK,X YES, TRANSFER TO ACTIVE
+       STU     ,Y
+       LDU     OPTR
+       STU     OLINK,X
+       STX     OPTR
+       LEAX    ,Y
+ISCLP  LEAY    ,X
+       LDX     ,X
+       BNE     ISC1
+       RTS
+       FCB     $40 CKBYT CSUM E800-EFFF(ACTUAL)
diff --git a/src/DEFB6.SRC b/src/DEFB6.SRC
new file mode 100755 (executable)
index 0000000..1a94c4f
--- /dev/null
@@ -0,0 +1,2253 @@
+*
+*UFO PROCESS START
+*PD=OBJECT,PD2=SHOT TIMER
+*
+UFOST  NEWP    UFOLP,STYPE
+       LEAU    ,X
+       OBI     UFOP1,UFOKIL,$3333
+       STX     PD,U
+       STU     OBJID,X
+       LDD     SEED
+       ANDA    #$1F
+       ADDD    BGL
+       STD     OX16,X
+       LSRB
+       ADDB    #YMIN
+       STB     OY16,X
+       CLRA
+       CLRB
+       STD     OYV,X
+       STD     OXV,X
+       LDA     #8
+       STA     PD2,U   INIT SHOT TIMER
+       BSR     UFONV0
+       JMP     APVCT
+*UFO PROCESS
+UFOLP  LDX     PD,U
+       LDD     OPICT,X
+       CMPD    #NULOB
+       BEQ     UFO3
+       DEC     PD2,U
+       BNE     UFO1
+       LDA     UFSTIM
+       JSR     RMAX
+       STA     PD2,U
+       JSR     SHOOT
+       BEQ     UFO1
+       LDD     #USHSND
+       JSR     SNDLD
+UFO1   LDU     OPICT,X
+       LEAU    OBJL,U  CYCLE IMAGE
+       CMPU    #UFOP3
+       BLS     UFO2
+       LDU     #UFOP1
+       BSR     UFONV
+UFO2   STU     OPICT,X
+UFO3   NAP     6,UFOLP
+*
+*UFO VELOCITY
+*
+UFONV  LDA     SEED
+       CMPA    UFOSK
+       BLS     UFONVX
+UFONV0 LDD     #$4001
+       STD     XTEMP
+       LDD     OX16,X
+       SUBD    PLABX
+       BMI     UFONV1
+       NEG     XTEMP
+UFONV1 ADDD    #20*32  X CLOSE?
+       CMPD    #40*32
+       BLS     UFONV3  YES, DONT SEEK
+       LDB     XTEMP
+       SEX
+       ADDD    PLAXV
+       STD     OXV,X
+UFONV3 LDA     OY16,X
+       SUBA    PLAYC
+       BMI     UFONV4
+       NEG     XTEMP+1
+UFONV4 ADDA    #10
+       CMPA    #20     Y CLOSE?
+       BLS     UFONVX  YES, QUIT
+       CLRB
+       LDA     XTEMP+1
+       ADDD    PLAYV
+       ASRA            DIVIDE BY 2
+       RORB
+       STD     OYV,X
+UFONVX RTS
+*UFOKILL
+UFOKIL DEC     UFOCNT
+       KILP    0120,UFHSND
+       RTS
+*
+*PROBE START
+*A=#
+PRBST  STA     XTEMP
+PRBS1  OBI     PRBP1,PRBKIL,$CCCC
+       JSR     RAND
+       LDD     HSEED
+       ANDA    #$3F
+       ADDA    #$10
+       STD     OX16,X  INIT X
+       LSRB
+       ADDB    #YMIN
+       STB     OY16,X  INIT Y
+       LDB     SEED
+       ANDB    #$3F
+       ADDB    #-$20
+PRBS2  SEX
+       STD     OXV,X
+       LDB     LSEED
+       ANDB    #$7F
+       SUBB    #$40
+       SEX
+       BMI     PRBS3   MIN YV
+       ORB     #$20
+       BRA     PRBS4
+PRBS3  ANDB    #$DF
+PRBS4  STD     OYV,X
+       JSR     APVCT
+       DEC     XTEMP
+       BNE     PRBS1
+PRBSTX RTS
+*
+*KILL PROBE
+*
+PRBKIL KILO    0210,PRHSND
+       LDA     #6
+       JSR     RMAX
+       LEAY    ,X
+       JSR     MMSW
+       DEC     PRBCNT
+       RTS
+*
+*RANDOM VELOCITY
+*X=OBJECT
+RANDV  JSR     RAND
+       LDB     SEED
+       SEX
+       ASLB
+       ROLA    X2
+       STD     OYV,X
+       LDB     LSEED
+       ANDB    #$3F
+       ADDB    #-$20
+       SEX
+       STD     OXV,X
+       RTS
+*
+*MAKE A MINI SWARMER
+*Y=CENTER,A=#
+*
+MMSW   PSHS    D,X,Y,U
+       STA     XTEMP
+MMSLP  LDA     SWCNT
+       INCA
+       CMPA    #20
+       BHI     MMSWX   TOO MANY GUYS
+       STA     SWCNT
+       NEWP    MSWM,STYPE
+       LEAU    ,X
+       OBI     SWPIC1,MSWKIL,$2424
+       LDD     OX16,Y
+       STD     OX16,X
+       LDD     OY16,Y
+       STD     OY16,X
+       STX     PD,U
+       STU     OBJID,X
+       BSR     RANDV
+       LDD     HSEED
+       ANDB    SWAC    
+       STB     PD2,U   ACCEL
+       ANDA    #$1F
+       STA     PTIME,U
+       LDA     SWSTIM
+       JSR     RMAX
+       STA     PD4,U
+       STX     OPTR
+       DEC     XTEMP
+       BNE     MMSLP
+MMSWX  PULS    D,X,Y,U,PC
+*
+*MINI SWARM KILL
+*X=OBJECT
+MSWKIL DEC     SWCNT
+       JSR     KILOFF  
+       PSHS    X
+       JSR     KILLOP
+       PULS    X
+       LDD     OX16,X  
+       SUBD    #$40
+       STD     OX16,X
+       LDD     OY16,X
+       SUBA    #2
+       STA     OY16,X
+       LDU     #SWXP1
+       STU     OPICT,X
+       JSR     XSVCT
+       LDD     #$0115
+       JSR     SCORE
+       LDD     #SWHSND
+       JMP     SNDLD
+*
+*MINI SWARM PROCESS
+*PD=OBJECT,PD2 ACCELERATION,PD4=SHOT TIMER
+*
+MSWM   LDX     PD,U
+       LDB     SWXV
+       LDY     PLABX
+       CMPY    OX16,X
+       BHS     MSWM2
+       NEGB
+MSWM2  SEX
+       STD     OXV,X   X VELOCITY
+       BRA     MSWL
+MSWLP  LDB     PD2,U
+       LDX     PD,U
+       LDA     PLAYC   GET Y ACCEL
+       CMPA    OY16,X
+       BHI     MSWM3
+       NEGB
+MSWM3  SEX
+       ADDD    OYV,X
+       CMPD    #$0200
+       BLT     MSWM4
+       LDD     #$0200
+MSWM4  CMPD    #-$200
+       BGT     MSWM5
+       LDD     #-$200
+MSWM5  STD     OYV,X
+*DAMPING
+       COMA
+       COMB
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       TFR     A,B
+       SEX
+       ADDD    OYV,X
+       STD     OYV,X
+*RANDOM FACTOR
+       LDB     SEED
+       ANDB    #$1F
+       ADDB    #-$10
+       SEX
+       ADDD    OYV,X
+       STD     OYV,X
+       LDD     PLABX   PAST HIM?
+       SUBD    OX16,X
+       ADDD    #150*32
+MSP    CMPD    #300*32 WAY PAST?
+       BHI     MSWM    GO BACK + GIT IM
+*FIRE?
+MSWMF  DEC     PD4,U
+       BNE     MSWL
+       JSR     SWBMB   BOMB GUY
+MSWL   NAP     3,MSWLP
+*
+*SWARM BOMB
+*
+SWBMB  PSHS    X
+       LDD     PLABX
+       SUBD    OX16,X
+       EORA    OXV,X
+       BMI     SWBX    NOT HEADED FOR PLAYER
+       LEAY    ,X
+       SHL     FBOUT,BMBP1,BKIL
+       BEQ     SWBX
+       LDD     OXV,Y
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       STD     OXV,X
+       LDD     #SWSSND SWARMER SOUND
+       JSR     SNDLD
+       CLRB
+       LDA     PLAYC
+       SUBA    OY16,X
+SWB1   ASRA
+       RORB
+       ASRA
+       RORB
+       ASRA
+       RORB
+       ASRA
+       RORB
+       ASRA
+       RORB
+       STD     OYV,X
+SWBX   LDA     SWSTIM
+       JSR     RMAX
+       STA     PD4,U
+       PULS    X,PC
+*
+*ASTRONAUT PROCESS
+*WALK ON TERRAIN
+*PD =CURRENT INDEX TO TLIST
+*
+ASTRO  LDX     PD,U
+       LEAX    2,X
+       CMPX    #TLIST+32
+       BLO     ASTRO1
+       LDX     #TLIST
+ASTRO1 STX     PD,U
+       LDX     ,X
+       BEQ     ASTX    NOONE THERE
+       LDD     OBJX,X  ON SCREEN?
+       BEQ     ASTX    NOPE
+       LDD     OCVECT,X
+       CMPD    #ASTKIL
+       BNE     ASTX    CAPTURED
+       LDD     OPICT,X
+       CMPD    #ASTP2
+       BHI     ASTR    WALKING TO RIGHT
+*WALKING TO LEFT
+       LDA     SEED
+       CMPA    #8
+       BLS     ASTRX1  TURN AROUND
+       JSR     GETALT
+       ADDA    #4
+       CMPA    #$E8
+       BLS     ASTL1
+       LDA     #$E8
+ASTL1  LDB     #1
+       CMPA    OY16,X
+       BEQ     ASTL3
+       BHI     ASTL2
+       NEGB
+ASTL2  ADDB    OY16,X
+       STB     OY16,X  UP/DOWN
+ASTL3  LDU     OPICT,X TOGGLE IMAGE
+       LEAU    OBJL,U
+       CMPU    #ASTP2
+       BLS     ASTLX2
+ASTLX1 LDU     #ASTP1
+ASTLX2 LDB     #-$20   MOVE LEFT
+       BRA     ASTX1
+*WALKING TO RIGHT
+ASTR   LDA     SEED
+       CMPA    #$8
+       BLS     ASTLX1  TURN AROUND
+       BSR     GETALT
+       ADDA    #15
+       CMPA    #$E8
+       BLS     ASTR1
+       LDA     #$E8
+ASTR1  LDB     #1
+       CMPA    OY16,X
+       BEQ     ASTR3
+       BHI     ASTR2
+       NEGB
+ASTR2  ADDB    OY16,X
+       STB     OY16,X
+ASTR3  LDU     OPICT,X IMAGING
+       LEAU    OBJL,U
+       CMPU    #ASTP4
+       BLS     ASTRX2
+ASTRX1 LDU     #ASTP3
+ASTRX2 LDB     #$20
+ASTX1  STU     OPICT,X
+       SEX
+       ADDD    OX16,X
+       STD     OX16,X
+ASTX   NAP     2,ASTRO
+*
+*GET ALTITUDE
+*A=ALT,X=OBJ
+*
+GETALT PSHS    B,X
+       LDD     OX16,X
+       LSRA
+       RORB
+       LSRA
+       RORB
+       LSRA
+       RORB
+       LSRA
+       RORB
+       LSRA    
+       RORB
+       LSRA
+       RORB
+       LDX     #ALTBL
+       LDA     D,X
+       PULS    B,X,PC
+*
+*KILL ASTRO
+*X=OBJECT
+ASTKIL LDA     PCFLG   PLAYER?
+       BEQ     ASTK1
+       CLRA
+       PULS    D,PC    IGNORE
+ASTK1  BSR     ASTCLR
+       JSR     KILOFF
+       LDD     #ASXP1
+       STD     OPICT,X
+       LDD     OX16,X
+       SUBD    #$40
+       STD     OX16,X
+       JSR     XSVCT
+       LDD     #AHSND
+       JMP     SNDLD
+AKIL1  LDU     OBJID,X
+       BEQ     ASTKIL  NOT FALLING
+       LDA     PCFLG
+       BEQ     AKIL10  SHOT
+       LDD     PADDR,U 1ST TIME
+       CMPD    #AFALL2
+       BEQ     AKIL2
+       LDD     #ACSND
+       JSR     SNDLD
+       PSHS    X
+       NEWP    P500,STYPE
+       LEAY    ,X
+       PULS    X
+       STX     PD,Y    ASTRO OBJ-500 ROUTINE
+AKIL2  LDD     #AFALL2
+       STD     PADDR,U
+NOKILL CLRA
+       PULS    D,PC
+AKIL10 BSR     ASTK1
+       JMP     KILLOP
+*
+*CLEAR ASTRO FROM LIST
+*
+ASTCLR LEAY    ,X
+ASTC0  PSHS    X,U,A
+       LDU     #TLIST
+       LDA     #64
+ASTC1  CMPY    ,U++
+       BEQ     ASTC2
+       DECA    
+       BNE     ASTC1
+       JSR     ERROR
+ASTC2  CLRD
+       STD     -2,U
+       DEC     ASTCNT
+       BNE     ASTCX
+       NEWP    TERBLO,STYPE BLOW UP TERRAIN
+ASTCX  PULS    X,U,PC,A
+*
+*TERRAIN BLOW PROCESS
+*
+TERBLO LDA     STATUS
+       ORA     #2
+       STA     STATUS
+       CLR     PD,U    LOOP COUNT
+       JSR     MAPCH7
+       JSR     BGERAS
+*OFF SCANNER TERRAIN
+       LDX     #STETAB
+       LDU     #0
+       LDA     #64
+TBL1   STU     [,X++]
+       DECA
+       BNE     TBL1
+TBLP0  LDX     OFREE
+       LDD     #TEREX
+       STD     OPICT,X
+       LDB     #2
+       STB     XTEMP
+TBLP   JSR     RAND
+       ANDA    #$3F
+       ADDD    BGL
+       STD     OX16,X
+       JSR     GETALT
+       STA     OY16,X
+       SUBA    #10
+       JSR     XSVCT
+       DEC     XTEMP
+       BNE     TBLP
+       LDA     SEED
+       ANDA    #$1F
+       LDX     #COLTAB
+       LDA     A,X
+       STA     PCRAM
+       LDD     #AHSND  LIGHTNING BOLT
+       JSR     SNDLD
+       LDX     #TBL3
+       LDA     #2
+TBL2   LDB     #8
+       STB     OVCNT   PHONY OVERLOAD
+       JMP     SLEEP
+TBL3   CLR     PCRAM
+       LDA     PD,U    GET ITERATION
+       LSRA
+       LSRA
+       LSRA
+       INCA
+       JSR     RMAX    RANDOM SLEEP
+       LDX     #TBL4
+       BRA     TBL2
+TBL4   INC     PD,U
+       LDA     PD,U
+       CMPA    #16
+       BNE     TBLP0
+       LDD     #TBSND
+       JSR     SNDLD
+       JMP     SUCIDE
+*
+*250 POINT PROCESS
+*PD=ASTRO PROCESS
+*
+P250   OBI     C25P1,NOKILL,$0000
+       LDD     #$0125
+       BRA     P5000
+*
+*500 POINT PROCESS
+*X=EARTHLING OBJECT
+*
+P500   OBI     C5P1,NOKILL,$0000
+       LDD     #$0150
+P5000  JSR     SCORE
+       LDY     PD,U
+       LDD     PLAXV
+       STD     OXV,X
+       LDD     #0
+       STD     OYV,X
+       LDA     #$11
+       STA     OTYP,X
+       LDD     OX16,Y
+       STD     OX16,X
+       LDD     OY16,Y
+       BMI     P501
+       ADDD    #$1800
+       BRA     P502
+P501   SUBD    #$2000
+P502   STD     OY16,X
+       STX     OPTR
+       STX     PD,U    OBJECT INDEX
+       NAP     50,P503
+P503   LDX     PD,U
+       JSR     KILOFF
+       JMP     SUCIDE
+*
+*SHOOT AT PLAYER
+*X=OBJECT FIRING
+*
+SHOOT  PSHS    X
+       SHL     FBOUT,BMBP1,BKIL
+       BEQ     SHOOTX  NONE LEFT
+       LDB     SEED
+       ANDB    #$1F
+       ADDB    #-$10
+       ADDB    PLAXC
+       SUBB    OBJX,X
+       SEX
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       STD     OXV,X
+       LDB     SEED    REL?
+       CMPB    #120
+       BLS     SHOOT0  NO
+       LDD     PLAXV
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ADDD    OXV,X
+       STD     OXV,X
+SHOOT0 LDB     LSEED
+       ANDB    #$1F
+       ADDB    #-$10
+       ADDB    PLAYC
+       SUBB    OBJY,X
+       SEX
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       STD     OYV,X
+       LDA     #1      RETURN NE
+SHOOTX PULS    X,PC
+*
+*LANDER SHOOT
+*
+LSHOT  DEC     PD6,U
+       BNE     LSHTX
+       LDA     LDSTIM
+       JSR     RMAX
+       STA     PD6,U
+       BSR     SHOOT
+       BEQ     LSHTX
+       LDD     #LSHSND
+       JSR     SNDLD
+LSHTX  RTS
+*
+*START SCHITZOS
+*A=NUMBER
+*PD=X
+*PD2=SHOT TIMER
+*
+SCZST  PSHS    A
+       STA     XTEMP
+SCZS0  NEWP    SCZ0,STYPE
+       LEAU    ,X
+       OBI     SCZP1,SCZKIL,$CC33
+       JSR     RAND
+       LDD     BGL
+       SUBD    #300*32
+       STD     XTEMP2
+       LDD     HSEED
+       SUBD    XTEMP2
+       CMPD    #600*32
+       BHS     SCZS1
+       ADDD    #$8000
+SCZS1  ADDD    XTEMP2  AVOID PLAYER
+       STD     OX16,X
+       LDA     SEED
+       LSRA
+       ADDA    #YMIN
+       STA     OY16,X
+       CLRD
+       STD     OYV,X
+       STD     OXV,X
+       LDA     SZSTIM
+       JSR     RMAX
+       STA     PD,U
+       JSR     APVCT
+       STU     OBJID,X
+       STX     PD,U
+       INC     SCZCNT
+       DEC     XTEMP
+       BNE     SCZS0
+       PULS    A,PC
+*KILL SHITZO
+SCZKIL DEC     SCZCNT
+       KILP    0115,SCHSND
+       RTS
+*
+*GET TARGET FROM LIST
+*RET EQ IF NONE,D=TRG OBJECT
+*U=PROCESS
+GTARG  PSHS    X
+       LDA     ASTCNT
+       BEQ     GTX     NOBODY LEFT
+       LDX     TPTR
+GT1    LEAX    2,X
+       CMPX    #TLIST+64
+       BLO     GT2
+       LDX     #TLIST
+GT2    LDD     ,X
+       BNE     GT3
+       CMPX    TPTR    AROUND ONCE?
+       BNE     GT1
+       PULS    X,PC
+GT3    STX     TPTR    FOUND ONE
+       STD     PD2,U
+       STX     PD4,U
+GTX    PULS    X,PC
+*
+*START LANDERS
+*A=NUMBER
+*
+LANDST PSHS    A
+       STA     XTEMP
+LNDST0 TST     ASTCNT  NO MORE TARGETS
+       BNE     LNDST1
+       JMP     SCZS0
+LNDST1 NEWP    LANDS0,STYPE
+       LEAU    ,X
+       OBI     LNDP1,LKILL,$4433
+       JSR     RAND
+       LDD     HSEED
+       STD     OX16,X
+       LDA     #YMIN+2
+       STA     OY16,X
+       LDD     LNDYV
+       STD     OYV,X
+       LDA     LDSTIM  SHOOTING TIME
+       JSR     RMAX
+       STA     PD6,U
+       LDA     LNDXV
+       JSR     RMAX
+       TFR     A,B
+       CLRA
+       BITB    #1
+       BEQ     LNS2
+       COMB
+       COMA
+LNS2   STD     OXV,X
+       STU     OBJID,X
+       JSR     APVCT
+       STX     PD,U
+       BSR     GTARG
+       INC     LNDCNT
+       DEC     XTEMP
+       BNE     LNDST0
+LNDSTX PULS    A,PC
+*
+*LANDER KIDNAP
+*PD=OBJECT,PD2=TARGET,PD4=TLIST INDEX
+*PD6=SHOT TIMER
+LANDS0 LDX     PD,U
+       LDY     PD2,U
+       LDD     [PD4,U] TARGET ALIVE?
+       BEQ     LNDSAA
+       LDA     OCVECT+1,Y
+       CMPA    #ASTKIL!.$FF
+       BNE     LNDSAA  ORBIT
+       LDA     OX16,X
+       ANDA    #$FC
+       STA     XTEMP
+       LDA     OX16,Y
+       ANDA    #$FC
+       CMPA    XTEMP   CLOSE?
+       BEQ     LANDG0  GET IM
+       BRA     LANDSA
+LNDSAA LDA     OTYP,X  HYPERABLE
+       ANDA    #$FE
+       STA     OTYP,X
+       JSR     GTARG   RE:TARGET
+       LBEQ    SCZ00   NO, FREAK
+LANDSA JSR     GETALT
+       SUBA    #50
+       SUBA    OY16,X
+       BHI     LANDS1
+       CMPA    #-20
+       BLT     LNDS1   
+       CLRA
+       CLRB
+       BRA     LANDS2
+LNDS1  LDD     LNDYV
+       COMA
+       COMB
+       BRA     LANDS2
+LANDS1 LDD     LNDYV
+LANDS2 STD     OYV,X   NEW Y VEL
+       LDD     OPICT,X APPEARING?
+       CMPD    #NULOB
+       BEQ     LANDS4
+       JSR     LSHOT
+       LDU     OPICT,X NEW PICT
+       LEAU    OBJL,U
+       CMPU    #LNDP3
+       BLS     LANDS3
+       LDU     #LNDP1
+LANDS3 STU     OPICT,X
+LANDS4 NAP     6,LANDS0
+*LETS GET HIM
+LANDG0 CLRD
+       INC     OTYP,X  DONT HYPER ME
+       STD     OXV,X
+       STD     OYV,X
+       LDD     #LNDP1
+       STD     OPICT,X
+LANDG  LDX     PD,U
+       LDY     PD2,U
+       LDD     [PD4,U]
+       BEQ     LNDSAA  DEAD
+       LDA     OCVECT+1,Y
+       CMPA    #ASTKIL!.$FF
+       BNE     LNDSAA  TAKEN
+       LDD     OX16,Y
+       ANDB    #$E0
+       STD     XTEMP2
+       LDD     OX16,X
+       ANDB    #$E0
+       CMPD    XTEMP2
+       BEQ     LNDG2
+       BLT     LNDG1
+       LDB     #-$20
+       BRA     LANDG1
+LNDG1  LDB     #$20
+LANDG1 SEX
+       ADDD    OX16,X
+       STD     OX16,X
+LNDG2  LDA     OY16,Y
+       SUBA    #12
+       CMPA    OY16,X
+       BEQ     LANDG3
+       LDD     LNDYV
+       BHS     LANDG2
+       COMA
+       COMB
+LANDG2 ADDD    OY16,X
+       STD     OY16,X
+LNDG20 JSR     LSHOT
+       NAP     1,LANDG
+*ARE   WE      ON      HIM?
+LANDG3 LDD     OX16,X
+       ADDD    #$0040
+       SUBD    OX16,Y
+       CMPD    #$80
+       BHI     LNDG20  NOPE
+       LDD     #LKIL1  CHANGE KILL VECTOR
+       STD     OCVECT,X
+       LDD     LNDYV
+       COMB
+       COMA
+       STD     OYV,X   SPLIT
+       STD     OYV,Y
+       LDD     #LPKSND
+       JSR     SNDLD
+       LDD     #AKIL1
+       STD     OCVECT,Y
+*FLEE
+LANDF  LDU     CRPROC
+       LDX     PD,U
+       LDA     OY16,X
+       CMPA    #YMIN+8
+       BLS     LANDFX  ALL DONE
+       JSR     LSHOT
+       NAP     4,LANDF
+*PULL HIM INSIDE
+LANDFX LDD     #LSKSND
+       JSR     SNDLD
+LNDFXA LDX     PD,U
+       LDY     PD2,U
+       LDD     [PD4,U]
+       BNE     LNDFX0
+       JSR     KILOFF  GIVE UP
+       DEC     LNDCNT
+       INC     LNDRES
+       JMP     SUCIDE
+LNDFX0 CLRD
+       STD     OYV,X
+       STD     OYV,Y
+       LDA     OY16,Y
+       CMPA    OY16,X
+       BLS     LNDFX1
+       DEC     OY16,Y
+       LDA     #$12
+       JSR     SNDOUT
+       NAP     1,LNDFXA
+LNDFX1 LEAX    ,Y      KILL ASTRO
+       LDD     OBJX,Y  CENTER EARTHLING BLOW
+       ADDA    #1
+       STD     CENTMP
+       JSR     ASTK1
+SCZ00  DEC     LNDCNT
+       INC     SCZCNT
+       LDX     PD,U
+       CLR     OTYP,X  OK TO HYPER
+       LDD     #SCZP1
+       STD     OPICT,X
+       LDD     #$CC33
+       STD     OBJCOL,X
+       LDD     #SCZKIL
+       STD     OCVECT,X
+       LDA     SZSTIM
+       STA     PD2,U
+*
+*I AM SCHITZO I,M FEELING FINE
+*PD=OBJECT,PD2=SHOT TIME
+*
+SCZ0   LDX     PD,U
+       LDB     SZXV
+       LDY     PLABX
+       CMPY    OX16,X
+       BGE     SCZ1
+       NEGB
+SCZ1   SEX
+       STD     OXV,X   SEEK X
+       LDD     PLABX   X       CLOSE?
+       SUBD    OX16,X
+       ADDD    #380
+       CMPD    #$700
+       BLS     SCZ6    SEEK Y
+       LDA     PLAYC   AVOID Y
+       SUBA    OY16,X
+       BLS     SCZ2
+       CMPA    #8
+       BHI     SCZ3
+       LDD     SZYV
+       COMA
+       COMB
+       BRA     SCZ5
+SCZ2   CMPA    #-8
+       BGT     SCZ4
+SCZ3   CLRD
+       BRA     SCZ5
+SCZ4   LDD     SZYV
+SCZ5   STD     OYV,X
+       BRA     SCZ10
+SCZ6   LDA     PLAYC   SEEK Y
+       CMPA    OY16,X
+       LDD     SZYV
+       BHS     SCZ7
+       COMA
+       COMB
+SCZ7   STD     OYV,X
+       LDD     OBJX,X
+       BEQ     SCZ12   NOT ON SCREEN
+*RANDOM Y HOP
+SCZ10  LDB     SZRY
+       LDA     SEED
+       BMI     SCZ11
+       NEGB
+SCZ11  ADDB    OY16,X
+       CMPB    #YMIN
+       BHS     SCZ110
+       LDB     #YMAX
+SCZ110 STB     OY16,X
+       DEC     PD2,U   SHOT TIME
+       BNE     SCZ12
+       LDA     SZSTIM
+       JSR     RMAX
+       STA     PD2,U
+       JSR     SHOOT
+       BEQ     SCZ12
+       LDD     #SSHSND
+       JSR     SNDLD
+SCZ12  NAP     3,SCZ0
+*
+*KILL KIDNAPPING LANDER
+*
+LKIL1  LDU     OBJID,X GOT A PASSENGER?
+       LDD     [PD4,U]
+       BEQ     LKILL
+       LDD     #0
+       LDD     #0      SPACE SAVER FO SOUND CALL
+       PSHS    X
+       NEWP    AFALL,STYPE START HIM FALLING
+       LDU     PD2,U
+       STU     PD,X
+       LDD     #ASCSND
+       JSR     SNDLD   SCREAM.....
+       LDD     #0
+       STD     OYV,U
+       STX     OBJID,U
+       PULS    X
+*KILL LANDR
+LKILL  DEC     LNDCNT
+       KILP    0115,LHSND
+       RTS
+*
+*ASTRONAUT FALL
+*
+AFALL  LDX     PD,U
+       LDD     #8      ACCEL DOWNWARD
+       ADDD    OYV,X
+       CMPD    #$300
+       BHS     AFALL0
+       STD     OYV,X
+AFALL0 JSR     GETALT
+       CMPA    OY16,X  HIT GROUND?
+       BHI     AFALL1  NO
+       LDD     OYV,X
+       CMPD    #$E0    FATAL?
+       BLS     ALAND   NO
+       LDD     OBJX,X
+       ADDD    #$0107
+       STD     CENTMP  CENTER OF EXPLOSION
+       JSR     ASTK1
+       JMP     SUCIDE
+AFALL1 NAP     4,AFALL
+AFALL2 LDX     PD,U
+       LDD     #0
+       STD     OYV,X
+       LDA     PLAY16
+       ADDA    #10
+       STA     OY16,X
+       LDD     PLABX
+       ADDD    #$0080
+       STD     OX16,X
+       JSR     GETALT
+       CMPA    OY16,X
+       BLO     ALAND0  WERE ON THE GROUND
+       NAP     1,AFALL2
+ALAND  PSHS    X
+       LDX     #P250
+       BRA     ALND00
+ALAND0 PSHS    X
+       LDX     #P500
+ALND00 LDA     #STYPE
+       JSR     MKPROC
+       LEAY    ,X
+       PULS    X
+       STX     PD,Y    ASTRO OBJECT TO 500 PROC
+       LDD     #0
+       STD     OBJID,X
+       STD     OYV,X
+       LDD     #ASTKIL
+       STD     OCVECT,X
+       LDD     #ALSND
+       JSR     SNDLD
+       JMP     SUCIDE
+*
+*TIEST
+*A=# IN SQUAD 1-4
+*
+TIEST  STA     XTEMP
+       LDB     TIEXV
+       COM     TFLG    ALTERNATE DIRECTIONS
+       BMI     TIEST1
+       NEGB
+TIEST1 STB     XTEMP+1 X VELOCITY
+       LDX     #TIE
+       LDA     #STYPE
+       JSR     MSPROC  MAKE A SUPER PROCESS
+       LEAU    ,X      SAVE INDEX
+       LDA     XTEMP
+       STA     PD+8,U
+       CLRD
+       STD     PD,U
+       STD     PD2,U
+       STD     PD4,U
+       STD     PD6,U
+TIEST2 OBI     TIEP1,TIEKIL,$8888
+       LDB     XTEMP+1
+       SEX
+       STD     OXV,X
+       CLRD
+       STD     OYV,X
+       LDA     XTEMP   X SPACING
+       LSRA
+       RORB
+       ADDA    XTEMP
+       ADDD    PLABX
+       ADDA    #$80
+       STD     OX16,X
+       LDA     #$50
+       STA     OY16,X
+       STA     PD+9,U  CRUISE ALT
+       STU     OBJID,X
+       STX     OPTR
+       LDA     XTEMP
+       ASLA
+       ADDA    #PD-2
+       STX     A,U
+       DEC     XTEMP
+       BNE     TIEST2  
+TIESX  RTS
+*
+*TIE PROCESS
+*PD,PD2,PD4,PD6=TIES,0000=DEAD
+*PD8=#IN SQUAD,PD+9=CRUISE ALT
+*
+TIE    LDA     SEED    ADD RANDOM Y
+       ANDA    #$6
+       ADDA    #PD
+       LDX     A,U
+       LBEQ    TIEX    NONE THERE
+       LDB     SEED
+       LDA     #OBJL
+       ANDB    #$3F
+       ADDB    #-$20
+       BMI     TIE0
+       NEGA
+TIE0   LDY     OPICT,X NEW IMAGE
+       LEAY    A,Y
+       CMPY    #TIEP1
+       BHS     TIE01
+       LDY     #TIEP1
+TIE01  CMPY    #TIEP4
+       BLS     TIE02
+       LDY     #TIEP4
+TIE02  STY     OPICT,X
+       SEX
+       ADDD    OYV,X   NEW Y VEL
+       STD     OYV,X
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       TFR     A,B
+       NEGB
+       SEX
+       ADDD    OYV,X
+       STD     OYV,X
+       LDA     OBJY,X  ON SCREEN?
+       BNE     TIE09   YES
+*OFF SCREEN CASE
+*CRUISE ALT ADJUST
+       LDA     SEED
+       CMPA    #$40
+       BHI     TIE06   BYPASS THIS TIME
+       ANDA    #$3
+       ADDA    #-2
+       ADDA    PD+9,U
+       CMPA    #$40    LIMIT CHECKING
+       BHS     TIE03
+       LDA     #$40
+TIE03  CMPA    #$68
+       BLO     TIE04
+       LDA     #$68
+TIE04  STA     PD+9,U
+*Y VEL ADJUST
+TIE06  LDA     PD+9,U
+       SUBA    OY16,X
+       ADDA    #$10
+       CMPA    #$20
+       BLS     TIEX
+       SUBA    #$10
+       BMI     TIE07
+       LDD     #-$10
+       BRA     TIE08
+TIE07  LDD     #$10
+TIE08  ADDD    OYV,X
+       STD     OYV,X
+       BRA     TIEX
+*ON SCREEN
+TIE09  SUBA    PLAYC   CLOSE TO PLAYER
+       BMI     TIE20   BELOW
+       CMPA    #$20
+       BLO     TIE10   CLOSE
+       LDD     #$FFF0
+       BRA     TIE30
+TIE10  CMPA    #$10
+       BHI     TIE31
+       LDD     #$0010
+       BRA     TIE30
+TIE20  CMPA    #-$20
+       BGT     TIE21
+       LDD     #$0010
+       BRA     TIE30
+TIE21  CMPA    #-$10
+       BLT     TIE31
+       LDD     #$FFF0
+TIE30  ADDD    OYV,X
+       STD     OYV,X
+TIE31  LDA     LSEED   BOMB?
+       ANDA    #$7
+       BNE     TIEX    NO
+       BSR     BOMBST
+TIEX   NAP     1,TIE
+*
+*TIE KILL
+*
+TIEKIL KILO    0125,TIHSND
+       DEC     TIECNT
+       LDU     OBJID,X
+       LEAY    PD,U
+TIEK1  CMPX    ,Y++
+       BNE     TIEK1
+       CLRD
+       STD     -2,Y
+       DEC     PD+8,U  
+       BNE     TIEKX
+       LEAX    ,U
+       JSR     KILL
+TIEKX  RTS
+*
+*START BOMB
+*
+BOMBST LDA     BMBCNT
+       CMPA    #10
+       BHS     BMBSTX
+       SHL     BMBOUT,BMBP1,BKIL
+       BEQ     BMBSTX
+       LDB     HSEED
+       SEX
+       ASLB
+       ROLA
+       LDA     SEED
+       ANDA    #$1F
+       INCA
+       STA     ODATA,X LIFETIME
+BMBSTX RTS
+KILOFF JSR     KILLOB
+*
+*OFF OBJECT
+*X=OBJECT
+*
+OFSHIT PSHS    X,U,D,Y
+       JSR     MAPCH2  SELECT CHARS
+       LDD     OBJX,X
+       LDY     OPICT,X
+       JSR     [OBJDEL,Y]
+       PULS    X,U,D,Y,PC
+*
+*KILL ROUTINE
+*X=OBJECT
+*RET=SCORE MSB,LSB
+*RET+2=SOUND
+*
+KILP01 PSHS    X
+       JSR     KILLOP
+       PULS    X
+       BRA     KILO01
+KILPOS PSHS    X
+       JSR     KILLOP
+       PULS    X
+KILOS  JSR     KILLOB
+KILO01 PSHS    U,D
+       LDU     4,S
+       PULU    D
+       JSR     SCORE
+       BSR     EXST
+       PULU    D
+       STU     4,S
+       JSR     SNDLD
+       PULS    U,D,PC
+*
+*EXPLODE
+*X=OBJECT TO BLOW
+*
+EXST   PSHS    X,U,D,Y
+       BSR     OFSHIT
+       JSR     XSVCT
+       PULS    X,U,D,Y,PC
+*
+*COLOR TIES
+*PD =TCTAB INDEX
+TIECOL LDX     #TCTAB
+TIECL1 STX     PD,U
+       NAP     6,TIECL
+TIECL  LDX     PD,U
+       LDD     ,X++
+       STD     PCRAM+$D
+       LDA     ,X+
+       STA     PCRAM+$F
+       CMPX    #TCTAB+9
+       BLO     TIECL1
+       BRA     TIECOL
+*TIE COLOR TABLE
+TCTAB  FCB     $81,$81,$2F
+       FCB     $81,$2F,$07
+       FCB     $2F,$81,$07
+*
+*COLOR BOMBS
+*
+CBOMB  LDA     #$FF
+       STA     PCRAM+$A
+       CLR     PCRAM+$C
+       NAP     3,CBMB1
+CBMB1  LDA     SEED
+       ANDA    #$1F
+       LDX     #COLTAB
+       LDA     A,X
+       STA     PCRAM+$A
+       STA     PCRAM+$C
+       LDX     #BMBD10
+       CMPX    BAX
+       BNE     CBMB2
+       LDX     #BMBD20
+CBMB2  STX     BAX
+       NAP     6,CBOMB
+*
+*FLASH PLAYER-UP PROCESS
+*
+FLPUP  LDA     SCRFLG  SCORED?
+       BNE     FLPX
+       LDX     #P1DISP
+       LDA     CURPLR
+       DECA
+       BEQ     FLP1
+       LDX     #P2DISP
+FLP1   LDD     #256*24+8
+       JSR     BLKCLR
+       NAP     8,FLP2
+FLP2   JSR     SCRTRN
+       NAP     12,FLPUP
+FLPX   DIE
+*
+*SLEEP IN ROMOTE BLOCK
+*PD+6,7=WAKEUP ADDR
+*PD+5=BLOCK
+SLEEPP LDU     CRPROC
+       STX     PD+6,U
+       LDB     MAPCR   GET CURRENT BLOCK
+       STB     PD+5,U  SAVE IT FOR THE ELL OF IT
+       LDX     #SLEEP$ WAKEUP
+       JMP     SLEEP
+SLEEP$ LDA     PD+5,U  GET THE BLOCK
+       BSR     MAPCHG
+       JMP     [PD+6,U] AND "RETURN"
+*
+*LONG JSR BLOCK SWAPPING
+*RET= ADDR
+*RET+2= BLOCK
+*CALLING ROUTINE BLOCK IS SAVED
+*
+LJSR   LEAS    -3,S    MAKE ROOM
+       PSHS    A,U     SAVE TEMPS
+       LDA     MAPCR   GET BLOCK
+       STA     5,S     PUT WITH RETURN ADDR
+       LDU     6,S     GET "RETURN ADDR"
+       LDA     2,U     GET NEW BLOCK
+       LDU     ,U
+       STU     3,S
+       BSR     MAPCHG  MAKE NEW BLOCK
+       PULS    A,U     RESTORE
+       JSR     [0,S]   DO IT
+       PSHS    A,U     SAVE AGAIN
+       LDA     5,S     GET OLD BLOCK BACK
+       BSR     MAPCHG  HOW BORING
+       LDU     6,S     GET "RETURN ADDR"
+       LEAU    3,U     MAKE REAL
+       STU     6,S     PUT BACK ON STACK
+       PULS    A,U     RESTORE
+       LEAS    3,S     TAKE AWAY BYTEE
+       RTS             AND GET THE PHUCK OUT OF HERE.
+*
+*BACKGROUND TERRAIN INIT
+*
+BGI    BSR     MAPCH7
+       JMP     BGINIT
+*
+*MAP CHANGE SUBROUTINES
+*
+MAPCH7 LDA     #7
+       BRA     MAPCHG
+MAPCH2 LDA     #2
+       BRA     MAPCHG
+MAPCH3 LDA     #3
+       BRA     MAPCHG
+MAPCH1 LDA     #1
+MAPCHG STA     MAPCR
+       STA     MAPC
+       RTS
+*
+*MESSAGE WRITER
+*X=SCREEN ADDR, U=MESS VECT ADDR
+*
+MESS   PSHS    X,Y,D,U,DP,CC
+       BSR     MAPCH2
+       JSR     WTBV
+       PULS    X,Y,D,U,DP,CC,PC
+*
+*AUDIT ROUTINE
+*INC METER B
+AUDIT  BSR     MAPCH3
+       JMP     VAUD1
+       FCB     $39     CKBYT CSUM F000-F7FF(ACTUAL)
+*
+*WRITE AN OBJECT TO SCREEN
+*Y=OBJECT DESCRIPTOR ADDR
+*D=SCREEN ADDR
+*ALL SAVED
+*REENTRANT
+*
+CWRIT  PSHS    A,B,X,Y,U
+       TFR     D,X
+       LDA     MAPCR   MAP SWAPPING
+       PSHS    A
+       LDA     #2
+       STA     MAPCR
+       STA     MAPC
+       LDD     OBJW,Y  GET WIDTH,LENGTH
+       LDY     OBJP0,Y GET DATA
+       PSHS    D       SAVE WIDTH,HEIGHT
+       BITB    #1      ODD LENGTH?
+       BNE     CWRT1
+*EVEN BYTE COUNT
+CWRT00 SUBB    #2
+CWRT0  LDU     B,Y
+       STU     B,X
+       SUBB    #2
+       BPL     CWRT0
+       LDB     1,S
+       LEAX    $100,X
+       LEAY    B,Y
+       DECA
+       BNE     CWRT00
+       BRA     CWRTX
+*ODD BYTE COUNT
+CWRT1  DECB
+       LDA     B,Y
+       STA     B,X
+       SUBB    #2
+       BMI     CWRT3
+CWRT2  LDU     B,Y
+       STU     B,X
+       SUBB    #2
+       BPL     CWRT2
+CWRT3  LDB     1,S     GET HEIGHT
+       LEAX    $100,X
+       LEAY    B,Y
+       DEC     ,S      DEC WIDTH
+       BNE     CWRT1
+CWRTX  LEAS    2,S     GET MAP +2 PHONIES
+       PULS    A
+       STA     MAPCR
+       STA     MAPC
+       PULS    A,B,X,Y,U,PC
+*
+*COFF
+*Y=OBJECT DESCRIPTOR ADDR
+*D=SCREEN ADDR
+*
+COFF   PSHS    A,B,X,U
+       TFR     D,X
+       LDA     MAPCR
+       PSHS    A
+       LDA     #2      SWAP IN MAP
+       STA     MAPCR
+       STA     MAPC
+       LDD     OBJW,Y  GET WIDTH ,HEIGHT
+COFFA  LDU     #0
+       PSHS    B       SAVE HT
+       BITB    #1      ODD LENGTH?
+       BNE     COFF1   YES
+*EVEN BYTE COUNT
+COFF00 SUBB    #2
+COFF0  STU     B,X
+       SUBB    #2
+       BPL     COFF0
+       LDB     ,S      GET HT
+       LEAX    $100,X
+       DECA
+       BNE     COFF00
+       BRA     COFFX
+*ODD BYTE COUNT
+COFF1  DECB
+       CLR     B,X
+       SUBB    #2
+       BMI     COFF3
+COFF2  STU     B,X
+       SUBB    #2
+       BPL     COFF2
+COFF3  LDB     ,S      GET HT
+       LEAX    $100,X
+       DECA
+       BNE     COFF1
+COFFX  PULS    A,B     PULL MAPCR,HEIGHT
+       STB     MAPCR
+       STB     MAPC
+       PULS    A,B,X,U,PC
+*
+*BLOCK CLEAR
+*X=ADDR, D=W,H
+*
+BLKCLR PSHS    A,B,X,U
+       LDA     MAPCR   SAVE MAP
+       PSHS    A
+       LDA     1,S
+       BRA     COFFA
+*
+*SCREEN CLEAR
+*
+SCRCLR PSHS    D,X,Y,U
+       LDU     #$9C00
+       LDX     #0
+       TFR     X,Y
+       TFR     X,D
+SCLRLP PSHU    X,Y,D
+       PSHU    X,Y,D
+       PSHU    X,Y,D
+       PSHU    X,Y,D
+       PSHU    X,Y,D
+       PSHU    X       32 AT A CRACK
+       CMPU    #0
+       BNE     SCLRLP
+       PULS    D,X,Y,U,PC
+*
+*CLEAR ACTIVE SCREEN
+*
+SCLR1  PSHS    D,X,Y,U,DP
+       LDU     #$9C00
+       LDX     #0
+       TFR     X,Y
+       TFR     X,D
+       TFR     A,DP
+SC0LP  LDB     #8
+SC1LP  PSHU    X,Y,A,DP
+       PSHU    X,Y,A,DP
+       PSHU    X,Y,A,DP
+       PSHU    X,Y,A,DP
+       DECB
+       BNE     SC1LP
+       PSHU    X,Y,A,DP
+       PSHU    X,Y,A,DP
+       PSHU    X,Y,A,DP
+       PSHU    X,Y
+       LEAU    -YMIN,U
+       CMPU    #0
+       BNE     SC0LP
+       PULS    D,X,Y,U,DP,PC
+*
+* RESET PROCESSING
+*
+RESET  CLR     MAPC    SETUP PIAS
+       LDX     #$CC00
+       CLR     1,X
+       CLR     3,X
+       CLR     5,X
+       CLR     7,X
+       LDA     #$C0
+       STA     ,X
+       LDA     #$FF
+       STA     2,X
+       CLR     4,X     
+       CLR     6,X
+       LDA     #4
+       STA     3,X
+       STA     5,X
+       STA     7,X
+       ORA     #$10    SET FOR SLAM SW ON ^TRANS
+       STA     1,X     AND PROGRAM
+       LDX     #$C000  SET INTERESTING SCREEN COLORS
+       LDA     #$C0
+RESET1 STA     ,X+
+       LDB     #$B5
+       MUL
+       CMPX    #$C010
+       BNE     RESET1
+       ORCC    #$80    SET AUTO CYCLE NOT FLAG <=================TEMPORARY
+       ANDCC   #$EF    CLEAR COMPREHENSIVE/INITIAL FLAG(I BIT)
+*
+* POWER UP RAM TEST
+*
+       LDY     #2      SET TEST COUNTER
+       CLRA
+       TFR     A,DP    CLEAR BAD RAM MAP(BIT 0-BLOCK 1, B1-BL2 , B2-BL3)
+       ANDCC   #$BF    INITIALIZE BAD RAM IN PAGE FLAG(F BIT)
+       CLRB
+RAM2   TFR     D,U     SAVE SEED
+       LDX     #0      GET STARTING ADDRESS INTO POINTER
+RAM3   COMB            RANDOM NUMBER ROUTINE
+       BITB    #9
+       BNE     RAM4
+       COMB
+       RORA
+       RORB
+       BRA     RAM6
+RAM4   COMB
+       BITB    #9
+       BNE     RAM5
+       RORA
+       RORB
+       BRA     RAM6
+RAM5   LSRA
+       RORB
+RAM6   STD     ,X++    LOAD INTO ADDRESS AND ADVANCE
+       EXG     X,D     WATCHDOG TEST
+       TSTB
+       BNE     RAM6B
+       LDB     #$38    RESET WATCHDOG
+       STB     $C3FC
+       TFR     CC,B    CHECK COMPREHENSIVE/INITIAL FLAG
+       BITB    #$10
+       BEQ     RAM6A   SKIP IF INITIAL
+       CLR     MAPC    SELECT PIA BLOCK
+       LDB     $CC00   CHECK IF ADVANCE PRESSED AND AUTO UP
+       COMB
+       BITB    #3
+       BEQ     RAM11A  TEST ABORTED, RETURN TO COMPREHENSIVE
+RAM6A  CLRB
+RAM6B  EXG     X,D
+       CMPX    #$C000  ADDRESS POINTER DONE?
+       BNE     RAM3    NO, LOOP
+       TFR     U,D     GET SEED
+       LDX     #0      GET STARTING ADDRESS INTO POINTER
+RAM7   COMB            RANDOM NUMBER ROUTINE
+       BITB    #9
+       BNE     RAM8
+       COMB
+       RORA
+       RORB
+       BRA     RAM10
+RAM8   COMB
+       BITB    #9
+       BNE     RAM9
+       RORA
+       RORB
+       BRA     RAM10
+RAM9   LSRA
+       RORB
+RAM10  CMPD    ,X++    CHECK FOR MATCH
+       BEQ     RAM11   NO, ERROR
+       EXG     D,Y     SAVE ERROR
+       TFR     CC,A    CHECK COMPREHENSIVE/INITIAL FLAG
+       BITA    #$10
+       BEQ     RAM10A  SKIP IF INITIAL
+       LDA     #DIABLK ERROR, RETURN TO COMPREHENSIVE
+       STA     MAPCR
+       STA     MAPC    AND IN HARDWARE
+       JMP     VRAM10
+RAM10A CLRA
+       EXG     Y,D     RECOVER COUNTER
+       ORCC    #$40    SET BAD RAM IN PAGE FLAG
+RAM11  EXG     X,D     END OF PAGE TEST
+       TSTB
+       BNE     RAM17   PAGE NOT DONE
+       TFR     CC,B    CHECK COMPREHENSIVE/INITIAL FLAG
+       BITB    #$10
+       BEQ     RAM11B  SKIP IF INITIAL
+       LDB     $CC00   CHECK IF ADVANCE PRESSED AND AUTO UP
+       COMB
+       BITB    #3
+       BNE     RAM16   NOT YET, SKIP ERROR PROCESSING SAVE DP
+RAM11A LDA     #DIABLK TEST ABORTED, RETURN TO COMPREHENSIVE
+       STA     MAPCR   IN FLAG
+       STA     MAPC
+       JMP     VRAM20
+RAM11B TFR     CC,B    GET CONDITION CODES
+       BITB    #$40    CHECK BAD RAM IN PAGE FLAG
+       BEQ     RAM16   RAM PAGE OK-SKIP ERROR PROCESSING
+* ERROR PROCESSING
+       ANDCC   #$BF    CLEAR BAD RAM IN PAGE FLAG
+       TFR     DP,B    GET BAD RAM MAP
+       TFR     A,DP    SAVE ADDRESS
+RAM12  SUBA    #3      FIND BLOCK NUMBER
+       BCC     RAM12
+       INCA
+       BNE     RAM13
+       ORB     #2      BLOCK 2
+       BRA     RAM15
+RAM13  INCA
+       BNE     RAM14
+       ORB     #1      BLOCK 1
+       BRA     RAM15
+RAM14  ORB     #4      BLOCK 3
+RAM15  TFR     DP,A    RECOVER ADDRESS
+       TFR     B,DP    SAVE BAD RAM MAP
+*
+RAM16  LDB     #$38    RESET WATCHDOG
+       STB     $C3FC
+       CLRB
+RAM17  EXG     X,D
+       CMPX    #$C000  CHECK FOR END OF MEMORY
+       LBNE    RAM7    NO?, LOOP
+       LEAY    -1,Y
+       LBNE    RAM2    REPEAT TEST
+       TFR     CC,B
+       TSTB            CHECK AUTO CYCLE NOT FLAG  <================TEMPORARY
+       BMI     RAM17B  CLEAR, CONTINUE RAM TEST
+       LDB     #DIABLK SELECT DIAGNOSTIC BLOCK
+       STB     MAPC
+       JSR     INIT    INITIALIZE DIRECT PAGE VARIABLES
+       JMP     VOUND0  NEXT TEST IN CYCLE          <================
+RAM17B BITB    #$10    CHECK COMPREHENSIVE/INITIAL FLAG-SAVE RANDOM NUMBER 
+       LBNE    RAM2    COMPREHENSIVE, CONTINUE
+* FIND GOOD RAM
+       LDA     #$9E
+       TFR     DP,B    GET BAD RAM MAP
+       TSTB
+       BEQ     RAM19   DP <= $9E, IF ALL RAM OK
+RAM18  INCA            DP <= $9F, IF (BLOCK 2 OR 3 BAD) AND 1 OK
+       LSRB            DP <= $A0, IF BLOCK 1 BAD AND 2 OK
+       BCS     RAM18   DP <= $A1, IF ONLY BLOCK 3 OK
+RAM19  TFR     A,DP    DP <= $A2, IF ALL BLOCKS BAD, GOOD LUCK!
+       ADDA    #$1     SET HARDWARE STACK AT TOP OF GOOD RAM BLOCK
+       CLRB
+       TFR     D,S
+       JSR     INIT    SETUP FOR TEXT ROUTINE
+* 
+* POWER UP ROM TEST
+*
+ROM0   LDU     #ROMMAP GET ROM MAPC ADDRESS
+ROM1   CLR     MAPC    RESET WATCHDOG
+       LDA     #$38
+       STA     $C3FC
+       LDA     ,U      GET DESCRIP
+       LDB     ,U
+       BEQ     ROM9    NO PART?, NEXT ROM
+       ANDB    #$F     EXTRACT BLOCK #
+       STB     MAPC    SELECT BLOCK
+       ANDA    #$70    EXTRACT ADDRESS
+       LSRA
+       ADDA    #$C0
+       CLRB
+       TFR     D,X     ADDRESS IN X
+       LDY     #$800   SET BYTE COUNTER
+       TFR     U,D     INITIALIZE CHECKSUM TO ROM NUMBER
+       SUBB    #(ROMMAP-2)!.$FF
+       LSRB
+       CLRA            CLEAR CARRY
+*ADDER LOOP
+ROM2   ADCB    ,X+     ADD AND ROTATE CARRY
+       LEAY    -1,Y    DECREMENT COUNTER
+       BNE     ROM2    DONE
+*
+       CMPB    #$80    CHECK THE SUM
+       BEQ     ROM9    OK?, NEXT ROM
+       TFR     CC,A    GET COMPREHENSIVE/INITIAL FLAG
+       BITA    #$10    TEST IT
+       BEQ     IDIS20  DISPLAY INITIAL ERROR
+ROM2A  JMP     MAPCH3  SELECT DIAG AND RETURN
+ROM9   LEAU    1,U
+       CMPU    #ROMMAP+24
+       BNE     ROM1
+       TFR     CC,A
+       BITA    #$10    TEST COMPREHENSIVE/INITIAL FLAG
+       BNE     ROM2A   RETURN TO COMPREHENSIVE
+*
+* INITIAL TEST RESULTS DISPLAY
+*
+IDIS1  TFR     DP,A    CHECK IF RAM OK <== ROM OK STARTING POINT
+       CMPA    #$9E
+       BNE     IDIS10  BRANCH IF RAM BAD
+* ROM OK, RAM OK
+       JSR     MAPCH3  SELECT DIAG BLOCK
+       JSR     VORAOK  DISPLAY ROUTINE IN DIAGNOSTIC BLOCK
+       BRA     GAMEOV  NOW GO TO GAME OVER
+* ROM OK, RAM BAD
+IDIS10 LDB     #$40    BAD RAM INDICATION LEDS
+       BSR     BADLY   LITE LEDS, SELECT DIAG BLOCK
+       JSR     VOOKRB  DISPLAY ROUTINE IN DIAGNOSTIC BLOCK
+       BRA     GAMEOV  NOW GO TO GAME OVER
+*
+*B>LEDS
+*ERROR DELAY TO READ LEDS
+*SELECT DYKE BLOCK, RET
+*
+BADLY  LDX     #$CC00
+       STB     ,X      LITE LEDS
+       STB     2,X
+       CLR     $D000   SELECT BLOCK 0
+BADLY1 LDA     #$38    ONE FOR THE DOGGIE
+       STA     $C3FC
+       LEAX    -1,X
+       BNE     BADLY1
+       JMP     MAPCH3
+* ROM BAD
+IDIS20 LDB     #$80    BAD ROM INDICATION LEDS
+       BSR     BADLY   LITE LEDS, SELECT DIAG BLOCK
+       JSR     VOMBAD  DISPLAY ROUTINE IN DIAGNOSTIC BLOCK
+*
+*GAME OVER
+*
+GAMEOV JSR     VPWRUP
+       JMP     SINIT
+*
+* STORE B,X BLOCK 0
+*
+STBXB0 PSHS    A,CC
+       LDA     MAPCR
+       PSHS    A
+       CLR     MAPCR
+       CLR     MAPC
+       STB     ,X
+STBXB  PULS    A
+       STA     MAPCR
+       STA     MAPC
+       PULS    CC,A,PC
+*
+* LOAD B ,X - BLOCK 0
+*
+LDBXB0 PSHS    A,CC    SAVE STATE
+       LDA     MAPCR   GET CURRENT ACTIVE BLOCK
+       PSHS    A       SAVE IT
+       CLR     MAPCR   MAKE IT 0
+       CLR     MAPC    AND IN HARDWARE
+       LDB     ,X      GET THE DATA
+       BRA     STBXB   FINISH ABOVE
+*
+* INITIALIZE DP VARIABLES FOR TEXT/DIAG USE
+*
+INIT   PSHS    D       SAVE STATE
+       CLR     MESPT
+       CLR     ASCNTR
+       LDA     #DIABLK SELECT DIAG BLOCK
+       STA     MAPCR   INTO CURRENT
+       STA     ASLAST
+       LDD     #$FFFF  INIT NUMBER
+       STD     NUMBER
+       PULS    D,PC    GO BACK
+*
+* CMOS PRIMITIVE FOR READING
+*
+RCMOS  LDA     1,X     GET LSB
+       ANDA    #$0F    LEAVE ONLY LS
+       PSHS    A       SAVE IT
+       LDA     ,X++    GET MSB + AUTO INC
+       ASLA
+       ASLA
+       ASLA
+       ASLA            SHIFT LS TO MSB
+       ADDA    ,S+     GET LSB + FIX STACK
+       RTS             BYE
+*
+* READ CMOS INTO A
+*
+RCMOSA PSHS    B       SAVE A WHILE
+       LDB     MAPCR   GET CURRENT
+       PSHS    B       SAVE IT
+       CLR     MAPCR   NOW SET TO BLOCK 0
+       CLR     MAPC    AND HARDWARE
+       BSR     RCMOS   GO READ IT IN A
+RCMOSX PULS    B       GET OLD BLOCK #
+       STB     MAPCR   SAVE IT AGAIN
+       STB     MAPC    AND IN HARDWARE
+       PULS    B,PC    CLEAN + GO
+*
+* READ CMOS INTO D POINTED TO BY X: A=X,X+1; B=X+2,X+3
+*
+RCMOSD BSR     RCMOSA  GET THE FIRST BYTE+FALL THRU FOR 2ND
+*
+* READ CMOS INTO B POINTED TO BY X
+*
+RCMOSB PSHS    A       SAVE A
+       BSR     RCMOSA  GET IN A
+       TFR     A,B     PUT IT IN B
+       PULS    A,PC    DONE
+*
+* WRITE TO CMOS PRIMITIVE
+*
+WCMOS  PSHS    A       SAVE WHATS TO BE WRITTEN
+       STA     1,X     SAVE LSB
+       LSRA            SHIFT MS TO LS
+       LSRA
+       LSRA
+       LSRA
+       STA     ,X++    SAVE MSB AND AUTO INC
+       PULS    A,PC    DONE
+*
+* WRITE TO CMOS FROM A AT X
+*
+WCMOSA PSHS    B       SAVE STATE
+       LDB     MAPCR   GET CURRENT MAP
+       PSHS    B       SAVE ON STACK
+       CLR     MAPCR   POINT TO BLOCK 0
+       CLR     MAPC    AND IN HARDWARE
+       BSR     WCMOS   WRITE A TO CMOS
+       PULS    B       GET BLOCK SAVED
+       STB     MAPCR   SAVE IT
+       STB     MAPC    AND IN HARDWARE
+       PULS    B,PC    CLEAN UP + GO
+*
+* WRITE CMOS FROM D TO X: A=X,X+1; B=X+2,X+3
+*
+WCMOSD BSR     WCMOSA  DO IT AND FALL THRU FOR 2ND
+*
+* WRITE CMOS FROM B TO X
+*
+WCMOSB PSHS    A       SAVE A
+       TFR     B,A     MOVE B TO A
+       BSR     WCMOSA  FAKE IT
+       PULS    A,PC    DONE
+*
+* ROM ADDRESS MAP - ONE BYTE EVERY 2K 
+*                   FIRST 2 BYTES FOR ROM1,
+*                    NEXT 2 BYTES FOR ROM2, ETC.
+*
+*       BITS 0-3 BLOCK NUMBER (USE $F FOR MAIN MEMORY)
+*       BITS 6-4 ADDRESS 0 FOR $C000
+*                        1 FOR $C800
+*                        2 FOR $D000 
+*                        3 FOR $D800
+*                        4 FOR $E000 
+*                        5 FOR $E800 
+*                        6 FOR $F000 
+*                        7 FOR $F800     
+*       00 FOR NO ROM
+*
+ROMMAP FCB     $20,$00 ROM 1
+       FCB     $40,$50 ROM 2
+       FCB     $60,$70 ROM 3
+       FCB     $30,$00 ROM 4
+       FCB     $00,$00 ROM 5
+       FCB     $07,$00 ROM 6
+       FCB     $03,$00 ROM 7
+       FCB     $02,$00 ROM 8
+       FCB     $01,$00 ROM 9
+       FCB     $13,$00 ROM 10
+       FCB     $12,$00 ROM 11
+       FCB     $11,$00 ROM 12
+*
+*START DATA TABLES
+*
+*SWITCH TABLE
+*
+SWTAB  FDB     LFIRE   FIRE
+       FCB     STYPE,$E8
+       FDB     0       THRUST
+       FCB     0,0
+       FDB     SBOMB   SMART BOMB
+       FCB     STYPE,$F8
+       FDB     HYPER
+       FCB     STYPE,$F8
+       FDB     ST2
+       FCB     STYPE,0
+       FDB     ST1
+       FCB     STYPE,0
+       FDB     REV
+       FCB     STYPE,$E8
+       FDB     0
+       FCB     0,0
+SWTAB1 FDB     0
+       FCB     0,0
+       FDB     ADVSW
+       FCB     STYPE,0
+       FDB     RCOIN
+       FCB     CTYPE,0
+       FDB     HSRES   HI SCORE RESET
+       FCB     STYPE,0
+       FDB     LCOIN
+       FCB     CTYPE,0
+       FDB     CCOIN
+       FCB     CTYPE,0
+*
+*COLOR RAM TABLE
+*
+CRTAB  FCB     0       0 SPACE
+       FCB     $00     1 LASER (SPECIAL)
+       FCB     $07     2 RED
+       FCB     $28     3 GREEN
+       FCB     $2F     4 YELLOW
+       FCB     $81     5 BLUE
+       FCB     $A4     6 GRAY
+       FCB     $15     7 BROWN
+       FCB     $C7     8 PURPLE
+       FCB     $FF     9 WHITE
+       FCB     $00     A BOMB CYCLER
+       FCB     $00     B MONOCHROME
+       FCB     $00     C CYCLER
+       FCB     $00     D TIE1
+       FCB     $00     E TIE2
+       FCB     $00     F TIE3
+******************************
+*G R A P H I C S
+******************************
+*SCHITZO
+SCZP1  FCB     5,8
+       FDB     SCZD10,SCZD11,ON58,OFF58
+*ASTRO EXPLODE
+ASXP1  FCB     4,8
+       FDB     ASXD10,ASXD10,ON48,OFF48
+*SWARM EXPLODE
+SWXP1  FCB     4,8
+       FDB     SWXD10,SWXD10,ON48,OFF48
+*NULL OBJECT
+NULOB  FCB     1,1
+       FDB     NULD10,NULD10,DRTS,DRTS
+NULD10 FCB     0
+*PROBE
+PRBP1  FCB     4,8
+       FDB     PRBD10,PRBD11,ON48,OFF48
+*ASTRONAUTS
+*FACING LEFT
+ASTP1  FCB     2,8
+       FDB     ASTD10,ASTD11,ON28,OFF28
+ASTP2  FCB     2,8
+       FDB     ASTD20,ASTD21,ON28,OFF28
+*FACING RT.
+ASTP3  FCB     2,8
+       FDB     ASTD30,ASTD31,ON28,OFF28
+ASTP4  FCB     2,8
+       FDB     ASTD40,ASTD41,ON28,OFF28
+*TIE PICTS
+TIEP1  FCB     4,8
+       FDB     TIED10,TIED11,ON48,OFF48
+TIEP2  FCB     4,8
+       FDB     TIED20,TIED21,ON48,OFF48
+TIEP3  FCB     4,8
+       FDB     TIED30,TIED31,ON48,OFF48
+TIEP4  FCB     4,8
+       FDB     TIED40,TIED41,ON48,OFF48
+*BOMB EXPLOSION PICT
+BXPIC  FCB     4,8
+       FDB     BXD10,BXD10,ON48,OFF48
+*BOMB PICT
+BMBP1  FCB     2,3
+       FDB     BMBD10,BMBD11,ON23,OFF23
+BMBP2  FCB     2,3
+       FDB     BMBD20,BMBD21,ON23,OFF23
+*LASER PICT
+LASP1  FCB     8,1
+       FDB     LASD10
+LASD10 FDB     $FFFF,$FFFF,$FFFF,$FFFF
+*SWARM PICTS
+SWPIC1 FCB     3,4
+       FDB     SWMD10,SWMD11,ON34,OFF34
+*LANDER
+LNDP1  FCB     5,8
+       FDB     LND10,LND11,ON58,OFF58
+LNDP2  FCB     5,8
+       FDB     LND20,LND21,ON58,OFF58
+LNDP3  FCB     5,8
+       FDB     LND30,LND31,ON58,OFF58
+*UFO PICTURE
+UFOP1  FCB     6,4
+       FDB     UFOD10,UFOD11,ON64,OFF64
+UFOP2  FCB     6,4
+       FDB     UFOD20,UFOD21,ON64,OFF64
+UFOP3  FCB     6,4
+       FDB     UFOD30,UFOD31,ON64,OFF64
+*PLAYER PICTURE
+PLAPIC FCB     8,6
+       FDB     PLD10,PLD11,ON86,OFF86
+PLBPIC FCB     8,6
+       FDB     PLD20,PLD21,ON86,OFF86
+*MINI PLAYER PICTURE
+PLAMIN FCB     5,4
+       FDB     PLAM0
+*SMART BOMB
+SBPIC  FCB     3,3
+       FDB     SBD10
+*250 SCORE
+C25P1  FCB     6,6
+       FDB     C25D10,C25D11,ON66,OFF66
+*500 SCORE
+C5P1   FCB     6,6
+       FDB     C5D10,C5D11,ON66,OFF66
+*TERRAIN EXPLOSION
+TEREX  FCB     8,6
+       FDB     TERX0,TERX0,CWRIT,COFF
+*SCHITZO
+SCZD10 FDB     $0000,$0303,$0000,$0330
+       FDB     $0C3C,$0C08,$3830,$0000
+       FDB     $C0C0,$C878,$7870,$7070
+       FDB     $0030,$0303,$3030,$0300
+       FDB     $0000,$0000,$0000,$0030
+SCZD11 FDB     $0000,$0000,$0000,$0030
+       FDB     $0003,$3030,$0303,$3000
+       FDB     $CCCC,$CC87,$8707,$0707
+       FDB     $0003,$8080,$8303,$0000
+       FDB     $0000,$3030,$0000,$3003
+*ASTRO EXPLODE
+ASXD10 FDB     $0000,$0D6C,$6C0D,$0000
+       FDB     $06E6,$C883,$82C8,$EC06
+       FDB     $606D,$8C28,$288C,$6D60
+       FDB     $0000,$E0C6,$C6E0,$0000
+*SWARM EXPLODE
+SWXD10 FDB     $0000,$0222,$2402,$0000
+       FDB     $0222,$4444,$2442,$2200
+       FDB     $2022,$4444,$2442,$2200
+       FDB     $0000,$2022,$2220,$0000
+*PROBE
+PRBD10 FDB     $000E,$00D8,$000E,$0000 1
+       FDB     $0F08,$8CC8,$8C08,$0F00 2
+       FDB     $000E,$80C8,$800E,$0000 3
+       FDB     $0000,$00D0,$0000,$0000 4
+PRBD11 FDB     $0000,$000D,$0000,$0000 1
+       FDB     $00E0,$088C,$08E0,$0000 2
+       FDB     $F080,$C88C,$C880,$F000 3
+       FDB     $00E0,$008D,$00E0,$0000 4
+*ASTRONAUTS
+ASTD10 FDB     $3343,$4387,$8707,$0707 1
+       FDB     $0000,$8080,$8000,$0000
+ASTD11 FDB     $0304,$0408,$0800,$0000 1
+       FDB     $3030,$3878,$7870,$7070 2
+ASTD20 FDB     $3343,$4387,$8777,$7777 1
+       FDB     $0000,$8080,$8000,$0000
+ASTD21 FDB     $0304,$0408,$0807,$0707
+       FDB     $3030,$3878,$7870,$7070
+ASTD30 FDB     $0303,$8387,$8707,$0707
+       FDB     $3040,$4080,$8000,$0000
+ASTD31 FDB     $0000,$0808,$0800,$0000
+       FDB     $3334,$3478,$7870,$7070
+ASTD40 FDB     $0303,$8387,$8707,$0707
+       FDB     $3040,$4080,$8070,$7070
+ASTD41 FDB     $0000,$0808,$0800,$0000
+       FDB     $3334,$3478,$7877,$7777
+*
+*TIE PICTS
+*
+TIED10 FDB     $0808,$DDDE,$DEDE,$DD00 1
+       FDB     $8888,$DDEE,$FEEE,$DD00 2
+       FDB     $8888,$D8D8,$D8D0,$D000 3
+       FDB     0,0,0,0 4
+TIED11 FDB     $0000,$0D0D,$0D0D,$0D00 1
+       FDB     $8888,$DDEE,$EFEE,$DD00 2
+       FDB     $8888,$DDED,$EDED,$DD00 3
+       FDB     $8080,$8080,$8000,$0000 4
+TIED20 FDB     $0008,$DDDE,$DEDE,$DD00 1
+       FDB     $0088,$DDEE,$FEEE,$DD00 2
+       FDB     $0088,$D8D8,$D8D8,$D000 3
+       FDB     0,0,0,0 4
+TIED21 FDB     $0000,$0D0D,$0D0D,$0D00 1
+       FDB     $0088,$DDEE,$EFEE,$DD00 2
+       FDB     $0088,$DDED,$EDED,$DD00 3
+       FDB     $0080,$8080,$8080,$0000 4
+TIED30 FDB     $0000,$DDDE,$DEDE,$DD00 1
+       FDB     $0000,$DDEE,$FEEE,$DD00 2
+       FDB     $0000,$D8D8,$D8D8,$D800 3
+       FDB     0,0,0,0 4
+TIED31 FDB     $0000,$0D0D,$0D0D,$0D00 1
+       FDB     $0000,$DDEE,$EFEE,$DD00 2
+       FDB     $0000,$DDED,$EDED,$DD00 3
+       FDB     $0000,$8080,$8080,$8000 4
+TIED40 FDB     $0000,$DDDE,$DEDE,$DD00 1
+       FDB     $0000,$DDEE,$FEEE,$DD88 2
+       FDB     $0000,$D0D8,$D8D8,$D888 3
+       FDB     0,0,0,0
+TIED41 FDB     $0000,$0D0D,$0D0D,$0D00 1
+       FDB     $0000,$DDEE,$EFEE,$DD88 2
+       FDB     $0000,$DDED,$EDED,$DD88 3
+       FDB     $0000,$0080,$8080,$8080 4
+***************
+*BLK 3 GRAPHICS
+***************
+       ORG     $CC90
+*BOMB EXPLOSION PICT
+BXD10  FDB     $000C,$CCCC,$CCCC,$0C00
+       FDB     $CCCC,$CCCC,$CCCC,$CCCC
+       FDB     $CCCC,$CCCC,$CCCC,$CCCC
+       FDB     $00C0,$CCCC,$CCCC,$C000
+*
+*BOMB PICT
+*
+BMBD10 FDB     $A00A,$A0A0,$00A0
+BMBD11 FDB     $0A00,$0A0A,$A00A
+BMBD20 FDB     $0AAA,$0A00,$A000
+BMBD21 FDB     $000A,$00A0,$AAA0
+*SWARM PICTS
+SWMD10 FDB     $0002,$2302
+       FDB     $2022,$2322
+       FDB     $0000,$2000
+SWMD11 FDB     $0000,$0200
+       FDB     $0222,$3222
+       FDB     $0020,$3220
+*
+*LANDER
+*
+LND10  FDB     $0000,$0303,$0000,$0330 1
+       FDB     $0434,$3030,$3430,$0000 2
+       FDB     $4444,$3333,$3430,$3030 3
+       FDB     $0030,$0303,$3030,$0300 4
+       FDB     $0000,$0000,$0000,$0030 5
+LND11  FDB     $0000,$0000,$0000,$0003 1
+       FDB     $0003,$3333,$0303,$3000 2
+       FDB     $4444,$0303,$4303,$0303 3
+       FDB     $4043,$3030,$4303,$0000 4
+       FDB     $0000,$3030,$0000,$3003 5
+LND20  FDB     $0000,$0303,$0000,$0330 1
+       FDB     $0434,$0303,$3430,$0000 2
+       FDB     $4444,$3030,$3430,$3030 3
+       FDB     $0030,$3333,$3030,$0300 4
+       FDB     $0000,$0000,$0000,$0030 5
+LND21  FDB     $0000,$0000,$0000,$0003 1
+       FDB     $0003,$3030,$0303,$3000 2
+       FDB     $4444,$3333,$4303,$0303 3
+       FDB     $4043,$0303,$4303,$0000 4
+       FDB     $0000,$3030,$0000,$3003 5
+LND30  FDB     $0000,$0303,$0000,$0330 1
+       FDB     $0033,$3333,$3330,$0000 2
+       FDB     $0033,$0303,$3330,$3030 3
+       FDB     $0030,$3333,$3030,$0300 4
+       FDB     $0000,$0000,$0000,$0030 5
+LND31  FDB     $0000,$0000,$0000,$0003 1
+       FDB     $0003,$3333,$0303,$3000 2
+       FDB     $0033,$3030,$0303,$0303 3
+       FDB     $0033,$3333,$3303,$0000 4
+       FDB     $0000,$3030,$0000,$3003 5
+*
+*UFO PICTURE
+*
+*UFO PICTURE 1
+UFOD10 FDB     $0003,$3403,$3370,$4033 1,2
+       FDB     $3307,$4433,$3300,$0433 3,4
+       FDB     $3073,$4033,$0000,$3000 5,6
+UFOD11 FDB     $0000,$0300,$0337,$4433 1,2
+       FDB     $3300,$0433,$3370,$4033 3,4
+       FDB     $3307,$4433,$0030,$0330 5,6
+*UFO PICTURE 2
+UFOD20 FDB     $0003,$3003,$3300,$4433 1,2
+       FDB     $3370,$0433,$3307,$4033 3,4
+       FDB     $3003,$4433,$0000,$3000 5,6
+UFOD21 FDB     $0000,$0300,$0330,$0433 1,2
+       FDB     $3307,$4033,$3300,$4433 3,4
+       FDB     $3370,$0433,$0030,$4330 5,6
+UFOD30 FDB     $0003,$3403,$3307,$0433 1,2
+       FDB     $3300,$4033,$3370,$4433 3,4
+       FDB     $3003,$0433,$0000,$3000 5,6
+UFOD31 FDB     $0000,$0300,$0330,$4033 1,2
+       FDB     $3370,$4433,$3307,$0433 3,4
+       FDB     $3300,$4033,$0030,$4330 5,6
+*
+*PLAYER PICTURE
+*
+PLD10  FDB     $0006,$2606,$2600 1
+       FDB     $6666,$6688,$8888 2
+       FDB     $0060,$6666,$8886 3
+       FDB     $0000,$0066,$6693 4
+       FDB     $0000,$006D,$6600 5
+       FDB     $0000,$00EF,$6600 6
+       FDB     $0000,$0000,$6900 7
+       FDB     $0000,$0000,$3000 8
+PLD11  FDB     $0000,$0200,$0200 1
+       FDB     $0666,$6628,$6808 2
+       FDB     $6066,$6686,$8888 3
+       FDB     $0000,$6066,$8669 4
+       FDB     $0000,$0066,$6630 5
+       FDB     $0000,$00DE,$6600 6
+       FDB     $0000,$00F0,$6600 7
+       FDB     $0000,$0000,$9300 8
+PLD20  FDB     $0000,$0000,$3900 1
+       FDB     $0000,$000F,$6600 2
+       FDB     $0000,$00ED,$6600 3
+       FDB     $0000,$0066,$6603 4
+       FDB     $0000,$0666,$6896 5
+       FDB     $0666,$6668,$8888 6
+       FDB     $6066,$6683,$8680 7
+       FDB     $0000,$3000,$3000 8
+PLD21  FDB     $0000,$0000,$0300 1
+       FDB     $0000,$0000,$9600 2
+       FDB     $0000,$00FE,$6600 3
+       FDB     $0000,$00D6,$6600 4
+       FDB     $0000,$0066,$6639 5
+       FDB     $0006,$6666,$8868 6
+       FDB     $6666,$6688,$8888 7
+       FDB     $0060,$6330,$6300 8
+*MINI PLAYER PICTURE
+PLAM0  FDB     $0626,$6828
+       FDB     $6066,$6686
+       FDB     $0000,$6666
+       FDB     $0000,$ED66
+       FDB     $0000,$0063
+*SMART BOMB
+SBD10  FCB     $90,$09,$90
+       FCB     $99,$99,$99
+       FCB     $90,$CC,$90
+*250 SCORE
+C25D10 FDB     $1100,$1110,$1100
+       FDB     $1010,$1000,$1000
+       FDB     $1110,$1100,$1100
+       FDB     $1000,$1010,$1000
+       FDB     $1110,$1010,$1100
+       FDB     $1010,$1010,$1000
+C25D11 FDB     $0100,$0101,$0100
+       FDB     $1101,$1100,$1100
+       FDB     $0101,$0100,$0100
+       FDB     $1100,$1101,$1100
+       FDB     $0101,$0101,$0100
+       FDB     $1101,$0101,$1100
+*500 SCORE
+C5D10  FDB     $FFF0,$FF00,$FF00
+       FDB     $F000,$F0F0,$F000
+       FDB     $EEE0,$E0E0,$EE00
+       FDB     $E0E0,$E0E0,$E000
+       FDB     $DDD0,$D0D0,$DD00
+       FDB     $D0D0,$D0D0,$D000
+C5D11  FDB     $0F0F,$0F00,$0F00
+       FDB     $FF00,$FF0F,$FF00
+       FDB     $0E0E,$0E0E,$0E00
+       FDB     $EE0E,$0E0E,$EE00
+       FDB     $0D0D,$0D0D,$0D00
+       FDB     $DD0D,$0D0D,$DD00
+*TERRAIN EXPLOSION
+TERX0  FDB     $1C0D,$7FE7,$7000 1
+       FDB     $0F71,$7107,$DC77 2
+       FDB     $7C0D,$71C7,$77DE 3
+       FDB     $0771,$1717,$DEF7 4
+       FDB     $7117,$717C,$DEF0 5
+       FDB     $0777,$C771,$1770 6
+       FDB     $707C,$D777,$7770 7
+       FDB     $01CD,$FFD7,$70F0 8
+*
+*VECTORS
+*
+       ORG     $FF9D
+       FDB     NULOB
+       FDB     ROMMAP
+       JMP     RCMOSA
+       JMP     RCMOSB
+       JMP     RCMOSD
+       JMP     WCMOSA
+       JMP     WCMOSB
+       JMP     WCMOSD
+       JMP     CWRIT
+       JMP     COFF
+       JMP     BLKCLR
+       JMP     SCRCLR
+       JMP     ROM0
+       JMP     ROM9
+       JMP     RAM2
+       JMP     GAMEOV
+       JMP     BGI
+       JMP     LJSR
+       JMP     SLEEPP
+       JMP     STBXB0
+       JMP     LDBXB0
+       JMP     SNDLD
+       FDB     APSND
+       FCB     $2A     CKBYT  CSUM F800-FFFF(ACTUAL)
+       ORG     $FFF0
+       FDB     RESET,RESET,RESET
+       FDB     RESET,IRQHK
+       FDB     RESET,RESET,RESET
+       PAGE
diff --git a/src/INFO.SRC b/src/INFO.SRC
new file mode 100755 (executable)
index 0000000..fc66243
--- /dev/null
@@ -0,0 +1,39 @@
+ TO ASSEMBLE THE DEFENDER MESS
+
+RASM PHR2,DEFA2,DEFB2,AMODE0;-X (ELSE CREF SYMBOL OVERFLOW)
+RASM PHR2,SAMEXPA7
+RASM PHR2,DEFA2,DEFB2
+TO GET THE DIAGS, CHAIN ALL.CF
+LOAD IT ALL AND THEN PRAY IT WORKS
+(NOTE: BEWARE OF ORDER OF LOADING
+       LOOK OUT FOR THE SELECTED BLOCK SHIT
+
+DR J. 1/21/81
+
+INFORMATION ABOUT THESE FILES:
+
+ROM1 THRU ROM12 ARE THE WHITE SOFTWARE (1ST RELEASE WITHOUT CHECKSUMS)
+ROM1A THRU ROM12A ARE THE BLUE SOFTWARE (1ST RELEASE WITH CHECKSUMS)
+ROM1B, ROM2A, ROM3B, ROM4B, AND ROM6A THRU ROM12A ARE THE GREEN SOFTWARE 
+ (2ND RELEASE FOR 2 2716'S INSTEAD OF 1 2532 AT D000)
+ROM1C, ROM4E, AND ALL OTHER ROMXC ARE THE RED SOFTWARE (COCKTAIL SOFTWARE-
+ ALSO RELEASED FOR ROM). NOTE THAT ROM4C AND ROM4D ARE VERSIONS OF RED THAT
+ ARE INCORRECT DUE TO THE MULTIPLE COIN PRICING ERROR.
+ROM4F IS THE GREEN SOFTWARE PRICING FIX.
+ROM10Z IS TAITO ROM10C WITH DEFAULT OF 5 SHIPS.
+
+
+THESE FILES ARE EITHER 2K/4K AND LOAD AT $6000-$67FF/$6000-$6FFF
+
+3/26/81
+
+PHR6.SRC         636 LINES
+DEFA7.SRC      3,375 LINES
+DEFB6.SRC      2,252 LINES
+AMODE1.SRC     1,310 LINES
+BLK71.SRC        723 LINES
+SAMEXAP7.SRC     382 LINES
+MESS0.SRC        955 LINES
+ROMF8.SRC        692 LINES
+ROMC0.SRC        925 LINES
+ROMC8.SRC        839 LINES
diff --git a/src/MESS0.SRC b/src/MESS0.SRC
new file mode 100755 (executable)
index 0000000..4287e2b
--- /dev/null
@@ -0,0 +1,952 @@
+       TTL     MESS0 - MESSAGE BLOCK REV 0 - 12/22/80
+       NMLIST
+       NOGEN
+       SETDP   $A0
+*
+* EQUATES
+*
+INITS  EQU     $A000
+PNUMB  EQU     INITS+6
+INITDS EQU     PNUMB+2
+SCOREN EQU     INITDS+4
+       ORG     $A03A   LOCAL RAM HERE
+*
+* LOCAL RAM VARIABLES DURING DIAGS
+*
+TEMP1A RMB     1
+TEMP1B RMB     1
+TEMP1C RMB     1
+TEMP2A RMB     2
+TEMP2B RMB     2
+TEMP2C RMB     2
+TEMP2D RMB     2
+TMPAD  RMB     2       XHATCH
+ASBUFF RMB     1       ADVANCE SWITCH WITH AUTO BUFFER
+ASLAST RMB     1       ADVANCE SWITCH WITH AUTO LAST POSITION
+ASCNTR RMB     1       ADVANCE SWITCH WITH AUTO COUNTER
+CURSR2 RMB     2       USER CURSER
+CHARSP RMB     1       HORIZONTAL SPACE BETWEEN CHARACTERS(TEXT ROUTINE)
+LINESP RMB     1       VERTICAL SPACING BETWEEN LINE CENTERS(TEXT ROUTINE)
+TOPL   RMB     2       TOP LEFT ADDRESS(TEXT ROUTINE)
+CURSER RMB     2       CURSER ADDRESS(TEXT ROUTINE)
+MESPT  RMB     2       MESSAGE POINTER(TEXT ROUTINE)
+WORDPT RMB     2       WORD POINTER(TEXT ROUTINE)
+MESEND RMB     2       MESSAGE END(TEXT ROUTINE)
+SPACEF RMB     1       SPACE FLAG(TEST ROUTINE)
+NUMBER RMB     2       NUMBER(NUMBER ROUTINE)
+ROMPTR RMB     2       ROM TABLE POINTER(COMPREHENSIVE ROM TEST)
+LSCC00 RMB     1       LAST STATE OF PAI AT CC00
+LSCC04 RMB     1       LAST STATE OF PAI AT CC04 PLAYER 1
+LSCC06 RMB     1       LAST STATE OF PAI AT CC06 PLAYER 1
+LCC042 RMB     1       LAST STATE OF PAI AT CC04 PLAYER 2
+LCC062 RMB     1       LAST STATE OF PAI AT CC06 PLAYER 2 
+DISTBL RMB     38      DISPLAY TABLE(SWITCH TEST)
+*
+*
+       ORG     $C000
+*
+* VECTORS INTO MESSAGE ROM
+*
+N0V    FDB     N0
+TV1    JMP     WTEXTB
+TV2    JMP     ETEXTB
+TV3    JMP     WTEXTC
+TV4    JMP     ETEXTC
+TV5    JMP     WNUMBB
+TV6    JMP     ENUMBB
+TV7    JMP     WNUMBC
+TV8    JMP     ENUMBC
+TV9    JMP     ERASTK
+TV10   JMP     DISSTK
+TV11   JMP     OPER$
+TV12   JMP     OPERIN
+       RMB     9       EXPANSION FOR 3 MORE
+*
+* CHECKBYTE
+*
+       FDB     $FFFF
+*
+* OPERATOR INSTRUCTION TABLE
+*
+IGAMEO FDB     VINS2,VINS3     GAME OVER
+IROMFL FDB     VINS4,0 ROM FAILURE
+IROMDO FDB     VINS4,0 ROM TEST DONE
+IRAMTS FDB     VINS5,0 RAM TEST
+IRAMFL FDB     VINS6,0 RAM FAILURE
+IRAMDO FDB     VINS6,0 RAM TEST DONE
+ICMSDO FDB     VINS7,0 CMOS RAM TEST DONE
+ICOLTS FDB     VINS5,0 COLOR RAM TEST
+ICOLDO FDB     VINS8,0 COLOR RAM TEST DONE
+IAUDTS FDB     VINS9,VINS10    AUDIO TEST
+ISWTTS FDB     VINS11,0 SWITCH TEST
+IMONTS FDB     VINS2,VINS12 MONITOR TEST
+IAUD1  FDB     VINS13,VINS14 AUDIT/GAME ADJUST
+IAUD2  FDB     VINS17,0 PART TWO
+*
+* MESSAGE VECTORS
+*
+VINITT FDB     INITT   "INITIAL TESTS INDICATE "
+VUNIOK FDB     UNIOK   "UNIT OK "
+VWROM  FDB     WROM    "ROM "
+VWRAM  FDB     WRAM    "RAM "
+VROMFL FDB     ROMFL   "ROM FAILURE "
+VRAMFL FDB     RAMFL   "RAM FAILURE "
+VGAMOV FDB     GAMOV   "GAME OVER "
+VALROM FDB     ALROM   "ALL ROMS OK "
+VRAMTS FDB     RAMTS   "RAM TEST "
+VNORAM FDB     NORAM   "NO RAM ERRORS DETECTED "
+VCMSFL FDB     CMSFL   "CMOS RAM FAILURE 
+*                       TEST MUST BE ENTERED
+*                       WITH COIN DOOR OPEN " 
+VCMSOK FDB     CMSOK   "CMOS RAM OK "
+VCMSAB FDB     CMSAB   "MULTIPLE RAM FAILURE,
+*                       CMOS RAM CAN NOT BE TESTED "
+VCOLTS FDB     COLTS   "COLOR RAM TEST
+*                       VERTICAL COLOR BARS INDICATE 
+*                       COLOR RAM FAILURE "
+VAUDTS FDB     AUDTS   "AUDIO TEST
+*                       SOUND "
+VSWTTS FDB     SWTTS   "SWITCH TEST "
+VMONTS FDB     MONTS   "MONITOR TEST PATTERNS "
+VSW0   FDB     SW0     "AUTO UP "
+VSW1   FDB     SW1     "ADVANCE "
+VSW2   FDB     SW2     "RIGHT COIN "
+VSW3   FDB     SW3     "HIGHSCORE RESET "
+VSW4   FDB     SW4     "LEFT COIN "
+VSW5   FDB     SW5     "CENTER COIN "
+VSW6   FDB     SW6     "INVALID SWITCH "
+VSW7   FDB     SW7     "INVALID SWITCH "
+VSW8   FDB     SW8     "FIRE "
+VSW9   FDB     SW9     "THRUST "
+VSWA   FDB     SWA     "SMART BOMB "
+VSWB   FDB     SWB     "HYPERSPACE "
+VSWC   FDB     SWC     "TWO PLAYERS "
+VSWD   FDB     SWD     "ONE PLAYER "
+VSWE   FDB     SWE     "REVERSE "
+VSWF   FDB     SWF     "DOWN "
+VSW10  FDB     SW10    "UP "
+VSW11  FDB     SW11    "INVALID SWITCH "
+VSW12  FDB     SW12    "INVALID SWITCH "
+VSW13  FDB     SW13    "INVALID SWITCH "
+VSW14  FDB     SW14    "INVALID SWITCH "
+VSW15  FDB     SW15    "INVALID SWITCH "
+VSW16  FDB     SW16    "INVALID SWITCH "
+VSW17  FDB     SW17    "INVALID SWITCH "
+VINS1  FDB     INS1    "PRESS ADVANCE WITH SWITCH SET FOR: "
+VINS2  FDB     INS2    "AUTO FOR GAME AUDIT, GAME ADJUSTMENT "
+VINS3  FDB     INS3    "MANUAL FOR ROM TEST "
+VINS4  FDB     INS4    "AUTO FOR RAM TEST "
+VINS5  FDB     INS5    "AUTO TO EXIT TEST "
+VINS6  FDB     INS6    "AUTO FOR CMOS RAM TEST "
+VINS7  FDB     INS7    "AUTO FOR COLOR RAM TEST "
+VINS8  FDB     INS8    "AUTO FOR AUDIO TEST "
+VINS9  FDB     INS9    "AUTO FOR SWITCH TEST "
+VINS10 FDB     INS10   "MANUAL TO TEST AN INDIVIDUAL SOUND "
+VINS11 FDB     INS11   "AUTO FOR MONITOR TEST PATTERNS "
+VINS12 FDB     INS12   "MANUAL TO STEP THRU PATTERNS "
+VINS13 FDB     INS13   "AUTO FOR GAME OVER"
+VINS14 FDB     INS14   "MANUAL TO STEP THRU ADJUST"
+VINS15 FDB     INS15   "WILLIAMS DEFENDER"
+VINS16 FDB     INS16   "PRESS ADV TO STEP THRU TEST"
+VINS17 FDB     INS17   "PRESS HIGH SCORE RESET"
+*
+* AMODE MESSAGE VECTORS
+*
+LANDV  FDB     LAND
+MUTV   FDB     MUT
+SWRMPV FDB     SWRMP
+BOMBV  FDB     BOMBR
+SWARMV FDB     SWARM
+BAITV  FDB     BAIT
+CREDV  FDB     CRED
+SCANV  FDB     SCAN
+ELECV  FDB     ELEC
+*
+* EUGENE'S VECTORS
+*
+PLYR1  FDB     PLAYR1
+PLYR2  FDB     PLAYR2
+BONSX  FDB     BONUSX
+P1S    FDB     P1STA
+P12S   FDB     P12STA
+ATWV   FDB     ATW     "ATTACK WAVE"
+COMPV  FDB     COMP    "COMPLETED"
+*
+* SAM'S VECTORS
+*
+HOFV   FDB     HOF
+INIT$V FDB     INIT$
+HALLDV FDB     HALLD
+HALENV FDB     HALEN
+VMEND  FDB     MEND    END OF MESSAGES
+*
+* MESSAGES
+*
+INITT  FDB     INITAL,TESTS,INDCAT
+UNIOK  FDB     UNIT,OK
+WROM   FDB     ROM
+WRAM   FDB     RAM
+ROMFL  FDB     ROM,FAILUR
+RAMFL  FDB     RAM,FAILUR
+GAMOV  FDB     GAME,OVER
+ALROM  FDB     ALL,ROMS,OK
+RAMTS  FDB     RAM,TEST
+NORAM  FDB     NO,RAM,ERRORS,DETECT
+CMSFL  FDB     CMOSW,RAM,FAILUR
+       FCB     RTC,$28,$A0
+       FDB     TEST,MUST,BE,ENTERD
+       FCB     RLF
+       FDB     WITH,COINW,DOOR,OPEN
+CMSOK  FDB     CMOSW,RAM,OK
+CMSAB  FDB     MULTIP,RAM,FAILUR
+       FCB     HMC,$FE
+       FDB     CCOMA
+       FCB     VMT,$10,HMT,$F8
+       FDB     CMOSW,RAM,CAN,NOT,BE,TESTED
+COLTS  FDB     COLOR,RAM,TEST
+       FCB     VMT,$30,HMT,$E8
+       FDB     VERTIC,COLOR,BARS,INDCAT
+       FCB     RLF,HMC,$FC
+       FDB     COLOR,RAM,FAILUR
+AUDTS  FDB     AUDIO,TEST
+       FCB     RLF,RLF,HMC,4
+       FDB     SOUND
+SWTTS  FDB     SWITCH,TEST
+MONTS  FDB     MONITR,TEST,PATRNS
+SW0    FDB     AUTO,UP
+SW1    FDB     ADVANC
+SW2    FDB     RIGHT,COINW
+SW3    FDB     HSR
+SW4    FDB     LEFT,COINW
+SW5    FDB     CENTER,COINW
+SW6    FDB     INVSW
+SW7    FDB     INVSW
+SW8    FDB     FIRE
+SW9    FDB     THRUST
+SWA    FDB     SMART,BOMB
+SWB    FDB     HYPERS
+SWC    FDB     TWO,PLAYRS
+SWD    FDB     ONE,PLAYER
+SWE    FDB     REVERS
+SWF    FDB     DOWN
+SW10   FDB     UP
+SW11   FDB     INVSW
+SW12   FDB     INVSW
+SW13   FDB     INVSW
+SW14   FDB     INVSW
+SW15   FDB     INVSW
+SW16   FDB     INVSW
+SW17   FDB     INVSW
+INS1   FDB     PRESS,ADVANC,WITH,SWITCH,SET,FOR
+       FCB     HMC,$FE
+       FDB     CCOLON
+INS2   FDB     AUTO,FOR,AUDIT
+       FCB     HMC,$FE
+       FDB     CCOMA,GAME,ADJUST
+INS3   FDB     MANUAL,FOR,ROM,TEST
+INS4   FDB     AUTO,FOR,RAM,TEST
+INS5   FDB     AUTO,TO,EXIT,TEST
+INS6   FDB     AUTO,FOR,CMOSW,RAM,TEST
+INS7   FDB     AUTO,FOR,COLOR,RAM,TEST
+INS8   FDB     AUTO,FOR,AUDIO,TEST
+INS9   FDB     AUTO,FOR,SWITCH,TEST
+INS10  FDB     MANUAL,TO,TEST,INDIVL,SOUNDS
+INS11  FDB     AUTO,FOR,MONITR,TEST,PATRNS
+INS12  FDB     MANUAL,TO,STEP,THRU,PATRNS
+INS13  FDB     AUTO,FOR,GAME,OVER
+INS14  FDB     MANUAL,TO,STEP,THRU,ADJUST
+INS15  FDB     WILLAM,DEFEND
+INS16  FDB     PRESS,ADVANC,TO,STEP,THRU,TEST
+INS17  FDB     PRESS,HSR,TO,MAKE,CHANGE
+*
+* AMODE MESSAGES
+*
+LAND   FDB     LANDER
+       FCB     RLF,HMC,6
+       FDB     N150    
+MUT    FDB     MUTANT
+       FCB     RLF,HMC,6
+       FDB     N150    
+SWRMP  FDB     POD
+       FCB     RLF,HMC,0       
+       FDB     N1000   
+BOMBR  FDB     BOMBER
+       FCB     RLF,HMC,6
+       FDB     N250    
+SWARM  FDB     SWARMR
+       FCB     RLF,HMC,8
+       FDB     N150            
+BAIT   FDB     BAITER
+       FCB     RLF,HMC,6
+       FDB     N200    
+CRED   FDB     CREDW$
+SCAN   FDB     SCANER
+ELEC   FDB     ELECTR
+       FCB     RLF,RLF,HMC,12
+       FDB     PRESEN
+*
+* EUGENE'S MESSAGES
+*
+PLAYR1 FDB     PLAYER,ONE
+PLAYR2 FDB     PLAYER,TWO
+BONUSX FDB     BX
+P1STA  FDB     PRESS,ONE,PLAYER,START
+P12STA FDB     PRESS,ONE,OR,TWO,PLAYER,START
+ATW    FDB     ATTACK,WAVE
+COMP   FDB     COMPLE
+*
+* SAM'S MESSAGES
+*
+HOF    FDB     YOU,HAVE,QUALIF,FOR
+       FCB     RLF
+       FDB     THE,DEFEND,H.O.F
+       FCB     RLF,RLF
+       FDB     SELECT,INITLS,WITH,UP,DOWN,STICK
+       FCB     RLF,RLF
+       FDB     PRESS,FIRE,TO,ENTER,INITAL
+INIT$  FDB     INITS
+       FCB     HMT,8
+       FDB     INITS+2
+       FCB     HMT,16
+       FDB     INITS+4
+HALLD  FDB     H.O.F
+       FCB     RTC,$22,$68
+       FDB     TODAYS
+       FCB     HMT,$3E
+       FDB     ALL,TIME
+       FCB     RLF,HMC,$FC     
+       FDB     GREAT
+       FCB     HMT,$3D
+       FDB     GREAT
+HALEN  FDB     PNUMB
+       FCB     HMT,$5
+       FDB     INITDS
+       FCB     HMT,$13
+       FDB     SCOREN
+MEND   EQU     *       
+*
+*       WORDS
+*
+ADJUST FCC     "ADJUSTMENT/"
+ADVANC FCC     "ADVANCE/"
+ALL    FCC     "ALL/"
+ATTACK FCC     "ATTACK/"
+AUDIO  FCC     "AUDIO/"
+AUDIT  FCC     "AUDIT/"
+AUTO   FCC     "AUTO/"
+BAITER FCC     "BAITER/"
+BARS   FCC     "BARS/"
+BE     FCC     "BE/"
+BOMB   FCC     "BOMB/"
+BOMBER FCC     "BOMBER/"
+BX     FCC     "BONUS X/"
+CAN    FCC     "CAN/"
+CCOMA  FCC     ",/"
+CCOLON FCC     ":/"
+CENTER FCC     "CENTER/"
+CHANGE FCC     "CHANGE/"
+CMOSW  FCC     "CMOS/"
+COINW  FCC     "COIN/"
+COLOR  FCC     "COLOR/"
+COMPLE FCC     "COMPLETED/"
+CREDW  FCC     "CREDIT/"
+CREDW$ FCC     "CREDITS:/"
+DEFEND FCC     "DEFENDER/"
+DETECT FCC     "DETECTED/"
+DOOR   FCC     "DOOR/"
+DOWN   FCC     "DOWN/"
+ELECTR FCC     "ELECTRONICS INC./"
+ENTER  FCC     "ENTER/"
+ENTERD FCC     "ENTERED/"
+ERRORS FCC     "ERRORS/"
+EXIT   FCC     "EXIT/"
+FAILUR FCC     "FAILURE/"
+FIRE   FCC     "FIRE/"
+FOR    FCC     "FOR/"
+GAME   FCC     "GAME/"
+GREAT  FCC     "GREATEST/"
+H.O.F  FCC     "HALL OF FAME/"
+HAVE   FCC     "HAVE/"
+HSR    FCC     "HIGHSCORE RESET/"
+HYPERS FCC     "HYPERSPACE/"
+INDCAT FCC     "INDICATE/"
+INDIVL FCC     "INDIVIDUAL/"
+INITAL FCC     "INITIAL/"
+INITLS FCC     "INITIALS/"
+INVSW  FCC     "INVALID SWITCH/"
+LANDER FCC     "LANDER/"
+LEFT   FCC     "LEFT/"
+MAKE   FCC     "MAKE/"
+MANUAL FCC     "MANUAL/"
+MONITR FCC     "MONITOR/"
+MULTIP FCC     "MULTIPLE/"
+MUST   FCC     "MUST/"
+MUTANT FCC     "MUTANT/"
+N150   FCC     "150/"
+N200   FCC     "200/"
+N250   FCC     "250/"
+N1000  FCC     "1000/"
+NO     FCC     "NO/"
+NOT    FCC     "NOT/"
+OK     FCC     "OK/"
+ONE    FCC     "ONE/"
+OPEN   FCC     "OPEN/"
+OR     FCC     "OR/"
+OVER   FCC     "OVER/"
+PATRNS FCC     "PATTERNS/"
+PLAYER FCC     "PLAYER/"
+PLAYRS FCC     "PLAYERS/"
+POD    FCC     " POD/"
+PRESEN FCC     "PRESENTS/"
+PRESS  FCC     "PRESS/"
+QUALIF FCC     "QUALIFIED/"
+RAM    FCC     "RAM/"
+REVERS FCC     "REVERSE/"
+RIGHT  FCC     "RIGHT/"
+ROM    FCC     "ROM/"
+ROMS   FCC     "ROMS/"
+SCANER FCC     "SCANNER/"
+SELECT FCC     "SELECT/"
+SET    FCC     "SET/"
+SLAM   FCC     "SLAM/"
+SMART  FCC     "SMART/"
+SOUND  FCC     "SOUND/"
+SOUNDS FCC     "SOUNDS/"
+START  FCC     "START/"
+STEP   FCC     "STEP/"
+STICK  FCC     "STICK/"
+SWARMR FCC     "SWARMER/"
+SWITCH FCC     "SWITCH/"
+TEST   FCC     "TEST/"
+TESTED FCC     "TESTED/"
+TESTS  FCC     "TESTS/"
+THE    FCC     "THE/"
+THRU   FCC     "THRU/"
+THRUST FCC     "THRUST/"
+TILT   FCC     "TILT/"
+TIME   FCC     "TIME/"
+TO     FCC     "TO/"
+TODAYS FCC     "TODAYS/"
+TWO    FCC     "TWO/"
+UNIT   FCC     "UNIT/"
+UP     FCC     "UP/"
+VERTIC FCC     "VERTICAL/"
+WAVE   FCC     "WAVE/"
+WILLAM FCC     "WILLIAMS/"
+WITH   FCC     "WITH/"
+YOU    FCC     "YOU/"
+*          
+* CHARACTER DESCRIPTOR TABLE
+*
+CHRTBL FDB     $0108,SPACE SPACE   DESCRIPTER TABLE
+       FDB     $0108,EXCLPT ESCLAMATION POINT
+       FDB     $0108,COMMA COMMA
+       FDB     $0308,QUESMK QUESTION MARK
+       FDB     $0108,PERIOD PERIOD
+       FDB     $0308,QUESMK QUESTION MARK
+N0     FDB     $0308,NUMBR0 NUMBER 0
+       FDB     $0308,NUMBR1 NUMBER 1
+       FDB     $0308,NUMBR2 NUMBER 2
+       FDB     $0308,NUMBR3 NUMBER 3
+       FDB     $0308,NUMBR4 NUMBER 4
+       FDB     $0308,NUMBR5 NUMBER 5
+       FDB     $0308,NUMBR6 NUMBER 6
+       FDB     $0308,NUMBR7 NUMBER 7
+       FDB     $0308,NUMBR8 NUMBER 8
+       FDB     $0308,NUMBR9 NUMBER 9
+       FDB     $0108,COLON COLON
+       FDB     $0308,QUESMK QUESTION MARK
+ALPHA0 FDB     $0308,BLANK BLANK BLOCK
+       FDB     $0308,LETTRA LETTER A
+       FDB     $0308,LETTRB LETTER B
+       FDB     $0308,LETTRC LETTER C
+       FDB     $0308,LETTRD LETTER D
+       FDB     $0308,LETTRE LETTER E
+       FDB     $0308,LETTRF LETTER F
+       FDB     $0308,LETTRG LETTER G
+       FDB     $0308,LETTRH LETTER H
+       FDB     $0208,LETTRI LETTER I
+       FDB     $0308,LETTRJ LETTER J
+       FDB     $0308,LETTRK LETTER K
+       FDB     $0308,LETTRL LETTER L
+       FDB     $0408,LETTRM LETTER M
+       FDB     $0308,LETTRN LETTER N
+       FDB     $0308,LETTRO LETTER O
+       FDB     $0308,LETTRP LETTER P
+       FDB     $0308,LETTRQ LETTER Q
+       FDB     $0308,LETTRR LETTER R
+       FDB     $0308,LETTRS LETTER S
+       FDB     $0308,LETTRT LETTER T
+       FDB     $0308,LETTRU LETTER U
+       FDB     $0308,LETTRV LETTER V
+       FDB     $0408,LETTRW LETTER W
+       FDB     $0308,LETTRX LETTER X
+       FDB     $0308,LETTRY LETTER Y
+       FDB     $0308,LETTRZ LETTER Z
+*
+* CHARACTERS
+*
+*SPACE AND BLANK
+SPACE  EQU     *
+BLANK  FDB     0,0,0,0,0,0 
+       FDB     0,0,0,0,0,0 (BSZ 3*8)
+* EXCLAMATION POINT
+EXCLPT FDB     $0101,$0101,$0100,$0100
+* COMMA
+COMMA  FDB     $0000,$0000,$0001,$0110
+* PERIOD
+PERIOD FDB     $0000,$0000,$0000,$0100
+* NUMBER 0
+NUMBR0 FDB     $0101,$0101,$0101,$0100
+       FDB     $1100,$0000,$0000,$1100
+       FDB     $1111,$1111,$1111,$1100
+* NUMBER 1
+NUMBR1 FDB     $0000,$0100,$0000,$0000
+       FDB     $0111,$1000,$0000,$0000
+       FDB     $1111,$1111,$1111,$1100
+* NUMBER 2
+NUMBR2 FDB     $0101,$0000,$0001,$0100
+       FDB     $1100,$0001,$1000,$1100
+       FDB     $1111,$1110,$0000,$1100
+* NUMBER 3
+NUMBR3 FDB     $0100,$0000,$0000,$0100
+       FDB     $1100,$0011,$0000,$1100
+       FDB     $1111,$1111,$1111,$1100
+* NUMBER 4
+NUMBR4 FDB     $0000,$0101,$0000,$0000
+       FDB     $0110,$0011,$0000,$0000
+       FDB     $1111,$1111,$1111,$1100
+* NUMBER 5
+NUMBR5 FDB     $0101,$0101,$0000,$0100
+       FDB     $1110,$1011,$0000,$1100
+       FDB     $1100,$0011,$0101,$1100
+* NUMBER 6
+NUMBR6 FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1011,$1010,$1100
+       FDB     $1100,$0011,$0101,$1100
+* NUMBER 7
+NUMBR7 FDB     $0100,$0000,$0001,$0100
+       FDB     $1100,$0001,$1110,$1000
+       FDB     $1111,$1110,$0000,$0000
+* NUMBER 8
+NUMBR8 FDB     $0101,$0100,$0101,$0100
+       FDB     $1110,$1011,$1010,$1100
+       FDB     $1101,$0110,$0101,$1100
+* NUMBER 9
+NUMBR9 FDB     $0101,$0101,$0000,$0100
+       FDB     $1110,$1011,$0000,$1100
+       FDB     $1101,$0111,$0101,$1100
+* COLON
+COLON  FDB     $0000,$0100,$0001,$0000
+* QUESTION MARK
+QUESMK FDB     $0101,$0000,$0000,$0000
+       FDB     $1100,$0001,$0100,$0100
+       FDB     $1111,$1110,$0000,$0000
+* LETTER A
+LETTRA FDB     $0101,$0101,$0101,$0100
+       FDB     $1100,$0011,$0000,$0000
+       FDB     $1111,$1111,$1111,$1100
+* LETTER B
+LETTRB FDB     $0101,$0101,$0101,$0100
+       FDB     $1100,$0011,$0000,$1100
+       FDB     $1111,$1111,$1111,$1100
+* LETTER C
+LETTRC FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1010,$1010,$1100
+       FDB     $1100,$0000,$0000,$1100
+* LETTER D
+LETTRD FDB     $0101,$0101,$0101,$0100
+       FDB     $1100,$0000,$0000,$1100
+       FDB     $1011,$1111,$1111,$1000
+* LETTER E
+LETTRE FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1011,$1010,$1100
+       FDB     $1100,$0010,$0000,$1100
+* LETTER F
+LETTRF FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1011,$1010,$1000
+       FDB     $1100,$0010,$0000,$0000
+* LETTER G
+LETTRG FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1010,$1010,$1100
+       FDB     $1100,$0011,$0101,$1100
+* LETTER H
+LETTRH FDB     $0101,$0101,$0101,$0100
+       FDB     $1010,$1011,$1010,$1000
+       FDB     $0101,$0111,$0101,$0100
+* LETTER I
+LETTRI FDB     $0101,$0101,$0101,$0100
+       FDB     $1010,$1010,$1010,$1000
+* LETTER J
+LETTRJ FDB     $0000,$0000,$0001,$0100
+       FDB     $0000,$0000,$0000,$1100
+       FDB     $1111,$1111,$1111,$1100
+* LETTER K
+LETTRK FDB     $0101,$0101,$0101,$0100
+       FDB     $0000,$0111,$0100,$0000
+       FDB     $0110,$0000,$0010,$0100
+* LETTER L
+LETTRL FDB     $0101,$0101,$0101,$0100
+       FDB     $1010,$1010,$1010,$1100
+       FDB     $0000,$0000,$0000,$1100
+* LETTER M
+LETTRM FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1010,$1010,$1000
+       FDB     $1110,$1010,$0000,$0000
+       FDB     $1111,$1111,$1111,$1100
+* LETTER N
+LETTRN FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1010,$1010,$1000
+       FDB     $1101,$0101,$0101,$0100
+* LETTER O
+LETTRO FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1010,$1010,$1100
+       FDB     $1101,$0101,$0101,$1100
+* LETTER P
+LETTRP FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1011,$1010,$1000
+       FDB     $1101,$0111,$0000,$0000
+* LETTER Q
+LETTRQ FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1010,$1010,$1100
+       FDB     $1101,$0101,$0111,$1110
+* LETTER R
+LETTRR FDB     $0101,$0101,$0101,$0100
+       FDB     $1110,$1011,$1010,$1000
+       FDB     $1101,$0111,$1001,$0100
+* LETTER S
+LETTRS FDB     $0101,$0101,$0000,$0100
+       FDB     $1110,$1011,$0000,$1100
+       FDB     $1100,$0011,$1111,$1100
+* LETTER T
+LETTRT FDB     $1100,$0000,$0000,$0000
+       FDB     $1111,$1111,$1111,$1100
+       FDB     $1100,$0000,$0000,$0000
+* LETTER U
+LETTRU FDB     $0101,$0101,$0101,$0100
+       FDB     $1010,$1010,$1010,$1100
+       FDB     $0101,$0101,$0101,$1100
+* LETTER V
+LETTRV FDB     $0101,$0101,$0100,$0000
+       FDB     $0000,$0000,$0010,$0100
+       FDB     $0101,$0101,$0110,$0000
+* LETTER W
+LETTRW FDB     $0101,$0101,$0101,$0000
+       FDB     $1010,$1010,$1010,$0100
+       FDB     $1010,$1010,$1010,$0100
+       FDB     $1010,$1010,$1010,$0000
+* LETTER X
+LETTRX FDB     $0101,$0000,$0001,$0100
+       FDB     $0000,$1001,$1000,$0000
+       FDB     $0101,$1000,$1001,$0100
+* LETTER Y
+LETTRY FDB     $0101,$0000,$0000,$0000
+       FDB     $0000,$1001,$0101,$0100
+       FDB     $0101,$1000,$0000,$0000
+* LETTER Z
+LETTRZ FDB     $0100,$0000,$0101,$0100
+       FDB     $1100,$0110,$0000,$1100
+       FDB     $1110,$0000,$0000,$1100
+*
+* UPPER HALF CHECKBYTE
+*
+       FDB     $FFFF
+*
+* MESSAGE INSTRUCTION TABLE
+*
+RSP    EQU     0       RESET SPACE BETWEEN CHARACTERS       <2 BYTES>
+RLS    EQU     1       RESET LINE SPACING                   <2 BYTES>
+HMT    EQU     2       HORIZONTAL MOVE RELATIVE TO TOP LEFT <2 BYTES>
+HMC    EQU     3       HORIZONTAL MOVE RELATIVE TO CURSER   <2 BYTES>
+VMT    EQU     4       VERTICAL MOVE RELATIVE TO TOP LEFT   <2 BYTES>
+VMC    EQU     5       VERTICAL MOVE RELATIVE TO CURSER     <2 BYTES>
+RTC    EQU     6       RESET TOP LEFT AND CURSER            <3 BYTES>
+RLF    EQU     7       RETURN(TO TOPL LEFT), LINE FEED      <1 BYTE>
+PIC    EQU     8       PICTURE                              <3 BYTES>
+*
+* OPERATOR INSTRUCTIONS
+*
+*    Y POINTING TO TABLE
+*
+*
+OPER$  PSHS    U,X,Y   SAVE STATE
+       LDU     #VINS16 "PRESS ADVANCE TO STEP"
+       BRA     OPER0   DO BELOW
+OPERIN PSHS    U,X,Y
+       LDU     #VINS1  "PRESS ADVANCE WITH SW..."
+OPER0  LDX     #$18CE  SCREEN ADDRESS
+       JSR     WTEXTB  OUTPUT IT
+       LDU     ,Y++    GET POINTER
+       BEQ     OPER1   NO, INSTRUCTION SKIP
+       LDX     #$10DA  SCREEN ADDRESS
+       JSR     WTEXTB  WRITE IT OUT
+OPER1  LDU     ,Y++
+       BEQ     OPER2   DONE!
+       LDX     #$10E4  SCREEN ADDRESS
+       JSR     WTEXTB  DO IT
+OPER2  PULS    X,Y,U,PC GO BACK CLEAN
+*
+* ERASE A "WORD FROM THE SCREEN
+*
+ERASTK PSHS    U,Y,X,D,CC
+       LDY     #COFFV
+       BRA     DISST0  DO BELOW
+*
+* OUTPUT A "WORD" FROM 32 BYTES OF STACK
+*
+DISSTK PSHS    U,Y,X,D,CC
+       LDY     #CWRITV
+DISST0 LDD     #TEXT3  POINT TO HANDLER
+       STY     TEMP2A
+       STD     TEMP2B
+       STX     CURSER  PUT DOWN CURSER
+       STX     TOPL    SET TOP LEFT
+       LDX     #$010A  STANDARD SPACING
+       STX     CHARSP
+       CLR     SPACEF
+       LDU     5,S     GET IT
+       STU     WORDPT  SAVE AS POINTER
+       LEAU    32,U    MOVE IT TO END
+       STU     MESEND  SAVE AS END
+       STU     MESPT   AND POINTER
+       BRA     TEXT3   GO DO BELOW
+* 
+* TEXT ROUTINE         X IS TOP LEFT ADDRESS
+*                      U IS MESSAGE VECTOR ADDRESS
+*
+*      ALL REGISTERS SAVED 
+*      EXCEPT CARRY BIT(0-MESSAGE IN PROGRESS
+*                       1-MESSAGE COMPLETED)  
+*
+* WRITE TEXT BLOCK
+WTEXTB PSHS    U,Y,X,D,CC <=START HERE TO WRITE TEXT BLOCK
+       LDY     #CWRITV
+       LDD     #TEXT3
+       BRA     TEXT1
+* ERASE TEXT BLOCK
+ETEXTB PSHS    U,Y,X,D,CC <=START HERE TO ERASE TEXT BLOCK
+       LDY     #COFFV
+       LDD     #TEXT3
+       BRA     TEXT1
+* WRITE TEXT CHARACTER
+WTEXTC PSHS    U,Y,X,D,CC <=START HERE TO WRITE TEXT CHARACTER
+       LDY     #CWRITV
+       LDD     #TEXT8
+       BRA     TEXT1
+* ERASE TEXT CHARACTER
+ETEXTC PSHS    U,Y,X,D,CC <=START HERE TO ERASE TEXT CHARACTER
+       LDY     #COFFV
+       LDD     #TEXT8
+TEXT1  STY     TEMP2A  SAVE WRITE/ERASE SELECT
+       STD     TEMP2B  SAVE BLOCK/CHARACTER SELECT
+TEXT2  TST     MESPT   CHECK IF NEW MESSAGE
+       BNE     TEXT3   NO, SKIP INITIALIZATION
+* NEW MESSAGE
+       STX     CURSER  SET CURSOR
+       STX     TOPL    SET TOP LEFT
+       LDX     #$010A  SET CHARACTER AND LINE SPACINGS
+       STX     CHARSP
+       CLR     SPACEF  CLEAR SPACE FLAG
+       LDX     2,U     GET END OF MESSAGE
+       STX     MESEND  SAVE IT
+       LDX     ,U      GET MESSAGE POINTER
+       BRA     TEXT5   BRANCH TO NEXT WORD OR INSTRUCTION
+* NEXT CHARACTER
+TEXT3  TST     SPACEF  CHECK SPACE FLAG
+       BNE     TEXT9   YES SPACE?, PROCESS NEXT WORD OR INSTRUCTION
+       LDX     WORDPT  GET WORD POINTER
+       LDB     ,X+     GET ASCII CHARACTER AND ADVANCE WORD POINTER
+       CMPB    #$2F    CHECK FOR END OF WORD "/"
+       BNE     TEXT7   BRANCH TO CHARACTER PROCESSING
+       LDB     #$20    MAKE CHARACTER A SPACE
+       STB     SPACEF  SET SPACE FLAG
+       BRA     TEXT7   PROCESS SPACE
+* NEXT WORD OR INSTRUCTION
+TEXT9  CLR     SPACEF  CLEAR SPACE FLAG
+       LDX     MESPT   GET MESSAGE POINTER
+TEXT4  CMPX    MESEND  CHECK IF DONE
+       BNE     TEXT5   CONTINUE
+TEXT4A CLR     MESPT   ZERO MESSAGE POINTER
+       PULS    CC,D,X,Y,U
+       ORCC    #1      SET CARRY-MESSAGE COMPLETED
+       RTS
+TEXT5  LDU     ,X++    GET NEXT WORD OR INSTRUCTION
+       BMI     TEXT6   BRANCH TO WORD PROCESSING
+* INSTRUCTION PROCESSING
+       LEAX    -1,X    BACKUP MESSAGE POINTER
+       TFR     U,D     TRANSFER INSTRUCION INTO A
+       CMPA    #8      CHECK IF INSTRUCTION IS VALID
+       BHI     TEXT4A  NO? QUIT MESSAGE
+       ASLA            MULTIPLY BY 2
+       LDY     #INSTBL GET INSTRUCTION TABLE ADDRESS
+       JSR     [A,Y]   EXECUTE INSTRUCTION
+       BRA     TEXT4   NEXT WORD OR INSTRUCTION
+* WORD PROCESSING
+TEXT6  STX     MESPT   SAVE MESSAGE POINTER
+       STU     WORDPT  SAVE WORD POINTER
+       BRA     TEXT3   BRANCH TO NEXT CHARACTER
+* CHARACTER PROCESSING
+TEXT7  STX     WORDPT  SAVE WORD POINTER
+       SUBB    #$20
+       CMPB    #1      CHECK IF SPACE OR EXCLAMATION PT.
+       BLS     TEXT7B  YES?, WRITE IT
+       CMPB    #11     CHECK INVALID
+       BLS     TEXT7A  YES?, CHANGE TO QUEST MK
+       SUBB    #10
+       CMPB    #16     CHECK FOR NEXT VALID GROUP
+       BLS     TEXT7B  YES?, WRITE IT
+       CMPB    #20     CHECK INVALID
+       BLS     TEXT7A  YES?, CHANGE TO QUEST MK
+       SUBB    #4
+       CMPB    #44     CHECK FOR LAST VALID GROUP
+       BLS     TEXT7B  YES?, WRITE IT
+TEXT7A LDB     #3      CHANGE INVALID CHAR TO QUEST MK
+TEXT7B ASLB            MULTIPLY CHARACTER BY 4
+       ASLB
+       LDX     #CHRTBL GET CHARACTER DESCRIPTER TABLE
+       ABX     FIND    CHARACTER DESCRIPTER
+       TFR     X,Y     SET CHARACTER DESCRIPTER POINTER
+       LDD     CURSER  SET CURSER
+       LDX     TEMP2A  WRITE/ERASE CHARACTER
+       JSR     ,X
+       ADDA    ,Y      ADVANCE CURSER CHARACTER WIDTH
+       ADDA    CHARSP  ADVANCE CURSER CHARACTER SPACING
+       STA     CURSER  SAVE CURSER
+       LDX     TEMP2B  NEXT TEXT BYTE / QUIT
+       JMP     ,X
+TEXT8  PULS    CC,D,X,Y,U
+       ANDCC   #$FE    CLEAR CARRY-MESSAGE NOT COMPLETED
+       RTS             RETURN FROM WRITE/ERASE CHARACTER
+* INSTRUCTION ADDRESS TABLE
+INSTBL FDB     RSP1,RLS1,HMT1,HMC1,VMT1,VMC1,RTC1,RLF1,PIC1
+* RESET SPACE BETWEEN CHARACTERS
+RSP1   LDA     ,X+     GET NEXT TEXT BYTE
+       STA     CHARSP  RESET CHARSP
+       RTS
+* RESET LINE SPACING
+RLS1   LDB     ,X+     GET NEXT TEXT BYTE
+       STB     LINESP  RESET LINESP
+       RTS
+* HORIZONTAL MOVE RELATIVE TO TOP LEFT
+HMT1   LDA     TOPL    GET TOP LEFT HORIZONTAL
+       ADDA    ,X+     ADD NEXT TEXT BYTE
+       STA     CURSER  RESET CURSER HORIZONTAL
+       RTS
+* HORIZONTAL MOVE RELATIVE TO CURSER
+HMC1   LDA     CURSER  GET CURSER HORIZONTAL
+       ADDA    ,X+     ADD NEXT TEXT BYTE
+       STA     CURSER  RESET CURSER HORIZONTAL
+       RTS
+* VERTICAL MOVE RELATIVE TO TOP LEFT
+VMT1   LDB     TOPL+1  GET TOP LEFT VERTICAL
+       ADDB    ,X+     ADD NEXT TEXT BYTE
+       STB     CURSER+1 RESET CURSER VERTICAL
+       RTS
+* VERTICAL MOVE RELATIVE TO CURSER
+VMC1   LDB     CURSER+1 GET CURSER VERTICAL
+       ADDB    ,X+     ADD NEXT TEXT BYTE
+       STB     CURSER+1 RESET CURSER VERTICAL
+       RTS
+* RESET TOP LEFT AND CURSER
+RTC1   LDD     ,X++    GET NEXT TWO TEXT BYTES
+       STD     TOPL    RESET TOP LEFT
+       STD     CURSER  RESET CURSER
+       RTS
+* RETURN(TO TOPL LEFT), LINE FEED
+RLF1   LDA     TOPL    GET TOP LEFT HORIZONTAL
+       LDB     CURSER+1 GET CURSER VERTICAL
+       ADDB    LINESP  ADD LINE SPACING TO VERTICAL
+       STD     CURSER  RESET CURSER
+       RTS
+* PICTURE
+PIC1   LDY     ,X++    GET NEXT TWO TEXT BYTES
+       STX     MESPT   SAVE MESSAGE POINTER
+       LDX     TEMP2A  WRITE/ERASE PICTURE
+       JSR     ,X
+       ADDA    ,Y      ADVANCE CURSER PICTURE WIDTH
+       ADDA    CHARSP  ADVANCE CURSER CHARACTER SPACING
+       STA     CURSER  SAVE CURSER
+       LEAS    2,S     POP STACK
+       LDX     TEMP2B  NEXT TEXT BYTE / QUIT
+       JMP     ,X
+*
+* NUMBER ROUTINE       X IS TOP LEFT ADDRESS,
+*                          CHANGED AFTER NUMBER COMPLETED
+*                      D IS BCD NUMBER
+*                      CHARSP IS USED AS SPACING
+*
+*       NUMBER IS SHIFTED ONE NIBBLE AT A TIME LEFT
+*          AND REPLACED BY F, AS IT IS WRITTEN TO SCREEN
+*          (EX. 5349 => 349F => 49FF => 9FFF => FFFF DONE) 
+*
+* WRITE NUMBER BLOCK
+WNUMBB PSHS    U,Y,X,D,CC <=START HERE TO WRITE NUMBER BLOCK 
+       LDY     #CWRITV
+       LDU     #NUMB4
+       BRA     NUMB1
+* ERASE NUMBER BLOCK
+ENUMBB PSHS    U,Y,X,D,CC <=START HERE TO ERASE NUMBER BLOCK
+       LDY     #COFFV
+       LDU     #NUMB4
+       BRA     NUMB1
+* WRITE NUMBER DIGIT
+WNUMBC PSHS    U,Y,X,D,CC <=START HERE TO WRITE NUMBER DIGIT
+       LDY     #CWRITV
+       LDU     #NUMB6
+       BRA     NUMB1
+* ERASE NUMBER DIGIT
+ENUMBC PSHS    U,Y,X,D,CC <=START HERE TO ERASE NUMBER DIGIT
+       LDY     #COFFV
+       LDU     #NUMB6
+NUMB1  STY     TEMP2A  SAVE WRITE/ERASE SELECT
+       STU     TEMP2B  SAVE BLOCK/DIGIT SELECT
+       LDU     NUMBER
+       CMPU    #$FFFF  CHECK IF NEW NUMBER
+       BNE     NUMB3A  CONTINUE OLD NUMBER
+       STX     CURSER  SAVE SCREEN POSITION
+       STD     NUMBER  SAVE NUMBER
+       BNE     NUMB2   CHECK FOR >0
+       LDD     #$0FFF  DISPLAY ONE DIGIT "0"
+       BRA     NUMB3   SKIP LEADING 0 SUPRESSION
+NUMB2  BITA    #$F0    TEST LEADING DIGIT
+       BNE     NUMB3   NOT 0
+       BSR     NUMB10  SHIFT ONE NIBBLE LEFT
+       BRA     NUMB2
+NUMB3  STD     NUMBER  SAVE NUMBER
+NUMB3A LDD     NUMBER  GET NUMBER
+NUMB4  ANDA    #$F0    EXTRACT NEXT DIGIT
+       CMPA    #$F0    CHECK IF FINISHED
+       BNE     NUMB5   NO, CONTINUE
+       PULS    CC,D,X,Y,U
+       LDX     CURSER  NEW SCREEN POSITION
+       ORCC    #1      SET CARRY BIT(NUMBER COMPLETED)
+       RTS             RETURN
+NUMB5  LSRA            DIVIDE NUMBER BY 4
+       LSRA
+       LDX     #N0     SET DIGIT DESCRIPTER
+       LEAY    A,X
+       LDD     CURSER  SET SCREEN POSITION
+       LDX     TEMP2A  WRITE/ERASE DIGIT
+       JSR     ,X
+       ADDA    ,Y      ADVANCE CURSER DIGIT WIDTH
+       ADDA    CHARSP  ADVANCE CURSER CHARACTER SPACING
+       STA     CURSER  SAVE CURSER
+       LDD     NUMBER  GET NUMBER
+       BSR     NUMB10  SHIFT ONE NIBBLE LEFT
+       STD     NUMBER
+       LDX     TEMP2B  NEXT DIGIT / QUIT
+       JMP     ,X
+NUMB6  PULS    CC,D,X,Y,U
+       ANDCC   #$FE    CLEAR CARRY BIT(NUMBER NOT FINISHED)
+       RTS             RETURN
+NUMB10 ASLB            SHIFT ONE NIBBLE LEFT
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ASLB
+       ROLA
+       ORB     #$0F
+       RTS
+       PAGE
diff --git a/src/PHR6.SRC b/src/PHR6.SRC
new file mode 100755 (executable)
index 0000000..d2ea0ae
--- /dev/null
@@ -0,0 +1,635 @@
+       TTL      D E F E N D E R    1.0
+       NMLIST
+       NOGEN
+*
+*      RAM DECLARATIONS AND CONSTANTS
+*
+* HARDWARE CONSTANTS
+*
+CKBYT  EQU     $FF     CHECKSUM
+HSTK   EQU     $BFFF
+MAPC   EQU     $D000   MAP CONTROL
+RAM    EQU     $A000
+CRAM   EQU     $C000   COLOR RAM ADDR
+WDOG   EQU     $C3FC
+WDATA  EQU     $38     NORMAL SCREEN;($39=FLIPPED)
+DIABLK EQU     3
+CMOS   EQU     $C400
+SOUND  EQU     $CC02
+VERTCT EQU     $C800   6-BIT VERTICAL BEAM ADDR
+YMAX   EQU     240
+YMIN   EQU     42      MIN Y COORD
+*
+*BLOCK 7
+*TERRAIN,PLAYER EXPLOSION,WAVE TABLE
+BGINIT EQU     $C000
+BGOUT  EQU     $C003
+ALINITQ        EQU     $C006   ALTITUDE INIT
+BGERAS EQU     $C009   HYPER ROUTINE
+PXVCT  EQU     $C00E   PLAYER EXPLOSION
+WVTAB  EQU     $C011   WAVE DATA TABLE
+WVTEND EQU     $C013
+*
+*BLOCK 2
+*TEXT AND CHARACTERS
+N0V    EQU     $C000    NUMERALS
+WTBV   EQU     $C002   WRITE BLOCK
+WNBV   EQU     $C00E
+*MESSAGES
+PLYR1  EQU     $C0EF   PLAYER 1
+PLYR2  EQU     $C0F1   PLAYER 2
+BONSX  EQU     $C0F3   BONUS X
+GO     EQU     $C075   GAME OVER
+ATWV   EQU     $C0F9   ATTACK WAVE
+COMPV  EQU     $C0FB   COMPLETED
+*
+*DIAGNOSTIC BLOCK VECTORS
+*BLK 3
+VORAOK EQU     $C000   ROM RAM OK
+VOOKRB EQU     $C003   ROM OK, RAM BAD
+VOMBAD EQU     $C006   ROM BAD
+VPWRUP EQU     $C009   PWRUP
+VAUD   EQU     $C00C   AUDIT
+VAUD1  EQU     $C00F   ADD 1 TO AUDIT
+LCOINV EQU     $C012   LEFT COIN
+RCOINV EQU     $C015   RIGHT COIN
+CCOINV EQU     $C018   CENTER COIN
+RHSTDV EQU     $C01B   RESET HSTD
+VCMOSM EQU     $C01E
+VUDITG EQU     $C021
+VUTOCY EQU     $C024   AUTO CYCLE
+VCROM0 EQU     $C027   FAILURE MODES
+VRAM10 EQU     $C02A
+VRAM20 EQU     $C02D
+VOUND0 EQU     $C030
+RHSTD$ EQU     $C033   RESET TODAYS GREATS
+*
+*ATTRACT MODE VECTORS
+*BLK 1
+ATTRV  EQU     $C000   START ATTRACT
+SCNRV  EQU     $C003   SCANNER SUBROUTINE
+*
+*MAIN PROGRAM VECTORS
+*
+NULOBV EQU     $FF9D
+RMAPV  EQU     $FF9F   ROM MAP
+RCAV   EQU     $FFA1   READ CMOS IN A
+RCBV   EQU     $FFA4   READ CMOS IN B
+RCDV   EQU     $FFA7   READ CMOS IN D
+WCAV   EQU     $FFAA   WRITE IN A
+WCBV   EQU     $FFAD   WRITE IN B
+WCDV   EQU     $FFB0   WRITE IN D
+CWRITV EQU     $FFB3   CWRITE
+COFFV  EQU     $FFB6   COFF
+BLKCLV EQU     $FFB9
+SCRCLV EQU     $FFBC   SCREEN CLEAR
+ROMOV  EQU     $FFBF
+ROM9V  EQU     $FFC2
+RAM2V  EQU     $FFC5
+VAMEOV EQU     $FFC8   TEST EXIT
+BGIV   EQU     $FFCB   BACKGROUND INIT
+LJSRV  EQU     $FFCE   LONG JSR W/ BLOCK SWAP+SAVE
+SLEPPV EQU     $FFD1   SLEEP WITH BLOCK SAVE
+STBXBV EQU     $FFD4   STORE B AT X BLOCK ZERO
+LDBXBV EQU     $FFD7   LOAD B AT X BLOCK ZERO
+SNDLDV EQU     $FFDA   SOUND ROUTINE
+APSNDV EQU     $FFDD   APPEAR SOUND
+*
+*EXPLOSION, APPEAR VECTORS
+*
+APVCT  EQU     $FC60   APPEAR
+XSVCT  EQU     $FC63   EXPLOSION
+XUVCT  EQU     $FC66   EXPLOSION UPDATE
+ALTBL  EQU     $B300
+*
+* EXPLOSION,APPEAR EQUATES
+*
+RSIZE  EQU     0       SIZE (MSB IS APPEAR FLAG)  
+OBDESC EQU     2       OBJECT DESCRIPTER ADDRESS
+ERASES EQU     4       ERASE TABLE START
+CENTER EQU     6       CENTER OF EXPANSION
+TOPLFT EQU     8       NORMAL SIZE TOP LEFT ADDRESS
+OBJPTR EQU     10      OBJECT LIST POINTER (APPEAR ONLY)
+RAMSIZ EQU     $40     LENGTH OF RAM ALLOCATION
+RAMEND EQU     $A000   RAM ALLOCATION END + 1
+EXPLSV EQU     $DC00   EXPLOSION START VECTOR
+APERSV EQU     $DC02   APPEAR START VECTOR
+EXPNUV EQU     $DC04   EXPANDED UPDATE VECTOR
+*
+*PIA DEFINITIONS
+*
+PIA0   EQU     $CC00
+*B0 AUTO UP
+*B1 ADVANCE
+*B2 RCOIN
+*B3 HSRESET
+*B4 LCOIN
+*B5 CCOIN
+*B6 LED1
+*B7 LED2
+*CA2 SLAM
+*CA1 IRQ
+PIA1   EQU     $CC02
+*B0-B5 SOUND
+*B6-B7 LEDS
+*CB2 IRQ
+PIA2   EQU     $CC04
+*B0 FIRE
+*B1 THRUST
+*B2 SMART BOMB
+*B3 HYPERSPACE
+*B4 START 2
+*B5 START 1
+*B6 REV
+*B7 DOWN
+*
+PIA3   EQU     $CC06
+*B0 UP
+*B7 INPUT 1=COCKTAIL
+*CB2 OUTPUT SWITCH MUX CONTROL 1=PLAYER1,0=PLAYER2
+*SCORE DISPLAY CONSTANTS
+P1SBD  EQU     $291B
+P2SBD  EQU     $8B1B
+P1DISP EQU     $0F1C   TOP LEFT PLAYER 1
+P2DISP EQU     $711C   TOP LEFT PLAYER 2
+DIGLTH EQU     4*256   DIGIT LENGTH
+P1LAS  EQU     $0F14
+P2LAS  EQU     $7114
+SCANH  EQU     YMIN-34 SCANNER HEIGHT
+SCANER EQU     $3000+SCANH SCANNER
+*
+* CMOS RAM ALLOCATION
+*
+       ORG     CMOS
+DIPFLG RMB     1       DIPSW SET FLAG
+SLOT1  RMB     4       LEFT COIN TOTAL
+SLOT2  RMB     4       CENTER COIN TOTAL
+SLOT3  RMB     4       RIGHT COIN TOTAL
+TOTPDC RMB     4       TOTAL PAID CREDITS
+TOTRPL RMB     4       TOTAL REPLAYS
+BLLTIM RMB     4       BALL TIME IN MINS
+BLLCNT RMB     4       TOTAL "BALLS" PLAYED
+CMSDEF EQU     *
+CRHSTD RMB     12      FOR ALL TIME HSTD
+       RMB     12      ALL TIME #2
+       RMB     12
+       RMB     12
+       RMB     12
+       RMB     12
+       RMB     12
+       RMB     12
+CREDST EQU     *       CREDITS BACKUP
+DIPSW  RMB     2       DIPSW FUNCTIONS WHEN DIPFLG SET
+       ORG     CMOS+$7F PUT IT ACCROSS BOUNDARY
+CMOSCK RMB     2       FOR BOUNDARY BYTE
+REPLAY RMB     4       REPLAY LEVEL
+NSHIP  RMB     2       # OF SHIPS/GAME
+COINSL RMB     2       FOR COINAGE SELECT MODE
+SLOT1M RMB     2       LEFT COIN MULT
+SLOT2M RMB     2       CENTER COIN MULT
+SLOT3M RMB     2       RIGHT COIN MULT
+CUNITC RMB     2       COIN UNITS PER CREDIT
+CUNITB RMB     2       COIN UNITS FOR BONUS
+MINUNT RMB     2       MINIMUM REQD
+FREEPL RMB     2       FREE PLAY MODE
+GA1    RMB     2       GAME ADJUSTS - 1 DIFFICULTY
+       RMB     2       2 DIFFICULTY CEILING
+       RMB     2       3 BGSND
+       RMB     2       4 RESTORE WAVE #
+       RMB     2       5
+       RMB     2       6
+       RMB     2       7
+       RMB     2       8
+       RMB     2       9
+       RMB     2       10
+*
+*EXPLOSION RAM ALLOCATION
+*
+       ORG     $9C00
+RAMALS RMB     RAMEND-RAMALS
+*
+*BASE PAGE RAM AREA
+*
+       ORG     RAM
+BGSAV  RMB     32      RESERVED FOR TERRAIN
+BGL    RMB     2       TERRAIN LEFT POINTER
+BGLX   RMB     2       OLD TERRAIN LEFT
+GTIME  RMB     1       GAME TIMER
+PDFLG  RMB     1       SPACE HOLDER PLAYER DIED
+PCRAM  RMB     16      PSEUDO COLOR RAM
+MAPCR  RMB     1
+CREDIT RMB     1
+CUNITS RMB     1
+BUNITS RMB     1
+TEMP1A RMB     1
+TEMP1B RMB     1       
+TEMP1C RMB     1
+TEMP2A RMB     2
+TEMP2B RMB     2
+TEMP2C RMB     2
+TEMP2D RMB     2
+TEMP2E RMB     2
+ASBUFF RMB     1       ADVANCE SWITCH WITH AUTO BUFFER
+ASLAST RMB     1       ADVANCE SWITCH WITH AUTO LAST POSITION
+ASCNTR RMB     1       ADVANCE SWITCH WITH AUTO COUNTER
+CURSR2 RMB     2       USER CURSER
+CHARSP RMB     1       HORIZONTAL SPACE BETWEEN CHARACTERS(TEXT ROUTINE)
+LINESP RMB     1       VERTICAL SPACING BETWEEN LINE CENTERS(TEXT ROUTINE)
+TOPL   RMB     2       TOP LEFT ADDRESS(TEXT ROUTINE)
+CURSER RMB     2       CURSER ADDRESS(TEXT ROUTINE)
+MESPT  RMB     2       MESSAGE POINTER(TEXT ROUTINE)
+WORDPT RMB     2       WORD POINTER(TEXT ROUTINE)
+MESEND RMB     2       MESSAGE END(TEXT ROUTINE)
+SPACEF RMB     1       SPACE FLAG(TEST ROUTINE)
+NUMBER RMB     2       NUMBER(NUMBER ROUTINE)
+ROMPTR RMB     2       ROM TABLE POINTER(COMPREHENSIVE ROM TEST)
+TIMER  RMB     1       FIRQ TIMER
+OVCNT  RMB     1
+ACTIVE RMB     2       POINTER TO LIST OF CURRENTLY ACTIVE (SLEEPING) PROCS.
+FREE   RMB     2       POINTER TO LIST OF UNALLOCATED PROCESS SLEEP SPACE.
+CRPROC RMB     2       POINTER TO SLEEP AREA OF CURRENTLY EXECUTING PROCESS.
+OPTR   RMB     2       OBJECT LIST POINTER
+OFREE  RMB     2       FREE LIST POINTER
+SPFREE RMB     2       SUPER PROCESS FREE LIST
+IPTR   RMB     2       INACITVE OBJECT LIST PTR
+SPTR   RMB     2       SHELL LIST POINTER
+ITEMP  RMB     2       INTERUPT TEMP
+ITEMP2 RMB     2
+XTEMP  RMB     2       SAVE AREA FOR QUICK TEMPORARY
+XTEMP2 RMB     2
+TEMP48 RMB     2       OUTPUT ROUTINE TEMP
+PIA01  RMB     1
+PIA02  RMB     1
+PIA21  RMB     1       N-1 PIA2
+PIA22  RMB     1       N-2 PIA2
+PIA31  RMB     1       N-1 PIA3
+SLMCNT RMB     1       SLAM,COIN DEBOUNCERS
+LCCNT  RMB     1
+RCCNT  RMB     1
+CCCNT  RMB     1
+SWPROC RMB     8       SWITCH SCAN TEMP
+SCRFLG RMB     1       PLAYER SCORE FLAG
+CURPLR RMB     1       CURRENT
+PLRCNT RMB     1       NUMBER OF PLAYERS
+PLRX   RMB     2       CURRENT PLAYER INDEX STORE
+IRQHK  RMB     3       IRQ RAM VECTOR
+IFLG   RMB     1       IRQ FLAG
+PCX    RMB     2
+BGDELT RMB     2
+SETEND RMB     2       SCANNER ERASE TABLE END
+BMBCNT RMB     1       BOMBS ACTIVE
+SBFLG  RMB     1       SMART BOMB FLAG
+TPTR   RMB     2       TARGET LIST INDEX
+SHTEMP RMB     2       SHELL ROUTINE
+THX    RMB     2       THRUST TABLE INDEX
+XXX1   RMB     1       SCREEN OUTPUT PARAMS
+XXX2   RMB     1
+XXX3   RMB     1
+FISX   RMB     2       LAS FISSLE TABLE INDEX
+BAX    RMB     2       BOMB IMAGE PTR
+FBX    RMB     2       FIREBALL INDEX
+TFLG   RMB     1       TIE DIRECTION
+REPLA  RMB     2       REPLAY LEVEL
+THFLG  RMB     1       THRUST SOUND FLAG
+STRCNT RMB     1       STARS ACTIVE COUNT
+REVFLG RMB     1       REV SWITCH DEBOUNCE
+*SOUND RAM
+SNDX   RMB     2       TABLE INDEX
+SNDPRI RMB     1       PRIORITY
+SNDTMR RMB     1
+SNDREP RMB     1
+*LASER DATA STRUCTURE
+LFLG   RMB     1
+LCOLRX RMB     1
+PWRFLG RMB     1       POWER ON FLAG
+WCURS  RMB     2       WILLI CURSER CHECK
+*
+*STATUS FLAG
+*B7=GAME OVER
+*B6=PLAYER CONTROLS INACTIVE
+*B5=STARS,OBJECTS,SHELLS
+*B4=PLAYER IMAGE COLLISION INACTIVE
+*B3=PLAYER DEAD
+*B2=APPEARS,EXPLOSIONS DISABLE
+*B1=TERRAIN INACTIVE
+*B0=PLAYER START DELAY-NO HYPER
+STATUS RMB     1
+*
+*PLAYER DIRECTION+THRUST
+NPLAD  RMB     2       NEW PLAYER DIRECTION
+PLADIR RMB     2
+*PLAYER COORDINATES
+*UPPER LEFT 
+PLAXC  RMB     1
+PLAYC  RMB     1
+*NEW
+NPLAXC RMB     1
+NPLAYC RMB     1
+*16 BIT
+PLAX16 RMB     2
+PLAY16 RMB     2
+*PLAYER VELOCITY
+PLAXV  RMB     3
+PLAYV  RMB     2
+*ABSOLUTE X
+PLABX  RMB     2
+*
+*COLLISION ROUTINE PARAMETERS
+*
+XCNT   RMB     1       SCAN COUNTS
+YCNT   RMB     1
+OX1    RMB     1       OFFSETS
+OY1    RMB     1
+PX1    RMB     1
+PY1    RMB     1
+OBHT   RMB     1       HT TEMPS
+PLHT   RMB     1
+ULX    RMB     1       UPPER LEFT COORD
+ULY    RMB     1       "
+LRX    RMB     1
+LRY    RMB     1
+CTEMP  RMB     2       INDEX TEMP
+CTEMP2 RMB     2
+PCFLG  RMB     1       PLAYER COLLISION
+*RANDOM        VARIABLES
+SEED   RMB     1
+HSEED  RMB     1
+LSEED  RMB     1
+*
+*EXPLOSION DIRECT PAGE VARIABLES
+*
+LSEXPL RMB     2       LAST EXPLOSION RAM
+XOFF   RMB     1
+YOFF   RMB     1
+FLAVOR RMB     1
+SIZE   RMB     1
+DSIZE  RMB     1
+XSTART RMB     2
+YSTART RMB     2
+ODDEVN RMB     2
+VSTART RMB     2
+WIDTHC RMB     1
+LENGTC RMB     1
+DATPTR RMB     2
+YSKIP  RMB     1
+BLKADD RMB     2
+CENTMP RMB     2
+*ASTRONAUT COUNT
+ASTCNT RMB     1
+*
+*ENEMIES LIST
+*WARNING DO NOT CHANGE ORDER OF COUNTS
+ELIST  EQU     *
+*RESERVE COUNTS
+LNDRES RMB     1       # OF LANDERS
+TIERES RMB     1       "
+PRBRES RMB     1
+SCZRES RMB     1
+SWMRES RMB     1
+ELIST1 EQU     *
+WAVTIM RMB     1       TIME FOR NEXT WAVE
+WAVSIZ RMB     1       SIZE OF WAVE
+LNDXV  RMB     1       LANDER HORIZ VEL
+LNDYV  RMB     2
+LDSTIM RMB     1       LANDER SHOOT TIME
+TIEXV  RMB     1
+SZRY   RMB     1       SHITZO RANDOM Y JUMP
+SZYV   RMB     2       Y VEL
+SZXV   RMB     1
+SZSTIM RMB     1       SHOT TIMER
+SWXV   RMB     1       SWARM X V
+SWSTIM RMB     1       SWARM SHOT TIMER
+SWAC   RMB     1       SWARM ACCEL MASK
+UFOTIM RMB     1       UFO TIMER
+UFSTIM RMB     1       " SHOTS
+UFOSK  RMB     1       UFO SEEK PROBABILITY
+ELEND  EQU     *
+*ACTIVE COUNTS, NON RESTORE
+ECNTS  EQU     *
+LNDCNT RMB     1
+TIECNT RMB     1
+PRBCNT RMB     1
+SCZCNT RMB     1
+SWCNT  RMB     1
+WAVTMR RMB     1
+UFOTMR RMB     1
+UFOCNT RMB     1
+ECEND  EQU     *
+*
+*TARGET LIST
+*
+TLIST  EQU     *
+       RMB     40
+TLEND  EQU     *
+*
+*LASER FISSLE TABLE
+*
+FISTAB RMB     32
+FISEND EQU     *
+*
+*THRUST TABLE
+*
+HSRFLG EQU     *       HIGH SCORE RESET FLAG(ATTRACT MODE)
+THTAB  RMB     64
+THTEND EQU     *
+*FIREBALL TABLE
+FBTAB  RMB     32
+FBTEND EQU     *
+*
+*PLAYER DATA TABLE
+*
+PLDATA EQU     *
+.P1SCR RMB     4       SCORE MSB 1ST
+.P1RP  RMB     3       NEXT REPLAY LEVEL
+.P1LAS RMB     1       #OF LASERS
+.P1WAV RMB     1       WAVE # IN HEX
+.P1SBC RMB     1       SMART BOMBS
+.P1TRG RMB     1       ASTRONAUTS
+.P1ENM RMB     50      ENEMY STATE
+.P1END EQU     *
+.P2SCR RMB     4
+.P2RP  RMB     3
+.P2LAS RMB     1
+.P2WAV RMB     1
+.P2SBC RMB     1
+.P2TRG RMB     1
+.P2ENM RMB     50
+PLDEND EQU     *       END OF PLAYER DATA
+PLDLEN EQU     .P1END-PLDATA
+PSCOR  EQU     .P1SCR-PLDATA
+PRPLA  EQU     .P1RP-PLDATA
+PLAS   EQU     .P1LAS-PLDATA
+PWAV   EQU     .P1WAV-PLDATA
+PSBC   EQU     .P1SBC-PLDATA
+PTARG  EQU     .P1TRG-PLDATA
+PENEMY EQU     .P1ENM-PLDATA
+*
+*MASTER OBJECT LIST
+*
+OLIST  EQU     *
+OSIZE  EQU     $17
+*
+*INDEX OFFSETS
+*
+OLINK  EQU     0       LINK TO NEXT
+OPICT  EQU     2       PICTURE DESCRIPTOR ADDR
+OBJX   EQU     4       UPPER LEFT SCREEN X
+OBJY   EQU     5       UPPER LEFT SCREEN Y
+OBJID  EQU     6       ASSOCIATED PROCESS ID (IF ANY)
+OCVECT EQU     8       COLLISION ROUTINE ADDR
+OX16   EQU     $A      16 BIT X WORLD COORD
+OY16   EQU     $C      16 BIT Y WORLD COORD
+OXV    EQU     $E      X VELOCITY
+OYV    EQU     $10     Y VELOCITY
+OBJCOL EQU     $12     SCANNER BLIP
+OTYP   EQU     $14     OBJECT TYPE
+ODATA  EQU     $15     MISC. DATA
+*RESERVE AREA
+       RMB     (95)*OSIZE
+OLEND  EQU     *
+*
+*USER DEFINED OBJECT TYPES
+*0=NORMAL,HYPERABLE
+*1=LANDER PICKING UP NON-HYP
+*2(BIT 1)= APPEAR NON-HYP
+*$10=EARTHLING NON-HYP,NON SMART BOMB
+*$11=SIGN POST NON-HYP,NON SB
+*
+*USER DEFINED PROCESS TYPES
+*
+STYPE  EQU     0       SYSTEM PROCESS
+ATYPE  EQU     1
+CTYPE  EQU     2
+*
+*SLEEPING PROCESS TABLE
+*
+PTAB   EQU     *
+*
+*OFFSET CONSTANTS
+*
+PLINK  EQU     0
+PADDR  EQU     2
+PTIME  EQU     4
+PTYPE  EQU     5
+PCOD   EQU     6
+PDATA  EQU     7
+PD     EQU     7
+PD1    EQU     8
+PD2    EQU     9
+PD3    EQU     10
+PD4    EQU     11
+PD5    EQU     12
+PD6    EQU     13
+PD7    EQU     14
+PSIZE  EQU     15
+       RMB     15*(75)
+TABEND EQU     *
+*
+*SUPER PROCESSES
+*
+SPSIZE EQU     PSIZE+8
+SPTAB  RMB     SPSIZE*5
+SPTEND EQU     *
+*
+*STAR DATA STRUCTURE
+*
+SMAP   EQU     *
+.SX    RMB     1
+.SY    RMB     1       X,Y COORDS
+.SCOL  RMB     1
+       RMB     1       WASTER
+SNUM   EQU     16
+SLGTH  EQU     4
+       RMB     (SNUM-1)*SLGTH RESERVE SPACE
+SMEND  EQU     *
+*OFFSET CONSTANTS
+SX     EQU     0
+SY     EQU     .SY-.SX
+SCOL   EQU     .SCOL-.SX
+*
+*MONOCHROME TABLE
+*
+MONOTB RMB     128
+*
+*SCANNER ERASE TABLES
+*
+SETAB  RMB     200     OBJECTS
+STETAB RMB     128     TERRAIN
+*
+*OBJECT PICTURE STRUCTURE
+*
+OBJW   EQU     0
+OBJH   EQU     1
+OBJP0  EQU     2
+OBJP1  EQU     OBJP0+2
+OBJWRT EQU     OBJP0+4
+OBJDEL EQU     OBJP0+6
+OBJL   EQU     OBJDEL+2
+*
+*HI SCORE TABLE
+*STORED MSB-LSB XYZ
+       ORG     $B260
+THSTAB RMB     12*8    TODAYS
+*
+*M A C R O S
+*
+SHL    MACRO   \0,\1,\2
+       JSR     GETSHL
+       FDB     \0,\1,\2
+       ENDM
+KILP   MACRO   \0,\1
+       JSR     KILPOS
+       FDB     $\0
+       FDB     \1
+       ENDM
+KILO   MACRO   \0,\1
+       JSR     KILOS
+       FDB     $\0
+       FDB     \1
+       ENDM
+*INIT OBJECT
+OBI    MACRO   \0,\1,\2
+       JSR     OBINIT
+       FDB     \0,\1,\2
+       ENDM
+CLRD   MACRO
+       CLRA
+       CLRB
+       ENDM
+
+DIE    MACRO
+       JMP     SUCIDE  DIE!
+       ENDM
+*
+NAP    MACRO   \0,\1
+       LDA     #\0     TIME
+       LDX     #\1     WAKEUP ADDR
+       JMP     SLEEP
+       ENDM
+*
+*MAKE A NEW PROCESS
+*
+NEWP   MACRO   \0,\1
+       LDX     #\0     ADDR
+       LDA     #\1     TYPE
+       JSR     MKPROC
+       ENDM
+*
+*OBJECT OFF MACRO
+*
+OBJOFF MACRO   \0
+       IFEQ    NARG-1
+       LDY     #\0
+       ENDC
+       JSR     COFF
+       ENDM
+*
+*OBJECT        ON MACRO
+*
+OBJON  MACRO   \0
+       IFEQ    NARG-1
+       LDY     #\0
+       ENDC
+       JSR     CWRIT
+       ENDM
+       PAGE
diff --git a/src/ROMC0.SRC b/src/ROMC0.SRC
new file mode 100755 (executable)
index 0000000..5c03ec5
--- /dev/null
@@ -0,0 +1,926 @@
+       TTL     ROMC0 - DIAG ROM AT C000 - 12/22/80
+*
+* SYSTEM EQUATES
+*
+LETCOL EQU     $C001   USE COLOR 1!!!
+THSTAB EQU     $B260   HOME!!
+KILSND EQU     $13     SOUND NUMBER TO TURN OFF SOUNDS
+LSOUND EQU     $1F     LAST SOUND TO BE TESTED
+SWSND  EQU     $08     SOUND MADE FOR SWCLOSURE
+*
+*
+* DIAGNOSTIC ROM
+*
+*
+       ORG     DIAORG  POINT TO START
+*
+* VECTORED JUMPS INTO ROM HERE
+*
+       JMP     RORAOK
+       JMP     ROOKRB
+       JMP     ROMBAD
+       JMP     PWRUP
+       JMP     AUD
+       JMP     AUD1
+       JMP     COINL
+       JMP     COINR
+       JMP     COINC
+       JMP     RHSTD
+       JMP     CMOSMV
+       JMP     AUDITG
+       JMP     AUTOCY
+       JMP     CROM0
+       JMP     CRAM10
+       JMP     CRAM20
+       JMP     SOUND0
+       JMP     RHSTD$
+OUTB0  JMP     STBXBV  DIRECT
+INB0   JMP     LDBXBV  DIRECT
+*
+* INDIRECT TO BLOCK 2 TEXT ROUTINES
+*
+VWTEXT JSR     LJSRV   GO TO BLOCK 2
+       FDB     TV1
+       FCB     2
+       RTS
+VETEXT JSR     LJSRV
+       FDB     TV2
+       FCB     2
+       RTS
+VWNUMB JSR     LJSRV
+       FDB     TV5
+       FCB     2
+       RTS
+VENUMB JSR     LJSRV
+       FDB     TV6
+       FCB     2
+       RTS
+VERAST JSR     LJSRV
+       FDB     TV9
+       FCB     2
+       RTS
+VDISST JSR     LJSRV
+       FDB     TV10
+       FCB     2
+       RTS
+VOPER$ JSR     LJSRV
+       FDB     TV11
+       FCB     2
+       RTS
+VOPERI JSR     LJSRV
+       FDB     TV12
+       FCB     2
+       RTS
+*
+* CHECKBYTE
+*
+       FDB     $FFFF
+*
+* INITIAL ROM OK, RAM OK
+*
+RORAOK JSR     NEWTST
+       LDB     #$7A    GREEN LETTERS
+       JSR     SETCOL  SET COLOR
+       LDU     #VINITT "INITIAL TESTS INDICATE "
+       LDX     #$2870  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDU     #VUNIOK "UNIT OK "
+       LDX     #$4090  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDB     #$F     FLASH ALL LEDS TWICE
+       JSR     FLASHL
+       LDY     #3000   3 SECOND DELAY
+       JMP     DELAY   AND RTS BACK TO MAIN
+*
+* INTIIAL ROM OK, RAM BAD
+*
+ROOKRB JSR     NEWTST
+       LDB     #$57    RED LETTERS
+       JSR     SETCOL  SET COLORS
+       LDU     #VINITT "INITIAL TESTS INDICATE "
+       LDX     #$2870  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDU     #VRAMFL "RAM FAILURE "
+       LDX     #$3890  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       BRA     IDIS30  WAIT 30 SECONDS THEN RETURN 
+*
+* INTITAL ROM BAD
+*
+ROMBAD JSR     NEWTST
+       LDB     #$57    RED LETTERS
+       JSR     SETCOL  SET COLORS
+       LDU     #VINITT "INITIAL TESTS INDICATE "
+       LDX     #$2860  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDU     #VROMFL "ROM FAILURE "
+       LDX     #$3880  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       TFR     DP,A    CHECK IF RAM ALSO BAD
+       CMPA    #$9E
+       BEQ     IDIS30
+*
+* RAM BAD ALSO
+       LDU     #VRAMFL "RAM FAILURE "
+       LDX     #$38A0  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+* 30 SECOND DELAY - CHECK ADVANCE SWITCH
+IDIS30 LDY     #3000   30 SECOND DELAY
+IDIS31 JSR     DELY10  DELAY 10 MILLISECONDS
+       LDX     #$CC00  READ COIN DOOR SWITCHES
+       JSR     INB0
+       BITB    #2      CHECK FOR ADVANCE
+       BEQ     IDIS32  NO ADVANCE?, CONTINUE
+       LSRB            CHECK AUTO/MANUAL SWITCH
+       BCS     IDIS33  AUTO?, BACK TO MAIN PROGRAM
+       BRA     CROM0   MANUAL?, JUMP TO DIAGNOSTICS
+IDIS32 LEAY    -1,Y    COUNT DOWN TIME
+       BNE     IDIS31
+IDIS33 RTS             BACK TO MAIN PROGRAM
+*
+* POWER UP SUBROUTINE
+*
+PWRUP  ANDCC   #$EF    REMOVE CONTINUOUS TEST IF GET BACK HERE
+       LDX     #CMOSCK GO READ CHECK BYTE
+       JSR     RCBV
+       CMPB    #$5A    OK
+       BNE     PWRUP0  NO
+       LDX     #DIPFLG CHECK FOR SPECIAL FUNCTION
+       JSR     INB0
+       ANDB    #$F     REMOVE GARBAGE
+       BNE     PWRUP4  YES?, WHICH FUNCTION?
+       RTS             NO?, DONE
+*SPECIAL FUNCTION
+PWRUP4 CLRB            CLEAR SPECIAL FUNCTION FLAG
+       JSR     OUTB0
+       LDX     #DIPSW  GET FUNCTION NUMBER
+       JSR     RCBV
+       CLRA            ZERO FUNCTION NUMBER
+       LEAX    -2,X
+       JSR     WCAV
+       CMPB    #$15    AUTO CYCLE?
+       BNE     PWRUP2  NO
+AUTOCY ANDCC   #$7F    CLEAR AUTO CYCLE FLAG
+       BRA     CROM0   GO DO ROM TEST
+PWRUP2 CMPB    #$25    RESET HIGH SCORE TABLES?
+       BNE     PWRUP3  NO
+       JMP     RHSTD   RESET THEM
+PWRUP3 CMPB    #$35    CLEAR AUDITS?
+       BNE     PWRUP1  NO
+       JMP     CLRAUD  CLEAR THEM
+PWRUP1 CMPB    #$45    DEFAULT?
+       BEQ     PWRUP0  YES, DO IT
+       RTS
+PWRUP0 LEAS    2,S     REMOVE THIS CALL
+       JSR     CMINIT  INIT CMOS
+       JMP     AUDITG  GO TO AUDIT SECTION
+*
+* COMPREHENSIVE ROM TEST
+*
+CROM0  ORCC    #$10    SET COMPREHENSIVE FLAG
+       JSR     NEWTST
+       JSR     ROM0V
+       PSHS    U       SAVE A BIT
+       LDU     RMAPV   GET IT INDIRECT
+       LEAU    24,U    GET TO THE END
+       STU     TEMP2D  SAVE A BIT
+       PULS    U       GET IT BACK
+       CMPU    TEMP2D  DONE?
+       BEQ     CROM10  ROMS ALL OK
+* ROM FAILURE
+       STU     ROMPTR  SAVE ROM TABLE POINTER
+       LDB     #8      LIGHT LED1
+       JSR     LEDS
+       LDB     #$57    RED LETTERS
+       JSR     SETCOL  SET COLORS
+       LDU     #VROMFL "ROM FAILURE "
+       LDX     #$3860  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #IROMFL GIVE INSTRUCTIONS
+       JSR     VOPERI
+       LDD     #$4266  SET CURSER
+       STD     CURSR2
+CROM1  LDX     CURSR2  GET CURSER
+       LEAX    10,X    ADVANCE IT
+       STX     CURSR2  SAVE CURSER
+       LDU     #VWROM  "ROM "
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDU     RMAPV   GET INDIRECTLY
+       STU     TEMP2D  SAVE #
+       LDU     ROMPTR  RESTORE ROM POINTER
+       LDD     ROMPTR  GET ROM TABLE POINTER
+       SUBD    TEMP2D  DETERMINE WHICH ROM FAILED
+       LSRB
+       BCS     CROM2   ERROR IN FIRST HALF
+       LEAU    1,U     FORGET ABOUT OTHER HALF
+CROM2  INCB
+       STB     TEMP1A  SAVE ROM NUMBER
+       JSR     CONVTB  CONVERT FROM HEX TO BCD
+       LDX     CURSER  STEAL CURSER FROM TEXT
+       JSR     VWNUMB  WRITE NUMBER TO SCREEN
+       JSR     WATCHD  RESET WATCHDOG
+       JSR     ROM9V   CONTINUE
+       STU     ROMPTR  SAVE ROM POINTER
+       LDU     RMAPV   GET IT
+       LEAU    24,U    INDIRECTLY
+       CMPU    ROMPTR  DONE?
+       BNE     CROM1   ANOTHER FAILURE
+       JSR     ADVSW   WAIT FOR ADVANCE SWITCH
+       TST     ASCNTR  CHECK FOR AUTO UP
+       BNE     CRAM0   YES?, NEXT TEST
+       LDB     TEMP1A  GET LAST BAD ROM NUMBER
+       JSR     LEDS    DISPLAY ON LEDS
+       LDY     #IROMDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       BRA     CROM20  WAIT FOR ADVANCE THEN RAM TEST
+* ROMS OK
+CROM10 TFR     CC,B    CHECK AUTO CYCLE NOT FLAG <===========TEMPORORY
+       TSTB
+       BPL     CRAM0A  CLEAR?, NEXT TEST            <===========
+       LDB     #$7A    GREEN LETTERS
+       JSR     SETCOL  SET COLOR
+       LDU     #VALROM "ALL ROMS OK "
+       LDX     #$3880
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #IROMDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       LDB     #8      FLASH LED 1 TWICE
+       JSR     FLASHL
+CROM20 JSR     NEXTST
+*
+* COMPREHENSIVE RAM TEST
+*
+CRAM0  JSR     NEWTST
+       CLRB            TURN OFF LEDS
+       JSR     LEDS
+       JSR     WHITE   WHITE LETTERS
+       LDU     #VRAMTS "RAM TEST "
+       LDX     #$4080
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #IRAMTS GIVE INSTRUCTIONS
+       JSR     VOPERI
+       LDY     #5000   DELAY 5 SECONDS
+       JSR     DELAY
+CRAM0A JSR     DELY10  WAIT 10 MILLISECONDS
+       TST     ASCNTR  CHECK FOR ADV W AUTO
+       LBNE    CMOS0   YES, NEXT TEST
+       TST     ASBUFF  IS ADVANCE SWITCH DEFINATELY OPEN
+       BNE     CRAM0A  NO, KEEP WAITING
+       LDX     #$C000  SET INTERESTING SCREEN COLORS
+       LDB     #$C0
+CRAM1  JSR     OUTB0
+       LDA     #$B5
+       MUL
+       EXG     A,B
+       LEAX    1,X
+       CMPX    #$C010
+       BNE     CRAM1
+       LDD     #0      ZERO RANDOM SEED
+       LDY     #$000A  INITIALIZE TEST COUNTER
+       JMP     RAM2V   BEGIN TEST
+* RAM FAILURE
+CRAM10 TFR     Y,D     GET ERROR
+       EORB    ,-X
+       EORA    ,-X
+       STD     TEMP2C  SAVE ERROR
+       STX     TEMP2D  SAVE ADDRESS
+       JSR     ZEROCL  ZERO COLORS
+       JSR     SCRCLV
+       JSR     INITDP  RE-INITIALIZE DIRECT PAGE VARIABLES
+       JSR     WATCHD  RESET WATCHDOG
+       LDB     #4      LIGHT LED 2
+       JSR     LEDS
+       LDB     #$57    COLOR LETTERS RED
+       JSR     SETCOL  SET COLOR
+       LDU     #VRAMFL "RAM FAILURE "
+       LDX     #$3870
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #IRAMFL GIVE INSTRUCTIONS
+       JSR     VOPERI
+       LDD     TEMP2C  GET ERROR IN A
+       TSTA
+       BNE     CRAM11
+       TFR     B,A
+CRAM11 CLRB            FIND BIT NUMBER
+CRAM12 INCB
+       LSRA
+       BCC     CRAM12
+       STB     TEMP1A  SAVE BAD BIT NUMBER
+       LDD     TEMP2D  GET BAD BLOCK NUMBER IN A
+CRAM13 SUBA    #3
+       BCC     CRAM13
+       ADDA    #4
+       STA     TEMP1B  SAVE BAD BLOCK NUMBER
+       LDU     #VWRAM  "RAM "
+       LDX     #$4290  SCREEN ADDRESS
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDB     TEMP1B  GET BAD BLOCK NUMBER
+       ASLB            SHIFT ONE NIBBLE LEFT
+       ASLB
+       ASLB    
+       ASLB
+       ADDB    TEMP1A  ADD BAD BIT NUMBER
+       CLRA
+       LDX     CURSER  STEAL CURSER FROM TEXT
+       JSR     VWNUMB  WRITE RAM NUMBER TO SCREEN
+       JSR     ADVSW   WAIT FOR ADVANCE SWITCH
+       TST     ASCNTR  CHECK AUTO/MANUAL SWITCH
+       BNE     CMOS0   AUTO, SKIP TO CMOS RAM TEST
+       LDA     TEMP1B  GET BAD BLOCK NUMBER
+       LDB     #$10    DISPLAY BAD BLOCK ON LEDS
+CRAM14 LSRB
+       DECA
+       BNE     CRAM14
+       JSR     LEDS
+       JSR     ADVSW   WAIT FOR ADVANCE SWITCH
+       TST     ASCNTR  CHECK AUTO/MANUAL SWITCH
+       BNE     CMOS0   AUTO, SKIP TO CMOS RAM TEST
+       LDB     TEMP1A  GET BAD BIT NUMBER
+       JSR     LEDS    DISPLAY ON LEDS
+       LDY     #IRAMDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       BRA     CRAM30  WAIT FOR ADVSW
+* RAM TEST ABORTED
+CRAM20 JSR     ZEROCL  ZERO COLORS
+       JSR     SCRCLV
+       JSR     INITDP  RE-INTIIALIZE DIRECT PAGE VARIABLES
+       JSR     WATCHD  RESET WATCHDOG
+       CMPY    #$000A  TEST FOR EARLY ABORT
+       BEQ     CMOS0   ABORTED EARLY-NEXT TEST
+       LDB     #$7A    GREEN LETTERS
+       JSR     SETCOL  SET COLOR
+       LDU     #VNORAM "NO RAM ERRORS DETECTED "
+       LDX     #$2880
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #IRAMDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       LDB     #4      FLASH LED 2 TWICE
+       JSR     FLASHL
+CRAM30 JSR     NEXTST
+*
+* CMOS RAM TEST
+*
+CMOS0  JSR     NEWTST
+       TFR     DP,A    GET CONTENTS OF CMOS RAM INTO GOOD BLOCK
+       CMPA    #$A2    DOES GOOD BLOCK EXITS?
+       BNE     CMOS10  YES?, CONTINUE
+* NO GOOD BLOCKS
+       LDB     #2      LIGHT LED 3
+       JSR     LEDS
+       LDB     #$57    COLOR LETTERS RED
+       JSR     SETCOL  SET COLOR
+       LDU     #VCMSAB "MULTIPLE RAM FAILURE, CMOS RAM CAN NOT BE TESTED"
+       LDX     #$2880
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #ICMSDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       JMP     CMOS30  WAIT FOR SWITCH THEN COLOR RAM
+*
+CMOS10 ADDA    #3      SAVE CMOS $300 ABOVE DIRECT PAGE
+       CLRB
+       STD     TEMP2C  SAVE ADDRESS
+       LDU     TEMP2C  INTO U REGISTER
+       LDX     #CMOS   CMOS STARTING ADDRESS
+CMOS11 JSR     INB0
+       STB     ,U+
+       LEAX    1,X
+       CMPX    #CMOS+$100
+       BNE     CMOS11
+       LDD     #$10    INITIALIZE PATTERN COUNTER AND CLEAR A
+       STB     TEMP1A
+* TEST LOOP
+       CLRA            ZERO TEST COUNTER
+CMOS12 LDX     #CMOS   INITIALIZE CMOS POINTER
+       LDB     TEMP1A  GET START OF PATTERN
+CMOS13 JSR     OUTB0
+       LEAX    1,X
+       INCB
+       CMPB    TEMP1A  CHECK IF DONE
+       BNE     CMOS13
+       LDX     #CMOS
+       INCA
+CMOS14 JSR     INB0
+       STB     TEMP1B
+       LEAX    1,X
+       JSR     INB0
+       SUBB    TEMP1B
+       DECB
+       ANDB    #$F     MASK UPPER NIBBLE
+       BNE     CMOS15  ERROR? ABORT TEST(TEMP1A>0)
+       INCA            CHECK COUNTER
+       BNE     CMOS14
+       JSR     WATCHD  RESET WATCHDOG
+       TST     ASCNTR  CHECK FOR ADV. W AUTO
+       BNE     CMOS15  YES?, ABORT TEST
+       DEC     TEMP1A  NEXT PATTERN
+       BNE     CMOS12
+* RECOVER CMOS
+CMOS15 LDU     TEMP2C  INTO U REGISTER
+       LDX     #CMOS   CMOS STARTING ADDRESS
+CMOS16 LDB     ,U+     TRANSFER DATA
+       JSR     OUTB0
+       LEAX    1,X
+       CMPX    #CMOS+$100 AT END?
+       BNE     CMOS16
+       TST     ASCNTR  CHECK IF OPERATOR ABORTED?
+       BNE     COLRAM  NEXT TEST
+       LDA     TEMP1A  CHECK IF TEST ABORTED?
+       BEQ     CMOS20  NO?, CMOS OK
+* CMOS RAM BAD
+       LDB     #2      LIGHT LED 3
+       JSR     LEDS
+       LDB     #$57    COLOR LETTERS RED
+       JSR     SETCOL  SET COLOR
+       JSR     WATCHD  GET THE DOGGY
+       LDU     #VCMSFL "CMOS RAM FAILURE "
+       LDX     #$3080
+       JSR     VWTEXT  WRITE TO SCREEN
+       JSR     WATCHD  GET THE DOGGY
+       LDY     #ICMSDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       BRA     CMOS30  WAIT FOR SWITCH THEN COLOR RAM TEST
+* CMOS RAM OK
+CMOS20 LDB     #$7A    GREEN LETTERS
+       JSR     SETCOL  SET COLOR
+       LDU     #VCMSOK "CMOS RAM OK "
+       LDX     #$3880
+       JSR     VWTEXT  WRITE TO SCREEN
+       LDY     #ICMSDO GIVE INSTRUCTIONS
+       JSR     VOPERI
+       LDB     #2      FLASH LED 3 TWICE
+       JSR     FLASHL
+CMO