Annotation of researchv10dc/cmd/kasb/kas2.c, revision 1.1.1.1

1.1       root        1: /* @(#)kas2.c  1.2 */
                      2: #include <stdio.h>
                      3: #include "kas.h"
                      4: #include "kas.yh"
                      5: #define OP(a,b,c)  {a,b|XTAG,c}
                      6: #define R(a,b) {a,REG|XTAG,b}
                      7: #define RL(a,b)        {a,REGL|XTAG,b}
                      8: #define RH(a,b)        {a,REGH|XTAG,b}
                      9: #define M(a,b) {a,DEBUG|XTAG,b}
                     10: #define P(a,b) {a,PAGE|XTAG,b}
                     11: struct symtab instab[] = {
                     12: OP("mov", MVINS, 0),
                     13: OP("inc", SFINS, (3<<4)),
                     14: OP("adc", SFINS, (4<<4)),
                     15: OP("asl", SFINS, (5<<4)),
                     16: OP("aslc", SFINS, (6<<4)),
                     17: OP("dec", SFINS, (7<<4)),
                     18: OP("add", DFINS, (0<<4)),
                     19: OP("addc", DFINS, (1<<4)),
                     20: OP("subc", DFINS, (2<<4)),
                     21: OP("orn", DFINS, (10<<4)),
                     22: OP("and", DFINS, (11<<4)),
                     23: OP("or", DFINS, (12<<4)),
                     24: OP("xor", DFINS, (13<<4)),
                     25: OP("sub", DFINS, (14<<4)),
                     26: OP("addn", DFINS, (15<<4)),
                     27: OP("jmp", JMPINS, (0<<8)|0100000),
                     28: OP("br", BRINS, (1<<8)|0100000),
                     29: OP("brc", BRINS, (2<<8)|0100000),
                     30: OP("brz", BRINS, (3<<8)|0100000),
                     31: OP("br0", BRINS, (4<<8)|0100000),
                     32: OP("br1", BRINS, (5<<8)|0100000),
                     33: OP("br4", BRINS, (6<<8)|0100000),
                     34: OP("br7", BRINS, (7<<8)|0100000),
                     35: R("r0", 0),
                     36: R("r1", 1),
                     37: R("r2", 2),
                     38: R("r3", 3),
                     39: R("r4", 4),
                     40: R("r5", 5),
                     41: R("r6", 6),
                     42: R("r7", 7),
                     43: R("r8", 8),
                     44: R("r9", 9),
                     45: R("r10", 10),
                     46: R("r11", 11),
                     47: R("r12", 12),
                     48: R("r13", 13),
                     49: R("r14", 14),
                     50: R("r15", 15),
                     51: {"mem", MEM|XTAG, 0},
                     52: {"brg", BRG|XTAG, 0},
                     53: {"mar", MAR|XTAG, 0},
                     54: {"pc", PC|XTAG, 0},
                     55: {"pcr", PCR|XTAG, 0},
                     56: RL("idl", 0),
                     57: RL("idh", 1),
                     58: RL("odl", 2),
                     59: RL("odh", 3),
                     60: RL("ial", 4),
                     61: RL("iah", 5),
                     62: RL("oal", 6),
                     63: RL("oah", 7),
                     64: RL("lur0", 8+0),
                     65: RL("lur1", 8+1),
                     66: RL("lur2", 8+2),
                     67: RL("lur3", 8+3),
                     68: RL("lur4", 8+4),
                     69: RL("lur5", 8+5),
                     70: RL("lur6", 8+6),
                     71: RL("lur7", 8+7),
                     72: RH("csr0", 0),
                     73: RH("csr1", 1),
                     74: RH("csr2", 2),
                     75: RH("csr3", 3),
                     76: RH("csr4", 4),
                     77: RH("csr5", 5),
                     78: RH("csr6", 6),
                     79: RH("csr7", 7),
                     80: RH("npr", 8+0),
                     81: RH("nprx", 8+1),
                     82: P("p0",0),
                     83: P("p1",1<<11),
                     84: P("p2",2<<11),
                     85: P("p3",3<<11),
                     86: {".", XTEXT, 0},
                     87: {".text", SEG|XTAG, XTEXT},
                     88: {".data", SEG|XTAG, XDATA},
                     89: {".org", ORG|XTAG, 0},
                     90: {".byte", DATA|XTAG, 1},
                     91: {".word", DATA|XTAG, 2},
                     92: M(".load", DLOAD),
                     93: M(".dump", DDUMP),
                     94: M(".step", DSTEP),
                     95: M(".run", DRUN),
                     96: M(".reset", DRESET),
                     97: M(".wcsr", DWCSR),
                     98: M(".clear", DCLEAR),
                     99: M(".stop", DSTOP),
                    100: M(".regs", DREGS),
                    101: 0,
                    102: };
                    103: 
                    104: struct symtab  symtab[NSYM];
                    105: struct symtab  *hshtab[NHASH];
                    106: struct symtab  loclab[10];
                    107: struct symtab  *dot;
                    108: int    tsize;
                    109: int    dsize;
                    110: int    anyerrs;
                    111: int    textsv, datasv;
                    112: char   dbmode;
                    113: char   *outfile, *dbfile, *infile;
                    114: int    dbfd;
                    115: int    dbtab[3];
                    116: char   dbstr[50], instr[50];
                    117: short  ispace[NKMCI], reloc[NKMCI];
                    118: char   dspace[NKMCD];
                    119: struct ir ir;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.