PancakeNESEmu
A homebrewed NES Emulator written in C
Loading...
Searching...
No Matches
tui.h File Reference
#include <ncurses.h>
#include "core/cpu.h"
Include dependency graph for tui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_nscreen (const char *local_format)
 Procedure that init the ncurses screen.
 
void printw_cpu_state (CPU *cpu)
 Procedure that displays the current state of the cpu in a ncurses window.
 
void end_nscreen ()
 Procedure that kill the current ncurses window.
 

Function Documentation

◆ end_nscreen()

void end_nscreen ( )

Procedure that kill the current ncurses window.

Definition at line 23 of file tui.c.

23 {
24 refresh();
25 getch();
26 endwin();
27}

Referenced by main().

Here is the caller graph for this function:

◆ init_nscreen()

void init_nscreen ( const char * local_format)

Procedure that init the ncurses screen.

Parameters
[in]local_formatThe locale text formatting

Definition at line 5 of file tui.c.

5 {
6 setlocale(LC_ALL, local_format);
7 initscr();
8 raw();
9 keypad(stdscr, TRUE);
10 noecho();
11 // nodelay(stdscr, TRUE);
12}

Referenced by main().

Here is the caller graph for this function:

◆ printw_cpu_state()

void printw_cpu_state ( CPU * cpu)

Procedure that displays the current state of the cpu in a ncurses window.

Parameters
[in]cpuThe CPU to display

Definition at line 14 of file tui.c.

14 {
15 printw("\nACC: %i\tX: %i\t Y: %i\n", cpu->accumulator, cpu->register_x, cpu->register_y);
16 printw("N: %i\tV: %i\tP: %i\tB: %i\n", GET_N_FLAG(cpu) >> 7, GET_V_FLAG(cpu) >> 6,
17 GET_P_FLAG(cpu) >> 5, GET_B_FLAG(cpu) >> 4);
18 printw("D: %i\tI: %i\tZ: %i\tC: %i\n", GET_D_FLAG(cpu) >> 3, GET_I_FLAG(cpu) >> 2,
19 GET_Z_FLAG(cpu) >> 1, GET_C_FLAG(cpu));
20 printw("SP: %#02x\tPC: %#02x\n", cpu->stack_pointer, cpu->program_counter);
21}
#define GET_V_FLAG(x)
Definition cpu.h:125
#define GET_C_FLAG(x)
Definition cpu.h:119
#define GET_N_FLAG(x)
Definition cpu.h:126
#define GET_P_FLAG(x)
Definition cpu.h:124
#define GET_B_FLAG(x)
Definition cpu.h:123
#define GET_Z_FLAG(x)
Definition cpu.h:120
#define GET_I_FLAG(x)
Definition cpu.h:121
#define GET_D_FLAG(x)
Definition cpu.h:122
data accumulator
A 8 bit register used to perform operations.
Definition cpu.h:31
data register_y
A 8 bit register. Commonly used to hold offset and counters.
Definition cpu.h:33
address program_counter
An address pointing to the next instruction to be executed.
Definition cpu.h:28
data stack_pointer
A register that holds the 8 lower bytes of the address 0x11??.
Definition cpu.h:29
data register_x
A 8 bit register. Commonly used to hold offset and counters.
Definition cpu.h:32

References CPU::accumulator, GET_B_FLAG, GET_C_FLAG, GET_D_FLAG, GET_I_FLAG, GET_N_FLAG, GET_P_FLAG, GET_V_FLAG, GET_Z_FLAG, CPU::program_counter, CPU::register_x, CPU::register_y, and CPU::stack_pointer.

Referenced by main().

Here is the caller graph for this function: