section psycheual,code
 incdir dh0:psycheual/raw/

 bsr disableos
 bsr createmasks
 bsr bitplanes
 bsr newframe
 bsr shareware
start
 bsr intro
 bsr getready
 bsr initgame

startlevel
 bsr rumblesfx
 bsr initlevel
 bsr gamescreen
 bsr fadein
 move.b #gmvec,vector
main
 bsr framewait
 bsr drawscreen
 bsr radiation
 bsr drawaliens
 bsr findraw
 bsr paneltext
 bsr pickups
 bsr opendoors
 bsr movealiens
 bsr hdetect
 bsr speech
; btst #10,$dff016
; beq.s jumpout
 btst #over,flag
 beq.s main
 bra endlevel
jumpout
 bset #over,flag
 bset #compl,flag
endlevel
 move.b #novec,vector
 bsr manoff
 bsr fadeout
 bsr outrumble
 bsr levelcomp
 btst #compl,flag
 beq.s nolevel 
 addq.w #1,level
 cmp.w #10,level
 blt startlevel 
nolevel
 bsr gameover
 bra start

finish
 bsr blitwait
 move.l #grname,a1
 clr.l d0
 move.l 4.w,a6
 jsr -$198(a6)
 move.l d0,a4
 move.l 38(a4),cop1lch(a5)
 clr.l copjmp1(a5)
 bsr enableos
 clr.l d0
return
 rts

interrupts
 movem.l d0-d7/a0-a6,-(sp)
 move.w #$20,intreq(a5)
 bchg #pulse,flag
 move.b vector,d0
 cmp.b #gmvec,d0
 beq gmint
 cmp.b #invec,d0
 beq inint
 cmp.b #hlvec,d0
 beq hlint
 cmp.b #envec,d0
 beq enint 
endvint
 movem.l (sp)+,d0-d7/a0-a6
 rte
gmint
 bsr setman
 bsr setscreen
 bsr firing
 bsr injflash
 bsr splashblood
 bsr readjoy
 bsr smooth
 bsr readfire
 bsr flash
 bra.s endvint
inint
 bsr mtmusic
 bsr stars
 bsr scroller
 bsr reflect
 bsr water
 bra.s endvint
hlint
 bsr mtmusic
 bsr stars
 bsr scroller
 bsr reflect
 bra.s endvint
enint
 bsr mtmusic
 bsr stars
 bra.s endvint
 
shareware
 bsr cls
 bsr termplanes
 bsr catchvb
 move.l #termcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 move.b #novec,vector
 lea share(pc),a0
 clr.w d1
shstart
 move.l a0,a2
shloop
 tst.b (a0)+
 beq.s shendl
 bra.s shloop
shendl
 sub.l a2,a0
 cmp.w #0,a0
 beq shnew
 move.w #41,d0
 sub.w a0,d0
 lsr.w #1,d0
 move.l screen(pc),a1
 add.l #40960,a1
 add.w d0,a1
 move.w d1,d2
 mulu #360,d2
 add.w d2,a1
shtloop
 move.b (a2)+,d2
 beq.s shnew
 cmp.b #1,d2
 beq.s shfin
 sub.b #32,d2
 and.w #$ff,d2
 lsl.w #3,d2
 move.l #pfont,a3
 add.w d2,a3
 move.l a3,a4
 lea 768(a4),a4
 rept 6
 move.b (a3)+,(a1)
 move.b (a4)+,-10240(a1)
 lea 40(a1),a1
 endr
 lea -239(a1),a1
 bra.s shtloop
shnew
 addq.w #1,d1
 move.l a2,a0
 bra shstart
shfin
 bsr fadeinwinona
 bsr firewait
 bsr fadeoutterm
 rts

intro
 bsr cls
 bsr introplanes
 bsr catchvb
 move.l #introcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 clr.l scrlpnt
 move.l #watab,watrpnt
 lea darktrain,a0
 bsr mtinit
 bsr initint
 move.b #invec,vector
 bsr fadeinint
 bra.s intmain
reint
 move.b #invec,vector
 bsr initint
 bsr fadeinget
intmain
 bsr catchvb
 subq.w #1,counter
 beq.s halloffame
 btst #7,$bfe001
 bne.s intmain
endint
 bsr fadeoutint
 move.b #novec,vector
 bsr mtend
 rts

halloffame
 bsr fadeoutintb
 move.b #hlvec,vector
 bsr inithall
 bsr fadeinget
hallmain
 bsr catchvb
 subq.w #1,counter
 beq.s hallout
 btst #7,$bfe001
 bne.s hallmain
hallout
 bsr fadeoutintb
 move.b #hlvec,vector
 bra.s reint

getready
 move.w #20,d0
 bsr wait
 bsr cls
 bsr clearwaves
 move.w #$fff,introcols+6
 move.w #$999,introcols+18
 bsr txtbeepasfx
 move.l #player1,a0
 move.l screen(pc),a1
 lea 19026(a1),a1
 bsr cybline
 move.l #getread,a0
 move.l screen(pc),a1
 lea 22544(a1),a1
 bsr cybline
 move.w #1,dmacon(a5)
 bsr firewait
 clr.w introcols+18
 move.w #20,d0
.loop
 bsr catchvb
 move.w introcols+6,d1
 not.w d1
 and.w #$fff,d1
 move.w d1,introcols+6
 dbra d0,.loop
 move.w #$0f0,introcols+6
 move.w #$090,introcols+18
 bsr fadeoutget
 rts

gameover
 move.b #novec,vector
 bsr cls
 bsr introplanes
 bsr catchvb
 move.l #introcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 btst #compl,flag
 bne.s notdead
 move.l #manover,a0
 move.l screen(pc),a1
 lea 14+132*80(a1),a1
 move.w #279,d0
.loop
 move.l (a0)+,(a1)+
 move.l (a0)+,(a1)+
 move.l (a0)+,(a1)+
 move.l (a0)+,(a1)+
 lea 28(a1),a1
 dbra d0,.loop
notdead
 bsr fadeingov
 bsr txtbeepasfx
 move.l #gover,a0
 move.l screen(pc),a1
 lea 16+132*200(a1),a1 
 bsr sybline
 move.w #1,dmacon(a5)
 bsr firewait
 bsr fadered
 bsr fadeoutget
 bsr hiscores
 bsr complete
 rts

scroller
 addq.l #2,scrlpnt
 move.l scrlpnt(pc),d0
 eor.w #-1,d0
 and.w #7,d0
 move.w d0,textdel+2
 move.l scrlpnt(pc),d0
 lsr.l #3,d0
 move.l #text,a0
 add.l d0,a0
 tst.b (a0)
 bne.s notend
 move.l #318,scrlpnt
 bra.s scroller
notend
 move.w #42,d0
 move.l screen(pc),a1
 add.l #38542,a1
 bset #shft,flag
lineloop
 move.b (a0),d1
 bne.s norestart
 move.l #retext,a0
norestart
 bsr.s drawchar
 bchg #shft,flag
 beq.s noadd
 addq.l #2,a1
noadd
 dbra d0,lineloop
 rts
drawchar
 clr.w d1
 move.b (a0)+,d1
 sub.b #32,d1
 lsl.w #5,d1
 move.l #cybfont,a2
 add.w d1,a2
anti
 bsr blitwait
 move.l a2,bltapth(a5)
 move.l a1,bltcpth(a5)
 move.l a1,bltdpth(a5)
 move.w #0,bltamod(a5)
 move.w #174,bltcmod(a5)
 move.w #174,bltdmod(a5)
 move.l #-1,bltafwm(a5)
 move.w #$0bf0,bltcon0(a5)
 btst #shft,flag
 beq.s noshft
 move.w #$8bfa,bltcon0(a5)
noshft
 move.w #$401,bltsize(a5)
 rts
drawanti
 lea 88(a1),a1
 lea 3072(a2),a2
 bsr.s anti
 lea -88(a1),a1
 lea -3072(a2),a2
 rts 

textline
 bclr #shft,flag
.loop 
 tst.b (a0)
 beq.s fintline
 bsr.s drawchar
 bsr.s drawanti
 bchg #shft,flag
 beq.s .loop
 addq.l #2,a1
 bra.s .loop
fintline
 addq.l #1,a0
 rts

sybline
 bclr #shft,flag
.sloop 
 bsr catchvb
 bsr catchvb
 tst.b (a0)
 beq return
 bsr drawchar
 bsr.s drawanti
 bchg #shft,flag
 beq.s .sloop
 addq.l #2,a1
 bra.s .sloop

cybline
 bclr #shft,flag
.loop 
 bsr catchvb
 tst.b (a0)
 beq return
 bsr drawchar
 bsr.s drawanti
 bchg #shft,flag
 beq.s .loop
 addq.l #2,a1
 bra.s .loop

reflect
 move.l screen(pc),a0
 add.l #38542,a0
 move.l a0,a1
 lea 5632(a1),a1
 move.w #15,d0
.loop
 rept 11
 move.l (a0)+,(a1)+
 endr
 lea 132(a0),a0
 lea -220(a1),a1
 dbra d0,.loop
 rts

water
 move.l watrpnt(pc),a0
 move.l #watdel+6,a1
 move.w #42,d0
wloop
 move.w (a0)+,d1
 move.w d1,d2
 lsl.w #4,d2
 or.w d2,d1
 move.w d1,(a1)
 addq.l #8,a1
 cmp.l #endwtab,a0
 bne.s noendw
 move.l #watab,a0
noendw
 dbra d0,wloop
 addq.l #2,watrpnt
 move.l watrpnt(pc),d0
 cmp.l #endwtab,d0
 bne return
 move.l #watab,watrpnt
 rts 

stars
 move.l #starspr,d0
 move.w d0,starhs
 swap d0
 move.w d0,starhs+4
 lea starspr+1,a0
 moveq.b #1,d0
 move.w #125,d1
starsloop
 cmp.b #$d9,(a0)
 bne.s movestar
 move.b #$3f,(a0)
movestar
 add.b d0,(a0)
 addq.b #1,d0
 cmp.b #4,d0
 bne.s nextstar
 moveq.b #1,d0
nextstar
 addq.l #8,a0
 dbra d1,starsloop
 rts

gamescreen
 rept 2
 bsr newframe
 bsr intframe
 bsr.s drawscreen
 bsr drawaliens
 endr
 bsr setscreen
 bset #0,icount+1
 bsr setman
 rts

drawscreen
 addq.w #1,animadd
 cmp.w #8,animadd
 blt.s noresanim
 clr.w animadd
noresanim
 bsr blitwait
 move.l #-1,bltafwm(a5)
 move.l #$09f00000,bltcon0(a5)
 move.w #0,bltamod(a5)
 move.w #46,bltdmod(a5)
 move.w animadd(pc),d7
 move.w scrx(pc),d0
 move.w scry(pc),d1
 subq.w #4,d0
 subq.w #4,d1
 and.w #$fff0,d0
 and.w #$fff0,d1
 move.w d0,stx
 move.w d1,sty
 lsr.w #4,d0
 lsr.w #4,d1
 add.w d0,d0
 add.w d1,d1
 mulu #64,d1
 move.l #map,a0
 add.w d0,a0
 add.w d1,a0
 lea -130(a0),a0
 move.l screen(pc),a1
 lea 7684(a1),a1
 move.w #14,d0
.loop
 bsr.s drawrow
 lea 3800(a1),a1
 lea 88(a0),a0
 dbra d0,.loop
 rts
drawrow
 move.w #19,d1
.loop
 bsr.s drawblock
 dbra d1,.loop
 rts
drawblock
 move.w (a0)+,d2
 cmp.w #511,d2
 bge.s noanim
 cmp.w #286,d2
 ble.s noanim
 add.w d7,d2
noanim
 mulu #160,d2
 move.l #gamegfx,a2
 add.l d2,a2
 bsr blitwait
 move.l a2,bltapth(a5)
 move.l a1,bltdpth(a5)
 move.w #$1401,bltsize(a5)
 addq.l #2,a1
 rts

drawaliens
 move.w stx(pc),d0
 move.w sty(pc),d1
 move.w d0,d2
 move.w d1,d3
 sub.w #32,d0
 sub.w #32,d1
 add.w #304-20,d2
 add.w #220-20,d3
 move.l #aldata,a0
markbobs
 tst.b 1(a0)
 beq.s allbobs
 move.w 4(a0),d4
 move.w 6(a0),d5
 cmp.w d0,d4
 blt.s clipbob
 cmp.w d2,d4
 bgt.s clipbob
 cmp.w d1,d5
 blt.s clipbob
 cmp.w d3,d5
 bgt.s clipbob
 move.b #1,(a0)
 addq.l #8,a0
 bra.s markbobs
clipbob
 clr.b (a0)
 addq.l #8,a0
 bra.s markbobs
allbobs 
 bsr blitwait
 move.l #$ffff0000,bltafwm(a5)
 move.w #42,bltamod(a5)
 move.w #234,bltbmod(a5)
 move.w #234,bltcmod(a5)
 move.w #234,bltdmod(a5)
 move.l #aldata,a4
blokes
 tst.b 1(a4)
 beq return
 tst.b (a4)
 beq.s nextbob
 move.b 2(a4),d2
 move.w 4(a4),d0
 move.w 6(a4),d1
 bsr.s drawbloke
nextbob
 addq.l #8,a4
 bra.s blokes
deaddude
 move.b #1,1(a4)
 move.l #maskgfx+12288+42,a3
 move.l #fallgfx+42,a2
 bra.s deadin
falldude
 move.b 2(a4),d2
 cmp.b #7,d2
 bge.s deaddude
 addq.b #1,2(a4)
 move.l #maskgfx+12288,a3
 move.l #fallgfx,a2
 and.w #$ff,d2
 mulu #6,d2
 add.l d2,a2
 add.l d2,a3
 bra.s deadin 
drawbloke
 cmp.b #1,1(a4)
 beq.s deaddude
 cmp.b #2,1(a4)
 beq.s falldude
 and.w #$ff,d2
 mulu #1536,d2
 move.l #maskgfx,a3
 add.l d2,a3
 mulu #5,d2
 move.l #bobgfx,a2
 add.l d2,a2
 move.w animadd,d2
 mulu #6,d2
 add.l d2,a2
 add.l d2,a3
deadin
 move.l screen(pc),a1
 sub.w stx(pc),d0
 sub.w sty(pc),d1
 add.w #48,d0
 add.w #48,d1
 move.w d0,d2
 lsr.w #4,d0
 add.w d0,d0
 and.w #$f,d2
 ror.w #4,d2
 mulu #48*5,d1
 add.w d1,d0
 and.l #$ffff,d0
 add.l d0,a1
 move.w d2,d3
 or.w #$fca,d2
 cmp.b #4,1(a4)
 bne.s nocloak
 move.l a1,a2
 move.w #$2000,d3 
 lea -240(a2),a2
nocloak
 bsr blitwait
 move.l a3,bltapth(a5)
 move.l a2,bltbpth(a5)
 move.l a1,bltcpth(a5)
 move.l a1,bltdpth(a5)
 move.w d3,bltcon1(a5)
 move.w d2,bltcon0(a5)
 move.w #$803,bltsize(a5)
 rept 4
 lea 48(a1),a1
 lea 48(a2),a2
 bsr blitwait
 move.l a3,bltapth(a5)
 move.l a2,bltbpth(a5)
 move.l a1,bltcpth(a5)
 move.l a1,bltdpth(a5)
 move.w #$803,bltsize(a5)
 endr 
 rts

findraw
 bset #bufchng,flag
 rts

readjoy
 btst #dead,flag
 bne dspin
 clr.b mandir
 clr.b dflag
 bsr.s joylr
 bsr.s joyud
 rts
joylr 
 move.w joy1dat(a5),d0
joyr
 btst #1,d0
 bne right
joyl
 btst #9,d0
 bne left
 rts
joyud
 move.w joy1dat(a5),d0
joyd
 btst #0,d0
 beq joyd2
 btst #1,d0
 beq down
 bra joyu
