Question
Check the following two assembly codes; try to understand each command line; put comments after each command line. Re-program the given code to illuminate the
Check the following two assembly codes; try to understand each command line; put comments after each command line. Re-program the given code to illuminate the LEDs such that every two LEDs illuminate together every time, have a time delay, then shift to next two LEDs in turn. In other words, it is a rotation of two illuminating LEDs.
; This is a code to illuminate LEDS on Dragon12+ Board
; This program uses Port B as the output port to drive LEDs while using the digit 1 of Port J to be the
; common terminals of all LEDs
PORTB equ $0001
DDRB equ $0003
PTJ equ $0268
DDRJ equ $026A
ptp equ $258
ddrp equ $25a
org $1000
lpcnt ds.b 1
org $1500
start movb #$FF, DDRB
movb #$ff, ddrp;
movb #$02, DDRJ;
ldaa #$FD;
staa PTJ;
movb #$FF, ptp;
forever movb #16, lpcnt
ldx #led_tab
led_lp movb 1, x+, portb
jsr delay
dec lpcnt
bne led_lp
bra forever
led_tab dc.b $80, $40, $20, $10, $08, $04, $02, $01
dc.b $01, $02, $04, $08, $10, $20, $40, $80
delay ldab #20
out_loop ldy #20000
inner_loop psha
pula
dbne y, inner_loop
dbne b, out_loop
rts
end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started