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

Puffy's Saga (ZX Spectrum)

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

Puffy's Saga

Developers: Ashminster Computing, Ubi Soft
Publisher: Ubi Soft
Platform: ZX Spectrum
Released in EU: 1989


SourceIcon.png This game has uncompiled source code.


Sound Driver Source Code Fragment

Two pieces of code used for the sound driver in this game can be viewed with a hex editor at the addresses below for the .tzx dump.

313E:

          C HL
	CALL NZ,CHORD
	LD (IX+DATA),L
	LD (IX+DATA+1),H
ENVELOPE	
        INC (IX+ENVTIMER)
	LD A,(IX+ENVTIMER)
	CP ADTIME
	JR NC,$10
	LD E,(IX+ENVTIMER)
	LD HL,ATTACKDECAY-1
	JR $11
$10	SUB (IX+SUSTAIN)
	RET C
	LD E,A
	LD HL,RELEASE
$11	LD D,0
	ADD HL,DE
	LD E,(HL)
	LD BC,#FFFD
	LD A,(IX+CHANNELNUM)
	ADD 8
	OUT (C),A
	LD B,#BF
	OUT (C),E
	RET

ADTIME	EQU 6
RTIME	EQU 7

ATTACKDECAY	DB 13,12,11,10,9,8

RELEASE		DB 7,6,5,4,3,2,0

CHORD	PUSH IX

3348:

EQ
	LD A,(HL)
	INC HL
	CALL SET_LENGTH
	POP IX
	RET


SET_LENGTH
	LD C,%00100000
	RES 7,A
	BIT 3,A
	JR Z,$10
	RES 3,A
	LD C,%00110000
$10	LD B,A
	INC B
	DEC B
	JR Z,$11
$12	SRL C
	DJNZ $12
$11	LD A,C
	LD (IX+TIMER),A
	SUB RTIME
	JR NC,$13
	SUB A
$13	LD (IX+SUSTAIN),A
	LD (IX+ENVTIMER),0
	RET


SET_FREQ
	PUSH HL
	SUB #18
	LD BC,#000C
$10	INC