Mercurial > hg > index.cgi
comparison lwasm/insn_inh.c @ 385:4fd16faa4d93
Add various "convenience" ops
These are things like "NEGD" in 6809 mode or NEGQ in 6309 mode. These
require either 6809conv or 6309conv pragmas.
Also fix a problem with "CPX" in the 6800 mode.
Thanks to Erik G <erik@6809.org> for the patch.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 13 Jul 2015 21:26:34 -0600 |
parents | 35d4213e6657 |
children |
comparison
equal
deleted
inserted
replaced
384:6ee9c67a0f8d | 385:4fd16faa4d93 |
---|---|
37 { | 37 { |
38 // there may be two operations here so check for both | 38 // there may be two operations here so check for both |
39 l -> len = OPLEN(instab[l -> insn].ops[0]); | 39 l -> len = OPLEN(instab[l -> insn].ops[0]); |
40 if (instab[l -> insn].ops[1] >= 0) | 40 if (instab[l -> insn].ops[1] >= 0) |
41 l -> len += OPLEN(instab[l -> insn].ops[1]); | 41 l -> len += OPLEN(instab[l -> insn].ops[1]); |
42 skip_operand(p); | |
42 } | 43 } |
43 | 44 |
44 EMITFUNC(insn_emit_inh6800) | 45 EMITFUNC(insn_emit_inh6800) |
45 { | 46 { |
46 // there may be two operations here so check for both | 47 // there may be two operations here so check for both |
47 lwasm_emitop(l, instab[l -> insn].ops[0]); | 48 lwasm_emitop(l, instab[l -> insn].ops[0]); |
48 if (instab[l -> insn].ops[1] >= 0) | 49 if (instab[l -> insn].ops[1] >= 0) |
49 lwasm_emitop(l, instab[l -> insn].ops[1]); | 50 lwasm_emitop(l, instab[l -> insn].ops[1]); |
51 l -> cycle_base = instab[l -> insn].ops[3]; | |
52 } | |
50 | 53 |
51 l -> cycle_adj = instab[l -> insn].ops[3]; | 54 int negq_ops[] = { 0x10, 0x43, 0x10, 0x53, 0x10, 0x31, 0xc6, 0x10, 0x31, 0xc0 }; |
55 #define negq_size (sizeof(negq_ops)/sizeof(int)) | |
56 | |
57 PARSEFUNC(insn_parse_conv) | |
58 { | |
59 int i; | |
60 l -> len = 0; | |
61 for (i = 0; i <= 2; i++) | |
62 { | |
63 if (instab[l -> insn].ops[i] >= 0) | |
64 l -> len += OPLEN(instab[l -> insn].ops[i]); | |
65 } | |
66 | |
67 /* negq */ | |
68 if (instab[l -> insn].ops[0] == -1) | |
69 l -> len = negq_size; | |
70 skip_operand(p); | |
52 } | 71 } |
72 | |
73 EMITFUNC(insn_emit_conv) | |
74 { | |
75 int i; | |
76 for (i = 0; i <= 2; i++) | |
77 { | |
78 if (instab[l -> insn].ops[i] >= 0) | |
79 lwasm_emitop(l, instab[l -> insn].ops[i]); | |
80 } | |
81 | |
82 /* special case for negq */ | |
83 if (instab[l -> insn].ops[0] == -1) | |
84 { | |
85 // 1043 (2) comd | |
86 // 1053 (2) comw | |
87 // 1031C6 (4) adcr 0,w | |
88 // 1031C0 (4) adcr 0,d | |
89 | |
90 for (i = 0; i < negq_size; i++) | |
91 lwasm_emitop(l, negq_ops[i]); | |
92 } | |
93 | |
94 l->cycle_base = instab[l -> insn].ops[3]; | |
95 } |