aboutsummaryrefslogtreecommitdiffstats
path: root/codesc14xxx.c
blob: 5a5943fbcd75174f25a65bab020a627af18b2fec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
/* codesc14xxx.c */

/*****************************************************************************/
/* AS-Portierung                                                             */
/*                                                                           */
/* Codegenerator SC14xxx                                                     */
/*                                                                           */
/* Historie: 25. 3.1999 Grundsteinlegung                                     */
/*           27. 3.1999 Durch die Befehle durch                              */
/*           19. 4.1999 Argumentbereich B_BR korrigiert                      */
/*           20. 4.1999 Argumentbereich B_RST korrigiert                     */
/*                                                                           */
/*****************************************************************************/

#include "stdinc.h"
#include <string.h>

#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "codepseudo.h"
#include "headids.h"
#include "asmitree.h"

/*---------------------------------------------------------------------------*/

#define M_14400 (1 << 0)
#define M_14401 (1 << 1)
#define M_14402 (1 << 2)
#define M_14404 (1 << 3)
#define M_14405 (1 << 4)
#define M_14420 (1 << 5)
#define M_14421 (1 << 6)
#define M_14422 (1 << 7)
#define M_14424 (1 << 8)

#define FixedOrderCnt 155

typedef struct
        {
          Word CPUMask;
          Byte Code, MinArg, MaxArg;
        } FixedOrder;

static CPUVar CPU14400, CPU14401, CPU14402, CPU14404, CPU14405,
              CPU14420, CPU14421, CPU14422, CPU14424;
static PInstTable InstTable;
static FixedOrder *FixedOrders;
static Word CurrMask;

/*---------------------------------------------------------------------------*/

	static void DecodeFixed(Word Index)
BEGIN
   FixedOrder *POp = FixedOrders + Index;
   Boolean OK;
   Byte Value;

   if ((ArgCnt > 1) OR ((ArgCnt == 0) AND (POp->MinArg != POp->MaxArg))) WrError(1110);
   else if ((POp->CPUMask & CurrMask) == 0) WrError(1500);
   else
    BEGIN
     OK = True;
     if (ArgCnt == 0) Value = 0;
     else
      BEGIN
       FirstPassUnknown = False;
       Value = EvalIntExpression(ArgStr[1], Int8, &OK);
       if (FirstPassUnknown) Value = POp->MinArg;
       if (OK) OK = ChkRange(Value, POp->MinArg, POp->MaxArg);
      END
     if (OK)
      BEGIN
       WAsmCode[0] = (((Word) POp->Code) << 8) + (Value & 0xff);
       CodeLen = 1;
      END
    END
END

/*---------------------------------------------------------------------------*/

static Boolean Toggle;

	static void PutByte(Byte Val)
BEGIN
   if (Toggle) WAsmCode[CodeLen++] |= ((Word) Val) << 8;
   else WAsmCode[CodeLen] = Val & 0xff;
   Toggle = NOT Toggle;
END

	static Boolean DecodePseudo(void)
BEGIN
   int z;
   Boolean OK;
   TempResult t;
   char *p;

   if ((Memo("DC")) OR (Memo("DC8")))
    BEGIN
     if (ArgCnt == 0) WrError(1110);
     else
      BEGIN
       z = 1; OK = TRUE; Toggle = FALSE;
       while ((OK) AND (z <= ArgCnt))
        BEGIN
         FirstPassUnknown = False;
         EvalExpression(ArgStr[z], &t);
         switch (t.Typ)
          BEGIN
           case TempInt:
            if (FirstPassUnknown) t.Contents.Int &= 127;
            if (ChkRange(t.Contents.Int, -128, 255)) PutByte(t.Contents.Int);
            break;
           case TempString:
            for (p = t.Contents.Ascii; *p != '\0'; p++)
             PutByte(CharTransTable[((usint) *p) & 0xff]);
            break;
           case TempFloat:
            WrError(1135);
           default:
            OK = False;
          END
         z++;
        END
       if (NOT OK) CodeLen = 0;
       else if (Toggle) CodeLen++;
      END
     return True;
    END

   if ((Memo("DW")) OR (Memo("DW16")))
    BEGIN
     if (ArgCnt == 0) WrError(1110);
     else  
      BEGIN
       z = 1; OK = TRUE;
       while ((OK) AND (z <= ArgCnt))
        BEGIN
         WAsmCode[z - 1] = EvalIntExpression(ArgStr[z], Int16, &OK);
         z++;
        END
       if (OK) CodeLen = ArgCnt;
      END
     return True;
    END

   if ((Memo("DS8")) OR (Memo("DS")))
    BEGIN
     if (ArgCnt != 1) WrError(1110);
     else
      BEGIN
       FirstPassUnknown = False;
       z = EvalIntExpression(ArgStr[1], UInt16, &OK);
       if (OK)
        if (FirstPassUnknown) WrError(1820);
        else
         BEGIN
          CodeLen = (z + 1) >> 1;
          DontPrint = True;
          BookKeeping();
         END
      END
     return True;
    END

   if (Memo("DS16"))
    BEGIN
     if (ArgCnt != 1) WrError(1110);
     else
      BEGIN
       FirstPassUnknown = False;
       z = EvalIntExpression(ArgStr[1], UInt16, &OK);
       if (OK)
        if (FirstPassUnknown) WrError(1820);
        else
         BEGIN
          CodeLen = z;
          DontPrint = True;
          BookKeeping();
         END
      END
     return True;
    END

   return False;
