I wrote the part that changes the text color, but I can't find a way to change the background color, this code is for tasm assembly:
model small
stack 256
.data
ent db 0ah,0dh,'$'
array db 2,4,5,6
db 7,8,9,5
db 1,2,3,4
db 5,6,7,8
temp dw 0
.code
main :
mov ax,@data
mov ds,ax
mov ah, 06h
mov al, 0
mov cx, 0
mov dh, 79
mov dl, 79
mov bh, 4h
int 10h
This is a my code but it doesn't work:
mov ah, 0bh
mov bh, 01h
mov bl, 2h
int 10h
mov ah, 02h
mov dl, 34h
int 21h
mov ax,4c00h ; exit from program
int 21h
end main
In BIOS function 6, BH contains an 8-bit color. Its lower 4 bits specify the foreground color while the upper 4 bits specify the background color. Try, for example, mov bh, 14h
instead of mov bh, 4h
. It should start writing red on blue instead of red on black.