diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2018-06-15 22:10:47 +0100 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2018-06-15 22:10:47 +0100 |
| commit | d8dbfe55f4741a9cf70c1b95762461e08eb08f22 (patch) | |
| tree | 779df3fc4192b251da8f9f1e9e712376d9f096c9 /src/main/kotlin/cpu/Registers.kt | |
| parent | 22f3463e3128947df69cb6444c82bd73350d5cc5 (diff) | |
| download | KGB-d8dbfe55f4741a9cf70c1b95762461e08eb08f22.tar.xz KGB-d8dbfe55f4741a9cf70c1b95762461e08eb08f22.zip | |
Add all 8-Bit Load opcodes
Diffstat (limited to 'src/main/kotlin/cpu/Registers.kt')
| -rw-r--r-- | src/main/kotlin/cpu/Registers.kt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/cpu/Registers.kt b/src/main/kotlin/cpu/Registers.kt index 7aa144f..6d1e626 100644 --- a/src/main/kotlin/cpu/Registers.kt +++ b/src/main/kotlin/cpu/Registers.kt @@ -99,5 +99,21 @@ class Registers { L = bm.getLsb(value) } + fun getAndDecrementHL(): Int { + val currentHL = HL + if(HL > 0x0000) { // TODO - is this correct? Or should it underflow to 0xFFFF?. Also for increment op. + HL-- + } + return currentHL + } + + fun getAndIncrementHL(): Int { + val currentHL = HL + if(HL < 0xFFFF) { + HL++ + } + return currentHL + } + }
\ No newline at end of file |