home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 42 / af042b.adf / BULL5.LHA / display.s < prev    next >
Text File  |  1992-11-19  |  3KB  |  140 lines

  1. FUNC_DISPLAY    =    1
  2. FUNC_MUSIC        =    0
  3. PLANESIZE    =    SCREEN_WIDTH*SCREEN_HEIGHT
  4. ******************************************************************************
  5.     xdef    _display
  6. _display
  7.     movem.l    d0-d7/a0-a6,-(sp)
  8.     jsr        _set_up_disc
  9. .repeat
  10.  
  11.     jsr        _wait_vbi                ; wait for a vertical blank
  12.     jsr        _clear_screen
  13.     jsr        _init                    ; initiate man.
  14.  
  15. ;    move.w    #$707,(COLOR).l
  16.     jsr        _draw_all                ; draw all the sprites and things
  17.  
  18.     jsr        _swap_screens            ; display the screen
  19.  
  20.     jsr        _move_all                ; move all the sprites and things
  21.  
  22.     cmp.b    #KB_Q,_iinkey            ; have we pressed the Q key?
  23.     bne        .repeat                    ; no then loop around
  24. .the_end                            ; Oh we have then lets exit
  25.     movem.l    (sp)+,d0-d7/a0-a6
  26.     rts
  27.     even
  28.     dc.l    0,0    
  29. **************************************************************************
  30. _lmul                                ; long multiply routine
  31.     movem.l    d1-d3,-(sp)
  32.     move.w    d0,d2
  33.     move.w    d1,d3
  34.     swap    d0
  35.     swap    d1
  36.     mulu    d2,d1
  37.     mulu    d3,d0
  38.     mulu    d3,d2
  39.     add.w    d1,d0
  40.     swap    d0
  41.     clr.w    d0
  42.     add.l    d2,d0
  43.     movem.l    (sp)+,d1-d3
  44.     rts
  45. ******************************************************************************
  46. *                        Random Number Routine                                 *
  47. ******************************************************************************
  48.  
  49. _rnd                                        ;takes d1 (0-d1)
  50.     move.w    .seed(pc),d0
  51.     mulu    #9377,d0
  52.     add.w    #9439,d0
  53.     move.w    d0,.seed
  54.     and.l    #$7fff,d0                        ;make sure positive word
  55.  
  56.     divu    d1,d0
  57.     swap    d0
  58.     rts
  59. .seed    dc.w    1972
  60. ******************************************************************************
  61. _abs                        ; turn number to absolute
  62.     tst.w    d0
  63.     bpl.s    .positive
  64.         neg.w    d0
  65. .positive
  66.     rts
  67. ******************************************************************************
  68. *                        Redraw a Background Screen                             *
  69. ******************************************************************************
  70.  
  71. _q_redraw            ;needs a0 as data to copy
  72.     move.l    _w_screen,a1
  73.     move.l    #32000/40/4-1,d7
  74. .copy_loop
  75.     movem.l    (a0)+,a2-a4/d0-d6
  76.     movem.l    a2-a4/d0-d6,(a1)
  77.     lea        40(a1),a1
  78.     movem.l    (a0)+,a2-a4/d0-d6
  79.     movem.l    a2-a4/d0-d6,(a1)
  80.     lea        40(a1),a1
  81.     movem.l    (a0)+,a2-a4/d0-d6
  82.     movem.l    a2-a4/d0-d6,(a1)
  83.     lea        40(a1),a1
  84.     movem.l    (a0)+,a2-a4/d0-d6
  85.     movem.l    a2-a4/d0-d6,(a1)
  86.     lea        40(a1),a1
  87.     dbra    d7,.copy_loop
  88.     rts
  89.  
  90. ******************************************************************************
  91. _clear_all_registers
  92.     moveq.l    #0,d0
  93.     moveq.l    #0,d1
  94.     moveq.l    #0,d2
  95.     moveq.l    #0,d3
  96.     moveq.l    #0,d4
  97.     moveq.l    #0,d5
  98.     moveq.l    #0,d6
  99.     moveq.l    #0,d7
  100.     move.l    d0,a0
  101.     move.l    d0,a1
  102.     move.l    d0,a2
  103.     move.l    d0,a3
  104.     move.l    d0,a4
  105.     move.l    d0,a5
  106.     move.l    d0,a6
  107.     rts
  108.  
  109. ******************************************************************************
  110. quit                    dc.w    0
  111.  
  112. _sp_screen                                ;where sprites can be drawn
  113.     dc.l    0
  114.  
  115.  
  116. title
  117. backscreen
  118.      ds.b    32000
  119.     even
  120.  
  121. an1    dc.l    0,0,0                            ;animation stack
  122. ******************************************************************************
  123. * uses d0 as counter, a0 as screen
  124. _clear_screen
  125.     bsr        _clear_all_registers        ; clear all registers
  126.     move.l    _w_screen,a0                ; find start of screen to clear
  127.     lea        32000(a0),a0                ; and move to the end of it
  128.     moveq.w    #(615/5)-1,d0                ; number of times we want to loop -1
  129. .loop
  130.     movem.l    d1-d7/a1-a6,-(a0)            ; clear 52 bytes
  131.     movem.l    d1-d7/a1-a6,-(a0)            ; 5 times
  132.     movem.l    d1-d7/a1-a6,-(a0) 
  133.     movem.l    d1-d7/a1-a6,-(a0)
  134.     movem.l    d1-d7/a1-a6,-(a0)
  135.     dbra    d0,.loop
  136.     movem.l    d1-d5,-(a0)                    ;clear off the last 20 bytes
  137.     rts
  138.     
  139.     
  140.