C语言:
static unsigned char Monitor0[16] __attribute__ ((at(0x0180))) ;
static unsigned char Monitor1[16] __attribute__ ((at(0x0190))) ;
static unsigned char var0 __attribute__ ((at(0x01c0))) ;
static unsigned char var1 __attribute__ ((at(0x01c1))) ;
//程序可以直接读写操作, 如: var0 = 0; if(var1 >5){...};
//-----------------------------------------------------------------------------------------
汇编:
;RAMBANK 0 和RAMBANK 1 分开定义
RAMBANK 0 ds0
ds0 .section 'data'
temp0 db ?
temp1 db ?
;存放在RAM Bank1中的变量
RAMBANK 1 ds1
ds1 .section 'data'
b1_data0 db ?
b1_data1 db ?
; 程序中需要用间接寻址代码访问
mov a,1
mov MP1H,A
mov a,offset b1_data0
mov MP1L,A
mov a,3
mov IAR1,A
mov a,offset b1_data1
mov MP1L,a
mov a,56H
mov IAR1,A
|