Refactor rewind functionality with circular buffer, update BufferedImageData handling in DisplayView, enhance ConsoleView rendering updates, and integrate SnakeCode data.

This commit is contained in:
2025-08-17 20:32:12 +02:00
parent f169dce339
commit 37691dc7fa
15 changed files with 4916 additions and 4854 deletions

View File

@@ -57,7 +57,7 @@ abstract class Instruction(
if (ls != null) {
return ls
}
val jumpReg = JumpInstruction.disassemble(instruction)
val jumpReg = JumpRegisterInstruction.disassemble(instruction)
if (jumpReg != null) {
return jumpReg
}
@@ -65,7 +65,7 @@ abstract class Instruction(
if (jump != null) {
return jump
}
return "<unknown>"
return ""
}
}
}

View File

@@ -26,10 +26,16 @@ class JumpRegisterInstruction(
companion object {
fun disassemble(instruction: Short): String? {
if (BinaryUtils.getBits(16, 5, instruction).toInt() == 9) {
if (BinaryUtils.getBits(16, 4, instruction).toInt() == 9) {
val reg = BinaryUtils.getBits(4, 4, instruction)
val sb = StringBuilder("jr")
sb.append(fromInteger(reg.toInt()))
if (reg.toInt() == 11) {
return "ret"
} else {
val sb = StringBuilder("jr")
sb.append(" ")
sb.append(fromInteger(reg.toInt()))
return sb.toString()
}
}
return null
}