mirror of
https://github.com/bradgrantham/apple2e.git
synced 2024-07-03 17:29:29 +00:00
initialize CPU correctly, never set bit 4 or 5 of P
This commit is contained in:
parent
c798a2d886
commit
afb222f18f
10
cpu6502.h
10
cpu6502.h
|
@ -147,15 +147,15 @@ struct CPU6502
|
||||||
a(0),
|
a(0),
|
||||||
x(0),
|
x(0),
|
||||||
y(0),
|
y(0),
|
||||||
s(0),
|
s(0xFF),
|
||||||
p(0x20),
|
p(I),
|
||||||
exception(RESET)
|
exception(RESET)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
s = 0xFD;
|
s = 0xFF;
|
||||||
uint8_t low = bus.read(0xFFFC);
|
uint8_t low = bus.read(0xFFFC);
|
||||||
uint8_t high = bus.read(0xFFFD);
|
uint8_t high = bus.read(0xFFFD);
|
||||||
pc = low + high * 256;
|
pc = low + high * 256;
|
||||||
|
@ -1272,7 +1272,7 @@ struct CPU6502
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x28: { // PLP
|
case 0x28: { // PLP
|
||||||
p = stack_pull();
|
p = stack_pull() & ~ (B2 | B);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1547,7 +1547,7 @@ struct CPU6502
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x40: { // RTI
|
case 0x40: { // RTI
|
||||||
p = stack_pull();
|
p = stack_pull() & ~ (B2 | B);
|
||||||
uint8_t pcl = stack_pull();
|
uint8_t pcl = stack_pull();
|
||||||
uint8_t pch = stack_pull();
|
uint8_t pch = stack_pull();
|
||||||
pc = pcl + pch * 256;
|
pc = pcl + pch * 256;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user