gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/gb/wav_sample/src/samptest.c
1 #include <gb/gb.h>
2 #include <stdio.h>
3
4 #include "sample_player.h"
5
6 #include "samples_bank2.h"
7 #include "samples_bank3.h"
8
9
10 void main(void)
11 {
12
13 NR52_REG = 0x80u;
14 NR51_REG = 0xffu;
15 NR50_REG = 0x77u;
16
17 __critical {
18 TMA_REG = 0xC0u, TAC_REG = 0x07u;
19 add_TIM(play_isr);
20 set_interrupts(VBL_IFLAG | TIM_IFLAG);
21 }
22
23 puts("PRESS A/B TO PLAY\n");
24
25 while(1)
26 {
27 UINT8 j = joypad();
28 if (j & J_A) {
29 play_sample1();
30 while (joypad() & J_A) vsync();
31 } else
32 if (j & J_B) {
33 play_sample2();
34 while (joypad() & J_B) vsync();
35 }
36 vsync();
37 }
38 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.