2013-05-13 80 views
0

是否有任何中断可以让我清除NASM中的控制台窗口?或者我必须使用一些技巧来获得这样的效果?如何清除NASM中的控制台窗口?

+0

你必须使用一些技巧。什么OS? – 2013-05-13 16:07:20

回答

0

这里有一个办法做到这一点:

; ------------------------------------------------------------------ 
; os_clear_screen -- Clears the screen to background 
; IN/OUT: Nothing (registers preserved) 

os_clear_screen: 
    pusha 

    mov dx, 0   ; Position cursor at top-left 
    call os_move_cursor 

    mov ah, 6   ; Scroll full-screen 
    mov al, 0   ; Normal white on black 
    mov bh, 7   ; 
    mov cx, 0   ; Top-left 
    mov dh, 24   ; Bottom-right 
    mov dl, 79 
    int 10h 

    popa 
    ret 


; ------------------------------------------------------------------ 
; os_move_cursor -- Moves cursor in text mode 
; IN: DH, DL = row, column; OUT: Nothing (registers preserved) 

os_move_cursor: 
    pusha 

    mov bh, 0 
    mov ah, 2 
    int 10h    ; BIOS interrupt to move cursor 

    popa 
    ret 

此代码是不是我的,它是从MikeOS,一个简单的操作系统汇编语言编写的拍摄。