aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-28 22:01:07 +0200
committerBad Diode <bd@badd10de.dev>2021-05-28 22:01:07 +0200
commit5068ec8d19fb7248abfcd065e1890c85fd96566b (patch)
tree78f3dab9e5a9081f6b06cbb1dea1cd3727c489a1 /src
parent9c61e2e75220439e917fa5fba9d59014a2a5c43a (diff)
downloaduxngba-5068ec8d19fb7248abfcd065e1890c85fd96566b.tar.gz
uxngba-5068ec8d19fb7248abfcd065e1890c85fd96566b.zip
Add SYSTEM_WAIT configuration
Diffstat (limited to 'src')
-rw-r--r--src/common.h24
-rw-r--r--src/main.c5
2 files changed, 18 insertions, 11 deletions
diff --git a/src/common.h b/src/common.h
index 0fe2752..12114d7 100644
--- a/src/common.h
+++ b/src/common.h
@@ -683,16 +683,6 @@ typedef enum {
683 NOTE_C_8 683 NOTE_C_8
684} Note; 684} Note;
685 685
686static const char * note_names[] = {
687 "C2", "C#2", "D2", "D#2", "E2", "F2", "F#2", "G2", "G#2", "A2", "A#2", "B2",
688 "C3", "C#3", "D3", "D#3", "E3", "F3", "F#3", "G3", "G#3", "A3", "A#3", "B3",
689 "C4", "C#4", "D4", "D#4", "E4", "F4", "F#4", "G4", "G#4", "A4", "A#4", "B4",
690 "C5", "C#5", "D5", "D#5", "E5", "F5", "F#5", "G5", "G#5", "A5", "A#5", "B5",
691 "C6", "C#6", "D6", "D#6", "E6", "F6", "F#6", "G6", "G#6", "A6", "A#6", "B6",
692 "C7", "C#7", "D7", "D#7", "E7", "F7", "F#7", "G7", "G#7", "A7", "A#7", "B7",
693 "C8"
694};
695
696static const u32 sound_rates[] = { 686static const u32 sound_rates[] = {
697 44 , 156 , 262 , 363 , 457 , 547 , 631 , 710 , 785 , 856 , 923 , 986 , 687 44 , 156 , 262 , 363 , 457 , 547 , 631 , 710 , 785 , 856 , 923 , 986 ,
698 1046, 1102, 1155, 1205, 1252, 1297, 1339, 1379, 1416, 1452, 1485, 1517, 688 1046, 1102, 1155, 1205, 1252, 1297, 1339, 1379, 1416, 1452, 1485, 1517,
@@ -703,6 +693,19 @@ static const u32 sound_rates[] = {
703 2016, 693 2016,
704}; 694};
705 695
696
697//
698// System control.
699//
700
701// Used to configure gamepak access timings.
702#define SYSTEM_WAIT *((vu16*)(MEM_IO + 0x0204))
703
704// This register defaults to 0, but manufacture cartridges use the values
705// provided below.
706#define SYSTEM_WAIT_DEFAULT 0
707#define SYSTEM_WAIT_CARTRIDGE 0x4317
708
706// 709//
707// Misc. 710// Misc.
708// 711//
@@ -730,6 +733,7 @@ wait_vsync(void) {
730// 733//
731// Memory section macros for devkitARM. 734// Memory section macros for devkitARM.
732// 735//
736
733#define IWRAM_DATA __attribute__((section(".iwram"))) 737#define IWRAM_DATA __attribute__((section(".iwram")))
734#define IWRAM_CODE __attribute__((section(".iwram"), long_call, target("arm"))) 738#define IWRAM_CODE __attribute__((section(".iwram"), long_call, target("arm")))
735#define EWRAM_DATA __attribute__((section(".ewram"))) 739#define EWRAM_DATA __attribute__((section(".ewram")))
diff --git a/src/main.c b/src/main.c
index 7a2c397..2aa744c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -365,9 +365,12 @@ handle_input(Uxn *u) {
365 365
366static Uxn u; 366static Uxn u;
367EWRAM_BSS 367EWRAM_BSS
368static u8 umem[65536]; 368static u8 umem[KB(65)];
369 369
370int main(void) { 370int main(void) {
371 // Adjust system wait times.
372 SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE;
373
371 // Initialize filesystem. 374 // Initialize filesystem.
372 fs_init(); 375 fs_init();
373 376