Advertisement
heavenriver

ExEsame6.asm

Jun 15th, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Exercise on slide 6
  2. ;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.
  3. ;Progettare:
  4. ;1) il SCA dell'interfaccia verso DISPLAY;
  5. ;2) il software per attivare DISPLAY e gestirne le interruzioni.
  6. ;NOTA
  7. ;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.
  8.  
  9. org 400h
  10. display equ 0h            ;Interrupts every T seconds, checks if bufferA equals bufferB
  11.                           ;If so, deactivates display. If not, burst-transfers bufferA to display
  12. bufferA equ 0BBBBh        ;First buffer
  13. bufferB equ 0EEEEh        ;Second buffer
  14. code
  15. jsr init
  16. seti
  17. main: jmp main            ;Loops until interrupt
  18. halt
  19. init: start display       ;Initializes display device
  20. setim display
  21. jmp main
  22. driver 0, 700h            ;Display driver
  23. push R0
  24. push R1
  25. push R2
  26. push R3
  27. push R4
  28. push R5
  29. movb #128, R0             ;Sets "WC" to 128
  30. movb #bufferA, R1         ;Sets "CAR1" to bufferA
  31. movb #bufferB, R2         ;Sets "CAR2" to bufferB
  32. check: movb (R1)+, R3     ;Copies address content to dolly registers
  33. movb (R2)+, R4
  34. xorb R3, R4               ;Checks if the two register contents are the same
  35. jz proceed                ;If so, keeps checking
  36. jmp notequal              ;If not, starts related routine
  37. proceed: subb #1, R0      ;Decrements counter
  38. jz closure                ;If counter hits 0, the two buffers are equal
  39. jmp check                 ;Else, keeps checking
  40. notequal: movb #128, R5
  41. outb WC, R5
  42. movb #bufferA, R5
  43. outb CAR, R5
  44. movb #1, R5
  45. outb DMAC-BURST, R5
  46. start display
  47. closure: pop R5           ;Routine over
  48. pop R4
  49. pop R3
  50. pop R2
  51. pop R1
  52. pop R0
  53. rti
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement