Mercurial > hg-old > index.cgi
comparison lwasm/insn_rtor.c @ 357:0cf4948d53b4
Checkpoint - adding actual cpu instructions
author | lost@starbug |
---|---|
date | Wed, 31 Mar 2010 20:12:20 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
356:7166254491ed | 357:0cf4948d53b4 |
---|---|
1 /* | |
2 insn_rtor.c | |
3 Copyright © 2010 William Astle | |
4 | |
5 This file is part of LWASM. | |
6 | |
7 LWASM is free software: you can redistribute it and/or modify it under the | |
8 terms of the GNU General Public License as published by the Free Software | |
9 Foundation, either version 3 of the License, or (at your option) any later | |
10 version. | |
11 | |
12 This program is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
15 more details. | |
16 | |
17 You should have received a copy of the GNU General Public License along with | |
18 this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 */ | |
21 | |
22 #include <config.h> | |
23 | |
24 #include "lwasm.h" | |
25 #include "instab.h" | |
26 | |
27 PARSEFUNC(insn_parse_rtor) | |
28 { | |
29 int r0, r1; | |
30 | |
31 static const char *regs = "D X Y U S PCW V A B CCDP0 0 E F "; | |
32 static const char *regs9 = "D X Y U S PC A B CCDP "; | |
33 | |
34 // register to register (r0,r1) | |
35 // registers are in order: | |
36 // D,X,Y,U,S,PC,W,V | |
37 // A,B,CC,DP,0,0,E,F | |
38 | |
39 r0 = lwasm_lookupreg2((as -> target == TARGET_6309) ? regs9 : regs, p); | |
40 if (r0 < 0 || *(*p)++ != ',') | |
41 { | |
42 lwasm_register_error(as, l, "Bad operand"); | |
43 r0 = r1 = 0; | |
44 } | |
45 else | |
46 { | |
47 r1 = lwasm_lookupreg2((as -> target = TARGET_6309) ? regs9 : regs, p); | |
48 if (r1 < 0) | |
49 { | |
50 lwasm_register_error(as, l, "Bad operand"); | |
51 r0 = r1 = 0; | |
52 } | |
53 } | |
54 l -> pb = (r0 << 4) | r1; | |
55 l -> len = OPLEN(instab[l -> insn].ops[0]) + 1; | |
56 } | |
57 | |
58 EMITFUNC(insn_emit_rtor) | |
59 { | |
60 lwasm_emitop(l, instab[l -> insn].ops[0]); | |
61 lwasm_emit(l, l -> pb); | |
62 } |