mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-15 16:06:21 +00:00
Add Commercial Instruction Set.
I haven't done much compatibility testing with MACRO11 to check weirdnesses, but the original functionality is very limied: none of the mnemonics has operands.
This commit is contained in:
parent
fa7ece3864
commit
1d799534bb
3
CHANGES
3
CHANGES
@ -7,6 +7,9 @@
|
||||
number.
|
||||
- Added checks for junk text following correct code. This revealed
|
||||
some small other issues, now fixed.
|
||||
- Added CIS instructions; as an extension, for the Inline variants
|
||||
you can specify the descriptor addresses etc as arguments to
|
||||
the instruction (much like an implied .word).
|
||||
|
||||
25.04.2020: Rhialto
|
||||
version 0.5:
|
||||
|
||||
39
assemble.c
39
assemble.c
@ -1722,6 +1722,45 @@ static int assemble(
|
||||
}
|
||||
return CHECK_EOL;
|
||||
|
||||
{ int nwords;
|
||||
EX_TREE *expr[4];
|
||||
case OC_CIS2:
|
||||
/* Either no operands or 2 (mostly) address operand words
|
||||
* (extension) */
|
||||
nwords = 2;
|
||||
goto cis_common;
|
||||
case OC_CIS3:
|
||||
/* Either no operands or 3 (mostly) address operand words
|
||||
* (extension) */
|
||||
nwords = 3;
|
||||
goto cis_common;
|
||||
case OC_CIS4:
|
||||
/* Either no operands or 4 (mostly) address operand words
|
||||
* (extension) */
|
||||
nwords = 4;
|
||||
cis_common:
|
||||
if (!EOL(*cp)) {
|
||||
for (int i = 0; i < nwords; i++) {
|
||||
if (i > 0)
|
||||
cp = skipdelim(cp);
|
||||
EX_TREE *ex = parse_expr(cp, 0);
|
||||
cp = ex->cp;
|
||||
expr[i] = ex;
|
||||
}
|
||||
} else {
|
||||
expr[0] = NULL;
|
||||
}
|
||||
|
||||
store_word(stack->top, tr, 2, op->value);
|
||||
|
||||
if (expr[0]) {
|
||||
for (int i = 0; i < nwords; i++) {
|
||||
store_value(stack, tr, 2, expr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return CHECK_EOL;
|
||||
|
||||
default:
|
||||
report(stack->top, "Unimplemented instruction format\n");
|
||||
return 0;
|
||||
|
||||
68
symbols.c
68
symbols.c
@ -463,7 +463,73 @@ void add_symbols(
|
||||
add_sym("TSTD", I_TSTD, OC_FPPDST, &instruction_section, &system_st);
|
||||
add_sym("TSTF", I_TSTF, OC_FPPDST, &instruction_section, &system_st);
|
||||
|
||||
/* FIXME: The CIS instructions are missing! */
|
||||
/* The CIS instructions */
|
||||
add_sym("ADDNI", I_ADDN|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("ADDN", I_ADDN, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("ADDPI", I_ADDP|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("ADDP", I_ADDP, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("ASHNI", I_ASHN|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("ASHN", I_ASHN, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("ASHPI", I_ASHP|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("ASHP", I_ASHP, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CMPCI", I_CMPC|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("CMPC", I_CMPC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CMPNI", I_CMPN|I_CIS_I, OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CMPN", I_CMPN, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CMPPI", I_CMPP|I_CIS_I, OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CMPP", I_CMPP, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CVTLNI",I_CVTLN|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CVTLN", I_CVTLN, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CVTLPI",I_CVTLP|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CVTLP", I_CVTPL, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CVTNLI",I_CVTNL|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CVTNL", I_CVTNL, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CVTPLI",I_CVTPL|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CVTPL", I_CVTPL, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CVTNPI",I_CVTNP|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CVTNP", I_CVTNP, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("CVTPNI",I_CVTPN|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("CVTPN", I_CVTPN, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("DIVPI", I_DIVP|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("DIVP", I_DIVP, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("LOCCI", I_LOCC|I_CIS_I, OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("LOCC", I_LOCC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D0", I_L2Dr+0, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D1", I_L2Dr+1, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D2", I_L2Dr+2, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D3", I_L2Dr+3, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D4", I_L2Dr+4, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D5", I_L2Dr+5, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D6", I_L2Dr+6, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L2D7", I_L2Dr+7, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D0", I_L3Dr+0, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D1", I_L3Dr+1, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D2", I_L3Dr+2, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D3", I_L3Dr+3, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D4", I_L3Dr+4, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D5", I_L3Dr+5, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D6", I_L3Dr+6, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("L3D7", I_L3Dr+7, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("MATCI", I_MATC|I_CIS_I, OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("MATC", I_MATC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("MOVCI", I_MOVC|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("MOVC", I_MOVC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("MOVRCI",I_MOVRC|I_CIS_I,OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("MOVRC", I_MOVRC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("MOVTCI",I_MOVTC|I_CIS_I,OC_CIS4, &instruction_section, &system_st);
|
||||
add_sym("MOVTC", I_MOVTC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("MULPI", I_MULP|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("MULP", I_MULP, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("SCANCI",I_SCANC|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("SCANC", I_SCANC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("SKPCI", I_SKPC|I_CIS_I, OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("SKPC", I_SKPC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("SPANCI",I_SPANC|I_CIS_I,OC_CIS2, &instruction_section, &system_st);
|
||||
add_sym("SPANC", I_SPANC, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("SUBNI", I_SUBN|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("SUBN", I_SUBN, OC_NONE, &instruction_section, &system_st);
|
||||
add_sym("SUBPI", I_SUBP|I_CIS_I, OC_CIS3, &instruction_section, &system_st);
|
||||
add_sym("SUBP", I_SUBP, OC_NONE, &instruction_section, &system_st);
|
||||
|
||||
add_sym(current_section->label, 0, 0, current_section, §ion_st);
|
||||
}
|
||||
|
||||
37
symbols.h
37
symbols.h
@ -207,7 +207,36 @@ enum instruction_ops { I_ADC = 0005500,
|
||||
I_XFC = 0076700,
|
||||
I_XOR = 0074000,
|
||||
I_MFPT = 0000007,
|
||||
/* CIS not implemented - maybe later */
|
||||
/* CIS - Commercial Instruction Set */
|
||||
I_CIS_I = 0000100, /* Inline arguments */
|
||||
I_CIS_P = 0000020, /* Packed instead of Numeric */
|
||||
I_ADDN = 0076050,
|
||||
I_ADDP = 0076070,
|
||||
I_ASHN = 0076056,
|
||||
I_ASHP = 0076076,
|
||||
I_CMPC = 0076044,
|
||||
I_CMPN = 0076052,
|
||||
I_CMPP = 0076072,
|
||||
I_CVTLN = 0076057,
|
||||
I_CVTLP = 0076077,
|
||||
I_CVTNL = 0076053,
|
||||
I_CVTPL = 0076073,
|
||||
I_CVTNP = 0076055,
|
||||
I_CVTPN = 0076054,
|
||||
I_DIVP = 0076075,
|
||||
I_LOCC = 0076040,
|
||||
I_L2Dr = 0076020,
|
||||
I_L3Dr = 0076060,
|
||||
I_MATC = 0076045,
|
||||
I_MOVC = 0076030,
|
||||
I_MOVRC= 0076031,
|
||||
I_MOVTC= 0076032,
|
||||
I_MULP = 0076074,
|
||||
I_SCANC= 0076042,
|
||||
I_SKPC = 0076041,
|
||||
I_SPANC= 0076043,
|
||||
I_SUBN = 0076051,
|
||||
I_SUBP = 0076071,
|
||||
/* FPU */
|
||||
I_ABSD = 0170600,
|
||||
I_ABSF = 0170600,
|
||||
@ -287,6 +316,12 @@ enum operand_codes { OC_MASK = 0xff00,
|
||||
/* FPP fp source: immediate or gen */
|
||||
OC_FPPDST = OC_1GEN,
|
||||
/* FPP general destination */
|
||||
OC_CIS2 = 0x0c00,
|
||||
/* CIS with 2 parameter words */
|
||||
OC_CIS3 = 0x0d00,
|
||||
/* CIS with 3 parameter words */
|
||||
OC_CIS4 = 0x0e00,
|
||||
/* CIS with 4 parameter words */
|
||||
OC__LAST = 0xff00
|
||||
};
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ TESTS="test-asciz \
|
||||
test-backpatch \
|
||||
test-blkb \
|
||||
test-bsl-mac-arg \
|
||||
test-cis \
|
||||
test-complex-reloc \
|
||||
test-enabl-ama \
|
||||
test-enabl-lcm \
|
||||
|
||||
92
tests/test-cis.lst.ok
Normal file
92
tests/test-cis.lst.ok
Normal file
@ -0,0 +1,92 @@
|
||||
1 ;;;;;
|
||||
2 ;
|
||||
3 ; Test assembling the CIS instructions (Commercial Instruction Set).
|
||||
4 ;
|
||||
5
|
||||
6 000000 076050 ADDN
|
||||
7 000002 076070 ADDP
|
||||
8 000004 076056 ASHN
|
||||
9 000006 076076 ASHP
|
||||
10 000010 076044 CMPC
|
||||
11 000012 076052 CMPN
|
||||
12 000014 076072 CMPP
|
||||
13 000016 076057 CVTLN
|
||||
14 000020 076073 CVTLP
|
||||
15 000022 076053 CVTNL
|
||||
16 000024 076073 CVTPL
|
||||
17 000026 076055 CVTNP
|
||||
18 000030 076054 CVTPN
|
||||
19 000032 076075 DIVP
|
||||
20 000034 076040 LOCC
|
||||
21 000036 076020 L2D0
|
||||
22 000040 076027 L2D7
|
||||
23 000042 076060 L3D0
|
||||
24 000044 076067 L3D7
|
||||
25 000046 076045 MATC
|
||||
26 000050 076030 MOVC
|
||||
27 000052 076031 MOVRC
|
||||
28 000054 076032 MOVTC
|
||||
29 000056 076074 MULP
|
||||
30 000060 076042 SCANC
|
||||
31 000062 076041 SKPC
|
||||
32 000064 076043 SPANC
|
||||
33 000066 076051 SUBN
|
||||
34 000070 076071 SUBP
|
||||
35
|
||||
36 000072 076150 000352' 000356' ADDNI s1, s2, d1
|
||||
000100 000362'
|
||||
37 000102 076170 000352' 000356' ADDPI s1, s2, d1
|
||||
000110 000362'
|
||||
38 000112 076156 000352' 000362' ASHNI s1, d1, <<'5*256.>!3> ; rounding digit and shift count
|
||||
000120 032403
|
||||
39 000122 076176 000352' 000362' ASHPI s1, d1, <<'5*256.>!3>
|
||||
000130 032403
|
||||
40 000132 076144 000352' 000356' CMPCI s1, s2, 'F ; fill character
|
||||
000140 000106
|
||||
41 000142 076152 000352' 000356' CMPNI s1, s2
|
||||
42 000150 076172 000352' 000356' CMPPI s1, s2
|
||||
43 000156 076157 000352' 000366' CVTLNI s1, l1
|
||||
44 000164 076177 000352' 000366' CVTLPI s1, l1
|
||||
45 000172 076153 000352' 000366' CVTNLI s1, l1
|
||||
46 000200 076173 000352' 000366' CVTPLI s1, l1
|
||||
47 000206 076155 000352' 000362' CVTNPI s1, d1
|
||||
48 000214 076154 000352' 000362' CVTPNI s1, d1
|
||||
49 000222 076175 000352' 000356' DIVPI s1, s2, d1
|
||||
000230 000362'
|
||||
50 000232 076140 000352' 000101 LOCCI s1, 'A
|
||||
51 000240 076145 000352' 000356' MATCI s1, s2
|
||||
52 000246 076130 000352' 000362' MOVCI s1, d1, 'F ; fill character
|
||||
000254 000106
|
||||
53 000256 076131 000352' 000362' MOVRCI s1, d1, 'F ; fill character
|
||||
000264 000106
|
||||
54 000266 076132 000352' 000362' MOVTCI s1, d1, 'F, t1
|
||||
000274 000106 000372'
|
||||
55 000300 076174 000352' 000356' MULPI s1, s2, d1
|
||||
000306 000362'
|
||||
56 000310 076142 000352' 000356' SCANCI s1, s2 ; src and set descriptors
|
||||
57 000316 076141 000352' 000123 SKPCI s1, 'S ; skip character
|
||||
58 000324 076143 000352' 000356' SPANCI s1, s2 ; src and set descriptors
|
||||
59 000332 076151 000352' 000356' SUBNI s1, s2, d1
|
||||
000340 000362'
|
||||
60 000342 076171 000352' 000356' SUBPI s1, s2, d1
|
||||
000350 000362'
|
||||
61
|
||||
62 000352 000001 000002 s1: .word 1, 2 ; string descriptor
|
||||
63 000356 000003 000004 s2: .word 3, 4 ; string descriptor
|
||||
64 000362 000005 000006 d1: .word 5, 6 ; string descriptor
|
||||
65 000366 000007 000010 l1: .word 7, 10 ; long integer
|
||||
66 000372 116 117 120 t1: .ascii /NOPABC/ ; translation table
|
||||
000375 101 102 103
|
||||
66
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
. ******R 001 L1 000366R 001 S2 000356R 001
|
||||
D1 000362R 001 S1 000352R 001 T1 000372R 001
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
000400 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
66
tests/test-cis.mac
Normal file
66
tests/test-cis.mac
Normal file
@ -0,0 +1,66 @@
|
||||
;;;;;
|
||||
;
|
||||
; Test assembling the CIS instructions (Commercial Instruction Set).
|
||||
;
|
||||
|
||||
ADDN
|
||||
ADDP
|
||||
ASHN
|
||||
ASHP
|
||||
CMPC
|
||||
CMPN
|
||||
CMPP
|
||||
CVTLN
|
||||
CVTLP
|
||||
CVTNL
|
||||
CVTPL
|
||||
CVTNP
|
||||
CVTPN
|
||||
DIVP
|
||||
LOCC
|
||||
L2D0
|
||||
L2D7
|
||||
L3D0
|
||||
L3D7
|
||||
MATC
|
||||
MOVC
|
||||
MOVRC
|
||||
MOVTC
|
||||
MULP
|
||||
SCANC
|
||||
SKPC
|
||||
SPANC
|
||||
SUBN
|
||||
SUBP
|
||||
|
||||
ADDNI s1, s2, d1
|
||||
ADDPI s1, s2, d1
|
||||
ASHNI s1, d1, <<'5*256.>!3> ; rounding digit and shift count
|
||||
ASHPI s1, d1, <<'5*256.>!3>
|
||||
CMPCI s1, s2, 'F ; fill character
|
||||
CMPNI s1, s2
|
||||
CMPPI s1, s2
|
||||
CVTLNI s1, l1
|
||||
CVTLPI s1, l1
|
||||
CVTNLI s1, l1
|
||||
CVTPLI s1, l1
|
||||
CVTNPI s1, d1
|
||||
CVTPNI s1, d1
|
||||
DIVPI s1, s2, d1
|
||||
LOCCI s1, 'A
|
||||
MATCI s1, s2
|
||||
MOVCI s1, d1, 'F ; fill character
|
||||
MOVRCI s1, d1, 'F ; fill character
|
||||
MOVTCI s1, d1, 'F, t1
|
||||
MULPI s1, s2, d1
|
||||
SCANCI s1, s2 ; src and set descriptors
|
||||
SKPCI s1, 'S ; skip character
|
||||
SPANCI s1, s2 ; src and set descriptors
|
||||
SUBNI s1, s2, d1
|
||||
SUBPI s1, s2, d1
|
||||
|
||||
s1: .word 1, 2 ; string descriptor
|
||||
s2: .word 3, 4 ; string descriptor
|
||||
d1: .word 5, 6 ; string descriptor
|
||||
l1: .word 7, 10 ; long integer
|
||||
t1: .ascii /NOPABC/ ; translation table
|
||||
Loading…
x
Reference in New Issue
Block a user