打印

HotC51汇编数组定义头文件(HotAsm.h V1.02)即将发布.

[复制链接]
2553|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
HotC51|  楼主 | 2009-2-26 22:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*------------------------------------------------------------
    HotC51汇编数组定义头文件(HotAsm.h V1.02)
最初建立时间: 2009.2.18 
最近修改时间: 2009.2.26    (正在添加之中,最终将彻底替代嵌入汇编)
增  添原  因: 为全面支持裸奔式实时操作系统HotTask51做准备
              并替代年代久远的HotIns.h/c(不在HotTask51下使用)
应        用: 可以用COM接口技术对HotC51汇编数组进行封装
              实现比嵌入汇编更为灵活和更非典之用,“汇编数组”的
              出现,将程序战场蔓延至整个代码和数据区~~~
--------------------------------------------------------------
    HotTask51汇编数组调用函数库(正在添加之中,最后形成“水库”)
--------------------------------------------------------------
    第一步:编写汇编数组的“汇编代码” 参见HotIns.h/c
--------------------------------------------------------------
HotASM (__reset_comlib__)[] = 
{//应该在C文件中编写
    HotASM_PUSH_DPL(),            
    HotASM_PUSH_DPH(),
    HotASM_RETI(),
    HotASM_CLR_A(),
    HotASM_PUSH_ACC(),            
    HotASM_PUSH_ACC(),
    HotASM_RETI(),
};
--------------------------------------------------------------
    第二步:编写普通C函数,注意它的名字与调用关系不大
--------------------------------------------------------------
void Reset()
{//此法只是演示如何替代HotIns.h/c  
    IE=0;
    DPTR = __reset_comlib__ + 5;
    _icall_(__reset_comlib__);
}
void Start()
{//此法只是演示如何替代HotIns.h/c  
    IE=0;
    PSW=0;
    _icall_(__reset_comlib__ + 4);
    _icall_(__reset_comlib__ + 4);
}
---------------------------------------------------
    第三步:编写COM接口,填入需要的C函数,
注意它的名称与调用次序关系很大,名称与调用关系不大
最后在HotAsm.h的接口里:
interface
{
    void (*HotAsm_Start)(void);
    void (*HotAsm_Reset)(void);
}IHotCom_AsmVtbl_Interface, *pIHotCom_AsmVtbl_Interface;

则在主程序里的函数名是asmLib.function.HotAsm_Reset();
----------------------------------------------------------------
IHotCom_Asm_Interface asmLib =//真实的COM接口 
{
    (pHotAsmFunction)Start,//
    (pHotAsmFunction)Reset,
};

#include "hottask51.h"
void main()
{
    asmLib.function.HotAsm_Start();//二次RETI(HotC51将做专题)
    asmLib.function.HotAsm_Reset();//软件复位
    HotTaskStart();//此时任务永远不可能启动
}              
菜农HotPower@126.com 2008.2.26 于西安大雁塔村农会
---------------------------------------------------------------*/


