flags.pas 911 B

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