Search code examples
assemblydosx86-16

What's the difference between the int 21h services 01h, 07h and 08h and when should I use one over the other?


I know that service 01h accepts an input and prints it to the screen, while services 07h and 08h accept an input and don't print it to the screen. Other than this what's the difference between these services and when should I use one over the other?.


Solution

  • The differences are:

    Int 0x21, ah=0x01: Echos the character to the screen. The other 2 alternatives do not.

    Int 0x21, ah=0x07: Is raw input with no special character checking (e.g. "control+c"). It should be used when you need to handle special characters yourself.

    Int 0x21, ah=0x08: Is normal input with special character checking (e.g. "control+c"). It should be used when you'd rather DOS handles special characters for you.

    For when you should use them, the answer is "30+ years ago". Because it lacks any security, doesn't support multi-tasking (or GUI) and can't handle internationalization properly; everyone abounded DOS as soon as they were able back in the 1990s; and since then there's been major changes in hardware (multiple CPUs, larger memory, networking/internet, touch-screens, multiple monitors, ...) that it simply can't support. Now it's reached the point where DOS is inferior to not using any OS at all (and just using UEFI shell alone).