-
Notifications
You must be signed in to change notification settings - Fork 0
Emulator
The emulator gives the ability to run .mcm programs. It can execute programs at your machine's clock speed or, if necessary, launch a simple command line interface to manipulate the CPU internals and have a better look at how it works.
Once the emulator is running, it will produce an output similar to this:
==General info==
Instruction 0x0008, value: 0x02d00800
Instruction fields:
Next address: 0x000b
Bus A: 0x0002 Bus B: 0x0000 Bus C: 0x0000
ALU: 0x0000 Shift: 0x0000 rwf: 0x0
==Registers==
A: 0x0000 B: 0x0000 C: 0xa7c7
D: 0x0000 TC: 0x0000 TB: 0x0000
PC: 0x0000 MDR: 0x0000 MAR: 0x0001
==RAM==
|0xfffc|0xfffd|0xfffe|0xffff|0x0000|0x0001|0x0002|0x0003|0x0004|0x0005|0x0006|
---------------------------------------^--------------------------------------
|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|
Where it can be seen how every value changes in real time.
To stop the emulator from running, simply press:
ctrl + c.
To launch a program with the command line interface, you need to add the -cmd flag at the end.
==General info==
Instruction 0x0000, value: 0x00000004
Instruction fields:
Next address: 0x0000
Bus A: 0x0000 Bus B: 0x0000 Bus C: 0x0000
ALU: 0x0000 Shift: 0x0000 rwf: 0x4
==Registers==
A: 0x0000 B: 0x0000 C: 0x0000
D: 0x0000 TC: 0x0000 TB: 0x0000
PC: 0x0000 MDR: 0x0000 MAR: 0x0000
==RAM==
|0xfffb|0xfffc|0xfffd|0xfffe|0xffff|0x0000|0x0001|0x0002|0x0003|0x0004|0x0005|
---------------------------------------^--------------------------------------
|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|0x0000|
>:
After the cursor appears, commands can be typed.
-
nextorn: Executes the next operation -
runorr: Continues code execution -
quitorq: Quits the program -
setreg <REG> <hex value>: Sets the value of a register -
setmem <hex address> <hex value>: Sets the value of a memory address -
setdelay <delay>: Sets a delay in milliseconds between the execution of each instruction -
getdelay: Displays the current delay
All register names must be in caps. The command line also accepts hex values typed in any of these ways: Various syntaxes to insert the number 0x000f:
- f
- 0xf
- 000f
- 0x000f
To run micro-programs, type: ./microglossum -run programname.mcm. If necessary, add the -cmd flag.