This file simulates and disassembles part of 8080 processor.
More...
#include <inttypes.h>
#include "memory_8080.h"
Go to the source code of this file.
|
#define | UNUSED __attribute__((unused)) |
|
#define | ALL_BUT_AUX_FLAG (SIGN_FLAG | ZERO_FLAG | PARITY_FLAG | CARRY_FLAG) |
| All but the aux flag options.
|
|
|
enum | flag_bits {
SIGN_FLAG = 1 << 0
, ZERO_FLAG = 1 << 1
, AUX_FLAG = 1 << 3
, PARITY_FLAG = 1 << 5
,
CARRY_FLAG = 1 << 7
} |
| ENUMS for PSW_FLAGS.
|
|
enum | condition_flags {
NZ_check = 0x0
, Z_check = 0x1
, NC_check = 0x2
, C_check = 0x3
,
PO_check = 0x4
, PE_check = 0x5
, P_check = 0x6
, M_check = 0x7
} |
| different condition checks for JMP, conditional OPS More...
|
|
This file simulates and disassembles part of 8080 processor.
- 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
◆ UNUSED
#define UNUSED __attribute__((unused)) |
GCC header for unused variables Werror bypass
◆ condition_flags
different condition checks for JMP, conditional OPS
Enumerator |
---|
NZ_check | not zero (Z = 0)
|
Z_check | zero (2 = 1)
|
NC_check | no carry (CY = 0)
|
C_check | carry (CY = 1)
|
PO_check | parity odd (P = 0)
|
PE_check | parity even (P = 1)
|
P_check | plus (Sign = 0)
|
M_check | minus(Sign = 1)
|
◆ 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 |
( |
uint8_t |
port | ) |
|
Function to read a byte of data from the port.
- Parameters
-
port | from which the data is read |
- Returns
- uint8_t
◆ io_machine_OUT()
void io_machine_OUT |
( |
uint8_t |
port, |
|
|
uint8_t |
data |
|
) |
| |
Function to write data to the IO port.
- Parameters
-
port | where the data is written to |
data | which is written |
◆ print_state()
Print the state of CPU.
- Parameters
-