Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ld a, [sample_buffer+] ;LUT for volumes integrated in buffer
- ld d, a
- ld a, [sample_buffer+] ;pregenerated buffer by software frequency generator, 8 bit samples for ease of use
- srl a
- ld e, a
- ld a, [de] (to get the final amplitude)
- sub $40
- jr nc, nocomplement1
- cpl
- inc a ;because SM83 doesn't have the Z80's neg
- nocomplement1:
- push af
- ld a, [sample_buffer+]
- ld d, a
- ld a, [sample_buffer+]
- srl a
- ld e, a
- ld a, [de]
- sub $40
- jr nc, nocomplement2
- cpl
- inc a
- nocomplement2:
- ld b, a
- pop af
- add b
- add $80
- ld d, amplitude_LUT
- ld e, a
- ld a, [de]
- ld b, a
- or $0f
- ldh [rNRx2], a
- ld a, $80
- ldh [rNRx4], a
- ld a, b
- and $f0
- ld b, a
- swap b
- or b
- ldh [rNR50], a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement