|
程序如下;
#define __STACKSIZE__ 0x80 // user stack
#define __ISTACKSIZE__ 0x80 // interrupt stack
#define __HEAPSIZE__ 0x0 // heap size
#define __STANDARD_IO__ 0 // use standard I/O (ex printf)
#define __WATCH_DOG__ 0 // When watchdog is made effective after reset, here is set to 1.
#pragma section program interrupt
#if __WATCH_DOG__ != 1
#define scopy(X,Y,Z) _asm(" .initsct "X","Y","Z"\n"\
" .initsct "X"I,rom"Y",noalign\n"\
" mov.w #(topof "X"I)&0ffffH,A0\n"\
" mov.b #(topof "X"I)>>16,R1H\n"\
" mov.w #(topof "X")&0ffffH,A1\n"\
" mov.w #sizeof "X",R3\n"\
" smovf.b")
#define sclear(X,Y,Z) _asm(" .initsct "X","Y","Z"\n"\
" mov.b #00H,R0L\n"\
" mov.w #(topof "X") ,A1\n"\
" mov.w #sizeof "X",R3\n"\
" sstr.b")
#else
#define scopy(X,Y,Z) _asm(" .initsct "X","Y","Z"\n"\
" .initsct "X"I,rom"Y",noalign\n"\
" scopy "X"I,"X"")
#define sclear(X,Y,Z) _asm(" .initsct "X","Y","Z"\n"\
" N_BZERO "X"")
#endif
#define scopy_f(X,Y,Z) _asm(" .initsct "X","Y","Z"\n"\
" .initsct "X"I,rom"Y",noalign\n"\
" push.w #(sizeof "X") >> 16\n"\
" push.w #(sizeof "X") & 0ffffH\n"\
" push.w #(topof "X") >> 16\n"\
" push.w #(topof "X") & 0ffffH\n"\
" push.w #(topof "X"I) >> 16\n"\
" push.w #(topof "X"I) & 0ffffH\n"\
" .stk 12\n"\
" .glb _bcopy\n"\
" .call _bcopy,G\n"\
" jsr.a _bcopy\n"\
" add.b #12,sp\n"\
" .stk -12")
#define sclear_f(X,Y,Z) _asm(" .initsct "X","Y","Z"\n"\
" push.w #(sizeof "X")>>16\n"\
" push.w #(sizeof "X")&0ffffH\n"\
" push.w #(topof "X")>>16\n"\
" push.w #(topof "X")&0ffffH\n"\
" .stk 8\n"\
" .glb _bzero\n"\
" .call _bzero,G\n"\
" jsr.a _bzero\n"\
" add.b #8H,sp\n"\
" .stk -8")
#if __WATCH_DOG__ == 1
#pragma ASM
scopy .macro FROM_,TO_
mov.b #00,0DH
mov.b #0ffH,0DH
mov.w #0000H,R0
.local M1
M1:
cmp.w #sizeof TO_,R0
.local M2
jeq M2
mov.b #00,0DH
mov.b #0ffH,0DH
mov.w #(topof FROM_)&0ffffH,A0
mov.w #(topof TO_)&0ffffH,A1
add.w R0,A0
add.w R0,A1
mov.b [A0],[A1]
add.w #1,R0
jmp M1
M2:
.endm
N_BZERO .macro SECT_
mov.b #00,0DH
mov.b #0ffH,0DH
mov.w #0000H,R0
.local M1
M1:
cmp.w #sizeof SECT_,R0
.local M2
jeq M2
mov.b #00,0DH
mov.b #0ffH,0DH
mov.w #(topof SECT_)&0ffffH,A0
add.w R0,A0
mov.b #00H,[A0]
add.w #1H,R0
jmp M1
M2:
.endm
#pragma ENDASM
#endif
这段程序到底是什么意思,scopy和sclear有什么功能? |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|