Integer Java Virtual Machine emulator

Home
User's guide
Assembly
Download


Running the application

emuIJVM is a Java application, it needs so the Sun Microsystems JRE software to be runned. You can find this software at this link.
After downloading the Binary archive from the Download page you should decompress this archive, go to the folder created by the decompression folder and double click on the emuIJVM.jar file (you can also execute java -jar emuIJVM.jar from a command prompt).
At this point the MAL (Micro Assembly Language translator) will translate in binary all the microinstrunctions presents on the ./IJVM/microprogram.mal file.
If MAL finds an error in the file it will stop the program and warn you with an appropriate message.
Otherwise you will have the IJVM's GUI in front of you.

Tipying, Translating and running an IJVM program

Your Assembly IJVM program should be typed in the text area on the left titled Assembly IJVM Program.(Assembly Language Specification)

Once your program is typed it is possible to start the assembler by clicking on the "Translate & Load" button, you can find it in the "IJVM Control Panel" panel.

This button will start the assembler which will translate your program and will load it on the IJVM's memory. It will update then the Constant Pool, the Method's Area and will activate the Start, Step and Reset buttons.
If the assembler finds and error in your program it will warn you using the text area titled "Assembler Output", the "Translation completed successfully!" message will be shown otherwise.

After this process you can start the computation by clicking on the Start button, this will execute you program.
The top right text area "is Ruinning" will contain "true" while the computation is running.
If you want to see step by step the program execution you should click on the "Step" button repeatedly.

The first instruction

The first executed instruction by the emulator is INVOKEVIRTUAL main.
This will be written by the assembler in the first three bytes of the method's area.

Stopping the computation

After clicking on the Start button your program will be completely executed.
In this case the computation will automatically stop itself after the execution of the last instruction which is in the main method.
At the end of the computation you can see on the top left panel (Mic-1 Status) the current Mic-1 machine's status.
The "Step by Step" computation will continue until you finish clicking on the Step button (pay attention so!).
If your program contains an infinite loop (due to a logical error) you can stop it by clicking on the Stop button.
Caution
Programs which cause a loop could (particularly in old machines) throw an OutOfMemoryError in this case is highly recommended a program reboot.

Saving and Opening files .ijvm

It is possible to save and/or open files containing Assembly IJVM language program using the File menu.

Customizing the microprogram

You can modify or extend the IJVM microprogram.
To do this you should open the Edit menu and select MicroProgram.
A new window is now open which contains the current microprogram, you can modify it from here.
Once you have modified the microprogram you can start the translation by clicking on the "Translate" button, if the process is successful the "Save & Close" button will be active, this will save your new program permanently.
If you have ruined the microprogram, and you are desperate, you can click on Restore Default (this will fix all your problems!).

Extended MAL

To allow microprogram extensions the MAL language has been slightly extended.
Are now accepted instructions like:

(0xXY) microinstruction;

This means that the microinstruction will take place on the 0xXY position in the Mic-1's control store.
Obviously is not allowed using this extension for microinstructions referenced by any type of jump.

Eg:
(0x100)lb1:TOS=1;
Z=OPC; if(N) goto lb1; else goto lb2;
lb2:

MAL language specifications

Customizing the Opcodes List

Click Edit --> Opcode List
You will see a window containing the list of the current opcodes.
You can create a new Opcode clicking on the "New" button, edit one of them by the "Edit" button, or delete one of them by the "Delete" button.
The New and the Edit buttons will open a new window containing:
1) Name - opcode's mnemonic name.
2) Value1 - opcode's machine language value (this should be the same value (0xXY) assigned to the first instruction in the microprogram which interprets the IJVM instruction.
3) Large - Will create a 2-bytes long OPCODE if selected (eg. WIDE ILOAD)
4) Value2 - Active if Large is selected
5) Parameters - OPCODE'S parameter list editable by the Edit, Delete e New buttons.

"Save & Close" will save permanently the list, and Restore Default will restore the default list.