mach5.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #define RCSID5 "$Id$"
  6. /*
  7. * Signetics 2650 special routines
  8. */
  9. #define MASK 0x6000
  10. #define MASK1 0x1FFF
  11. #define MASK2 0x1FFE
  12. page()
  13. {
  14. if(((DOTVAL - 1) & MASK1) == MASK1)
  15. serror("page violation");
  16. }
  17. pag2()
  18. {
  19. if(((DOTVAL - 1) & MASK1) >= MASK2)
  20. serror("page violation");
  21. }
  22. rela(exp,ind)
  23. expr_t exp;
  24. int ind;
  25. {
  26. int c, d;
  27. page();
  28. if(pass == PASS_3){
  29. #ifdef ASLD
  30. if((DOTVAL & MASK) != (exp.val & MASK))
  31. serror("relative address outside page");
  32. #endif
  33. d = low13(DOTVAL);
  34. c = low13(exp.val);
  35. #ifdef ASLD
  36. /*
  37. * I (Duk Bekema) think the next two if's are meant to
  38. * handle wrap around, but the original author didn't give
  39. * any comment here and I don't know anything about the
  40. * Signetics 2650.
  41. */
  42. if(c - d > 0x1F80)
  43. d |= 0x2000;
  44. if(d - c > 0x1F80)
  45. c |= 0x2000;
  46. #endif
  47. c -= d + 1;
  48. fit(fit7(c));
  49. }
  50. #ifdef RELOCATION
  51. newrelo(exp.typ, RELPC | RELO1);
  52. #endif
  53. emit1(low7(c) | ind);
  54. }
  55. absoa(exp, ix, ind)
  56. expr_t exp;
  57. int ix;
  58. unsigned ind;
  59. {
  60. pag2();
  61. #ifdef ASLD
  62. if(pass == PASS_3 && (exp.val & MASK) != (DOTVAL & MASK))
  63. serror("page violation");
  64. #endif
  65. #ifdef RELOCATION
  66. newrelo(exp.typ, RELO2 | RELBR);
  67. #endif
  68. emit2(low13(exp.val) | ind | ix);
  69. }
  70. absob(exp, ind)
  71. expr_t exp;
  72. unsigned ind;
  73. {
  74. pag2();
  75. #ifdef ASLD
  76. if (exp.val < 0)
  77. serror("branch to nonexistent memory");
  78. #endif
  79. #ifdef RELOCATION
  80. newrelo(exp.typ, RELO2 | RELBR);
  81. #endif
  82. emit2(exp.val | ind);
  83. }