home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / emulaton / utilities / magicasm / assembler / h / vars < prev   
Encoding:
Text File  |  1998-04-14  |  6.4 KB  |  230 lines

  1. char rom[128][8192];
  2. int bank_offset[128];
  3. int bank_page[128];
  4. int max_bank;
  5. int bank;
  6. int page;
  7. int rsbase;
  8.  
  9. int    errcnt;            /* error counter */
  10. struct t_symbol *hash_tbl[256];    /* pointers to starting links in symtab */
  11. struct t_symbol *lablptr;        /* label pointer into symbol table */
  12. struct t_symbol *glablptr;        /* pointer to the latest defined global symbol */
  13. char hex[5];               /* hexadecimal character buffer */
  14. int    loccnt;                /* location counter    */
  15. int    nxt_free;            /* next free location in symtab */
  16. int    opflg;                /* operation code flags */
  17. int    opval;                /* operation code value */
  18. int    optype;                /* operation code type */
  19. int    pass;                /* pass counter        */
  20. char prlnbuf[LAST_CH_POS+1]; /* print line buffer    */
  21. int    sflag;                /* symbol table output flag */
  22. int    slnum;                /* source line number counter */
  23. char symbol[SBOLSZ+1];    /* temporary symbol storage    */
  24. int    undef;                /* undefined symbol in expression flg  */
  25. int    value;                /* operand field value */
  26. int clist;                /* listing on/off */
  27. int mlist;                /* macro listing on/off */
  28. int xlist;                /* flag for listing file */
  29.  
  30. int opvaltab[6][16] = {
  31.     0x08, 0x08, 0x04, 0x14, 0x14, 0x11, 0x00, 0x10,
  32.     0x0C, 0x1C, 0x18, 0x2C, 0x3C, 0x00, 0x00, 0x00,
  33. /* -- */
  34.     0x00, 0x00, 0x04, 0x14, 0x14, 0x00, 0x00, 0x00,    /*  CPX CPY LDX LDY */
  35.     0x0C, 0x1C, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00,    /*  ST0 ST1 ST2 TAM TMA */
  36. /* -- */
  37.     0x00, 0x89, 0x24, 0x34, 0x00, 0x00, 0x00, 0x00,    /*  BIT */
  38.     0x2C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  39. /* -- */
  40.     0x3A, 0x00, 0xC6, 0xD6, 0x00, 0x00, 0x00, 0x00,    /*  DEC */
  41.     0xCE, 0xDE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  42. /* -- */
  43.     0x1A, 0x00, 0xE6, 0xF6, 0x00, 0x00, 0x00, 0x00,    /*  INC */
  44.     0xEE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  45. /* -- */
  46.     0x00, 0x00, 0x64, 0x74, 0x00, 0x00, 0x00, 0x00,    /*  STZ */
  47.     0x9C, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  48. };
  49.  
  50. struct t_opcode optab[176] =        /* nmemonic  operation code table    */
  51. {
  52.     {"ADC",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x61,0},
  53.     {"AND",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x21,0},
  54.     {"ASL",ACC|ZP|ZP_X|ABS|ABS_X,0x02,0},
  55.     {"BBR0",CLASS5,0x0f,0},
  56.     {"BBR1",CLASS5,0x1f,0},
  57.     {"BBR2",CLASS5,0x2f,0},
  58.     {"BBR3",CLASS5,0x3f,0},
  59.     {"BBR4",CLASS5,0x4f,0},
  60.     {"BBR5",CLASS5,0x5f,0},
  61.     {"BBR6",CLASS5,0x6f,0},
  62.     {"BBR7",CLASS5,0x7f,0},
  63.     {"BBS0",CLASS5,0x8f,0},
  64.     {"BBS1",CLASS5,0x9f,0},
  65.     {"BBS2",CLASS5,0xaf,0},
  66.     {"BBS3",CLASS5,0xbf,0},
  67.     {"BBS4",CLASS5,0xcf,0},
  68.     {"BBS5",CLASS5,0xdf,0},
  69.     {"BBS6",CLASS5,0xef,0},
  70.     {"BBS7",CLASS5,0xff,0},
  71.     {"BCC",CLASS2,0x90,0},
  72.     {"BCS",CLASS2,0xb0,0},
  73.     {"BEQ",CLASS2,0xf0,0},
  74.     {"BIT",IMM|ZP|ZP_X|ABS|ABS_X,0x00,2},
  75.     {"BMI",CLASS2,0x30,0},
  76.     {"BNE",CLASS2,0xd0,0},
  77.     {"BPL",CLASS2,0x10,0},
  78.     {"BRA",CLASS2,0x80,0},
  79.     {"BRK",CLASS1,0x00,0},
  80.     {"BSR",CLASS2,0x44,0},
  81.     {"BVC",CLASS2,0x50,0},
  82.     {"BVS",CLASS2,0x70,0},
  83.     {"CLA",CLASS1,0x62,0},
  84.     {"CLC",CLASS1,0x18,0},
  85.     {"CLD",CLASS1,0xd8,0},
  86.     {"CLI",CLASS1,0x58,0},
  87.     {"CLV",CLASS1,0xb8,0},
  88.     {"CLX",CLASS1,0x82,0},
  89.     {"CLY",CLASS1,0xc2,0},
  90.     {"CMP",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0xc1,0},
  91.     {"CPX",IMM|ZP|ABS,0xe0,1},
  92.     {"CPY",IMM|ZP|ABS,0xc0,1},
  93.     {"CSH",CLASS1,0xd4,0},
  94.     {"CSL",CLASS1,0x54,0},
  95.     {"DEC",ACC|ZP|ZP_X|ABS|ABS_X,0x00,3},
  96.     {"DEX",CLASS1,0xca,0},
  97.     {"DEY",CLASS1,0x88,0},
  98.     {"EOR",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x41,0},
  99.     {"INC",ACC|ZP|ZP_X|ABS|ABS_X,0x00,4},
  100.     {"INX",CLASS1,0xe8,0},
  101.     {"INY",CLASS1,0xc8,0},
  102.     {"JMP",ABS|ABS_IND|ABS_IND_X,0x40,0},
  103.     {"JSR",ABS,0x14,0},
  104.     {"LDA",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0xa1,0},
  105.     {"LDX",IMM|ZP|ZP_Y|ABS|ABS_Y,0xa2,1},
  106.     {"LDY",IMM|ZP|ZP_X|ABS|ABS_X,0xa0,1},
  107.     {"LSR",ACC|ZP|ZP_X|ABS|ABS_X,0x42,0},
  108.     {"NOP",CLASS1,0xea,0},
  109.     {"ORA",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x01,0},
  110.     {"PHA",CLASS1,0x48,0},
  111.     {"PHP",CLASS1,0x08,0},
  112.     {"PHX",CLASS1,0xDA,0},
  113.     {"PHY",CLASS1,0x5A,0},
  114.     {"PLA",CLASS1,0x68,0},
  115.     {"PLP",CLASS1,0x28,0},
  116.     {"PLX",CLASS1,0xFA,0},
  117.     {"PLY",CLASS1,0x7A,0},
  118.     {"RMB0",ZP,0x03,0},
  119.     {"RMB1",ZP,0x13,0},
  120.     {"RMB2",ZP,0x23,0},
  121.     {"RMB3",ZP,0x33,0},
  122.     {"RMB4",ZP,0x43,0},
  123.     {"RMB5",ZP,0x53,0},
  124.     {"RMB6",ZP,0x63,0},
  125.     {"RMB7",ZP,0x73,0},
  126.     {"ROL",ACC|ZP|ZP_X|ABS|ABS_X,0x22,0},
  127.     {"ROR",ACC|ZP|ZP_X|ABS|ABS_X,0x62,0},
  128.     {"RTI",CLASS1,0x40,0},
  129.     {"RTS",CLASS1,0x60,0},
  130.     {"SAX",CLASS1,0x22,0},
  131.     {"SAY",CLASS1,0x42,0},
  132.     {"SBC",IMM|ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0xe1,0},
  133.     {"SEC",CLASS1,0x38,0},
  134.     {"SED",CLASS1,0xf8,0},
  135.     {"SEI",CLASS1,0x78,0},
  136.     {"SET",CLASS1,0xf4,0},
  137.     {"SMB0",ZP,0x83,0},
  138.     {"SMB1",ZP,0x93,0},
  139.     {"SMB2",ZP,0xA3,0},
  140.     {"SMB3",ZP,0xB3,0},
  141.     {"SMB4",ZP,0xC3,0},
  142.     {"SMB5",ZP,0xD3,0},
  143.     {"SMB6",ZP,0xE3,0},
  144.     {"SMB7",ZP,0xF3,0},
  145.     {"ST0",IMM,0x03,1},
  146.     {"ST1",IMM,0x13,1},
  147.     {"ST2",IMM,0x23,1},
  148.     {"STA",ZP|ZP_X|ZP_IND|ZP_IND_X|ZP_IND_Y|ABS|ABS_X|ABS_Y,0x81,0},
  149.     {"STX",ZP|ZP_Y|ABS,0x82,0},
  150.     {"STY",ZP|ZP_X|ABS,0x80,0},
  151.     {"STZ",ZP|ZP_X|ABS|ABS_X,0x00,5},
  152.     {"SXY",CLASS1,0x02,0},
  153.     {"TAI",CLASS6,0xf3,0},
  154.     {"TAM",CLASS8,0x53,0},
  155.     {"TAM0",CLASS3,0x53,0x01},
  156.     {"TAM1",CLASS3,0x53,0x02},
  157.     {"TAM2",CLASS3,0x53,0x04},
  158.     {"TAM3",CLASS3,0x53,0x08},
  159.     {"TAM4",CLASS3,0x53,0x10},
  160.     {"TAM5",CLASS3,0x53,0x20},
  161.     {"TAM6",CLASS3,0x53,0x40},
  162.     {"TAM7",CLASS3,0x53,0x80},
  163.     {"TAX",CLASS1,0xaa,0},
  164.     {"TAY",CLASS1,0xa8,0},
  165.     {"TDD",CLASS6,0xc3,0},
  166.     {"TIA",CLASS6,0xe3,0},
  167.     {"TII",CLASS6,0x73,0},
  168.     {"TIN",CLASS6,0xd3,0},
  169.     {"TMA",CLASS8,0x43,0},
  170.     {"TMA0",CLASS3,0x43,0x01},
  171.     {"TMA1",CLASS3,0x43,0x02},
  172.     {"TMA2",CLASS3,0x43,0x04},
  173.     {"TMA3",CLASS3,0x43,0x08},
  174.     {"TMA4",CLASS3,0x43,0x10},
  175.     {"TMA5",CLASS3,0x43,0x20},
  176.     {"TMA6",CLASS3,0x43,0x40},
  177.     {"TMA7",CLASS3,0x43,0x80},
  178.     {"TRB",ZP|ABS,0x10,0},
  179.     {"TSB",ZP|ABS,0x00,0},
  180.     {"TST",CLASS7,0x00,0},
  181.     {"TSX",CLASS1,0xba,0},
  182.     {"TXA",CLASS1,0x8a,0},
  183.     {"TXS",CLASS1,0x9a,0},
  184.     {"TYA",CLASS1,0x98,0},
  185.  
  186.     {"=",PSEUDO,2,0},
  187.  
  188.     {"BANK",PSEUDO,5,0},
  189.     {"DB",PSEUDO,0,0},
  190.     {"DW",PSEUDO,1,0},
  191.     {"ENDM",PSEUDO,12,0},
  192.     {"EQU",PSEUDO,2,0},
  193.     {"INCBIN",PSEUDO,6,0},
  194.     {"INCLUDE",PSEUDO,7,0},
  195.     {"INCCHR",PSEUDO,8,0xEA},
  196.     {"INCSPR",PSEUDO,9,0xEA},
  197.     {"INCPAL",PSEUDO,10,0xF8},
  198.     {"LIST",PSEUDO,13,0},
  199.     {"MACRO",PSEUDO,11,0},
  200.     {"MLIST",PSEUDO,14,0},
  201.     {"NOLIST",PSEUDO,15,0},
  202.     {"NOMLIST",PSEUDO,16,0},
  203.     {"ORG",PSEUDO,4,0},
  204.     {"PAGE",PSEUDO,3,0},
  205.     {"RSSET",PSEUDO,17,0},
  206.     {"RS",PSEUDO,18,0},
  207.  
  208.     {".BANK",PSEUDO,5,0},
  209.     {".DB",PSEUDO,0,0},
  210.     {".DW",PSEUDO,1,0},
  211.     {".ENDM",PSEUDO,12,0},
  212.     {".EQU",PSEUDO,2,0},
  213.     {".INCBIN",PSEUDO,6,0},
  214.     {".INCLUDE",PSEUDO,7,0},
  215.     {".INCCHR",PSEUDO,8,0xEA},
  216.     {".INCSPR",PSEUDO,9,0xEA},
  217.     {".INCPAL",PSEUDO,10,0xF8},
  218.     {".LIST",PSEUDO,13,0},
  219.     {".MACRO",PSEUDO,11,0},
  220.     {".MLIST",PSEUDO,14,0},
  221.     {".NOLIST",PSEUDO,15,0},
  222.     {".NOMLIST",PSEUDO,16,0},
  223.     {".ORG",PSEUDO,4,0},
  224.     {".PAGE",PSEUDO,3,0},
  225.     {".RSSET",PSEUDO,17,0},
  226.     {".RS",PSEUDO,18,0},
  227.     {NULL,0,0}
  228. };
  229.  
  230.