home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / assembler-tools / proasm / routines / intuitionsupport.r < prev    next >
Encoding:
Text File  |  1994-09-05  |  5.3 KB  |  196 lines

  1. ****************************************************************************
  2. *                                        *
  3. *                   ****   Intuition Support  ****                *
  4. *                                        *
  5. *    Author        RenĂ© Eberhard                        *
  6. *    Version        0.5                            *
  7. *    Last Revision    16-Jan-94                        *
  8. *    Identifier    int_support                        *
  9. *       Prefix        int_support   (intuition.library support)        *
  10. *                                         *
  11. *                                         *
  12. *-----------------------------[ UPDATES ]----------------------------------*
  13. *                                        *
  14. *    -REB!    13-Jun-93    Start this Project               *
  15. *    -REB!    14-Jul-93    Request() added -> Clean version       *
  16. *    -REB!    16-Jul-93    Multiple use added               *
  17. *    -DAW!    16-Jan-94    Preferences default pointer used for V39   *
  18. *                                        *
  19. ****************************************************************************
  20. *---------------------------[ Functions ]----------------------------------*
  21. *                                        *
  22. * - SetBusyPointer, ClrBusyPointer                        *
  23. *                                        *
  24. *---------------------------[ COMMENT ]------------------------------------*
  25. *                                            *
  26. ****************************************************************************
  27.  
  28.     IFND    int_support
  29. int_support    SET    1
  30.  
  31. intsupport_oldbase    equ __BASE
  32.     BASE    intsupport_base
  33.  
  34. intsupport_base:
  35.         
  36. ;---------------------------------------------------------------------------
  37.  
  38.     IFND    USE_NEWROUTINES
  39.     NEED_    SetBusyPointer
  40.     NEED_    ClrBusyPointer
  41.     ENDIF
  42.         
  43. ;---------------------------------------------------------------------------
  44. ****************************************************************************
  45. *                                        *
  46. * NAME    : SetBusyPointer                            *
  47. *                                        *
  48. * SYNOPSIS:                                     *
  49. *       SetBusyPointer (Windowhandler)                        *
  50. *                       D0.L                             *
  51. *                                        *
  52. * RESULT  : BusyHandler or NULL for error                    *
  53. *                                        *
  54. * COMMENT : This function creates a DATA hunk into the chip memory        *
  55. *                                        *
  56. ****************************************************************************
  57.     IFD    xxx_SetBusyPointer
  58. SetBusyPointer:
  59.     NEED_    ClrBusyPointer
  60.  
  61.     PUSHM.L    d1-a6
  62.     move.l    d0,d7            ;Store Windowhandler
  63.     beq.s    \Rtn
  64.         
  65. ;---------------[ Allocate request ]----------------------------------------
  66.  
  67.     move.l    AbsExecBase,a6        ;Allocate Struct request
  68.     move.l    #rq_SIZEOF+4,d0        ;SIZE + WindowHandler
  69.     move.l    #MEMF_CLEAR,d1
  70.     JSRLIB_    AllocMem
  71.     move.l    d0,d6            ;Store returncode into D6.L
  72.     beq.s    \Rtn            ;Fail
  73.  
  74.     move.l    d0,a0
  75.     move.l    d7,(a0)+        ;Store WindowHandler
  76.                     ;A0.L points now to Struct Request
  77. ;---------------------------------------------------------------------------
  78.  
  79. \Req:    PUSH.L    d0            ;Store memoryblock
  80.     move.l    IntBase(PC),a6        ;A0.L initialized from above
  81.     move.l    d7,a1            ;Windowhandler
  82.     JSRLIB_    Request
  83.     POP.L    a1            ;Initialize A1.L if there is a failure
  84.     tst.l    d0
  85.     bne.s    \SetP            ;Fail
  86.  
  87.     move.l    AbsExecBase,a6        ;Free Struct request
  88.     move.l    #rq_SIZEOF+4,d0        ;SIZE
  89.     JSRLIB_    FreeMem
  90.     clr.l    d6            ;Error code
  91.     bra.s    \Rtn
  92.  
  93. ;---------------------------------------------------------------------------
  94.  
  95. \SetP:    move.l    d7,a0            ;Windowhandler
  96.     cmp.w    #39,LIB_VERSION(a6)
  97.     blt.s    .v36
  98.     lea    .setbusy(pc),a1
  99.     JSRLIB_    SetWindowPointerA
  100.     bra.s    \Rtn
  101.  
  102. .v36:    lea    int_support_SpriteData,a1
  103.     moveq    #16,d0            ;Height
  104.     moveq    #16,d1            ;Weight
  105.     moveq    #-6,d2            ;XOffset
  106.     moveq    #0,d3            ;YOffset
  107.     JSRLIB_    SetPointer
  108.  
  109. \Rtn:    move.l    d6,d0            ;Returncode into D0.L
  110.     POPM.L    d1-a6
  111.     rts
  112.  
  113. .setbusy:
  114.     dc.l    WA_BusyPointer,1
  115.     dc.l    WA_PointerDelay,1
  116.     dc.l    TAG_DONE
  117.  
  118. ;---------------[ Sprite Datas ]--------------------------------------------
  119.  
  120.  
  121.     SECTION "Pointer_DATA",DATA,CHIP
  122.  
  123. int_support_SpriteData:
  124.     dc.w    $0000,$0000,$0400,$07c0,$0000,$07c0,$0100,$0380
  125.     dc.w    $0000,$07e0,$07c0,$1ff8,$1ff0,$3fec,$3ff8,$7fde
  126.     dc.w    $3ff8,$7fbe,$7ffc,$ff7f,$7efc,$ffff,$7ffc,$ffff
  127.     dc.w    $3ff8,$7ffe,$3ff8,$7ffe,$1ff0,$3ffc,$07c0,$1ff8
  128.     dc.w    $0000,$07e0
  129.  
  130.     SECTION    __OldSection
  131.  
  132.     ENDC
  133.  
  134. ;---------------------------------------------------------------------------
  135. ****************************************************************************
  136. *                                        *
  137. * NAME    : ClrBusyPointer                            *
  138. *                                        *
  139. * SYNOPSIS:                                     *
  140. *       ClrBusyPointer (BusyHandler)                        *
  141. *                       D0.L                                  *
  142. *                                        *
  143. ****************************************************************************
  144.     IFD    xxx_ClrBusyPointer
  145. ClrBusyPointer:
  146.     NEED_    SetBusyPointer
  147.  
  148.     PUSHM.L    d0-a6
  149.  
  150.     tst.l    d0
  151.     beq.s    \Rtn            ;No BusyHandler
  152.     move.l    d0,a5            ;Store BusyHandler
  153.  
  154. ;---------------[ Remove request ]------------------------------------------
  155.  
  156.     move.l    (a5),d7            ;Store WindowHandler
  157.     beq.s    \Free            ;No -> Free memoryblock
  158.     move.l    d7,a1            ;WindowHandler into A1.L for EndRequest()
  159.     move.l    a5,a0            ;BusyHandler
  160.     addq.l    #4,a0            ;Pointer to Struct Request
  161.     move.l    IntBase(PC),a6
  162.     JSRLIB_    EndRequest
  163.  
  164. ;---------------[ Free memory ]---------------------------------------------
  165.  
  166. \Free:    move.l    AbsExecBase,a6            ;Free Struct Request
  167.     move.l    a5,a1                ;Memoryblock
  168.     move.l    #rq_SIZEOF+4,d0            ;SIZE + WindowHandler
  169.     JSRLIB_    FreeMem
  170.     
  171. ;---------------[ Make original pointer ]-----------------------------------
  172.  
  173. \Clr:    move.l    IntBase(PC),a6
  174.     move.l    d7,a0                    ;Windowhandler
  175.     cmp.w    #39,LIB_VERSION(a6)
  176.     blt.s    1$
  177.     lea    .clrbusy(pc),a1
  178.     JSRLIB_    SetWindowPointerA
  179.     bra.s    \Rtn
  180. 1$:    JSRLIB_    ClearPointer
  181.  
  182. \Rtn:    POPM.L    d0-a6
  183.     rts
  184.  
  185. .clrbusy:
  186.     dc.l    WA_Pointer,0
  187.     dc.l    TAG_DONE
  188.  
  189.     ENDC
  190.  
  191. ;---------------------------------------------------------------------------
  192.     BASE    intsupport_oldbase
  193.  
  194.     ENDC
  195. ;---------------------------------------------------------------------------
  196.