Add mutable addressing mode reads to spc700

This commit is contained in:
scawful
2023-12-09 13:39:59 -05:00
parent 87db938963
commit 231ef4678a
3 changed files with 217 additions and 9 deletions

View File

@@ -17,6 +17,12 @@ uint8_t Spc700::dp() {
return read((PSW.P << 8) + offset);
}
uint8_t& Spc700::mutable_dp() {
PC++;
uint8_t offset = read(PC);
return mutable_read((PSW.P << 8) + offset);
}
uint8_t Spc700::get_dp_addr() {
PC++;
uint8_t offset = read(PC);
@@ -40,19 +46,15 @@ uint8_t Spc700::dp_plus_y() {
// Indexed indirect (add index before 16-bit lookup).
uint16_t Spc700::dp_plus_x_indirect() {
PC++;
uint8_t offset = read(PC);
uint16_t addr = read((PSW.P << 8) + offset + X) |
(read((PSW.P << 8) + offset + X + 1) << 8);
uint16_t addr = read_16(PC + X);
return addr;
}
// Indirect indexed (add index after 16-bit lookup).
uint16_t Spc700::dp_indirect_plus_y() {
PC++;
uint8_t offset = read(PC);
uint16_t baseAddr =
read((PSW.P << 8) + offset) | (read((PSW.P << 8) + offset + 1) << 8);
return baseAddr + Y;
uint16_t offset = read_16(PC);
return offset + Y;
}
uint16_t Spc700::abs() {