Basically, I have to "paint" a simple picture of a house in my DOS Box using assembly code. Part of this picture involves a sky in the background and a green patch of grass underneath. I was told I can accomplish this by any method I wanted, but I was never taught much about x86 graphics mode. So, I decided to accomplish the goal in mode 3 (80x25 text mode). Basically, I am using loop structures to print empty spaces with highlights.
I've managed to paint the sky (along with several unintentional randomly assorted letters on the screen). However, my next instruction is to move the cursor to a certain position to the screen and then print the grass portion, but this does not happen. I'm not sure if NASM is simply ignoring the instruction, if it has no way to get to it, or if my code is wrong. Any insight would be appreciated.
Here is my code:
org 100h
section .text
mov ah, 0 ;change to 80x25 color text mode
mov al, 3
int 10h
drawSky:
mov ax, 0b800h ;color activate display page
mov ds, ax
mov cx, 2000 ;80x25 = 2000 words
mov di, 0
mov ax, 3320h ;blank spaces with blue background
call fillbuf
drawGrass:
mov ah, 2 ;move cursor
xor bh, bh ;page number 0
mov dh, 14h ;move to row 20
mov dl, 0h ;move to column 0
int 10h
mov ax, 0b800h ;color activate display page
mov ds, ax
mov cx, 1000
mov di, 0
mov ax, 2220h ;blank spaces with blue background
call fillbuf
fillbuf:
mov [di], ax ;character in al, attribute in ah
add di, 2 ;go to next word
loop fillbuf