Version 0.8b with additional speed for the DS-Lite/Phat plus some small tweaks and improvements.

This commit is contained in:
Dave Bernazzani 2025-04-29 06:39:33 -04:00
parent 152030abc8
commit e16d12f558
6 changed files with 128 additions and 84 deletions

Binary file not shown.

View File

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

View File

@ -48,6 +48,7 @@
u8 floppy_sound_counter = 0;
u8 bDebugDisplay = 0;
// "Colodore" palette
uint8_t palette_red[16] = {
@ -449,15 +450,16 @@ int i = 0;
int debug[8]={0,0,0,0,0,0,0,0};
void C64Display::Speedometer(int speed)
{
#if 0
char tmp[34];
sprintf(tmp, "%-8d", speed);
DSPrint(19, 1, 6, tmp);
if (bDebugDisplay)
{
sprintf(tmp, "%-8d", speed);
DSPrint(19, 1, 6, tmp);
sprintf(tmp, "%-8d %-8d %-6d %-6d", debug[0],debug[1],debug[2],debug[3]);
DSPrint(0, 0, 6, tmp);
#endif
sprintf(tmp, "%-8d %-8d %-6d %-6d", debug[0],debug[1],debug[2],debug[3]);
DSPrint(0, 0, 6, tmp);
}
show_joysticks();
show_shift_key();

View File

@ -1097,11 +1097,13 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
unsigned spr_coll=0, gfx_coll=0;
// Draw each active sprite
for (unsigned snum = 0; snum < 8; ++snum) {
for (unsigned snum = 0; snum < 8; ++snum)
{
uint8_t sbit = 1 << snum;
// Is sprite visible?
if ((sprite_on & sbit) && mx[snum] < DISPLAY_X-32) {
if ((sprite_on & sbit) && mx[snum] < DISPLAY_X-32)
{
uint8_t *p = chunky_ptr + mx[snum] + 8;
uint8_t *q = spr_coll_buf + mx[snum] + 8;
@ -1118,7 +1120,8 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
uint32_t fore_mask = (fmbp[0] << 24) | (fmbp[1] << 16) | (fmbp[2] << 8) | (fmbp[3] << 0);
fore_mask = (fore_mask << sshift) | (fmbp[4] >> (8-sshift));
if (mxe & sbit) { // X-expanded
if (mxe & sbit) // X-expanded
{
if (mx[snum] >= DISPLAY_X-56)
continue;
@ -1127,7 +1130,8 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
uint32_t fore_mask_r = (fmbp[4] << 24) | (fmbp[5] << 16) | (fmbp[6] << 8);
fore_mask_r <<= sshift;
if (mmc & sbit) { // X-expanded multicolor mode
if (mmc & sbit) // X-expanded multicolor mode
{
uint32_t plane0_l, plane0_r, plane1_l, plane1_r;
// Expand sprite data
@ -1152,21 +1156,32 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
// Paint sprite
for (unsigned i = 0; i < 32; ++i, plane0_l <<= 1, plane1_l <<= 1, fore_mask <<= 1) {
for (unsigned i = 0; i < 32; ++i, plane0_l <<= 1, plane1_l <<= 1, fore_mask <<= 1)
{
uint8_t col;
if (plane1_l & 0x80000000) {
if (plane0_l & 0x80000000) {
if (plane1_l & 0x80000000)
{
if (plane0_l & 0x80000000)
{
col = mm1_color;
} else {
}
else
{
col = color;
}
} else {
if (plane0_l & 0x80000000) {
}
else
{
if (plane0_l & 0x80000000)
{
col = mm0_color;
} else {
}
else
{
continue;
}
}
if (q[i]) { // Obscured by higher-priority data?
spr_coll |= q[i] | sbit;
} else if ((fore_mask & 0x80000000) == 0) {
@ -1215,7 +1230,9 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
// Paint sprite
for (unsigned i = 0; i < 32; ++i, sdata_l <<= 1, fore_mask <<= 1) {
if (sdata_l)
for (unsigned i = 0; i < 32; ++i, sdata_l <<= 1, fore_mask <<= 1)
{
if (sdata_l & 0x80000000) {
if (q[i]) { // Obscured by higher-priority data?
spr_coll |= q[i] | sbit;
@ -1225,8 +1242,12 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
q[i] |= sbit;
}
}
for (unsigned i = 32; i < 48; ++i, sdata_r <<= 1, fore_mask_r <<= 1) {
if (sdata_r & 0x80000000) {
if (sdata_r)
for (unsigned i = 32; i < 48; ++i, sdata_r <<= 1, fore_mask_r <<= 1)
{
if (sdata_r & 0x80000000)
{
if (q[i]) { // Obscured by higher-priority data?
spr_coll |= q[i] | sbit;
} else if ((fore_mask_r & 0x80000000) == 0) {
@ -1237,9 +1258,11 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
}
} else { // Unexpanded
if (mmc & sbit) { // Unexpanded multicolor mode
}
else // Unexpanded
{
if (mmc & sbit) // Unexpanded multicolor mode
{
uint32_t plane0, plane1;
// Convert sprite chunky pixels to bitplanes
@ -1257,18 +1280,29 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
// Paint sprite
for (unsigned i = 0; i < 24; ++i, plane0 <<= 1, plane1 <<= 1, fore_mask <<= 1) {
if (plane0 || plane1)
for (unsigned i = 0; i < 24; ++i, plane0 <<= 1, plane1 <<= 1, fore_mask <<= 1)
{
uint8_t col;
if (plane1 & 0x80000000) {
if (plane0 & 0x80000000) {
if (plane1 & 0x80000000)
{
if (plane0 & 0x80000000)
{
col = mm1_color;
} else {
}
else
{
col = color;
}
} else {
if (plane0 & 0x80000000) {
}
else
{
if (plane0 & 0x80000000)
{
col = mm0_color;
} else {
}
else
{
continue;
}
}
@ -1279,9 +1313,9 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
q[i] |= sbit;
}
} else { // Unexpanded standard mode
}
else // Unexpanded standard mode
{
// Collision with graphics?
if (fore_mask & sdata) {
gfx_coll |= sbit;
@ -1293,8 +1327,11 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
// Paint sprite
for (unsigned i = 0; i < 24; ++i, sdata <<= 1, fore_mask <<= 1) {
if (sdata & 0x80000000) {
if (sdata)
for (unsigned i = 0; i < 24; ++i, sdata <<= 1, fore_mask <<= 1)
{
if (sdata & 0x80000000)
{
if (q[i]) { // Obscured by higher-priority data?
spr_coll |= q[i] | sbit;
} else if ((fore_mask & 0x80000000) == 0) {
@ -1309,7 +1346,8 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
// Check sprite-sprite collisions
if (spr_coll) {
if (spr_coll)
{
uint8_t old_clx_spr = clx_spr;
clx_spr |= spr_coll;
if (old_clx_spr == 0) { // Interrupt on first detected collision
@ -1322,7 +1360,8 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
}
// Check sprite-background collisions
if (gfx_coll) {
if (gfx_coll)
{
uint8_t old_clx_bgr = clx_bgr;
clx_bgr |= gfx_coll;
if (old_clx_bgr == 0) { // Interrupt on first detected collision
@ -1485,9 +1524,10 @@ int MOS6569::EmulateLine(void)
p++;
}
if (display_state) {
switch (display_idx) {
if (display_state)
{
switch (display_idx)
{
case 0: // Standard text
if (x_scroll & 3)
{
@ -1699,7 +1739,6 @@ int MOS6569::EmulateLine(void)
}
}
VIC_nop:
// Skip this if all sprites are off
if (me | sprite_on)

View File

@ -49,6 +49,8 @@ char strBuf[40];
#define WAITVBL swiWaitForVBlank();swiWaitForVBlank();swiWaitForVBlank();
extern u8 bDebugDisplay;
/*********************************************************************************
* Show The 14 games on the list to allow the user to choose a new game.
********************************************************************************/
@ -113,7 +115,7 @@ int Filescmp (const void *c1, const void *c2)
/*********************************************************************************
* Find files (TAP/TZX/Z80/SNA) available - sort them for display.
********************************************************************************/
void speccySEFindFiles(u8 bTapeOnly)
void gimliDSFindFiles(u8 bTapeOnly)
{
u32 uNbFile;
DIR *dir;
@ -146,7 +148,7 @@ void speccySEFindFiles(u8 bTapeOnly)
{
if ( (strcasecmp(strrchr(szFile, '.'), ".D64") == 0) ) {
strcpy(gpFic[uNbFile].szName,szFile);
gpFic[uNbFile].uType = SPECCY_FILE;
gpFic[uNbFile].uType = NORMALFILE;
uNbFile++;
countZX++;
}
@ -167,7 +169,7 @@ void speccySEFindFiles(u8 bTapeOnly)
// ----------------------------------------------------------------
// Let the user select a new game (rom) file and load it up!
// ----------------------------------------------------------------
u8 speccySELoadFile(u8 bTapeOnly)
u8 gimliDSLoadFile(u8 bTapeOnly)
{
bool bDone=false;
u16 ucHaut=0x00, ucBas=0x00,ucSHaut=0x00, ucSBas=0x00, romSelected= 0, firstRomDisplay=0,nbRomPerPage, uNbRSPage;
@ -177,7 +179,7 @@ u8 speccySELoadFile(u8 bTapeOnly)
// Show the menu...
while ((keysCurrent() & (KEY_TOUCH | KEY_START | KEY_SELECT | KEY_A | KEY_B))!=0);
speccySEFindFiles(bTapeOnly);
gimliDSFindFiles(bTapeOnly);
ucGameChoice = -1;
@ -333,13 +335,14 @@ u8 speccySELoadFile(u8 bTapeOnly)
{
bDone=true;
if (keysCurrent() & KEY_X) retVal = 2; else retVal = 1;
if (keysCurrent() & KEY_Y) bDebugDisplay = 1; else bDebugDisplay = 0;
ucGameChoice = ucGameAct;
WAITVBL;
}
else
{
chdir(gpFic[ucGameAct].szName);
speccySEFindFiles(bTapeOnly);
gimliDSFindFiles(bTapeOnly);
ucGameAct = 0;
nbRomPerPage = (countZX>=14 ? 14 : countZX);
uNbRSPage = (countZX>=5 ? 5 : countZX);
@ -597,7 +600,7 @@ u8 DisketteMenu(C64 *the_c64)
case MENU_ACTION_DRIVE8:
BottomScreenMainMenu();
retVal = speccySELoadFile(0);
retVal = gimliDSLoadFile(0);
if (ucGameChoice >= 0)
{
retVal = 1;
@ -609,7 +612,7 @@ u8 DisketteMenu(C64 *the_c64)
case MENU_ACTION_DRIVE9:
BottomScreenMainMenu();
retVal = speccySELoadFile(0);
retVal = gimliDSLoadFile(0);
if (ucGameChoice >= 0)
{
retVal = 1;

View File

@ -1,7 +1,7 @@
#define MAX_FILES 2048
#define MAX_FILENAME_LEN 256
#define SPECCY_FILE 0x01
#define NORMALFILE 0x01
#define DIRECTORY 0x02
class C64;
extern void DSPrint(int iX,int iY,int iScr,char *szMessage);