/*--------------------------------------------------------------------------------------------
                HotASM51汇编指令集宏指令定义
  Rn(x)   Rn(0~7)                  asm_MOV_A,R0(), asm_MOV_A_Rn(5),      mov a,r0;mov a,r5;
@ iRn(x)  iRn(0~1)                  asm_MOV_A_iR1(), asm_MOVX_iRn_A(0), mov a,@r1;movx @r0,a;
! BIT(x)  BIT(0~0x7f, 0x80~0xff)  asm_CLR_BIT(0x30),asm_SETB_P0_0(),  clr 30h;setb p0.0;
& REG(x)  REG(0~0x7f, 0x80~0xff)  asm_MOV_REG_A(HotASM_B),              mov b,a;
# DATA(x) DATA(0~0xff, 0~0xffff)  asm_MOV_A_DATA(250),                  mov a,#250;
---------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------
NOP
指令名称:空操作指令
指令功能:不执行任何操作,常用于产生一个机器周期的时间延迟
操作内容:PC←(PC)+l
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_NOP(),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_NOP()               (HotASM_REG)0x00
/*--------------------------------------------------------------------------------------------
AJMP addr11
指令名称:绝对转移指令
指令功能:构造目的地址,实现程序转移。其方法是以指令提供的11位地址,取代PC的低11位,.
          而PC的高5位保持不变。
操作内容:PC←(PC)+2 PCl0~0←addrll
字 节 数:2
机器周期:2
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_AJMP(0x2500),
            asm_AJMP(0x2500),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_AJMP             (HotASM_REG)0x01
      #define asm_AJMP(addr11)         HotASM_AAREG(HotASM_Code_AJMP, addr11)
/*--------------------------------------------------------------------------------------------
LJMP addrl6
指令名称:长转移指令
指令功能:使程序按指定地址进行无条件转移
操作内容:PC←addrl6
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_LJMP(0x2500),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_LJMP             (HotASM_REG)0x02
      #define asm_LJMP(addrl6)     HotASM_Code_LJMP, HotASM_LAREG(addrl6)
/*--------------------------------------------------------------------------------------------
RR A
指令名称:循环右移指令
指令功能:累加器内容循环右移一位
操作内容:An←(An+1);n=0~6 A7←(A0)
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_RR_A(),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_RR_A()               (HotASM_REG)0x03
/*--------------------------------------------------------------------------------------------
INC A
指令名称:累加器加1指令
指令功能:累加器内容加1
操作内容:A←(A)+1
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_INC_A(),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_INC_A()              (HotASM_REG)0x04
/*--------------------------------------------------------------------------------------------
INC direct
指令名称:直接寻址单元加1指令
指令功能:内部BAM低128单元或专用寄存器内容加1
操作内容:direct←(direct)+1
字 节 数:2
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_INC_ACC(),
            asm_INC_REG(HotASM_B),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_INC_REG          (HotASM_REG)0x05
#define asm_INC_REG(direct)         HotASM_Code_INC_REG, (HotASM_REG)(direct) 
    #define asm_INC_SP()             HotASM_Code_INC_REG, HotASM_SP
    #define asm_INC_PSW()             HotASM_Code_INC_REG, HotASM_PSW
    #define asm_INC_ACC()             HotASM_Code_INC_REG, HotASM_ACC
    #define asm_INC_B()             HotASM_Code_INC_REG, HotASM_B
    #define asm_INC_DPL()             HotASM_Code_INC_REG, HotASM_DPL
    #define asm_INC_DPH()             HotASM_Code_INC_REG, HotASM_DPH


/*--------------------------------------------------------------------------------------------
INC @Ri
指令名称:间接寻址单元加1指令
指令功能:内部RAM低128单元内容加1
操作内容:(Ri)←((Ri))+1;i=0,l
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_INC_iR0(),
            asm_INC_iRn(HotASM_R0),
            asm_INC_iRn(HotASM_R1),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define asm_INC_iRn(Ri)            (HotASM_REG)(0x06 + Ri % 1)
        #define asm_INC_iR0()      (HotASM_REG)0x06
        #define asm_INC_iR1()      (HotASM_REG)0x07
/*--------------------------------------------------------------------------------------------
INC Rn
指令名称:寄存器加1指令
指令功能:寄存器内容加1
操作内容:Rn←(Rn)+1,n=0~7
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_INC_R3(),
            asm_INC_Rn(HotASM_R0),
            asm_INC_Rn(HotASM_R1),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_INC_Rn(Rn)         (HotASM_REG)(0x08 + Rn % 8)
        #define asm_INC_R0()        (HotASM_REG)0x08
        #define asm_INC_R1()        (HotASM_REG)0x09
        #define asm_INC_R2()        (HotASM_REG)0x0a
        #define asm_INC_R3()        (HotASM_REG)0x0b
        #define asm_INC_R4()        (HotASM_REG)0x0c
        #define asm_INC_R5()        (HotASM_REG)0x0d
        #define asm_INC_R6()        (HotASM_REG)0x0e
        #define asm_INC_R7()        (HotASM_REG)0x0f
/*--------------------------------------------------------------------------------------------
JBC bit,rel
指令名称:位条件转移清0指令
指令功能:对指定位的状态进行测试。若为1,则把该位清0并进行转移;否则程序顺序执行
操作内容:若(bit)=1,则PC←(PC)+3+rel,bit←0 若(bit)≠1,则PC←(PC)+3
字 节 数:3
机器周期:2
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_JBC_BIT(HotASM_24H_1, __HotASM_Fuction__1),
            asm_RET()
          };
          HotASM (__HotASM_Fuction__1)[] = 
          {
            asm_JBC_BIT(HotASM_24H_X(0), __HotASM_Fuction__),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_JBC              (HotASM_REG)0x10
    #define asm_JBC_BIT(bit, rel)    HotASM_Code_JBC, (bit), (rel)
/*--------------------------------------------------------------------------------------------
ACALL addr11
指令名称:绝对调用指令
指令功能:构造目的地址,进行子程序调用。其方法是以指令提供的11位地址(al0~a0),
          取代PC的低11位,PC的高5位不变。
操作内容:PC←(PC)+2 SP←(SP)+1 (SP)←(PC)7~0 SP←(SP)+1 (SP)←(PC)15~8 PC10~0←addrl0~0
字 节 数:2
机器周期:2
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_ACALL(0x250),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_ACALL             (HotASM_REG)0x11
    #define asm_ACALL(addr)         HotASM_AAREG(HotASM_Code_ACALL, addr)

/*--------------------------------------------------------------------------------------------
LCALL addr16
指令名称:长调用指令
指令功能:按指令给定地址进行子程序调用
操作内容:PC←(PC)+3 SP←(SP)+1 SP)←(PC)7~0 SP←(SP)+1 (SP)←(PC)15~8 PC←addrl6
字 节 数:3
机器周期:2
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_LCALL(0x250),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_LCALL             (HotASM_REG)0x12
    #define asm_LCALL(addr16)     HotASM_Code_LCALL, HotASM_LAREG(addr16)
/*--------------------------------------------------------------------------------------------
RRC A
指令名称:带进位循环右移指令
指令功能:累加器内容连同进位标志位循环右移一位
操作内容:An←(An+1);n=0~6 A7←(C) C←(A0)
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_RRC_A(),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_RRC_A()               (HotASM_REG)0x13
/*--------------------------------------------------------------------------------------------
DEC A
指令名称:累加器减1指令
指令功能:累加器内容减1
操作内容:A←(A)-1
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_DEC_A(),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_DEC_A()              (HotASM_REG)0x14
/*--------------------------------------------------------------------------------------------
DEC direct
指令名称:直接寻址减1指令
指令功能:内部RAM低128单元及专用寄存器内容减1
操作内容:direct←(direct)-1
字 节 数:2
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_DEC_ACC(),
            asm_DEC_B(),
            asm_DEC_REG(HotASM_SP),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_DEC              (HotASM_REG)0x15
    #define asm_DEC_REG(direct)      HotASM_Code_DEC,(HotASM_REG)(direct) 
        #define asm_DEC_SP()          HotASM_Code_DEC, HotASM_SP
        #define asm_DEC_SP()          HotASM_Code_DEC, HotASM_SP
        #define asm_DEC_PSW()          HotASM_Code_DEC, HotASM_PSW
        #define asm_DEC_ACC()          HotASM_Code_DEC, HotASM_ACC
        #define asm_DEC_B()          HotASM_Code_DEC, HotASM_B
        #define asm_DEC_DPL()          HotASM_Code_DEC, HotASM_DPL
        #define asm_DEC_DPH()          HotASM_Code_DEC, HotASM_DPH
/*--------------------------------------------------------------------------------------------
DEC @Ri
指令名称:间接寻址减1指令
指令功能:内部RAM低128单元内容减1
操作内容:(Ri)←((Ri))-1, i=0,1
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_DEC_iR0(),
            asm_DEC_iRn(HotASM_R0),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define asm_DEC_iRn(Ri)            (HotASM_REG)(0x16 + Ri % 1)
        #define asm_DEC_iR0()       (HotASM_REG)0x16
        #define asm_DEC_iR1()       (HotASM_REG)0x17
/*--------------------------------------------------------------------------------------------
DEC Rn
指令名称:寄存器减1指令
指令功能:寄存器内容减1
操作内容:Rn←(Rn)-1,n=0~7
字 节 数:1
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_DEC_R0(),
            asm_DEC_Rn(HotASM_R0),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
    #define asm_DEC_Rn(Rn)             (HotASM_REG)(0x18 + Rn % 8)
        #define asm_DEC_R0()        (HotASM_REG)0x18
        #define asm_DEC_R1()        (HotASM_REG)0x19
        #define asm_DEC_R2()        (HotASM_REG)0x1a
        #define asm_DEC_R3()        (HotASM_REG)0x1b
        #define asm_DEC_R4()        (HotASM_REG)0x1c
        #define asm_DEC_R5()        (HotASM_REG)0x1d
        #define asm_DEC_R6()        (HotASM_REG)0x1e
        #define asm_DEC_R7()        (HotASM_REG)0x1f
/*--------------------------------------------------------------------------------------------
JB bit,rel
指令名称:位条件转移指令
指令功能:根据指定位的状态,决定程序是否转移。若为1则转移;否则顺序执行
操作内容:若(bit)=1,则PC←(PC)+3+rel 若(bit)≠1,则PC←(PC)+3
字 节 数:3
机器周期:2
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_JB_BIT(HotASM_P0_0, 0x250),
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_JB              (HotASM_REG)0x20
    #define asm_JB_BIT(bit, rel)    HotASM_Code_JB, HotASM_BIT(bit), (HotASM_REG)rel
//#define HotASM_Code_AJMP_21        (HotASM_REG)0x21
/*--------------------------------------------------------------------------------------------
RET
指令名称:子程序返回指令
指令功能:子程序返回 
操作内容:PC15~8←((SP)) SP←(SP)-1 PC7~0←((SP)) SP←(SP)-1
字 节 数:1
机器周期:2
--------------------------------------------------------------------------------------------*/
#define asm_RET()                   (HotASM_REG)0x22
/*--------------------------------------------------------------------------------------------
RL A
指令名称:循环左移指令
指令功能:累加器内容循环左移一位
操作内容:An+1←(An); n=0~6 A0←(A7)
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_RL_A()                   (HotASM_REG)0x23
/*--------------------------------------------------------------------------------------------
ADD A,#data
指令名称:立即数加法指令
指令功能:累加器内容与立即数相加
操作内容:A←(A)+data
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_ADD_A_DATA(data)           (HotASM_REG)0x24, (HotASM_REG)data
/*--------------------------------------------------------------------------------------------
ADD A,direct
指令名称:直接寻址加法指令
指令功能:累加器内容与内部RAM单元或专用寄存器内容相加
操作内容:A←(A)+(direct)
字 节 数:2
机器周期:1
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_ADD_A_REG     (HotASM_REG)0x25
#define asm_ADD_A_REG(direct)       HotASM_Code_ADD_A_REG, (HotASM_REG)direct
    #define asm_ADD_A_SP()          HotASM_Code_ADD_A_REG, HotASM_SP
    #define asm_ADD_A_SP()          HotASM_Code_ADD_A_REG, HotASM_SP
    #define asm_ADD_A_PSW()      HotASM_Code_ADD_A_REG, HotASM_PSW
    #define asm_ADD_A_ACC()      HotASM_Code_ADD_A_REG, HotASM_ACC
    #define asm_ADD_A_B()          HotASM_Code_ADD_A_REG, HotASM_B
    #define asm_ADD_A_DPL()      HotASM_Code_ADD_A_REG, HotASM_DPL
    #define asm_ADD_A_DPH()      HotASM_Code_ADD_A_REG, HotASM_DPH
/*--------------------------------------------------------------------------------------------
ADD A,@Ri
指令名称:间接寻址加法指令
指令功能:累加器内容与内部RAM低128单元内容相加
操作内容:A←(A)+((Ri)), i=0,1
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_ADD_A_iRn(Ri)             (HotASM_REG)(0x26 + Ri % 1)
    #define asm_ADD_A_iR0()         (HotASM_REG)0x26
    #define asm_ADD_A_iR1()         (HotASM_REG)0x27
/*--------------------------------------------------------------------------------------------
ADD A,Rn
指令名称:寄存器加法指令
指令功能:累加器内容与寄存器内容相加
操作内容:A←(A)+(Rn), n=0~7
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_ADD_A_Rn(Rn)             (HotASM_REG)(0x28 + Rn % 8)
    #define asm_ADD_A_R0()             (HotASM_REG)0x28
    #define asm_ADD_A_R1()             (HotASM_REG)0x29
    #define asm_ADD_A_R2()             (HotASM_REG)0x2a
    #define asm_ADD_A_R3()             (HotASM_REG)0x2b
    #define asm_ADD_A_R4()             (HotASM_REG)0x2c
    #define asm_ADD_A_R5()             (HotASM_REG)0x2d
    #define asm_ADD_A_R6()             (HotASM_REG)0x2e
    #define asm_ADD_A_R7()             (HotASM_REG)0x2f
/*--------------------------------------------------------------------------------------------
JNB bit,rel                
指令名称:位条件转移指令
指令功能:根据指定位的状态,决定程序是否转移。若为0则转移;否则顺序执行
操作内容:若(bit)=0,则PC←(PC)+3+rel 若(bit)≠0,则PC←(PC)+3
字 节 数:3
机器周期:1
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_JNB                (HotASM_REG)0x30
    #define asm_JNB_BIT(bit, rel) HotASM_Code_JNB, HotASM_BIT(bit), (HotASM_REG)rel
//#define HotASM_Code_AJMP_31        (HotASM_REG)0x31
/*--------------------------------------------------------------------------------------------
RETI
指令名称:中断返回指令
指令功能:中断服务程序返回
操作内容:PC15?/FONT>8←((SP)) SP←(SP)-l PC7~0←((SP)) SP←(SP)-1
字 节 数:1
机器周期:2
--------------------------------------------------------------------------------------------*/
#define asm_RETI()                   (HotASM_REG)0x32
/*--------------------------------------------------------------------------------------------
RLC A
指令名称:带进位循环左移指令
指令功能:累加器内容连同进位标志位循环左移一位
操作内容:An-1←(An);n=0~6 A0←(C) C←(A7)
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_RLC_A()                   (HotASM_REG)0x33
/*--------------------------------------------------------------------------------------------
ADDC A,#data
指令名称:立即数带进位加法指令
指令功能:累加器内容、立即数及进位位相加
操作内容:A←(A)+data+(C)
字 节 数:2
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_ADDC_A_DATA(data)           (HotASM_REG)0x34, (HotASM_REG)data
/*--------------------------------------------------------------------------------------------
ADDC A,direct
指令名称:直接寻址带进位加法指令
指令功能:累加器内容、内部RAM低128单元或专用寄存器内容与进位位加
操作内容:A←(A)+(direct)+(C)
字 节 数:2
机器周期:1
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_ADDC_A_REG     (HotASM_REG)0x35
#define asm_ADDC_A_REG(direct)   HotASM_Code_ADDC_A_REG, (HotASM_REG)direct
    #define asm_ADDC_A_SP()      HotASM_Code_ADDC_A_REG, HotASM_SP
    #define asm_ADDC_A_SP()      HotASM_Code_ADDC_A_REG, HotASM_SP
    #define asm_ADDC_A_PSW()      HotASM_Code_ADDC_A_REG, HotASM_PSW
    #define asm_ADDC_A_ACC()      HotASM_Code_ADDC_A_REG, HotASM_ACC
    #define asm_ADDC_A_B()          HotASM_Code_ADDC_A_REG, HotASM_B
    #define asm_ADDC_A_DPL()      HotASM_Code_ADDC_A_REG, HotASM_DPL
    #define asm_ADDC_A_DPH()      HotASM_Code_ADDC_A_REG, HotASM_DPH
/*--------------------------------------------------------------------------------------------
ADDC A,@Ri
指令名称:间接寻址带进位加法指令
指令功能:累加器内容、内部RAM低128单元内容及进位位相加
操作内容:A←(A)+((Ri)), i=0,1
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_ADDC_A_iRn(Ri)         (HotASM_REG)(0x36 + Ri % 1)
    #define asm_ADDC_A_iR0()     (HotASM_REG)0x36
    #define asm_ADDC_A_iR1()     (HotASM_REG)0x37
/*--------------------------------------------------------------------------------------------
ADDC A,Rn
指令名称:寄存器带进位加法指令
指令功能:累加器内容、寄存器内容和进位位相加
操作内容:A←(A)+(Rn)+(C), n=0~7
字 节 数:1
机器周期:1
--------------------------------------------------------------------------------------------*/
#define asm_ADDC_A_Rn(Rn)         (HotASM_REG)(0x38 + Rn % 8)
    #define asm_ADDC_A_R0()         (HotASM_REG)0x38
    #define asm_ADDC_A_R1()         (HotASM_REG)0x39
    #define asm_ADDC_A_R2()         (HotASM_REG)0x3a
    #define asm_ADDC_A_R3()         (HotASM_REG)0x3b
    #define asm_ADDC_A_R4()         (HotASM_REG)0x3c
    #define asm_ADDC_A_R5()         (HotASM_REG)0x3d
    #define asm_ADDC_A_R6()         (HotASM_REG)0x3e
    #define asm_ADDC_A_R7()         (HotASM_REG)0x3f
/*--------------------------------------------------------------------------------------------
JC rel
指令名称:累加位条件转移指令
指令功能:根据累加位(C)的状态决定程序是否转移,若为1则转移,否则顺序执行
操作内容:若(C)=1,则PC←(PC)+2+rel 若(C)≠1,则PC←(PC)+2
字 节 数:2
机器周期:2
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_JC              (HotASM_REG)0x40
    #define asm_JC(rel)          HotASM_Code_JC, (HotASM_REG)rel
//#define HotASM_Code_AJMP_41        (HotASM_REG)0x41
/*--------------------------------------------------------------------------------------------
ORL direct,A
指令名称:逻辑或操作指令
指令功能:内部RAM低128单元或专用寄存器内容与累加器内容进行逻辑或操作
操作内容:direct←(direct)∨(A)
字 节 数:2
机器周期:1
HotASM例: HotASM (__HotASM_Fuction__)[] = 
          {
            asm_ORL_B_A(),
            asm_ORL_REG_A(HotASM_DPL)
            asm_RET()
          };
--------------------------------------------------------------------------------------------*/
#define HotASM_Code_ORL_REG_A         (HotASM_REG)0x42
    #define asm_ORL_REG_A(direct)       HotASM_Code_ORL_REG_A, (HotASM_REG)direct
        #define asm_ORL_SP_A()           HotASM_Code_ORL_REG_A, HotASM_SP
        #define asm_ORL_PSW_A()      HotASM_Code_ORL_REG_A, HotASM_PSW
        #define asm_ORL_B_A()          HotASM_Code_ORL_REG_A, HotASM_B
        #define asm_ORL_DPL_A()      HotASM_Code_ORL_REG_A, HotASM_DPL
        #define asm_ORL_DPH_A()      HotASM_Code_ORL_REG_A, HotASM_DPH

相关帖子

沙发
HotC51|  楼主 | 2009-2-26 22:17 | 只看该作者

哈哈~~~沙发自己坐~~~等A人与菜农PK~~~

使用特权

评论回复
板凳
HotC51|  楼主 | 2009-2-27 02:02 | 只看该作者

HotC51汇编数组寄存器定义头文件(HotRegx52.h V1.02)

/*------------------------------------------------------------
    HotC51汇编数组寄存器定义头文件(HotRegx52.h V1.02)
最初建立时间: 2009.2.18 
最近修改时间: 2009.2.27    (正在添加之中,最终将彻底替代嵌入汇编)
增  添原  因: 为全面支持裸奔式实时操作系统HotTask51做准备
              并替代年代久远的HotIns.h/c(不在HotTask51下使用)
应        用: 可以用COM接口技术对HotC51汇编数组进行封装
              实现比嵌入汇编更为灵活和更非典之用,“汇编数组”的
              出现,将程序战场蔓延至整个代码和数据区~~~
-------------------------------------------------------------*/

