[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosGetMachineMode()           Get current machine mode (real, 286 protected).
------------------------------------------------------------------------------

 Function : Get the current machine mode (real, 286 protected).

 Syntax   : USHORT BLXAPI DosGetMachineMode(BYTE *mmode);

 mmode      Pointer to a byte to receive the machine mode.

 Return   : Machine mode indicator byte

 DosGetMachineMode() returns the current machine mode (either real or
 protected). Since Blinker has the capability of creating dual mode programs
 that may run in protected or real mode depending on the host environment,
 DosGetMachineMode() may be used to determine the current mode and take
 appropriate action.

 Example:

    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <blx286.h>
    unsigned char far *VideoBuffer;
    void main(void)
    {
    BYTE        machinemode;
    SEL         selector;
    if (DosGetMachineMode(&machinemode) == 0)
       switch (machinemode)
          {
          case MODE_REAL:
             printf ("\nReal mode - absolute pointers ok\n");
             VideoBuffer = MK_FP(0xb800,0);
             break;
          case MODE_PROTECTED:
             printf ("\n286 Protected mode - plenty memory\n");
             if (DosMapRealSeg (0xb800, 0x8000l, &selector))
                {
                printf ("\nTrouble\n");
                exit (1);
                }
             VideoBuffer = MK_FP(selector,0);
             break;
          default:
             printf ("\nOther mode - interesting\n");
             exit(1);
          }
    }

 Then:

    /* Display a '*' in top left corner of screen*/
    *VideoBuffer[0] = '*';

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson