home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI05.ARJ / ictari.05 / ASSEMBLY / RASTER.S < prev   
Text File  |  1987-04-22  |  8KB  |  231 lines

  1. ***************************************************************************
  2. *                                      *                                                              
  3. *                     A FAIRLY SIMPLE RASTER ROUTINE              *
  4. *                                          *
  5. *         Written By Steven Jordan And Andrew Martin          *
  6. *                (c) Diamond Software 1993!              *
  7. *                                      *
  8. * If your felling adventurous then you can change it so that it scolls      *
  9. * up or down the screen. Or how about bouncing it up and down or even      *
  10. * side to side. (It's not too hard - it just needs a bit of imagination!  *
  11. *                                       *
  12. *          This routine can be used in your own demo          *
  13. *       All I ask is that you say hi to me (Steven Jordan)          *                                
  14. *                                      *
  15. *  HAS ANBODY GOT ANY ROUTINES FOR : A PLASMA SCREEN & A BIG SCROLLER?      *
  16. *                                              *
  17. ***************************************************************************
  18.  
  19.  
  20. ok_lets_start    
  21.  
  22.     clr.l   -(sp)            supervisor mode on
  23.     move.w  #$20,-(sp)
  24.     trap    #1
  25.     move.l  d0,savereg
  26.     
  27.     move.l    $44e,a0            current physbase
  28.     sub.l    #$2000,a0        go back a bit because our 50-60 hz...
  29.     move.l    a0,physbase        ..trick would push us into rom
  30.  
  31.     lea    stack,a7        stack needed later
  32.  
  33.     move.l  #moff,-(sp)        mouse off
  34.     clr.w   -(sp)            clear
  35.     move.w  #25,-(sp)        set mouse?
  36.     trap    #14            XBOIS
  37.     addq.l  #8,sp            adjust stack
  38.     dc.w    $a00a            timer A
  39.  
  40.     move.w  #4,-(sp)        get res    
  41.     trap    #14            call XBOIS
  42.     addq.l  #2,sp            adjust stack
  43.     move.w  d0,oldrez        save old res
  44.     move.l  $44e,oldscr        save old screen
  45.     move.l  physbase,screen        move phys to drawing screen
  46.  
  47.     movem.l $ffff8240.w,d0-d7    get system cols
  48.     movem.l d0-d7,oldpal        store 'em
  49.  
  50.     move.w  #0,-(sp)        low res
  51.     move.l  screen(pc),-(sp)    phys    
  52.     move.l  screen(pc),-(sp)    log
  53.     move.w  #5,-(sp)        setscreen
  54.     trap    #14            call XBIOS
  55.     add.l   #12,sp            adjust stack
  56.  
  57.     bsr     hblon            inttall interrupts
  58.  
  59. ***************************************************************************
  60. * THIS IS OUR MAIN LOOP - WE LOOP UNTIL ESC IS PRESSED              *
  61. ***************************************************************************
  62.  
  63. again    
  64.     move.w  #7,-(sp)        wait for a key - no echo
  65.     trap    #1            call GEMDOS
  66.     addq.l  #2,sp            adjust stack
  67.     swap    d0            swap d0/sp/a7
  68.     cmp.b    #$01,d0            ESC ?  if so quit
  69.     bne    again            NO, try again
  70.  
  71. ***************************************************************************
  72. * IF WE EVER GET TO HERE THEN THE ESC KEY HAS BEEN PRESSED.          *
  73. * NOW WE CAN RESTORE ALL THT WE CHANGED                       *
  74. ***************************************************************************
  75.  
  76.     bsr     hbloff            disable interrupts
  77.  
  78.     movem.l oldpal,d0-d7        get old system cols
  79.     movem.l d0-d7,$ffff8240        get 'em
  80.  
  81.     move.w  oldrez,-(sp)        old res
  82.     move.l  oldscr,-(sp)        old phys
  83.     move.l  oldscr,-(sp)        old log
  84.     move.w  #5,-(sp)        set screen
  85.     trap    #14            call XBOIS
  86.     add.l   #12,sp            adjust stack
  87.  
  88.     move.l  #mon,-(sp)        mouse on
  89.     clr.w   -(sp)            clear
  90.     move.w  #25,-(sp)        set mouse?
  91.     trap    #14            XBOIS
  92.     addq.l  #8,sp            adjust stack
  93.     dc.w    $a009            time A
  94.  
  95.     move.l  savereg,-(sp)        leave supervisor
  96.     move.w  #$20,-(sp)
  97.     trap    #1
  98.     addq.l  #6,sp
  99.  
  100.     clr.w   -(sp)            quit
  101.     trap    #1
  102.  
  103. ***************************************************************************
  104. * NOW FOLLOWS ALL OUR NEW TIMER B STUFF AND VBL STUFF ...                  *
  105. ***************************************************************************
  106.  
  107. hblon    move.l  $120,oldtimer        save old timer B vector
  108.     move.l  $70,oldvbl        save old vb vector
  109.     move.l  $70,vbl+2        now, new vbl routine will jump to
  110. ;                    old one afterwards
  111.     move.b  $fffffa07,old07        timer B enable
  112.     move.b  $fffffa09,old09        timer C enable
  113.     move.b  $fffffa0f,old0f        timer B in-service
  114.     move.b  $fffffa11,old11        timer C in-service
  115.     move.b  $fffffa1b,old1b        timer B control
  116.     and.b   #$df,$fffa09        disable timer C
  117.     and.b   #$fe,$fffa07        disable timer B 
  118.     move.l  #timer1,$120        new timer B vector
  119.     move.l  #newvbl,$70        new vb vector
  120.     or.b    #1,$fffffa07        enable timer B
  121.     or.b    #1,$fffffa13        set timer B mask
  122.     rts
  123.  
  124. ***************************************************************************
  125.  
  126. hbloff    move.w  sr,-(sp)
  127.     move.w  #$2700,sr        
  128.     move.b  old07(pc),$fffffa07     
  129.     move.b  old09(pc),$fffffa09
  130.     move.b  old0f(pc),$fffffa0f
  131.     move.b  old11(pc),$fffffa11
  132.     move.b  old1b(pc),$fffffa1b
  133.     move.l  oldtimer,$120
  134.     move.l  oldvbl,$70
  135.     move.w  (sp)+,sr
  136.     rts
  137.  
  138. ***************************************************************************
  139. * THIS IS OUR NEW VBL ROUTINE FOR OUR RASTERS ...              *
  140. ***************************************************************************
  141.  
  142. newvbl    clr.b   $fffffa1b.w        disable timer B
  143.     move.b  #1,$fffffa21        first raster 1 line away
  144.     move.b  #8,$fffffa1b        enable timer B
  145.     move.l  #timer1,$120        timer B vector
  146. vbl    jmp     $12345678        skip the magic number (this has no effect when you change it!)
  147.  
  148. ***************************************************************************
  149.  
  150. timer1    clr.b   $fffffa1b.w        stop timer
  151.     movem.l d0-d7/a0-a1,-(sp)      save from corruption
  152.     move.w  #$fa21,a1        timer B scanline
  153.     move.b  #12,(a1)        next interrupt at line X
  154.     move.l  #newtb2,$120        set our new timer B vector
  155.     move.b  #8,$fffffa1b.w        let timer B continue 
  156.  
  157.     move.w  #198-1,d2        set repeat (no. colours)
  158.     move.l  #pal1,a0         get our palette
  159.     add.l   #44*9,a0        add 44*9 words
  160. loop    move.b  (a1),d0            get value of timer B
  161. wait1    cmp.b   (a1),d0            wait one scanline 
  162.     beq     wait1            keep looping until 1 scanline reached
  163.     move.w  -(a0),$ff8240         set our colours backwards!
  164.     dbra    d2,loop            keep looping until all cols done
  165.  
  166.     movem.l    palette,d1-d7/a0    get the palette
  167. loopx    move.b    (a1),d0            get the value of timer B
  168. wait2    cmp.b    (a1),d0            wait another scanline
  169.     beq    wait2            until we have     
  170.     movem.l    d1-d7/a0,$ff8240    restore the palette
  171.                 
  172.     movem.l (sp)+,d0-d7/a0-a1    restore all things changed
  173.     bclr    #0,$fffffa0f        end of our interrupt
  174.     rte
  175.  
  176. ***************************************************************************
  177.  
  178. newtb2    clr.b   $fffffa1b.w        stop timer B
  179.     movem.l d0-d7/a0-a1,-(sp)    store registers
  180.     move.w  #$fa21,a1        
  181.     move.b  #76,(a1)        our next interrupt 
  182.     move.b  #8,$fffffa1b.w        timer B
  183.     movem.l (sp)+,d0-d7/a0-a1    restore old registers
  184.     bclr    #0,$fffffa0f.w        end our interrupt
  185.     rte
  186.  
  187. ***************************************************************************
  188.  
  189.  
  190. pal1    rept    2
  191.     dc.w     $710,$720,$730,$740,$750,$760,$770,$670,$570,$470,$370
  192.     dc.w     $270,$170,$70,$71,$72,$73,$74,$75,$76,$77,$67,$57,$47,$37
  193.     dc.w     $27,$17,$7,$107,$207,$307,$407,$507,$607,$707,$706,$705
  194.     dc.w     $704,$703,$702,$701,$700,$710,$720,$730,$740,$750,$760
  195.     dc.w     $770,$670,$570,$470,$370,$270,$170,$70,$71,$72,$73,$74
  196.     dc.w     $75,$76,$77,$67,$57,$47,$37,$27,$17,$7,$107,$207,$307
  197.     dc.w     $407,$507,$607,$707,$706,$705,$704,$703,$702,$701,$700
  198.     dc.w     $710,$720,$730,$740,$750,$760,$770,$670,$570,$470,$370
  199.     dc.w     $270,$170,$70,$71,$72,$73,$74,$75,$76,$77,$67,$57,$47
  200.     dc.w     $37,$27,$17,$7,$107,$207,$307,$407,$507,$607,$707,$706
  201.     dc.w     $705,$704,$703,$702,$701,$700
  202.     endr
  203.  
  204.      
  205. palette        ds.w    32
  206.         ds.w    310
  207.  
  208. stack        dc.l    0
  209. physbase    dc.l    0
  210. screen_0    dc.l    0
  211. handle        dc.w    0
  212. oldrez          dc.w    0
  213. oldscr          dc.l    0
  214. savereg         dc.l    0
  215. screen          dc.l    0
  216. oldpal          ds.w    16
  217. mon             dc.b    $08
  218. moff            dc.b    $12
  219. oldvbl          dc.l    0
  220. oldtimer        dc.l    0
  221. old07           dc.b    0
  222. old09           dc.b    0
  223. old0f           dc.b    0
  224. old11           dc.b    0
  225. old1b           dc.b    0
  226.  
  227.  
  228.  
  229.  
  230.  
  231.