Skip to content

Commit 20eee43

Browse files
committed
Sound demo tweak, a bit cooler.
1 parent 7fd53a4 commit 20eee43

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

src/audio.s

+29-10
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,32 @@ mode: .res 1
2828

2929
vol_init = 63
3030

31-
att_init = 46
32-
dec_init = 100
33-
sus_init = 11
31+
att_init = 255
32+
dec_init = 19
33+
sus_init = 50
3434
rel_init = 10
3535

36-
note_spc = 7
37-
noff_spc = 4
36+
note_spc = 9
37+
noff_spc = 6
3838
; noff < note
3939

4040

4141
.segment "PRGBK01"
4242

43-
some_notes: .byte 0, 7, 10, 15, 10, 7, 0, 15
44-
.byte 0, 7, 10, 14, 10, 7, 0, 14
45-
.byte 0, 7, 10, 12, 10, 7, 0, 12
46-
.byte 0, 7, 10, 19, 10, 7, 0, 19
43+
some_notes: .byte 12+0, 12+7, 12+10, 12+15, 12+10, 12+7, 12+0, 12+15
44+
.byte 12+0, 12+7, 12+10, 12+14, 12+10, 12+7, 12+0, 12+14
45+
.byte 12+0, 12+7, 12+10, 12+12, 12+10, 12+7, 12+0, 12+12
46+
.byte 12+0, 12+7, 12+10, 12+19, 12+10, 12+7, 12+0, 12+19
47+
.byte 8, 12+0, 12+7, 12+15, 12+7, 12+0, 8, 12+15
48+
.byte 8, 12+0, 12+7, 12+14, 12+7, 12+0, 8, 12+14
49+
.byte 8, 12+0, 12+7, 12+12, 12+7, 12+0, 8, 12+12
50+
.byte 10, 12+2, 12+7, 12+19, 12+7, 12+2, 10, 12+19
4751
some_notes_size = * - some_notes
4852

49-
notes: .word 427, 403, 380, 359, 338, 319, 301, 284, 268, 253, 239, 225
53+
notes: .word 854, 806, 760, 718, 676, 638, 602, 568, 536, 506, 478, 450
54+
.word 427, 403, 380, 359, 338, 319, 301, 284, 268, 253, 239, 225
5055
.word 213, 201, 189, 179, 169, 159, 150, 142, 134, 126, 119, 112
56+
.word 106, 100, 94, 89, 84, 79, 75, 71, 67, 63, 59, 56
5157

5258
;-------------------------------------------------------------------------------
5359
; void sound_engine(void) __nmi__
@@ -73,6 +79,17 @@ play_mode:
7379
asl
7480
tax
7581
movw $4002, {notes, x}
82+
movw $4006, {notes, x}
83+
lda notes, x
84+
sta $4002
85+
clc
86+
adc #1
87+
sta $4006
88+
lda notes+1, x
89+
sta $4003
90+
adc #0
91+
sta $4007
92+
7693
inc soundptr
7794
bne :+
7895
inc soundptr+1
@@ -96,6 +113,7 @@ do_vol:
96113
jsr APU_volume
97114
ora #$B0
98115
sta $4000
116+
sta $4004
99117

100118
lda #$0C
101119
and btn_press
@@ -169,6 +187,7 @@ button_mode:
169187
jsr APU_volume
170188
ora #$B0
171189
sta $4000
190+
sta $4004
172191

173192
rts
174193
.endproc

0 commit comments

Comments
 (0)