summaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--mixlib/mix_ins.h85
-rw-r--r--mixlib/mix_scanner.l27
-rw-r--r--samples/.arch-inventory2
-rw-r--r--samples/isamixinstruction.mixal106
l---------samples/mixasm1
l---------samples/mixvm1
6 files changed, 164 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);
diff --git a/samples/.arch-inventory b/samples/.arch-inventory
index f2cfaf7..c3031ea 100644
--- a/samples/.arch-inventory
+++ b/samples/.arch-inventory
@@ -1,2 +1,4 @@
precious ^(Makefile)$
precious ^(Makefile\.in)$
+junk (\.mix)$
+junk (\.mls)$
diff --git a/samples/isamixinstruction.mixal b/samples/isamixinstruction.mixal
new file mode 100644
index 0000000..0815fab
--- /dev/null
+++ b/samples/isamixinstruction.mixal
@@ -0,0 +1,106 @@
+B EQU 1(4:4)
+BMAX EQU B-1
+UMAX EQU 20
+TABLE NOP GOOD(BMAX)
+ ADD FLOAT(5:5)
+ SUB FLOAT(5:5)
+ MUL FLOAT(5:5)
+ DIV FLOAT(5:5)
+ HLT GOOD
+ SRC GOOD
+ MOVE MEMORY(BMAX)
+ LDA FIELD(5:5)
+ LD1 FIELD(5:5)
+ LD2 FIELD(5:5)
+ LD3 FIELD(5:5)
+ LD4 FIELD(5:5)
+ LD5 FIELD(5:5)
+ LD6 FIELD(5:5)
+ LDX FIELD(5:5)
+ LDAN FIELD(5:5)
+ LD1N FIELD(5:5)
+ LD2N FIELD(5:5)
+ LD3N FIELD(5:5)
+ LD4N FIELD(5:5)
+ LD5N FIELD(5:5)
+ LD6N FIELD(5:5)
+ LDXN FIELD(5:5)
+ STA FIELD(5:5)
+ ST1 FIELD(5:5)
+ ST2 FIELD(5:5)
+ ST3 FIELD(5:5)
+ ST4 FIELD(5:5)
+ ST5 FIELD(5:5)
+ ST6 FIELD(5:5)
+ STX FIELD(5:5)
+ STJ FIELD(5:5)
+ STZ FIELD(5:5)
+ JBUS MEMORY(UMAX)
+ IOC GOOD(UMAX)
+ IN MEMORY(UMAX)
+ OUT MEMORY(UMAX)
+ JRED MEMORY(UMAX)
+ JLE MEMORY
+ JANP MEMORY
+ J1NP MEMORY
+ J2NP MEMORY
+ J3NP MEMORY
+ J4NP MEMORY
+ J5NP MEMORY
+ J6NP MEMORY
+ JXNP MEMORY
+ ENNA GOOD
+ ENN1 GOOD
+ ENN2 GOOD
+ ENN3 GOOD
+ ENN4 GOOD
+ ENN5 GOOD
+ ENN6 GOOD
+ ENNX GOOD
+ CMPA FLOAT(5:5)
+ CMP1 FIELD(5:5)
+ CMP2 FIELD(5:5)
+ CMP3 FIELD(5:5)
+ CMP4 FIELD(5:5)
+ CMP5 FIELD(5:5)
+ CMP6 FIELD(5:5)
+ CMPX FIELD(5:5)
+BEGIN LDA INST
+ CMPA VALID(3:3)
+ JG BAD
+ LD1 INST(5:5)
+ DEC1 64
+ J1NN BAD
+ CMPA TABLE+64,1(4:4)
+ JG BAD
+ LD1 TABLE+64,1(1:2)
+ JMP 0,1
+FLOAT CMPA VALID(4:4)
+ JE GOOD
+FIELD ENTA 0
+ LDX INST(4:4)
+ DIV =9=
+ STX *+1(0:2)
+ INCA 0
+ CMPA =5=
+ JG BAD
+MEMORY LDX INST(3:3)
+ JXNZ GOOD
+ LDX INST(0:2)
+ JXN BAD
+ CMPX =3999=
+ JLE GOOD
+ JMP BAD
+VALID CMPX 3999,6(6)
+*VALID CON 63,3999(0:2),6(3:3),6(4:4) CMPX 3999,6(6)
+*
+*
+*
+INST CON 63,3999(0:2),6(3:3),45(4:4)
+GOOD OUT GTEXT(18)
+ HLT
+BAD OUT BTEXT(18)
+ HLT
+GTEXT ALF GOOD
+BTEXT ALF BAD
+ END BEGIN
diff --git a/samples/mixasm b/samples/mixasm
new file mode 120000
index 0000000..db38217
--- /dev/null
+++ b/samples/mixasm
@@ -0,0 +1 @@
+../mixutils/mixasm \ No newline at end of file
diff --git a/samples/mixvm b/samples/mixvm
new file mode 120000
index 0000000..bdb6e79
--- /dev/null
+++ b/samples/mixvm
@@ -0,0 +1 @@
+../mixutils/mixvm \ No newline at end of file