PIC16: verifying PAGE local CALLs

Nov 02, 2019 0 Replies

I have this need to remove some redundant PAGESELs(for reasons) I want to check if the calls are in range, however. There is a macro for that on PICList. But it doesn't seem to work in gputils. maybe also broken on others.. unsure. This is what I've tried:


;+++++ ; PCALL page call, code for calling on same page ; outputs messages if LONG/SHORT call could/must be used n0_call MACRO LABEL LOCAL DEST_HIGH, SOURCE_HIGH, DIFF_HIGH DEST_HIGH SET (HIGH(LABEL)&0x78) ; save bit's 4:5 of dest address SOURCE_HIGH SET (HIGH($)&0x78) ; --- || --- source address DIFF_HIGH SET DEST_HIGH ^ SOURCE_HIGH ; get difference ( XOR )



IF (DIFF_HIGH == 0) ; same page, call ok CALL LABEL ELSE ERROR " Error ! Replace PCALL with LONG_CALL " ENDIF ENDM



But I can not get it to print that error message. I believe it is because of the labels being unresolved(it's relocatable mode). The assembler might just put zeros in there. Am I right, or is there a way to work around this.



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required