home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 171.lha / SupLib / resource.asm < prev    next >
Assembly Source File  |  1988-04-28  |  1KB  |  56 lines

  1.  
  2.  ;
  3.  ;  EXEC resource support
  4.  ;                   4(sp)  8(sp)
  5.  ;    AutoAllocMiscResource(resno, value)
  6.  ;        resno:  MR_SERIALPORT, SERIALBITS, PARALLELPORT, PARALLELBITS
  7.  ;        value:  -1 to allocate, 0 to check
  8.  ;
  9.  ;        returns 0 on success
  10.  ;
  11.  ;    AutoFreeMiscResource(resno)
  12.  ;                  4(sp)
  13.  ;        Free a misc resource you allocated
  14.  ;
  15.  ;    No need to open the misc.resource
  16.  
  17.         public  _AutoAllocMiscResource
  18.         public  _AutoFreeMiscResource
  19.         public  _LVOOpenResource
  20.  
  21.         FAR     DATA
  22.  
  23. _AutoAllocMiscResource:
  24.         move.l  A6,-(sp)
  25.         bsr     OpenMiscResource
  26.         beq     amfail
  27.         move.l  8(sp),D0
  28.         move.l  12(sp),A1
  29.         jsr     -6(A6)
  30.         bra     amret
  31. amfail        moveq.l #-1,D0
  32. amret        move.l  (sp)+,A6
  33.         rts
  34.  
  35. _AutoFreeMiscResource:
  36.         move.l  A6,-(sp)
  37.         bsr     OpenMiscResource
  38.         beq     fmret
  39.         move.l  8(sp),D0
  40.         jsr     -12(A6)
  41. fmret        move.l  (sp)+,A6
  42.         rts
  43.  
  44. OpenMiscResource:
  45.         move.l  4,A6
  46.         lea.l   MiscName,A1
  47.         jsr     _LVOOpenResource(A6)
  48.         move.l  D0,A6
  49.         tst.l   D0
  50.         rts
  51.  
  52. MiscName:   dc.b    "misc.resource",0
  53.  
  54.  
  55.  
  56.