Prev: A314 Up: Map Next: A33B
A31D: Send attenuation and frequency bytes to PSG
Used by the routine at tone_data_to_psg. Note: The value is actually 111,861 / frequency, so higher numbers give lower notes
Input
C Attenuation operation in upper nybble (1CC1XXXX)
D Tone operation in upper nybble (1CC0XXXX)
(IX+$03) Frequency LSB
(IX+$04) Attenuation/frequency MSB (AAAA00FF)
attn_and_freq_to_psg A31D CALL attn_or_noise_to_psg Set attenuation
A320 LD A,(IX+$03) Frequency LSB
A323 AND $0F Isolate bits 0-3 of frequency
A325 OR D Apply operation to bits 4-7
A326 OUT ($FF),A Send to PSG
A328 LD A,(IX+$03) Frequency LSB (FFFFFFFF)
A32B AND $F0 Isolate bits 4-7 of frequency (FFFF0000)
A32D LD D,A Save it
A32E LD A,(IX+$04) Get frequency MSB (AAAA00FF)
A331 AND $0F Isolate lower nybble with bits 8-9 of frequency (000000FF)
A333 OR D Now FFFF00FF in wrong order
A334 RRCA FFFFF00F
A335 RRCA FFFFFF00
A336 RRCA 0FFFFFF0
A337 RRCA 00FFFFFF
A338 OUT ($FF),A Send to PSG
A33A RET
Prev: A314 Up: Map Next: A33B