flags.pas 796 B

1234567891011121314151617181920212223242526272829303132
  1. { This example demonstrates the use of the flag constants in
  2. conjunction with an interrupt call
  3. In detail it checks if APM (advanced power management) is
  4. available.
  5. Int 15h 5300h - APM specification : Installation check
  6. Input : AX = 5300h
  7. BX = device id of system BIOS (= 0000h)
  8. Return : Carry clear if successful
  9. AH = major version (BCD)
  10. AL = minor version (BCD)
  11. }
  12. uses
  13. go32;
  14. var
  15. r : trealregs;
  16. begin
  17. { set register values and issue real mode interrupt call }
  18. r.ax := $5300;
  19. r.bx := 0;
  20. realintr($15, r);
  21. { check if carry clear and write a suited message }
  22. if ((r.flags and carryflag)=0) then begin
  23. Writeln('APM v', (r.ah and $f), '.',
  24. (r.al shr 4), (r.al and $f), ' detected');
  25. end else
  26. Writeln('APM not present');
  27. end.