/* A Bison parser, made by GNU Bison 2.1. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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, 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. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { REGISTER = 258, KOC_BDEF = 259, KOC_ELSE = 260, KOC_END = 261, KOC_ENDI = 262, KOC_EQU = 263, KOC_IF = 264, KOC_INCLUDE = 265, KOC_ORG = 266, KOC_RESM = 267, KOC_SDEF = 268, KOC_SET = 269, KOC_WDEF = 270, KOC_CHSET = 271, KOC_CHDEF = 272, KOC_CHUSE = 273, KOC_opcode = 274, KOC_opcode_i = 275, KOC_relbr = 276, KOC_relbr_x = 277, KOC_SDBD = 278, KOC_ROMW = 279, KOC_PROC = 280, KOC_ENDP = 281, KOC_STRUCT = 282, KOC_ENDS = 283, KOC_MEMATTR = 284, KOC_DDEF = 285, KOC_RPT = 286, KOC_ENDR = 287, KOC_USRERR = 288, KOC_LIST = 289, CONSTANT = 290, EOL = 291, KEOP_AND = 292, KEOP_DEFINED = 293, KEOP_EQ = 294, KEOP_GE = 295, KEOP_GT = 296, KEOP_HIGH = 297, KEOP_LE = 298, KEOP_LOW = 299, KEOP_LT = 300, KEOP_MOD = 301, KEOP_MUN = 302, KEOP_NE = 303, KEOP_NOT = 304, KEOP_OR = 305, KEOP_SHL = 306, KEOP_SHR = 307, KEOP_XOR = 308, KEOP_locctr = 309, KEOP_STRLEN = 310, KEOP_ASC = 311, LABEL = 312, STRING = 313, SYMBOL = 314, FEATURE = 315, KTK_invalid = 316 }; #endif /* Tokens. */ #define REGISTER 258 #define KOC_BDEF 259 #define KOC_ELSE 260 #define KOC_END 261 #define KOC_ENDI 262 #define KOC_EQU 263 #define KOC_IF 264 #define KOC_INCLUDE 265 #define KOC_ORG 266 #define KOC_RESM 267 #define KOC_SDEF 268 #define KOC_SET 269 #define KOC_WDEF 270 #define KOC_CHSET 271 #define KOC_CHDEF 272 #define KOC_CHUSE 273 #define KOC_opcode 274 #define KOC_opcode_i 275 #define KOC_relbr 276 #define KOC_relbr_x 277 #define KOC_SDBD 278 #define KOC_ROMW 279 #define KOC_PROC 280 #define KOC_ENDP 281 #define KOC_STRUCT 282 #define KOC_ENDS 283 #define KOC_MEMATTR 284 #define KOC_DDEF 285 #define KOC_RPT 286 #define KOC_ENDR 287 #define KOC_USRERR 288 #define KOC_LIST 289 #define CONSTANT 290 #define EOL 291 #define KEOP_AND 292 #define KEOP_DEFINED 293 #define KEOP_EQ 294 #define KEOP_GE 295 #define KEOP_GT 296 #define KEOP_HIGH 297 #define KEOP_LE 298 #define KEOP_LOW 299 #define KEOP_LT 300 #define KEOP_MOD 301 #define KEOP_MUN 302 #define KEOP_NE 303 #define KEOP_NOT 304 #define KEOP_OR 305 #define KEOP_SHL 306 #define KEOP_SHR 307 #define KEOP_XOR 308 #define KEOP_locctr 309 #define KEOP_STRLEN 310 #define KEOP_ASC 311 #define LABEL 312 #define STRING 313 #define SYMBOL 314 #define FEATURE 315 #define KTK_invalid 316 /* Copy the first part of user declarations. */ #line 1 "asm/as1600_real.y" /* NOTICE: This code is based on the Public Domain AS2650.Y that comes * with the Frankenstein Assembler, by Mark Zenier. The changes * that I, Joseph Zbiciak, have made are being placed under GPL. * See GPL notice immediately below. */ /* ======================================================================== */ /* 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ======================================================================== */ /* Copyright (c) 1998-1999, Joseph Zbiciak */ /* ======================================================================== */ /* HEADER: ; TITLE: Frankenstein Cross Assemblers; VERSION: 2.0; DESCRIPTION: " Reconfigurable Cross-assembler producing Intel (TM) Hex format object records. "; KEYWORDS: cross-assemblers, 1600, 1805, 2650, 6301, 6502, 6805, 6809, 6811, tms7000, 8048, 8051, 8096, z8, z80; SYSTEM: UNIX, MS-Dos ; FILENAME: as1600.y; WARNINGS: "This software is in the public domain. Any prior copyright claims are relinquished. This software is distributed with no warranty whatever. The author takes no responsibility for the consequences of its use. Yacc (or Bison) required to compile." ; SEE-ALSO: as1600.ps, frasmain.c; AUTHORS: Mark Zenier; Joe Zbiciak COMPILERS: GCC */ /* 1600 instruction generation file, GI standard syntax */ /* September 25, 1999 */ /* description frame work parser description for framework cross assemblers history February 2, 1988 September 11, 1990 - merge table definition September 12, 1990 - short file names September 14, 1990 - short variable names September 17, 1990 - use yylex as external */ /* ======================================================================== *\ The CP-1610 supports the following basic opcode formats: --------------------------------------- ------- -------------------------- Format Words Description --------------------------------------- ------- -------------------------- 0000 000 0oo 1 Implied 1-op insns 0000 000 100 bbppppppii pppppppppp 3 Jump insns 0000 000 1oo 1 Implied 1-op insns 0000 ooo ddd 1 1-op insns, comb src/dst 0000 110 0dd 1 GSWD 0000 110 1om 1 NOP(2), SIN(2) 0001 ooo mrr 1 Rotate/Shift insns 0ooo sss ddd 1 2-op arith, reg->reg 1000 zxc ccc pppppppppp 2 Branch insns 1ooo 000 ddd pppppppppp 2 2-op arith, direct, reg 1ooo mmm ddd 1* 2-op arith, ind., reg 1ooo 111 ddd iiiiiiiiii 2* 2-op arith, immed., reg --------------------------------------- ------- -------------------------- ----- Key ----- oo -- Opcode field (dependent on format) sss -- Source register, R0 ... R7 (binary encoding) ddd -- Destination register, R0 ... R7 (binary encoding) 0dd -- Destination register, R0 ... R3 cccc -- Condition codes (branches) x -- External branch condition (0 == internal, 1 == examine BEXT) z -- Branch displacement direction (1 == negative) m -- Shift amount (0 == shift by 1, 1 == shift by 2) bb -- Branch return register ii -- Branch interrupt flag mode -------------------------------- Branch Condition Codes (cccc) -------------------------------- n == 0 n == 1 n000 -- Always Never n001 -- Carry set/Greater than Carry clear/Less than or equal n010 -- Overflow set Overflow clear n011 -- Positive Negative n100 -- Equal Not equal n101 -- Less than Greater than or equal n110 -- Less than or equal Greater than n111 -- Unequal sign and carry Equal sign and carry ------------------------------- Branch Return Registers (bb) ------------------------------- 00 -- R4 01 -- R5 10 -- R6 11 -- none (do not save return address) ------------------------------- Branch Interrupt Modes (ii) ------------------------------- 00 -- Do not change interrupt enable state 01 -- Enable interrupts 10 -- Disable interrupts 11 -- Undefined/Reserved ? ------------ SDBD notes ------------ -- SDBD is supported on "immediate" and "indirect" modes only. -- An SDBD prefix on an immediate instruction sets the immediate constant to be 16 bits, stored in two adjacent 8-bit words. The ordering is little-endian. -- An SDBD prefix on an indirect instruction causes memory to be accessed twice, bringing in (or out) two 8-bit words, again in little-endian order. If a non-incrementing data counter is used, both accesses are to the same address. Otherwise, the counter is post-incremented with each access. Indirect through R6 (stack addressing) is not allowed, although I suspect it works as expected (performing two accesses through R6). ------------------------ General encoding notes ------------------------ -- "Immediate" mode is encoded the same as "Indirect" mode, except that R7 is given as the indirect register. I'm guessing R7 is implemented the same as R4 and R5, especially since MVOI does what you'd expect -- it (attempts to) write over its immediate operand!!! -- The PC value (in R7) used for arithmetic always points to the first byte after the instruction for purposes of arithmetic. This is consistent with the observation that immediate mode is really indirect mode in disguise, with the instruction being only one word long initially. -- Several instructions are just special cases of other instructions, and therefore do not need special decoder treatment: -- TSTR Rx --> MOVR Rx, Rx -- JR Rx --> MOVR Rx, R7 -- CLRR Rx --> XORR Rx, Rx -- B --> Branch with condition code 0000 ("Always") -- NOPP --> Branch with condition code 1000 ("Never") -- PSHR Rx --> MVO@ Rx, R6 -- PULR Rx --> MVI@ R6, Rx -- "Direct" mode is encoded the same as "Indirect" mode, except 000 (which corresponds to R0) is encoded in the indirect register field. This is why R0 cannot be used as a data counter, and why it has no "special use." -- Relative branches encode their sign bit in the opcode word, rather than relying on a sign-extended relative offset in their second word. This allows +/- 10-bit range in a 10-bit wide memory, or +/- 16-bit range in a 16-bit memory. To avoid redundant encoding, the offset is calculated slightly differently for negative vs. positive offset: -- Negative: address_of_branch + 1 - offset -- Positive: address_of_branch + 2 + offset I'm guessing it is implemented about like so in hardware: -- offset == pc + (offset ^ (sign ? -1 : 0)) --------------- Opcode Spaces --------------- I've divided the CP-1610 opcode map into 12 different opcode spaces. (I really should merge the two separate Implied 1-op spaces into one space. Oh well...) In the descriptions below, "n/i" means "not interruptible". Defined flags: Sign, Zero, Carry, Overflow, Interrupt-enable, Double-byte-data. Interrupt-enable and Double-byte-data are not user visible. -- Implied 1-op instructions, part A: 0000 000 0oo Each has a single, implied operand, if any. opcode mnemonic n/i SZCOID description -- 00 HLT Halts the CPU (until next interrupt?) -- 01 SDBD * 1 Set Double Byte Data -- 10 EIS * 1 Enable Interrupt System -- 11 DIS * 1 Disable Interrupt System -- Implied 1-op instructions, part B: 0000 000 1oo Each has a single, implied operand, if any. opcode mnemonic n/i SZCOID description -- 00 n/a Aliases the "Jump" opcode space -- 01 TCI * Terminate Current Interrupt. -- 10 CLRC * Clear carry flag -- 11 SETC * Set carry flag -- Jump Instructions: 0000 000 100 bbppppppii pppppppppp Unconditional jumps with optional return-address save and interrupt enable/disable. bb ii mnemonic n/i SZCOID description -- 11 00 J Jump. -- xx 00 JSR Jump. Save return address in R4..R6 -- 11 01 JE 1 Jump and enable ints. -- xx 01 JSRE 1 Jump and enable ints. Save ret addr. -- 11 10 JD 0 Jump and disable ints -- xx 10 JSRD 0 Jump and disable ints. Save ret addr. -- xx 11 n/a Invalid opcode. -- Register 1-op instructions 0000 ooo rrr Each has one register operand, encoded as 000 through 111. opcode mnemonic n/i SZCOID description -- 000 n/a Aliases "Implied", "Jump" opcode space -- 001 INCR XX INCrement register -- 010 DECR XX DECrement register -- 011 COMR XX COMplement register (1s complement) -- 100 NEGR XXXX NEGate register (2s complement) -- 101 ADCR XXXX ADd Carry to Register -- 110 n/a Aliases "GSWD", "NOP/SIN" opcode space -- 111 RSWD XXXX Restore Status Word from Register -- Get Status WorD 0000 110 0rr This was given its own opcode space due to limited encoding on its destination register and complication with the NOP/SIN encodings. -- NOP/SIN 0000 110 1om I don't know what the "m" bit is for. I don't know what to do with SIN. opcode mnemonic n/i SZCOID description -- 0 NOP No operation -- 1 SIN Software Interrupt (pulse PCIT pin) ? -- Shift/Rotate 1-op instructions 0001 ooo mrr These can operate only on R0...R3. The "m" bit specifies whether the operation is performed once or twice. The overflow bit is used for catching the second bit on the rotates/shifts that use the carry. opcode mnemonic n/i SZCOID description -- 000 SWAP * XX Swaps bytes in word once or twice. -- 001 SLL * XX Shift Logical Left -- 010 RLC * XXX2 Rotate Left through Carry/overflow -- 011 SLLC * XXX2 Shift Logical Left thru Carry/overflow -- 100 SLR * XX Shift Logical Right -- 101 SAR * XX Shift Arithmetic Right -- 110 RRC * XXX2 Rotate Left through Carry/overflow -- 111 SARC * XXX2 Shift Arithmetic Right thru Carry/over -- Register/Register 2-op instructions 0ooo sss ddd Register to register arithmetic. Second operand acts as src2 and dest. opcode mnemonic n/i SZCOID description -- 00x n/a Aliases other opcode spaces -- 010 MOVR XX Move register to register -- 011 ADDR XXXX Add src1 to src2->dst -- 100 SUBR XXXX Sub src1 from src2->dst -- 101 CMPR XXXX Sub src1 from src2, don't store -- 110 ANDR XX AND src1 with src2->dst -- 111 XORR XX XOR src1 with src2->dst -- Conditional Branch instructions 1000 zxn ccc pppppppppppppppp The "z" bit specifies the direction for the offset. The "x" bit specifies using an external branch condition instead of using flag bits. Conditional brances are interruptible. The "n" bit specifies branching on the opposite condition from 'ccc'. cond n=0 Condition n=1 Condition -- n000 B always NOPP never -- n001 BC C = 1 BNC C = 0 -- n010 BOV O = 1 BNOV O = 0 -- n011 BPL S = 0 BMI S = 1 -- n100 BZE/BEQ Z = 1 BNZE/BNEQ Z = 0 -- n101 BLT/BNGE S^O = 1 BGE/BNLT S^O = 0 -- n110 BLE/BNGT Z|(S^O) = 1 BGT/BNLE Z|(S^O) = 0 -- n111 BUSC S^C = 1 BESC S^C = 0 -- Direct/Register 2-op instructions 1ooo 000 rrr pppppppppppppppp Direct memory to register arithmetic. MVO uses direct address as a destination, all other operations use it as a source, with the register as the destination. opcode mnemonic n/i SZCOID description -- 000 n/a Aliases conditional branch opcodes -- 001 MVO * Move register to direct address -- 010 MVI Move direct address to register -- 011 ADD XXXX Add src1 to src2->dst -- 100 SUB XXXX Sub src1 from src2->dst -- 101 CMP XXXX Sub src1 from src2, don't store -- 110 AND XX AND src1 with src2->dst -- 111 XOR XX XOR src1 with src2->dst -- Indirect/Register 2-op instructions 1ooo sss ddd A source of "000" is actually a Direct/Register opcode. A source of "111" is actually a Immediate/Register opcode. R4, R5 increment after each access. If the D bit is set, two accesses are made through the indirect register, updating the address if R4 or R5. R6 increments after writes, decrements before reads. opcode mnemonic n/i SZCOID description -- 000 n/a Aliases conditional branch opcodes -- 001 MVO@ * Move register to indirect address -- 010 MVI@ Move indirect address to register -- 011 ADD@ XXXX Add src1 to src2->dst -- 100 SUB@ XXXX Sub src1 from src2->dst -- 101 CMP@ XXXX Sub src1 from src2, don't store -- 110 AND@ XX AND src1 with src2->dst -- 111 XOR@ XX XOR src1 with src2->dst -- Immediate/Register 2-op instructions 1ooo 111 ddd pppp If DBD is set, the immediate value spans two adjacent bytes, little endian order. Otherwise the immediate value spans one word. This instruction really looks like indirect through R7, and I suspect that's how the silicon implements it. opcode mnemonic n/i SZCOID description -- 000 n/a Aliases conditional branch opcodes -- 001 MVOI * Move register to immediate field! -- 010 MVII Move immediate field to register -- 011 ADDI XXXX Add src1 to src2->dst -- 100 SUBI XXXX Sub src1 from src2->dst -- 101 CMPI XXXX Sub src1 from src2, don't store -- 110 ANDI XX AND src1 with src2->dst -- 111 XORI XX XOR src1 with src2->dst \* ======================================================================== */ #include #include #include "config.h" #include "file/file.h" #include "asm/frasmdat.h" #include "asm/fragcon.h" #include "asm/protos.h" #define yylex lexintercept #define JSR_RG 0x0001 #define SHF_RG 0x0002 #define IND_RG 0x0004 #define SDBD 0x0008 #define ST_REGREG 0x0001 #define ST_REGEXP 0x0002 #define ST_EXPREG 0x0004 #define ST_REGCEX 0x0008 #define ST_CEXREG 0x0010 #define ST_REG 0x0020 #define ST_EXP 0x0040 #define ST_IMP 0x0080 #define ST_EXPEXP 0x0100 /* ======================================================================== */ /* R0 .. R7 can be used as general-purpose registers. */ /* R0 .. R3 can be used for shifts and GSWD. */ /* R1 .. R6 can be used for indirect addressing. */ /* R4 .. R6 can be used for JSR. */ /* ======================================================================== */ static int reg_type[8] = { SHF_RG, SHF_RG | IND_RG, SHF_RG | IND_RG, SHF_RG | IND_RG, JSR_RG | IND_RG, JSR_RG | IND_RG, JSR_RG | IND_RG, 0 }; /* ======================================================================== */ /* BDEF outputs a number as a ROMW width word directly. Allowed width is */ /* determined by argument #2 to the expression. */ /* WDEF outputs a 16-bit word as a Double Byte Data. */ /* ======================================================================== */ static char genbdef[] = "[1=].[2#]I$[1=]x"; static char genwdef[] = "[1=].10I$[1=].FF&x[1=].8}.FF&x"; /*static char gensdbd[] = "0001x";*/ char ignosyn[] = "[Xinvalid syntax for instruction"; char ignosel[] = "[Xinvalid operands"; long labelloc; static int satsub; int ifstkpt = 0; int fraifskip = FALSE, frarptskip = FALSE; int frarptact = FALSE, frarptcnt = -1; int struct_locctr = -1; extern char *proc; extern int proc_len; static char currmode[32] = ""; static int sdbd = 0, is_sdbd = 0; static int romw = 16; static unsigned romm = 0xFFFF; static int first = 1; static int fwd_sdbd = 0; struct symel * endsymbol = SYMNULL; #define SDBD_CHK \ if (sdbd) { sdbd = 0; frawarn("SDBD not allowed with this instruction."); } /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #line 439 "asm/as1600_real.y" typedef union YYSTYPE { int intv; long longv; char *strng; struct symel *symb; } YYSTYPE; /* Line 196 of yacc.c. */ #line 653 "asm/as1600.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 219 of yacc.c. */ #line 665 "asm/as1600.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif #if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # else # define YYSTACK_ALLOC alloca # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYINCLUDED_STDLIB_H # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) # endif # ifdef __cplusplus extern "C" { # endif # ifndef YYMALLOC # define YYMALLOC malloc # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ && (defined (__STDC__) || defined (__cplusplus))) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ && (defined (__STDC__) || defined (__cplusplus))) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifdef __cplusplus } # endif # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short int yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 74 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 838 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 72 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 9 /* YYNRULES -- Number of rules. */ #define YYNRULES 94 /* YYNRULES -- Number of states. */ #define YYNSTATES 174 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 316 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 68, 69, 2, 2, 2, 70, 71, 64, 62, 66, 63, 2, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 67, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const unsigned short int yyprhs[] = { 0, 0, 3, 6, 8, 11, 13, 16, 19, 22, 24, 27, 31, 35, 38, 40, 43, 47, 50, 52, 54, 56, 60, 63, 69, 74, 82, 89, 96, 99, 101, 104, 109, 111, 113, 116, 118, 120, 123, 126, 129, 132, 135, 138, 142, 146, 148, 150, 153, 155, 159, 161, 164, 169, 171, 174, 179, 181, 184, 189, 195, 200, 206, 209, 214, 219, 222, 225, 228, 231, 234, 238, 242, 246, 250, 254, 258, 262, 266, 270, 274, 278, 282, 286, 290, 294, 298, 301, 303, 306, 308, 310, 312, 317, 324 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { 73, 0, -1, 73, 74, -1, 74, -1, 75, 36, -1, 36, -1, 1, 36, -1, 77, 6, -1, 33, 58, -1, 6, -1, 10, 58, -1, 77, 8, 80, -1, 77, 14, 80, -1, 31, 80, -1, 32, -1, 34, 58, -1, 77, 34, 58, -1, 9, 80, -1, 9, -1, 5, -1, 7, -1, 77, 11, 80, -1, 11, 80, -1, 77, 11, 80, 66, 80, -1, 11, 80, 66, 80, -1, 77, 11, 80, 66, 80, 66, 58, -1, 11, 80, 66, 80, 66, 58, -1, 29, 80, 66, 80, 66, 58, -1, 77, 16, -1, 18, -1, 18, 80, -1, 17, 58, 66, 79, -1, 77, -1, 76, -1, 77, 78, -1, 78, -1, 57, -1, 57, 67, -1, 4, 79, -1, 30, 79, -1, 13, 79, -1, 15, 79, -1, 12, 80, -1, 79, 66, 80, -1, 79, 66, 58, -1, 80, -1, 58, -1, 77, 25, -1, 26, -1, 77, 27, 80, -1, 28, -1, 24, 80, -1, 24, 80, 66, 80, -1, 23, -1, 21, 80, -1, 22, 80, 66, 80, -1, 19, -1, 19, 80, -1, 19, 3, 66, 80, -1, 19, 3, 66, 68, 80, -1, 19, 80, 66, 3, -1, 19, 68, 80, 66, 3, -1, 19, 3, -1, 19, 3, 66, 3, -1, 20, 3, 66, 3, -1, 62, 80, -1, 63, 80, -1, 49, 80, -1, 42, 80, -1, 44, 80, -1, 80, 64, 80, -1, 80, 65, 80, -1, 80, 62, 80, -1, 80, 63, 80, -1, 80, 46, 80, -1, 80, 51, 80, -1, 80, 52, 80, -1, 80, 41, 80, -1, 80, 40, 80, -1, 80, 45, 80, -1, 80, 43, 80, -1, 80, 48, 80, -1, 80, 39, 80, -1, 80, 37, 80, -1, 80, 50, 80, -1, 80, 53, 80, -1, 38, 59, -1, 59, -1, 38, 60, -1, 60, -1, 69, -1, 35, -1, 55, 70, 58, 71, -1, 56, 70, 58, 66, 80, 71, -1, 70, 80, 71, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { 0, 526, 526, 527, 530, 534, 535, 542, 547, 551, 555, 579, 600, 622, 644, 653, 665, 685, 717, 738, 756, 775, 798, 814, 838, 855, 884, 905, 924, 940, 945, 970, 1037, 1049, 1052, 1073, 1084, 1085, 1087, 1098, 1110, 1121, 1130, 1147, 1152, 1165, 1171, 1204, 1223, 1236, 1265, 1280, 1305, 1342, 1356, 1372, 1397, 1408, 1421, 1436, 1451, 1466, 1501, 1513, 1526, 1539, 1543, 1547, 1551, 1555, 1559, 1563, 1567, 1571, 1575, 1579, 1583, 1587, 1591, 1595, 1599, 1603, 1607, 1611, 1615, 1619, 1623, 1627, 1631, 1635, 1639, 1643, 1647, 1660, 1685 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "REGISTER", "KOC_BDEF", "KOC_ELSE", "KOC_END", "KOC_ENDI", "KOC_EQU", "KOC_IF", "KOC_INCLUDE", "KOC_ORG", "KOC_RESM", "KOC_SDEF", "KOC_SET", "KOC_WDEF", "KOC_CHSET", "KOC_CHDEF", "KOC_CHUSE", "KOC_opcode", "KOC_opcode_i", "KOC_relbr", "KOC_relbr_x", "KOC_SDBD", "KOC_ROMW", "KOC_PROC", "KOC_ENDP", "KOC_STRUCT", "KOC_ENDS", "KOC_MEMATTR", "KOC_DDEF", "KOC_RPT", "KOC_ENDR", "KOC_USRERR", "KOC_LIST", "CONSTANT", "EOL", "KEOP_AND", "KEOP_DEFINED", "KEOP_EQ", "KEOP_GE", "KEOP_GT", "KEOP_HIGH", "KEOP_LE", "KEOP_LOW", "KEOP_LT", "KEOP_MOD", "KEOP_MUN", "KEOP_NE", "KEOP_NOT", "KEOP_OR", "KEOP_SHL", "KEOP_SHR", "KEOP_XOR", "KEOP_locctr", "KEOP_STRLEN", "KEOP_ASC", "LABEL", "STRING", "SYMBOL", "FEATURE", "KTK_invalid", "'+'", "'-'", "'*'", "'/'", "','", "':'", "'#'", "'$'", "'('", "')'", "$accept", "file", "allline", "line", "labeledline", "labelcolon", "genline", "exprlist", "expr", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const unsigned short int yytoknum[] = { 0, 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, 43, 45, 42, 47, 44, 58, 35, 36, 40, 41 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { 0, 72, 73, 73, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 77, 77, 78, 78, 78, 78, 78, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { 0, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 3, 3, 2, 1, 2, 3, 2, 1, 1, 1, 3, 2, 5, 4, 7, 6, 6, 2, 1, 2, 4, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 1, 1, 2, 1, 3, 1, 2, 4, 1, 2, 4, 1, 2, 4, 5, 4, 5, 2, 4, 4, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 2, 1, 1, 1, 4, 6, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const unsigned char yydefact[] = { 0, 0, 0, 19, 9, 20, 18, 0, 0, 0, 0, 0, 0, 29, 56, 0, 0, 0, 53, 0, 48, 50, 0, 0, 0, 14, 0, 0, 5, 36, 0, 3, 0, 33, 32, 35, 6, 91, 0, 0, 0, 0, 0, 0, 46, 87, 89, 0, 0, 90, 0, 38, 45, 17, 10, 22, 42, 40, 41, 0, 30, 62, 0, 57, 0, 54, 0, 51, 0, 39, 13, 8, 15, 37, 1, 2, 4, 7, 0, 0, 0, 28, 47, 0, 0, 0, 34, 86, 88, 68, 69, 67, 0, 0, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 21, 12, 49, 16, 0, 0, 94, 44, 43, 83, 82, 78, 77, 80, 79, 74, 81, 84, 75, 76, 85, 72, 73, 70, 71, 24, 31, 63, 0, 58, 0, 60, 64, 55, 52, 0, 0, 92, 0, 0, 59, 61, 0, 23, 0, 26, 27, 0, 93, 25 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { -1, 30, 31, 32, 33, 34, 35, 51, 52 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -54 static const short int yypact[] = { 198, -35, 240, -54, -54, -54, 298, -53, 298, 298, 240, 240, -49, 298, 20, 9, 298, 298, -54, 298, -54, -54, 298, 240, 298, -54, -41, -36, -54, -38, 157, -54, -10, -54, 237, -54, -54, -54, -39, 298, 298, 298, -42, -40, -54, -54, -54, 298, 298, -54, 298, -34, 690, 690, -54, 390, 690, -34, -34, -30, 690, -26, 298, 420, -23, 690, 450, 480, 510, -34, 690, -54, -54, -54, -54, -54, -54, -54, 298, 298, 298, -54, -54, 298, -19, -21, -54, -54, -54, 690, 690, 746, -13, -12, -54, -54, 332, 269, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 240, 82, 540, 28, 44, 298, 298, 298, 690, 570, 690, 690, -54, -22, -18, -54, -54, 690, 746, 773, 773, 773, 773, 773, -54, 773, 719, -54, -54, 719, -27, -27, -54, -54, 600, -34, -54, 298, 690, 47, -54, -54, 690, 690, 630, 298, -54, 298, -7, 690, -54, -5, 660, 361, -54, -54, -4, -54, -54 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { -54, -54, 22, -54, -54, 23, 25, 4, -6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const short int yytable[] = { 53, 36, 55, 56, 82, 54, 83, 60, 63, 59, 65, 66, 64, 67, 57, 58, 68, 71, 70, 104, 87, 88, 72, 61, 107, 108, 76, 69, 92, 73, 93, 155, 97, 89, 90, 91, 115, 112, 113, 127, 116, 94, 95, 119, 96, 128, 129, 156, 162, 161, 165, 169, 75, 170, 173, 37, 117, 85, 38, 86, 0, 0, 39, 0, 40, 0, 0, 0, 0, 41, 0, 0, 123, 124, 125, 42, 43, 126, 0, 45, 46, 0, 47, 48, 0, 151, 0, 0, 62, 49, 50, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 153, 0, 0, 0, 157, 158, 159, 37, 0, 150, 38, 0, 0, 0, 39, 0, 40, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 42, 43, 0, 0, 45, 46, 0, 47, 48, 164, 0, 0, 0, 152, 49, 50, 0, 167, 0, 168, 74, 1, 0, 0, 2, 3, 4, 5, 0, 6, 7, 8, 9, 10, 0, 11, 0, 12, 13, 14, 15, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 26, 27, 0, 28, 0, 0, 0, 0, 0, 1, 0, 0, 2, 3, 4, 5, 0, 6, 7, 8, 9, 10, 0, 11, 29, 12, 13, 14, 15, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 26, 27, 0, 28, 0, 0, 0, 0, 0, 0, 2, 0, 77, 0, 78, 0, 0, 79, 9, 10, 80, 11, 81, 0, 29, 14, 15, 16, 17, 18, 19, 82, 20, 83, 21, 0, 23, 0, 0, 0, 84, 0, 0, 0, 37, 0, 0, 38, 0, 0, 0, 39, 0, 40, 0, 0, 0, 0, 41, 0, 0, 0, 0, 29, 42, 43, 0, 44, 45, 46, 0, 47, 48, 37, 0, 0, 38, 0, 49, 50, 39, 0, 40, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 42, 43, 0, 131, 45, 46, 0, 47, 48, 37, 0, 0, 38, 0, 49, 50, 39, 0, 40, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 42, 43, 0, 0, 45, 46, 0, 47, 48, 0, 0, 0, 0, 0, 49, 50, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 98, 0, 99, 100, 101, 130, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 98, 0, 99, 100, 101, 172, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 114, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 118, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 120, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 121, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 122, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 154, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 160, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 163, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 166, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 171, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 106, 107, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 98, 0, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 0, 107, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, 99, 100, 101, 0, 102, 0, 103, 104, 0, 105, 0, 0, 107, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113, -1, -1, -1, 0, -1, 0, -1, 104, 0, -1, 0, 0, 107, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 111, 112, 113 }; static const short int yycheck[] = { 6, 36, 8, 9, 25, 58, 27, 13, 14, 58, 16, 17, 3, 19, 10, 11, 22, 58, 24, 46, 59, 60, 58, 3, 51, 52, 36, 23, 70, 67, 70, 3, 66, 39, 40, 41, 66, 64, 65, 58, 66, 47, 48, 66, 50, 58, 58, 3, 66, 71, 3, 58, 30, 58, 58, 35, 62, 34, 38, 34, -1, -1, 42, -1, 44, -1, -1, -1, -1, 49, -1, -1, 78, 79, 80, 55, 56, 83, -1, 59, 60, -1, 62, 63, -1, 3, -1, -1, 68, 69, 70, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, -1, -1, 120, 121, 122, 35, -1, 115, 38, -1, -1, -1, 42, -1, 44, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, 55, 56, -1, -1, 59, 60, -1, 62, 63, 152, -1, -1, -1, 68, 69, 70, -1, 160, -1, 162, 0, 1, -1, -1, 4, 5, 6, 7, -1, 9, 10, 11, 12, 13, -1, 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, -1, -1, 1, -1, -1, 4, 5, 6, 7, -1, 9, 10, 11, 12, 13, -1, 15, 57, 17, 18, 19, 20, 21, 22, 23, 24, -1, 26, -1, 28, 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, 4, -1, 6, -1, 8, -1, -1, 11, 12, 13, 14, 15, 16, -1, 57, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, -1, -1, -1, 34, -1, -1, -1, 35, -1, -1, 38, -1, -1, -1, 42, -1, 44, -1, -1, -1, -1, 49, -1, -1, -1, -1, 57, 55, 56, -1, 58, 59, 60, -1, 62, 63, 35, -1, -1, 38, -1, 69, 70, 42, -1, 44, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, 55, 56, -1, 58, 59, 60, -1, 62, 63, 35, -1, -1, 38, -1, 69, 70, 42, -1, 44, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, 55, 56, -1, -1, 59, 60, -1, 62, 63, -1, -1, -1, -1, -1, 69, 70, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 37, -1, 39, 40, 41, 71, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 37, -1, 39, 40, 41, 71, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 66, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 37, -1, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, -1, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, -1, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65, 39, 40, 41, -1, 43, -1, 45, 46, -1, 48, -1, -1, 51, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 63, 64, 65 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { 0, 1, 4, 5, 6, 7, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 29, 30, 31, 32, 33, 34, 36, 57, 73, 74, 75, 76, 77, 78, 36, 35, 38, 42, 44, 49, 55, 56, 58, 59, 60, 62, 63, 69, 70, 79, 80, 80, 58, 80, 80, 79, 79, 58, 80, 3, 68, 80, 3, 80, 80, 80, 80, 79, 80, 58, 58, 67, 0, 74, 36, 6, 8, 11, 14, 16, 25, 27, 34, 77, 78, 59, 60, 80, 80, 80, 70, 70, 80, 80, 80, 66, 37, 39, 40, 41, 43, 45, 46, 48, 50, 51, 52, 53, 62, 63, 64, 65, 66, 66, 66, 80, 66, 66, 66, 66, 66, 80, 80, 80, 80, 58, 58, 58, 71, 58, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 79, 3, 68, 80, 66, 3, 3, 80, 80, 80, 66, 71, 66, 66, 80, 3, 66, 80, 80, 58, 58, 66, 71, 58 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (0) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) short int *bottom; short int *top; #endif { YYFPRINTF (stderr, "Stack now"); for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_reduce_print (int yyrule) #else static void yy_reduce_print (yyrule) int yyrule; #endif { int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { size_t yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif #endif /* YYERROR_VERBOSE */ #if YYDEBUG /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) #else static void yysymprint (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif switch (yytype) { default: break; } YYFPRINTF (yyoutput, ")"); } #endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM); # else int yyparse (); # endif #else /* ! YYPARSE_PARAM */ #if defined (__STDC__) || defined (__cplusplus) int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM) # else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; # endif #else /* ! YYPARSE_PARAM */ #if defined (__STDC__) || defined (__cplusplus) int yyparse (void) #else int yyparse () ; #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short int yyssa[YYINITDEPTH]; short int *yyss = yyssa; short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 4: #line 531 "asm/as1600_real.y" { clrexpr(); ;} break; case 6: #line 536 "asm/as1600_real.y" { clrexpr(); yyerrok; ;} break; case 7: #line 543 "asm/as1600_real.y" { endsymbol = (yyvsp[-1].symb); nextreadact = Nra_end; ;} break; case 8: #line 548 "asm/as1600_real.y" { fraerror((yyvsp[0].strng)); ;} break; case 9: #line 552 "asm/as1600_real.y" { nextreadact = Nra_end; ;} break; case 10: #line 556 "asm/as1600_real.y" { if(frarptact) { fraerror("INCLUDE not permitted inside REPEAT"); } else if(nextfstk >= FILESTKDPTH) { fraerror("include file nesting limit exceeded"); } else { infilestk[nextfstk].line = 0; infilestk[nextfstk].fnm = savestring((yyvsp[0].strng),strlen((yyvsp[0].strng))); if( (infilestk[nextfstk].fpt = path_fopen(as1600_search_path,(yyvsp[0].strng),"r")) ==(FILE *)NULL ) { fraerror("cannot open include file"); } else { nextreadact = Nra_new; } } ;} break; case 11: #line 580 "asm/as1600_real.y" { if((yyvsp[-2].symb)->seg == SSG_UNDEF) { pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { (yyvsp[-2].symb)->seg = SSG_EQU; (yyvsp[-2].symb)->value = evalr[0].value; prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror("noncomputable expression for EQU"); } } else { fraerror("cannot change symbol value with EQU"); } ;} break; case 12: #line 601 "asm/as1600_real.y" { if((yyvsp[-2].symb)->seg == SSG_UNDEF || (yyvsp[-2].symb)->seg == SSG_SET) { pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { (yyvsp[-2].symb)->seg = SSG_SET; (yyvsp[-2].symb)->value = evalr[0].value; prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror("noncomputable expression for SET"); } } else { fraerror("cannot change symbol value with SET"); } ;} break; case 13: #line 623 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[0].intv)); if (evalr[0].seg == SSG_ABS) { if (evalr[0].value < 0) { fraerror("REPEAT count must be >= 0"); } else { frarptcnt = evalr[0].value; frarptact = TRUE; if (frarptcnt == 0) frarptskip = TRUE; else frarptskip = FALSE; } } else { fraerror("Constant expression required for REPEAT block"); } ;} break; case 14: #line 645 "asm/as1600_real.y" { if (frarptact == FALSE) { fraerror("ENDR without repeat"); } frarptact = FALSE; frarptskip = FALSE; ;} break; case 15: #line 654 "asm/as1600_real.y" { if (stricmp((yyvsp[0].strng), "ON" )==0) fprintf(intermedf, "N:0\n"); else if (stricmp((yyvsp[0].strng), "OFF" )==0) fprintf(intermedf, "N:2\n"); else if (stricmp((yyvsp[0].strng), "CODE")==0) fprintf(intermedf, "N:1\n"); else if (stricmp((yyvsp[0].strng), "PREV")==0) fprintf(intermedf, "N:3\n"); else { fraerror("LISTING must be followed by \"ON\", \"OFF\" " "or \"CODE\""); } ;} break; case 16: #line 666 "asm/as1600_real.y" { if (stricmp((yyvsp[0].strng), "ON" )==0) fprintf(intermedf, "N:0\n"); else if (stricmp((yyvsp[0].strng), "OFF" )==0) fprintf(intermedf, "N:2\n"); else if (stricmp((yyvsp[0].strng), "CODE")==0) fprintf(intermedf, "N:1\n"); else if (stricmp((yyvsp[0].strng), "PREV")==0) fprintf(intermedf, "N:3\n"); else { fraerror("LISTING must be followed by \"ON\", \"OFF\" " "or \"CODE\""); } if((yyvsp[-2].symb)->seg == SSG_UNDEF) { (yyvsp[-2].symb)->seg = SSG_ABS; (yyvsp[-2].symb)->value = labelloc; } else fraerror( "multiple definition of label"); ;} break; case 17: #line 686 "asm/as1600_real.y" { if((++ifstkpt) < IFSTKDEPTH) { pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { if(evalr[0].value != 0) { elseifstk[ifstkpt] = If_Skip; endifstk[ifstkpt] = If_Active; } else { fraifskip = TRUE; elseifstk[ifstkpt] = If_Active; endifstk[ifstkpt] = If_Active; } } else { fraifskip = TRUE; elseifstk[ifstkpt] = If_Active; endifstk[ifstkpt] = If_Active; } } else { fraerror("IF stack overflow"); } ;} break; case 18: #line 718 "asm/as1600_real.y" { if(fraifskip) { if((++ifstkpt) < IFSTKDEPTH) { elseifstk[ifstkpt] = If_Skip; endifstk[ifstkpt] = If_Skip; } else { fraerror("IF stack overflow"); } } else { yyerror("syntax error"); YYERROR; } ;} break; case 19: #line 739 "asm/as1600_real.y" { switch(elseifstk[ifstkpt]) { case If_Active: fraifskip = FALSE; break; case If_Skip: fraifskip = TRUE; break; case If_Err: fraerror("ELSE with no matching if"); break; } ;} break; case 20: #line 757 "asm/as1600_real.y" { switch(endifstk[ifstkpt]) { case If_Active: fraifskip = FALSE; ifstkpt--; break; case If_Skip: fraifskip = TRUE; ifstkpt--; break; case If_Err: fraerror("ENDI with no matching if"); break; } ;} break; case 21: #line 776 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { locctr = 2 * (labelloc = evalr[0].value); currseg = 0; strcpy(currmode,"+R"); if((yyvsp[-2].symb)->seg == SSG_UNDEF) { (yyvsp[-2].symb)->seg = SSG_ABS; (yyvsp[-2].symb)->value = labelloc; } else fraerror( "multiple definition of label"); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 22: #line 799 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { locctr = 2 * (labelloc = evalr[0].value); currseg = 0; strcpy(currmode,"+R"); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 23: #line 815 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[-2].intv)); pevalexpr(1, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS && evalr[1].seg == SSG_ABS) { locctr = 2 * (labelloc = evalr[0].value); currseg = (evalr[1].value - labelloc); strcpy(currmode, currseg ? "" : "+R"); if((yyvsp[-4].symb)->seg == SSG_UNDEF) { (yyvsp[-4].symb)->seg = SSG_ABS; (yyvsp[-4].symb)->value = labelloc; } else fraerror( "multiple definition of label"); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 24: #line 839 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[-2].intv)); pevalexpr(1, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS && evalr[1].seg == SSG_ABS) { locctr = 2 * (labelloc = evalr[0].value); currseg = (evalr[1].value - labelloc); strcpy(currmode, currseg ? "" : "+R"); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 25: #line 856 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[-4].intv)); pevalexpr(1, (yyvsp[-2].intv)); if(evalr[0].seg == SSG_ABS && evalr[1].seg == SSG_ABS) { char *s = (yyvsp[0].strng); if (strlen(s) > 30) fraerror("Mode string is too long (max 30 chars)\n"); strcpy(currmode, s); locctr = 2 * (labelloc = evalr[0].value); currseg = (evalr[1].value - labelloc); if((yyvsp[-6].symb)->seg == SSG_UNDEF) { (yyvsp[-6].symb)->seg = SSG_ABS; (yyvsp[-6].symb)->value = labelloc; } else fraerror( "multiple definition of label"); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 26: #line 885 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[-4].intv)); pevalexpr(1, (yyvsp[-2].intv)); if(evalr[0].seg == SSG_ABS && evalr[1].seg == SSG_ABS) { char *s = (yyvsp[0].strng); if (strlen(s) > 30) fraerror("Mode string is too long (max 30 chars)\n"); strcpy(currmode, s); locctr = 2 * (labelloc = evalr[0].value); currseg = (evalr[1].value - labelloc); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 27: #line 906 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[-4].intv)); pevalexpr(1, (yyvsp[-2].intv)); if(evalr[0].seg == SSG_ABS && evalr[1].seg == SSG_ABS) { char *s = (yyvsp[0].strng); if (strlen(s) > 30) fraerror("Mode string is too long (max 30 chars)\n"); genmarec(evalr[0].value, evalr[1].value, s); } else { fraerror( "noncomputable expression for MEMATTR"); } ;} break; case 28: #line 925 "asm/as1600_real.y" { if((yyvsp[-1].symb)->seg == SSG_UNDEF) { (yyvsp[-1].symb)->seg = SSG_EQU; if( ((yyvsp[-1].symb)->value = chtcreate()) <= 0) { fraerror("cannot create character translation table"); } prtequvalue("C: 0x%lx\n", (yyvsp[-1].symb)->value); } else { fraerror("multiple definition of label"); } ;} break; case 29: #line 941 "asm/as1600_real.y" { chtcpoint = (int *) NULL; prtequvalue("C: 0x%lx\n", 0L); ;} break; case 30: #line 946 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[0].intv)); if( evalr[0].seg == SSG_ABS) { if( evalr[0].value == 0) { chtcpoint = (int *)NULL; prtequvalue("C: 0x%lx\n", 0L); } else if(evalr[0].value < chtnxalph) { chtcpoint = chtatab[evalr[0].value]; prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror("nonexistent character translation table"); } } else { fraerror("noncomputable expression"); } ;} break; case 31: #line 971 "asm/as1600_real.y" { int findrv, numret, *charaddr; char *sourcestr = (yyvsp[-2].strng), *before; if(chtnpoint != (int *)NULL) { for(satsub = 0; satsub < (yyvsp[0].intv); satsub++) { before = sourcestr; pevalexpr(0, exprlist[satsub]); findrv = chtcfind(chtnpoint, &sourcestr, &charaddr, &numret); if(findrv == CF_END) { fraerror("more expressions than characters"); break; } if(evalr[0].seg == SSG_ABS) { switch(findrv) { case CF_UNDEF: { if(evalr[0].value < 0 || evalr[0].value > 255) { frawarn("character translation " "value truncated"); } *charaddr = evalr[0].value & 0xff; prtequvalue("C: 0x%lx\n", evalr[0].value); } break; case CF_INVALID: case CF_NUMBER: fracherror("invalid character " "to define", before, sourcestr); break; case CF_CHAR: fracherror("character already " "defined", before, sourcestr); break; } } else { fraerror("noncomputable expression"); } } if( *sourcestr != '\0') { fraerror("more characters than expressions"); } } else { fraerror("no CHARSET statement active"); } ;} break; case 32: #line 1038 "asm/as1600_real.y" { if((yyvsp[0].symb)->seg == SSG_UNDEF) { (yyvsp[0].symb)->seg = SSG_ABS; (yyvsp[0].symb)->value = labelloc; prtequvalue("C: 0x%lx\n", labelloc); } else fraerror("multiple definition of label"); ;} break; case 34: #line 1053 "asm/as1600_real.y" { if (sdbd) frawarn("label between SDBD and instruction"); if((yyvsp[-1].symb)->seg == SSG_UNDEF) { (yyvsp[-1].symb)->seg = SSG_ABS; (yyvsp[-1].symb)->value = labelloc; } else fraerror("multiple definition of label"); if (locctr & 1) fraerror("internal error: PC misaligned."); labelloc = locctr >> 1; sdbd = is_sdbd; is_sdbd = 0; first = 0; ;} break; case 35: #line 1074 "asm/as1600_real.y" { if (locctr & 1) fraerror("internal error: PC misaligned."); labelloc = locctr >> 1; sdbd = is_sdbd; is_sdbd = 0; first = 0; ;} break; case 38: #line 1088 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_DATA, currmode); evalr[2].seg = SSG_ABS; evalr[2].value = 8; for( satsub = 0; satsub < (yyvsp[0].intv); satsub++) { pevalexpr(1, exprlist[satsub]); locctr += geninstr(genbdef); } ;} break; case 39: #line 1099 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_DATA, currmode); evalr[2].seg = SSG_ABS; evalr[2].value = romw; for( satsub = 0; satsub < (yyvsp[0].intv); satsub++) { pevalexpr(1, exprlist[satsub]); locctr += geninstr(genbdef); } ;} break; case 40: #line 1111 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_STRING, currmode); evalr[2].seg = SSG_ABS; evalr[2].value = romw; for( satsub = 0; satsub < (yyvsp[0].intv); satsub++) { pevalexpr(1, exprlist[satsub]); locctr += geninstr(genbdef); } ;} break; case 41: #line 1122 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_DBDATA|TYPE_DATA, currmode); for( satsub = 0; satsub < (yyvsp[0].intv); satsub++) { pevalexpr(1, exprlist[satsub]); locctr += geninstr(genwdef); } ;} break; case 42: #line 1131 "asm/as1600_real.y" { pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { locctr = 2 * (labelloc + evalr[0].value); prtequvalue("C: 0x%lx\n", labelloc); genlocrec(currseg, labelloc, TYPE_HOLE, currmode); genrsrv(labelloc + evalr[0].value); } else { fraerror("noncomputable result for RMB expression"); } ;} break; case 43: #line 1148 "asm/as1600_real.y" { exprlist[nextexprs++] = (yyvsp[0].intv); (yyval.intv) = nextexprs; ;} break; case 44: #line 1153 "asm/as1600_real.y" { char *s = (yyvsp[0].strng); long accval = 0; while (*s) { accval = chtran(&s); exprlist[nextexprs++] = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,accval,SYMNULL); } (yyval.intv) = nextexprs; ;} break; case 45: #line 1166 "asm/as1600_real.y" { nextexprs = 0; exprlist[nextexprs++] = (yyvsp[0].intv); (yyval.intv) = nextexprs; ;} break; case 46: #line 1172 "asm/as1600_real.y" { char *s = (yyvsp[0].strng); long accval = 0; while (*s) { accval = chtran(&s); exprlist[nextexprs++] = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,accval,SYMNULL); } (yyval.intv) = nextexprs; ;} break; case 47: #line 1205 "asm/as1600_real.y" { if (proc) fraerror("Nested procedures/structures are not allowed."); proc = strdup((yyvsp[-1].symb)->symstr); proc_len = strlen(proc); if((yyvsp[-1].symb)->seg == SSG_UNDEF) { (yyvsp[-1].symb)->seg = SSG_ABS; (yyvsp[-1].symb)->value = labelloc; prtequvalue("C: 0x%lx\n", labelloc); } else fraerror("multiple definition of label"); ;} break; case 48: #line 1224 "asm/as1600_real.y" { if (!proc || struct_locctr != -1) fraerror("ENDP w/out PROC."); free(proc); proc = NULL; proc_len = 0; ;} break; case 49: #line 1237 "asm/as1600_real.y" { if (proc) fraerror("Nested procedures/structures are not allowed."); proc = strdup((yyvsp[-2].symb)->symstr); proc_len = strlen(proc); struct_locctr = locctr; pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { locctr = 2 * (labelloc = evalr[0].value); if((yyvsp[-2].symb)->seg == SSG_UNDEF) { (yyvsp[-2].symb)->seg = SSG_ABS; (yyvsp[-2].symb)->value = labelloc; } else fraerror( "multiple definition of label"); prtequvalue("C: 0x%lx\n", evalr[0].value); } else { fraerror( "noncomputable expression for ORG"); } ;} break; case 50: #line 1266 "asm/as1600_real.y" { if (!proc || struct_locctr == -1) fraerror("ENDS w/out STRUCT."); free(proc); proc = NULL; proc_len = 0; locctr = struct_locctr; struct_locctr = -1; ;} break; case 51: #line 1281 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_HOLE, currmode); pevalexpr(0, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { romw = evalr[0].value; if (romw < 8 || romw > 16) fraerror("ROMWIDTH out of range"); romm = 0xFFFFU >> (16 - romw); } else { fraerror("noncomputable expression for ROMWIDTH"); } if (!first) { frawarn("Code appears before ROMW directive."); } fwd_sdbd = 0; ;} break; case 52: #line 1306 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_HOLE, currmode); pevalexpr(0, (yyvsp[-2].intv)); pevalexpr(1, (yyvsp[0].intv)); if(evalr[0].seg == SSG_ABS) { romw = evalr[0].value; if (romw < 8 || romw > 16) fraerror("ROMWIDTH out of range"); romm = 0xFFFFU >> (16 - romw); } else fraerror("noncomputable expression for ROMWIDTH"); if (!first) { frawarn("Code appears before ROMW directive."); } if (evalr[1].seg == SSG_ABS) { fwd_sdbd = evalr[1].value; if (fwd_sdbd > 1 || fwd_sdbd < 0) fraerror("SDBD mode flag must be 0 or 1."); } else fraerror("noncomputable expression for ROMWIDTH"); ;} break; case 53: #line 1343 "asm/as1600_real.y" { if (sdbd) frawarn("Two SDBDs in a row."); genlocrec(currseg, labelloc, TYPE_CODE, currmode); locctr += geninstr(findgen((yyvsp[0].intv), ST_IMP, 0)); is_sdbd = SDBD; ;} break; case 54: #line 1357 "asm/as1600_real.y" { /*unsigned rel_addr = labelloc + 2;*/ /*int dir;*/ SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); pevalexpr(1, (yyvsp[0].intv)); evalr[3].seg = SSG_ABS; evalr[3].value = romw; locctr += geninstr(findgen((yyvsp[-1].intv), ST_EXP, sdbd)); ;} break; case 55: #line 1373 "asm/as1600_real.y" { /*unsigned rel_addr = labelloc + 2;*/ /*int dir;*/ SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); pevalexpr(1, (yyvsp[-2].intv)); pevalexpr(4, (yyvsp[0].intv)); if (evalr[4].seg != SSG_ABS) fraerror("Must have constant expr for BEXT condition"); evalr[3].seg = SSG_ABS; evalr[3].value = romw; locctr += geninstr(findgen((yyvsp[-3].intv), ST_EXPEXP, sdbd)); ;} break; case 56: #line 1398 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); locctr += geninstr(findgen((yyvsp[0].intv), ST_IMP, sdbd)); ;} break; case 57: #line 1409 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); pevalexpr(1, (yyvsp[0].intv)); locctr += geninstr(findgen((yyvsp[-1].intv), ST_EXP, sdbd)); ;} break; case 58: #line 1422 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); evalr[1].value = (yyvsp[-2].intv); pevalexpr(2, (yyvsp[0].intv)); evalr[3].seg = SSG_ABS; evalr[3].value = romw; locctr += geninstr(findgen((yyvsp[-3].intv), ST_REGEXP, reg_type[(yyvsp[-2].intv)]|sdbd)); ;} break; case 59: #line 1437 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); evalr[1].value = (yyvsp[-3].intv); evalr[3].seg = SSG_ABS; evalr[3].value = romw; pevalexpr(2, (yyvsp[0].intv)); locctr += geninstr(findgen((yyvsp[-4].intv), ST_REGCEX, reg_type[(yyvsp[-3].intv)]|sdbd)); ;} break; case 60: #line 1452 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); pevalexpr(1, (yyvsp[-2].intv)); evalr[2].value = (yyvsp[0].intv); evalr[3].seg = SSG_ABS; evalr[3].value = romw; locctr += geninstr(findgen((yyvsp[-3].intv), ST_EXPREG, reg_type[(yyvsp[0].intv)]|sdbd)); ;} break; case 61: #line 1467 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_CODE, currmode); pevalexpr(1, (yyvsp[-2].intv)); evalr[2].value = (yyvsp[0].intv); evalr[3].seg = SSG_ABS; evalr[3].value = romw; if (sdbd == 0 && romw != 16) { if (evalr[1].seg == SSG_ABS && (0xFFFF & evalr[1].value & ~romm) != 0) { /*frawarn("Constant is wider than ROM width. " "Inserting SDBD.");*/ locctr += geninstr("0001x"); sdbd = SDBD; } if (evalr[1].seg != SSG_ABS && fwd_sdbd) { frawarn("Inserting SDBD due to forward reference."); locctr += geninstr("0001x"); sdbd = SDBD; } } locctr += geninstr(findgen((yyvsp[-4].intv), ST_CEXREG, reg_type[(yyvsp[0].intv)]|sdbd)); ;} break; case 62: #line 1502 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); evalr[1].value = (yyvsp[0].intv); locctr += geninstr(findgen((yyvsp[-1].intv), ST_REG, reg_type[(yyvsp[0].intv)]|sdbd)); ;} break; case 63: #line 1514 "asm/as1600_real.y" { SDBD_CHK genlocrec(currseg, labelloc, TYPE_CODE, currmode); evalr[1].value = (yyvsp[-2].intv); evalr[2].value = (yyvsp[0].intv); locctr += geninstr(findgen((yyvsp[-3].intv), ST_REGREG, reg_type[(yyvsp[-2].intv)]|sdbd)); ;} break; case 64: #line 1527 "asm/as1600_real.y" { genlocrec(currseg, labelloc, TYPE_CODE, currmode); evalr[1].value = (yyvsp[-2].intv); evalr[2].value = (yyvsp[0].intv); locctr += geninstr(findgen((yyvsp[-3].intv), ST_REGREG, reg_type[(yyvsp[-2].intv)]|sdbd)); ;} break; case 65: #line 1540 "asm/as1600_real.y" { (yyval.intv) = (yyvsp[0].intv); ;} break; case 66: #line 1544 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_UN,(yyvsp[0].intv),IFC_NEG,0,0L, SYMNULL); ;} break; case 67: #line 1548 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_UN,(yyvsp[0].intv),IFC_NOT,0,0L, SYMNULL); ;} break; case 68: #line 1552 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_UN,(yyvsp[0].intv),IFC_HIGH,0,0L, SYMNULL); ;} break; case 69: #line 1556 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_UN,(yyvsp[0].intv),IFC_LOW,0,0L, SYMNULL); ;} break; case 70: #line 1560 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_MUL,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 71: #line 1564 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_DIV,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 72: #line 1568 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_ADD,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 73: #line 1572 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_SUB,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 74: #line 1576 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_MOD,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 75: #line 1580 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_SHL,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 76: #line 1584 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_SHR,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 77: #line 1588 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_GT,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 78: #line 1592 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_GE,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 79: #line 1596 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_LT,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 80: #line 1600 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_LE,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 81: #line 1604 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_NE,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 82: #line 1608 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_EQ,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 83: #line 1612 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_AND,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 84: #line 1616 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_OR,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 85: #line 1620 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_BIN,(yyvsp[-2].intv),IFC_XOR,(yyvsp[0].intv),0L, SYMNULL); ;} break; case 86: #line 1624 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_DEF,0,IGP_DEFINED,0,0L,(yyvsp[0].symb)); ;} break; case 87: #line 1628 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_SYMB,0,IFC_SYMB,0,0L,(yyvsp[0].symb)); ;} break; case 88: #line 1632 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,(yyvsp[0].longv), SYMNULL); ;} break; case 89: #line 1636 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,(yyvsp[0].longv), SYMNULL); ;} break; case 90: #line 1640 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_PROGC,0,IFC_PROGCTR,0,labelloc,SYMNULL); ;} break; case 91: #line 1644 "asm/as1600_real.y" { (yyval.intv) = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,(yyvsp[0].longv), SYMNULL); ;} break; case 92: #line 1648 "asm/as1600_real.y" { char *s = (yyvsp[-1].strng); long accval = 0; long length = 0; while (*s) { accval = chtran(&s); length++; } (yyval.intv) = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,length++,SYMNULL); ;} break; case 93: #line 1661 "asm/as1600_real.y" { char *s = (yyvsp[-3].strng); long accval = 0; long sindex = 0; pevalexpr(0, (yyvsp[-1].intv)); if(evalr[0].seg == SSG_ABS) { sindex = evalr[0].value; while (*s && sindex >= 0) { accval = chtran(&s); sindex--; } if (sindex >= 0) accval = 0; (yyval.intv) = exprnode(PCCASE_CONS,0,IGP_CONSTANT,0,accval,SYMNULL); } else { fraerror("noncomputable expression for index to ASC"); } ;} break; case 94: #line 1686 "asm/as1600_real.y" { (yyval.intv) = (yyvsp[-1].intv); ;} break; default: break; } /* Line 1126 of yacc.c. */ #line 3256 "asm/as1600.tab.c" yyvsp -= yylen; yyssp -= yylen; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if YYERROR_VERBOSE yyn = yypact[yystate]; if (YYPACT_NINF < yyn && yyn < YYLAST) { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; char *yymsg = 0; # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; #if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); #endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= yysize1 < yysize; yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= yysize1 < yysize; yysize = yysize1; if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yymsg; int yyi = 0; while ((*yyp = *yyf)) { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else { yyerror (YY_("syntax error")); goto yyexhaustedlab; } } else #endif /* YYERROR_VERBOSE */ yyerror (YY_("syntax error")); } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) goto yyerrorlab; yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK; } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 1693 "asm/as1600_real.y" int lexintercept(void) /* description intercept the call to yylex (the lexical analyzer) and filter out all unnecessary tokens when skipping the input between a failed IF and its matching ENDI or ELSE globals fraifskip the enable flag */ { #undef yylex int rv; if(frarptskip) { for(;;) { switch(rv = yylex()) { case 0: case KOC_END: case KOC_ENDR: case EOL: return rv; default: break; } } } else if(fraifskip) { for(;;) { switch(rv = yylex()) { case 0: case KOC_END: case KOC_IF: case KOC_ELSE: case KOC_ENDI: case EOL: return rv; default: break; } } } else return yylex(); #define yylex lexintercept } void setreserved(void) { reservedsym("and", KEOP_AND, 0); reservedsym("defined", KEOP_DEFINED, 0); reservedsym("ge", KEOP_GE, 0); reservedsym("high", KEOP_HIGH, 0); reservedsym("le", KEOP_LE, 0); reservedsym("low", KEOP_LOW, 0); reservedsym("mod", KEOP_MOD, 0); reservedsym("ne", KEOP_NE, 0); reservedsym("not", KEOP_NOT, 0); reservedsym("or", KEOP_OR, 0); reservedsym("shl", KEOP_SHL, 0); reservedsym("shr", KEOP_SHR, 0); reservedsym("xor", KEOP_XOR, 0); reservedsym("AND", KEOP_AND, 0); reservedsym("DEFINED", KEOP_DEFINED, 0); reservedsym("GE", KEOP_GE, 0); reservedsym("HIGH", KEOP_HIGH, 0); reservedsym("LE", KEOP_LE, 0); reservedsym("LOW", KEOP_LOW, 0); reservedsym("MOD", KEOP_MOD, 0); reservedsym("NE", KEOP_NE, 0); reservedsym("NOT", KEOP_NOT, 0); reservedsym("OR", KEOP_OR, 0); reservedsym("SHL", KEOP_SHL, 0); reservedsym("SHR", KEOP_SHR, 0); reservedsym("XOR", KEOP_XOR, 0); reservedsym("STRLEN", KEOP_STRLEN, 0); reservedsym("ASC", KEOP_ASC, 0); /* machine specific token definitions */ reservedsym("r0", REGISTER, 0); reservedsym("r1", REGISTER, 1); reservedsym("r2", REGISTER, 2); reservedsym("r3", REGISTER, 3); reservedsym("r4", REGISTER, 4); reservedsym("r5", REGISTER, 5); reservedsym("r6", REGISTER, 6); reservedsym("r7", REGISTER, 7); reservedsym("sp", REGISTER, 6); reservedsym("pc", REGISTER, 7); reservedsym("R0", REGISTER, 0); reservedsym("R1", REGISTER, 1); reservedsym("R2", REGISTER, 2); reservedsym("R3", REGISTER, 3); reservedsym("R4", REGISTER, 4); reservedsym("R5", REGISTER, 5); reservedsym("R6", REGISTER, 6); reservedsym("R7", REGISTER, 7); reservedsym("SP", REGISTER, 6); reservedsym("PC", REGISTER, 7); reservedsym("__FEATURE.MACRO", FEATURE, 99); } int cpumatch(char *str) { (void)str; return TRUE; } /* ======================================================================== */ /* Opcode and Instruction Generation Tables */ /* */ /* These tables are used by the assembler framework to generate */ /* instructions from the parsed input. */ /* */ /* OPTAB -- OPcode TABle. Contains the set of supported mnemonics. */ /* OSTAB -- Opcode Syntax TABle. Syntax definition sets for instrs. */ /* IGTAB -- Instruction Generation TABle. Contains RPN code for */ /* generating the instructions. */ /* ======================================================================== */ /* ======================================================================== */ /* OPTAB -- OPcode TABle. Contains the set of supported mnemonics. */ /* ======================================================================== */ struct opsym optab[] = { { "invalid", KOC_opcode, 2, 0 }, { "MVO", KOC_opcode, 1, 2 }, { "MVI", KOC_opcode, 1, 3 }, { "ADD", KOC_opcode, 1, 4 }, { "SUB", KOC_opcode, 1, 5 }, { "CMP", KOC_opcode, 1, 6 }, { "AND", KOC_opcode, 1, 7 }, { "XOR", KOC_opcode, 1, 8 }, { "MVO@", KOC_opcode, 1, 9 }, { "MVI@", KOC_opcode_i, 1, 10 }, { "ADD@", KOC_opcode_i, 1, 11 }, { "SUB@", KOC_opcode_i, 1, 12 }, { "CMP@", KOC_opcode_i, 1, 13 }, { "AND@", KOC_opcode_i, 1, 14 }, { "XOR@", KOC_opcode_i, 1, 15 }, { "MVOI", KOC_opcode, 1, 16 }, { "MVII", KOC_opcode, 1, 17 }, { "ADDI", KOC_opcode, 1, 18 }, { "SUBI", KOC_opcode, 1, 19 }, { "CMPI", KOC_opcode, 1, 20 }, { "ANDI", KOC_opcode, 1, 21 }, { "XORI", KOC_opcode, 1, 22 }, { "MOVR", KOC_opcode, 1, 24 }, { "ADDR", KOC_opcode, 1, 25 }, { "SUBR", KOC_opcode, 1, 26 }, { "CMPR", KOC_opcode, 1, 27 }, { "ANDR", KOC_opcode, 1, 28 }, { "XORR", KOC_opcode, 1, 29 }, { "B", KOC_relbr, 1, 30 }, { "BC", KOC_relbr, 1, 31 }, { "BOV", KOC_relbr, 1, 32 }, { "BPL", KOC_relbr, 1, 33 }, { "BZE", KOC_relbr, 1, 34 }, { "BEQ", KOC_relbr, 1, 34 }, { "BLT", KOC_relbr, 1, 35 }, { "BNGE", KOC_relbr, 1, 35 }, { "BLE", KOC_relbr, 1, 36 }, { "BNGT", KOC_relbr, 1, 36 }, { "BUSC", KOC_relbr, 1, 37 }, { "NOPP", KOC_opcode, 2, 92 }, { "BNC", KOC_relbr, 1, 39 }, { "BNOV", KOC_relbr, 1, 40 }, { "BMI", KOC_relbr, 1, 41 }, { "BNZE", KOC_relbr, 1, 42 }, { "BNZ", KOC_relbr, 1, 42 }, { "BNEQ", KOC_relbr, 1, 42 }, { "BNE", KOC_relbr, 1, 42 }, { "BGE", KOC_relbr, 1, 43 }, { "BNLT", KOC_relbr, 1, 43 }, { "BGT", KOC_relbr, 1, 44 }, { "BNLE", KOC_relbr, 1, 44 }, { "BESC", KOC_relbr, 1, 45 }, { "BEXT", KOC_relbr_x, 1, 96 }, { "SWAP", KOC_opcode, 2, 46 }, { "SLL", KOC_opcode, 2, 48 }, { "RLC", KOC_opcode, 2, 50 }, { "SLLC", KOC_opcode, 2, 52 }, { "SLR", KOC_opcode, 2, 54 }, { "SAR", KOC_opcode, 2, 56 }, { "RRC", KOC_opcode, 2, 58 }, { "SARC", KOC_opcode, 2, 60 }, { "NOP", KOC_opcode, 1, 62 }, { "NOP2", KOC_opcode, 1, 94 }, { "SIN", KOC_opcode, 1, 63 }, { "SIN2", KOC_opcode, 1, 95 }, { "J", KOC_opcode, 1, 64 }, { "JE", KOC_opcode, 1, 65 }, { "JD", KOC_opcode, 1, 66 }, { "JSR", KOC_opcode, 1, 67 }, { "JSRE", KOC_opcode, 1, 68 }, { "JSRD", KOC_opcode, 1, 69 }, { "INCR", KOC_opcode, 1, 70 }, { "DECR", KOC_opcode, 1, 71 }, { "COMR", KOC_opcode, 1, 72 }, { "NEGR", KOC_opcode, 1, 73 }, { "ADCR", KOC_opcode, 1, 74 }, { "GSWD", KOC_opcode, 1, 75 }, { "RSWD", KOC_opcode, 1, 76 }, { "HLT", KOC_opcode, 1, 77 }, { "SDBD", KOC_SDBD, 1, 78 }, { "EIS", KOC_opcode, 1, 79 }, { "DIS", KOC_opcode, 1, 80 }, { "TCI", KOC_opcode, 1, 81 }, { "CLRC", KOC_opcode, 1, 82 }, { "SETC", KOC_opcode, 1, 83 }, { "TSTR", KOC_opcode, 1, 84 }, /* MOVR Rx, Rx */ { "CLRR", KOC_opcode, 1, 85 }, /* XORR Rx, Rx */ { "PSHR", KOC_opcode, 1, 86 }, /* MVO@ Rx, SP */ { "PULR", KOC_opcode, 1, 87 }, /* MVI@ SP, Rx */ { "JR", KOC_opcode, 1, 88 }, /* MOVR Rx, PC */ { "CALL", KOC_opcode, 1, 89 }, /* JSR R5, addr */ { "BEGIN", KOC_opcode, 1, 90 }, /* MVO@ R5, SP */ { "RETURN", KOC_opcode, 1, 91 }, /* MVI@ SP, PC */ { "DECLE", KOC_DDEF, 0, 0 }, /* Generates ROMW values */ { "DCW", KOC_DDEF, 0, 0 }, /* Generates ROMW values */ { "BIDECLE", KOC_WDEF, 0, 0 }, /* Generates SDBD values */ { "ROMWIDTH", KOC_ROMW, 0, 0 }, { "ROMW", KOC_ROMW, 0, 0 }, { "PROC", KOC_PROC, 0, 0 }, { "ENDP", KOC_ENDP, 0, 0 }, { "BYTE", KOC_BDEF, 0, 0 }, /* Generates 8-bit values */ { "CHARDEF", KOC_CHDEF, 0, 0 }, { "CHARSET", KOC_CHSET, 0, 0 }, { "CHARUSE", KOC_CHUSE, 0, 0 }, { "CHD", KOC_CHDEF, 0, 0 }, { "DATA", KOC_DDEF, 0, 0 }, /* Generates ROMW values */ { "DB", KOC_BDEF, 0, 0 }, /* Generates 8-bit values */ { "DW", KOC_WDEF, 0, 0 }, /* Generates SDBD values */ { "ELSE", KOC_ELSE, 0, 0 }, { "END", KOC_END, 0, 0 }, { "ENDI", KOC_ENDI, 0, 0 }, { "EQU", KOC_EQU, 0, 0 }, { "FCB", KOC_BDEF, 0, 0 }, /* Generates 8-bit values */ { "FCC", KOC_SDEF, 0, 0 }, { "FDB", KOC_WDEF, 0, 0 }, /* Generates SDBD values */ { "IF", KOC_IF, 0, 0 }, { "INCL", KOC_INCLUDE, 0, 0 }, { "INCLUDE", KOC_INCLUDE, 0, 0 }, { "ORG", KOC_ORG, 0, 0 }, { "RES", KOC_RESM, 0, 0 }, { "RESERVE", KOC_RESM, 0, 0 }, { "RMB", KOC_RESM, 0, 0 }, { "SET", KOC_SET, 0, 0 }, { "STRING", KOC_SDEF, 0, 0 }, { "WORD", KOC_WDEF, 0, 0 }, /* Generates SDBD values */ { "STRUCT", KOC_STRUCT, 0, 0 }, /* Opens a struct def'n */ { "ENDS", KOC_ENDS, 0, 0 }, /* Closes a struct def'n */ { "MEMATTR", KOC_MEMATTR, 0, 0 }, /* Set memory attributes */ { "RPT", KOC_RPT, 0, 0 }, /* Repeat a block of code */ { "REPEAT", KOC_RPT, 0, 0 }, /* Repeat a block of code */ { "ENDR", KOC_ENDR, 0, 0 }, /* End repeated block */ { "ERR", KOC_USRERR, 0, 0 }, /* User-designated error */ { "STRLEN", KEOP_STRLEN, 0, 0 }, /* Returns length of string */ { "ASC", KEOP_ASC, 0, 0 }, /* ASCII val of char in str */ { "LISTING", KOC_LIST, 0, 0 }, /* Assembler listing control */ { "", 0, 0, 0 } }; /* ======================================================================== */ /* OSTAB -- Opcode Syntax TABle. Syntax definition sets for instrs. */ /* */ /* Legend: */ /* REG Register. */ /* EXP EXPression */ /* CEX Constant EXpression (eg. exp. prefixed w/ #). */ /* IMP Implied operand. */ /* ======================================================================== */ struct opsynt ostab[] = { /* invalid 0 */ { 0, 1, 0 }, /* invalid 1 */ { 0xFFFF, 1, 1 }, /* MVO 2 */ { ST_REGEXP, 1, 2 }, /* MVI 3 */ { ST_EXPREG, 1, 3 }, /* ADD 4 */ { ST_EXPREG, 1, 4 }, /* SUB 5 */ { ST_EXPREG, 1, 5 }, /* CMP 6 */ { ST_EXPREG, 1, 6 }, /* AND 7 */ { ST_EXPREG, 1, 7 }, /* XOR 8 */ { ST_EXPREG, 1, 8 }, /* MVO@ 9 */ { ST_REGREG, 1, 9 }, /* MVI@ 10 */ { ST_REGREG, 1, 10 }, /* ADD@ 11 */ { ST_REGREG, 1, 11 }, /* SUB@ 12 */ { ST_REGREG, 1, 12 }, /* CMP@ 13 */ { ST_REGREG, 1, 13 }, /* AND@ 14 */ { ST_REGREG, 1, 14 }, /* XOR@ 15 */ { ST_REGREG, 1, 15 }, /* MVOI 16 */ { ST_REGCEX, 1, 16 }, /* MVII 17 */ { ST_CEXREG, 2, 17 }, /* ADDI 18 */ { ST_CEXREG, 2, 19 }, /* SUBI 19 */ { ST_CEXREG, 2, 21 }, /* CMPI 20 */ { ST_CEXREG, 2, 23 }, /* ANDI 21 */ { ST_CEXREG, 2, 25 }, /* XORI 22 */ { ST_CEXREG, 2, 27 }, /* unused 23 */ { 0, 1, 0 }, /* oops */ /* MOVR 24 */ { ST_REGREG, 1, 29 }, /* ADDR 25 */ { ST_REGREG, 1, 30 }, /* SUBR 26 */ { ST_REGREG, 1, 31 }, /* CMPR 27 */ { ST_REGREG, 1, 32 }, /* ANDR 28 */ { ST_REGREG, 1, 33 }, /* XORR 29 */ { ST_REGREG, 1, 34 }, /* B 30 */ { ST_EXP, 1, 35 }, /* BC 31 */ { ST_EXP, 1, 36 }, /* BOV 32 */ { ST_EXP, 1, 37 }, /* BPL 33 */ { ST_EXP, 1, 38 }, /* BEQ 34 */ { ST_EXP, 1, 39 }, /* BLT 35 */ { ST_EXP, 1, 40 }, /* BLE 36 */ { ST_EXP, 1, 41 }, /* BUSC 37 */ { ST_EXP, 1, 42 }, /* unused 38 */ { 0, 1, 0 }, /* oops */ /* BNC 39 */ { ST_EXP, 1, 44 }, /* BNOV 40 */ { ST_EXP, 1, 45 }, /* BMI 41 */ { ST_EXP, 1, 46 }, /* BNEQ 42 */ { ST_EXP, 1, 47 }, /* BGE 43 */ { ST_EXP, 1, 48 }, /* BGT 44 */ { ST_EXP, 1, 49 }, /* BESC 45 */ { ST_EXP, 1, 50 }, /* SWAP 46 */ { ST_REG, 1, 51 }, /* SWAP 47 */ { ST_REGEXP, 1, 52 }, /* SLL 48 */ { ST_REG, 1, 53 }, /* SLL 49 */ { ST_REGEXP, 1, 54 }, /* RLC 50 */ { ST_REG, 1, 55 }, /* RLC 51 */ { ST_REGEXP, 1, 56 }, /* SLLC 52 */ { ST_REG, 1, 57 }, /* SLLC 53 */ { ST_REGEXP, 1, 58 }, /* SLR 54 */ { ST_REG, 1, 59 }, /* SLR 55 */ { ST_REGEXP, 1, 60 }, /* SAR 56 */ { ST_REG, 1, 61 }, /* SAR 57 */ { ST_REGEXP, 1, 62 }, /* RRC 58 */ { ST_REG, 1, 63 }, /* RRC 59 */ { ST_REGEXP, 1, 64 }, /* SARC 60 */ { ST_REG, 1, 65 }, /* SARC 61 */ { ST_REGEXP, 1, 66 }, /* NOP 62 */ { ST_IMP, 1, 67 }, /* SIN 63 */ { ST_IMP, 1, 68 }, /* J 64 */ { ST_EXP, 1, 69 }, /* JE 65 */ { ST_EXP, 1, 70 }, /* JD 66 */ { ST_EXP, 1, 71 }, /* JSR 67 */ { ST_REGEXP, 1, 72 }, /* JSRE 68 */ { ST_REGEXP, 1, 73 }, /* JSRD 69 */ { ST_REGEXP, 1, 74 }, /* INCR 70 */ { ST_REG, 1, 75 }, /* DECR 71 */ { ST_REG, 1, 76 }, /* COMR 72 */ { ST_REG, 1, 77 }, /* NEGR 73 */ { ST_REG, 1, 78 }, /* ADCR 74 */ { ST_REG, 1, 79 }, /* GSWD 75 */ { ST_REG, 1, 80 }, /* RSWD 76 */ { ST_REG, 1, 81 }, /* HLT 77 */ { ST_IMP, 1, 82 }, /* SDBD 78 */ { ST_IMP, 1, 83 }, /* EIS 79 */ { ST_IMP, 1, 84 }, /* DIS 80 */ { ST_IMP, 1, 85 }, /* TCI 81 */ { ST_IMP, 1, 86 }, /* CLRC 82 */ { ST_IMP, 1, 87 }, /* SETC 83 */ { ST_IMP, 1, 88 }, /* TSTR 84 */ { ST_REG, 1, 89 }, /* CLRR 85 */ { ST_REG, 1, 90 }, /* PSHR 86 */ { ST_REG, 1, 91 }, /* PULR 87 */ { ST_REG, 1, 92 }, /* JR 88 */ { ST_REG, 1, 93 }, /* CALL 89 */ { ST_EXP, 1, 94 }, /* BEGIN 90 */ { ST_IMP, 1, 95 }, /* RETURN 91 */ { ST_IMP, 1, 96 }, /* NOPP 92 */ { ST_EXP, 1, 43 }, /* NOPP 93 */ { ST_IMP, 1, 97 }, /* NOP2 94 */ { ST_IMP, 1, 98 }, /* SIN2 95 */ { ST_IMP, 1, 99 }, /* BEXT 95 */ { ST_EXPEXP, 1, 100 }, /* end */ { 0, 0, 0 } }; /* ======================================================================== */ /* Helper macros. */ /* MVO_OK Tests arg 2 to make sure it's R1 .. R6. */ /* SH_OK Tests if shift amount is ok. */ /* CST_OK Tests if constant is ok (within field width). */ /* DBD Generate double-byte-data. */ /* RR Register/Register generator. Reused for Direct, Immediate. */ /* BR Branch Relative generator. */ /* SH Shift generator. */ /* SR Single-register generator */ /* JSR Jump/JSR generator */ /* CST Constant arg generator (eg. immediate argument) */ /* ======================================================================== */ #define MVO_OK "[2#].0=.[2#].7=+T$" #define SH_OK(n) #n ".1>T$" #n ".<0T$" #define CST_OK(w,c) #c "." #w"I$" #define DBD(x) #x ".FF&x" #x ".8}.FF&x" #define RR(o,x,y) #o "." #x ".3{|." #y "|x" #define BRDIR(a) "P.2+." #a ">." #define BROFS(a) #a ".P.2+-." BRDIR(a) "!_^" #define BR(c,a,w) "0200." #c "|." BRDIR(a) "5{|x" BROFS(a) "~x" #w "I$" #define BX(c,a,w) #c ".4I$" \ "0210." #c "|." BRDIR(a) "5{|x" BROFS(a) "~x" #w "I$" /*#define BR(c,a,m) "0200." #c "|." BRDIR(a) "5{|x" #a "x"*/ #define CST(c,m) CST_OK(m,c) #c "x" #define SH(o,n,r) SH_OK(n) "0040." #o ".3{|." #n ".1&.2{|." #r "|x" #define SR(o,r) "0000." #o ".3{|." #r "|x" #define JSR(r,e,a) "0004x" #r ".3&.8{." #a ".8}.FC&|." #e "|x" #a ".3FF&x" /* ======================================================================== */ /* IGTAB -- Instruction Generator Table. */ /* ======================================================================== */ struct igel igtab[] = { /* inv 0 */ { SDBD, 0, "[Xnullentry" }, /* inv 1 */ { SDBD, 0, "[Xinvalid opcode" }, /* MVO 2 */ { SDBD, 0, RR(0240,0,[1#]) CST([2=],[3#]) }, /* MVI 3 */ { SDBD, 0, RR(0280,0,[2#]) CST([1=],[3#]) }, /* ADD 4 */ { SDBD, 0, RR(02C0,0,[2#]) CST([1=],[3#]) }, /* SUB 5 */ { SDBD, 0, RR(0300,0,[2#]) CST([1=],[3#]) }, /* CMP 6 */ { SDBD, 0, RR(0340,0,[2#]) CST([1=],[3#]) }, /* AND 7 */ { SDBD, 0, RR(0380,0,[2#]) CST([1=],[3#]) }, /* XOR 8 */ { SDBD, 0, RR(03C0,0,[2#]) CST([1=],[3#]) }, /* MVO@ 9 */ { SDBD, 0, MVO_OK RR(0240,[2#],[1#]) }, /* MVI@ 10 */ { IND_RG, IND_RG, RR(0280,[1#],[2#]) }, /* ADD@ 11 */ { IND_RG, IND_RG, RR(02C0,[1#],[2#]) }, /* SUB@ 12 */ { IND_RG, IND_RG, RR(0300,[1#],[2#]) }, /* CMP@ 13 */ { IND_RG, IND_RG, RR(0340,[1#],[2#]) }, /* AND@ 14 */ { IND_RG, IND_RG, RR(0380,[1#],[2#]) }, /* XOR@ 15 */ { IND_RG, IND_RG, RR(03C0,[1#],[2#]) }, /* MVOI 16 */ { SDBD, 0, RR(0240,7,[1#]) CST([2=],[3#]) }, /* MVII 17 */ { SDBD, 0, RR(0280,7,[2#]) CST([1=],[3#]) }, /* MVII 18 */ { SDBD, SDBD, RR(0280,7,[2#]) DBD([1=]) }, /* ADDI 19 */ { SDBD, 0, RR(02C0,7,[2#]) CST([1=],[3#]) }, /* ADDI 20 */ { SDBD, SDBD, RR(02C0,7,[2#]) DBD([1=]) }, /* SUBI 21 */ { SDBD, 0, RR(0300,7,[2#]) CST([1=],[3#]) }, /* SUBI 22 */ { SDBD, SDBD, RR(0300,7,[2#]) DBD([1=]) }, /* CMPI 23 */ { SDBD, 0, RR(0340,7,[2#]) CST([1=],[3#]) }, /* CMPI 24 */ { SDBD, SDBD, RR(0340,7,[2#]) DBD([1=]) }, /* ANDI 25 */ { SDBD, 0, RR(0380,7,[2#]) CST([1=],[3#]) }, /* ANDI 26 */ { SDBD, SDBD, RR(0380,7,[2#]) DBD([1=]) }, /* XORI 27 */ { SDBD, 0, RR(03C0,7,[2#]) CST([1=],[3#]) }, /* XORI 28 */ { SDBD, SDBD, RR(03C0,7,[2#]) DBD([1=]) }, /* MOVR 29 */ { SDBD, 0, RR(0080,[1#],[2#]) }, /* ADDR 30 */ { SDBD, 0, RR(00C0,[1#],[2#]) }, /* SUBR 31 */ { SDBD, 0, RR(0100,[1#],[2#]) }, /* CMPR 32 */ { SDBD, 0, RR(0140,[1#],[2#]) }, /* ANDR 33 */ { SDBD, 0, RR(0180,[1#],[2#]) }, /* XORR 34 */ { SDBD, 0, RR(01C0,[1#],[2#]) }, /* B 35 */ { SDBD, 0, BR(0,[1=],[3#]) }, /* BC 36 */ { SDBD, 0, BR(1,[1=],[3#]) }, /* BOV 37 */ { SDBD, 0, BR(2,[1=],[3#]) }, /* BPL 38 */ { SDBD, 0, BR(3,[1=],[3#]) }, /* BEQ 39 */ { SDBD, 0, BR(4,[1=],[3#]) }, /* BLT 40 */ { SDBD, 0, BR(5,[1=],[3#]) }, /* BLE 41 */ { SDBD, 0, BR(6,[1=],[3#]) }, /* BUSC 42 */ { SDBD, 0, BR(7,[1=],[3#]) }, /* NOPP 43 */ { SDBD, 0, BR(8,[1=],[3#]) }, /* BNC 44 */ { SDBD, 0, BR(9,[1=],[3#]) }, /* BNOV 45 */ { SDBD, 0, BR(A,[1=],[3#]) }, /* BMI 46 */ { SDBD, 0, BR(B,[1=],[3#]) }, /* BNEQ 47 */ { SDBD, 0, BR(C,[1=],[3#]) }, /* BGE 48 */ { SDBD, 0, BR(D,[1=],[3#]) }, /* BGT 49 */ { SDBD, 0, BR(E,[1=],[3#]) }, /* BESC 50 */ { SDBD, 0, BR(F,[1=],[3#]) }, /* SWAP 51 */ { SDBD|SHF_RG,SHF_RG, SH(0,0,[1#]) }, /* SWAP 52 */ { SDBD|SHF_RG,SHF_RG, SH(0,[2=].1-,[1#]) }, /* SLL 53 */ { SDBD|SHF_RG,SHF_RG, SH(1,0,[1#]) }, /* SLL 54 */ { SDBD|SHF_RG,SHF_RG, SH(1,[2=].1-,[1#]) }, /* RLC 55 */ { SDBD|SHF_RG,SHF_RG, SH(2,0,[1#]) }, /* RLC 56 */ { SDBD|SHF_RG,SHF_RG, SH(2,[2=].1-,[1#]) }, /* SLLC 57 */ { SDBD|SHF_RG,SHF_RG, SH(3,0,[1#]) }, /* SLLC 58 */ { SDBD|SHF_RG,SHF_RG, SH(3,[2=].1-,[1#]) }, /* SLR 59 */ { SDBD|SHF_RG,SHF_RG, SH(4,0,[1#]) }, /* SLR 60 */ { SDBD|SHF_RG,SHF_RG, SH(4,[2=].1-,[1#]) }, /* SAR 61 */ { SDBD|SHF_RG,SHF_RG, SH(5,0,[1#]) }, /* SAR 62 */ { SDBD|SHF_RG,SHF_RG, SH(5,[2=].1-,[1#]) }, /* RRC 63 */ { SDBD|SHF_RG,SHF_RG, SH(6,0,[1#]) }, /* RRC 64 */ { SDBD|SHF_RG,SHF_RG, SH(6,[2=].1-,[1#]) }, /* SARC 65 */ { SDBD|SHF_RG,SHF_RG, SH(7,0,[1#]) }, /* SARC 66 */ { SDBD|SHF_RG,SHF_RG, SH(7,[2=].1-,[1#]) }, /* NOP 67 */ { SDBD, 0, "0034x" }, /* SIN 68 */ { SDBD, 0, "0036x" }, /* J 69 */ { SDBD, 0, JSR(3,0,[1=]) }, /* JE 70 */ { SDBD, 0, JSR(3,1,[1=]) }, /* JD 71 */ { SDBD, 0, JSR(3,2,[1=]) }, /* JSR 72 */ { SDBD|JSR_RG,JSR_RG, JSR([1#],0,[2=]) }, /* JSRE 73 */ { SDBD|JSR_RG,JSR_RG, JSR([1#],1,[2=]) }, /* JSRD 74 */ { SDBD|JSR_RG,JSR_RG, JSR([1#],2,[2=]) }, /* INCR 75 */ { SDBD, 0, SR(1,[1#]) }, /* DECR 76 */ { SDBD, 0, SR(2,[1#]) }, /* COMR 77 */ { SDBD, 0, SR(3,[1#]) }, /* NEGR 78 */ { SDBD, 0, SR(4,[1#]) }, /* ADCR 79 */ { SDBD, 0, SR(5,[1#]) }, /* GSWD 80 */ { SDBD|SHF_RG,SHF_RG, SR(6,[1#]) }, /* RSWD 81 */ { SDBD, 0, SR(7,[1#]) }, /* HLT 82 */ { SDBD, 0, "0000x" }, /* SDBD 83 */ { SDBD, 0, "0001x" }, /* EIS 84 */ { SDBD, 0, "0002x" }, /* DIS 85 */ { SDBD, 0, "0003x" }, /* TCI 86 */ { SDBD, 0, "0005x" }, /* CLRC 87 */ { SDBD, 0, "0006x" }, /* SETC 88 */ { SDBD, 0, "0007x" }, /* TSTR 89 */ { SDBD, 0, RR(0080,[1#],[1#]) }, /* CLRR 90 */ { SDBD, 0, RR(01C0,[1#],[1#]) }, /* PSHR 91 */ { SDBD, 0, RR(0240,6,[1#]) }, /* PULR 92 */ { 0, 0, RR(0280,6,[1#]) }, /* JR 93 */ { SDBD, 0, RR(0080,[1#],7) }, /* CALL 94 */ { SDBD, 0, JSR(5,0,[1=]) }, /* BEGIN 95 */ { SDBD, 0, RR(0240,6,5) }, /* RETURN 96*/ { SDBD, 0, RR(0280,6,7) }, /* NOPP 97 */ { SDBD, 0, "0208x0000x" }, /* NOP2 98 */ { SDBD, 0, "0035x" }, /* SIN2 99 */ { SDBD, 0, "0037x" }, /* BESC 100 */ { SDBD, 0, BX([4#],[1=],[3#]) }, /* end */ { 0, 0, "[Xinvalid opcode" }, }; #define NUMOPCODE (sizeof(optab)/sizeof(struct opsym)) int gnumopcode = NUMOPCODE; int ophashlnk[NUMOPCODE]; /* ======================================================================== */ /* End of file: fraptabdef.c */ /* ======================================================================== */