#ifndef __HotASM_Regx52_H__
#define __HotASM_Regx52_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include "hottask51.h"//裸奔之OS系统链接头文件
/*--------------------------------------------
    汇编数组通用寄存器组定义
--------------------------------------------*/
#define HotASM_Rn(Rn)   (HotASM_REG)(Rn)

#define HotASM_R0         (HotASM_REG)0x00
#define HotASM_R1         (HotASM_REG)0x01
#define HotASM_R2         (HotASM_REG)0x02
#define HotASM_R3         (HotASM_REG)0x03
#define HotASM_R4         (HotASM_REG)0x04
#define HotASM_R5         (HotASM_REG)0x05
#define HotASM_R6         (HotASM_REG)0x06
#define HotASM_R7         (HotASM_REG)0x07

#define HotASM_RGn(group, Rn) (HotASM_REG)((group * 8) + (Rn % 8))

#define HotASM_R00     (HotASM_REG)0x00
#define HotASM_R01     (HotASM_REG)0x01
#define HotASM_R02     (HotASM_REG)0x02
#define HotASM_R03     (HotASM_REG)0x03
#define HotASM_R04     (HotASM_REG)0x04
#define HotASM_R05     (HotASM_REG)0x05
#define HotASM_R06     (HotASM_REG)0x06
#define HotASM_R07        (HotASM_REG)0x07

#define HotASM_R10     (HotASM_REG)0x08
#define HotASM_R11     (HotASM_REG)0x09
#define HotASM_R12     (HotASM_REG)0x0a
#define HotASM_R13     (HotASM_REG)0x0b
#define HotASM_R14     (HotASM_REG)0x0c
#define HotASM_R15     (HotASM_REG)0x0d
#define HotASM_R16     (HotASM_REG)0x0e
#define HotASM_R17    (HotASM_REG)0x0f

#define HotASM_R20     (HotASM_REG)0x10
#define HotASM_R21     (HotASM_REG)0x11
#define HotASM_R22     (HotASM_REG)0x12
#define HotASM_R23     (HotASM_REG)0x13
#define HotASM_R24     (HotASM_REG)0x14
#define HotASM_R25     (HotASM_REG)0x15
#define HotASM_R26     (HotASM_REG)0x16
#define HotASM_R27        (HotASM_REG)0x17

#define HotASM_R30     (HotASM_REG)0x18
#define HotASM_R31     (HotASM_REG)0x19
#define HotASM_R32     (HotASM_REG)0x1a
#define HotASM_R33     (HotASM_REG)0x1b
#define HotASM_R34     (HotASM_REG)0x1c
#define HotASM_R35     (HotASM_REG)0x1d
#define HotASM_R36     (HotASM_REG)0x1e
#define HotASM_R37    (HotASM_REG)0x1f
/*--------------------------------------------
    汇编数组位寄存器位定义
--------------------------------------------*/
#define HotASM_20H          (HotASM_REG)0x20
    #define HotASM_20H_X(bit) (HotASM_REG)bit 
    #define HotASM_20H_0 (HotASM_REG)0x00
    #define HotASM_20H_1 (HotASM_REG)0x01
    #define HotASM_20H_2 (HotASM_REG)0x02
    #define HotASM_20H_3 (HotASM_REG)0x03
    #define HotASM_20H_4 (HotASM_REG)0x04
    #define HotASM_20H_5 (HotASM_REG)0x05
    #define HotASM_20H_6 (HotASM_REG)0x06
    #define HotASM_20H_7 (HotASM_REG)0x07
#define HotASM_21H          (HotASM_REG)0x21
    #define HotASM_21H_X(bit) (HotASM_REG)(0x08 + bit)
    #define HotASM_21H_0 (HotASM_REG)0x08
    #define HotASM_21H_1 (HotASM_REG)0x09
    #define HotASM_21H_2 (HotASM_REG)0x0a
    #define HotASM_21H_3 (HotASM_REG)0x0b
    #define HotASM_21H_4 (HotASM_REG)0x0c
    #define HotASM_21H_5 (HotASM_REG)0x0d
    #define HotASM_21H_6 (HotASM_REG)0x0e
    #define HotASM_21H_7 (HotASM_REG)0x0f
#define HotASM_22H          (HotASM_REG)0x22
    #define HotASM_22H_X(bit) (HotASM_REG)(0x10 + bit) 
    #define HotASM_22H_0 (HotASM_REG)0x10
    #define HotASM_22H_1 (HotASM_REG)0x11
    #define HotASM_22H_2 (HotASM_REG)0x12
    #define HotASM_22H_3 (HotASM_REG)0x13
    #define HotASM_22H_4 (HotASM_REG)0x14
    #define HotASM_22H_5 (HotASM_REG)0x15
    #define HotASM_22H_6 (HotASM_REG)0x16
    #define HotASM_22H_7 (HotASM_REG)0x17
#define HotASM_23H          (HotASM_REG)0x21
    #define HotASM_23H_X(bit) (HotASM_REG)(0x18 + bit) 
    #define HotASM_23H_0 (HotASM_REG)0x18
    #define HotASM_23H_1 (HotASM_REG)0x19
    #define HotASM_23H_2 (HotASM_REG)0x1a
    #define HotASM_23H_3 (HotASM_REG)0x1b
    #define HotASM_23H_4 (HotASM_REG)0x1c
    #define HotASM_23H_5 (HotASM_REG)0x1d
    #define HotASM_23H_6 (HotASM_REG)0x1e
    #define HotASM_23H_7 (HotASM_REG)0x1f
#define HotASM_24H          (HotASM_REG)0x24
    #define HotASM_24H_X(bit) (HotASM_REG)(0x20 + bit) 
    #define HotASM_24H_0 (HotASM_REG)0x20
    #define HotASM_24H_1 (HotASM_REG)0x21
    #define HotASM_24H_2 (HotASM_REG)0x22
    #define HotASM_24H_3 (HotASM_REG)0x23
    #define HotASM_24H_4 (HotASM_REG)0x24
    #define HotASM_24H_5 (HotASM_REG)0x25
    #define HotASM_24H_6 (HotASM_REG)0x26
    #define HotASM_24H_7 (HotASM_REG)0x27
#define HotASM_25H          (HotASM_REG)0x25
    #define HotASM_25H_X(bit) (HotASM_REG)(0x28 + bit) 
    #define HotASM_25H_0 (HotASM_REG)0x28
    #define HotASM_25H_1 (HotASM_REG)0x29
    #define HotASM_25H_2 (HotASM_REG)0x2a
    #define HotASM_25H_3 (HotASM_REG)0x2b
    #define HotASM_25H_4 (HotASM_REG)0x2c
    #define HotASM_25H_5 (HotASM_REG)0x2d
    #define HotASM_25H_6 (HotASM_REG)0x2e
    #define HotASM_25H_7 (HotASM_REG)0x2f
#define HotASM_26H          (HotASM_REG)0x26
    #define HotASM_26H_X(bit) (HotASM_REG)(0x30 + bit) 
    #define HotASM_26H_0 (HotASM_REG)0x30
    #define HotASM_26H_1 (HotASM_REG)0x31
    #define HotASM_26H_2 (HotASM_REG)0x32
    #define HotASM_26H_3 (HotASM_REG)0x33
    #define HotASM_26H_4 (HotASM_REG)0x34
    #define HotASM_26H_5 (HotASM_REG)0x35
    #define HotASM_26H_6 (HotASM_REG)0x36
    #define HotASM_26H_7 (HotASM_REG)0x37
#define HotASM_27H          (HotASM_REG)0x27
    #define HotASM_27H_X(bit) (HotASM_REG)(0x38 + bit) 
    #define HotASM_27H_0 (HotASM_REG)0x38
    #define HotASM_27H_1 (HotASM_REG)0x39
    #define HotASM_27H_2 (HotASM_REG)0x3a
    #define HotASM_27H_3 (HotASM_REG)0x3b
    #define HotASM_27H_4 (HotASM_REG)0x3c
    #define HotASM_27H_5 (HotASM_REG)0x3d
    #define HotASM_27H_6 (HotASM_REG)0x3e
    #define HotASM_27H_7 (HotASM_REG)0x3f
#define HotASM_28H          (HotASM_REG)0x28
    #define HotASM_28H_X(bit) (HotASM_REG)(0x40 + bit) 
    #define HotASM_28H_0 (HotASM_REG)0x40
    #define HotASM_28H_1 (HotASM_REG)0x41
    #define HotASM_28H_2 (HotASM_REG)0x42
    #define HotASM_28H_3 (HotASM_REG)0x43
    #define HotASM_28H_4 (HotASM_REG)0x44
    #define HotASM_28H_5 (HotASM_REG)0x45
    #define HotASM_28H_6 (HotASM_REG)0x46
    #define HotASM_28H_7 (HotASM_REG)0x47
#define HotASM_29H          (HotASM_REG)0x29
    #define HotASM_29H_X(bit) (HotASM_REG)(0x48 + bit) 
    #define HotASM_29H_0 (HotASM_REG)0x48
    #define HotASM_29H_1 (HotASM_REG)0x49
    #define HotASM_29H_2 (HotASM_REG)0x4a
    #define HotASM_29H_3 (HotASM_REG)0x4b
    #define HotASM_29H_4 (HotASM_REG)0x4c
    #define HotASM_29H_5 (HotASM_REG)0x4d
    #define HotASM_29H_6 (HotASM_REG)0x4e
    #define HotASM_29H_7 (HotASM_REG)0x4f
#define HotASM_2AH          (HotASM_REG)0x2A
    #define HotASM_2AH_X(bit) (HotASM_REG)(0x50 + bit) 
    #define HotASM_2AH_0 (HotASM_REG)0x50
    #define HotASM_2AH_1 (HotASM_REG)0x51
    #define HotASM_2AH_2 (HotASM_REG)0x52
    #define HotASM_2AH_3 (HotASM_REG)0x53
    #define HotASM_2AH_4 (HotASM_REG)0x54
    #define HotASM_2AH_5 (HotASM_REG)0x55
    #define HotASM_2AH_6 (HotASM_REG)0x56
    #define HotASM_2AH_7 (HotASM_REG)0x57
#define HotASM_2BH          (HotASM_REG)0x2B
    #define HotASM_2BH_X(bit) (HotASM_REG)(0x58 + bit) 
    #define HotASM_2BH_0 (HotASM_REG)0x58
    #define HotASM_2BH_1 (HotASM_REG)0x59
    #define HotASM_2BH_2 (HotASM_REG)0x5a
    #define HotASM_2BH_3 (HotASM_REG)0x5b
    #define HotASM_2BH_4 (HotASM_REG)0x5c
    #define HotASM_2BH_5 (HotASM_REG)0x5d
    #define HotASM_2BH_6 (HotASM_REG)0x5e
    #define HotASM_2BH_7 (HotASM_REG)0x5f
#define HotASM_2CH          (HotASM_REG)0x2C
    #define HotASM_2CH_X(bit) (HotASM_REG)(0x60 + bit) 
    #define HotASM_2AH_0 (HotASM_REG)0x50
    #define HotASM_2AH_1 (HotASM_REG)0x51
    #define HotASM_2AH_2 (HotASM_REG)0x52
    #define HotASM_2AH_3 (HotASM_REG)0x53
    #define HotASM_2AH_4 (HotASM_REG)0x54
    #define HotASM_2AH_5 (HotASM_REG)0x55
    #define HotASM_2AH_6 (HotASM_REG)0x56
    #define HotASM_2AH_7 (HotASM_REG)0x57
