Improved clock_time on the (timerless) Apple2 in several ways:
- The Contiki timer code does not check for clock_time overflows. Therefore it is desirable to have as little overflows as possible to reduce the unwanted side effects. On the other hand one certainly doesn't want clock_time_t to be 32 bit as this would pull in lots of stuff from the cc65 runtime library. But looking at the usage of the Contiki timers it turns out that the maximum resolution needed is a half second. So CLOCK_CONF_SECOND is now set to 2 which reduces clock_time overflows to once after running Contiki for more that 9 hours ;-) An internal 16 bit counter is used to determine when half a second has passed.
- Adjusted the internal counter to have clock_time work quite accurately at least with Contiki sitting at the empty desktop and an Ethernet driver loaded.
- Added detection of an Apple IIgs running at 2.8 MHz instead of the ordinary 1.0 MHz.
diff --git a/contiki-apple2/lib/clock-arch.S b/contiki-apple2/lib/clock-arch.S
new file mode 100644
index 0000000..5d9c39d
--- /dev/null
+++ b/contiki-apple2/lib/clock-arch.S
@@ -0,0 +1,34 @@
+;
+; Clock tick code for Contiki (Apple2 version)
+;
+
+        .constructor    inittick
+	.export		_tick
+
+	.segment	"INIT"
+
+inittick:
+	; Switch in ROM
+	bit	$C082
+
+	; Check for IIgs
+	sec
+	jsr     $FE1F
+	bcs     done
+
+	; Check for fast speed
+	bit	$C036
+	bpl	done
+
+	; Adjust tick (5/14 = 1.0MHz/2.8MHz)
+	lda	#5
+	sta	_tick
+
+	; Switch in LC bank 2 for R/O
+done:	bit	$C080
+
+	rts
+
+        .data
+
+_tick:	.byte	14