home *** CD-ROM | disk | FTP | other *** search
- char rom[128][8192];
- int bank_offset[128];
- int bank_page[128];
- int max_bank;
- int bank;
- int page;
- int rsbase;
-
- int errcnt; /* error counter */
- struct t_symbol *hash_tbl[256]; /* pointers to starting links in symtab */
- struct t_symbol *lablptr; /* label pointer into symbol table */
- struct t_symbol *glablptr; /* pointer to the latest defined global symbol */
- char hex[5]; /* hexadecimal character buffer */
- int loccnt; /* location counter */
- int nxt_free; /* next free location in symtab */
- int opflg; /* operation code flags */
- int opval; /* operation code value */
- int optype; /* operation code type */
- int pass; /* pass counter */
- char prlnbuf[LAST_CH_POS+1]; /* print line buffer */
- int sflag; /* symbol table output flag */
- int slnum; /* source line number counter */
- char symbol[SBOLSZ+1]; /* temporary symbol storage */
- int undef; /* undefined symbol in expression flg */
- int value; /* operand field value */
- int clist; /* listing on/off */
- int mlist; /* macro listing on/off */
- int xlist; /* flag for listing file */
-
- int opvaltab[6][16] = {
- 0x08, 0x08, 0x04, 0x14, 0x14, 0x11, 0x00, 0x10,
- 0x0C, 0x1C, 0x18, 0x2C, 0x3C, 0x00, 0x00, 0x00,
- /* -- */
- 0x00, 0x00, 0x04, 0x14, 0x14, 0x00, 0x00, 0x00, /* CPX CPY LDX LDY */
- 0x0C, 0x1C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, /* ST0 ST1 ST2 TAM TMA */
- /* -- */
- 0x00, 0x89, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00, /* BIT */
- 0x2C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* -- */
- 0x3A, 0x00, 0xC6, 0xD6, 0x00, 0x00, 0x00, 0x00, /* DEC */
- 0xCE, 0xDE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* -- */
- 0x1A, 0x00, 0xE6, 0xF6, 0x00, 0x00, 0x00, 0x00, /* INC */
- 0xEE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* -- */
- 0x00, 0x00, 0x64, 0x74, 0x00, 0x00, 0x00, 0x00, /* STZ */
- 0x9C, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- struct t_opcode optab[176] = /* nmemonic operation code table */
- {
- {"ADC",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x61,0},
- {"AND",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x21,0},
- {"ASL",ACC|ZP|ZP_X|ABS|ABS_X,0x02,0},
- {"BBR0",CLASS5,0x0f,0},
- {"BBR1",CLASS5,0x1f,0},
- {"BBR2",CLASS5,0x2f,0},
- {"BBR3",CLASS5,0x3f,0},
- {"BBR4",CLASS5,0x4f,0},
- {"BBR5",CLASS5,0x5f,0},
- {"BBR6",CLASS5,0x6f,0},
- {"BBR7",CLASS5,0x7f,0},
- {"BBS0",CLASS5,0x8f,0},
- {"BBS1",CLASS5,0x9f,0},
- {"BBS2",CLASS5,0xaf,0},
- {"BBS3",CLASS5,0xbf,0},
- {"BBS4",CLASS5,0xcf,0},
- {"BBS5",CLASS5,0xdf,0},
- {"BBS6",CLASS5,0xef,0},
- {"BBS7",CLASS5,0xff,0},
- {"BCC",CLASS2,0x90,0},
- {"BCS",CLASS2,0xb0,0},
- {"BEQ",CLASS2,0xf0,0},
- {"BIT",IMM|ZP|ZP_X|ABS|ABS_X,0x00,2},
- {"BMI",CLASS2,0x30,0},
- {"BNE",CLASS2,0xd0,0},
- {"BPL",CLASS2,0x10,0},
- {"BRA",CLASS2,0x80,0},
- {"BRK",CLASS1,0x00,0},
- {"BSR",CLASS2,0x44,0},
- {"BVC",CLASS2,0x50,0},
- {"BVS",CLASS2,0x70,0},
- {"CLA",CLASS1,0x62,0},
- {"CLC",CLASS1,0x18,0},
- {"CLD",CLASS1,0xd8,0},
- {"CLI",CLASS1,0x58,0},
- {"CLV",CLASS1,0xb8,0},
- {"CLX",CLASS1,0x82,0},
- {"CLY",CLASS1,0xc2,0},
- {"CMP",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0xc1,0},
- {"CPX",IMM|ZP|ABS,0xe0,1},
- {"CPY",IMM|ZP|ABS,0xc0,1},
- {"CSH",CLASS1,0xd4,0},
- {"CSL",CLASS1,0x54,0},
- {"DEC",ACC|ZP|ZP_X|ABS|ABS_X,0x00,3},
- {"DEX",CLASS1,0xca,0},
- {"DEY",CLASS1,0x88,0},
- {"EOR",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x41,0},
- {"INC",ACC|ZP|ZP_X|ABS|ABS_X,0x00,4},
- {"INX",CLASS1,0xe8,0},
- {"INY",CLASS1,0xc8,0},
- {"JMP",ABS|ABS_IND|ABS_IND_X,0x40,0},
- {"JSR",ABS,0x14,0},
- {"LDA",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0xa1,0},
- {"LDX",IMM|ZP|ZP_Y|ABS|ABS_Y,0xa2,1},
- {"LDY",IMM|ZP|ZP_X|ABS|ABS_X,0xa0,1},
- {"LSR",ACC|ZP|ZP_X|ABS|ABS_X,0x42,0},
- {"NOP",CLASS1,0xea,0},
- {"ORA",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x01,0},
- {"PHA",CLASS1,0x48,0},
- {"PHP",CLASS1,0x08,0},
- {"PHX",CLASS1,0xDA,0},
- {"PHY",CLASS1,0x5A,0},
- {"PLA",CLASS1,0x68,0},
- {"PLP",CLASS1,0x28,0},
- {"PLX",CLASS1,0xFA,0},
- {"PLY",CLASS1,0x7A,0},
- {"RMB0",ZP,0x03,0},
- {"RMB1",ZP,0x13,0},
- {"RMB2",ZP,0x23,0},
- {"RMB3",ZP,0x33,0},
- {"RMB4",ZP,0x43,0},
- {"RMB5",ZP,0x53,0},
- {"RMB6",ZP,0x63,0},
- {"RMB7",ZP,0x73,0},
- {"ROL",ACC|ZP|ZP_X|ABS|ABS_X,0x22,0},
- {"ROR",ACC|ZP|ZP_X|ABS|ABS_X,0x62,0},
- {"RTI",CLASS1,0x40,0},
- {"RTS",CLASS1,0x60,0},
- {"SAX",CLASS1,0x22,0},
- {"SAY",CLASS1,0x42,0},
- {"SBC",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0xe1,0},
- {"SEC",CLASS1,0x38,0},
- {"SED",CLASS1,0xf8,0},
- {"SEI",CLASS1,0x78,0},
- {"SET",CLASS1,0xf4,0},
- {"SMB0",ZP,0x83,0},
- {"SMB1",ZP,0x93,0},
- {"SMB2",ZP,0xA3,0},
- {"SMB3",ZP,0xB3,0},
- {"SMB4",ZP,0xC3,0},
- {"SMB5",ZP,0xD3,0},
- {"SMB6",ZP,0xE3,0},
- {"SMB7",ZP,0xF3,0},
- {"ST0",IMM,0x03,1},
- {"ST1",IMM,0x13,1},
- {"ST2",IMM,0x23,1},
- {"STA",ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x81,0},
- {"STX",ZP|ZP_Y|ABS,0x82,0},
- {"STY",ZP|ZP_X|ABS,0x80,0},
- {"STZ",ZP|ZP_X|ABS|ABS_X,0x00,5},
- {"SXY",CLASS1,0x02,0},
- {"TAI",CLASS6,0xf3,0},
- {"TAM",CLASS8,0x53,0},
- {"TAM0",CLASS3,0x53,0x01},
- {"TAM1",CLASS3,0x53,0x02},
- {"TAM2",CLASS3,0x53,0x04},
- {"TAM3",CLASS3,0x53,0x08},
- {"TAM4",CLASS3,0x53,0x10},
- {"TAM5",CLASS3,0x53,0x20},
- {"TAM6",CLASS3,0x53,0x40},
- {"TAM7",CLASS3,0x53,0x80},
- {"TAX",CLASS1,0xaa,0},
- {"TAY",CLASS1,0xa8,0},
- {"TDD",CLASS6,0xc3,0},
- {"TIA",CLASS6,0xe3,0},
- {"TII",CLASS6,0x73,0},
- {"TIN",CLASS6,0xd3,0},
- {"TMA",CLASS8,0x43,0},
- {"TMA0",CLASS3,0x43,0x01},
- {"TMA1",CLASS3,0x43,0x02},
- {"TMA2",CLASS3,0x43,0x04},
- {"TMA3",CLASS3,0x43,0x08},
- {"TMA4",CLASS3,0x43,0x10},
- {"TMA5",CLASS3,0x43,0x20},
- {"TMA6",CLASS3,0x43,0x40},
- {"TMA7",CLASS3,0x43,0x80},
- {"TRB",ZP|ABS,0x10,0},
- {"TSB",ZP|ABS,0x00,0},
- {"TST",CLASS7,0x00,0},
- {"TSX",CLASS1,0xba,0},
- {"TXA",CLASS1,0x8a,0},
- {"TXS",CLASS1,0x9a,0},
- {"TYA",CLASS1,0x98,0},
-
- {"=",PSEUDO,2,0},
-
- {"BANK",PSEUDO,5,0},
- {"DB",PSEUDO,0,0},
- {"DW",PSEUDO,1,0},
- {"ENDM",PSEUDO,12,0},
- {"EQU",PSEUDO,2,0},
- {"INCBIN",PSEUDO,6,0},
- {"INCLUDE",PSEUDO,7,0},
- {"INCCHR",PSEUDO,8,0xEA},
- {"INCSPR",PSEUDO,9,0xEA},
- {"INCPAL",PSEUDO,10,0xF8},
- {"LIST",PSEUDO,13,0},
- {"MACRO",PSEUDO,11,0},
- {"MLIST",PSEUDO,14,0},
- {"NOLIST",PSEUDO,15,0},
- {"NOMLIST",PSEUDO,16,0},
- {"ORG",PSEUDO,4,0},
- {"PAGE",PSEUDO,3,0},
- {"RSSET",PSEUDO,17,0},
- {"RS",PSEUDO,18,0},
-
- {".BANK",PSEUDO,5,0},
- {".DB",PSEUDO,0,0},
- {".DW",PSEUDO,1,0},
- {".ENDM",PSEUDO,12,0},
- {".EQU",PSEUDO,2,0},
- {".INCBIN",PSEUDO,6,0},
- {".INCLUDE",PSEUDO,7,0},
- {".INCCHR",PSEUDO,8,0xEA},
- {".INCSPR",PSEUDO,9,0xEA},
- {".INCPAL",PSEUDO,10,0xF8},
- {".LIST",PSEUDO,13,0},
- {".MACRO",PSEUDO,11,0},
- {".MLIST",PSEUDO,14,0},
- {".NOLIST",PSEUDO,15,0},
- {".NOMLIST",PSEUDO,16,0},
- {".ORG",PSEUDO,4,0},
- {".PAGE",PSEUDO,3,0},
- {".RSSET",PSEUDO,17,0},
- {".RS",PSEUDO,18,0},
- {NULL,0,0}
- };
-
-