Started implementing the debugger.

This commit is contained in:
2017-01-31 19:42:04 +01:00
parent 3eba81d2bd
commit e47cb247eb
13 changed files with 7188 additions and 118 deletions

View File

@@ -41,6 +41,7 @@ struct t_constant {
static byte* code; // [MAX_CODE_SIZE];
static word codepos = 0;
static word lines[32768];
static t_label known_labels[MAX_LABELS];
static int num_known_labels = 0;
@@ -85,11 +86,14 @@ static void int_to_string(int value, char* label) {
/****************************************************************************************/
static void emmit(const byte value) {
lines[codepos] = tkn_get_line();
code[codepos++] = value;
}
static void emmit_w(const word value) {
lines[codepos] = tkn_get_line();
code[codepos++] = value & 255;
lines[codepos] = tkn_get_line();
code[codepos++] = value >> 8;
}
@@ -865,6 +869,7 @@ void parser_parse(const char* buffer, byte* mem) {
const int parser_get_codesize() { return codepos; }
const int parser_get_memory_usage() { return num_variables; }
unsigned short* parser_get_lines() { return lines; }
void parser_register_external_function(const char* name, const int num_parameters) {
strcpy(external_functions[num_external_functions].name, name);