home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser 2002 January / STC_CD_01_2002.iso / SCENE / IMATROLL / SRC / MAIN.S < prev    next >
Text File  |  2001-12-11  |  8KB  |  328 lines

  1. ; oOOOOOOOo     oOOo     oOOo  oOOOOOOOOOOo
  2. ; OOOO   OOOo   OOOO     OOOO  OOOOO
  3. ; OOOO    OOOo  OOOO     OOOO  OOOOO                      
  4. ; OOOOOo  OOOO  OOOOOOOOOOOOO  OOOOOOOOOOOo             
  5. ; OOOOOO  OOOO  OOOOOo   OOOO        OOOOOO            
  6. ; OOOOOO  OOOO  OOOOOO   OOOO        OOOOOO
  7. ; OOOOOO  OOOO  OOOOOO   OOOO        OOOOOO
  8. ; OOOOOO OOOO   OOOOOO   OOOO        OOOOOO
  9. ; OOOOOOOOO     OOOOOO   OOOO  oOOOOOOOOOOO
  10. ;
  11. ; Dead Hackers Society Falcon Demoshell v13
  12. ; April 8, 2000
  13. ;
  14. ; Anders Eriksson
  15. ; ae@dhs.nu
  16. ;
  17. ; soundtracker replay: Bitmaster / TCE
  18. ; video save/restore : Aura & Mugwumps
  19. ;
  20. ; Slightly modified for Alive issue one in November 2000.
  21. ; Light Version (no mp2 replay, ice decrunch, 2 video modes, 
  22. ; no startup menu,...) by Matt'US Alem
  23. ;
  24. ; Please notice that this demosys is made for use within DHS
  25. ; and the way we like it to work. It might be total crap
  26. ; for others, then instead of flaming us, just erase it :)
  27. ;
  28. ; This is the main routine to run the I AM A TROLL demo
  29. ; Coded by Matt'US Alem at the ParaCon III (31/11/2001)
  30. ; look at the includes...
  31. ;
  32. ; main.s
  33.  
  34.         output    .app
  35.  
  36.         opt    p=68030/68882    ;68030+68882 code allowed
  37.         comment HEAD=%111        ;fastload/loadalt/mallocalt = ON
  38.                     ;setup max screensize used in the demo
  39. scr_w:        equ    320        ;width  (x - in pixels)
  40. scr_h:        equ    240        ;height (y - in pixels)
  41. scr_d:        equ    2        ;depth  (in bytes)
  42.  
  43. dspmodmusic:    equ    1        ;1 = use dspmod music
  44.  
  45.  
  46. ; --------------------------------------------------------------
  47.         section    text
  48. ; --------------------------------------------------------------
  49.  
  50.         include    'sys\init.s'    ;init demosshell
  51.  
  52.  
  53. ; --------------------------------------------------------------
  54. ;        mainloop 
  55. ; --------------------------------------------------------------
  56.  
  57. mainloop:
  58.         tst.l    vblsync        ;vbl wait mode
  59.         bne.s    .always        ;
  60.  
  61. .firstonly:        tst.w    vblwait        ;wait for first vbl only
  62.         beq.s    .done        ;
  63.         clr.w    vblwait        ;
  64.         bra.s    .waitdone        ;
  65.  
  66. .always:        move.w    .var,d0        ;wait for next vbl always
  67.         cmp.w    vblwait,d0        ;
  68.         beq.s    .done        ;
  69.  
  70.  
  71. .waitdone:        move.l    main_routine,a0    ;main routine
  72.         jsr    (a0)        ;
  73.  
  74.         move.w    vblwait,.var    ;later use
  75.  
  76. .nah:
  77.         cmp.l    #2,swapscreens    ;number of screens to cycle
  78.         blt.s    .done        ;
  79.         lea.l    screen_adr1,a0    ;
  80.         bgt.s    .swap3        ;
  81.  
  82. .swap2:        move.l    (a0),d0        ;cycle 2 screens
  83.         move.l    4(a0),(a0)+        ;
  84.         move.l    d0,(a0)        ;
  85.         bra.s    .done        ;
  86.  
  87. .swap3:        move.l    (a0),d0        ;cycle 3 screens
  88.         move.l    4(a0),(a0)+        ;
  89.         move.l    4(a0),(a0)+        ;
  90.         move.l    d0,(a0)        ;
  91.  
  92. .done:
  93.         
  94.         cmp.b    #$39,$fffffc02.w    ;exit
  95.         bne.w    mainloop        ;
  96.         bra.w    exit        ;
  97.  
  98. .var:        ds.w    1
  99.  
  100.  
  101.  
  102. ; --------------------------------------------------------------
  103. ;        vbl 50-100 Hz
  104. ; --------------------------------------------------------------
  105.  
  106. vbl:        movem.l    d0-a6,-(sp)
  107.  
  108.         cmp.l    #2,swapscreens    ;set screen_adr
  109.         bge.s    .no         ;
  110.         move.l    screen_adr,d0    ;single set
  111.         cmp.l    .var,d0        ;
  112.         beq.s    .noset        ;
  113.         move.l    d0,.var        ;
  114.         bra.s    .set        ;
  115.  
  116. .no:         move.l    screen_adr1,d0    ;double/tripple set
  117.         cmp.l    .var,d0        ;
  118.         beq.s    .noset        ;
  119.         move.l    d0,.var        ;
  120.  
  121. .set:        move.l    d0,d1        ;set screen
  122.         lsr.w    #8,d0        ;
  123.         move.l    d0,$ffff8200.w    ;
  124.         move.b    d1,$ffff820d.w    ;
  125.  
  126. .noset:        move.l    vbl_routine,a0    ;vbl
  127.         jsr    (a0)        ;
  128.  
  129.         addq.w    #1,vblwait        ;inc vbl
  130.  
  131.         bsr.w    dspmod_vbl            ;modplayer
  132.  
  133. .done:        movem.l    (sp)+,d0-a6
  134.         rte
  135.  
  136. .var:        ds.l    1
  137.  
  138.  
  139.  
  140. ; --------------------------------------------------------------
  141. ;        timer-d 100 Hz
  142. ; --------------------------------------------------------------
  143.  
  144. timer_d:        movem.l    d0-a6,-(sp)
  145.  
  146.         move.l    current_fx,a0        ;current position
  147.         lea.l    vbl_routine,a1        ;routinelist
  148.         subq.l    #1,(a0)+            ;dec
  149.         bne.s    .done            ;0=next part
  150.         add.l    #24,current_fx        ;next part
  151. .done:        move.l    (a0)+,a2            ;timer routine
  152.         move.l    (a0)+,(a1)+            ;vbl routine
  153.         move.l    (a0)+,(a1)+            ;main routine
  154.         move.l    (a0)+,(a1)+            ;screens to cycle
  155.         move.l    (a0),(a1)            ;vblwait type
  156.  
  157.         jsr    (a2)            ;timer routine
  158.  
  159.  
  160. .done2:        movem.l    (sp)+,d0-a6
  161.         bclr    #4,$fffffa11.w        ;clear busybit
  162.         rte
  163.  
  164.  
  165.  
  166. ; --------------------------------------------------------------
  167. ;        subroutines & includes
  168. ; --------------------------------------------------------------
  169.  
  170. dummy:        rts
  171.  
  172. blackpal:        lea.l    $ffff9800.w,a0        ;black palette
  173.         move.w    #256-1,d7            ;
  174. .loop:        clr.l    (a0)+            ;
  175.         dbra    d7,.loop            ;
  176.         rts                ;
  177.  
  178.  
  179.         include    'sys\exit.s'        ;exit routines
  180.         include    'sys\video.s'        ;light videolib
  181.         include    'sys\loader.s'        ;loader rout
  182.         include    'sys\dspmod.s'                    ;
  183.  
  184.         include    'tc_line.s'            ;trace lines 
  185.         include    '3d.s'            ;3D rotation engine
  186.         include    'logo.s'            ;TC logo
  187.         include    'com_eff.s'            ;fade, text effect...
  188.         include    'rotozoom.s'        ;rotozoomer
  189.         include    'flame.s'            ;flame effect
  190.  
  191.  
  192. ; --------------------------------------------------------------
  193.         section    data
  194. ; --------------------------------------------------------------
  195.  
  196.         even
  197.  
  198.  
  199. ; videomode settings
  200. ; see video.s for available resolutions and how to set them
  201.  
  202. monitor:        dc.w    0            ;0=vga 1=rgb/tv (init.s auto detect)
  203.  
  204. vga_freq:        dc.w    60            ;60/100 Hz
  205. rgb_freq:        dc.w    50            ;50/60 Hz
  206.  
  207. detail:        dc.w    1            ;0=low 1=high
  208.  
  209.  
  210. ; initroutines to run before demo starts
  211. ; list ends with dc.l 0
  212.  
  213. inits:
  214.         dc.l    video_2            ;set resolution
  215.         dc.l    blackpal            ;black palette
  216.  
  217.         dc.l    dspmod_load            ;load module/reserve mem
  218.         dc.l    dspmod_begin        ;init musicroutine                        ;
  219.         dc.l    init_fade            ;create fade table
  220.         dc.l    Init_rotozoomer        ;create texture
  221.         dc.l    init_3Drot            ;create mul tables
  222.         dc.l    Init_Flame1            ;create text logo
  223.         dc.l    Init_Flame2            ;bis
  224.  
  225.         dc.l    0
  226.  
  227.  
  228. ; demoparts list
  229. ;
  230. ; dc.l ticks,timer,vbl,main,screens,vblwait
  231. ;
  232. ;       ticks : 100Hz frames to run part
  233. ;       timer : address to timer routine
  234. ;         vbl : address to vbl routine
  235. ;        main : address to main routine
  236. ;     screens : number of screens to cycle. valid options:
  237. ;                  1 = singlebuffer
  238. ;                  2 = doublebuffer
  239. ;                  3 = tripple buffer
  240. ;                  lower vales are treated as single buffer and
  241. ;                  higher values as tripple buffer
  242. ;        vblwait : mainloop wait for vbl.
  243. ;                  0 = waitvbl only if efx <1vbl (valid for tripbuf only)
  244. ;                  1 = always waitvbl
  245.  
  246. demo_parts:
  247. ;
  248. ; 505 music breakpoints (in sec) : 0s 11s 31s
  249. ;        
  250.         dc.l    20,dummy,video_5,buffers_clear,1,1    ;set res=320x200xTC
  251.     
  252.         dc.l    300,dummy,dummy,intro_text,1,1
  253.  
  254.         dc.l    250,dummy,dummy,table_fade,1,1
  255.  
  256.         dc.l    520,dummy,dummy,copy_logo1,1,1
  257.  
  258.         dc.l    300,dummy,dummy,table_fade,1,1
  259.  
  260.         dc.l    2425,dummy,dummy,Main_RZ,1,1
  261.  
  262.         dc.l    300,dummy,dummy,table_fade,1,1
  263.         
  264.         dc.l    20,dummy,video_5,buffers_clear,1,1
  265.         
  266.         dc.l    30,dummy,dummy,sb3D_back,2,1
  267.         dc.l    2440,dummy,dummy,sb3D_Main,2,1
  268.  
  269.         dc.l    300,dummy,dummy,table_fade,1,1
  270.  
  271.         REPT 2
  272.         dc.l    500,dummy,dummy,FlameCredits,1,1
  273.         dc.l    500,dummy,dummy,Text_Flames1,1,1
  274.         dc.l    500,dummy,dummy,FlameCredits,1,1
  275.         dc.l    500,dummy,dummy,Text_Flames2,1,1
  276.         ENDR
  277.  
  278.         dc.l    300,dummy,dummy,table_fade,1,1
  279.  
  280.         dc.l    300,dummy,dummy,credits1,1,1
  281.         dc.l    300,dummy,dummy,table_fade,1,1
  282.  
  283.         dc.l    300,dummy,dummy,credits2,1,1
  284.         dc.l    300,dummy,dummy,table_fade,1,1
  285.         
  286.         dc.l    300,dummy,dummy,credits3,1,1
  287.         dc.l    300,dummy,dummy,table_fade,1,1
  288.  
  289.         dc.l    300,dummy,dummy,credits4,1,1
  290.         dc.l    300,dummy,dummy,table_fade,1,1
  291.         
  292.         dc.l    300,dummy,dummy,endtext,1,1
  293.         dc.l    700,dummy,dummy,table_fade,1,1
  294.  
  295.         dc.l    -1,dummy,dummy,exit,1,1            ;exit
  296.  
  297.  
  298. current_fx:        dc.l    demo_parts                ;current
  299. vbl_routine:    dc.l    dummy                    ;vbl
  300. main_routine:    dc.l    dummy                    ;main
  301. swapscreens:    ds.l    1                    ;screens
  302. vblsync:        ds.l    1                    ;vblwait
  303.  
  304.  
  305.  
  306. ; --------------------------------------------------------------
  307.         section    bss
  308. ; --------------------------------------------------------------
  309.  
  310.         even
  311.  
  312. runlevel:        ds.w    1
  313. vblwait:        ds.w    1                    ;for fx in less than 1vbl
  314. screen_adr1:    ds.l    1                    ;screen address 1
  315. screen_adr:                            ;WORK ADDRESS!
  316. screen_adr2:    ds.l    1                    ;screen address 2
  317. screen_adr3:    ds.l    1                    ;screen address 3
  318. save_stack:        ds.l    1                    ;old stackpointer
  319. save_timer_d:    ds.l    1                    ;old timer-d
  320. save_vbl:        ds.l    1                    ;old vbl
  321. save_mfp:        ds.l    1                    ;old mfp
  322. save_dta:        ds.l    1                    ;old dta address
  323. save_pal:        ds.l    256+8                    ;old colours (falcon+st/e)
  324. save_video:        ds.b    32+12+2                    ;videl save
  325. save_keymode:    ds.w    1                    ;old keyclick mode
  326. dta:        ds.l    11                    ;new dta buffer
  327.  
  328.         end