I want to implement cursor movement using keys in my OS. I tried this code to do that:
mouse:
mov ah,0h
int 16h
cmp al, 107
je Down
cmp al, 105
je Up
cmp al, 106
je Left
cmp al, 108
je Right
jmp mouse
Right:
add dl, 1
call SetCursor
jmp mouse
ret
Left:
sub dl, 1
call SetCursor
jmp mouse
ret
Up:
sub dh, 1
call SetCursor
jmp mouse
ret
Down:
add dh, 1
call SetCursor
jmp mouse
ret
SetCursor:
mov ah, 02h
mov bh, 00
int 10h
ret
Bootloader (a little part of it):
%include "stage2info.inc"
STAGE2_LOAD_SEG equ STAGE2_ABS_ADDR>>4
.stage2_loaded:
mov ax, STAGE2_RUN_SEG
mov ds, ax
mov es, ax
jmp STAGE2_RUN_SEG:STAGE2_RUN_OFS
TIMES 510-($-$$) db 0
dw 0xaa55
Why cursor doesn't moves vertically on real hardware but does on a virtual machine? I tried to change the keys but nothing, same. Why the code doesn't work on real hardware? Is my code wrong?