Version 0.9d with improved Cartridge handling and other minor cleanups.

This commit is contained in:
Dave Bernazzani 2025-05-06 08:01:24 -04:00
parent 355c858dcc
commit 77799f4952
13 changed files with 73 additions and 48 deletions

Binary file not shown.

View File

@ -9,7 +9,7 @@ include $(DEVKITARM)/ds_rules
export TARGET := GimliDS
export TOPDIR := $(CURDIR)
export VERSION := 0.9c
export VERSION := 0.9d
ICON := -b $(CURDIR)/C64_icon.bmp "GimliDS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/GimliDS"

View File

@ -124,11 +124,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
```
## Change Log
Version 0.9b release 05-May-2025 by wavemotion-dave
Version 0.9d release 06-May-2025 by wavemotion-dave
* Added ability to remap the British Pound (£) symbol to one of the other rare missing keys (left arrow, up arrow, C=)
* Fix for CPU jump commands not handling the extra cycle it takes.
* All carts insertions do a proper reset so that we don't lock up when switching carts.
* Minor cartridge accuracy improvements - new LED added to cart icon for EasyFlash loading.
Version 0.9b/c release 05-May-2025 by wavemotion-dave
* Pressing L+R shoulder buttons together is WARP mode (run emulator fast while the buttons are held)
* Improved L/R + DPAD scale/offset (so it doesn't also produce joystick input at the same time)
* Minor tweaks to TrueDrive mode for improved cycle accuracy
* CRT and PRG Cartridge support. Most popular game-based formats are supported. Use the new CART icon.
* 0.9c hot-fix release fixes the Cartridge Menu graphic and adds a bit more speed for the DS-Lite.
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').

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -218,6 +218,10 @@ void C64::NMI(void)
TheCPU->AsyncNMI();
}
/*
* Load PRG file directly into memory
*/
void C64::LoadPRG(char *filename)
{
FILE *fp = fopen(filename, "rb");
@ -775,14 +779,6 @@ bool C64::LoadSnapshot(char *filename)
#include "Prefs.h"
#include "main.h"
extern "C" {
//#include "menu.h"
//#include "ui.h"
//#include "input.h"
//#include "gpmisc.h"
}
#include <nds.h>
#include "nds/arm9/console.h"
#include <stdio.h>
@ -921,8 +917,6 @@ ITCM_CODE void C64::VBlank(bool draw_frame)
while (GetTicks() < (((unsigned int)TICKS_PER_SEC/(unsigned int)50) * (unsigned int)frames))
{
if (bTurboWarp) break;
asm("nop");
//break; // Uncomment this for full speed...
}
frames_per_sec++;

View File

@ -88,7 +88,7 @@
#if PRECISE_CPU_CYCLES
// Account for cyles due to crossing page boundaries
#define page_plus(exp, reg) \
(adr = exp, last_cycles -= (((adr & 0xff) + reg) & 0x100 ? 1:0), adr + reg)
(adr = exp, /*last_cycles -= (((adr & 0xff) + reg) & 0x100 ? 1:0),*/ adr + reg) // TODO: Fix last_cycles here...
// Read absolute x-indexed operand
#define read_byte_abs_x() read_byte(page_plus(read_adr_abs(), x))

View File

@ -44,6 +44,8 @@
#include <filesystem>
namespace fs = std::filesystem;
u8 cart_led = 0; // Used to briefly 'light up' the cart icon for Easy Flash 'disk' access
extern uint8 *MemMap[0x10];
extern u8 myRAM[];
extern u8 myBASIC[];
@ -52,13 +54,13 @@ extern u8 myKERNAL[];
u8 cartROM[1024*1024]; // 1MB max supported cart size (not including .crt and chip headers)
extern C64 *gTheC64; // Easy access to the main C64 object
// Base class for cartridge with ROM
ROMCartridge::ROMCartridge(unsigned num_banks, unsigned bank_size) : numBanks(num_banks), bankSize(bank_size)
{
// We always re-use the same 1MB cart ROM buffer...
rom = cartROM;
memset(rom, 0xff, num_banks * bank_size);
cart_led = 0;
}
ROMCartridge::~ROMCartridge()
@ -310,7 +312,7 @@ void CartridgeC64GS::MapThyself(void)
uint8_t CartridgeC64GS::ReadIO1(uint16_t adr, uint8_t bus_byte)
{
notEXROM = true; // Disable ROM
bank = 0;
MapThyself();
return bus_byte;
}
@ -408,6 +410,7 @@ void CartridgeEasyFlash::WriteIO1(uint16_t adr, uint8_t byte)
{
notEXROM = (byte & 2) ? false:true;
notGAME = (byte & 4) ? ((byte & 1) ? false:true) : false;
if (byte & 0x80) cart_led=2;
}
MapThyself();
}

View File

@ -158,20 +158,18 @@ void C64Display::UpdateLEDs(int l0, int l1)
#define LFA 0x095 // Left arrow
#define CLR 0x147 // Home/clear
#define PND 0x92
#define PND 0x92 // Pound
#define RST 0x13 // Restore
#define RET '\n' // Enter
#define BSP 0x08 // Backspace
#define CTL 0x21 // Ctrl
#define SPC 0x20 // Space
#define ATT 0x22 // At@
#define UPA 0x23 //uparrow symbol
#define UPA 0x23 // UP arrow symbol
#define RUN 0x00 // RunStop
#define SLK 0x25 // Shift Lock
#define CMD 0x26 // Commodore key
#define SHF 0x27 // Shift Key
#define CUP 0x14 // Cursor up
#define CDL 0x15 // Cursor left
@ -375,10 +373,9 @@ __attribute__ ((noinline)) ITCM_CODE void C64Display::UpdateRasterLine(int raste
// Output the raster line to the LCD...
u32 *dest = (uint32*)((u32)0x06000000 + (512*(raster-FIRST_DISP_LINE)));
u32 *source = (u32*) src;
for (int i=0; i<(DISPLAY_X-0x10)/8; i++)
for (int i=0; i<(DISPLAY_X-0x14)/4; i++)
{
*dest++ = *source++;
*dest++ = *source++;
}
}
@ -442,6 +439,17 @@ void show_cartstatus(void)
{
DSPrint(21, 23, 2, (char*)"012");
}
extern u8 cart_led;
if (cart_led)
{
DSPrint(22, 21, 2, (char*)"3");
cart_led--;
}
else
{
DSPrint(22, 21, 6, (char*)" ");
}
}
void show_shift_key(void)
@ -731,7 +739,8 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
if (reload == 1) // load cart THEN reset
{
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
bDelayLoadCRT = 3; // 3 frames and load the CRT file
TheC64->Reset();
bDelayLoadCRT = 5; // 5 frames and load the CRT file
}
else // reload is 2 - PRG file reset FIRST
{
@ -822,6 +831,7 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
}
else
{
u8 left_arrow = 0;
if(c!=0x0)
{
switch (c)
@ -884,7 +894,12 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
case CLR: c64_key = MATRIX(6,3); break;
case LFA: c64_key = MATRIX(7,1); break;
case UPA: c64_key = MATRIX(6,6); break;
case PND: c64_key = MATRIX(6,0); break;
case PND:
if (myConfig.poundKey == 0) c64_key = MATRIX(6,0); // Pound
if (myConfig.poundKey == 1) c64_key = MATRIX(7,1); // Right Arrow
if (myConfig.poundKey == 2) c64_key = MATRIX(0,7); // Up Arrow
if (myConfig.poundKey == 3) c64_key = MATRIX(7,5); // Commodore Command
break;
case CMD: c64_key = MATRIX(7,5); break;
case CUP: c64_key = MATRIX(0,7); break;
@ -906,6 +921,11 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
}
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
if (left_arrow)
{
KeyPress(MATRIX(7,1) | 0x80, key_matrix, rev_matrix);
}
}
}
}

View File

@ -855,7 +855,7 @@ inline void MOS6569::vblank(void)
frame_skipped = (total_frames & 1); // Skip every other...
if (frame_skipped)
{
if ((total_frames % 5) == 0) frame_skipped = 0; // But every so often toss in an odd frame
if ((total_frames % 3) == 0) frame_skipped = 0; // But every so often toss in an odd frame
}
}
@ -952,7 +952,7 @@ __attribute__ ((noinline)) ITCM_CODE void MOS6569::el_std_bitmap(uint8 *p, uint
}
void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
__attribute__ ((noinline)) ITCM_CODE void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
{
uint16 lookup[4];
uint32 *wp = (uint32 *)p;
@ -991,7 +991,7 @@ void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
}
void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
__attribute__ ((noinline)) ITCM_CODE void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
{
uint32 *lp = (uint32 *)p;
uint8 *cp = color_line;
@ -1213,7 +1213,6 @@ __attribute__ ((noinline)) ITCM_CODE void MOS6569::el_sprites(uint8 *chunky_ptr
}
}
}
}
else // Unexpanded
{
@ -1680,8 +1679,7 @@ int MOS6569::EmulateLine(void)
if (raster >= FIRST_DMA_LINE-1 && raster <= LAST_DMA_LINE-1 && (((raster+1) & 7) == y_scroll) && bad_lines_enabled)
rc = 0;
// Not end of screen... output the next scanline as it will be 'stale' and not cached...
// This also helps with tearing as we'll be outputting the 'stale' (last frame) line while the new frame is drawing.
// Not end of screen... output scanline we just rendered directly to the NDS LCD Screen buffer...
if (!frame_skipped)
{
if (!bSkipDraw)
@ -1694,7 +1692,9 @@ int MOS6569::EmulateLine(void)
VIC_nop:
// Skip this if all sprites are off
if (me | sprite_on)
{
cycles_left -= el_update_mc(raster);
}
return cycles_left;
}

View File

@ -576,7 +576,7 @@ DiskMenu_t disk_menu =
DiskMenu_t cart_menu =
{
(char *)" ", 12,
(char *)" ", 11,
{
{(char *)" INSERT CARTRIDGE ", MENU_ACTION_INSERT_CART},
{(char *)" REMOVE CARTRIDGE ", MENU_ACTION_REMOVE_CART},

View File

@ -72,7 +72,6 @@ MainMenu_t main_menu =
{(char *)" SAVE STATE ", MENU_ACTION_SAVE_STATE},
{(char *)" LOAD STATE ", MENU_ACTION_LOAD_STATE},
{(char *)" RESET C64 ", MENU_ACTION_RESET_EMU},
{(char *)" PRESS @ KEY ", MENU_ACTION_PRESS_C64},
{(char *)" QUIT GIMLIDS", MENU_ACTION_QUIT_EMU},
{(char *)" EXIT MENU ", MENU_ACTION_EXIT},
{(char *)" NULL ", MENU_ACTION_END},
@ -379,7 +378,7 @@ void SetDefaultGameConfig(void)
myConfig.diskSFX = 1; // Disk sound effects on
myConfig.joyPort = 0; // Default to Joy1
myConfig.joyMode = 0; // Default is normal joypad / dpad
myConfig.reserved2 = 0;
myConfig.poundKey = 0; // Default is Pound Key!
myConfig.reserved3 = 0;
myConfig.reserved4 = 0;
myConfig.reserved5 = 0;
@ -593,6 +592,7 @@ const struct options_t Option_Table[1][20] =
{"DISK SOUND", {"SFX OFF", "SFX ON"}, &myConfig.diskSFX, 2},
{"CPU CYCLES", {CYCLE_DELTA_STR}, &myConfig.cpuCycles, 19},
{"1541 CYCLES", {CYCLE_DELTA_STR}, &myConfig.flopCycles, 19},
{"POUND KEY", {"POUND", "LEFT ARROW", "UP ARROW", "C= COMMODORE"}, &myConfig.poundKey, 4},
{"D-PAD UP", {KEY_MAP_OPTIONS}, &myConfig.key_map[0], 64},
{"D-PAD DOWN", {KEY_MAP_OPTIONS}, &myConfig.key_map[1], 64},
@ -604,6 +604,7 @@ const struct options_t Option_Table[1][20] =
{"X BUTTON", {KEY_MAP_OPTIONS}, &myConfig.key_map[6], 64},
{"Y BUTTON", {KEY_MAP_OPTIONS}, &myConfig.key_map[7], 64},
{NULL, {"", ""}, NULL, 1},
}
};

View File

@ -13,7 +13,7 @@ struct __attribute__((__packed__)) Config_t
u8 diskSFX;
u8 joyPort;
u8 joyMode;
u8 reserved2;
u8 poundKey;
u8 reserved3;
u8 reserved4;
u8 reserved5;