The latest MPASM/MPLAB User's Guides contain a table showing this and all other pseudo-ops understood by MPASM; here's the list: PIC16CXX SPECIAL INSTRUCTION MNEMONICS Name Mnemonic Equivalent Status Operation(s) Clear Carry CLRC BCF 3,0 - Clear Digit Carry CLRDC BCF 3,1 - Set Digit Carry SETDC BSF 3,1 - Clear Zero CLRZ BCF 3,2 - Set Zero SETZ BSF 3,2 - Skip on Carry SKPC BTFSS 3,0 - Skip on No Carry SKPNC BTFSC 3,0 - Skip on Digit Carry SKPDC BTFSS 3,1 - Skip on No Digit Carry SKPNDC BTFSC 3,1 - Skip on Zero SKPZ BTFSS 3,2 - Skip on Non Zero SKPNZ BTFSC 3,2 - Test File TSTF f MOVF f,1 Z Move File to W MOVFW f MOVF f,0 Z Negate File NEGF f,d COMF f,1 INCF f,d Z Add Carry to File ADDCF f,d BTFSC 3,0 INCF f,d Z Subtract Carry from File SUBCF f,d BTFSC 3,0 DECF f,d Z Add Digit Carry to File ADDDCF f,d BTFSC 3,1 INCF f,d Z Subtract Digit SUBDCF f,d BTFSC 3,1 Carry from File DECF f,d Z Branch B k GOTO k - Branch on Carry BC k BTFSC 3,0 GOTO k - Branch on No Carry BNC k BTFSS 3,0 GOTO k - Branch on Digit Carry BDC k BTFSC 3,1 GOTO k - Branch on No Digit Carry BNDC k BTFSS 3,1 GOTO k - Branch on Zero BZ k BTFSC 3,2 GOTO k - Branch on Non Zero BNZ k BTFSS 3,2 GOTO k - Call across page boundary LCALL k BCF 3,5 or BSF 3,5 BCF 3,6 or BSF 3,6 CALL k By the way, don't bother using the "LCALL" pseudo-op... Since it doesn't restore the code-page bits after the CALL, it's sorta useless. Also, be careful with the pseudo-ops that assemble to two instructions; constructs like the following, for instance, will cause you great pain and suffering: ; DON'T DO THIS! BTFSS FLAGS,SWITCH ;If the switch is pressed, skip ahead. NEGF REG ;Otherwise, negate the REG register.
Questions:
Comments:
Andrew Russell Morris Says:
Thanks a lot! A consultant my former employer hired used BZ and BNZ extensively. I have also been using them as well, but I didn't know where they came from and I wanted to know if there were any more of them. Also, I needed to be sure that they would reliably work. This posting helped me. Thanks a lot!the_audio_technician-gmail- replies:
By the way, don't bother using the "LCALL" pseudo-op... Since it doesn't restore the code-page bits after the CALL, it's sorta useless.Not true. The reason LCALL doesn't restore page bits is that it doesn't need to! Even though PICs' program counters are only 8-bit, you'll find that the stack (on a PIC with 2K words program memory) is 11 bits wide, so that, once you've set your PCLATH bits properly to CALL the routine (on another memory page), the PC will load all the necessary bits from the stack to return to one location past the CALL, even if it's on another page. In other words, RTFM - or in this case - RTDS (Read the F'in Data Sheet :) the_audio_technician-gmail- replies: BTW, if it weren't done this way, you'd only be able to call a given subroutine from one page — as the "RETURN" page bits would have to be set in the subroutine, so it would always return to the same page (no matter where you called it from). If that were the case, then you're right — it would be pretty useless. Luckily it's not.
the_audio_technician-gmail- replies: BTW, if it weren't done this way, you'd only be able to call a given subroutine from one page — as the "RETURN" page bits would have to be set in the subroutine, so it would always return to the same page (no matter where you called it from). If that were the case, then you're right — it would be pretty useless. Luckily it's not.