mach1.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /*
  7. * Motorola 68020 dependent C declarations
  8. */
  9. #define low3(z) ((short)(z) & 07)
  10. #define low4(z) ((short)(z) & 017)
  11. #define low5(z) ((short)(z) & 037)
  12. #define low6(z) ((short)(z) & 077)
  13. #define low7(z) ((short)(z) & 0177)
  14. #define fit3(z) ((((z)-1) & ~((int)07)) == 0)
  15. #define fit4(z) (((z) & ~((int)017)) == 0)
  16. #define fit5(z) (((z) & ~((int)037)) == 0)
  17. #define fit6(z) (((z) & ~((int)077)) == 0)
  18. #define fit7(z) (((z) & ~((int)0177)) == 0)
  19. #define sfit7(z) (fit7((z)+64))
  20. #define fit8(z) (((z) & ~((int)0xFF)) == 0)
  21. #define fit16(z) (((z) & ~(0xFFFFL)) == 0)
  22. #define SIZE_B 0000
  23. #define SIZE_W 0100
  24. #define SIZE_L 0200
  25. #define SIZE_NON 0300
  26. #define SIZE_DEF SIZE_W
  27. #define FSIZE_L 00
  28. #define FSIZE_S 01
  29. #define FSIZE_X 02
  30. #define FSIZE_P 03
  31. #define FSIZE_W 04
  32. #define FSIZE_D 05
  33. #define FSIZE_B 06
  34. #define DEF_FP 01000 /* default floating point processor */
  35. #define DEF_MM 00000 /* default memory management */
  36. extern int co_id; /* coprocessor id */
  37. extern int mrg_1,mrg_2; /* Mode and ReGister */
  38. extern short ffew_1, ffew_2; /* Full Format Extension Word */
  39. extern expr_t bd_1,bd_2,od_1,od_2; /* base and outer displacements */
  40. #ifndef ASLD
  41. extern valu_t bd_rel1,bd_rel2,od_rel1,od_rel2;
  42. #endif
  43. #ifdef RELOCATION
  44. #ifdef ASLD
  45. #define T_EMIT2(a,b,c,d) t_emit2(a,b,c,(valu_t)0)
  46. #define T_EMIT4(a,b,c,d) t_emit4(a,b,c,(valu_t)0)
  47. #else /* ALSD */
  48. #define T_EMIT2(a,b,c,d) t_emit2(a,b,c,(valu_t)d)
  49. #define T_EMIT4(a,b,c,d) t_emit4(a,b,c,(valu_t)d)
  50. #endif /* ASLD */
  51. #else
  52. #define T_EMIT2(a,b,c,d) t_emit2(a)
  53. #define T_EMIT4(a,b,c,d) t_emit4(a)
  54. #endif
  55. struct instr_t {
  56. short i_word; /* word to be emitted */
  57. #ifdef RELOCATION
  58. short i_relotype;
  59. int i_reloinfo;
  60. valu_t i_relonami;
  61. #endif
  62. };
  63. typedef struct instr_t instr_t;
  64. extern instr_t instr[30]; /* temporary area for instructions */
  65. extern instr_t *instrp; /* index into instr[] */
  66. extern int dot_offset;
  67. /* flags used when reading effective addresses */
  68. #define INDEX 0300
  69. #define PRE_INDEX 0100
  70. #define POST_INDEX 0200
  71. #define DBL_INDEX 0300
  72. #define PC_MODE 0400
  73. /* addressing mode bits */
  74. #define DTA 0x01
  75. #define MEM 0x02
  76. #define CTR 0x04
  77. #define ALT 0x08
  78. #define FITB 0x10
  79. #define FITW 0x20
  80. #define PUTW 0x40
  81. #define PUTL 0x80
  82. extern int curr_instr;
  83. extern int curr_size;
  84. #ifndef extern
  85. extern short eamode[];
  86. #else
  87. short eamode[] = {
  88. /* 00A */ DTA |ALT,
  89. /* 01A */ ALT,
  90. /* 02A */ DTA|MEM|CTR|ALT,
  91. /* 03A */ DTA|MEM |ALT,
  92. /* 04A */ DTA|MEM |ALT,
  93. /* 05A */ DTA|MEM|CTR|ALT|FITW|PUTW, /* if relocation wanted, use 06A */
  94. /* 06A */ DTA|MEM|CTR|ALT |PUTW, /* relocation handled by ea_1() */
  95. /* 07x */ 0,
  96. /* 070 */ DTA|MEM|CTR|ALT|FITW|PUTW | (RELO2)<<8,
  97. /* 071 */ DTA|MEM|CTR|ALT |PUTL | (RELO4)<<8,
  98. /* 072 */ DTA|MEM|CTR |FITW|PUTW, /* if relocation wanted, use 073 */
  99. /* 073 */ DTA|MEM|CTR |PUTW, /* relocation handled by ea_1() */
  100. /* 074x */ 0,
  101. /* 074B */ DTA|MEM |FITB|PUTW | (RELO1)<<8,
  102. /* 074W */ DTA|MEM |FITW|PUTW | (RELO2)<<8,
  103. /* 074L */ DTA|MEM |PUTL | (RELO4)<<8,
  104. };
  105. /* RELO2 had to go with mode 070, because the assembly
  106. * language programmer can use addresses like
  107. * '(expression).w', which still have to be relocatable.
  108. */
  109. #endif