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
132
133
134
135
136
137
138
139
140
141
|
;****************************************************************************
; MainMenu
; Menu where you get to select the song and such
; The main screen, bah...
;****************************************************************************
MainMenu:
move.w #0, (RAM_CurrSong) ; Selected song
bsr UpdateMenu ; Show description of first song
move.l #0, (RAM_LArrowAnim) ; Reset arrows anim
move.w #$8407, (RAM_BGAnim) ; Reset background anim
@MainLoop:
move.b (RAM_JoyPress), d0 ; Get joypad input
btst.l #2, d0 ; Previous song?
beq.s @NoLeft
move.w (RAM_CurrSong), d7 ; Select previous song
bne.s @NotTooLeft
move.w #NumSongs, d7
@NotTooLeft:
subq.w #1, d7
move.w d7, (RAM_CurrSong)
bsr UpdateMenu ; Update current song
move.w #28, (RAM_LArrowAnim) ; Animate left arrow
lea (SFX_Beep), a0 ; Beep!
bsr Echo_PlaySFX
@NoLeft:
btst.l #3, d0 ; Next song?
beq.s @NoRight
move.w (RAM_CurrSong), d7 ; Select next song
addq.w #1, d7
cmp.w #NumSongs, d7
blt.s @NotTooRight
moveq #0, d7
@NotTooRight:
move.w d7, (RAM_CurrSong)
bsr UpdateMenu ; Update current song
move.w #28, (RAM_RArrowAnim) ; Animate right arrow
lea (SFX_Beep), a0 ; Beep!
bsr Echo_PlaySFX
@NoRight:
btst.l #5, d0 ; Play song?
bne.s @DoPlay
btst.l #6, d0
beq.s @NoPlay
@DoPlay:
lea (SongList), a1 ; Get song address
move.w (RAM_CurrSong), d7
lsl.w #4, d7
lea (a1,d7.w), a1
move.l (a1), a0
bsr Echo_PlayBGM ; Play song
@NoPlay:
btst.l #4, d0 ; Stop song?
beq.s @NoStop
bsr Echo_StopBGM
@NoStop:
btst.l #7, d0 ; Debug key
beq.s @NoDebug
lea (BGM_Test), a0 ; Play test BGM
;bsr Echo_PlayBGM
lea (SFX_Test), a0 ; Play test SFX
bsr Echo_PlaySFX
@NoDebug:
lea (@ArrowPal), a0
move.w (RAM_LArrowAnim), d0 ; Animate left arrow
move.l (a0,d0.w), d1
move.l #$C0060000, ($C00004)
move.l d1, ($C00000)
subq.w #2, d0
bge.s @NoLArrowOver
moveq #0, d0
@NoLArrowOver:
move.w d0, (RAM_LArrowAnim)
move.w (RAM_RArrowAnim), d0 ; Animate right arrow
move.l (a0,d0.w), d1
move.l #$C0260000, ($C00004)
move.l d1, ($C00000)
subq.w #2, d0
bge.s @NoRArrowOver
moveq #0, d0
@NoRArrowOver:
move.w d0, (RAM_RArrowAnim)
move.w (RAM_BGAnim), d0 ; Animate background
bchg.l #1, d0
move.w d0, (RAM_BGAnim)
move.w d0, ($C00004)
bsr VSync ; Next frame
bsr ReadJoypad
bra @MainLoop
;****************************************************************************
@ArrowPal:
dc.w $00E, $00E, $02E, $02E, $04E, $04E, $06E, $06E
dc.w $28E, $28E, $4AE, $4AE, $6CE, $6CE, $8EE, $8EE
;****************************************************************************
; UpdateMenu
; Shows the current option on screen
;****************************************************************************
UpdateMenu:
bsr ClearLines ; Clear lines
lea (SongList), a1 ; Get address of song data
move.w (RAM_CurrSong), d0
lsl.w #4, d0
lea (a1,d0.w), a1
addq.l #4, a1
moveq #7, d0 ; Write song title
moveq #9, d1
move.w #$A000, d2
move.l (a1)+, a0
bsr WriteString
addq.w #2, d1 ; Write song description
move.w #$C000, d2
move.l (a1)+, a0
bsr WriteString
addq.w #2, d1
move.l (a1)+, a0
bsr WriteString
rts ; End of subroutine
|