On Thu, 15 Jan 1998 19:39:02 +0000 Philip Martin writes: >Hi all, >A register (atemp) contains the number 87, what I want to end up with >is >a register (btemp) containing 8 >a register (ctemp) containing 7 This is straightforward, do something like: swapf atemp,w ;Move high 4 bits of atemp to low 4 of W andlw b'00001111' ;Keep only low bits movwf btemp movfw atemp ;Get copy of atemp andlw b'00001111' ;Keep only low bits movwf ctemp ;Result to ctemp This is the simple beginner's example to do what you described. Various 'trick' methods are also possible, but not really needed in this simple case. > >OK, so there the 7 is easy, but what if the starting number was >something like 32, 64 or another number where all the bits are in the >msb. You are talking about splitting HEX 87 into 8 and 7? If not, then the process (for example to convert 64 (HEX 40) into 6 and 4) is known as binary to decimal conversion. For a single byte, repeatedly subtracting 10 until the remainder (one's digit) is less than 10 is practicable. For larger numbers, more complex (but often-described) methods are necessary.