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

📄 simops.c

📁 CC386 is a general-purpose 32-bit C compiler. It is not an optimizing compiler but given that the co
💻 C
字号:
/* 
Copyright 2001-2003 Free Software Foundation, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  

You may contact the author at:

mailto::camille@bluegrass.net

or by snail mail at:

David Lindauer
850 Washburn Ave Apt 99
Louisville, KY 40222

 **********************************************************************

SIMOPS.C defines how the assembly language operands should look 
when displayed

 **********************************************************************

 */

#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <ctype.h>
#include "operands.h"
#include "header.h"
#include "utype.h"

BOOL useim;

void SegmentDisplay(char *buffer, long value)
{
    sprintf(buffer, "sg_%x", value);
}

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

void FormatValue(char *buffer, OPERAND *record, uint segs, uint type)
{
    char buf[256];
    DEBUG_INFO *dbg;
    char *typetab,  *symtab;
    int offset;
    buf[0] = 0;
    if (record->address)
        segs++;
    FindSymbolByAddress(&dbg, &typetab, &symtab, &offset, record->address, buf);
    switch (type)
    {
        case SY_SIGNEDOFS:
            if (record->address < 0)
                sprintf(buffer, "-os_%x", (BYTE)ABS(record->address));
            else
                sprintf(buffer, "+os_%x", (BYTE)record->address);
            break;
        case SY_WORDOFS:
            sprintf(buffer, "+ow_%lx", record->address);
            break;
        case SY_BYTEOFS:
            sprintf(buffer, "+ob_%x", (BYTE)record->address);
            break;
        case SY_ABSOLUTE:
            if (buf[0])
                sprintf(buffer, "ad_%lx:%s", record->address, buf);
            else
                sprintf(buffer, "ad_%lx", record->address);
            break;
        case SY_SIGNEDIMM:
            if (record->address < 0)
                sprintf(buffer, "-is_%x", ABS(record->address));
            else
                sprintf(buffer, "+is_%x", record->address);
            break;
        case SY_WORDIMM:
            if (useim)
                sprintf(buffer, "iw_%lx", record->address);
            else
                sprintf(buffer, "offset ad_%lx", record->address);
            break;
        case SY_BYTEIMM:
            sprintf(buffer, "ib_%x", (BYTE)(record->address));
            break;
        case SY_PORT:
            sprintf(buffer, "p_%x", (BYTE)record->address);
            break;
        case SY_INTR:
            sprintf(buffer, "it_%x", (BYTE)record->address);
            break;
        case SY_RETURN:
            sprintf(buffer, "rt_%x", (uint)record->address);
            break;
        case SY_ABSBRANCH:
            if (buf[0])
                sprintf(buffer, "ba_%lx:%s", record->address, buf);
            else
                sprintf(buffer, "ba_%lx", record->address);
            break;
        case SY_LONGBRANCH:
            if (buf[0])
                sprintf(buffer, "bl_%lx:%s", record->address, buf);
            else
                sprintf(buffer, "bl_%lx", record->address);
            break;
        case SY_SHORTBRANCH:
            if (buf[0])
                sprintf(buffer, "bs_%lx:%s", record->address, buf);
            else
                sprintf(buffer, "bs_%lx", record->address);
            break;
        case SY_SHIFT:
            sprintf(buffer, "ib_%x", (BYTE)record->address);
            break;
        case SY_SEGMENT:
            SegmentDisplay(buffer, record->segment);
            break;
    }
}

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

void AddSymbol(OPERAND *record, uint type)
{
    record++;
    type++;
}

⌨️ 快捷键说明

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