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

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