I have mentioned it before, and now I«ve tried it: ; Following macro I want to use instead of call instructions when I«m not sure ; if the routine I call (target) is in the same page as the calling routine. ; Writing include files I don«t want to decide either, as they should be universal. ; The macro senses if there is need to set PCLATH. ; If setting PCLATH (corrupt W) it saves and restores W in Wtemp if Wtemp<>0. ; So we have fully automatic code optimization! CALLPAGE macro target,Wtemp if high target == high $ ;No need to change PCLATH messg "CALLPAGE evaluated to simple call" else if Wtemp == 0 ;Do not save and reload W, +2 instructions movlw high target movwf PCLATH else ;Save and restore W using register adress Wtemp, +4 instr. movwf Wtemp movlw high target movwf PCLATH movf Wtemp,W endif endif call target endm ;Of course, we could also make a GOPAGE macro the same way. I think it would work really great if it was not for the compiler: I get an almost endless list of errors like " Error[116] C:\MO\PROG\PIC\P\BAL01\MONIT.ASM 147 : Address label duplicated or different in second pass (monitio) Error[116] C:\MO\PROG\PIC\P\BAL01\MONIT.ASM 150 : Address label duplicated or different in second pass (monitiorot) Error[116] C:\MO\PROG\PIC\P\BAL01\MONIT.ASM 160 : Address label duplicated or different in second pass (monitiorotutH) Error[116] C:\MO\PROG\PIC\P\BAL01\MONIT.ASM 162 : Address label duplicated or different in second pass (monitiorotutOK) " etc, etc... Well, the macro seem to work, as the adresses change. Nice, that is the goal, right. So, I just want the compiler to run more passes, and we are there! But how to make it run more passes ?? Are there other obstacles? Thank you in advance. /Morgan PS Strange... the nice song "Write in C" keep running in my mind more and more... But I do«t have time to learn C now; deadline monday... probably meaning I«m dead tuesday... DS / Morgan Olsson, MORGANS REGLERTEKNIK, SE-277 35 KIVIK, Sweden \ \ mrt@iname.com, ph: +46 (0)414 70741; fax +46 (0)414 70331 /