Video mode 3 also has the ability to display colored text.
To do this we will not be using interrupts because we want to display informatino as fast as possible to the screen. Instead, we will be writing directly to the video memory. Memory addres for the various video modes can be found here. In the case of mode 3h, we can see that it starts at address 0xB800.
The other consideration that we have is the color. One byte is used for background and one byte is used for the foreground. Let's look at an example.
Number | Color | Name | Number | Color | Name |
Let's look at some example code:
mov ax, 0x3 ; set video mode to 3
int 10h
mov ax, 0xB800
mov es, ax ; put 0xB800 into the extra segment
xor di, di ; fast way to set `di` to zero
mov ah, 0xF1 ; background to 0xF - white, foreground to 0x1 - blue
mov al, 'A' ; letter to display 'A'
stosw ; store word to memory address B800:0000 (es:di)