150 likes | 171 Views
This study guide discusses the INT interrupt and the boot process of a PC, including interrupt handlers and BIOS booting. Learn about INT I/O, INT vectors, common interrupts, and the system boot process.
E N D
CS2422 Assembly Language & System Programming November 2, 2006
Today’s Topics • INT (Interrupt). • How Does a PC Boot?
Study Guide • Interrupt: Sections 13.1.3 and 13.1.4. • (Advanced) Interrupt Handler: Section 16.4. • Boot Process: http://www.pcguide.com/ref/mbsys/bios/boot.htm
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 AX,@data MOV DS, AX … … INT 21h Main endp PUSH DX PUSH CX … … IP CS 0h 4h … … 84h … … 3FFh
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 1st 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 Boothttp://www.pcguide.com/ref/mbsys/bios/boot.htm