Unable to clear entire screen in 16-bit real mode

I am trying to clear the screen in my simple 16-bit real-mode operating system. Below is the code:

clearScreen:
    pusha

    mov ah, 0x7
    mov al, 0
    int 0x10

    popa
    ret

I read that setting alto 0 and calling the interruption of the scroll screen will clear the screen, but it only seems that the color of the first line is turning gray.

Thanks to everyone who can explain why this is not working.

+4
source share
1 answer

The problem is that the function int 0x10 0x07takes more parameters than you specified. In particular,

  • AH = 07 = scroll down the window
  • AL = number of lines to scroll (or 0 for all)
  • BH =
  • CH, CL = ,
  • DH, DL = ,

, , , , !

, , 80x25, :

clearScreen:
    pusha

    mov ax, 0x0700  ; function 07, AL=0 means scroll whole window
    mov bh, 0x07    ; character attribute = white on black
    mov cx, 0x0000  ; row = 0, col = 0
    mov dx, 0x184f  ; row = 24 (0x18), col = 79 (0x4f)
    int 0x10        ; call BIOS video interrupt

    popa
    ret

. Ralf Brown .

+7

Source: https://habr.com/ru/post/1535813/


All Articles