-
Notifications
You must be signed in to change notification settings - Fork 1
/
incSOUNDCommand.asm
78 lines (68 loc) · 1.62 KB
/
incSOUNDCommand.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
;*******************************************************************************
;* SOUND Command *
;* This BASIC function to set up the Voice Envelope *
;* *****************************************************************************
;* Syntax : SOUND Freq, Pulse, Attack, Decay, Sustain, Release *
;* Inputs : *
;* : *
;*******************************************************************************
; sound : Freq......
COM_SOUND
lda #$00
ldy COMM_AY ; Voice OffSet V1 = 0, V2 = 7, V3 = 14
sta $D400,y
sta $D401,y
sta $D402,y
sta $D403,y
;sta $D404,y
sta $D405,y
sta $D406,y
jsr GETNO2
ldx COMM_AY
sta $D400,x
tya
sta $D401,x
jsr bas_CHKCOM$
jsr GETNO2
cpy #$10
bcc @NotIllegal
jmp bas_IQERR$
@NotIllegal
ldx COMM_AY
sta $D402,x
tya
sta $D403,x
jsr GetSoundOneByte ; Attack
asl
asl
asl
asl
ldx COMM_AY
sta $D405,x
jsr GetSoundOneByte ; Decay
ldx COMM_AY
ora $D405,x
sta $D405,x
jsr GetSoundOneByte ; Sustain
asl
asl
asl
asl
ldx COMM_AY
sta $D406,x
jsr GetSoundOneByte ; Release
ldx COMM_AY
ora $D406,x
sta $D406,x
rts
GetSoundOneByte
jsr bas_CHRGOT$
jsr bas_CHKCOM$
jsr bas_GETBYTC$
cpx #$10
bcc @NotIllegal
jmp bas_IQERR$
@NotIllegal
txa
and #%00001111
rts