mirror of
https://github.com/wavemotion-dave/GimliDS.git
synced 2025-06-19 06:15:35 -04:00
More CPU cleanup for 1541 vs the main CPU. Added some additional VIC routines into ITCM memory for minor speedup. Added new 'cart' icon in prep for cartridge support.
This commit is contained in:
parent
77c6bc7b62
commit
a2797d4301
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 44 KiB |
@ -57,6 +57,8 @@ uint8 myRAM[C64_RAM_SIZE];
|
|||||||
uint8 myKERNAL[KERNAL_ROM_SIZE];
|
uint8 myKERNAL[KERNAL_ROM_SIZE];
|
||||||
uint8 myRAM1541[DRIVE_RAM_SIZE] __attribute__((section(".dtcm")));
|
uint8 myRAM1541[DRIVE_RAM_SIZE] __attribute__((section(".dtcm")));
|
||||||
|
|
||||||
|
uint8 bTurboWarp __attribute__((section(".dtcm"))) = 0;
|
||||||
|
|
||||||
#define SNAPSHOT_VERSION 1
|
#define SNAPSHOT_VERSION 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -194,6 +196,8 @@ void C64::Reset(void)
|
|||||||
TheCIA2->Reset();
|
TheCIA2->Reset();
|
||||||
TheIEC->Reset();
|
TheIEC->Reset();
|
||||||
TheVIC->Reset();
|
TheVIC->Reset();
|
||||||
|
|
||||||
|
bTurboWarp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -872,7 +876,7 @@ ITCM_CODE void C64::VBlank(bool draw_frame)
|
|||||||
frames++;
|
frames++;
|
||||||
while (GetTicks() < (((unsigned int)TICKS_PER_SEC/(unsigned int)50) * (unsigned int)frames))
|
while (GetTicks() < (((unsigned int)TICKS_PER_SEC/(unsigned int)50) * (unsigned int)frames))
|
||||||
{
|
{
|
||||||
//if (ThePrefs.TrueDrive && TheDisplay->led_state[0]) break; // If reading the drive in 'true drive' mode, just plow along...
|
if (bTurboWarp) break;
|
||||||
asm("nop");
|
asm("nop");
|
||||||
//break; // Uncomment this for full speed...
|
//break; // Uncomment this for full speed...
|
||||||
}
|
}
|
||||||
@ -1076,6 +1080,13 @@ uint8 C64::poll_joystick(int port)
|
|||||||
if (++auto_fire_dampen & 0x08) joy_fire=0;
|
if (++auto_fire_dampen & 0x08) joy_fire=0;
|
||||||
} else auto_fire_dampen=0;
|
} else auto_fire_dampen=0;
|
||||||
|
|
||||||
|
bTurboWarp = 0;
|
||||||
|
if((keys & KEY_R) && (keys & KEY_L))
|
||||||
|
{
|
||||||
|
// Turbo/Warp mode!
|
||||||
|
bTurboWarp = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
if((keys & KEY_R) && !dampen)
|
if((keys & KEY_R) && !dampen)
|
||||||
{
|
{
|
||||||
if (keys & KEY_UP)
|
if (keys & KEY_UP)
|
||||||
@ -1099,7 +1110,7 @@ uint8 C64::poll_joystick(int port)
|
|||||||
if (myConfig.offsetX > 0) myConfig.offsetX--;
|
if (myConfig.offsetX > 0) myConfig.offsetX--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if((keys & KEY_L) && !dampen)
|
if((keys & KEY_L) && !dampen)
|
||||||
{
|
{
|
||||||
if (keys & KEY_UP)
|
if (keys & KEY_UP)
|
||||||
@ -1138,16 +1149,21 @@ uint8 C64::poll_joystick(int port)
|
|||||||
dampen = 50; // Full second - do not repeat this often!
|
dampen = 50; // Full second - do not repeat this often!
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dampen) dampen--;
|
if (!dampen) // Handle joystick
|
||||||
|
{
|
||||||
|
// Handle the joystick input... never dampen this!
|
||||||
|
if(port != myConfig.joyPort) return j;
|
||||||
|
|
||||||
// Handle the joystick input... never dampen this!
|
if( joy_up ) j&=0xfe; // Up
|
||||||
if(port != myConfig.joyPort) return j;
|
if( joy_down ) j&=0xfd; // Down
|
||||||
|
if( joy_left ) j&=0xfb; // Left
|
||||||
if( joy_up ) j&=0xfe; // Up
|
if( joy_right ) j&=0xf7; // Right
|
||||||
if( joy_down ) j&=0xfd; // Down
|
if( joy_fire ) j&=0xef; // Fire button
|
||||||
if( joy_left ) j&=0xfb; // Left
|
}
|
||||||
if( joy_right ) j&=0xf7; // Right
|
else
|
||||||
if( joy_fire ) j&=0xef; // Fire button
|
{
|
||||||
|
dampen--;
|
||||||
|
}
|
||||||
|
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
@ -112,4 +112,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern void floppy_soundfx(u8 type);
|
extern void floppy_soundfx(u8 type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,6 +166,8 @@ __attribute__ ((noinline)) uint8 MOS6510::read_byte_io(uint16 adr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return myRAM[adr];
|
return myRAM[adr];
|
||||||
|
case 0x8:
|
||||||
|
case 0x9:
|
||||||
case 0xc:
|
case 0xc:
|
||||||
return myRAM[adr];
|
return myRAM[adr];
|
||||||
case 0xd:
|
case 0xd:
|
||||||
@ -218,16 +220,14 @@ __attribute__ ((noinline)) uint8 MOS6510::read_byte_io(uint16 adr)
|
|||||||
|
|
||||||
inline __attribute__((always_inline)) uint8 MOS6510::read_byte(uint16 adr)
|
inline __attribute__((always_inline)) uint8 MOS6510::read_byte(uint16 adr)
|
||||||
{
|
{
|
||||||
if (adr < 0xa000)
|
if (adr & 0x8000) return read_byte_io(adr);
|
||||||
return myRAM[adr];
|
else return myRAM[adr];
|
||||||
else
|
|
||||||
return read_byte_io(adr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a word (little-endian) from the CPU's address space
|
* Read a word (little-endian) from the CPU's address space
|
||||||
*/
|
*/
|
||||||
inline uint16 MOS6510::read_word(uint16 adr)
|
__attribute__ ((noinline)) uint16 MOS6510::read_word(uint16 adr)
|
||||||
{
|
{
|
||||||
return read_byte(adr) | (read_byte(adr+1) << 8);
|
return read_byte(adr) | (read_byte(adr+1) << 8);
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ private:
|
|||||||
uint8 read_byte(uint16 adr);
|
uint8 read_byte(uint16 adr);
|
||||||
uint8 read_byte_io(uint16 adr);
|
uint8 read_byte_io(uint16 adr);
|
||||||
uint16 read_word(uint16 adr);
|
uint16 read_word(uint16 adr);
|
||||||
|
uint16 read_word_slow(uint16 adr);
|
||||||
void write_byte(uint16 adr, uint8 byte);
|
void write_byte(uint16 adr, uint8 byte);
|
||||||
void write_byte_io(uint16 adr, uint8 byte);
|
void write_byte_io(uint16 adr, uint8 byte);
|
||||||
|
|
||||||
|
@ -142,11 +142,15 @@
|
|||||||
#else // CPU is 1541
|
#else // CPU is 1541
|
||||||
cpu_cycles += CycleDeltas[myConfig.cpuCycles];
|
cpu_cycles += CycleDeltas[myConfig.cpuCycles];
|
||||||
MOS6510 *localCPU = the_c64->TheCPU;
|
MOS6510 *localCPU = the_c64->TheCPU;
|
||||||
|
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 ...
|
// If we are 1541CPU, we want to alternate running instructions with the main CPU ...
|
||||||
while (cpu_cycles > cycles_left) cpu_cycles -= localCPU->EmulateLine(0);
|
while (cpu_cycles > cycles_left)
|
||||||
|
{
|
||||||
|
cpu_cycles -= localCPU->EmulateLine(0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (read_byte_imm())
|
switch (read_byte_imm())
|
||||||
@ -1376,6 +1380,9 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef IS_CPU_1541
|
#ifdef IS_CPU_1541
|
||||||
// See if there are any straggler cycles left for the CPU
|
// See if there are any straggler cycles left for the CPU
|
||||||
while (cpu_cycles > 0) cpu_cycles -= the_c64->TheCPU->EmulateLine(0);
|
while (cpu_cycles > 0)
|
||||||
|
{
|
||||||
|
cpu_cycles -= the_c64->TheCPU->EmulateLine(0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -273,7 +273,7 @@ static u32 total_frames __attribute__((section(".dtcm"))); /
|
|||||||
* Constructor: Initialize variables
|
* Constructor: Initialize variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void init_text_color_table(uint8 *colors)
|
void MOS6569::init_text_color_table(uint8 *colors)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
for (int j = 0; j < 16; j++)
|
for (int j = 0; j < 16; j++)
|
||||||
@ -364,11 +364,7 @@ void MOS6569::Reset(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
|
||||||
static void make_mc_table(void)
|
|
||||||
#else
|
|
||||||
void MOS6569::make_mc_table(void)
|
void MOS6569::make_mc_table(void)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
mc_color_lookup[0] = b0c_color | (b0c_color << 8);
|
mc_color_lookup[0] = b0c_color | (b0c_color << 8);
|
||||||
mc_color_lookup[1] = b1c_color | (b1c_color << 8);
|
mc_color_lookup[1] = b1c_color | (b1c_color << 8);
|
||||||
@ -380,11 +376,7 @@ void MOS6569::make_mc_table(void)
|
|||||||
* Convert video address to pointer
|
* Convert video address to pointer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
uint8 *MOS6569::get_physical(uint16 adr)
|
||||||
inline uint8 *get_physical(uint16 adr)
|
|
||||||
#else
|
|
||||||
inline uint8 *MOS6569::get_physical(uint16 adr)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int va = adr | cia_vabase;
|
int va = adr | cia_vabase;
|
||||||
if ((va & 0x7000) == 0x1000)
|
if ((va & 0x7000) == 0x1000)
|
||||||
@ -557,11 +549,7 @@ void MOS6569::SetState(MOS6569State *vd)
|
|||||||
* Trigger raster IRQ
|
* Trigger raster IRQ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
void MOS6569::raster_irq(void)
|
||||||
static inline void raster_irq(void)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::raster_irq(void)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
irq_flag |= 0x01;
|
irq_flag |= 0x01;
|
||||||
if (irq_mask & 0x01) {
|
if (irq_mask & 0x01) {
|
||||||
@ -575,7 +563,7 @@ inline void MOS6569::raster_irq(void)
|
|||||||
* Read from VIC register
|
* Read from VIC register
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ITCM_CODE uint8 MOS6569::ReadRegister(uint16 adr)
|
uint8 MOS6569::ReadRegister(uint16 adr)
|
||||||
{
|
{
|
||||||
switch (adr) {
|
switch (adr) {
|
||||||
case 0x00: case 0x02: case 0x04: case 0x06:
|
case 0x00: case 0x02: case 0x04: case 0x06:
|
||||||
@ -846,11 +834,7 @@ void MOS6569::TriggerLightpen(void)
|
|||||||
* VIC vertical blank: Reset counters and redraw screen
|
* VIC vertical blank: Reset counters and redraw screen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
|
||||||
static inline void vblank(void)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::vblank(void)
|
inline void MOS6569::vblank(void)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
raster_y = vc_base = 0;
|
raster_y = vc_base = 0;
|
||||||
lp_triggered = false;
|
lp_triggered = false;
|
||||||
@ -879,11 +863,7 @@ inline void MOS6569::vblank(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
__attribute__ ((noinline)) ITCM_CODE void MOS6569::el_std_text(uint8 *p, uint8 *q, uint8 *r)
|
||||||
ITCM_CODE void el_std_text(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_std_text(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
unsigned int b0cc = b0c;
|
unsigned int b0cc = b0c;
|
||||||
uint32 *lp = (uint32 *)p;
|
uint32 *lp = (uint32 *)p;
|
||||||
@ -910,11 +890,7 @@ inline void MOS6569::el_std_text(uint8 *p, uint8 *q, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
__attribute__ ((noinline)) ITCM_CODE void MOS6569::el_mc_text(uint8 *p, uint8 *q, uint8 *r)
|
||||||
ITCM_CODE void el_mc_text(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_mc_text(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint32 *wp = (uint32 *)p;
|
uint32 *wp = (uint32 *)p;
|
||||||
uint8 *cp = color_line;
|
uint8 *cp = color_line;
|
||||||
@ -958,11 +934,7 @@ inline void MOS6569::el_mc_text(uint8 *p, uint8 *q, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
||||||
void el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint32 *lp = (uint32 *)p;
|
uint32 *lp = (uint32 *)p;
|
||||||
uint8 *mp = matrix_line;
|
uint8 *mp = matrix_line;
|
||||||
@ -980,11 +952,7 @@ inline void MOS6569::el_std_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
||||||
void el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint16 lookup[4];
|
uint16 lookup[4];
|
||||||
uint32 *wp = (uint32 *)p;
|
uint32 *wp = (uint32 *)p;
|
||||||
@ -1023,11 +991,7 @@ inline void MOS6569::el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
|
||||||
static inline void el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint32 *lp = (uint32 *)p;
|
uint32 *lp = (uint32 *)p;
|
||||||
uint8 *cp = color_line;
|
uint8 *cp = color_line;
|
||||||
@ -1048,11 +1012,7 @@ inline void MOS6569::el_ecm_text(uint8 *p, uint8 *q, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
__attribute__ ((noinline)) ITCM_CODE void MOS6569::el_std_idle(uint8 *p, uint8 *r)
|
||||||
ITCM_CODE void el_std_idle(uint8 *p, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_std_idle(uint8 *p, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint8 data = *get_physical(ctrl1 & 0x40 ? 0x39ff : 0x3fff);
|
uint8 data = *get_physical(ctrl1 & 0x40 ? 0x39ff : 0x3fff);
|
||||||
uint32 *lp = (uint32 *)p;
|
uint32 *lp = (uint32 *)p;
|
||||||
@ -1067,11 +1027,7 @@ inline void MOS6569::el_std_idle(uint8 *p, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
void MOS6569::el_mc_idle(uint8 *p, uint8 *r)
|
||||||
ITCM_CODE void el_mc_idle(uint8 *p, uint8 *r)
|
|
||||||
#else
|
|
||||||
inline void MOS6569::el_mc_idle(uint8 *p, uint8 *r)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint8 data = *get_physical(0x3fff);
|
uint8 data = *get_physical(0x3fff);
|
||||||
uint32 *lp = (uint32 *)p - 1;
|
uint32 *lp = (uint32 *)p - 1;
|
||||||
@ -1092,7 +1048,7 @@ inline void MOS6569::el_mc_idle(uint8 *p, uint8 *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ITCM_CODE void el_sprites(uint8 *chunky_ptr)
|
__attribute__ ((noinline)) ITCM_CODE void MOS6569::el_sprites(uint8 *chunky_ptr)
|
||||||
{
|
{
|
||||||
unsigned spr_coll=0, gfx_coll=0;
|
unsigned spr_coll=0, gfx_coll=0;
|
||||||
|
|
||||||
@ -1375,11 +1331,7 @@ ITCM_CODE void el_sprites(uint8 *chunky_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLOBAL_VARS
|
__attribute__ ((noinline)) ITCM_CODE int MOS6569::el_update_mc(int raster)
|
||||||
ITCM_CODE int el_update_mc(int raster)
|
|
||||||
#else
|
|
||||||
inline int MOS6569::el_update_mc(int raster)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int cycles_used = 0;
|
int cycles_used = 0;
|
||||||
|
@ -79,9 +79,22 @@ public:
|
|||||||
void Reset(void);
|
void Reset(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef GLOBAL_VARS
|
|
||||||
void vblank(void);
|
void vblank(void);
|
||||||
void raster_irq(void);
|
void raster_irq(void);
|
||||||
|
uint8 *get_physical(uint16 adr);
|
||||||
|
void el_std_text(uint8 *p, uint8 *q, uint8 *r);
|
||||||
|
void el_mc_text(uint8 *p, uint8 *q, uint8 *r);
|
||||||
|
void el_std_bitmap(uint8 *p, uint8 *q, uint8 *r);
|
||||||
|
void el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r);
|
||||||
|
void el_ecm_text(uint8 *p, uint8 *q, uint8 *r);
|
||||||
|
void el_std_idle(uint8 *p, uint8 *r);
|
||||||
|
void el_mc_idle(uint8 *p, uint8 *r);
|
||||||
|
void el_sprites(uint8 *chunky_ptr);
|
||||||
|
int el_update_mc(int raster);
|
||||||
|
void init_text_color_table(uint8 *colors);
|
||||||
|
void make_mc_table(void);
|
||||||
|
|
||||||
|
#ifndef GLOBAL_VARS
|
||||||
|
|
||||||
uint16 mx[8]; // VIC registers
|
uint16 mx[8]; // VIC registers
|
||||||
uint8 my[8];
|
uint8 my[8];
|
||||||
@ -143,18 +156,6 @@ private:
|
|||||||
uint8 bad_lines_enabled; // Flag: Bad Lines enabled for this frame
|
uint8 bad_lines_enabled; // Flag: Bad Lines enabled for this frame
|
||||||
bool lp_triggered; // Flag: Lightpen was triggered in this frame
|
bool lp_triggered; // Flag: Lightpen was triggered in this frame
|
||||||
|
|
||||||
uint8 *get_physical(uint16 adr);
|
|
||||||
void make_mc_table(void);
|
|
||||||
void el_std_text(uint8 *p, uint8 *q, uint8 *r);
|
|
||||||
void el_mc_text(uint8 *p, uint8 *q, uint8 *r);
|
|
||||||
void el_std_bitmap(uint8 *p, uint8 *q, uint8 *r);
|
|
||||||
void el_mc_bitmap(uint8 *p, uint8 *q, uint8 *r);
|
|
||||||
void el_ecm_text(uint8 *p, uint8 *q, uint8 *r);
|
|
||||||
void el_std_idle(uint8 *p, uint8 *r);
|
|
||||||
void el_mc_idle(uint8 *p, uint8 *r);
|
|
||||||
void el_sprites(uint8 *chunky_ptr);
|
|
||||||
int el_update_mc(int raster);
|
|
||||||
|
|
||||||
uint16 mc_color_lookup[4];
|
uint16 mc_color_lookup[4];
|
||||||
|
|
||||||
bool border_40_col; // Flag: 40 column border
|
bool border_40_col; // Flag: 40 column border
|
||||||
|
Loading…
Reference in New Issue
Block a user