I am working on a "Pong game", and everytime a player scores, I clear the screen by filling it with a desired color and drawing the players and the ball again. Here is the code I use to clear the screen:
mov ah,06h ;clear screen instruction
mov al,00h ;number of lines to scroll
mov bh,2 ;display attribute - colors
mov ch,0 ;start row
mov cl,0 ;start col
mov dh,24d ;end of row
mov dl,79d ;end of col
int 10h ;BIOS interrupt
The problem is that I am also printing the scores on the screen. Here's the code I use to set up the text color:
mov ah,09 ; FUNCTION 9
mov bx,0004 ; PAGE 0, COLOR 4
int 10h ; INTERRUPT 10 -> BIOS
And here's how I load the text:
mov ah,02h
mov dh,2 ;row
mov dl,16 ;column
int 10h
mov si, FirstPlayerScore
call printf
ret
printf:
lodsb
cmp al, 0
je finish
mov ah, 0eh
int 10h
jmp printf
finish:
ret
That's the result. I would like to change the scores' background color to green, not black. By searching a bit I found out I could do something like:
MOV BL,1EH ; Background = Blue, Foreground = Yellow
But it does not solve the problem. I would appreaciate any hints or answers.