joyd2
 btst #1,d0
 bne down
joyu
 btst #9,d0
 beq.s joyu3
joyu2
 btst #8,d0
 beq up
 bra.s joy4
joyu3
 btst #8,d0
 bne up
joy4
 rts

left
 btst #0,mandir
 bne return
 bclr #block,dflag
 bset #0,mandir
 move.w manx(pc),d0
 move.w many(pc),d1
 subq.w #2,d0
 add.w #11,d1
 bsr detect
 move.w d0,lastblk
 tst.w d1
 beq.s lmok
 bset #block,dflag
lmok
 move.w manx(pc),d0
 move.w many(pc),d1
 subq.w #2,d0
 bsr detect
 beq.s hleft
 bset #block,dflag
 bra.s hleft2
hleft
 bset #dup,dflag
hleft2
 move.w manx(pc),d0
 move.w many(pc),d1
 subq.w #2,d0
 add.w #22,d1
 bsr detect
 beq.s hleft3
 bset #block,dflag
 rts 
hleft3
 bset #ddown,dflag
 btst #block,dflag
 bne return
 cmp.w #144,manx
 bgt.s manleft
 cmp.w #16,scrx
 ble.s manleft
 subq.w #2,scrx
 rts
manleft
 subq.w #2,manx
 rts

right
 btst #1,mandir
 bne return
 bclr #block,dflag
 bset #1,mandir
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #24,d0
 add.w #11,d1
 bsr detect
 move.w d0,lastblk
 tst.w d1
 beq.s rmok
 bset #block,dflag
rmok
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #24,d0
 bsr detect
 beq.s hright
 bset #block,dflag
 bra.s hright2
hright
 bset #dup,dflag
hright2
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #24,d0
 add.w #22,d1
 bsr detect
 beq.s hright3
 bset #block,dflag
 rts
hright3 
 bset #ddown,dflag
 btst #block,dflag
 bne return
 cmp.w #144,manx
 blt.s manright
 cmp.w #750,scrx
 bge.s manright
 addq.w #2,scrx
 rts
manright
 addq.w #2,manx
 rts

up
 btst #2,mandir
 bne return
 bclr #block,dflag
 bset #2,mandir
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #11,d0
 subq.w #2,d1
 bsr detect
 move.w d0,lastblk
 tst.w d1
 beq.s umok
 bset #block,dflag
umok
 move.w manx(pc),d0
 move.w many(pc),d1
 subq.w #2,d1
 bsr detect
 beq.s hup
 bset #block,dflag
 bra.s hup2
hup
 bset #dleft,dflag
hup2
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #22,d0
 subq.w #2,d1
 bsr detect
 beq.s hup3
 bset #block,dflag
 rts
hup3
 bset #dright,dflag
 btst #block,dflag
 bne return
 cmp.w #112,many
 bgt.s manup
 cmp.w #10,scry
 ble.s manup
 subq.w #2,scry
 rts
manup
 subq.w #2,many
 rts

down
 btst #3,mandir
 bne return
 bclr #block,dflag
 bset #3,mandir
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #11,d0
 add.w #24,d1
 bsr detect
 move.w d0,lastblk
 tst.w d1
 beq.s dmok
 bset #block,dflag
dmok
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #24,d1
 bsr detect
 beq.s hdown
 bset #block,dflag
 bra.s hdown2
hdown
 bset #dleft,dflag
hdown2
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #22,d0
 add.w #24,d1
 bsr detect
 beq.s hdown3
 bset #block,dflag
 rts
hdown3
 bset #dright,dflag
 btst #block,dflag
 bne return
 cmp.w #112,many
 blt.s mandown
 cmp.w #838,scry
 bge.s mandown
 addq.w #2,scry
 rts
mandown
 addq.w #2,many
 rts

detect
 move.w scrx(pc),d2
 move.w scry(pc),d3
 addq.w #2,d0
 subq.w #6,d1
 add.w d2,d0
 add.w d3,d1
 lsr.w #4,d0
 lsr.w #4,d1
 lsl.w #1,d0
 lsl.w #7,d1
 move.l #map-260,a0
 add.w d0,a0
 add.w d1,a0
 move.w (a0),d0
 cmp.w #422,d0
 bgt.s nocol
 cmp.w #197,d0
 blt.s nocol
col
 moveq.w #1,d1
 rts
nocol
 cmp.w #519,d0
 bge.s endcol
 cmp.w #511,d0
 bge doors
endcol
 clr.w d1
 rts

radiation
 move.w midblk(pc),d0
 cmp.w #174,d0
 blt norad
 cmp.w #188,d0
 bgt norad
 move.w clicks(pc),d0
 and.w #$7,d0
 move.l #gieger,a0
 mulu #40,d0
 add.l d0,a0
 tst.w d0
 bne nobeep
 bsr beepgsfx
 subq.w #1,health
 beq vdead
nobeep
 move.l #pnlgfx+2915,a1
 move.w #19,d0
.loop
 move.b (a0)+,(a1)+
 move.b (a0)+,(a1)+
 lea 38(a1),a1
 dbra d0,.loop
 addq.w #1,clicks
 rts
norad
 clr.w clicks
 move.l #pnlgfx+2915,a1
 move.w #19,d0
.loop
 clr.b (a1)+
 clr.b (a1)+
 lea 38(a1),a1
 dbra d0,.loop
 rts

smooth
 move.b dflag,d0
 move.b mandir,topmenu
 move.b mandir,mflag
 move.b d0,d1
 move.b d0,d2
 move.b d0,d3
 move.b d0,d4
 lsr.b #1,d2
 lsr.b #1,d4
 eor.b d1,d2
 btst #2,d2
 bne.s smoothlr
 eor.b d3,d4
 btst #0,d4
 bne.s smoothud
 rts
smoothlr
 btst #0,d0
 bne return
 btst #1,d0
 bne return
 btst #3,d0
 bne.s smoothr
 bsr left
 move.b topmenu,mandir
 rts
smoothr
 bsr right
 move.b topmenu,mandir
 rts 
smoothud
 btst #2,d0
 bne return
 btst #3,d0
 bne return
 btst #1,d0
 bne.s smoothd
 bsr up
 move.b topmenu,mandir
 rts
smoothd
 bsr down
 move.b topmenu,mandir
 rts 

readfire
 btst #7,$bfe001
 beq.s pressed
 bclr #fhold,flag
 rts
pressed
 btst #fhold,flag
 bne return
 bset #fhold,flag
 cmp.w #423,midblk
 beq terminal
 cmp.w #431,midblk
 beq terminal
 tst.w ammo
 beq clicksound
 move.b rounds,rndslft
 bset #pulse,flag
 cmp.b #15,rounds
 beq autohandsfx
 cmp.b #10,rounds
 beq autogunsfx
 cmp.b #5,rounds
 beq autoelecsfx
 cmp.b #2,rounds
 beq shotgunsfx
 cmp.b #1,rounds
 beq riflesfx
 rts 

firing
 tst.b rndslft
 beq noflame
 tst.w ammo
 beq outammo
 btst #pulse,flag
 beq noflame
 addq.w #1,bfired
 subq.w #1,ammo
 subq.b #1,rndslft
 move.l #flames,d5
 clr.w d0
 move.b lastdir(pc),d0
 subq.b #1,d0
 mulu #272,d0 
 add.l d0,d5
 move.w manx(pc),d0
 move.w many(pc),d1
 clr.w d4
 move.l #sprit4l,a0
 move.l d5,d2
 move.l d5,a1
 bsr adjust
 bsr setsprite
 move.w manx(pc),d0
 add.w #16,d0
 move.w many(pc),d1
 add.l #136,d5
 move.l #sprit5l,a0
 move.l d5,d2
 move.l d5,a1
 bsr adjust
 bsr setsprite
 bsr fdetect
 rts 

outammo
 clr.b rndslft
noflame
 clr.w sprit4l
 clr.w sprit4h
 clr.w sprit5l
 clr.w sprit5h
 rts

adjust
 move.b lastdir(pc),d3
 cmp.b #1,d3
 bne.s nour
 sub.w #21,d0
 sub.w #21,d1
 rts
nour
 cmp.b #2,d3
 bne.s ndou
 addq.w #5,d0
 sub.w #30,d1
 rts
ndou
 cmp.b #3,d3
 bne.s noul
 add.w #22,d0
 sub.w #20,d1
 rts
noul
 cmp.b #4,d3
 bne.s nol
 sub.w #30,d0
 addq.w #3,d1
 rts
nol
 cmp.b #5,d3
 bne.s nor
 add.w #24,d0
 addq.w #5,d1
 rts
nor
 cmp.b #6,d3
 bne.s nodl
 sub.w #22,d0
 add.w #21,d1
 rts
nodl
 cmp.b #7,d3
 bne.s nod
 addq.w #3,d0
 add.w #24,d1
 rts
nod
 add.w #21,d0
 add.w #20,d1
 rts

fdetect
 move.b lastdir(pc),d0
 cmp.b #1,d0
 bne.s fn1
 move.w #-16,d0
 move.w #-16,d1
 move.b #4,cdir
 bra fdir
fn1 cmp.b #2,d0
 bne.s fn2
 clr.w d0
 move.w #-16,d1
 move.b #5,cdir
 bra fdir
fn2 cmp.b #3,d0
 bne.s fn3
 move.w #16,d0
 move.w #-16,d1
 move.b #6,cdir
 bra.s fdir
fn3 cmp.b #5,d0
 bne.s fn4
 move.w #16,d0
 clr.w d1
 move.b #7,cdir
 bra.s fdir
fn4 cmp.b #8,d0
 bne.s fn5
 move.w #16,d0
 move.w #16,d1
 move.b #0,cdir
 bra.s fdir
fn5 cmp.b #7,d0
 bne.s fn6
 clr.w d0
 move.w #16,d1
 move.b #1,cdir
 bra.s fdir
fn6 cmp.b #6,d0
 bne.s fn7
 move.w #-16,d0
 move.w #16,d1
 move.b #2,cdir
 bra.s fdir
fn7 move.w #-16,d0
 clr.w d1
 move.b #3,cdir
fdir
 move.w curx(pc),d2
 move.w cury(pc),d3
 add.w manx(pc),d2
 add.w many(pc),d3
 sub.w #10,d2
 sub.w #20,d3
 move.w #10,d6
.loop
 bsr fdet
 beq return
 add.w d0,d2
 add.w d1,d3
 dbra d6,.loop
 rts
 
fdet
 move.l #aldata,a6
floop
 tst.b 1(a6)
 beq cwall
 tst.b (a6)
 beq fnext
 cmp.b #2,1(a6)
 ble.s fnext 
 move.w 4(a6),a0
 move.w 6(a6),a1
 move.w a0,a2
 move.w a1,a3
 subq.w #4,a0
 subq.w #4,a1
 lea 34(a2),a2
 lea 34(a3),a3
 cmp.w d2,a2
 blt.s fnext
 cmp.w d2,a0
 bgt.s fnext
 cmp.w d3,a3
 blt.s fnext
 cmp.w d3,a1
 bgt.s fnext
 move.b 3(a6),d0
 move.b gundam(pc),d1
 cmp.b d1,d0
 bgt.s damalien
 move.b #2,1(a6)
 clr.b 2(a6)
 clr.b 3(a6)
 add.w #10,score
 addq.w #1,deadene
 addq.w #1,bhit
 bsr woahsfx
 bra.s hit
fnext 
 addq.l #8,a6
 bra.s floop
damalien
 sub.b d1,3(a6)
 addq.w #1,bhit
 move.b cdir(pc),2(a6)
 bsr startblood
 bsr impactsfx
 bra.s hit

cwall
 move.l #map,a0
 move.w d2,d4
 move.w d3,d5
 addq.w #3,d4
 addq.w #3,d5
 lsr.w #4,d4
 lsr.w #4,d5
 lsl.w #1,d4
 lsl.w #7,d5
 add.w d4,a0
 add.w d5,a0
 move.w (a0),d4
 cmp.w #422,d4
 bgt.s fdoors
 cmp.w #197,d4
 blt.s nohit
hit
 clr.w d4
 rts
fdoors
 cmp.w #519,d4
 bge.s nohit
 cmp.w #511,d4
 blt.s nohit
 clr.w d4
 rts
nohit
 move.w #1,d4
 rts
startblood
 tst.w blx
 bne return
 move.w 4(a6),d0
 move.w 6(a6),d1
 add.w #12,d0
 add.w #20,d1
 move.w d0,blx
 move.w d1,bly
 clr.w blframe
 rts 

splashblood
 tst.w blx
 beq return
 move.w blx(pc),d0
 move.w bly(pc),d1
 sub.w stx(pc),d0
 sub.w sty(pc),d1
 move.l #sprit6l,a0
 move.l #blood,d2
 move.w blframe(pc),d3
 mulu #72,d3
 add.l d3,d2
 move.l d2,a1
 move.w d2,(a0)
 swap d2
 move.w d2,4(a0)
 add.w #$80+16,d0
 add.w #$2c+16,d1
 move.w d1,d3
 clr.w d2
 lsl.w #$8,d1
 roxl.b #$1,d2
 add.w #$10,d3
 lsl.w #$8,d3
 roxl.b #$1,d2
 lsr.w #$1,d0
 roxl.b #$1,d2
 or.w d2,d3
 or.w d0,d1
 move.w d1,(a1)
 move.w d3,2(a1)
 addq.w #1,blframe
 cmp.w #8,blframe
 blt return
 clr.w sprit6l
 clr.w sprit6h
 clr.w blx
 rts

setscreen
 btst #bufchng,flag
 beq.s nochange
 bclr #bufchng,flag
 bsr newframe
nochange
 move.l scrbak(pc),d4
 move.w scrx(pc),d0
 move.w curx(pc),d1
 lsr.w #4,d0
 lsr.w #4,d1
 sub.w d0,d1
 ext.l d1
 add.l d1,d1
 sub.l d1,d4
 move.w scry(pc),d0
 move.w cury(pc),d1
 sub.w d0,d1
 muls #240,d1
 sub.l d1,d4
 move.l d4,d0
 bsr intframe
 move.w scrx(pc),d0
 and.w #$f,d0
 move.w d0,d1
 lsl.w #4,d1
 or.w d1,d0
 not.w d0
 and.w #$ff,d0
 move.w d0,scrdel+2
 rts

injflash
 clr.w d0
 btst #injure,flag
 beq.s nored
 move.w #$500,d0
nored
 move.w d0,panelcols+2
 move.w d0,gamecols+2
 move.w d0,llogocols+2
 bclr #injure,flag
 rts

flash
 addq.b #1,lcount
 move.b lcount(pc),d0
 and.b #$8,d0
 cmp.b #$4,d0
 bgt flash1
 move.w #$600,gamecols+90
 move.w #$f00,gamecols+94
 rts
flash1
 move.w #$f00,gamecols+90
 move.w #$600,gamecols+94
 rts

setman
 move.b mandir,d0
 beq.s nojoy
 cmp.b #%0101,d0
 bne.s notul
 move.w #1,d1
 bra.s gotdir
notul
 cmp.b #%0100,d0
 bne.s notu
 move.w #2,d1
 bra.s gotdir
notu
 cmp.b #%0110,d0
 bne.s notur
 move.w #3,d1
 bra.s gotdir
notur
 cmp.b #%0001,d0
 bne.s notl
 move.w #4,d1
 bra.s gotdir
notl
 cmp.b #%0010,d0
 bne.s notr
 move.w #5,d1
 bra.s gotdir
notr
 cmp.b #%1001,d0
 bne.s notdl
 move.w #6,d1
 bra.s gotdir
notdl
 cmp.b #%1000,d0
 bne.s notd
 move.w #7,d1
 bra.s gotdir
notd
 cmp.b #%1010,d0
 bne.s notdr
 move.w #8,d1
 bra.s gotdir
notdr
 move.w #2,d1
 bra.s gotdir
