PutCmd ; entry point for "cmd" data
clrc ; RS = 0 (command) |B0
skpnc ; |B0
PutDat ; entry point for "dat" data
setc ; RS = 1 (data) |B0
movwf Temp ; save WREG data byte |B0
swapf Temp,W ; swap nybbles in W |B0
call PutNyb ; send left nybble |B0
movf Temp,W ; |B0
call PutNyb ; send right nybble |B0
PutNyb
andlw 0x0F ; mask off left nybble |B0
skpnc ; RS = 0? yes, skip, else |B0
iorlw b'10000000' ; set RS bit to '1' |B0
btfss PIR1,TXIF ; UART transmit buffer empty? |B0
goto $-1 ; no, branch and wait, else |B0
movwf TXREG ; send it |B0
return ; |B0