assembly - Differences between: INT 10H , INT 16H, INT 21H -


could please explain me differences between: int 10h , int 16h, int 21h in assembly language? when should use of them , what?

for example: in simple code printing "hello, world!" why did use int 10h in fourth line? why did use int 16h in line before last?

name "hi-world" org 100h      mov ax, 3      int 10h       mov ax, 1003h mov bx, 0 int 10h mov ax, 0b800h mov ds, ax mov [02h], 'h'  mov [04h], 'e'  mov [06h], 'l'  mov [08h], 'l'  mov [0ah], 'o'  mov [0ch], ','  mov [0eh], 'w'  mov [10h], 'o'  mov [12h], 'r'  mov [14h], 'l'  mov [16h], 'd'  mov [18h], '!'   mov cx, 12  ; number of characters. mov di, 03h ; start byte after 'h'  c:  mov [di], 11101100b  add di, 2 ; skip on next ascii code in vga memory. loop c  ; wait key press: mov ah, 0 int 16h  ret 

first of int means interrupt , has nothing int data type.

each int represents functions family, ah represents function number.

for example :

  1. int 0x10 used screen manipulation

    • ah=0x00 -> set video mode
    • ax=0x1003 -> set blinking mode
    • ah=0x13 -> write string
    • ah=0x03 -> cursor position
  2. int 0x13 storage (hdd , fdd)

    • ah=0x42 -> disk read
    • ah=0x43 -> disk write
  3. int 0x16 keyboard control , read:
    • ah=0x00 -> getkey
    • ah=0x03 -> set typematic rate , delay

you can find these functions here: interrupt jump table

but these bios int, can rewritten os during startup. example, windows uses int 0x21 communication between user space , kernel space; linux-based use int 0x80. see linux system call table

in code:

  • int 0x10 ah = 0x00 , al = 3 (mov ax, 3) means: set video mode textmode 80x25 chars , 16 colors.
  • int 0x10 ax = 0x1003 means: toggle intensity/blinking bit background intensity enabled

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -