as.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #define UNKNOWN 0
  2. #define IS_REG 0x1
  3. #define IS_ACCU 0x2
  4. #define IS_DATA 0x4
  5. #define IS_LABEL 0x8
  6. #define IS_MEM 0x10
  7. #define IS_ADDR 0x20
  8. #define IS_ILB 0x40
  9. #define AX 0
  10. #define BX 3
  11. #define CL 1
  12. #define SP 4
  13. #define BP 5
  14. #define SI 6
  15. #define DI 7
  16. #define REG( op) ( op->type & IS_REG)
  17. #define ACCU( op) ( op->type & IS_REG && op->reg == AX)
  18. #define REG_CL( op) ( op->type & IS_REG && op->reg == CL)
  19. #define DATA( op) ( op->type & IS_DATA)
  20. #define lABEL( op) ( op->type & IS_LABEL)
  21. #define ILB( op) ( op->type & IS_ILB)
  22. #define MEM( op) ( op->type & IS_MEM)
  23. #define ADDR( op) ( op->type & IS_ADDR)
  24. #define EADDR( op) ( op->type & ( IS_ADDR | IS_MEM | IS_REG))
  25. #define CONST1( op) ( op->type & IS_DATA && strcmp( "1", op->expr) == 0)
  26. #define MOVS( op) ( op->type & IS_LABEL&&strcmp("\"movs\"", op->lab) == 0)
  27. #define IMMEDIATE( op) ( op->type & ( IS_DATA | IS_LABEL))
  28. #define TRUE 1
  29. #define FALSE 0
  30. struct t_operand {
  31. unsigned type;
  32. int reg;
  33. char *expr, *lab, *off;
  34. };
  35. extern struct t_operand saved_op, *AX_oper;