Linux 清洁总成上的控制台
是否有类似于Linux 清洁总成上的控制台,linux,assembly,system,nasm,Linux,Assembly,System,Nasm,是否有类似于系统(“cls”)的内容 我正在使用NASM进行编译,我正在x86Linux上工作 更新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
系统(“cls”)的内容存在于C上用于程序集的代码>
我正在使用NASM进行编译,我正在x86Linux上工作
更新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
section.data
%定义SC_写入4;eax=写入(ebx、ecx、edx)
%定义ESC 033q
MAX_PALAVRA equ 40
(...)
num1 dd 0
num2 dd 0
结果dd0
tamstr dd 0
第2节bss
圣宫酒店
opc resb 2
第节.案文
全球启动
刷新:
mov eax,ESC |('['要模拟终端清除
命令,请在部分使用以下命令:
ClearTerm: db 27,"[H",27,"[2J" ; <ESC> [H <ESC> [2J
CLEARLEN equ $-ClearTerm ; Length of term clear string
我已经尝试了该链接上的代码,但在编译时,它给出了“错误:移位运算符可能只应用于标量值”和“错误:“|”运算符可能只应用于标量值”的提示。发布代码或屏幕截图以查看您正在做什么。system(“cls”)
一开始是一个可怕的构造,但那只是启动一个外部程序。当然,您也可以从asm启动外部程序。您可以一直走老路,向控制台输出一堆新行。
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