hw10_sol - University of Florida EEL 3701 Dr. Eric M....

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: University of Florida EEL 3701 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering Page 1/1 Homework 10 Solutions 1. Here is a short program that shows all addressing modes: We are given a table of student's test scores where there are three scores in a semester per student. Unfortunately, the person who entered the grades put them in the wrong order. They presently are in the following order. Student #1 test #2/test #3/test #1, Student #2 test #2/test #3/test #1 Student #200 test #2/test #3/test #1. We would like them to be in the following order. Student #1 test #1/test #2/test #3, Student #2 test #1/test #2/test #3 Student #200 test #1/test #2/test #3. Assume all scores start at 1000H (SRAM). N EQU 200 TABLE EQU $1000 NEG1 EQU %11111111 ; $FF ORG $1800 ; temporary data area TEMP DS.B 1 COUNT DS.B 1 ORG $0 LDAA #N STAA COUNT LDX #TABLE ; ptr to top of table (immediate addressing) Loop_pt LDAB 0,X ; get test #2 score (indexed addressing) LDAA 1,X ; get test #3 score (indexed addressing) STAA TEMP ; save test #3 score in temp area (extended) LDAA 2,X ; get test #1 score (indexed) Re_order_data STAA 0,X ; store test #1 score (indexed) STAB 1,X ; store test #2 score (indexed) LDAA TEMP ; get test #3 score (extended) STAA 2,X ; store test #3 score (indexed) Check_counter LDAA COUNT ; retrieve count (extended) LDAB #NEG1 ; decrement counter (immediate) SUM_BA ; count = count -1 (inherent) * ABA ; equivalent to SUM_BA on 68HC11/12 BEQ END ; if count = 0 then end (branch addressing) STAA COUNT ; save count (extended) INX ; inc ptr (inherent) INX ; inc ptr (inherent) INX ; inc ptr (inherent) BNE Loop_pt ; if count != 0 then loop (branch addressing) END BEQ END ; something to do (branch addressing) University of Florida...
View Full Document

Page1 / 5

hw10_sol - University of Florida EEL 3701 Dr. Eric M....

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online