mirror of
https://github.com/bradgrantham/apple2e.git
synced 2024-09-29 09:54:45 +00:00
add INC, DEC, and STA (zpg)
This commit is contained in:
parent
471fdffcf5
commit
c3adb3abe6
31
apple2e.cpp
31
apple2e.cpp
@ -49,7 +49,10 @@ struct system_clock
|
|||||||
clk_t operator++(int) { clk_t v = value; value ++; return v; }
|
clk_t operator++(int) { clk_t v = value; value ++; return v; }
|
||||||
} clk;
|
} clk;
|
||||||
|
|
||||||
const int machine_clock_rate = 1023000;
|
// was 1023000
|
||||||
|
// 3.579545 * 4 / 14
|
||||||
|
// 1.02272714285714285714
|
||||||
|
const int machine_clock_rate = 1022727;
|
||||||
|
|
||||||
bool read_blob(char *name, unsigned char *b, size_t sz)
|
bool read_blob(char *name, unsigned char *b, size_t sz)
|
||||||
{
|
{
|
||||||
@ -986,7 +989,7 @@ struct CPU6502
|
|||||||
static const unsigned char I = 0x04;
|
static const unsigned char I = 0x04;
|
||||||
static const unsigned char Z = 0x02;
|
static const unsigned char Z = 0x02;
|
||||||
static const unsigned char C = 0x01;
|
static const unsigned char C = 0x01;
|
||||||
int pc;
|
int pc = 0;
|
||||||
enum Exception {
|
enum Exception {
|
||||||
NONE,
|
NONE,
|
||||||
RESET,
|
RESET,
|
||||||
@ -2027,7 +2030,7 @@ struct CPU6502
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x91: { // STA
|
case 0x91: { // STA (ind), Y
|
||||||
unsigned char zpg = read_pc_inc(bus);
|
unsigned char zpg = read_pc_inc(bus);
|
||||||
int addr = bus.read(zpg) + bus.read((zpg + 1) & 0xFF) * 256 + y;
|
int addr = bus.read(zpg) + bus.read((zpg + 1) & 0xFF) * 256 + y;
|
||||||
bus.write(addr, a);
|
bus.write(addr, a);
|
||||||
@ -2352,6 +2355,23 @@ struct CPU6502
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 0x92: { // STA (zpg), 65C02 instruction!
|
||||||
|
unsigned char zpg = read_pc_inc(bus);
|
||||||
|
int addr = bus.read(zpg) + bus.read((zpg + 1) & 0xFF) * 256;
|
||||||
|
bus.write(addr, a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x3A: { // DEC
|
||||||
|
set_flags(N | Z, a = a - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 0x1A: { // INC
|
||||||
|
set_flags(N | Z, a = a + 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("unhandled instruction %02X\n", inst);
|
printf("unhandled instruction %02X\n", inst);
|
||||||
fflush(stdout); exit(1);
|
fflush(stdout); exit(1);
|
||||||
@ -2602,6 +2622,7 @@ enum APPLE2Einterface::EventType process_events(MAINboard *board, bus_frontend&
|
|||||||
return APPLE2Einterface::NONE;
|
return APPLE2Einterface::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern uint16_t pc;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -2740,7 +2761,7 @@ int main(int argc, char **argv)
|
|||||||
clk_t prev_clock = clk;
|
clk_t prev_clock = clk;
|
||||||
while(clk - prev_clock < clocks_per_slice) {
|
while(clk - prev_clock < clocks_per_slice) {
|
||||||
if(debug & DEBUG_DECODE) {
|
if(debug & DEBUG_DECODE) {
|
||||||
string dis = read_bus_and_disassemble(bus, cpu.pc);
|
string dis = read_bus_and_disassemble(bus, use_fake6502 ? pc : cpu.pc);
|
||||||
printf("%s\n", dis.c_str());
|
printf("%s\n", dis.c_str());
|
||||||
}
|
}
|
||||||
if(use_fake6502) {
|
if(use_fake6502) {
|
||||||
@ -2804,7 +2825,7 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(debug & DEBUG_DECODE) {
|
if(debug & DEBUG_DECODE) {
|
||||||
string dis = read_bus_and_disassemble(bus, cpu.pc);
|
string dis = read_bus_and_disassemble(bus, use_fake6502 ? pc : cpu.pc);
|
||||||
printf("%s\n", dis.c_str());
|
printf("%s\n", dis.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user