#define HotASM_2DH          (HotASM_REG)0x2F
    #define HotASM_2DH_X(bit) (HotASM_REG)(0x68 + bit) 
    #define HotASM_2DH_0 (HotASM_REG)0x68
    #define HotASM_2DH_1 (HotASM_REG)0x69
    #define HotASM_2DH_2 (HotASM_REG)0x6a
    #define HotASM_2DH_3 (HotASM_REG)0x6b
    #define HotASM_2DH_4 (HotASM_REG)0x6c
    #define HotASM_2DH_5 (HotASM_REG)0x6d
    #define HotASM_2DH_6 (HotASM_REG)0x6e
    #define HotASM_2DH_7 (HotASM_REG)0x6f
#define HotASM_2EH          (HotASM_REG)0x2E
    #define HotASM_2EH_X(bit) (HotASM_REG)(0x70 + bit) 
    #define HotASM_2EH_0 (HotASM_REG)0x70
    #define HotASM_2EH_1 (HotASM_REG)0x71
    #define HotASM_2EH_2 (HotASM_REG)0x72
    #define HotASM_2EH_3 (HotASM_REG)0x73
    #define HotASM_2EH_4 (HotASM_REG)0x74
    #define HotASM_2EH_5 (HotASM_REG)0x75
    #define HotASM_2EH_6 (HotASM_REG)0x76
    #define HotASM_2EH_7 (HotASM_REG)0x77
#define HotASM_2FH          (HotASM_REG)0x2F
    #define HotASM_2FH_X(bit) (HotASM_REG)(0x78 + bit) 
    #define HotASM_2FH_0 (HotASM_REG)0x78
    #define HotASM_2FH_1 (HotASM_REG)0x79
    #define HotASM_2FH_2 (HotASM_REG)0x7a
    #define HotASM_2FH_3 (HotASM_REG)0x7b
    #define HotASM_2FH_4 (HotASM_REG)0x7c
    #define HotASM_2FH_5 (HotASM_REG)0x7d
    #define HotASM_2FH_6 (HotASM_REG)0x7e
    #define HotASM_2FH_7 (HotASM_REG)0x7f
/*-----------------------------------------------------------
    汇编数组PX寄存器位定义(HotC51宏扩展接口)
寄存器名:Pn(Pn)  Pn=0~3(可能还有更多的)
------------------------------------------------------------*/
#define HotASM_Pn(Pn)         (HotASM_REG)(0x80 + Pn * 0x10)
  #define HotASM_Pn_X(Pn, bit) (HotASM_REG)(0x80 + Pn * 0x10 + bit)
/*--------------------------------------------
    汇编数组51寄存器定义
--------------------------------------------*/
#define HotASM_P0             (HotASM_REG)0x80
/*--------------------------------------------
    汇编数组P0寄存器位定义
--------------------------------------------*/
  #define HotASM_P0_X(bit) (HotASM_REG)(0x80 + bit)

  #define HotASM_P0_0     (HotASM_REG)0x80
  #define HotASM_P0_1     (HotASM_REG)0x81
  #define HotASM_P0_2     (HotASM_REG)0x82
  #define HotASM_P0_3     (HotASM_REG)0x83
  #define HotASM_P0_4     (HotASM_REG)0x84
  #define HotASM_P0_5     (HotASM_REG)0x85
  #define HotASM_P0_6     (HotASM_REG)0x86
  #define HotASM_P0_7     (HotASM_REG)0x87
    #define HotASM_SP         (HotASM_REG)0x81
    #define HotASM_DPL        (HotASM_REG)0x82
    #define HotASM_DPH        (HotASM_REG)0x83
    #define HotASM_PCON     (HotASM_REG)0x87
/*--------------------------------------------
    汇编数组PCON寄存器位定义(不能位寻址)
--------------------------------------------*/
  #define HotASM_PCON_IDL     (HotASM_REG)0x01
  #define HotASM_PCON_STOP    (HotASM_REG)0x02
  #define HotASM_PCON_PD    (HotASM_REG)0x03    /* Alternate definition */
  #define HotASM_PCON_GF0   (HotASM_REG)0x08
  #define HotASM_PCON_GF1   (HotASM_REG)0x04

  #define HotASM_PCON_SMOD  (HotASM_REG)0x80
#define HotASM_TCON        (HotASM_REG)0x88
/*--------------------------------------------
    汇编数组TCON寄存器位定义
--------------------------------------------*/
  #define HotASM_TCON_X(bit) (HotASM_REG)(0x88 + bit)

  #define HotASM_TCON_0        (HotASM_REG)0x88
  #define HotASM_TCON_1        (HotASM_REG)0x89
  #define HotASM_TCON_2        (HotASM_REG)0x8A
  #define HotASM_TCON_3        (HotASM_REG)0x8B
  #define HotASM_TCON_4        (HotASM_REG)0x8C
  #define HotASM_TCON_5        (HotASM_REG)0x8D
  #define HotASM_TCON_6        (HotASM_REG)0x8E
  #define HotASM_TCON_7        (HotASM_REG)0x8F

  #define HotASM_TCON_IT0    (HotASM_REG)0x88
  #define HotASM_TCON_IE0    (HotASM_REG)0x89
  #define HotASM_TCON_IT1    (HotASM_REG)0x8A
  #define HotASM_TCON_IE1    (HotASM_REG)0x8B
  #define HotASM_TCON_TR0    (HotASM_REG)0x8C
  #define HotASM_TCON_TF0    (HotASM_REG)0x8D
  #define HotASM_TCON_TR1    (HotASM_REG)0x8E
  #define HotASM_TCON_TF1    (HotASM_REG)0x8F
#define HotASM_TMOD        (HotASM_REG)0x89
/*--------------------------------------------
    汇编数组TMOD寄存器位定义(不能位寻址)
--------------------------------------------*/
  #define HotASM_TMOD_0 (HotASM_REG)0x01
  #define HotASM_TMOD_1 (HotASM_REG)0x02
  #define HotASM_TMOD_2 (HotASM_REG)0x04
  #define HotASM_TMOD_3 (HotASM_REG)0x08
  #define HotASM_TMOD_4 (HotASM_REG)0x10
  #define HotASM_TMOD_5 (HotASM_REG)0x20
  #define HotASM_TMOD_6 (HotASM_REG)0x40
  #define HotASM_TMOD_7 (HotASM_REG)0x80

    #define HotASM_TL0    (HotASM_REG)0x8a
    #define HotASM_TH0    (HotASM_REG)0x8c
    #define HotASM_TL1    (HotASM_REG)0x8b
    #define HotASM_TH1    (HotASM_REG)0x8d
#define HotASM_P1         (HotASM_REG)0x90
/*--------------------------------------------
    汇编数组P1寄存器位定义
--------------------------------------------*/
  #define HotASM_P1_X(bit) (HotASM_REG)(0x90 + bit)

  #define HotASM_P1_0    (HotASM_REG)0x90
  #define HotASM_P1_1    (HotASM_REG)0x91
  #define HotASM_P1_2    (HotASM_REG)0x92
  #define HotASM_P1_3    (HotASM_REG)0x93
  #define HotASM_P1_4    (HotASM_REG)0x94
  #define HotASM_P1_5    (HotASM_REG)0x95
  #define HotASM_P1_6    (HotASM_REG)0x96
  #define HotASM_P1_7    (HotASM_REG)0x97
#define HotASM_SCON        (HotASM_REG)0x98
/*--------------------------------------------
    汇编数组SCON寄存器位定义
--------------------------------------------*/
  #define HotASM_SCON_X(bit) (HotASM_REG)(0x98 + bit)

  #define HotASM_SCON_0 (HotASM_REG)0x98
  #define HotASM_SCON_1 (HotASM_REG)0x99
  #define HotASM_SCON_2 (HotASM_REG)0x9A
  #define HotASM_SCON_3 (HotASM_REG)0x9B
  #define HotASM_SCON_4 (HotASM_REG)0x9C
  #define HotASM_SCON_5 (HotASM_REG)0x9D
  #define HotASM_SCON_6 (HotASM_REG)0x9E
  #define HotASM_SCON_7 (HotASM_REG)0x9F

  #define HotASM_SCON_RI     (HotASM_REG)0x98
  #define HotASM_SCON_TI     (HotASM_REG)0x99
  #define HotASM_SCON_RB8     (HotASM_REG)0x9A
  #define HotASM_SCON_TB8     (HotASM_REG)0x9B
  #define HotASM_SCON_REN     (HotASM_REG)0x9C
  #define HotASM_SCON_SM2     (HotASM_REG)0x9D
  #define HotASM_SCON_SM1     (HotASM_REG)0x9E
  #define HotASM_SCON_SM0     (HotASM_REG)0x9F
#define HotASM_SBUF        (HotASM_REG)0x99
#define HotASM_P2         (HotASM_REG)0xa0
/*--------------------------------------------
    汇编数组P2寄存器位定义
--------------------------------------------*/
  #define HotASM_P2_X(bit) (HotASM_REG)(0xa0 + bit)

  #define HotASM_P2_0    (HotASM_REG)0xa0
  #define HotASM_P2_1    (HotASM_REG)0xa1
  #define HotASM_P2_2    (HotASM_REG)0xa2
  #define HotASM_P2_3    (HotASM_REG)0xa3
  #define HotASM_P2_4    (HotASM_REG)0xa4
  #define HotASM_P2_5    (HotASM_REG)0xa5
  #define HotASM_P2_6    (HotASM_REG)0xa6
  #define HotASM_P2_7    (HotASM_REG)0xa7
#define HotASM_IE        (HotASM_REG)0xa8
/*--------------------------------------------
    汇编数组IE寄存器位定义
--------------------------------------------*/
  #define HotASM_IE_X(bit) (HotASM_REG)(0xa8 + bit)

  #define HotASM_IE0    (HotASM_REG)0xa8
  #define HotASM_IE1    (HotASM_REG)0xa9
  #define HotASM_IE2    (HotASM_REG)0xaa
  #define HotASM_IE3    (HotASM_REG)0xab
  #define HotASM_IE4    (HotASM_REG)0xac
  #define HotASM_IE5    (HotASM_REG)0xad
  #define HotASM_IE6    (HotASM_REG)0xae
  #define HotASM_IE7    (HotASM_REG)0xaf

  #define HotASM_EX0    (HotASM_REG)0xa8
  #define HotASM_ET0    (HotASM_REG)0xa9
  #define HotASM_EX1    (HotASM_REG)0xaa
  #define HotASM_ET1    (HotASM_REG)0xab
  #define HotASM_ES        (HotASM_REG)0xac
  #define HotASM_ET2    (HotASM_REG)0xad
//  #define HotASM_IE6    (HotASM_REG)0xae
  #define HotASM_EA        (HotASM_REG)0xaf
#define HotASM_P3         (HotASM_REG)0xb0
/*--------------------------------------------
    汇编数组P3寄存器位定义
--------------------------------------------*/
  #define HotASM_P3_X(bit) (HotASM_REG)(0xb0 + bit)

  #define HotASM_P3_0    (HotASM_REG)0xb0
  #define HotASM_P3_1    (HotASM_REG)0xb1
  #define HotASM_P3_2    (HotASM_REG)0xb2
  #define HotASM_P3_3    (HotASM_REG)0xb3
  #define HotASM_P3_4    (HotASM_REG)0xb4
  #define HotASM_P3_5    (HotASM_REG)0xb5
  #define HotASM_P3_6    (HotASM_REG)0xb6
  #define HotASM_P3_7    (HotASM_REG)0xb7
#define HotASM_IP         (HotASM_REG)0xb8
/*--------------------------------------------
    汇编数组IP寄存器位定义
--------------------------------------------*/
  #define HotASM_IP_X(bit) (HotASM_REG)(0xb8 + bit)

  #define HotASM_IP_0    (HotASM_REG)0xb8
  #define HotASM_IP_1    (HotASM_REG)0xb9
  #define HotASM_IP_2    (HotASM_REG)0xba
  #define HotASM_IP_3    (HotASM_REG)0xbb
  #define HotASM_IP_4    (HotASM_REG)0xbc
  #define HotASM_IP_5    (HotASM_REG)0xbd
  #define HotASM_IP_6    (HotASM_REG)0xbe
  #define HotASM_IP_7    (HotASM_REG)0xbf
