We just released a prototype of the cancelled SNES port of Puggsy! Take a look!
As always, thank you for supporting The Cutting Room Floor on Patreon!

Spy vs. Spy: The Island Caper (ZX Spectrum)

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

Spy vs. Spy: The Island Caper

Developer: Orpheus
Publisher: Databyte
Platform: ZX Spectrum
Released in EU: 1987


SourceIcon.png This game has uncompiled source code.


Source Code Fragments

Two giant fragments of code are present in the game, but the code was somewhat difficult to restore due to unneeded characters inserted all throughout the code. They can be viewed at the hex addresses seen on both sides in the .tzx dump.

Side A

6448:

and a
jr z,op25
cp 1
jr nz,op24
inc a
ld (caryfg),a
ld a,(caryht)
ld (htpix),a
ld a,(shape)
ld e,a
jr op26

op25
inc a
ld (caryfg),a
ld a,(caryht)
ld e,a
ld a,(hl)
inc a
sub e
inc b
jr op27

op24
ld a,(hl)
inc a

op27
ld (htpix),a
inc hl
ld e,(hl)
inc hl

op26
push bc
push hl
ld d,0
ld hl,csuwid
add hl,de
ld a,(hl)
ld (widpix),a
ld a,8
;;;;;;;;;;
ld (zc64),a
ld hl,csublo
add hl,de
ld c,(hl)
ld hl,csubhi
add hl,de
ld b,(hl)
push bc
pop iy
ld ix,spygrp     
call op1sub     
pop hl     
pop bc     
djnz op23
ld hl,spy
set 7,(hl)
ret

stanim 
ld (animno),a
ld e,a    
ld d,0
ld hl,animlo
add hl,de
ld a,(hl)
ld hl,animhi
add hl,de
ld h,(hl)
ld l,a
ld a,(hl)
ld (animfm),a     
ld (cntrup),a
inc hl
ld a,(hl)
cp 40
jr nc,sa5 
ld e,a
ld a,(spy)
bit 0,a
ld a,0
;      
jr   z,sa4
ld a,25

sa4
add e     
jr sa1    

sa5 
add 10

sa1
ld e,a
ld iy,clstlo
add iy,de
ld c,(iy)
ld iy,clsthi
add iy,de
ld b,(iy)
ld (animpt),bc
inc hl
ld e,(hl)
ld iy,xlstlo
add iy,de
ld c,(iy)
ld iy,xlsthi
add iy,de
ld b,(iy)
ld (xlptr),bc
inc hl
ld e,(hl)
ld iy,ylstlo
add iy,de
ld c,(iy)
ld iy,ylsthi
add iy,de
ld b,(iy)
ld (ylptr),bc
inc hl
ld e,(hl)
ld iy,zlstlo
add iy,de
ld c,(iy)
ld iy,zlsthi
add iy,de
ld b,(iy)
ld (zlptr),bc
inc hl
ld a,(hl)
ld (repeat),a
inc hl
ld a,(hl)
ld (delay),a
ld

6B55:

ret

dnact
ld hl,flag
bit ashes,(hl)
ret z
res ashes,(hl)
ld a,20
call stanim
ret

doanim
call rise
ld a,(active)
and a
jr z,inact
ld a,(delcnt)
and a
jr z,doan1
dec a
ld (delcnt),a
ret

doan1
ld a,(delay)
ld (delcnt),a
ld a,(cntrup)
cp 255
jr nz,doan2
ld a,(animfm)
ld (cntrup),a
ld a,(repeat)
dec a
ld (repeat),a
jr nz,doan2
xor a
ld (active),a
call dostop
ret

doan2
ld a,(cntrup)
ld e,a
ld d,0
ld hl,(xlptr)
add hl,de
ld a,(xpos)
add (hl)
ld (xpos),a 
ld a,(xpos)
ld (xline),a
ld hl,(ylptr)
add hl,de
ld a,(ypos)
add (hl)
ld (ypos),a
ld hl,(zlptr)
add hl,de
ld a,(ypos)
add (hl)
ld (ypos),a
ld a,(qflag)
ld b,a 
call usewot
add 25
sub b
ld (bottom),a
ld a,(addval)
ld b,a
ld a,(yoff)
add b
ld (yoff),a
cp 18
jr c,doan3
xor a
ld (addval),a
ld a,18
ld (yoff),a

doan3
ld b,a
ld a,(ypos)
add b
ld (yline1),a
ld de,(animpt)
ld a,(cntrup)
ld l,a
ld h,0
add hl,de
ld e,(hl)
ld d,0
call opcinf
ld a,(cntrup)
dec a
ld (cntrup),a
ret

dostop 
ld a,(xpos)
ld (xline),a
ld a,(yoff)
ld b,a
ld a,(qflag)
ld c,a
ld a,(ypos)
add b
ld (yline1),a
call usewot
add 25
sub c
ld (bottom),a
ld a,(animno)
and a
jr z,dos4
cp 2
jr z,dos4
ld e,a
ld d,0
ld hl,stplst
ld a,46 2
add e
ld e,a
add hl,de
ld a,(animno)
cp 22
jr nz,dos1
xor a
ld (animno),a
jr dos2

dos1 
cp 23 
jr nz,dos2
ld a,2
ld (animno),a

dos2
ld e,(hl)
call opcinf

dos4
ld a,(animno)
cp 27
jr z,dos4a  
cp 8
ret nc
ld hl,flag
res dig,(hl)

