FINALY fix inicializing gameboard

This commit is contained in:
PoliEcho 2025-07-09 21:33:36 +02:00
parent 564a6b88c1
commit c5e404f1dd
3 changed files with 7 additions and 10 deletions

View File

@ -43,7 +43,7 @@ init_gameboard:
mov rsi, 0x20; set rsi to SPACE character
mov rdx, [gameboard_size]
push rdx
add rdx, ESC_chars_compensation_Len+2; I dont know how this work but it works so i wont touch it
add rdx, ESC_chars_compensation_Len; I dont know how this work but it works so i wont touch it
call memory_set
@ -51,14 +51,10 @@ init_gameboard:
pop rdi
add rdi, rdx; get pointer to last char on screen
push rdi
add rdi, 9; I dont know how this work but it works so i wont touch it
push rdi
add rdi, ESC_chars_compensation_Len
lea rsi, [reset]
call string_copy
pop rax
mov byte [rax+resetLen], 0; I dont know how this work but it works so i wont touch it
pop rdi
xor rax, rax
mov ax, [term_cols]

View File

@ -88,7 +88,7 @@ memory_set:; takes destination in rdi, byte in sil and lenght in rdx
cmp rdx, 16
jnl .write_16_or_more_bytes
mov cl, dl
mov rcx, rdx
jmp .write_less_than_16_bytes
.write_16_or_more_bytes:
mov rax, rdi; move destination to rax
@ -101,10 +101,11 @@ memory_set:; takes destination in rdi, byte in sil and lenght in rdx
mov cl, 16
sub cl, al; now offset to first higher 16 byte alligned address is stored in r8
mov rax, r11
movzx rcx, cl; remove ani posible garbage
.write_less_than_16_bytes:
mov rax, r11
sub rdx, rcx; we will write these bytes now
rep stosb

View File

@ -9,4 +9,4 @@ TIOCGWINSZ equ 0x5413
ASCII_ZERO equ 48
ESC_CHAR equ 27
ESC_chars_compensation_Len equ 13; i have to compensate for escape sequences that dont get printed why 11 exactly, I dont know
ESC_chars_compensation_Len equ 9; i have to compensate for escape sequences that dont get printed why 11 exactly, I dont know