#include /* common defines and macros */
#include /* derivative information */
#include "main_asm.h" /* interface to the assembly module */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
void main(void) {
/* put your own code here */
EnableInterrupts;
asm_main(); /* call the assembly function */
for(;;) {
asm{
LDAA #0x02;
STAA A,X;
CPX #$050C;
BNE ad;
LDX #$0502;
ad:INX
}} /* wait forever */
}
以下是asm_main中的内容
MY_EXTENDED_RAM: SECTION
ORG $0502
; Insert here your data definition. For demonstration, temp_byte is used.
TT ds.b 10
; code section
MyCode: SECTION
; this assembly routine is called by the C/C++ application
asm_main:
CLI ; enable interrupts
MOVB #1,TT; just some demonstration code
LDAA #0
TFR A,X
LEAX TT,X
LDAA #$f8;
STAA ,X
NOP ; Insert here you own code
RTC ; return to caller
|