Answer :- Here we can see that, the code is
swapping the 8 byte values from memory address $1000 and
$100F.
It means-
value of $1000 and $1000F have been swapped.
value of $1001 and $1000E have been swapped.
value of $1002 and $1000D have been swapped.
value of $1003 and $1000C have been swapped.
value of $1004 and $1000B have been swapped.
value of $1005 and $1000A have been swapped.
value of $1006 and $10009 have been swapped.
value of $1007 and $10008 have been swapped.
When loop completes, X = $1007 and Y = $1008. A = $07, B = $00,
SP = $1015.
Given the following memory and register values as shown in Tables 1 & 2 below Determine the values of the A, B, X, Y, CCR& SP registers in Table 1 as the program is executed Show new values of memory content in Table 2 if the memory location content is affected. NOTE: This is a continues program where instruction results affect the instruction that follows. Leave the cell blank to indicate no change Table 1 FLAGS HCS12 - Registers Zivic | (X) (Y) | (SP) Hex Hex Hex | N Instruction (A) (B) Initial Values SFF S01 $100E $1000 $1010 1111 TEMP DS.B 1 PULY Ys value from stack pointer-S1000, SP = $1012 PULX value from stack pointer = $1010, SP = $1014 B = byte value from SP = $08, SP = $1015 PULB LABLE LDAA 1,Y+ A-value from address $1000-S00, Y = $ 1001 | A = $01, Y = $1002 TEMP = $01 TEMP=A=$00 STAA TEMP A -$OF, X $100E at address $1001, value SOF A = $01 at address $100E, val = $01 LDAA 1,-X- As byte value from $100F-SOF, X = $100F STAA-1,Y at address $1000, value SOF LDAA TEMP A = value in TEMP = $00 STAA 0, Copy A to address $100F, so at $100F value is $00 DBNE B, LABLE B-6, not zero goto "LABLE" B-7, not zero hence goto label named as "LABLE"
Table 2 Content (Hex) Address Content (Hex) Address (Hex) (Hex) Before Exec. After After Before Exec. Exec. Exec SOF $04 $03 $02 SOB $100B $00 $1000 $100C SOE $OD $01 $1001 SOD $100D S02 $1002 $01 SOE $0C $OB $OA $100E S03 $1003 $00 SOF $100F S04 S1004 $10 $1010 $05 $1005 1011S00 $10 $09 $06 $1006 $08 $1012 $07 $1007 $10 $07 $06 $1013 S08 $1008 $8 $1014 $09 $1009 S0 $05 $1015 SOA $100A