home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / cpem8010.zip / glob.h < prev    next >
C/C++ Source or Header  |  1995-02-16  |  3KB  |  138 lines

  1. /*     $Id: glob.h 1.4 1995/02/16 22:55:29 rg Exp $
  2.  *      Copyright (c) 1994 by R. Griech
  3.  *
  4.  *  Global definitions for the CP/M emulator.
  5.  *  Maybe in some parts it is no good programming style - but who cares
  6.  */
  7.  
  8. #ifndef _GLOB_H_
  9. #define _GLOB_H_
  10.  
  11.  
  12. #include <stdlib.h>
  13. #include <Strng.h>
  14.  
  15.  
  16.  
  17. #ifdef DEF_GLOBALS
  18. #define EXTERN
  19. #else
  20. #define EXTERN extern
  21. #endif
  22.  
  23.  
  24.  
  25. #define VERSION     "1.0.160295"
  26. #define ARG_OPT     "CPEMOPT"
  27. #define ARG_MAP     "CPEMAP"
  28. #define ARG_PATH    "CPEMPATH"
  29.  
  30. #define EXT_CPM     "CPM"
  31. #define EXT_COM     "COM"
  32.  
  33. #define BDOS_BEG    0xfe00
  34. #define BIOS_BEG    0xff00
  35. #define TPA_BEG     0x100
  36.  
  37. #define DEF_FCB1    0x005c
  38. #define DEF_FCB2    0x006c
  39. #define DEF_DMA     0x0080
  40.  
  41. #define MAX_FCBS    40
  42.  
  43. #define CORE        "./core.cpm"
  44. #define CORESIZE    0xc000
  45.  
  46. struct _wordregs {
  47.    unsigned short AF,BC,DE,HL,AF2,BC2,DE2,HL2,IR,IX,IY,SP,PC;
  48. };
  49. struct _byteregs {
  50.    unsigned char  F, A, C, B, E, D, L, H;
  51.    unsigned char F2,A2,C2,B2,E2,D2,L2,H2;
  52.    unsigned char R,I,XL,XH,YL,YH,SL,SH,PL,PH;
  53. };
  54. union REGS {
  55.    struct _wordregs w;
  56.    struct _byteregs b;
  57. };
  58. #define F_S   0x80
  59. #define F_Z   0x40
  60. #define F_H   0x10
  61. #define F_PE  0x04
  62. #define F_N   0x02
  63. #define F_C   0x01
  64.  
  65. #define W(P)  (*((unsigned short *)(P)))
  66. #define B(P)  (*((unsigned char  *)(P)))
  67. #define SB(P) (*((  signed char  *)(P)))
  68.  
  69. struct _FCB {
  70.    unsigned char dr;
  71.    unsigned char f[8];
  72.    unsigned char t[3];            // muß hinter f stehen
  73.    unsigned char ex;
  74.    unsigned char s1;
  75.    unsigned char s2;
  76.    unsigned char rc;
  77.    unsigned char d[16];
  78.    unsigned char cr;
  79.    unsigned char r[3];
  80. };
  81. typedef struct _FCB FCB;
  82.  
  83.  
  84.  
  85. EXTERN int    opt_OutBuf;
  86. EXTERN int    opt_Verbose;
  87. EXTERN int    opt_Quest;
  88. EXTERN String opt_CpmArg;
  89. EXTERN String opt_CpmCmd;
  90. EXTERN int    opt_User;
  91. EXTERN int    opt_CoreDump;
  92. EXTERN int    opt_SingleStep;
  93. EXTERN int    opt_BsCalls;
  94. EXTERN int    opt_Profile;
  95. EXTERN String opt_Term;
  96. EXTERN String CpmMap[16][16];            // user,drive
  97.  
  98. EXTERN char          StartPath[_MAX_PATH];
  99. EXTERN char          StartDrive;        // 0=A:,...
  100. EXTERN unsigned char Mem[0x11000];        // Z80-memory (a little bit more than 64K
  101. EXTERN int           ExitCode;            // if != 0, terminate
  102.  
  103. extern Regex CpmFName;
  104. extern Regex CpmFNameStart;
  105.  
  106.  
  107. #ifdef DEBUG
  108. #  define DIAG stdout
  109. #else
  110. #  define DIAG stderr
  111. #endif
  112.  
  113.  
  114. void RegisterDump( REGS r, char *ErrMsg, int DeArea );
  115. void CoreDump( void );
  116. void Z80Emu( REGS *preg );
  117. void Z80EmuInit( void );
  118. void Z80EmuExit( void );
  119. void Bdos( REGS *preg );
  120. void BdosInit( void );
  121. void BdosExit( void );
  122. void Bios( REGS *preg );
  123. void BiosInit( void );
  124. void BiosExit( void );
  125.  
  126. void fatal( char *fmt, char *msg = NULL );
  127.  
  128.  
  129. //
  130. //  due to a missing declaration in stdio.h / termcap.h
  131. //
  132. extern "C" {
  133.    int _fsetmode( FILE *stream, const char *mode );
  134. }
  135.  
  136.  
  137. #endif
  138.