
Table1	equ $f1d200
Table2	equ $f1d400

	run $f1b000

	movei init,r29
	jump (r29)
	nop
org $f1b020
	movei timer1,r29
	jump (r29)
	nop

****************
init	movei $f1a100,r30
	movei %100011111000000111,r0
	moveta r30,r30
	store r0,(r30)
	
	movei $f1a154,r0
	movei $15,r1            ; Word-Strobe-Enable
	movei $fffffe00,r2	; Modulo-Maske
	movei $f1a118,r3	; Modulo-Mask-Reg
	store r1,(r0)
	store r2,(r3)
      	movei Table1,r14
	movei Table2,r15

	movei $f1b00c,r31	; SP
	moveta r31,r31
	
	movei $f10000,r1
	movei 266,r2
	movei $f10002,r3
	movei 1000,r4
	movei $f10020,r5
	load (r30),r6	; Flags holen
	loadw (r5),r7
	storew r2,(r1)
	storew r4,(r3)	; 26,6 Mhz/266/1000=>100Hz
	bset 2,r7
	bset 6,r6
	bset 10,r7
	storew r7,(r5)
	bset 11,r6

	moveq 0,r10
	load (r14),r0
	load (r15),r1
	movei $f1a148,r20
	movei $f1a14c,r21
	movei $f00058,r22
	storew r10,(r22)
	
	store r6,(r29)
loop
	addqmod 4,r10
	movei 1000,r2
	nop
wait	subq 1,r2
	jr nn,wait
	nop
	sharq #2,r0
	sharq #2,r1	; etwas leiser
	store r0,(r20)
	store r1,(r21)
	load (r15+r10),r1
	jr loop
	load (r14+r10),r0
	

timer1	movei $f1a100,r29
	load (r29),r28
storew r10,(r22)
	addqmod 4,r10
;	store r0,(r20)
;	store r1,(r21)

	storew r27,(r22)
	not r27
moveta r10,r10	
;	load (r14+r10),r0
;	load (r15+r10),r1
	
	load (r31),r30
	addq 2,r30
	addq 4,r31

	bclr 3,r28
	bclr 14,r28
	bset 11,r28
	jump (r30)
	store r28,(r29)

