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

📄 outas68.c

📁 CC386 is a general-purpose 32-bit C compiler. It is not an optimizing compiler but given that the co
💻 C
📖 第 1 页 / 共 5 页
字号:
    {
        "fsult", op_fsult, OPE_SET
    }
    , 
    {
        "fsolt", op_fsolt, OPE_SET
    }
    , 
    {
        "fsuge", op_fsuge, OPE_SET
    }
    , 
    {
        "fsole", op_fsole, OPE_SET
    }
    , 
    {
        "fsugt", op_fsugt, OPE_SET
    }
    , 
    {
        "fsogl", op_fsogl, OPE_SET
    }
    , 
    {
        "fsueq", op_fsueq, OPE_SET
    }
    , 
    {
        "fsor", op_fsor, OPE_SET
    }
    , 
    {
        "fsun", op_fsun, OPE_SET
    }
    , 
    {
        "fst", op_fst, OPE_SET
    }
    , 
    {
        "fsf", op_fsf, OPE_SET
    }
    , 
    {
        "fsst", op_fsst, OPE_SET
    }
    , 
    {
        "fssf", op_fssf, OPE_SET
    }
    , 
    {
        "fsseq", op_fsseq, OPE_SET
    }
    , 
    {
        "fssne", op_fssne, OPE_SET
    }
    , 
    {
        "fsgldiv", op_fsgldiv, OPE_FMATHX
    }
    , 
    {
        "fsglmul", op_fsglmul, OPE_FMATHX
    }
    , 
    {
        "fsin", op_fsin, OPE_FMATH
    }
    , 
    {
        "fsincos", op_fsincos, OPE_FSINCOS
    }
    , 
    {
        "fsinh", op_fsinh, OPE_FMATH
    }
    , 
    {
        "fsqrt", op_fsqrt, OPE_FMATH
    }
    , 
    {
        "fsub", op_fsub, OPE_FMATHX
    }
    , 
    {
        "ftan", op_ftan, OPE_FMATH
    }
    , 
    {
        "ftanh", op_ftanh, OPE_FMATH
    }
    , 
    {
        "ftentox", op_ftentox, OPE_FMATH
    }
    , 
    {
        "ftrapeq", op_ftrapeq, OPE_TRAPcc
    }
    , 
    {
        "ftrapne", op_ftrapne, OPE_TRAPcc
    }
    , 
    {
        "ftrapgt", op_ftrapgt, OPE_TRAPcc
    }
    , 
    {
        "ftrapngt", op_ftrapngt, OPE_TRAPcc
    }
    , 
    {
        "ftrapge", op_ftrapge, OPE_TRAPcc
    }
    , 
    {
        "ftrapnge", op_ftrapnge, OPE_TRAPcc
    }
    , 
    {
        "ftraplt", op_ftraplt, OPE_TRAPcc
    }
    , 
    {
        "ftrapnlt", op_ftrapnlt, OPE_TRAPcc
    }
    , 
    {
        "ftraple", op_ftraple, OPE_TRAPcc
    }
    , 
    {
        "ftrapnle", op_ftrapnle, OPE_TRAPcc
    }
    , 
    {
        "ftrapgl", op_ftrapgl, OPE_TRAPcc
    }
    , 
    {
        "ftrapngl", op_ftrapngl, OPE_TRAPcc
    }
    , 
    {
        "ftrapgle", op_ftrapgle, OPE_TRAPcc
    }
    , 
    {
        "ftrapngle", op_ftrapngle, OPE_TRAPcc
    }
    , 
    {
        "ftrapogt", op_ftrapogt, OPE_TRAPcc
    }
    , 
    {
        "ftrapule", op_ftrapule, OPE_TRAPcc
    }
    , 
    {
        "ftrapoge", op_ftrapoge, OPE_TRAPcc
    }
    , 
    {
        "ftrapult", op_ftrapult, OPE_TRAPcc
    }
    , 
    {
        "ftrapolt", op_ftrapolt, OPE_TRAPcc
    }
    , 
    {
        "ftrapuge", op_ftrapuge, OPE_TRAPcc
    }
    , 
    {
        "ftrapole", op_ftrapole, OPE_TRAPcc
    }
    , 
    {
        "ftrapugt", op_ftrapugt, OPE_TRAPcc
    }
    , 
    {
        "ftrapogl", op_ftrapogl, OPE_TRAPcc
    }
    , 
    {
        "ftrapueq", op_ftrapueq, OPE_TRAPcc
    }
    , 
    {
        "ftrapor", op_ftrapor, OPE_TRAPcc
    }
    , 
    {
        "ftrapun", op_ftrapun, OPE_TRAPcc
    }
    , 
    {
        "ftrapt", op_ftrapt, OPE_TRAPcc
    }
    , 
    {
        "ftrapf", op_ftrapf, OPE_TRAPcc
    }
    , 
    {
        "ftrapst", op_ftrapst, OPE_TRAPcc
    }
    , 
    {
        "ftrapsf", op_ftrapsf, OPE_TRAPcc
    }
    , 
    {
        "ftrapseq", op_ftrapseq, OPE_TRAPcc
    }
    , 
    {
        "ftrapsne", op_ftrapsne, OPE_TRAPcc
    }
    , 
    {
        "ftst", op_ftst, OPE_FONE
    }
    , 
    {
        "ftwotox", op_ftwotox, OPE_FMATH
    }
    , 
    {
        0, 0, 0
    }
    , 
};
void dump_muldivval(void){}
void dump_browsedata(unsigned char *data, int len)
{
    if (!prm_asmfile)
        outcode_dump_browsedata(data, len);
}