END

/*---------------------------------------------------------------------------*/

static int InstrZ;

	static void AddFixed(char *NName, Byte NCode, Word NMask,
                             Byte NMin, Byte NMax)
BEGIN
   if (InstrZ >= FixedOrderCnt) exit(255);
   FixedOrders[InstrZ].CPUMask = NMask;
   FixedOrders[InstrZ].Code = NCode;
   FixedOrders[InstrZ].MinArg = NMin;
   FixedOrders[InstrZ].MaxArg = NMax;
   AddInstTable(InstTable, NName, InstrZ++, DecodeFixed);
END

	static void InitFields(void)
BEGIN
   InstTable = CreateInstTable(301);

   FixedOrders = (FixedOrder*) malloc(sizeof(FixedOrder) * FixedOrderCnt);
   InstrZ = 0;

   /* standard set */

   AddFixed("BR"       , 0x01, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x01, 0xff);
   AddFixed("BRK"      , 0x6e,                     M_14402 | M_14404 | M_14405                     | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("JMP"      , 0x02, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x01, 0xff);
   AddFixed("JMP1"     , 0x03, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x01, 0xff);
   AddFixed("RTN"      , 0x04, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("WNT"      , 0x08, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x01, 0xff);
   AddFixed("WT"       , 0x09, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x01, 0xff);
   AddFixed("WSC"      , 0x48,                               M_14404 | M_14405           | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("RFEN"     , 0x0b, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("RFDIS"    , 0x0a, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("BK_A"     , 0x0e, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("BK_A1"    , 0x05,                               M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("BK_C"     , 0x0f, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("SLOTZERO" , 0x0d, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("EN_SL_ADJ", 0x2c, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("WNTP1"    , 0x07, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("WNTM1"    , 0x06, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("LD_PTR"   , 0x0c,                     M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("UNLCK"    , 0x28, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RX"     , 0x49,                               M_14404 | M_14405                     | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("A_TX"     , 0x4a,                               M_14404 | M_14405                     | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("A_MUTE"   , 0xc1, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_MTOFF"  , 0xc9,                               M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_MUTE1"  , 0xca,                                                   M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_MTOFF1" , 0xcb,                                                   M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_STOFF"  , 0xc2, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_STON"   , 0xcc,                     M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV0"   , 0x80, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV36"  , 0x82, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV30"  , 0x83, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV24"  , 0x84, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV18"  , 0x85, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV12"  , 0x86, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV6"   , 0x87, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV33"  , 0x8a, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV27"  , 0x8b, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV21"  , 0x8c, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV15"  , 0x8d, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV9"   , 0x8e, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RCV3"   , 0x8f, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_NORM"   , 0xc5, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_RST"    , 0xc0, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_LDR"    , 0xc6, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("A_LDW"    , 0xc7, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("A_RST1"   , 0xeb,                                                   M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("A_LDR1"   , 0xce,                               M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("A_LDW1"   , 0xcf,                               M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("A_ST18"   , 0xe1,                     M_14402                                                            , 0x00, 0x00);
   AddFixed("B_ST"     , 0x31, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_ST2"    , 0x21,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_PPT"    , 0x22,                               M_14404 | M_14405                               | M_14424, 0x00, 0x00);
   AddFixed("B_ZT"     , 0x22, M_14400                                                                                , 0x00, 0x00);
   AddFixed("B_ZR"     , 0x2a, M_14400                                                                                , 0x00, 0x00);
   AddFixed("B_AT"     , 0x32, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_AT2"    , 0x37,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BT"     , 0x34, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BTFM"   , 0x23,                               M_14404 | M_14405                               | M_14424, 0x00, 0xff);
   AddFixed("B_BTFU"   , 0x25,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BTFP"   , 0x35,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BTDU"   , 0x71,                               M_14404 | M_14405                               | M_14424, 0x00, 0xff);
   AddFixed("B_BTDP"   , 0x72,                               M_14404 | M_14405                               | M_14424, 0x00, 0xff);
   AddFixed("B_XON"    , 0x27, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_XOFF"   , 0x26, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_SR"     , 0x29, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_AR"     , 0x3a, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_AR2"    , 0x3f,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_RON"    , 0x2f, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_RINV"   , 0x2e, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_BR"     , 0x3c, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BRFU"   , 0x2d,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BRFP"   , 0x3d,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BRFD"   , 0x2a,                               M_14404 | M_14405                               | M_14424, 0x00, 0xff);
   AddFixed("B_BRDU"   , 0x79,                               M_14404 | M_14405                               | M_14424, 0x00, 0xff);
   AddFixed("B_BRDP"   , 0x7a,                               M_14404 | M_14405                               | M_14424, 0x00, 0xff);
   AddFixed("B_XR"     , 0x2b, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_XT"     , 0x24, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_WB_ON"  , 0x65,                     M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_WB_OFF" , 0x64,                     M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_WRS"    , 0x39, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_RC"     , 0x33, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_RST"    , 0x20, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("B_DIV1"   , 0x4f,                                         M_14405                                        , 0x00, 0x00);
   AddFixed("B_DIV2"   , 0x4e,                                         M_14405                                        , 0x00, 0x00);
   AddFixed("B_DIV4"   , 0x4d,                                         M_14405                                        , 0x00, 0x00);
   AddFixed("C_LD"     , 0xfa,           M_14401 | M_14402                     | M_14420 | M_14421 | M_14422          , 0x00, 0xff);
   AddFixed("C_ON"     , 0xee,                                                   M_14420 | M_14421 | M_14422          , 0x00, 0x00);
   AddFixed("C_OFF"    , 0xef,                                                   M_14420 | M_14421 | M_14422          , 0x00, 0x00);
   AddFixed("C_LD2"    , 0xba,                                                                                 M_14424, 0x00, 0xff);
   AddFixed("C_ON2"    , 0xae,                                                                                 M_14424, 0x00, 0x00);
   AddFixed("C_OFF2"   , 0xaf,                                                                                 M_14424, 0x00, 0x00);
   AddFixed("D_LDK"    , 0x50, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("D_PREP"   , 0x44, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("D_WRS"    , 0x5f, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("D_LDS"    , 0x57, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("D_RST"    , 0x40, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("M_WR"     , 0xb9, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("M_RST"    , 0xa9, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("M_INI0"   , 0xa0,                               M_14404 | M_14405                               | M_14424, 0x00, 0x00);
   AddFixed("M_INI1"   , 0xa1,                               M_14404 | M_14405                               | M_14424, 0x00, 0x00);
   AddFixed("MEN1N"    , 0xa4, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("MEN1"     , 0xa5, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("P_EN"     , 0xe9,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("P_LDH"    , 0xed,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("P_LDL"    , 0xec,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("P_LD"     , 0xe8,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("P_SC"     , 0xea,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("U_INT0"   , 0x61, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("U_INT1"   , 0x6b, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("U_INT2"   , 0x6d, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("U_INT3"   , 0x6f, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("U_PSC"    , 0x60, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
   AddFixed("U_VINT"   , 0x63,                               M_14404 | M_14405                     | M_14422 | M_14424, 0x00, 0xff);

   /* obsolete stuff - argument range may be incorrect */

   AddFixed("D_ON"     , 0x42, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("D_OFF"    , 0x43, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("RCK_INT"  , 0x62,                                                   M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("CLK1"     , 0x66,                                                   M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("CLK3"     , 0x67,                                                   M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("U_CK8"    , 0x68, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("U_CK4"    , 0x69, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("U_CK2"    , 0x6a, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("U_CK1"    , 0x6c, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("MEN3N"    , 0xa2, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("MEN3"     , 0xa3, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("MEN2N"    , 0xa6, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("MEN2"     , 0xa7, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("M_RD"     , 0xa8, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0xff);
   AddFixed("M_WRS"    , 0xb8, M_14400                                         | M_14420 | M_14421                    , 0x00, 0xff);
   AddFixed("A_ALAW"   , 0xc3, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00); 
   AddFixed("A_DT"     , 0xc4, M_14400 | M_14401                               | M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("A_LIN"    , 0xc8,                                                   M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("A_DT1"    , 0xcd,                                                   M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("A_STRN"   , 0xe0,                                                   M_14420 | M_14421                    , 0x00, 0x00);
   AddFixed("RCK_EXT"  , 0x63,                                                   M_14420 | M_14421                    , 0x00, 0xff);
   AddFixed("P_SPD0"   , 0xe8, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD1"   , 0xe9, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD2"   , 0xea, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD3"   , 0xeb, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD4"   , 0xec, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD5"   , 0xed, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD6"   , 0xee, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_SPD7"   , 0xef, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD0"   , 0xe0, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD1"   , 0xe1, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD2"   , 0xe2, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD3"   , 0xe3, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD4"   , 0xe4, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD5"   , 0xe5, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD6"   , 0xe6, M_14400                                                                                , 0x00, 0xff);
   AddFixed("P_RPD7"   , 0xe7, M_14400                                                                                , 0x00, 0xff);

   /* aliases */

   AddFixed("B_TX"     , 0x31, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BT2"    , 0x25,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BR2"    , 0x2d,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BTP"    , 0x35,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_BRP"    , 0x3d,           M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0xff);
   AddFixed("B_ON"     , 0x27, M_14400 | M_14401 | M_14402 | M_14404 | M_14405 | M_14420 | M_14421 | M_14422 | M_14424, 0x00, 0x00);
END

	static void DeinitFields(void)
BEGIN
   DestroyInstTable(InstTable);
   free(FixedOrders);
END

/*---------------------------------------------------------------------------*/

	static void MakeCode_sc14xxx(void)
BEGIN
   /* Leeranweisung ignorieren */

   if (Memo("")) return;

   /* Pseudoanweisungen */

   if (DecodePseudo()) return;

   if (NOT LookupInstTable(InstTable,OpPart))
     WrXError(1200, OpPart);
END

	static Boolean IsDef_sc14xxx(void)
BEGIN
   return FALSE;
END

	static void SwitchFrom_sc14xxx(void)
BEGIN
   DeinitFields();
END

	static void SwitchTo_sc14xxx(void)
BEGIN
   PFamilyDescr FoundDescr;

   FoundDescr = FindFamilyByName("SC14XXX");

   TurnWords = False; ConstMode = ConstModeC; SetIsOccupied = False;
   PCSymbol = "$"; HeaderID = FoundDescr->Id; NOPCode = 0x0000;
   DivideChars = ","; HasAttrs = False;

   ValidSegs = (1<<SegCode);
   Grans[SegCode] = 2; ListGrans[SegCode] = 2; SegInits[SegCode] = 1;
   SegLimits[SegCode] = 0xff;

   MakeCode=MakeCode_sc14xxx; IsDef = IsDef_sc14xxx;
   SwitchFrom = SwitchFrom_sc14xxx;

   InitFields();
   CurrMask = 1 << (MomCPU - CPU14400);
END

/*---------------------------------------------------------------------------*/

	void codesc14xxx_init(void)
BEGIN
   CPU14400 = AddCPU("SC14400", SwitchTo_sc14xxx);
   CPU14401 = AddCPU("SC14401", SwitchTo_sc14xxx);
   CPU14402 = AddCPU("SC14402", SwitchTo_sc14xxx);
   CPU14404 = AddCPU("SC14404", SwitchTo_sc14xxx);
   CPU14405 = AddCPU("SC14405", SwitchTo_sc14xxx);
   CPU14420 = AddCPU("SC14420", SwitchTo_sc14xxx);
   CPU14421 = AddCPU("SC14421", SwitchTo_sc14xxx);
   CPU14422 = AddCPU("SC14422", SwitchTo_sc14xxx);
   CPU14424 = AddCPU("SC14424", SwitchTo_sc14xxx);
END