1. zhengzhongming <zheng430@163.com> HotC51_V1.06 2. xwjfile@21cn.com HotC51_V1.06 3. hugui_bj <hugui_bj@163.com> HotC51_V1.06 4. kanprin <kanprin@163.com> HotC51_V1.06 5. powerfans.liu <powerfans.liu@163.com> HotC51_V1.06 6. "吴旭光" <xuguangw@nwpu.edu.cn> HotC51_V1.06 7. huminqzhli <huminqzhli@126.com> HotC51_V1.06 8. MajorYang <seamajor@gmail.com> HotC51_V1.06 9. "红心j" <78166267@qq.com> HotC51_V1.06 10. nbyhr@126.com HotC51_V1.06 11. gjk <jerkoh@163.com> HotC51_V1.06 12. "高卿(Lawrence Gao)" <lawrence@yaitor.com> HotC51_V1.06 13. liu <liuhang20011@163.com> HotC51_V1.06
/*---------------------------------------------------------------------------- HotC51汇编数组定义头文件(HotAsm.h V1.06) 最初建立时间: 2009.2.18 最近修改时间: 2009.3.4 (可以正式 PK MCS51汇编指令集) 将@Ri统一为iRn,纠正asm_MOV_Ri()为asm_MOV_iRn() 更新Ri % 1的bug(正确为Ri % 2) 增 添原 因: 为全面支持裸奔式实时操作系统HotTask51做准备 并替代年代久远的HotIns.h/c(不在HotTask51下使用)
全面增添HotC51汇编数组扩展指令集,直接PK MCS51汇编指令集
应 用: 可以用COM接口技术对HotC51汇编数组进行封装 封装后的代码将如同穿上铁甲的“战士”~~~ 未 来计 划: 首先将HotC51汇编数组做成比宏汇编更好用的接近C习惯. 开始先修正指令集,逐步完善,最终到达“宏C”之目标。 目前已有HotC51扩展集如直接设置16位的T0/T1等。 小范围内流动,不至于干扰正常的“编程秩序” 菜农HotPower@126.com 2008.3.4 16:58 于西安大雁塔村农会 -----------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------ HotASM51汇编数组指令集与MCS51汇编指令集对照表 DB(x) DB(0~0xff) //伪指令 asm_DB(250),asm_DB('1'), db 250; DW(x) DW(0~0xffff)//伪指令 asm_DW(0x1234),//大端 dw 0x1234; dw(x) dw(0~0xffff)//伪指令 asm_dw(0x1234),//小端 dw 0x3412; 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),asm_MOV_B_A(), mov b,a; # DATA(x) DATA(0~0xff, 0~0xffff) asm_MOV_DPTR(0x250),asm_MOV_A(250) mov dptr,#0x250;mov a,#250; -------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------- HotTask51汇编数组函数测试 void __HotASM_TEST__(void) 入口: DPTR保存的是汇编数组函数的首地址__HotASM_TEST__ R2R1保存的是汇编数组函数的首地址__HotASM_TEST__ 出口: 结果: -----------------------------------------------*/ HotASM (__HotASM_TEST__) {//DPTR保存的是汇编数组函数的首地址__HotASM_ISR__ //HotC51宏扩展指令测试 // asm_JMP_aDPTR(), //jmp @a+dptr // asm_JMP_0DPTR(0x1234), //mov dptr,#1234;clr a;jmp @a+dptr // asm_JMP_nDPTR(0, 0x1234), //mov dptr,#1234;mov a,#0;jmp @a+dptr
//HotC51宏扩展指令测试 // asm_CALL_aDPTR(), //lcall C?ICALL2 + 1 // asm_CALL_0DPTR(0x1234), //mov dptr,#1234;lcall C?ICALL2 // asm_CALL_nDPTR(0, 0x1234), //mov dptr,#1234;mov a,#0;call C?ICALL2 + 1
//HotC51指令测试及HotC51宏扩展指令测试 asm_MOVC_A_aPC(),//movc a,@a+pc asm_MOVC_A_0PC(),//clr a;movc a,@a+PC asm_MOVC_A_nPC(0),//mov a, #0;movc a,@a+PC//比上条指令多1字节
asm_MOVC_A_aDPTR(),//movc a,@a+dptr asm_MOVC_A_0DPTR(0x1234),//mov dptr,#0x1234;clr a;movc a,@a+dptr asm_MOVC_A_nDPTR(0, 0x1234),//mov dptr,#0x1234;mov a, #0;movc a,@a+dptr //比上条指令多1字节
asm_MOVX_A_DPTR(), //movx a,@dptr asm_MOVX_A_iDPTR(0x1234), //mov dptr,#0x1234;movx a,@dptr
asm_MOVX_DPTR_A(), //movx @dptr,a asm_MOVX_0DPTR(0x1234), //mov dptr,#1234;clr a;movx @dptr,a asm_MOVX_nDPTR(0, 0x1234), //mov dptr,#1234;mov a,#0;movx @dptr,a//比上条指令多1字节
asm_MOVX_A_iRn(0), //movx a,@r0 asm_MOVX_A_iRn(1), //movx a,@r1
asm_MOVX_A_iR0(), //movx a,@r0 asm_MOVX_A_iR1(), //movx a,@r1
asm_MOVX_iRn_A(0), //movx @r0,a asm_MOVX_iRn_A(1), //movx @r1,a
asm_MOVX_iR0_A(), //movx @r1,a asm_MOVX_iR1_A(), //movx @r1,a
asm_MOV_A_Rn(0), //mov a,r0 asm_MOV_A_Rn(1), //mov a,r0 asm_MOV_A_Rn(2), //mov a,r0 asm_MOV_A_Rn(3), //mov a,r0 asm_MOV_A_Rn(4), //mov a,r0 asm_MOV_A_Rn(5), //mov a,r0 asm_MOV_A_Rn(6), //mov a,r0 asm_MOV_A_Rn(7), //mov a,r0
asm_MOV_A_R0(), //mov a,r0 asm_MOV_A_R1(), //mov a,r1 asm_MOV_A_R2(), //mov a,r2 asm_MOV_A_R3(), //mov a,r3 asm_MOV_A_R4(), //mov a,r4 asm_MOV_A_R5(), //mov a,r5 asm_MOV_A_R6(), //mov a,r6 asm_MOV_A_R7(), //mov a,r7
asm_MOV_Rn_A(0), //mov r0,a
asm_MOV_R0_A(), //mov r0,a asm_MOV_R1_A(), //mov r1,a asm_MOV_R2_A(), //mov r2,a asm_MOV_R3_A(), //mov r3,a asm_MOV_R4_A(), //mov r4,a asm_MOV_R5_A(), //mov r5,a asm_MOV_R6_A(), //mov r6,a asm_MOV_R7_A(), //mov r7,a
asm_MOV_Rn(0, 250), //mov r0,#250 asm_MOV_R0(250), //mov r0,#250
//HotC51宏扩展指令测试 asm_MOV_Timer0(0x0123),//mov th0,#0x12;mov tl0,#0x34 asm_MOV_Timer1(0x4567),//mov th1,#0x45;mov tl1,#0x67 asm_MOV_Timer2(0x89ab),//mov th2,#0x89;mov tl2,#0xab asm_MOV_RCAP2(0xcdef), //mov RCAP2H,#0xcd;mov RCAP2L,#0xef; asm_MOV_AB(0x1234), //mov a,#12;mov b,#0x34 asm_MOV_BA(0x1234), //mov b,#12;mov a,#0x34
/* #define lable_loop -(size_SJMP() + size_MOV_iRn()+size_ORL_A_iRn()) #define lable_exit size_ORL_A_REG()+size_JNC()+size_ORL_A_REG() //lable_loop: asm_MOV_iR1(250),//mov @r1,#250 asm_ORL_A_iR1(),//orl a,@r1 asm_SJMP(lable_loop), asm_SJMP(lable_exit), asm_ORL_A_B(),//orl a,b asm_JNC(size_ORL_A_REG()),//jnc exit asm_ORL_A_DPL(),//orl a,dpl //lable_exit: */
#define lable__HotASM_TEST__Exit ( size_JBC_P1_X()+ size_CPL_P1_X()+ size_CLR_P3_X()+ size_SETB_P3_X()+ size_NOP()) asm_JB_P2_5(size_JBC_P1_X() + size_CPL_P1_X() + size_CLR_P3_X() + size_SETB_P3_X() + size_NOP() ), asm_NOP(), asm_JBC_P1_0(size_CPL_P1_X() + size_CLR_P3_X() + size_SETB_P3_X() ),//填入JBC_P1_0()到lable__HotASM_TEST__Exit之间的指令长度 asm_CPL_P1_0(), asm_CLR_WR(), asm_SETB_RD(), //lable__HotASM_TEST__Exit: asm_RET() };
|
|
文章评论(0条评论)
登录后参与讨论