home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bc3.zip / REALINT.H < prev    next >
C/C++ Source or Header  |  1992-02-09  |  2KB  |  54 lines

  1. //
  2. // (c) Copyright 1992  Qualitas,Inc. All Rights Reserved
  3. //
  4. // realint.h - definitions for RealInterrupt class
  5. //
  6. // The RealInterrupt class (not to be confused with the
  7. // RealInterruptHandler class) provides a means to issue
  8. // interrupts in real mode.  
  9. // 
  10. // The required argument for the constructor is the number of
  11. // the interrupt to be issued.  Calling the RealInt with a
  12. // dpmiRegs_t structure as an argument translates to invocation
  13. // of the DPMI function that issues the interrupt in real mode.
  14. //
  15. // It is recommended to set the SS:SP fields of the dpmiRegs_t 
  16. // to zero which directs DPMI to allocate a host stack for the
  17. // real mode interrupt handler to run on.  In addition, users 
  18. // should make sure that the flags field of the dpmiRegs_t has
  19. // a safe value.
  20. //
  21. // Initialize the dpmiRegs_t with the desired register contents.
  22. // Upon return from the call, the dpmiRegs_t is updated to 
  23. // reflect the register state changes caused by the real interrupt.
  24. // 
  25. // Example:
  26. //
  27. //    #include "dpmi.h"
  28. //    #include "realint.h"
  29. //
  30. //    void realIntExample(void)
  31. //    {
  32. //        dpmiRegs_t realRegs;
  33. //        RealInterrupt realEMS(0x67);
  34. //
  35. //        realRegs.drSS=0; realRegs.drESP.s=0; // use host stack
  36. //        realRegs.drFlags = 0x3202;         // safe flags value
  37. //        realRegs.drEAX.s = 0x4000;         // ah=40 get status
  38. //
  39. //        realEMS(realRegs);             // issue real int 67h
  40. //        . . .
  41. //    }
  42. //
  43. #include "dpmi.h"
  44.  
  45. class RealInterrupt {
  46. public:
  47.     RealInterrupt(uChar ord)        // constructor
  48.         {ordinal = ord;};
  49.     void operator()(dpmiRegs_t& rc)        // invocation by call operator
  50.         {DPMIIssueRealInterrupt(ordinal, 0, &rc);};
  51. protected:
  52.     uChar ordinal;
  53. };
  54.