mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-09-29 00:54:54 +00:00
Correct some outstanding LR35902 problems arising.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
016b3bca59
commit
88d773708c
@ -80,22 +80,19 @@ namespace EightBit {
|
|||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
void writeRegister(int offset, uint8_t content) {
|
void writeRegister(int offset, uint8_t content) {
|
||||||
REG(offset) = content;
|
return Memory::write(BASE + offset, content);
|
||||||
fireWriteBusEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t readRegister(int offset) {
|
uint8_t readRegister(int offset) {
|
||||||
auto returned = REG(offset);
|
return Memory::read(BASE + offset);
|
||||||
fireReadBusEvent();
|
|
||||||
return returned;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void incrementLY() {
|
void incrementLY() {
|
||||||
REG(LY) = (REG(LY) + 1) % TotalLineCount;
|
writeRegister(LY, (readRegister(LY) + 1) % TotalLineCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetLY() {
|
void resetLY() {
|
||||||
REG(LY) = 0;
|
writeRegister(LY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadBootRom(const std::string& path);
|
void loadBootRom(const std::string& path);
|
||||||
@ -110,10 +107,5 @@ namespace EightBit {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<uint8_t, 0x100> m_boot;
|
std::array<uint8_t, 0x100> m_boot;
|
||||||
|
|
||||||
uint8_t& REG(int offset) {
|
|
||||||
ADDRESS().word = BASE + offset;
|
|
||||||
return Memory::reference();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -6,8 +6,8 @@ EightBit::Bus::Bus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EightBit::Bus::reset() {
|
void EightBit::Bus::reset() {
|
||||||
REG(NR52) = 0xf1;
|
writeRegister(NR52, 0xf1);
|
||||||
REG(LCDC) = 0x91;
|
writeRegister(LCDC, 0x91);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EightBit::Bus::loadBootRom(const std::string& path) {
|
void EightBit::Bus::loadBootRom(const std::string& path) {
|
||||||
|
@ -570,16 +570,16 @@ void EightBit::LR35902::executeOther(int x, int y, int z, int p, int q) {
|
|||||||
case 7: // Assorted operations on accumulator/flags
|
case 7: // Assorted operations on accumulator/flags
|
||||||
switch (y) {
|
switch (y) {
|
||||||
case 0:
|
case 0:
|
||||||
rlc(f, a);
|
a = rlc(f, a);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
rrc(f, a);
|
a = rrc(f, a);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
rl(f, a);
|
a = rl(f, a);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
rr(f, a);
|
a = rr(f, a);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
daa(a, f);
|
daa(a, f);
|
||||||
|
Loading…
Reference in New Issue
Block a user