diff --git a/.gitignore b/.gitignore index 0cccdf0..75c577f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ **/*.rs.bk /Cargo.lock /rust_dos.com +rust.kex diff --git a/src/func_constants.inc b/src/func_constants.inc new file mode 100644 index 0000000..76359f3 --- /dev/null +++ b/src/func_constants.inc @@ -0,0 +1,10 @@ +SF_TERMINATE_PROCESS = -1 +SF_CREATE_WINDOW = 0 +SF_PUT_PIXEL = 1 +SF_GET_KEY = 2 +SF_GET_SYS_TIME = 3 +SF_DRAW_TEXT = 4 +SF_WAIT_EVENT = 10 +SF_REDRAW = 12 + SSF_BEGIN_DRAW = 1 + SSF_END_DRAW = 2 diff --git a/src/syscalls.S b/src/syscalls.S index 9e86ded..c92386d 100644 --- a/src/syscalls.S +++ b/src/syscalls.S @@ -1,5 +1,7 @@ format ELF +include "src/func_constants.inc" + section '.text' public _exit public _start_window_draw @@ -10,25 +12,25 @@ section '.text' public _pressed_key _exit: - mov eax, -1 + mov eax, SF_TERMINATE_PROCESS int 0x40 _start_window_draw: - mov eax, 0xc - mov ebx, 1 + mov eax, SF_REDRAW + mov ebx, SSF_BEGIN_DRAW int 0x40 ret _end_window_draw: - mov eax, 0xc - mov ebx, 2 + mov eax, SF_REDRAW + mov ebx, SSF_END_DRAW int 0x40 ret _define_window: push edi push esi - xor eax, eax + mov eax, SF_CREATE_WINDOW mov ebx, dword [esp + 0x0c] mov ecx, dword [esp + 0x10] mov edx, dword [esp + 0x14] @@ -42,7 +44,7 @@ _define_window: _display_message: push edi push esi - mov eax, 4 + mov eax, SF_DRAW_TEXT mov ebx, dword [esp + 0x0c] mov ecx, dword [esp + 0x10] mov edx, dword [esp + 0x14] @@ -54,11 +56,11 @@ _display_message: ret _wait_event: - mov eax, 0xa + mov eax, SF_WAIT_EVENT int 0x40 ret _pressed_key: - mov eax, 2 + mov eax, SF_GET_KEY int 0x40 ret