#define HotASM_PSW        (HotASM_REG)0xd0
/*--------------------------------------------
    汇编数组PSW寄存器位定义
--------------------------------------------*/
  #define HotASM_PSW_X(bit)    (HotASM_REG)(0xd0 + bit)

  #define HotASM_PSW_0    (HotASM_REG)0xd0
  #define HotASM_PSW_1    (HotASM_REG)0xd1
  #define HotASM_PSW_2    (HotASM_REG)0xd2
  #define HotASM_PSW_3    (HotASM_REG)0xd3
  #define HotASM_PSW_4    (HotASM_REG)0xd4
  #define HotASM_PSW_5    (HotASM_REG)0xd5
  #define HotASM_PSW_6    (HotASM_REG)0xd6
  #define HotASM_PSW_7    (HotASM_REG)0xd7

  #define HotASM_PSW_PX0    (HotASM_REG)0xd0
  #define HotASM_PSW_PT0    (HotASM_REG)0xd1
  #define HotASM_PSW_PX1    (HotASM_REG)0xd2
  #define HotASM_PSW_PT1    (HotASM_REG)0xd3
  #define HotASM_PSW_PS        (HotASM_REG)0xd4
  #define HotASM_PSW_PT2    (HotASM_REG)0xd5
//  #define HotASM_PSW_6        (HotASM_REG)0xd6
//  #define HotASM_PSW_7        (HotASM_REG)0xd7

  #define HotASM_PSW_P        (HotASM_REG)0xd0
  #define HotASM_PSW_F1        (HotASM_REG)0xd1
  #define HotASM_PSW_OV        (HotASM_REG)0xd2
  #define HotASM_PSW_RS0    (HotASM_REG)0xd3
  #define HotASM_PSW_RS1     (HotASM_REG)0xd4
  #define HotASM_PSW_F0        (HotASM_REG)0xd5
  #define HotASM_PSW_AC        (HotASM_REG)0xd6
  #define HotASM_PSW_C        (HotASM_REG)0xd7
#define HotASM_T2CON    (HotASM_REG)0xc8
/*--------------------------------------------
    汇编数组T2CON寄存器位定义
--------------------------------------------*/
    #define HotASM_T2CON_X(bit) (HotASM_REG)(0xc8 + bit)

    #define HotASM_T2CON_0    (HotASM_REG)0xc8
    #define HotASM_T2CON_1    (HotASM_REG)0xc9
    #define HotASM_T2CON_2    (HotASM_REG)0xca
    #define HotASM_T2CON_3    (HotASM_REG)0xcb
    #define HotASM_T2CON_4    (HotASM_REG)0xcc
    #define HotASM_T2CON_5    (HotASM_REG)0xcd
    #define HotASM_T2CON_6    (HotASM_REG)0xce
    #define HotASM_T2CON_7    (HotASM_REG)0xcf

    #define HotASM_TH2    (HotASM_REG)0xcd
    #define HotASM_TL2    (HotASM_REG)0xcc
    #define HotASM_RCAP2H    (HotASM_REG)0xcb
    #define HotASM_RCAP2L    (HotASM_REG)0xca
#define HotASM_ACC         (HotASM_REG)0xe0
/*--------------------------------------------
    汇编数组ACC寄存器位定义
--------------------------------------------*/
  #define HotASM_ACC_X(bit) (HotASM_REG)(0xe0 + bit)

  #define HotASM_ACC_0    (HotASM_REG)0xe0
  #define HotASM_ACC_1    (HotASM_REG)0xe1
  #define HotASM_ACC_2    (HotASM_REG)0xe2
  #define HotASM_ACC_3    (HotASM_REG)0xe3
  #define HotASM_ACC_4    (HotASM_REG)0xe4
  #define HotASM_ACC_5    (HotASM_REG)0xe5
  #define HotASM_ACC_6    (HotASM_REG)0xe6
  #define HotASM_ACC_7    (HotASM_REG)0xe7
#define HotASM_B         (HotASM_REG)0xf0
/*--------------------------------------------
    汇编数组B寄存器位定义
--------------------------------------------*/
  #define HotASM_B_X(bit) (HotASM_REG)(0xf0 + bit)

  #define HotASM_B_0    (HotASM_REG)0xf0
  #define HotASM_B_1    (HotASM_REG)0xf1
  #define HotASM_B_2    (HotASM_REG)0xf2
  #define HotASM_B_3    (HotASM_REG)0xf3
  #define HotASM_B_4    (HotASM_REG)0xf4
  #define HotASM_B_5    (HotASM_REG)0xf5
  #define HotASM_B_6    (HotASM_REG)0xf6
  #define HotASM_B_7    (HotASM_REG)0xf7

#ifdef __cplusplus
}
#endif
#endif//__HotASM_Regx52_H__

使用特权

评论回复
地板
| | 2009-2-27 09:17 | 只看该作者

等待HotRegx52.h V2009.2009版本....

使用特权

评论回复
5
HotC51|  楼主 | 2009-2-27 13:24 | 只看该作者

哈哈~~~估计是套“迷踪拳法”~~~HotAsm.h V1.03来了

/*------------------------------------------------------------
    HotC51汇编数组寄存器定义头文件(HotRegx52.h V1.03)
最初建立时间: 2009.2.18 
最近修改时间: 2009.2.27    (正在添加之中,最终将彻底替代嵌入汇编)
增  添原  因: 为全面支持裸奔式实时操作系统HotTask51做准备
              并替代年代久远的HotIns.h/c(不在HotTask51下使用)
              在汇编数组的环境下替代regx52.h头文件,并更方便。
应        用: 可以用COM接口技术对HotC51汇编数组进行封装
              实现比嵌入汇编更为灵活和更非典之用,“汇编数组”的
              出现,将程序战场蔓延至整个代码和数据区~~~
-------------------------------------------------------------*/

#ifndef __HotASM_Regx52_H__
#define __HotASM_Regx52_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include "hottask51.h"//裸奔之OS系统链接头文件
/*--------------------------------------------
    汇编数组通用位定义
--------------------------------------------*/
#define HotASM_Bit0     (HotASM_REG)0
#define HotASM_Bit1     (HotASM_REG)1
#define HotASM_Bit2     (HotASM_REG)2
#define HotASM_Bit3     (HotASM_REG)3
#define HotASM_Bit4     (HotASM_REG)4
#define HotASM_Bit5     (HotASM_REG)5
#define HotASM_Bit6     (HotASM_REG)6
#define HotASM_Bit7     (HotASM_REG)7
/*--------------------------------------------
    汇编数组IO接口定义
--------------------------------------------*/
#define HotASM_Port0    (HotASM_REG)0
#define HotASM_Port1    (HotASM_REG)1
#define HotASM_Port2    (HotASM_REG)2
#define HotASM_Port3    (HotASM_REG)3
#define HotASM_Port4    (HotASM_REG)4
#define HotASM_Port5    (HotASM_REG)5
#define HotASM_Port6    (HotASM_REG)6
#define HotASM_Port7    (HotASM_REG)7

/*--------------------------------------------
    汇编数组通用寄存器组定义
--------------------------------------------*/
#define HotASM_Rn(Rn)   (HotASM_REG)(Rn % 8)

#define HotASM_R0         (HotASM_REG)0x00
#define HotASM_R1         (HotASM_REG)0x01
#define HotASM_R2         (HotASM_REG)0x02
#define HotASM_R3         (HotASM_REG)0x03
#define HotASM_R4         (HotASM_REG)0x04
#define HotASM_R5         (HotASM_REG)0x05
#define HotASM_R6         (HotASM_REG)0x06
#define HotASM_R7         (HotASM_REG)0x07

#define HotASM_RXn(group, Rn) (HotASM_REG)(((group % 4) * 8) + (Rn % 8))

#define HotASM_R00     (HotASM_REG)0x00
#define HotASM_R01     (HotASM_REG)0x01
#define HotASM_R02     (HotASM_REG)0x02
#define HotASM_R03     (HotASM_REG)0x03
#define HotASM_R04     (HotASM_REG)0x04
#define HotASM_R05     (HotASM_REG)0x05
#define HotASM_R06     (HotASM_REG)0x06
#define HotASM_R07    (HotASM_REG)0x07

#define HotASM_R10     (HotASM_REG)0x08
#define HotASM_R11     (HotASM_REG)0x09
#define HotASM_R12     (HotASM_REG)0x0a
#define HotASM_R13     (HotASM_REG)0x0b
#define HotASM_R14     (HotASM_REG)0x0c
#define HotASM_R15     (HotASM_REG)0x0d
#define HotASM_R16     (HotASM_REG)0x0e
#define HotASM_R17    (HotASM_REG)0x0f

#define HotASM_R20     (HotASM_REG)0x10
#define HotASM_R21     (HotASM_REG)0x11
#define HotASM_R22     (HotASM_REG)0x12
#define HotASM_R23     (HotASM_REG)0x13
#define HotASM_R24     (HotASM_REG)0x14
#define HotASM_R25     (HotASM_REG)0x15
#define HotASM_R26     (HotASM_REG)0x16
#define HotASM_R27        (HotASM_REG)0x17

#define HotASM_R30     (HotASM_REG)0x18
#define HotASM_R31     (HotASM_REG)0x19
#define HotASM_R32     (HotASM_REG)0x1a
#define HotASM_R33     (HotASM_REG)0x1b
#define HotASM_R34     (HotASM_REG)0x1c
#define HotASM_R35     (HotASM_REG)0x1d
#define HotASM_R36     (HotASM_REG)0x1e
#define HotASM_R37    (HotASM_REG)0x1f
/*--------------------------------------------
    汇编数组位寄存器位定义
--------------------------------------------*/
//#define HotASM_BIT_X(breg, bit) (HotASM_REG)((breg * 8) | (bit % 8))

#define HotASM_REG_X(direct, bit) (HotASM_REG)(((direct - 0x20) * 8) | (bit % 8))

#define HotASM_20H          (HotASM_REG)0x20
    #define HotASM_20H_X(bit) HotASM_REG_X(HotASM_20H, bit)
    #define HotASM_20H_0 HotASM_20H_X(HotASM_Bit0)
    #define HotASM_20H_1 HotASM_20H_X(HotASM_Bit1)
    #define HotASM_20H_2 HotASM_20H_X(HotASM_Bit2)
    #define HotASM_20H_3 HotASM_20H_X(HotASM_Bit3)
    #define HotASM_20H_4 HotASM_20H_X(HotASM_Bit4)
    #define HotASM_20H_5 HotASM_20H_X(HotASM_Bit5)
    #define HotASM_20H_6 HotASM_20H_X(HotASM_Bit6)
    #define HotASM_20H_7 HotASM_20H_X(HotASM_Bit7)
#define HotASM_21H          (HotASM_REG)0x21
    #define HotASM_21H_X(bit) HotASM_REG_X(HotASM_21H, bit)
    #define HotASM_21H_0 HotASM_21H_X(HotASM_Bit0)
    #define HotASM_21H_1 HotASM_21H_X(HotASM_Bit1)
    #define HotASM_21H_2 HotASM_21H_X(HotASM_Bit2)
    #define HotASM_21H_3 HotASM_21H_X(HotASM_Bit3)
    #define HotASM_21H_4 HotASM_21H_X(HotASM_Bit4)
    #define HotASM_21H_5 HotASM_21H_X(HotASM_Bit5)
    #define HotASM_21H_6 HotASM_21H_X(HotASM_Bit6)
    #define HotASM_21H_7 HotASM_21H_X(HotASM_Bit7)
