home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_07 / MARK_WC2.LZH / INCLUDE / BASEPAGE.H < prev    next >
C/C++ Source or Header  |  1988-04-27  |  4KB  |  100 lines

  1. /*
  2.  * basepage.h -- describe GEM-DOS base page structure.
  3.  *
  4.  * Copyright (c) 1981-1987, Mark Williams Company, Chicago
  5.  * This file and its contents may not be copied or distributed
  6.  * without permission.
  7.  */
  8. #ifndef BASEPAGE_H
  9. #define BASEPAGE_H
  10. /*
  11.  * GEM-DOS base page structure, also called the "psp".
  12.  * The documented elements have been supplemented with
  13.  * information gleaned from disassembling the ROM-based system.
  14.  */
  15. typedef struct {
  16.     long    p_lowtpa;    /* 0 Low transient program area (TPA) */
  17.     long    p_hitpa;    /* 4 High TPA */
  18.     long    p_tbase;    /* 8 Text segment base */
  19.     long    p_tlen;        /* C Text segment length */
  20.     long    p_dbase;    /* 10 Data length base */
  21.     long    p_dlen;        /* 14 Data length length */
  22.     long    p_bbase;    /* 18 bss segment base */
  23.     long    p_blen;        /* 1C bss segment length */
  24.     long    p_dta;        /* 20 data (dta) pointer (undocumented) */
  25.     long    p_parent;    /* 24 Parent's basepage (undocumented) */
  26.     long    p_fxx0;        /* 28 Undocumented */
  27.     long    p_env;        /* 2C Environment string pointer */
  28.     char    p_stdfh[6];    /* 30 Standard file handles (undocumented) */
  29.     char    p_fxx1;        /* 36 Undocumented */
  30.     char    p_curdrv;    /* 37 Current drive number (undocumented) */
  31.     long    p_fxx2;        /* 38 Undocumented */
  32.     long     p_fxx3;        /* 3C Undocumented */
  33.     long    p_fxx4;        /* 40 Undocumented */
  34.     long    p_fxx5;        /* 44 Undocumented */
  35.     long    p_fxx6;        /* 48 Undocumented */
  36.     long    p_fxx7;        /* 4C Undocumented */
  37.     long    p_fxx8;        /* 50 Undocumented */
  38.     long    p_fxx9;        /* 54 Undocumented */
  39.     long    p_fxx10;    /* 58 Undocumented */
  40.     long    p_fxx11;    /* 5C Undocumented */
  41.     long    p_fxx12;    /* 60 Undocumented */
  42.     long    p_fxx13;    /* 64 Undocumented */
  43.     long    p_saved0;    /* 68 Undocumented */
  44.     long    p_savea3;    /* 6C Undocumented */
  45.     long    p_savea4;    /* 70 Undocumented */
  46.     long    p_savea5;    /* 74 Undocumented */
  47.     long    p_savea6;    /* 78 Undocumented */
  48.     long    p_saveusp;    /* 7C Undocumented */
  49.     char    p_cmdlin[128];    /* Command line */
  50. } BASEPAGE;
  51. /*
  52.  * When linked with an MWC runtime startup, the entry point and textbase
  53.  * are named '_start'.  The basepage occupies the 256 bytes of memory
  54.  * immediately preceding.
  55.  */
  56. extern BASEPAGE _start[];
  57. #define BP    (&_start[-1])
  58. /*
  59.  * A pointer to the process's basepage is also passed at 4(sp) when the
  60.  * process is executed.  crts0.s also passes the basepage pointer
  61.  * as a fourth argument to main.
  62.  */
  63.  
  64. /* GEM-DOS maintains a pointer to the basepage of the process currently
  65.  * executing at this location in memory.  True for RAM- and ROM-loaded
  66.  * systems as of 06/14/86.
  67.  */
  68. #define GEMBP    ((BASEPAGE **)0x602C)
  69. /*
  70.  * When handling a GEM-DOS trap, the element "p_saveusp" points to a
  71.  * considerable amount of saved context on the user's stack.
  72.  * The layout is as follows:
  73.  */
  74. typedef struct {
  75.     long    p_savessp;    /* The supervisor stack after clean up */
  76.     int    p_savesr;    /* The status register from the trap */
  77.     long    p_savepc;    /* The program counter from the trap */
  78.     long    p_saved1;    /* The saved user d1 */
  79.     long    p_saved2;    /* The saved user d2 */
  80.     long    p_saved3;    /* The saved user d3 */
  81.     long    p_saved4;    /* The saved user d4 */
  82.     long    p_saved5;    /* The saved user d5 */
  83.     long    p_saved6;    /* The saved user d6 */
  84.     long    p_saved7;    /* The saved user d7 */
  85.     long    p_savea0;    /* The saved user a0 */
  86.     long    p_savea1;    /* The saved user a1 */
  87.     long    p_savea2;    /* The saved user a2 */
  88. /*
  89.  * That's 50 bytes of stack overflow that you will never see in user
  90.  * context.
  91.  */
  92. /*
  93.  * Next are the GEM-DOS opcode and parameters pushed by the user:
  94.  */
  95.     int    p_op;        /* GEM-DOS operation requested */
  96.                 /* parameters for operation */
  97. } OVERFLOW;
  98. #endif
  99. /* End of basepage.h */
  100.