summaryrefslogtreecommitdiff
path: root/menu.s68
blob: f603ebf3ed8d35a7bd513563f1fce6b81b875e2c (plain)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
	dc.l $0, start
	dc.l empty_handler
	dc.l empty_handler
	;$10
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$20
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$30
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$40
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$50
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$60
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$70
	dc.l int_4
	dc.l empty_handler
	dc.l int_6
	dc.l empty_handler
	;$80
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$90
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$A0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$B0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$C0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$D0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$E0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$F0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.b "SEGA GENESIS    "
	dc.b "(c) 2015.JULY   "
	dc.b "Menu            "
	dc.b "                "
	dc.b "                "
	dc.b "Menu            "
	dc.b "                "
	dc.b "                "
	dc.b "GM MK-00000-00", 0, 0
	dc.b "                "
	dc.l $0, rom_end-1, $FF0000, $FFFFFF
	dc.b "                "
	dc.b "                "
	dc.b "                "
	dc.b "                "
	dc.b "JUE "
	
empty_handler:
int_6:
	rte
int_4:
	rte
	
	rsset $FFFF8000
x_pos    rs.w 1
base_cmd rs.l 1

start:
	lea $C00000, a0
	lea $C00004, a1
	move.w #$8104, (a1) ;Mode 5, everything turned off
	move.w #$8004, (a1)
	move.w #$8220, (a1) ;Scroll a table $8000
	move.w #$8405, (a1) ;Scroll b table $A000
	move.w #$8560, (a1) ;SAT table $C000
	move.w #$8700, (a1) ;backdrop color 0
	move.w #$8B00, (a1) ;full screen scroll
	move.w #$8C87, (a1) ;40 cell mode, double-res interlace
	move.w #$8D00, (a1) ;hscroll table at 0
	move.w #$8F02, (a1) ;autoinc 2
	move.w #$9001, (a1) ;64x32 scroll size
	move.l #$C0000000, (a1)
	move.w #$000, (a0)
	move.w #$EEE, (a0)

	;init scroll table
	move.l #$40000000, (a1)
	move.w #0, (a0)
	move.w #4, (a0)

	;load tiles
	move.l #$48000000, (a1)
	lea font(pc), a2
	move.w #((fontend-font)/4 - 1), d0
tloop:
	move.l (a2)+, (a0)
	dbra d0, tloop



	;clear name table
	move.l #$40000002, (a1)
	moveq #32, d0
	move.w #(64*64-1), d1
ploop:
	move.w d0, (a0)
	dbra d1, ploop
	
	move.l #$40000002, d3,
	move.l d3, (a1)
	move.l d3, base_cmd.w

	lea Message(pc), a6
	moveq #0, d0
	bsr print_string
	
	
	
	move.w #$8144, (a1) ;enable display
	move #$2300, sr
	

wait_forever
	bra wait_forever

Message:
	dc.b "Journey From Darkness - Strider Returns (U) [c][!].bin", $A
	dc.b "Toejam & Earl in Panic on Funkotron (U) [!].bin", $A
	dc.b "Fire Shark (U) [c][!].bin", $A
	dc.b "Sonic and Knuckles (W) [!].bin", 0

	align 1

;Prints a null terminated string
;a6 - pointer to string
;a0 - VDP data port
;d0 - base tile attribute
;
;Clobbers: d1.w, d2.w, d3.l
print_string:
	lea widths(pc), a5
	move.w x_pos.w, d2
	move.l base_cmd.w, d3
.loop
	moveq #0, d1
	move.b (a6)+, d1
	beq .end
	cmp.b #$A, d1
	beq .newline
	tst.b (-32, a5, d1.w)
	beq .narrow
	add.w d0, d1
	move.w d1, (a0)
	addq #2, d2
	bra .loop
.narrow
	add.w d0, d1
	move.w d1, (a0)
	addq #1, d2
	move.l d2, d1
	;switch to other plane
	and.w #$FFFE, d1
	swap d1
	eor.l #$20000000, d3
	or.l d3, d1
	move.l d1, (a1)
	bra .loop
.newline
	moveq #0, d2
	;switch back to plane A
	and.l #$DFFFFFFF, d3
	;skip to next row
	add.l #$00800000, d3
	move.l d3, (a1)
	bra .loop
.end
	move.w d2, x_pos.w
	move.l d3, base_cmd.w
	rts

	align 1
font:
	incbin font_interlace_variable.tiles
fontend

widths:
	dc.b 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1
	dc.b 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0
	dc.b 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1
	dc.b 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
	dc.b 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1
	
rom_end: