-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRelocated_Code_Callers.s
132 lines (69 loc) · 2.61 KB
/
Relocated_Code_Callers.s
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
; -------------------- callers for relocated code
TitleScreen_RAM_Code:
; set MegaROM page for Code to be relocated
ld a, CODE_TO_BE_RELOCATED_MEGAROM_PAGE
call Set_and_Save_MegaROM_Page
ld hl, TitleScreen_Start
ld de, RAM_Code
ld bc, TitleScreen_size
ldir
; Starts the music
ld a, MUSIC_SHUFFLE_ONE ; index of music on SONG_TABLE
call StartMusic ; param a: liiiiiii, where l (MSB) is the loop flag (0 = loop), and iiiiiii is the 0-based song index (0, 1, 2...)
call TitleScreen
call Clear_RAM_Code_Area
; Stops the music
call StopMusic
ret
ChooseInputScreen_RAM_Code:
; set MegaROM page for Code to be relocated
ld a, CODE_TO_BE_RELOCATED_MEGAROM_PAGE
call Set_and_Save_MegaROM_Page
ld hl, ChooseInputScreen_Start
ld de, RAM_Code
ld bc, ChooseInputScreen_size
ldir
; Starts the music
ld a, MUSIC_YOU_WIN_1 ; index of music on SONG_TABLE
call StartMusic ; param a: liiiiiii, where l (MSB) is the loop flag (0 = loop), and iiiiiii is the 0-based song index (0, 1, 2...)
call ChooseInputScreen
call Clear_RAM_Code_Area
; Stops the music
call StopMusic
ret
HowToPlayScreen_RAM_Code:
; set MegaROM page for Code to be relocated
ld a, CODE_TO_BE_RELOCATED_MEGAROM_PAGE
call Set_and_Save_MegaROM_Page
ld hl, HowToPlayScreen_Start
ld de, RAM_Code
ld bc, HowToPlayScreen_size
ldir
; Starts the music
ld a, MUSIC_YOU_WIN_1 ; index of music on SONG_TABLE
call StartMusic ; param a: liiiiiii, where l (MSB) is the loop flag (0 = loop), and iiiiiii is the 0-based song index (0, 1, 2...)
call HowToPlayScreen
call Clear_RAM_Code_Area
; Stops the music
call StopMusic
ret
StageClearAnimation_RAM_Code:
; set MegaROM page for Code to be relocated
ld a, CODE_TO_BE_RELOCATED_MEGAROM_PAGE
; ld (Seg_P8000_SW), a
call Set_and_Save_MegaROM_Page
ld hl, StageClearAnimation_Start
ld de, RAM_Code
ld bc, StageClearAnimation_size
ldir
call StageClearAnimation
call Clear_RAM_Code_Area
ret
Clear_RAM_Code_Area:
ld hl, RAM_Code ; source
xor a
ld (hl), a ; clear first byte
ld de, RAM_Code + 1 ; destiny
ld bc, RAM_Code.size - 1 ; size
ldir ; Copy BC bytes from HL to DE
ret