Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Exercise on slide 6
- ;Sia DISPLAY una periferica del processore PD32 che interrompe il processore ogni T secondi. Il servizio associato all'interruzione è il seguente: il processore deve controllare che il contenuto di un buffer di 128 byte all'indirizzo BBBBh sia uguale (byte a byte) al contenuto di un buffer all'indirizzo EEEEh. In caso affermativo, la periferica DISPLAY deve essere disattivata; in caso contrario, il contenuto del buffer ad indirizzo BBBBh deve essere trasferito verso DISPLAY. Il trasferimento deve avvenire in modalità burst, ovvero DISPLAY viene abilitato a consumare i dati in input solo quando l'intero contenuto del buffer è già stato trasferito sull'interfaccia verso DISPLAY.
- ;Progettare:
- ;1) il SCA dell'interfaccia verso DISPLAY;
- ;2) il software per attivare DISPLAY e gestirne le interruzioni.
- ;NOTA
- ;Si ipotizzi che l'interfaccia contenga una memoria FIFO di 128 byte per supportare il trasferimento in burst con due segnali di controllo: scrittura e lettura. La memoria FIFO genera autonomamente gli indirizzi interni per memorizzare e leggere i dati.
- org 400h
- display equ 0h ;Interrupts every T seconds, checks if bufferA equals bufferB
- ;If so, deactivates display. If not, burst-transfers bufferA to display
- bufferA equ 0BBBBh ;First buffer
- bufferB equ 0EEEEh ;Second buffer
- code
- jsr init
- seti
- main: jmp main ;Loops until interrupt
- halt
- init: start display ;Initializes display device
- setim display
- jmp main
- driver 0, 700h ;Display driver
- push R0
- push R1
- push R2
- push R3
- push R4
- push R5
- movb #128, R0 ;Sets "WC" to 128
- movb #bufferA, R1 ;Sets "CAR1" to bufferA
- movb #bufferB, R2 ;Sets "CAR2" to bufferB
- check: movb (R1)+, R3 ;Copies address content to dolly registers
- movb (R2)+, R4
- xorb R3, R4 ;Checks if the two register contents are the same
- jz proceed ;If so, keeps checking
- jmp notequal ;If not, starts related routine
- proceed: subb #1, R0 ;Decrements counter
- jz closure ;If counter hits 0, the two buffers are equal
- jmp check ;Else, keeps checking
- notequal: movb #128, R5
- outb WC, R5
- movb #bufferA, R5
- outb CAR, R5
- movb #1, R5
- outb DMAC-BURST, R5
- start display
- closure: pop R5 ;Routine over
- pop R4
- pop R3
- pop R2
- pop R1
- pop R0
- rti
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement