This is an old revision of the document!
The Alfy ASM language is the assembly language for the ALF32 Computer. This virtual CPU has:
Alfy ASM is simulated using CPUSim version 4. To use the simulator:
To run a simulation, you may run it in interactive or non-interactive mode.
Read the installation instructions.
To run CPUSim, open a shell and write
java -classpath .:richtextfx-fat-0.6.10.jar cpusim.Main -m alf_computer32.cpu -t file.asm
This will open the UI, load the AlfyComputer_32.cpu and the file.asm.
To run CPUSim, open a shell and write
java -classpath .:richtextfx-fat-0.6.10.jar cpusim.Main -c -m alf_computer32.cpu -t file.asm
This will load the alf_computer32.cpu and run the file.asm.
After loading a machine and a program, to run it:
Instruction | Equivalent |
---|---|
set r1 value (16 bits) | r1 = value |
mov r1 r2 | r1 = r2 |
load r1 r2 | r2 = MEM [r1] |
store r1 r2 | MEM [r1] = r2 |
pload r1 r2 | r2 = PMEM [r1] |
pstore r1 r2 | PMEM [r1] = r2 |
push r1 | sp = sp - 4 MEM [sp] = r1 |
pop r1 | r1 = MEM [sp] sp = sp + 4 |
pushsp | temp = sp sp = sp - 4 MEM [sp] = temp |
popsp | sp = MEM [sp] |
jmp label | goto label |
run label | sp = sp - 4 MEM [sp] = ip goto etiquete |
ret | sp = sp + 4 ip = MEM [sp] |
(pseudo) label_title: | label label_title |