diff --git a/src/instructions.c b/src/instructions.c index e250703..00edae7 100644 --- a/src/instructions.c +++ b/src/instructions.c @@ -381,5 +381,5 @@ void _xor() { } void end() { - state->should_exit = 0; //could use EAX for return code but i don't think i care + state->should_exit = 0; } diff --git a/src/interpreter_states.c b/src/interpreter_states.c index 70dc5b0..2780e9e 100644 --- a/src/interpreter_states.c +++ b/src/interpreter_states.c @@ -87,6 +87,10 @@ int get_exit_state() { return state->should_exit; } +int get_exit_code() { + return state->registers->eax; +} + LABEL_ERR add_label(char *label, int line) { if (label == NULL) return LABEL_INVALID; @@ -191,7 +195,7 @@ ARRAY_ERR add_array(char* line) { } arr_char[i++] = (long long)* ptr++; } - state->ARRAYS_VALUES[state->num_arrays++] = arr_char; + state->ARRAYS_VALUES[state->num_arrays++] = (long long *)arr_char; return ARRAY_OK; } ptr = strtok_(ptr, ","); diff --git a/src/interpreter_states.h b/src/interpreter_states.h index 86e5327..bcf7bb7 100644 --- a/src/interpreter_states.h +++ b/src/interpreter_states.h @@ -76,6 +76,7 @@ int init_state(); void free__state(); void set_exit_state(int exit_state); int get_exit_state(); +int get_exit_code(); LABEL_ERR add_label(char *label, int line); ARRAY_ERR add_array(char *line); void sanitize_arguments(); diff --git a/src/pasm.c b/src/pasm.c index c9bb6b4..1ed2e3a 100644 --- a/src/pasm.c +++ b/src/pasm.c @@ -202,7 +202,7 @@ int pasm_run_script(const char *filename, char **file, size_t lines, int _fstrea free_(line); } - int ret_code = get_exit_state(); + int ret_code = get_exit_code(); free__script(file); return ret_code; }