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

  1. ; File......: SETBASE.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. ;     cpmiSetBase()
  17. ;  $CATEGORY$
  18. ;     CPMI
  19. ;  $ONELINER$
  20. ;     Set the linear base address associated with a selector.
  21. ;  $SYNTAX$
  22. ;     int pascal cpmiSetBase( SELECTOR selector, LINEAR base )
  23. ;  $ARGUMENTS$
  24. ;     selector is the selector for which the base address is to be set.
  25. ;
  26. ;     base is the linear base address.
  27. ;  $RETURNS$
  28. ;     SUCCEED if successful, FAIL otherwise.
  29. ;  $DESCRIPTION$
  30. ;     This function is useful for assigning physical memory to a selector.
  31. ;     Note that it is a linear address and not a real mode segment:offset.
  32. ;  $EXAMPLES$
  33. ;     auto char * Video;
  34. ;
  35. ;     FP_SEG( Video ) = cpmiAllocSelector();
  36. ;     FP_OFF( Video ) = 0;
  37. ;
  38. ;     cpmiSetBase( FP_SEG( Video ), 0xB8000 );
  39. ;  $INCLUDE$
  40. ;     CPMI.H
  41. ;  $SEEALSO$
  42. ;     cpmiGetBase(), cpmiGetLimit(), cpmiSetLimit()
  43. ;  $END$
  44. ;
  45.  
  46. IDEAL
  47. P286
  48.  
  49. Public    cpmiSetBase
  50.  
  51. Segment   _NanFor   Word      Public    "CODE"
  52.           Assume    CS:_NanFor
  53.  
  54. Proc      cpmiSetBase         Far
  55.  
  56.           Enter     0,0                           ; Create stack frame
  57.  
  58.           Mov       AX,7                          ; DPMI -- set base
  59.           Mov       BX,[Word Ptr BP + 10]         ; Get selector
  60.           Mov       DX,[Word Ptr BP + 6]          ; Get low word of address
  61.           Mov       CX,[Word Ptr BP + 8]          ; Get high word of address
  62.           Int       31h                           ; Call DPMI
  63.           Mov       AX,1                          ; Default to SUCCEED
  64.           SBB       AX,0                          ; Set to FAIL on error
  65.  
  66. @@Exit:   Leave                                   ; Destroy stack frame
  67.           RetF      6
  68. Endp      cpmiSetBase
  69. Ends      _NanFor
  70. End