Version 1.1c with a few more tweaks and improvements. Extended 4 more pixels for vertical display for the games that really utilize the bottom of the screen (Gaplus, etc). Removed a lot of dead code that was not utilized.

This commit is contained in:
Dave Bernazzani 2025-05-14 06:52:06 -04:00
parent f332319398
commit 6f24cc6893
10 changed files with 348 additions and 360 deletions

Binary file not shown.

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -54,18 +54,19 @@
#include <maxmod9.h>
#include "soundbank.h"
// Slight speed improvement to have these in global memory where the address is fixed at linker time
uint8 myRAM[C64_RAM_SIZE];
uint8 myKERNAL[KERNAL_ROM_SIZE];
uint8 myBASIC[BASIC_ROM_SIZE];
uint8 myRAM1541[DRIVE_RAM_SIZE] __attribute__((section(".dtcm")));
uint8 myCOLOR[0x400] __attribute__((section(".dtcm")));
uint8 myRAM1541[DRIVE_RAM_SIZE] __attribute__((section(".dtcm"))); // Small enough to keep in fast memory
uint8 myCOLOR[0x400] __attribute__((section(".dtcm"))); // Small enough to keep in fast memory
uint8 bTurboWarp __attribute__((section(".dtcm"))) = 0;
uint8 cart_in __attribute__((section(".dtcm"))) = 0;
uint8 bTurboWarp __attribute__((section(".dtcm"))) = 0; // Run the CPU as fast as possible
uint8 cart_in __attribute__((section(".dtcm"))) = 0; // Will be set to '1' if CART is inserted
MOS6510 myCPU __attribute__((section(".dtcm"))); // Put the entire CPU object into fast memory...
C64 *gTheC64 = nullptr;
C64 *gTheC64 = nullptr; // For occasional access in other classes without having to pass it around
u8 CompressBuffer[300*1024]; //300K more than enough (might need to compress RDU at 256K)
@ -111,6 +112,7 @@ C64::C64()
TheCart = TheCPU->TheCart = new Cartridge();
TheREU = TheCPU->TheREU = new REU(TheCPU);
// Initialize main C64 memory
InitMemory();
// Clear joykey
@ -887,17 +889,11 @@ void Pause(uint32 ms)
}
int frames_per_sec=0;
#ifndef HAVE_USLEEP
int usleep(unsigned long int microSeconds)
{
Pause(microSeconds);
return 0;
}
#endif
/*
* Constructor, system-dependent things
@ -980,6 +976,7 @@ void kbd_buf_update(C64 *TheC64)
ITCM_CODE void C64::VBlank(bool draw_frame)
{
static int frames=0;
static int frames_per_sec=0;
scanKeys();
kbd_buf_update(this);
@ -1000,10 +997,10 @@ ITCM_CODE void C64::VBlank(bool draw_frame)
frames_per_sec++;
extern u16 vBlanks;
if (vBlanks >= 60)
extern u16 DSIvBlanks;
if (DSIvBlanks >= 60)
{
vBlanks = 0;
DSIvBlanks = 0;
TheDisplay->Speedometer((int)frames_per_sec);
frames_per_sec = 0;
}
@ -1292,6 +1289,10 @@ uint8 C64::poll_joystick(int port)
return j;
}
/*
* C64 .crt Cart Insert
*/
void C64::InsertCart(char *filename)
{
Cartridge * new_cart = nullptr;
@ -1314,11 +1315,17 @@ void C64::InsertCart(char *filename)
}
}
/*
* C64 .crt Cart Remove
*/
void C64::RemoveCart(void)
{
extern u8 cart_in;
delete TheCart;
TheCart = TheCPU->TheCart = new Cartridge();
extern char CartFilename[];
strcpy(CartFilename, "");
cart_in = 0;
}

View File

