fix: warnings, delete: debug function

This commit is contained in:
2024-01-22 22:55:32 +01:00
parent 4ac400a7b0
commit a7ae66b65a
4 changed files with 3 additions and 11 deletions

View File

@@ -11,12 +11,6 @@
extern int dprintf(int stream, const char *format, ...);
#endif
void api_get_data() {
static const char dat[] = "Hello, World !";
state->registers->eax = (long long)dat;
}
void api_put() {
int mode = (int)state->STACK[state->STACK_IDX--]; // 1 for char, 2 for num
if (mode != 1 && mode != 2) return;
@@ -37,7 +31,7 @@ void api_put() {
dprintf(f, "%c", c); //using printf and not write because of the buffer
}
else {
dprintf(f, "%d", state->STACK[state->STACK_IDX--]);
dprintf(f, "%lld", state->STACK[state->STACK_IDX--]);
}
}

View File

@@ -1,13 +1,11 @@
#pragma once
#include "instructions.h"
void api_get_data();
void api_put();
void api_getasynckeystate();
static const command_t api_map[] = {
{.command = "put", .fptr = api_put},
{.command = "get_data", .fptr = api_get_data},
{.command = "GetAsyncKeyState", .fptr = api_getasynckeystate},
{.command = NULL, .fptr = NULL}

View File

@@ -49,7 +49,7 @@ long long* get_reg(char* reg_char) {
++reg_char;
for (int i = 0; i < state->num_arrays; i++)
if (strcmp(state->ARRAYS_NAME[i], reg_char) == 0)
return &state->ARRAYS_VALUES[i];
return (long long *)&state->ARRAYS_VALUES[i];
switch (reg_char[1]) {
case '1' :
return &state->registers->a1;
@@ -81,7 +81,7 @@ long long get_value(char* arg) {
if (is_reg(arg)) {
if (arg[0] == '&') {
ret = get_reg(arg);
ret = (long long)get_reg(arg);
}
else if (arg[0] == '*') {
ret = *(long long *)(*get_reg(arg));