diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2018-07-16 21:27:33 +0100 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2018-07-16 21:27:33 +0100 |
| commit | ae3bb9819aad653d6a2ed972000e3c3696e39bf1 (patch) | |
| tree | 38cf07fc92c728807f03603ac0b0f7c51df77115 /src/main/kotlin/cpu/Registers.kt | |
| parent | 244cf2663133abb2fb861bce0474344999652f67 (diff) | |
| download | KGB-ae3bb9819aad653d6a2ed972000e3c3696e39bf1.tar.xz KGB-ae3bb9819aad653d6a2ed972000e3c3696e39bf1.zip | |
Implement JUMP ops
Diffstat (limited to 'src/main/kotlin/cpu/Registers.kt')
| -rw-r--r-- | src/main/kotlin/cpu/Registers.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/kotlin/cpu/Registers.kt b/src/main/kotlin/cpu/Registers.kt index 54539a8..81db1b0 100644 --- a/src/main/kotlin/cpu/Registers.kt +++ b/src/main/kotlin/cpu/Registers.kt @@ -131,6 +131,14 @@ class Registers { return currentSP } + fun addSignedByteToPC(byte: Int) { + PC = if (bm.isSignedByteNegative(byte)) { + (PC - bm.getAbsoluteValue(byte)) and 0xFFFF + } else { + (PC + bm.getAbsoluteValue(byte)) and 0xFFFF + } + } + fun getFlag(flag: Flag): Int { return (F shr flag.bitPosition) and 0x01 } |