
	opt ?+ o+ h+ c-

RTCLOK = $12
SAVMSC = $58

AUDF1 = $d200
AUDC1 = $d201
AUDF2 = $d202
AUDC2 = $d203
AUDF3 = $d204
AUDC3 = $d205
AUDF4 = $d206
AUDC4 = $d207
AUDCTL = $d208
SKCTL = $d20f


progr = $3000


	org progr

	lda #0
	sta SKCTL
	sta AUDF1
	sta AUDC1
	sta AUDF2
	sta AUDC2
	sta AUDF3
	sta AUDC3
	sta AUDF4
	sta AUDC4
	sta AUDCTL
	jsr wait

	lda #%10001011
	sta SKCTL
	lda #%00000000
	sta AUDCTL
	lda #$a8
	sta AUDC1

	ldx #$ff
	stx AUDF2
	lda #$a8
	sta AUDC2

	ldx #$7f	;1/2

?loop1	jsr wait
	stx AUDF1
	jsr prn
	dex
	cpx #$55	;1/3
	bne ?loop1

?loop2	jsr wait
	stx AUDF1
	jsr prn
	inx
	bpl ?loop2

	dex
	bpl ?loop1

wait	lda RTCLOK+2
?loop	cmp RTCLOK+2
	beq ?loop
	rts

prn	ldy #0
	txa
	lsr
	lsr
	lsr
	lsr
	jsr ?hex
	txa
	and #$0f

?hex	cmp #10
	scc
	adc #"A"-"9"-1-1
	adc #"0"
	sta (SAVMSC),y
	iny
	rts


	run progr


	end

