types.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /****************************************************************************
  2. * dcc project general header
  3. * (C) Cristina Cifuentes, Mike van Emmerik
  4. ****************************************************************************/
  5. /**** Common definitions and macros ****/
  6. #ifdef __MSDOS__ /* Intel: 16 bit integer */
  7. typedef long Int; /* Int: 0x80000000..0x7FFFFFFF */
  8. typedef unsigned long flags32; /* 32 bits */
  9. typedef unsigned long dword; /* 32 bits */
  10. #define MAX 0x7FFFFFFF
  11. #else /* Unix: 32 bit integer */
  12. typedef int Int; /* Int: 0x80000000..0x7FFFFFFF */
  13. typedef unsigned int flags32; /* 32 bits */
  14. typedef unsigned int dword; /* 32 bits */
  15. #define MAX 0x7FFFFFFF
  16. #endif
  17. /* Type definitions used in the program */
  18. typedef unsigned char byte; /* 8 bits */
  19. typedef unsigned short word;/* 16 bits */
  20. typedef short int16; /* 16 bits */
  21. typedef unsigned char boolT; /* 8 bits */
  22. #if defined(__MSDOS__) | defined(WIN32)
  23. #define unlink _unlink // Compiler is picky about non Ansi names
  24. #endif
  25. #define TRUE 1
  26. #define FALSE 0
  27. #define SYNTHESIZED_MIN 0x100000 /* Synthesized labs use bits 21..32 */
  28. /* These are for C library signature detection */
  29. #define SYMLEN 16 /* Length of proc symbols, incl null */
  30. #define PATLEN 23 /* Length of proc patterns */
  31. #define WILD 0xF4 /* The wild byte */
  32. /****** MACROS *******/
  33. /* Macro to allocate a node of size sizeof(structType). */
  34. #define allocStruc(structType) (structType *)allocMem(sizeof(structType))
  35. /* Macro reads a LH word from the image regardless of host convention */
  36. /* Returns a 16 bit quantity, e.g. C000 is read into an Int as C000 */
  37. //#define LH(p) ((int16)((byte *)(p))[0] + ((int16)((byte *)(p))[1] << 8))
  38. #define LH(p) ((word)((byte *)(p))[0] + ((word)((byte *)(p))[1] << 8))
  39. /* Macro reads a LH word from the image regardless of host convention */
  40. /* Returns a signed quantity, e.g. C000 is read into an Int as FFFFC000 */
  41. #define LHS(p) (((byte *)(p))[0] + (((char *)(p))[1] << 8))
  42. /* Macro tests bit b for type t in prog.map */
  43. #define BITMAP(b, t) (prog.map[(b) >> 2] & ((t) << (((b) & 3) << 1)))
  44. /* Macro to convert a segment, offset definition into a 20 bit address */
  45. #define opAdr(seg,off) ((seg << 4) + off)