annotate old-trunk/lwasm/old/insn_rtor.c @ 377:55ed7d06b136

Fixed intersection internal references in object target
author lost@starbug
date Mon, 26 Apr 2010 18:37:06 -0600
parents eb230fa7d28e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
339
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
1 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
2 insn_rtor.c
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
3 Copyright © 2009 William Astle
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
4
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
5 This file is part of LWASM.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
6
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
7 LWASM is free software: you can redistribute it and/or modify it under the
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
8 terms of the GNU General Public License as published by the Free Software
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
9 Foundation, either version 3 of the License, or (at your option) any later
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
10 version.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
11
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
15 more details.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
16
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
17 You should have received a copy of the GNU General Public License along with
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
18 this program. If not, see <http://www.gnu.org/licenses/>.
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
19 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
20
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
21 /*
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
22 for handling register to register mode instructions
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
23 */
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
24
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
25 #define __insn_rtor_c_seen__
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
26 #include <config.h>
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
27 #include "lwasm.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
28 #include "instab.h"
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
29
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
30 OPFUNC(insn_rtor)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
31 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
32 int r0, r1;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
33 static const char *regs = "D X Y U S PCW V A B CCDP0 0 E F ";
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
34 static const char *regs9 = "D X Y U S PC A B CCDP ";
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
35
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
36 lwasm_emitop(as, l, instab[opnum].ops[0]);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
37 // register to register (r0,r1)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
38 // registers are in order:
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
39 // D,X,Y,U,S,PC,W,V
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
40 // A,B,CC,DP,0,0,E,F
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
41 r0 = lwasm_lookupreg2((as -> no6309) ? regs9 : regs, p);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
42 if (r0 < 0 || *(*p)++ != ',')
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
43 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
44 register_error(as, l, 1, "Bad operand");
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
45 r0 = r1 = 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
46 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
47 else
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
48 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
49 r1 = lwasm_lookupreg2((as -> no6309) ? regs9 : regs, p);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
50 if (r1 < 0)
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
51 {
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
52 register_error(as, l, 1, "Bad operand");
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
53 r0 = r1 = 0;
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
54 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
55 }
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
56 lwasm_emit(as, l, (r0 << 4) | r1);
eb230fa7d28e Prepare for migration to hg
lost
parents:
diff changeset
57 }