Skip to content

Commit

Permalink
Read IE from Memory (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
kremi151 committed Dec 28, 2020
1 parent a968bc6 commit d1499c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/source/emulator/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ bool CPU::doInterrupts(Memory &memory) {
}
u8 &_if = ioRegisters.getIF();
_if %= 0x1fu;
u8 _ie = ioRegisters.getIE() & 0x1fu;
u8 _ie = memory.getIE() & 0x1fu;
u8 _intr = _if & _ie & 0x1f;
if (!_intr) {
return false;
Expand Down
5 changes: 0 additions & 5 deletions core/source/emulator/io_registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#define __FB_REG_OFFSET_OBP1 (FB_REG_OBP1 - 0xFF00)
#define __FB_REG_OFFSET_WY (FB_REG_WY - 0xFF00)
#define __FB_REG_OFFSET_WX (FB_REG_WX - 0xFF00)
#define __FB_REG_OFFSET_IE (FB_REG_IE - 0xFF00)

namespace FunkyBoy {

Expand Down Expand Up @@ -156,10 +155,6 @@ namespace FunkyBoy {
return *(hwIO + __FB_REG_OFFSET_WY);
}

inline u8 &getIE() {
return *(hwIO + __FB_REG_OFFSET_IE);
}

friend class CPU;
};

Expand Down
4 changes: 4 additions & 0 deletions core/source/memory/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ namespace FunkyBoy {

void doDMA();

inline u8 getIE() {
return interruptEnableRegister;
}

#ifdef FB_TESTING
io_registers &getIoRegisters();
#endif
Expand Down

0 comments on commit d1499c3

Please sign in to comment.