














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















The Purpose of Interrupts
Introduction SOFTWARE INTERRUPT: The 8086 INT instruction can be used to cause the 8086 to do any one of 256 possible interrupt types. The desired type is specified as part of the instruction. Software interrupts produced by the INT instructions have many uses. For example: INT 3 instruction to insert breakpoints in programs for debugging. Another use of Software interrupt INT is to test various interrupts-service procedures. For example: INT 0 instruction to send execution to a divide-by-zero interrupt –service procedure without having to run the actual division program.
INT Instruction The term type in the instruction format refers to a number between 0 and 255 which identifies the interrupt. When an 8086 executes an INT instruction. It will:
INT 21h Instruction INT 21h / AH=1 - read character from standard input, with echo, result is stored in AL. if there is no character in the keyboard buffer, the function waits until any key is pressed. example: mov ah, 1 int 21h INT 21h / AH=2 - write character to standard output. entry: DL = character to write, after execution AL = DL. example: mov ah, 2 mov dl, 'a' int 21h
INT 21h Instruction (^) INT 21h / AH=5 - output character to printer. entry: DL = character to print, after execution AL = DL. example: mov ah, 5 mov dl, 'a' int 21h (^) INT 21h / AH=7 - character input without echo to AL. example: mov ah, 7 int 21h (^) INT 21h / AH=9 - output of a string at DS:DX. String must be terminated by ' $ '. example: msg db "hello world $“ .code mov ax,@data mov ds,ax mov dx,offset msg mov ah, int 21h ret (^) 03/08/
Other INT 21h Instruction INT 21h / 6h; direct console input or output. INT 21h/0Bh; Get input Status INT 21h/0Ch; Flush keyboard buffer and read standard input INT 21h/0Eh; Select default drive INT 21h/19h; Get current default drive INT 21h/25h; Set interrupt vector INT 21h/35h; Get interrupt Vector INT 21h/39h; Make directory INT 21h/3Ah; Remove directory INT 21h/3Bh; Set current directory
Other INT 21h instruction
Example Programs (^) INPUT THE STRING: .model small .stack 100h .code mov ax, @data mov ds , ax mov ah,0Ah int 21h end (^) PRINT THE STRING IN THE OUTPUT .model small .data msg db "hello world $" .stack 100h .code mov ax, @data mov ds, ax mov dx, offset msg mov ah, int 21h ret (^) 03/08/
Example Programs (^) GET SYSTEM DATE AND TIME: // DATE: .model small .stack 100h .code mov ax, @data mov ds, ax mov ah, 2Ah; int 21h ; end //TIME: .model small .stack 100h .code mov ax,@data mov ds,ax mov ah, 2Ch; int 21h ; end
INT 10h Instructions INT 10h instruction is used for the video mode. Even this INT instruction has many operations that works according to the value moved onto the ‘ah’. Option 0H – Sets video mode. Registers used: (^) AH = 0H (^) AL = Video Mode.
INT 10h Instructions
The following are some of the services offered by INT 10 H. INT 10H/00H; set video mode INT 10H/01H; set cursor size INT 10H/02H; set cursor position INT 10H/03H; return cursor status INT 10H/05H; select active page INT 10H/06H; scroll up screen INT 10H/07H; scroll down screen INT 10H/0Ah; display character INT 10H/0CH; Write pixel dot INT 10H/13H; Return video information
INT 10h Instructions
INT 10h / AH = 0Ch - change color for a single pixel. input: AL = pixel color CX = column. DX = row. example: mov al, 13h mov ah, 0 int 10h ; set graphics video mode. mov al, 1100b mov cx, 10 mov dx, 20 mov ah, 0ch int 10h ; set pixel. (^) INT 10h / AH = 0Dh - get color of a single pixel. input: CX = column. DX = row. output: AL = pixel color
INT 10h Instructions
INT 10h / AH = 13h - write string. input: AL = write mode: bit 0 : update cursor after writing; bit 1 : string contains attributes. BH = page number. BL = attribute if string contains only characters (bit 1 of AL is zero). CX = number of characters in string (attributes are not counted). DL,DH = column, row at which to start writing. ES:BP points to string to be printed.