|
libc8
CHIP-8 utility library
|
#include "../chip8.h"Go to the source code of this file.
Data Structures | |
| union | C8_ArgValue |
| Stores an argument's value (string or int) More... | |
| struct | C8_Arg |
| Represents an argument for a command with a type and value. More... | |
| struct | C8_Command |
| Represents a command with an ID, argument ID, and associated argument. More... | |
Macros | |
| #define | C8_DEBUG_HELP_STRING "Available commands:\n\break [ADDRESS]: Add breakpoint to PC or ADDRESS, if given\n\rmbreak [ADDRESS]: Remove breakpoint at PC or ADDRESS, if given\n\continue: Exit debug mode until next breakpoint or completion\n\help: Print this help string\n\load PATH: Load program state from PATH\n\next: Step to the next instruction\n\print [ATTRIBUTE]: Print current value of ATTRIBUTE\n\save PATH: Save program state to the given file\n\set ATTRIBUTE VALUE: Set the given attribute to the given value\n\quit: Terminate the program\n\\n\Available attributes to print:\n\PC: Program counter\n\SP: Stack pointer\n\DT: Delay timer\n\ST: Sound timer\n\I: I address\n\K: Register to store next keypress\n\V[x]: All register values or value of Vx, if given\n\stack: All stack values\n\$[address]: Value at given address\n\\n\If no argument is given to print, it will print all of the above attributes\n\except for address values.\n" |
| Debug help string. | |
Enumerations | |
| enum | C8_DebugState { C8_DEBUG_QUIT , C8_DEBUG_CONTINUE , C8_DEBUG_STEP } |
| Debug state enum. More... | |
| enum | C8_CommandIdentifier { C8_CMD_NONE = -1 , C8_CMD_ADD_BREAKPOINT = 0 , C8_CMD_RM_BREAKPOINT , C8_CMD_CONTINUE , C8_CMD_NEXT , C8_CMD_SET , C8_CMD_LOAD , C8_CMD_SAVE , C8_CMD_PRINT , C8_CMD_HELP , C8_CMD_QUIT , C8_CMD_LOADFLAGS , C8_CMD_SAVEFLAGS } |
| Represents command types. More... | |
| enum | C8_ArgIdentifier { C8_ARG_NONE = -1 , C8_ARG_SP = 0 , C8_ARG_DT , C8_ARG_ST , C8_ARG_PC , C8_ARG_I , C8_ARG_VK , C8_ARG_STACK , C8_ARG_BG , C8_ARG_FG , C8_ARG_SFONT , C8_ARG_BFONT , C8_ARG_QUIRKS , C8_ARG_V , C8_ARG_R , C8_ARG_ADDR , C8_ARG_FILE } |
| Represents argument types. More... | |
Functions | |
| int | c8_debug_repl (C8 *) |
| Debug command line loop. | |
| int | c8_has_breakpoint (C8 *, uint16_t) |
| Check if breakpoint exists at address pc. | |
Stuff related to debug mode.
| #define C8_DEBUG_HELP_STRING "Available commands:\n\break [ADDRESS]: Add breakpoint to PC or ADDRESS, if given\n\rmbreak [ADDRESS]: Remove breakpoint at PC or ADDRESS, if given\n\continue: Exit debug mode until next breakpoint or completion\n\help: Print this help string\n\load PATH: Load program state from PATH\n\next: Step to the next instruction\n\print [ATTRIBUTE]: Print current value of ATTRIBUTE\n\save PATH: Save program state to the given file\n\set ATTRIBUTE VALUE: Set the given attribute to the given value\n\quit: Terminate the program\n\\n\Available attributes to print:\n\PC: Program counter\n\SP: Stack pointer\n\DT: Delay timer\n\ST: Sound timer\n\I: I address\n\K: Register to store next keypress\n\V[x]: All register values or value of Vx, if given\n\stack: All stack values\n\$[address]: Value at given address\n\\n\If no argument is given to print, it will print all of the above attributes\n\except for address values.\n" |
Debug help string.
| enum C8_ArgIdentifier |
| enum C8_CommandIdentifier |
| enum C8_DebugState |
| int c8_debug_repl | ( | C8 * | c8 | ) |
Debug command line loop.
This function parses user commands from stdin and prints the result until one of the following conditions is met:
C8_DEBUG_CONTINUE)C8_DEBUG_QUIT)C8_DEBUG_STEP)| c8 | the current CHIP-8 state |
C8_DEBUG_CONTINUE, C8_DEBUG_STEP, or C8_DEBUG_QUIT | int c8_has_breakpoint | ( | C8 * | c8, |
| uint16_t | pc | ||
| ) |
Check if breakpoint exists at address pc.
This function checks if there is a breakpoint set at the specified program counter (pc) address in the C8 structure. It returns 1 if a breakpoint exists at that address, and 0 if no breakpoint is set.
| c8 | C8 to check breakpoints of |
| pc | address to check for breakpoint at |