In: Computer Science
The following program segment was being run on the
Basic Computer.
319 ION (Interrupt enable ON)
320 LDA ADS
321 STA PTR
322 LDA CTR
323 ADD PTR I
324 ISZ PTR
While the computer was in T2 cycle of LDA CTR, an interrupt hits
it. The ISR is located from
624 to 711. Write down the sequence of steps that the computer will
go through before it
resumes this program. Put serial number on each of your steps.
1) Processor finishes the execution of current instruction LDA CTR
2) Processor Identify the source of Interrupt by Checking which flag is set. An acknowledgment signal to the device that issued the interrupt.( The acknowledgment allows the device to remove its interrupt signal.)
3) Save the Status of CPU and the location of the next
instruction to be executed, which is contained in
the program counter(PC contains address of next instruction ,ADD
PRTI ,which is 323). into the system stack.
4) Also saves Contents of processor registers and Flags into system sack.
5) The processor now loads the program counter(PC) with the entry location of the ISR. i.e PC is loaded with address 624.
6) Now the processor executes instruction in memory locaion from 624 to 711.(process the interrupt)
7) Once the ISR is finished, Restore contents of processor registers and flags from system stack.
8) Turn the interrupt facility on
9) It also loads the address of interrupted program i.e. 323 from stack into PC. Also retrieves status of CPU from stack.
10) Now the processor resumes the program execution from where it is interruptd.
Micro operation – Interrupt cycle
i. The contents of the PC are transferred to the MBR , so that they can be saved for return from the interrupt
t1: MBR ←(PC) i.e MBR ← (323)
ii. • MAR is loaded with the address at which the contents of the PC are to be saved (stack address)
• PC is loaded with the address of the start of the interrupt-service routine
t2: MAR ← stack_top_address.
PC ← ISR-address i.e. PC ← (624)
iii. Store the MBR, which contains the old value of the PC into stack-memory.
t3: M[stack_top_address]←(MBR)