home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 609b.lha / MandelSquare_v1.3 / Source.LZH / Source / WaitLine.asm < prev   
Assembly Source File  |  1992-01-05  |  2KB  |  66 lines

  1. ** Revision Header * Header built automatically - do not edit! *************
  2. *
  3. *    (C) Copyright 1991 by Olaf `Olsen' Barthel, all rights reserved
  4. *
  5. *    Name .....: WaitLine.asm
  6. *    Created ..: Monday 26-Aug-91 11:20
  7. *    Revision .: 1
  8. *
  9. *    Date            Author          Comment
  10. *    =========       ========        ====================
  11. *    26-Aug-91    Olsen        Created this file!
  12. *
  13. ****************************************************************************
  14.  
  15.     section    text,code
  16.  
  17.     xdef    _WaitLine
  18.  
  19. ;    VOID __asm WaitLine(register __d1 Line);
  20. ;
  21. ;        Small routine to wait for a specific Y-position of the    
  22. ;    electron beam (busy polling, actually).
  23. ;
  24. ;    Register usage is as follows:
  25. ;
  26. ;        d0    = Electron beam line number
  27. ;        d1    = Line number
  28. ;        a0    = Address of VPOSR register
  29. ;        a1    = Address of VHPOSR register
  30.  
  31. _WaitLine:
  32.     lea.l    $dff006,a1    ; Grab VHPOSR
  33.  
  34.     moveq    #0,d0        ; Clear line counter
  35.  
  36.     sub.w    #1,d1        ; Subtract one line to make it valid
  37.  
  38.     btst    #8,d1        ; Bit 8 required?
  39.     beq.s    3$
  40.  
  41.     lea.l    $dff004,a0    ; Grab VPOSR
  42.  
  43. 1$    move.w    (a0),d0        ; Get 8th bit of line counter
  44.     btst    #0,d0        ; Bit set?
  45.     beq.s    2$
  46.     move.w    (a1),d0        ; Get position of electron beam
  47.     lsr.w    #8,d0        ; Shift to get the high order byte
  48.     bset    #8,d0        ; Set the 8th bit
  49.     cmp.w    d1,d0        ; Compare with desired line number
  50.     blt.s    1$        ; Loop until reached
  51.     rts
  52.  
  53. 2$    move.w    (a1),d0        ; Get position of electron beam
  54.     lsr.w    #8,d0        ; Shift to get the high order byte
  55.     cmp.w    d1,d0        ; Compare with desired line number
  56.     blt.s    1$        ; Loop until reached
  57.     rts
  58.  
  59. 3$    move.w    (a1),d0        ; Get position of electron beam
  60.     lsr.w    #8,d0        ; Shift to get the high order byte
  61.     cmp.w    d1,d0        ; Compare with desired line number
  62.     blt.s    3$        ; Loop until reached
  63.     rts
  64.  
  65.     end
  66.