

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Quiz; Class: Microcomputer Systems; Subject: ECE Elect & Computer Engr; University: Tennessee Tech University; Term: Fall 2000;
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Quiz 2 ECE-3120: Fall ‘
org $1000 ;starting address of the program ldd $2000 ;DÅm[$2000] addd $2002 ;DÅm[$2002] subd $1000 ;DÅm[$1000] std $2100 ;DÅm[$2100]
N equ 5 ;array count org $1000 ;starting address of the array array: db 1,2,3,4, org $2000 ;starting address of the array sum: rmb 1 ;array sum assuming we need just 1 byte i: rmb 1 ;array index org $1500 ;starting address of the program ldaa # staa i ;initialize loop (array) index to 0 staa sum ;initialize sum to 0 loop: ldab i cmpb #N ;is I = N? beq done ;if done, then branch ldx #array ;use index register X as a pointer to the array abx ;compute the address of array[i] ldab 0,x ;place array[i] in B ldy sum ;place sum in Y aby ;sumÅsum+array[i] sty sum ;update sum inc i ;increment loop counter by 1 bra loop done: swi ;return to D-Bug12 monitor end
ldaa $1000 ;DÅm[$1000], loading the number to be ;manipulated in D eora #$F0 ;Toggles upper 4 bits in A anda #$F0 ;clears the lower 4 bits in A
Logic
Example : AÅ 10111100 ldaa $1000 ;AÅ 10111100 eora #$F0 ;A XOR $F0 Æ 10111100 ; XOR 11110000 Æ 01001100 So after eora A Å01001100 (finished toggle part) anda #$F0 ;A AND $F) Æ 01001100 ; AND Æ 11110000 Æ 01000000 So after anda AÅ01000000 (finished clearing lower 4 bits)