#define HotASM_22H          (HotASM_REG)0x22
    #define HotASM_22H_X(bit) HotASM_REG_X(HotASM_22H, bit)
    #define HotASM_22H_0 HotASM_22H_X(HotASM_Bit0)
    #define HotASM_22H_1 HotASM_22H_X(HotASM_Bit1)
    #define HotASM_22H_2 HotASM_22H_X(HotASM_Bit2)
    #define HotASM_22H_3 HotASM_22H_X(HotASM_Bit3)
    #define HotASM_22H_4 HotASM_22H_X(HotASM_Bit4)
    #define HotASM_22H_5 HotASM_22H_X(HotASM_Bit5)
    #define HotASM_22H_6 HotASM_22H_X(HotASM_Bit6)
    #define HotASM_22H_7 HotASM_22H_X(HotASM_Bit7)
#define HotASM_23H          (HotASM_REG)0x23
    #define HotASM_23H_X(bit) HotASM_REG_X(HotASM_23H, bit) 
    #define HotASM_23H_0 HotASM_23H_X(HotASM_Bit0)
    #define HotASM_23H_1 HotASM_23H_X(HotASM_Bit1)
    #define HotASM_23H_2 HotASM_23H_X(HotASM_Bit2)
    #define HotASM_23H_3 HotASM_23H_X(HotASM_Bit3)
    #define HotASM_23H_4 HotASM_23H_X(HotASM_Bit4)
    #define HotASM_23H_5 HotASM_23H_X(HotASM_Bit5)
    #define HotASM_23H_6 HotASM_23H_X(HotASM_Bit6)
    #define HotASM_23H_7 HotASM_23H_X(HotASM_Bit7)
#define HotASM_24H          (HotASM_REG)0x24
    #define HotASM_24H_X(bit) HotASM_REG_X(HotASM_24H, bit) 
    #define HotASM_24H_0 HotASM_24H_X(HotASM_Bit0)
    #define HotASM_24H_1 HotASM_24H_X(HotASM_Bit1)
    #define HotASM_24H_2 HotASM_24H_X(HotASM_Bit2)
    #define HotASM_24H_3 HotASM_24H_X(HotASM_Bit3)
    #define HotASM_24H_4 HotASM_24H_X(HotASM_Bit4)
    #define HotASM_24H_5 HotASM_24H_X(HotASM_Bit5)
    #define HotASM_24H_6 HotASM_24H_X(HotASM_Bit6)
    #define HotASM_24H_7 HotASM_24H_X(HotASM_Bit7)
#define HotASM_25H          (HotASM_REG)0x25
    #define HotASM_25H_X(bit) HotASM_REG_X(HotASM_25H, bit)  
    #define HotASM_25H_0 HotASM_25H_X(HotASM_Bit0)
    #define HotASM_25H_1 HotASM_25H_X(HotASM_Bit1)
    #define HotASM_25H_2 HotASM_25H_X(HotASM_Bit2)
    #define HotASM_25H_3 HotASM_25H_X(HotASM_Bit3)
    #define HotASM_25H_4 HotASM_25H_X(HotASM_Bit4)
    #define HotASM_25H_5 HotASM_25H_X(HotASM_Bit5)
    #define HotASM_25H_6 HotASM_25H_X(HotASM_Bit6)
    #define HotASM_25H_7 HotASM_25H_X(HotASM_Bit7)
#define HotASM_26H          (HotASM_REG)0x26
    #define HotASM_26H_X(bit) HotASM_REG_X(HotASM_26H, bit) 
    #define HotASM_26H_0 HotASM_26H_X(HotASM_Bit0)
    #define HotASM_26H_1 HotASM_26H_X(HotASM_Bit1)
    #define HotASM_26H_2 HotASM_26H_X(HotASM_Bit2)
    #define HotASM_26H_3 HotASM_26H_X(HotASM_Bit3)
    #define HotASM_26H_4 HotASM_26H_X(HotASM_Bit4)
    #define HotASM_26H_5 HotASM_26H_X(HotASM_Bit5)
    #define HotASM_26H_6 HotASM_26H_X(HotASM_Bit6)
    #define HotASM_26H_7 HotASM_26H_X(HotASM_Bit7)
#define HotASM_27H          (HotASM_REG)0x27
    #define HotASM_27H_X(bit) HotASM_REG_X(HotASM_27H, bit) 
    #define HotASM_27H_0 HotASM_27H_X(HotASM_Bit0)
    #define HotASM_27H_1 HotASM_27H_X(HotASM_Bit1)
    #define HotASM_27H_2 HotASM_27H_X(HotASM_Bit2)
    #define HotASM_27H_3 HotASM_27H_X(HotASM_Bit3)
    #define HotASM_27H_4 HotASM_27H_X(HotASM_Bit4)
    #define HotASM_27H_5 HotASM_27H_X(HotASM_Bit5)
    #define HotASM_27H_6 HotASM_27H_X(HotASM_Bit6)
    #define HotASM_27H_7 HotASM_27H_X(HotASM_Bit7)
#define HotASM_28H          (HotASM_REG)0x28
    #define HotASM_28H_X(bit) HotASM_REG_X(HotASM_28H, bit) 
    #define HotASM_28H_0 HotASM_28H_X(HotASM_Bit0)
    #define HotASM_28H_1 HotASM_28H_X(HotASM_Bit1)
    #define HotASM_28H_2 HotASM_28H_X(HotASM_Bit2)
    #define HotASM_28H_3 HotASM_28H_X(HotASM_Bit3)
    #define HotASM_28H_4 HotASM_28H_X(HotASM_Bit4)
    #define HotASM_28H_5 HotASM_28H_X(HotASM_Bit5)
    #define HotASM_28H_6 HotASM_28H_X(HotASM_Bit6)
    #define HotASM_28H_7 HotASM_28H_X(HotASM_Bit7)
#define HotASM_29H          (HotASM_REG)0x29
    #define HotASM_29H_X(bit) HotASM_REG_X(HotASM_29H, bit)  
    #define HotASM_29H_0 HotASM_29H_X(HotASM_Bit0)
    #define HotASM_29H_1 HotASM_29H_X(HotASM_Bit1)
    #define HotASM_29H_2 HotASM_29H_X(HotASM_Bit2)
    #define HotASM_29H_3 HotASM_29H_X(HotASM_Bit3)
    #define HotASM_29H_4 HotASM_29H_X(HotASM_Bit4)
    #define HotASM_29H_5 HotASM_29H_X(HotASM_Bit5)
    #define HotASM_29H_6 HotASM_29H_X(HotASM_Bit6)
    #define HotASM_29H_7 HotASM_29H_X(HotASM_Bit7)
#define HotASM_2AH          (HotASM_REG)0x2A
    #define HotASM_2AH_X(bit) HotASM_REG_X(HotASM_2AH, bit) 
    #define HotASM_2AH_0 HotASM_2AH_X(HotASM_Bit0)
    #define HotASM_2AH_1 HotASM_2AH_X(HotASM_Bit1)
    #define HotASM_2AH_2 HotASM_2AH_X(HotASM_Bit2)
    #define HotASM_2AH_3 HotASM_2AH_X(HotASM_Bit3)
    #define HotASM_2AH_4 HotASM_2AH_X(HotASM_Bit4)
    #define HotASM_2AH_5 HotASM_2AH_X(HotASM_Bit5)
    #define HotASM_2AH_6 HotASM_2AH_X(HotASM_Bit6)
    #define HotASM_2AH_7 HotASM_2AH_X(HotASM_Bit7)
#define HotASM_2BH          (HotASM_REG)0x2B
    #define HotASM_2BH_X(bit) HotASM_REG_X(HotASM_2BH, bit)
    #define HotASM_2BH_0 HotASM_2BH_X(HotASM_Bit0)
    #define HotASM_2BH_1 HotASM_2BH_X(HotASM_Bit1)
    #define HotASM_2BH_2 HotASM_2BH_X(HotASM_Bit2)
    #define HotASM_2BH_3 HotASM_2BH_X(HotASM_Bit3)
    #define HotASM_2BH_4 HotASM_2BH_X(HotASM_Bit4)
    #define HotASM_2BH_5 HotASM_2BH_X(HotASM_Bit5)
    #define HotASM_2BH_6 HotASM_2BH_X(HotASM_Bit6)
    #define HotASM_2BH_7 HotASM_2BH_X(HotASM_Bit7)
#define HotASM_2CH          (HotASM_REG)0x2C
    #define HotASM_2CH_X(bit) HotASM_REG_X(HotASM_2CH, bit)
    #define HotASM_2CH_0 HotASM_2CH_X(HotASM_Bit0)
    #define HotASM_2CH_1 HotASM_2CH_X(HotASM_Bit1)
    #define HotASM_2CH_2 HotASM_2CH_X(HotASM_Bit2)
    #define HotASM_2CH_3 HotASM_2CH_X(HotASM_Bit3)
    #define HotASM_2CH_4 HotASM_2CH_X(HotASM_Bit4)
    #define HotASM_2CH_5 HotASM_2CH_X(HotASM_Bit5)
    #define HotASM_2CH_6 HotASM_2CH_X(HotASM_Bit6)
    #define HotASM_2CH_7 HotASM_2CH_X(HotASM_Bit7)
#define HotASM_2DH          (HotASM_REG)0x2D
    #define HotASM_2DH_X(bit) HotASM_REG_X(HotASM_2DH, bit)
    #define HotASM_2DH_0 HotASM_2DH_X(HotASM_Bit0)
    #define HotASM_2DH_1 HotASM_2DH_X(HotASM_Bit1)
    #define HotASM_2DH_2 HotASM_2DH_X(HotASM_Bit2)
    #define HotASM_2DH_3 HotASM_2DH_X(HotASM_Bit3)
    #define HotASM_2DH_4 HotASM_2DH_X(HotASM_Bit4)
    #define HotASM_2DH_5 HotASM_2DH_X(HotASM_Bit5)
    #define HotASM_2DH_6 HotASM_2DH_X(HotASM_Bit6)
    #define HotASM_2DH_7 HotASM_2DH_X(HotASM_Bit7)
#define HotASM_2EH          (HotASM_REG)0x2E
    #define HotASM_2EH_X(bit) HotASM_REG_X(HotASM_2EH, bit) 
    #define HotASM_2EH_0 HotASM_2EH_X(HotASM_Bit0)
    #define HotASM_2EH_1 HotASM_2EH_X(HotASM_Bit1)
    #define HotASM_2EH_2 HotASM_2EH_X(HotASM_Bit2)
    #define HotASM_2EH_3 HotASM_2EH_X(HotASM_Bit3)
    #define HotASM_2EH_4 HotASM_2EH_X(HotASM_Bit4)
    #define HotASM_2EH_5 HotASM_2EH_X(HotASM_Bit5)
    #define HotASM_2EH_6 HotASM_2EH_X(HotASM_Bit6)
    #define HotASM_2EH_7 HotASM_2EH_X(HotASM_Bit7)
#define HotASM_2FH          (HotASM_REG)0x2F
    #define HotASM_2FH_X(bit) HotASM_REG_X(HotASM_2FH, bit) 
    #define HotASM_2FH_0 HotASM_2FH_X(HotASM_Bit0)
    #define HotASM_2FH_1 HotASM_2FH_X(HotASM_Bit1)
    #define HotASM_2FH_2 HotASM_2FH_X(HotASM_Bit2)
    #define HotASM_2FH_3 HotASM_2FH_X(HotASM_Bit3)
    #define HotASM_2FH_4 HotASM_2FH_X(HotASM_Bit4)
    #define HotASM_2FH_5 HotASM_2FH_X(HotASM_Bit5)
    #define HotASM_2FH_6 HotASM_2FH_X(HotASM_Bit6)
    #define HotASM_2FH_7 HotASM_2FH_X(HotASM_Bit7)
/*-----------------------------------------------------------
    汇编数组PX寄存器位定义(HotC51宏扩展接口)
寄存器名:Pn(Pn)  Pn=0~3(可能还有更多的)
------------------------------------------------------------*/
#define HotASM_SREG_X(direct, bit) (HotASM_REG)((direct | 0x80) | (bit % 8))

  #define HotASM_Pn(Pn)         (HotASM_REG)(0x80 + (Pn % 4) * 0x10)
  #define HotASM_Pn_X(Pn, bit)  (HotASM_REG)(HotASM_Pn(Pn) | (bit % 8))
