First off I would like to thank bruce for this code from his site.

'************************************************* ***********
'* Name : serkey16.bas *
'* Author : Reynolds Electronics *
'* Date : 07/12/2001 *
'* Version : 1.0 *
'* Notes : PicBasic Pro program for 16-key serial keypad *
'************************************************* ***********
INCLUDE "modedefs.bas"

col VAR BYTE ' Keypad column
row VAR BYTE ' Keypad row
key VAR BYTE ' Key value
baud VAR PortA.0 ' Baud select pin
serpin VAR PortA.1 ' Serial output pin
CMCON = 7 ' PortA = digital I/O
VRCON = 0 ' Voltage reference disabled
TRISA = %00000001' PortA.0 = baud select pin
OPTION_REG.7 = 0 ' Enable PORTB pull-ups

loop:
GOSUB getkey 'Get key from keypad
send:
IF baud = 1 THEN fast'If baud = 1 then N9600,else N2400
SEROUT serpin,N2400,[key]'Send key value out PortA.1
GOTO loop
fast:
SEROUT serpin,N9600,[key]
GOTO loop 'Do it forever
getkey:
PAUSE 50 'Debounce key-input
getkeyu:' Wait for all keys up
PORTB = 0 ' All output-pins low
TRISB = $f0 ' Bottom 4-pins out, top 4-pins in
IF ((PORTB >> 4) != $f) THEN getkeyu'If keys down, loop
PAUSE 50 ' Debounce key-input

getkeyp:' Wait for keypress
FOR row = 0 TO 3 ' 4 rows in keypad
PORTB = 0 ' All output-pins low
TRISB = (DCD row) ^ $ff ' Set one row pin to output
col = PORTB >> 4 ' Read columns
IF col != $f THEN gotkey' If any keydown, exit
NEXT row
GOTO getkeyp ' No keys down, go look again

gotkey: ' Change row and column to key number 1 - 16
key = (row * 4) + (NCD (col ^ $f))
'NOTE: for 12-key keypad, change to key = (row * 3)
RETURN ' Subroutine over

END

I would like to use this in only a 12 key configuration. This leaves me with 7 data pins required.
In this code Bruce makes use of all 8 PortB pins. Unfortunately these arent available to me because they are currently being used for HPWM and a parallel LCD.

My question is, with these ports available (no 8 in sequence) how can I modify this code to work.
RA0, RA1, RA2, RA3, RA4, RA5, RB7, RC0, RC4, RC5, RC6, RC7

I am using a 16F767.

Thanks in advance,
-brian