C上是否存在与system("cls");
类似的任何内容?
我正在使用NASM进行编译,而且我正在使用x86 linux。
更新1:这是我修改后的代码,用于集成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
干杯
答案 0 :(得分:1)
在clear
部分中模仿终端.data
命令:
ClearTerm: db 27,"[H",27,"[2J" ; <ESC> [H <ESC> [2J
CLEARLEN equ $-ClearTerm ; Length of term clear string
然后每当你想要清除终端时:
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 the length of terminal control string
int 80h