nojoy
 move.b lastdir(pc),d1
gotdir
 addq.w #1,mframe
 move.w icount(pc),d0
 tst.w d0
 beq.s noinv
 subq.w #1,icount
 btst #0,d0
 beq manoff
noinv
 move.b d1,lastdir
 subq.b #1,d1
 and.w #$ff,d1
 mulu #544*5,d1
 tst.b mflag
 beq.s nomove
 move.w mframe(pc),d2
 and.w #$7,d2
 cmp.w #$5,d2
 blt.s short
 moveq.w #8,d0
 sub.w d2,d0
 move.w d0,d2
short
 mulu #544,d2
 bra.s moved
nomove
 clr.l d2
 clr.w mframe
moved
 move.l #sprites,d5
 add.l d1,d5
 add.l d2,d5
 move.w manx(pc),d0
 move.w many(pc),d1
 move.l d5,d2
 move.w #$80,d4
 move.l #sprit0l,a0
 move.l d2,a1
 bsr setsprite
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #136,d5
 move.l d5,d2
 move.w #$80,d4
 move.l #sprit1l,a0
 move.l d2,a1
 bsr setsprite
 move.w manx(pc),d0
 add.w #16,d0
 move.w many(pc),d1
 add.w #136,d5
 move.l d5,d2
 move.w #$80,d4
 move.l #sprit2l,a0
 move.l d2,a1
 bsr setsprite
 move.w manx(pc),d0
 add.w #16,d0
 move.w many(pc),d1
 add.w #136,d5
 move.l d5,d2
 move.w #$80,d4
 move.l #sprit3l,a0
 move.l d2,a1
 bsr setsprite
 rts

manoff
 clr.w sprit0l
 clr.w sprit0h
 clr.w sprit1l
 clr.w sprit1h
 clr.w sprit2l
 clr.w sprit2h
 clr.w sprit3l
 clr.w sprit3h
 rts

setsprite
 move.w d2,(a0)
 swap d2
 move.w d2,4(a0)
 add.w #$0080,d0
 add.w #$002c,d1
 move.w d1,d3
 clr.w d2
 lsl.w #$0008,d1
 roxl.b #$01,d2
 add.w #$0020,d3
 lsl.w #$0008,d3
 roxl.b #$01,d2
 lsr.w #$0001,d0
 roxl.b #$01,d2
 or.w d2,d3
 or.w d4,d3
 or.w d0,d1
 move.w d1,(a1)
 move.w d3,2(a1)
 rts

movealiens
 move.l #aldata,a1
maloop
 move.b 1(a1),d0
 beq return
 cmp.b #2,d0
 ble.s nextalien
 tst.b (a1)
 beq.s nextalien
 bsr.s alienmove
nextalien
 addq.l #8,a1
 bra.s maloop 

alienmove
 move.w 4(a1),d0
 move.w 6(a1),d1
 move.w d0,d3
 swap d3
 move.w d1,d3
 swap d3
 move.b 2(a1),d4
 beq.s alul
 cmp.b #1,d4
 beq.s alu
 cmp.b #2,d4
 beq.s alur
 cmp.b #3,d4
 beq alr
 cmp.b #4,d4
 beq aldr
 cmp.b #5,d4
 beq ald
 cmp.b #6,d4
 beq aldl
 cmp.b #7,d4
 beq all
alul
 move.w #-3,d5
 move.w #-3,d6
 bsr cale
 bne chngadir
 bsr cauple
 bne chngadir
 bsr caup
 bne chngadir
 subq.w #3,4(a1)
 subq.w #3,6(a1)
 rts
alu
 clr.w d5
 move.w #-3,d6
 bsr caupri
 bne chngadir
 bsr cauple
 bne chngadir
 bsr caup
 bne chngadir
 subq.w #3,6(a1)
 rts
alur
 move.w #3,d5
 move.w #-3,d6
 bsr caupri
 bne chngadir
 bsr cari
 bne chngadir
 bsr caup
 bne chngadir
 addq.w #3,4(a1)
 subq.w #3,6(a1)
 rts
alr
 move.w #3,d5
 clr.w d6
 bsr caupri
 bne chngadir
 bsr cari
 bne chngadir
 bsr cadnri
 bne chngadir
 addq.w #3,4(a1)
 rts
aldr
 move.w #3,d5
 move.w #3,d6
 bsr cadn
 bne chngadir
 bsr cari
 bne chngadir
 bsr cadnri
 bne chngadir
 addq.w #3,4(a1)
 addq.w #3,6(a1)
 rts
ald
 clr.w d5
 move.w #2,d6
 bsr cadn
 bne chngadir
 bsr cadnle
 bne chngadir
 bsr cadnri
 bne chngadir
 addq.w #3,6(a1)
 rts
aldl
 move.w #-3,d5
 move.w #3,d6
 bsr cadn
 bne.s chngadir
 bsr cadnle
 bne.s chngadir
 bsr cale
 bne.s chngadir
 subq.w #3,4(a1)
 addq.w #3,6(a1)
 rts
all  
 move.w #-3,d5
 clr.w d6
 bsr.s cauple
 bne.s chngadir
 bsr cadnle
 bne.s chngadir
 bsr cale
 bne.s chngadir
 subq.w #3,4(a1)
 rts
chngadir
 addq.b #1,cdcount
 btst #4,cdcount
 bgt.s otherway
 move.b 2(a1),d0
 beq.s resa
 subq.b #1,d0
 move.b d0,2(a1)
 rts
resa
 move.b #7,2(a1)
 rts 
otherway
 move.b 2(a1),d0
 cmp.b #7,d0
 beq.s resb
 addq.b #1,d0
 move.b d0,2(a1)
 rts
resb
 clr.b 2(a1)
 rts

cauple
 addq.w #4,d0
 addq.w #4,d1
 bra.s adetect
caup
 add.w #16,d0
 addq.w #4,d1
 bra.s adetect
caupri
 add.w #28,d0
 addq.w #4,d1
 bra.s adetect
cari
 add.w #28,d0
 add.w #16,d1
 bra.s adetect
cadnri
 add.w #28,d0
 add.w #28,d1
 bra.s adetect
cadn
 add.w #16,d0
 add.w #28,d1
 bra.s adetect
cadnle
 addq.w #4,d0
 add.w #28,d1
 bra.s adetect
cale
 addq.w #4,d0
 add.w #16,d1
 bra adetect

adetect
 add.w d5,d0
 add.w d6,d1
 lsr.w #4,d0
 lsr.w #4,d1
 lsl.w #1,d0
 lsl.w #7,d1
 move.l #map,a0
 add.w d0,a0
 add.w d1,a0
 move.w (a0),d0
 cmp.w #422,d0
 bgt.s noacol
 cmp.w #195,d0
 blt.s noacol
acol
 bsr.s restxy
 moveq.w #1,d2
 rts
noacol
 cmp.w #519,d0
 bge.s endacol
 cmp.w #511,d0
 bge.s acol
endacol
 bsr.s aadetect
 bsr.s restxy
 tst.w d7
 rts
restxy
 move.w d3,d0
 swap d3
 move.w d3,d1
 swap d3
 rts

aadetect
 movem.l d0-d6/a0-a6,-(sp)
 clr.w d7
 move.l #aldata,a6
 move.l a1,d4
 move.w 4(a1),d0
 move.w 6(a1),d1
 add.w d5,d0
 add.w d6,d1
 move.w d0,d2
 move.w d1,d3
 addq.w #2,d0
 addq.w #2,d1
 add.w #26,d2
 add.w #26,d3
aaloop
 cmp.l d4,a6
 beq.s aanext
 tst.b 1(a6)
 beq.s aafin
 move.w 4(a6),a0
 move.w 6(a6),a1
 move.w a0,a2
 move.w a1,a3
 addq.w #4,a0
 addq.w #4,a1
 lea 26(a2),a2
 lea 26(a3),a3
 cmp.w d0,a2
 blt.s aanext
 cmp.w d2,a0
 bgt.s aanext
 cmp.w d1,a3
 blt.s aanext
 cmp.w d3,a1
 bgt.s aanext
 moveq.w #1,d7
aafin
 movem.l (sp)+,d0-d6/a0-a6
 rts
aanext
 addq.l #8,a6
 bra.s aaloop

hdetect
 btst #dead,flag
 bne return
 tst.w icount
 bne return
 move.l #aldata,a6
 move.l a1,d4
 move.w curx(pc),d0
 move.w cury(pc),d1
 add.w manx(pc),d0
 add.w many(pc),d1
 move.w d0,d2
 move.w d1,d3
 sub.w #12,d0
 sub.w #28,d1
 addq.w #4,d2
 sub.w #12,d3
heloop
 tst.b 1(a6)
 beq return
 cmp.b #2,1(a6)
 ble hnext
 tst.b (a6)
 beq hnext
 move.w 4(a6),a0
 move.w 6(a6),a1
 move.w a0,a2
 move.w a1,a3
 addq.w #4,a0
 addq.w #4,a1
 lea 26(a2),a2
 lea 26(a3),a3
 cmp.w d0,a2
 blt.s hnext
 cmp.w d2,a0
 bgt.s hnext
 cmp.w d1,a3
 blt.s hnext
 cmp.w d3,a1
 bgt.s hnext
 bset #injure,flag
 move.w health(pc),d0
 move.w level(pc),d1
 lsr.w #1,d1
 add.w #10,d1
 cmp.w d0,d1
 bge.s vdead
 sub.w d1,health
 tst.b shotct
 bne return
 move.b #1,shotct
 cmp.b #1,rounds
 beq eatsfx
 cmp.b #5,rounds
 beq eatsfx
 rts
vdead
 bset #dead,flag
 move.w #50,scount
 clr.w health
 bsr screamsfx
 rts
hnext
 addq.l #8,a6
 cmp.l d4,d6
 beq.s hnext
 bra heloop

dspin
 subq.w #1,scount
 beq.s newlife
 move.w scount(pc),d0
 and.b #$7,d0
 addq.b #1,d0
 clr.b mandir
 move.b d0,lastdir
 rts
newlife 
 tst.w lives
 beq.s fingame
 subq.w #1,lives
 move.w #100,health
 move.w #100,icount
 bclr #dead,flag
 rts
fingame
 bset #over,flag
 rts

paneltext
 move.l #pnlgfx,a0
 lea 2886(a0),a0
 move.w score(pc),d0
 move.w #5,d1
 bsr.s drawpnum
 lea 11(a0),a0
 move.w lives(pc),d0
 move.w #1,d1
 bsr.s drawpnum
 addq.l #8,a0
 move.w health(pc),d0
 cmp.w #100,d0
 ble.s notover
 move.w #100,health
 move.w #100,d0
notover
 move.w #2,d1
 bsr.s drawpnum
 lea 10(a0),a0
 move.w keys(pc),d0
 move.w #2,d1
 bsr.s drawpnum
 lea 10(a0),a0
 move.w ammo(pc),d0
 move.w #3,d1
 bsr.s drawpnum
 rts
 
drawpnum
 clr.l d2
.loop
 and.l #$ffff,d0
 divu #10,d0
 swap d0
 move.b d0,d2
 add.b #16,d2
 swap d0
 bsr.s drawpchar
 dbra d1,.loop
 rts 

drawpchar
 move.l #pfont,a1
 lsl.w #3,d2
 add.l d2,a1
 rept 5
 move.b (a1)+,(a0)
 lea 160(a0),a0
 endr
 lea -801(a0),a0
 rts

pickups
 move.w manx(pc),d0
 move.w many(pc),d1
 addq.w #4,d0
 addq.w #4,d1
 bsr detect
 bsr.s checktile
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #18,d0
 addq.w #4,d1
 bsr detect
 bsr.s checktile
 move.w manx(pc),d0
 move.w many(pc),d1
 addq.w #4,d0
 add.w #18,d1
 bsr detect
 bsr.s checktile
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #18,d0
 add.w #18,d1
 bsr detect
 bsr.s checktile
 move.w manx(pc),d0
 move.w many(pc),d1
 add.w #11,d0
 add.w #11,d1
 bsr detect
 move.w d0,midblk
 rts

checktile
 cmp.w #471,d0
 beq hitlift
 cmp.w #439,d0
 bgt hitglobe
 cmp.w #53,d0
 bgt return
 cmp.w #52,d0
 bgt extralife
 cmp.w #48,d0
 bgt medikit
 cmp.w #44,d0
 bgt bullets
 cmp.w #40,d0
 bgt greenkey
 cmp.w #36,d0
 bgt bluekey
 cmp.w #36,d0
 beq shotgun
 cmp.w #35,d0
 beq machinegun
 cmp.w #34,d0
 beq machinepistol
 cmp.w #33,d0
 beq pulserifle
 cmp.w #32,d0
 beq loadsammo
 cmp.w #31,d0
 beq invincibility
 cmp.w #26,d0
 bgt medithree
 cmp.w #22,d0
 bgt medione
 rts

doors
 tst.w keys
 beq col
 subq.w #1,keys
 move.w #4,drcount
 move.w d0,d7
 bsr slidesfx
 cmp.w #511,d7
 beq.s verdoor
 cmp.w #512,d7
 beq.s verdoorl
 cmp.w #513,d7
 beq.s horzdoor
 cmp.w #514,d7
 beq.s horzdoorr
 cmp.w #515,d7
 beq.s verdoor
 cmp.w #516,d7
 beq.s verdoorl
 cmp.w #517,d7
 beq.s horzdoor
 cmp.w #518,d7
 beq.s horzdoorr
 rts

horzdoorr
 subq.l #2,a0
 subq.w #1,d7
horzdoor
 lsl.w #2,d7
 sub.w #1525,d7
 move.w d7,(a0)
 addq.w #4,d7
 move.w d7,2(a0)
 move.l a0,drdata
 addq.l #2,a0
 move.l a0,drdata+4
 moveq.w #0,d1
 rts
verdoorl
 lea -128(a0),a0
 subq.w #1,d7
verdoor
 lsl.w #2,d7
 sub.w #1525,d7
 move.w d7,(a0)
 addq.w #4,d7
 move.w d7,128(a0)
 move.l a0,drdata
 lea 128(a0),a0
 move.l a0,drdata+4
 moveq.w #0,d1
 rts
opendoors
 tst.l drdata
 beq return
 move.l drdata,a0
 move.l drdata+4,a1
 move.w (a0),d0
 move.w (a1),d1
 subq.w #1,drcount
 tst.w drcount
 bne.s slidedoor
 clr.l drdata
 bsr doorsfx
 rts
slidedoor
 addq.w #1,(a0)
 addq.w #1,(a1)
 rts
 
hitglobe
 cmp.w #439,d0
 beq.s actglobe
 cmp.w #447,d0
 beq.s blglobe
 cmp.w #455,d0
 beq.s trglobe
 cmp.w #463,d0
 beq.s brglobe
 rts
blglobe
 lea -128(a0),a0
 bra actglobe
trglobe
 subq.l #2,a0
 bra actglobe
brglobe
 lea -130(a0),a0
 bra actglobe
actglobe
 bsr globesfx
 add.w #100,score
 move.w #2,(a0)
 move.w #3,2(a0)
 move.w #9,128(a0)
 move.w #10,130(a0)
 subq.b #1,gleft
 move.l #pnlgfx+194,a0
 move.b #4,d0
 move.b gleft(pc),d1
 sub.b d1,d0
 and.l #$ff,d0
 add.l d0,a0
 move.b #%01111110,(a0)
 rts 

hitlift
 tst.b gleft
 bne return
 move.b #novec,vector
 bset #over,flag
 bset #compl,flag
 rts

extralife
 addq.w #1,lives
 move.w #1,(a0)
 bsr springsound
 rts
medikit
 move.w #100,health
 sub.w #49,d0
 bra gotpickup
 rts
bullets
 add.w #10,ammo
 sub.w #45,d0
 bra gotpickup
greenkey
 addq.w #1,keys
 sub.w #41,d0
 bra gotpickup
