10 Commits

Author SHA1 Message Date
PoliEcho 7006e8a4fe Update README.md
build_test / build (push) Successful in 3m10s
2025-08-10 09:08:12 +00:00
PoliEcho 2df9271b40 Update README.md
build_test / build (push) Successful in 3m3s
2025-07-30 08:26:55 +00:00
PoliEcho 681f0abc79 Add demo.txt
build_test / build (push) Successful in 2m26s
2025-07-14 22:29:19 +00:00
PoliEcho a48d4bbf9f Update README.md
build_test / build (push) Successful in 2m7s
2025-07-14 22:19:27 +00:00
PoliEcho b33192de27 Update README.md
build_test / build (push) Successful in 2m21s
2025-07-14 22:14:30 +00:00
PoliEcho c081838dd9 remove demo video
build_test / build (push) Successful in 2m45s
2025-07-14 21:46:07 +00:00
PoliEcho 23e9001ea1 add demo video
build_test / build (push) Successful in 2m51s
2025-07-14 22:35:05 +02:00
PoliEcho 65d1d4aa52 Update README.md
build_test / build (push) Successful in 2m3s
2025-07-14 19:02:49 +00:00
PoliEcho 82e55b3e1e Merge branch 'master' of https://git.pupes.org/PoliEcho/asm-game-of-life
build_test / build (push) Successful in 2m11s
2025-07-14 20:57:01 +02:00
PoliEcho 6d3279f850 add tty workaround 2025-07-14 20:55:41 +02:00
3 changed files with 38 additions and 5 deletions
+6 -2
View File
@@ -1,7 +1,9 @@
<img src="https://git.pupes.org/repo-avatars/e4ede9d30f070c9e191eace5a88dcaa40434b9cadf60204122fab5a83aec9a9f" alt="logo of ParaDocs" width="196"></img> <img src="https://git.pupes.org/repo-avatars/e4ede9d30f070c9e191eace5a88dcaa40434b9cadf60204122fab5a83aec9a9f" alt="pulsar in asm game of life" width="196"></img>
[![build test](https://git.pupes.org/PoliEcho/asm-game-of-life/actions/workflows/build_test.yaml/badge.svg)](https://git.pupes.org/PoliEcho/asm-game-of-life/actions?workflow=build_test.yaml) [![build test](https://git.pupes.org/PoliEcho/asm-game-of-life/actions/workflows/build_test.yaml/badge.svg)](https://git.pupes.org/PoliEcho/asm-game-of-life/actions?workflow=build_test.yaml)
# AMD64 Assembly Game of life # AMD64 Assembly Game of life
> [!WARNING]
> this program will break if your terminal is too small
## Dependencies ## Dependencies
> AMD64 Linux Kernel > AMD64 Linux Kernel
@@ -29,7 +31,9 @@ make
## Warning ## Warning
delays in TTY may be broken delays in TTY may be diferent depending on cpu clockspeed use j/k to adjust
## Notes ## Notes
if screen does not clear properly after loading just move the cursor around a bit if screen does not clear properly after loading just move the cursor around a bit
looks best in TTY
it sometimes SEGFAULTS in TTY on start but only on non debug builds and it is not consistent
+1
View File
@@ -0,0 +1 @@
ssh demo@demo.pupes.org # password: "demo"
+29 -1
View File
@@ -12,6 +12,8 @@ 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
@@ -49,6 +51,7 @@ 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]
@@ -73,11 +76,25 @@ 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
@@ -88,8 +105,18 @@ handle_user_input:; main loop of the program
syscall; read user input syscall; read user input
cmp rax, EAGAIN cmp rax, EAGAIN
je .no_input jne .handle_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
@@ -237,6 +264,7 @@ 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