I'm trying to implement branching in my jasmin byte code program but whatever I try I always get a syntax error on the branching. The code should check if the 2 numbers are equal and if true print "true" else jump to the end label and quit program.
I have used the official jasmin instructions page as example.
Error:
test.j:13: Warning - Syntax error.
if_icmpeg L1
^
test.j:15: JAS Error: Missing arguments for instruction goto.
L
^
test.j: Found 2 errors
Jasmin byte code file:
.class public test
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 99
.limit locals 99
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc 5
ldc 3
isub
ldc 7
if_icmpeg L1
goto LE1
L1:
ldc "true"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
LE1:
return
.end method
You have a typo. It should be if_icmpeq
, not if_icmpeg
.
On a side note, have you considered trying the Krakatau assembler? I believe it would give a more useful error message in this situation.