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

Fairlight: A Prelude (ZX Spectrum)

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

Fairlight: A Prelude

Also known as: Fairlight
Developer: The Edge
Publisher: The Edge
Platform: ZX Spectrum
Released in EU: 1985


SourceIcon.png This game has uncompiled source code.


Source Code Fragments

48K version

A few sections of the code are left in the game. The code seen below can be seen with a hex editor at the addresses below in the .tap dump of the game.

2204:

        LD	(IY+7),3
        JR	DOE
WEI3	LD	(V+18),A
        PUSH	IX
        POP	DE
        LD	H,255
        LD	L,(IY+30)
        LD	(HL),E
        INC	HL
        LD	(HL),D
        SET	5,(IX+16)
        RES	7,(IX+14)
        RES	1,(IY+17)
        LD	C,254
        CALL	ROMM
        PUSH	IX
        CALL	DOE
        POP	HL
        LD	A,(V+3)
        PUSH	AF
        LD	A,(T+20)
        LD	(V+3),A
        PUSH	HL
        CALL	SRP
        POP	HL
        CALL	INFOR
        POP	AF
        LD	(V+3),A
        LD	(IY+17),0
        RET
I88	CALL	IN31
        JR	Z,I80
I89	RRA
        JR	NC,I82
        LD	C,8
I82	RRA
        JR	NC,I83
        LD	C,4
I83	RRA
        JR	NC,I84
        LD	C,128
I84
I85
        LD	C,64
I85     RRA
        JR	C,INP59
        JR	INP5
I80	LD	A,223
        CALL	INPUT
        JR	Z,INP2
        LD	C,8
INP2	LD	A,191
        CALL	INPUT
        JR	Z,INP3
        LD	C,4
INP3	LD	A,253
        CALL	INPUT
        JR	Z,INP4
        LD	C,128
INP4	LD	A,251
        CALL	INPUT
        JR	Z,INP5
        LD	C,64
INP5	CALL	MIMAN
        LD	A,E
        BIT	6,E

6981:

        18,74,230,150,94,21,0,52,150,8,94
