A Z80 ASM interpreter (emulator) written in Python
- Parser for loading in assembly (.asm) files (I/O)
- Lexer to tokenize the input file
- Parser to check the validity of the tokens
- Runner to execute the parsed tokens
- 16x16 pixel display that reads pixel color values from CPU memory (I/O)
- Error handling: Invalid assembly lines are printed to the console including the line number.
Not all instructions are implemented, most of those unimplemented functions have to do with interrupts. Trying to call an unimplemented function will result in an NotImplementedError.
Note: The unimplemented instructions can be found inside helpers/opcodes.py
.
- Install the required python packages using
pip install -r requirements.txt
There are two files which can be executed (main.py
and run.py
)
main.py
will load thedisplay_test.asm
file and print the result of every 'stage'.run.py
which asks for command line parameters
example:python3 run.py --input src/display_test.asm --display True
The display memory range is 0x0000
- 0x00FF
write a value between 0-255 to display a color. The full color range can be seen inside the screenshot.
There are pre-made test assembly files, which can be found inside the src/
folder and are fully documented.