Andrew Hall wrote: > I ran the following (simplified) code expecting it to fail: > > goto too_far ; Shouldn't work ? > > org 0x100 > too_far ; PCL will contain 0 > > nop > > When I ran the simulation I was surprised to see the "goto" jump to > the memory address 0x100 even though PCLATH contained zero :( I had > expected it to end up at address 0x0 ! In the register display PCL > contained 0 !! > > What am I doing wrong ? Have I misunderstood something about the > 84's architecture or simulator ? Andy: You've misunderstood how the GOTO command encodes the destination address. If you check the "PCLATH" section of the data book again, you'll see that the GOTO command can directly jump to ANY location in the 16C84's program space... Manipulation of the PCLATH register for GOTOs isn't necessary unless you're using parts with more than 2K of program memory. On the 16C84, you only need to use PCLATH when you're DIRECTLY modifying the PCL register (by executing a "MOVWF PCL" or "ADDWF PCL" or whatever). -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499