From 5068ec8d19fb7248abfcd065e1890c85fd96566b Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 28 May 2021 22:01:07 +0200 Subject: Add SYSTEM_WAIT configuration --- src/common.h | 24 ++++++++++++++---------- src/main.c | 5 ++++- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') 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 { NOTE_C_8 } Note; -static const char * note_names[] = { - "C2", "C#2", "D2", "D#2", "E2", "F2", "F#2", "G2", "G#2", "A2", "A#2", "B2", - "C3", "C#3", "D3", "D#3", "E3", "F3", "F#3", "G3", "G#3", "A3", "A#3", "B3", - "C4", "C#4", "D4", "D#4", "E4", "F4", "F#4", "G4", "G#4", "A4", "A#4", "B4", - "C5", "C#5", "D5", "D#5", "E5", "F5", "F#5", "G5", "G#5", "A5", "A#5", "B5", - "C6", "C#6", "D6", "D#6", "E6", "F6", "F#6", "G6", "G#6", "A6", "A#6", "B6", - "C7", "C#7", "D7", "D#7", "E7", "F7", "F#7", "G7", "G#7", "A7", "A#7", "B7", - "C8" -}; - static const u32 sound_rates[] = { 44 , 156 , 262 , 363 , 457 , 547 , 631 , 710 , 785 , 856 , 923 , 986 , 1046, 1102, 1155, 1205, 1252, 1297, 1339, 1379, 1416, 1452, 1485, 1517, @@ -703,6 +693,19 @@ static const u32 sound_rates[] = { 2016, }; + +// +// System control. +// + +// Used to configure gamepak access timings. +#define SYSTEM_WAIT *((vu16*)(MEM_IO + 0x0204)) + +// This register defaults to 0, but manufacture cartridges use the values +// provided below. +#define SYSTEM_WAIT_DEFAULT 0 +#define SYSTEM_WAIT_CARTRIDGE 0x4317 + // // Misc. // @@ -730,6 +733,7 @@ wait_vsync(void) { // // Memory section macros for devkitARM. // + #define IWRAM_DATA __attribute__((section(".iwram"))) #define IWRAM_CODE __attribute__((section(".iwram"), long_call, target("arm"))) #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) { static Uxn u; EWRAM_BSS -static u8 umem[65536]; +static u8 umem[KB(65)]; int main(void) { + // Adjust system wait times. + SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE; + // Initialize filesystem. fs_init(); -- cgit v1.2.1