I am trying to create a drawing program that displays a block character (ASCII 219) at the current cursor location. The up, down, left, and right keys are used to navigate on the screen. F1, F2, F3, and F4 are suppose to change the color. The escape key quits the program. When using the function keys the colors don't change as I would expect. My code is as follows:
org 100h
kol db 12
wiersz db 10
kolor db 1111b
kursor:
mov ah,3
mov bh,1
mov dh,byte [wiersz]
mov dl,byte [kol]
int 10h
mov bl,15
int 10h
petla:
; Get keystroke
mov ah,0
int 16h
; AH = BIOS scan code
cmp ah,48h
je gora
cmp ah,50h
je dol
cmp ah,4Bh
je lewo
cmp ah,4Dh
je prawo
cmp ah,3Bh
je F1
cmp ah,3Ch
je F2
cmp ah,3Dh
je F3
cmp ah,3Eh
je F4
cmp ah,3Fh
je F5
cmp ah,1
jne petla ; loop until Esc is pressed
mov ah,0x4c
int 0x21
gora:
sub byte [wiersz],1
mov ah,2
mov bh,0
mov dh,byte [wiersz]
mov dl,byte [kol]
int 10h
mov ah,09h
mov al,219
mov bx,kolor
mov cx, 1
int 10h
jmp petla
dol:
add byte [wiersz],1
mov ah,2
mov bh,0
mov dh,byte [wiersz]
mov dl,byte [kol]
int 10h
mov ah,09h
mov al,219
mov bx,kolor
mov cx, 1
int 10h
jmp petla
lewo:
sub byte [kol],1
mov ah,2
mov bh,0
mov dh,byte [wiersz]
mov dl,byte [kol]
int 10h
mov ah,09h
mov al,219
mov bx,kolor
mov cx, 1
int 10h
jmp petla
prawo:
add byte [kol],1
mov ah,2
mov bh,0
mov dh,byte [wiersz]
mov dl,byte [kol]
int 10h
mov ah,09h
mov al,219
mov bx,kolor
mov cx, 1
int 10h
jmp petla
F1:
mov byte [kolor], 0111b
int 21h
jmp petla
F2:
mov byte [kolor], 1001b
int 21h
jmp petla
F3:
mov byte [kolor], 0010b
int 21h
jmp petla
F4:
mov byte [kolor], 1011b
int 21h
jmp petla
F5:
mov byte [kolor], 1100b
int 21h
jmp petla
When the program is run the cursor moves around the screen with the arrows, but the block character doesn't appear, and the colors don't change. Can anyone explain why this problem may be occurring, and how I might be able to fix this code?