first commit of the recode

70% of the code was re-writter from scratch
This commit is contained in:
2024-01-18 16:01:04 +01:00
commit a97fde9f86
19 changed files with 1710 additions and 0 deletions

32
api.c Normal file
View File

@@ -0,0 +1,32 @@
#include "api.h"
#include "interpreter_states.h"
#ifdef _WIN32 //windows only apis
#include <Windows.h>
#endif
#include <stdio.h>
void api_put() {
int mode = state->STACK[state->STACK_IDX--]; // 1 for char, 2 for num
if (mode != 1 && mode != 2) return;
if (mode == 1) {
char c = state->STACK[state->STACK_IDX--];
if (c == '\0') c = ' ';
printf("%c", c); //using printf and not write because of the buffer
}
else {
printf("%d", state->STACK[state->STACK_IDX--]);
}
}
void api_getasynckeystate() {
#ifdef _WIN32
eax = GetAsyncKeyState(state->STACK[STACK_IDX--]);
#else
state->STACK_IDX--;
state->registers->eax = 1;
#endif
}