HW9: bonus working and optimized

This commit is contained in:
Claudio Maggioni 2018-11-30 15:44:39 +01:00
parent 522dafe05a
commit 7535965955

View file

@ -4,28 +4,23 @@ OBJREF 0x40
.main
.var
a
b
min
.end-var
LDC_W OBJREF
INVOKEVIRTUAL getnum
ISTORE a
LDC_W OBJREF
LDC_W OBJREF
INVOKEVIRTUAL getnum
ISTORE b
ILOAD a
ILOAD b
LDC_W OBJREF
INVOKEVIRTUAL getnum
INVOKEVIRTUAL min
INVOKEVIRTUAL print
HALT
.end-main
.method min(x,y)
.var
.end-var
ILOAD x
ILOAD y
ILOAD x
ISUB
IFLT returny
ILOAD x