DEFB	19,74,230,150,94,16,0,52,150,8,94
DEFB	19,74,50,150,94,15,0,230,150,4,94
DEFB	20,72,120,82,172,21,0,120,82,64,106
DEFB	21,74,50,150,94,18,0,230,150,4,94
DEFB	21,72,190,82,172,22,1,120,82,64,86
DEFB	21,73,120,82,102,20,0,120,82,128,172
DEFB	21,74,230,150,94,25,0,52,150,8,94
DEFB	22,73,120,82,84,21,1,190,82,128,172
DEFB	23,73,120,82,84,25,1,190,82,128,172
DEFB	24,73,120,82,84,26,1,190,82,128,172
DEFB	25,72,190,82,172,23,1,120,82,64,86
DEFB	25,74,50,150,94,21,0,230,150,4,94
DEFB	25,74,230,150,94,26,0,52,150,8,94
DEFB	26,72,190,82,172,24,1,120,82,64,86
DEFB	26,74,50,150,94,25,0,230,150,4,94
DEFB	26,76,196,150,102,27,0,50,150,128,172
DEFB	27,76,50,150,174,26,0,196,150,64,106
DEFB	27,78,180,116,140,34,0,120,50,16,60
DEFB	27,73,50,82,102,28,0,100,82,128,172
DEFB	28,72,100,82,172,27,0,50,82,64,104
DEFB	29,75,50,150,48,30,0,50,150,128,172
DEFB	29,71,50,122,152,34,0,172,98,4,152
DEFB	29,70,128,122,152,54,0,52,82,8,152
DEFB	29,72,140,82,124,53,0,60,82,64,104
DEFB	30,75,50,150,48,31,0,50,150,128,172
DEFB	30,75,50,150,174,29,0,50,150,64,52
DEFB	30,74,48,150,50,32,0,176,150,4,50
DEFB	31,75,50,150,174,30,0,50,150,64,52
DEFB	31,74,48,150,50,33,0,176,150,4,50
DEFB	31,81,176,100,70,81,8,60,100,8,128
DEFB	32,75,50,150,48,33,0,50,150,128,172
DEFB	32,74,178,150,50,30,0,52,150,8,50
DEFB	33,81,50,100,128,37,0,112,100,4,130
DEFB	33,75,50,150,174,32,0,50,150,64,52
DEFB	33,74,178,150,50,31,0,52,150,8,50
DEFB	34,70,176,98,152,29,0,52,124,8,152
DEFB	34,71,50,82,80,35,0,112,82,4,86
DEFB	34,78,100,52,50,27,0,170,116,32,130
DEFB	35,70,110,82,86,34,0,52,82,8,80
DEFB	35,75,50,150,50,36,0,50,150,128,172
DEFB	36,75,50,150,172,35,0,50,150,64,52
DEFB	36,75,50,150,50,37,0,50,150,128,172
DEFB	37,81,112,100,130,33,0,60,100,8,128
DEFB	37,75,50,150,172,36,0,50,150,64,52
DEFB	37,75,50,150,50,38,0,50,150,128,172
DEFB	37,71,50,82,150,47,0,174,82,4,100
DEFB	38,75,50,150,174,37,0,50,150,64,52
DEFB	38,74,112,150,100,39,0,52,150,8,100
DEFB	38,73,70,82,48,62,0,200,82,128,172
DEFB	39,74,50,150,100,38,0,112,150,4,100
DEFB	39,74,230,150,100,40,0,52,150,8,100
DEFB	39,73,60,82,104,42,3,50,82,128,172
DEFB	40,74,50,150,100,39,0,230,150,4,100
DEFB	40,73,120,82,104,41,0,100,82,128,172
DEFB	41,72,100,82,170,40,0,120,82,64,108
DEFB	42,72,52,82,172,39,3,60,82,64,108
DEFB	42,70,78,82,108,43,0,52,82,8,108
DEFB	42,73,54,82,76,45,3,60,82,128,172
DEFB	43,71,50,82,108,42,0,78,82,4,108
DEFB	43,72,90,82,78,44,0,90,82,128,172
DEFB	44,72,90,82,172,43,0,90,82,64,80
DEFB	45,74,54,150,50,46,0,174,150,4,50
DEFB	45,72,60,82,174,42,3,54,82,64,82
DEFB	46,74,174,150,50,45,0,58,150,8,50
DEFB	46,72,90,82,132,57,6,80,82,64,108
DEFB	46,81,58,100,106,52,0,80,100,4,114
DEFB	47,72,100,82,172,48,0,100,82,64,52
DEFB	47,71,50,82,100,50,0,174,82,4,100
DEFB	47,70,174,82,100,37,0,52,82,8,150
DEFB	48,71,50,82,100,49,0,174,82,4,100
DEFB	48,73,100,82,50,47,0,100,82,128,172
DEFB	49,73,100,82,50,50,0,100,82,128,172
DEFB	49,70,174,82,100,48,0,52,82,8,100
DEFB	50,72,100,82,172,49,0,100,82,64,52
DEFB	50,70,174,82,100,47,0,52,82,8,100
DEFB	50,71,50,82,50,2,0,174,102,4,150
DEFB	50,72,150,82,48,63,0,90,82,128,174
DEFB	51,80,110,52,120,80,0,56,180,32,156
DEFB	51,83,150,100,48,52,0,50,100,128,174
DEFB	51,81,178,100,146,62,0,52,100,8,

77BF:

DEFB	53,70,48,82,156,76,0,154,82,4,156
DEFB	54,70,88,82,158,53,0,92,130,8,152
DEFB	54,71,50,82,152,29,0,128,124,4,152
DEFB	54,71,90,128,156,55,0,88,82,4,156
DEFB	55,70,88,82,158,54,0,92,130,8,152
DEFB	55,82,110,150,154,56,0,110,52,16,154
DEFB	56,80,110,52,154,55,0,110,140,32,156
DEFB	56,71,90,82,110,68,0,88,82,4,110
DEFB	57,71,90,128,156,58,0,88,82,4,156
DEFB	57,73,80,82,100,46,6,90,82,128,132
DEFB	57,72,60,82,172,62,6,70,82,64,148
DEFB	58,71,90,128,158,59,0,88,82,4,156
DEFB	58,70,88,82,158,57,0,92,130,8,152
DEFB	59,71,90,128,158,60,0,88,82,4,156
DEFB	59,70,88,82,158,58,0,92,130,8,152
DEFB	60,82,110,150,154,61,7,146,52,16,154
DEFB	60,70,88,82,158,59,0,92,130,8,152
DEFB	61,80,146,52,154,60,0,100,160,32,156
DEFB	62,81,50,100,146,51,0,176,100,4,146
DEFB	62,73,70,82,146,57,6,60,82,128,172
DEFB	62,72,196,82,172,38,0,70,82,64,50
DEFB	62,73,196,82,146,77,4,9

