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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 172 - (show annotations)
Sat Nov 28 13:10:37 2009 UTC (10 years, 2 months ago) by dbug
File size: 9146 byte(s)
Added the source code of "Save The Earth", the Atari STe demo presented at Kindergarden 2009
1 ;
2 ; Dbug's STE only demo
3 ; for the 20th anniversary of the Atari STE
4 ; 2009, 5th of April
5 ;
6 ; Kraftwerk: Music non stop
7 ; p4 changes -l -s submitted -t //depot/sources/atari/ABriefSteryOfTime/... >commits.txt <- dumps all the commits
8
9 enable_steembreak equ 0
10 enable_boundschecker equ 0
11 enable_colorhelpers equ 0
12 enable_music equ 1
13 enable_debug_text equ 0
14 enable_auto_skip equ 1
15 enable_navigation equ 0
16
17 ;
18 ; Enable/disable parts
19 ; Nothing enabled=95114
20 enable_part_loadingdone equ 1 ; 104494
21 enable_part_tvsnow equ 1 ; 253644
22 enable_part_piracy equ 1 ; 1524008
23 enable_part_cinemascope equ 1 ; 778358 - 24"
24 enable_part_nightcity equ 1 ; 171388 - 22"
25 enable_part_motherboard equ 1 ; 511040 - 44"
26 enable_part_outrun equ 1 ; 144620 - 7"
27 enable_part_insertdisk equ 1 ; 158570 - 13"
28 enable_part_office equ 1 ; 213836 - 36"
29 enable_part_chatroom equ 1 ; 154576 - 50"
30 enable_part_credits equ 1 ; 197922 - 38"
31
32
33 stack_size set 500
34 big_buffer_size set 0
35
36 opt o+,w-
37
38 SECTION TEXT
39
40 text_start
41
42 bra ProgStart
43
44 SECTION DATA
45
46 data_start
47
48
49 SECTION BSS
50
51 bss_start
52
53 include macros.s
54 include system.s
55 include keyboard.s
56 include palette.s
57 include blitter.s
58 include math.s
59 include full.s
60 include subtitle.s
61 include texting.s
62 include audio.s
63 include curves.s
64 include depack.s
65 include sequence.s
66
67 SECTION TEXT
68
69 ; ------------------
70 ; Program start
71 ; ------------------
72 ProgStart
73 ;
74 ; Call the main routine
75 ;
76 move.l #super_main,-(sp)
77 move.w #$26,-(sp)
78 trap #14
79 addq.w #6,sp
80
81 ;
82 ; Quit
83 ;
84 clr.w -(sp)
85 trap #1
86
87
88 super_main
89 ;
90 ; This has to be done first, else we will lose data
91 ; We need to start by clearing the BSS in case of some packer let some crap
92 ;
93 lea bss_start,a0
94 lea bss_end,a1
95 bsr MemoryClear
96
97 ;
98 ; Can now safely save the stack pointer and allocate our own stack.
99 ;
100 move.l sp,save_ssp
101 lea my_stack,sp
102
103 ;
104 ; We need to know on which machine we are running the intro.
105 ; We accept STE and MegaSTE as valid machines.
106 ; Anything else will have a nice message telling them to "upgrade" or use an emulator :)
107 ;
108 bsr DetectMachine
109 tst d0
110 bne.s .testok
111
112 ; This machine is not a STE/MSTE
113 pea NotASteMessage
114 move #9,-(sp)
115 trap #1
116 addq #6,sp
117
118 ; wait key
119 move #7,-(sp)
120 trap #1
121 addq #2,sp
122
123 move.l save_ssp,sp
124 rts
125
126 .testok
127
128
129 ;
130 ; Ignore all interrupt requests
131 ;
132 bsr SaveSystem
133
134 bsr SetSystemParameters
135
136 bsr SubtitleMapFont
137
138 bsr KeyboardFlushBuffer
139
140 move.l #routine_vbl_nothing,$70.w
141 bsr screen_choc ; Shake up baby !
142
143 bsr main
144
145
146 ;
147 ; Restore everything
148 ;
149 fin_demo
150 bsr WaitVbl
151 move.l #routine_vbl_nothing,$70.w
152 bsr screen_choc
153
154 bsr KeyboardFlushBuffer
155 bsr RestoreSystem
156
157 move.l save_ssp,sp
158 rts
159
160
161
162 main
163
164 sf.b flag_end_program
165
166 .loop_sequence
167 ;
168 ; Some initialisation code common to all parts
169 ;
170 move.l #routine_vbl_nothing,$70.w
171 move.l #DummyRoutine,_AdrEndOfFadeRoutine
172
173 ; Set a black palette to avoid glitches
174 lea empty_line,a0
175 bsr PaletteSet
176
177 sf.b flag_end_part
178 move #0,pos_scr_x
179 move #0,pos_scr_y
180 move #208,screen_stride ; Default in 320x200 is 160 bytes
181 move #208,blit_stride
182 move.b #0,$ffff820f.w ; line width (still necessary ???)
183
184 move.l #DummyRoutine,_AdrPartVblRoutine
185
186 bsr SubtitleClearBuffer
187 bsr ClearBigBuffer
188
189 bsr KeyboardFlushBuffer
190
191 ;
192 ; Initialise the part
193 ;
194 move.l PtrSequencer,a0
195 move.l (a0)+,_AdrPartInit
196 beq .end_sequence
197 move.l (a0)+,_AdrPartPlay
198 move.l (a0)+,_AdrPartTerminate
199 move.l (a0)+,d0 ; Sequencer
200 move.l a0,PtrSequencer
201
202 tst.l d0
203 beq.s .skip_sequencer
204 move.l d0,a0
205 bsr SequencerInit
206 .skip_sequencer
207
208 ; VBL Sync
209 bsr SyncVbl
210
211 _AdrPartInit=*+2
212 jsr $123456 ; Init
213
214 ;
215 ; Loop on the part
216 ;
217 tst.l _AdrPartPlay
218 beq.s .end_part
219 .loop_play
220
221 ; VBL Sync
222 bsr WaitVbl
223
224 ; Check the keyboard
225 bsr KeyboardManage
226
227 ; returns d0=true to quit
228 _AdrKeyboardManager=*+2
229 jsr KeyboardDefaultManager
230 tst.b d0
231 bne.s .end_part
232
233 _AdrPartPlay=*+2
234 jsr $123456 ; Play - receives the pressed key in D0, or 0 if nothing is pressed
235
236 tst.b flag_end_part
237 beq.s .loop_play
238 .end_part
239
240
241 ;
242 ; Clean-up the part
243 ;
244 tst.l _AdrPartTerminate
245 beq.s .end_cleanup
246
247 _AdrPartTerminate=*+2
248 jsr $123456 ; Terminate
249
250 .end_cleanup
251
252 ; User pressed space ?
253 tst.b flag_end_program
254 beq .loop_sequence
255
256 .end_sequence
257 ifne enable_music
258 bsr StopMusic
259 endc
260 rts
261
262
263 ClearBigBuffer
264 lea big_buffer_start,a0
265 lea big_buffer_end,a1
266 bsr MemoryClear
267 rts
268
269
270 routine_vbl_nothing
271 movem.l d0-a6,-(sp)
272
273 sf $fffffa1b.w ; Disable HBL
274
275 st flag_vbl
276
277 ; Update the time counters
278 bsr TimeUpdate
279
280 ;
281 ; Replay music if initialised
282 ;
283 ifne enable_music
284 move.l _AdrMusicVblRoutine,a0
285 jsr (a0)
286 endc
287
288 movem.l (sp)+,d0-a6
289 rte
290
291
292 CommonVblSubRoutine
293 st.b flag_vbl
294
295 ; Update the time counters
296 bsr TimeUpdate
297
298 COLORHELP #$777
299 _AdrPartVblRoutine=*+2
300 jsr DummyRoutine
301 COLORHELP #$000
302
303 ;
304 ; Compute new palette
305 ;
306 lea palette_vbl_fade,a0
307 bsr ApplyGradient
308 rts
309
310
311 DummyRoutine
312 rts
313
314
315 ; ===========================================================================
316 ;
317 ; Additional source for parts
318 ;
319 ; ===========================================================================
320
321 ifne enable_music
322 include music.s
323 endc
324
325 ifne enable_part_loadingdone
326 include loaddone.s
327 endc
328
329 ifne enable_part_tvsnow
330 include tvsnow.s
331 endc
332
333 ifne enable_part_piracy
334 include piracy.s
335 endc
336
337 ifne enable_part_cinemascope
338 include cinescop.s
339 endc
340
341 ifne enable_part_nightcity
342 include nighcity.s
343 endc
344
345 ifne enable_part_insertdisk
346 include insrdisk.s
347 endc
348
349 ifne enable_part_office
350 include deskofic.s
351 endc
352
353 ifne enable_part_chatroom
354 include chatroom.s
355 endc
356
357 ifne enable_part_motherboard
358 include mobo.s
359 endc
360
361 ifne enable_part_outrun
362 include outrun.s
363 endc
364
365 ifne enable_part_credits
366 include credits.s
367 endc
368
369 SECTION TEXT
370
371 text_end
372
373 text_size equ text_end-text_start
374
375 SECTION DATA
376
377 even
378
379 ; Some black area that Will always contains 000 (which is why it is in DATA and not in BSS)
380 ; can be used for erasing, and space character definition
381 ; Required space is:
382 ; - 32 bytes for a palette (16 words)
383 ; - 64 bytes for a fullregister clearing (16 long words)
384 ; - 128 bytes for a space character: 16 lines by 4 bytes by 2 columns
385 black_palette dcb.l 32
386 white_palette dcb.w 16,$fff
387
388 PtrSequencer
389 dc.l Sequencer
390
391 Sequencer
392 ifne enable_part_loadingdone
393 dc.l LoadDoneInit,LoadDonePlay,LoadDoneTerminate,0
394 endc
395
396 ifne enable_part_tvsnow
397 dc.l TvSnowInit,TvSnowPlay,TvSnowTerminate,0
398 endc
399
400 ifne enable_part_piracy
401 dc.l PiracyInit,PiracyPlay,PiracyTerminate,PiracySequencer
402 endc
403
404 ifne enable_part_cinemascope
405 dc.l CinemaScopeInit,CinemaScopePlay,CinemaScopeTerminate,CinemascopeSequencer
406 endc
407
408 ifne enable_part_nightcity
409 dc.l DisplayNightCityInit,DisplayNightCityPlay,DisplayNightCityTerminate,NightCitySequencer
410 endc
411
412 ifne enable_part_motherboard
413 dc.l MotherBoardInit,MotherBoardPlay,MotherBoardTerminate,AtariBuildingSequencer
414 endc
415
416 ifne enable_part_outrun
417 dc.l OutrunInit,OutrunPlay,OutrunTerminate,OutrunSequencer
418 endc
419
420 ifne enable_part_insertdisk
421 dc.l InsertDiskInit,InsertDiskPlay,InsertDiskTerminate,BootDiskSequencer
422 endc
423
424 ifne enable_part_office
425 dc.l DesktopOfficeInit,DesktopOfficePlay,DesktopOfficeTerminate,DesktopOfficeSequencer
426 endc
427
428 ifne enable_part_chatroom
429 dc.l ChatRoomInit,ChatRoomPlay,ChatRoomTerminate,ChatRoomSequencer
430 endc
431
432 ifne enable_part_credits
433 dc.l CreditsInit,CreditsPlay,CreditsTerminate,0
434 endc
435
436 ; The end
437 dc.l 0,0,0
438
439
440 ; ===========================================================================
441 ;
442 ; Tables, palettes, and other dc.x thingies
443 ;
444 ; ===========================================================================
445
446 NotASteMessage
447 dc.b "This demo works only on STE or MegaSTE",0
448
449 even
450
451 data_end
452
453 data_size equ data_end-data_start
454
455 SECTION BSS
456
457 even
458
459 ds.l stack_size
460 my_stack ds.l 1
461
462 even
463
464 empty_line ds.b 256+230 ; Some empty bytes to have something "clean" to display during the sync line
465
466 even
467
468
469 big_buffer_start ds.l (big_buffer_size+3)/4
470 big_buffer_end
471
472
473 bss_end ds.l 1
474
475 bss_size equ bss_end-bss_start
476
477 ;
478 ; 0000574E T R text_end -> 25780 (was 102528,115754,39372,21174,23612,22350)
479 ; 00000000 T R text_start
480 ;
481 ; 000BA702 D R data_end -> 763028 (was 1193668,803840,803956,803982,767264,763650)
482 ; 00000000 D R data_start
483 ;
484 ; Total Disk = 788808
485 ;
486 ; 00118DEC B R bss_end -> 1158298 (was 635528,1297968,1340524,1175250,1150444)
487 ; 00000000 B R bss_start
488 ;
489 ; Total memory usage = 1947106
490 ;
491
492 end
493

  ViewVC Help
Powered by ViewVC 1.1.26