commodore64: autoload PRG images when the basic stub consists of only a SYS command

This commit is contained in:
saxxonpike 2012-11-07 18:59:00 +00:00
parent 483ef0d7e0
commit bae5c32915
1 changed files with 16 additions and 1 deletions
BizHawk.Emulation/Computers/Commodore64

View File

@ -52,7 +52,22 @@ namespace BizHawk.Emulation.Computers.Commodore64
//mem[0x0277] = 0x0D;
//mem[0x0278] = 0x0D;
cpu.PC = 2064;
if (data[0x05] == 0x00 && data[0x06] == 0x9E)
{
// sys command
int sysAddress = 0;
int sysIndex = 0x07;
while (data[sysIndex] != 0)
{
sysAddress *= 10;
sysAddress += (data[sysIndex] & 0xF);
sysIndex++;
}
if (sysAddress > 0 && sysAddress < 0x10000)
{
cpu.PC = (ushort)sysAddress;
}
}
loaded = true;
}