Improving debugger.
This commit is contained in:
10
parser.cpp
10
parser.cpp
@@ -42,6 +42,7 @@ struct t_constant {
|
||||
static byte* code; // [MAX_CODE_SIZE];
|
||||
static word codepos = 0;
|
||||
static word lines[32768];
|
||||
static word current_line;
|
||||
|
||||
static t_label known_labels[MAX_LABELS];
|
||||
static int num_known_labels = 0;
|
||||
@@ -86,14 +87,14 @@ static void int_to_string(int value, char* label) {
|
||||
/****************************************************************************************/
|
||||
|
||||
static void emmit(const byte value) {
|
||||
lines[codepos] = tkn_get_line();
|
||||
lines[codepos] = current_line;
|
||||
code[codepos++] = value;
|
||||
}
|
||||
|
||||
static void emmit_w(const word value) {
|
||||
lines[codepos] = tkn_get_line();
|
||||
lines[codepos] = current_line;
|
||||
code[codepos++] = value & 255;
|
||||
lines[codepos] = tkn_get_line();
|
||||
lines[codepos] = current_line;
|
||||
code[codepos++] = value >> 8;
|
||||
}
|
||||
|
||||
@@ -114,7 +115,7 @@ static int get_variable_index(const char* string, const int array_size = 1) {
|
||||
t_variable* variable = variables;
|
||||
t_variable* last = variables;
|
||||
while (variable != nullptr) {
|
||||
if (strcmp(variable->name, string) == 0) { variable_is_array = (variable->size > 1); return variable->index; }
|
||||
if (strcmp(variable->name, string) == 0) { variable_is_array = (variable->size > 1); return variable->index + 0xC000; }
|
||||
last = variable;
|
||||
variable = variable->next;
|
||||
}
|
||||
@@ -749,6 +750,7 @@ static void parse_wait() {
|
||||
|
||||
static void parse_statements() {
|
||||
while (!parser_finished) {
|
||||
current_line = tkn_get_line();
|
||||
switch (tkn_get_token()) {
|
||||
case TOKEN_CONST:
|
||||
tkn_next(); parse_const(); break;
|
||||
|
||||
Reference in New Issue
Block a user