mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-11 02:29:50 +00:00
Further return by value, rather than reference.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
adf506a41e
commit
c6eb68ba13
@ -65,7 +65,7 @@ namespace EightBit {
|
||||
adjustNegative(datum);
|
||||
}
|
||||
|
||||
void getWordPaged(uint8_t page, uint8_t offset, register16_t& output);
|
||||
register16_t getWordPaged(uint8_t page, uint8_t offset);
|
||||
uint8_t getBytePaged(uint8_t page, uint8_t offset);
|
||||
void setBytePaged(uint8_t page, uint8_t offset, uint8_t value);
|
||||
|
||||
@ -85,12 +85,12 @@ namespace EightBit {
|
||||
|
||||
void Address_ZeroPageIndirect() {
|
||||
Address_ZeroPage();
|
||||
getWordPaged(0, MEMPTR().low, MEMPTR());
|
||||
MEMPTR() = getWordPaged(0, MEMPTR().low);
|
||||
}
|
||||
|
||||
void Address_Indirect() {
|
||||
Address_Absolute();
|
||||
getWordPaged(MEMPTR().high, MEMPTR().low, MEMPTR());
|
||||
MEMPTR() = getWordPaged(MEMPTR().high, MEMPTR().low);
|
||||
}
|
||||
|
||||
void Address_ZeroPageX() {
|
||||
@ -119,7 +119,7 @@ namespace EightBit {
|
||||
|
||||
void Address_IndexedIndirectX() {
|
||||
Address_ZeroPageX();
|
||||
getWordPaged(0, MEMPTR().low, MEMPTR());
|
||||
MEMPTR() = getWordPaged(0, MEMPTR().low);
|
||||
}
|
||||
|
||||
bool Address_IndirectIndexedY() {
|
||||
|
@ -47,13 +47,15 @@ int EightBit::MOS6502::step() {
|
||||
|
||||
void EightBit::MOS6502::reset() {
|
||||
Processor::reset();
|
||||
getWordPaged(0xff, RSTvector, PC());
|
||||
PC() = getWordPaged(0xff, RSTvector);
|
||||
}
|
||||
|
||||
void EightBit::MOS6502::getWordPaged(uint8_t page, uint8_t offset, register16_t& output) {
|
||||
output.low = getBytePaged(page, offset);
|
||||
EightBit::register16_t EightBit::MOS6502::getWordPaged(uint8_t page, uint8_t offset) {
|
||||
EightBit::register16_t returned;
|
||||
returned.low = getBytePaged(page, offset);
|
||||
BUS().ADDRESS().low++;
|
||||
output.high = getByte();
|
||||
returned.high = getByte();
|
||||
return returned;
|
||||
}
|
||||
|
||||
uint8_t EightBit::MOS6502::getBytePaged(uint8_t page, uint8_t offset) {
|
||||
@ -73,7 +75,7 @@ void EightBit::MOS6502::interrupt(uint8_t vector) {
|
||||
pushWord(PC());
|
||||
push(P());
|
||||
setFlag(P(), IF);
|
||||
getWordPaged(0xff, vector, PC());
|
||||
PC() = getWordPaged(0xff, vector);
|
||||
}
|
||||
|
||||
int EightBit::MOS6502::execute(uint8_t cell) {
|
||||
@ -545,5 +547,5 @@ void EightBit::MOS6502::BRK() {
|
||||
pushWord(PC());
|
||||
PHP();
|
||||
setFlag(P(), IF);
|
||||
getWordPaged(0xff, IRQvector, PC());
|
||||
PC() = getWordPaged(0xff, IRQvector);
|
||||
}
|
||||
|
@ -315,10 +315,10 @@ namespace EightBit {
|
||||
void retn();
|
||||
void reti();
|
||||
|
||||
bool jrConditionalFlag(uint8_t& f, int flag);
|
||||
bool returnConditionalFlag(uint8_t& f, int flag);
|
||||
bool jumpConditionalFlag(uint8_t& f, int flag);
|
||||
bool callConditionalFlag(uint8_t& f, int flag);
|
||||
bool jrConditionalFlag(uint8_t f, int flag);
|
||||
bool returnConditionalFlag(uint8_t f, int flag);
|
||||
bool jumpConditionalFlag(uint8_t f, int flag);
|
||||
bool callConditionalFlag(uint8_t f, int flag);
|
||||
|
||||
void sbc(uint8_t& f, register16_t& operand, register16_t value);
|
||||
void adc(uint8_t& f, register16_t& operand, register16_t value);
|
||||
|
@ -73,7 +73,7 @@ void EightBit::Z80::decrement(uint8_t& f, uint8_t& operand) {
|
||||
setFlag(f, VF, operand == Mask7);
|
||||
}
|
||||
|
||||
bool EightBit::Z80::jrConditionalFlag(uint8_t& f, const int flag) {
|
||||
bool EightBit::Z80::jrConditionalFlag(uint8_t f, const int flag) {
|
||||
switch (flag) {
|
||||
case 0: // NZ
|
||||
return jrConditional(!(f & ZF));
|
||||
@ -89,7 +89,7 @@ bool EightBit::Z80::jrConditionalFlag(uint8_t& f, const int flag) {
|
||||
throw std::logic_error("Unhandled JR conditional");
|
||||
}
|
||||
|
||||
bool EightBit::Z80::jumpConditionalFlag(uint8_t& f, const int flag) {
|
||||
bool EightBit::Z80::jumpConditionalFlag(uint8_t f, const int flag) {
|
||||
switch (flag) {
|
||||
case 0: // NZ
|
||||
return jumpConditional(!(f & ZF));
|
||||
@ -122,7 +122,7 @@ void EightBit::Z80::reti() {
|
||||
retn();
|
||||
}
|
||||
|
||||
bool EightBit::Z80::returnConditionalFlag(uint8_t& f, const int flag) {
|
||||
bool EightBit::Z80::returnConditionalFlag(uint8_t f, const int flag) {
|
||||
switch (flag) {
|
||||
case 0: // NZ
|
||||
return returnConditional(!(f & ZF));
|
||||
@ -146,7 +146,7 @@ bool EightBit::Z80::returnConditionalFlag(uint8_t& f, const int flag) {
|
||||
throw std::logic_error("Unhandled RET conditional");
|
||||
}
|
||||
|
||||
bool EightBit::Z80::callConditionalFlag(uint8_t& f, const int flag) {
|
||||
bool EightBit::Z80::callConditionalFlag(uint8_t f, const int flag) {
|
||||
switch (flag) {
|
||||
case 0: // NZ
|
||||
return callConditional(!(f & ZF));
|
||||
|
Loading…
x
Reference in New Issue
Block a user