mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-04-13 11:37:21 +00:00
Actually, all 6502 getWord usage has an invariant high page indicator.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
7432e602f8
commit
0604d5cf22
@ -65,7 +65,7 @@ namespace EightBit {
|
||||
void ADC_d(uint8_t data);
|
||||
|
||||
private:
|
||||
void interrupt(uint16_t vector);
|
||||
void interrupt(uint8_t vector);
|
||||
|
||||
void adjustZero(uint8_t datum) { clearFlag(P(), ZF, datum); }
|
||||
void adjustNegative(uint8_t datum) { setFlag(P(), NF, datum & NF); }
|
||||
@ -76,11 +76,6 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
void getWord(uint8_t page, uint8_t offset, register16_t& output);
|
||||
void getWord(uint8_t offset, register16_t& output);
|
||||
|
||||
void getWord(register16_t& output);
|
||||
void getWord(uint16_t offset, register16_t& output);
|
||||
void getWord(const register16_t& offset, register16_t& output);
|
||||
|
||||
virtual void push(uint8_t value) final;
|
||||
virtual uint8_t pop() final;
|
||||
@ -100,7 +95,7 @@ namespace EightBit {
|
||||
|
||||
void Address_ZeroPageIndirect() {
|
||||
Address_ZeroPage();
|
||||
getWord(MEMPTR().low, MEMPTR());
|
||||
getWord(0, MEMPTR().low, MEMPTR());
|
||||
}
|
||||
|
||||
void Address_Indirect() {
|
||||
@ -130,7 +125,7 @@ namespace EightBit {
|
||||
|
||||
void Address_IndexedIndirectX() {
|
||||
Address_ZeroPageX();
|
||||
getWord(MEMPTR().low, MEMPTR());
|
||||
getWord(0, MEMPTR().low, MEMPTR());
|
||||
}
|
||||
|
||||
void Address_IndirectIndexedY() {
|
||||
@ -512,9 +507,11 @@ namespace EightBit {
|
||||
void BRK();
|
||||
|
||||
const uint16_t PageOne = 0x100;
|
||||
const uint16_t IRQvector = 0xfffe;
|
||||
const uint16_t RSTvector = 0xfffc;
|
||||
const uint16_t NMIvector = 0xfffa;
|
||||
|
||||
// All interrupt vectors are on the 0xFF page
|
||||
const uint8_t IRQvector = 0xfe;
|
||||
const uint8_t RSTvector = 0xfc;
|
||||
const uint8_t NMIvector = 0xfa;
|
||||
|
||||
uint8_t x; // index register X
|
||||
uint8_t y; // index register Y
|
||||
|
@ -60,7 +60,7 @@ int EightBit::MOS6502::step() {
|
||||
|
||||
void EightBit::MOS6502::reset() {
|
||||
Processor::reset();
|
||||
getWord(RSTvector, PC());
|
||||
getWord(0xff, RSTvector, PC());
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::getWord(uint8_t page, uint8_t offset, register16_t& output) {
|
||||
@ -71,32 +71,12 @@ void EightBit::MOS6502::getWord(uint8_t page, uint8_t offset, register16_t& outp
|
||||
output.high = getByte();
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::getWord(uint8_t offset, register16_t& output) {
|
||||
getWord(0, offset, output);
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::getWord(register16_t& output) {
|
||||
output.low = getByte();
|
||||
BUS().ADDRESS().word++;
|
||||
output.high = getByte();
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::getWord(uint16_t offset, register16_t& output) {
|
||||
BUS().ADDRESS().word = offset;
|
||||
getWord(output);
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::getWord(const register16_t& offset, register16_t& output) {
|
||||
BUS().ADDRESS() = offset;
|
||||
getWord(output);
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::interrupt(uint16_t vector) {
|
||||
void EightBit::MOS6502::interrupt(uint8_t vector) {
|
||||
raise(HALT());
|
||||
pushWord(PC());
|
||||
push(P());
|
||||
setFlag(P(), IF);
|
||||
getWord(vector, PC());
|
||||
getWord(0xff, vector, PC());
|
||||
}
|
||||
|
||||
int EightBit::MOS6502::execute(uint8_t cell) {
|
||||
@ -556,5 +536,5 @@ void EightBit::MOS6502::BRK() {
|
||||
pushWord(PC());
|
||||
PHP();
|
||||
setFlag(P(), IF);
|
||||
getWord(IRQvector, PC());
|
||||
getWord(0xff, IRQvector, PC());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user