asm2class-usage Mailing List for Assembler JVM
Status: Beta
Brought to you by:
boretti
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
---|
From: SourceForge.net <no...@so...> - 2004-11-01 22:43:34
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2832457 By: boretti // // Copyright (C) 2004 Boretti Mathieu // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // This class sort all argument (integer) and display the result // // // // Define a class named "org.boretti.asm2class.example.tri.tri1" // Lorg/boretti/asm2class/example/tri/tri1; : // // Define a method named "main" with String [] as parameter and no // return value. This method is public and static // * . main ([Ljava/lang/String;)V : iconst_0 // <0> istore_1 // iconst_0 // <0> istore_2 // BOUCLE1 : iload_1 // <i> dup // <i> <i> aload_0 // <i> <i> a arraylength // <i> <i> <Taille> iconst_m1 // <i> <i> <Taille> <-1> iadd // <i> <i> <Taille-1> if_icmpge FIN1 // <i> iconst_1 // <i> <1> iadd // <i+1> istore_2 // BOUCLE2 : iload_2 // <j> aload_0 // <j> <a> arraylength // <j> <Taille> if_icmpge FIN2 // aload_0 // <a> iload_1 // <a> <i> aaload // <a[i]> invokestatic Ljava/lang/Integer; (Ljava/lang/String;)Ljava/lang/Integer; valueOf // <a[i]> invokevirtual Ljava/lang/Integer; ()I intValue // 1 // <a[i]> aload_0 // <a[i]> <a> iload_2 // <a[i]> <a> <j> aaload // <a[i]> <a[j]> invokestatic Ljava/lang/Integer; (Ljava/lang/String;)Ljava/lang/Integer; valueOf // <a[i]> <a[j]> invokevirtual Ljava/lang/Integer; ()I intValue // 1 // <a[i]> <a[j]> if_icmple FINX // aload_0 // <a> dup // <a> iload_1 // <a> <a> <i> aaload // <a> <a[i]> aload_0 // <a> <a[i]> <a> dup // <a> <a[i]> <a> <a> iload_2 // <a> <a[i]> <a> <a> <j> aaload // <a> <a[i]> <a> <a[j]> iload_1 // <a> <a[i]> <a> <a[j]> <i> swap // <a> <a[i]> <a> <i> <a[j]> aastore // <a> <a[i]> iload_2 // <a> <a[i]> <j> swap // <a> <i> <a[i]> aastore // FINX : iinc 2 1 goto BOUCLE2 FIN2 : iinc 1 1 goto BOUCLE1 FIN1 : pop iconst_0 istore_1 LOOP : iload_1 // <j> aload_0 // <j> <a> arraylength // <j> <Taille> if_icmpge FINLOOP // getstatic Ljava/lang/System; out Ljava/io/PrintStream; // <Stream> aload_0 // <Stream> <a> iload_1 // <Stream> <a> <i> aaload // <Stream> <a[i]> invokevirtual Ljava/io/PrintStream; (Ljava/lang/String;)V println // iinc 1 1 goto LOOP FINLOOP : FIN : return // ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=373524 |
From: SourceForge.net <no...@so...> - 2004-05-19 14:49:05
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2577072 By: nobody // // Copyright (C) 2004 Boretti Mathieu // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // This class sum all argument of the Main and Divide by the number of argument // // // // Define a class named "org.boretti.asm2class.example.moyenne" // Lorg/boretti/asm2class/example/moyenne; : // // Define a method named "main" with String [] as parameter and no // return value. This method is public and static // * . main ([Ljava/lang/String;)V : fconst_0 // 0.0 fstore_1 // iconst_0 // 0 istore_2 // aload_0 // a arraylength // <t> dup // <t> <t> ifeq FIN // <t> SUM : dup // <t> <t> iload_2 // <t> <t> <2> if_icmple MOYENNE // <t> aload_0 // <t> a iload_2 // <t> a <2> aaload // <t> s invokestatic Ljava/lang/Float; (Ljava/lang/String;)Ljava/lang/Float; valueOf // <t> F invokevirtual Ljava/lang/Float; ()F floatValue // 1 // <t> f fload_1 // <t> f <1> fadd // <t> f fstore_1 // <t> iinc 2 1 // <t> goto SUM // <t> MOYENNE : fload_1 // <t> f swap // f <t> i2f // f f fdiv // f getstatic Ljava/lang/System; out Ljava/io/PrintStream; // f out swap // out f invokevirtual Ljava/io/PrintStream; (F)V println // return // FIN : pop // return // ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=373524 |
From: SourceForge.net <no...@so...> - 2004-05-19 14:47:26
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2577064 By: nobody // // Copyright (C) 2004 Boretti Mathieu // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // Solve the hanoi problem // // // Define a class named "org.boretti.asm2class.example.hanoi" // Lorg/boretti/asm2class/example/hanoi; : // // Define the number of disk to use // - . $ START I 4 // // Define a method named "main" with String [] as parameter and no // return value. This method is public and static // * . main ([Ljava/lang/String;)V : getstatic Lorg/boretti/asm2class/example/hanoi; START I iconst_0 iconst_1 iconst_2 invokestatic Lorg/boretti/asm2class/example/hanoi; (IIII)V hanoi return // // Define how to translate disks // 0:Nombre // 1:From // 2:To // 3:Inter // * . hanoi(IIII)V : iload_0 lookupswitch DEFAULT 0 : CASE0 1 : CASE1 2 : CASE2 CASE1 : iload_1 iload_2 invokestatic Lorg/boretti/asm2class/example/hanoi; (II)V translate goto CASE0 CASE2 : iload_1 iload_3 invokestatic Lorg/boretti/asm2class/example/hanoi; (II)V translate iload_1 iload_2 invokestatic Lorg/boretti/asm2class/example/hanoi; (II)V translate iload_3 iload_2 invokestatic Lorg/boretti/asm2class/example/hanoi; (II)V translate goto CASE0 DEFAULT : iload_0 iconst_m1 iadd dup istore 4 iload_1 iload_3 iload_2 invokestatic Lorg/boretti/asm2class/example/hanoi; (IIII)V hanoi iload_1 iload_2 invokestatic Lorg/boretti/asm2class/example/hanoi; (II)V translate iload 4 iload_3 iload_2 iload_1 invokestatic Lorg/boretti/asm2class/example/hanoi; (IIII)V hanoi CASE0 : return // // Define how to translate a disk // * . translate(II)V : getstatic Ljava/lang/System; out Ljava/io/PrintStream; dup iload_0 iconst_1 iadd invokevirtual Ljava/io/PrintStream; (I)V print dup ldc "->" invokevirtual Ljava/io/PrintStream; (Ljava/lang/String;)V print iload_1 iconst_1 iadd invokevirtual Ljava/io/PrintStream; (I)V println return ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=373524 |
From: SourceForge.net <no...@so...> - 2004-05-19 14:47:07
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2577062 By: nobody // // Copyright (C) 2004 Boretti Mathieu // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // This class do the following Sum // // 1+1/2+1/4+1/8+... = sum(1/(2^n)) // // N times // // // Define a class named "org.boretti.asm2class.example.somme" // Lorg/boretti/asm2class/example/somme; : // // Define a method named "main" with String [] as parameter and no // return value. This method is public and static // * . main ([Ljava/lang/String;)V : // // push 0.0f onto the stack // fconst_0 // 0 // // store the head of the stack into register 1 fstore_1 // // // push 1 onto the stack // iconst_1 // 1 // // store the head of the stack into register 2 // istore_2 // // // Push the static field "out" from class java.lang.System // that is of type java.io.PrintStream onto the stack // getstatic Ljava/lang/System; out Ljava/io/PrintStream; // 1 // // Duplicate the head // dup // 1 1 // // Store this static field into register 0 // astore_0 // 1 // // Push a small text // ldc "Please insert a integer" // 1 t // // Display the text // invokevirtual Ljava/io/PrintStream; (Ljava/lang/String;)V println // // // Creer un DataInputStream // new Ljava/io/DataInputStream; // 1 // // Duplicate the head // dup // 1 1 // // Push the static field "in" from class java.lang.System // that is of type java.io.InputStream onto the stack // getstatic Ljava/lang/System; in Ljava/io/InputStream; // 1 1 <s> // // Call initializer method // invokespecial Ljava/io/DataInputStream; (Ljava/io/InputStream;)V <init> // 1 // // Read Line // invokevirtual Ljava/io/DataInputStream; ()Ljava/lang/String; readLine // 1 // // Convert String to Integer // invokestatic Ljava/lang/Integer; (Ljava/lang/String;)Ljava/lang/Integer; valueOf // 1 // // Convert nomber to int // invokevirtual Ljava/lang/Integer; ()I intValue // 1 // // Duplicate the head // START : dup // // load register 2 onto the stack // iload_2 // // compare head-1 and head of the stack and jump to FIN if the relation is < // if_icmplt FIN // // Push 1.0f onto the stack // fconst_1 // 1f // // Push register 0 onto the stack // aload_0 // 1f out // // Duplicate the head of the stack and insert 2 value down // dup_x1 // out 1f out // // Duplicate the head of the stack // dup // out 1f out out // // load register 2 onto the stack // iload_2 // out 1f out out <2> // // Duplicate the head of the stack and insert 2 value down // dup_x2 // out 1f <2> out out <2> // // Invoke print to display the counter for the loop // invokevirtual Ljava/io/PrintStream; (I)V print // out 1f <2> out // // push ":" onto the stack // ldc ":" // out 1f <2> out ":" // // Invoke print to display the ":" // invokevirtual Ljava/io/PrintStream; (Ljava/lang/String;)V print // out 1f <2> // // Push constant 1 onto the stack // iconst_1 // out 1f <2> 1 // // Shift left // ishl // out 1f <2d> // // Convert head of the stack to float // i2f // out 1f <2df> // // Divide the head of the stack // fdiv // out <v> // // Push register 1 onto the stack // fload_1 // out <v> <1> // // Add head-1 and head // fadd // out <s> // // Duplicate the head // dup // out <s> <s> // // store head into register 1 // fstore_1 // out <s> // // Display the current value of the sum // invokevirtual Ljava/io/PrintStream; (F)V println // // // Increment register 2 by 1 // iinc 2 1 // // Jump to START // goto START // // Drop the head of the stack // FIN : pop // // Return from the method // return ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=373524 |
From: SourceForge.net <no...@so...> - 2004-05-19 14:46:36
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2577061 By: nobody // // Copyright (C) 2004 Boretti Mathieu // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // // This file is a simply HelloWorld in java assembly java // // // Define a class named "org.boretti.asm2class.example.HelloWorld" // Lorg/boretti/asm2class/example/HelloWorld; : // // Define a method named "main" with String [] as parameter and no // return value. This method is public and static // * . main ([Ljava/lang/String;)V : // // Push the static field "out" from class java.lang.System // that is of type java.io.PrintStream onto the stack // getstatic Ljava/lang/System; out Ljava/io/PrintStream; // // Push String "HelloWorld" onto the stack // ldc "HelloWorld" // // Invoke virtual method named "println" from class // java.io.PrintStream with parameter java.lang.String // and no return value // invokevirtual Ljava/io/PrintStream; (Ljava/lang/String;)V println // // Return from this method // return ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=373524 |