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 Message-ID: <1991Dec16.171246.20359@news.iastate.edu> Date: 16 Dec 91 17:12:46 GMT References: Sender: news@news.iastate.edu (USENET News System) Reply-To: twbv4@isuvax.iastate.edu Organization: Iowa State University, Ames, Iowa Lines: 77 In article , mat@matt.ksu.ksu.edu (My name is NOT matt!) writes: > >Could anyone give an example of how to move sound into the DOC RAM and play >it? Okay, here goes, but first a disclaimer or three: 1) I'm doing thing from memory :-) 2) The following is rated ASM65816 and may not be suitable for users. 3) Todd and Chris, its not supposed to be blindingly fast ;-) SndPtr equ 0 ; should be setup to point to the sound SndCtl equ $00c03c SndData equ $00c03d SndAdrL equ $00c03e SndAdrH equ $00c03f SystemVol equ $e100ca ; system (control panel) volume setting MoveIt anop ; move sound into DOCRAM sep #$20 ; goto 8 bit accumulator longa off lda #$60 sta >SndCtl ; tell GLU we want access to DOCRAM, auto-inc mode. lda #$00 sta >SndAdrL ; zero out address in DOCRAM sta >SndAdrH ldy #$0000 LoopIt lda [SndPtr],y sta >SndData iny cpy #$1000 ; do 4096 (hex 1000) bytes bne LoopIt ; okay, sound is now in DOCRAM, play it! lda >SystemVol and #$0f ; mask off any weird stuff ora #$20 ; we want to access Ensoniq registers lda #0 sta >SndAdrL ; select freq lo for osc 0 lda #200 ; this corresponds to the 'weird' playback rate in sta >SndData ; AZ, the sound tools, etc. lda #$20 ; frequency hi byte sta >SndAdrL lda #$00 sta >SndData lda #$40 ; volume, osc 0 sta >SndAdrL lda #$ff ; max volume sta >SndData lda #$80 ; waveform table pointer (ie address in DOCRAM) sta >SndAdrL lda #$00 sta >SndData lda #$c0 sta >SndAdrL lda %00100100 ; wave size is 4k (4096 bytes) sta >SndData lda #$e1 ; oscillator enable sta >SndAdrL lda #$02 ; enable 1 oscillator sta >SndData lda #$a0 ; Osc. Control sta >SndAdrL lda #$02 ; channel 0, play once and halt, no interrupt sta >SndData rts ; end of proc. :) >Thanx. You're most certainly welcome. :) >-- Belgorath -- >Internet - mat@matt.ksu.ksu.edu BITNET - mat%matt.ksu.ksu.edu@ksuvm.bitnet >Come to +appleiigs NOW! :) ------------------------------------------------------------------------------- Ian Schmidt twbv4@isuvax.iastate.edu irsman@iastate.edu -> USUAL SIG IS ON VACATION TO PROTEST ISU CENSORSHIP OF USENET <- -------------------------------------------------------------------------------