Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2.  
  3. .macro MOVIA reg, addr
  4.   movhi \reg, %hi(\addr)
  5.   ori \reg, \reg, %lo(\addr)
  6. .endm
  7.  
  8. #defineconstants
  9. .equ Switches, 0x00011010
  10. .equ Trigger,  0x00011000
  11. .equ Accumulator, 0x00011020
  12. .equ zero, 0x00000000
  13. .equ one, 0x00000001
  14.  
  15. #Define the main program
  16. .global main
  17. main:
  18.   movia r2, Switches
  19.   movia r3, Trigger
  20.   movia r4, Accumulator
  21.   movia r8, zero
  22.   movia r9, one
  23.   initd 0(r5)
  24.  
  25. Main_loop:
  26.     Check0_loop:
  27.         and r10, r3, r9
  28.         beq r10, r8, Check1_loop
  29.         br Check0_loop
  30.     Check1_loop:
  31.         and r10, r3, r9
  32.         beq r10, r9, end_loop
  33.         br Check1_loop
  34.     end_loop:
  35.         ldbio r6, 0(r2)
  36.         add r5, r5, r6
  37.         stbio r4, 0(r5)
  38.         br Main_loop
  39.  
  40. END:
  41.  br END /* Wait here once the program has completed */
  42. .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement