Change the background color of dosbox console when executing a tasm program

SoulRider picture SoulRider · Mar 25, 2016 · Viewed 8.1k times · Source

I am trying to display x in the center of the screen and then change the background color of the console to blue. I have the following code that accomplishes everything except for changing the background color:

    TITLE screen1.ASM
.MODEL SMALL

.STACK 0100h
.DATA

.CODE
start:
MOV AX,@DATA
MOV DS,AX


MOV AX,0600h
MOV BH,07h
MOV CX,0000h
MOV DX,184Fh
INT 10h

MOV AH,02h
MOV BH,00h
MOV DH,0Ch
MOV DL,28h
INT 10h

MOV AH,02h
MOV DL,'x'
INT 21h

MOV AX,4C00h
INT 21h
END start

The code clears the screen, displays x at the center of the dosbox window and gives control back to DOS. I'm trying to find out what change I would need to just update the background color of the window (not the text) to blue.

Answer

Hamza Anis picture Hamza Anis · Mar 25, 2016

When clearing the screen move bh=17h instead of 07h

 TITLE screen1.ASM
.MODEL SMALL

.STACK 0100h
.DATA

.CODE
start:
MOV AX,@DATA
MOV DS,AX



MOV AX,0600h 
MOV BH,17h   
MOV CX,0000h  
MOV DX,184Fh  
INT 10h

MOV AH,02h   ;settin cursor position 
MOV BH,00h   ;page number
MOV DH,0Ch    ;row
MOV DL,28h   ;column
INT 10h

MOV AH,02h
MOV DL,'x'
INT 21h

MOV AX,4C00h
INT 21h
END start

enter image description here