	li W0 1000
	output 8 W0	; set period to 1000

	; **** WATCH ****
	; **** in the reverse order (from 23:59:59 to 00:00:00) ****
	
; registers
	; 0 : seconds (units)
	; 1 : seconds (tens)
	; 2 : minutes (units)
	; 3 : minutes (tens)
	; 4 : hours   (units)
	; 5 : hours   (tens)

	; constants : for more speed

	; 8 : 1
	; 9 : 10
	; 10 : 6
	; 11 : 24

; RAM
	; 0-9 : contains 7 segments conversion for 0-9

; outputs
	; 0-5 : idem registers but transformed in 7-segments output

	xor W0 W0 W0	; clear W0
	xor W1 W1 W1	; clear W1
	xor W2 W2 W2	; clear W2
	xor W3 W3 W3
	xor W4 W4 W4
	xor W5 W5 W5

	li W8 1
	li W9 10
	li W10 6
	li W11 2
	li W12 4

	li W14 0
	li W15 63
	sh W14 W15
	li W14 1
	li W15 6
	sh W14 W15
	li W14 2
	li W15 91
	sh W14 W15
	li W14 3
	li W15 79
	sh W14 W15
	li W14 4
	li W15 102
	sh W14 W15
	li W14 5
	li W15 109
	sh W14 W15
	li W14 6
	li W15 125
	sh W14 W15
	li W14 7
	li W15 7
	sh W14 W15
	li W14 8
	li W15 127
	sh W14 W15
	li W14 9
	li W15 111
	sh W14 W15

incseconds:
	la W14 minus0
	move W15 W0
	jmpnz W14	; if W0 is not equal to 0, W0 is decremented	
	subu W0 W9 W8	; otherwise put W9-W8=5 into W0

	la W14 minus1
	move W15 W1
	jmpnz W14	; if W1 is not equal to 0, W1 is dec
	subu W1 W10 W8

	la W14 minus2
	move W15 W2
	jmpnz W14	; if W2 is not equal to 0, W2 is dec
	subu W2 W9 W8

	la W14 minus3
	move W15 W3
	jmpnz W14	; if W3 is not equel to 0, W3 is dec
	subu W3 W10 W8

	la W14 minus4
	move W15 W4
	jmpnz W14	; if W4 is not equal to 0, W4 is dec
	subu W4 W9 W8

	la W14 minus5
	move W15 W5
	jmpnz W14	; if W5 is not equal to 0, W5 is dec

	addu W5 W8 W8	; otherwise put 2 into W5
	addu W4 W5 W8	; and 3 into W4

labelsleep:
	lh W14 W5
	output 5 W14
	lh W14 W4
	output 4 W14
	lh W14 W3
	output 3 W14
	lh W14 W2
	output 2 W14
	lh W14 W1
	output 1 W14
	lh W14 W0
	output 0 W14	; it here that watch is printed
	la W14 incseconds
	sleep
	jmp W14

minus0:
	subu W0 W0 W8
	la W14 labelsleep
	jmp W14	

minus1:
	subu W1 W1 W8
	la W14 labelsleep
	jmp W14	

minus2:
	subu W2 W2 W8
	la W14 labelsleep
	jmp W14	


minus3:
	subu W3 W3 W8
	la W14 labelsleep
	jmp W14	


minus4:
	subu W4 W4 W8
	la W14 labelsleep
	jmp W14	


minus5:
	subu W5 W5 W8
	la W14 labelsleep
	jmp W14	

