home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 405.lha / Z8_CrossAsm / optab.h < prev    next >
C/C++ Source or Header  |  1990-06-05  |  8KB  |  343 lines

  1.  
  2. /* optap.h */
  3.  
  4. struct optable op_adc[] = {
  5.     R4,R4,2,0x12,DESTSL4_OR_SOURCE,0,
  6.     R4,IR4,2,0x13,DESTSL4_OR_SOURCE,0,
  7.     R8,R8,3,0x14,ZSOURCE,ZDEST,
  8.     R8,IR8,3,0x15,ZSOURCE,ZDEST,
  9.     R8,IM8,3,0x16,ZDEST,ZSOURCE,
  10.     IR8,IM8,3,0x17,ZDEST,ZSOURCE,
  11.     0,0,0,0,0,0                /* terminator */
  12. };
  13.  
  14. struct optable op_add[] = {
  15.     R4,R4,2,0x02,DESTSL4_OR_SOURCE,0,
  16.     R4,IR4,2,0x03,DESTSL4_OR_SOURCE,0,
  17.     R8,R8,3,0x04,ZSOURCE,ZDEST,
  18.     R8,IR8,3,0x05,ZSOURCE,ZDEST,
  19.     R8,IM8,3,0x06,ZDEST,ZSOURCE,
  20.     IR8,IM8,3,0x07,ZDEST,ZSOURCE,
  21.     0,0,0,0,0,0                /* terminator */
  22. };
  23.  
  24. struct optable op_and[] = {
  25.     R4,R4,2,0x52,DESTSL4_OR_SOURCE,0,
  26.     R4,IR4,2,0x53,DESTSL4_OR_SOURCE,0,
  27.     R8,R8,3,0x54,ZSOURCE,ZDEST,
  28.     R8,IR8,3,0x55,ZSOURCE,ZDEST,
  29.     R8,IM8,3,0x56,ZDEST,ZSOURCE,
  30.     IR8,IM8,3,0x57,ZDEST,ZSOURCE,
  31.     0,0,0,0,0,0                /* terminator */
  32. };
  33.  
  34. struct optable op_cp[] = {
  35.     R4,R4,2,0xa2,DESTSL4_OR_SOURCE,0,
  36.     R4,IR4,2,0xa3,DESTSL4_OR_SOURCE,0,
  37.     R8,R8,3,0xa4,ZSOURCE,ZDEST,
  38.     R8,IR8,3,0xa5,ZSOURCE,ZDEST,
  39.     R8,IM8,3,0xa6,ZDEST,ZSOURCE,
  40.     IR8,IM8,3,0xa7,ZDEST,ZSOURCE,
  41.     0,0,0,0,0,0                /* terminator */
  42. };
  43.  
  44. struct optable op_or[] = {
  45.     R4,R4,2,0x42,DESTSL4_OR_SOURCE,0,
  46.     R4,IR4,2,0x43,DESTSL4_OR_SOURCE,0,
  47.     R8,R8,3,0x44,ZSOURCE,ZDEST,
  48.     R8,IR8,3,0x45,ZSOURCE,ZDEST,
  49.     R8,IM8,3,0x46,ZDEST,ZSOURCE,
  50.     IR8,IM8,3,0x47,ZDEST,ZSOURCE,
  51.     0,0,0,0,0,0                /* terminator */
  52. };
  53.  
  54. struct optable op_sbc[] = {
  55.     R4,R4,2,0x32,DESTSL4_OR_SOURCE,0,
  56.     R4,IR4,2,0x33,DESTSL4_OR_SOURCE,0,
  57.     R8,R8,3,0x34,ZSOURCE,ZDEST,
  58.     R8,IR8,3,0x35,ZSOURCE,ZDEST,
  59.     R8,IM8,3,0x36,ZDEST,ZSOURCE,
  60.     IR8,IM8,3,0x37,ZDEST,ZSOURCE,
  61.     0,0,0,0,0,0                /* terminator */
  62. };
  63.  
  64. struct optable op_sub[] = {
  65.     R4,R4,2,0x22,DESTSL4_OR_SOURCE,0,
  66.     R4,IR4,2,0x23,DESTSL4_OR_SOURCE,0,
  67.     R8,R8,3,0x24,ZSOURCE,ZDEST,
  68.     R8,IR8,3,0x25,ZSOURCE,ZDEST,
  69.     R8,IM8,3,0x26,ZDEST,ZSOURCE,
  70.     IR8,IM8,3,0x27,ZDEST,ZSOURCE,
  71.     0,0,0,0,0,0                /* terminator */
  72. };
  73.  
  74. struct optable op_tcm[] = {
  75.     R4,R4,2,0x62,DESTSL4_OR_SOURCE,0,
  76.     R4,IR4,2,0x63,DESTSL4_OR_SOURCE,0,
  77.     R8,R8,3,0x64,ZSOURCE,ZDEST,
  78.     R8,IR8,3,0x65,ZSOURCE,ZDEST,
  79.     R8,IM8,3,0x66,ZDEST,ZSOURCE,
  80.     IR8,IM8,3,0x67,ZDEST,ZSOURCE,
  81.     0,0,0,0,0,0                /* terminator */
  82. };
  83.  
  84. struct optable op_tm[] = {
  85.     R4,R4,2,0x72,DESTSL4_OR_SOURCE,0,
  86.     R4,IR4,2,0x73,DESTSL4_OR_SOURCE,0,
  87.     R8,R8,3,0x74,ZSOURCE,ZDEST,
  88.     R8,IR8,3,0x75,ZSOURCE,ZDEST,
  89.     R8,IM8,3,0x76,ZDEST,ZSOURCE,
  90.     IR8,IM8,3,0x77,ZDEST,ZSOURCE,
  91.     0,0,0,0,0,0                /* terminator */
  92. };
  93.  
  94. struct optable op_xor[] = {
  95.     R4,R4,2,0xb2,DESTSL4_OR_SOURCE,0,
  96.     R4,IR4,2,0xb3,DESTSL4_OR_SOURCE,0,
  97.     R8,R8,3,0xb4,ZSOURCE,ZDEST,
  98.     R8,IR8,3,0xb5,ZSOURCE,ZDEST,
  99.     R8,IM8,3,0xb6,ZDEST,ZSOURCE,
  100.     IR8,IM8,3,0xb7,ZDEST,ZSOURCE,
  101.     0,0,0,0,0,0                /* terminator */
  102. };
  103.  
  104. struct optable op_call[] = {
  105.     DA,0,3,0xd6,ZDEST,0,
  106.     IRR8,0,2,0xd4,ZDEST,0,
  107.     0,0,0,0,0,0
  108. };
  109.  
  110. struct optable op_ld[] = {
  111.     R4,IM8,2,0x0c,OPCODE_OR_DESTSL4,ZSOURCE,
  112.     R4,R8,2,0x08,OPCODE_OR_DESTSL4,ZSOURCE,
  113.     R8,R4,2,0x09,OPCODE_OR_SOURCESL4,ZDEST,
  114.     R4,IR4,2,0xe3,DESTSL4_OR_SOURCE,0,
  115.     IR4,R4,2,0xf3,DESTSL4_OR_SOURCE,0,
  116.     R8,R8,3,0xe4,ZSOURCE,ZDEST,
  117.     R8,IR8,3,0xe5,ZSOURCE,ZDEST,
  118.     R8,IM8,3,0xe6,ZDEST,ZSOURCE,
  119.     IR8,IM8,3,0xe7,ZDEST,ZSOURCE,
  120.     IR8,R8,3,0xf5,ZSOURCE,ZDEST,
  121.     0,0,0,0,0,0
  122. };
  123.  
  124. struct optable op_lde[] = {
  125.     R4,IRR4,2,0x82,DESTSL4_OR_SOURCE,0,
  126.     IRR4,R4,2,0x92,SOURCESL4_OR_DEST,0,
  127.     0,0,0,0,0,0
  128. };
  129.  
  130. struct optable op_ldei[] = {
  131.     IR4,IRR4,2,0x83,DESTSL4_OR_SOURCE,0,
  132.     IRR4,IR4,2,0x93,SOURCESL4_OR_DEST,0,
  133.     0,0,0,0,0,0
  134. };
  135.  
  136. struct optable op_ldc[] = {
  137.     R4,IRR4,2,0xc2,DESTSL4_OR_SOURCE,0,
  138.     IRR4,R4,2,0xd2,SOURCESL4_OR_DEST,0,
  139.     0,0,0,0,0,0
  140. };
  141.  
  142. struct optable op_ldci[] = {
  143.     IR4,IRR4,2,0xc3,DESTSL4_OR_SOURCE,0,
  144.     IRR4,IR4,2,0xd3,SOURCESL4_OR_DEST,0,
  145.     0,0,0,0,0,0
  146. };
  147.  
  148. struct optable op_inc[] = {
  149.     R4,0,1,0x0e,OPCODE_OR_DESTSL4,0,
  150.     R8,0,2,0x20,ZDEST,0,
  151.     IR8,0,2,0x21,ZDEST,0,
  152.     0,0,0,0,0,0
  153. };
  154.  
  155. struct optable op_clr[] = {
  156.     R8,0,2,0xb0,ZDEST,0,
  157.     IR8,0,2,0xb1,ZDEST,0,
  158.     0,0,0,0,0,0
  159. };
  160.  
  161. struct optable op_com[] = {
  162.     R8,0,2,0x60,ZDEST,0,
  163.     IR8,0,2,0x61,ZDEST,0,
  164.     0,0,0,0,0,0
  165. };
  166.  
  167. struct optable op_da[] = {
  168.     R8,0,2,0x40,ZDEST,0,
  169.     IR8,0,2,0x41,ZDEST,0,
  170.     0,0,0,0,0,0
  171. };
  172.  
  173. struct optable op_pop[] = {
  174.     R8,0,2,0x50,ZDEST,0,
  175.     IR8,0,2,0x51,ZDEST,0,
  176.     0,0,0,0,0,0
  177. };
  178.  
  179. struct optable op_push[] = {
  180.     R8,0,2,0x70,ZDEST,0,
  181.     IR8,0,2,0x71,ZDEST,0,
  182.     0,0,0,0,0,0
  183. };
  184.  
  185. struct optable op_dec[] = {
  186.     R8,0,2,0x00,ZDEST,0,
  187.     IR8,0,2,0x01,ZDEST,0,
  188.     0,0,0,0,0,0
  189. };
  190.  
  191. struct optable op_rl[] = {
  192.     R8,0,2,0x90,ZDEST,0,
  193.     IR8,0,2,0x91,ZDEST,0,
  194.     0,0,0,0,0,0
  195. };
  196.  
  197. struct optable op_rlc[] = {
  198.     R8,0,2,0x10,ZDEST,0,
  199.     IR8,0,2,0x11,ZDEST,0,
  200.     0,0,0,0,0,0
  201. };
  202.  
  203. struct optable op_rr[] = {
  204.     R8,0,2,0xe0,ZDEST,0,
  205.     IR8,0,2,0xe1,ZDEST,0,
  206.     0,0,0,0,0,0
  207. };
  208.  
  209. struct optable op_rrc[] = {
  210.     R8,0,2,0xc0,ZDEST,0,
  211.     IR8,0,2,0xc1,ZDEST,0,
  212.     0,0,0,0,0,0
  213. };
  214.  
  215. struct optable op_sra[] = {
  216.     R8,0,2,0xd0,ZDEST,0,
  217.     IR8,0,2,0xd1,ZDEST,0,
  218.     0,0,0,0,0,0
  219. };
  220.  
  221. struct optable op_swap[] = {
  222.     R8,0,2,0xf0,ZDEST,0,
  223.     IR8,0,2,0xf1,ZDEST,0,
  224.     0,0,0,0,0,0
  225. };
  226.  
  227. struct optable op_ccf[] = {
  228.     IMP,0,1,0xef,0,0,
  229.     0,0,0,0,0,0
  230. };
  231.  
  232. struct optable op_di[] = {
  233.     IMP,0,1,0x8f,0,0,
  234.     0,0,0,0,0,0
  235. };
  236.  
  237. struct optable op_iret[] = {
  238.     IMP,0,1,0xbf,0,0,
  239.     0,0,0,0,0,0
  240. };
  241.  
  242. struct optable op_nop[] = {
  243.     IMP,0,1,0xff,0,0,
  244.     0,0,0,0,0,0
  245. };
  246.  
  247.  
  248. struct optable op_ei[] = {
  249.     IMP,0,1,0x9f,0,0,
  250.     0,0,0,0,0,0
  251. };
  252.  
  253. struct optable op_srp[] = {
  254.     IM8,0,2,0x31,ZDEST,0,
  255.     0,0,0,0,0,0
  256. };
  257.  
  258. struct optable op_ret[] = {
  259.     IMP,0,1,0xaf,0,0,
  260.     0,0,0,0,0,0
  261. };
  262.  
  263. struct optable op_rcf[] = {
  264.     IMP,0,1,0xcf,0,0,
  265.     0,0,0,0,0,0
  266. };
  267.  
  268. struct optable op_scf[] = {
  269.     IMP,0,1,0xdf,0,0,
  270.     0,0,0,0,0,0
  271. };
  272.  
  273. struct optable op_incw[] = {
  274.     RR8,0,2,0xa0,ZDEST,0,
  275.     IRR8,0,2,0xa1,ZDEST,0,
  276.     0,0,0,0,0,0
  277. };
  278.  
  279. struct optable op_decw[] = {
  280.     RR8,0,2,0x80,ZDEST,0,
  281.     IRR8,0,2,0x81,ZDEST,0,
  282.     0,0,0,0,0,0
  283. };
  284.  
  285.         
  286. struct syntax {
  287.     char *mne;        /* ascii mneumonic */
  288.     int opr_type;    /* operand type descriptor */
  289.     struct optable *otab;  /* pointer to operand evaluation table */
  290.     int tot_args;       /* total minimum arguments including mne */
  291. };
  292.  
  293. /* the z8 syntax description */
  294.  
  295. struct syntax z8[] = {
  296.     "Invalid",0,NULL,0,
  297.     "ADC",DEST_SOURCE,op_adc,3,
  298.     "ADD",DEST_SOURCE,op_add,3,
  299.     "AND",DEST_SOURCE,op_and,3,
  300.     "CALL",DEST_ONLY,op_call,2,
  301.     "CCF",IMPLIED,op_ccf,1,
  302.     "CLR",DEST_ONLY,op_clr,2,
  303.     "COM",DEST_ONLY,op_com,2,
  304.     "CP",DEST_SOURCE,op_cp,2,
  305.     "DA",DEST_ONLY,op_da,2,
  306.     "DEC",DEST_ONLY,op_dec,2,
  307.     "DECW",DEST_ONLY,op_decw,3,
  308.     "DI",IMPLIED,op_di,1,
  309.     "DJNZ",CREATE_DJ,NULL,3,
  310.     "EI",IMPLIED,op_ei,1,
  311.     "INC",DEST_ONLY,op_inc,2,
  312.     "INCW",DEST_ONLY,op_incw,3,
  313.     "IRET",IMPLIED,op_iret,1,
  314.     "JP",CREATE_JP,NULL,3,
  315.     "JR",CREATE_JR,NULL,3,
  316.     "LD",DEST_SOURCE,op_ld,3,
  317.     "LDC",DEST_SOURCE,op_ldc,2,
  318.     "LDCI",DEST_SOURCE,op_ldci,2,
  319.     "LDE",DEST_SOURCE,op_lde,2,
  320.     "LDEI",DEST_SOURCE,op_ldei,2,
  321.     "NOP",IMPLIED,op_nop,1,
  322.     "OR",DEST_SOURCE,op_or,2,
  323.     "POP",DEST_ONLY,op_pop,2,
  324.     "PUSH",DEST_ONLY,op_push,2,
  325.     "RCF",IMPLIED,op_rcf,1,
  326.     "RET",IMPLIED,op_ret,1,
  327.     "RL",DEST_ONLY,op_rl,2,
  328.     "RLC",DEST_ONLY,op_rlc,2,
  329.     "RR",DEST_ONLY,op_rr,2,
  330.     "RRC",DEST_ONLY,op_rrc,2,
  331.     "SBC",DEST_SOURCE,op_sbc,3,
  332.     "SCF",IMPLIED,op_scf,1,
  333.     "SRA",DEST_ONLY,op_sra,2,
  334.     "SRP",DEST_ONLY,op_srp,2,
  335.     "SUB",DEST_SOURCE,op_sub,3,
  336.     "SWAP",DEST_ONLY,op_swap,2,
  337.     "TCM",DEST_SOURCE,op_tcm,3,
  338.     "TM",DEST_SOURCE,op_tm,3,
  339.     "XOR",DEST_SOURCE,op_xor,3
  340. };
  341.  
  342. #define Z8SIZE sizeof(z8) / sizeof(z8[0])
  343.