        title " Hogeschool van Utrecht Opdracht week "
	subtitle " titel van het programma "
        

; XT Oscillator is used target 4 MHz 
; do not use power up nor watchdog nor code protection !!       

;destinations for file register-byte

indirect        equ     00h                     ;Indirect data adressing
tmr0            equ     01h                     ;counter register
pcl             equ     02h                     ;Program Counter
status          equ     03h                     ;status word register
fsr             equ     04h                     ;File select register
port_a          equ     05h
port_b          equ     06h
tris_a          equ     05h                     ; new value for port a reg
tris_b          equ     06h                     ; new value for port b reg
eedata		equ	08h			; eeprom registers
eeadr		equ	09h
pclatch		equ	0ah			; 
intcon		equ	0bh			; interrupt settings

;bit declarations

w               equ     00h                     ;destination is W-register
f               equ     01h                     ;destination is a File register

input           equ     01h
output          equ     00h


rp0             equ     05h                     ;bank change bit
zero_bit        equ     02h                     ;zero bit in status byte
carry_bit       equ     00h                     ;carry bit in status byte
dc_bit		equ	01h			;digit carry
tf0             equ     02h                     ;timer overflow in intcon
gie             equ     07h


; byte declarations

l1      	equ     0ch
l2      	equ     0dh
l3      	equ     0eh


; reset vector equ 000h jump to out off call

                org     000h
                goto    start

; initialiseren van de poorten

start
	
		clrf	port_a			; clear init byte port_a
                clrf    port_b                  ; clear init byte port_b
                bsf     status,rp0              ; select bank 1
                movlw   B'00011111'             ; 1 = input , 0 = output 
                movwf	tris_a			; set port a in bank 1
                movlw   B'00000000'             ; 1 = input , 0 = output 
                movwf	tris_b			; set port b in bank 1
 		bcf     status,rp0		; select bank 0 
   

; start of the programm

; l1 = locatie 0c
; l2 = locatie 0d
; l3 = locatie 0e

main						; your coding comes here
		BSF 	port_b, 3
                call    wacht
		BCF 	port_b, 3
                call    wacht
                goto    main
		NOP		

		goto 	main
	
wacht
                movlw   080h		;zet 080h in locatie 0ch
                movwf   l1	
loop3
                movlw   0ffh
                movwf   l2		;zet 0ffh in locatie 0dh
loop2
                movlw   0ffh
                movwf   l3		;zet 0ffh in locatie 0eh
loop1
                decfsz  l3, f		;telt tot getal in locatie 0eh 0 is.
                goto    loop1
                decfsz  l2,f		;trekt 1 van locatie 0d af en  
                goto    loop2		;springt vervolgens naar loop2
                decfsz  l1, f		;trekt 1 van locatie 0c af en springt vervolgens naar loop3
                retlw   0h		;gaat terug naar aangevraagde
		
		goto main
end



