summaryrefslogtreecommitdiff
path: root/tmss.s68
blob: 33f834a60dcd619b4510e3745f87ed72a3fb3b4c (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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
	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 empty_handler
	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 IS COOL    "
	dc.b "(C)M.Pavone 2021"
	dc.b "TRAIN MEMES STAN"
	dc.b "D SILENTLY      "
	dc.b "                "
	dc.b "TRIUMPHANT MAMMA"
	dc.b "LS SALUTE SOCIAL"
	dc.b "ITES            "
	dc.b "MP 20210227-01",0,0
	dc.b "J               "
	dc.l $0
	dc.l romend-1
	dc.l $FF0000
	dc.l $FFFFFF
	dc.b "                "
	dc.b "                "
	dc.b "                "
	dc.b "                "
	dc.b "JUE             "
	
frame_counter equ $FFFF8000
ram_code equ $FFFF8002

empty_handler:
	rte
start:
	lea $A14000, a3
	move.l #'SEGA', (a3)
	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 #$8404, (a1) ;Scroll b table $8000
	move.w #$8560, (a1) ;SAT table $C000
	move.w #$8700, (a1) ;backdrop color 0
	move.w #$8A01, (a1) ;Set HINT counter
	move.w #$8B00, (a1) ;full screen scroll
	move.w #$8C81, (a1) ;40 cell mode, no interlace
	move.w #$8D00, (a1) ;hscroll table at 0
	move.w #$8F02, (a1) ;autoinc 2
	move.w #$9011, (a1) ;64x64 scroll size
	move.l #$C0000000, (a1)
	move.w #$000, (a0)
	move.w #$EEE, (a0)

	;clear scroll table
	move.l #$40000000, (a1)
	move.l #0, (a0)

	;load tiles
	move.l #$44000000, (a1)
	lea font, 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.b #$40, $A10009
	move.b #$00, $A10003

	move.l #$45960002, d7
	move.l d7, (a1)
	move.l #$800000, d6
	
	lea ram_code_src(pc), a6
	lea ram_code.w, a5
	moveq #(font-ram_code_src)/2-1, d0
copy:
	move.w (a6)+, (a5)+
	dbra d0, copy
	lea $101(a3), a4
	lea $100.w, a5
	move.l #'SEGA', d5
	move.l #' SEG', d4
	moveq #0, d0
	moveq #1, d2
	move.w #180, d3
	btst #6, $A10001
	beq .not_pal
	move.w #150, d3
.not_pal:
	jmp ram_code.w

ram_code_src:
	move.b d2, (a4)
	cmp.l (a5), d5
	beq.s is_good
	cmp.l (a5), d4
	bne.s is_bad
is_good:
	move.b d0, (a4)
	lea good(pc), a6
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string

	move.w #$8164, (a1)
	move #$2500, SR
wait:
	cmp.w frame_counter.w, d3
	bne.s wait
	move #$2700, SR
	move.b d2, (a4)
	move.l $0.w, a7
	move.l $4.w, a6
	move.w #$8104, (a1)
	move.l d0, (a3)
	jmp (a6)
	
is_bad:
	lea bad(pc), a6
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string
	
	move.w #$8144, (a1)
forever:
	bra.s forever


int_6:
	addq.w #1, frame_counter.w
	rte

;Prints a null terminated string
;a6 - pointer to string
;a0 - VDP data port
;d0 - base tile attribute
;
;Clobbers: d1.w
print_string:
.loop
	moveq #0, d1
	move.b (a6)+, d1
	beq .end
	add.w d0, d1
	move.w d1, (a0)
	bra .loop
.end
	rts
	
good:
	dc.b "  BLASTEM THINKS", 0
	dc.b "  THAT THIS CART", 0
	dc.b " TASTES DELICIOUS!", 0
	
bad:
	dc.b "  *sniff* *sniff*", 0
	dc.b " something doesn't", 0
	dc.b "  smell right...", 0

	align 1
font:
	incbin font.tiles
fontend

romend