Version 0.9c with improved Cartridge option background graphic and added speed for the DS-Lite/Phat.

This commit is contained in:
Dave Bernazzani 2025-05-05 12:17:57 -04:00
parent 3720990aa2
commit 355c858dcc
9 changed files with 88 additions and 25 deletions

Binary file not shown.

View File

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

View File

@ -67,7 +67,7 @@ SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png))) PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
OSPECIALS := keyboard.o mainmenu_bg.o diskmenu_bg.o intro.o OSPECIALS := keyboard.o mainmenu_bg.o diskmenu_bg.o cartmenu_bg.o intro.o
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C # use CXX for linking C++ projects, CC for standard C
@ -138,6 +138,9 @@ mainmenu_bg.s mainmenu_bg.h : mainmenu_bg.png
diskmenu_bg.s diskmenu_bg.h : diskmenu_bg.png diskmenu_bg.s diskmenu_bg.h : diskmenu_bg.png
grit $^ -o $@ -gt -mrt -mR8 -mLs -gzl -mzl grit $^ -o $@ -gt -mrt -mR8 -mLs -gzl -mzl
cartmenu_bg.s cartmenu_bg.h : cartmenu_bg.png
grit $^ -o $@ -gt -mrt -mR8 -mLs -gzl -mzl
intro.s intro.h : intro.png intro.s intro.h : intro.png
grit $^ -o $@ -gt -mrt -mR8 -mLs -gzl -mzl grit $^ -o $@ -gt -mrt -mR8 -mLs -gzl -mzl

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,3 +1,20 @@
// =====================================================================================
// GimliDS Copyright (c) 2025 Dave Bernazzani (wavemotion-dave)
//
// As GimliDS is a port of the Frodo emulator for the DS/DSi/XL/LL handhelds,
// any copying or distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted per the original
// Frodo emulator license shown below. Hugest thanks to Christian Bauer for his
// efforts to provide a clean open-source emulation base for the C64.
//
// Numerous hacks and 'unsafe' optimizations have been performed on the original
// Frodo emulator codebase to get it running on the small handheld system. You
// are strongly encouraged to seek out the official Frodo sources if you're at
// all interested in this emulator code.
//
// The GimliDS emulator is offered as-is, without any warranty. Please see readme.md
// =====================================================================================
/* /*
* Cartridge.cpp - Cartridge emulation * Cartridge.cpp - Cartridge emulation
* *
@ -33,13 +50,13 @@ extern u8 myBASIC[];
extern u8 myKERNAL[]; extern u8 myKERNAL[];
u8 cartROM[1024*1024]; // 1MB max supported cart size (not including .crt and chip headers) u8 cartROM[1024*1024]; // 1MB max supported cart size (not including .crt and chip headers)
extern C64 *gTheC64; extern C64 *gTheC64; // Easy access to the main C64 object
// Base class for cartridge with ROM // Base class for cartridge with ROM
ROMCartridge::ROMCartridge(unsigned num_banks, unsigned bank_size) : numBanks(num_banks), bankSize(bank_size) ROMCartridge::ROMCartridge(unsigned num_banks, unsigned bank_size) : numBanks(num_banks), bankSize(bank_size)
{ {
// Allocate ROM // We always re-use the same 1MB cart ROM buffer...
rom = cartROM; rom = cartROM;
memset(rom, 0xff, num_banks * bank_size); memset(rom, 0xff, num_banks * bank_size);
} }
@ -334,7 +351,7 @@ uint8_t CartridgeDinamic::ReadIO1(uint16_t adr, uint8_t bus_byte)
// Magic Desk / Marina64 cartridge (banked 8K ROM cartridge) // Magic Desk / Marina64 cartridge (banked 8K ROM cartridge)
CartridgeMagicDesk::CartridgeMagicDesk() : ROMCartridge(128, 0x2000) CartridgeMagicDesk::CartridgeMagicDesk() : ROMCartridge(128, 0x2000)
{ {
bTrueDriveRequired = true; bTrueDriveRequired = true; // Magic Desk won't load properly without the true drive infrastructure
notEXROM = false; notEXROM = false;
bank = 0; bank = 0;

View File

@ -1,3 +1,20 @@
// =====================================================================================
// GimliDS Copyright (c) 2025 Dave Bernazzani (wavemotion-dave)
//
// As GimliDS is a port of the Frodo emulator for the DS/DSi/XL/LL handhelds,
// any copying or distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted per the original
// Frodo emulator license shown below. Hugest thanks to Christian Bauer for his
// efforts to provide a clean open-source emulation base for the C64.
//
// Numerous hacks and 'unsafe' optimizations have been performed on the original
// Frodo emulator codebase to get it running on the small handheld system. You
// are strongly encouraged to seek out the official Frodo sources if you're at
// all interested in this emulator code.
//
// The GimliDS emulator is offered as-is, without any warranty. Please see readme.md
// =====================================================================================
/* /*
* Cartridge.h - Cartridge emulation * Cartridge.h - Cartridge emulation
* *
@ -29,7 +46,7 @@ struct CartridgeState {
u8 notEXROM; u8 notEXROM;
u8 notGAME; u8 notGAME;
u8 bank; u8 bank;
uint8_t ram[256]; uint8_t ram[256];
}; };
@ -45,7 +62,7 @@ public:
static Cartridge * FromFile(char *filename, char *errBuffer); static Cartridge * FromFile(char *filename, char *errBuffer);
virtual void Reset() { } virtual void Reset() { }
bool isTrueDriveRequired(void); bool isTrueDriveRequired(void);
// Map cart into the CPU memory map... // Map cart into the CPU memory map...

View File

@ -48,8 +48,8 @@
#include "soundbank.h" #include "soundbank.h"
u8 floppy_sound_counter = 0; u8 floppy_sound_counter __attribute__((section(".dtcm"))) = 0;
u8 bDebugDisplay = 0; u8 bDebugDisplay __attribute__((section(".dtcm"))) = 0;
// "Colodore" palette // "Colodore" palette
uint8_t palette_red[16] = { uint8_t palette_red[16] = {
@ -256,13 +256,11 @@ void C64Display::NewPrefs(Prefs *prefs)
floppy_sound_counter = 50; // One seconds of no floppy sound... floppy_sound_counter = 50; // One seconds of no floppy sound...
} }
uint8* frontBuffer; u8 JITTER[] __attribute__((section(".dtcm"))) = {0, 64, 128};
s16 temp_offset __attribute__((section(".dtcm"))) = 0;
u8 JITTER[] = {0, 64, 128}; u16 slide_dampen __attribute__((section(".dtcm"))) =0;
s16 temp_offset = 0; u16 vBlanks __attribute__((section(".dtcm"))) = 0;
u16 slide_dampen=0; ITCM_CODE void vblankIntr(void)
u16 vBlanks;
void vblankIntr(void)
{ {
vBlanks++; vBlanks++;
int cxBG = ((s16)myConfig.offsetX << 8); int cxBG = ((s16)myConfig.offsetX << 8);
@ -336,8 +334,6 @@ int init_graphics(void)
BG_PALETTE_SUB[255] = RGB15(31,31,31); BG_PALETTE_SUB[255] = RGB15(31,31,31);
//consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true); //consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true);
frontBuffer = (uint8*)(0x06000000);
if (!fatInitDefault()) if (!fatInitDefault())
{ {
iprintf("Unable to initialize media device!"); iprintf("Unable to initialize media device!");
@ -374,14 +370,15 @@ int init_graphics(void)
/* /*
* Redraw one raster line of the bitmap to the LCD * Redraw one raster line of the bitmap to the LCD
*/ */
ITCM_CODE void C64Display::UpdateRasterLine(int raster, u8 *src) __attribute__ ((noinline)) ITCM_CODE void C64Display::UpdateRasterLine(int raster, u8 *src)
{ {
// Output the raster line to the LCD... // Output the raster line to the LCD...
u32 *dest = (uint32*)((u32)0x06000000 + (512*(raster-FIRST_DISP_LINE))); u32 *dest = (uint32*)((u32)0x06000000 + (512*(raster-FIRST_DISP_LINE)));
u32 *source = (u32*) src; u32 *source = (u32*) src;
for (int i=0; i<(DISPLAY_X-0x10)/4; i++) for (int i=0; i<(DISPLAY_X-0x10)/8; i++)
{ {
*dest++ = *source++; *dest++ = *source++;
*dest++ = *source++;
} }
} }

