LIST p=16F628 ;tell assembler what chip we are using
include "P16F628.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the configuration settings (oscillator type etc.)
org 0x0000
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)
bsf STATUS,RP0
movlw b'00000000'
movwf TRISA
movlw b'11111111'
movwf TRISB
bcf STATUS,RP0
movlw 0x80
movwf 0x20
movwf PORTA
loop btfsc PORTB,1
call fwd
hold1 btfsc PORTB,1
goto hold1
btfsc PORTB,2
call bck
hold2 btfsc PORTB,2
goto hold2
goto loop
fwd btfsc 0x20,7
goto end1
bcf STATUS,C
rlf 0x20,1
movf 0x20,0
movwf PORTA
end1 return
bck btfsc 0x20,0
goto end2
bcf STATUS,C
rrf 0x20,1
movf 0x20,0
movwf PORTA
end2 return
end