PancakeNESEmu
A homebrewed NES Emulator written in C
Loading...
Searching...
No Matches
tui.c
Go to the documentation of this file.
1#include "UI/tui.h"
2
3#include <locale.h>
4
5void init_nscreen(const char* local_format) {
6 setlocale(LC_ALL, local_format);
7 initscr();
8 raw();
9 keypad(stdscr, TRUE);
10 noecho();
11 // nodelay(stdscr, TRUE);
12}
13
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}
22
24 refresh();
25 getch();
26 endwin();
27}
#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
This structure will be used to represent the state of the Central Processing Unit (CPU) of our emulat...
Definition cpu.h:27
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
void printw_cpu_state(CPU *cpu)
Procedure that displays the current state of the cpu in a ncurses window.
Definition tui.c:14
void init_nscreen(const char *local_format)
Procedure that init the ncurses screen.
Definition tui.c:5
void end_nscreen()
Procedure that kill the current ncurses window.
Definition tui.c:23