home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / MAGGIE22.ARJ / magg22st.msa / GOODIES / ST_INTRO.ZIP / M21.ST / INTRO3.S < prev    next >
Text File  |  1996-09-12  |  25KB  |  1,220 lines

  1. ;
  2. ;    a v e n a
  3. ;
  4. ;    maggie 21 st intro
  5. ;
  6. ;    started 20th august 1996
  7. ;    tunnel effect to 22nd august
  8. ;    water effect 5th september to 9th september
  9. ;
  10.  
  11.  
  12.         output    d:\source2\m21.st\intro.prg
  13.         opt    p=68000
  14.  
  15. start:
  16.         clr.l    -(a7)
  17.         move.w    #$20,-(a7)
  18.         trap    #1
  19.         move.l    d0,save_stack
  20.         lea    stack,a7
  21.  
  22.         move.w    #4,-(a7)
  23.         trap    #14
  24.         addq.l    #2,a7
  25.         cmp.w    #2,d0
  26.         bge    resolution_error
  27.         move.w    d0,save_resolution
  28.  
  29.         bsr    save_colours
  30.         bsr    save_all
  31.         bsr    save_soundchip
  32.         bsr    install_all
  33.         bsr    install_music
  34.         bsr    install_music_interrupt
  35.         bsr    install_screens
  36.  
  37.         ;bra    debug
  38.  
  39.         move.l    #script,a6
  40. script_loop:
  41.         move.l    (a6)+,d0
  42.         bmi.s    script_finished
  43.         move.l    d0,a1
  44.         jsr    (a1)
  45.         bra    script_loop
  46. script_finished:
  47.  
  48. debug_end:
  49. here:        cmp.b    #$39,$fffffc02.w
  50.         bne.s    here
  51.  
  52.  
  53. ; Restore everything: 
  54. exit_intro:
  55.         bsr    restore_music_interrupt
  56.         bsr    restore_soundchip
  57.         bsr    restore_all
  58.         bsr    restore_colours
  59.  
  60.         move.w    save_resolution,-(a7)
  61.         move.l    $044e.w,-(a7)
  62.         move.l    #-1,-(a7)
  63.         move.w    #5,-(a7)
  64.         trap    #14
  65.         lea    12(a7),a7
  66.  
  67. exit_program:
  68.         move.l    save_stack,-(a7)
  69.         move.w    #$20,-(a7)
  70.         trap    #1
  71.         addq.l    #6,a7
  72.  
  73.         clr.w    -(a7)
  74.         trap    #1
  75.  
  76.         ;illegal
  77.  
  78. resolution_error:
  79.         pea    res_string(pc)
  80.         move.w    #9,-(a7)
  81.         trap    #1
  82.         addq.l    #6,a7
  83.  
  84.         move.w    #1,-(a7)
  85.         trap    #1
  86.         addq.l    #2,a7
  87.         bra    exit_program
  88.  
  89.  
  90. res_string:    dc.b    27,"E"
  91.         dc.b    "'maggie intro no likey falcon or",13,10
  92.         dc.b    "monochrome screen resolutions!'",13,10,10
  93.         dc.b    "Please switch to ST-Low or ST-Medium",0
  94.         even
  95.  
  96. ;-------------------------------------------------------
  97. ;        SECTION    MUSIC
  98. ;-------------------------------------------------------
  99. script_install_picture:
  100.         move.l    (a6)+,a0
  101.         pea    (a6)
  102.         bsr    install_picture
  103.         move.l    (a7)+,a6
  104.         rts
  105.  
  106. script_reset_timer:
  107.         clr.l    music_timer
  108.         rts
  109.  
  110. script_reloop:
  111.         move.l    (a6)+,a6
  112.         rts
  113.  
  114. script_wait_music:
  115.         move.l    (a6)+,d0
  116.         pea    (a6)
  117.         bsr    wait_music
  118.         move.l    (a7)+,a6
  119.         rts
  120.  
  121. script_display_picture:
  122.         pea    (a6)
  123.         bsr    display_picture
  124.         move.l    (a7)+,a6
  125.         rts
  126.  
  127. script_display_text_screen
  128.         pea    (a6)
  129.         bsr    display_text_screen
  130.         move.l    (a7)+,a6
  131.         rts
  132.  
  133. script_install_fade:
  134.         move.l    (a6)+,a0
  135.         move.l    (a6)+,d0
  136.         pea    (a6)
  137.         bsr    install_fade
  138.         move.l    (a7)+,a6
  139.         rts
  140.  
  141. script_fade:    move.l    (a6)+,a0
  142.         move.l    (a6)+,d0
  143.         pea    (a6)
  144.         bsr    install_fade
  145.         bsr    start_fade
  146.         move.l    (a7)+,a6
  147.         rts
  148.  
  149. script_text_handler:
  150.         move.l    (a6)+,a0
  151.         pea    (a6)
  152.         bsr    text_handler
  153.         move.l    (a7)+,a6
  154.         rts
  155.  
  156. script_start_fade:
  157.         pea    (a6)
  158.         bsr    start_fade
  159.         move.l    (a7)+,a6
  160.         rts
  161.  
  162. script_bunny:
  163.         pea    (a6)
  164.         lea    bunny_picture+2,a0
  165.         lea    bunny_palette,a1
  166.         moveq    #16-1,d0
  167. .neg        move.w    (a0),d1
  168.         move.w    d1,(a1)+
  169.         ;eor.w    #$fff,d1
  170.         move.w    d1,(a0)+
  171.         dbf    d0,.neg
  172.         move.l    (a7)+,a6
  173.         rts
  174.  
  175. ;-------------------------------------------------------
  176. ;        SECTION    SCRIPT
  177. ;-------------------------------------------------------
  178.  
  179. timer_b:    movem.l    d0-a6,-(a7)
  180.         jsr    tune+312
  181.         addq.l    #1,music_timer
  182.         movem.l    (a7)+,d0-a6
  183.         rte
  184.  
  185.  
  186. music_fix:
  187.         move.l    d0,d7
  188.         bsr    .set_chip
  189.         move.l    d1,d7
  190.         bsr    .set_chip
  191.         move.l    d2,d7
  192.         bsr    .set_chip
  193.         move.l    d3,d7
  194.         bsr    .set_chip
  195.         jmp    tune+700
  196. .set_chip:
  197.         rol.l    #8,d7
  198.         move.b    d7,$ffff8800.w
  199.         rol.l    #8,d7
  200.         move.b    d7,$ffff8802.w
  201.         rol.l    #8,d7
  202.         move.b    d7,$ffff8800.w
  203.         rol.l    #8,d7
  204.         move.b    d7,$ffff8802.w
  205.         rts
  206.  
  207. save_soundchip:
  208.         lea    $ffff8800.w,a0
  209.         lea    soundchip_buffer,a1
  210.         moveq    #$f,d0
  211. .loop        move.b    d0,(a0)
  212.         move.b    (a0),(a1)+
  213.         dbf    d0,.loop
  214.         rts
  215.  
  216. restore_soundchip:
  217.         lea    $ffff8800.w,a0
  218.         lea    soundchip_buffer,a1
  219.         moveq    #$f,d0
  220. .loop        move.b    d0,(a0)
  221.         move.b    (a1)+,2(a0)
  222.         dbf    d0,.loop
  223.         move.b    #8,(a0)
  224.         clr.b    2(a0)
  225.         move.b    #9,(a0)
  226.         clr.b    2(a0)
  227.         move.b    #$a,(a0)
  228.         clr.b    2(a0)
  229.         rts
  230.  
  231. install_music:
  232.         clr.l    music_timer
  233.  
  234. ; Original music didn't work on Falcons, so this patch has
  235. ; been introduced:
  236.         lea    tune+684,a0            ;Falcon fix
  237.         movem.w    music_fix_instructions,d0/d1/d2
  238.         movem.w    d0/d1/d2,(a0)
  239. ; Music:
  240.         lea    tune+350,a0
  241.         lea    tune+368,a1
  242.         move.l    a0,10(a1)
  243.         move.l    a1,10(a0)
  244.         jsr    tune+32
  245.  
  246.         lea    tune+1774,a0
  247.         jsr    tune
  248.         rts
  249.  
  250. ; The following instruction is copied onto the old movep.l
  251. ;   instruction which only works on ST
  252. music_fix_instructions:
  253.         jmp    music_fix
  254.  
  255.  
  256. install_music_interrupt:
  257.         move.l    #timer_b,$120.w
  258.         clr.b    $fffffa1b.w
  259.         move.b    #$f5,$fffffa21.w
  260.         move.b    #7,$fffffa1b.w
  261.         bset    #0,$fffffa07.w
  262.         bset    #0,$fffffa13.w
  263.         rts
  264.  
  265. restore_music_interrupt:
  266.         clr.b    $fffffa1b.w
  267.         bclr    #0,$fffffa07.w
  268.         bclr    #0,$fffffa13.w
  269.         rts
  270.  
  271. wait_music
  272.         cmp.l    music_timer,d0
  273.         bgt.s    wait_music
  274.         rts
  275.  
  276. wait_vbl
  277.         move.l    vbl_timer,d0
  278. .wait        cmp.l    vbl_timer,d0
  279.         beq.s    .wait
  280.         rts
  281.  
  282. ;-------------------------------------------------------
  283. ;        SECTION    INTERRUPTS
  284. ;-------------------------------------------------------
  285. save_all:    lea    save_area,a0
  286.         move.l    $70.w,(a0)+
  287.         move.l    $110.w,(a0)+
  288.         move.l    $114.w,(a0)+
  289.         move.l    $118.w,(a0)+
  290.         move.l    $120.w,(a0)+
  291.         move.l    $134.w,(a0)+
  292.         move.b    $fffffa01.w,(a0)+
  293.         move.b    $fffffa07.w,(a0)+
  294.         move.b    $fffffa09.w,(a0)+
  295.         move.b    $fffffa0f.w,(a0)+
  296.         move.b    $fffffa13.w,(a0)+
  297.         move.b    $fffffa15.w,(a0)+
  298.         move.b    $fffffa17.w,(a0)+
  299.         move.b    $fffffa19.w,(a0)+
  300.         move.b    $fffffa1b.w,(a0)+
  301.         move.b    $fffffa1f.w,(a0)+
  302.         move.b    $fffffa21.w,(a0)+
  303.         rts
  304.  
  305. save_colours    movem.l    $ffff8240.w,d0-d7
  306.         moveM.l    d0-d7,old_colours
  307.         rts
  308.  
  309.  
  310. restore_all:    lea    save_area,a0
  311.         move.l    (a0)+,$70.w
  312.         move.l    (a0)+,$110.w
  313.         move.l    (a0)+,$114.w
  314.         move.l    (a0)+,$118.w
  315.         move.l    (a0)+,$120.w
  316.         move.l    (a0)+,$134.w
  317.         move.b    (a0)+,$fffffa01.w
  318.         move.b    (a0)+,$fffffa07.w
  319.         move.b    (a0)+,$fffffa09.w
  320.         move.b    (a0)+,$fffffa0f.w
  321.         move.b    (a0)+,$fffffa13.w
  322.         move.b    (a0)+,$fffffa15.w
  323.         move.b    (a0)+,$fffffa17.w
  324.         move.b    (a0)+,$fffffa19.w
  325.         move.b    (a0)+,$fffffa1b.w
  326.         move.b    (a0)+,$fffffa1f.w
  327.         move.b    (a0)+,$fffffa21.w
  328.         rts
  329.  
  330. restore_colours    movem.l    old_colours,d0-d7
  331.         movem.l    d0-d7,$ffff8240.w
  332.         rts
  333.  
  334. install_all:
  335.         move.w    #0,-(a7)
  336.         pea    -1.w
  337.         pea    -1.w
  338.         move.w    #5,-(a7)
  339.         trap    #14
  340.         lea    12(a7),a7
  341.  
  342.         move.w    #37,-(a7)
  343.         trap    #14
  344.         addq.l    #2,a7
  345.  
  346.         move.w    #$2700,sr
  347.         clr.l    vbl_timer
  348.         move.l    #vbl,$70.w
  349.         clr.l    $fffffa06.w
  350.         clr.l    $fffffa12.w
  351.         move.b    #$40,$fffffa17.w
  352.         bsr    install_keyboard
  353.  
  354.         lea    current_palette,a0
  355.         bsr    install_palette
  356.         move.w    #$2300,sr
  357.         rts
  358.  
  359. ;-------------------------------------------------------
  360. install_keyboard:
  361.         move.l    #key,$118.w
  362.         bset    #6,$fffffa09.w
  363.         bset    #6,$fffffa15.w
  364.         rts
  365.  
  366. key:        move.b    $fffffc02.w,keyboard_dummy
  367.         rte
  368.  
  369. ;-------------------------------------------------------
  370. vbl:        movem.l    d0-a6,-(a7)
  371.         cmp.b    #$39,$fffffc02.w
  372.         beq    exit_intro
  373.  
  374.         tst.w    palette_flag
  375.         beq.s    .nopal
  376.  
  377.         clr.w    palette_flag
  378.         move.l    palette_address,a0
  379.         movem.l    (a0),d0-d7
  380.         movem.l    d0-d7,$ffff8240.w
  381.  
  382. .nopal:
  383.         move.l    vbl_routine,d0
  384.         beq.s    .none
  385.         move.l    d0,a0
  386.         jsr    (a0)
  387. .none:
  388.         addq.l    #1,vbl_timer
  389.         movem.l    (a7)+,d0-a6
  390.         rte
  391.  
  392. swap_screens:
  393.         move.l    logic,d0
  394.         move.l    physic,logic
  395.         move.l    d0,physic
  396.         lsr.w    #8,d0
  397.         move.l    d0,$ffff8200.w
  398.         rts
  399.  
  400. ;-------------------------------------------------------
  401. ;        SECTION    PALETTE
  402. ;-------------------------------------------------------
  403. install_palette:
  404.         move.l    a0,palette_address
  405.         move.w    #-1,palette_flag
  406.         rts
  407.  
  408. install_screens:
  409.         move.l    #screens,d0
  410.         sub.b    d0,d0
  411.         move.l    d0,physic
  412.         add.l    #32000,d0
  413.         move.l    d0,logic
  414.         rts
  415.  
  416. install_fade:
  417.         move.w    d0,fade_speed
  418.         lea    fade_destination,a1
  419.         moveq    #16-1,d7
  420. .fade        move.w    (a0)+,d0
  421.         bsr    convert_to_internal
  422.         move.b    d1,(a1)+
  423.         move.b    d2,(a1)+
  424.         move.b    d3,(a1)+
  425.         dbf    d7,.fade
  426.  
  427.         move.l    palette_address,a0
  428.         lea    fade_start,a1
  429.         moveq    #16-1,d7
  430. .fade2        move.w    (a0)+,d0
  431.         bsr    convert_to_internal
  432.         move.b    d1,(a1)+
  433.         move.b    d2,(a1)+
  434.         move.b    d3,(a1)+
  435.         dbf    d7,.fade2
  436.         rts
  437.  
  438. convert_to_internal:
  439.         lea    convert_to_internal_table,a6
  440.         move.b    d0,d1
  441.         and.w    #$f,d1
  442.         move.b    (a6,d1.w),d3
  443.         lsr.w    #4,d0
  444.         move.b    d0,d1
  445.         and.w    #$f,d1
  446.         move.b    (a6,d1.w),d2
  447.         lsr.w    #4,d0
  448.         move.b    d0,d1
  449.         and.w    #$f,d1
  450.         move.b    (a6,d1.w),d1
  451.         rts
  452.  
  453.  
  454.  
  455. vbl_fade:
  456.         subq.w    #1,fade_temp
  457.         bgt    .no_fade
  458.  
  459.         move.w    fade_speed,fade_temp
  460.         addq.w    #1,fade_count
  461.         cmp.w    #17,fade_count
  462.         beq.s    vbl_fade_done
  463.  
  464.         lea    fade_start,a0
  465.         lea    fade_destination,a1
  466.         lea    convert_to_ste_table,a2
  467.         move.l    palette_address,a3
  468.  
  469.         move.w    fade_count,d2
  470.         moveq    #16-1,d0
  471. .fader
  472.         move.b    (a1)+,d1
  473.         sub.b    (a0),d1
  474.         ext.w    d1
  475.         muls.w    d2,d1
  476.         asr.w    #4,d1
  477.         add.b    (a0)+,d1
  478.         ext.w    d1
  479.         move.b    (a2,d1.w),d3
  480.  
  481.         move.b    (a1)+,d1        
  482.         sub.b    (a0),d1
  483.         ext.w    d1
  484.         muls.w    d2,d1
  485.         asr.w    #4,d1
  486.         add.b    (a0)+,d1
  487.         ext.w    d1
  488.  
  489.         asl.w    #4,d3
  490.         or.b    (a2,d1.w),d3
  491.  
  492.         move.b    (a1)+,d1        
  493.         sub.b    (a0),d1
  494.         ext.w    d1
  495.         muls.w    d2,d1
  496.         asr.w    #4,d1
  497.         add.b    (a0)+,d1
  498.         ext.w    d1
  499.  
  500.         asl.w    #4,d3
  501.         or.b    (a2,d1.w),d3
  502.  
  503.         and.w    #$0fff,d3
  504.         move.w    d3,(a3)+
  505.         dbf    d0,.fader
  506.  
  507.         move.w    #-1,palette_flag
  508. .no_fade:    rts
  509.  
  510.  
  511. vbl_fade_done:    clr.l    vbl_routine
  512.         clr.w    fade_count
  513.         clr.w    fade_temp
  514.         st    fade_done_flag
  515.         rts
  516.  
  517. start_fade:    move.w    #0,fade_count
  518.         clr.w    fade_done_flag
  519.         clr.w    fade_temp
  520.         move.l    #vbl_fade,vbl_routine
  521.         rts
  522.  
  523.  
  524. convert_to_internal_table:
  525.         dc.b    0,2,4,6,8,10,12,14
  526.         dc.b    1,3,5,7,9,11,13,15
  527. convert_to_ste_table:
  528.         dc.b    0,8,1,9,2,10,3,11
  529.         dc.b    4,12,5,13,6,14,7,15
  530.  
  531.  
  532. ;-------------------------------------------------------
  533. ;        SECTION    PICTURE
  534. ;-------------------------------------------------------
  535. install_picture:
  536.         pea    (a0)
  537.         lea    32(a0),a1
  538.         move.l    logic,a2
  539.         bsr    backform
  540.         move.l    (a7)+,a0
  541.  
  542.         moveq    #1,d1
  543.         bsr    install_fade
  544.         bsr    swap_screens
  545.         rts
  546.  
  547.  
  548. backform:
  549. ; formt Bild aus Spezialformat zurück
  550. ; a0=Adresse
  551.  
  552.         move.w    #(200*20)-1,D0
  553. .backformloop0:    moveq    #0,D1        ; clear Plane 0-3
  554.         moveq    #0,D2
  555.         moveq    #0,D3
  556.         moveq    #0,D4
  557.         moveq    #3,D5        ; 4 words
  558. .backformloop1:    move.w    (A1)+,D7    ; get word (Special)
  559.         add.w    D7,D7        ; shift left by 1
  560.         addx.w    D1,D1        ; Plane 0 set
  561.         add.w    D7,D7        ;
  562.         addx.w    D2,D2        ;
  563.         add.w    D7,D7        ;
  564.         addx.w    D3,D3        ;
  565.         add.w    D7,D7        ;
  566.         addx.w    D4,D4        ;
  567.         add.w    D7,D7        ;
  568.         addx.w    D1,D1        ;
  569.         add.w    D7,D7        ;
  570.         addx.w    D2,D2        ;
  571.         add.w    D7,D7        ;
  572.         addx.w    D3,D3        ;
  573.         add.w    D7,D7        ;
  574.         addx.w    D4,D4        ;
  575.         add.w    D7,D7        ;
  576.         addx.w    D1,D1        ;
  577.         add.w    D7,D7        ;
  578.         addx.w    D2,D2        ;
  579.         add.w    D7,D7        ;
  580.         addx.w    D3,D3        ;
  581.         add.w    D7,D7        ;
  582.         addx.w    D4,D4        ;
  583.         add.w    D7,D7        ;
  584.         addx.w    D1,D1        ;
  585.         add.w    D7,D7        ;
  586.         addx.w    D2,D2        ;
  587.         add.w    D7,D7        ;
  588.         addx.w    D3,D3        ;
  589.         add.w    D7,D7        ;
  590.         addx.w    D4,D4        ;
  591.         dbra    D5,.backformloop1
  592.         move.w    D4,(A2)+    ;
  593.         move.w    D3,(A2)+
  594.         move.w    D2,(A2)+
  595.         move.w    D1,(A2)+
  596.         dbra    D0,.backformloop0
  597.         rts
  598.  
  599. display_picture:
  600.         bsr    start_fade
  601.         rts
  602.  
  603. ;-------------------------------------------------------
  604. ;            SECTION    TEXT
  605. ;-------------------------------------------------------
  606. Char_Width    =    17
  607. Space_Width    =    8
  608.  
  609. text_handler:
  610. .display_loop:
  611.         moveq    #0,d0
  612.         move.b    (a0)+,d0
  613.         bpl.s    .display_loop
  614.  
  615.         sub.w    #128,d0
  616.         ext.w    d0
  617.         add.w    d0,d0
  618.         add.w    d0,d0
  619.         move.l    dlist(pc,d0.w),a1
  620.         jsr    (a1)
  621.         bra    .display_loop
  622. display_end:    addq.l    #4,a7
  623.         rts
  624.  
  625.  
  626. dlist:        dc.l    clear_logic
  627.         dc.l    display_end
  628.         dc.l    wait_music
  629.         dc.l    set_text
  630.         dc.l    print_text
  631.         dc.l    0    ;initialize_screen
  632.         dc.l    swap_screens
  633.  
  634. ComClear    equ    128
  635. ComEnd        equ    129
  636. ComWait        equ    130
  637. ComSet        equ    131
  638. ComPrint    equ    132
  639. ComShow        equ    133
  640. ComSwap        equ    134
  641.  
  642. clear_screens:
  643.         move.l    physic,a1
  644.         bsr    clear_one
  645.         ;Falls through
  646. clear_logic:
  647.         move.l    logic,a1
  648. clear_one:    moveq    #0,d0
  649.         move.w    #32000/16-1,d1
  650. .clear:        move.l    d0,(a1)+
  651.         move.l    d0,(a1)+
  652.         move.l    d0,(a1)+
  653.         move.l    d0,(a1)+
  654.         dbf    d1,.clear
  655.         rts
  656.  
  657. set_text:
  658.         moveq    #0,d0
  659.         move.b    (a0)+,d0
  660.         asl.w    #1,d0
  661.         move.w    d0,text_x
  662.         moveq    #0,d0
  663.         move.b    (a0)+,d0
  664.         move.w    d0,text_y
  665.         rts
  666.  
  667. print_text:
  668.         moveq    #0,d0
  669.         move.b    (a0)+,d0        ;which screen! (ignored)
  670.         move.l    logic,a1
  671.         move.l    a1,textscreen
  672.  
  673. text_print2
  674. .get_letter
  675.         moveq    #0,d2
  676.         move.b    (a0)+,d2        ;d0 = letter to do
  677.         bmi    .text_done
  678.         moveq    #0,d1
  679.         sub.w    #" ",d2
  680.         move.w    #Char_Width,d1
  681.         lea    text_convert_table,a6
  682.         move.b    (a6,d2.w),d2
  683.         bpl.s    .ok2
  684.         move.w    #Space_Width,d1
  685.         bra    .dont_draw
  686. .ok2
  687.         move.w    d1,text_to_add
  688.         pea    (a0)
  689.           bsr       text_draw_letter
  690.         move.l    (a7)+,a0
  691. .dont_draw:
  692.         move.w    text_to_add,d0
  693.         add.w    d0,text_x
  694.         bra    .get_letter
  695.  
  696. .text_done:    subq.l    #1,a0
  697.         rts
  698.  
  699. ;--------------------------------------------------------------
  700. text_draw_letter:
  701.         movem.w    text_x,d0/d1
  702.         mulu.w    #8*48,d2
  703.         add.l    #text_font,d2
  704.         move.l    d2,a0
  705.  
  706.         move.l    textscreen,A1
  707.         mulu.w    #160,D1            ;can't be bothered...
  708.         add.l    D1,A1
  709.         move.w    D0,D1
  710.         and.w    #$F,D0            ;d0 = shift amt
  711.  
  712.         move.w    d0,d7
  713.         lea    text_mask_table,a6
  714.  
  715.         add.w    d7,d7
  716.         move.w    0(a6,d7.w),d6        ;left mask
  717.         move.w    d6,d7
  718.         not.w    d7
  719.  
  720.         eor.w    d0,d1            ;d1 = x-offset
  721.         asr.w    #1,d1            ;16 pixels = 8 bytes
  722.         add.w    d1,a1
  723.  
  724.         moveq    #48-1,d5
  725. .doline:
  726.         move.l    (a0)+,d1        ;fiddle with
  727.         move.l    (a0)+,d2
  728.         ror.l    d0,d1
  729.         ror.l    d0,d2
  730.         eor.w    d1,8(a1)        ;middle section sorted...
  731.         eor.w    d2,10(a1)        ;this is correct
  732.         swap    d1
  733.         swap    d2
  734.  
  735.         move.w    d1,d3
  736.         and.w    d6,d3
  737.         eor.w    d3,0(a1)
  738.         move.w    d2,d3
  739.         and.w    d6,d3
  740.         eor.w    d3,2(a1)
  741.  
  742.         and.w    d7,d1
  743.         eor.w    d1,16(a1)
  744.         and.w    d7,d2
  745.         eor.w    d2,18(a1)
  746.  
  747.         lea    160(a1),a1
  748.         dbf    d5,.doline
  749.         rts
  750.  
  751. text_error    rts
  752.  
  753. display_text_screen
  754.         bsr    swap_screens
  755.         lea    text_palette,a0
  756.         moveq.l    #1,d0
  757.         bsr    install_fade
  758.         bsr    start_fade
  759.         rts
  760.  
  761.  
  762. ;-----------------------------------------------------------
  763.             SECTION DATA
  764. ;-----------------------------------------------------------
  765.         even
  766. text_1:
  767.         dc.b    ComClear
  768.         dc.b    ComSet,160/2,150,ComPrint,0,"maggie"
  769.         dc.b    ComEnd
  770. text_2:
  771.         dc.b    ComClear
  772.         dc.b    ComSet,160/2,0,ComPrint,0,"goes back"
  773.         dc.b    ComSet,160/2,40,ComPrint,0,"to basics"
  774.         dc.b    ComEnd
  775. text_3:
  776.         dc.b    ComClear
  777.         dc.b    ComSet,80/2+4,100,ComPrint,0,"for issue"
  778.         dc.b    ComSet,80/2,140,ComPrint,0,"twenty one"
  779.         dc.b    ComEnd
  780.  
  781. text_4:
  782.         dc.b    ComClear
  783.         dc.b    ComSet,0/2,100,ComPrint,0,"pixel excellence"
  784.         dc.b    ComSet,0/2,140,ComPrint,0,"by flan of exa"
  785.         dc.b    ComEnd
  786.  
  787. text_5:
  788.         dc.b    ComClear
  789.         dc.b    ComSet,0/2,100,ComPrint,0,"sonic excellence"
  790.         dc.b    ComSet,0/2,140,ComPrint,0,"by lap of next"
  791.         dc.b    ComEnd
  792.  
  793. text_6:
  794.         dc.b    ComClear
  795.         dc.b    ComSet,0/2,100,ComPrint,0,"coding negligence"
  796.         dc.b    ComSet,0/2,140,ComPrint,0,"by tat of avena"
  797.         dc.b    ComEnd
  798.  
  799. text_7:
  800.         dc.b    ComClear
  801.         dc.b    ComSet,0/2,00,ComPrint,0,"Four plane"
  802.         dc.b    ComSet,0/2,40,ComPrint,0,"distortion"
  803.         dc.b    ComSet,0/2,80,ComPrint,0,"routines"
  804.         dc.b    ComEnd
  805.  
  806. text_8:
  807.         dc.b    ComClear
  808.         dc.b    ComSet,50/2,100,ComPrint,0,"Now lets"
  809.         dc.b    ComSet,50/2,130,ComPrint,0,"ruin Uncle"
  810.         dc.b    ComSet,50/2,160,ComPrint,0,"Sam Tramiel"
  811.         dc.b    ComEnd
  812.  
  813. text_9:
  814.         dc.b    ComClear
  815.         dc.b    ComSet,0/2,160,ComPrint,0,"Greetings bit"
  816.         dc.b    ComEnd
  817.  
  818. text_10:
  819.         dc.b    ComClear
  820.         dc.b    ComSet,0/2,50,ComPrint,0,"Hope you enjoyed"
  821.         dc.b    ComSet,0/2,90,ComPrint,0,"this little intro"
  822.         dc.b    ComEnd
  823.  
  824. text_11:
  825.         dc.b    ComClear
  826.         dc.b    ComSet,0/2,120,ComPrint,0,"Some more patterns"
  827.         dc.b    ComSet,0/2,160,ComPrint,0,"to finish"
  828.         dc.b    ComEnd
  829.  
  830.         even
  831.  
  832. Text_Convert_Table:
  833.         dcb.b    65-32,-1
  834.         dc.b    26,27,28,29,30,31,32,33,34,35,36,37,38
  835.         dc.b    39,40,41,42,43,44,45,46,47,48,49,50,51
  836.         dcb.b    6,-1
  837.         dc.b    0,1,2,3,4,5,6,7,8,9,10,11,12
  838.         dc.b    13,14,15,16,17,18,19,20,21,22,23,24,25
  839.         even
  840.  
  841. text_mask_table:
  842.         dc.w    %1111111111111111    ;16
  843.         dc.w    %0111111111111111    ;15
  844.         dc.w    %0011111111111111    ;14
  845.         dc.w    %0001111111111111    ;13
  846.         dc.w    %0000111111111111    ;12
  847.         dc.w    %0000011111111111    ;11
  848.         dc.w    %0000001111111111    ;10
  849.         dc.w    %0000000111111111    ;9
  850.         dc.w    %0000000011111111    ;8
  851.         dc.w    %0000000001111111    ;7
  852.         dc.w    %0000000000111111    ;6
  853.         dc.w    %0000000000011111    ;5
  854.         dc.w    %0000000000001111    ;4
  855.         dc.w    %0000000000000111    ;3
  856.         dc.w    %0000000000000011    ;2
  857.         dc.w    %0000000000000001    ;1    
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866. script:
  867.         ;dc.l    script_fade,greetings_palette,1
  868.         ;dc.l    script_wait_music,$10
  869.         ;dc.l    greetings
  870.  
  871.  
  872.         dc.l    script_install_picture,avena_picture
  873.         dc.l    script_wait_music,$120
  874.         dc.l    script_display_picture
  875.  
  876.         dc.l    script_wait_music,100+$120
  877.         dc.l    script_fade,black_palette,1
  878.  
  879.         dc.l    script_text_handler,text_1
  880.         dc.l    script_wait_music,200+$120
  881.         dc.l    script_display_text_screen
  882.         dc.l    script_wait_music,270+$120
  883.         dc.l    script_fade,black_palette,1
  884.  
  885.         dc.l    script_text_handler,text_2
  886.         dc.l    script_wait_music,340+$120
  887.         dc.l    script_display_text_screen
  888.         dc.l    script_wait_music,410+$120
  889.         dc.l    script_fade,black_palette,1
  890.         dc.l    script_text_handler,text_3
  891.         dc.l    script_wait_music,480+$120
  892.         dc.l    script_display_text_screen
  893.         dc.l    script_wait_music,550+$120
  894.         dc.l    script_fade,black_palette,1
  895.  
  896.         dc.l    script_wait_music,$3d0
  897.         dc.l    script_fade,white_palette,1
  898.         dc.l    script_wait_music,$3f0
  899.  
  900.         dc.l    script_tunnel_start,$480    ;go!
  901.         dc.l    20,80
  902.         dc.l    2*((200*0)+0),tunnel_palette_1
  903.         dc.l    tunnel_gfx_1
  904.  
  905.         dc.l    script_fade,white_palette,1
  906.         dc.l    script_wait_music,$4a0
  907.         dc.l    script_bunny
  908.         dc.l    script_install_picture,bunny_picture
  909.         dc.l    script_display_picture
  910.         dc.l    script_wait_music,$540
  911.         dc.l    script_fade,white_palette,1
  912.         dc.l    script_wait_music,$560
  913.  
  914.         dc.l    script_tunnel_start,$600
  915.         dc.l    10,100
  916.         dc.l    2*((200*0)+100),tunnel_palette_2
  917.         dc.l    tunnel_gfx_2
  918.  
  919.         dc.l    script_tunnel_start,$700
  920.         dc.l    20,50
  921.         dc.l    2*((200*0)+40),tunnel_palette_3
  922.         dc.l    tunnel_gfx_3
  923.  
  924.         dc.l    script_tunnel_start,$800
  925.         dc.l    10,100
  926.         dc.l    2*((200*0)+100),tunnel_palette_4
  927.         dc.l    tunnel_gfx_4
  928.  
  929.         dc.l    script_text_handler,text_4
  930.         dc.l    script_wait_music,$810
  931.         dc.l    script_display_text_screen
  932.         dc.l    script_wait_music,$880
  933.         dc.l    script_fade,black_palette,1
  934.         dc.l    script_text_handler,text_5
  935.         dc.l    script_wait_music,$890
  936.         dc.l    script_display_text_screen
  937.         dc.l    script_wait_music,$900
  938.         dc.l    script_fade,black_palette,1
  939.  
  940.         dc.l    script_text_handler,text_6
  941.         dc.l    script_wait_music,$910
  942.         dc.l    script_display_text_screen
  943.  
  944.         dc.l    script_wash_start
  945.         dc.l    0,bunny_picture+32+30
  946.  
  947.         dc.l    script_wait_music,$980
  948.         dc.l    script_fade,black_palette,2
  949.         dc.l    script_wait_music,$9e0
  950.  
  951. tb= $9e0
  952. ; purely stationary
  953.         dc.l    script_wash_do
  954.         dc.l    bunny_picture+0
  955.         dc.l    $40            ;rot start
  956.         dc.l    100,0,0            ;rot amount, speed, offset
  957.         dc.l    20,0,0            ;rip amount, speed, offset
  958.         dc.l    tb+$50            ;finish time
  959.  
  960.         dc.l    script_wash_do
  961.         dc.l    bunny_picture+0
  962.         dc.l    $80            ;rot start
  963.         dc.l    200,0,20        ;rot amount, speed, offset
  964.         dc.l    0,00,0            ;rip amount, speed, offset
  965.         dc.l    tb+$a0            ;finish time
  966.  
  967.         dc.l    script_wash_do
  968.         dc.l    bunny_picture+0
  969.         dc.l    0            ;rot start
  970.         dc.l    100,0,10        ;rot amount, speed, offset
  971.         dc.l    0,00,0            ;rip amount, speed, offset
  972.         dc.l    tb+$f0            ;finish time
  973.  
  974. ; Oh dear, whats this?
  975.         dc.l    script_text_handler,text_7
  976.         dc.l    script_display_text_screen
  977.         dc.l    script_wait_music,tb+$180
  978.         dc.l    script_fade,black_palette,1
  979.         dc.l    script_wait_music,tb+$1a0
  980.  
  981.         dc.l    script_wash_do
  982.         dc.l    bunny_picture+0
  983.         dc.l    0        ;rot start
  984.         dc.l    100,10,4    ;rot amount, speed, offset
  985.         dc.l    0,00,0        ;rip amount, speed, offset
  986.         dc.l    tb+$280        ;finish time
  987.  
  988.         dc.l    script_wash_do
  989.         dc.l    bunny_picture+0
  990.         dc.l    0        ;rot start
  991.         dc.l    0,0,0        ;rot amount, speed, offset
  992.         dc.l    20,20,0        ;rip amount, speed, offset
  993.         dc.l    tb+$480        ;finish time
  994.  
  995.         dc.l    script_wash_do
  996.         dc.l    bunny_picture+0
  997.         dc.l    0        ;rot start
  998.         dc.l    0,0,0        ;rot amount, speed, offset
  999.         dc.l    20,20,-40    ;rip amount, speed, offset
  1000.         dc.l    tb+$600        ;finish time
  1001.  
  1002.         dc.l    script_text_handler,text_8
  1003.         dc.l    script_display_text_screen
  1004.  
  1005.         dc.l    script_wash_start
  1006.         dc.l    0,stramiel_picture+32
  1007.  
  1008.         dc.l    script_wait_music,tb+$700
  1009.  
  1010.         dc.l    script_fade,black_palette,1
  1011.         dc.l    script_wait_music,tb+$720
  1012. ; Uncle Sam
  1013.         dc.l    script_wash_do
  1014.         dc.l    stramiel_picture+0
  1015.         dc.l    0        ;rot start
  1016.         dc.l    100,8,8        ;rot amount, speed, offset
  1017.         dc.l    0,0,0        ;rip amount, speed, offset
  1018.         dc.l    tb+$880        ;finish time
  1019.  
  1020.         dc.l    script_wash_do
  1021.         dc.l    stramiel_picture+0
  1022.         dc.l    0        ;rot start
  1023.         dc.l    100,8,4        ;rot amount, speed, offset
  1024.         dc.l    30,4,4        ;rip amount, speed, offset
  1025.         dc.l    tb+$a00        ;finish time
  1026.  
  1027. tb2=tb+$a00
  1028.  
  1029.         dc.l    script_wash_start
  1030.         dc.l    1,0
  1031.  
  1032. ;tb2=$80
  1033. ; Patterned effects:
  1034.         dc.l    script_wash_do
  1035.         dc.l    pattern_palette_1
  1036.         dc.l    0        ;rot start
  1037.         dc.l    0,8,4        ;rot amount, speed, offset
  1038.         dc.l    0,14,-8        ;rip amount, speed, offset
  1039.         dc.l    tb2+$80    ;finish time
  1040.  
  1041.         dc.l    script_wash_do
  1042.         dc.l    pattern_palette_2
  1043.         dc.l    0        ;rot start
  1044.         dc.l    0,8,4        ;rot amount, speed, offset
  1045.         dc.l    20,14,-38    ;rip amount, speed, offset
  1046.         dc.l    tb2+$180    ;finish time
  1047.  
  1048.         dc.l    script_wash_do
  1049.         dc.l    pattern_palette_3
  1050.         dc.l    0        ;rot start
  1051.         dc.l    100,4,4        ;rot amount, speed, offset
  1052.         dc.l    20,14,10    ;rip amount, speed, offset
  1053.         dc.l    tb2+$3c0    ;finish time
  1054.  
  1055. gb=tb2+$3c0
  1056. ; Greetings:
  1057.         dc.l    script_text_handler,text_9
  1058.         dc.l    script_display_text_screen
  1059.         dc.l    script_wait_music,gb+$c0
  1060.         dc.l    script_fade,black_palette,1
  1061.         dc.l    script_wait_music,gb+$10
  1062.         dc.l    script_reset_timer
  1063.         dc.l    script_fade,greetings_palette,1
  1064.         dc.l    script_wait_music,$10
  1065.         dc.l    greetings
  1066.  
  1067.         dc.l    script_reset_timer
  1068. ; " Goodbye"
  1069.         dc.l    script_fade,black_palette,1
  1070.         dc.l    script_wait_music,$10
  1071.         dc.l    script_text_handler,text_10
  1072.         dc.l    script_display_text_screen
  1073.         dc.l    script_wait_music,$80
  1074.         dc.l    script_fade,black_palette,1
  1075.         dc.l    script_wait_music,$90
  1076.  
  1077.         dc.l    script_reset_timer
  1078.  
  1079.         dc.l    script_text_handler,text_11
  1080.         dc.l    script_display_text_screen
  1081.  
  1082.         dc.l    script_wash_start
  1083.         dc.l    1,0
  1084.  
  1085.         dc.l    script_wait_music,$80
  1086.         dc.l    script_fade,black_palette,1
  1087.         dc.l    script_wait_music,$90
  1088. ; End Loop
  1089. end_loop:
  1090.         dc.l    script_reset_timer
  1091.  
  1092. ;tb2=$80
  1093. ; Patterned effects:
  1094.         dc.l    script_wash_do
  1095.         dc.l    pattern_palette_1
  1096.         dc.l    0        ;rot start
  1097.         dc.l    0,8,4        ;rot amount, speed, offset
  1098.         dc.l    0,14,-8        ;rip amount, speed, offset
  1099.         dc.l    $300        ;finish time
  1100.  
  1101.         dc.l    script_wash_do
  1102.         dc.l    pattern_palette_2
  1103.         dc.l    0        ;rot start
  1104.         dc.l    30,8,4        ;rot amount, speed, offset
  1105.         dc.l    10,14,-28    ;rip amount, speed, offset
  1106.         dc.l    $600        ;finish time
  1107.  
  1108.         dc.l    script_wash_do
  1109.         dc.l    pattern_palette_3
  1110.         dc.l    0        ;rot start
  1111.         dc.l    100,4,2        ;rot amount, speed, offset
  1112.         dc.l    10,14,10    ;rip amount, speed, offset
  1113.         dc.l    $900        ;finish time
  1114.         dc.l    script_reloop,end_loop
  1115.  
  1116.         dc.l    -1
  1117.  
  1118. ;-------------------------------------------------------
  1119.             SECTION    DATA
  1120. ;-------------------------------------------------------
  1121. vbl_routine:        dc.l    0
  1122.  
  1123. text_font        incbin    data\courier.dat
  1124.             even
  1125.  
  1126.  
  1127. tunnel_gfx_buffer:
  1128. ring_buffer        ;ds.b    max_ring_number*max_ring_angle*2
  1129.             ;ds.b    4*(64*64*2)        ; = 32768 bytes
  1130. avena_picture:        incbin    d:\source2\maggie.ori\m21.pic
  1131.             ds.b    768
  1132.  
  1133. bunny_picture:        incbin    data\lapours.pic
  1134. stramiel_picture    incbin    data\stramiel.pic
  1135.  
  1136.             even
  1137. tune:            incbin    data\tune.lap
  1138.             even
  1139. sine_table:        incbin    f:\data\smallsin.dat
  1140.             even
  1141.  
  1142. tunnel_palette_1:    dc.w    $000,$112,$224,$336
  1143. tunnel_palette_2:    dc.w    $000,$212,$424,$636
  1144. tunnel_palette_3:    dc.w    $000,$114,$2ef,$fff
  1145. tunnel_palette_4:    dc.w    $000,$122,$244,$366
  1146.  
  1147. text_palette:        dc.w    $000,$444,$666,$777
  1148.             dcb.w    12,$fff
  1149.  
  1150. pattern_palette_1:
  1151.             dc.w    $000,$100,$200,$300
  1152.             dc.w    $400,$500,$600,$f00
  1153.             dc.w    $f11,$f22,$f33,$f44
  1154.             dc.w    $f55,$f66,$f77,$fff
  1155.  
  1156. pattern_palette_2:
  1157.             dc.w    $000,$001,$002,$003
  1158.             dc.w    $004,$005,$006,$007
  1159.             dc.w    $11f,$22f,$33f,$44f
  1160.             dc.w    $55f,$66f,$77f,$fff
  1161.  
  1162. pattern_palette_3:
  1163.             dc.w    $000,$101,$202,$303
  1164.             dc.w    $404,$505,$606,$707
  1165.             dc.w    $f1f,$f2f,$f3f,$f4f
  1166.             dc.w    $f5f,$f6f,$f7f,$fff
  1167.  
  1168. black_palette:        dcb.w    16,0
  1169. blue_palette:        dcb.w    16,$00f
  1170. white_palette:        dcb.w    16,$fff
  1171.  
  1172.  
  1173. ;-------------------------------------------------------
  1174.             SECTION    BSS
  1175. ;-------------------------------------------------------
  1176.             even
  1177. bunny_palette:        ds.w    16
  1178. old_colours        ds.w    16
  1179. text_x            ds.w    1
  1180. text_y            ds.w    1
  1181. text_to_add        ds.w    1
  1182. textscreen        ds.l    1
  1183.  
  1184. logic            ds.l    1
  1185. physic            ds.l    1
  1186. keyboard_dummy:        ds.w    1
  1187.  
  1188. palette_address:    ds.l    1
  1189. palette_flag:        ds.w    1
  1190. fade_speed        ds.w    1
  1191. fade_temp        ds.w    1
  1192. fade_start        ds.b    16*3
  1193. fade_destination    ds.b    16*3
  1194.             even
  1195. fade_count        ds.w    1
  1196. fade_done_flag        ds.w    1
  1197. current_palette        ds.w    16
  1198.  
  1199. vbl_timer:        ds.l    1
  1200. music_timer:        ds.l    1
  1201.  
  1202. save_stack:        ds.l    1
  1203. save_area:        ds.b    64
  1204. save_resolution:    ds.w    1
  1205. soundchip_buffer:    ds.b    16
  1206.  
  1207.             ds.l    200
  1208. stack:
  1209.  
  1210.             ds.b    256
  1211. screens:        ds.b    32000*2
  1212.  
  1213.  
  1214.             include    greets.s
  1215.             include    wash2.s
  1216.             include    tunnel2.s
  1217.  
  1218.  
  1219.  
  1220.