summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-05 13:32:21 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-05 13:32:21 +0000
commit6865e612102c809bfed00acb52ce75395395cc89 (patch)
treec68d68703f432db887bd111088bbc51a4506f6cb /mixlib
parent52cd64b7673affa9737ee6f486ea974c59f4d388 (diff)
downloadmdk-6865e612102c809bfed00acb52ce75395395cc89.tar.gz
mdk-6865e612102c809bfed00acb52ce75395395cc89.tar.bz2
Invalid F-spec reported as warnings, to allow hacks as CMPX xxxx(6)
git-archimport-id: mdk@sv.gnu.org/mdk--devel--1--patch-13
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_ins.h85
-rw-r--r--mixlib/mix_scanner.l27
2 files changed, 54 insertions, 58 deletions
diff --git a/mixlib/mix_ins.h b/mixlib/mix_ins.h
index 07d8e38..3060f1c 100644
--- a/mixlib/mix_ins.h
+++ b/mixlib/mix_ins.h
@@ -2,22 +2,22 @@
* This file declares types and functions for manipulating MIX
* instructions
* ------------------------------------------------------------------
- * Copyright (C) 2000 Free Software Foundation, Inc.
- *
+ * Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
+ *
*/
@@ -40,38 +40,38 @@ mix_release_ins(void);
typedef mix_short_t mix_address_t;
/*-- Index field: a value between 0 and 6 */
-typedef enum {
+typedef enum {
mix_I0, mix_I1, mix_I2, mix_I3, mix_I4, mix_I5, mix_I6 } mix_index_t;
/*-- Instruction id: enumeration of MIX instruction set */
typedef enum {
- mix_NOP, mix_ADD, mix_SUB, mix_MUL, mix_DIV,
- mix_NUM, mix_CHAR, mix_HLT,
- mix_SLA, mix_SRA, mix_SLAX, mix_SRAX, mix_SLC, mix_SRC,
- mix_MOVE, mix_LDA, mix_LD1, mix_LD2, mix_LD3, mix_LD4, mix_LD5,
+ mix_NOP, mix_ADD, mix_SUB, mix_MUL, mix_DIV,
+ mix_NUM, mix_CHAR, mix_HLT,
+ mix_SLA, mix_SRA, mix_SLAX, mix_SRAX, mix_SLC, mix_SRC,
+ mix_MOVE, mix_LDA, mix_LD1, mix_LD2, mix_LD3, mix_LD4, mix_LD5,
mix_LD6, mix_LDX, mix_LDAN, mix_LD1N, mix_LD2N, mix_LD3N, mix_LD4N,
- mix_LD5N, mix_LD6N, mix_LDXN, mix_STA, mix_ST1, mix_ST2, mix_ST3, mix_ST4,
- mix_ST5, mix_ST6, mix_STX, mix_STJ, mix_STZ, mix_JBUS, mix_IOC, mix_IN,
- mix_OUT, mix_JRED,
+ mix_LD5N, mix_LD6N, mix_LDXN, mix_STA, mix_ST1, mix_ST2, mix_ST3, mix_ST4,
+ mix_ST5, mix_ST6, mix_STX, mix_STJ, mix_STZ, mix_JBUS, mix_IOC, mix_IN,
+ mix_OUT, mix_JRED,
mix_JMP, mix_JSJ, mix_JOV, mix_JNOV, mix_JL, mix_JE, mix_JG, mix_JGE,
mix_JNE, mix_JLE,
- mix_JAN, mix_JAZ, mix_JAP, mix_JANN, mix_JANZ, mix_JANP,
+ mix_JAN, mix_JAZ, mix_JAP, mix_JANN, mix_JANZ, mix_JANP,
mix_J1N, mix_J1Z, mix_J1P, mix_J1NN, mix_J1NZ, mix_J1NP,
mix_J2N, mix_J2Z, mix_J2P, mix_J2NN, mix_J2NZ, mix_J2NP,
mix_J3N, mix_J3Z, mix_J3P, mix_J3NN, mix_J3NZ, mix_J3NP,
mix_J4N, mix_J4Z, mix_J4P, mix_J4NN, mix_J4NZ, mix_J4NP,
mix_J5N, mix_J5Z, mix_J5P, mix_J5NN, mix_J5NZ, mix_J5NP,
mix_J6N, mix_J6Z, mix_J6P, mix_J6NN, mix_J6NZ, mix_J6NP,
- mix_JXN, mix_JXZ, mix_JXP, mix_JXNN, mix_JXNZ, mix_JXNP,
- mix_INCA, mix_DECA, mix_ENTA, mix_ENNA,
+ mix_JXN, mix_JXZ, mix_JXP, mix_JXNN, mix_JXNZ, mix_JXNP,
+ mix_INCA, mix_DECA, mix_ENTA, mix_ENNA,
mix_INC1, mix_DEC1, mix_ENT1, mix_ENN1,
mix_INC2, mix_DEC2, mix_ENT2, mix_ENN2,
mix_INC3, mix_DEC3, mix_ENT3, mix_ENN3,
- mix_INC4, mix_DEC4, mix_ENT4, mix_ENN4,
- mix_INC5, mix_DEC5, mix_ENT5, mix_ENN5,
- mix_INC6, mix_DEC6, mix_ENT6, mix_ENN6,
- mix_INCX, mix_DECX, mix_ENTX, mix_ENNX,
- mix_CMPA, mix_CMP1, mix_CMP2, mix_CMP3, mix_CMP4,
+ mix_INC4, mix_DEC4, mix_ENT4, mix_ENN4,
+ mix_INC5, mix_DEC5, mix_ENT5, mix_ENN5,
+ mix_INC6, mix_DEC6, mix_ENT6, mix_ENN6,
+ mix_INCX, mix_DECX, mix_ENTX, mix_ENNX,
+ mix_CMPA, mix_CMP1, mix_CMP2, mix_CMP3, mix_CMP4,
mix_CMP5, mix_CMP6, mix_CMPX, mix_INVALID_INS
} mix_ins_id_t;
@@ -82,22 +82,22 @@ typedef mix_byte_t mix_opcode_t;
/* labels for each opcode */
enum {
- mix_opNOP = 0, mix_opADD, mix_opSUB, mix_opMUL, mix_opDIV,
- mix_opSPC, mix_opSLx, mix_opMOVE,
- mix_opLDA, mix_opLD1, mix_opLD2, mix_opLD3, mix_opLD4, mix_opLD5,
- mix_opLD6, mix_opLDX, mix_opLDAN, mix_opLD1N, mix_opLD2N, mix_opLD3N,
- mix_opLD4N, mix_opLD5N, mix_opLD6N, mix_opLDXN,
- mix_opSTA, mix_opST1, mix_opST2, mix_opST3, mix_opST4,
- mix_opST5, mix_opST6, mix_opSTX, mix_opSTJ, mix_opSTZ,
- mix_opJBUS, mix_opIOC, mix_opIN, mix_opOUT, mix_opJRED,
- mix_opJMP, mix_opJAx, mix_opJ1x, mix_opJ2x, mix_opJ3x,
+ mix_opNOP = 0, mix_opADD, mix_opSUB, mix_opMUL, mix_opDIV,
+ mix_opSPC, mix_opSLx, mix_opMOVE,
+ mix_opLDA, mix_opLD1, mix_opLD2, mix_opLD3, mix_opLD4, mix_opLD5,
+ mix_opLD6, mix_opLDX, mix_opLDAN, mix_opLD1N, mix_opLD2N, mix_opLD3N,
+ mix_opLD4N, mix_opLD5N, mix_opLD6N, mix_opLDXN,
+ mix_opSTA, mix_opST1, mix_opST2, mix_opST3, mix_opST4,
+ mix_opST5, mix_opST6, mix_opSTX, mix_opSTJ, mix_opSTZ,
+ mix_opJBUS, mix_opIOC, mix_opIN, mix_opOUT, mix_opJRED,
+ mix_opJMP, mix_opJAx, mix_opJ1x, mix_opJ2x, mix_opJ3x,
mix_opJ4x, mix_opJ5x, mix_opJ6x, mix_opJXx,
- mix_opINCA, mix_opINC1, mix_opINC2, mix_opINC3,
+ mix_opINCA, mix_opINC1, mix_opINC2, mix_opINC3,
mix_opINC4, mix_opINC5, mix_opINC6, mix_opINCX,
- mix_opCMPA, mix_opCMP1, mix_opCMP2, mix_opCMP3, mix_opCMP4,
+ mix_opCMPA, mix_opCMP1, mix_opCMP2, mix_opCMP3, mix_opCMP4,
mix_opCMP5, mix_opCMP6, mix_opCMPX
};
-
+
extern mix_opcode_t
mix_get_opcode_from_id(mix_ins_id_t id);
@@ -110,7 +110,7 @@ mix_get_fspec_from_id(mix_ins_id_t id);
extern gboolean
mix_ins_id_is_extended(mix_ins_id_t id);
-extern const gchar *
+extern const gchar *
mix_get_string_from_id(mix_ins_id_t id);
extern mix_ins_id_t
@@ -122,7 +122,7 @@ mix_get_ins_id(mix_opcode_t code, mix_fspec_t fspec);
/*-- MIX instruction type */
typedef struct mix_ins_t mix_ins_t;
-struct mix_ins_t
+struct mix_ins_t
{
mix_address_t address;
mix_index_t index;
@@ -144,7 +144,7 @@ mix_ins_to_word(const mix_ins_t *ins);
extern mix_ins_id_t
mix_word_to_ins(mix_word_t w, mix_ins_t *ins);
-#define mix_word_add_address(word,addr) (word) |= ((addr)<<18)
+#define mix_word_add_address(word,addr) (word) |= ((addr)<<18)
/* decompose an instruction codified in a word into its parts */
#define mix_get_ins_address(word) ((mix_address_t)((word)>>18))
@@ -179,17 +179,4 @@ extern void
mix_ins_print(const mix_ins_t *ins);
-
-/* A MIX ins has an associated execution time */
-/* Initialise mix_ins data providing an interlock time for I/O devices */
-/* --------------------------------------> MOVE to VM
-typedef guint mix_time_t;
-
-extern void
-mix_init_ins_with_interlock_time(mix_time_t t);
-
-extern mix_time_t
-mix_ins_exec_time(const mix_ins_t *ins);
-*/
-
#endif /* MIX_INS_H */
diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l
index 2b3099b..1ad8eaa 100644
--- a/mixlib/mix_scanner.l
+++ b/mixlib/mix_scanner.l
@@ -434,16 +434,25 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
<FSPEC>{
{number}")"(({ws}+.*\n)|\n) {
glong val = atol (yytext);
- if ( val < 0 || val > MIX_BYTE_MAX )
- RETURN_ERROR (MIX_PERR_INV_FSPEC, NULL);
- if ( ins.opcode != mix_opMOVE
- && ins.opcode != mix_opNOP
- && ( ins.opcode < mix_opJBUS || ins.opcode > mix_opJXx )
- && !mix_fspec_is_valid (mix_byte_new (val)) )
+
+ if (val < 0 || val > MIX_BYTE_MAX)
RETURN_ERROR (MIX_PERR_INV_FSPEC, NULL);
- if ( nof )
- mix_parser_log_error (parser, MIX_PERR_INV_FSPEC,
- lineno, _("ignored"), TRUE);
+
+ if (ins.opcode != mix_opMOVE
+ && ins.opcode != mix_opNOP
+ && ( ins.opcode < mix_opJBUS || ins.opcode > mix_opJXx )
+ && !mix_fspec_is_valid (mix_byte_new (val)) )
+ {
+ gchar *spec = g_strdup_printf ("%d", (int)val);
+ mix_parser_log_error (parser, MIX_PERR_INV_FSPEC, lineno, spec, TRUE);
+ g_free (spec);
+ }
+
+ if (nof)
+ {
+ mix_parser_log_error (parser, MIX_PERR_INV_FSPEC,
+ lineno, _("ignored"), TRUE);
+ }
else
{
ins.fspec = mix_byte_new (val);