EA.1 Assuming that we have the following instruction sequence to be executed by
ID: 3733724 • Letter: E
Question
EA.1 Assuming that we have the following instruction sequence to be executed by the HCS12, what will be the contents of the topmost 4 bytes of the stack after the execution of these lds #$1500 ldaa #$56 staa 1.-SP ldab #22 staa 1-SP sty 2,-SP EA.2 Write instructions to perform the following operation: 1) Push the value $2301 (word value) onto the stack 2] Push the value $34 (byte value) onto the stack 3 Pop the top word of the stack and save it at memory location $1000-$1001 4) Push the 16-bit value stored at $1000-$1001 into the stack E4.3 Revise the subroutine in Example 4.2 so that it can convert a 16-bit signed integer toa BCD string. E4.4 Write a subroutine to find the greatest common divisor of two 16-bit unsigned integers These two 16-bit numbers are passed in the stack. The subroutine returns the gcd in double accumulator D EA.5 Write a subroutine to convert all the lowercase letters in a string to uppercase. The pointer to the string is passed to this subroutine in X E4.6 The label array,x is the starting address of an array of 100 8-bit elements. Trace the fol lowing code sequence and describe what the subroutine sub x does: array x #100 ldaa sub dab O.x bne loopExplanation / Answer
E4.1)ldx #$0800
ldaa #5
ldab #0
loop stab 0,x
incb
inx
dbne a,loop
E4.2) 1)pushw $2301
2)push $2301
3)000H
MOV 00H, $1000H
MOV 01H, $1001H
POP 1FH
POP 0EH
END
4)0000h
MOV 08h, $1000h
MOV 09h, $1001h
PUSH 00h
PUSH 01h
END
E4.3)PUSH B
PUSH D
MVI B, $1000H
MVI C, $1001H
SUB B
INR E
JMP STEP 1
STEP2: CMP C
JC STEP 3
SUB C
MVI D, 00H
MVI E, 00H
STEP1: CMP B
JC STEP 2 0
INR D
JMP STEP 2
STEP3: STA $34H
MOV A, D
STA 6101H
MOV A, E
STA $1001H
POP D
POP B
RET
E.4.4)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.