有问题请教
IMR .set 0004h
IFR .set 0006h
WDCR .set 7029h
SCSR1 .set 7018h
MCRA .set 7090h
PBDATDIR .set 709ah
WD_KEY .set 7025h
WSGR .set 0FFFFH
KICK_DOG .macro
LDP #0E0H
SPLK #5555H ,WD_KEY
SPLK #0AAAAH,WD_KEY
LDP #0H
.endm
.title \"vectors.asm\"
.ref _c_int0,phantom
.sect \".vectors\"
reset: b _c_int0;
INT1: b phantom;
int2: b phantom;
int3: b phantom;
int4: b phantom;
int5: b phantom;
int6: b phantom;
.def _c_int0 ,phantom
.bss OUTDATA,1
.bss GPRO, 1
.text
_c_int0:
CLRC CNF
CLRC OVM
CLRC SXM
SETC INTM
LDP #0E0H
SPLK #0E8H,WDCR
SPLK #81FEH,SCSR1
LDP #0E1H
SPLK #0FFH,MCRA
SPLK #0FF00H,PBDATDIR
LDP #0H
SPLK #0,IMR
LACC IFR
SACL IFR
SPLK #0H ,GPRO
OUT GPRO,WSGR
KICK_DOG
LOOP
LDP #0H
SPLK #1H, OUTDATA
ST_LOOP
LDP #0E1H
LACC OUTDATA
OR #0FF00H
SACL PBDATDIR
CALL DELAY
LACC OUTDATA
SFL
SACL OUTDATA
B ST_LOOP
.END
DELAY
LAR AR0,#01H
RPT #0FFH
NOP
RET
phantom:
CLRC INTM
RET
MEMORY
{
PAGE 0: VECS: origin = 0000h, length = 0040h
PROG: origin = 0040h, length = 3fc0h
PAGE 1: B0B1: origin = 0200h, length = 200h
SARAM: origin = 8000h, length = 1000h
}
SECTIONS
{
vectors : { } > VECS PAGE = 0
.cinit : { } > PROG PAGE = 0
.text : { } > PROG PAGE = 0
.const : { } > B0B1 PAGE 1
.data : { } > B0B1 PAGE 1
.bss : { } > SARAM PAGE 1
.stack : { } > SARAM PAGE 1
.sysmem : { } > SARAM PAGE 1
}
还想请问一下:如何根据自己的主程序来编写CMD文件,还是主程序参照CMD文件编写?CMD如何编写?谢谢
在上面的程序中我修改了一下CMD文件后,程序就跑不起来了!麻烦帮我看下是怎么回事?
MEMORY
{
PAGE 0: /* program memory */
PM : origin = 0000h, length = 08000h /*32K On-chip memory*/
SARAM : origin = 8000h, length = 0800h /*2K SARAM in program space*/
EX1_PM : origin = 8800h , length = 07600h /*External RAM*/
B0_PM : origin = 0FF00h, length = 0100h /*On chip DARAM if CNF =1,else */
PAGE 1: /* data memory*/
REGS
rigin = 0h, length = 60h
BLK_B2
rigin = 0060h,length = 20h
BLK_B0
rigin = 0200h,length = 100h
BLK_B1:origin = 0300h,length = 100h
SARAM_D:origin = 800h,length = 800h
PERIPH: origin= 07000h,length = 1000h
EX2_DM:origin = 8000h,length = 8000h
PAGE 3: /*I/O memory*/
IO_EX: origin = 0h,length = 0FFF0h
IO_IN: origin = 0FFF0h,length = 0Fh
}
SECTIONS
{
vectors : { } > PM PAGE 0
.text : { } > PM PAGE 0
.data : { } > BLK_B0 PAGE 1
.bss : { } > EX2_DM PAGE 1
}
BSS设置的不对.
你把BSS设到BLK_B1,
在你自己定义的变量前写
LDP #6
试试.
页地址要搞对.
老师,我按的修改了,还是提示:
CALL DELAY
\"asm1.asm\", line 44: AN IDENTIFIER IN THE EXPRESSION IS INVALID
不知道为什么,我看例程里也都没定义呀
在我自己定义的变量前用LDP #6H,还是不行呀!
我看书上的例子里面把.BSS定义在300H-3FFH,但是在使用的时候还是用的LDP #0H呀,不明白为什么?
1.你DELAY程序前面有一个.END,应该放在最后.
2.那可能你的程序还有其他错误.
3.BSS定义在300H-37FH,要用LDP #6
BSS定义在380H-3FFH,要用LDP #7
书上可能有错误.