home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / falcon / program / jagdem_s / source / jag_demo.s < prev    next >
Text File  |  1994-03-31  |  26KB  |  846 lines

  1. * THE JAGUAR DEMO!
  2.  
  3. ; Code by Genie and EGB's Smelly Sox!
  4. ; Music by Metronome of Adrenalin!
  5. ; Mod replay by Bitmaster of BSW!
  6. ; This code is (c) 1994 PB Productions!
  7.  
  8. ; Uses Devpac for the odd bit of 68030 code, uses tabs = 8
  9.  
  10.  
  11. DEVPAC_RUN    equ    1    < 1 = run from Devpack!
  12.  
  13. SCANLINE_TEST    equ    0    < if 1, shows about of vbl time left
  14.  
  15. ; A few system variables.
  16.  
  17. c256regs    equ    $ffff9800
  18. vidhimid    equ    $ffff8200
  19. vidlo        equ    $ffff820d
  20. timer        equ    $468
  21. keyclick    equ    $484
  22.  
  23.     IFNE    DEVPAC_RUN
  24. FILED    equ    0
  25.     ELSE
  26. FILED    equ    1
  27.     ENDC
  28.  
  29.     IFNE    FILED
  30.     opt    d-
  31.     output    jag_demo.prg
  32.     ENDC
  33.  
  34. main    pea    0
  35.     move    #$20,-(sp)
  36.     trap    #1
  37.     move.l    d0,oldstack
  38.     addq.l    #6,sp
  39.     lea    newstack,a7        < Use our own stack
  40.  
  41.     move.l    $44e.w,oldscr
  42.     move    #4,-(sp)        < We now know this doesn't work!
  43.     trap    #14              (We thought it would give us
  44.     addq.l    #2,sp               the current video mode!)
  45.     move    d0,oldmode
  46.     andi    #%1111111111111000,d0    < Keep all the old values   : This was discovered by accident.
  47.     ori    #%0000000000000100,d0    < Put into true-colour mode : We're much better at it now!
  48.     movem.l    front,d6-d7        { 
  49.     clr.b    d6            { --- Yes this is bad, but we didn't
  50.     clr.b    d7            {     know about the "careful
  51.     movem.l    d6-d7,front        {     boundry" trick!
  52.     move.l    d6,a6
  53.     move    d0,-(sp)        < Set screen
  54.     move    #3,-(sp)
  55.     pea    (a6)
  56.     pea    (a6)
  57.     move    #5,-(sp)
  58.     trap    #14
  59.     lea    14(sp),sp
  60.     clr.l    (c256regs).w        < Set border col to black
  61.  
  62.     bsr    swap_screen
  63.     lea    start_screen,a0        < Convert Degas PI1 pic
  64.     bsr    convert_to_true_colour    < to true colour screen
  65.     bsr    swap_screen
  66.     bsr    save_ints
  67.     bsr    key_int_on        < Set up keyboard interrupt
  68.     lea    module,a6        < Start the music.
  69.     bsr    muson            <
  70.     bsr    set_ints        < Start demo interrupts
  71.  
  72. * SLIDESHOW BIT
  73.  
  74. * The following loop just pulls out the address of a pic and displays
  75. * it. This process repeats until there aren't any piccies left.
  76.  
  77. .loop    move.l    pic_ptr,a0        Get piccy pointer
  78.     move.l    (a0)+,d0        Get address of piccy
  79.     cmpi.l    #-1,d0            At end of list?
  80.     beq.s    .wait
  81.     move.l    a0,pic_ptr         If not, save piccy pointer
  82.     move.l    d0,a0            {
  83.     move.l    back,a1            {-- Depack piccy to "back" screen.
  84.     bsr    depack            {
  85.     move    #250,(timer).w        Set 5 sec delay after fade
  86.     move.b    #1,do_next        Set "fade in progress" flag on
  87.     move.l    #start_fade_vbl,$70.w    Start fade
  88.     clr.b    keybuff
  89.  
  90. .key    cmp.b    #$39,keybuff        {
  91.     beq.s    .wait            {-- Tes for space bar or left
  92.     tst.b    mouse_buttons        {   mouse button.
  93.     bne.s    .wait            {
  94.     tst.b    do_next            Ready for next pic?
  95.     beq.s    .loop             If so, do pic
  96.     bra.s    .key             Otherwise wait test keys again
  97.  
  98. * PLASMA BIT
  99. ; This just waits for either the space bar or left mouse button before
  100. ; exiting the program
  101.  
  102. .wait
  103.     move.l    back,a0
  104.     adda.l    #(35*640)+(95*2)+2,a0
  105.     move.l    a0,old_pos
  106.     bsr    clr_screen        Nice "wipe" effect.
  107.     move.l    #plasma_vbl,$70.w    Start plasma.
  108.  
  109.     clr.b    mouse_buttons
  110.     clr.b    keybuff
  111.  
  112. .key3    cmp.b    #$39,keybuff        {
  113.     beq.s    .wait2            {-- Test for space bar or
  114.     tst.b    mouse_buttons        {   Left mouse button.
  115.     beq.s    .key3            {
  116.  
  117. .wait2    bsr    ret_ints        < Restore interrupts
  118.     bsr    musoff            < Switch music off
  119.     bsr    key_int_off        < Restore keyboard routines
  120.  
  121.     IFEQ    FILED
  122.     move    oldmode,-(sp)        If running from Devpac
  123.     move    #3,-(sp)        restore screen and exit.
  124.     move.l    oldscr,-(sp)
  125.     move.l    oldscr,-(sp)
  126.     move    #5,-(sp)
  127.     trap    #14
  128.     lea    14(sp),sp
  129.  
  130.     move.l    oldstack,-(sp)
  131.     move    #$20,-(sp)
  132.     trap    #1
  133.     move.l    d0,oldstack
  134.     addq.l    #6,sp
  135.     move    #34,-(sp)
  136.     trap    #14
  137.     addq.l    #2,sp
  138.     clr    -(sp)
  139.     trap    #1
  140.     ELSE
  141.     move.l    4,a0            < Otherwise, do warm reset!
  142.     jmp    (a0)              (Only because we couldn't restore mode properly!)
  143.     ENDC
  144.  
  145.         ds.l    100
  146. newstack    ds.l    1        < Our own stack
  147. oldstack    ds.l    1        < The old stack
  148.  
  149. * Save interrupts
  150.  
  151. save_ints
  152.     lea    ints,a0            < Not very much to save here!
  153.     move.l    $70.w,(a0)+          (All the other are saved by their own custom routines.)
  154.     rts
  155.  
  156. ints
  157. .old70    ds.l    1
  158. .olda07    ds.b    1
  159. .olda09    ds.b    1
  160.     even
  161.  
  162. * Set interrupts
  163.  
  164. set_ints
  165.     move    #$2700,sr
  166.     bclr    #0,(keyclick).w     Switch off keyclick
  167.     move    #200,(timer).w        Wait 4 secs at start of demo. (For title page)
  168.     move.l    #do_nothing_vbl,$70.w    Start off doing nothing.
  169.     move    #$2300,sr        Start interrupts
  170.     move.b    #1,do_next        {
  171. .loop    tst.b    do_next            {-- Wait until 4 secs are up.
  172.     bne.s    .loop            {
  173.     rts
  174.  
  175. * Restore interrupts
  176.  
  177. ret_ints
  178.     move    #$2700,sr
  179.     bset    #0,(keyclick).w        Keyclick back on
  180.     lea    ints,a0
  181.     move.l    (a0)+,$70.w        Restore lone interrupt
  182.     move    #$2300,sr
  183.     rts
  184.  
  185. * Converts a PI1 picture to a true colour display
  186. ; In the first part, we get the pallete, and convert into it's trucol
  187. ; equivalent. Then we get each pixel from the picture (In plane mode-
  188. ; not very easy!) and use as an index to plot the right colour from
  189. ; the converted pallette onto the screen. Sounds harder than it
  190. ; actually is.
  191.  
  192. ; a0 = the Degas PI1 file.
  193.  
  194. ; First, we convert the colours.
  195.  
  196. convert_to_true_colour
  197.     lea    2(a0),a1        < a1 = picture pallette
  198.     lea    .tru_colours,a2        < a2 = converted trucol pallette
  199.     moveq    #16-1,d0
  200. .colours
  201.     moveq    #0,d1            {
  202.     move.l    d1,d2            {-- clear d1-d3
  203.     move.l    d1,d3            {
  204.     move    (a1)+,d1        Get colour from Degas pic
  205.     move    d1,d2            {-- Copy into d2-d3
  206.     move    d1,d3            {
  207.     and    #$700,d1        Isolate R bits in d1 (%-----RRR--------)
  208.     and    #$70,d2            "     " G "     " d2 (%---------GGG----)
  209.     and    #$7,d3            "     " B "     " d3 (%-------------BBB)
  210.     lsl    #5,d1            Convert to trucol R  (%RRRRR-----------)
  211.     lsl    #4,d2            Convert to trucol G  (%-----GGGGGG-----)
  212.     lsl    #2,d3            Convert to trucol B  (%-----------BBBBB)
  213.     or    d2,d1            add G bits to R bits
  214.     or    d3,d1            add B bits to R + G bits (Now d1 = trucol RGB value)
  215.     move    d1,(a2)+        Save converted trucol value in new pallette
  216.     dbf    d0,.colours        Repeat for other colours
  217.  
  218. ; Now we convert the picture.
  219.  
  220.     lea    $22(a0),a1        < a1 = Degas lo-res pic data
  221.     move.l    back,a2            < a2 = Address of trucol pic to draw.
  222.     lea    .tru_colours,a3        < a3 = trucol "pallette"
  223.  
  224. ; Each line of the pic is set out into 20 segments of 4 video planes.
  225.  
  226.     move.l    #(20*200)-1,d0
  227. .planes    movem.w    (a1)+,d2-d5        < Get 1 segment of 4 planes
  228.     move    #16-1,d1        < There's 16 pixels per segment.
  229. .pixels    moveq    #0,d6            < d6 = resultant colour number.
  230.     lsl.w    #1,d5            shift 4th plane 1 to left (Result bit in extend flag)
  231.     roxl    #1,d6            shift extend flag into colour number            
  232.     lsl.w    #1,d4            shift 3rd plane 1 to left (Result bit in extend flag)
  233.     roxl    #1,d6            shift extend flag into colour number            
  234.     lsl.w    #1,d3            shift 2nd plane 1 to left (Result bit in extend flag)
  235.     roxl    #1,d6            shift extend flag into colour number            
  236.     lsl.w    #1,d2            shift 1st plane 1 to left (Result bit in extend flag)
  237.     roxl    #1,d6                shift extend flag into colour number (now d6= colour number!)
  238.     move    (a3,d6.w*2),(a2)+    Get colour from pallete, and plot on trucol screen
  239.     dbf    d1,.pixels        Do for next pixel
  240.     dbf    d0,.planes        Repeat for all segments.
  241.     rts
  242.  
  243. .tru_colours
  244.     ds.w    16            < trucolour pallete
  245.  
  246. * This vbl interrupt does nothing except count off a timer.
  247.  
  248. do_nothing_vbl
  249.     bsr    next
  250.     rte
  251.  
  252. next    subq.w    #1,(timer).w
  253.     beq.s    .bye
  254.     rts
  255. .bye    clr.b    do_next
  256.     rts
  257. do_next    ds.b    1
  258.     even
  259.  
  260. * This vbl rout starts the fading process.
  261. ; For each vbl coming up, increasing columns of trucolour RAM in the front
  262. ; picture are faded into the corresponding pixels in the back picture,
  263. ; until there are 32 columns being faded at once. Since it takes 32 fades
  264. ; maximum for a single pixel in the front screen to be faded into the
  265. ; back screen, then we should end up with a fading bar which can be
  266. ; dragged across the screen in the next vbl routine
  267.  
  268. start_fade_vbl
  269.     clr    line_count            < Start with 1 line
  270.     move.l    #fade1_vbl,$70.w        < Next vbl is slightly below
  271.     movem.l    front,a0/a1            < a0 = front, a1 = back screen
  272.     adda.l    #(319*2),a0            {-- Go to top right of screen
  273.     adda.l    #(319*2),a1            {   (319 pixels * 2 bytes)
  274.     movem.l    a0/a1,f_start            < fading starts there
  275.  
  276. fade1_vbl
  277.     IFNE    SCANLINE_TEST
  278.     eori.l    #$ffff00ff,(c256regs).w
  279.     ENDC
  280.     movem.l    d0-a6,-(sp)
  281.     cmp    #32-1,line_count        Is there 32 lines being drawn?
  282.     beq.s    .bye                 If so, install next vbl routine
  283.     moveq    #0,d7
  284.     movem.l    f_start,a0/a1            Get start of fading bar.
  285.     move.l    a0,a2                {-- Save starts for later
  286.     move.l    a1,a3                {
  287.     move    line_count,d7            For d7= 1 to line_count
  288. .loop    bsr    fade_line             Fade a whol column of pixels.
  289.     dbf    d7,.loop
  290.     add    #1,line_count            Increase the no of columns for next time.
  291.     subq.l    #2,a2                {-- Move fade bar 1 to the left
  292.     subq.l    #2,a3                {
  293.     movem.l    a2/a3,f_start            Save new start of fading bar.
  294.     bsr    key                Check keys.
  295.     bra.s    .ok
  296. .bye    move.l    #fade2_vbl,$70.w        < If 32 lines, next vbl is a new routine
  297. .ok    movem.l    (sp)+,d0-a6
  298.     IFNE    SCANLINE_TEST
  299.     eori.l    #$ffff00ff,(c256regs).w
  300.     ENDC
  301.     rte
  302.  
  303. f_start        ds.l    2
  304.  
  305. line_count    ds.w    1
  306.  
  307. * This vbl routine moves the 32 wide fade bar across the screen.
  308. ; There are 32X200 fade operations being carried out each time. This
  309. ; is why the fade is so slow!
  310.  
  311. fade2_vbl
  312.     IFNE    SCANLINE_TEST
  313.     eori.l    #$ff000000,(c256regs).w
  314.     ENDC
  315.     movem.l    d0-a6,-(sp)
  316.     movem.l    f_start,a0/a1        Get the start of the fading bar.
  317.     movem.l    front,a2        {-- Has it hit the left of the screen yet?
  318.     cmpa.l    a0,a2            {
  319.     beq.s    .bye             If so, set the end-of-fade bit in motion.
  320.     move.l    a0,a2            {-- save fade starts for later.
  321.     move.l    a1,a3            {
  322.     move.l    #32-1,d7        For d7= 1 to 37
  323. .loop    bsr    fade_line         Fade a column
  324.     dbf    d7,.loop
  325.     subq.l    #2,a2            {-- Move fade bar left 1 pixel
  326.     subq.l    #2,a3            {
  327.     movem.l    a2/a3,f_start        Save new fade bar start.
  328.     bsr    key            Check keys
  329.     bra.s    .ok
  330. .bye    move.l    #fade3_vbl,$70.w    If at left hand side, next vbl is end-of-fade bit.
  331.     sub    #1,line_count
  332. .ok    movem.l    (sp)+,d0-a6
  333.     IFNE    SCANLINE_TEST
  334.     eori.l    #$ff000000,(c256regs).w
  335.     ENDC
  336.     rte
  337.  
  338. * This is the final part of the fade, when the fading bar hits the left
  339. ; hand side of the screen. The last 32 columns are faded off.
  340.  
  341. fade3_vbl
  342.     IFNE    SCANLINE_TEST
  343.     eori.l    #$ff0000,(c256regs).w
  344.     ENDC
  345.     movem.l    d0-a6,-(sp)
  346.     tst    line_count            Are we at zero lines yet?
  347.     bmi.s    .bye                 If so, fade is finished.
  348.     movem.l    front,a0/a1            Fading always starts here at left of screen.
  349.     move    line_count,d7            For d7= 1 to line_count    
  350. .loop    bsr    fade_line             Fade a column
  351.     dbf    d7,.loop
  352.     sub    #1,line_count            Decrease the number of lines to fade
  353.     bsr    key                Check for keypress
  354.     bra.s    .ok
  355. .bye    move.l    #do_nothing_vbl,$70.w        If fade is finished, do nothing
  356. .ok    movem.l    (sp)+,d0-a6
  357.     IFNE    SCANLINE_TEST
  358.     eori.l    #$ff0000,(c256regs).w
  359.     ENDC
  360.     rte
  361.  
  362. * This subroutine is used by the vbl to check if either the space bar
  363. ; the left hand mouse button has been pressed. This is used in case the
  364. ; vbl interrupt takes longer then it should!
  365.  
  366. key    tst.b    mouse_buttons
  367.     bne.s    .pressed
  368.     cmp.b    #$39,keybuff
  369.     bne.s    .end
  370. .pressed                ; {-- If keys press, install
  371.     move.l    #do_nothing_vbl,$70.w      {   a less time consuming vbl!
  372. .end
  373.     rts
  374.  
  375. * This fades a whole column (200 pixels high) by basically calling
  376. ; the "fade pixel" subroutine for each of the pixels!
  377.  
  378. fade_line
  379.     movem.l    a0/a1,-(sp)
  380.     move.l    #200-1,d6
  381. .loop    bsr    fade_tru_pix
  382.     lea    638(a0),a0
  383.     lea    638(a1),a1
  384.     dbf    d6,.loop
  385.     movem.l    (sp)+,a0/a1
  386.     addq.l    #2,a0
  387.     addq.l    #2,a1
  388.     rts
  389.  
  390. * Fadeit - true colour versh, coded by <Genie!> of Network Trash.
  391. ; Obviously it only works on single pixels!
  392. ;
  393. ; a0 = pointer to colour to change
  394. ; a1 = pointer to target colour
  395.  
  396. fade_tru_pix
  397. .red    moveq    #0,d1            {
  398.     move.l    d1,d2            { --- Clear regs d1-d4
  399.     move.l    d1,d3            {
  400.     move.l    d1,d4            {
  401.     move    (a1)+,d1        Get target pixel
  402.     move    (a0),d2            Get pixel to change
  403.     cmp    d1,d2            If pixel colour the same?
  404.     beq.s    .bye             If so, don't bother- we've finished!
  405.     move    d1,d3            {
  406.     move    d2,d4            { --- Isolate R bits
  407.     andi    #%1111100000000000,d3    {
  408.     andi    #%1111100000000000,d4    {
  409.     cmp.l    d3,d4            Are the R bits the same?
  410.     beq.s    .rok             If so, try the G bits.
  411.     bgt.s    .rsub             If the target pixel has smaller amount of red-|
  412. .radd    addi    #%0000100000000000,d2    Otherwise add an element of red.           |
  413.     bra.s    .rok                                       |
  414. .rsub    subi    #%0000100000000000,d2     ... take away an element of red. <------------|
  415. .rok
  416. .green    move    d1,d3            {
  417.     move    d2,d4            { --- Isolate G bits
  418.     andi    #%11111000000,d3    {
  419.     andi    #%11111000000,d4    {
  420.     cmp.l    d3,d4            Are the G bits the same?
  421.     beq.s    .gok             If so, try the B bits.
  422.     bgt.s    .gsub             If the target has smaller amount of green-----|
  423. .gadd    add    #%00001000000,d2     Otherwise add an element of green.           |
  424.     bra.s    .gok                                       |
  425. .gsub    subi    #%00001000000,d2     ... take away an element of green. <----------|
  426. .gok
  427. .blue    move    d1,d3            {
  428.     move    d2,d4            { --- Isolate B bits
  429.     andi    #%11111,d3        {
  430.     andi    #%11111,d4        {
  431.     cmp.l    d3,d4            Are the B bits the same?
  432.     beq.s    .bok             If so, finish.
  433.     bgt.s    .bsub             If the target has smaller amounts of blue-----|
  434. .badd    addq.l    #1,d2             Otherwise add an element of blue.           |
  435.     bra.s    .bok                                       |
  436. .bsub    subq.l    #1,d2             ... take away an element of blue. <-----------|
  437. .bok    move    d2,(a0)+        Put changed pixel on screen.
  438.     rts
  439. .bye    addq.l    #2,a0
  440.     rts
  441.  
  442.  
  443. * PLASMA VBL ROUTINE.
  444. ; Yes, this is the vbl routine for the plasma bit at the end.
  445. ; As you can guess, it's a trucolour plasma with scroller. It's not very
  446. ; good though, since it uses software scrolling, and so it only happens
  447. ; in a small square of the screen! Perhaps I should have used hardware
  448. ; scrolling?
  449.  
  450. plasma_vbl
  451.     IFNE    SCANLINE_TEST
  452.     eori.l    #$ff,(c256regs).w
  453.     ENDC
  454.     movem.l    d0-a6,-(sp)
  455.     bsr    swap_screen            < Guess what?
  456.     bsr    do_plasma            < Guess!
  457.     bsr    scroller            < This is hard to understand!
  458.     bsr    next
  459.     movem.l    (sp)+,d0-a6
  460.     IFNE    SCANLINE_TEST
  461.     eori.l    #$ff,(c256regs).w
  462.     ENDC
  463.     rte
  464.  
  465.  
  466. * Guess what- it swaps the front and back screen!
  467.  
  468. swap_screen
  469.     move.l    back,d0            {
  470.     move.l    front,back        { --- Swap values "front" <-> "back"
  471.     move.l    d0,front        {
  472.     move.l    d0,d1
  473.     lsr.w    #8,d0
  474.     move.l    d0,(vidhimid).w        { --- Set video base address of screen.
  475.     move.b    d1,(vidlo).w        {
  476.     rts
  477.     
  478.  
  479. * Well, this does more than a clear screen! It clears it to a gradiated
  480. ; true-colour background!
  481.  
  482. clr_screen
  483.     movem.l    front,a0-a1        < a0 = front screen, a1 = back screen
  484.     add.l    #(199*640),a0        { --- go to end of both screens
  485.     add.l    #(199*640),a1        {
  486.     move.l    #100-1,d0        For first 100 lines do
  487. .loop    move.l    a0,a2             
  488.     move.l    a1,a3
  489.     move.l    d0,d1             Change d0 to G bits
  490.     lsr    #2,d1
  491.     lsl    #6,d1
  492.     addi    #%1100100000011111,d1     Add to R+B bits...
  493.     move    #320-1,d2         For 320 pixels do
  494. .loop1    move    d1,(a2)+          { --- stick on both screens
  495.     move    d1,(a3)+          {
  496.     dbf    d2,.loop1
  497.     move    (timer).w,d2         {
  498. .loop2    cmp    (timer).w,d2         { --- Wait till next pixel
  499.     beq.s    .loop2            
  500.     lea    -640(a0),a0         { --- Go back a line.
  501.     lea    -640(a1),a1         {
  502.     dbf    d0,.loop
  503.     move.l    #100-1,d0        For next 100 lines do
  504. .loop3    move.l    a0,a2
  505.     move.l    a1,a3
  506.     move    #320-1,d2         For 320 pixels do
  507. .loop4    move    d1,(a2)+          { --- put d1 as a pixel on screen.
  508.     move    d1,(a3)+          {
  509.     dbf    d2,.loop4
  510.     move    (timer).w,d2         {
  511. .loop5    cmp    (timer).w,d2          { --- Wait for vbl
  512.     beq.s    .loop5
  513.     lea    -640(a0),a0         { --- Go back a line
  514.     lea    -640(a1),a1         {
  515.     dbf    d0,.loop3
  516.     rts
  517.  
  518.     
  519. * PLASMA ROUTINE.
  520. ; In this a lot of RGB values are mangled together at one side of the
  521. ; screen and scrolled across to the other side.
  522. ; Nice idea, but the routine is a bit lame really. Look, it was coded
  523. ; very quickly! At least I made it look reasonably designy!
  524.  
  525. do_plasma
  526.     move.l    plas_y_r_ptr,a0        {
  527.     move.l    plas_y_g_ptr,a1        { --- Get sine pointers for R,G,B bits
  528.     move.l    plas_y_b_ptr,a2        {
  529.     moveq    #0,d5
  530.     moveq    #0,d6
  531.     moveq    #0,d7
  532. .rag    move.b    (a0)+,d5        Get vertical offset for R
  533.     cmp.b    #-1,d5            At end of table?
  534.     beq    .rr             Reset table.
  535. .gag    move.b    (a1)+,d6        Get vertical offset for G
  536.     cmp.b    #-1,d6            At end of table?
  537.     beq    .gr             Reset table.
  538. .bag    move.b    (a2)+,d7        Get vertical offset for B
  539.     cmp.b    #-1,d7            At end of table?
  540.     beq    .br             Reset table.
  541.     move.l    a0,plas_y_r_ptr        {
  542.     move.l    a1,plas_y_g_ptr        { --- save new postion of pointers
  543.     move.l    a2,plas_y_b_ptr        {
  544.  
  545. ; Now we scroll the old plasma along a bit. (By software scrolling- Aargh!)
  546.  
  547.     move.l    back,a0
  548.     move.l    old_pos,a1        < "oldpos" is where we're copying from.
  549.     adda.l    #(35*640)+(95*2)+2,a0    Go along to end of plasma "square"
  550.     move.l    a0,old_pos        Save new "oldpos"
  551.     subq.l    #2,a0
  552.     move.l    a0,a2
  553.     move    #130-1,d0        {
  554. .loop1    move    #(130/2)-1,d1        { --- Copy it along. (This is lame!)
  555. .loop2    move.l    (a1)+,(a0)+        {
  556.     dbf    d1,.loop2        
  557.     lea    640-260(a0),a0        { --- go for next line
  558.     lea    640-260(a1),a1        {
  559.     dbf    d0,.loop1
  560.     
  561. ; Now the actual plasma bit.
  562.  
  563.     lea    130*2(a2),a0
  564.     lea    plas_r_bit,a1        {
  565.     lea    plas_g_bit,a2        { --- load RGB value pointers
  566.     lea    plas_b_bit,a3        {
  567.     move.l    #130-1,d0        For 130 lines (lame!) do
  568. .loop3    moveq    #0,d1
  569. .red    add    (a1,d5.w*2),d1         {
  570. .green    add    (a2,d6.w*2),d1         { --- add up RGB values to make pixel
  571. .blue    add    (a3,d7.w*2),d1         {
  572.     addq.l    #1,d5             Next R value
  573.     cmp.b    #(plas_r_end-plas_r_bit)/2,d5    Reached end of R values?
  574.     bne.s    .okr                 No, OK then...
  575.     moveq    #0,d5                 Yes, then reset!
  576. .okr    addq.l    #1,d6             Next G value
  577.     cmp.b    #(plas_g_end-plas_g_bit)/2,d6    Reached end of G values?
  578.     bne.s    .okg                 No, OK then...
  579.     moveq    #0,d6                 Yes, then reset!
  580. .okg    addq.l    #1,d7             Next B value
  581.     cmp.b    #(plas_b_end-plas_b_bit)/2,d7    Reached end of B values?
  582.     bne.s    .okb                 No, OK then...
  583.     moveq    #0,d7                 Yes, then reset!
  584. .okb    move    d1,(a0)             Put pixel on screen
  585.     lea    640(a0),a0         Go to next line
  586.     dbf    d0,.loop3
  587.     rts
  588. .rr    lea    plas_y_r_dat,a0        < Resetting R since pointer bit.
  589.     bra    .rag
  590. .gr    lea    plas_y_g_dat,a1        < Resetting G since pointer bit.
  591.     bra    .gag
  592. .br    lea    plas_y_b_dat,a2        < Resetting B since pointer bit.
  593.     bra    .bag
  594.  
  595. old_pos    ds.l    1        < Old postion of plasma
  596.  
  597.  
  598. * SCROLLER.
  599. ; Guess what- this is a scroller! This is a bit dister one as well!
  600. ; OK, you've probably guess by now that it's very easy to do a bit
  601. ; disting scroller, since you've don't really have to deal with bits
  602. ; in trucolour mode!
  603.  
  604. scroller:
  605.     moveq    #0,d0
  606.     move.b    scr_cnt,d0        < Get no of pixels of letter left to scroll.
  607.     tst.b    d0            Any left? (ie next letter)
  608.     beq.s    .new_letter         If so, make up a new letter.
  609. .sag    move.l    scr_dist_ptr,a0        Get scroller sine pointer
  610. .dag    moveq    #0,d0
  611.     move.b    (a0)+,d0        Get new vertical sine pos
  612.     cmp.b    #-1,d0            At end of table yet?
  613.     beq.s    .dr             If so, reset table.
  614.     move.l    a0,scr_dist_ptr        Save new sine pointer position
  615.     move.l    back,a0                { --- Get to top right of plasma "square"
  616.     adda.l    #(36*640)+((95+129)*2)+2,a0    {
  617. .loop1    lea    640(a0),a0        Down a line
  618.     dbf    d0,.loop1        Repeat for height of sine value.
  619.     lea    build,a1        Get current char. bitmap store
  620.     moveq    #0,d1
  621.     moveq    #16-1,d0        For each line of char. (16) do
  622. .loop2    lsl.w    (a1)+             Shift left (Leftmost pixel now in extend and carry flags.)
  623.     bcc.s    .again             If no carry flag set (ie no pixel), try next line.
  624.     not    (a0)              Otherwise NOT (ie invert) current pixel.
  625. .again    lea    640(a0),a0         Go to next line.
  626.     dbf    d0,.loop2
  627.     subq.b    #1,scr_cnt        Next pixel.
  628.     rts
  629. .dr    lea    scr_dist_dat,a0        < Reset scrolly sine pointer bit.
  630.     bra.s    .dag
  631.  
  632. ; This bit make up the next letter, which is 1 plane bitmap form and
  633. ; 16 X 16 pixels. (Yep, the old Omensoft one again!)
  634.  
  635. .new_letter
  636.     move.l    scr_ptr,a0        Get scrolltext pointer.
  637. .nag    move.b    (a0)+,d0        Get letter
  638.     cmp.b    #-1,d0            At end of text?
  639.     beq.s    .nr             If so, wrap!
  640.     subi.b    #' ',d0            Font starts at ' ' so take away #' ' from ASCII value.
  641.     lsl    #5,d0            * 32 (Each char of font is 32 bytes in length.)
  642.     move.l    a0,scr_ptr        Save new scrolltext pointer.
  643.     lea    font,a0            Get font data
  644.     lea    build,a1        Get character store.
  645.     lea    (a0,d0.w),a0        Move to character in font.
  646.     movem.l    (a0),d0-d7        { --- copy charcter into character store.
  647.     movem.l    d0-d7,(a1)        {
  648.     move.b    #16,scr_cnt        Reset no of pixels to scroll
  649.     bra    .sag            Go back to main scrolly rout.
  650. .nr    lea    scr_text,a0        < Resetting scrolltext pointer bit.
  651.     bra.s    .nag
  652.     
  653.     
  654. ; This is for the depacking of pictures.
  655.  
  656.     include depack35.s
  657.  
  658. ; This is for the keyboard code.
  659.  
  660. MOUSE_Y    equ    1
  661.  
  662.     include    keyboard.s
  663.  
  664. ; And this is for the module playing routine.
  665.  
  666.     include    a:\sound\dsplay2.s
  667.     
  668.  
  669. * Module ("Ambient Dub Corruption (Extended Mix)")
  670. ; by Metronome of Adrenlin!
  671.  
  672.  
  673. module    incbin    a:\sound\adrenl2a.mod
  674.  
  675. oldmode    ds.w    1            < old video mode
  676. oldscr    ds.l    1            < Old screen base
  677. front    dc.l    screen1            { --- front/back screen addresses.
  678. back    dc.l    screen2            {
  679.  
  680. * This is the list of piccy addresses.
  681.  
  682. pic_list    dc.l    pp1,pp2,pp3,pp4,pp5,pp6,pp7,pp8
  683.         dc.l    pp9,pp10,pp11,pp12,pp13,pp14,pp15
  684.         dc.l    -1        < end of table
  685. pic_ptr        dc.l    pic_list    < Pointer to piccy list
  686.  
  687.  
  688. * These are the plasma colour values.
  689.  
  690. ; First RED
  691.  
  692. plas_r_bit
  693. i    set    0
  694.     REPT    32-1
  695.     dc.w    i*%100000000000
  696. i    set    i+1
  697.     ENDR
  698.     dc.w    i*%100000000000
  699.     dc.w    i*%100000000000
  700.     REPT    32-1
  701.     dc.w    i*%100000000000
  702. i    set    i-1
  703.     ENDR
  704. plas_r_end
  705.  
  706. ; Now GREEN
  707.  
  708. plas_g_bit
  709. i    set    0
  710.     REPT    32-1
  711.     dc.w    i*%1000000
  712. i    set    i+1
  713.     ENDR
  714.     dc.w    i*%1000000
  715.     dc.w    i*%1000000
  716.     REPT    32-1
  717.     dc.w    i*%1000000
  718. i    set    i-1
  719.     ENDR
  720. plas_g_end
  721.  
  722. ; Finally BLUE
  723.  
  724. plas_b_bit
  725. i    set    0
  726.     REPT    32-1
  727.     dc.w    i
  728. i    set    i+1
  729.     ENDR
  730.     dc.w    i
  731.     dc.w    i
  732.     REPT    32-1
  733.     dc.w    i
  734. i    set    i-1
  735.     ENDR
  736. plas_b_end
  737.  
  738.  
  739. * Now all the sine tables
  740.  
  741. ; First for the scroller
  742.  
  743. scr_dist_dat
  744.     incbin    a:\graphics\jsd.dat
  745.     dc.b    -1        < End of table
  746.     even
  747.     
  748. ; Now the plasma red bit
  749.  
  750. int_p_y_r
  751.     dcb.b    130,0        < Intial bit of zilch
  752. plas_y_r_dat
  753.     incbin    a:\graphics\jpr.dat
  754.     dc.b    -1        < End of table
  755.     even
  756.     
  757. ; Now the plasma green bit
  758.     
  759. int_p_y_g
  760.     dcb.b    260,0        < Intial bit of zilch
  761. plas_y_g_dat
  762.     incbin    a:\graphics\jpg.dat
  763.     dc.b    -1        < End of table
  764.     even
  765.     
  766. ; Now the plasma blue bit
  767.     
  768. int_p_y_b
  769.     dcb.b    390,0        < Intial bit of zilch
  770. plas_y_b_dat
  771.     incbin    a:\graphics\jpb.dat
  772.     dc.b    -1        < End of table
  773.     even
  774.     
  775.  
  776. * Now all the pointers for the plasma sine stuff.
  777.     
  778. plas_y_r_ptr
  779.     dc.l    int_p_y_r        RED   sine pointer
  780. plas_y_g_ptr
  781.     dc.l    int_p_y_g        GREEN sine pointer
  782. plas_y_b_ptr
  783.     dc.l    int_p_y_b        BLUE  sine pointer
  784.     
  785.  
  786. * Now the scrolltext- capital letters only.
  787.  
  788. scr_text
  789.     dc.b    '                                        OK, NOT EXACTLY A BRAIN-BLASTING DEMO, BUT IT WAS KNOCKED TOGETHER AT SHORT NOTICE!  CODE BY GENIE AND EGB''S SMELLY SOX, EXCEPT FOR THE MOD REPLAY ROUTINE (WHICH- GASP! - IS *NOT* BY CHRIS '
  790.     dc.b    'OF AURA, BUT "BITMASTER OF BSW" !). MUSIC IS BY METRONOME OF ADRENALIN.             '
  791.     dc.b    'JAGUAR SCREEN-SHOTS ARE FROM THE FOLLOWING GAMES:     DINO/HUMANS    TINY TOONS    ALIEN VS PREDATOR    KASUMI NINJA    CRESCENT GALAXY      ....     '
  792.     dc.b    'WHERE POSSIBLE, TARGA PICTURES HAVE BEEN USED TO GET A DECENT TRUE COLOUR IMAGE, RATHER THAN A 256 COLOUR ONE!        '
  793.     dc.b    'WHAT DO YOU MEAN THAT THE FADE IS SLOW?!?!?!    DON''T YOU REALIZE THAT I''M DOING 3 BIT-COMPARE OPERATIONS ON '
  794.     dc.b    '32 X 200 PIXELS AT A TIME!!!!         WELL, WE WERE THE FIRST TO DO A REALTIME TRUE-COLOUR FADE BETWEEN 2 PICTURES ON A FALCON DEMO, SO DON''T EXPECT TOO MUCH FOR OUR FIRST GO!         AH WELL, WAIT TILL WE GET OUR DSP MANUAL! '
  795.     dc.b    'EVEN BETTER, WAIT TILL WE ACTUALLY UNDERSTAND IT!            '
  796.     dc.b    'THIS IS ALSO PROBABLY THE FIRST DEMO ON THE FALCON TO USE A SCROLLER... GROAN!     SORRY ABOUT THAT!           '
  797.     dc.b    'WE''RE ALSO STARTING TO ALLOW YOU TO EXIT BY PRESSING A '
  798.     dc.b    'MOUSE BUTTON, LIKE ON AMIGA DEMOS!      YOU''D BETTER APPRECIATE THAT, OR WE''LL KILL YOU!!!         '
  799.     dc.b    'COMING SOON FROM PB PRODUCTIONS ON THE FALCON..... '
  800.     dc.b    'THE PERPETUAL DAWN DEMO PT 2 - LOADS OF NEW EFFECTS, MOST OF THEM MUCH BETTER THAN THE ONES ON THIS DEMO!        IT WILL ALSO HAVE LOADS OF DESIGNY EFFECTS, LIKE ON AMIGA DEMOS!       YES, IT''LL ALSO BE A MULTIPART!       OH, AND '
  801.     dc.b    'WE MIGHT EVEN GET ROUND TO DOING AN ISSUE OF PB!!!!!              IF YOU WANT TO GET THE LATEST ISSUE OF OUR BRILLIANT FALCON COMPATIBLE DISKMAG, THEN WRITE TO:       PB MAGAZINE,         PO BOX 1083,         GLASGOW G14 9DG,      '
  802.     dc.b    'BRITAIN.           YOU CAN ALSO GET IT BY ANONYMOUS FTP FROM     ARCHIVE.UMICH.EDU    IN THE DIRECTORY    "MAGAZINES/DISKMAGS/PB"     AND FROM     FTP.UNI-KL.DE    IN THE DIRECTORY "MAGAZINES" .        WE CAN BE EMAILED AT THE '
  803.     dc.b    'ADDRESS     AN18359@ANON.PENET.FI          WELL, ENOUGH OF THIS SCROLLY BULL, LET''S WARP!!!!          (EGB''S SMELLY SOX!)                                                                                            '
  804.     dc.b    -1            < End of scrolltext
  805.     even
  806. scr_ptr    dc.l    scr_text        < Pointer to scrolltext
  807. scr_dist_ptr
  808.     dc.l    scr_dist_dat        < Scrolly sine pointer
  809. scr_cnt    ds.b    1            < No. of pixels left to scroll.
  810.     even
  811. build    ds.w    16            < Scrolley character bitmap store
  812. font    incbin    a:\graphics\fontish.bin    < The font. (Yes, that old one again!)
  813.     even
  814.     
  815.     
  816. * Now all the pics. All of them have been packed using the Atomix packer v3.5.
  817.  
  818. start_screen
  819.     incbin    a:\graphics\jaglog.pi1        < Initial crap PI1 screen
  820. pp1    incbin    a:\graphics\jag_pic.tru        Jag machine shot
  821. pp2    incbin    a:\graphics\caveman.tru        { - Evolution Dino Dudes
  822. pp3    incbin    a:\graphics\caveman2.tru    {
  823. pp4    incbin    a:\graphics\raiden.tru        < Raiden
  824. pp5    incbin    a:\graphics\tiny1.tru        {   "We're Tiny, we're
  825. pp6    incbin    a:\graphics\tiny2.tru        { -  Toony, we're all a 
  826. pp7    incbin    a:\graphics\tiny3.tru        {    little loony..."
  827. pp8    incbin    a:\graphics\tiny4.tru        {
  828. pp9    incbin    a:\graphics\avp1.tru        [
  829. pp10    incbin    a:\graphics\avp2.tru        [ - Alien Vs Predator
  830. pp11    incbin    a:\graphics\avp3.tru        [
  831. pp12    incbin    a:\graphics\ninja1.tru        { - Kasumi Ninja (Very early pics
  832. pp13    incbin    a:\graphics\ninja2.tru        {   though, a bit more like MK now.)
  833. pp14    incbin    a:\graphics\cresc1.tru        [ - Crescent Galaxy (OK, OK, but
  834. pp15    incbin    a:\graphics\cresc2.tru        [   the screenshots are nice.)
  835.  
  836.     section    bss
  837.  
  838.     ds.b    256            {
  839. screen1    ds.w    320*200            { --- Finally the two screens. Lo-res trucol
  840. screen2    ds.w    320*200            {        (ie 320 X 200)
  841. endscreen
  842.     even
  843.  
  844. * End of code.
  845.  
  846.