Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .macro MOVIA reg, addr
- movhi \reg, %hi(\addr)
- ori \reg, \reg, %lo(\addr)
- .endm
- #defineconstants
- .equ Switches, 0x00011010
- .equ Trigger, 0x00011000
- .equ Accumulator, 0x00011020
- .equ zero, 0x00000000
- .equ one, 0x00000001
- #Define the main program
- .global main
- main:
- movia r2, Switches
- movia r3, Trigger
- movia r4, Accumulator
- movia r8, zero
- movia r9, one
- initd 0(r5)
- Main_loop:
- Check0_loop:
- and r10, r3, r9
- beq r10, r8, Check1_loop
- br Check0_loop
- Check1_loop:
- and r10, r3, r9
- beq r10, r9, end_loop
- br Check1_loop
- end_loop:
- ldbio r6, 0(r2)
- add r5, r5, r6
- stbio r4, 0(r5)
- br Main_loop
- END:
- br END /* Wait here once the program has completed */
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement