If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

1942 (Amstrad CPC)

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

1942

Developer: Elite Systems
Publisher: Elite Systems
Platform: Amstrad CPC
Released in EU: 1987


SourceIcon.png This game has uncompiled source code.


Source Code

A slightly large amount of source code was left behind. The hex addresses below are for the disk version. However, the text seen below is not perfectly extracted, as the original text had two extra bytes before every line of code.

933A:

uc   03F6 
avet  041C     wavet2 041D

org 1000

dosprt:equ 22603
udg:equ	7708
sdummy:equ	8620
setup:equ 22610
spt:equ 22445
sc:equ 22610
flip:equ 22730
call setup
scroll:defw	0
select:nop
clock:nop
clock8:nop
ftime:nop
btype:nop
status:nop
youc:defb
bmstat:defw 0,0,0,0,0,0
pstat:defw 0,0,0,0,0,0,0,0,0,0,0,0
slowp:nop
wavet:nop
wavet2:nop
lcount:nop
hcount:nop
clock5:nop
sheet:nop
diff:defb
backp:equ 22607
backg:defw
wavesh:defw
loops:equ

org 5700
score1:defw 0,0,0,0
lives1:defb
sheet1:nop
hc1:nop
btype1:nop
sidep1:nop 0,0,0
defb	0,0,0
score2:defw 0,0,0,0
lives2:defb
sheet2:nop
hc2:nop
btype2:nop
sidep2:nop
defb 0,0,0
numplr:nop
nxtplr:nop
jp incs0
jp panel
jp contrl
jp shoot
jp dobull

jp clsscr
sidep:nop
fire:defw 0
gamest:nop
jp noisef
jp noised
jp noisep
defb 0,0,0

game:
ld a,9
call #bc2c
ld e,a
ld hl,49152
ld bc,16384

am0:
ld (hl),e
inc hl
dec a,b
nz,am0

game2:
ld hl,score1
ld b,32
ld a,0

gam1:
ld (hl),a
inc hl
djnz gam1
ld a,5
ld (lives1),a
ld (lives2),a
call panel
call start
ld a,(numplr)
ld e,a
add a,a
add a,a
add a,e
ld (lives2),a

gam5:
ld a,(nxtplr)
add a,a
add a,a
add a,a
add a,a
ld e,a
ld d,0
ld ix,score1
add ix,de
push ix 
ld a,(ix+9)
ld (sheet

9A06:

ld e,a
ld d,0
ld hl,diftab
add hl,de
ld a,(hl)
ld (diff),a
ld a,(ix+11)
ld (btype),a
ld a,(ix+12)
ld (sidep),a
ld a,0
ld (gamest),a
ld (lcount),a
ld a,(ix+10)
ld (hcount),a
call panel
call begin
defb 0,0,0 ;call game 
pop ix
call wait
ld a,(gamest)
cp 1
jp z,gamdie 

; next sheet
push ix
call shtcom
pop ix
ld (ix+10),0
ld a,(ix+9)
inc a
ld (ix+9),a
cp 32
jp nz,gam5

;mega bonus
call end
call comp0
jp gam8

gamdie:
dec (ix+8)
ld a,(hcount)
ld (ix+10),a
ld a,0
ld (ix+11),a
ld (ix+12),a
ld a,(ix+8)
and a
jp z,gamd1
ld a,(numplr)
and a
jp z,gam5
ld a,(nxtplr)
xor 1
ld (nxtplr),a
add a,a
add a,a
add a,a
add a,a
ld e,a
ld d,0
ld ix,score1
add ix,de
ld a,(ix+8)
and a
jp nz,gam5
ld a,e
xor 16
ld e,a
ld ix,score1
add ix,de
ld a,(nxtplr)
xor 1
ld (nxtplr),a
jp gam5

gamd1:
call end
call comp0
ld a,(numplr)
and a
jp z,gam8
ld a,(nxtplr)
cp 1
jp z,gam8
xor 1
ld (nxtplr),a
jp gam5

gam8:
jp game

panel:
ld c,12
ld b,12
call #bc38 ;set bord
call colours
ld a,9
call #bc2c ;enc
ld d,19
ld h,13
ld l,0
ld e,24
call #bc44 ;box
ld hl,score1
ld (scr12),hl
ld hl,49368
ld (scr12+2),hl
ld ix,plr1
ld hl,49288
ld b,8
call pstrs
call disscr
ld ix,plr2
ld hl,49848
ld b,8
call pstrs
ld hl,score2
ld (scr12),hl
ld hl,49928
ld (scr12+2),hl
call disscr

ld hl,49608

ld b,8

ld ix,l942

call pstrs

ld hl,49693
ld b,5
ld ix,elite
call pstrs
ld a,(numplr)
and a
jp z,play1
ld a,(nxtplr)
and a
jp nz,play2

play1:
ld bc,score1
ld hl,49368
jp play3

play2:
ld bc,score2
ld hl,49928

play3:
ld (scr12),bc
ld (scr12+2),hl
ld hl,49448
ld a,(lives1)
call disliv
ld hl,50008
ld a,(lives2)
call disliv
ret

disliv:
cp 5
jp nz,dl0
dec a

dl0:
add a,a
add a,a
ld e,a
ld d,0
ld ix,livgx
add ix,de
ld b,4
call pstrs
inc hl
inc hl
ld ix,roll
ld b,3
jp pstrs

roll:
defb 27,27,27

livgx:
defb 36,36,36,36
defb 37,36,36,36
defb 37,37,36,36
defb 37,37,37,36
defb 37,37,37,37

colour:
ld ix,ink
ld b,15

clr0:
ld c,(ix+0)
push bc
ld a,15
sub b
ld b,c
call #bc32
inc ix
pop bc
djnz clr0
ret

pstrs:
push a,(ix+0)
call prt0
inc ix
pop bc
djnz pstrs
ret

scr12:
defw 0,0

plr1:
defb 25,21,10,34,14,27,36,1

plr2:
defb 25,21,10,34,14,27,36,2

elite:
defb 14,21,18,29,14

l942:
defb 36,36,1,9,4,2,36,36

ink:
defb 2,9,0,13,19,24,6,9,18,12,18,10,23,1,26,5

begin:
call clear
ld ix,plr1
ld a,(nxtplr)
add a,a
add a,a
add a,a
ld e,a
ld d,0
add ix,de
ld hl,50292
ld b,8
call pstrs
ld ix,lstage
ld hl,49804
ld b,13
callpstrs
ld hl,49819
ld a,(sheet)
ld e,a
ld a,32
sub e
call digit2
ret

digit2:
ld b,0

dg0:
inc b
sub 10
jp nc,dg0
add a,10
push af
dec b
ld a,b
call prt0
pop af
call prt0
ret

end:
call clear
ld hl,49808
ld ix,gover
ld b,10
call pstrs
ld hl,50294
ld a,(nxtplr)
add a,a
add a,a
add a,a
ld e,a
ld d,0
ld ix,plr1
add ix,de
ld b,8
call pstrs
call wait
ret

gover:
defb 16,10,22,14,36,24,31,14,27,36

lstage:
defb 21,10,28,29,36,36,36,36,28,29,10,16,14

incs0:
ld hl,(scr12)
ld de,6
add hl,de

incs1:
ld a,(hl)
add a,b

incs2:
cp 10
jr c,incs3
dec hl
inc (hl)
inc hl
sub 10
jp incs2

incs3:
ld (hl),a
ld b,0
dec hl
dec e
jp nz,incs1

disscr:
ld ix,(scr12)
ld hl,(scr12+2)
ld a,8

dis1:
push af 
ld a,(ix+0)
call prt0
inc ix
pop af
dec a
jp nz,dis1
ret

prt0:
push hl
ld l,a
ld h,0
add hl,hl
add hl,hl
add hl,hl
ld e,l
ld d,h
add hl,hl
add hl,de
ld de,udg
add hl,de
ex de,hl
pop hl
jp prt

prt:
ld b,8
push hl

prt1:
ld a,(de)
ld (hl),a
inc de
inc hl
ld a,(de)
ld (hl),a
inc de
inc hl
ld a,(de)
ld (hl),a
inc de
push de
ld de,2048-2
add hl,de
pop de
djnz prt1
pop hl
inc hl
inc hl
inc hl
ret

keys:
defw 0

comp0:
ld a,(nxtplr) ; compare scores
add a,a
add a,a
add a,a
add a,a
ld e,a
ld d,0
ld hl,score1
add hl,de
ld (co

E146:

ld de,11
add iy,de
inc ix
inc ix
inc ix
jp hit2

hit20:
push ix
push hl
pop ix
ld a,(ix+7)
add a,a
push af
add a,c
ld l,a
pop af
sub e
add a,(ix+1)
cp l
jp nc,hit22
ld a,b
add a,8
cp l
ld l,a
ld a,(ix+2)
sub d
add a,8
jp nc,hit22
ld a,128
jp hit22a

hit22:
ld a,0

hit22a:
push ix
pop hl
pop ix
and a
ret z
ld (hl),0
ld a,(ix+0)
cp 6
jp c,hit25
ld (ix+1),128
cp 10
ret nz
ld a,(bonc2)
inc a
ld (bonc2),a
cp 5