⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parse1.c

📁 地球模拟器
💻 C
📖 第 1 页 / 共 2 页
字号:
    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    a = ad(ce->c.ip + 1); /* a = address of start of template */    while(1) /* find size of template, s = size */    {   #if PLOIDY == 1	if(soup[ad(a + s)].inst != Nop0 &&           soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */	if(soup[ad(a + s)][ce->d.tr].inst != Nop0 &&           soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */            break;        s++;    }    is.dreg  = &(ce->c.ip); /* destination register for address */    is.dreg2 = &(ce->c.re[3]); /* destination register for template size */    is.dreg3 = &BitBucket;    is.sval  = a;  /* if template size == 0, increment IP */    is.sval2 = s;  /* size of template */    is.sval3 = Search_limit;    is.dmod  = SoupSize;    is.dran2 = SoupSize;    is.dval  = ad(a + s + 1); /* start address for forward search */    is.dval2 = ad(a - s - 1); /* start address for backward search */    is.mode  = 2; /* backward jump */    is.mode2 = 2;    is.dib = 1;    is.iip = 0;}/* void tcall(ce) adr(ce); push(ce); *//* void adr(ce) find address of a template * is.mode  = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 =  preference: 1 = forward, 2 = backward, and return for *        direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval  = starting address for forward search * is.dval2 = starting address for backward search * is.dreg  = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval  = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod  = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran  = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 *//* void push(ce) ce->c.sp = ++ce->c.sp % STACK_SIZE; *               ce->c.st[ce->c.sp] = is.sval + flaw(ce); * is.sval = value to be pushed onto the stack */void ptcall(ce) /* push ip to stack, outward template jump */Pcells  ce;     /* this maps to adr followed by push */{   I32s    a, s = 0;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    a = ad(ce->c.ip + 1); /* a = address of start of template */    while(1) /* find size of template, s = size */    {#if PLOIDY == 1	if(soup[ad(a + s)].inst != Nop0 &&           soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */	if(soup[ad(a + s)][ce->d.tr].inst != Nop0 &&           soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */            break;        s++;    }    is.dreg  = &(ce->c.ip); /* destination register for address */    is.dreg2 = &(ce->c.re[3]); /* destination register for template size */    is.dreg3 = &BitBucket;    is.sval  = ad(ce->c.ip + s + 1);    /* address to be pushed onto stack */    is.sval2 = s;  /* size of template */    is.sval3 = Search_limit;    is.dmod  = SoupSize;    is.dran2 = SoupSize;    is.dval  = ad(a + s + 1); /* start address for forward search */    is.dval2 = ad(a - s - 1); /* start address for backward search */    is.mode  = 0; /* outward jump */    is.mode2 = 1;    is.dib = 1;    is.iip = 0;}/* void pop(ce) *(is.dreg) = ce->c.st[ce->c.sp] + flaw(ce); *              if (!ce->c.sp) ce->c.sp = STACK_SIZE - 1; else --ce->c.sp; * is.dreg = destination register, where value popped off stack will go * is.dmod = value by which to modulus destination register * is.dran = range within which to contain destination register */void pret(ce) /* pop ip from stack */Pcells  ce;{   is.iip = is.dib = 1;    if (is.eins->exec)        return ;    is.dreg = &(ce->c.ip);    is.dmod = SoupSize;    is.iip = 0; is.dib = 1;}/* void movdd(ce) *(is.dreg) = is.sval + flaw(ce); * is.dreg = destination register, where moved value will be placed * is.sval = value to be placed in the dest reg * is.dmod = value by which to modulus destination register * is.dran = range within which to contain destination register */void pmovdc(ce) /* dx = cx */Pcells  ce;{   I32s  treg;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    treg = 3 + flaw(ce);    is.dreg = &(ce->c.re[mo(treg, NUMREG)]);    treg = 2 + flaw(ce);    is.sval = ce->c.re[mo(treg, NUMREG)];    is.iip = is.dib = 1;    if (is.dreg == &(ce->c.re[0]) || is.dreg == &(ce->c.re[1]))        is.dmod = SoupSize;    else        is.dran = SoupSize;}/* void movdd(ce) *(is.dreg) = is.sval + flaw(ce); * is.dreg = destination register, where moved value will be placed * is.sval = value to be placed in the dest reg * is.dmod = value by which to modulus destination register * is.dran = range within which to contain destination register */void pmovba(ce) /* bx = ax */Pcells  ce;{   I32s  treg;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    treg = 1 + flaw(ce);    is.dreg = &(ce->c.re[mo(treg, NUMREG)]);    treg = 0 + flaw(ce);    is.sval = ce->c.re[mo(treg, NUMREG)];    is.iip = is.dib = 1;    if (is.dreg == &(ce->c.re[0]) || is.dreg == &(ce->c.re[1]))        is.dmod = SoupSize;    else        is.dran = SoupSize;}/* void movii(ce) is.dins->inst = is.sins->inst; * is.dval  = address of destination instruction * is.dins  = pointer to destination instruction * is.sval  = address of source instruction * is.sins  = pointer to source instruction * is.dtra  = track of destination instruction * is.sval2 = original value of destination instruction */void pmovii(ce)Pcells  ce;{   I32s  tval;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    tval = ce->c.re[0] + flaw(ce);    is.dval = ad(tval);    tval = ce->c.re[1] + flaw(ce);    is.sval = ad(tval);#if PLOIDY == 1    is.dins = &soup[is.dval];    is.sins = &soup[is.sval];#else /* PLOIDY > 1 */    is.dins = &soup[is.dval][ce->d.tr];    is.sins = &soup[is.sval][ce->d.tr];#endif /* PLOIDY > 1 */    is.sval2 = is.dins->inst;    is.dtra = ce->d.tr;    is.iip = is.dib = 1;#ifdef HSEX    if (ce->d.x_over_addr)       {       if ((!ce->d.mov_daught) && (!FindMate(ce)))          ce->d.x_over_addr = ce->d.mate_addr = 0;       else UseMate(ce);       }#endif}/* void adr(ce) find address of a template * is.mode  = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 =  preference: 1 = forward, 2 = backward, and return for *        direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval  = starting address for forward search * is.dval2 = starting address for backward search * is.dreg  = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval  = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod  = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran  = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 */void padr(ce) /* search outward for template, return address in ax */Pcells  ce; /* return template size in cx */{   I32s    a, s = 0;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    a = ad(ce->c.ip + 1); /* a = address of start of template */    while(1) /* find size of template, s = size */    {#if PLOIDY == 1	if(soup[ad(a + s)].inst != Nop0 &&           soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */	if(soup[ad(a + s)][ce->d.tr].inst != Nop0 &&           soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */            break;        s++;    }    is.dreg  = &(ce->c.re[0]); /* destination register for address */    is.dreg2 = &(ce->c.re[2]); /* destination register for template size */    is.dreg3 = &BitBucket; /* throw away offset */    is.sval2 = s;  /* size of template */    is.sval3 = Search_limit;    is.dmod  = SoupSize;    is.dran2 = SoupSize;    is.dval  = ad(a + s + 1); /* start address for forward search */    is.dval2 = ad(a - s - 1); /* start address for backward search */    is.mode  = 0; /* outward jump */    is.mode2 = 1;    is.iip = s + 1; is.dib = 1;    if (!s)        is.dreg  = &BitBucket; /* dump return value if template size == 0 */}/* void adr(ce) find address of a template * is.mode  = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 =  preference: 1 = forward, 2 = backward, and return for *        direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval  = starting address for forward search * is.dval2 = starting address for backward search * is.dreg  = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval  = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod  = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran  = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 */void padrb(ce) /* search backward for template, return address in ax */Pcells  ce; /* return template size in cx */{   I32s    a, s = 0;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    a = ad(ce->c.ip + 1); /* a = address of start of template */    while(1) /* find size of template, s = size */    {#if PLOIDY == 1	if(soup[ad(a + s)].inst != Nop0 &&           soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */	if(soup[ad(a + s)][ce->d.tr].inst != Nop0 &&           soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */            break;        s++;    }    is.dreg  = &(ce->c.re[0]); /* destination register for address */    is.dreg2 = &(ce->c.re[2]); /* destination register for template size */    is.dreg3 = &BitBucket; /* throw away offset */    is.sval2 = s;  /* size of template */    is.sval3 = Search_limit;    is.dmod  = SoupSize;    is.dran2 = SoupSize;    is.dval  = ad(a + s + 1); /* start address for forward search */    is.dval2 = ad(a - s - 1); /* start address for backward search */    is.mode  = 2; /* backward jump */    is.mode2 = 2;    is.iip = s + 1; is.dib = 1;    if (!s)        is.dreg  = &BitBucket; /* dump return value if template size == 0 */}/* void adr(ce) find address of a template * is.mode  = search mode: 1 = forward, 2 = backward, 0 = outward * is.mode2 =  preference: 1 = forward, 2 = backward, and return for *        direction found: 1 = forward, 2 = backward, 3 = both, 0 = none * is.dval  = starting address for forward search * is.dval2 = starting address for backward search * is.dreg  = destination register where target address will be stored * is.dreg2 = destination register where template size will be stored * is.dreg3 = destination register where offset of target will be stored * is.sval  = return address if template size = 0 * is.sval2 = template size, 0 = no template * is.sval3 = search limit, and return for distance actually searched * is.dmod  = modulus value for is.dreg * is.dmod2 = modulus value for is.dreg2 * is.dmod3 = modulus value for is.dreg3 * is.dran  = range to maintain for is.dreg * is.dran2 = range to maintain for is.dreg2 * is.dran3 = range to maintain for is.dreg3 */void padrf(ce) /* search forward for template, return address in ax */Pcells  ce; /* return template size in cx */{   I32s    a, s = 0;    is.iip = is.dib = 1;    if (is.eins->exec)        return ;    a = ad(ce->c.ip + 1); /* a = address of start of template */    while(1) /* find size of template, s = size */    {#if PLOIDY == 1	if(soup[ad(a + s)].inst != Nop0 &&           soup[ad(a + s)].inst != Nop1)#else /* PLOIDY > 1 */	if(soup[ad(a + s)][ce->d.tr].inst != Nop0 &&           soup[ad(a + s)][ce->d.tr].inst != Nop1)#endif /* PLOIDY > 1 */            break;        s++;    }    is.dreg  = &(ce->c.re[0]); /* destination register for address */    is.dreg2 = &(ce->c.re[2]); /* destination register for template size */    is.dreg3 = &BitBucket; /* throw away offset */    is.sval2 = s;  /* size of template */    is.sval3 = Search_limit;    is.dmod  = SoupSize;    is.dran2 = SoupSize;    is.dval  = ad(a + s + 1); /* start address for forward search */    is.dval2 = ad(a - s - 1); /* start address for backward search */    is.mode  = 1; /* forward jump */    is.mode2 = 1;    is.iip = s + 1; is.dib = 1;    if (!s)        is.dreg  = &BitBucket; /* dump return value if template size == 0 */}/* void malchm(ce) is.sval2 = mal(ce,&is.sval3,is.sval,is.mode2); *                 *(is.dreg) = is.sval3; *                 chmode(ce,is.sval3,is.sval2,is.mode); * is.dreg  = destination register where allocated address is stored * is.sval  = requested size of block for mal() * is.sval2 = flawed size of block * is.sval3 = suggested address, and allocated address * is.mode  = memory protection mode (rwx), probably MemModeProt * is.mode2 = memory allocation mode for mal() */void pmal(ce)  /* allocate space for a new cell */Pcells  ce;  /* allocate space for a new cell */{   is.iip = is.dib = 1;    if (is.eins->exec)        return ;    is.dreg  = &(ce->c.re[0]);    is.sval  = ce->c.re[2];    is.sval3 = -1;    is.mode  = MemModeProt; /* only write privelages works at the moment */    is.mode2 = MalMode;}/* void divide(ce) cell division * is.sval  = offset of IP into daughter's genome * is.sval2 = eject genome from soup = 0, 1 = leave in soup * is.mode  = divide mode (3 steps) */void pdivide(ce)  /* give life to new cell by puting in queue */Pcells  ce;{   is.iip = is.dib = 1;    if (is.eins->exec)        return ;    is.mode = 2;  /* full division */}#endif  /* end of INST 1 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -