home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / NFSRC305.ZIP / CPMI / ALLOCSEL.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-01  |  1.7 KB  |  68 lines

  1. ; File......: ALLOCSEL.ASM
  2. ; Author....: Ted Means
  3. ; CIS ID....: 73067,3332
  4. ;
  5. ; This is an original work by Ted Means and is placed in the
  6. ; public domain.
  7. ;
  8. ; Modification history:
  9. ; ---------------------
  10. ;     Rev 1.0   01 Jan 1995 03:01:00   TED
  11. ;  Initial release
  12. ;
  13.  
  14. ;  $DOC$
  15. ;  $FUNCNAME$
  16. ;     cpmiAllocateSelector()
  17. ;  $CATEGORY$
  18. ;     CPMI
  19. ;  $ONELINER$
  20. ;     Allocate a selector
  21. ;  $SYNTAX$
  22. ;     SELECTOR pascal cpmiAllocateSelector( void )
  23. ;  $ARGUMENTS$
  24. ;     None
  25. ;  $RETURNS$
  26. ;     A selector with a base and limit of zero.  A null selector is returned
  27. ;     if the function fails.
  28. ;  $DESCRIPTION$
  29. ;     This function is used to create a new selector.  It must be
  30. ;     initialized with other CPMI calls before it will be useful.  Be
  31. ;     sure to free it with cpmiFreeSelector() when it is no longer needed.
  32. ;  $EXAMPLES$
  33. ;     auto SELECTOR sel = cpmiAllocateSelector();
  34. ;
  35. ;     cpmiSetBase( sel, 0xB8000 );
  36. ;
  37. ;     cpmiSetLimit( sel, 0x8000 );
  38.  
  39. ;     // Do whatever
  40. ;
  41. ;     cpmiFreeSelector( sel );
  42. ;  $INCLUDE$
  43. ;     CPMI.H
  44. ;  $SEEALSO$
  45. ;     cpmiFreeSelector(), cpmiSetLimit(), cpmiSetBase()
  46. ;  $END$
  47. ;
  48.  
  49. IDEAL
  50. P286
  51.  
  52. Public    cpmiAllocateSelector
  53.  
  54. Segment   _NanFor   Word      Public    "CODE"
  55.           Assume    CS:_NanFor
  56.  
  57. Proc      cpmiAllocateSelector          Far
  58.  
  59.           Xor       AX,AX                         ; DPMI -- alloc selector
  60.           Mov       CX,1                          ; Set selector count
  61.           Int       31h                           ; Call DPMI
  62.           JNC       @@Exit                        ; Leave if no error
  63.           Xor       AX,AX                         ; Return null selector
  64.  
  65. @@Exit:   RetF
  66. Endp      cpmiAllocateSelector
  67. Ends      _NanFor
  68. End