libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1
8#ifndef C8_DEBUG_H
9#define C8_DEBUG_H
10
11#include "../chip8.h"
12
17typedef enum {
22
29typedef enum {
44
51typedef enum {
70
82typedef union {
83 char* s;
84 int i;
86
98typedef struct {
101} C8_Arg;
102
114typedef struct {
118} C8_Command;
119
123#define C8_DEBUG_HELP_STRING \
124 "Available commands:\n\
125break [ADDRESS]: Add breakpoint to PC or ADDRESS, if given\n\
126rmbreak [ADDRESS]: Remove breakpoint at PC or ADDRESS, if given\n\
127continue: Exit debug mode until next breakpoint or completion\n\
128help: Print this help string\n\
129load PATH: Load program state from PATH\n\
130next: Step to the next instruction\n\
131print [ATTRIBUTE]: Print current value of ATTRIBUTE\n\
132save PATH: Save program state to the given file\n\
133set ATTRIBUTE VALUE: Set the given attribute to the given value\n\
134quit: Terminate the program\n\
135\n\
136Available attributes to print:\n\
137PC: Program counter\n\
138SP: Stack pointer\n\
139DT: Delay timer\n\
140ST: Sound timer\n\
141I: I address\n\
142K: Register to store next keypress\n\
143V[x]: All register values or value of Vx, if given\n\
144stack: All stack values\n\
145$[address]: Value at given address\n\
146\n\
147If no argument is given to print, it will print all of the above attributes\n\
148except for address values.\n"
149
150int c8_debug_repl(C8*);
151int c8_has_breakpoint(C8*, uint16_t);
152
153#endif
int c8_has_breakpoint(C8 *, uint16_t)
Check if breakpoint exists at address pc.
Definition: debug.c:104
C8_CommandIdentifier
Represents command types.
Definition: debug.h:29
@ C8_CMD_NEXT
Definition: debug.h:34
@ C8_CMD_CONTINUE
Definition: debug.h:33
@ C8_CMD_NONE
Definition: debug.h:30
@ C8_CMD_LOAD
Definition: debug.h:36
@ C8_CMD_SET
Definition: debug.h:35
@ C8_CMD_ADD_BREAKPOINT
Definition: debug.h:31
@ C8_CMD_LOADFLAGS
Definition: debug.h:41
@ C8_CMD_HELP
Definition: debug.h:39
@ C8_CMD_SAVE
Definition: debug.h:37
@ C8_CMD_SAVEFLAGS
Definition: debug.h:42
@ C8_CMD_PRINT
Definition: debug.h:38
@ C8_CMD_QUIT
Definition: debug.h:40
@ C8_CMD_RM_BREAKPOINT
Definition: debug.h:32
int c8_debug_repl(C8 *)
Debug command line loop.
Definition: debug.c:67
C8_DebugState
Debug state enum.
Definition: debug.h:17
@ C8_DEBUG_STEP
Definition: debug.h:20
@ C8_DEBUG_QUIT
Definition: debug.h:18
@ C8_DEBUG_CONTINUE
Definition: debug.h:19
C8_ArgIdentifier
Represents argument types.
Definition: debug.h:51
@ C8_ARG_V
Definition: debug.h:65
@ C8_ARG_SP
Definition: debug.h:53
@ C8_ARG_PC
Definition: debug.h:56
@ C8_ARG_STACK
Definition: debug.h:59
@ C8_ARG_FILE
Definition: debug.h:68
@ C8_ARG_ADDR
Definition: debug.h:67
@ C8_ARG_VK
Definition: debug.h:58
@ C8_ARG_DT
Definition: debug.h:54
@ C8_ARG_BG
Definition: debug.h:60
@ C8_ARG_QUIRKS
Definition: debug.h:64
@ C8_ARG_ST
Definition: debug.h:55
@ C8_ARG_SFONT
Definition: debug.h:62
@ C8_ARG_BFONT
Definition: debug.h:63
@ C8_ARG_R
Definition: debug.h:66
@ C8_ARG_I
Definition: debug.h:57
@ C8_ARG_NONE
Definition: debug.h:52
@ C8_ARG_FG
Definition: debug.h:61
Represents an argument for a command with a type and value.
Definition: debug.h:98
C8_ArgValue value
Definition: debug.h:100
C8_ArgIdentifier type
Definition: debug.h:99
Represents a command with an ID, argument ID, and associated argument.
Definition: debug.h:114
int setValue
Definition: debug.h:117
C8_Arg arg
Definition: debug.h:116
C8_CommandIdentifier id
Definition: debug.h:115
Represents current state of the CHIP-8 interpreter.
Definition: chip8.h:79
Stores an argument's value (string or int)
Definition: debug.h:82
char * s
Definition: debug.h:83
int i
Definition: debug.h:84