home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / MEMORY4.ASM < prev    next >
Assembly Source File  |  1994-12-01  |  1KB  |  49 lines

  1.     PAGE    66,132
  2. ;****************************** MEMORY4.ASM *********************************
  3. ;
  4. ;----------------------------------------------------------------------------
  5. LIBSEG           segment byte public "LIB"
  6.         assume cs:LIBSEG , ds:nothing
  7.  
  8. ;----------------------------------------------------------------------------
  9. .xlist
  10.     include  mac.inc
  11.     include  common.inc
  12. .list
  13. ;----------------------------------------------------------------------------
  14.  
  15. comment 
  16. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  MEMORY )
  17. CHECK_DOS_MEMORY - check DOS memory size and amount available
  18. ;  inputs: ax = segment at end of program area (zseg)
  19. ;  outputs: ax = available blocks or paragraphs (16 bytes = 1 block)
  20. ;           bx = total memory size in blocks
  21. ;
  22. ;  note:  This routine scan for the MCB chain, rather than look in
  23. ;         the DOS database.  For some implementations of brain
  24. ;         damaged DOS, the scan works better.
  25. ;* * * * * * * * * * * * * *
  26. 
  27.  
  28.     public    CHECK_DOS_MEMORY
  29. CHECK_DOS_MEMORY    proc    far
  30.     push    cx
  31.         sub     bx,bx
  32.         mov     es,bx
  33.         mov     bx,es:[413h]            ;get mem. size in 1k blocks
  34.         mov    cl,6
  35.         shl    bx,cl
  36. ;
  37. ; compute our final program location in paragraphs
  38. ;  ax = our final offset
  39. ;
  40.         mov    cx,bx
  41.         sub    cx,ax
  42.         mov    ax,cx
  43.         pop    cx
  44.     retf
  45. CHECK_DOS_MEMORY    endp
  46.  
  47. LIBSEG    ENDS
  48. ;;    end
  49.