diff --git a/GimliDS.nds b/GimliDS.nds index 7e10ab4..451018b 100644 Binary files a/GimliDS.nds and b/GimliDS.nds differ diff --git a/Makefile b/Makefile index cdf3afe..1eaa77c 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ include $(DEVKITARM)/ds_rules export TARGET := GimliDS export TOPDIR := $(CURDIR) -export VERSION := 1.2a +export VERSION := 1.3 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 cc82df1..780cd47 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ``` ## Change Log +Version 1.3 release 18-May-2025 by wavemotion-dave + * New global options with a number of new configurations (dim screen, default buttons, etc). + * Added ability to swap LCD screens on the main Commodore menu. + * Slight extension of vertical pixel resolution for some games that utilize more raster lines (Gaplus, etc). + * Minor cleanup and refactor under the hood for improved maintainability and slight performance tweaks. + Version 1.2 release 16-May-2025 by wavemotion-dave * Added new DIAGONALS joystick mode for a few Q-Bert clones. * Slide-n-Glide joystick mode made more responsive. diff --git a/arm9/gfx_data/intro.png b/arm9/gfx_data/intro.png index 768d077..539dd58 100644 Binary files a/arm9/gfx_data/intro.png and b/arm9/gfx_data/intro.png differ diff --git a/arm9/source/1541d64.cpp b/arm9/source/1541d64.cpp index 3823832..e9b9b46 100644 --- a/arm9/source/1541d64.cpp +++ b/arm9/source/1541d64.cpp @@ -32,6 +32,7 @@ #include "Prefs.h" #include "C64.h" #include "main.h" +#include "printf.h" // Channel modes (IRC users listen up :-) enum { diff --git a/arm9/source/C64.cpp b/arm9/source/C64.cpp index 1c76184..6d99b6f 100644 --- a/arm9/source/C64.cpp +++ b/arm9/source/C64.cpp @@ -53,6 +53,7 @@ #include "lzav.h" #include #include "soundbank.h" +#include "printf.h" // Slight speed improvement to have these in global memory where the address is fixed at linker time uint8 myRAM[C64_RAM_SIZE]; @@ -77,7 +78,6 @@ u8 CompressBuffer[300*1024]; //300K more than enough (might need to compress RDU */ C64::C64() { - quit_thyself = false; have_a_break = false; gTheC64 = this; @@ -932,7 +932,6 @@ void C64::Run(void) orig_kernal_1d85 = Kernal[0x1d85]; PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive); - quit_thyself = false; main_loop(); } @@ -1000,7 +999,7 @@ ITCM_CODE void C64::VBlank(bool draw_frame) if (DSIvBlanks >= 60) { DSIvBlanks = 0; - TheDisplay->Speedometer((int)frames_per_sec); + TheDisplay->DisplayStatusLine((int)frames_per_sec); frames_per_sec = 0; } @@ -1343,7 +1342,7 @@ void C64::RemoveCart(void) void C64::main_loop(void) { - while (!quit_thyself) + while (true) { if(have_a_break) { diff --git a/arm9/source/C64.h b/arm9/source/C64.h index 76767e6..56ee800 100644 --- a/arm9/source/C64.h +++ b/arm9/source/C64.h @@ -119,7 +119,6 @@ private: uint8 poll_joystick(int port); void main_loop(void); - bool quit_thyself; // Emulation thread shall quit bool have_a_break; // Emulation thread shall pause uint8 joykey; // Joystick keyboard emulation mask value diff --git a/arm9/source/CPU1541.cpp b/arm9/source/CPU1541.cpp index 0c517b4..f7b356f 100644 --- a/arm9/source/CPU1541.cpp +++ b/arm9/source/CPU1541.cpp @@ -98,6 +98,7 @@ #include "CIA.h" #include "Display.h" #include "mainmenu.h" +#include "printf.h" extern uint8 myRAM1541[DRIVE_RAM_SIZE]; @@ -665,10 +666,9 @@ void MOS6502_1541::Reset(void) * Illegal opcode encountered */ +static char illop_msg[80]; void MOS6502_1541::illegal_op(uint8 op, uint16 at) { - char illop_msg[80]; - sprintf(illop_msg, "1541: Illegal opcode %02x at %04x.", op, at); if (ShowRequester(illop_msg, "Reset 1541", "Reset C64")) the_c64->Reset(); diff --git a/arm9/source/CPUC64.cpp b/arm9/source/CPUC64.cpp index d4ba054..20a5022 100644 --- a/arm9/source/CPUC64.cpp +++ b/arm9/source/CPUC64.cpp @@ -79,6 +79,7 @@ #include "Display.h" #include "Cartridge.h" #include "mainmenu.h" +#include "printf.h" enum { diff --git a/arm9/source/CPU_emulline.h b/arm9/source/CPU_emulline.h index cfc2863..13c5ea4 100644 --- a/arm9/source/CPU_emulline.h +++ b/arm9/source/CPU_emulline.h @@ -130,14 +130,14 @@ #ifndef IS_CPU_1541 // If main C64 CPU we handle borrowed cycles // Main opcode fetch/execute loop - if (cycles_left != 1) cycles_left -= borrowed_cycles; + if (cycles_left != 1) cycles_left += borrowed_cycles; while (true) { if (page_plus_cyc) {last_cycles++; page_plus_cyc=0;} if ((cycles_left -= last_cycles) <= 0) { - borrowed_cycles = -cycles_left; + borrowed_cycles = cycles_left; break; } #else // CPU is 1541 diff --git a/arm9/source/Cartridge.cpp b/arm9/source/Cartridge.cpp index f4e9775..0eed87f 100644 --- a/arm9/source/Cartridge.cpp +++ b/arm9/source/Cartridge.cpp @@ -40,7 +40,7 @@ #include "C64.h" #include "CPUC64.h" #include "Cartridge.h" - +#include "printf.h" #include namespace fs = std::filesystem; diff --git a/arm9/source/Display.cpp b/arm9/source/Display.cpp index 7f2ec6b..50e71e9 100644 --- a/arm9/source/Display.cpp +++ b/arm9/source/Display.cpp @@ -46,6 +46,7 @@ #include "mainmenu.h" #include #include "soundbank.h" +#include "printf.h" u8 floppy_sound_counter __attribute__((section(".dtcm"))) = 0; u8 bDebugDisplay __attribute__((section(".dtcm"))) = 0; @@ -228,7 +229,7 @@ void ShowKeyboard(void) /* - * Display constructor: Draw Speedometer/LEDs in window + * Display constructor */ C64Display::C64Display(C64 *the_c64) : TheC64(the_c64) @@ -410,7 +411,7 @@ int init_graphics(void) irqSet(IRQ_VBLANK, vblankDS); irqEnable(IRQ_VBLANK); - return TRUE; + return TRUE; } @@ -429,11 +430,6 @@ __attribute__ ((noinline)) ITCM_CODE void C64Display::UpdateRasterLine(int raste } } - -/* - * Draw speedometer - */ - //***************************************************************************** // Displays a message on the screen //***************************************************************************** @@ -536,7 +532,7 @@ int getMemFree() { // returns the amount of free memory in bytes int i = 0; int debug[16]={0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0}; -void C64Display::Speedometer(int speed) +void C64Display::DisplayStatusLine(int speed) { char tmp[34]; diff --git a/arm9/source/Display.h b/arm9/source/Display.h index 043e764..916b5dc 100644 --- a/arm9/source/Display.h +++ b/arm9/source/Display.h @@ -53,7 +53,7 @@ public: ~C64Display(); void UpdateRasterLine(int raster, u8 *src); void UpdateLEDs(int l0, int l1); - void Speedometer(int speed); + void DisplayStatusLine(int speed); void KeyPress(int key, uint8 *key_matrix, uint8 *rev_matrix); void KeyRelease(int key, uint8 *key_matrix, uint8 *rev_matrix); void PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick); diff --git a/arm9/source/IEC.cpp b/arm9/source/IEC.cpp index 749f6a0..c830b6a 100644 --- a/arm9/source/IEC.cpp +++ b/arm9/source/IEC.cpp @@ -64,6 +64,7 @@ #include "Prefs.h" #include "Display.h" #include "main.h" +#include "printf.h" // IEC command codes enum { diff --git a/arm9/source/VIC.cpp b/arm9/source/VIC.cpp index 3ba42c8..1f2cb46 100644 --- a/arm9/source/VIC.cpp +++ b/arm9/source/VIC.cpp @@ -82,25 +82,6 @@ #include "Prefs.h" #include "CIA.h" -// First and last displayed line -const unsigned FIRST_DISP_LINE = 0x20; -const unsigned LAST_DISP_LINE = 0x114; - -// First and last possible line for Bad Lines -const unsigned FIRST_DMA_LINE = 0x30; -const unsigned LAST_DMA_LINE = 0xf7; - -// Display window coordinates -const int ROW25_YSTART = 0x33; -const int ROW25_YSTOP = 0xfb; -const int ROW24_YSTART = 0x37; -const int ROW24_YSTOP = 0xf7; - -const int COL40_XSTART = 0x20; -const int COL40_XSTOP = 0x160; -const int COL38_XSTART = 0x27; -const int COL38_XSTOP = 0x157; - uint8 fast_line_buffer[512] __attribute__((section(".dtcm"))) = {0}; // Tables for sprite X expansion @@ -1496,12 +1477,10 @@ int MOS6569::EmulateLine(void) uint8 *r = fore_mask_buf + COL40_XSTART/8; // Pointer in foreground mask buffer if (x_scroll) { - p--; uint8 b0cc = b0c_color; int limit = x_scroll; for (int i=0; i0 - *++p = b0cc; - p++; + *p++ = b0cc; } if (display_state) diff --git a/arm9/source/VIC.h b/arm9/source/VIC.h index 4214510..0426392 100644 --- a/arm9/source/VIC.h +++ b/arm9/source/VIC.h @@ -39,14 +39,30 @@ #define _VIC_H #include -extern const unsigned FIRST_DISP_LINE; - // Total number of raster lines (PAL) -const unsigned TOTAL_RASTERS = 0x138; +#define TOTAL_RASTERS 0x138 // Screen refresh frequency (PAL) -const unsigned SCREEN_FREQ = 50; +#define SCREEN_FREQ 50 +// First and last displayed line +#define FIRST_DISP_LINE 0x20 +#define LAST_DISP_LINE 0x114 + +// First and last possible line for Bad Lines +#define FIRST_DMA_LINE 0x30 +#define LAST_DMA_LINE 0xf7 + +// Display window coordinates +#define ROW25_YSTART 0x33 +#define ROW25_YSTOP 0xfb +#define ROW24_YSTART 0x37 +#define ROW24_YSTOP 0xf7 + +#define COL40_XSTART 0x20 +#define COL40_XSTOP 0x160 +#define COL38_XSTART 0x27 +#define COL38_XSTOP 0x157 class MOS6510; class C64Display; diff --git a/arm9/source/diskmenu.cpp b/arm9/source/diskmenu.cpp index f899f0f..29fd72c 100644 --- a/arm9/source/diskmenu.cpp +++ b/arm9/source/diskmenu.cpp @@ -35,6 +35,7 @@ #include "cartmenu_bg.h" #include "Prefs.h" #include "C64.h" +#include "printf.h" char Drive8File[MAX_FILENAME_LEN]; char Drive9File[MAX_FILENAME_LEN]; diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index b0b0ee2..4de9994 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -44,6 +44,7 @@ #include "mainmenu.h" #include "intro.h" +#include "printf.h" #include #include #include diff --git a/arm9/source/mainmenu.cpp b/arm9/source/mainmenu.cpp index a409a2b..cd827af 100644 --- a/arm9/source/mainmenu.cpp +++ b/arm9/source/mainmenu.cpp @@ -32,6 +32,7 @@ #include "mainmenu_bg.h" #include "Prefs.h" #include "Display.h" +#include "printf.h" extern C64 *TheC64; extern int bg0b, bg1b; diff --git a/arm9/source/sysdeps.h b/arm9/source/sysdeps.h index 0bba837..8d05c1b 100644 --- a/arm9/source/sysdeps.h +++ b/arm9/source/sysdeps.h @@ -116,3 +116,4 @@ using std::vector; #include #include +