icedvariables
icedvariables

Reputation: 99

Change text color/colour in 16 bit real mode assembly using int 0x10 and ax = 0x07

I noticed when using the 0x07 (scroll/clear screen) function in 0x07 that there is an attribute for screen colour (in bh). I noticed that help color listed all these colours so I changed what was originally 0x07 (white on black) to 0x0a (green on black) but it did not function as I expected and the screen stayed white on black. I have a feeling that I need to change the display mode but I'm unsure on how to do that.

clearScreen:
    pusha

    mov ax, 0x07    ; function to scroll window
    mov bh, 0x0a    ; Does not work
    mov cx, 0x0000  ; row = 0, column = 0
    mov dx, 0x184f  ; row = 24 (0x18), column = 79 (0x4f)
    int 0x10        ; call the BIOS interrupt

    popa
    ret

Thanks.

Upvotes: 1

Views: 1323

Answers (1)

Jester
Jester

Reputation: 58762

mov ax, 0x07 should be mov ax, 0x0700 because the function number belongs in AH, and the number of lines in AL. Also note that the screen will stay black of course, since a space with green on black is still black. The cursor will change to green, though. You could try black on green for some effect, ie. mov bh, 0xa0.

Upvotes: 1

Related Questions