dos4a
ld a,(xpos)
ld (x),a
ld a,(ypos)
ld (y),a
ret  4 

rotate
ld a,(iy)
inc iy
ld b,4 

rot3
ld c,0
rl a
rl c
rl a
rl c
push af
ld a,c
push hl
ld hl,bits
add l
ld l,a
jr nc,rot4 
inc h

rot4
ld a,(direct)
or a
ld a,c
ld c,(hl)
pop hl
jr z,rot1
rr c
rr h
rr l
and a
jr nz,rot5
scf 

rot5
rr d
rr e
jr rot2

rot1
rl c
rl l
rl h
and a
jr nz,rot6
scf

rot6
rl e
rl d

rot2
pop af
djnz rot3
ret  9

op1sub
ld a,(htpix)
push af
push ix
push iy
ld hl,bits
ld b,4
ld a,(zc64)

op11
rr a
jr nc,op12
ld (hl),255
jr op13

op12
ld (hl),0

op13
inc hl
djnz op11
ld a,10101010b
ld (shade),a

op18
ld a,(yline)
ld b,a
ld a,(bottom)
cp b
jp c,op17
push ix
ld a,(target)
sla a
ld e,a
ld d,0
add ix,de
ld hl,0
ld de,0ffffh
call rotate
call rotate
ld a,(widpix)
cp 7
jr z,op15
call rotate
ld a,(widpix)
cp 11
jr z,op15
call rotate
jr op16

op15
ld a,(direct)
or a
jr nz,op1

Side B

6448:

pop de
pop bc
pop af
ei
reti

secspt
ld a,(secs)
and 240 
srl a
ld hl,nosr
add l
ld l,a
jr nc,secs1
inc h

secs1
ld bc,0108h
ld de,17564
call drwbc
ld a,(secs)
and 15
sla a
sla a
sla a
ld hl,nosr
add l
ld l,a
jr nc,secs2
inc h

secs2
ld bc,0108h
call drwbc
ld a,(18076)
set 7,a
ld (18076),a
ld a,(16828)
set 7,a
ld (16828),a 
ret

minspt 
ld a,(mins)
and 240
srl a
ld hl,nosl
add l
ld l,a
jr nc,mins1
inc h

mins1 
ld bc,0108h
ld de,17562
call drwbc
ld a,(mins)
and 15
sla a
sla a
sla a
ld hl,nosl
add l
ld l,a 
jr nc,mins2
inc h

mins2
ld bc,0108h 
call drwbc
ld a,(18075)
set 0,a
ld (18075),a
ld a,(16827)
set 0,a
ld (16827),a
ret           

scan1
ld hl,keylef
ld (hl),0
ld a,(what)
bit 7,a
jp nz,int2l
bit 6,a
jp nz,curs    
bit 5,a
jp nz,kemp
jp keysl

scan2
ld hl,keyrig
ld (hl),0
ld a,(what)
bit 3,a
jp nz,int2r
bit 2,a
jp nz,curs
bit 1,a
jp nz,kemp
jp keysr

int2l
ld bc,0f7feh
in a,(c)
bit 0,a
jr nz,intl1
set 1,(hl)

intl1
bit 1,a
jr nz,intl2
set 0,(hl)
intl2
bit 2,a
jr nz,intl3
set 2,(hl)

intl3
bit 3,a
jr nz,intl4
set 3,(hl)

intl4
bit 4,a
ret nz
set 4,(hl)
ret

int2r
ld bc,0effeh
in a,(c)
bit 4,a
jr nz,intr1
set 1,(hl)

intr1
bit 3,a
jr nz,intr2
set 0,(hl)

intr2
bit 2,a
jr nz,intr3
set 2,(hl)

intr3
bit 1,a
jr nz,intr4
set 3,(hl)

6B59:

The below fragment also has code seen in the second fragment for Side A, starting with the doan3 routine. However, this has been removed to prevent redundancy.

jr nz 
set 1,(hl)

curs1
ld b,0efh
in a,(c)
bit 4,a
jr nz,curs2
set 2,(hl)

curs2
bit 3,a
jr nz,curs3
set 3,(hl)

curs3
bit 2,a
jr nz,curs4
set 0,(hl)

curs4
bit 0,a
ret nz
set 4,(hl)
ret

kemp
in a,(31)
and 31
ld (hl),a
ret

keysl
ld bc,0fefeh
in a,(c)
bit 3,a
jr nz,keysl1 
set 4,(hl) $0

keysl1
bit 1,a
jr nz,keysl2
set 1,(hl)

keysl2
bit 2,a
jr nz,keysl3
set 0,(hl)

keysl3
ld b,0fdh
in a,(c)
bit 0,a
jr nz,keysl4
set 2,(hl)

keysl4
ld b,0fbh
in a,(c)
bit 0,a
ret nz
set 3,(hl)
ret

keysr
ld bc,07ffeh
in a,(c)
bit 4,a
jr nz,keysr1
set 4,(hl)

keysr1
bit 2,a
jr nz,keysr2
set 0,(hl)

keysr2
bit 3,a
jr nz,keysr3
set 1,(hl)

keysr3
ld b,0bfh
in a,(c)
bit 1,a
jr nz,keysr4
set 2,(hl)

keysr4
ld b,0dfh
in a,(c)
bit 0,a
ret nz
set 3,(hl)
ret
ld (addval),a
ld a,18
ld (yoff),a