bluekey
 addq.w #3,keys
 sub.w #37,d0
 bra gotpickup
shotgun
 move.b #2,rounds
 move.b #14,gundam
 move.w #1,(a0)
 bsr springsound
 rts
machinegun
 move.b #10,rounds
 move.b #12,gundam
 move.w #1,(a0)
 bsr springsound
 rts
machinepistol
 move.b #15,rounds
 move.b #15,gundam
 move.w #1,(a0)
 bsr springsound
 rts
pulserifle
 move.b #5,rounds
 move.b #9,gundam
 move.w #1,(a0)
 bsr springsound
 rts
loadsammo
 add.w #50,ammo
 move.w #1,(a0)
 bsr squelchsound
 rts
invincibility
 move.w #350,icount
 move.w #1,(a0)
 bsr springsound
 rts
medione
 addq.w #5,health
 sub.w #23,d0
 bra.s gotpickup
medithree
 add.w #15,health
 sub.w #27,d0
 bra gotpickup

gotpickup
 cmp.w #0,d0
 bne.s notile
 move.w #1,d0
 bra.s fillin
notile
 cmp.w #1,d0
 bne.s nostile
 move.w #4,d0
 bra.s fillin
nostile
 cmp.w #2,d0
 bne.s nognd
 move.w #141,d0
 bra.s fillin
nognd
 move.w #144,d0
fillin
 move.w d0,(a0)
 bsr squelchsound
 rts 

speech
 tst.b shotct
 beq return
 addq.b #1,shotct
 rts

createmasks
 move.l #bobgfx,a0
 move.l #maskgfx,a1
 move.w #287,d5
.loop
 bsr.s createrow
 dbra d5,.loop
 rts
createrow
 move.w #11,d6
.rloop
 move.l (a0),d0
 move.l 48(a0),d1
 move.l 2*48(a0),d2
 move.l 3*48(a0),d3
 move.l 4*48(a0),d4
 or.l d1,d0
 or.l d2,d0
 or.l d3,d0
 or.l d4,d0
 move.l d0,(a1)+
 addq.l #4,a0
 dbra d6,.rloop
 lea 192(a0),a0
 rts

initint
 bsr clrtop
 move.l #intlogo,a0
 move.l screen(pc),a1
 lea (50*176)+2(a1),a1
 move.w #347,d0
.loop
 rept 10
 move.l (a0)+,(a1)+
 endr
 addq.l #4,a1
 dbra d0,.loop
 move.l screen(pc),a0
 lea 16546(a0),a0
 move.l a0,a1
 subq.l #2,a1
 bsr blitwait
 move.l a0,bltapth(a5)
 move.l a1,bltdpth(a5)
 move.l #-1,bltafwm(a5)
 move.l #$89f00000,bltcon0(a5)
 move.l #$20002,bltamod(a5)
 move.w #$2b15,bltsize(a5)
 move.w #250,counter
 move.l #pfire,a0
 move.l screen(pc),a1
 lea (170*176)+10(a1),a1
 bsr textline 
 rts

inithall
 bsr clrtop
 move.l #hallogo,a0
 move.l screen(pc),a1
 lea 1416(a1),a1
 move.w #123,d0
.loop
 rept 7
 move.l (a0)+,(a1)+
 endr
 lea 16(a1),a1
 dbra d0,.loop
 bsr clearwaves
 lea hiscrs(pc),a0
 move.l screen(pc),a1
 lea 9866(a1),a1
 bsr catchvb
 move.w #3,d7
.tloop
 bsr textline
 lea 3152(a1),a1
 dbra d7,.tloop
 bsr catchvb
 move.w #3,d7
.tloop2
 bsr textline
 lea 3152(a1),a1
 dbra d7,.tloop2
 bsr catchvb
 lea hinums(pc),a3
 move.l screen(pc),a1
 lea 9884(a1),a1
 move.w #7,d7
.nloop
 move.w (a3)+,d0
 move.w #5,d1
 bsr hextodec
 lea ascii(pc),a0
 bsr textline 
 lea 3162(a1),a1
 dbra d7,.nloop
 move.w #250,counter
 rts

clearwaves
 move.l #watdel+6,a0
 move.w #42,d0
.wloop
 clr.w (a0)
 addq.l #8,a0
 dbra d0,.wloop
 rts

initgame
 clr.w score
 clr.w keys
 clr.w level
 move.w #4,lives
 move.w #100,health
 move.w #500,ammo
 move.w #20,keys
 move.b #1,rounds
 move.b #20,gundam
 clr.b flag
 rts

initlevel
 bsr catchvb
 move.l #copper,cop1lch(a5)
 clr.l copjmp1(a5)
 clr.l drdata
 clr.l drdata+4
 clr.l pnlgfx+194
 clr.w leven
 clr.w deadene
 clr.w bfired
 clr.w bhit
 clr.b flag
 move.l #gamepal,curpal
 move.b #5,gleft
 move.b #2,lastdir
 move.w #4095,d0
 move.w #150,icount
 move.w #20592/2,sfxlen
 move.l #rumble,sfxpath
 move.l #mapdata,a0
 move.l #map,a1
 move.l #aldata,a2
 move.w level(pc),d1
 mulu #8192,d1
 add.l d1,a0
 move.l a0,curmap
iloop
 move.w (a0)+,(a1)+
 move.w (a0),d1
 cmp.w #109,d1
 blt.s reent
 cmp.w #110,d1
 bgt.s noman
 bsr.s manxy 
 bra.s reent
noman
 cmp.w #117,d1
 blt.s reent
 cmp.w #120,d1
 bgt.s reent 
 bsr.s alxy
reent
 dbra d0,iloop
 clr.w (a2)
 rts

manxy
 move.l a0,d1
 move.l curmap(pc),d2
 sub.l d2,d1
 lsr.w #1,d1
 divu #64,d1
 move.w d1,d2
 swap d1
 lsl.w #4,d1
 lsl.w #4,d2
 sub.w #114,d1
 sub.w #74,d2
 move.w d1,scrx
 move.w d2,scry
 move.w #146,manx
 move.w #114,many
 rts

alxy
 btst #0,d1
 beq.s gotcloaker
 move.b #3,d7
 bra.s nocloaker
gotcloaker
 move.b #4,d7
nocloaker
 addq.w #1,leven
 move.l a0,d1
 move.l curmap(pc),d2
 sub.l d2,d1
 lsr.w #1,d1
 divu #64,d1
 move.w d1,d2
 swap d1
 lsl.w #4,d1
 lsl.w #4,d2
 move.w d7,(a2)+
 move.l a2,d7
 lsr.w #1,d7
 and.w #$7,d7
 move.b d7,(a2)+
 move.w level,d7
 lsl.b #3,d7
 add.b #40,d7
 move.b d7,(a2)+
 move.w d1,(a2)+
 move.w d2,(a2)+
 rts

levelcomp
 btst #compl,flag
 beq return
 lea blondestreaks,a0
 bsr mtinit
 move.b #envec,vector
 bsr cls
 bsr introplanes
 bsr catchvb
 move.l #introcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 move.l #clrlogo,a0
 move.l screen(pc),a1
 addq.l #2,a1
 move.w #83,d0
