Exception - "unanticipated" event caused by the running program.
a) Fault - when restarted, the instruction causing the fault will be redone
e.g., page fault - tried to access a page that was not in main memory
e.g., division by zero - (interrupt generated if the overflow flag is set)
b) Trap - when restarted, the instruction after the one causing the fault is started
e.g., user defined interrupts
c) Aborts - halts program
e.g., hardware error detected
e.g., inconsistent values in system tables encountered
Pentium Registers
General Purpose Registers
Software interrupt - "anticipated" event caused by the running program when it issues an ("int") interrupt instruction
Synchronous event - program "knows" when the interrupt will occur
e.g., "int 3" is for break point interrupt
e.g., requests to the operating system for service - DOS and BIOS
DOS "int 21H" displays a character to screen
register parameters: in AH register put 02H
in DL register put ASCII character to display
Nothing is returned
BIOS "int 16H" keyboard service routines (lower-level functions than DOS)
register parameters: in AH register put 00H for function to read a character
register parameters: in AH register put 01H for function to check keyboard buffer
returns 1 in ZF if character buffer is empty
returns 0 in ZF if character buffer is not empty with ASCII char. put
in AL register and scan codes put in AH register
register parameters: in AH register put 02H for function to check keyboard status
returns status of shift and toggles keys in AL register using bit
assignment (0 - right SHIFT down, 1 - left SHIFT down, 2 - CTRL
down, 3 - ALT down, ... , 7 - INS lock down)
Various ways to interact with I/O devices
Hardware interrupt - "unanticipated" event caused by a hardware device external to the CPU
(asynchronous event - not caused by the running program)
Communication between CPU and device performing hardware interrupt:
1) MNI or INTR pin asserted by device
2) CPU sends interrupt acknowledgement (INTA) signal
3) Interrupting device places interrupt type # on data bus
4) CPU uses interrupt # to invoke corresponding ISR to service interrupt