<?
require_once "lib/utils.php";
?>
#### lib/counter.php

<?
require_once "lib/counter.php";
counter(10);
counterMod(24);
counterMod(10);
counterMod(6);
?>

#### Main function

# h : hour
# m : minute
# s : second

# 7 : 7 segment
# B : BCD
# b : binary

<?=listV("h7",0,14)?>,<?=listV("m7",0,14)?>,<?=listV("s7",0,14)?> = main(){
	i = ~0	# it forces i0 to 1 if no settings file !
	r  = 0  # idem

	inst <?=listV("c",0,10)?>, i0 = counter10(i,r)

	inst <?=listV("sB",0,4)?>, i1 = counterMod10(i0,r)
	inst <?=listV("sB",4,7)?>, i2 = counterMod6(i1,r)

	inst <?=listV("mB",0,4)?>, i3 = counterMod10(i2,r)
	inst <?=listV("mB",4,7)?>, i4 = counterMod6(i3,r)

	inst <?=listV("hb",0,5)?>, i5 = counterMod24(i4,r)

	rom <?=listV("hB",0,6)?>  = romDec24(<?=listV("hb",0,5)?>)

	rom <?=listV("s7",0,7)?>  = rom7seg(<?=listV("sB",0,4)?>)
	rom <?=listV("s7",7,14)?> = rom7seg(0,<?=listV("sB",4,7)?>)
	rom <?=listV("m7",0,7)?>  = rom7seg(<?=listV("mB",0,4)?>)
	rom <?=listV("m7",7,14)?> = rom7seg(0,<?=listV("mB",4,7)?>)
	rom <?=listV("h7",0,7)?>  = rom7seg(<?=listV("hB",0,4)?>)
	rom <?=listV("h7",7,14)?> = rom7seg(0,0,<?=listV("hB",4,6)?>)
}
