mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add some samples of Jasmin assembly
This commit is contained in:
56
samples/Jasmin/if1.j
Normal file
56
samples/Jasmin/if1.j
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
.class public if1
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If556261059
|
||||||
|
goto IfElse556261059
|
||||||
|
If556261059:
|
||||||
|
.line 3
|
||||||
|
.line 3
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone556261059
|
||||||
|
IfElse556261059:
|
||||||
|
.line 5
|
||||||
|
.line 5
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x2
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfDone556261059:
|
||||||
|
|
||||||
|
.line 6
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x3
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
|
||||||
|
.line 7
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpne IfNot-920218690
|
||||||
|
.line 8
|
||||||
|
.line 8
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x4
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfNot-920218690:
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
167
samples/Jasmin/if2.j
Normal file
167
samples/Jasmin/if2.j
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
.class public if2
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq Cmp1893841232
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone1893841232
|
||||||
|
Cmp1893841232:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone1893841232:
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If-1736765035
|
||||||
|
goto IfElse-1736765035
|
||||||
|
If-1736765035:
|
||||||
|
.line 2
|
||||||
|
.line 3
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone-1736765035
|
||||||
|
IfElse-1736765035:
|
||||||
|
.line 4
|
||||||
|
.line 4
|
||||||
|
ldc 0x2
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq Cmp-1460884369
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-1460884369
|
||||||
|
Cmp-1460884369:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-1460884369:
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If-247349760
|
||||||
|
goto IfElse-247349760
|
||||||
|
If-247349760:
|
||||||
|
.line 4
|
||||||
|
.line 5
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x2
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone-247349760
|
||||||
|
IfElse-247349760:
|
||||||
|
.line 6
|
||||||
|
.line 7
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x3
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfDone-247349760:
|
||||||
|
IfDone-1736765035:
|
||||||
|
|
||||||
|
.line 10
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x2
|
||||||
|
if_icmpeq Cmp933554851
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone933554851
|
||||||
|
Cmp933554851:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone933554851:
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If1623625546
|
||||||
|
goto IfElse1623625546
|
||||||
|
If1623625546:
|
||||||
|
.line 10
|
||||||
|
.line 11
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone1623625546
|
||||||
|
IfElse1623625546:
|
||||||
|
.line 12
|
||||||
|
.line 12
|
||||||
|
ldc 0x2
|
||||||
|
ldc 0x2
|
||||||
|
if_icmpeq Cmp1572138409
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone1572138409
|
||||||
|
Cmp1572138409:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone1572138409:
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If126354425
|
||||||
|
goto IfElse126354425
|
||||||
|
If126354425:
|
||||||
|
.line 12
|
||||||
|
.line 13
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x2
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone126354425
|
||||||
|
IfElse126354425:
|
||||||
|
.line 14
|
||||||
|
.line 15
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x3
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfDone126354425:
|
||||||
|
IfDone1623625546:
|
||||||
|
|
||||||
|
.line 18
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x2
|
||||||
|
if_icmpeq Cmp126493150
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone126493150
|
||||||
|
Cmp126493150:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone126493150:
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If1522284422
|
||||||
|
goto IfElse1522284422
|
||||||
|
If1522284422:
|
||||||
|
.line 18
|
||||||
|
.line 19
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone1522284422
|
||||||
|
IfElse1522284422:
|
||||||
|
.line 20
|
||||||
|
.line 20
|
||||||
|
ldc 0x2
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq Cmp-906666545
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-906666545
|
||||||
|
Cmp-906666545:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-906666545:
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If1083939031
|
||||||
|
goto IfElse1083939031
|
||||||
|
If1083939031:
|
||||||
|
.line 20
|
||||||
|
.line 21
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x2
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone1083939031
|
||||||
|
IfElse1083939031:
|
||||||
|
.line 22
|
||||||
|
.line 23
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x3
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfDone1083939031:
|
||||||
|
IfDone1522284422:
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
55
samples/Jasmin/if3.j
Normal file
55
samples/Jasmin/if3.j
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
.class public if3
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If-811796083
|
||||||
|
goto IfElse-811796083
|
||||||
|
If-811796083:
|
||||||
|
.line 3
|
||||||
|
.line 3
|
||||||
|
ldc 0x0
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq If-1001319390
|
||||||
|
goto IfElse-1001319390
|
||||||
|
If-1001319390:
|
||||||
|
.line 4
|
||||||
|
.line 4
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
goto IfDone-1001319390
|
||||||
|
IfElse-1001319390:
|
||||||
|
.line 6
|
||||||
|
.line 6
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x2
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfDone-1001319390:
|
||||||
|
goto IfDone-811796083
|
||||||
|
IfElse-811796083:
|
||||||
|
.line 8
|
||||||
|
.line 8
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x3
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfDone-811796083:
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
37
samples/Jasmin/if4.j
Normal file
37
samples/Jasmin/if4.j
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
.class public if4
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpne IfNot1919266740
|
||||||
|
.line 2
|
||||||
|
.line 2
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpne IfNot613368541
|
||||||
|
.line 2
|
||||||
|
.line 2
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
invokevirtual java/io/PrintStream/print(I)V
|
||||||
|
IfNot613368541:
|
||||||
|
IfNot1919266740:
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
54
samples/Jasmin/op1.j
Normal file
54
samples/Jasmin/op1.j
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
.class public op1
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
iadd
|
||||||
|
invokevirtual java/io/PrintStream/println(I)V
|
||||||
|
|
||||||
|
.line 3
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0xa
|
||||||
|
ldc 0x5
|
||||||
|
isub
|
||||||
|
invokevirtual java/io/PrintStream/println(I)V
|
||||||
|
|
||||||
|
.line 4
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x15
|
||||||
|
ldc 0x3
|
||||||
|
idiv
|
||||||
|
invokevirtual java/io/PrintStream/println(I)V
|
||||||
|
|
||||||
|
.line 5
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x159
|
||||||
|
ldc 0x38
|
||||||
|
imul
|
||||||
|
invokevirtual java/io/PrintStream/println(I)V
|
||||||
|
|
||||||
|
.line 6
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x52
|
||||||
|
ldc 0x9
|
||||||
|
irem
|
||||||
|
invokevirtual java/io/PrintStream/println(I)V
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
34
samples/Jasmin/op2.j
Normal file
34
samples/Jasmin/op2.j
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
.class public op2
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x0
|
||||||
|
iand
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 3
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x0
|
||||||
|
ior
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
68
samples/Jasmin/op3.j
Normal file
68
samples/Jasmin/op3.j
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
.class public op3
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x0
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq Cmp-1307183590
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-1307183590
|
||||||
|
Cmp-1307183590:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-1307183590:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 3
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x0
|
||||||
|
ldc 0x0
|
||||||
|
if_icmpeq Cmp-1443270821
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-1443270821
|
||||||
|
Cmp-1443270821:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-1443270821:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 4
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpeq Cmp1759327329
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone1759327329
|
||||||
|
Cmp1759327329:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone1759327329:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 5
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x0
|
||||||
|
if_icmpeq Cmp-678570146
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-678570146
|
||||||
|
Cmp-678570146:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-678570146:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
68
samples/Jasmin/op4.j
Normal file
68
samples/Jasmin/op4.j
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
.class public op4
|
||||||
|
.super java/lang/Object
|
||||||
|
;
|
||||||
|
; standard initializer (calls java.lang.Object's initializer)
|
||||||
|
;
|
||||||
|
.method public <init>()V
|
||||||
|
aload_0
|
||||||
|
invokenonvirtual java/lang/Object/<init>()V
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method public static main([Ljava/lang/String;)V
|
||||||
|
|
||||||
|
.limit locals 1
|
||||||
|
.limit stack 5
|
||||||
|
BeginGlobal:
|
||||||
|
.line 2
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x0
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpne Cmp-191731100
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-191731100
|
||||||
|
Cmp-191731100:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-191731100:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 3
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x0
|
||||||
|
ldc 0x0
|
||||||
|
if_icmpne Cmp-901585603
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-901585603
|
||||||
|
Cmp-901585603:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-901585603:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 4
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x1
|
||||||
|
if_icmpne Cmp1522577937
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone1522577937
|
||||||
|
Cmp1522577937:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone1522577937:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
.line 5
|
||||||
|
getstatic java/lang/System/out Ljava/io/PrintStream;
|
||||||
|
ldc 0x1
|
||||||
|
ldc 0x0
|
||||||
|
if_icmpne Cmp-1653028684
|
||||||
|
ldc 0x0
|
||||||
|
goto CmpDone-1653028684
|
||||||
|
Cmp-1653028684:
|
||||||
|
ldc 0x1
|
||||||
|
CmpDone-1653028684:
|
||||||
|
invokevirtual java/io/PrintStream/println(Z)V
|
||||||
|
|
||||||
|
EndGlobal:
|
||||||
|
return
|
||||||
|
.end method
|
||||||
|
|
||||||
0
samples/Jasmin/while1.j
Normal file
0
samples/Jasmin/while1.j
Normal file
Reference in New Issue
Block a user