Skip to content

Commit 079429e

Browse files
committed
jmp modification to auto use ZF
1 parent da507c4 commit 079429e

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

main.kar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
lit g1 10
2-
lit g2 10
2+
lit g2 11
33
eq g1 g2
4-
jz 10 i4
4+
jz 10
55
str f1 "They are equal"
66
call println
77
lit f1 0

src/main/kotlin/engine/Parser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fun parser(file: List<String>): List<InstructData> {
154154
// Long
155155
"jmp", "jz", "jnz" -> {
156156
InstructData(
157-
name = "jmp", arrayOf(line[1].toInt())
157+
name = instruction, arrayOf(line[1].toInt())
158158
)
159159
}
160160

src/main/kotlin/internals/instructions/controlFlow/jnz.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import vm
1515
* @throws GeneralControlFlowException If an error occurs during the jump operation.
1616
*/
1717
fun ControlFlow.jnz(targetAddress: Int): Any = try {
18-
1918
if (registers.read(intelNames[IntelRegisters.ZF]) != 0L) {
2019
vm.pc = targetAddress
2120
} else {

0 commit comments

Comments
 (0)