Limit Load_PRG() debug output on IO access

This commit is contained in:
Thomas Bernard 2019-12-08 15:49:07 +01:00
parent ba407e87cc
commit 0dbeaee4d6
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
2 changed files with 37 additions and 8 deletions

View File

@ -41,6 +41,8 @@
#define CPU_6502_USE_LOCAL_HEADER #define CPU_6502_USE_LOCAL_HEADER
#include "6502.h" #include "6502.h"
#define MAX_IO_ACCESS_MSG_COUNT 10
/** /**
* Check if it is a machine langage program with a BASIC * Check if it is a machine langage program with a BASIC
* startup line (eg. 10 SYS2061) * startup line (eg. 10 SYS2061)
@ -96,23 +98,37 @@ word C64_isBinaryProgram(FILE * f)
static byte C64_mem_read(void *context, word address) static byte C64_mem_read(void *context, word address)
{ {
if ((((struct c64state *)context)->ram[1] & 2) && address >= 0xe000) struct c64state * c64 = (struct c64state *)context;
if ((c64->ram[1] & 2) && address >= 0xe000)
{ {
GFX2_Log(GFX2_WARNING, "** ROM ** read($%04x)\n", address); GFX2_Log(GFX2_WARNING, "** ROM ** read($%04x)\n", address);
if (address == 0xffe4) if (address == 0xffe4)
((struct c64state *)context)->keyjoyread++; c64->keyjoyread++;
return 0x60; // RTS return 0x60; // RTS
} }
if ((((struct c64state *)context)->ram[1] & 4) && if ((c64->ram[1] & 4) &&
(address >= 0xd000) && (address < 0xe000)) (address >= 0xd000) && (address < 0xe000))
{ {
GFX2_Log(GFX2_DEBUG, "** IO ** read($%04x) $%02x\n", if ((address & 0xff00) == 0xd000)
address, ((struct c64state *)context)->ram[address]); {
if (c64->ioaccess[address - 0xd000] < MAX_IO_ACCESS_MSG_COUNT)
{
GFX2_Log(GFX2_DEBUG, "** IO ** read($%04x) $%02x\n",
address, c64->ram[address]);
if (++c64->ioaccess[address - 0xd000] == MAX_IO_ACCESS_MSG_COUNT)
GFX2_Log(GFX2_DEBUG, " stopping debug log on $%04x\n", address);
}
}
else
{
GFX2_Log(GFX2_DEBUG, "** IO ** read($%04x) $%02x\n",
address, c64->ram[address]);
}
if ((address & 0xfffe) == 0xdc00) if ((address & 0xfffe) == 0xdc00)
((struct c64state *)context)->keyjoyread++; c64->keyjoyread++;
} }
return ((struct c64state *)context)->ram[address]; return c64->ram[address];
} }
static void C64_mem_write(void *context, word address, byte value) static void C64_mem_write(void *context, word address, byte value)
@ -121,7 +137,19 @@ static void C64_mem_write(void *context, word address, byte value)
if ((address >= 0xd000 && address < 0xd800) || if ((address >= 0xd000 && address < 0xd800) ||
(address >= 0xdc00 && address < 0xe000)) (address >= 0xdc00 && address < 0xe000))
{ {
GFX2_Log(GFX2_DEBUG, "** IO ** write($%04x, $%02x)\n", address, value); if ((address & 0xff00) == 0xd000)
{
if (c64->ioaccess[address - 0xd000] < MAX_IO_ACCESS_MSG_COUNT)
{
GFX2_Log(GFX2_DEBUG, "** IO ** write($%04x, $%02x)\n", address, value);
if (++c64->ioaccess[address - 0xd000] == MAX_IO_ACCESS_MSG_COUNT)
GFX2_Log(GFX2_DEBUG, " stopping debug log on $%04x\n", address);
}
}
else
{
GFX2_Log(GFX2_DEBUG, "** IO ** write($%04x, $%02x)\n", address, value);
}
switch (address) switch (address)
{ {
case 0xd011: case 0xd011:

View File

@ -45,6 +45,7 @@ struct c64state {
byte fliscreens[8]; byte fliscreens[8];
byte backgrounds[200]; byte backgrounds[200];
byte vicmode; byte vicmode;
byte ioaccess[256];
}; };
word C64_isBinaryProgram(FILE * f); word C64_isBinaryProgram(FILE * f);