annotate lwasm/insn_inh.c @ 333:507f442dc71e

Add support for 6800 compatibility instructions. The occasional program uses the 6800 compatibility instructions since they are actually specified by Motorola in at least some documentation. They advertised the 6809 as source compatible with the 6800. This mode is not enabled by default, however. It is my belief that receiving an error when using a non-6809 instruction is more useful since it is unlikely that much 6800 source code is being assembled for the 6809 these days. Nevertheless, the --6809compat option is present for just those purposes so one does not have to resort to using macros (which would work equally well in most cases).
author William Astle <lost@l-w.ca>
date Tue, 15 Apr 2014 10:57:34 -0600
parents 2c24602be78f
children 35d4213e6657
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
1 /*
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
2 insn_inh.c
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
3 Copyright © 2010 William Astle
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
4
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
5 This file is part of LWASM.
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
6
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
10 version.
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
11
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
15 more details.
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
16
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
19
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
20 */
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
21
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
22 #include "lwasm.h"
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
23 #include "instab.h"
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
24
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
25 PARSEFUNC(insn_parse_inh)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
26 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
27 l -> len = OPLEN(instab[l -> insn].ops[0]);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
28 skip_operand(p);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
29 }
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
30
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
31 EMITFUNC(insn_emit_inh)
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
32 {
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
33 lwasm_emitop(l, instab[l -> insn].ops[0]);
2c24602be78f Initial import from lwtools 3.0.1 version, with new hand built build system and file reorganization
lost@l-w.ca
parents:
diff changeset
34 }
333
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
35
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
36 PARSEFUNC(insn_parse_inh6800)
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
37 {
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
38 // there may be two operations here so check for both
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
39 l -> len = OPLEN(instab[l -> insn].ops[0]);
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
40 if (instab[l -> insn].ops[1] >= 0)
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
41 l -> len += OPLEN(instab[l -> insn].ops[1]);
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
42 }
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
43
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
44 EMITFUNC(insn_emit_inh6800)
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
45 {
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
46 // there may be two operations here so check for both
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
47 lwasm_emitop(l, instab[l -> insn].ops[0]);
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
48 if (instab[l -> insn].ops[1] >= 0)
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
49 lwasm_emitop(l, instab[l -> insn].ops[1]);
507f442dc71e Add support for 6800 compatibility instructions.
William Astle <lost@l-w.ca>
parents: 0
diff changeset
50 }