NOTE: all numbers are in HEX below. The trick below works because we are working MODULO 100 hex. Input: W is a pointer ranging from 00h thru 9Fh Output: W points to the correct register in bank 0 or 1 ; At entry, the value of W is as follows: ; 00..4F - we want to map to page 0 addresses 20..6F ; 50..9F - we want to map to page 1 addresses A0..EF ; We start by adding B0. This will set STATUS,C to 1, ; if we have a page 1 address, and to 0 if we have a=20 ; page 0 address. After this add, we will have: ; B0..FF - which we want to map to page 0 addresses 20..6F ; 00..4F - which we want to map to page 1 addresses A0..EF ADDLW 0B0h=09 ; Now, if carry is set, we add 30. After this conditional ; add, we will have: ; B0..FF - which we want to map to page 0 addresses 20..6F ; 30..7F - which we want to map to page 1 addresses A0..EF BTFSC STATUS,C ADDLW 030h ; One more add gives us our answer. By adding 70 we get: ; 20..6F for page 0 addresses ; A0..EF for page 1 addresses ADDLW 070h -- Problem solved in 4 instructions! ~ Bob Ammerman RAm Systems --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .