Question: . equ LEDS , 0 xf 0 2 0 0 0 0 0 ; address of LED array . equ SWITCH , 0 xf 0
equ LEDS xf ; address of LED array
equ SWITCH xf ; address of switches
reset:
li tx ; initialize pattern to all off
sw t LEDS ; display pattern
loop:
lw t SWITCH ; read switches
andi t txf ; keep only lower bits
beq t zero, allon ; if switches are turn all LEDs on
beq t t loop ; if switches are the same as last time, do nothing
move t t ; remember last switch value
li tx ; initialize pattern to all off
andi t tx ; check bit
beq t zero, odd ; if bit is skip to odd check
even: ori t txaa ; turn on even LEDs
j done
odd: andi t tx ; check bit
beq t zero, other ; if bit is skip to other check
ori t tx ; turn on odd LEDs
j done
other: andi t tx ; check bit
beq t zero, cycle ; if bit is skip to cycle
li tx ; initialize pattern to one on
cycle: sll t t ; shift left to create marquee pattern
or t t
done: sw t LEDS ; display pattern
j loop
allon: li txff ; turn all LEDs on
j loop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
