gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 7b7499d5e4cf132dafa1a2b1d23f5a989ee74fee parent c9b5e777ff8a0ee69f6f55b57d64c0d69a1d3a7e Author: Toxa <untoxa@mail.ru> Date: Sun, 19 Feb 2023 21:07:22 +0300 enhance wav playback example Diffstat:
| M | gbdk-lib/examples/gb/wav_sample/src/sample_player.c | 30 | ++++++++++++++++++------------ |
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/gbdk-lib/examples/gb/wav_sample/src/sample_player.c b/gbdk-lib/examples/gb/wav_sample/src/sample_player.c @@ -20,31 +20,37 @@ void play_isr() __nonbanked __naked { ld a, (#__current_bank) ; save bank and switch ld e, a ld a, (#_play_bank) - ld (#0x2000), a + ld (_rROMB0), a + + ldh a, (_NR51_REG) + ld c, a + and #0b10111011 + ldh (_NR51_REG), a xor a - ldh (_NR30_REG),a + ldh (_NR30_REG), a -_wave_addr = 0xFF30 - .rept 16 + .irp ofs,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ld a, (hl+) - ldh (_wave_addr), a -_wave_addr = _wave_addr + 1 + ldh (__AUD3WAVERAM+ofs), a .endm ld a, #0x80 - ldh (_NR30_REG),a + ldh (_NR30_REG), a ld a, #0xFE ; length of wave - ldh (_NR31_REG),a + ldh (_NR31_REG), a ld a, #0x20 ; volume - ldh (_NR32_REG),a + ldh (_NR32_REG), a xor a ; low freq bits are zero - ldh (_NR33_REG),a + ldh (_NR33_REG), a ld a, #0xC7 ; start; no loop; high freq bits are 111 - ldh (_NR34_REG),a + ldh (_NR34_REG), a + + ld a, c + ldh (_NR51_REG), a ld a, e ; restore bank - ld (#0x2000), a + ld (_rROMB0), a ld a, l ; save current position ld (#_play_sample), a
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.