; +------------------------------- ; | Individual methods to set and clear each ; | port bit, via shadow register to avoid ; | the odd read-modify-write that direct ; | port BSFs cause (in which electrical values ; | are read from the port, which might not yet ; | match the desired logical value). MPUTSA: MOVFW portAShadow MOVWF PORTA RETURN MPUTWA MOVWF portAShadow MOVWF PORTA RETURN PUTA MACRO CALL MPUTWA ENDM PUTLA MACRO _v MOVLW _v CALL MPUTWA ENDM MBSPA0: BSF portAShadow,0 GOTO MPUTSA BSPA0 MACRO CALL MBSPA0 ENDM MBCPA0: BCF portAShadow,0 GOTO MPUTSA BCPA0 MACRO CALL MBCPA0 ENDM MBSPA1: BSF portAShadow,1 GOTO MPUTSA BSPA1 MACRO CALL MBSPA1 ENDM MBCPA1: BCF portAShadow,1 GOTO MPUTSA BCPA1 MACRO CALL MBCPA1 ENDM MBSPA2: BSF portAShadow,2 GOTO MPUTSA BSPA2 MACRO CALL MBSPA2 ENDM MBCPA2: BCF portAShadow,2 GOTO MPUTSA BCPA2 MACRO CALL MBCPA2 ENDM MBSPA3: BSF portAShadow,3 GOTO MPUTSA BSPA3 MACRO CALL MBSPA3 ENDM MBCPA3: BCF portAShadow,3 GOTO MPUTSA BCPA3 MACRO CALL MBCPA3 ENDM MBSPA4: BSF portAShadow,4 GOTO MPUTSA BSPA4 MACRO CALL MBSPA4 ENDM MBCPA4: BCF portAShadow,4 GOTO MPUTSA BCPA4 MACRO CALL MBCPA4 ENDM MBSPA5: BSF portAShadow,5 GOTO MPUTSA BSPA5 MACRO CALL MBSPA5 ENDM MBCPA5: BCF portAShadow,5 GOTO MPUTSA BCPA5 MACRO CALL MBCPA5 ENDM MBSPA6: BSF portAShadow,6 GOTO MPUTSA BSPA6 MACRO CALL MBSPA6 ENDM MBCPA6: BCF portAShadow,6 GOTO MPUTSA BCPA6 MACRO CALL MBCPA6 ENDM MBSPA7: BSF portAShadow,7 GOTO MPUTSA BSPA7 MACRO CALL MBSPA7 ENDM MBCPA7: BCF portAShadow,7 GOTO MPUTSA BCPA7 MACRO CALL MBCPA7 ENDM MPUTSB: MOVFW portBShadow MOVWF PORTB RETURN MPUTWB MOVWF portBShadow MOVWF PORTB RETURN PUTB MACRO CALL MPUTWB ENDM PUTLB MACRO _v MOVLW _v CALL MPUTWB ENDM MBSPB0: BSF portBShadow,0 GOTO MPUTSB BSPB0 MACRO CALL MBSPB0 ENDM MBCPB0: BCF portBShadow,0 GOTO MPUTSB BCPB0 MACRO CALL MBCPB0 ENDM MBSPB1: BSF portBShadow,1 GOTO MPUTSB BSPB1 MACRO CALL MBSPB1 ENDM MBCPB1: BCF portBShadow,1 GOTO MPUTSB BCPB1 MACRO CALL MBCPB1 ENDM MBSPB2: BSF portBShadow,2 GOTO MPUTSB BSPB2 MACRO CALL MBSPB2 ENDM MBCPB2: BCF portBShadow,2 GOTO MPUTSB BCPB2 MACRO CALL MBCPB2 ENDM MBSPB3: BSF portBShadow,3 GOTO MPUTSB BSPB3 MACRO CALL MBSPB3 ENDM MBCPB3: BCF portBShadow,3 GOTO MPUTSB BCPB3 MACRO CALL MBCPB3 ENDM MBSPB4: BSF portBShadow,4 GOTO MPUTSB BSPB4 MACRO CALL MBSPB4 ENDM MBCPB4: BCF portBShadow,4 GOTO MPUTSB BCPB4 MACRO CALL MBCPB4 ENDM MBSPB5: BSF portBShadow,5 GOTO MPUTSB BSPB5 MACRO CALL MBSPB5 ENDM MBCPB5: BCF portBShadow,5 GOTO MPUTSB BCPB5 MACRO CALL MBCPB5 ENDM MBSPB6: BSF portBShadow,6 GOTO MPUTSB BSPB6 MACRO CALL MBSPB6 ENDM MBCPB6: BCF portBShadow,6 GOTO MPUTSB BCPB6 MACRO CALL MBCPB6 ENDM MBSPB7: BSF portBShadow,7 GOTO MPUTSB BSPB7 MACRO CALL MBSPB7 ENDM MBCPB7: BCF portBShadow,7 GOTO MPUTSB BCPB7 MACRO CALL MBCPB7 ENDM