More cleanup, some improved handling of raster rendering and a start of a 'game hacks' section in the readme.md

This commit is contained in:
Dave Bernazzani 2025-05-11 19:30:52 -04:00
parent 547f578c50
commit bebe56a812
6 changed files with 23 additions and 11 deletions

View File

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

View File

@ -109,6 +109,14 @@ How would this work... well, if you're not experiencing any weird graphical glit
In general, if you have a scanline instability/flicker near the top of the screen, use slightly negative CPU adjustment values. If the glitch is towards the bottom of the screen... use a slightly positive adjustment value.
## Specific Game Hacks
To get some of the more popular games running as good as possible on the venerable DS, here is a list of things you might try.
* Gauntlet - set the CPU CYCLES to +5 to eliminate graphical glitches on 'G' font.
* Bruce Lee - set the CPU CYCLES to +4 to minimize graphical line-based glitches.
* Turrican I - set the BAD CYCLES to -6 (you will have some corruption on the title screen but the game will look and play fine - most importantly you can actually start the game!).
* Turrican II - requires True Drive enabled (or load from cart).
## Acknowledgements

View File

@ -182,7 +182,8 @@ inline void MOS6526::EmulateLine(int cycles)
unsigned long tmp;
// Timer A
if (ta_cnt_phi2) {
if (ta_cnt_phi2)
{
ta = tmp = ta - cycles; // Decrement timer
if (tmp > 0xffff) { // Underflow?
@ -201,7 +202,8 @@ inline void MOS6526::EmulateLine(int cycles)
}
// Timer B
if (tb_cnt_phi2) {
if (tb_cnt_phi2)
{
tb = tmp = tb - cycles; // Decrement timer
if (tmp > 0xffff) { // Underflow?

View File

@ -580,6 +580,8 @@ void MOS6510::Reset(void)
// Clear all interrupt lines
interrupt.intr_any = 0;
nmi_state = false;
borrowed_cycles = 0;
interrupt.intr[INT_VICIRQ] = false;
interrupt.intr[INT_CIAIRQ] = false;

View File

@ -135,7 +135,7 @@
while (true)
{
if (page_plus_cyc) {last_cycles++; page_plus_cyc=0;}
if ((cycles_left -= last_cycles) < 0)
if ((cycles_left -= last_cycles) <= 0)
{
borrowed_cycles = -cycles_left;
break;
@ -147,7 +147,7 @@
if (page_plus_cyc) {last_cycles++; page_plus_cyc=0;}
cycle_counter += last_cycles; // In case we have any initial interrupt cycles
while ((cycles_left -= last_cycles) >= 0)
while ((cycles_left -= last_cycles) > 0)
{
// If we are 1541CPU, we want to alternate running instructions with the main CPU ...
while (cpu_cycles > cycles_left)

View File

@ -347,18 +347,17 @@ int init_graphics(void)
//more vram banks consecutivly (VRAM A-D are all 0x20000 bytes in size)
vramSetPrimaryBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, VRAM_C_SUB_BG , VRAM_D_LCD);
vramSetBankD(VRAM_D_LCD); // Not using this for video but 128K of faster RAM always useful! Mapped at 0x06860000 - 256K Used for tape patch look-up
vramSetBankD(VRAM_D_LCD); // Not using this for video but 128K of faster RAM always useful! Mapped at 0x06860000 - Unused - reserved for future use
vramSetBankE(VRAM_E_LCD); // Not using this for video but 64K of faster RAM always useful! Mapped at 0x06880000 - ..
vramSetBankF(VRAM_F_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x06890000 - ..
vramSetBankG(VRAM_G_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x06894000 - ..
vramSetBankH(VRAM_H_LCD); // Not using this for video but 32K of faster RAM always useful! Mapped at 0x06898000 - ..
vramSetBankI(VRAM_I_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x068A0000 - Unused - reserved for future use
vramSetBankI(VRAM_I_LCD); // Not using this for video but 16K of faster RAM always useful! Mapped at 0x068A0000 - 16K used for SID waveform table cache
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG1_ACTIVE); //sub bg 0 will be used to print text
REG_BG0CNT_SUB = BG_MAP_BASE(31);
BG_PALETTE_SUB[255] = RGB15(31,31,31);
//consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true);
if (!fatInitDefault())
{
@ -399,9 +398,10 @@ int init_graphics(void)
__attribute__ ((noinline)) ITCM_CODE void C64Display::UpdateRasterLine(int raster, u8 *src)
{
// 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-0x14)/4; i++)
u32 *dest = (uint32*)((u32)0x06000010 + (512*(raster-FIRST_DISP_LINE)));
u32 *source = (u32*) (src+16);
for (int i=0; i<88; i++) // 352 pixels is 320 main pixels and 16 pixel borders. Good enough for DS since we can't really show much of the border anyway.
{
*dest++ = *source++;
}