linux - Clean console on assembly -
is there similar system("cls");
exists on c assembly?
i'm using nasm compile , i'm working on x86 linux.
update 1: here's modified code integrate sugestion:
section .data %define sc_write 4 ; eax = write(ebx, ecx, edx) %define esc 033q max_palavra equ 40 (...) num1 dd 0 num2 dd 0 result dd 0 tamstr dd 0 section .bss strnum resb max_palavra opc resb 2 section .text global _start refresh: mov eax, esc | ('[' << 8) | (bottomrow << 16) stosd mov eax, ';0h' | (si << 24) stosd mov edx, edi mov edi, outbuf mov ecx, edi sub edx, ecx xor ebx, ebx lea eax, [byte ebx + sc_write] inc ebx int 0x80 _start: mov eax, ds mov es, eax
cheers
to imitate terminals clear
command have in .data
section:
clearterm: db 27,"[h",27,"[2j" ; <esc> [h <esc> [2j clearlen equ $-clearterm ; length of term clear string
then whenever want clear terminal do:
mov eax, 4 ; specify sys_write call mov ebx, 1 ; specify file descriptor 1: stdout mov ecx, clearterm ; pass offset of terminal control string mov edx, clearlen ; pass length of terminal control string int 80h
Comments
Post a Comment