diff --git a/GimliDS.nds b/GimliDS.nds index 842f0b1..ff0ed1a 100644 Binary files a/GimliDS.nds and b/GimliDS.nds differ diff --git a/Makefile b/Makefile index 0092fa9..81e06fc 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(DEVKITARM)/ds_rules export TARGET := GimliDS export TOPDIR := $(CURDIR) -export VERSION := 0.9 +export VERSION := 0.9a ICON := -b $(CURDIR)/C64_icon.bmp "GimliDS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/GimliDS" diff --git a/README.md b/README.md index 3fa0308..d538fa7 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ``` ## Change Log +Version 0.9a release 02-May-2025 by wavemotion-dave + * Fixed TrueDrive loading so it doesn't alter the CPU speed (for games like Pang which were playing quite 'uneven'). + * Bumped up volume of the SID output by 50% (was too quiet) + * Improved 1541 Drive emulation - mostly in the GCR and IEC areas. Nothing noticeable but should be more accurate. + * Fixed write floppy icon color (instead of the usual green, will flash blue). + * Tweaks to C64 keyboard graphic to be more authentic. + Version 0.9 release 30-Apr-2025 by wavemotion-dave * New and improved key mapping - including the new Slide-n-Glide joysticks handling. * SID filtering improved for better audio rendering (Space Taxi voice heard!). diff --git a/arm9/Makefile b/arm9/Makefile index a11c807..75309a4 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -28,7 +28,7 @@ ARCH := -marm -mthumb-interwork CFLAGS := -g -O3 -flto -Wall -Wformat=0 -Wno-sequence-point -Wno-delete-non-virtual-dtor -Wno-pointer-arith -Wno-register -Wno-narrowing -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math $(ARCH) -falign-functions=4 -frename-registers -finline-functions $(ARCH) -CFLAGS += $(INCLUDE) -DARM9 -D__NDS__=1 -DPRECISE_CPU_CYCLES=1 -DPRECISE_CIA_CYCLES=0 -DGLOBAL_VARS=1 +CFLAGS += $(INCLUDE) -DARM9 -D__NDS__=1 -DPRECISE_CPU_CYCLES=1 -DGLOBAL_VARS=1 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s diff --git a/arm9/gfx_data/intro.png b/arm9/gfx_data/intro.png index c008355..c190713 100644 Binary files a/arm9/gfx_data/intro.png and b/arm9/gfx_data/intro.png differ diff --git a/arm9/gfx_data/keyboard.png b/arm9/gfx_data/keyboard.png index ae2dff6..7ec502e 100644 Binary files a/arm9/gfx_data/keyboard.png and b/arm9/gfx_data/keyboard.png differ diff --git a/arm9/source/C64.cpp b/arm9/source/C64.cpp index ea6bc37..8f6a488 100644 --- a/arm9/source/C64.cpp +++ b/arm9/source/C64.cpp @@ -1170,16 +1170,17 @@ void C64::main_loop(void) } // The order of calls is important here - int cycles = TheVIC->EmulateLine(); + int cpu_cycles_to_execute = TheVIC->EmulateLine(); TheSID->EmulateLine(SID_CYCLES_PER_LINE); -#if !PRECISE_CIA_CYCLES - TheCIA1->EmulateLine(63); - TheCIA2->EmulateLine(63); -#endif + TheCIA1->EmulateLine(CIA_CYCLES_PER_LINE); + TheCIA2->EmulateLine(CIA_CYCLES_PER_LINE); + // ----------------------------------------------------------------- + // TrueDrive is more complicated as we must interleave the two CPUs + // ----------------------------------------------------------------- if (ThePrefs.TrueDrive) { - int cycles_1541 = 64; + int cycles_1541 = FLOPPY_CYCLES_PER_LINE + CycleDeltas[myConfig.flopCycles]; TheCPU1541->CountVIATimers(cycles_1541); if (!TheCPU1541->Idle) @@ -1190,17 +1191,17 @@ void C64::main_loop(void) // is now handled inside CPU_emuline.h for the 1541 processor // to avoid the overhead of lots of function calls... // ----------------------------------------------------------- - TheCPU1541->EmulateLine(cycles_1541, cycles); + TheCPU1541->EmulateLine(cycles_1541, cpu_cycles_to_execute); } else { - TheCPU->EmulateLine(cycles); + TheCPU->EmulateLine(cpu_cycles_to_execute); } } else { // 1541 processor disabled, only emulate 6510 - TheCPU->EmulateLine(cycles); + TheCPU->EmulateLine(cpu_cycles_to_execute); } linecnt++; diff --git a/arm9/source/C64.h b/arm9/source/C64.h index 817920b..24c82a8 100644 --- a/arm9/source/C64.h +++ b/arm9/source/C64.h @@ -30,6 +30,11 @@ const int CHAR_ROM_SIZE = 0x1000; const int DRIVE_RAM_SIZE = 0x800; const int DRIVE_ROM_SIZE = 0x4000; +#define SID_CYCLES_PER_LINE 63 +#define CIA_CYCLES_PER_LINE 63 +#define BAD_CYCLES_PER_LINE 23 +#define FLOPPY_CYCLES_PER_LINE 64 + class Prefs; class C64Display; class MOS6510; diff --git a/arm9/source/CIA.h b/arm9/source/CIA.h index 6a4a710..6bfa613 100644 --- a/arm9/source/CIA.h +++ b/arm9/source/CIA.h @@ -116,9 +116,10 @@ public: uint8 IECLines; // State of IEC lines (bit 7 - DATA, bit 6 - CLK, bit 4 - ATN) private: + void write_pa(uint8_t byte); + MOS6569 *the_vic; MOS6502_1541 *the_cpu_1541; - void write_pa(uint8_t byte); }; diff --git a/arm9/source/CPUC64.h b/arm9/source/CPUC64.h index 208246c..cf70447 100644 --- a/arm9/source/CPUC64.h +++ b/arm9/source/CPUC64.h @@ -46,11 +46,6 @@ #define PRECISE_CPU_CYCLES 0 #endif -// Set this to 1 for instruction-aligned CIA emulation -#ifndef PRECISE_CIA_CYCLES -#define PRECISE_CIA_CYCLES 0 -#endif - // Interrupt types enum { diff --git a/arm9/source/CPU_emulline.h b/arm9/source/CPU_emulline.h index 2502dd2..a0ff02e 100644 --- a/arm9/source/CPU_emulline.h +++ b/arm9/source/CPU_emulline.h @@ -128,34 +128,23 @@ #define ENDOP(cyc) last_cycles = cyc; break; -#ifndef IS_CPU_1541 +#ifndef IS_CPU_1541 // If main C64 CPU we handle borrowed cycles // Main opcode fetch/execute loop -#if PRECISE_CPU_CYCLES if (cycles_left) cycles_left -= borrowed_cycles; while (true) { -#if PRECISE_CIA_CYCLES && !defined(IS_CPU_1541) - if (last_cycles) { - TheCIA1->EmulateLine(last_cycles); - TheCIA2->EmulateLine(last_cycles); - } -#endif - if ((cycles_left -= last_cycles) < 0) { + if ((cycles_left -= last_cycles) < 0) + { borrowed_cycles = -cycles_left; break; } -#else - while ((cycles_left -= last_cycles) >= 0) { -#endif - -#else +#else // CPU is 1541 cpu_cycles += CycleDeltas[myConfig.cpuCycles]; MOS6510 *localCPU = the_c64->TheCPU; while ((cycles_left -= last_cycles) >= 0) { - cycle_counter += last_cycles; // Needed for GCR timing // If we are 1541CPU, we want to alternate running instructions with the main CPU ... while (cpu_cycles > cycles_left) cpu_cycles -= localCPU->EmulateLine(0); #endif @@ -1381,8 +1370,12 @@ // Extension opcode case 0xf2: ext_opcode(); break; } + +#ifdef IS_CPU_1541 + cycle_counter += last_cycles; // Needed for GCR timing +#endif } #ifdef IS_CPU_1541 // See if there are any straggler cycles left for the CPU - while (cpu_cycles > 0) cpu_cycles -= the_c64->TheCPU->EmulateLine(1); + while (cpu_cycles > 0) cpu_cycles -= the_c64->TheCPU->EmulateLine(0); #endif diff --git a/arm9/source/Display.cpp b/arm9/source/Display.cpp index eabd9be..bec7d67 100644 --- a/arm9/source/Display.cpp +++ b/arm9/source/Display.cpp @@ -162,7 +162,7 @@ void C64Display::UpdateLEDs(int l0, int l1) #define RET '\n' // Enter #define BSP 0x08 // Backspace #define CTL 0x21 // Ctrl -#define SPC 0x20// Space +#define SPC 0x20 // Space #define ATT 0x22 // At@ #define UPA 0x23 //uparrow symbol #define RUN 0x00 // RunStop @@ -602,7 +602,7 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst else if (tilex < 194) c = '0'; else if (tilex < 213) c = '+'; else if (tilex < 233) c = '-'; - else if (tilex < 256) c = UPA; + else if (tilex < 256) c = PND; } else if (tiley < 104) // QWERTY Row { diff --git a/arm9/source/SID.h b/arm9/source/SID.h index c434c60..0a9ba6c 100644 --- a/arm9/source/SID.h +++ b/arm9/source/SID.h @@ -40,9 +40,6 @@ #include #include - -#define SID_CYCLES_PER_LINE 63 - extern uint8 regs[32]; extern uint8 last_sid_byte; extern int16_t EGDivTable[16]; // Clock divisors for A/D/R settings diff --git a/arm9/source/VIC.cpp b/arm9/source/VIC.cpp index 692b006..e7dc015 100644 --- a/arm9/source/VIC.cpp +++ b/arm9/source/VIC.cpp @@ -1464,7 +1464,7 @@ int MOS6569::EmulateLine(void) { if (raster >= FIRST_DMA_LINE && raster <= LAST_DMA_LINE && ((raster & 7) == y_scroll) && bad_lines_enabled) { is_bad_line = true; - cycles_left = 23 + CycleDeltas[myConfig.badCycles]; + cycles_left = BAD_CYCLES_PER_LINE; } goto VIC_nop; } @@ -1485,7 +1485,7 @@ int MOS6569::EmulateLine(void) { // Turn on display display_state = is_bad_line = true; - cycles_left = 23 + CycleDeltas[myConfig.badCycles]; + cycles_left = BAD_CYCLES_PER_LINE; rc = 0; // Read and latch 40 bytes from video matrix and color RAM diff --git a/arm9/source/mainmenu.cpp b/arm9/source/mainmenu.cpp index 2faf55f..8957bb9 100644 --- a/arm9/source/mainmenu.cpp +++ b/arm9/source/mainmenu.cpp @@ -370,7 +370,7 @@ void SetDefaultGameConfig(void) myConfig.reserved7 = 0; myConfig.reserved8 = 0xA5; // So it's easy to spot on an "upgrade" and we can re-default it myConfig.cpuCycles = 0; // Normal 63 - this is the delta adjustment to that - myConfig.badCycles = 0; // Normal 23 - this is the delta adjustment to that + myConfig.flopCycles = 0; // Normal 64 - this is the delta adjustment to that myConfig.offsetX = 32; // Push the side border off the main display myConfig.offsetY = 19; // Push the top border off the main display @@ -378,7 +378,7 @@ void SetDefaultGameConfig(void) myConfig.scaleY = 200; // Scale the 200 pixels of C64 display to the DS 200 (yes, there is only 192 so this will cut... use PAN UP/DN) } -s16 CycleDeltas[] = {0,1,2,3,4,5,6,7,8,9,-9,-8,-7,-6,-5,-4,-3,-2,-1}; // Used with myConfig.cpuCycles and myConfig.badCycles +s16 CycleDeltas[] = {0,1,2,3,4,5,6,7,8,9,-9,-8,-7,-6,-5,-4,-3,-2,-1}; // Used with myConfig.cpuCycles and myConfig.flopCycles // ---------------------------------------------------------------------- // Read file twice and ensure we get the same CRC... if not, do it again @@ -575,7 +575,7 @@ const struct options_t Option_Table[1][20] = {"LCD JITTER", {"NONE", "LIGHT", "HEAVY"}, &myConfig.jitter, 3}, {"DISK SOUND", {"SFX OFF", "SFX ON"}, &myConfig.diskSFX, 2}, {"CPU CYCLES", {CYCLE_DELTA_STR}, &myConfig.cpuCycles, 19}, - {"BAD CYCLES", {CYCLE_DELTA_STR}, &myConfig.badCycles, 19}, + {"1541 CYCLES", {CYCLE_DELTA_STR}, &myConfig.flopCycles, 19}, {"D-PAD UP", {KEY_MAP_OPTIONS}, &myConfig.key_map[0], 64}, {"D-PAD DOWN", {KEY_MAP_OPTIONS}, &myConfig.key_map[1], 64}, diff --git a/arm9/source/mainmenu.h b/arm9/source/mainmenu.h index a1a107a..a06c4c3 100644 --- a/arm9/source/mainmenu.h +++ b/arm9/source/mainmenu.h @@ -21,7 +21,7 @@ struct __attribute__((__packed__)) Config_t u8 reserved7; u8 reserved8; u8 cpuCycles; - u8 badCycles; + u8 flopCycles; s8 offsetX; s8 offsetY; s16 scaleX;