Piclisters, Pardon me but just when I thought I had a handle on page jumping in the 16C57, it springs a new surprise. OK, here's a programme to test CBLOCK instruction. There's a whole lot of dummy registers defined and the programme just goes thru and clears each of them. It jumps to the reset address on PAGE #3 'cause I'd like to fit some routines outside of PAGE #0 for once. (I've got a real programme to write that calls for a lot of registers.) The programme compiles OK but MPLAB says there's a problem with some registers and their page assignments :- --------------------------------- Compiling CALLER2.ASM: Command line: "C:\PROGRA~1\MPLAB\MPASMWIN.EXE /dDEBUG /e+ /l+ /x- /w0 /c+ /m+ /rhex /p16C57 /q A:\CALLER2.ASM" Warning[216] A:\CALLER2.ASM 21 : Radix superceded by command line. Message[308] A:\CALLER2.ASM 22 : Warning level superceded by command line value. (0) Message[306] A:\CALLER2.ASM 109 : Crossing page boundary -- ensure page bits are set. Message[302] A:\CALLER2.ASM 141 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 142 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 143 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 144 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 145 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 146 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 147 : Register in operand not in bank 0. Message[302] A:\CALLER2.ASM 148 : Register in operand not in bank 0. Message[306] A:\CALLER2.ASM 187 : Crossing page boundary -- ensure page bits are set. Build completed successfully. --------------------------------- When we step the programme thru, it finds its way to PAGE #3 then back to PAGE #0 and into the CLEAR routine, just like it should. BUT, when we step thru CLEAR, clearing registers as we go, it gets up to reg1A, then PCL resets and we finish up back near the start someplace. OK, I thought the 57's general purpose registers go from 0x08 up to 0x07F and so we should be able to handle the registers assigned to it. What's going on? Advice much appreciated! Thnax in advance - PJH ;***************************************************************** ;Here be ye programme ========> title caller2 ;DATE : June 25, 1999 ;PURPOSE : to figure out how CBLOCKS work!!!! list p=16C57, F=inhx8m, R=hex errorlevel 0,-305 include "A:\p16c5x.inc" __CONFIG _CP_OFF &_WDT_OFF &_XT_OSC ;********************************************************************** ;MACRO SECTION ... 'page select' MACROS ; PA0 = 0X05 ; PA1 = 0X06 ; PA1 PA0 ; 0 0 Page #0 (0000-01FF) ; 0 1 Page #1 (0200-03FF) ; 1 0 Page #2 (0400-04FF) ; 1 1 Page #3 (0600-07FF) ;********************************************************************** Page_0 MACRO bcf STATUS,5 bcf STATUS,6 ENDM Page_1 MACRO bsf STATUS,5 bcf STATUS,6 ENDM Page_2 MACRO bcf STATUS,5 bsf STATUS,6 ENDM Page_3 MACRO bsf STATUS,5 bsf STATUS,6 ENDM ;********************************************************************** ;VECTOR ASSIGNMENTS ;********************************************************************** _16C57_4 equ 0x07FB ;Don't go over END-OF_PAGE with RESET instructions. ;********************************************************************** ;REGISTER ASSIGNMENTS ;********************************************************************** CBLOCK 0x08 reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 regA regB regC regD regE regF reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1A reg1B reg1C reg1D reg1E reg1F ENDC ;******************************************************************************* ******* ;PAGE #0 ;START the MAIN PROGRAMME at 0x00 and jump to reset address. Subroutines are placed in ;lower half of Page #0, ie 00-0FF. Main programme starts at 0100. LCD message routines ;go in PAGE #1. Eventually. ;******************************************************************************* ******* org 0x00 go_rst nop Page_3 goto reset start clrf FSR goto main ;************************************************************ ;CLEAR ... initialises registers to start up values ;************************************************************ clear clrf reg0 clrf reg1 clrf reg2 clrf reg3 clrf reg4 clrf reg5 clrf reg6 clrf reg7 clrf reg8 clrf reg9 clrf regA clrf regB clrf regC clrf regD clrf regE clrf regF clrf reg10 clrf reg11 clrf reg12 clrf reg13 clrf reg14 clrf reg15 clrf reg16 clrf reg17 clrf reg18 clrf reg19 clrf reg1A clrf reg1B clrf reg1C clrf reg1D clrf reg1E clrf reg1F retlw 0x00 ;************************************************************** ;Beginning of main programme from the the upper half of PAGE #0 ;************************************************************** org 0x0100 main call clear look nop goto look ;**************************************************************************** ;PAGE #1 ;**************************************************************************** org 0x0200 ;**************************************************************************** ;PAGE #2 ;**************************************************************************** org 0x0400 ;**************************************************************************** ;PAGE #3 ;THE HOME OF THE RESET VECTOR ;**************************************************************************** org 0x0600 org 0x0700 ;Upper half of the page org _16C57_4 ;RESET vector at the end of Page #1 reset nop Page_0 goto start end --