CS2422 Assembly Language & System Programming November 2, 2006
Today’s Topics INT (Interrupt). How Does a PC Boot?
Study Guide Interrupt: Sections and (Advanced) Interrupt Handler: Section Boot Process:
Interrupt If you call your friend and his/her mom says he/she is not home, what do you do? Do something else, and get interrupted when I/O events happen. May be triggered by hardware or software. INT is also used for system calls (=low- level procedures).
Note that we will use the 16-bit mode in the following slides.
Examples of INT I/O Put parameters in registers Reference: chapter 8 Example: INT 10 –Function Code in AH –Function 06H = clear Example: Clear Screen MOV AX, 0600 MOV BH, 17 MOV CX, 0000 MOV DX, 184F INT 10
Examples of I/O INT Another Example: INT 21H –Function Code in AH –Function 09H = display –Assume the string ‘hello$’ is at DS:200 Example: Display ‘hello’ MOV AH, 09 MOV DX, 200 INT 21H
INT Vectors In 000h-3FFh (1KB) For INT 00-FF Each INT uses a 4-byte vector (CS:IP): –2 bytes for IP –2 bytes for CS Actual code (Service Routine) is in CS:IP IRET at the end of INT Service Routine
INT Vectors: Example Main proc MOV MOV DS, AX … INT 21h Main endp PUSH DX PUSH CX … IPCS …… 0h0h 4h4h 3FFh …… 84h
Interrupt Vectoring Process
Common Interrupts INT 10h Video Services INT 16h Keyboard Services INT 17h Printer Services INT 1Ah Time of Day INT 1Ch User Timer Interrupt INT 21h MS-DOS Services
Boot Process (1) CPU Reset –Blank memory, except ROM –Start running from address FFFF0 (only 16 bytes left!)
Boot Process (2) BIOS Boot and POST (Power-On Self Test) –BIOS of other device may be checked too. (e.g., Video) –Flash ROM Upgrade Possible –If booting from hard disk 1 st Sector (MBR) loaded
System Boot (3) Master Boot Record (MBR) loaded. –Heard about LILO? –Remember that PC DOS/Windows OS (e.g., Linux, MS-DOS or Windows) is then loaded. INT Services may be in ROM or set up while loading OS.
For Further Information… PC Guide – BIOS System Boot