/*--------------------------------------------
    汇编数组51寄存器定义
--------------------------------------------*/
#define HotASM_P0             (HotASM_REG)0x80
/*--------------------------------------------
    汇编数组P0寄存器位定义
--------------------------------------------*/
  #define HotASM_P0_X(bit) HotASM_SREG_X(HotASM_P0, bit)

  #define HotASM_P0_0     HotASM_P0_X(HotASM_Bit0)
  #define HotASM_P0_1     HotASM_P0_X(HotASM_Bit1)
  #define HotASM_P0_2     HotASM_P0_X(HotASM_Bit2)
  #define HotASM_P0_3     HotASM_P0_X(HotASM_Bit3)
  #define HotASM_P0_4     HotASM_P0_X(HotASM_Bit4)
  #define HotASM_P0_5     HotASM_P0_X(HotASM_Bit5)
  #define HotASM_P0_6     HotASM_P0_X(HotASM_Bit6)
  #define HotASM_P0_7     HotASM_P0_X(HotASM_Bit7)
    #define HotASM_SP         (HotASM_REG)0x81
    #define HotASM_DPL        (HotASM_REG)0x82
    #define HotASM_DPH        (HotASM_REG)0x83
/*--------------------------------------------
    汇编数组PCON寄存器位定义(不能位寻址)
--------------------------------------------*/
#define HotASM_PCON     (HotASM_REG)0x87
  #define HotASM_PCON_X(bit) (HotASM_REG)(HotASM_PCON + (1 << (bit % 8)))

  #define HotASM_PCON_0     HotASM_PCON_X(HotASM_Bit0)
  #define HotASM_PCON_1     HotASM_PCON_X(HotASM_Bit1)
  #define HotASM_PCON_2     HotASM_PCON_X(HotASM_Bit2)
  #define HotASM_PCON_3     HotASM_PCON_X(HotASM_Bit3)
  #define HotASM_PCON_4     HotASM_PCON_X(HotASM_Bit4)
  #define HotASM_PCON_5     HotASM_PCON_X(HotASM_Bit5)
  #define HotASM_PCON_6     HotASM_PCON_X(HotASM_Bit6)
  #define HotASM_PCON_7     HotASM_PCON_X(HotASM_Bit7)

  #define HotASM_PCON_IDL_     HotASM_PCON_0
  #define HotASM_PCON_STOP_    HotASM_PCON_1
  #define HotASM_PCON_PD_    HotASM_PCON_1
  #define HotASM_PCON_GF0_  HotASM_PCON_2
  #define HotASM_PCON_GF1_  HotASM_PCON_3
  #define HotASM_PCON_SMOD_ HotASM_PCON_7

  #define HotASM_IDL_         HotASM_PCON_0
  #define HotASM_STOP_        HotASM_PCON_1
  #define HotASM_PD_        HotASM_PCON_1
  #define HotASM_GF0_          HotASM_PCON_2
  #define HotASM_GF1_          HotASM_PCON_3
  #define HotASM_SMOD_         HotASM_PCON_7
/*--------------------------------------------
    汇编数组TCON寄存器位定义
--------------------------------------------*/
#define HotASM_TCON        (HotASM_REG)0x88
  #define HotASM_TCON_X(bit) HotASM_SREG_X(HotASM_TCON, bit)

  #define HotASM_TCON_0        HotASM_TCON_X(HotASM_Bit0)
  #define HotASM_TCON_1        HotASM_TCON_X(HotASM_Bit1)
  #define HotASM_TCON_2        HotASM_TCON_X(HotASM_Bit2)
  #define HotASM_TCON_3        HotASM_TCON_X(HotASM_Bit3)
  #define HotASM_TCON_4        HotASM_TCON_X(HotASM_Bit4)
  #define HotASM_TCON_5        HotASM_TCON_X(HotASM_Bit5)
  #define HotASM_TCON_6        HotASM_TCON_X(HotASM_Bit6)
  #define HotASM_TCON_7        HotASM_TCON_X(HotASM_Bit7)

  #define HotASM_TCON_IT0    HotASM_TCON_0
  #define HotASM_TCON_IE0    HotASM_TCON_1
  #define HotASM_TCON_IT1    HotASM_TCON_2
  #define HotASM_TCON_IE1    HotASM_TCON_3
  #define HotASM_TCON_TR0    HotASM_TCON_4
  #define HotASM_TCON_TF0    HotASM_TCON_5
  #define HotASM_TCON_TR1    HotASM_TCON_6
  #define HotASM_TCON_TF1    HotASM_TCON_7

  #define HotASM_IT0    HotASM_TCON_0
  #define HotASM_IE0    HotASM_TCON_1
  #define HotASM_IT1    HotASM_TCON_2
  #define HotASM_IE1    HotASM_TCON_3
  #define HotASM_TR0    HotASM_TCON_4
  #define HotASM_TF0    HotASM_TCON_5
  #define HotASM_TR1    HotASM_TCON_6
  #define HotASM_TF1    HotASM_TCON_7
/*--------------------------------------------
    汇编数组TMOD寄存器位定义(不能位寻址)
--------------------------------------------*/
#define HotASM_TMOD        (HotASM_REG)0x89
  #define HotASM_TMOD_X(bit) (HotASM_REG)(HotASM_TMOD + (1 << (bit % 8)))

  #define HotASM_TMOD_0 HotASM_TMOD_X(HotASM_Bit0)
  #define HotASM_TMOD_1 HotASM_TMOD_X(HotASM_Bit1)
  #define HotASM_TMOD_2 HotASM_TMOD_X(HotASM_Bit2)
  #define HotASM_TMOD_3 HotASM_TMOD_X(HotASM_Bit3)
  #define HotASM_TMOD_4 HotASM_TMOD_X(HotASM_Bit4)
  #define HotASM_TMOD_5 HotASM_TMOD_X(HotASM_Bit5)
  #define HotASM_TMOD_6 HotASM_TMOD_X(HotASM_Bit6)
  #define HotASM_TMOD_7 HotASM_TMOD_X(HotASM_Bit7)

  #define HotASM_TMOD_T0_M0_   HotASM_TMOD_0
  #define HotASM_TMOD_T0_M1_   HotASM_TMOD_1
  #define HotASM_TMOD_T0_CT_   HotASM_TMOD_2
  #define HotASM_TMOD_T0_GATE_ HotASM_TMOD_3
  #define HotASM_TMOD_T1_M0_   HotASM_TMOD_4
  #define HotASM_TMOD_T1_M1_   HotASM_TMOD_5
  #define HotASM_TMOD_T1_CT_   HotASM_TMOD_6
  #define HotASM_TMOD_T1_GATE_ HotASM_TMOD_7

  #define HotASM_TMOD_T1_MASK_ (HotASM_TMOD_7 | HotASM_TMOD_6 | HotASM_TMOD_5 | HotASM_TMOD_4)
  #define HotASM_TMOD_T0_MASK_ (HotASM_TMOD_3 | HotASM_TMOD_2 | HotASM_TMOD_1 | HotASM_TMOD_0)

  #define HotASM_T0_M0_   HotASM_TMOD_0
  #define HotASM_T0_M1_   HotASM_TMOD_1
  #define HotASM_T0_CT_   HotASM_TMOD_2
  #define HotASM_T0_GATE_ HotASM_TMOD_3
  #define HotASM_T1_M0_   HotASM_TMOD_4
  #define HotASM_T1_M1_   HotASM_TMOD_5
  #define HotASM_T1_CT_   HotASM_TMOD_6
  #define HotASM_T1_GATE_ HotASM_TMOD_7

  #define HotASM_T1_MASK_ HotASM_TMOD_T1_MASK_
  #define HotASM_T0_MASK_ HotASM_TMOD_T0_MASK_


#define HotASM_TL0        (HotASM_REG)0x8a
#define HotASM_TH0        (HotASM_REG)0x8c
#define HotASM_TL1        (HotASM_REG)0x8b
#define HotASM_TH1        (HotASM_REG)0x8d
/*--------------------------------------------
    汇编数组P1寄存器位定义
--------------------------------------------*/
#define HotASM_P1         (HotASM_REG)0x90
  #define HotASM_P1_X(bit) HotASM_SREG_X(HotASM_P1, bit)

  #define HotASM_P1_0     HotASM_P1_X(HotASM_Bit0)
  #define HotASM_P1_1     HotASM_P1_X(HotASM_Bit1)
  #define HotASM_P1_2     HotASM_P1_X(HotASM_Bit2)
  #define HotASM_P1_3     HotASM_P1_X(HotASM_Bit3)
  #define HotASM_P1_4     HotASM_P1_X(HotASM_Bit4)
  #define HotASM_P1_5     HotASM_P1_X(HotASM_Bit5)
  #define HotASM_P1_6     HotASM_P1_X(HotASM_Bit6)
  #define HotASM_P1_7     HotASM_P1_X(HotASM_Bit7)
/*--------------------------------------------
    汇编数组SCON寄存器位定义
--------------------------------------------*/
#define HotASM_SCON        (HotASM_REG)0x98
  #define HotASM_SCON_X(bit) HotASM_SREG_X(HotASM_SCON, bit)

  #define HotASM_SCON_0 HotASM_SCON_X(HotASM_Bit0)
  #define HotASM_SCON_1 HotASM_SCON_X(HotASM_Bit1)
  #define HotASM_SCON_2 HotASM_SCON_X(HotASM_Bit2)
  #define HotASM_SCON_3 HotASM_SCON_X(HotASM_Bit3)
  #define HotASM_SCON_4 HotASM_SCON_X(HotASM_Bit4)
  #define HotASM_SCON_5 HotASM_SCON_X(HotASM_Bit5)
  #define HotASM_SCON_6 HotASM_SCON_X(HotASM_Bit6)
  #define HotASM_SCON_7 HotASM_SCON_X(HotASM_Bit7)

  #define HotASM_SCON_RI     HotASM_SCON_0
  #define HotASM_SCON_TI     HotASM_SCON_1
  #define HotASM_SCON_RB8     HotASM_SCON_2
  #define HotASM_SCON_TB8     HotASM_SCON_3
  #define HotASM_SCON_REN     HotASM_SCON_4
  #define HotASM_SCON_SM2     HotASM_SCON_5
  #define HotASM_SCON_SM1     HotASM_SCON_6
  #define HotASM_SCON_SM0     HotASM_SCON_7

  #define HotASM_RI     HotASM_SCON_0
  #define HotASM_TI     HotASM_SCON_1
  #define HotASM_RB8     HotASM_SCON_2
  #define HotASM_TB8     HotASM_SCON_3
  #define HotASM_REN     HotASM_SCON_4
  #define HotASM_SM2     HotASM_SCON_5
  #define HotASM_SM1     HotASM_SCON_6
  #define HotASM_SM0     HotASM_SCON_7
#define HotASM_SBUF        (HotASM_REG)0x99
/*--------------------------------------------
    汇编数组P2寄存器位定义
--------------------------------------------*/
#define HotASM_P2         (HotASM_REG)0xa0
  #define HotASM_P2_X(bit) HotASM_SREG_X(HotASM_P2, bit)

  #define HotASM_P2_0     HotASM_P2_X(HotASM_Bit0)
  #define HotASM_P2_1     HotASM_P2_X(HotASM_Bit1)
  #define HotASM_P2_2     HotASM_P2_X(HotASM_Bit2)
  #define HotASM_P2_3     HotASM_P2_X(HotASM_Bit3)
  #define HotASM_P2_4     HotASM_P2_X(HotASM_Bit4)
  #define HotASM_P2_5     HotASM_P2_X(HotASM_Bit5)
  #define HotASM_P2_6     HotASM_P2_X(HotASM_Bit6)
  #define HotASM_P2_7     HotASM_P2_X(HotASM_Bit7)
