So me and my friends want to learn how to start using the PicBasic codes for creating a program. What are the functions of each code in the said program:

Device 16F877A Declare Xtal = 4
ADCON1 = 7
PortB_Pullups = On
All_Digital = TRUE
TRISA=%000000
TRISB=%00001111
TRISC=%00000000
TRISD=%00000000
TRISE=%000

Dim Time As Byte
Dim PUJ As Byte
Dim BUS As Byte
Dim TAXI As Byte

Dim display As Byte
Dim display2 As Byte
Dim display3 As Byte

Clear PUJ
Clear BUS
Clear TAXI
Clear Time

Clear PORTA
Clear PORTB
Clear PORTC
Clear PORTD
Clear PORTE
DelayMS 500



Rst:

PUJ= Dig PUJ,0
TAXI = Dig TAXI,0
BUS = Dig BUS,0
display = PUJ
display2 =BUS
display3 =TAXI

PORTC = display
PORTD = display2
PORTA = display3


Counting:

For Time = 1 To 400

If PORTB.0 = 0 Then
DelayMS 50
While PORTB.0 = 0:Wend
Time = 1
PUJ = PUJ + 1

If PUJ > 9 Then
PUJ = 0
EndIf

PUJ = Dig PUJ,0
display = PUJ

PORTC = display
EndIf
;--------------------------------------...
If PORTB.1 = 0 Then
DelayMS 50
While PORTB.1 = 0:Wend
Time = 1
BUS = BUS + 1

If BUS > 9 Then
BUS = 0
EndIf

BUS = Dig BUS,0
display2 = BUS

PORTD = display2
PORTA = display3
EndIf
;--------------------------------------...
If PORTB.2 = 0 Then
DelayMS 50
While PORTB.2 = 0:Wend
Time = 1
TAXI = TAXI + 1

If TAXI > 9 Then
TAXI = 0
EndIf

TAXI = Dig TAXI,0
display3 = TAXI

PORTA = display3
EndIf

DelayMS 150
Next Time

Clear PUJ
Clear BUS
Clear TAXI
Clear Time

PUJ= Dig PUJ,0
TAXI = Dig TAXI,0
BUS = Dig BUS,0
display = PUJ
display2 =BUS
display3 =TAXI

PORTC = display
PORTD = display2
PORTA = display3

GoTo Counting

We all know that: Device 16F877A is the microcontroller we used then
Declare Xtal = 4 is the value of the oscillator in Megahertz. So far we only know the first two lines...