Mercurial > hg > index.cgi
annotate lwasm/insn_inh.c @ 349:b62af915c2cc
Fix includebin to use binary mode when emitting the contents of the file.
For systems with the stupid distinction between binary and text files (I'm
looking at you Windows), actually specify binary mode when reading the
include file for a binary include.
It worked fine on Linux and other Unix-like systems which treat files as
a simple sequence of bytes but on Windows, you get the benefit of 0x1A
causing an EOF signal with text mode files which is not helpful.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 12 Apr 2015 12:11:19 -0600 |
parents | 507f442dc71e |
children | 35d4213e6657 |
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 } |