@ -383,6 +383,8 @@ void MOS6526_1::WriteRegister(uint16 adr, uint8 byte)
break;
case 0xd:
if (ThePrefs.CIAIRQHack) // Hack for addressing modes that read from the address
icr = 0;
if (byte & 0x80) {
int_mask |= byte & 0x1f;
if (icr & int_mask) { // Trigger IRQ if pending
@ -516,6 +518,8 @@ void MOS6526_2::WriteRegister(uint16 adr, uint8 byte)
break;
case 0xd:
if (ThePrefs.CIAIRQHack)
icr = 0;
if (byte & 0x80) {
int_mask |= byte & 0x7f;
if (icr & int_mask & 0x1f) { // Trigger NMI if pending

View File

@ -47,9 +47,8 @@
#include <maxmod9.h>
#include "soundbank.h"
u8 floppy_sound_counter __attribute__((section(".dtcm"))) = 0;
u8 bDebugDisplay __attribute__((section(".dtcm"))) = 0;
u8 bDebugDisplay __attribute__((section(".dtcm"))) = 0;
// "Colodore" palette
uint8_t palette_red[16] = {
@ -139,6 +138,11 @@ void C64Display::UpdateLEDs(int l0, int l1)
#define ABS(a) (((a) < 0) ? -(a) : (a))
#define ROUND(f) ((u32) ((f) < 0.0 ? (f) - 0.5 : (f) + 0.5))
#define INSERT_CART 0xFD
#define MOUNT_DISK 0xFE
#define MAIN_MENU 0xFF
#define KB_NORMAL 0
#define KB_CAPS 1
#define KB_SHIFT 2
@ -152,10 +156,6 @@ void C64Display::UpdateLEDs(int l0, int l1)
#define F_7 0x7
#define F_8 0x18
#define INSERT_CART 0xFD
#define MOUNT_DISK 0xFE
#define MAIN_MENU 0xFF
#define LFA 0x095 // Left arrow
#define CLR 0x147 // Home/clear
#define PND 0x92 // Pound
@ -254,13 +254,14 @@ void C64Display::NewPrefs(Prefs *prefs)
floppy_sound_counter = 50; // One seconds of no floppy sound...
}
u8 JITTER[] __attribute__((section(".dtcm"))) = {0, 64, 128};
s16 temp_offset __attribute__((section(".dtcm"))) = 0;
u16 slide_dampen __attribute__((section(".dtcm"))) =0;
u16 vBlanks __attribute__((section(".dtcm"))) = 0;
u8 JITTER[] __attribute__((section(".dtcm"))) = {0, 64, 128};
s16 temp_offset __attribute__((section(".dtcm"))) = 0;
u16 slide_dampen __attribute__((section(".dtcm"))) = 0;
u16 DSIvBlanks __attribute__((section(".dtcm"))) = 0;
ITCM_CODE void vblankIntr(void)
{
vBlanks++;
DSIvBlanks++;
int cxBG = ((s16)myConfig.offsetX << 8);
int cyBG = ((s16)myConfig.offsetY+temp_offset) << 8;
int xdxBG = ((320 / myConfig.scaleX) << 8) | (320 % myConfig.scaleX) ;
@ -328,7 +329,6 @@ __attribute__ ((noinline)) void toggle_zoom(void)
}
}
extern void InterruptHandler(void);
int init_graphics(void)
{
//set the mode for 2 text layers and two extended background layers
@ -584,7 +584,6 @@ int c64_key=-1;
int lastc64key=-1;
bool m_tpActive=false;
touchPosition m_tp;
u8 issue_commodore_key = 0;
void C64Display::IssueKeypress(uint8 row, uint8 col, uint8 *key_matrix, uint8 *rev_matrix)
{
@ -629,340 +628,330 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
scanKeys();
if (issue_commodore_key)
if ((lastc64key >-1) && ((keysCurrent() & KEY_TOUCH) == 0))
{
issue_commodore_key = 0;
c64_key = MATRIX(7,5);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
KeyRelease(lastc64key, key_matrix, rev_matrix);
}
if ((keysCurrent() & KEY_TOUCH) == 0) // No touch screen... reset the flag
{
m_tpActive = false;
}
else
if ((m_tpActive == false) && (keysCurrent() & KEY_TOUCH))
{
if ((lastc64key >-1) && ((keysCurrent() & KEY_TOUCH) == 0))
{
KeyRelease(lastc64key, key_matrix, rev_matrix);
}
touchRead(&m_tp);
m_tpActive = true;
if ((keysCurrent() & KEY_TOUCH) == 0) // No touch screen... reset the flag
{
m_tpActive = false;
}
else
if ((m_tpActive == false) && (keysCurrent() & KEY_TOUCH))
{
touchRead(&m_tp);
m_tpActive = true;
unsigned short c = 0;
int tilex, tiley;
unsigned short c = 0;
int tilex, tiley;
tilex = m_tp.px;
tiley = m_tp.py;
if (tiley > 20) // We're in the keyboard area...
tilex = m_tp.px;
tiley = m_tp.py;
if (tiley > 20) // We're in the keyboard area...
{
if (tiley < 44) // Big Key Row
{
if (tiley < 44) // Big Key Row
{
if (tilex < 42)
{
myConfig.joyPort ^= 1;
extern void show_joysticks();
show_joysticks();
}
else if (tilex < 80) c = CTL;
else if (tilex < 118) c = BSP;
else if (tilex < 156) c = RST;
else if (tilex < 194) c = CLR;
else if (tilex < 255) c = RUN;
}
else if (tiley < 74) // Number Row
{
if (tilex < 23) c = '1';
else if (tilex < 42) c = '2';
else if (tilex < 61) c = '3';
else if (tilex < 80) c = '4';
else if (tilex < 99) c = '5';
else if (tilex < 118) c = '6';
else if (tilex < 137) c = '7';
else if (tilex < 156) c = '8';
else if (tilex < 175) c = '9';
else if (tilex < 194) c = '0';
else if (tilex < 213) c = '+';
else if (tilex < 233) c = '-';
else if (tilex < 256) c = PND;
}
else if (tiley < 104) // QWERTY Row
{
if (tilex < 23) c = CUP;
else if (tilex < 42) c = 'Q';
else if (tilex < 61) c = 'W';
else if (tilex < 80) c = 'E';
else if (tilex < 99) c = 'R';
else if (tilex < 118) c = 'T';
else if (tilex < 137) c = 'Y';
else if (tilex < 156) c = 'U';
else if (tilex < 175) c = 'I';
else if (tilex < 194) c = 'O';
else if (tilex < 213) c = 'P';
else if (tilex < 233) c = '@';
else if (tilex < 256) c = '*';
}
else if (tiley < 134) // ASDF Row
{
if (tilex < 23) c = CDL;
else if (tilex < 42) c = 'A';
else if (tilex < 61) c = 'S';
else if (tilex < 80) c = 'D';
else if (tilex < 99) c = 'F';
else if (tilex < 118) c = 'G';
else if (tilex < 137) c = 'H';
else if (tilex < 156) c = 'J';
else if (tilex < 175) c = 'K';
else if (tilex < 194) c = 'L';
else if (tilex < 213) c = ':';
else if (tilex < 233) c = ';';
else if (tilex < 256) c = '=';
}
else if (tiley < 164) // ZXCV Row
{
if (tilex < 23) c = SHF;
else if (tilex < 42) c = 'Z';
else if (tilex < 61) c = 'X';
else if (tilex < 80) c = 'C';
else if (tilex < 99) c = 'V';
else if (tilex < 118) c = 'B';
else if (tilex < 137) c = 'N';
else if (tilex < 156) c = 'M';
else if (tilex < 175) c = ',';
else if (tilex < 194) c = '.';
else if (tilex < 213) c = '/';
else if (tilex < 256) c = RET;
}
else if (tiley < 192) // Bottom Row
{
if (tilex < 23) c = F_1;
else if (tilex < 42) c = F_3;
else if (tilex < 61) c = F_5;
else if (tilex < 80) c = F_7;
else if (tilex < 164) c = ' ';
else if (tilex < 193) c = INSERT_CART;
else if (tilex < 223) c = MOUNT_DISK;
else if (tilex < 256) c = MAIN_MENU;
}
if (tilex < 42)
{
myConfig.joyPort ^= 1;
extern void show_joysticks();
show_joysticks();
}
else if (tilex < 80) c = CTL;
else if (tilex < 118) c = BSP;
else if (tilex < 156) c = RST;
else if (tilex < 194) c = CLR;
else if (tilex < 255) c = RUN;
}
else if (tiley < 74) // Number Row
{
if (tilex < 23) c = '1';
else if (tilex < 42) c = '2';
else if (tilex < 61) c = '3';
else if (tilex < 80) c = '4';
else if (tilex < 99) c = '5';
else if (tilex < 118) c = '6';
else if (tilex < 137) c = '7';
else if (tilex < 156) c = '8';
else if (tilex < 175) c = '9';
else if (tilex < 194) c = '0';
else if (tilex < 213) c = '+';
else if (tilex < 233) c = '-';
else if (tilex < 256) c = PND;
}
else if (tiley < 104) // QWERTY Row
{
if (tilex < 23) c = CUP;
else if (tilex < 42) c = 'Q';
else if (tilex < 61) c = 'W';
else if (tilex < 80) c = 'E';
else if (tilex < 99) c = 'R';
else if (tilex < 118) c = 'T';
else if (tilex < 137) c = 'Y';
else if (tilex < 156) c = 'U';
else if (tilex < 175) c = 'I';
else if (tilex < 194) c = 'O';
else if (tilex < 213) c = 'P';
else if (tilex < 233) c = '@';
else if (tilex < 256) c = '*';
}
else if (tiley < 134) // ASDF Row
{
if (tilex < 23) c = CDL;
else if (tilex < 42) c = 'A';
else if (tilex < 61) c = 'S';
else if (tilex < 80) c = 'D';
else if (tilex < 99) c = 'F';
else if (tilex < 118) c = 'G';
else if (tilex < 137) c = 'H';
else if (tilex < 156) c = 'J';
else if (tilex < 175) c = 'K';
else if (tilex < 194) c = 'L';
else if (tilex < 213) c = ':';
else if (tilex < 233) c = ';';
else if (tilex < 256) c = '=';
}
else if (tiley < 164) // ZXCV Row
{
if (tilex < 23) c = SHF;
else if (tilex < 42) c = 'Z';
else if (tilex < 61) c = 'X';
else if (tilex < 80) c = 'C';
else if (tilex < 99) c = 'V';
else if (tilex < 118) c = 'B';
else if (tilex < 137) c = 'N';
else if (tilex < 156) c = 'M';
else if (tilex < 175) c = ',';
else if (tilex < 194) c = '.';
else if (tilex < 213) c = '/';
else if (tilex < 256) c = RET;
}
else if (tiley < 192) // Bottom Row
{
if (tilex < 23) c = F_1;
else if (tilex < 42) c = F_3;
else if (tilex < 61) c = F_5;
else if (tilex < 80) c = F_7;
else if (tilex < 164) c = ' ';
else if (tilex < 193) c = INSERT_CART;
else if (tilex < 223) c = MOUNT_DISK;
else if (tilex < 256) c = MAIN_MENU;
}
if (c==MAIN_MENU)
if (c==MAIN_MENU)
{
TheC64->Pause();
MainMenu(TheC64);
ShowKeyboard();
TheC64->Resume();
}
else if (c==INSERT_CART)
{
TheC64->Pause();
u8 reload = mount_cart(TheC64);
ShowKeyboard();
if ((reload == 1) || (reload == 2))
{
TheC64->Pause();
MainMenu(TheC64);
ShowKeyboard();
TheC64->Resume();
}
else if (c==INSERT_CART)
{
TheC64->Pause();
u8 reload = mount_cart(TheC64);
ShowKeyboard();
if ((reload == 1) || (reload == 2))
// Remove any disks...
Prefs *prefs = new Prefs(ThePrefs);
strcpy(prefs->DrivePath[0], "");
strcpy(prefs->DrivePath[1], "");
prefs->TrueDrive = myConfig.trueDrive;
TheC64->NewPrefs(prefs);
ThePrefs = *prefs;
delete prefs;
if (reload == 1) // load cart THEN reset
{
// Remove any disks...
Prefs *prefs = new Prefs(ThePrefs);
strcpy(prefs->DrivePath[0], "");
strcpy(prefs->DrivePath[1], "");
prefs->TrueDrive = myConfig.trueDrive;
TheC64->NewPrefs(prefs);
ThePrefs = *prefs;
delete prefs;
if (reload == 1) // load cart THEN reset
{
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
bDelayLoadCRT = 5; // 5 frames and load the CRT file
}
else // reload is 2 - PRG file reset FIRST
{
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
bDelayLoadPRG = 10; // 10 frames and load the PRG file
}
cart_in = 1;
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
bDelayLoadCRT = 5; // 5 frames and load the CRT file
}
else if (reload == 3)
else // reload is 2 - PRG file reset FIRST
{
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
bDelayLoadPRG = 10; // 10 frames and load the PRG file
}
cart_in = 1;
}
else if (reload == 3)
{
TheC64->RemoveCart();
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
cart_in = 0;
}
TheC64->Resume();
}
else if (c==MOUNT_DISK)
{
TheC64->Pause();
u8 reload = mount_disk(TheC64);
ShowKeyboard();
if (reload & 0x7F)
{
kbd_buf_reset();
// Insert the new disk into the drive...
Prefs *prefs = new Prefs(ThePrefs);
strcpy(prefs->DrivePath[0], Drive8File);
strcpy(prefs->DrivePath[1], Drive9File);
prefs->TrueDrive = myConfig.trueDrive;
TheC64->NewPrefs(prefs);
ThePrefs = *prefs;
delete prefs;
// See if we should issue a system-wide RESET
if (reload == 2)
{
TheC64->RemoveCart();
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
cart_in = 0;
}
TheC64->Resume();
}
else if (c==MOUNT_DISK)
{
TheC64->Pause();
u8 reload = mount_disk(TheC64);
ShowKeyboard();
TheC64->Resume();
if (reload & 0x7F)
if (reload & 0x80)
{
extern void kbd_buf_feed(const char *s);
kbd_buf_feed("\rLOAD\"*\",8,1\rRUN\r");
}
}
else if (c != 0)
{
mmEffect(SFX_KEYCLICK); // Play short key click for feedback...
}
if(c==RET) // Return
{
c64_key = MATRIX(0,1);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
} else
if(c==BSP) // Backspace
{
c64_key = MATRIX(0,0);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
} else
if(c==RUN)
{
mmEffect(SFX_KEYCLICK); // Play short key click for feedback...
c64_key = MATRIX(7,7);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
} else
if(c==SLK || c==SHF)
{
if(m_Mode==KB_NORMAL) {
m_Mode = KB_SHIFT;
} else {
m_Mode = KB_NORMAL;
}
show_shift_key();
}
else
{
u8 left_arrow = 0;
if(c!=0x0)
{
switch (c)
{
kbd_buf_reset();
case 'A': c64_key = MATRIX(1,2); break;
case 'B': c64_key = MATRIX(3,4); break;
case 'C': c64_key = MATRIX(2,4); break;
case 'D': c64_key = MATRIX(2,2); break;
case 'E': c64_key = MATRIX(1,6); break;
case 'F': c64_key = MATRIX(2,5); break;
case 'G': c64_key = MATRIX(3,2); break;
case 'H': c64_key = MATRIX(3,5); break;
case 'I': c64_key = MATRIX(4,1); break;
case 'J': c64_key = MATRIX(4,2); break;
case 'K': c64_key = MATRIX(4,5); break;
case 'L': c64_key = MATRIX(5,2); break;
case 'M': c64_key = MATRIX(4,4); break;
case 'N': c64_key = MATRIX(4,7); break;
case 'O': c64_key = MATRIX(4,6); break;
case 'P': c64_key = MATRIX(5,1); break;
case 'Q': c64_key = MATRIX(7,6); break;
case 'R': c64_key = MATRIX(2,1); break;
case 'S': c64_key = MATRIX(1,5); break;
case 'T': c64_key = MATRIX(2,6); break;
case 'U': c64_key = MATRIX(3,6); break;
case 'V': c64_key = MATRIX(3,7); break;
case 'W': c64_key = MATRIX(1,1); break;
case 'X': c64_key = MATRIX(2,7); break;
case 'Y': c64_key = MATRIX(3,1); break;
case 'Z': c64_key = MATRIX(1,4); break;
// Insert the new disk into the drive...
Prefs *prefs = new Prefs(ThePrefs);
strcpy(prefs->DrivePath[0], Drive8File);
strcpy(prefs->DrivePath[1], Drive9File);
prefs->TrueDrive = myConfig.trueDrive;
TheC64->NewPrefs(prefs);
ThePrefs = *prefs;
delete prefs;
case ' ': c64_key = MATRIX(7,4); break;
case '0': c64_key = MATRIX(4,3); break;
case '1': c64_key = MATRIX(7,0); break;
case '2': c64_key = MATRIX(7,3); break;
case '3': c64_key = MATRIX(1,0); break;
case '4': c64_key = MATRIX(1,3); break;
case '5': c64_key = MATRIX(2,0); break;
case '6': c64_key = MATRIX(2,3); break;
case '7': c64_key = MATRIX(3,0); break;
case '8': c64_key = MATRIX(3,3); break;
case '9': c64_key = MATRIX(4,0); break;
case '*': c64_key = MATRIX(6,1); break;
case ':': c64_key = MATRIX(5,5); break;
case ';': c64_key = MATRIX(6,2); break;
case '=': c64_key = MATRIX(6,5); break;
case '/': c64_key = MATRIX(6,7); break;
case ATT: c64_key = MATRIX(5,6); break;
case ',': c64_key = MATRIX(5,7); break;
case '.': c64_key = MATRIX(5,4); break;
case '+': c64_key = MATRIX(5,0); break;
case '-': c64_key = MATRIX(5,3); break;
case CTL: c64_key = MATRIX(7,2); break;
case RST: c64_key = MATRIX(7,7); TheC64->NMI(); break;
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:
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;
case CDL: c64_key = MATRIX(0,2); break;
case F_1: c64_key = MATRIX(0,4); break;
case F_3: c64_key = MATRIX(0,5); break;
case F_5: c64_key = MATRIX(0,6); break;
case F_7: c64_key = MATRIX(0,3); break;
default : c64_key = -1; break;
// See if we should issue a system-wide RESET
if (reload == 2)
{
TheC64->RemoveCart();
TheC64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
TheC64->Reset();
}
}
TheC64->Resume();
if (reload & 0x80)
if (c64_key < 0)
return;
if(m_Mode==KB_NORMAL)
{
extern void kbd_buf_feed(const char *s);
kbd_buf_feed("\rLOAD\"*\",8,1\rRUN\r");
c64_key = c64_key | 0x80;
}
}
else if (c != 0)
{
mmEffect(SFX_KEYCLICK); // Play short key click for feedback...
}
if(c==RET) // Return
{
c64_key = MATRIX(0,1);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
} else
if(c==BSP) // Backspace
{
c64_key = MATRIX(0,0);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
} else
if(c==RUN)
{
mmEffect(SFX_KEYCLICK); // Play short key click for feedback...
c64_key = MATRIX(7,7);
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
} else
if(c==SLK || c==SHF)
{
if(m_Mode==KB_NORMAL) {
m_Mode = KB_SHIFT;
} else {
m_Mode = KB_NORMAL;
}
show_shift_key();
}
else
{
u8 left_arrow = 0;
if(c!=0x0)
if (left_arrow)
{
switch (c)
{
case 'A': c64_key = MATRIX(1,2); break;
case 'B': c64_key = MATRIX(3,4); break;
case 'C': c64_key = MATRIX(2,4); break;
case 'D': c64_key = MATRIX(2,2); break;
case 'E': c64_key = MATRIX(1,6); break;
case 'F': c64_key = MATRIX(2,5); break;
case 'G': c64_key = MATRIX(3,2); break;
case 'H': c64_key = MATRIX(3,5); break;
case 'I': c64_key = MATRIX(4,1); break;
case 'J': c64_key = MATRIX(4,2); break;
case 'K': c64_key = MATRIX(4,5); break;
case 'L': c64_key = MATRIX(5,2); break;
case 'M': c64_key = MATRIX(4,4); break;
case 'N': c64_key = MATRIX(4,7); break;
case 'O': c64_key = MATRIX(4,6); break;
case 'P': c64_key = MATRIX(5,1); break;
case 'Q': c64_key = MATRIX(7,6); break;
case 'R': c64_key = MATRIX(2,1); break;
case 'S': c64_key = MATRIX(1,5); break;
case 'T': c64_key = MATRIX(2,6); break;
case 'U': c64_key = MATRIX(3,6); break;
case 'V': c64_key = MATRIX(3,7); break;
case 'W': c64_key = MATRIX(1,1); break;
case 'X': c64_key = MATRIX(2,7); break;
case 'Y': c64_key = MATRIX(3,1); break;
case 'Z': c64_key = MATRIX(1,4); break;
case ' ': c64_key = MATRIX(7,4); break;
case '0': c64_key = MATRIX(4,3); break;
case '1': c64_key = MATRIX(7,0); break;
case '2': c64_key = MATRIX(7,3); break;
case '3': c64_key = MATRIX(1,0); break;
case '4': c64_key = MATRIX(1,3); break;
case '5': c64_key = MATRIX(2,0); break;
case '6': c64_key = MATRIX(2,3); break;
case '7': c64_key = MATRIX(3,0); break;
case '8': c64_key = MATRIX(3,3); break;
case '9': c64_key = MATRIX(4,0); break;
case '*': c64_key = MATRIX(6,1); break;
case ':': c64_key = MATRIX(5,5); break;
case ';': c64_key = MATRIX(6,2); break;
case '=': c64_key = MATRIX(6,5); break;
case '/': c64_key = MATRIX(6,7); break;
case ATT: c64_key = MATRIX(5,6); break;
case ',': c64_key = MATRIX(5,7); break;
case '.': c64_key = MATRIX(5,4); break;
case '+': c64_key = MATRIX(5,0); break;
case '-': c64_key = MATRIX(5,3); break;
case CTL: c64_key = MATRIX(7,2); break;
case RST: c64_key = MATRIX(7,7); TheC64->NMI(); break;
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:
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;
case CDL: c64_key = MATRIX(0,2); break;
case F_1: c64_key = MATRIX(0,4); break;
case F_3: c64_key = MATRIX(0,5); break;
case F_5: c64_key = MATRIX(0,6); break;
case F_7: c64_key = MATRIX(0,3); break;
default : c64_key = -1; break;
}
if (c64_key < 0)
return;
if(m_Mode==KB_NORMAL)
{
c64_key = c64_key | 0x80;
}
KeyPress(c64_key, key_matrix, rev_matrix);
lastc64key=c64_key;
if (left_arrow)
{
KeyPress(MATRIX(7,1) | 0x80, key_matrix, rev_matrix);
}
KeyPress(MATRIX(7,1) | 0x80, key_matrix, rev_matrix);
}
}
}
@ -975,28 +964,18 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
* Allocate C64 colors
*/
typedef struct {
int r;
int g;
int b;
} plt;
static plt palette[256];
void C64Display::InitColors(uint8 *colors)
{
int i;
for (i = 0; i < 16; i++)
{
palette[i].r = palette_red[i]>>3;
palette[i].g = palette_green[i]>>3;
palette[i].b = palette_blue[i]>>3;
BG_PALETTE[i]=RGB15(palette_red[i]>>3,palette_green[i]>>3,palette_blue[i]>>3);
}
// frodo internal 8 bit palette
for(i=0; i<256; i++) {
for(i=0; i<256; i++)
{
colors[i] = i & 0x0f;
}
}

View File

@ -39,7 +39,10 @@ Prefs::Prefs()
strcpy(DrivePath[0], "");
strcpy(DrivePath[1], "");
SIDType = SIDTYPE_DIGITAL;
FastReset = true;
CIAIRQHack = false;
TrueDrive = false; // True Drive Emulation when TRUE (slower emulation)
}

View File

@ -43,7 +43,9 @@ public:
bool operator!=(const Prefs &rhs) const;
char DrivePath[2][256]; // Path for drive 8 and 9
int SIDType; // SID emulation type
bool FastReset; // Skip RAM test on reset
bool CIAIRQHack; // Write to CIA ICR clears IRQ
bool TrueDrive; // Enable processor-level 1541 emulation
};

View File

@ -84,7 +84,7 @@
// First and last displayed line
const unsigned FIRST_DISP_LINE = 0x20;
const unsigned LAST_DISP_LINE = 0x110;
const unsigned LAST_DISP_LINE = 0x114;
// First and last possible line for Bad Lines
const unsigned FIRST_DMA_LINE = 0x30;
@ -262,8 +262,8 @@ static u8 display_state __attribute__((section(".dtcm"))); /
static u8 border_on __attribute__((section(".dtcm"))); // Flag: Upper/lower border on
static u8 border_40_col __attribute__((section(".dtcm"))); // Flag: 40 column border
static u8 frame_skipped __attribute__((section(".dtcm"))); // Flag: Frame is being skipped
static uint8 bad_lines_enabled __attribute__((section(".dtcm"))); // Flag: Bad Lines enabled for this frame
static bool lp_triggered __attribute__((section(".dtcm"))); // Flag: Lightpen was triggered in this frame
static u8 bad_lines_enabled __attribute__((section(".dtcm"))); // Flag: Bad Lines enabled for this frame
static u8 lp_triggered __attribute__((section(".dtcm"))); // Flag: Lightpen was triggered in this frame
static u32 total_frames __attribute__((section(".dtcm"))); // Total frames - used for consistent frame skip on DS-Lite

View File

@ -15,7 +15,7 @@
// The GimliDS emulator is offered as-is, without any warranty. Please see readme.md
// =====================================================================================
// Main Menu Loading Code
// Main Menu Loading Code and Configuration Settings for the DS/XL/LL
#include <nds.h>
#include <fat.h>
@ -47,8 +47,7 @@ extern void BottomScreenMainMenu(void);
#define MENU_ACTION_SAVE_STATE 2 // Save State
#define MENU_ACTION_LOAD_STATE 3 // Load State
#define MENU_ACTION_CONFIG 4 // Configure Game
#define MENU_ACTION_PRESS_C64 5 // Issue the actual C= key!
#define MENU_ACTION_QUIT_EMU 6 // Exit Emulator
#define MENU_ACTION_QUIT_EMU 5 // Exit Emulator
#define MENU_ACTION_SKIP 99 // Skip this MENU choice
typedef struct
@ -171,12 +170,6 @@ u8 MainMenu(C64 *the_c64)
exit(0);
break;
case MENU_ACTION_PRESS_C64:
extern u8 issue_commodore_key;
issue_commodore_key = 1;
bExitMenu = true;
break;
case MENU_ACTION_RESET_EMU:
the_c64->RemoveCart();
the_c64->PatchKernal(ThePrefs.FastReset, ThePrefs.TrueDrive);
@ -376,7 +369,7 @@ void SetDefaultGameConfig(void)
myConfig.trueDrive = 0; // Fast 1541 emulation by default
myConfig.jitter = 1; // Medium level of jitter
myConfig.diskSFX = 1; // Disk sound effects on
myConfig.joyPort = 0; // Default to Joy1
myConfig.joyPort = 1; // Default to Joy2 (it's a toss-up but more than 50% use Joy2)
myConfig.joyMode = 0; // Default is normal joypad / dpad
myConfig.poundKey = 0; // Default is Pound Key!
myConfig.reuType = 0; // No REU by default