Link to home
Start Free TrialLog in
Avatar of Baskanavitch
Baskanavitch

asked on

Motorola familiarity helpful, 68HC12 instruction question

I am trying to develop a lab illustrating how C++ cross-compiles into fairly 'inefficient' assembly code, rather than writing directly in assembly.  I wrote the following example program and cross-compiled it using a GNU 68HC12 (ver. 3.0.4) compiler:

int main (void)
{

int first = 4;
int second = 5;
int third = 6;

int final = first + second + third;

return 0;

}

The first five assembly instructions are the following:

movw_.frame,2,-sp
leas -16,sp
sts_.frame
ldy_.frame
movw#4,2,y

After quite a bit of searching, I have found out that the frame is a part of the stack used for parameters and local storage of variables and is only used with high-level languages, but I have not been able to find anything referencing how it is used/accessed.  I have come up with less than that on the MOVW instruction being used with three parameters.  

If anyone has any insight to how the frame works, the notation used, or the use of MOVW with three parameters, I would greatly appreciate it.

ASKER CERTIFIED SOLUTION
Avatar of grg99
grg99

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial