asm_constants.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Andrea Di Biagio
  3. * Politecnico di Milano, 2007
  4. *
  5. * asm_constants.h
  6. * Formal Languages & Compilers Machine, 2007/2008
  7. *
  8. */
  9. #ifndef _ASM_CONSTANTS
  10. #define _ASM_CONSTANTS
  11. /* the size of an instruction (in bytes) */
  12. #define ASM_INSTRUCTION_SIZE 4
  13. /* the size of a word (in bytes) */
  14. #define ASM_WORD_SIZE 4
  15. /* alignment information */
  16. #define ASM_ALIGMENT_SIZE 4
  17. /* invalid memory offset */
  18. #define ASM_INVALID_MEMORY_OFFSET -1
  19. /* opcodes pseudo-M68000 */
  20. #define ADD_OP 0
  21. #define SUB_OP 1
  22. #define ANDL_OP 2
  23. #define ORL_OP 3
  24. #define XORL_OP 4
  25. #define ANDB_OP 5
  26. #define ORB_OP 6
  27. #define XORB_OP 7
  28. #define MUL_OP 8
  29. #define DIV_OP 9
  30. #define SHL_OP 10
  31. #define SHR_OP 11
  32. #define ROTL_OP 12
  33. #define ROTR_OP 13
  34. #define NEG_OP 14
  35. #define SPCL_OP 15
  36. #define ADDI_OP 16
  37. #define SUBI_OP 17
  38. #define ANDLI_OP 18
  39. #define ORLI_OP 19
  40. #define XORLI_OP 20
  41. #define ANDBI_OP 21
  42. #define ORBI_OP 22
  43. #define XORBI_OP 23
  44. #define MULI_OP 24
  45. #define DIVI_OP 25
  46. #define SHLI_OP 26
  47. #define SHRI_OP 27
  48. #define ROTLI_OP 28
  49. #define ROTRI_OP 29
  50. #define NOTL_OP 30
  51. #define NOTB_OP 31
  52. #define NOP_OP 32
  53. #define MOVA_OP 33
  54. #define JSR_OP 34
  55. #define RET_OP 35
  56. #define HALT_OP 36
  57. #define BT_OP 37
  58. #define BF_OP 38
  59. #define BHI_OP 39
  60. #define BLS_OP 40
  61. #define BCC_OP 41
  62. #define BCS_OP 42
  63. #define BNE_OP 43
  64. #define BEQ_OP 44
  65. #define BVC_OP 45
  66. #define BVS_OP 46
  67. #define BPL_OP 47
  68. #define BMI_OP 48
  69. #define BGE_OP 49
  70. #define BLT_OP 50
  71. #define BGT_OP 51
  72. #define BLE_OP 52
  73. #define SEQ_OP 53
  74. #define SGE_OP 54
  75. #define SGT_OP 55
  76. #define SLE_OP 56
  77. #define SLT_OP 57
  78. #define SNE_OP 58
  79. #define LOAD_OP 59
  80. #define STORE_OP 60
  81. #define READ_OP 61
  82. #define WRITE_OP 62
  83. #define INVALID_OPCODE -1
  84. /* error codes */
  85. #define ASM_OK 0
  86. #define ASM_NOT_INITIALIZED_INFO 1
  87. #define ASM_UNDEFINED_INSTRUCTION 2
  88. #define ASM_INVALID_LABEL_FOUND 3
  89. #define ASM_LABEL_ALREADY_PRESENT 4
  90. #define ASM_UNDEFINED_DATA 5
  91. #define ASM_INVALID_DATA_FORMAT 6
  92. #define ASM_FOPEN_ERROR 7
  93. #define ASM_INVALID_INPUT_FILE 8
  94. #define ASM_FWRITE_ERROR 9
  95. #define ASM_FCLOSE_ERROR 10
  96. #define ASM_CODE_NOT_PRESENT 11
  97. #define ASM_OUT_OF_MEMORY 12
  98. #define ASM_INVALID_OPCODE 13
  99. #define ASM_UNKNOWN_ERROR 14
  100. /* instruction formats */
  101. #define ASM_FORMAT_TER 0
  102. #define ASM_FORMAT_BIN 1
  103. #define ASM_FORMAT_UNR 2
  104. #define ASM_FORMAT_JMP 3
  105. #define ASM_FORMAT_NULL 4
  106. /* data formats */
  107. #define ASM_WORD 0
  108. #define ASM_SPACE 1
  109. #endif