2013-10-25 57 views
0

我正在使用NASM for Linux,我想知道如何在保護模式下清除屏幕。我發現了一個使用int10h的解決方案,但在保護模式下,我只能使用int80h。提前致謝。如何在保護模式下清除屏幕

回答

0

你可以寫\x1b[2J到標準輸出,使終端被清除和修復使用\x1b[H光標位置,例如在NASM:

global _start 

section .data 
    clr db 0x1b, "[2J", 0x1b, "[H" 
    clrlen equ $ - clr 

section .text 
_start: 
    mov eax, 4 
    mov ebx, 1 
    mov ecx, clr 
    mov edx, clrlen 
    int 0x80 

    mov eax, 1 
    mov ebx, 0 
    int 0x80 

爲GNU彙編:

.globl _start 

.data 
    clr  : .ascii "\x1b[2J\x1b[H" 
    clrlen = . - clr 

.text 
_start: 
    movl $4, %eax 
    movl $1, %ebx 
    movl $clr, %ecx 
    movl $clrlen, %edx 
    int $0x80 

    movl $1, %eax 
    movl $0, %ebx 
    int $0x80