hello I managed to do some coding but I got errors, here is the code: the explanation is below :

TRISB = %11111111
TRISC= %00000000
TRISD = %11110000

state var word

PORTC = %11111011
PORTD = %11111111
main:


'if switch bottom is pressed
if PORTB.0 then
'put a flag that it is pressed with the state variable
state = 1
endif
' the middle button is pressed and our state is 1
IF PORTB.2 and state == 1 THEN
' do readfirst subroutine
GOsub readFirst
else


IF PORTB.3 and state == 2 then
state=3
endif
if portb.1 and state == 3 then
gosub readSecond
endif
endif
goto main



readFirst:
'check if middle led is turned off

IF PORTC.2 == 0 then
'if it is turned off then make the bottom led and the
one above it turned off
low PORTD.0
low PORTC.3
high PORTC.2
'problem here, should I set the others led again to
high, because
'they were high in the setup
HIGH PORTC.0
HIGH PORTC.1
'change our state to 2 in case not to worry about this
statement again
state=2
endif
return

readSecond:
if portc.1 == 0 then
low portc.3
low portc.2
high portc.1
state=3
endif
return