aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cpu/Registers.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/cpu/Registers.kt')
-rw-r--r--src/main/kotlin/cpu/Registers.kt16
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