mirror of
https://github.com/antoinevignau/source.git
synced 2025-02-02 09:32:53 +00:00
1 line
59 KiB
Plaintext
1 line
59 KiB
Plaintext
|
****************************************************************
*
* Init Sound DOC
*
****************************************************************
ProDOS gequ $e100a8
longa on
longi on
InitSound START ReggaeMan
Using InstDef
Using PictureBuffer
Using SequenceNotes
Using SeqEffects1
Using SeqEffects2
ldx #$00
lda #$8080
bcle sta >WaveBuffer,x ; 256 bytes buffer
inx
inx
cpx #256
bne bcle
sei
PushLong #WaveBuffer ; Copy to DOC ram 256 $80 bytes
PushWord #0 ; to make sure that there are no
PushWord #256 ; $00 bytes that would stop the
_WriteRamBlock ; oscilator.
sep #$20
longa off
bcleWait lda >$E1C03C
bmi bcleWait
ora #%00100000
and #%10111111
sta >$E1C03C
lda #$40
sta >$E1C03E ; Set Volume Registers
ldy #0
lda #0 ; Volume=0
bcleWrite1 sta >$E1C03D
iny
cpy #30
bne bcleWrite1
lda #$80
sta >$E1C03E ; Set Wavetable Pointer Registers
ldy #0
lda #0 ; Wavetable Pointer register=0
bcleWrite2 sta >$E1C03D
iny
cpy #30
bne bcleWrite2
lda #$A0
sta >$E1C03E ; Set Control Registers
ldy #0
bcleWrite3 lda #1 ; Control Byte=1 (osc. stopped)
sta >$E1C03D
iny
cpy #30
bne bcleWrite3
lda #$C0
sta >$E1C03E ; Set Wavetable Size Registers
ldy #0
bcleWrite4 lda #0 ; Size=0
sta >$E1C03D
iny
cpy #30
bne bcleWrite4
lda #$00
sta >$E1C03E
lda #$FA
sta >$E1C03D ; Frequency low 0=$7D =50Hz
lda #$20
sta >$E1C03E
lda #$0
sta >$E1C03D ; Frequency high 0=0
lda #$E1
sta >$E1C03E
lda #60
sta >$E1C03D ; 30 osc. enabled
lda #$A0
sta >$E1C03E
lda #$8
sta >$E1C03D ; Osc 0 generates interrupts
rep #$20
longa on
cli
rts
****************************************************************
*
* Load Music
*
****************************************************************
LoadMusic ENTRY
Using SequenceNotes
Using SeqEffects1
Using SeqEffects2
Using InstDef
PushLong #Parmblock
PushWord #$2010 ; Open
jsl GSOS
jsl ProDOSErrJSL
lda parmblock+2
sta parmblock2+2
sta parmblock3+2
sta parmblock4+2
sta parmblock5+2
sta parmblock6+2
sta parmblock7+2
PushLong #Parmblock2
PushWord #$2012 ; Read Header
jsl GSOS
jsl ProDOSErrJSL
ldx #44
ldy #0
bcleSetVolume lda >HeaderBuffer,x
sta VolumeTable,y
iny
iny
txa
clc
adc #30
tax
cmp #470
bcc bcleSetVolume
ReadFile lda >HeaderBuffer+6
sta Length
sta Length2
|