7D2A:

        ,0,92,130,8,152
DEFB	67,82,110,150,154,68,0,110,52,16,154
DEFB	68,80,110,52,154,67,0,110,140,32,156
DEFB	68,71,90,82,110,56,0,88,82,4,110
DEFB	69,73,120,82,84,2,0,100,82,128,172
DEFB	70,71,50,82,78,72,0,174,82,4,78
DEFB	70,75,50,150,50,73,0,50,150,128,172
DEFB	71,70,174,82,78,73,0,52,82,8,78
DEFB	72,70,174,82,78,70,0,52,82,8,78
DEFB	73,75,50,150,172,70,0,50,150,64,52
DEFB	73,71,50,82,78,71,0,174,82,4,78
DEFB	73,73,80,82,50,64,0,90,130,128,172
DEFB	75,70,80,82,154,63,0,50,82,8,154
DEFB	76,70,154,82,154,53,0,50,82,8,154
DEFB	77,73,70,82,100,78,0,70,82,128,172
DEFB	77,72,100,128,172,62,4,196,82,64,148
DEFB	78,72,70,82,172,77,0,70,82,64,102
DEFB	78,75,50,150,50,17,0,100,200,128,172
DEFB	80,82,110,200,154,51,0,110,52,16,110
;STATIC OBJ
DEFB	3,49,0,150,80,100
DEFB	5,49,0,150,80,100
DEFB	5,4

84BB:

        0,106,80,140
DEFB	73,22,0,106,80,100
        *L+
        DEFB	255

		(T+13),A
BT23	LD	H,(IY+TE+8)
        CALL	BUT
        LD	A,C
        AND	3
        CP	3
        JR	NZ,BT40

91BD:

        DEFB	6,1,9,12,5,4,164
        JR	AGAB
SUCC	CALL	PRINT
        DEFB	19,21,3,3,5,4,5,4,164
AGAB	CALL	PRINT
        DEFB	0,9,14,200,20,100,25,15,21,18,0,17,21,5,19,20
        DEFB	0,20,8,5,0,23,9,26,1,18,4,0,9,19,0,6,18,5,5
        DEFB	164
        CALL	MESS2
        JP	WAIT
ROS	LD	(IY),7
        LD	B,5
        LD	HL,55552
        LD	(T),HL
OBJD	LD	L,(IY+31)
        INC	IY
        LD	H,(IY+31)
        INC	IY
        LD	A,L
        OR	H
        JR	Z,OB2
        LD	(IY+29),E
        LD	(IY+30),D
        PUSH	BC
        LD	BC,DATLEN

9672:

ART2    CALL	ATTRI
        CP	3
        CALL	Z,WAIT
        LD	A,239
        CALL	INPUT
        RRA
        JR	NC,STAR2
        BIT	1,B
        RET	NZ
STAR2	AND	12
        JR	Z,ST20
        LD	H,255
        LD	L,(IY+30)
        LD	E,(HL)
        INC	HL
        LD	D,(HL)
        PUSH	DE
        POP	IX
        LD	A,(IX+12)
        AND	15
        CP	9
        JR	NZ,USE6
        LD	(IY+52),30
        LD	B,0
        LD	(HL),B
        DEC	HL
        LD	(HL),B
        CALL	EEN
        POP	HL
        JP	TELE
USE6	CP	6
        JR	NZ,USE5
        LD	DE,2313
        LD	(V+21),DE
        JR	ST22
USE5	CP	5
        JR	NZ,USE4
        SET	7,(IY+23)
        JR	ST22
USE4	CP	4
        JR	NZ,ST20
        LD	A,(V+21)
        INC	A
        CP	10
        JR	NC,ST21
        LD	(V+21),A
        JR	ST22
ST21	LD	(IY+22),9
ST22	LD	A,(V+30)
        SET	0,(IY+23)
        LD	(HL),0
        DEC	HL
        LD	(HL),0
        JR	STE3
ST20	LD	A,247
        CALL	INPUT
        JR	Z,ST3
        LD	B,5
        LD	C,255
ST4	INC	C
        INC	C
        RRA
        JR	C,ST5
        DJNZ	ST4
ST5 	LD	A,158
        ADD	A,C
        CP	(IY+30)
        JR	Z,ST3
        LD	(IY+30),A