/* Init module */
void outcodeini(void)
{
    strtab = 0;
    gentype = nogen;
    curseg = noseg;
    outcol = 0;
    datahead = datatail = 0;
    mpthunklist = 0;
}

/*
 * Register a fixup 
 */
void datalink(int flag)
{
    DATALINK *p;
    if (!prm_datarel)
        return ;
    global_flag++; /* Global tab */
    p = xalloc(sizeof(DATALINK));
    p->sp = datasp;
    p->type = flag;
    p->offset = dataofs;
    p->next = 0;
    if (datahead)
    {
        datatail->next = p;
        datatail = datatail->next;
    }
    else
        datahead = datatail = p;
    global_flag--;
}

//-------------------------------------------------------------------------

void nl(void)
/*
 * New line
 */
{
    if (prm_asmfile)
    {
        if (outcol > 0)
        {
            oputc('\n', outputFile);
            outcol = 0;
            gentype = nogen;
        }
    }
}

/* Put an opcode
 */
void outop(char *name)
{
    oputc('\t', outputFile);
    while (*name)
        oputc(toupper(*name++), outputFile);
}

//-------------------------------------------------------------------------

void putop(int op)
{
    if (op > op_ftwotox)
        DIAG("illegal opcode.");
    else
        outop(oplst[op].word);
}

//-------------------------------------------------------------------------

char *dumpns(NAMESPACE *ns, char *buf, int *done)
{
    if (!ns)
        return buf;
    buf = dumpns(ns->next, buf, done);
    *done = 1;
    *buf++ = '@';
    strcpy(buf, ns->sp->name + prm_cmangle);
    buf += strlen(buf);
    return buf;
}

//-------------------------------------------------------------------------

void putsym(char *buf, SYM *sp, char *p)
{
    int done = 0;
    if (!p)
    {
        buf[0] = 0;
        return ;
    }
    if (sp->staticlabel)
        sprintf(buf, "L_%d", sp->value.i);
    else if (sp->alias)
    {
        strcpy(buf, sp->alias);
        goto reppercent;
    }
    else
    {
        char *q = buf;
        if (sp->pascaldefn)
        {
            if (prm_cmangle)
                p++;
            while (*p)
            #ifdef COLDFIRE
                    *q++ =  *p++;
            #else 
                *q++ = toupper(*p++);
            #endif 
            *q = 0;
        }
        else if (sp->isstdcall)
        {
            if (prm_cmangle)
                p++;
            strcpy(buf, p);
        }
        else
        {
            if (sp->mangled && !(sp->tp->type == bt_func || sp->tp->type ==
                bt_ifunc))
            {
                q = dumpns(sp->value.classdata.parentns, buf, &done);
                if (done)
                {
                    *q++ = '@';
                    strcpy(q, p + prm_cmangle);
                }
                else
                    strcpy(q, p);
            }
            else
                strcpy(buf, p);
            reppercent: if (prm_cplusplus)
            {
                // problematic for compiling templates via ASM and TASM
                q = buf;
                while (q = strchr(q, '#'))
                    *q = '%';
            }
        }
    }
}

//-------------------------------------------------------------------------

