Path: ns-mx!hobbes.physics.uiowa.edu!news.iastate.edu!vaxe.iastate.edu!TWBV4
From: twbv4@isuvax.iastate.edu (Ian Schmidt)
Newsgroups: comp.sys.apple2
Subject: Re: Sound Digitization
Message-ID: <1991Dec17.153321.2611@news.iastate.edu>
Date: 17 Dec 91 15:33:21 GMT
References: <1991Dec16.162532.14913@crash.cts.com>,<1991Dec17.101532.8062@nntp.uoregon.edu>
Sender: news@news.iastate.edu (USENET News System)
Reply-To: twbv4@isuvax.iastate.edu
Organization: Iowa State University, Ames, Iowa
Lines: 71

Okay, here goes, the official AudioZap Digitizing Method. :-)
Set BufPtr to a pointer to the buffer for digitizing and EndPtr to
the ADDRESS (not byte count) of the end of the buffer.
As always, its in ORCA/M ASM65816 1.2 format. 

; DP Equates

BufPtr	equ 0
EndPtr	equ 4

; other equates

IRQ_Volume	equ $e100ca
SCtl		equ $c03c
SData		equ $c03d
SAdrL		equ $c03e
SAdrH		equ $c03f
Kbd		equ $c000
Strobe		equ $c010

DigitizeIt	START
		sep #$20
		longa off
                lda #0
	 	pha
	 	plb	

		lda >IRQ_Volume
		and #$0f
		ora #$20
		sta SCtl
                lda #$e2
		sta SAdrL
LoopIt		lda Delay    ; digitizing rate; see why Hertz in AZ ain't
		dec a        ; gonna happen?
		bne LoopIt
                sta SData	; write to trigger the Ensoniq
		lda SData	; garbage, works as delay
		lda SData       ; get sample
		bne NonZ	; zero samples are invalid on IIgs
		lda #1
NonZ		sta [BufPtr],y
		inc BufPtr
		bne CkEnd
		inc BufPtr+1
		bne CkEnd
		inc BufPtr+2
CkEnd		lda Kbd
		bmi EndIt
		lda BufPtr
		cmp EndPtr
		bne LoopIt
		lda BufPtr+1
		cmp EndPtr+1
		bne LoopIt
		lda BufPtr+2
		cmp EndPtr+2
		bne LoopIt
EndIt		sta Strobe
		phk
		plb
		rep #$20	
		longa on
		rts
		END		


-------------------------------------------------------------------------------
Ian Schmidt                 twbv4@isuvax.iastate.edu         irsman@iastate.edu
    ->  USUAL SIG IS ON VACATION TO PROTEST ISU CENSORSHIP OF USENET  <-
-------------------------------------------------------------------------------
Path: ns-mx!uunet!think.com!rpi!usenet.coe.montana.edu!milton!nntp.uoregon.edu!cie.uoregon.edu!nparker
From: nparker@cie.uoregon.edu (Neil Parker)
Newsgroups: comp.sys.apple2
Subject: Re: Sound Digitization
Message-ID: <1991Dec18.022207.7036@nntp.uoregon.edu>
Date: 18 Dec 91 02:22:07 GMT
References: <1991Dec16.162532.14913@crash.cts.com> <1991Dec17.101532.8062@nntp.uoregon.edu>
Sender: news@nntp.uoregon.edu
Organization: The Universal Society for the Prevention of Reality
Lines: 22

In article <1991Dec17.101532.8062@nntp.uoregon.edu> nparker@cie.uoregon.edu (Neil Parker) writes:
>[...code containing nasty typo...]

Sorry about that, folks.  I posted some code that started like this:
>irqVolume  equ 6
>soundCtl   equ $E0C03C
>soundData  equ $E0C03D
>soundAdrL  equ $E0C03E
>soundAdrH  equ $E0C03F
>
>           pha
>           pha
>	   pea irqVolume
>	   _GetVector      ;Get ptr to system volume

That should be _GetAddr, not _GetVector.  It makes a BIG difference...

          - Neil Parker
--
Neil Parker                 No cute ASCII art...no cute quote...no cute
nparker@cie.uoregon.edu     disclaimer...no deposit, no return...
parker@corona.uoregon.edu   (This space intentionally left blank:           )
