Tuesday, 22 December 2020

Lunchtime Coder #4-4 - 8080 Emulator for Space Invaders Arcade - The 8080 Processor Part 2

I'm not going to write a full tutorial on how to write an 8080 processor emulator, as enough of these exist already but if you do want to write a Space Invaders emulator, you will need to know what all of these terms mean:

Program Counter (PC)
Opcode
Operand
OpBytes
Registers (A, B, C, D, E, H, L)
Register Pairs (BC, DE, HL, AF) Conditional Flags
The Stack Pointer (SP)
PSW
16 Bit Shift Register (Not part of the 8080 but required for Space Invaders emulator)
Interrupts
Dip Switches
Processor Cycle Duration

Once you are familiar with what each of these terms mean, arm yourself with the 8080 handbook and start coding.

The emulator goes something along the lines of:

Read opcode, Read Operands if required, carry out opcode, Set conditional flags if required.
Every so many opcodes, update the screen. (Around every 1350 Opcodes seems about right)
Every so many Processor Cycles, perform an interrupt. (around every 16666 seems to fit)

No comments:

Post a comment