home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / VARIOUS / MK_FP.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1.1 KB  |  39 lines

  1. ;****************************************************************************
  2. ; Filename: MK_FP.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.1
  5. ;  Created: 1994.09.18
  6. ;  Updated: 1995.03.11
  7. ;****************************************************************************
  8. ; Copyright Peter Andersson, 1994-1995.
  9. ; All rights reserved.
  10. ;****************************************************************************
  11. ; Function: PVOID @MK_FP(PVOID address)
  12. ;  Comment: Converts an 32 bit address to a segment:offset
  13. ;    input: Eax - address to convert
  14. ;  Returns: Segment address in the higher part of Eax and the offset address
  15. ;           in the lower part of Eax (Ax). Eax is -1 if the memory address
  16. ;           is out of range (>=1Mb)
  17. ;****************************************************************************
  18.  
  19.     Include    STDDEF.INC
  20.  
  21.     Codeseg
  22.  
  23. Proc    MK_FP   ,1
  24.         Sub    Eax,[_zero]
  25.         Cmp    Eax,100000h        ; Can't convert address above
  26.         Jae    @@Error            ; 1Mb or below 0...
  27.         Mov    Edx,Eax
  28.         And    Eax,0FFFF0h
  29.         And    Edx,0Fh
  30.         Shl    Eax,12
  31.         Add    Eax,Edx
  32.         Ret
  33.     Align    4
  34. @@Error:    Mov    Eax,-1
  35.         Ret
  36. Endp
  37.  
  38.     End
  39.