Butchers algorithm in Jasmin -
i keep getting errors , have been trying print forever seems. ive looked info on jasmin , far can tell there isn't lot of information. code appreciated. i'm supposed use butchers algorithm print jasmin on command line next 10 years of easter. of problem in printing of month , code below.....
.class public example/easterdeb .super java/lang/object ; ; standard initializer .method public <init>()v aload_0 invokenonvirtual java/lang/object/<init>()v return .end method .method public static main([ljava/lang/string;)v ; set limits used method .limit locals 20 .limit stack 6 ; setup local variables: ; 1 - printstream object held in java.lang.system.out getstatic java/lang/system/out ljava/io/printstream; astore_1 ; 2 - integer 10 - counter used in loop bipush 10 sipush 2016 istore_2 ;count in 2 istore 4 ;year in 4 ; loop 10 times printing out number loop: ; compute 10 - <local variable 2> ... iload 4 ;year bipush 19 irem istore 5 ; in 5 iload 4 bipush 100 idiv istore 6 ; b in 6 iload 4 bipush 100 irem istore 7 ; c in 7 iload 7 iload 6 bipush 4 idiv istore 8 ; d in 8 iload 6 bipush 4 irem istore 9 ; e in 9 iload 6 bipush 8 iadd bipush 25 idiv istore 10 ; f in 10 iload 6 iload 10 isub bipush 1 iadd bipush 3 idiv istore 11 ; g in 11 bipush 19 iload 5 imul iload 6 iadd iload 8 isub iload 11 isub bipush 15 iadd bipush 30 irem istore 12 ; h in 12 iload 7 bipush 4 idiv istore 13 ; in 13 iload 7 bipush 4 irem istore 14 ; k in 14 bipush 32 bipush 2 iload 9 ;load e imul iadd bipush 2 iadd iload 13 ; load imul iload 12 ; load h isub iload 14 ; load k isub bipush 7 irem istore 15 ; x in 15 iload 5 bipush 11 iload 12 imul iadd bipush 22 iload 15 imul iadd sipush 451 idiv istore 16 ; m in 16 iload 12 iload 15 iadd bipush 7 iload 16 imul isub bipush 114 iadd bipush 31 idiv istore 17 ; easter month in 17 iload 12 iload 15 iadd bipush 7 iload 16 imul isub bipush 114 iadd bipush 31 irem bipush 1 iadd istore 18 ; p in 18 iload 17 bipush 4 isub ifeq print_april aload_1 ldc "march" swap goto print_it print_april: aload_1 ldc "april" print_it: invokestatic java/lang/string/valueof(i)ljava/lang/string; astore_3 ; ... , print aload_1 ; push printstream object aload_3 ; push string created - ... invokevirtual java/io/printstream/println(ljava/lang/string;)v ; decrement counter , loop iinc 4 1 ;increment year iinc 2 -1 iload_2 ifne loop ; done return .end method
so figured out here is
.class public easter
.super java/lang/object
.method public ()v
aload_0
invokespecial java/lang/object/()v
return
.end method
.method public static main([ljava/lang/string;)v
.limit stack 100 .limit locals 50 getstatic java/lang/system/out ljava/io/printstream; astore_1 ; 2 - integer 10 - counter used in loop sipush 2009 istore 4 ;year in 4 bipush 10 istore_2 ;count in 2 ; loop 10 times printing out number loop: iinc 4 1 iload 4 bipush 19 irem istore 5 ; in 5 iload 4 bipush 100 idiv istore 6 ; b in 6 iload 4 bipush 100 irem istore 7 ; c in 7 iload 6 bipush 4 idiv istore 8 ; d in 8 iload 6 bipush 4 irem istore 9 ; e in 9 iload 6 bipush 8 iadd bipush 25 idiv istore 10 ; f in 10 iload 6 iload 10 isub bipush 1 iadd bipush 3 idiv istore 11 ; g in 11 bipush 19 iload 5 imul iload 6 bipush 15 iadd iadd iload 8 iload 11 iadd isub bipush 30 irem istore 12 ; h in 12 iload 7 bipush 4 idiv istore 13 ; in 13 iload 7 bipush 4 irem istore 14 ; k in 14 bipush 2 iload 9 ;load e imul bipush 2 iload 13 ; load imul bipush 32 iadd iadd iload 12 ; load h iload 14 ; load k iadd isub bipush 7 irem istore 15 ; x in 15 bipush 11 iload 12 ;load h imul bipush 22 iload 15 imul iload 5 ;load iadd iadd sipush 451 idiv istore 16 ; m in 16 iload 12 iload 15 bipush 114 iadd iadd bipush 7 iload 16 imul isub istore 17 iload 17 bipush 31 idiv istore 18 ; easter month in 17 iload 17 bipush 31 irem istore 19 ; p in 19 iload 18 bipush 4 isub ifeq print_april aload_1 ldc "march " goto print_it print_april: aload_1 ldc "april " goto print_it print_it: invokevirtual java/io/printstream/print(ljava/lang/string;)v aload_1 iload 19 bipush 1 iadd invokestatic java/lang/string/valueof(i)ljava/lang/string; invokevirtual java/io/printstream/print(ljava/lang/string;)v aload_1 ldc ", " invokevirtual java/io/printstream/print(ljava/lang/string;)v aload_1 iload 4 invokestatic java/lang/string/valueof(i)ljava/lang/string; invokevirtual java/io/printstream/print(ljava/lang/string;)v aload_1 ldc "\n" invokevirtual java/io/printstream/print(ljava/lang/string;)v iinc 2 -1 ; check loop iload_2 ifne loop return
.end method
Comments
Post a Comment