ThomasSpeedrunner icon

zSetChanVol

ThomasSpeedrunner | PRO | 09/21/14 10:42:40 PM UTC | 0 ⭐ | 537 👁️ | Never ⏰ | []
text |

830 B

|

None

|

0 👍

/

0 👎

;zsub_E8A
zSetChanVol:
	bit	7,(ix+1)		; a PSG track
	ret	nz				; If so, quit!
	bit	2,(ix+0)		; If playback control byte "SFX is overriding this track" bit set...
	ret	nz				; ... then quit!
	ld	e,(ix+1Ah)		; zVolTLMaskTbl value from last voice setting (marks which specific TL operators need updating)
	ld	a,(ix+1)		; Load current voice control byte
	and	3				; Keep only bits 0-2
	add	a,40h			; Add 40h -- appropriate TL register
	ld	d,(ix+6)		; Get channel volume
	bit	7,d				; If bit 7 (80h) is set...
	ret	nz				; ... then quit!
	push	hl			; Save 'hl'
	ld	l,(ix+1Eh)		; low byte of where TL bytes begin (set during last voice setting)
	ld	h,(ix+1Fh)		; high byte of where TL bytes begin (set during last voice setting)
	call	zSetFMTLs	; Set the appropriate Total Levels
	pop	hl				; Restore 'hl'
	ret
; End of function zSetChanVol

Comments