STE3	LD	H,255
        LD	L,A
        LD	E,(HL)
        INC	HL
        LD	D,(HL)
        EX	DE,HL
        LD	A,H
        OR	L
        JR	NZ,ST6
        CALL	INFO0
        JR	ST3
ST6	CALL	INFOR
ST3	BIT	0,(IY+23)
        JR	Z,ST9
        RES	0,(IY+23)
        CALL	PRINT
        DEFB	200,55,12,164
        LD	A,


(Source: Divingkataetheweirdo)

128K version

Different code fragments can be found in this version. As with the 48k version, the code seen below can be seen with a hex editor at the addresses below in the .tap dump of the game.

96BF:

        DEFB	2,3,32,90,58,114
        DEFB	2,3,32

C258:

        IT	2,(IY+23)
        JR	Z,NOG0
        XOR	A

C8D8:

        L,(IY+TE+11)
        RET
BAT	LD	A,(IX+12)
        AND	15
        CP	1
        JP	NZ,BAT0
        SET	7,(IY+TE+23)
        LD	A,(V+3)
        CP	7
        JP	NZ,BTM
        LD	A,(IX+14)
        AND	A
        JR	Z,BGGI
        PUSH	HL
        PUSH	DE
        PUSH	IX
        LD	L,(IY+30)
        LD	H,255
        LD	E,(HL)
        INC	HL
        LD	D,(HL)
        PUSH	DE
        POP	IX
        CP	(IX+19)
        POP	IX
        POP	DE
        POP	HL
        JR	Z,BGGI
        LD	(IY+7),2
        JP	BTM
BGGI	LD	A,(IX+17)
        LD	C,A
        AND	(IY+TE+24)
        JP	Z,BTM
        LD	A,(V+52)
        CP	61
        JR	NZ,BEGT
        BIT	1,(IY+17)
        JP	Z,BTM
BEGT	CALL	BUT
        LD	L,(IX+15)
        LD	E,(IX+18)
        LD	A,C
        AND	60
        JR	NZ,DIZ
        LD	A,B
        SUB	(IX+6)
        JP	C,BTM
        LD	B,A
        ADD	A,(IY+TE+9)
        SUB	(IX+9)
        JP	NC,BTM
        LD	A,L
        ADD	A,B
        LD	B,A
        LD	H,E
        BIT	6,C
        JR	NZ,DIZ1
        LD	A,E
        SUB	(IY+TE+11)
        LD	H,A
        JR	DIZ1
DIZ	LD	A,C
        AND	48
        JR	Z,DIZ0
        LD	A,B
        SUB	(IX+6)
        ADD	A,L
        LD	B,A
        LD	A,H
        SUB	(IX+8)
        ADD	A,E
        LD	H,A
        LD	A,(IX+16)
        BIT	4,C
        JR	Z,DIZ2
        ADD	A,(IY+TE+10)
        JR	DIZ2
DIZ0	LD	A,H
        SUB	(IX+8)
        JP	C,BTM
        LD	H,A
        ADD	A,(IY+TE+11)
        SUB	(IX+11)
        JP	NC,BTM
        LD	A,H
        LD	A,E
        ADD	A,H
        LD	H,A
        LD	A,L
        LD	B,A
        BIT	3,C
        JR	NZ,DIZ1
        SUB	(IY+TE+9)
        LD	B,A
DIZ1	LD	A,D
        SUB	(IX+7)
        JP	NC,BTM
        LD	D,A
        SUB	(IY+TE+10)
        ADD	A,(IX+10)
        JP	NC,BTM
        LD	A,(IX+16)
        ADD	A,D
DIZ2	LD	D,A
        CALL	BUT2
        EXX
        LD	C,(IX+13)
        LD	HL,OBJ3D-5
        PUSH	IX
FIR5	LD	DE,5
        ADD	HL,DE
FIRR	LD	E,(HL)
        INC	HL
        LD	A,(HL)
        CP	70
        JR	NC,FIREN
        LD	A,E
        CP	C
        JR	NZ,FIR5
        PUSH	HL
        PUSH	BC
        LD	A,(HL)
        INC	HL
        LD	DE,V+80
        LD	BC,4
        LDIR
        PUSH	DE
        LD	HL,OBJ-5
        LD	DE,11
        INC	A
