-
Notifications
You must be signed in to change notification settings - Fork 5
/
vgc_demo.asm
132 lines (86 loc) · 2.3 KB
/
vgc_demo.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
;******************************************************************
; 6502 BBC Micro Compressed VGM (VGC) Music Player
; By Simon Morris
; https://github.com/simondotm/vgm-player-bbc
; https://github.com/simondotm/vgm-packer
;******************************************************************
; Allocate vars in ZP
.zp_start
ORG &70
GUARD &8f
;----------------------------------------------------------------------------------------------------------
; Common code headers
;----------------------------------------------------------------------------------------------------------
; Include common code headers here - these can declare ZP vars from the pool using SKIP...
INCLUDE "lib/vgcplayer_config.h.asm"
INCLUDE "lib/vgcplayer.h.asm"
.zp_end
\ ******************************************************************
\ * Utility code - always memory resident
\ ******************************************************************
ORG &3000
GUARD &7c00
.start
;----------------------------
;-------------------------------------------
; main
;-------------------------------------------
; code routines
INCLUDE "lib/vgcplayer.asm"
ALIGN 256
.main
{
; initialize the vgm player with a vgc data stream
lda #hi(vgm_stream_buffers)
ldx #lo(vgm_data)
ldy #hi(vgm_data)
sec ; set carry to enable looping
jsr vgm_init
; loop & update
sei
.loop
; set to false to playback at full speed for performance testing
IF TRUE
; vsync
lda #2
.vsync1
bit &FE4D
beq vsync1
sta &FE4D
ENDIF
;ldy#10:.loop0 ldx#0:.loop1 nop:nop:dex:bne loop1:dey:bne loop0
lda #&03:sta&fe21
jsr vgm_update
pha
lda #&07:sta&fe21
pla
beq loop
cli
rts
}
.vgm_buffer_start
; reserve space for the vgm decode buffers (8x256 = 2Kb)
ALIGN 256
.vgm_stream_buffers
skip 256
skip 256
skip 256
skip 256
skip 256
skip 256
skip 256
skip 256
.vgm_buffer_end
; include your tune of choice here, some samples provided....
.vgm_data
;INCBIN "music/vgc/song_091.vgc"
;INCBIN "music/vgc/axelf.vgc"
;INCBIN "music/vgc/bbcapple.vgc"
;INCBIN "music/vgc/nd-ui.vgc"
;INCBIN "music/vgc/outruneu.vgc"
;INCBIN "music/vgc/ym_009.vgc"
;INCBIN "music/vgc/test_bbc.vgc"
INCBIN "music/vgc/acid_demo.vgc"
.end
PRINT ~vgm_data
SAVE "Main", start, end, main