📄 outco386.c
字号:
/*
Copyright 1994-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.
This program is derived from the cc68k complier by
Matthew Brandt (mattb@walkingdog.net)
You may contact the author of this derivative at:
mailto::camille@bluegrass.net
or by snail mail at:
David Lindauer
850 Washburn Ave Apt 99
Louisville, KY 40222
*/
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "lists.h"
#include "expr.h"
#include "c.h"
#include "gen386.h"
#include "diag.h"
#include "lists.h"
#define FULLVERSION
extern MULDIV *muldivlink;
extern struct slit *strtab;
extern ASMNAME oplst[];
extern int global_flag;
extern enum e_sg curseg;
extern SYM *currentfunc;
extern int prm_asmfile;
extern DBGBLOCK *DbgBlocks[];
extern int prm_debug;
int outcode_base_address;
EMIT_TAB segs[MAX_SEGS];
LINEBUF *linelist, *linetail;
VIRTUAL_LIST *virtualFirst, *virtualLast;
static LABEL **labelbuf;
//char segregs[] = "CSDSESFSGSSS";
static unsigned char segoverxlattab[] =
{
0x3e, 0x2e, 0x3e, 0x26, 0x64, 0x65, 0x36
};
static unsigned char segtab[] =
{
0x18, 0x8, 0x18, 0x0, 0x20, 0x28, 0x10
};
OPCODE popn_aaa[] =
{
{
OP_CODEONLY, 0x0037, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_aad[] =
{
{
OP_CODEONLY, 0x0ad5, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_aam[] =
{
{
OP_CODEONLY, 0x0ad4, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_aas[] =
{
{
OP_CODEONLY, 0x003f, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_adc[] =
{
{
OP_RMIMMSIGNED, 0x1080, 0x0200
}
,
{
OP_ACCIMM, 0x0014, 0x0000
}
,
{
OP_REGRMREG, 0x0010, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_add[] =
{
{
OP_RMIMMSIGNED, 0x0080, 0x0200
}
,
{
OP_ACCIMM, 0x0004, 0x0000
}
,
{
OP_REGRMREG, 0x0000, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_and[] =
{
{
OP_RMIMMSIGNED, 0x2080, 0x0200
}
,
{
OP_ACCIMM, 0x0024, 0x0000
}
,
{
OP_REGRMREG, 0x0020, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_arpl[] =
{
{
OP_WORDRMREG, 0x0063, 0x2302
}
,
{
0, 0, 0
}
,
};
OPCODE popn_bound[] =
{
{
OP_WORDREGRM, 0x0062, 0x0201
}
,
{
0, 0, 0
}
,
};
OPCODE popn_bsf[] =
{
{
OP_WORDREGRM, 0x00bc, 0x0a03
}
,
{
0, 0, 0
}
,
};
OPCODE popn_bsr[] =
{
{
OP_WORDREGRM, 0x00bd, 0x0a04
}
,
{
0, 0, 0
}
,
};
OPCODE popn_bswap[] =
{
{
OP_BSWAP, 0x00c8, 0x0804
}
,
{
0, 0, 0
}
,
};
OPCODE popn_bt[] =
{
{
OP_BITNUM, 0x20ba, 0x0a03
}
,
{
OP_WORDRMREG, 0x00a3, 0x0a03
}
,
{
0, 0, 0
}
,
};
OPCODE popn_btc[] =
{
{
OP_BITNUM, 0x38ba, 0x0a03
}
,
{
OP_WORDRMREG, 0x00bb, 0x0a03
}
,
{
0, 0, 0
}
,
};
OPCODE popn_btr[] =
{
{
OP_BITNUM, 0x30ba, 0x0a03
}
,
{
OP_WORDRMREG, 0x00b3, 0x0a03
}
,
{
0, 0, 0
}
,
};
OPCODE popn_bts[] =
{
{
OP_BITNUM, 0x28ba, 0x0a03
}
,
{
OP_WORDRMREG, 0x00ab, 0x0a03
}
,
{
0, 0, 0
}
,
};
OPCODE popn_call[] =
{
{
OP_BRANCH, 0x00e8, 0x0000
}
,
{
OP_RM, 0x10ff, 0x0200
}
,
{
OP_SEGBRANCH, 0x009a, 0x0000
}
,
{
OP_FARRM, 0x18ff, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cbw[] =
{
{
OP_CBW, 0x0098, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cdq[] =
{
{
OP_INSDWORDSIZE, 0x0099, 0x0003
}
,
{
0, 0, 0
}
,
};
OPCODE popn_clc[] =
{
{
OP_CODEONLY, 0x00f8, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cld[] =
{
{
OP_CODEONLY, 0x00fc, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cli[] =
{
{
OP_CODEONLY, 0x00fa, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_clts[] =
{
{
OP_CODEONLY, 0x0006, 0x0803
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmc[] =
{
{
OP_CODEONLY, 0x00f5, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmova[] =
{
{
OP_WORDREGRM, 0x0047, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovb[] =
{
{
OP_WORDREGRM, 0x0042, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovbe[] =
{
{
OP_WORDREGRM, 0x0046, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovg[] =
{
{
OP_WORDREGRM, 0x004f, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovge[] =
{
{
OP_WORDREGRM, 0x004d, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovl[] =
{
{
OP_WORDREGRM, 0x004c, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovle[] =
{
{
OP_WORDREGRM, 0x004e, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovnb[] =
{
{
OP_WORDREGRM, 0x0043, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovno[] =
{
{
OP_WORDREGRM, 0x0041, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovnp[] =
{
{
OP_WORDREGRM, 0x004b, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovns[] =
{
{
OP_WORDREGRM, 0x0049, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovnz[] =
{
{
OP_WORDREGRM, 0x0045, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovo[] =
{
{
OP_WORDREGRM, 0x0040, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovp[] =
{
{
OP_WORDREGRM, 0x004a, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovs[] =
{
{
OP_WORDREGRM, 0x0048, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmovz[] =
{
{
OP_WORDREGRM, 0x0044, 0x0a06
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmp[] =
{
{
OP_RMIMMSIGNED, 0x3880, 0x0200
}
,
{
OP_ACCIMM, 0x003c, 0x0000
}
,
{
OP_REGRMREG, 0x0038, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmps[] =
{
{
OP_CMPS, 0x00a7, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmpsb[] =
{
{
OP_CODEONLY, 0x00a6, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmpsd[] =
{
{
OP_INSDWORDSIZE, 0x00a7, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmpsw[] =
{
{
OP_INSWORDSIZE, 0x00a7, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmpxchg[] =
{
{
OP_BYTERMREG, 0x00b0, 0x0a04
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cmpxchg8b[] =
{
{
OP_NOSTRICTRM, 0x08c7, 0x0a05
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cpuid[] =
{
{
OP_CODEONLY, 0x00a2, 0x0805
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cwd[] =
{
{
OP_CBW, 0x0099, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_cwde[] =
{
{
OP_INSDWORDSIZE, 0x0098, 0x0003
}
,
{
0, 0, 0
}
,
};
OPCODE popn_daa[] =
{
{
OP_CODEONLY, 0x0027, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_das[] =
{
{
OP_CODEONLY, 0x002f, 0x0000
}
,
{
0, 0, 0
}
,
};
OPCODE popn_dec[] =
{
{
OP_WREG02, 0x0048, 0x0000
}
,
{
OP_RM, 0x08fe, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_div[] =
{
{
OP_RM, 0x30f6, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_enter[] =
{
{
OP_ENTER, 0x00c8, 0x0802
}
,
{
0, 0, 0
}
,
};
OPCODE popn_esc[] =
{
{
OP_ESC, 0x00d8, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_f2xm1[] =
{
{
OP_CODEONLY, 0xf0d9, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fabs[] =
{
{
OP_CODEONLY, 0xe1d9, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fadd[] =
{
{
OP_FLOATMATH, 0x00d8, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_faddp[] =
{
{
OP_FLOATMATHP, 0xc0de, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fbld[] =
{
{
OP_FBLD, 0x20df, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fbstp[] =
{
{
OP_FBLD, 0x30df, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fchs[] =
{
{
OP_CODEONLY, 0xe0d9, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fnclex[] =
{
{
OP_CODEONLY, 0xe2db, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fclex[] =
{
{
OP_CODEONLY, 0xe2db, 0x1200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fcom[] =
{
{
OP_CODEONLY, 0xd1d8, 0x0200
}
,
{
OP_FLOATRM, 0x10d8, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fcomp[] =
{
// {OP_CODEONLY,0xd9d8,0x0200},
{
OP_FREG, 0xd8d8, 0x0200
}
,
{
OP_FLOATRM, 0x18d8, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fcompp[] =
{
{
OP_CODEONLY, 0xd9de, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fcos[] =
{
{
OP_CODEONLY, 0xffd9, 0x0230
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fdecstp[] =
{
{
OP_CODEONLY, 0xf6d9, 0x0200
}
,
{
0, 0, 0
}
,
};
OPCODE popn_fdisi[] =
{
{
OP_CODEONLY, 0xe1db, 0x0200
}
,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -