home *** CD-ROM | disk | FTP | other *** search
-
- nol
-
- INCLUDE "exec/types.i"
- INCLUDE "exec/ports.i"
- INCLUDE "exec/io.i"
- INCLUDE "libraries/dosextens.i"
- INCLUDE "exec/memory.i"
- INCLUDE "devices/audio.i"
-
- xref _AbsExecBase
- xref _BeginIO
- xref _LVOAddPort
- xref _LVOAllocMem
- xref _LVOAllocSignal
- xref _LVOCheckIO
- xref _LVOClose
- xref _LVOCloseDevice
- xref _LVOCloseLibrary
- xref _LVODoIO
- xref _LVOFindPort
- xref _LVOFindTask
- xref _LVOFreeMem
- xref _LVOFreeSignal
- xref _LVOGetMsg
- xref _LVOOpen
- xref _LVOOpenDevice
- xref _LVOOpenLibrary
- xref _LVOOutput
- xref _LVOPutMsg
- xref _LVORead
- xref _LVORemPort
- xref _LVOReplyMsg
- xref _LVOSendIO
- xref _LVOWait
- xref _LVOWaitIO
- xref _LVOWaitPort
- xref _LVOWrite
-
- list
-
- movea.l #intname,a1
- moveq #31,d0
- movea.l 4,a6
- jsr _LVOOpenLibrary(a6)
- move.l d0,intbase
- beq abort
- movea.l #dosname,a1
- moveq #0,d0
- movea.l 4,a6
- jsr _LVOOpenLibrary(a6)
- move.l d0,dosbase
- beq abort
- movea.l #grname,a1
- moveq #0,d0
- movea.l 4,a6
- jsr _LVOOpenLibrary(a6)
- move.l d0,grbase
- beq abort
-
- movea.l dosbase,a6 ; get output handle
- jsr _LVOOutput(a6)
- move.l d0,writehandle
-
- lea msg0,a0
- move.l #msglen0,d3
- bsr CKirjoita
-
-
- bsr init_audio
- tst.l d0
- beq abort
- lea msg3,a0
- move.l #msglen3,d3
- bsr CKirjoita
- bsr do_voice
- lea msg4,a0
- move.l #msglen4,d3
- bsr CKirjoita
- bsr free_audio
- lea msg5,a0
- move.l #msglen5,d3
- bsr CKirjoita
-
- abort
- rts
-
- init_audio
-
- move.l #ioa_SIZEOF,d0
- move.l #(MEMF_CLEAR!MEMF_CHIP),d1
- move.l 4,a6
- jsr _LVOAllocMem(a6)
- move.l d0,aumsg
- beq ei_chip_muistia
-
- move.l #10000,d0
- move.l #MEMF_CHIP,d1
- move.l 4,a6
- jsr _LVOAllocMem(a6)
- move.l d0,audiodata
- beq ei_chip_muistia
- bsr Lataa
-
- move.l aumsg,a1
- lea allocbits,a0
- move.l a0,ioa_Data(a1)
- move.l #4,ioa_Length(a1)
- move.l #0,MN_REPLYPORT(a1)
- move.b #127,LN_PRI(a1)
- move.b #ADIOF_NOWAIT,IO_FLAGS(a1)
-
- lea audioname,a0
- moveq #0,d0
- moveq #0,d1
- move.l 4,a6
- jsr _LVOOpenDevice(a6)
- tst.l d0
- bne ei_audiota
-
- move.l aumsg,a0
- move.l IO_UNIT(a0),unit
- ; move.l #0,MN_REPLYPORT(a0)
- move.l IO_DEVICE(a0),audev
- move.l ioa_AllocKey(a0),allockey
- moveq #-1,d0
- init_audio_pois
- rts
-
- ei_audiota
- lea msg1,a0
- move.l #msglen1,d3
- bsr CKirjoita
- moveq #0,d0
- bra.s init_audio_pois
-
- ei_chip_muistia
- lea msg2,a0
- move.l #msglen2,d3
- bsr CKirjoita
- moveq #0,d0
- bra.s init_audio_pois
-
- voice_out
- ; annetaan a0:ssa osoite messagedataan
- moveq #13,d1
- move.l aumsg,a1
- voice_out_loop
- move.b 0(a0,d1.w),ioa_Data(a1,d1.w)
- dbra d1,voice_out_loop
-
- ; move.l audiodata,ioa_Data(a1)
- ; move.w allockey,ioa_AllocKey(a1)
- move.w #CMD_WRITE,IO_COMMAND(a1)
- ; move.l unit,IO_UNIT(a1)
- move.b #(ADIOF_NOWAIT!ADIOF_PERVOL),IO_FLAGS(a1)
-
- lea msg6,a0
- move.l #msglen6,d3
- bsr CKirjoita
- move.l 4,a6
- move.l aumsg,a1
- move.l a1,-(sp)
- jsr _BeginIO
- move.l (sp)+,a1
- lea msg7,a0
- move.l #msglen7,d3
- bsr CKirjoita
-
- rts
-
- do_voice
- lea voice1,a0
- bsr voice_out
- move.l #100,d7
- move.l #100,d0
- do_loop
- ; move.l aumsg,a1
- ; move.l 4,a6
- ; jsr _LVOCheckIO(a6)
- move.l aumsg,a1
- move.w allockey,ioa_AllocKey(a1)
- move.w #CMD_READ,IO_COMMAND(a1)
- move.b #IOF_QUICK,IO_FLAGS(a1)
- move.l unit,IO_UNIT(a1)
- move.l 4,a6
- jsr _LVODoIO(a6)
- move.l d0,d2
- bsr modify
- move.l a5,addr
- move.l #10,lenght
- bsr type
- dbra d7,do_loop
- do_voice_loop
- move.l aumsg,a1
- move.l 4,a6
- jsr _LVOCheckIO(a6)
- tst.l d0
- ;bne do_voice_loop
- rts
-
- free_audio
- move.l aumsg,a1
- ; move.w allockey,ioa_AllocKey(a1)
- move.w #ADCMD_FREE,IO_COMMAND(a1)
- move.b #IOF_QUICK,IO_FLAGS(a1)
- ; move.l unit,IO_UNIT(a1)
- move.l 4,a6
- jsr _LVODoIO(a6)
-
- move.l aumsg,a1
- move.l 4,a6
- jsr _LVOCloseDevice(a6)
-
- move.l aumsg,a1
- move.l #ioa_SIZEOF,d0
- move.l 4,a6
- jsr _LVOFreeMem(a6)
- move.l audiodata,a1
- move.l #10000,d0
- move.l 4,a6
- jsr _LVOFreeMem(a6)
- rts
-
- CKirjoita
- ; viestin osoite a0:ssa
- ; pituus d3:ssa
- move.l a0,d2
- move.l writehandle,d1
- movea.l dosbase,a6
- jsr _LVOWrite(a6)
- rts
-
- Lataa
- move.l a6,-(sp)
-
- ; avataan tiedosto
- lea sound,a0
- move.l a0,d1 ; Nimen osoite : name
- move.l #MODE_OLDFILE,d2 ; accessMode
- movea.l dosbase,a6
- jsr _LVOOpen(a6)
- tst.l d0 ; jos tulos on nolla, tiedostoa ei ole
- beq.s lataa_loppu
-
- ; tiedosto saatiin avattua
- move.l d0,filehandle ;tiedoston tunnus muistiin
- move.l d0,d1
- move.l audiodata,d2 ; osoite muistiin, jonne kirjoitetaan : buffer
- move.l #10000,d3 ; muistiblokin koko : length
- movea.l dosbase,a6
- jsr _LVORead(a6)
-
- ; suljetaan tiedosto
- move.l filehandle,d1
- movea.l dosbase,a6
- jsr _LVOClose(a6)
- move.l audiodata,voice1
- lataa_loppu
- move.l (sp)+,a6
- rts
-
- modify ;muutettava luku d2:ssa
- move.l #string,a5 ;merkkijonon osoite, joho luku tulee
- moveq #8,d1
- loop
- move.l d2,d0
- lsr.l #4,d2
- bsr.s muuta
- move.b d0,-1(a5,d1.l)
- subi.b #1,d1
- bne loop
- rts
- muuta ;muutettava luku d0:ssa
- and.b #$f,d0
- or.b #$30,d0
- cmp.b #$3a,d0
- blt pois
- add.b #7,d0
- pois
- rts
- type
- move.l dosbase,a6
- move.l writehandle,d1
- move.l addr,d2
- move.l lenght,d3
- jsr -48(a6)
- rts
-
- intbase ds.l 1
- dosbase ds.l 1
- grbase ds.l 1
- filehandle dc.l 0
- writehandle dc.l 0
-
- audiodata dc.l 0
- audev dc.l 0
- unit dc.l 0
- aumsg dc.l 0
- allockey dc.w 0
- allocbits dc.b 1,2,4,8
-
- voice1
- dc.l 0 ; ioa_Data
- dc.l 8660 ; ioa_Length
- dc.w 300 ; ioa_Period
- dc.w 63 ; ioa_Volume
- dc.w 2 ; ioa_Cycles
-
- intname dc.b 'intuition.library',0
- dosname dc.b 'dos.library',0
- grname dc.b 'graphics.library',0
- audioname dc.b 'audio.device',0
- sound dc.b 'sound',0
- string dc.b '********',32,10
- addr dc.l 0
- lenght dc.l 0
-
- msg0 dc.b 'Voice V1.0 © Leo Puolamaa May 1991',$0a
- msglen0 equ *-msg0
- msg1 dc.b 'audio.device ei avaudu !',$0a
- msglen1 equ *-msg1
- msg2 dc.b 'MEMF_CHIP loppu !',$0a
- msglen2 equ *-msg2
- msg3 dc.b 'Audio.device alustettu.',$0a
- msglen3 equ *-msg3
- msg4 dc.b 'Ääni soitettu.',$0a
- msglen4 equ *-msg4
- msg5 dc.b 'Audio.device suljettu.',$0a
- msglen5 equ *-msg5
- msg6 dc.b 'Seuraavaksi kutsutaan _BeginIO...',$0a
- msglen6 equ *-msg6
- msg7 dc.b '..._BeginIO suoritettu !',$0a
- msglen7 equ *-msg7
- end
-