/*--------------------------------------------
    汇编数组IE寄存器位定义
--------------------------------------------*/
#define HotASM_IE        (HotASM_REG)0xa8
  #define HotASM_IE_X(bit) HotASM_SREG_X(HotASM_IE, bit)

  #define HotASM_IE_0    HotASM_IE_X(HotASM_Bit0)
  #define HotASM_IE_1    HotASM_IE_X(HotASM_Bit1)
  #define HotASM_IE_2    HotASM_IE_X(HotASM_Bit2)
  #define HotASM_IE_3    HotASM_IE_X(HotASM_Bit3)
  #define HotASM_IE_4    HotASM_IE_X(HotASM_Bit4)
  #define HotASM_IE_5    HotASM_IE_X(HotASM_Bit5)
  #define HotASM_IE_6    HotASM_IE_X(HotASM_Bit6)
  #define HotASM_IE_7    HotASM_IE_X(HotASM_Bit7)

  #define HotASM_IE_EX0    HotASM_IE_0
  #define HotASM_IE_ET0    HotASM_IE_1
  #define HotASM_IE_EX1    HotASM_IE_2
  #define HotASM_IE_ET1    HotASM_IE_3
  #define HotASM_IE_ES    HotASM_IE_4
  #define HotASM_IE_ET2    HotASM_IE_5
//  #define HotASM_IE_6    HotASM_IE_6
  #define HotASM_IE_EA    HotASM_IE_6

  #define HotASM_EX0    HotASM_IE_0
  #define HotASM_ET0    HotASM_IE_1
  #define HotASM_EX1    HotASM_IE_2
  #define HotASM_ET1    HotASM_IE_3
  #define HotASM_ES        HotASM_IE_4
  #define HotASM_ET2    HotASM_IE_5
//  #define HotASM_IE_6    HotASM_IE_6
  #define HotASM_EA        HotASM_IE_6
/*--------------------------------------------
    汇编数组P3寄存器位定义
--------------------------------------------*/
#define HotASM_P3         (HotASM_REG)0xb0
  #define HotASM_P3_X(bit) HotASM_SREG_X(HotASM_P3, bit)

  #define HotASM_P3_0     HotASM_P3_X(HotASM_Bit0)
  #define HotASM_P3_1     HotASM_P3_X(HotASM_Bit1)
  #define HotASM_P3_2     HotASM_P3_X(HotASM_Bit2)
  #define HotASM_P3_3     HotASM_P3_X(HotASM_Bit3)
  #define HotASM_P3_4     HotASM_P3_X(HotASM_Bit4)
  #define HotASM_P3_5     HotASM_P3_X(HotASM_Bit5)
  #define HotASM_P3_6     HotASM_P3_X(HotASM_Bit6)
  #define HotASM_P3_7     HotASM_P3_X(HotASM_Bit7)

  #define HotASM_P3_RXD  HotASM_P3_0
  #define HotASM_P3_TXD  HotASM_P3_1
  #define HotASM_P3_INT0 HotASM_P3_2
  #define HotASM_P3_INT1 HotASM_P3_3
  #define HotASM_P3_T0   HotASM_P3_4
  #define HotASM_P3_T1   HotASM_P3_5
  #define HotASM_P3_WR   HotASM_P3_6
  #define HotASM_P3_RD   HotASM_P3_7

  #define HotASM_RXD  HotASM_P3_0
  #define HotASM_TXD  HotASM_P3_1
  #define HotASM_INT0 HotASM_P3_2
  #define HotASM_INT1 HotASM_P3_3
  #define HotASM_T0   HotASM_P3_4
  #define HotASM_T1   HotASM_P3_5
  #define HotASM_WR   HotASM_P3_6
  #define HotASM_RD   HotASM_P3_7
/*--------------------------------------------
    汇编数组IP寄存器位定义
--------------------------------------------*/
#define HotASM_IP         (HotASM_REG)0xb8
  #define HotASM_IP_X(bit) HotASM_SREG_X(HotASM_IP, bit)

  #define HotASM_IP_0    HotASM_IP_X(HotASM_Bit0)
  #define HotASM_IP_1    HotASM_IP_X(HotASM_Bit1)
  #define HotASM_IP_2    HotASM_IP_X(HotASM_Bit2)
  #define HotASM_IP_3    HotASM_IP_X(HotASM_Bit3)
  #define HotASM_IP_4    HotASM_IP_X(HotASM_Bit4)
  #define HotASM_IP_5    HotASM_IP_X(HotASM_Bit5)
  #define HotASM_IP_6    HotASM_IP_X(HotASM_Bit6)
  #define HotASM_IP_7    HotASM_IP_X(HotASM_Bit7)

  #define HotASM_IP_PX0  HotASM_IP_0
  #define HotASM_IP_PT0  HotASM_IP_1
  #define HotASM_IP_PX1  HotASM_IP_2
  #define HotASM_IP_PT1  HotASM_IP_3
  #define HotASM_IP_PS   HotASM_IP_4
  #define HotASM_IP_PT2  HotASM_IP_5

  #define HotASM_PX0  HotASM_IP_0
  #define HotASM_PT0  HotASM_IP_1
  #define HotASM_PX1  HotASM_IP_2
  #define HotASM_PT1  HotASM_IP_3
  #define HotASM_PS   HotASM_IP_4
  #define HotASM_PT2  HotASM_IP_5
/*--------------------------------------------
    汇编数组PSW寄存器位定义
--------------------------------------------*/
#define HotASM_PSW        (HotASM_REG)0xd0
  #define HotASM_PSW_X(bit)    HotASM_SREG_X(HotASM_PSW, bit)

  #define HotASM_PSW_0    HotASM_PSW_X(HotASM_Bit0)
  #define HotASM_PSW_1    HotASM_PSW_X(HotASM_Bit1)
  #define HotASM_PSW_2    HotASM_PSW_X(HotASM_Bit2)
  #define HotASM_PSW_3    HotASM_PSW_X(HotASM_Bit3)
  #define HotASM_PSW_4    HotASM_PSW_X(HotASM_Bit4)
  #define HotASM_PSW_5    HotASM_PSW_X(HotASM_Bit5)
  #define HotASM_PSW_6    HotASM_PSW_X(HotASM_Bit6)
  #define HotASM_PSW_7    HotASM_PSW_X(HotASM_Bit7)

  #define HotASM_PSW_P        HotASM_PSW_0
  #define HotASM_PSW_F1        HotASM_PSW_1
  #define HotASM_PSW_OV        HotASM_PSW_2
  #define HotASM_PSW_RS0    HotASM_PSW_3
  #define HotASM_PSW_RS1     HotASM_PSW_4
  #define HotASM_PSW_F0        HotASM_PSW_5
  #define HotASM_PSW_AC        HotASM_PSW_6
  #define HotASM_PSW_C        HotASM_PSW_7
  #define HotASM_PSW_CY        HotASM_PSW_7

  #define HotASM_P        HotASM_PSW_0
  #define HotASM_F1        HotASM_PSW_1
  #define HotASM_OV        HotASM_PSW_2
  #define HotASM_RS0    HotASM_PSW_3
  #define HotASM_RS1     HotASM_PSW_4
  #define HotASM_F0        HotASM_PSW_5
  #define HotASM_AC        HotASM_PSW_6
  #define HotASM_C        HotASM_PSW_7
  #define HotASM_CY        HotASM_PSW_7
/*--------------------------------------------
    汇编数组T2CON寄存器位定义
--------------------------------------------*/
#define HotASM_T2CON    (HotASM_REG)0xc8
    #define HotASM_T2CON_X(bit) HotASM_SREG_X(HotASM_T2CON, bit)

    #define HotASM_T2CON_0    HotASM_T2CON_X(HotASM_Bit0)
    #define HotASM_T2CON_1    HotASM_T2CON_X(HotASM_Bit1)
    #define HotASM_T2CON_2    HotASM_T2CON_X(HotASM_Bit2)
    #define HotASM_T2CON_3    HotASM_T2CON_X(HotASM_Bit3)
    #define HotASM_T2CON_4    HotASM_T2CON_X(HotASM_Bit4)
    #define HotASM_T2CON_5    HotASM_T2CON_X(HotASM_Bit5)
    #define HotASM_T2CON_6    HotASM_T2CON_X(HotASM_Bit6)
    #define HotASM_T2CON_7    HotASM_T2CON_X(HotASM_Bit7)

    #define HotASM_T2CON_CP_RL2 HotASM_T2CON_0
    #define HotASM_T2CON_C_T2   HotASM_T2CON_1
    #define HotASM_T2CON_TR2    HotASM_T2CON_2
    #define HotASM_T2CON_EXEN2  HotASM_T2CON_3
    #define HotASM_T2CON_TCLK   HotASM_T2CON_4
    #define HotASM_T2CON_RCLK   HotASM_T2CON_5
    #define HotASM_T2CON_EXF2   HotASM_T2CON_6
    #define HotASM_T2CON_TF2    HotASM_T2CON_7

    #define HotASM_CP_RL2 HotASM_T2CON_0
    #define HotASM_C_T2   HotASM_T2CON_1
    #define HotASM_TR2    HotASM_T2CON_2
    #define HotASM_EXEN2  HotASM_T2CON_3
    #define HotASM_TCLK   HotASM_T2CON_4
    #define HotASM_RCLK   HotASM_T2CON_5
    #define HotASM_EXF2   HotASM_T2CON_6
    #define HotASM_TF2    HotASM_T2CON_7


    #define HotASM_TH2    (HotASM_REG)0xcd
    #define HotASM_TL2    (HotASM_REG)0xcc
    #define HotASM_RCAP2H    (HotASM_REG)0xcb
    #define HotASM_RCAP2L    (HotASM_REG)0xca
/*--------------------------------------------
    汇编数组ACC寄存器位定义
--------------------------------------------*/
#define HotASM_ACC         (HotASM_REG)0xe0
  #define HotASM_ACC_X(bit) HotASM_SREG_X(HotASM_ACC, bit)

  #define HotASM_ACC_0    HotASM_ACC_X(HotASM_Bit0)
  #define HotASM_ACC_1    HotASM_ACC_X(HotASM_Bit1)
  #define HotASM_ACC_2    HotASM_ACC_X(HotASM_Bit2)
  #define HotASM_ACC_3    HotASM_ACC_X(HotASM_Bit3)
  #define HotASM_ACC_4    HotASM_ACC_X(HotASM_Bit4)
  #define HotASM_ACC_5    HotASM_ACC_X(HotASM_Bit5)
  #define HotASM_ACC_6    HotASM_ACC_X(HotASM_Bit6)
  #define HotASM_ACC_7    HotASM_ACC_X(HotASM_Bit7)
/*--------------------------------------------
    汇编数组B寄存器位定义
--------------------------------------------*/
#define HotASM_B         (HotASM_REG)0xf0
  #define HotASM_B_X(bit) HotASM_SREG_X(HotASM_B, bit)

  #define HotASM_B_0    HotASM_B_X(HotASM_Bit0)
  #define HotASM_B_1    HotASM_B_X(HotASM_Bit1)
  #define HotASM_B_2    HotASM_B_X(HotASM_Bit2)
  #define HotASM_B_3    HotASM_B_X(HotASM_Bit3)
  #define HotASM_B_4    HotASM_B_X(HotASM_Bit4)
  #define HotASM_B_5    HotASM_B_X(HotASM_Bit5)
  #define HotASM_B_6    HotASM_B_X(HotASM_Bit6)
  #define HotASM_B_7    HotASM_B_X(HotASM_Bit7)

#ifdef __cplusplus
}
#endif
#endif//__HotASM_Regx52_H__

使用特权

评论回复
6
xuyiyi| | 2010-7-31 11:41 | 只看该作者
大叔的汇编玩的.............
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
彻底的倒塌  ;P

使用特权

评论回复
7
hotpower| | 2010-7-31 13:24 | 只看该作者
活过来观念变了~~~

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

36

主题

306

帖子

0

粉丝