ON 20020603@3:16:30 PM at page: http://www.piclist.com/techref/member/BJM-bigfoot-486/index.htm BJM-bigfoot-486 Brendan James Moran added 'Comments Pages: /techref/piclist/cump/index.htm ' ON 20020603@8:08:46 PM at page: http://www.piclist.com/techref/member/BJM-bigfoot-486/index.htm BJM-bigfoot-486 Brendan James Moran added 'Maintains Pages: /techref/piclist/cump/index.htm ' ON 20020604@10:43:41 AM at page: http://www.piclist.com/techref/member/BJM-bigfoot-486/index.htm BJM-bigfoot-486 Brendan James Moran edited the page ON 20020624@12:06:15 PM at page: http://www.piclist.com/techref/member/BJM-bigfoot-486/index.htm BJM-bigfoot-486 Brendan James Moran added 'Code: #if 0 +-------------------------------------------------+ | Register select macros by Brendan Moran | | For use by whoever feels so inclined | | relevant email may be sent to | | ansi_annirak AT yahoo.com | +-------------------------------------------------+ #endif setRB0 macro ;set register bank 0 #ifndef RB0 ;ensure that the proper bank indicator is defined #define RB0 #endif #ifdef RB1 #undefine RB1 #endif #ifdef RB2 #undefine RB2 #endif #ifdef RB3 #undefine RB3 #endif bcf STATUS,RP0 bcf STATUS,RP1 endm setRB1 macro ;set register bank 1 #ifdef RB0 #undefine RB0 #endif #ifndef RB1 #define RB1 #endif #ifdef RB2 #undefine RB2 #endif #ifdef RB3 #undefine RB3 #endif bsf STATUS,RP0 bcf STATUS,RP1 endm setRB2 macro ;set register bank 2 #ifdef RB0 #undefine RB0 #endif #ifdef RB1 #undefine RB1 #endif #ifndef RB2 #define RB2 #endif #ifdef RB3 #undefine RB3 #endif bcf STATUS,RP0 bsf STATUS,RP1 endm setRB3 macro ;set register bank 3 #ifdef RB0 #undefine RB0 #endif #ifdef RB1 #undefine RB1 #endif #ifdef RB2 #undefine RB2 #endif #ifndef RB3 #define RB3 #endif bsf STATUS,RP0 bsf STATUS,RP1 endm ;--------------------------------------------------------------------------------- op2 macro opcode,opr1,opr2,rb ;macro for use with double operand opcodes #if rb == 0 ;specify the opcode, first operand, second #ifndef RB0 ;operand and target register bank ERROR "Register bank error" #endif #endif #if rb == 1 #ifndef RB1 ERROR "Register bank error" #endif #endif #if rb == 2 #ifndef RB2 ERROR "Register bank error" #endif #endif #if rb == 3 #ifndef RB3 ERROR "Register bank error" #endif #endif opcode (opr1^(rb*0x80)),opr2 ;xors the two MSBs with the register bank value ;so that if the wrong bank has been selected, the endm ;assembler will generate an error. ;--------------------------------------------------------------------------------- op1 macro opcode,opr1,rb ;macro for use with single operand opcodes #if rb == 0 ;specify the opcode, first operand, and #ifndef RB0 ;target register bank ERROR "Register bank error" #endif #endif #if rb == 1 #ifndef RB1 ERROR "Register bank error" #endif #endif #if rb == 2 #ifndef RB2 ERROR "Register bank error" #endif #endif #if rb == 3 #ifndef RB3 ERROR "Register bank error" #endif #endif opcode (opr1^(rb*0x80)) ;xors the two MSBs with the register bank value ;so that if the wrong bank has been selected, the endm ;assembler will generate an error. '