本文整理汇总了C++中ROP_ARG函数的典型用法代码示例。如果您正苦于以下问题:C++ ROP_ARG函数的具体用法?C++ ROP_ARG怎么用?C++ ROP_ARG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ROP_ARG函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SFR_W
/*From several sources, since none said the same thing:
The decimal adjust instruction is associated with the use of the ADD and ADDC instructions.
The eight-bit value in the accumulator is adjusted to form two BCD digits of four bits each.
If the accumulator contents bits 0-3 are greater than 9, OR the AC flag is set, then six is added to
produce a proper BCD digit.
If the carry is set, OR the four high bits 4-7 exceed nine, six is added to the value of these bits.
The carry flag will be set if the result is > 0x99, but not cleared otherwise */
UINT16 new_acc = R_ACC & 0xff;
if(GET_AC || (new_acc & 0x0f) > 0x09)
new_acc += 0x06;
if(GET_CY || ((new_acc & 0xf0) > 0x90) || (new_acc & ~0xff))
new_acc += 0x60;
SFR_W(ACC,new_acc&0xff);
if(new_acc & ~0xff)
SET_CY(1);
}
//DEC A /* 1: 0001 0100 */
INLINE void dec_a(void)
{
SFR_W(ACC,R_ACC-1);
}
//DEC data addr /* 1: 0001 0101 */
INLINE void dec_mem(void)
{
UINT8 addr = ROP_ARG(PC++); //Grab data address
UINT8 data = IRAM_R(addr);
IRAM_W(addr,data-1);
}
//DEC @R0/@R1 /* 1: 0001 011i */
INLINE void dec_ir(int r)
{
UINT8 data = IRAM_IR(R_R(r));
IRAM_W(R_R(r),data-1);
}
//DEC R0 to R7 /* 1: 0001 1rrr */
INLINE void dec_r(int r)
{
R_R(r) = R_R(r) - 1;
}
//DIV AB /* 1: 1000 0100 */
INLINE void div_ab(void)
{
if( R_B == 0 ) {
//Overflow flag is set!
SET_OV(1);
//Really the values are undefined according to the manual, but we'll just leave them as is..
//SFR_W(ACC,0xff);
//SFR_W(B,0xff);
}
else {
int a = (int)R_ACC/R_B;
int b = (int)R_ACC%R_B;
//A gets quotient byte, B gets remainder byte
SFR_W(ACC,a);
SFR_W(B, b);
//Overflow flag is cleared
SET_OV(0);
}
//Carry Flag is always cleared
SET_CY(0);
}
//DJNZ data addr, code addr /* 1: 1101 0101 */
INLINE void djnz_mem(void)
{
UINT8 addr = ROP_ARG(PC++); //Grab data address
INT8 rel_addr = ROP_ARG(PC++); //Grab relative code address
IRAM_W(addr,IRAM_R(addr) - 1); //Decrement value contained at data address
if(IRAM_R(addr) != 0) //Branch if contents of data address is not 0
PC = PC + rel_addr;
}
//DJNZ R0 to R7,code addr /* 1: 1101 1rrr */
INLINE void djnz_r(int r)
{
INT8 rel_addr = ROP_ARG(PC++); //Grab relative code address
R_R(r) = R_R(r) - 1; //Decrement value
if(R_R(r) != 0) //Branch if contents of R0 - R7 is not 0
PC = PC + rel_addr;
}
//INC A /* 1: 0000 0100 */
INLINE void inc_a(void)
{
SFR_W(ACC,R_ACC+1);
}
//INC data addr /* 1: 0000 0101 */
INLINE void inc_mem(void)
{
UINT8 addr = ROP_ARG(PC++); //Grab data address
UINT8 data = IRAM_R(addr);
IRAM_W(addr,data+1);
}
//.........这里部分代码省略.........
示例2: orl_mem_byte
/*ORL data addr, #data 1: 0100 0011 */
INLINE void orl_mem_byte(void)
{
UINT8 addr = ROP_ARG(PC++); /*Grab data address */
UINT8 data = ROP_ARG(PC++); /*Grab data */
UINT8 srcdata = IRAM_R(addr); /*Grab data from data address */
IRAM_W(addr,srcdata | data); /*Set data address value to it's value Logical OR with Data */
}
示例3: jb
/*JB bit addr, code addr 1: 0010 0000 */
INLINE void jb(void)
{
UINT8 addr = ROP_ARG(PC++); /*Grab bit address */
INT8 rel_addr = ROP_ARG(PC++); /*Grab relative code address */
if(BIT_R(addr)) /*If bit set at specified bit address, jump */
PC = PC + rel_addr;
}
示例4: jbc
/*JBC bit addr, code addr 1: 0001 0000 */
INLINE void jbc(void)
{
UINT8 addr = ROP_ARG(PC++); /*Grab bit address */
INT8 rel_addr = ROP_ARG(PC++); /*Grab relative code address */
if(BIT_R(addr)) { /*If bit set at specified bit address, jump */
PC = PC + rel_addr;
BIT_W(addr,0); /*Clear Bit also */
}
}
示例5: SFR_R
/*******************************************************************************************
NOTE: All registers are accessed directly, instead of using the SFR_R() function for speed
Direct register access is availabe from the R_(register name) macros.. ex: R_ACC for the ACC
with the exception of the PC
********************************************************************************************/
//ACALL code addr /* 1: aaa1 0001 */
INLINE void acall(void)
{
UINT8 op = ROP(PC-1); //Grab the opcode for ACALL
UINT8 addr = ROP_ARG(PC++); //Grab code address byte
PUSH_PC //Save PC to the stack
//Thanks Gerrit for help with this! :)
PC = (PC & 0xf800) | ((op & 0xe0) << 3) | addr;
}
//ADD A, #data /* 1: 0010 0100 */
INLINE void add_a_byte(void)
{
UINT8 data = ROP_ARG(PC++); //Grab data
UINT8 result = R_ACC + data; //Add data to accumulator
DO_ADD_FLAGS(R_ACC,data,0) //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADD A, data addr /* 1: 0010 0101 */
INLINE void add_a_mem(void)
{
UINT8 addr = ROP_ARG(PC++); //Grab data address
UINT8 data = IRAM_R(addr); //Grab data from data address
UINT8 result = R_ACC + data; //Add data to accumulator
DO_ADD_FLAGS(R_ACC,data,0); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADD A, @R0/@R1 /* 1: 0010 011i */
INLINE void add_a_ir(int r)
{
UINT8 data = IRAM_IR(R_R(r)); //Grab data from memory pointed to by R0 or R1
UINT8 result = R_ACC + data; //Add data to accumulator
DO_ADD_FLAGS(R_ACC,data,0); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADD A, R0 to R7 /* 1: 0010 1rrr */
INLINE void add_a_r(int r)
{
UINT8 data = R_R(r); //Grab data from R0 - R7
UINT8 result = R_ACC + data; //Add data to accumulator
DO_ADD_FLAGS(R_ACC,data,0); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADDC A, #data /* 1: 0011 0100 */
INLINE void addc_a_byte(void)
{
UINT8 data = ROP_ARG(PC++); //Grab data
UINT8 result = R_ACC + data + GET_CY; //Add data + carry flag to accumulator
DO_ADD_FLAGS(R_ACC,data,GET_CY); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADDC A, data addr /* 1: 0011 0101 */
INLINE void addc_a_mem(void)
{
UINT8 addr = ROP_ARG(PC++); //Grab data address
UINT8 data = IRAM_R(addr); //Grab data from data address
UINT8 result = R_ACC + data + GET_CY; //Add data + carry flag to accumulator
DO_ADD_FLAGS(R_ACC,data,GET_CY); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADDC A, @R0/@R1 /* 1: 0011 011i */
INLINE void addc_a_ir(int r)
{
UINT8 data = IRAM_IR(R_R(r)); //Grab data from memory pointed to by R0 or R1
UINT8 result = R_ACC + data + GET_CY; //Add data + carry flag to accumulator
DO_ADD_FLAGS(R_ACC,data,GET_CY); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//ADDC A, R0 to R7 /* 1: 0011 1rrr */
INLINE void addc_a_r(int r)
{
UINT8 data = R_R(r); //Grab data from R0 - R7
UINT8 result = R_ACC + data + GET_CY; //Add data + carry flag to accumulator
DO_ADD_FLAGS(R_ACC,data,GET_CY); //Set Flags
SFR_W(ACC,result); //Store 8 bit result of addtion in ACC
}
//AJMP code addr /* 1: aaa0 0001 */
INLINE void ajmp(void)
{
UINT8 op = ROP(PC-1); //Grab the opcode for AJMP
UINT8 addr = ROP_ARG(PC++); //Grab code address byte
//Thanks Gerrit for help with this! :)
PC = (PC & 0xf800) | ((op & 0xe0) << 3) | addr;
}
//ANL data addr, A /* 1: 0101 0010 */
//.........这里部分代码省略.........
示例6: cjne_ir_byte
/*CJNE @R0/@R1, #data, code addr 1: 1011 011i */
INLINE void cjne_ir_byte(int r)
{
UINT8 data = ROP_ARG(PC++); /*Grab data */
INT8 rel_addr = ROP_ARG(PC++); /*Grab relative code address */
UINT8 srcdata = IRAM_IR(R_R(r)); /*Grab value pointed to by R0 or R1 */
if(srcdata != data) /*Jump if values are not equal */
PC = PC + rel_addr;
/*Set carry flag to 1 if 1st compare value is < 2nd compare value */
SET_CY( (srcdata < data) );
}
示例7: anl_c_bitaddr
/*ANL C, bit addr 1: 1000 0010 */
INLINE void anl_c_bitaddr(void)
{
int cy = GET_CY;
UINT8 addr = ROP_ARG(PC++); /*Grab bit address */
UINT8 bit = BIT_R(addr); /*Grab bit data from bit address */
SET_CY( (cy & bit) ); /*Set Carry flag to Carry Flag Value Logical AND with Bit */
}
示例8: djnz_r
/*DJNZ R0 to R7,code addr 1: 1101 1rrr */
INLINE void djnz_r(int r)
{
INT8 rel_addr = ROP_ARG(PC++); /*Grab relative code address */
R_R(r) = R_R(r) - 1; /*Decrement value */
if(R_R(r) != 0) /*Branch if contents of R0 - R7 is not 0 */
PC = PC + rel_addr;
}
示例9: add_a_byte
/*ADD A, #data 1: 0010 0100 */
INLINE void add_a_byte(void)
{
UINT8 data = ROP_ARG(PC++); /*Grab data */
UINT8 result = R_ACC + data; /*Add data to accumulator */
DO_ADD_FLAGS(R_ACC,data,0) /*Set Flags */
SFR_W(ACC,result); /*Store 8 bit result of addtion in ACC */
}
示例10: subb_a_byte
/*SUBB A, #data 1: 1001 0100 */
INLINE void subb_a_byte(void)
{
UINT8 data = ROP_ARG(PC++); /*Grab data */
UINT8 result = R_ACC - data - GET_CY; /*Subtract data & carry flag from accumulator */
DO_SUB_FLAGS(R_ACC,data,GET_CY); /*Set Flags */
SFR_W(ACC,result); /*Store 8 bit result of addtion in ACC */
}
示例11: xch_a_mem
/*XCH A, data addr 1: 1100 0101 */
INLINE void xch_a_mem(void)
{
UINT8 addr = ROP_ARG(PC++); /*Grab data address */
UINT8 data = IRAM_R(addr); /*Grab data */
UINT8 oldACC = R_ACC; /*Hold value of ACC */
SFR_W(ACC,data); /*Sets ACC to data */
IRAM_W(addr,oldACC); /*Sets data address to old value of ACC */
}