Chk_Keys movlw 0x00 ;wait until no key pressed
;I know its bad to write to the pin, but its already low due to the lack of pullup.
movwf KEY_PORT ;set all output pins low
;After the movwf port b is b'00000111' (pullups on rb0-2)
movf KEY_PORT, W
andlw 0x0F ;mask off high byte
;masking the byte still results in b'00000111'
sublw 0x0F
;herein lies the problem, subtracting b'00000111' from b'00001111' (0x0f)
results in b'00001000' and leaves the Zero flag cleared, thus sticking me in an
infinite loop when the next instruction skips "goto keys" and instead goes
to a short delay and then back to Chk_Keys.
btfsc STATUS, Z ;test if any key pressed
goto Keys ;if none, read keys
call Delay20
goto Chk_Keys ;else try again