.loop
 rept 10
 move.l (a0)+,(a1)+
 endr
 addq.l #4,a1
 dbra d0,.loop
 lea clrtxt1(pc),a0
 move.l screen(pc),a1
 lea 6+40*176(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea 6+60*176(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea 6+80*176(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea 6+130*176(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea 6+150*176(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea 6+170*176(a1),a1
 bsr textline
 move.w leven(pc),d0
 moveq.w #3,d1
 bsr hextodec
 lea ascii(pc),a0
 move.l screen(pc),a1
 lea 30+40*176(a1),a1
 bsr textline
 move.w deadene(pc),d0
 moveq.w #3,d1
 bsr hextodec
 lea ascii(pc),a0
 move.l screen(pc),a1
 lea 30+60*176(a1),a1
 bsr textline
 move.w leven(pc),d0
 move.w deadene(pc),d1
 bsr calcpercent
 moveq.w #3,d1
 bsr hextodec
 lea ascii(pc),a0
 move.l screen(pc),a1
 lea 30+80*176(a1),a1
 bsr textline
 cmp.w #80,lstpcnt
 blt.s norbonus
 lea ruth(pc),a0
 move.l screen(pc),a1
 lea 6+100*176(a1),a1
 bsr textline
 add.w #1000,score
norbonus
 move.w bfired(pc),d0
 moveq.w #3,d1
 bsr hextodec
 lea ascii(pc),a0
 move.l screen(pc),a1
 lea 30+130*176(a1),a1
 bsr textline
 move.w bhit(pc),d0
 moveq.w #3,d1
 bsr hextodec
 lea ascii(pc),a0
 move.l screen(pc),a1
 lea 30+150*176(a1),a1
 bsr textline
 move.w bfired(pc),d0
 move.w bhit(pc),d1
 bsr calcpercent
 moveq.w #3,d1
 bsr hextodec
 lea ascii(pc),a0
 move.l screen(pc),a1
 lea 30+170*176(a1),a1
 bsr textline
 cmp.w #80,lstpcnt
 blt.s noebonus
 lea perc(pc),a0
 move.l screen(pc),a1
 add.l #6+190*176,a1
 bsr textline
 add.w #500,score
noebonus
 bsr fadeinclr
 bsr firewait
 bsr fadeoutintb
 bsr mtend
 move.b #novec,vector
 rts

hextodec
 clr.l d2
 lea ascii(pc),a0
 rept 6
 clr.b (a0)+
 endr
 lea ascii(pc),a0
 add.w d1,a0
 addq.w #1,a0
.loop
 and.l #$ffff,d0
 divu #10,d0
 swap d0
 move.b d0,d2
 add.b #48,d2
 swap d0
 move.b d2,-(a0)
 dbra d1,.loop
 rts

calcpercent
 tst.w d0
 beq noperc
 tst.w d1
 beq noperc
 cmp.w #655,d1
 blt.s noshrink
 lsr.w #3,d0
 lsr.w #3,d1
noshrink
 mulu #100,d1
 and.l #$ffff,d1
 divu d0,d1
 and.l #$ffff,d1
 move.w d1,d0
 move.w d0,lstpcnt
 rts
noperc
 clr.w d0
 clr.w lstpcnt
 rts
 
terminal
 move.b #novec,vector
 bsr fadeout
 bsr setupterm
 lea implon(pc),a0
 bsr termpage
 bsr firewait
core
 lea impcore(pc),a0
 bsr termpage
 bsr termselect
 tst.b barmenu
 beq.s inquiry
 cmp.b #1,barmenu
 beq command
 cmp.b #2,barmenu
 beq invaders
 cmp.b #3,barmenu
 beq.s logoff
 cmp.b #4,barmenu
 beq special
logoff
 lea impdisc(pc),a0
 bsr termpage
 move.w #25,d0
 bsr wait
 bsr fadeoutterm
 move.l #copper,cop1lch(a5)
 bsr fadein
 move.b #gmvec,vector
 rts

inquiry
 lea impinq(pc),a0
 bsr termpage
 bsr termselect
 tst.b barmenu
 beq levmap
 cmp.b #1,barmenu
 beq.s autodestruct
 cmp.b #2,barmenu
 beq.s cooling
 cmp.b #3,barmenu
 beq.s emergency
 cmp.b #4,barmenu
 beq.s emersys
 cmp.b #5,barmenu
 beq.s compacc
 cmp.b #6,barmenu
 beq sysreg
 bra core
cooling
 lea impcool(pc),a0
 bsr termpage
 bsr termselect
 bra.s inquiry
autodestruct
 lea impauto(pc),a0
 bsr termpage
 bsr termselect
 bra.s inquiry
emergency
 lea impemer(pc),a0
 bsr termpage
 bsr termselect
 bra inquiry
emersys
 lea impesys(pc),a0
 bsr termpage
 bsr termselect
 bra inquiry
compacc
 lea impaccs(pc),a0
 bsr termpage
 bsr termselect
 tst.b barmenu
 beq.s level4
 cmp.b #1,barmenu
 beq.s level3
 cmp.b #2,barmenu
 beq.s level2
 cmp.b #3,barmenu
 beq.s level1 
 bra inquiry
level4
 lea implev4(pc),a0
 bsr termpage
 bsr termselect
 bra.s compacc
level3
 lea implev3(pc),a0
 bsr termpage
 bsr termselect
 bra.s compacc
level2
 lea implev2(pc),a0
 bsr termpage
 bsr termselect
 bra.s compacc
level1
 lea implev1(pc),a0
 bsr termpage
 bsr termselect
 bra.s compacc
sysreg
 lea impsreg(pc),a0
 bsr termpage
 bsr termselect
 bra inquiry
levmap 
 bsr clrtermtext
 bsr txtbeepsfx
 move.l tscreen(pc),a0
 addq.l #4,a0
 move.l #map,a1
 move.w #31,d0
.loop
 bsr catchvb
 bsr.s scanrow
 lea 128(a0),a0
 bsr.s scanrow
 lea 128(a0),a0
 dbra d0,.loop
 move.w #1,dmacon(a5)
 bsr firewait
 bra inquiry
scanrow
 move.w #31,d1
.loop
 bsr.s scanblock
 dbra d1,.loop
 rts
scanblock
 clr.b d3
 move.w (a1)+,d2
 cmp.w #422,d2
 bgt.s next
 cmp.w #197,d2
 blt.s next
 move.b #$f0,d3
next
 move.w (a1)+,d2
 cmp.w #422,d2
 bgt.s gotblks
 cmp.w #197,d2
 blt.s gotblks
 or.b #$f,d3
gotblks
 move.b d3,40(a0)
 move.b d3,80(a0)
 move.b d3,120(a0)
 move.b d3,(a0)+
 rts

command
 lea impcomm(pc),a0
 bsr termpage
 bsr termselect
 tst.b barmenu
 beq estat1
 cmp.b #1,barmenu
 beq estat2
 cmp.b #2,barmenu
 beq estat3
 cmp.b #3,barmenu
 beq findest
 cmp.b #4,barmenu
 beq.s filton
 cmp.b #5,barmenu
 beq.s filtoff
 bra core
filtoff
 bset #1,$bfe001
 bra.s command
filton
 bclr #1,$bfe001
 bra.s command
findest
 cmp.b #1,gleft
 bgt.s noglobes
 clr.b gleft
 move.l #emerpal,curpal
 move.l #siren,sfxpath
 move.w #19010/2,sfxlen
 bsr startsiren
 lea destcmp(pc),a0
 bsr termpage
 bsr termselect
 bra command
noglobes
 lea destnot(pc),a0
 bsr termpage
 bsr termselect
 bra command

estat1
estat2
estat3
 move.l #emerpal,curpal
 bra command

special
 lea impill(pc),a0
 bsr termpage
 bsr termselect
 bra core

termpage
 bsr clrtermtext
 bsr txtbeepsfx
 clr.w d7
tpage
 move.l tscreen,a1
 move.w d7,d0
 mulu #640,d0
 add.l d0,a1
 bsr termline
 tst.b d1
 beq.s newline
 cmp.b #1,d1
 beq.s endpage
 bra.s tpage
newline
 addq.w #1,d7
 bra.s tpage
endpage
 move.w #1,dmacon(a5)
 move.b (a0),barmenu
 move.b (a0)+,topmenu
 move.b (a0)+,botmenu
 rts
termline
 bsr catchvb
 bclr #shft,flag
ttloop 
 clr.w d1
 move.b (a0)+,d1
 cmp.b #5,d1
 blt return
 cmp.b #32,d1
 blt.s tab
 sub.b #32,d1
 lsl.w #5,d1
 move.l #cybfont,a2
 add.w d1,a2
 bsr blitwait
 move.l a2,bltapth(a5)
 move.l a1,bltcpth(a5)
 move.l a1,bltdpth(a5)
 clr.w bltamod(a5)
 move.w #38,bltcmod(a5)
 move.w #38,bltdmod(a5)
 move.l #-1,bltafwm(a5)
 move.w #$0bf0,bltcon0(a5)
 btst #shft,flag
 beq.s notshft
 move.w #$8bfa,bltcon0(a5)
notshft
 move.w #$401,bltsize(a5)
 bchg #shft,flag
 beq.s ttloop
 addq.l #2,a1
 bra.s ttloop
tab
 and.w #$ff,d1
 add.w d1,a1
 bra.s ttloop

termselect
 bsr.s dobar
 clr.b d7
tsloop
 bsr catchvb
 bsr.s dobar
 bsr.s termjoy
 bsr.s dobar
 btst #7,$bfe001
 bne.s tsloop
 move.w #10,d1
.loop
 bsr.s dobar
 bsr catchvb
 bsr catchvb
 dbra d1,.loop
 move.b topmenu,d0
 sub.b d0,barmenu
 rts

dobar
 move.l tscreen,a0
 clr.w d0
 move.b barmenu,d0
 mulu #640,d0
 add.l d0,a0
 move.w #159,d0
.loop
 not.l (a0)+
 dbra d0,.loop
 rts 

termjoy
 move.w joy1dat(a5),d0
tjoyd
 btst #0,d0
 beq.s tjoyd2
 btst #1,d0
 beq.s bardown
 bra.s tjoyu
tjoyd2
 btst #1,d0
 bne.s bardown
tjoyu
 btst #9,d0
 beq.s tjoyu3
tjoyu2
 btst #8,d0
 beq.s barup
 bra.s tjoy4
tjoyu3
 btst #8,d0
 bne.s barup
tjoy4
 bclr #0,d6
 rts

barup
 btst #0,d6
 bne return
 bset #0,d6
 move.b barmenu,d0
 cmp.b topmenu,d0
 beq return
 subq.b #1,barmenu
 rts
bardown
 btst #0,d6
 bne return
 bset #0,d6
 move.b barmenu,d0
 cmp.b botmenu,d0
 beq return
 addq.b #1,barmenu
 rts

clrtermtext
 move.l tscreen(pc),a1
 move.w #2559,d0
.loop
 clr.l (a1)+
 dbra d0,.loop
 rts

copytermback
 move.l #imbaq,a2
 move.l screen(pc),a1
 move.w #10239,d0
.loop
 move.l (a2)+,(a1)+
 dbra d0,.loop
 rts

setupterm
 move.l screen,a0
 add.l #40960,a0
 move.l a0,tscreen
 bsr termplanes
 bsr clrtermtext
 bsr copytermback
 bsr catchvb
 move.l #termcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 bsr fadeinterm
 rts
 
invaders
 bsr fadeoutterm
 bsr outrumble
 move.w #$f,dmacon(a5)
 bsr subgame
 bsr setupterm 
 bsr rumblesfx
 bra core

outrumble
 move.w #63,d0
.cloop
 bsr catchvb
 move.w d0,aud2vol(a5)
 move.w d0,aud3vol(a5)
 dbra d0,.cloop 
 rts

hiscores
 move.w hinums+14,d0
 cmp.w score,d0
 bgt return
 lea industrial,a0
 bsr mtinit
 move.b #envec,vector
 bsr introplanes
 bsr cls
 move.l #introcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 move.l #congfx,a0
 move.l screen(pc),a1
 addq.l #3,a1
 move.w #107,d0
hloop
 move.w #37,d1
.gloop 
 move.b (a0)+,(a1)+
 dbra d1,.gloop
 addq.l #6,a1
 dbra d0,hloop
 move.l #hinums+14,a0
 move.b #8,d0
jloop
 move.w -(a0),d1
 cmp.w score,d1
 bgt.s gotplace
 subq.b #1,d0
 cmp.b #1,d0
 bgt.s jloop
gotplace
 move.b d0,rounds
 add.b #48,d0
 move.b d0,connum
 move.l #conmess,a0
 move.l screen(pc),a1
 lea (176*50)+10(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea (176*80)+18(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea (176*110)+8(a1),a1
 bsr textline
 move.l screen(pc),a1
 lea (176*180)+2(a1),a1
 bsr textline
 bsr fadeinhi
 move.l #name,a3
 bsr highlight
nameloop
 bsr catchvb
 bsr drawname
 bsr highlight
 bsr getlet
 bsr highlight
 btst #7,$bfe001
 beq.s fpress
 bra.s nameloop
fpress
 move.b rounds,d7
 move.b d7,d1
 cmp.b #8,d7
 beq.s last
 move.b #8,d0
 sub.b d7,d0
 and.w #$ff,d0
 subq.w #1,d0
 move.w d0,d3
 move.l #hiscrs+6*18,a0
 move.l #hinums+12,a1
.loop
 move.l (a0),18(a0)
 move.w (a1),2(a1)
 lea -18(a0),a0
 subq.l #2,a1
 dbra d0,.loop 
last
 subq.b #1,d1
 and.w #$ff,d1
 move.w d1,d2
 mulu #18,d1
 lea hiscrs,a0
 add.w d1,a0
 lsl.w #1,d2
 lea hinums,a1
 add.w d2,a1
 move.w score,(a1)
 lea name,a1
 move.b (a1)+,(a0)+
 move.b (a1)+,(a0)+
 move.b (a1)+,(a0)+
 bsr fadeoutget
 rts
drawname
 lea name,a0
 move.l screen(pc),a1
 lea (176*150)+20(a1),a1
 bsr textline
 rts
highlight
 move.l a3,d0
 sub.l #name,d0
 move.l screen(pc),a1
 lea (176*149)+20(a1),a1
 add.w d0,a1
 eor.b #$fe,(a1)
 eor.b #$fe,17*176(a1)
 rts

getlet
entlr
 move.w joy1dat(a5),d0
entr
 btst #1,d0
 bne lright
entl
 btst #9,d0
 bne.s lleft
entd
 btst #0,d0
 beq.s entd2
 btst #1,d0
 beq.s ldown
 bra.s entu
entd2
 btst #1,d0
 bne.s ldown
entu
 btst #9,d0
 beq.s entu3
entu2
 btst #8,d0
 beq.s lup
 bra.s ent4
entu3
 btst #8,d0
 bne.s lup
ent4
 bclr #fhold,flag
 rts
lup
 btst #fhold,flag
 bne return
 bset #fhold,flag
 move.b (a3),d0
 cmp.b #65,d0
 ble return
 subq.b #1,(a3)
 rts
ldown
 btst #fhold,flag
 bne return
 bset #fhold,flag
 move.b (a3),d0
 cmp.b #90,d0
 bge return
 addq.b #1,(a3)
 rts
lleft
 btst #fhold,flag
 bne return
 bset #fhold,flag
 cmp.l #name,a3
 ble return
 subq.l #1,a3
 rts
lright
 btst #fhold,flag
 bne return
 bset #fhold,flag
 cmp.l #name+2,a3
 bge return
 addq.l #1,a3
 rts 
 
complete
 btst #compl,flag
 beq return
 bsr termplanes
 bsr cls
 move.w #1023,d0
 move.l #winona,a0
 move.l screen(pc),a1
 add.l #40960,a1
 move.l a1,tscreen
 move.l screen(pc),a1
 lea 20(a1),a1
.loop
 rept 5
 move.l (a0)+,(a1)+
 endr
 lea 20(a1),a1
 dbra d0,.loop
 move.l #termcopper,cop1lch(a5)
 clr.l copjmp1(a5)
 lea comp(pc),a0
 move.w #-1,d7
 bra.s newcline
endloop
 move.b (a0)+,d0
 beq.s newcline
 cmp.b #1,d0
 beq.s finend
 move.l #pfont,a1
 and.w #$ff,d0
 sub.w #32,d0
 lsl.w #3,d0
 add.w d0,a1
 move.l a1,a3
 lea 768(a3),a3
 rept 6
 move.b (a1)+,(a2)
 move.b (a3)+,-10240(a2)
 lea 40(a2),a2
 endr
 lea -239(a2),a2
 bra.s endloop
newcline
 addq.w #1,d7
 move.w d7,d0
 mulu #40*8,d0
 move.l tscreen(pc),a2
 add.l d0,a2
 bra.s endloop
finend 
 bsr fadeinwinona
 bsr firewait
 bsr fadewhite
 bsr fadeoutterm
 rts 

txtbeepsfx
 move.l #beep,d2
 move.w #5692/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr start0
 rts
txtbeepasfx
 move.l #beepa,d2
 move.w #6422/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr channel0
 rts
riflesfx
 move.l #rifle,d2
 move.w #13000/2,d3
 move.w #250,d4
 move.w #50,d5
 bsr.s channel0
 rts
shotgunsfx
 move.l #shot,d2
 move.w #14458/2,d3
 move.w #250,d4
 move.w #50,d5
 bsr.s channel0
 rts
autogunsfx
 move.l #autgun,d2
 move.w #11214/2,d3
 move.w #250,d4
 move.w #50,d5
 bsr.s channel0
 rts
autoelecsfx
 move.l #elcgun,d2
 move.w #6800/2,d3
 move.w #250,d4
 move.w #50,d5
 bsr.s channel0
 rts
autohandsfx
 move.l #ahgun,d2
 move.w #13300/2,d3
 move.w #250,d4
 move.w #50,d5
 bsr.s channel0
 rts
clicksound
 move.l #clack,d2
 move.w #1300/2,d3
 move.w #250,d4
 move.w #50,d5
 bsr.s channel0
 rts
channel0
 bsr.s start0
 bsr videowait
 move.w #2,aud0len(a5)
 rts
start0
 move.w #$1,dmacon(a5)
 bsr videowait
 move.l d2,aud0lch(a5)
 move.w d3,aud0len(a5)
 move.w d4,aud0per(a5)
 move.w d5,aud0vol(a5)
 move.w #$8001,dmacon(a5)
 rts

beepgsfx
 move.l #beepg,d2
 move.w #8300/2,d3
 move.w #250,d4
 move.w #40,d5
 bsr.s channel1
 rts
impactsfx
 move.l #impact,d2
 move.w #1866/2,d3
 move.w #350,d4
 move.w #64,d5
 bsr.s channel1
 rts
springsound
 move.l #spring,d2
 move.w #1788/2,d3
 move.w #400,d4
 move.w #30,d5
 bsr.s channel1
 rts
squelchsound
 move.l #squelch,d2
 move.w #1362/2,d3
 move.w #250,d4
 move.w #30,d5
 bsr.s channel1
 rts
globesfx
 move.l #globe,d2
 move.w #7628/2,d3
 move.w #250,d4
 move.w #40,d5
 bsr.s channel1
 rts
woahsfx
 move.l #woah,d2
 move.w #9200/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr.s channel1
 rts
channel1
 bsr.s start1
 bsr videowait
 move.w #2,aud1len(a5)
 rts
start1
 move.w #$2,dmacon(a5)
 bsr videowait
 move.l d2,aud1lch(a5)
 move.w d3,aud1len(a5)
 move.w d4,aud1per(a5)
 move.w d5,aud1vol(a5)
 move.w #$8002,dmacon(a5)
 rts

slidesfx
 move.l #slide,d2
 move.w #2234/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr.s channel2
 move.l #atom,d2
 move.w #8910/2,d3
 bsr.s soon2
 rts
doorsfx
 move.l #drclnk,d2
 move.w #8238/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr.s channel2
 move.l #atom,d2
 move.w #8910/2,d3
 bsr.s soon2
 rts
screamsfx
 move.l #scream,d2
 move.w #9072/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr.s channel2
 move.l #atom,d2
 move.w #8910/2,d3
 bsr.s soon2
 rts
channel2
 bsr.s start2
 bsr videowait
 move.w #2,aud2len(a5)
 rts
start2
 move.w #$4,dmacon(a5)
 bsr videowait
soon2
 move.l d2,aud2lch(a5)
 move.w d3,aud2len(a5)
 move.w d4,aud2per(a5)
 move.w d5,aud2vol(a5)
 move.w #$8004,dmacon(a5)
 rts

startsiren
 move.l sfxpath(pc),d2
 move.w sfxlen(pc),d3
 move.w #250,d4
 move.w #64,d5
 bsr soon3
 rts
eatsfx
 move.l #eatthis,d2
 move.w #10102/2,d3
 move.w #250,d4
 move.w #64,d5
 bsr channel3
 move.l sfxpath(pc),d2
 move.w sfxlen(pc),d3
 bsr soon3
 rts
rumblesfx
 move.l #rumble,d2
 move.w #20592/2,d3
 move.w #250,d4
 clr.w d5
 bsr.s start3
 move.l #atom,d2
 move.w #8910/2,d3
 move.w #250,d4
 clr.w d5
 bsr start2
 move.w #63,d0
.loop
 bsr catchvb
 move.w #64,d1
 sub.w d0,d1
 move.w d1,aud2vol(a5)
 move.w d1,aud3vol(a5)
 dbra d0,.loop
 rts
channel3
 bsr.s start3
 bsr videowait
 move.w #2,aud3len(a5)
 rts
start3
 move.w #$8,dmacon(a5)
 bsr videowait
soon3
 move.l d2,aud3lch(a5)
 move.w d3,aud3len(a5)
 move.w d4,aud3per(a5)
 move.w d5,aud3vol(a5)
 move.w #$8008,dmacon(a5)
 rts

videowait
 moveq.w #3,d0
vid2 
 move.b vhposr(a5),d1
vid3 
 cmp.b vhposr(a5),d1
 beq.s vid3
 dbra d0,vid2 
 moveq.w #8,d1
vid4 
 dbra d1,vid4
 rts
 
fadein
 lea frntpal(pc),a3
 move.l #llogocols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 lea panelpal(pc),a3
 move.l #panelcols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 move.l curpal(pc),a3
 move.l #gamecols+2,a4
 move.w #31,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeout
 lea blackpal(pc),a3
 move.l #panelcols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 lea blackpal(pc),a3
 move.l #gamecols+2,a4
 move.w #31,colnumb
 move.w #4,paladd
 bsr fade
 lea blackpal(pc),a3
 move.l #llogocols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeinint
 lea scrlpal(pc),a3
 move.l #textdel+10,a4
 move.w #23,colnumb
 move.w #8,paladd
 bsr fade
fadeinget
 lea frntpal(pc),a3
 move.l #introcols+2,a4
 move.w #19,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeoutint
 lea blackpal(pc),a3
 move.l #textdel+10,a4
 move.w #23,colnumb
 move.w #8,paladd
 bsr fade
fadeoutget
 lea blackpal(pc),a3
 move.l #introcols+2,a4
 move.w #19,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeoutintb
 lea blackpal(pc),a3
 move.l #introcols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadered
 lea redpal(pc),a3
 move.l #introcols+2,a4
 move.w #19,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeinterm
 lea termpal(pc),a3
 move.l #termcols+2,a4
 move.w #31,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeoutterm
 lea blackpal(pc),a3
 move.l #termcols+2,a4
 move.w #31,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeinwinona
 lea winonapal(pc),a3
 move.l #termcols+2,a4
 move.w #31,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadewhite
 lea whitepal(pc),a3
 move.l #termcols+2,a4
 move.w #31,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeinhi
 lea hipal(pc),a3
 move.l #introcols+2,a4
 move.w #19,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeinclr
 lea lclrpal(pc),a3
 move.l #introcols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 rts
fadeingov
 lea goverpal(pc),a3
 move.l #introcols+2,a4
 move.w #15,colnumb
 move.w #4,paladd
 bsr fade
 rts

fade
 bsr catchvb
 move.w #15,d7
.floop
 bsr catchvb
 bsr.s stpfade
 dbra d7,.floop
 rts
stpfade
 move.l a3,a0
 move.l a4,a1
 move.w colnumb(pc),d0
fadeloop
 move.w (a0)+,d1
 move.w d1,d2
 move.w d1,d3
 move.w (a1),d4
 move.w d4,d5
 move.w d4,d6
 and.w #$f00,d1
 and.w #$f0,d2
 and.w #$f,d3
 and.w #$f00,d4
 and.w #$f0,d5
 and.w #$f,d6
redin
 cmp.w d1,d4
 beq.s greenin
 blt.s redup
 sub.w #$100,d4
 bra.s greenin
redup
 add.w #$100,d4
greenin
 cmp.w d2,d5
 beq.s bluein
 blt.s greenup
 sub.w #$10,d5
 bra.s bluein
greenup
 add.w #$10,d5
bluein
 cmp.w d3,d6
 beq.s nextin
 blt.s blueup
 subq.w #$1,d6
 bra.s nextin
blueup
 addq.w #$1,d6
nextin
 or.w d4,d5
 or.w d5,d6
 move.w d6,(a1)
 add.w paladd(pc),a1
 dbra d0,fadeloop
 rts

disableos
 lea $dff000,a5
 move.l 4.w,a6
 bsr blitwait
 bsr catchvb
 jsr -120(a6)
 move.w #$7fff,dmacon(a5)
 move.w #$7fff,intena(a5)
 move.l $6c.w,oldint+2
 move.l	#interrupts,$6c.w
 move.w #$87e0,dmacon(a5)
 move.w #$c020,intena(a5)
 clr.l spr0dat(a5)
 clr.l 0.w
 clr.b flag
 bset #1,$bfe001
 rts
enableos
 move.w #$7fff,dmacon(a5)
 move.w #$7fff,intena(a5)
oldint
 move.l #0,$6c.w
 move.w #$83f0,dmacon(a5)
 move.w #$e02c,intena(a5)
 move.l 4.w,a6
 jsr -126(a6)
 rts

blitwait 
 btst #14,dmaconr(a5)
bwait
 btst #14,dmaconr(a5)
 bne.s bwait
 rts

firewait
 btst #7,$bfe001
 bne.s firewait
 rts

wait
.wait
 bsr.s catchvb
 dbra d0,.wait
 rts

startvb
 btst #0,vposr+1(a5)
 beq.s startvb
 rts
catchvb
 btst #0,vposr+1(a5)
 beq.s catchvb
vb2
 btst #0,vposr+1(a5)
 bne.s vb2
 rts

framewait
 btst #bufchng,flag
 bne.s framewait
 rts
newframe
 move.l screen(pc),d0
 move.l scrbak(pc),screen
 move.l d0,scrbak
 move.w stx(pc),curx
 move.w sty(pc),cury
 rts
intframe
 add.l #9604,d0
 move.w d0,plane1l
 swap d0
 move.w d0,plane1h
 swap d0
 add.l #48,d0
 move.w d0,plane2l
 swap d0
 move.w d0,plane2h
 swap d0
 add.l #48,d0
 move.w d0,plane3l
 swap d0
 move.w d0,plane3h
 swap d0
 add.l #48,d0
 move.w d0,plane4l
 swap d0
 move.w d0,plane4h
 swap d0
 add.l #48,d0
 move.w d0,plane5l
 swap d0
 move.w d0,plane5h
 rts
bitplanes
 move.l #scrbuf1,screen
 move.l #scrbuf2,scrbak
 move.l #pnlgfx,d0
 move.w d0,ppln1l
 swap d0
 move.w d0,ppln1h
 swap d0
 add.l #40,d0
 move.w d0,ppln2l
 swap d0
 move.w d0,ppln2h
 swap d0
 add.l #40,d0
 move.w d0,ppln3l
 swap d0
 move.w d0,ppln3h
 swap d0
 add.l #40,d0
 move.w d0,ppln4l
 swap d0
 move.w d0,ppln4h
 move.l #llogfx,d0
 move.w d0,lpln1l
 swap d0
 move.w d0,lpln1h
 swap d0
 add.l #40,d0
 move.w d0,lpln2l
 swap d0
 move.w d0,lpln2h
 swap d0
 add.l #40,d0
 move.w d0,lpln3l
 swap d0
 move.w d0,lpln3h
 swap d0
 add.l #40,d0
 move.w d0,lpln4l
 swap d0
 move.w d0,lpln4h
 rts
introplanes
 move.l screen(pc),d0
 move.w d0,ipln1l
 swap d0
 move.w d0,ipln1h
 swap d0
 add.l #44,d0
 move.w d0,ipln2l
 swap d0
 move.w d0,ipln2h
 swap d0
 add.l #44,d0
 move.w d0,ipln3l
 swap d0
 move.w d0,ipln3h
 swap d0
 add.l #44,d0
 move.w d0,ipln4l
 swap d0
 move.w d0,ipln4h
 rts
termplanes
 move.l screen(pc),d0
 move.w d0,tpln1l
 swap d0
 move.w d0,tpln1h
 swap d0
 add.l #$2800,d0
 move.w d0,tpln2l
 swap d0
 move.w d0,tpln2h
 swap d0
 add.l #$2800,d0
 move.w d0,tpln3l
 swap d0
 move.w d0,tpln3h
 swap d0
 add.l #$2800,d0
 move.w d0,tpln4l
 swap d0
 move.w d0,tpln4h
 swap d0
 add.l #$2800,d0
 move.w d0,tpln5l
 swap d0
 move.w d0,tpln5h
 rts

cls
 move.l screen(pc),a0
 move.w #(scrsize/4)-1,d0
.loop
 clr.l (a0)+
 dbra d0,.loop
 rts

clrtop
 move.l screen(pc),a0
 move.w #8799,d0
.loop
 clr.l (a0)+
 dbra d0,.loop
 rts 

error 
 move.w	#-1,d0
.errloop
 move.w #$f00,col00(a5)
 dbra d0,.errloop
 clr.l d0
 rts

screen	dc.l 0
scrbak	dc.l 0
scrlpnt	dc.l 0
watrpnt	dc.l 0
tscreen	dc.l 0
drdata	dc.l 0,0
curpal	dc.l 0
sfxpath	dc.l 0
temp	dc.l 0
curmap	dc.l 0
sfxlen	dc.w 0
drcount	dc.w 0
scrx	dc.w 0
scry	dc.w 0
manx	dc.w 0
many	dc.w 0
curx	dc.w 0
cury	dc.w 0
stx	dc.w 0
sty	dc.w 0
level	dc.w 0
animadd	dc.w 0
colnumb dc.w 0
score	dc.w 0
lives	dc.w 0
health	dc.w 0
keys	dc.w 0
ammo	dc.w 0
paladd	dc.w 0
lastblk	dc.w 0
midblk	dc.w 0
icount	dc.w 0
counter	dc.w 0
scount	dc.w 0
bfired	dc.w 0
bhit	dc.w 0
leven	dc.w 0
deadene	dc.w 0
lstpcnt	dc.w 0
blx	dc.w 0
bly	dc.w 0
blframe	dc.w 0
clicks	dc.w 0
mframe	dc.w 0
mread	dc.w 0
shotct	dc.b 0
atomct	dc.b 0
cdir	dc.b 0
cdcount	dc.b 0
flag	dc.b 0
vector	dc.b 0
mandir	dc.b 0
mflag	dc.b 0
lastdir dc.b 0
rounds	dc.b 0
rndslft	dc.b 0
gundam	dc.b 0
lcount	dc.b 0
topmenu dc.b 0
botmenu	dc.b 0
barmenu	dc.b 0
gleft	dc.b 0
dflag	dc.b 0

share	dc.b 0,"Welcome to Psycheual",0
	dc.b "____________________",0,0
	dc.b "Amiga Format",0
	dc.b "____________",0
	dc.b 34,"...probably one of the best investments",0
	dc.b "you've ever made for your Amiga.",0
	dc.b "What more could you want?",34,0,0
	dc.b "Amiga Power",0
	dc.b "___________",0
	dc.b 34,"...this is great quality stuff.",34,0,0,0,0,0,0,0
	dc.b "This version of Psycheual is not freely",0
	dc.b "distributable. Please don't make copies",0
	dc.b "for anyone else. Thanks.",0,0
	dc.b "^^^^^^^^^^",0,0
	dc.b "Press fire to continue...",0,1


pfire	dc.b "PRESS FIRE TO COMMENCE...",0
player1	dc.b "PLAYER 1",0
getread	dc.b " GET READY!",0
gover	dc.b " GAME OVER.",0
text	dc.b "                                        "

retext	dc.b "WELCOME TO PSYCHEUAL.    HERE ARE SOME BASIC INSTRUCTIONS "
	dc.b "TO HELP YOU GET GOING.    ON EACH LEVEL THERE ARE FOUR POWER "
	dc.b "GLOBES WHICH YOU NEED TO ACTIVATE.  THERE ARE FOUR LITTLE "
	dc.b "LIGHTS AT THE TOP RIGHT OF THE SCREEN WHICH ILLUMINATE "
	dc.b "AS YOU DO THIS.  WHEN YOU'VE GOT ALL FOUR, YOU "
	dc.b "WILL NEED TO LOG ON TO A TERMINAL AND SELECT THE FINALISE "
	dc.b "DESTRUCT SEQUENCE OPTION FROM THE COMMAND MENU.  WHEN YOU "
	dc.b "HEAR THE SIREN START, LEG IT TO THE DECK LIFT TO ESCAPE THE "
	dc.b "LEVEL.  DON'T "
	dc.b "FORGET TO BRUTALLY CUT DOWN ANYONE WHO GETS IN YOUR WAY. "

	dc.b "                PROGRAMMING, GRAPHICS, "
	dc.b "MUSIC AND SOUND EFFECTS BY BEN JAMES.  "
	dc.b "ORIGINAL TITLE MUSIC BY UNDERWORLD [RICK SMITH, "
	dc.b "KARL HYDE AND DARREN EMERSON]  "
	dc.b "PROTRACKER V1.1B PLAY ROUTINE BY LARS HAMRE."
	dc.b "                                            ",0

null	DC.B 1
impcore DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",12," CORE MENU ",14,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B 6,"OPTION  .... ACCESS REQUIRED",0
	DC.B "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",0
	DC.B 6,"INQUIRY .... LEVEL 03 ACCESS",0
	DC.B 6,"COMMAND .... LEVEL 03 ACCESS",0
	DC.B 6,"LEISURE .... LEVEL 04 ACCESS",0
	DC.B 6,"LOG OUT",0
	DC.B 6,"SPECIAL .... LEVEL 01 ACCESS",0,0
	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# PUSH JOYSTICK ^ _  TO CHOOSE OPTION, $",0
	DC.B "# THEN PRESS FIRE TO SELECT.           $",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B 1,5,9
impinq	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",12,"STATE INQUIRY",12,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0,0
	DC.B 10,"LEVEL SCHEMATICS",0
	DC.B 10,"AUTO DESTRUCT",0
	DC.B 10,"COOLING SYSTEMS",0
	DC.B 10,"EMERGENCY PROCEDURES",0
	DC.B 10,"EMERGENCY SYSTEMS",0
	DC.B 10,"COMPUTER ACCESS LEVELS",0
	DC.B 10,"SYSTEM REGULATIONS",0
	DC.B 10,"<  CORE MENU",0
	DC.B 1,4,11
impcool	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  COOLING SYSTEMS ",11,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "EACH LEVEL OF THE STATION HAS IT'S OWN",0
	DC.B "COOLING SYSTEMS. THESE SYSTEMS ARE NOT",0
	DC.B "FOR KEEPING THE STATION COOL, BUT FOR",0
	DC.B "THE LEVEL'S FUSION REACTORS.",0,0
	DC.B "THE COOLING SYSTEM ON ANY GIVEN LEVEL",0
	DC.B "CANNOT BE DEACTIVATED UNDER NORMAL",0
	DC.B "CIRCUMSTANCES. HOWEVER, SHOULD A CODE 2",0
	DC.B "EMERGENCY BE INITIATED, THE COOLING",0
	DC.B "SYSTEM CAN THEN BE SHUT DOWN",0,0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
impauto	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",10,"@  AUTO DESTRUCT ",11,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "A DELIBERATE SERIES OF EVENTS MUST TAKE",0
	DC.B "PLACE TO INITIALISE THE AUTO DESTRUCT",0
	DC.B "SEQUENCE.",0,0
	DC.B "ON EACH LEVEL OF THE STATION, THERE ARE",0
	DC.B "FOUR GLOBES. ALL FOUR MUST BE ACTIVATED",0
	DC.B "AS THE FIRST PART OF THE AUTO DESTRUCT",0
	DC.B "SEQUENCE. FINALISING THE SEQUENCE IS",0
	DC.B "ACHIEVED BY RUNNING A DIGITALLY ENCODED",0
	DC.B "COMMAND FROM ANY IMPAQ TERMINAL.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
impemer	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",6,"@  EMERGENCY PROCEDURES",8,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "SHOULD EMERGENCY CONDITIONS ARISE, THE",0
	DC.B "COMPUTER SYSTEM MUST BE INFORMED SO THAT",0
	DC.B "IT CAN PLACE THE STATION ON EMERGENCY",0
	DC.B "STATUS. INDUCING AN EMERGENCY CODE WILL",0
	DC.B "ENABLE APPROPRIATE EMERGENCY SYSTEMS.",0
	DC.B "FOR MORE, READ EMERGENCY SYSTEMS HELP.",0
	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# CODE 1 ... LIFE SUPPORT/HULL BREACH  $",0
	DC.B "# CODE 2 ... BIOLOGICAL CONTAMINATION  $",0
	DC.B "# CODE 3 ... INTERNAL MALFUNCTION",6,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
impesys	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  EMERGENCY SYSTEMS",8," $",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "ONCE EMERGENCY STATUS HAS BE INITIATED,",0
	DC.B "EMERGENCY SYSTEMS AND FUNCTIONS WILL",0
	DC.B "BECOME ACTIVE. EACH LEVEL OF EMERGENCY",0
	DC.B "HAS PARTICULAR SYSTEMS AS FOLLOWS.",0
	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# CODE 1 ... EMERGENCY POWER ",10,"$",0
	DC.B "#",8,"... EMERGENCY LIGHTING",8,"$",0
	DC.B "# CODE 2 ... AUTO DESTRUCT ENABLED     $",0
	DC.B "#",8,"... EVACUATION LIGHTING",6," $",0
	DC.B "# CODE 3 ... EMERGENCY POWER ",10,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B 18,"EXIT",0
	DC.B 1,14,14	
impaccs	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",6,"@  COMPUTER ACCESS LEVELS",6,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "MANY FUNCTIONS AVAILABLE ON AN IMPAQ",0
	DC.B "NETWORK TERMINAL ARE ONLY AVAILABLE TO",0
	DC.B "USER WITH A SUFFICIENTLY HIGH ACCESS",0
	DC.B "LEVEL. THE LOWEST LEVEL IS 4 AND THE",0
	DC.B "HIGHEST IS 1. MORE INFORMATION ON A",0
	DC.B "PARTICULAR ACCESS LEVEL IS AVAILABLE.",0,0
	DC.B 12,"LEVEL 04 ACCESS",0
	DC.B 12,"LEVEL 03 ACCESS",0
	DC.B 12,"LEVEL 02 ACCESS",0
	DC.B 12,"LEVEL 01 ACCESS [PARTIAL]",0
	DC.B 12,"<  INQUIRY MENU",0
	DC.B 1,10,14
implev4	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  LEVEL 04 ACCESS ",11,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "LEVEL 4 IS THE MOST RESTRICTED COMPUTER",0
	DC.B "ACCESS LEVEL. DESIGNED TO ACCOMODATE ALL",0
	DC.B "NON TECHNICAL PERSONNEL. DATA RECORDS",0
	DC.B "CAN BE ACCESSED TO A SHALLOW LEVEL, PLUS",0
	DC.B "BASIC COMMAND PROCEDURES CAN BE EASILY",0
	DC.B "PERFORMED.",0,0
	DC.B "ALL ACCESS LEVELS ALLOW FULL ACCESS TO",0
	DC.B "THE LIMITED COMPUTER LEISURE FACILITIES.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,13,13
implev3	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  LEVEL 03 ACCESS ",11,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "LEVEL 3 ACCESS IS SPECIFICALLY FOR THE",0
	DC.B "STATIONS ENGINEERS. IT ENABLES TEST AND",0
	DC.B "VERIFICATION COMMANDS TO BE EXECUTED.",0
	DC.B "CERTAIN COMMANDS ARE DISABLED DURING",0
	DC.B "THE DARK HOURS, WHICH IS WHEN THE",0
	DC.B "MAJORITY OF PERSONNEL ARE RESTING IN",0
	DC.B "QUARTERS.",0,0
	DC.B "FULL ACCESS TO STATION BLUEPRINTS IS",0
	DC.B "AVAILABLE WITH LEVEL 3 ACCESS OR BETTER.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
implev2	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  LEVEL 02 ACCESS ",11,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "ALL RESEARCH STAFF HAVE LEVEL 2 ACCESS.",0
	DC.B "EACH USER HAS A SECURE AREA FOR STORING",0
	DC.B "TEST SETUPS AND RESULTS.",0,0
	DC.B "GROUP OR MULTIPLE USER AREAS CAN BE",0
	DC.B "SETUP FOR TEAMS OF SCIENTISTS.",0,0
	DC.B "UNDER USUAL STATION CONDITIONS, LEVEL 2",0
	DC.B "USER REQUESTS HAVE THE HIGHEST SYSTEM",0
	DC.B "PRIORITIES.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
implev1	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  LEVEL 01 ACCESS ",11,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "STATION AND SYSTEM SUPERVISORS HAVE THIS",0
	DC.B "HIGHEST ACCESS LEVEL. TOTAL ACCESS TO",0
	DC.B "ALL AREAS OF THE SYSTEM IS AVAILABLE",0,0
	DC.B "STATION SECURITY SYSTEMS WILL ONLY BE",0
	DC.B "FOUND IN THE LEVEL 1 USER AREA.",0,0
	DC.B "CERTAIN OTHER FUNCTIONS WHICH WERE USED",0
	DC.B "DURING THE CONSTRUCTION OF THE STATION",0
	DC.B "ARE STILL USABLE WITH LEVEL 1 ACCESS.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
impsreg	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",8,"@  SYSTEM REGULATIONS",8,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "THE FOLLOWING ACTIONS ARE VIOLATIONS OF",0
	DC.B "SYSTEM REGULATIONS.",0,0
	DC.B "~ LEAVING A TERMINAL UNATTENDED WHILE",0
	DC.B "  STILL LOGGED AT LEVEL 3 OR BETTER.",0
	DC.B "~ DOWNLOADING MATERIAL OF AN OFFENSIVE",0
	DC.B "  NATURE INTO PUBLIC AREAS.",0
	DC.B "~ COMPUTER HACKING OF ANY DESCRIPTION.",0
	DC.B "~ WEARING BROWN TROWSERS.",0
	DC.B "~ RUNNING PSEUDO REALITY| GAMES.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,14,14
impcomm	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",10,"@  ENTER COMMAND",10," $",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0,0
	DC.B 10,"STATUS EMERGENCY CODE 1",0
	DC.B 10,"STATUS EMERGENCY CODE 2",0
	DC.B 10,"STATUS EMERGENCY CODE 3",0
	DC.B 10,"FINALISE AUTO DESTRUCT",0
	DC.B 10,"ENABLE AUDIO FILTER",0
	DC.B 10,"DISABLE AUDIO FILTER",0
	DC.B 10,"<  CORE MENU",0
	DC.B 1,4,10
implon	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "#",6,"IMPAQ COMPUTER CORPORATION",6,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0,0
	DC.B "IMPAQ FRONTDOOR V1.99",0
	DC.B "DATE [22/6/2024]",0,0
	DC.B "SPECIAL GUEST USER ACCESS REQUESTED.",0
	DC.B "LEVEL 2 ACCESS GRANTED.",0,0
	DC.B "PRESS BUTTON TO COMMENCE...",0,1
impill	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",10,"\  SYSTEM MESSAGE",10,"$",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0
	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# AN ACCESS VIOLATION HAS OCCURED. THE $",0
	DC.B "# FUNCTIONS CONTAINED WITHIN REQUIRE   $",0
	DC.B "# LEVEL 1 ACCESS PRIVELAGES.",10," $",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0,0
	DC.B 18,"EXIT",0
	DC.B 1,9,9
destcmp	DC.B 0,0,0,0,0,0
	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "#   LEVEL DESTRUCT SEQUENCE COMPLETE   $",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0,0
	DC.B 18,"EXIT",0
	DC.B 1,10,10
destnot	DC.B "*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(",0
	DC.B "# ",14,"WARNING!",14," $",0
	DC.B "+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)",0,0
	DC.B "THIS COMMAND MUST BE PRECEEDED BY THE",0
	DC.B "ACTIVATION OF FOUR POWER GLOBES ON THIS",0
	DC.B "LEVEL.",0,0
	DC.B 18,"EXIT",0
	DC.B 1,8,8
impdisc	DC.B 0,0,0,0,"  YOU ARE DISCONNECTED...",1
clrtxt1	DC.B "   HUMANOIDS ON LEVEL",0
	DC.B " HUMANOIDS ELIMINATED",0
	DC.B "   KILLING EFFICIENCY       :",0
	DC.B "        BULLETS FIRED",0
	DC.B "    BULLETS ON TARGET",0
	DC.B "        SHOT ACCURACY       :",0

ruth	dc.b "       RUTHLESS BONUS   1000",0
perc	dc.b "      PRECISION BONUS   0500",0
	
comp	dc.b "CONGRATULATIONS!",0
	dc.b "________________",0,0
	dc.b "YOU HAVE JUST",0
	dc.b "COMPLETED PSYCHEUAL.",0,0
	dc.b "THE VIRUS HAS BEEN",0
	dc.b "ERRADICATED FROM",0
	dc.b "THE DOOMED SPACE",0
	dc.b "STATION AND YOU",0
	dc.b "RETURN HOME TO",0
	dc.b "RECEIVE YOUR",0
	dc.b "REWARD OF A MUCH",0
	dc.b "NEEDED DAY OFF!",0,0
	dc.b "I'M SURE YOU'RE NOW",0
	dc.b "EXPECTING A FULLY",0
	dc.b "ANIMATING OUTRO",0
	dc.b "SEQUENCE TO REWARD",0
	dc.b "YOU FOR YOUR SUPERB",0
	dc.b "ACHIEVEMENT.",0
	dc.b "TO BE HONEST, THERE",0
	dc.b "ISN'T ENOUGH MEMORY",0
	dc.b "OR DISK SPACE LEFT ",0
	dc.b "FOR A DECENT ONE.",0,0
	dc.b "'TIL WE MEET AGAIN,",0
	dc.b "TAKE GOOD CARE.",0
	dc.b "BEN, JANUARY 1998.",0,1	

ascii	dc.b 48,48,48,48,48,48,0
conmess	dc.b "YOU HAVE REACHED POSITION",0
	dc.b "NUMBER "
connum	dc.b " ",0
	dc.b "IN THE PSYCHEUAL HALL OF FAME",0
	dc.b "PLEASE CONSIDER ENTERING YOUR INITIALS.",0
name	dc.b "AAA",0
 even
hiscrs	dc.b "ELV .............",0
	dc.b "P J .............",0
	dc.b "MAH .............",0
	dc.b "C J .............",0
	dc.b "NIK .............",0
	dc.b "JON .............",0
	dc.b "DAN .............",0
	dc.b "MIP .............",0
hinums	dc.w 15000,10000,5000,4000,3000,2000,1000,500

grname	dc.b "graphics.library",0
 even

gamepal
 dc.w $000,$454,$343,$232,$0ff,$0bb,$222,$333
 dc.w $444,$555,$666,$888,$aaa,$ccc,$eee,$fff
 dc.w $a88,$866,$644,$433,$0f0,$0a0,$000,$000
 dc.w $000,$fff,$ff0,$f00,$f80,$900,$088,$044
emerpal
 dc.w $000,$400,$300,$200,$0ff,$0bb,$200,$300
 dc.w $400,$500,$600,$800,$a00,$c00,$e00,$f00
 dc.w $a00,$800,$600,$400,$000,$000,$000,$000
 dc.w $000,$fff,$f00,$f00,$a00,$900,$088,$044
termpal
 dc.w $000,$100,$200,$300,$400,$500,$600,$700
 dc.w $800,$900,$a00,$b00,$c00,$d00,$e00,$f00
 dc.w $f66,$f77,$f88,$f99,$faa,$fbb,$fcc,$fdd
 dc.w $fee,$fff,$fff,$fff,$fff,$fff,$fff,$fff
frntpal
 dc.w $000,$f00,$e00,$d00,$c00,$b00,$a00,$900
 dc.w $800,$700,$600,$500,$400,$300,$200,$100
 dc.w $000,$500,$700,$900
hipal
 dc.w $00,$f8,$e7,$d6,$c5,$b4,$a3,$93
 dc.w $82,$71,$61,$51,$40,$30,$20,$10
 dc.w $00,$53,$74,$95
scrlpal
 dc.w $800,$900,$a00,$900,$a00,$b00,$c00,$b00
 dc.w $c00,$d00,$e00,$d00,$e00,$f00,$e00,$f00
 dc.w $000,$800,$700,$600,$500,$400,$300,$200
 dc.w $100,0,0,0,0,0,0,0
redpal
 rept 32
 dc.w $f00
 endr
whitepal
 rept 32
 dc.w $fff
 endr
panelpal
 dc.w $000,$f00,$877,$655,$544,$433,$322,$211
 dc.w $ff0,$f80,$f00,$d00,$900,$700,$500,$300
winonapal
 dc.w $000,$111,$222,$333,$444,$555,$666,$777
 dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
 dc.w $fff,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
lclrpal
 dc.w $00,$8f,$7e,$7d,$6c,$6b,$5a,$59
 dc.w $48,$47,$36,$35,$24,$23,$12,$11
goverpal
 dc.w $000,$fcc,$200,$300,$400,$511,$611,$722
 dc.w $833,$944,$a55,$b66,$c77,$d99,$eaa,$fbb
blackpal
 ds.w 38

watab
 dc.w 8,09,10,11,11,11,11,10,09,8,7,6,5,5,5,5,6,7
 dc.w 8,10,11,11,09,07,05,05,06
 dc.w 8,10,12,14,15,15,14,12,10,8,6,4,2,1,1,2,4,6
 dc.w 8,10,11,11,09,07,05,05,06
 dc.w 8,09,10,11,11,11,11,10,09,8,7,6,5,5,5,5,6,7

endwtab

 include player.s
subgame	include invaders.s

 section chipdata,data_c

copper
 dc.w bplcon0,$4200
 dc.w bplcon1,0
 dc.w bplcon2,0
 dc.w bpl1mod,120
 dc.w bpl2mod,120
 dc.w diwstrt,$2c81
 dc.w diwstop,$2cc1
 dc.w ddfstrt,$38
 dc.w ddfstop,$d0
 dc.w bpl1pth
ppln1h dc.w 0,bpl1ptl
ppln1l dc.w 0,bpl2pth
ppln2h dc.w 0,bpl2ptl
ppln2l dc.w 0,bpl3pth
ppln3h dc.w 0,bpl3ptl
ppln3l dc.w 0,bpl4pth
ppln4h dc.w 0,bpl4ptl
ppln4l dc.w 0,spr0ptl
sprit0l dc.w 0,spr0pth
sprit0h dc.w 0,spr1ptl
sprit1l dc.w 0,spr1pth
sprit1h dc.w 0,spr2ptl
sprit2l dc.w 0,spr2pth
sprit2h dc.w 0,spr3ptl
sprit3l dc.w 0,spr3pth
sprit3h dc.w 0,spr4ptl
sprit4l dc.w 0,spr4pth
sprit4h dc.w 0,spr5ptl
sprit5l dc.w 0,spr5pth
sprit5h dc.w 0,spr6ptl
sprit6l dc.w 0,spr6pth
sprit6h dc.w 0,spr7ptl
sprit7l dc.w 0,spr7pth
sprit7h dc.w 0
panelcols
 dc.w col00,0,col01,0,col02,0,col03,0
 dc.w col04,0,col05,0,col06,0,col07,0
 dc.w col08,0,col09,0,col10,0,col11,0
 dc.w col12,0,col13,0,col14,0,col15,0
 dc.w $490f,$fffe,dmacon,$100
 dc.w bplcon0,$5200
scrdel
 dc.w bplcon1,0
 dc.w bplcon2,$24
 dc.w bpl1mod,200
 dc.w bpl2mod,200
 dc.w diwstrt,$2c91
 dc.w diwstop,$2cb1
 dc.w ddfstrt,$38
 dc.w ddfstop,$d0
 dc.w bpl1pth
plane1h dc.w 0,bpl1ptl
plane1l dc.w 0,bpl2pth
plane2h dc.w 0,bpl2ptl
plane2l dc.w 0,bpl3pth
plane3h dc.w 0,bpl3ptl
plane3l dc.w 0,bpl4pth
plane4h dc.w 0,bpl4ptl
plane4l dc.w 0,bpl5pth
plane5h dc.w 0,bpl5ptl
plane5l dc.w 0
gamecols
 dc.w col00,0,col01,0,col02,0,col03,0
 dc.w col04,0,col05,0,col06,0,col07,0
 dc.w col08,0,col09,0,col10,0,col11,0
 dc.w col12,0,col13,0,col14,0,col15,0
 dc.w col16,0,col17,0,col18,0,col19,0
 dc.w col20,0,col21,0,col22,0,col23,0
 dc.w col24,0,col25,0,col26,0,col27,0
 dc.w col28,0,col29,0,col30,0,col31,0
 dc.w $4b0f,$fffe,dmacon,$8100
 dc.w $ffdf,$fffe
 dc.w $0c0f,$fffe,dmacon,$100
 dc.w bplcon0,$4200
 dc.w bplcon1,0
 dc.w bplcon2,0
 dc.w bpl1mod,120
 dc.w bpl2mod,120
 dc.w diwstrt,$2c81
 dc.w diwstop,$2cc1
 dc.w ddfstrt,$38
 dc.w ddfstop,$d0 
 dc.w bpl1pth
lpln1h dc.w 0,bpl1ptl
lpln1l dc.w 0,bpl2pth
lpln2h dc.w 0,bpl2ptl
lpln2l dc.w 0,bpl3pth
lpln3h dc.w 0,bpl3ptl
lpln3l dc.w 0,bpl4pth
lpln4h dc.w 0,bpl4ptl
lpln4l dc.w 0
llogocols
 dc.w col00,0,col01,0,col02,0,col03,0
 dc.w col04,0,col05,0,col06,0,col07,0
 dc.w col08,0,col09,0,col10,0,col11,0
 dc.w col12,0,col13,0,col14,0,col15,0
 dc.w $0e0f,$fffe,dmacon,$8100
 dc.w $ffff,$fffe

introcopper
 dc.w bplcon0,$4200
 dc.w bplcon1,0
 dc.w bplcon2,0
 dc.w bpl1mod,134
 dc.w bpl2mod,134
 dc.w diwstrt,$2c81
 dc.w diwstop,$2cc1
 dc.w ddfstrt,$30
 dc.w ddfstop,$d0
 dc.w bpl1pth
ipln1h dc.w 0,bpl1ptl
ipln1l dc.w 0,bpl2pth
ipln2h dc.w 0,bpl2ptl
ipln2l dc.w 0,bpl3pth
ipln3h dc.w 0,bpl3ptl
ipln3l dc.w 0,bpl4pth
ipln4h dc.w 0,bpl4ptl
ipln4l dc.w 0,spr0ptl
starhs dc.w 0,spr0pth,0,spr1ptl
 dc.w 0,spr1pth,0,spr2ptl
 dc.w 0,spr2pth,0,spr3ptl
 dc.w 0,spr3pth,0,spr4ptl
 dc.w 0,spr4pth,0,spr5ptl
 dc.w 0,spr5pth,0,spr6ptl
 dc.w 0,spr6pth,0,spr7ptl
 dc.w 0,spr7pth,0
introcols
 dc.w col00,0,col01,0,col02,0,col03,0
 dc.w col04,0,col05,0,col06,0,col07,0
 dc.w col08,0,col09,0,col10,0,col11,0
 dc.w col12,0,col13,0,col14,0,col15,0
 dc.w col16,0,col17,0,col18,0,col19,0
watdel
 dc.w $8a0f,$fffe,bplcon1,$0,$8b0f,$fffe,bplcon1,0
 dc.w $8c0f,$fffe,bplcon1,$0,$8d0f,$fffe,bplcon1,0
 dc.w $8e0f,$fffe,bplcon1,$0,$8f0f,$fffe,bplcon1,0
 dc.w $900f,$fffe,bplcon1,$0,$910f,$fffe,bplcon1,0
 dc.w $920f,$fffe,bplcon1,$0,$930f,$fffe,bplcon1,0
 dc.w $940f,$fffe,bplcon1,$0,$950f,$fffe,bplcon1,0
 dc.w $960f,$fffe,bplcon1,$0,$970f,$fffe,bplcon1,0
 dc.w $980f,$fffe,bplcon1,$0,$990f,$fffe,bplcon1,0
 dc.w $9a0f,$fffe,bplcon1,$0,$9b0f,$fffe,bplcon1,0
 dc.w $9c0f,$fffe,bplcon1,$0,$9d0f,$fffe,bplcon1,0
 dc.w $9e0f,$fffe,bplcon1,$0,$9f0f,$fffe,bplcon1,0
 dc.w $a00f,$fffe,bplcon1,$0,$a10f,$fffe,bplcon1,0
 dc.w $a20f,$fffe,bplcon1,$0,$a30f,$fffe,bplcon1,0
 dc.w $a40f,$fffe,bplcon1,$0,$a50f,$fffe,bplcon1,0
 dc.w $a60f,$fffe,bplcon1,$0,$a70f,$fffe,bplcon1,0
 dc.w $a80f,$fffe,bplcon1,$0,$a90f,$fffe,bplcon1,0
 dc.w $aa0f,$fffe,bplcon1,$0,$ab0f,$fffe,bplcon1,0
 dc.w $ac0f,$fffe,bplcon1,$0,$ad0f,$fffe,bplcon1,0
 dc.w $ae0f,$fffe,bplcon1,$0,$af0f,$fffe,bplcon1,0
 dc.w $b00f,$fffe,bplcon1,$0,$b10f,$fffe,bplcon1,0
 dc.w $b20f,$fffe,bplcon1,$0,$b30f,$fffe,bplcon1,0
 dc.w $b40f,$fffe,bplcon1,$0,$b50f,$fffe,bplcon1,0
 dc.w $ffdf,$fffe
textdel
 dc.w bplcon1,0
 dc.w $070f,$fffe,col01,$0
 dc.w $080f,$fffe,col01,$0
 dc.w $090f,$fffe,col01,$0
 dc.w $0a0f,$fffe,col01,$0
 dc.w $0b0f,$fffe,col01,$0
 dc.w $0c0f,$fffe,col01,$0
 dc.w $0d0f,$fffe,col01,$0
 dc.w $0e0f,$fffe,col01,$0
 dc.w $0f0f,$fffe,col01,$0
 dc.w $100f,$fffe,col01,$0
 dc.w $110f,$fffe,col01,$0
 dc.w $120f,$fffe,col01,$0
 dc.w $130f,$fffe,col01,$0
 dc.w $140f,$fffe,col01,$0
 dc.w $150f,$fffe,col01,$0
 dc.w $160f,$fffe,col01,$0
 dc.w $180f,$fffe,col01,$0
 dc.w $190f,$fffe,col01,$0
 dc.w $1a0f,$fffe,col01,$0
 dc.w $1b0f,$fffe,col01,$0
 dc.w $1c0f,$fffe,col01,$0
 dc.w $1d0f,$fffe,col01,$0
 dc.w $1e0f,$fffe,col01,$0
 dc.w $1f0f,$fffe,col01,$0
 dc.w $ffff,$fffe

termcopper
 dc.w bplcon0,$5200
 dc.w bplcon1,0
 dc.w bplcon2,0
 dc.w bpl1mod,0
 dc.w bpl2mod,0
 dc.w diwstrt,$2c81
 dc.w diwstop,$2cc1
 dc.w ddfstrt,$38
 dc.w ddfstop,$d0
 dc.w bpl1pth
tpln1h dc.w 0,bpl1ptl
tpln1l dc.w 0,bpl2pth
tpln2h dc.w 0,bpl2ptl
tpln2l dc.w 0,bpl3pth
tpln3h dc.w 0,bpl3ptl
tpln3l dc.w 0,bpl4pth
tpln4h dc.w 0,bpl4ptl
tpln4l dc.w 0,bpl5pth
tpln5h dc.w 0,bpl5ptl
tpln5l dc.w 0,spr0ptl
 dc.w 0,spr0pth,0,spr1ptl
 dc.w 0,spr1pth,0,spr2ptl
 dc.w 0,spr2pth,0,spr3ptl
 dc.w 0,spr3pth,0,spr4ptl
 dc.w 0,spr4pth,0,spr5ptl
 dc.w 0,spr5pth,0,spr6ptl
 dc.w 0,spr6pth,0,spr7ptl
 dc.w 0,spr7pth,0
termcols
 dc.w col00,$fff,col01,$fff,col02,$fff,col03,$fff
 dc.w col04,$fff,col05,$fff,col06,$fff,col07,$fff
 dc.w col08,$fff,col09,$fff,col10,$fff,col11,$fff
 dc.w col12,$fff,col13,$fff,col14,$fff,col15,$fff
 dc.w col16,$fff,col17,$fff,col18,$fff,col19,$fff
 dc.w col20,$fff,col21,$fff,col22,$fff,col23,$fff
 dc.w col24,$fff,col25,$fff,col26,$fff,col27,$fff
 dc.w col28,$fff,col29,$fff,col30,$fff,col31,$fff
 dc.w $ffdf,$fffe
 dc.w $ffff,$fffe

starspr
 dc.l $2A692B00,$80000000,$2CD32D00,$80004000
 dc.l $2EFE2F00,$a0006000,$30603100,$80000000
 dc.l $32493300,$80004000,$34663500,$a0006000
 dc.l $369F3700,$80000000,$38C43900,$80004000
 dc.l $3A413B00,$a0006000,$3C603D00,$80000000
 dc.l $3EC23F00,$80004000,$40574100,$a0006000
 dc.l $42C44300,$80000000,$44614500,$80004000
 dc.l $46524700,$a0006000,$484E4900,$80000000
 dc.l $4A6E4B00,$80004000,$4C0D4D00,$a0006000
 dc.l $4E894F00,$80000000,$50A15100,$80004000
 dc.l $52665300,$a0006000,$54D05500,$80000000
 dc.l $56565700,$80004000,$585C5900,$a0006000
 dc.l $5AD05B00,$80000000,$5C895D00,$80004000
 dc.l $5E715F00,$a0006000,$60886100,$80000000
 dc.l $629D6300,$80004000,$646B6500,$a0006000
 dc.l $66A86700,$80000000,$68746900,$80004000
 dc.l $6AB46B00,$a0006000,$6CCC6D00,$80000000
 dc.l $6E616F00,$80004000,$70677100,$a0006000
 dc.l $72497300,$80000000,$74457500,$80004000
 dc.l $76E97700,$a0006000,$78787900,$80000000
 dc.l $7AD77B00,$80004000,$7CCE7D00,$a0006000
 dc.l $7E7A7F00,$80000000,$80348100,$80004000
 dc.l $821C8300,$a0006000,$84458500,$80000000
 dc.l $86A48700,$80004000,$88C68900,$a0006000
 dc.l $8A548B00,$80000000,$8C568D00,$80004000
 dc.l $8E6E8F00,$a0006000,$908B9100,$80000000
 dc.l $92129300,$80004000,$94529500,$a0006000
 dc.l $965A9700,$80000000,$98729900,$80004000
 dc.l $9A609B00,$a0006000,$9C769D00,$80000000
 dc.l $9E5F9F00,$80004000,$A06BA100,$a0006000
 dc.l $A29EA300,$80000000,$A4BFA500,$80004000
 dc.l $A65EA700,$a0006000,$A8A1A900,$80000000
 dc.l $AAADAB00,$80004000,$AC65AD00,$a0006000
 dc.l $AE5EAF00,$80000000,$B034B100,$80004000
 dc.l $B241B300,$a0006000,$B483B500,$80000000
 dc.l $B69BB700,$80004000,$B886B900,$a0006000
 dc.l $BAB2BB00,$80000000,$BC43BD00,$80004000
 dc.l $BE1ABF00,$a0006000,$C068C100,$80000000
 dc.l $C2FAC300,$80004000,$C407C500,$a0006000
 dc.l $C68BC700,$80000000,$C840C900,$80004000
 dc.l $CA6DCB00,$a0006000,$CC45CD00,$80000000
 dc.l $CE0ECF00,$80004000,$D0E7D100,$a0006000
 dc.l $D287D300,$80000000,$D410D500,$80004000
 dc.l $D617D700,$a0006000,$D85AD900,$80000000
 dc.l $DA1EDB00,$80004000,$DCACDD00,$a0006000
 dc.l $DE6DDF00,$80000000,$E014E100,$80004000
 dc.l $E277E300,$a0006000,$E4C7E500,$80000000
 dc.l $E6DEE700,$80004000,$E8B8E900,$a0006000
 dc.l $EAB9EB00,$80000000,$EC36ED00,$80004000
 dc.l $EE71EF00,$a0006000,$F07FF100,$80000000
 dc.l $F2C4F300,$80004000,$F407F500,$a0006000
 dc.l $F6AAF700,$80000000,$F828F900,$80004000
 dc.l $FA70FB00,$a0006000,$FC4DFD00,$80000000
 dc.l $FED7FF00,$80004000,$00C40106,$a0006000
 dc.l $028C0306,$80000000,$04CC0506,$80004000
 dc.l $06E00706,$a0006000,$08D50906,$80000000
 dc.l $0A060B06,$80004000,$0C290D06,$a0006000
 dc.l $0E8B0F06,$80000000,$10AF1106,$80004000
 dc.l $12ED1306,$a0006000,$14561506,$80000000
 dc.l $164F1706,$80004000,$188D1906,$a0006000
 dc.l $1A7C1B06,$80000000,$1CA11D06,$80004000
 dc.l $1ED21F06,$a0006000,$20D22106,$80000000
 dc.l $22C22306,$80004000,$24B32506,$a0006000
 dc.l $00000000

pnlgfx	incbin panel.ali
llogfx	incbin logolow.ali
sprites	incbin manim.raw
gamegfx	incbin blit.ali
bobgfx	incbin bobs.ali
fallgfx	incbin fall.ali
cybfont	incbin cyber.fnt
	incbin cybant.fnt
beep	incbin beep
beepa	incbin beepa
beepg	incbin gbeep
autgun	incbin autogun
rifle	incbin rifle
shot	incbin shotgun
elcgun	incbin autoelec
ahgun	incbin autohand
clack	incbin clack
rumble	incbin rumble
siren	incbin siren
spring	incbin spring
squelch	incbin squelch
slide	incbin hydrol
drclnk	incbin door
globe	incbin globe
woah	incbin woah
impact	incbin impact
scream	incbin scream
eatthis	incbin eatthis
atom	incbin atom
flames	incbin flames
	include oflame.s
blood	include blood
darktrain	incbin dh0:modules/mod.darktrain
industrial	incbin dh0:modules/mod.industrial2
blondestreaks	incbin dh0:modules/mod.blondestreaks

 section publicdata,data

mapdata	incbin map01
	incbin map02
	incbin map03
	incbin map04
	incbin map05
	incbin map06
	incbin map07
	incbin map08
	incbin map09
	incbin map10
pfont	incbin small
	incbin anti
intlogo	incbin logoint.ali
hallogo	incbin hall.ali
clrlogo	incbin lclear.ali
gieger	incbin gieger.ali
imbaq	incbin terminal.ali
manover	incbin over.ali
congfx	incbin cong.ali
winona	incbin robot.raw

 section screens,bss_c
 
scrbuf1 ds.b 48*240*5
scrbuf2 ds.b 48*280*5
maskgfx	ds.b 13824

 section publicbss,bss
 
map	ds.b 8192
aldata	ds.b 2000

scrsize	= 48*280*5
over	= 0
bufchng	= 1
shft	= 2
fhold	= 3
pulse	= 4
injure	= 5
dead	= 6
compl	= 7

novec	= 0
gmvec	= 1
invec	= 2
hlvec	= 3
envec	= 4

dup	= 0
ddown	= 1
dleft	= 2
dright	= 3
block	= 4

aud0lch equ $0a0
aud0len equ $0a4
aud0per equ $0a6
aud0vol equ $0a8
aud1lch equ $0b0
aud1len equ $0b4
aud1per equ $0b6
aud1vol equ $0b8
aud2lch equ $0c0
aud2len equ $0c4
aud2per equ $0c6
aud2vol equ $0c8
aud3lch equ $0d0
aud3len equ $0d4
aud3per equ $0d6
aud3vol equ $0d8
bltcon0 equ $040
bltcon1 equ $042
bltafwm equ $044
bltalwm equ $046
bltcpth equ $048
bltcptl equ $04a
bltbpth equ $04c
bltbptl equ $04e
bltapth equ $050
bltaptl equ $052
bltdpth equ $054
bltdptl equ $056
bltsize equ $058
bltcmod equ $060
bltbmod equ $062
bltamod equ $064
bltdmod equ $066
bltcdat equ $070
bltbdat equ $072
bltadat equ $074
bpl1pth equ $0e0
bpl1ptl equ $0e2
bpl2pth equ $0e4
bpl2ptl equ $0e6
bpl3pth equ $0e8
bpl3ptl equ $0ea
bpl4pth equ $0ec
bpl4ptl equ $0ee
bpl5pth equ $0f0
bpl5ptl equ $0f2
bplcon0 equ $100
bplcon1 equ $102
bplcon2 equ $104
bpl1mod equ $108
bpl2mod equ $10a
col00	equ $180
col01	equ $182
col02	equ $184
col03	equ $186
col04	equ $188
col05	equ $18a
col06	equ $18c
col07	equ $18e
col08	equ $190
col09	equ $192
col10	equ $194
col11	equ $196
col12	equ $198
col13	equ $19a
col14	equ $19c
col15	equ $19e
col16	equ $1a0
col17	equ $1a2
col18	equ $1a4
col19	equ $1a6
col20	equ $1a8
col21	equ $1aa
col22	equ $1ac
col23	equ $1ae
col24	equ $1b0
col25	equ $1b2
col26	equ $1b4
col27	equ $1b6
col28	equ $1b8
col29	equ $1ba
col30	equ $1bc
col31	equ $1be
cop1lch equ $080
copjmp1 equ $088
ddfstrt equ $092
ddfstop equ $094
diwstrt equ $08e
diwstop equ $090
dmacon	equ $096
dmaconr equ $002
intena	equ $09a
intenar equ $01c
intreq	equ $09c
intreqr equ $01e
joy1dat equ $00c
spr0pth equ $120
spr0ptl equ $122
spr1pth equ $124
spr1ptl equ $126
spr2pth equ $128
spr2ptl equ $12a
spr3pth equ $12c
spr3ptl equ $12e
spr4pth equ $130
spr4ptl equ $132
spr5pth equ $134
spr5ptl equ $136
spr6pth equ $138
spr6ptl equ $13a
spr7pth equ $13c
spr7ptl equ $13e
spr0dat equ $144
vhposr	equ $006
vposr	equ $004