Skip to content

NathanHoekstra/Z80_interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Z80_interpreter (GameBoy subset)

A Z80 ASM interpreter (emulator) written in Python
GameBoy

Features

  • 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.

Limitations

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.

How to use

  • Install the required python packages using pip install -r requirements.txt

There are two files which can be executed (main.py and run.py)

  1. main.py will load the display_test.asm file and print the result of every 'stage'.
  2. run.py which asks for command line parameters
    example: python3 run.py --input src/display_test.asm --display True

Displaying pixels

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.

Examples

There are pre-made test assembly files, which can be found inside the src/ folder and are fully documented.

Screenshot

Schermafbeelding 2020-05-08 om 13 41 19

About

A Z80 ASM interpreter written in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published