








































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!









































1
2
4
ireq
iack
D Q
Q
D Q
Q
o.c.
Interrupt enable
Interrupt request Vect(7…0)
Info (15…0)
Data (23…16)
Data (0…15)
5
7
8
I/O device 0
I/O device 1
I/O device j
data ireq
iack
I/O bus
10
11
GetIn is called to initialize:
13
14
Getline Subroutine for Interrupt-
Driven Character I/O
;Getline is called with return address in R31 and a pointer to a ;character buffer in R1. It will input characters up to a carriage ;return under interrupt control, setting Done to -1 when complete. CR .equ 13 ;ASCII code for carriage return. CIvec .equ 01F0H ;Character input interrupt vector address. Bufp: .dw 1 ;Pointer to next character location. Save: .dw 2 ;Save area for registers on interrupt. Done: .dw 1 ;Flag location is -1 if input complete. Getln: st r1, Bufp ;Record pointer to next character. edi ;Disable interrupts while changing mask. la r2, 1F1H ;Get vector address and device enable bit st r2, CICTL ;and put into control register of device. la r3, 0 ;Clear the st r3, Done ;line input done flag. een ;Enable Interrupts br r31 ;and return to caller.
16
CR .equ 13 ;ASCII code for carriage return.
CIvec .equ 01F0H ;Character input interrupt vector
;address.
Bufp: .dw 1 ;Pointer to next character location.
17
19
la r3, 0 ;Clear the
st r3, Done ;line input done flag.
een ;Enable Interrupts
br r31 ;and return to caller.
20
.org CIvec ;Start handler at vector address. str r0, Save ;Save the registers that str r1, Save+4 ; will be used by the interrupt ;handler.
Interrupt Handler for SRC Character Input