View File

@ -934,7 +934,7 @@ __attribute__ ((noinline)) ITCM_CODE void MOS6569::el_mc_text(uint8 *p, uint8 *
} }
void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r) __attribute__ ((noinline)) ITCM_CODE void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
{ {
uint32 *lp = (uint32 *)p; uint32 *lp = (uint32 *)p;
uint8 *mp = matrix_line; uint8 *mp = matrix_line;

View File

@ -31,6 +31,7 @@
#include "keyboard.h" #include "keyboard.h"
#include "mainmenu_bg.h" #include "mainmenu_bg.h"
#include "diskmenu_bg.h" #include "diskmenu_bg.h"
#include "cartmenu_bg.h"
#include "Prefs.h" #include "Prefs.h"
#include "C64.h" #include "C64.h"
@ -451,6 +452,16 @@ void BottomScreenDiskette(void)
dmaFillWords(dmaVal | (dmaVal<<16),(void*) bgGetMapPtr(bg1b),32*24*2); dmaFillWords(dmaVal | (dmaVal<<16),(void*) bgGetMapPtr(bg1b),32*24*2);
} }
void BottomScreenCartridge(void)
{
decompress(cartmenu_bgTiles, bgGetGfxPtr(bg0b), LZ77Vram);
decompress(cartmenu_bgMap, (void*) bgGetMapPtr(bg0b), LZ77Vram);
dmaCopy((void*) bgGetMapPtr(bg0b)+32*30*2,(void*) bgGetMapPtr(bg1b),32*24*2);
dmaCopy((void*) cartmenu_bgPal,(void*) BG_PALETTE_SUB,256*2);
unsigned short dmaVal = *(bgGetMapPtr(bg1b)+24*32);
dmaFillWords(dmaVal | (dmaVal<<16),(void*) bgGetMapPtr(bg1b),32*24*2);
}
void BottomScreenMainMenu(void) void BottomScreenMainMenu(void)
{ {
decompress(mainmenu_bgTiles, bgGetGfxPtr(bg0b), LZ77Vram); decompress(mainmenu_bgTiles, bgGetGfxPtr(bg0b), LZ77Vram);
@ -499,6 +510,24 @@ void DisplayFileNameDiskette(void)
} }
} }
void DisplayFileNameCartridge(void)
{
char tmp[34];
DSPrint(7,5,6, (char*)" ");
DSPrint(7,7,6, (char*)" ");
if (strlen(CartFilename) > 1)
{
DSPrint(7,5,6, (char *)"CARTRIDGE IS MOUNTED AS:");
strncpy(tmp, CartFilename, 25); tmp[24]=0;
DSPrint(7,7,6, tmp);
}
else
{
DSPrint(7,5,6, (char *)"CARTRIDGE IS NOT MOUNTED");
}
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// The Disk Menu can be called up directly from the keyboard graphic // The Disk Menu can be called up directly from the keyboard graphic
// and allows the user to rewind the tape, swap in a new tape, etc. // and allows the user to rewind the tape, swap in a new tape, etc.
@ -547,7 +576,7 @@ DiskMenu_t disk_menu =
DiskMenu_t cart_menu = DiskMenu_t cart_menu =
{ {
(char *)" ", 10, (char *)" ", 12,
{ {
{(char *)" INSERT CARTRIDGE ", MENU_ACTION_INSERT_CART}, {(char *)" INSERT CARTRIDGE ", MENU_ACTION_INSERT_CART},
{(char *)" REMOVE CARTRIDGE ", MENU_ACTION_REMOVE_CART}, {(char *)" REMOVE CARTRIDGE ", MENU_ACTION_REMOVE_CART},
@ -751,9 +780,9 @@ void CartMenuShow(bool bClearScreen, u8 sel)
if (bClearScreen) if (bClearScreen)
{ {
// ------------------------------------- // -------------------------------------
// Put up the Diskette menu background // Put up the Cartridge menu background
// ------------------------------------- // -------------------------------------
BottomScreenDiskette(); BottomScreenCartridge();
} }
// --------------------------------------------------- // ---------------------------------------------------
@ -774,7 +803,7 @@ void CartMenuShow(bool bClearScreen, u8 sel)
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
// And near the bottom, display the file/rom/disk that is currently loaded into memory. // And near the bottom, display the file/rom/disk that is currently loaded into memory.
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
DisplayFileNameDiskette(); DisplayFileNameCartridge();
} }