теперь немножко о формате asm-файла для компиляции.
Файл компилируется без каких либо проверок на корректность объявленных структур, синтаксиса описания команд - частично.
Первая строка файла - команда объявление текущего класса.
команды ассемблера:
class внутренне_имя_класса его_строковый_тип
nameandtype имя_переменной его_строковый_тип
другие_константы_(string, int и т.д.) внутренне_имя строка_или_число
interface строковое_имя_ранее_объявленнго_класса
field "указываем_атрибуты" имя_переменной_nameandtype
method "указываем_атрибуты" имя_метода его_строковый_тип
между блоками method ... endmethod указываются java-bytecode команды
и объявляются блоки localvariabletable stackmap, которые обнуляются при выходе из текушего метода командой endmethod
синтаксис описания bytecode можно получить дизассемблированием программой jd.exe любого class-файла
localvariabletable имя_переменной "ее_строковый_тип"
stackmap "строковый_тип" смещение_в_стеке:_ 0_или_1,
где 0_это_параметр_локальной_переменной; 1_параметр_стековой_переменной
_____
вот пример asm-файл j2me программы hello.java
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class hello extends MIDlet implements CommandListener {
private Display display;
private static Form mform = new Form("hello_w");
private static TextField ed_text = new TextField("Hello World", "[email protected]", 256, 0);
private static Command exitCmd = new Command("exit", 1, 2);
public hello() {
display = Display.getDisplay(this);
}
public void startApp() {
mform.append(ed_text);
mform.addCommand(exitCmd);
mform.setCommandListener(this);
display.setCurrent(mform);
}
public void pauseApp() {}
public void destroyApp(boolean flag) {}
public void commandAction(Command c, Displayable d) {
if(c == exitCmd) {
destroyApp(false);
notifyDestroyed();
}
}
}

class hello "hello"
class javax_microedition_lcdui_Display "javax/microedition/lcdui/Display"
class javax_microedition_lcdui_Form "javax/microedition/lcdui/Form"
class javax_microedition_lcdui_TextField "javax/microedition/lcdui/TextField"
class javax_microedition_lcdui_Command "javax/microedition/lcdui/Command"
class javax_microedition_midlet_MIDlet "javax/microedition/midlet/MIDlet"
class javax_microedition_lcdui_Displayable "javax/microedition/lcdui/Displayable"
class javax_microedition_lcdui_CommandListener "javax/microedition/lcdui/CommandListener"
nameandtype display "Ljavax/microedition/lcdui/Display;"
nameandtype mform "Ljavax/microedition/lcdui/Form;"
nameandtype ed_text "Ljavax/microedition/lcdui/TextField;"
nameandtype exitCmd "Ljavax/microedition/lcdui/Command;"
nameandtype append "(Ljavax/microedition/lcdui/Item;)I"
nameandtype addCommand "(Ljavax/microedition/lcdui/Command;)V"
nameandtype setCommandListener "(Ljavax/microedition/lcdui/CommandListener;)V"
nameandtype setCurrent "(Ljavax/microedition/lcdui/Displayable;)V"
nameandtype getDisplay "(Ljavax/microedition/midlet/MIDlet;)Ljavax/microedition/lcdui/Display;"
nameandtype destroyApp "(Z)V"
nameandtype notifyDestroyed "()V"
string str1 "hello_w"
string str2 "Hello World"
string str3 "[email protected]"
string str4 "exit"
integer int1 10
interface javax_microedition_lcdui_CommandListener
field "PRIVATE" display
field "PRIVATE STATIC" mform
field "PRIVATE STATIC" ed_text
field "PRIVATE STATIC" exitCmd
method "PUBLIC" <init> "()V"
localvariabletable this "Lhello;"
aload_0
invokenonvirtual {2B methodref} javax_microedition_midlet_MIDlet:<init> "()V"
aload_0
aload_0
invokestatic {2B methodref} javax_microedition_lcdui_Display.getDisplay
putfield {2B fieldref} hello.display
return
endmethod
method "PUBLIC" startApp "()V"
localvariabletable this "Lhello;"
getstatic {2B fieldref} hello.mform
getstatic {2B fieldref} hello.ed_text
invokevirtual {2B methodref} javax_microedition_lcdui_Form.append
pop
getstatic {2B fieldref} hello.mform
getstatic {2B fieldref} hello.exitCmd
invokevirtual {2B methodref} javax_microedition_lcdui_Form.addCommand
getstatic {2B fieldref} hello.mform
aload_0
invokevirtual {2B methodref} javax_microedition_lcdui_Form.setCommandListener
aload_0
getfield {2B fieldref} hello.display
getstatic {2B fieldref} hello.mform
invokevirtual {2B methodref} javax_microedition_lcdui_Display.setCurrent
return
endmethod
method "PUBLIC" pauseApp "()V"
localvariabletable this "Lhello;"
return
endmethod
method "PUBLIC" destroyApp "(Z)V"
localvariabletable this "Lhello;"
localvariabletable destroy "Z"
return
endmethod
method "PUBLIC" commandAction "(Ljavax/microedition/lcdui/Command;Ljavax/microedition/lcdui/Displayable;)V"
localvariabletable this "Lhello;"
localvariabletable c "Ljavax/microedition/lcdui/Command;"
localvariabletable d "Ljavax/microedition/lcdui/Displayable;"
aload_1
getstatic {2B fieldref} hello.exitCmd
if_acmpne $000C
aload_0
iconst_0
invokevirtual {2B methodref} hello.destroyApp
aload_0
invokevirtual {2B methodref} hello.notifyDestroyed
return
stackmap "hello" 16 0
stackmap "javax/microedition/lcdui/Command" 16 0
stackmap "javax/microedition/lcdui/Displayable" 16 0{}
endmethod
method "STATIC" <clinit> "()V"
new {2B class} javax_microedition_lcdui_Form
dup
ldc1 {1B string} str1
invokenonvirtual {2B methodref} javax_microedition_lcdui_Form:<init> "(Ljava/lang/String;)V"
putstatic {2B fieldref} hello.mform
new {2B class} javax_microedition_lcdui_TextField
dup
ldc1 {1B string} str2
ldc1 {1B string} str3
sipush $0100
iconst_0
invokenonvirtual {2B methodref} javax_microedition_lcdui_TextField:<init> "(Ljava/lang/String;Ljava/lang/String;II)V"
putstatic {2B fieldref} hello.ed_text
new {2B class} javax_microedition_lcdui_Command
dup
ldc1 {1B string} str4
iconst_1
iconst_2
invokenonvirtual {2B methodref} javax_microedition_lcdui_Command:<init> "(Ljava/lang/String;II)V"
putstatic {2B fieldref} hello.exitCmd
return
endmethod