home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / NEWS / 554 / JUIN / EMS_XMS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-07  |  2KB  |  52 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 124 of 245
  3. From : Chris Jantzen                       1:356/18.2           12 Jun 93  09:36
  4. To   : William Sitch                       1:163/542.0
  5. Subj : Detecting EMS/XMS
  6. ────────────────────────────────────────────────────────────────────────────────
  7. On Thursday June 10 1993, William Sitch wrote to All:
  8.  
  9.  WS> Does anyone know how to detect XMS/EMS?  I've used something documented in
  10.  WS> my PC INTERRUPTS book, but I can't seem to get it to work.
  11.  
  12. The following code was *mostly* right. Go back to your original source to
  13. compare the changes I made:}
  14.  
  15.  procedure check_ems (VAR installed:boolean; VAR ver,ver2:byte); var
  16.    regs  :  registers;
  17.  begin
  18.    regs.ax := $46;
  19.    intr($67,regs);
  20.    installed := regs.ah = $00;
  21.    if (installed = true) then
  22.      begin
  23.        ver := hi(regs.al);
  24.        ver2 := lo(regs.al);
  25.      end;
  26.  end;
  27.  
  28.  procedure check_xms (VAR installed:boolean; VAR ver,ver2:byte); var
  29.    regs  :  registers;
  30.  begin
  31.    regs.ax := $4300;
  32.    intr($2F,regs);
  33.    installed := regs.al = $80;
  34.    if (installed = true) then
  35.      begin
  36.        regs.ax := $4310;
  37.        regs.ah := $00;
  38.        intr($2F,regs);
  39.        ver := regs.ax;
  40.        ver2 := regs.bx;
  41.      end;
  42.  end;
  43.  
  44.  WS> I am pretty sure I'm calling the interrupts right, but it always returns
  45.  WS> false, indicating that I do NOT have EMS/XMS, although I do.  Can anyone
  46.  WS> help me out?
  47.  
  48. You were. Mostly. What you forgot was that when a real world book like PC
  49. Interrupts says "Load the AX register with the value 4300h", it means to us
  50. Pascal programmers "Load the AX variable with the value $4300". Note the dollar
  51. sign. That means hexadecimal (like the little h on the end means hexadecimal to
  52. assembly programmers).