This file contains a software abstraction of intel 8080 CPU, enough to run invaders.
More...
#include <stdlib.h>
#include <inttypes.h>
#include <stdio.h>
#include "debug.h"
#include "cpu_8080.h"
#include "opcodes_8080.h"
This file contains a software abstraction of intel 8080 CPU, enough to run invaders.
- Author
- Pranay Garg (prana.nosp@m.yga@.nosp@m.andre.nosp@m.w.cm.nosp@m.u.edu)
- Version
- 0.1
- Date
- 2020-12-20
◆ decompile_inst()
int decompile_inst |
( |
cpu_state * |
cpu, |
|
|
uint16_t * |
next_inst |
|
) |
| |
Recompile mode.
- Parameters
-
- Returns
- int
◆ exec_inst()
Executes the instruction pc is pointing to after incrementing it.
- Parameters
-
- Returns
- int
◆ init_cpu_8080()
cpu_state* init_cpu_8080 |
( |
uint16_t |
pc, |
|
|
uint8_t(*)(uint8_t) |
in_cb, |
|
|
void(*)(uint8_t, uint8_t) |
out_cb |
|
) |
| |
Initialize a new cpu_8080 instance structure. Everything is initialized to 0.
- Parameters
-
pc | Program counter initialization |
in_cb | |
out_cb | |
- Returns
- cpu_state* Pointer to the Malloced CPU state.
- Note
- the user is responsible for freeing the memory (for the CPU) once it's done
- expects base to be initialized by the user to a 64KB aligned memory
- Returns
- cpu_state*
◆ io_machine_IN()
uint8_t io_machine_IN |
( |
UNUSED uint8_t |
port | ) |
|
Default function for IO_WRAP This function would be triggered on an IN
instruction. Usually overriden by the caller during setup.
- Parameters
-
- Returns
- uint8_t
◆ io_machine_OUT()
void io_machine_OUT |
( |
UNUSED uint8_t |
port, |
|
|
UNUSED uint8_t |
data |
|
) |
| |
Default function for IO_WRAP This function would be triggered on an OUT
instruction. Usually overriden by the caller during setup.
- Parameters
-
◆ print_state()
Print the state of CPU.
- Parameters
-