



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Name:__________________________________________________________________________
Student Number:_________________________________________________________________
Instructions:
[1] Correct the program area of the following code that rearranges the numbers in the buffer in descending order.
[2] Given the following codes, what will be the resulting values at the break points for the memories and registers?
#include ECE383_Dragon12plus_registers.inc #include ascii.inc
ORG $
STR DC.B โ1432โ, NULL TARGET DS.W 1 DIGIT DS.W 1
$1000 $ $1001 $ $1002 $ $1003 $ $1004 $ $1005 $ $1006 $ $1007 $ $1008 $
[3] Complete the following code that initializes the serial port, reads inputs and display characters.
#include ECE383_Dragon12plus_registers.inc #include ascii.inc
ORG $ STR DCB.B 80, โXโ
ORG $
MOVW #$0271 , SCI0BRH ;Baud rate 2400 for 24MHZ MCLK MOVW #$030C , SCI0CR1 ;8-bit transmission ;Odd parity Enable ;Bi-directional communication. LOOP1: **BRCLR SCI0SR1, #$20 , *** ;Is serial port ready for read? LDAA SCI0DRL ;Read the input **BRCLR SCI0SR1, #$80 , *** ;Is serial port ready for write? STAA SCI0DRL ;Echo the input CMPA #CR ;Is input a Carriage Return? BEQ END_LOOP1 ;End of the loop SUBA #$20 ;Convert the lower case to the ;Upper case STAA 1, X+ BRA LOOP_FOR END_LOOP1: MOVB #NULL , 0, X ;End the string with a NULL
LDX #STR LOOP2: LDAA 1, x+ CMPA #NULL BEQ END_MAIN ;End of the loop **BRCLR SCI0SR1, #$80 , *** ;Is serial port ready for write? STAA SCI0DRL ;Display the character BRA LOOP
END_MAIN: RTS END
[4] What are the values of registers or memories after each instruction for the given data initialization?
a. LDY #STR ; Y = $ b. LDAB 2, +Y ; B = $12 Y = $ c. LDAA 1, Y ; A = $10 Y = $ d. STD STR+2 ; D = $1012 [STR+3] = $ e. LDY #STR+1 ; Y = $
f. PSHA ; SP= $3AFF [SP] = $ g. PSHY ; SP= $3AFD [SP+1] = $