phoron_asm 1.0.2

A Jasmin-compatible Assembler for the JVM
Documentation
.class public CountJasmin
.super java/lang/Object

.method public <init>()V
  aload_0 
  invokespecial java/lang/Object/<init>()V
  return
.end method

.method public static main([Ljava/lang/String;)V
  .limit stack 3
  .limit locals 4

  ; setup local variables

  getstatic java/lang/System/out Ljava/io/PrintStream; ; get the handle
  astore_1 ; store in variable 1 
  bipush 10 ; the literal 10, used as the loop counter limit check
  istore_2 ; store in variable 2

  ; the main loop, which runs 10 times
loop:
  bipush 10
  iload_2 ; load the total count
  isub ; TOS is now 10 - <total count>
  invokestatic java/lang/String/valueOf(I)Ljava/lang/String; ; convert to string
  astore_3 ; store the string repr in variable 3

  aload_1 ; load sysout
  aload_3 ; load the string repr of current iter
  invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V ; print the string repr

  iinc 2 -1 ; decrement the curr iter
  iload_2 ; load the curr iter
  ifne loop ; loop if curr iter is not zero

  return
.end method