Classic Computer Magazine Archive PROGRAM LISTING: 90-04/INVASION.SRC


0100  .OPT NOLIST
0105  *=$1F00
0110 BP
0115  LDA #2        ;INIT RESET KEY
0120  STA 9
0125  LDA #BP&255
0130  STA 2
0135  LDA #BP/256
0140  STA 3
0145  LDA #0
0150  STA 580
0155  STA LN        ;LVL VAR=0
0160  STA SP        ;SPD VAR=0
0165  STA 82        ;LMAR=0
0170  STA JLOCK     ;UNLOK JOYSTIK
0175  LDA #39
0180  STA 83        ;RMAR=0
0185  LDA #7
0190  JSR GRAPHICS
0195  LDA #64
0200  STA 16
0205  STA 53774     ;NO BREAK
0210  LDA #HPOS&255
0215  STA $C0       ;DEC ADR L
0220  STA PHPOS     ;HPOS PTR L
0225  LDA #HPOS/256
0230  STA $C1       ;DEC ADR H
0235  STA PHPOS+1   ;HPOS PTR H
0240  LDY #0
0245 MAKEDEC
0250  LDA #$DE      ;"DEC ABS,X"
0255  STA DECS,Y
0260  LDA $C0       ; ADR TO DEC L
0265  INY
0270  STA DECS,Y
0275  LDA $C1       ; ADR TO DEC H
0280  INY
0285  STA DECS,Y
0290  LDA $C0       ;INC BY 8 ADR FOR
0295  CLC           ; 'DEC' INSTR TO
0300  ADC #$08      ; GET NXT IN LYR
0305  STA $C0       ; OF STRS
0310  LDA $C1
0315  ADC #0
0320  STA $C1
0325  INY           ;MAKE NXT INSTR.
0330  CPY #72       ;DONE ALL?
0335  BCC MAKEDEC   ;N:CONT
0340  LDA #DLII&255 ;Y:INIT ADR TO
0345  STA $C0       ; MAKE DLI IN
0350  LDA #DLII/256
0355  STA $C1
0360  LDA #LT&255   ;INIT PTR TO
0365  STA PLT       ; LUM TBL
0370  LDA #LT/256
0375  STA PLT+1
0380  LDX #0        ;#DLI'S DONE
0385 OMDLI
0390  LDY #0        ;#INSTR'S DONE
0395 IMDLI
0400  LDA DLIP,Y    ;GET INSTR.
0405  STA ($C0),Y   ;PUT IN DLI
0410  INY           ;NXT BYT
0415  CPY #15       ;DONE?
0420  BCC IMDLI     ;N:GET ANOTHER
0425  LDA $C0       ;Y:INC ADR WHERE
0430  CLC           ; DLI IS PUT IN
0435  ADC #15       ; MEM
0440  STA $C0
0445  LDA $C1
0450  ADC #0
0455  STA $C1
0460  LDA PHPOS     ;CHG DLI INSTR
0465  CLC           ; TBL SO NXT DLI
0470  ADC #1        ; REFERS TO NXT
0475  STA PHPOS     ; STAR'S HPOS
0480  LDA PHPOS+1
0485  ADC #0
0490  STA PHPOS+1
0495  LDA PLT       ;SAME FOR LUM.
0500  CLC
0505  ADC #1
0510  STA PLT
0515  LDA PLT+1
0520  ADC #0
0525  STA PLT+1
0530  INX
0535  CPX #192      ;DONE 192 DLIS?
0540  BCC OMDLI     ;N:KEEP MAKING
0545  LDA #3        ;Y:ENABLE P/M
0550  STA 53277
0555  STA ERP       ;LVL 1 PSE
0560  LDA #$40      ;PMBASE=$4000
0565  STA 54279
0570  LDA #62       ;SDMCTL=SGL LINE
0575  STA 559
0580  LDA #1        ;GRPRIOR
0585  STA 623
0590  STA 752       ;CURSOR OFF
0595  LDA ELVT      ;GET LVL 1 SPD
0600  STA ELVL      ;STORE IN PGM
0605  LDA #$31      ;INIT MSGS
0610  STA LNGM
0615  STA SPGM
0620  LDA #14       ;SET UP P/M COL
0625  STA 704
0630  STA 705
0635  STA 706
0640  LDY #0
0645  TYA
0650 BLANKPM
0655  STA $4300,Y   ;CLR M1-4
0660  STA $4400,Y   ; P0
0665  STA $4500,Y   ; P1
0670  STA $4600,Y   ; P2
0675  INY
0680  BNE BLANKPM   ;DONE ALL 256?
0685  LDX #32       ;Y:X=OFSET TO M0
0690  LDA #$80
0695  STA X         ;INIT CRSHR POS
0700  STA Y
0705 FM STA $4300,X ;FILL M3
0710  INX
0715  CPX #224      ;BOT OF SCREEN?
0720  BCC FM        ;N:CONT FILL
0725  LDX #0        ;Y:INIT STR COLS
0730  STX CTR
0735 OLP
0740  LDY #0
0745 ILP
0750  LDA C,Y       ;GET LUM FROM TBL
0755  STA LT,X      ;STORE IN BIG TBL
0760  INX
0765  INY
0770  CPY #8        ;DONE W/SML TBL?
0775  BCC ILP       ;N:KEEP XFER
0780  INC CTR       ;Y:NXT GRP
0785  LDA CTR
0790  CMP #24       ;DONE W/SCREEN?
0795  BCC OLP       ;N:XFER SML TBL
0800  LDA #0        ;Y:BLK BCKGROUND
0805  STA 710
0810  TAX
0815 FILL
0820  LDA $D20A
0825  STA HPOS,X    ;RND STAR HPOS
0830  INX
0835  CPX #192      ;DONE 192?
0840  BCC FILL      ;N:MORE RND HPOS
0845  LDA 560       ;Y:SET UP DLI
0850  STA $C0       ; LINE
0855  LDA 561
0860  STA $C1
0865  LDY #2
0870  LDA ($C0),Y
0875  ORA #$80
0880  STA ($C0),Y
0885  LDA #SVBI&255 ;ADR FOR SETUP
0890  STA $0228     ; COUNTDOWN TIMER
0895  LDA #SVBI/256 ; ROUTINE
0900  STA $0229
0905  LDA #DLI&255  ;DLI ADR
0910  STA 512
0915  LDA #DLI/256
0920  STA 513
0925  LDX #0
0930 INITE
0935  LDA $D20A
0940  AND #$7F
0945  CLC
0950  ADC #60       ;RND ENM X
0955  STA EX,X
0960  AND #$3F      ;RND ENM MOVE
0965  STA ELIM,X    ; LIMIT
0970  AND #$03      ;RND ENM DX
0975  SEC
0980  SBC #1
0985  STA EDX,X
0990 REINITY
0995  LDA $D20A     ;RND ENM Y
1000  AND #$7F
1005  CLC
1010  ADC #46
1015  STA EY,X
1020  AND #$03      ;RND ENM DY
1025  SEC
1030  SBC #1
1035  BEQ REINITY   ;NO ZERO DY!
1040  STA EDY,X
1045  LDA #0        ;MVMENT CTR=0
1050  STA ECTR,X
1055  STA ELOCK,X   ;UNLOK ENM
1060  LDA #$FF      ;#VECTS MOVED=
1065  STA NV,X      ; NEG:ENM ADVANC
1070  LDA #5        ;ENM SHP CTR=5=
1075  STA ESC,X     ; SMALLEST FRAME
1080  LDA #7
1085  STA EP,X      ;TMR PSE=7
1090  STA ET,X      ;TMR=7
1095  INX
1100  CPX #3        ;DONE ALL 3 ENM?
1105  BCC INITE     ;N:INIT NEXT
1110  LDA ERP       ;Y:ENM RTN PSE*8=
1115  ASL A         ; ENM FIRING PSE
1120  ASL A
1125  ASL A
1130  STA OKF
1135  LDA #$70
1140  STA SHIELD    ;INIT SHIELD
1145  LDA #$99
1150  STA REM       ;INIT REMAINING
1155  LDA #0        ;POS 0,0
1160  STA 656
1165  STA 657
1170  STA 658
1175  TAX           ;X=IOCB0=SCRN
1180  LDA #11       ;ICCOM=PUTCHR
1185  STA $0342
1190  LDA #SMSG&255 ;ICBADR=SMSG
1195  STA $0344
1200  LDA #SMSG/256
1205  STA $0345
1210  LDA #158      ;ICBLEN=158
1215  STA $0348
1220  STX $0349
1225  STX $02FF     ;NO CTRL-1
1230  JSR $E456     ;CIOV
1235 ST LDX #0      ;PSE ABT 1 SEC
1240 OP
1245  LDY #0
1250 IP
1255  DEY
1260  BNE IP
1265  DEX
1270  BNE OP
1275  STX $02FF     ;NO CTRL-1
1280  LDA 53279     ;CONSOLE KEY
1285  CMP #7        ;TOUCHING A KEY?
1290  BEQ ST
1295  CMP #5        ;SELECT?
1300  BNE NSEL
1305  JMP SELECT
1310 NSEL CMP #3    ;OPTION?
1315  BNE NOPT
1320  JMP OPTION
1325 NOPT CMP #6    ;START?
1330  BNE ST
1335  JMP START
1340 OPTION
1345  LDX LN        ;INC LEVEL NUMBER
1350  INX
1355  CPX #3
1360  BCC LNS
1365  LDX #0
1370 LNS STX LN
1375  LDA ELVT,X    ;GET ENM LVL
1380  STA ELVL      ;STORE IN PGM
1385  LDA #35       ;POS 33,0
1390  STA 657
1395  LDA #0
1400  STA 658
1405  STA 656
1410  STA $0348     ;ICBLEN=0:DATA
1415  STA $0349     ; STORED IN ACCU.
1420  LDA #11       ;ICCOM=PUTCHR
1425  STA $0342
1430  INX           ;CHG LVL TO ASCII
1435  TXA
1440  ORA #$30
1445  STA LNGM      ;STORE IN GMSG
1450  LDX #$00      ;X=IOCB0:SCREEN
1455  JSR $E456     ;CIOV
1460  JMP ST        ;BACK TO PAUSE
1465 SELECT
1470  LDX SP        ;INC ENM SPD BY 1
1475  INX
1480  CPX #3
1485  BCC SPS
1490  LDX #0
1495 SPS STX SP
1500  LDA ERPT,X    ;GET NEW PAUSE
1505  STA ERP       ; &STORE IN PGM
1510  LDA #35       ;POS 33,1
1515  STA 657
1520  LDA #0
1525  STA 658
1530  STA $0348     ;ICBLEN=0:DATA IN
1535  STA $0349     ; ACCU.
1540  LDA #1
1545  STA 656
1550  LDA #11       ;ICCOM=PUTCHR
1555  STA $0342
1560  INX           ;CHG SPD TO ASCII
1565  TXA
1570  ORA #$30
1575  STA SPGM      ;STORE IN GMSG
1580  LDX #0        ;X=IOCB0:SCREEN
1585  JSR $E456     ;CIOV
1590  JMP ST        ;BACK TO PAUSE
1595 START
1600  LDX #0        ;POS 0,0
1605  STX 656
1610  STX 657
1615  STX 658
1620  LDA #11       ;ICCOM=PUTCHR
1625  STA $342
1630  LDA #GMSG&255 ;ICBADR=GMSG
1635  STA $0344
1640  LDA #GMSG/256
1645  STA $0345
1650  LDA #158      ;ICBLEN=158
1655  STA $0348
1660  LDA #0
1665  STA $0349
1670  JSR $E456     ;CIOV
1675  LDA #1        ;SET FLAG=PUT
1680  STA EFLAG     ; CRSHAIR ON SCR
1685  STA $21A      ;ENABLE SET RTN
1690  LDA #192
1695  STA 54286     ;ENABLE DLI
1700 MAIN
1705  LDA $D20F
1710  AND #$04      ;PRESSNG ANY KEY?
1715  BNE NOSPACE
1720  LDA 53769
1725  CMP #$21      ;PRESSING SPACE?
1730  BNE NOSPACE
1735  JSR STPI      ;STP ALL INTER.
1740 KEYED
1745  LDA $D20F
1750  AND #$04      ;STILL PRESSING?
1755  BEQ KEYED
1760 PAUSED
1765  LDA $D20F
1770  AND #$04      ;PRESSING A KEY?
1775  BNE PAUSED
1780  LDA 53769
1785  CMP #$21      ;PRESSING SPACE?
1790  BNE PAUSED
1795 RELEASE
1800  LDA $D20F
1805  AND #$04      ;STILL PRESSING?
1810  BEQ RELEASE
1815  JSR STRI      ;RESTART INTER.
1820 NOSPACE
1825  LDA #0
1830  STA 77        ;NO ATTRACT MODE
1835  LDA $D010     ;FIRE BUTTON?
1840  BNE EFIRE     ;N:ENM'S FIRE
1845  JMP FIRE      ;Y:YOU FIRE
1850 EFIRE
1855  LDA OKF       ;TIME FOR ENM TO
1860  BEQ DOEFIRE   ; FIRE?
1865  JMP MAIN
1870 DOEFIRE
1875  LDA ERP       ;RESTORE ENM FIRE
1880  ASL A         ; CTR
1885  ASL A
1890  ASL A
1895  STA OKF
1900  LDA $D20A
1905 ELVL=*+1
1910  CMP #64       ;FIRE ACCORDING
1915  BCS MAIN      ; TO PROBABILITY
1920  AND #$03
1925  CMP #3
1930  BEQ MAIN
1935  TAX           ;ENEMY # FIRING
1940  LDA NV,X
1945  BEQ MAIN      ;IF RECEDING,QUIT
1950  BMI MAIN      ;IF ADVANCNG,QUIT
1955  LDA ELOCK,X
1960  BNE MAIN      ;IF LOCKED,QUIT
1965  STX EL
1970  LDA #$20      ;START ENM LASER
1975  STA $D200     ; SOUND
1980  LDA #$4F
1985  STA $D201
1990  LDA #1        ;LOCK ENEMY
1995  STA ELOCK,X
2000  LDA #2        ;COLOR 2
2005  JSR COLOR
2010  LDX EL
2015  LDA EY,X      ;CHG ENM PLR Y
2020  SEC           ; INTO GR 7 YPOS
2025  SBC #26
2030  LSR A
2035  PHA
2040  TAY
2045  LDA EX,X      ;CHG ENM PLR X
2050  SEC           ; INTO GR 7 XPOS
2055  SBC #45
2060  PHA
2065  TAX
2070  LDA #0
2075  JSR PLOT      ;PLOT
2080  LDA $D20A     ;RND YPOS
2085  AND #$3F
2090  CLC
2095  ADC #8
2100  TAY
2105  STA LY
2110  LDA $D20A     ;RND XPOS
2115  AND #$7F
2120  CLC
2125  ADC #16
2130  TAX
2135  STA LX
2140  LDA #0
2145  JSR DRAWTO    ;DRAWTO TO HERE
2150  LDA #64       ;FLASH SCREEN RED
2155  STA 712
2160  STA 710
2165  LDA #0        ;COLOR 0
2170  JSR COLOR
2175  PLA           ;START XPOS FOR
2180  TAX           ; LASER
2185  PLA           ;START YPOS FOR
2190  TAY           ; LASER
2195  LDA #0
2200  JSR PLOT      ;'UNPLOT' THIS PT
2205  LDA #0        ;END XPOS FOR
2210  LDX LX        ; LASER
2215  LDY LY        ;END YPOS
2220  JSR DRAWTO    ;ERASE LINE
2225  LDX EL
2230  LDA #0        ;UNLOCK ENEMY
2235  STA ELOCK,X
2240  STA $D200     ;TURN OFF SOUND
2245  STA $D201
2250  STA 712       ;BLACKEN SCREEN
2255  STA 710
2260  LDA SHIELD
2265  PHA
2270  CMP #2
2275  BCC LOSE      ;YOU KILLED?
2280  JSR STPI
2285  SED
2290  PLA
2295  SEC
2300  SBC #2        ;DECREASE SHIELD
2305  STA SHIELD
2310  PHA
2315  CLD
2320  JSR STRI
2325  LDA #36       ;POS 36,0
2330  STA 657
2335  LDA #0
2340  STA 658
2345  STA 656
2350  PLA
2355  JSR PN        ;PRINT NEW SHIELD
2360  JMP MAIN      ;BACK TO MAIN
2365 LOSE
2370  LDA #$8F      ;DISTORTION,VOL
2375  STA $D201     ; FOR YOUR EXPL
2380  STA JLOCK     ;LOCK JSTICK
2385  LDX #$80      ;EXPL DURATION
2390 LO LDY #0
2395 LI LDA $D20A
2400  STA $D200     ;RND FREQ
2405  STA 712       ;RND COL
2410  STA 710
2415  DEY
2420  BNE LI
2425  DEX
2430  BNE LO        ;LOOP YOUR EXPL
2435  STX $D200     ;TURN OFF SOUND
2440  STX $D201
2445  STX 712       ;BCK COL=0
2450  STX 710
2455  STX 656       ;POS 0,0
2460  STX 657
2465  STX 658
2470  LDA #11
2475  STA $0342     ;ICCOM=PRNCHR
2480  LDA #LMSG&255 ;ICBADR=LMSG
2485  STA $0344
2490  LDA #LMSG/256
2495  STA $0345
2500  LDA #39       ;ICBLEN=39
2505  STA $0348
2510  STX $0349
2515  JSR $E456     ;CIOV
2520  JMP RES       ;WAIT FOR RESTART
2525 FIRE LDA #$4F  ;START YOUR LASER
2530  STA $D201     ; SOUND
2535  LDA #1
2540  STA $D200
2545  STA JLOCK     ;LOCK JOYSTIK
2550  JSR COLOR     ;COLOR 1
2555  LDA #0
2560  STA 53278     ;CLR OLD COLL.
2565  LDX #80
2570  LDY #79
2575  JSR PLOT      ;PLOT 80,79
2580  LDA X         ;CHG CROSSHAIR X
2585  SEC           ; TO GR.7 XPOS
2590  SBC #45
2595  PHA
2600  TAX
2605  LDA Y         ;CHG CROSSHAIR Y
2610  SEC           ; TO GR.7 YPOS
2615  SBC #26
2620  LSR A
2625  PHA
2630  TAY
2635  LDA #0
2640  JSR DRAWTO    ;DRAWTO TO HERE
2645  LDA #0
2650  JSR COLOR     ;COLOR 0
2655  LDA #0
2660  LDX #80
2665  LDY #79
2670  JSR PLOT      ;ERASE LASER STRT
2675  PLA           ;LASER END Y
2680  TAY
2685  PLA           ;LASER END X
2690  TAX
2695  LDA #0        ;TURN OFF SOUND
2700  STA $D200
2705  STA $D201
2710  JSR DRAWTO    ;ERASE LASER
2715  LDA #0        ;UNLOK JOYSTIK
2720  STA JLOCK
2725  LDA $D008     ;CHECK FOR ANY
2730  BEQ CH2       ; COLLISIONS
2735  JSR HIT
2740 CH2 LDA $D009
2745  BEQ CH3
2750  JSR HIT
2755 CH3 LDA $D00A
2760  BEQ NOHIT
2765  JSR HIT
2770 NOHIT
2775  JMP EFIRE     ;LET ENM FIRE
2780 HIT
2785  BIT ONE       ;HIT P0?
2790  BEQ ONEOK
2795  LDX #0
2800  JSR EXPLODE
2805 ONEOK
2810  BIT TWO       ;HIT P1?
2815  BEQ TWOOK
2820  LDX #1
2825  JSR EXPLODE
2830 TWOOK
2835  BIT FOUR      ;HIT P2?
2840  BEQ FOUROK
2845  LDX #2
2850  JSR EXPLODE
2855 FOUROK
2860  RTS
2865 EXPLODE
2870  PHA           ;SAVE COLL REG
2875  TXA           ;SAVE WHICH ENM
2880  PHA           ; TO EXPLODE
2885  LDA ELOCK,X   ;ENM LOCKED?
2890  BEQ CANEXP
2895  PLA
2900  PLA
2905  RTS
2910 CANEXP PLA     ;RESTORE WHICH TO
2915  PHA           ; EXPL.&SAVE AGN
2920  CLC           ;GET WHICH PLR
2925  ADC #$44      ; BAND TO USE
2930  STA EXPADR
2935  LDA #1        ;LOCK ENEMY
2940  STA ELOCK,X
2945  LDA EY,X      ;GET ENM YPOS
2950  TAY
2955  LDX #0
2960 EXPLP
2965  LDA EXPSHP,X  ;PUT EXPLOSION
2970 EXPADR=*+2
2975  STA $FF00,Y
2980  INX
2985  INY
2990  CPX #12       ;ALL 12?
2995  BCC EXPLP
3000  PLA
3005  TAX
3010  LDA #60       ;KEEP THIS EXPL.
3015  STA EXPCTR,X  ; ON FOR 1 SEC
3020  JSR STPI      ;STP INT
3025  SED
3030  LDA REM
3035  SEC
3040  SBC #1
3045  STA REM       ;REM=REM-1(DEC)
3050  LDA SHIELD
3055  CMP #$99
3060  BEQ NOIS
3065  CLC
3070  ADC #1
3075  STA SHIELD    ;SHIELD=SHIELD+1
3080 NOIS CLD
3085  JSR STRI      ;STR INT
3090  LDA REM
3095  PHA
3100  CMP #3        ;>=3 LEFT?
3105  BCS CANR
3110  LDA #0        ;CANT RESTORE
3115  JMP STORR
3120 CANR LDA #1    ;CAN RESTORE
3125 STORR STA R,X
3130  PLA
3135  BEQ WIN       ;IF KILL ALL,WIN!
3140  LDY #36       ;POS 36,1
3145  STY 657
3150  LDY #0
3155  STY 658
3160  LDY #1
3165  STY 656
3170  JSR PN        ;PRNT #REMAINING
3175  LDA #36       ;POS 36,0
3180  STA 657
3185  LDA #0
3190  STA 658
3195  STA 656
3200  LDA SHIELD
3205  JSR PN        ;PRINT NEW SHIELD
3210  PLA           ;RESTORE COL REG
3215  RTS           ;BACK TO CALLER
3220 WIN LDX #0     ;POS 0,0
3225  STX 656
3230  STX 657
3235  STX 658
3240  LDA #11       ;ICCOM=PUTCHR
3245  STA $342
3250  LDA #WMSG&255 ;ICBADR=WMSG
3255  STA $344
3260  LDA #WMSG/256
3265  STA $345
3270  LDA #79       ;ICBLEN=79
3275  STA $348
3280  STX $349
3285  JSR $E456     ;CIOV
3290 RES LDA 53279  ;PRESSING START?
3295  CMP #6
3300  BNE RES
3305  JMP $E474     ;'PRESS' RESET
3310 PN PHA
3315  LSR A         ;GET HIGH NIBBLE
3320  LSR A
3325  LSR A
3330  LSR A
3335  JSR CA        ;PRINT
3340  PLA
3345  AND #$0F      ;GET LOW NBL&PRT
3350 CA ORA #$30    ;CHG TO ASCII
3355  LDX #11       ;ICCOM=PUTCHR
3360  STX $342
3365  LDX #0        ;ICBLEN=0=DATA IN
3370  STX $348      ; ACCU.
3375  STX $349
3380  JMP $E456     ;CIOV
3385 STPI
3390  LDA #$80      ;STOP INTERRUPTS
3395  STA $D40E
3400  SEI
3405  RTS
3410 STRI LDA #$C0  ;ENABLE INTER.'S
3415  STA $D40E
3420  CLI
3425  RTS
3430 SVBI
3435  LDA #DVBI&255 ;ENABLE DEF VBI
3440  STA $0224
3445  LDA #DVBI/256
3450  STA $0225
3455  LDA #IVBI&255 ;ENABLE IMM VBI
3460  STA $0222
3465  LDA #IVBI/256
3470  STA $0223
3475  LDA #CRTN&255 ;ENABLE CTDN TMR
3480  STA $0228     ; ROUTINE
3485  LDA #CRTN/256
3490  STA $0229
3495  LDA #1
3500  STA $021A
3505  RTS
3510 CRTN
3515  LDA #0
3520  STA $02FF     ;NO CTRL-1
3525  INC 708       ;PULSE YOUR LASER
3530  LDA OKF       ;UPDATE OKF (ENM
3535  BEQ NUOKF     ; FIRE CTR)
3540  DEC OKF
3545 NUOKF
3550  LDX #2
3555 CKEXP
3560  LDA EXPCTR,X  ;ENM EXPLODING?
3565  BEQ NXEXP
3570  DEC EXPCTR,X  ;DEC EXPL CTR
3575  BEQ STPEXP    ;IF DONE EXP,STOP
3580  LDA #$20      ;ELSE,KEEP EXPL
3585  STA $D202     ; SOUND ON
3590  LDA #$0F
3595  STA $D203
3600 NXEXP DEX
3605  BPL CKEXP     ;DONE ALL ENM'S?
3610  LDA #1        ;RESET CTDN TMR
3615  STA $21A
3620  RTS
3625 STPEXP
3630  TXA
3635  PHA
3640  CLC           ;GET WHICH PLR
3645  ADC #$44      ; BAND TO USE
3650  STA EREXAD
3655  LDA EY,X
3660  TAY
3665  LDA #0
3670  STA $D202     ;STOP EXPL SOUND
3675  STA $D203
3680  TAX
3685 EREX
3690 EREXAD=*+2
3695  STA $FF00,Y   ;ERASE EXPL
3700  INX
3705  INY
3710  CPX #12       ;DONE ERASING?
3715  BCC EREX
3720  PLA
3725  TAX
3730  LDA $D20A     ;RND XPOS
3735  AND #$7F
3740  CLC
3745  ADC #60
3750  STA EX,X
3755  LDA $D20A     ;RND YPOS
3760  AND #$7F
3765  CLC
3770  ADC #46
3775  STA EY,X
3780  LDA #$FF      ;ENEMY=ADVANCING
3785  STA NV,X
3790  LDA #0
3795  STA 53278     ;NO COLL W/EXPL.
3800  LDA #5        ;ENEMY=STARTS
3805  STA ESC,X     ; OUT SMALL
3810  LDA #7
3815  STA ET,X      ;ENM TMR=7
3820  STA EP,X      ;ENM TMR PSE=7
3825  LDA R,X
3830  BEQ NOU       ;CAN WE UNLOK?
3835  LDA #0
3840  STA ELOCK,X   ;UNLOK
3845 NOU JMP NXEXP  ;NXT EXPL.
3850 DVBI
3855  INC S1        ;STAR1 CTR=..+1
3860  INC S2        ; 2
3865  INC S3        ; 3
3870  INC S4        ; 4
3875  INC S5        ; 5
3880  INC S6        ; 6
3885  INC S7        ; 7
3890  INC S8        ; 8
3895  LDX #0
3900 PAUSE
3905  LDA S1,X      ;NEED TO RESET
3910  CMP PS,X      ; THIS CTR?
3915  BCC SKIP
3920  LDA #0        ;RESET CTR
3925  STA S1,X
3930  JSR DECS      ;AND MOV THE STRS
3935  CPX #1
3940  BCS SKIP
3945  JSR DECS
3950 SKIP
3955  INX           ;NEXT LEVEL
3960  CPX #8        ;DONE ALL 8 LVLS?
3965  BCC PAUSE
3970  JMP $E462     ;RET TO SYSTEM
3975 DECS
3980  *=*+72        ;DEC STRS IN LYR
3985  RTS           ; (CREATED RTNE)
3990 DLI
3995  PHA           ;SAVE REGS
4000  TXA
4005  PHA
4010  TYA
4015  PHA
4020 DLII
4025  *=*+2880      ;SET STR HPOS,LUM
4030  PLA           ;RESTORE REGS
4035  TAY
4040  PLA
4045  TAX
4050  PLA
4055  RTI
4060 IVBI
4065  LDA JLOCK     ;LOCKED JOYSTIK?
4070  BEQ JMOVE
4075  JMP ERTN
4080 JMOVE
4085  LDX #1
4090 CHECKJOY
4095  LDA #15       ;GET 15-STICK(0)
4100  SEC
4105  SBC 632
4110  BIT ONE       ;UP?
4115  BEQ NOTONE
4120  LDY Y
4125  CPY #32       ;IS Y AT TOP?
4130  BCC NOTONE
4135  DEC Y         ;DEC Y TWICE
4140  DEC Y
4145  STX EFLAG     ;FLAG-REDRAW
4150 NOTONE
4155  BIT TWO       ;DOWN?
4160  BEQ NOTTWO
4165  LDY Y
4170  CPY #182      ;IS Y AT BOT?
4175  BCS NOTTWO
4180  INC Y         ;INC Y TWICE
4185  INC Y
4190  STX EFLAG     ;FLAG-REDRAW
4195 NOTTWO
4200  BIT FOUR      ;LEFT?
4205  BEQ NOTFOUR
4210  LDY X
4215  CPY #50       ;IS X LEFTMOST?
4220  BCC NOTFOUR
4225  DEC X         ;DEC X TWICE
4230  DEC X
4235 NOTFOUR
4240  BIT EIGHT     ;RIGHT?
4245  BEQ NOTEIGHT
4250  LDY X
4255  CPY #201      ;IS X RTMOST?
4260  BCS NOTEIGHT
4265  INC X         ;INC X TWICE
4270  INC X
4275 NOTEIGHT
4280  LDX X         ;UPDATE XPOS
4285  STX $D004
4290  INX
4295  INX
4300  STX $D005
4305  INX
4310  INX
4315  STX $D006     ;STORE IN HPOSM2
4320  LDA EFLAG     ;NEED TO REDRAW?
4325  BEQ ERTN      ;N:MOVE ENEMIES
4330  LDA #0        ;Y:REDRAW CROSS-
4335  STA EFLAG     ; HAIR
4340  TAX
4345  LDY Y
4350 PUTLOOP
4355  LDA $4300,Y   ;GET OLD MBYTE
4360  AND #$C0      ;SAVE ONLY M3
4365  ORA PSHAP,X   ;FORCE IN C-HAIR
4370  STA $4300,Y   ;STORE FINAL BYT
4375  INX
4380  INY
4385  CPX #12       ;DONE ALL 12?
4390  BCC PUTLOOP
4395 ERTN
4400  LDA #0
4405  STA EC
4410  STA $C0       ;($C0)=PTR TO PLR
4415  LDA #$44      ; BAND CURRENTLY
4420  STA $C1       ; IN USE
4425  LDX EC
4430 ELOOP
4435  LDA ELOCK,X   ;ENEMY LOCKED?
4440  BEQ CKTM
4445  JMP NEXENM
4450 CKTM DEC ET,X  ;DEC ENM'S TIMER
4455  BEQ DOTHISENM ;IF ZERO,MOVE HIM
4460  JMP NEXENM    ;ELSE DO NEXT ENM
4465 DOTHISENM
4470  LDA EP,X      ;RESET THIS ENM'S
4475  STA ET,X      ; TIMER
4480  LDA NV,X      ;GET #VECTRS MOVD
4485  BEQ DSAPPR    ;ZERO=DSAPPR
4490  BMI APPEAR    ;NEG#=APPEAR
4495  JMP CONTERTN  ;POS#=MOVING
4500 DSAPPR
4505  STA CTR
4510  LDA ESC,X
4515  CMP #5
4520  BCS SETAPR    ;DONE DISAPPRING?
4525  ASL A
4530  CLC
4535  ADC ESC,X
4540  ASL A
4545  ASL A
4550  LDY EY,X      ;Y=PTR TO ENM PLR
4555  TAX           ;X=PTR 2 ESHP TBL
4560 RECLP
4565  LDA ESHAP,X   ;GET SHAPE BYTE
4570  STA ($C0),Y   ;STORE IT IN P0
4575  INX
4580  INY
4585  INC CTR
4590  LDA CTR
4595  CMP #12
4600  BCC RECLP
4605  LDX EC
4610  INC ESC,X     ;NEXT FRAME
4615  JMP NEXENM    ;NXT ENM
4620 SETAPR
4625  LDA #$FF      ;#VECT CTR=NEG #:
4630  STA NV,X      ; ENM WILL APPEAR
4635  LDA EY,X
4640  CLC
4645  ADC #5
4650  STA EY,X
4655  TAY
4660  LDA #0        ;ERASE ENEMY
4665  STA ($C0),Y
4670  LDA $D20A     ;RND ENM XPOS
4675  AND #$7F
4680  CLC
4685  ADC #60
4690  STA EX,X
4695  LDA $D20A     ;RND ENM YPOS
4700  AND #$7F
4705  CLC
4710  ADC #46
4715  STA EY,X
4720  JMP NEXENM    ;NXT ENM
4725 APPEAR
4730  DEC ESC,X
4735  BMI DNAPPR    ;DONE APPEARING?
4740  LDA ESC,X
4745  ASL A
4750  CLC
4755  ADC ESC,X
4760  ASL A
4765  ASL A
4770  LDY EY,X      ;Y=PTR TO ENM PLR
4775  TAX           ;X=PTR TO SHP TBL
4780  LDA #0
4785  STA CTR
4790 APLP
4795  LDA ESHAP,X   ;GET ENM SHP BYT
4800  STA ($C0),Y   ;PUT IT IN PLR
4805  INX
4810  INY
4815  INC CTR
4820  LDA CTR       ;DONE 12 BYTES?
4825  CMP #12
4830  BCC APLP
4835  LDX EC
4840  LDA EX,X      ;GET ENM'S XPOS
4845  STA $D000,X   ;STORE IN HPOS
4850  JMP NEXENM    ;NXT ENM
4855 DNAPPR
4860  LDA $D20A     ;RND MAX # VECTRS
4865  AND #$07
4870  CLC
4875  ADC #4
4880  STA MNV,X
4885 ERP=*+1
4890  LDA #1
4895  STA ET,X      ;ENM TMR=1
4900  STA EP,X      ;ENM TMR PSE=1
4905  LDA #1
4910  STA NV,X      ;#VETCS MOVED=1
4915  JMP NEXENM    ;NXT ENM
4920 CONTERTN
4925  LDA EX,X      ;ENM'S X=..+DX
4930  CLC
4935  ADC EDX,X
4940  STA EX,X
4945  CMP #48       ;OFF LEFT EDGE?
4950  BCC CEDIR
4955  CMP #201      ;OFF RIGHT EDG?
4960  BCS CEDIR
4965  LDA EY,X      ;ENM Y=..+DY
4970  CLC
4975  ADC EDY,X
4980  STA EY,X
4985  CMP #186      ;OFF BOT EDGE?
4990  BCS CEDIR
4995  CMP #33       ;OFF TOP EDGE?
5000  BCC CEDIR
5005  INC ECTR,X    ;N:INC CTR 4 ENM
5010  LDA ECTR,X    ;HAS IT MOVED
5015  CMP ELIM,X    ; THE LIMIT?
5020  BCS CEDIR
5025 PUTENM
5030  LDY EY,X      ;Y=PTR TO ENM PLR
5035  LDX #0        ;X=PTR TO SHP TBL
5040 PUTELP
5045  LDA ESHAP,X   ;GET ENM SHAPBYT
5050  STA ($C0),Y   ;STORE IN ENM PLR
5055  INY
5060  INX
5065  CPX #12       ;DONE ALL 12?
5070  BCC PUTELP
5075  LDX EC
5080  LDA EX,X      ;GET ENM XPOS
5085  STA $D000,X   ;STORE IN HPOS
5090 NEXENM INC $C1 ;NXT PLR BAND
5095  INC EC        ;NXT ENM CTR
5100  LDX EC        ;DONE W/ALL 3
5105  CPX #3        ; ENMS?
5110  BCS RETIMM
5115  JMP ELOOP     ;CONT W/NXT ENM
5120 RETIMM
5125  JMP $E45F     ;BACK TO SYSTEM
5130 CEDIR
5135  LDA EY,X      ;RESTORE ENM YPOS
5140  SEC
5145  SBC EDY,X
5150  STA EY,X
5155  LDA EX,X      ;RESTORE ENM XPOS
5160  SEC
5165  SBC EDX,X
5170  STA EX,X
5175  INC NV,X      ;#VECTS MVED=..+1
5180  LDA NV,X      ;LIMIT YET?
5185  CMP MNV,X
5190  BCC CNTCEDIR
5195  LDA #0        ;NV=0:FLAG-ENM
5200  STA NV,X      ; WILL RECEDE
5205  STA ESC,X     ;RSET ENM SHP CTR
5210  LDA #7
5215  STA ET,X      ;ENM TMR=7
5220  STA EP,X      ;ENM TMR PSE=7
5225  JMP NEXENM    ;UPDATE NXT ENM
5230 CNTCEDIR
5235  LDA #0        ;RESET MVEMNT CTR
5240  STA ECTR,X
5245  LDA 53770     ;SET A NEW
5250  AND #$3F      ; MOVEMENT LIMIT
5255  STA ELIM,X
5260  LDA EX,X
5265  BPL POSEDX    ;IF X=LF,DX=RT
5270  BMI NEGEDX    ;IF X=RT,DX=LF
5275 NEWEDY LDA EY,X
5280  BPL POSEDY    ;IF Y=UP,DY=DN
5285  BMI NEGEDY    ;IF Y=DN,DY=UP
5290  JMP PUTENM    ;DRAW SHAPE
5295 POSEDX
5300  JSR GETPOS    ;GET RND ENM +DX
5305  STA EDX,X
5310  JMP NEWEDY
5315 NEGEDX
5320  JSR GETNEG    ;GET RND ENM -DX
5325  STA EDX,X
5330  JMP NEWEDY
5335 POSEDY
5340  JSR GETPOS    ;GET RND ENM +DY
5345  STA EDY,X
5350  JMP PUTENM
5355 NEGEDY
5360  JSR GETNEG    ;GET RND ENM -DY
5365  STA EDY,X
5370  JMP PUTENM
5375 GETPOS
5380  LDA 53770     ;GET RND 1-3
5385  AND #$03
5390  BEQ GETPOS
5395  RTS
5400 GETNEG
5405  LDA 53770     ;GET RND -1 TO -3
5410  AND #$03
5415  BEQ GETNEG
5420  EOR #$FF
5425  CLC
5430  ADC #1
5435  RTS
5440 ONE
5445  .BYTE 1 ;FOR 'BIT' INSTR.
5450 TWO
5455  .BYTE 2 ; SAME
5460 FOUR
5465  .BYTE 4 ; SAME
5470 EIGHT
5475  .BYTE 8 ; SAME
5480 Y
5485  .BYTE 0 ;CROSSHAIR Y
5490 X
5495  .BYTE 0 ;CROSSHAIR X
5500 EFLAG
5505  .BYTE 0 ;C-HAIR REDRAW FLAG
5510 PSHAP
5515  .BYTE $00,$00,$0C,$0C,$0C,$3F,$3F,$0C,$0C,$0C,$00,$00 ;CRSSHAIR SHAPE
5520 C
5525  .BYTE 14,12,10,8,8,6,4,2 ;STARS' COLOR (LUMINANCE) TABLE
5530 S1
5535  .BYTE 0 ;CTR FOR STAR LAYER 1
5540 S2
5545  .BYTE 0 ;                   2
5550 S3
5555  .BYTE 0 ;                   3
5560 S4
5565  .BYTE 0 ;                   4
5570 S5
5575  .BYTE 0 ;                   5
5580 S6
5585  .BYTE 0 ;                   6
5590 S7
5595  .BYTE 0 ;                   7
5600 S8
5605  .BYTE 0 ;                   8
5610 PS
5615  .BYTE 1,1,2,3,4,6,9,14 ;STR SPD
5620 CTR
5625  .BYTE 0 ;MISC COUNTER
5630 DLIP
5635  .BYTE $AD  ;"LDA ABSOLUTE"
5640 PHPOS
5645  .WORD HPOS ; ADR FOR LDA
5650  .BYTE $AC  ;"LDY ABSOLUTE"
5655 PLT
5660  .WORD LT          ;ADR FOR LDY
5665  .BYTE $8D,$0A,$D4 ;STA WSYNC
5670  .BYTE $8D,$07,$D0 ;STA HPOSM3
5675  .BYTE $8C,$15,$D0 ;STY COLRM3
5680 EX
5685  .BYTE 0,0,0 ;ENEMY XPOS TABLE
5690 EY
5695  .BYTE 0,0,0 ;ENEMY YPOS TABLE
5700 ESHAP
5705  .BYTE 0,0,0,0,146,186,254,198,0,0,0,0
5710  .BYTE 0,0,0,0,146,254,198,0,0,0,0,0
5715  .BYTE 0,0,0,0,84,124,68,0,0,0,0,0
5720  .BYTE 0,0,0,0,0,56,0,0,0,0,0,0
5725  .BYTE 0,0,0,0,0,16,0,0,0,0,0,0
5730 EDX
5735  .BYTE 0,0,0 ;ENEMY DX TABLE
5740 EDY
5745  .BYTE 0,0,0 ;ENEMY DY TABLE
5750 ECTR
5755  .BYTE 0,0,0 ;# STEPS TRAVELED
5760 ELIM
5765  .BYTE 0,0,0 ;MAX # STEPS TO XVL
5770 NV
5775  .BYTE 0,0,0 ;#VECTORS TRAVELED
5780 MNV
5785  .BYTE 0,0,0 ;MAX VECTS TO XVEL
5790 ESC
5795  .BYTE 0,0,0 ;ENM SHAPE CTR
5800 EP
5805  .BYTE 0,0,0 ;ENM TIMER PAUSES
5810 ET
5815  .BYTE 0,0,0 ;ENM TIMERS
5820 EC
5825  .BYTE 0     ;CTR FOR ENM MVEMNT
5830 JLOCK
5835  .BYTE 0
5840 ELOCK
5845  .BYTE 0,0,0 ;ENM 'LOCK' STATUS
5850 EL
5855  .BYTE 0     ;ENEMY FIRING LASER
5860 LX
5865  .BYTE 0     ;LASER TERMINAL X
5870 LY
5875  .BYTE 0     ;LASER TERMINAL Y
5880 EXPSHP
5885  .BYTE 20,64,10,160,4,17,132,33,4,80,2,40 ;EXPLOS SHAPE
5890 EXPCTR
5895  .BYTE 0,0,0 ;EXPLOSION COUNTER
5900 OKF
5905  .BYTE 0     ;ENM OK2FIRE CTR
5910 ELVT
5915  .BYTE 64,128,192 ;ENM LVL TBL
5920 ERPT
5925  .BYTE 3,2,1 ;ENM RTN PAUSE TBL
5930 LN
5935  .BYTE 0     ;LEVEL #
5940 SP
5945  .BYTE 0     ;ENEMY SPEED
5950 SMSG
5955  .BYTE "    �������������  OPTION-Level:1    "
5960  .BYTE "    ����������������  SELECT-Speed:1    "
5965  .BYTE "    ������������  START -Play Game  "
5970  .BYTE "    �����㩠��������  SPACE -Pause      "
5975 GMSG
5980  .BYTE "    �������������  Shield Energy:70  "
5985  .BYTE "    ����������������  Enemies Left :99  "
5990 LNGM=*+37
5995  .BYTE "    ������������  Level Number : 1  "
6000 SPGM=*+37
6005  .BYTE "    �����㩠��������  Enemy Speed  : 1  "
6010 WMSG
6015  .BYTE "    ����������Π���  ���Ġ��¡��ՠ��Ρ "
6020  .BYTE "    ����������������  �������Ӡ���Լ�� "
6025 LMSG
6030  .BYTE "    �������������YOU LOSE-PUSH START "
6035 SHIELD .BYTE 0 ;SHIELD ENERGY
6040 REM .BYTE 0   ;#ENM LEFT
6045 R .BYTE 0,0,0 ;ENM UNLOCK FLAG
6050 GRAPHICS
6055  PHA          ;SAVE ORIG. #
6060  LDX #$60     ;IOCB 6(SCREEN)
6065  LDA #12      ;CLOSE #6
6070  STA $342,X   ;(JUST TO BE
6075  JSR $E456    ; SAFE!)
6080  LDA #3       ;OPEN #6
6085  STA $342,X   ;COMMAND #
6090  LDA #SCRDEV&255 ;ADDR OF "S:"
6095  STA $344,X   ;LO BYTE
6100  LDA #SCRDEV/256 ;AND NOW THE
6105  STA $345,X   ;    HI BYTE
6110  LDA #1       ;LENGTH OF SCRN
6115  STA $348,X   ; I.D. IS ONLY
6120  LDA #0       ; ONE CHARACTER
6125  STA $349,X   ; (THE 'S')
6130  PLA          ;GET IT BACK
6135  PHA          ;BUT STILL SAVE
6140  EOR #16      ;REVERSE BIT 5
6145  AND #16      ;KEEP ONLY BIT 5
6150  CLC          ;ADD 12 TO IT
6155  ADC #12
6160  STA $34A,X   ;=ICAX1 SPEC
6165  PLA          ;ORIG. MODE #=
6170  STA $34B,X   ; ICAX2 SPEC
6175  JMP $E456    ;AND JMP TO CIO!
6180 COLOR
6185  STA COLNUM    ;STORE IT FOR
6190  RTS          ; LATER USE
6195 POSITION
6200  STY 84       ;VERT POS
6205  STX 85       ;HOR POS LO BYTE
6210  STA 86       ;HOR POS HI BYTE
6215  RTS          ;BYE!
6220 PLOT
6225  JSR POSITION ;POSITION CURSOR
6230  LDX #$60     ;SCREEN (IOCB6)
6235  LDA #11      ;PUT CHARS COMD
6240  STA $342,X   ;STORE IN ICCOM
6245  LDA #$00     ;BUFLEN OF ZERO
6250  STA $348,X   ; MEANS GET/PUT
6255  STA $349,X   ; DATA TO/FROM
6260 ;               THE ACCUM.
6265  LDA COLNUM   ;PUT COLOR # IN
6270 ;               ACCU B/C LEN=0
6275  JMP $E456    ;JMP TO CIO
6280 DRAWTO
6285  JSR POSITION ;POSITION CURSR
6290  LDX #$60     ;SCRN (IOCB6)
6295  LDA #17      ;DRAW LINE CMD
6300  STA $342,X   ;STORE IN ICCOM
6305  LDA #0       ;ZERO BUF LEN
6310  STA $348,X   ; B/C NO DATA
6315  STA $349,X   ; IS XFERRED!
6320  LDA COLNUM   ;STORE COL # IN
6325  STA $02FB    ; 2FB FOR CIO
6330  JMP $E456    ;AND GO TO CIO
6335 SCRDEV
6340  .BYTE "S"    ;SCREEN I.D.
6345 COLNUM
6350  BRK          ;COLOR# STORAGE
6355 HPOS
6360  *=*+192      ;TBL STR POS
6365 LT
6370  *=*+192      ;TBL STR LUM
6375  *=$02E0
6380  .WORD BP     ;DOS RUN ADR

Back to previous page