home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI10.ARJ / ictari.10 / ASSEMBLY / NEWTWIST / NEWTWIST.S < prev    next >
Text File  |  1997-09-17  |  22KB  |  958 lines

  1. * Serial number: 0359477910
  2.  
  3.  **********************************************
  4. *        The twist scroll    (Low Rez)           *
  5. *     Coding January 1989 by manikin           *
  6. *      of the lost boys                   *
  7. *                           *
  8. *  To contact us:    12 Cambridge Rd           *
  9. *        Teddington           *
  10. *        Middx               *
  11. *        TW11 8DR               *
  12. *                       *  
  13. *    Set TABS to 10                   *
  14.  **********************************************
  15. * Adjusted for medium resolution by            *
  16. *         I.D.Hancock                          *
  17. *                                              *
  18. * Now loads message from text file. SCROLL.TXT *
  19. * (Sorry about the 2 spaces for a CR-LF but    *
  20. * I got bored. I tried a piccy in the backgrnd *
  21. * but The Lost Boys use XOR to show the scroll *
  22. * so I changed my mind. Just lazy really :(  ) *
  23. * Which should be less than 10k, unless you    *
  24. * change the last line of this code !          *
  25. * Uses screen memory from the program and not  *
  26. * fixed screen memory. Simplifies the screen   *
  27. * swap routine which was well lame before :)   *
  28. * Restores the colours which it changes.       *
  29. * Should work on any config of ST ? not tested *
  30. *                                              *
  31. * Alterations made for iCTARi in 1994          *
  32. * Written on 4Mb STE using Devpac 2.25         *
  33.  **********************************************
  34. start    
  35.     dc.w     $a00a        lose mouse
  36.  
  37.     clr.l     -(sp)        set supervisor
  38.     move     #$20,-(sp)
  39.     trap     #1
  40.     add.l     #6,sp
  41.     move.l     d0,oldssp
  42.  
  43. * Sort out the scrolls text
  44. * pad start of scroll with spaces
  45.     movea.l    #scrolline,a1    start of scroll address
  46.     move.w    #21,d0        loop counter for 22 spaces
  47. spaceloop
  48.     move.b    #$20,(a1)+
  49.     dbra    d0,spaceloop
  50.     
  51. * load in the text file "scroll.txt"
  52.     move.w    #0,-(sp)          load a file
  53.     move.l    #fname,-(sp)    with file name
  54.     move.w    #$3d,-(sp)
  55.     trap    #1
  56.     addq.l    #8,sp
  57.     
  58.     move.l    d0,d2        file handle
  59.     
  60.     move.l    #thescroll,-(sp)    data start address
  61.     move.l    #maxlength,-(sp)    max data length in bytes
  62.     move.w    d2,-(sp)        file handle
  63.     move.w    #$3f,-(sp)    load block to memory
  64.     trap    #1
  65.     add.l    #12,sp
  66.  
  67. * Remove all CR LF's and replace with spaces and
  68. * pad end of message with gaps and put a $ff at the end    
  69.     movea.l    #thescroll,a0    get message w/o spaces in a0
  70.     move.l    a0,a1        and in a1
  71.     add.l    d0,a1        end of the text in a1
  72.     
  73. replaceloop
  74.     cmp.b    #$0d,(a0)
  75.     bne    not_crlf
  76.     
  77.     move.b    #$20,(a0)+
  78.     move.b    #$20,(a0)
  79. not_crlf
  80.     addq.l    #1,a0
  81.     
  82.     cmp.l    a1,a0
  83.     bls    replaceloop
  84.     
  85. * do the padding
  86.     move.w    #21,d0        counter for space padding
  87. spaceloop2
  88.     move.b    #$20,(a1)+
  89.     dbra    d0,spaceloop2
  90.     
  91.     move.b    #$ff,(a1)        put an ff at the end of the text
  92.     
  93.     move.w    d2,-(sp)        close file, file handle
  94.     move.w    #$3e,-(sp)
  95.     trap    #1
  96.     addq.l    #4,sp
  97.  
  98. * Sort out the screen resolution    
  99. * get current resolution
  100.     move.w    #4,-(sp)
  101.     trap    #14
  102.     addq.l    #2,sp
  103.     
  104.     cmp.w    #1,d0        are we in medium res
  105.     bne    cur_lo_res    already in low res
  106.     
  107. * go into lo res
  108.     move.w    #0,-(sp)
  109.     move.l    #-1,-(sp)
  110.     move.l    #-1,-(sp)
  111.     move.w    #5,-(sp)
  112.     trap    #14
  113.     add.l    #12,sp
  114.     
  115.     move.w    #1,(old_res)    flag medium res originally
  116.     bra    res_sorted
  117.  
  118. cur_lo_res
  119.     move.w    #-1,(old_res)    flag low res originally
  120. *                ie. don't change to med on exit
  121. res_sorted
  122.  
  123. * calculate the screen addresses. STFM needs them to be 256 byte
  124. * boundary aligned :(
  125.     move.l    #screenspace,d0
  126.     clr.b    d0
  127.     move.l    d0,screen
  128.     add.l    #32000,d0
  129.     move.l    d0,screen1
  130. * screens calculated.
  131.  
  132.     bsr     makefonts        make up the fonts
  133.  
  134.     move     #2,-(sp)        get physbase
  135.     trap     #14    
  136.     add.l     #2,sp
  137.     move.l     d0,savescrn
  138.  
  139. * set up some colours
  140.     move.l    $ff8240,colpal1    remember some old colors
  141.     move.l    $ff8244,colpal2    "
  142.     
  143. *                     bRGBlRGB    background,letter_foreground
  144.     move.l     #$00000070,$ff8240    set a few colors
  145.     
  146. *                     lRGBcRGB    let_background,let_crossover
  147.     move.l     #$07770070,$ff8244
  148.  
  149.  ****************************
  150. *     the main loop          *
  151.  ****************************
  152.  
  153. vbloop    
  154. * swap the screens
  155.     move.l     screen1,d0    screen1=physbase
  156.     move.l     screen,screen1    swap screens. NB:screen=logbase
  157.     move.l    d0,screen        complete swap
  158.     
  159.     move     #-1,-(sp)        set screens using xbios 5
  160.     move.l     screen1,-(sp)    phys
  161.     move.l     screen,-(sp)    log
  162.     move     #5,-(sp)
  163.     trap     #14
  164.     add.l     #12,sp
  165.  
  166.     move     #2,-(sp)        any keys waiting
  167.     move     #1,-(sp)
  168.     trap     #13
  169.     addq.l     #4,sp
  170.     tst     d0        test for key
  171.     bne    twistend        yes then exit the twist scroll
  172.  
  173.     move     #37,-(sp)        wait for vbl
  174.     trap     #14
  175.     add.l     #2,-(sp)
  176.  
  177.     add.l    #8640,fonttype    take the next font
  178.     cmp.l     #fontend,fonttype    is it past the last font?
  179.     bne     cont        if no then continue
  180.     move.l     #font1,fonttype    else reset font pointer to first font
  181.     add.l     #1,scrollpnt    advance scrolline by 1 character
  182.     move.l     scrollpnt,a6    get scroll
  183.     clr.l     d6
  184.     move.b     (a6)+,d6            
  185.     cmp.b     #$ff,21(a6)    test for end of scrolline
  186.     bne     cont        no then continue
  187.     move.l     #scrolline,scrollpnt    else restart scroll
  188.  
  189.  ********************************************************
  190. * Well this is the actual scrolline. each character is   *
  191. * is put on the screen by its own little routine.        *
  192. * which puts its character to a particular point in the  *
  193. * buffer. The first part of the character is added to    *
  194. * the screen while the second part is moved straight to  *
  195. * the screen. ie first word added second word moved      *
  196. * this is done (in general) for the first 29 lines but   *
  197. * as each character is 8 lines lower than the last the   *
  198. * last 8 lines would be added to themselves as the       *
  199. * previous character would not have cleared the screen   *
  200. * with its own character.       If you can understand    *
  201. * this bit then you have the key to the twist scroll.    *
  202. * take your time it will all become clear.           *
  203. * The scroll was worked out very carefully originally    *
  204. * so that where a character extends over the bottom of   *
  205. * the buffer it is drawn over at the top. This is done   *
  206. * in the dbra loops so you'll have to study them         *
  207. * carefully to see where.                   *
  208.  ********************************************************
  209.  
  210. cont    move.l     scrollpnt,a6    get scroll pointer
  211.     move.l     fonttype,a0    get fonttype
  212.     clr.l     d6
  213.     move.b     (a6)+,d6        get character
  214.     sub.b     #32,d6
  215.     mulu     #144,d6        get offset for this character in font
  216.     add.l     d6,a0
  217.     move.l     screen,a1        
  218.     add.l     #32,a0
  219.     move     #29-1,d0        do 29 lines
  220. f_draw    add.l     #2,a0        this is the first character
  221.     move     (a0)+,(a1)    so only the second half is drawn 
  222.     add.l     #160,a1        on the screen.
  223.     dbra     d0,f_draw
  224.  
  225.     move.l     fonttype,a0    as above
  226.     clr.l     d6
  227.     move.b     (a6)+,d6
  228.     sub.b     #32,d6
  229.     mulu     #144,d6
  230.     add.l     d6,a0
  231.     move.l     screen,a1
  232.     move     #28,d0        do 29 lines
  233. f_draw1c    move     (a0)+,d5        
  234.     add     d5,(a1)        add to screen
  235.     move     (a0)+,8(a1)    move to screen 
  236.     add.l     #160,a1
  237.     dbra     d0,f_draw1c
  238.     
  239.     move     #7,d0        do another 8 lines
  240. f_draw1d    move     (a0)+,(a1)    move to screen
  241.     move     (a0)+,8(a1)    add to screen
  242.     add.l     #160,a1
  243.     dbra     d0,f_draw1d
  244.  
  245.  ***********************************************
  246. * Construction of buffer continues as above     *
  247. * with appropriate offsets etc                  *
  248.  ***********************************************
  249.  
  250.     move     #28,d0
  251.     move.l     fonttype,a0
  252.     clr.l     d6
  253.     move.b     (a6)+,d6
  254.     sub.b     #32,d6
  255.     mulu     #144,d6
  256.     add.l     d6,a0
  257.     move.l     screen,a1
  258.     add.l     #1288,a1
  259. f_draw1    move     (a0)+,d5
  260.     add     d5,(a1)
  261.     move     (a0)+,8(a1)
  262.     add.l     #160,a1
  263.     dbra     d0,f_draw1
  264.     
  265.     move     #7,d0
  266. f_draw1b    move     (a0)+,(a1)
  267.     move     (a0)+,8(a1)
  268.     add.l     #160,a1
  269.     dbra     d0,f_draw1b
  270.     
  271.     move     #28,d0
  272.     move.l     fonttype,a0
  273.     clr.l     d6
  274.     move.b     (a6)+,d6
  275.     sub.b     #32,d6
  276.     mulu     #144,d6
  277.     add.l     d6,a0
  278.     move.l     screen,a1
  279.     add.l     #2576,a1
  280. f_draw2    move     (a0)+,d5
  281.     add     d5,(a1)
  282.     move     (a0)+,8(a1)
  283.     add.l     #160,a1
  284.     dbra     d0,f_draw2
  285.     
  286.     move     #7,d0
  287. f_draw2b    move     (a0)+,(a1)
  288.     move     (a0)+,8(a1)
  289.     add.l     #160,a1
  290.     dbra     d0,f_draw2b
  291.     
  292.     move     #28,d0
  293.     move.l     fonttype,a0
  294.     clr.l     d6
  295.     move.b     (a6)+,d6
  296.     sub.b     #32,d6
  297.     mulu     #144,d6
  298.     add.l     d6,a0
  299.     move.l     screen,a1
  300.     add.l     #3864,a1
  301. f_draw3    move     (a0)+,d5
  302.     add     d5,(a1)
  303.     move     (a0)+,8(a1)
  304.     add.l     #160,a1
  305.     dbra     d0,f_draw3
  306.     
  307.     move     #7,d0
  308. f_draw3b    move     (a0)+,(a1)
  309.     move     (a0)+,8(a1)
  310.     add.l     #160,a1
  311.     dbra     d0,f_draw3b
  312.     
  313.     move     #28,d0
  314.     move.l     fonttype,a0
  315.     clr.l     d6
  316.     move.b     (a6)+,d6
  317.     sub.b     #32,d6
  318.     mulu     #144,d6
  319.     add.l     d6,a0
  320.     move.l     screen,a1
  321.     add.l     #5152,a1
  322. f_draw4    move     (a0)+,d5
  323.     add     d5,(a1)
  324.     move     (a0)+,8(a1)
  325.     add.l     #160,a1
  326.     dbra     d0,f_draw4
  327.     
  328.     move     #7,d0
  329. f_draw4b    move     (a0)+,(a1)
  330.     move     (a0)+,8(a1)
  331.     add.l     #160,a1
  332.     dbra     d0,f_draw4b
  333.     
  334.     move     #28,d0
  335.     move.l     fonttype,a0
  336.     clr.l     d6
  337.     move.b     (a6)+,d6
  338.     sub.b     #32,d6
  339.     mulu     #144,d6
  340.     add.l     d6,a0
  341.     move.l     screen,a1
  342.     add.l     #6440,a1
  343. f_draw5    move     (a0)+,d5
  344.     add     d5,(a1)
  345.     move     (a0)+,8(a1)
  346.     add.l     #160,a1
  347.     dbra     d0,f_draw5
  348.     
  349.     move     #7,d0
  350. f_draw5b    move     (a0)+,(a1)
  351.     move     (a0)+,8(a1)
  352.     add.l     #160,a1
  353.     dbra     d0,f_draw5b
  354.     
  355.     move     #28,d0
  356.     move.l     fonttype,a0
  357.     clr.l     d6
  358.     move.b     (a6)+,d6
  359.     sub.b     #32,d6
  360.     mulu     #144,d6
  361.     add.l     d6,a0
  362.     move.l     screen,a1
  363.     add.l     #7728,a1
  364. f_draw6    move     (a0)+,d5
  365.     add     d5,(a1)
  366.     move     (a0)+,8(a1)
  367.     add.l     #160,a1
  368.     dbra     d0,f_draw6
  369.     
  370.     move     #2,d0
  371. f_draw6b    move     (a0)+,(a1)
  372.     move     (a0)+,8(a1)
  373.     add.l     #160,a1
  374.     dbra     d0,f_draw6b
  375.     
  376.     move     #4,d0
  377. f_draw6c    move     (a0)+,-12800(a1)
  378.     move     (a0)+,-12792(a1)
  379.     add.l     #160,a1
  380.     dbra     d0,f_draw6c
  381.     
  382.     move     #23,d0
  383.     move.l     fonttype,a0
  384.     clr.l     d6
  385.     move.b     (a6)+,d6
  386.     sub.b     #32,d6
  387.     mulu     #144,d6
  388.     add.l     d6,a0
  389.     move.l     screen,a1
  390.     add.l     #9016,a1
  391. f_draw7    move     (a0)+,d5
  392.     add     d5,(a1)
  393.     move     (a0)+,8(a1)
  394.     add.l     #160,a1
  395.     dbra     d0,f_draw7
  396.     
  397.     move     #4,d0
  398. f_draw7c    move     (a0)+,d5
  399.     add     d5,-12800(a1)
  400.     move     (a0)+,-12792(a1)
  401.     add.l     #160,a1
  402.     dbra     d0,f_draw7c
  403.     
  404.     move     #7,d0
  405. f_draw7b    move     (a0)+,-12800(a1)
  406.     move     (a0)+,-12792(a1)
  407.     add.l     #160,a1
  408.     dbra     d0,f_draw7b
  409.     
  410.     move     #15,d0
  411.     move.l     fonttype,a0
  412.     clr.l     d6
  413.     move.b     (a6)+,d6
  414.     sub.b     #32,d6
  415.     mulu     #144,d6
  416.     add.l     d6,a0
  417.     move.l     screen,a1
  418.     add.l     #10304,a1
  419. f_draw8c    move     (a0)+,d5
  420.     add     d5,(a1)
  421.     move     (a0)+,8(a1)
  422.     add.l     #160,a1
  423.     dbra     d0,f_draw8c
  424.     
  425.     move     #12,d0
  426. f_draw8    move     (a0)+,d5
  427.     add     d5,-12800(a1)
  428.     move     (a0)+,-12792(a1)
  429.     add.l     #160,a1
  430.     dbra     d0,f_draw8
  431.     
  432.     move     #7,d0
  433. f_draw8b    move     (a0)+,-12800(a1)
  434.     move     (a0)+,-12792(a1)
  435.     add.l     #160,a1
  436.     dbra     d0,f_draw8b
  437.     
  438.     move     #7,d0
  439.     move.l     fonttype,a0
  440.     clr.l     d6
  441.     move.b     (a6)+,d6
  442.     sub.b     #32,d6
  443.     mulu     #144,d6
  444.     add.l     d6,a0
  445.     move.l     screen,a1
  446.     add.l     #11592,a1
  447. f_draw9    move     (a0)+,d5
  448.     add     d5,(a1)
  449.     move     (a0)+,8(a1)
  450.     add.l     #160,a1
  451.     dbra     d0,f_draw9
  452.     
  453.     move     #20,d0
  454. f_draw9b    move     (a0)+,d5
  455.     add     d5,-12800(a1)
  456.     move     (a0)+,-12792(a1)
  457.     add.l     #160,a1
  458.     dbra     d0,f_draw9b
  459.     
  460.     move     #7,d0
  461. f_draw9c    move     (a0)+,-12800(a1)
  462.     move     (a0)+,-12792(a1)
  463.     add.l     #160,a1
  464.     dbra     d0,f_draw9c
  465.     
  466.     move     #28,d0
  467.     move.l     fonttype,a0
  468.     clr.l     d6    
  469.     move.b     (a6)+,d6
  470.     sub.b     #32,d6
  471.     mulu     #144,d6
  472.     add.l     d6,a0
  473.     move.l     screen,a1
  474.     add.l     #80,a1
  475. f_draw10    move     (a0)+,d5
  476.     add     d5,(a1)
  477.     move     (a0)+,8(a1)
  478.     add.l     #160,a1
  479.     dbra     d0,f_draw10
  480.     
  481.     move     #7,d0
  482. f_draw10c    move     (a0)+,(a1)
  483.     move     (a0)+,8(a1)
  484.     add.l     #160,a1
  485.     dbra     d0,f_draw10c
  486.     
  487.     move     #28,d0
  488.     move.l     fonttype,a0
  489.     clr.l     d6
  490.     move.b     (a6)+,d6
  491.     sub.b     #32,d6
  492.     mulu     #144,d6
  493.     add.l     d6,a0
  494.     move.l     screen,a1
  495.     add.l     #1368,a1
  496. f_draw11    move     (a0)+,d5
  497.     add     d5,(a1)
  498.     move     (a0)+,8(a1)
  499.     add.l     #160,a1
  500.     dbra     d0,f_draw11
  501.     
  502.     move     #7,d0
  503. f_draw11b    move     (a0)+,(a1)
  504.     move     (a0)+,8(a1)
  505.     add.l     #160,a1
  506.     dbra     d0,f_draw11b
  507.     
  508.     move     #28,d0
  509.     move.l     fonttype,a0
  510.     clr.l     d6
  511.     move.b     (a6)+,d6
  512.     sub.b     #32,d6
  513.     mulu     #144,d6
  514.     add.l     d6,a0
  515.     move.l     screen,a1
  516.     add.l     #2656,a1
  517. f_draw12    move     (a0)+,d5
  518.     add     d5,(a1)
  519.     move     (a0)+,8(a1)
  520.     add.l     #160,a1
  521.     dbra     d0,f_draw12
  522.     
  523.     move     #7,d0
  524. f_draw12b    move     (a0)+,(a1)
  525.     move     (a0)+,8(a1)
  526.     add.l     #160,a1
  527.     dbra     d0,f_draw12b
  528.     
  529.     move     #28,d0
  530.     move.l     fonttype,a0
  531.     clr.l     d6
  532.     move.b     (a6)+,d6
  533.     sub.b     #32,d6
  534.     mulu     #144,d6
  535.     add.l     d6,a0
  536.     move.l     screen,a1
  537.     add.l     #3944,a1
  538. f_draw13    move     (a0)+,d5
  539.     add     d5,(a1)
  540.     move     (a0)+,8(a1)
  541.     add.l     #160,a1
  542.     dbra     d0,f_draw13
  543.     
  544.     move     #7,d0
  545. f_draw13b    move     (a0)+,(a1)
  546.     move     (a0)+,8(a1)
  547.     add.l     #160,a1
  548.     dbra     d0,f_draw13b
  549.     
  550.     move     #28,d0
  551.     move.l     fonttype,a0
  552.     clr.l     d6
  553.     move.b     (a6)+,d6
  554.     sub.b     #32,d6
  555.     mulu     #144,d6
  556.     add.l     d6,a0
  557.     move.l     screen,a1
  558.     add.l     #5232,a1
  559. f_draw14    move     (a0)+,d5
  560.     add     d5,(a1)
  561.     move     (a0)+,8(a1)
  562.     add.l     #160,a1
  563.     dbra     d0,f_draw14
  564.     
  565.     move     #7,d0
  566. f_draw14b    move     (a0)+,(a1)
  567.     move     (a0)+,8(a1)
  568.     add.l     #160,a1
  569.     dbra     d0,f_draw14b
  570.     
  571.     move     #28,d0
  572.     move.l     fonttype,a0
  573.     clr.l     d6
  574.     move.b     (a6)+,d6
  575.     sub.b     #32,d6
  576.     mulu     #144,d6
  577.     add.l     d6,a0
  578.     move.l     screen,a1
  579.     add.l     #6520,a1
  580. f_draw15    move     (a0)+,d5
  581.     add     d5,(a1)
  582.     move     (a0)+,8(a1)
  583.     add.l     #160,a1
  584.     dbra     d0,f_draw15
  585.     
  586.     move     #7,d0
  587. f_draw15b    move     (a0)+,(a1)
  588.     move     (a0)+,8(a1)
  589.     add.l     #160,a1
  590.     dbra     d0,f_draw15b
  591.     
  592.     move     #28,d0
  593.     move.l     fonttype,a0
  594.     clr.l     d6
  595.     move.b     (a6)+,d6
  596.     sub.b     #32,d6
  597.     mulu     #144,d6
  598.     add.l     d6,a0
  599.     move.l     screen,a1
  600.     add.l     #7808,a1
  601. f_draw16    move     (a0)+,d5
  602.     add     d5,(a1)
  603.     move     (a0)+,8(a1)
  604.     add.l     #160,a1
  605.     dbra     d0,f_draw16
  606.     
  607.     move     #2,d0
  608. f_draw16b    move     (a0)+,(a1)
  609.     move     (a0)+,8(a1)
  610.     add.l     #160,a1
  611.     dbra     d0,f_draw16b
  612.     
  613.     move     #4,d0
  614. f_draw16c    move     (a0)+,-12800(a1)
  615.     move     (a0)+,-12792(a1)
  616.     add.l     #160,a1
  617.     dbra     d0,f_draw16c
  618.     
  619.     move     #23,d0
  620.     move.l     fonttype,a0
  621.     clr.l     d6    
  622.     move.b     (a6)+,d6
  623.     sub.b     #32,d6
  624.     mulu     #144,d6
  625.     add.l     d6,a0
  626.     move.l     screen,a1
  627.     add.l     #9096,a1
  628. f_draw17    move     (a0)+,d5
  629.     add     d5,(a1)
  630.     move     (a0)+,8(a1)
  631.     add.l     #160,a1
  632.     dbra     d0,f_draw17
  633.     
  634.     move     #4,d0
  635. f_draw17c    move     (a0)+,d5
  636.     add     d5,-12800(a1)
  637.     move     (a0)+,-12792(a1)
  638.     add.l     #160,a1
  639.     dbra     d0,f_draw17c
  640.     
  641.     move     #7,d0
  642. f_draw17b    move     (a0)+,-12800(a1)
  643.     move     (a0)+,-12792(a1)
  644.     add.l     #160,a1
  645.     dbra     d0,f_draw17b
  646.     
  647.     move     #15,d0
  648.     move.l     fonttype,a0
  649.     clr.l     d6
  650.     move.b     (a6)+,d6
  651.     sub.b     #32,d6
  652.     mulu     #144,d6
  653.     add.l     d6,a0
  654.     move.l     screen,a1
  655.     add.l     #10384,a1
  656. f_draw18    move     (a0)+,d5
  657.     add     d5,(a1)
  658.     move     (a0)+,8(a1)
  659.     add.l     #160,a1
  660.     dbra     d0,f_draw18
  661.     
  662.     move     #12,d0
  663. f_draw18c    move     (a0)+,d5
  664.     add     d5,-12800(a1)
  665.     move     (a0)+,-12792(a1)
  666.     add.l     #160,a1
  667.     dbra     d0,f_draw18c
  668.     
  669.     move     #7,d0
  670. f_draw18b    move     (a0)+,-12800(a1)
  671.     move     (a0)+,-12792(a1)
  672.     add.l     #160,a1
  673.     dbra     d0,f_draw18b
  674.     
  675.     move     #7,d0        the last character is added 
  676.     move.l     fonttype,a0    only to the first word
  677.     clr.l     d6        the second is discarded.
  678.     move.b     (a6)+,d6
  679.     sub.b     #32,d6
  680.     mulu     #144,d6
  681.     add.l     d6,a0
  682.     move.l     screen,a1
  683.     add.l     #11672,a1
  684. f_draw19    move     (a0)+,d5
  685.     add     d5,(a1)
  686.     add.l     #2,a0
  687.     add.l     #160,a1
  688.     dbra     d0,f_draw19
  689.     
  690.     move     #20,d0
  691. f_draw19c    move     (a0)+,d5
  692.     add     d5,-12800(a1)
  693.     add.l     #2,a0
  694.     add.l     #160,a1
  695.     dbra     d0,f_draw19c
  696.     
  697.     move     #7,d0
  698. f_draw19b    move     (a0)+,-12800(a1)
  699.     add.l     #2,a0
  700.     add.l     #160,a1
  701.     dbra     d0,f_draw19b
  702.     
  703.     bsr     construct
  704.     bra    vbloop
  705.  
  706.  *******************************************
  707. * Now this is where the scroll is actually  *
  708. * constructed. this is done by copying the  *
  709. * the buffer to the screen once the right   *
  710. * way up in plane 1 then upside down and    *
  711. * in plane 2 to the screen. A table tells   *
  712. * the routine how many times to display     *
  713. * each line of the buffer. By missing or    *
  714. * or displaying some lines twice it is easy *
  715. * to give the appearance of wrapping the    *
  716. * scroll around a bar.                      *
  717.  *******************************************
  718.  
  719. construct    move.l     screen,a1
  720.     move.l     a1,a0
  721.     add.l     #16000,a1        start scroll 100 lines down screen
  722.     move.l     a1,a3
  723.     add.l     #10722,a3        start the upside down bit further down and in plane2
  724.     move.l     #addtab,a2    the addtable (for controlling the drawing of scroll)
  725.     move     #67,d0        do 68 lines
  726. cnstruct1    move    (a0),(a1)    copy buffer to screen
  727.     move     8(a0),8(a1)
  728.     move     16(a0),16(a1)
  729.     move     24(a0),24(a1)
  730.     move     32(a0),32(a1)
  731.     move     40(a0),40(a1)
  732.     move     48(a0),48(a1)
  733.     move     56(a0),56(a1)
  734.     move     64(a0),64(a1)
  735.     move     72(a0),72(a1)
  736.     move     80(a0),80(a1)
  737.     move     88(a0),88(a1)
  738.     move     96(a0),96(a1)
  739.     move     104(a0),104(a1)
  740.     move     112(a0),112(a1)
  741.     move     120(a0),120(a1)
  742.     move     128(a0),128(a1)
  743.     move     136(a0),136(a1)
  744.     move     144(a0),144(a1)
  745.     move     152(a0),152(a1)
  746.     move     (a0),(a3)        move buffer to plane 2 
  747.     move     8(a0),8(a3)
  748.     move     16(a0),16(a3)
  749.     move     24(a0),24(a3)
  750.     move     32(a0),32(a3)
  751.     move     40(a0),40(a3)
  752.     move     48(a0),48(a3)
  753.     move     56(a0),56(a3)
  754.     move     64(a0),64(a3)
  755.     move     72(a0),72(a3)
  756.     move     80(a0),80(a3)
  757.     move     88(a0),88(a3)
  758.     move     96(a0),96(a3)
  759.     move     104(a0),104(a3)
  760.     move     112(a0),112(a3)
  761.     move     120(a0),120(a3)
  762.     move     128(a0),128(a3)
  763.     move     136(a0),136(a3)
  764.     move     144(a0),144(a3)
  765.     move     152(a0),152(a3)
  766.     add.l     #160,a1        add one line to first pointer
  767.     sub.l     #160,a3        sub one line from second pointer
  768.     move     (a2)+,d1        take value from add table for how
  769.     add     d1,a0        many lines to advance through buffer
  770.     dbra     d0,cnstruct1
  771.     rts
  772.  
  773.  ****************************************
  774. * the exit routine. if you've finished   *
  775. * gawping at our amazing scroll then you *
  776. * are free to leave!!!!!!!!!!!!!!!!!!!!  *
  777.  ****************************************
  778.  
  779. twistend    move.l     colpal1,$ff8240    reset some colors
  780.     move.l     colpal2,$ff8244
  781.     move.l     oldssp,-(sp)    back to user mode
  782.     move      #$20,-(sp)
  783.     trap      #1
  784.     add.l     #6,sp    
  785.  
  786.     move.w    old_res,d0    get old res in d0
  787.     
  788.     move.w     d0,-(sp)        reset screen pointer+original res
  789.     move.l     savescrn,-(sp)
  790.     move.l     savescrn,-(sp)
  791.     move     #5,-(sp)
  792.     trap     #14
  793.     add.l     #12,sp    
  794.  
  795.     clr     -(sp)        good bye cruel world!!!
  796.     trap     #1        aaaarrghhhhhhh!!!!!!!
  797.  
  798.  
  799.  **************************************
  800. *  These routines are for making the   *
  801. *  special fonts which this scroll     *
  802. *  uses to make the diagonal scroll    *
  803. *  each copy of the original font is   *
  804. *  shifted left by 2 pixels and        *
  805. *  moved up by one from the previous   *
  806. *  thus when all 8 copies are animated *
  807. *  they appear to move diagonally      *
  808.  **************************************
  809.  
  810. makefonts    lea     mainfont,a0    take original font
  811.     lea     font1,a1        first copy
  812.     move     #32,d0        start 8 lines in to char        
  813.     move     #0,d4        shift left by 1 pixel
  814.     bsr     movefont
  815.     
  816.     lea     mainfont,a0    take original font
  817.     lea     font2,a1        second copy
  818.     move     #28,d0        start 7 lines in to char
  819.     move     #2,d4        shift left by 3 pixels
  820.     bsr     movefont    
  821.     
  822.     lea     mainfont,a0    take original font
  823.     lea     font3,a1        third copy
  824.     move     #24,d0        start 6 line s in to char
  825.     move     #4,d4        shift left by 5 pixels
  826.     bsr     movefont
  827.     
  828.     lea     mainfont,a0    etc
  829.     lea     font4,a1
  830.     move     #20,d0        etc
  831.     move     #6,d4
  832.     bsr     movefont
  833.     
  834.     lea     mainfont,a0
  835.     lea     font5,a1
  836.     move     #16,d0
  837.     move     #8,d4
  838.     bsr     movefont
  839.     
  840.     lea     mainfont,a0
  841.     lea     font6,a1
  842.     move     #12,d0
  843.     move     #10,d4
  844.     bsr     movefont
  845.     
  846.     lea     mainfont,a0
  847.     lea     font7,a1
  848.     move     #8,d0
  849.     move     #12,d4
  850.     bsr     movefont
  851.     
  852.     lea     mainfont,a0    take original font 
  853.     lea     font8,a1        eigth copy
  854.     move     #4,d0        start on 2nd line
  855.     move     #14,d4        shift left by 15 pixels
  856.     bsr     movefont
  857.     
  858.     rts
  859.  
  860.  
  861. movefont    move     #59,d1        60 characters
  862. movefont1    move.l     a1,a2        first move font to copy 
  863.     add     d0,a2        add line offset
  864.     move     #35,d3        36 lines high
  865.     move.l     a2,a3
  866. movefont2    clr     (a2)+        blank 1 word
  867.     move     (a0)+,(a2)+    move font to 2nd word
  868.     dbra     d3,movefont2    loop
  869.     
  870.     move     d4,d5        move amount to shift to d5
  871. movefont3    move.l     a3,a4
  872.     move     #35,d3        now shift font over (36 lines)
  873. movefont4    lsl     2(a4)        shift 1st word     
  874.     roxl     (a4)        2nd word taking shifted bit from first
  875.     add.l     #4,a4
  876.     dbra     d3,movefont4
  877.     
  878.     dbra     d5,movefont3
  879.     
  880.     add.l     #144,a1
  881.     dbra     d1,movefont1
  882.     rts
  883.  
  884.  ************************************
  885. * The table for wrapping the scroll  *
  886. * around the imaginary bar. Numbers  *
  887. * correspond to numbers of bytes in  *
  888. * the buffer, 160= 1 line,320= 2line *
  889.  ************************************
  890.  
  891. addtab    dc.w     800,640,480,320,320,320,320,160,320,160,320,160,160,160,0,160,160,0
  892.     dc.w    160,160,0,160,160,0,160,0,160,0,160,0,160,0,160,0
  893.     dc.w     0,160,0,160,0,160,0,160,0,160,0,160,160,0,160,160
  894.     dc.w    0,160,160,0,160,160,160,320,160,320,160,320,320,320,480,320,640,800
  895. oldssp    dc.l     0
  896. savescrn    dc.l     0    
  897. fonttype    dc.l    font1
  898. screen1    dc.l     0        the two screens
  899. screen    dc.l     0
  900. scrollpnt    dc.l     scrolline        pointer to scrolline
  901.  
  902. colpal1    ds.l    1        colour palette info
  903. colpal2    ds.l    1        saved for clean exit
  904.     even
  905. fname    dc.b    "scroll.txt"    scroll text file name
  906.     even
  907. old_res    ds.w    1        holds the original resolution
  908. text    dc.b     $1b,$45,0,0    text for clearing screen
  909.  
  910.  ********************************************
  911. * The font is made up of 1 plane characters  *
  912. * which are 36 lines high and 1 word wide    *
  913. * the bottom 8 lines must be blank to allow  *
  914. * for the special format of characters!!     *
  915. * to make a font draw a series of characters *
  916. * 15 pixels wide (1 blank for space between  *
  917. * letters) and 28 lines high. you could draw *
  918. * them with a slant like I did to improve    *
  919. * the diagonal effect.                       *
  920.  ********************************************
  921.     even
  922. mainfont    incbin    "twist.dat"
  923.  ********************************************
  924. * The incbin instruction is used by genst    *
  925. * to include a binary file into an assembled *
  926. * file. If the assembler you use does not    *
  927. * have this instruction then either convert  *
  928. * the twist.dat file into dc.w statements or *
  929. * add an additional piece of code to load    *
  930. * the file to this part of the program.      *
  931.  ********************************************
  932.  
  933. * Requires Devpac 2 for this bit !!!!!
  934. * Remove 'section bss' if it causes a problem - NOTE your PRG file
  935. * will be massive now. Because of 64000k for the screens and 256 for
  936. * rounding down ! 
  937. section    bss    * don't store in the file
  938.  
  939.     even
  940.     ds.b    256        allow for fixing to a 256 bound
  941. screenspace ds.b    32000        first screen
  942.     ds.b    32000        second screen
  943.  
  944. * Font stores 
  945.  
  946. font1    ds.b    8640*9        allocate space for fonts
  947. font2    equ     font1+8640
  948. font3     equ     font2+8640
  949. font4    equ     font3+8640
  950. font5    equ     font4+8640
  951. font6    equ     font5+8640
  952. font7    equ     font6+8640
  953. font8    equ     font7+8640
  954. fontend    equ     font8+8640
  955.  
  956. scrolline    ds.b    22        room for 22 padded spaces
  957. thescroll
  958. maxlength    equ    10000        maximum of 10k scroll text file