From 564a6b88c1b39fc870820c7dd6e5c42f8933a69a Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Wed, 9 Jul 2025 20:34:24 +0200 Subject: [PATCH] fix aligment --- src/drawing.asm | 14 ++++++++++---- src/main.asm | 1 + src/symbols.asm | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/drawing.asm b/src/drawing.asm index e8e0a08..0247b3b 100644 --- a/src/drawing.asm +++ b/src/drawing.asm @@ -1,5 +1,7 @@ %include "symbols.asm" + + section .bss extern gameboard_ptr @@ -18,11 +20,12 @@ section .rodata home_cursor: db ESC_CHAR, "[H", 0 - statusbar: db ESC_CHAR, "[100m", "Use arrow keys to move cursor, enter to invert cell h/j to change simulation speed, p to simulation", 0 + statusbar: db ESC_CHAR, "[30;100m", "Use arrow keys to move cursor, enter to invert cell h/j to change simulation speed, p to simulation", 0 START_STOP_pos: equ $-statusbar-16 + start_str: db "START", 0 - stop_str: db "STOP", 0 + stop_str: db "STOP ", 0 section .text extern print_str @@ -40,6 +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 call memory_set @@ -47,11 +51,13 @@ init_gameboard: pop rdi add rdi, rdx; get pointer to last char on screen push rdi - inc rdi; so there is not empty chagacter at the end of screen + add rdi, 9; I dont know how this work but it works so i wont touch it + push rdi 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 diff --git a/src/main.asm b/src/main.asm index a1fa552..61f6fce 100644 --- a/src/main.asm +++ b/src/main.asm @@ -67,6 +67,7 @@ _start: inc rdi; addition byte for NULL BYTE lea rax, [resetLen] add rdi, rax + add rdi, ESC_chars_compensation_Len call alloc mov [gameboard_ptr], rax; stores pointer to gameboard array call init_gameboard diff --git a/src/symbols.asm b/src/symbols.asm index 8d46a2a..317c5f2 100644 --- a/src/symbols.asm +++ b/src/symbols.asm @@ -8,3 +8,5 @@ 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