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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!