Replace magic nums to constants
This commit is contained in:
parent
b7031863c2
commit
91d8b54a56
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
/Cargo.lock
|
/Cargo.lock
|
||||||
/rust_dos.com
|
/rust_dos.com
|
||||||
|
rust.kex
|
||||||
|
10
src/func_constants.inc
Normal file
10
src/func_constants.inc
Normal file
@ -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
|
@ -1,5 +1,7 @@
|
|||||||
format ELF
|
format ELF
|
||||||
|
|
||||||
|
include "src/func_constants.inc"
|
||||||
|
|
||||||
section '.text'
|
section '.text'
|
||||||
public _exit
|
public _exit
|
||||||
public _start_window_draw
|
public _start_window_draw
|
||||||
@ -10,25 +12,25 @@ section '.text'
|
|||||||
public _pressed_key
|
public _pressed_key
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
mov eax, -1
|
mov eax, SF_TERMINATE_PROCESS
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
_start_window_draw:
|
_start_window_draw:
|
||||||
mov eax, 0xc
|
mov eax, SF_REDRAW
|
||||||
mov ebx, 1
|
mov ebx, SSF_BEGIN_DRAW
|
||||||
int 0x40
|
int 0x40
|
||||||
ret
|
ret
|
||||||
|
|
||||||
_end_window_draw:
|
_end_window_draw:
|
||||||
mov eax, 0xc
|
mov eax, SF_REDRAW
|
||||||
mov ebx, 2
|
mov ebx, SSF_END_DRAW
|
||||||
int 0x40
|
int 0x40
|
||||||
ret
|
ret
|
||||||
|
|
||||||
_define_window:
|
_define_window:
|
||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
xor eax, eax
|
mov eax, SF_CREATE_WINDOW
|
||||||
mov ebx, dword [esp + 0x0c]
|
mov ebx, dword [esp + 0x0c]
|
||||||
mov ecx, dword [esp + 0x10]
|
mov ecx, dword [esp + 0x10]
|
||||||
mov edx, dword [esp + 0x14]
|
mov edx, dword [esp + 0x14]
|
||||||
@ -42,7 +44,7 @@ _define_window:
|
|||||||
_display_message:
|
_display_message:
|
||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
mov eax, 4
|
mov eax, SF_DRAW_TEXT
|
||||||
mov ebx, dword [esp + 0x0c]
|
mov ebx, dword [esp + 0x0c]
|
||||||
mov ecx, dword [esp + 0x10]
|
mov ecx, dword [esp + 0x10]
|
||||||
mov edx, dword [esp + 0x14]
|
mov edx, dword [esp + 0x14]
|
||||||
@ -54,11 +56,11 @@ _display_message:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
_wait_event:
|
_wait_event:
|
||||||
mov eax, 0xa
|
mov eax, SF_WAIT_EVENT
|
||||||
int 0x40
|
int 0x40
|
||||||
ret
|
ret
|
||||||
|
|
||||||
_pressed_key:
|
_pressed_key:
|
||||||
mov eax, 2
|
mov eax, SF_GET_KEY
|
||||||
int 0x40
|
int 0x40
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user