home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 43 / af043a.adf / BULL6.LHA / display.s < prev    next >
Text File  |  1992-12-15  |  3KB  |  161 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. _intro
  10.     jsr        _intro_screen
  11. .repeat
  12.  
  13. ;    jsr        _wait_vbi                ; wait for a vertical blank
  14.  
  15. ;    jsr        _clear_screen
  16.     jsr        _q_redraw
  17.  
  18.     jsr        _init                    ; initiate man.
  19.  
  20.     jsr        _draw_all                ; draw all the sprites and things
  21. .wait1
  22.     move.w    $dff004,d0
  23.     btst    #0,d0
  24.     bne.s    .wait1
  25. .wait2
  26.     move.w    $dff004,d0
  27.     btst    #0,d0
  28.     beq.s    .wait2
  29.     jsr        _swap_screens            ; display the screen
  30.  
  31.     jsr        _move_all                ; move all the sprites and things
  32.     cmp.w    #NO_LIVES,game_over
  33.     blt.s    .still_going
  34.         jsr        _end_game
  35.         jmp        _intro
  36. .still_going
  37.     cmp.b    #KB_Q,_iinkey            ; have we pressed the Q key?
  38.     bne        .repeat                    ; no then loop around
  39.  
  40. .the_end                            ; Oh we have then lets exit
  41.     movem.l    (sp)+,d0-d7/a0-a6
  42.     rts
  43.     even
  44.     dc.l    0,0    
  45. **************************************************************************
  46. _lmul                                ; long multiply routine
  47.     movem.l    d1-d3,-(sp)
  48.     move.w    d0,d2
  49.     move.w    d1,d3
  50.     swap    d0
  51.     swap    d1
  52.     mulu    d2,d1
  53.     mulu    d3,d0
  54.     mulu    d3,d2
  55.     add.w    d1,d0
  56.     swap    d0
  57.     clr.w    d0
  58.     add.l    d2,d0
  59.     movem.l    (sp)+,d1-d3
  60.     rts
  61. ******************************************************************************
  62. *                        Random Number Routine                                 *
  63. ******************************************************************************
  64.  
  65. _rnd                                        ;takes d1 (0-d1)
  66.     move.w    .seed(pc),d0
  67.     mulu    #9377,d0
  68.     add.w    #9439,d0
  69.     move.w    d0,.seed
  70.     and.l    #$7fff,d0                        ;make sure positive word
  71.  
  72.     divu    d1,d0
  73.     swap    d0
  74.     rts
  75. .seed    dc.w    1972
  76. ******************************************************************************
  77. _abs                        ; turn number to absolute
  78.     tst.w    d0
  79.     bpl.s    .positive
  80.         neg.w    d0
  81. .positive
  82.     rts
  83. ******************************************************************************
  84. *                        Redraw a Background Screen                             *
  85. ******************************************************************************
  86.  
  87. _q_redraw            ;needs a0 as data to copy
  88.  
  89.     BLIT_NASTY
  90.     lea        _background,a0
  91.     move.l    _w_screen,a1
  92.     move.w    #SCREEN_HEIGHT*4<<6+(SCREEN_WIDTH/2),d1
  93. ;    lea        HARDWARE_REGS,a6
  94.  
  95.     wait_blit
  96.  
  97.     move.l    a0,BLTAPT
  98.     move.l    a1,BLTDPT
  99.     move.l    #$FFFFFFFF,BLTAFWM
  100.     move.w    #0,BLTAMOD
  101.     move.w    #0,BLTDMOD
  102.     move.w    #$09F0,BLTCON0
  103.     move.w    #0,BLTCON1
  104.     move.w    d1,BLTSIZE
  105. ;
  106.     wait_blit
  107.     BLIT_NICE
  108. ;
  109.     rts
  110.  
  111. ******************************************************************************
  112. _clear_all_registers
  113.     moveq.l    #0,d0
  114.     moveq.l    #0,d1
  115.     moveq.l    #0,d2
  116.     moveq.l    #0,d3
  117.     moveq.l    #0,d4
  118.     moveq.l    #0,d5
  119.     moveq.l    #0,d6
  120.     moveq.l    #0,d7
  121.     move.l    d0,a0
  122.     move.l    d0,a1
  123.     move.l    d0,a2
  124.     move.l    d0,a3
  125.     move.l    d0,a4
  126.     move.l    d0,a5
  127.     move.l    d0,a6
  128.     rts
  129.  
  130. ******************************************************************************
  131. quit                    dc.w    0
  132.  
  133. _sp_screen                                ;where sprites can be drawn
  134.     dc.l    0
  135.  
  136.  
  137. title
  138. backscreen
  139.      ds.b    32000
  140.     even
  141.  
  142. an1    dc.l    0,0,0                            ;animation stack
  143. ******************************************************************************
  144. * uses d0 as counter, a0 as screen
  145. _clear_screen
  146.     bsr        _clear_all_registers        ; clear all registers
  147.     move.l    _w_screen,a0                ; find start of screen to clear
  148.     lea        32000(a0),a0                ; and move to the end of it
  149.     moveq.w    #(615/5)-1,d0                ; number of times we want to loop -1
  150. .loop
  151.     movem.l    d1-d7/a1-a6,-(a0)            ; clear 52 bytes
  152.     movem.l    d1-d7/a1-a6,-(a0)            ; 5 times
  153.     movem.l    d1-d7/a1-a6,-(a0) 
  154.     movem.l    d1-d7/a1-a6,-(a0)
  155.     movem.l    d1-d7/a1-a6,-(a0)
  156.     dbra    d0,.loop
  157.     movem.l    d1-d5,-(a0)                    ;clear off the last 20 bytes
  158.     rts
  159.     
  160.     
  161.