The emulator is very helpful tool to develop programs for A2Z, without downloading them to A2Z (which is slow). I can also develop programs with just a small laptop, when I am away from my electronic lab.
This emulator is also the easiest way to share my project, if somebody wants to play with it, without building the real hardware. It is available for download at the start page of the project (inside the ZIP file). The emulated flash memory is already loaded with all applications and data examples.
This is a “functional emulator”. It imitates the behaviour of the A2Z computer, but not the internal structure of the computer.
This part was much easier to code than I first expected.
The emulator is also coded in C, and uses the SFML library to acquire keyboard strokes, and to display the output graphic window. Therefore, the emulator should be easily ported to other platforms (Linux, Mac) with only small modifications.
The emulator imitates the speed of A2Z : it executes 52083 instructions every 16ms, and then waits until the end of the next 16ms period. This is equivalent to the 12.5MHz speed of the real CPU. I chose a 16ms step because it corresponds to the framerate of 60Hz : graphics are updated 60 times per second, like for VGA output.
- The Flash memory is emulated very basically, and the emulation does not correspond exactly to the real Flash. Therefore, a code that works on the emulator might not work on the real hardware.
- I use a French keyboard (AZERTY), and therefore an US keyboard might not work properly.
- The serial port is not emulated at all.
The best way to call the emulator is via command line. You can optionally put filenames as argument. Here is the behaviour:
- If no argument/parameter is put, the emulator loads the OS from the emulated Flash to the RAM, and executes it.
- Parameters should correspond to name of binc/bine/bina files, that you want to load and execute. Files are interpreted in the same order that they appear. Therefore, you should put the bine (or binc) file at the end.
During execution, you can use the following function keys:
- F4 : pause the execution
- F5 : resume execution
- F7 : restart execution / reboot
- F9 : load a new file to RAM, like the bootloader would do. This allow the user to update a file in A2Z file system, from a bin file in the PC. The update takes place in A2Z OS.