Compare commits
No commits in common. "82e55b3e1e4495d7c5fcc7473e260d767fadeac6" and "1820d4fdf8f527df8f9e9b9c54d9ca2d8ac9e4d2" have entirely different histories.
82e55b3e1e
...
1820d4fdf8
@ -12,8 +12,6 @@ section .bss
|
|||||||
extern gameboard_ptr
|
extern gameboard_ptr
|
||||||
|
|
||||||
extern simulation_running
|
extern simulation_running
|
||||||
|
|
||||||
extern running_in_tty
|
|
||||||
section .data
|
section .data
|
||||||
cursor_rows: dw 1
|
cursor_rows: dw 1
|
||||||
cursor_cols: dw 1
|
cursor_cols: dw 1
|
||||||
@ -51,7 +49,6 @@ global handle_user_input
|
|||||||
handle_user_input:; main loop of the program
|
handle_user_input:; main loop of the program
|
||||||
push r12
|
push r12
|
||||||
push r13
|
push r13
|
||||||
push r14
|
|
||||||
|
|
||||||
|
|
||||||
lea r12, [multipurpuse_buf]
|
lea r12, [multipurpuse_buf]
|
||||||
@ -76,25 +73,11 @@ handle_user_input:; main loop of the program
|
|||||||
movss xmm1, [simulation_speed]
|
movss xmm1, [simulation_speed]
|
||||||
mulss xmm0, xmm1; callculate sleep lenght
|
mulss xmm0, xmm1; callculate sleep lenght
|
||||||
cvttss2si rdx, xmm0; truncate and copy to rdx
|
cvttss2si rdx, xmm0; truncate and copy to rdx
|
||||||
mov r14, rdx
|
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
mov sil, [running_in_tty]
|
|
||||||
test sil, sil
|
|
||||||
jz .skip_tty_mul
|
|
||||||
push rax
|
|
||||||
mov rax, 2500; magic number
|
|
||||||
xor rdx,rdx
|
|
||||||
mul r14
|
|
||||||
mov r14, rax
|
|
||||||
pop rax
|
|
||||||
|
|
||||||
.skip_tty_mul:
|
|
||||||
test rax, rax; SYS_POLL returns 0 when no change happens within timeout
|
test rax, rax; SYS_POLL returns 0 when no change happens within timeout
|
||||||
jz .no_input
|
jz .no_input
|
||||||
|
|
||||||
.repeat_read:
|
|
||||||
|
|
||||||
xor rax, rax
|
xor rax, rax
|
||||||
mov qword [r12], rax; zeroout the buffer
|
mov qword [r12], rax; zeroout the buffer
|
||||||
|
|
||||||
@ -105,18 +88,8 @@ handle_user_input:; main loop of the program
|
|||||||
syscall; read user input
|
syscall; read user input
|
||||||
|
|
||||||
cmp rax, EAGAIN
|
cmp rax, EAGAIN
|
||||||
jne .handle_input
|
je .no_input
|
||||||
mov al, [running_in_tty]
|
|
||||||
test al, al
|
|
||||||
jz .no_input
|
|
||||||
; this runs only if running in tty
|
|
||||||
|
|
||||||
test r14, r14
|
|
||||||
jz .no_input; timeout
|
|
||||||
dec r14
|
|
||||||
jmp .repeat_read
|
|
||||||
|
|
||||||
.handle_input:
|
|
||||||
mov rax, [r12]
|
mov rax, [r12]
|
||||||
|
|
||||||
cmp eax, 0x00415B1B; check if input is more than left arrow
|
cmp eax, 0x00415B1B; check if input is more than left arrow
|
||||||
@ -264,7 +237,6 @@ handle_user_input:; main loop of the program
|
|||||||
jmp .main_loop
|
jmp .main_loop
|
||||||
|
|
||||||
.function_exit:
|
.function_exit:
|
||||||
pop r14
|
|
||||||
pop r13
|
pop r13
|
||||||
pop r12
|
pop r12
|
||||||
ret
|
ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user