Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having an issue with this practice problem where I followed the direction t

ID: 3866802 • Letter: I

Question

I am having an issue with this practice problem where I followed the direction that involved with CodeWarrior, but I keep getting errors message. I used the HCS12 Microcontrollers and Embedded Systems, 1st Edition to get the right parts that require from this program. I have to follow this direction, but I still do not understand what to do with it. I need help to create an effective program from the instruction to solve this problem, and it is due tonight.

this my work:

In Data section, declare a variable called Array1, and initialize it with these two numbers: $55, $AA. Declare a variable called Array2, and initialize it with these two numbers: $BB, $66. Write an assembly program in the Main program and follow these steps:

Load the first value in Array1 to A, and load the first value in Array2 to B.

Call the SWAP subroutine.

Store A to the first byte of Array1, and store B to the first bye of Array2.

Load the second value in Array1 to A, and load the second value in Array2 to B.

Call the SWAP subroutine.

Store A to the second byte of Array1, and store B to the second bye of Array2.

Make your program stay here forever.

Use the SWAP subroutine to the Subroutine section.

SWAP: PSHB
TAB
PULA
RTS

ErrorA12202: Not a hcl2 instruction or directive main.asm line 26 Error A12202: Not a hcl2 instruction or directive

Explanation / Answer

You can either use the Exchange command to swap the variables:

EXG A, B

Or you can store the result of one in a temporary variable first:

LDAA A

MOVB B, A

STAA B