void putconst(ENODE *offset)
/*
 *      put a constant to the outputFile file.
 */
{
    char buf[512];
    SYM *sp;
    switch (offset->nodetype)
    {
        case en_autoreg:
        case en_autocon:
        case en_icon:
        case en_lcon:
        case en_iucon:
        case en_lucon:
        case en_ccon:
        case en_cucon:
        case en_llcon:
        case en_llucon:
        case en_absacon:
            oprintf(outputFile, "$%lX", offset->v.i);
            break;
        case en_rcon:
        case en_fcon:
        case en_lrcon:
        case en_fimaginarycon:
        case en_rimaginarycon:
        case en_lrimaginarycon:
            oprintf(outputFile, "%.16e", offset->v.f);
            break;
        case en_fcomplexcon:
        case en_rcomplexcon:
        case en_lrcomplexcon:
            oprintf(outputFile, "%.16e,%.16e", offset->v.c.r, offset->v.c.i);
            break;
        case en_nalabcon:
            oprintf(outputFile, "L_%ld", offset->v.sp->value.i);
            break;
        case en_labcon:
            oprintf(outputFile, "L_%ld", offset->v.i);
            break;
        case en_napccon:
        case en_nacon:
            sp = offset->v.sp;
            putsym(buf, sp, sp->name);
            oprintf(outputFile, "%s", buf);
            break;
        case en_add:
        case en_addstruc:
            putconst(offset->v.p[0]);
            oprintf(outputFile, "+");
            putconst(offset->v.p[1]);
            break;
        case en_sub:
            putconst(offset->v.p[0]);
            oprintf(outputFile, "-");
            putconst(offset->v.p[1]);
            break;
        case en_uminus:
            oprintf(outputFile, "-");
            putconst(offset->v.p[0]);
            break;
        default:
            DIAG("illegal constant node.");
            break;
    }
}

//-------------------------------------------------------------------------

void putlen(int l)
/*
 *      append the length field to an instruction.
 */
{
    switch (l)
    {
        case 0:
            break; /* no length field */
        case 1:
            oprintf(outputFile, ".B");
            break;
        case 2:
            oprintf(outputFile, ".W");
            break;
        case 4:
            oprintf(outputFile, ".L");
            break;
        case 7:
            oprintf(outputFile, ".S");
            break;
        case 8:
            oprintf(outputFile, ".D");
            break;
        case 10:
            oprintf(outputFile, ".X");
            break;
        default:
            DIAG("illegal length field.");
            break;
    }
}

//-------------------------------------------------------------------------

void putsize(AMODE *ap)
{
    switch (ap->sz)
    {
        case 0:
        case 4:
            oprintf(outputFile, ".L");
            break;
        case 2:
            oprintf(outputFile, ".W");
            break;
        case 1:
            oprintf(outputFile, ".B");
            break;
    }
}

//-------------------------------------------------------------------------

void putamode(AMODE *ap)
/*
 *      outputFile a general addressing mode.
 */
{
    int scale, t;
    switch (ap->mode &0x1ff)
    {
        case am_ccr:
            oprintf(outputFile, "CCR");
            break;
        case am_fpcr:
            oprintf(outputFile, "FPCR");
            break;
        case am_fpsr:
            oprintf(outputFile, "FPSR");
            break;
        case am_usp:
            oprintf(outputFile, "USP");
            break;
        case am_sfc:
            oprintf(outputFile, "SFC");
            break;
        case am_dfc:
            oprintf(outputFile, "DFC");
            break;
        case am_vbr:
            oprintf(outputFile, "VBR");
            break;
        case am_cacr:
            oprintf(outputFile, "CACR");
            break;
        case am_caar:
            oprintf(outputFile, "CAAR");
            break;
        case am_msp:
            oprintf(outputFile, "MSP");
            break;
        case am_isp:
            oprintf(outputFile, "ISP");
            break;
        case am_sr:
            oprintf(outputFile, "SR");
            break;
        case am_bf:
            oprintf(outputFile, " {%d:%d}", ap->preg, ap->sreg);
            break;
        case am_bfreg:
            oprintf(outputFile, " {D%d:D%d}", ap->preg, ap->sreg);
            break;
        case am_divsl:
            oprintf(outputFile, "D%d:D%d", ap->preg, ap->sreg);
            break;
        case am_immed:
            oprintf(outputFile, "#");
        case am_direct:
            putconst(ap->offset);
            break;
        case am_adirect:
            oputc('(', outputFile);
            putconst(ap->offset);
            oputc(')', outputFile);
            putlen(ap->preg);
            break;
        case am_areg:
            oprintf(outputFile, "A%d", ap->preg);
            break;
        case am_dreg:
            oprintf(outputFile, "D%d", ap->preg);
            break;
        case am_freg:
            oprintf(outputFile, "FP%d", ap->preg);
            break;
        case am_ind:
            oprintf(outputFile, "(A%d)", ap->preg);
            break;
        case am_ainc:
            oprintf(outputFile, "(A%d)+", ap->preg);
            break;
        case am_adec:
            oprintf(outputFile, "-(A%d)", ap->preg);
            break;
        case am_indx:
            oprintf(outputFile, "(");
            putconst(ap->offset);
            oprintf(outputFile, ",A%d)", ap->preg);
            break;
        case am_pcindx:
            oprintf(outputFile, "(");
            putconst(ap->offset);
            oprintf(outputFile, ",PC)");
            break;

⌨️ 快捷键说明

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