Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | Mixed C and Assemly

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Mixed C and Assemly - Mohammad Khamees - Jun 18 12:31:44 2006

Hi,
I intend to mix some subroutines witten in assembly language into a
main program written in C language to program an EVB9S12NE64 kit
using CodeWarrior software..

could anyone tell me how?

is it only as the following examble:

if (i==0)
asm {
LDAA $2000
STAA $3000
.
.
}
else
asm {
LDAA $3000
STAA $2000
.
.
}

or there's other rules or WHAT?

thanx in Advance





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: Mixed C and Assemly - BobG...@aol.com - Jun 18 12:41:58 2006


In a message dated 6/18/2006 12:31:42 P.M. Eastern Standard Time,
e...@yahoo.com writes:

could anyone tell me how?

=========================
I use the imagecraft HC12 compiler, and this is CLEARLY explained in the
help file. I have heard some complaints about how easy/hard codeworrier is to
use, but SURELY there is some mention of how to do this in the docs... Big
picture is inline in a c file, or add a .s file to the project. Know how to do an
assembler only program?
[Non-text portions of this message have been removed]





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Mixed C and Assemly - Daniel Friederich - Jun 18 13:04:59 2006

the manual {CodeWarrior}Help\PDF\Compiler_HC12.pdf does contain a
chapter called "High-Level Inline Assembler
for the Freescale HC(S)12" describing the syntax to be used.
The sample provided by the OP does actually compile just fine, so I'm
not sure where the problem is.

Daniel

int i;
void main(void) {

if (i==0)
asm {
LDAA $2000
STAA $3000
}
else
asm {
LDAA $3000
STAA $2000
}
for(;;) {} /* wait forever */
}

PS: In general I would use hex numbers in C syntax (0x2000 instead of
$2000) in C files, but the inline assembler also understands the $ syntax.

B...@aol.com wrote:
>
> In a message dated 6/18/2006 12:31:42 P.M. Eastern Standard Time,
> e...@yahoo.com writes:
>
> could anyone tell me how?
>
> =========================
> I use the imagecraft HC12 compiler, and this is CLEARLY explained in the
> help file. I have heard some complaints about how easy/hard codeworrier is to
> use, but SURELY there is some mention of how to do this in the docs... Big
> picture is inline in a c file, or add a .s file to the project. Know how to do an
> assembler only program?
> [Non-text portions of this message have been removed]
>
>

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Mixed C and Assemly - Mohammad Khamees - Jun 19 14:50:56 2006


That's nice but I wanna know how variables created in C can be accessed
in Assembly

for ex:

int i[5];

asm{

LDD i

ADD #4

STD i

}

Is it valid??
--- In 6...@yahoogroups.com, Daniel Friederich
wrote:
>
> the manual {CodeWarrior}Help\PDF\Compiler_HC12.pdf does contain a
> chapter called "High-Level Inline Assembler
> for the Freescale HC(S)12" describing the syntax to be used.
> The sample provided by the OP does actually compile just fine, so I'm
> not sure where the problem is.
>
> Daniel
>
> int i;
> void main(void) {
>
> if (i==0)
> asm {
> LDAA $2000
> STAA $3000
> }
> else
> asm {
> LDAA $3000
> STAA $2000
> }
> for(;;) {} /* wait forever */
> }
>
> PS: In general I would use hex numbers in C syntax (0x2000 instead of
> $2000) in C files, but the inline assembler also understands the $
syntax.
>
> BobGardner@... wrote:
> >
> > In a message dated 6/18/2006 12:31:42 P.M. Eastern Standard Time,
> > epm_2006@... writes:
> >
> > could anyone tell me how?
> >
> >
> >
> > =========================
> > I use the imagecraft HC12 compiler, and this is CLEARLY explained in
the
> > help file. I have heard some complaints about how easy/hard
codeworrier is to
> > use, but SURELY there is some mention of how to do this in the
docs... Big
> > picture is inline in a c file, or add a .s file to the project. Know
how to do an
> > assembler only program?
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> >



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Mixed C and Assemly - eqh2 - Jun 19 15:39:27 2006

--- In 6...@yahoogroups.com, "Mohammad Khamees" wrote:
> That's nice but I wanna know how variables created in C can be
accessed
> in Assembly
>
This is explained in the High-Level Inline Assembler section of the
Codewarrior docs. Look through your start12.c file for some examples.
It would be nice if there were some more examples included with
Codewarrior.





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

RE: Re: Mixed C and Assemly - Erich Styger - Jun 20 3:11:54 2006

Hello,
Yes, except that you have to use ADDD. So it would be:

int i[5];

void bar(void) {
asm {
LDD i
ADDD #4
STD i
}
}

Which will give you:
4: asm {
5: LDD i
0000 fc0000 [3] LDD i
6: ADDD #4
0003 c30004 [2] ADDD #4
7: STD i
0006 7c0000 [3] STD i
8: }
9: }
0009 3d [5] RTS

Erich

-----Original Message-----
From: 6...@yahoogroups.com [mailto:6...@yahoogroups.com] On Behalf Of
Mohammad Khamees
Sent: Monday, June 19, 2006 8:48 PM
To: 6...@yahoogroups.com
Subject: [68HC12] Re: Mixed C and Assemly

That's nice but I wanna know how variables created in C can be accessed in
Assembly

for ex:

int i[5];

asm{

LDD i

ADD #4

STD i

}

Is it valid??
--- In 6...@yahoogroups.com, Daniel Friederich
wrote:
>
> the manual {CodeWarrior}Help\PDF\Compiler_HC12.pdf does contain a
> chapter called "High-Level Inline Assembler for the Freescale HC(S)12"
> describing the syntax to be used. The sample provided by the OP does
> actually compile just fine, so I'm not sure where the problem is.
>
> Daniel
>
> int i;
> void main(void) {
>
> if (i==0)
> asm {
> LDAA $2000
> STAA $3000
> }
> else
> asm {
> LDAA $3000
> STAA $2000
> }
> for(;;) {} /* wait forever */
> }
>
> PS: In general I would use hex numbers in C syntax (0x2000 instead of
> $2000) in C files, but the inline assembler also understands the $
syntax.
>
> BobGardner@... wrote:
> >
> > In a message dated 6/18/2006 12:31:42 P.M. Eastern Standard Time,
> > epm_2006@... writes:
> >
> > could anyone tell me how?
> >
> >
> >
> > =========================
> > I use the imagecraft HC12 compiler, and this is CLEARLY explained in
the
> > help file. I have heard some complaints about how easy/hard
codeworrier is to
> > use, but SURELY there is some mention of how to do this in the
docs... Big
> > picture is inline in a c file, or add a .s file to the project. Know
how to do an
> > assembler only program?
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> >



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )