/[projet1]/public/atari/demos/defenceforce/savetheearth/nighcity.s
Defence Force logotype

Contents of /public/atari/demos/defenceforce/savetheearth/nighcity.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 172 - (show annotations)
Sat Nov 28 13:10:37 2009 UTC (10 years ago) by dbug
File size: 7854 byte(s)
Added the source code of "Save The Earth", the Atari STe demo presented at Kindergarden 2009
1
2 SECTION TEXT
3
4 even
5
6 NIGHTCITY_TOTAL_HEIGHT equ 400 ; Two screen high
7 NIGHTCITY_POS_Y_MOON equ 0
8 NIGHTCITY_POS_Y_CITY equ 200
9 NIGHTCITY_POS_Y_MIRROR equ 364
10
11 NIGHTCITY_HEIGHT_MOON equ 76
12 NIGHTCITY_HEIGHT_CITY equ 200
13 NIGHTCITY_HEIGHT_MIRROR equ 35
14
15 DisplayNightCityInit
16 ; Depack the night city picture
17 lea PackInfoNightCity,a0
18 bsr DepackBlock
19
20 lea PackInfoMoon,a0
21 bsr DepackBlock
22
23 ifne enable_music
24 lea music,a0
25 bsr StartMusicIfNotStarted
26 endc
27
28 ; Set the screen information (static fullscreen picture)
29 move.l #big_buffer_start+depacked_nightcity+32,ptr_scr_1
30
31 move #0,pos_scr_y
32 ;move #NIGHTCITY_TOTAL_HEIGHT-200-1,pos_scr_y
33
34 ; Picture palette
35 lea black_palette,a0
36 lea big_buffer_start+depacked_nightcity,a1
37 moveq #16,d7
38 bsr ComputeGradient
39
40 ; Background gradient
41 lea big_buffer_start+nightcity_gradient,a2
42
43 move #200,d7
44
45 move.l #$000000,d0 ; Black
46 move.l #$000000,d1 ; Black
47 bsr CreateBackgroundGradient
48
49 move #50,d7
50
51 move.l #$000000,d0 ; Black
52 move.l #$000a51,d1 ; Dark blue
53 bsr CreateBackgroundGradient
54
55 move #35,d7
56
57 move.l #$000a51,d0 ; Dark blue
58 move.l #$76ccff,d1 ; Light blue
59 bsr CreateBackgroundGradient
60
61 move #35,d7
62
63 move.l #$76ccff,d0
64 move.l #$ff00b0,d1
65 bsr CreateBackgroundGradient
66
67 move #30,d7
68
69 move.l #$ff00b0,d0
70 move.l #$700000,d1
71 bsr CreateBackgroundGradient
72
73 move #50,d7
74
75 move.l #$000000,d0 ; Black
76 move.l #$001070,d1 ; Black
77 bsr CreateBackgroundGradient
78
79 bsr NightCityCreateMasterPicture
80 bsr NightCityUpdateDisplayList
81
82 ; Using the template data, we generate the fullscreen
83 lea PanoramicTemplate_DisplayList,a0
84 lea big_buffer_start+nightcity_fullscreen,a1
85 bsr GenerateOverscan
86 rts
87
88 DisplayNightCityPlay
89 COLORHELP #$700
90 bsr SequencerPlay
91 COLORHELP #$070
92 ;bsr NightCityUpdateDisplayList
93 COLORHELP #$007
94
95 _AdrNightCityRoutine=*+2
96 jsr DummyRoutine
97 COLORHELP #$000
98 rts
99
100 DisplayNightCityTerminate
101 bsr TerminateFullscreenTimer
102 rts
103
104
105 NightCityScrollDown
106 add #1,pos_scr_y
107 cmp #NIGHTCITY_TOTAL_HEIGHT-200,pos_scr_y
108 bne.s .keep_scrolling_y
109 move.l #DummyRoutine,_AdrNightCityRoutine
110 .keep_scrolling_y
111 rts
112
113
114 NightCityCreateMasterPicture
115 ; First makes every scanline point on the empty line
116 lea empty_line,a0
117 movem.l (a0),d1/d2/d3/d4/d5/d6/a4/a5 ; Black palette
118 move.l a0,d0
119 lsl.l #8,d0
120
121 lea big_buffer_start+nightcity_screen,a1
122 lea big_buffer_start+nightcity_palettes,a2
123 move #NIGHTCITY_TOTAL_HEIGHT-1,d7
124 .loop_erase_line
125 move.l d0,(a1)+
126 movem.l d1/d2/d3/d4/d5/d6/a4/a5,(a2)
127 lea 32(a2),a2
128 dbra d7,.loop_erase_line
129
130 ; Then add the moon with associated palettes
131 lea big_buffer_start+depacked_moon,a0 ; Palette
132 movem.l (a0)+,d1/d2/d3/d4/d5/d6/a4/a5 ; Moon palette
133 move.l a0,d0
134 lsl.l #8,d0
135 lea big_buffer_start+nightcity_screen+(NIGHTCITY_POS_Y_MOON*4),a2
136 lea big_buffer_start+nightcity_palettes+(NIGHTCITY_POS_Y_MOON*32),a3
137 move #NIGHTCITY_HEIGHT_MOON-1,d7
138 .loop_draw_moon
139 move.l d0,(a2)+
140 movem.l d1/d2/d3/d4/d5/d6/a4/a5,(a3)
141 add.l #208*256,d0
142 lea 32(a3),a3
143 dbra d7,.loop_draw_moon
144
145 ; Then add the city
146 lea big_buffer_start+depacked_nightcity,a0 ; Palette
147 movem.l (a0)+,d1/d2/d3/d4/d5/d6/a4/a5 ; City palette
148 move.l a0,d0
149 lsl.l #8,d0
150 addq.l #8,d0
151 lea big_buffer_start+nightcity_screen+(NIGHTCITY_POS_Y_CITY*4),a2
152 lea big_buffer_start+nightcity_palettes+(NIGHTCITY_POS_Y_CITY*32),a3
153 move #NIGHTCITY_HEIGHT_CITY-1,d7
154 .loop_draw_city
155 move.l d0,(a2)+
156 movem.l d1/d2/d3/d4/d5/d6/a4/a5,(a3)
157 add.l #208*256,d0
158 lea 32(a3),a3
159 dbra d7,.loop_draw_city
160
161 ; Then add the mirror of the city
162 lea big_buffer_start+depacked_nightcity,a0 ; Palette
163 movem.l (a0)+,d1/d2/d3/d4/d5/d6/a4/a5 ; City palette
164 move.l a0,d0
165 add.l #208*164,d0
166 lsl.l #8,d0
167 addq.l #8,d0
168 lea big_buffer_start+nightcity_screen+(NIGHTCITY_POS_Y_MIRROR*4),a2
169 lea big_buffer_start+nightcity_palettes+(NIGHTCITY_POS_Y_MIRROR*32),a3
170 move #NIGHTCITY_HEIGHT_MIRROR-1,d7
171 .loop_draw_city_mirror
172 move.l d0,(a2)+
173 movem.l d1/d2/d3/d4/d5/d6/a4/a5,(a3)
174 sub.l #208*256*2,d0
175 lea 32(a3),a3
176 dbra d7,.loop_draw_city_mirror
177
178
179 ; Then patch the palettes to insert the background color
180 lea big_buffer_start+nightcity_gradient,a0
181 lea big_buffer_start+nightcity_palettes,a1
182 move #NIGHTCITY_TOTAL_HEIGHT-1,d0
183 .loop_copy_background
184 move (a0)+,(a1)
185 lea 32(a1),a1
186 dbra d0,.loop_copy_background
187 rts
188
189
190 NightCityUpdateDisplayList
191 COLORHELP #$030
192 bsr.s NightCityMirror
193
194 COLORHELP #$040
195 lea big_buffer_start+nightcity_screen,a0 ; Scanlines list
196 lea big_buffer_start+nightcity_palettes,a1 ; Palette list
197
198 move pos_scr_y,d0
199 add d0,d0 ; x2
200 add d0,d0 ; x4
201 add d0,a0
202 lsl #3,d0
203 add d0,a1
204
205 lea DisplayList,a2 ; Target display list
206 move #200-1,d7
207 .loop_side
208 move.l (a0)+,(a2)+
209 move.l a1,(a2)+
210 lea 32(a1),a1
211 dbra d7,.loop_side
212
213 rts
214
215 NightCityMirror
216 lea sine_255,a1
217 move MirrorAngle,d2
218 addq #1,MirrorAngle
219 and #255,d2
220 add d2,d2
221
222 move MirrorAngle2,d3
223 subq #3,MirrorAngle2
224 and #255,d3
225 add d3,d3
226
227 ; Then add the mirror of the city
228 lea big_buffer_start+depacked_nightcity+32,a0 ; Palette
229 move.l a0,d0
230 add.l #208*164,d0
231 lsl.l #8,d0
232 addq.l #8,d0
233 lea big_buffer_start+nightcity_screen+(NIGHTCITY_POS_Y_MIRROR*4),a2
234 lea big_buffer_start+nightcity_palettes+(NIGHTCITY_POS_Y_MIRROR*32),a3
235 move #NIGHTCITY_HEIGHT_MIRROR-1,d7
236 .loop_draw_city_mirror
237
238 moveq #0,d1
239 move 0(a1,d2),d1 ; 16 bits, between 00 and 127
240 move d1,d5
241 addq #4,d2
242 lsr #5,d1
243
244 moveq #0,d4
245 move 0(a1,d3),d4 ; 16 bits, between 00 and 127
246 addq #6,d3
247 lsr #2,d4
248
249 add d4,d1
250
251 lsr #3,d1
252
253 mulu #208*256,d1
254 move.l d0,d6
255 add.l d1,d6
256
257 lsr #5,d5
258 add d5,d6
259
260 move.l d6,(a2)+
261 sub.l #208*256*2,d0
262
263 ;moveq #0,d1
264 ;move 0(a1,d2),d1 ; 16 bits, between 00 and 127
265 ;add #2,d2
266 ;;lsr #8,d1
267 ;lsr #4,d1
268 ;add.l d0,d1
269 ;move.l d1,(a2)+
270 ;sub.l #208*256*2,d0
271 lea 32(a3),a3
272 dbra d7,.loop_draw_city_mirror
273 rts
274
275 MirrorAngle dc.w 0
276 MirrorAngle2 dc.w 0
277
278 SECTION DATA
279
280 even
281
282 PackInfoNightCity
283 dc.l picture_nightcity
284 dc.l big_buffer_start+depacked_nightcity
285 dc.l 41632
286
287 PackInfoMoon
288 dc.l picture_moon
289 dc.l big_buffer_start+depacked_moon
290 dc.l 15840
291
292 ; Unpacked: 41632
293 ; Packed: 12447
294 ; 416x200
295 FILE "nghtcity.pik",picture_nightcity
296
297 ; Unpacked: 15840
298 ; Packed: 3278
299 ; 416x76
300 FILE "moon.pik",picture_moon
301
302
303 NightCitySequencer
304 SEQUENCE_SETPTR _AdrPartVblRoutine,NightCityUpdateDisplayList
305 SEQUENCE_SUBTITLE <"1989. Another warm summer night",13,"in California.">
306
307 SEQUENCE_TEMPORIZE 50*3
308 SEQUENCE_SETPTR _AdrNightCityRoutine,NightCityScrollDown
309
310 SEQUENCE_TEMPORIZE 50
311 SEQUENCE_SUBTITLE <"">
312
313
314 SEQUENCE_TEMPORIZE 50*5
315
316 SEQUENCE_SUBTITLE <"In San Francisco inhabitants are",13,"relaxing after a hard day at work.">
317 ;It's sleep time for the citizens",13,"of San Francisco.">
318
319 SEQUENCE_TEMPORIZE 50*3
320
321 SEQUENCE_SUBTITLE <"">
322
323 SEQUENCE_TEMPORIZE 50*3
324
325 SEQUENCE_SUBTITLE <"But in the nearby city of Sunnyvale,",13,"Atari is preparing the STe launch.">
326
327 SEQUENCE_TEMPORIZE 50*3
328
329 SEQUENCE_SUBTITLE <"">
330
331 SEQUENCE_GO_NEXT_PART ; And leave
332 SEQUENCE_END
333
334
335
336 SECTION BSS
337
338 even
339
340 ;
341 ; The content of this buffer is going to be stored in
342 ; the big common table.
343 ;
344 rsreset
345 nightcity_fullscreen rs.b Size_PanoramicRoutine_DisplayList
346 depacked_nightcity rs.b 41632
347 depacked_moon rs.b 15840
348
349 nightcity_screen rs.l NIGHTCITY_TOTAL_HEIGHT ; Pointers on lines
350 nightcity_palettes rs.b 32*NIGHTCITY_TOTAL_HEIGHT ; One palette per line
351 nightcity_gradient rs.w NIGHTCITY_TOTAL_HEIGHT ; One background entry per line
352
353 update_buffer_size
354
355
356

  ViewVC Help
Powered by ViewVC 1.1.26