--- a/progs/fib.j Tue Nov 27 07:53:57 2018 +0000
+++ b/progs/fib.j Wed Nov 28 23:45:37 2018 +0000
@@ -13,44 +13,11 @@
.limit stack 2
getstatic java/lang/System/out Ljava/io/PrintStream;
iload 0
- invokevirtual java/io/PrintStream/println(I)V
+ i2c
+ invokevirtual java/io/PrintStream/print(C)V
return
.end method
-.method public static read()I
- .limit locals 10
- .limit stack 10
-
- ldc 0
- istore 1 ; this will hold our final integer
-Label1:
- getstatic java/lang/System/in Ljava/io/InputStream;
- invokevirtual java/io/InputStream/read()I
- istore 2
- iload 2
- ldc 10 ; the newline delimiter
- isub
- ifeq Label2
- iload 2
- ldc 32 ; the space delimiter
- isub
- ifeq Label2
-
- iload 2
- ldc 48 ; we have our digit in ASCII, have to subtract it from 48
- isub
- ldc 10
- iload 1
- imul
- iadd
- istore 1
- goto Label1
-Label2:
- ;when we come here we have our integer computed in local variable 1
- iload 1
- ireturn
-.end method
-
.method public static main([Ljava/lang/String;)V
.limit locals 200
.limit stack 200