>Has anyone written a simple macro to call subroutines across page >boundaries? I've listed two below: one that preserves W to and from the called routine and one that doesn't. Both use an assembler variable _CallCounter that must be already declared, it's used to reset PCLATH with the best value so future local calls & gotos don't go into orbit. The W-preserving macros use a _TEMP_W RAM location that also must be declared. If _TEMP_W is not mirrored in all RAM banks (the upper bytes of a 16C67 are mirrored), it's up to you to babysit the initial & returning bank number. -Ed V Agile Controls agile@idmail.com ; Do a long call across address boundries _call macro Routine_Label _CallCounter += 1 movlw high Routine_Label ;set upper address byte movwf PCLATH call Routine_Label movlw high Call_Return_Point#v(_CallCounter) ;reset PCLATH movwf PCLATH Call_Return_Point#v(_CallCounter): endm ; Do a long call AND preserve W register _wcall macro Routine_Label _CallCounter += 1 movwf _TEMP_W ;preserve W movlw high Routine_Label ;set upper address byte movwf PCLATH movf _TEMP_W, W ;restore W call Routine_Label movwf _TEMP_W ;preserve W movlw high Call_Return_Point#v(_Call_Counter) ;reset PCLATH movwf PCLATH Call_Return_Point#v(_CallCounter): movf _TEMP_W, W ;restore W endm ; Do a long goto across address boundries _goto macro GotoLabel movlw high GotoLabel ;capture and set upper address byte movwf PCLATH goto GotoLabel endm ; Do a long goto AND preserve W register _wgoto macro GotoLabel movwf _TEMP_W ;preserve W in case it's being used movlw high GotoLabel ;capture and set upper address byte movwf PCLATH movf _TEMP_W, W ;restore W to original state goto GotoLabel endm