FINALY fix inicializing gameboard
This commit is contained in:
parent
564a6b88c1
commit
c5e404f1dd
@ -43,7 +43,7 @@ init_gameboard:
|
|||||||
mov rsi, 0x20; set rsi to SPACE character
|
mov rsi, 0x20; set rsi to SPACE character
|
||||||
mov rdx, [gameboard_size]
|
mov rdx, [gameboard_size]
|
||||||
push rdx
|
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
|
call memory_set
|
||||||
|
|
||||||
|
|
||||||
@ -51,14 +51,10 @@ init_gameboard:
|
|||||||
pop rdi
|
pop rdi
|
||||||
add rdi, rdx; get pointer to last char on screen
|
add rdi, rdx; get pointer to last char on screen
|
||||||
push rdi
|
push rdi
|
||||||
add rdi, 9; I dont know how this work but it works so i wont touch it
|
add rdi, ESC_chars_compensation_Len
|
||||||
push rdi
|
|
||||||
lea rsi, [reset]
|
lea rsi, [reset]
|
||||||
|
|
||||||
call string_copy
|
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
|
pop rdi
|
||||||
xor rax, rax
|
xor rax, rax
|
||||||
mov ax, [term_cols]
|
mov ax, [term_cols]
|
||||||
|
@ -88,7 +88,7 @@ memory_set:; takes destination in rdi, byte in sil and lenght in rdx
|
|||||||
|
|
||||||
cmp rdx, 16
|
cmp rdx, 16
|
||||||
jnl .write_16_or_more_bytes
|
jnl .write_16_or_more_bytes
|
||||||
mov cl, dl
|
mov rcx, rdx
|
||||||
jmp .write_less_than_16_bytes
|
jmp .write_less_than_16_bytes
|
||||||
.write_16_or_more_bytes:
|
.write_16_or_more_bytes:
|
||||||
mov rax, rdi; move destination to rax
|
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
|
mov cl, 16
|
||||||
sub cl, al; now offset to first higher 16 byte alligned address is stored in r8
|
sub cl, al; now offset to first higher 16 byte alligned address is stored in r8
|
||||||
|
movzx rcx, cl; remove ani posible garbage
|
||||||
mov rax, r11
|
|
||||||
|
|
||||||
.write_less_than_16_bytes:
|
.write_less_than_16_bytes:
|
||||||
|
mov rax, r11
|
||||||
sub rdx, rcx; we will write these bytes now
|
sub rdx, rcx; we will write these bytes now
|
||||||
|
|
||||||
rep stosb
|
rep stosb
|
||||||
|
@ -9,4 +9,4 @@ TIOCGWINSZ equ 0x5413
|
|||||||
ASCII_ZERO equ 48
|
ASCII_ZERO equ 48
|
||||||
ESC_CHAR equ 27
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user