FIR4	ADD	HL,DE
        DEC	A
        JR	NZ,FIR4
        POP	DE
        LD	BC,3
        LDIR
        LD	IX,V+75
        EXX
        CALL	BB2
        EXX
        POP	BC
        POP	HL
        JR	NC,FIR5
        BIT	4,(IX+5)
        JR	NZ,FIR5
        LD	(IY+7),1
        POP	IX
        JP	BTM
FIREN	LD	(IY+52),C
        POP	AF
        EXX


D057:

        LD	A,(T+14)
        LD	(IX+14),A
        CALL	EEN
        JP	ROOMST
EEN	LD	A,(V)
        SUB	7
        RET	Z
        LD	IX,7*DATLEN+LIST
        LD	B,A
EN	LD	A,(IX+12)
        AND	15
        CP	1
        RET	Z
        PUSH	BC
        LD	B,(IX+19)
        LD	DE,6
        LD	HL,OBJ3D-3
OLO	ADD	HL,DE
        DJNZ	OLO
        PUSH	HL
        LD	A,(IX+14)
        LD	B,A
        LD	C,8
        AND	15
        CP	11
        JR	NZ,OL2
        BIT	5,B
        CALL	NZ,MIWRAI
        JR	HRHR
OL2	CP	7
        JR	NZ,HRHR
        BIT	5,B
        CALL	NZ,MITRO
HRHR	PUSH	IX
        POP	HL
        LD	DE,6
        ADD	HL,DE
        POP	DE
        LD	BC,3
        LDIR
        POP	BC
FIF	LD	DE,DATLEN
        ADD	IX,DE
        DJNZ	EN
        RET
BAT0	BIT	4,(IY+TE+12)
        JR	Z,BTT
        BIT	2,(IY+23)
        JR	NZ,BTG
        LD	A,(T+20)
        CP	7
        JR	NZ,BTT
        CALL	DECLI1
BTG	LD	A,(IX+16)
        AND	31
        JR	Z,BTT
        SET	4,(IX+14)
        LD	(IX+13),18
        LD	IX,(T+25)
        SET	5,(IX+16)
        CALL	BUT
        JP	CHEND
BTT	BIT	4,(IX+12)
        JR	Z,BTY
        LD	A,(V+3)
        CP	7
        JR	NZ,BTY
        CALL	DECLI1
        JR	BO6
BTY 	BIT	7,(IY+TE+12)
        JR	Z,BT

D5A1:

	D	(IX+13),18
B,BO3	LD	A,(V+3)
	PUSH	AF
	PUSH	IX
	CALL	BTM
	POP	HL
	PUSH	HL
	POP	IX
	LD	A,(T+20)
	LD	(V+3),A
	CALL	SRP
	POP	AF
	LD	(V+3),A
	RET
BTI	LD	A,(T+14)
	AND	15
	CP	13
	JR	NZ,BTI0
	BIT	5,(IX+12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	(V+21),A
	JR	ST22
ST21	LD	(IY+22),9
ST22	LD	A,(V+30)
	SET	0,(IY+23)
	LD	(HL),0
	DEC	HL
	LD	(HL),0
	JR	STE3
AST20	LD	A,247
	CALL	INPUT
	JR	Z,ST3
	LD	B,5
	LD	C,255
BST4	INC	C
	INC	C
	RRA
	JR	C,ST5
	DJNZ	ST4
JBST5	LD	A,158
	ADD	A,C
	CP	(IY+30)
	JR	Z,ST3
	LD	(IY+30),A
STE3	LD	H,255
	LD	L,A
	LD	E,(HL)
	INC	HL
	LD	D,(HL)
	EX	DE,HL
	LD	A,H
	OR	L
	JR	NZ,ST6
	CALL	INFO0
	JR	ST3
BST6	CALL	INFOR
BST3	BIT	0,(IY+23)
	JR	Z,ST9
	RES	0,(IY+23)
	CALL	PRINT
	DEFB	200,55,12,164
	LD	A,(V+21)
	ADD	A,27
	CALL	PRICHR
DC	LD	A,(V+22)
	ADD	A,27
        CALL	PRICHR
ST9	CALL	MESSAG
	LD	HL,LIST+120
	LD	(IY+3),7
	LD	A,(V+21)
	OR	(IY+22)
	RET	Z
MOBSPR	PUSH	HL
	CALL	CHE3D
	POP	HL
	LD	A,(V+3)
	INC	(IY+3)
	CP	(IY)
	JP	Z,START
	LD	DE,DATLEN
	ADD	HL,DE
	*L+
	JR	MOBSPR


(Source: Divingkataetheweirdo)