ASM : Trouble using int21h on real machine

108 views Asked by At

I want to input a char in ASM compare it to a defined char and print a message if they are the same or retry if they aren't

Problem is that my code works on emu8086 but not on a VM:

mdp DB 'c$'
equal : 

       mov ah, 1h
       int 21h

cmp al,mdp
jne equal

On emu8086 it wait user to press a key and to press enter, on a VM (as a bootloader) I can't press any key.

1

There are 1 answers

1
Ross Ridge On BEST ANSWER

You can't use MS-DOS services (INT 21h) in a bootloader. MS-DOS is an operating system, like Linux or Windows. Just like how you can't use Linux services before Linux has loaded, you can't use MS-DOS services before it has loaded.

In a bootloader you're restricted to using BIOS services (or accessing the hardware directly). You can use the BIOS service INT 16h, AH=00h to read the keyboard.