mach4.c 995 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #define RCSID4 "$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. /*
  8. * Motorola 6800 parsing rules
  9. */
  10. operation
  11. :
  12. NOARG
  13. { emit1($1);}
  14. |
  15. BRANCH expr
  16. { branch($1,$2);}
  17. |
  18. XOP '#' expr
  19. { emit1($1 - 0x20);
  20. switch ($1 & 0x0F) {
  21. case 0x03:
  22. case 0x0C:
  23. case 0x0E:
  24. #ifdef RELOCATION
  25. newrelo($3.typ, RELBR | RELO2);
  26. #endif
  27. emit2($3.val);
  28. break;
  29. default:
  30. #ifdef RELOCATION
  31. newrelo($3.typ, RELO1);
  32. #endif
  33. emit1($3.val);
  34. }
  35. }
  36. |
  37. XOP '<' expr
  38. { emit1($1 - 0x10);
  39. #ifdef RELOCATION
  40. newrelo($3.typ, RELO1);
  41. #endif
  42. emit1($3.val);
  43. }
  44. |
  45. memref expr
  46. { emit1($1 + 0x10);
  47. #ifdef RELOCATION
  48. newrelo($2.typ, RELO2);
  49. #endif
  50. emit2($2.val);
  51. }
  52. |
  53. memref expr ',' X
  54. { emit1($1);
  55. #ifdef RELOCATION
  56. newrelo($2.typ, RELO1);
  57. #endif
  58. emit1($2.val);
  59. }
  60. ;
  61. memref :
  62. AOP
  63. |
  64. XOP
  65. ;