Added source files C--.

git-svn-id: svn://kolibrios.org@6446 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
GerdtR 2016-06-13 02:07:22 +00:00
parent 393851c2ba
commit 6bd5a354f5
38 changed files with 57942 additions and 0 deletions

View File

@ -0,0 +1,104 @@
Compiler = gcc
Linker = kos32-ld
Includes = -I d:\TEMP\mprog\kos\includes
Compiler_Options = -c -fno-exceptions -D_KOS_
Exe_file = cmm.kex
Path_Libs = -Ld:/TEMP/Dev-Cpp/lib/kos
#-Ld:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/lib/gcc -Ld:/TEMP/Dev-Cpp/lib -Ld:/TEMP/Dev-Cpp/lib
Add_Libs =
Link_Libs = -lc -lgcc
My_Libs = main.o port.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o
####################
## Makefile rules ##
####################
all : $(Exe_file)
$(Exe_file) : $(My_Libs)
$(Linker) -o cmm.kex -static -nostdlib -T static.lds --stack 0x100000 $(Path_Libs) $(Add_Libs) $(My_Libs) $(Link_Libs)
objcopy cmm.kex -O binary
kpack cmm.kex
clean:
rm *.o
# next are the exceptions that don't have to be compiled with the /zu option
# since they will never be called from a interrupt. hey.. I _tried_ to find
# a clean solution..
main.o : main.cpp
$(Compiler) $(Compiler_Options) $<
toka.o : toka.cpp
$(Compiler) $(Compiler_Options) $<
tokb.o : tokb.cpp
$(Compiler) $(Compiler_Options) $<
tokc.o : tokc.cpp
$(Compiler) $(Compiler_Options) $<
toke.o : toke.cpp
$(Compiler) $(Compiler_Options) $<
tokr.o : tokr.cpp
$(Compiler) $(Compiler_Options) $<
errors.o :errors.cpp
$(Compiler) $(Compiler_Options) $<
debug.o : debug.cpp
$(Compiler) $(Compiler_Options) $<
outobj.o : outobj.cpp
$(Compiler) $(Compiler_Options) $<
outpe.o : outpe.cpp
$(Compiler) $(Compiler_Options) $<
disasm.o : disasm.cpp
$(Compiler) $(Compiler_Options) $<
switch.o : switch.cpp
$(Compiler) $(Compiler_Options) $<
outle.o : outle.cpp
$(Compiler) $(Compiler_Options) $<
pointer.o : pointer.cpp
$(Compiler) $(Compiler_Options) $<
new_type.o : new_type.cpp
$(Compiler) $(Compiler_Options) $<
class.o : class.cpp
$(Compiler) $(Compiler_Options) $<
res.o : res.cpp
$(Compiler) $(Compiler_Options) $<
optreg.o : optreg.cpp
$(Compiler) $(Compiler_Options) $<
libobj.o : libobj.cpp
$(Compiler) $(Compiler_Options) $<
port.o: port.cpp
$(Compiler) $(Compiler_Options) $<
.cpp.o:
$(Compiler) $(Compiler_Options) $<
.asm.o:
fasm $<

View File

@ -0,0 +1,110 @@
Compiler = gcc
#Compiler_Options = -c -fno-exceptions -D_UNIX_
Compiler_Options = -c -fno-exceptions -O2 -D_WIN32_
#-D: _WIN32_ or _UNIX_
#-D: for _WIN32_ add -D__CONSOLE__
Exe_file = cmm
Path_Libs = -Ld:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/lib/gcc -Ld:/TEMP/Dev-Cpp/lib -Ld:/TEMP/Dev-Cpp/lib
Add_Libs = d:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtbegin.o d:/TEMP/Dev-Cpp/lib/crt2.o d:/TEMP/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtend.o
Link_Libs = -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32
My_Libs = main.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o port.o
#Link_Libs = -lmingw32 -lgcc -lmoldname -lmingwex -lmingw32 -lmoldname -lmingwex -lmsvcrt -lgcc -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32
####################
## Makefile rules ##
####################
all : $(Exe_file)
$(Exe_file) : $(My_Libs)
ld -o cmm.exe $(Path_Libs) $(Add_Libs) $(My_Libs) $(Link_Libs)
# $(Compiler) -o $(Exe_file) $(All_Libs)
# ld -o cmm.exe -Bdynamic d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/crtend.o d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../crt2.o d:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/crtbegin.o -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2 -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../.. -Ld:/TEMP/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../.. main.o toka.o tokb.o tokc.o toke.o tokr.o errors.o debug.o outobj.o outpe.o disasm.o switch.o outle.o pointer.o new_type.o class.o res.o optreg.o libobj.o port.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lmoldname -lmingwex -lmsvcrt -lgcc
clean:
rm *.o
# next are the exceptions that don't have to be compiled with the /zu option
# since they will never be called from a interrupt. hey.. I _tried_ to find
# a clean solution..
main.o : main.cpp
$(Compiler) $(Compiler_Options) $<
toka.o : toka.cpp
$(Compiler) $(Compiler_Options) $<
tokb.o : tokb.cpp
$(Compiler) $(Compiler_Options) $<
tokc.o : tokc.cpp
$(Compiler) $(Compiler_Options) $<
toke.o : toke.cpp
$(Compiler) $(Compiler_Options) $<
tokr.o : tokr.cpp
$(Compiler) $(Compiler_Options) $<
errors.o :errors.cpp
$(Compiler) $(Compiler_Options) $<
debug.o : debug.cpp
$(Compiler) $(Compiler_Options) $<
outobj.o : outobj.cpp
$(Compiler) $(Compiler_Options) $<
outpe.o : outpe.cpp
$(Compiler) $(Compiler_Options) $<
disasm.o : disasm.cpp
$(Compiler) $(Compiler_Options) $<
switch.o : switch.cpp
$(Compiler) $(Compiler_Options) $<
outle.o : outle.cpp
$(Compiler) $(Compiler_Options) $<
pointer.o : pointer.cpp
$(Compiler) $(Compiler_Options) $<
new_type.o : new_type.cpp
$(Compiler) $(Compiler_Options) $<
class.o : class.cpp
$(Compiler) $(Compiler_Options) $<
res.o : res.cpp
$(Compiler) $(Compiler_Options) $<
optreg.o : optreg.cpp
$(Compiler) $(Compiler_Options) $<
libobj.o : libobj.cpp
$(Compiler) $(Compiler_Options) $<
port.o: port.cpp
$(Compiler) $(Compiler_Options) $<
.cpp.o:
$(Compiler) $(Compiler_Options) $<
.asm.o:
fasm $<

568
programs/develop/cmm/asm.h Normal file
View File

@ -0,0 +1,568 @@
#define NUM_ASM_MODIF 12
char *asmmodif[]={
"FAR", "SHORT", "NEAR", "DUP", "INT","WORD","LONG","DWORD",
"TBYTE","LDOUBLE","QWORD","DOUBLE"
};
//á«®¢  ¬®¤¨ä¨ª â®àë
#define m_far 1
#define m_short 2
#define m_near 4
#define m_dup 8
#define m_int 16
#define m_word 32
#define m_long 64
#define m_dword 128
#define m_tbyte 256
#define m_ldouble 512
#define m_qword 1024
#define m_double 2048
//ª®­à®«ì à §àã襭¨ï ॣ¨áâ஢
#define d1par 256 //¯® ¯¥à¢®¬ã ®¯¥à ­¤ã
#define d2par 512 //¯® 2 ®¯¥à ­¤ã
struct ASMPAR
{
unsigned char num; //ç¨á«® ®¯¥à ­¤®¢ ¬« ¤è¨¥ 4 ¡¨â  ¬¨­¨¬ «ì­®¥ ç¨á«®,
// áâ à訥 4 ¬ ªá¨¬ «ì­®¥, ¥á«¨ 0, ⮠⮫쪮 ¬« ¤è¥¥,
// ¥á«¨ 15, â® ­¥®£à ­¨ç¥­®
unsigned char chip; // ­¥®¡å®¤¨¬ë© cpu
unsigned short reg; // à §àãè ¥¬ë¥ ॣ¨áâàë
unsigned short mod; // á«®¢®-¬®¤¨ä¨ª â®à
}asmpar[]={
2,0,d1par,0, //a_add
2,0,d1par,0, //a_or
2,0,d1par,0, //a_adc
2,0,d1par,0, //a_sbb
2,0,d1par,0, //a_and
2,0,d1par,0, //a_sub
2,0,d1par,0, //a_xor
2,0,d1par,0, //a_cmp
1,0,d1par,0, //a_not
1,0,d1par,0, //a_neg
1,0,dEAX|dEDX,0, //a_mul
0,0,0,0,
1,0,dEAX|dEDX,0, //a_div=a_mul+2
1,0,dEAX|dEDX,0, //a_idiv
2,0,d1par,0, //a_rol
2,0,d1par,0, //a_ror
2,0,d1par,0, //a_rcl
2,0,d1par,0, //a_rcr
2,0,d1par,0, //a_shl
2,0,d1par,0, //a_shr
0,0,0,0,
2,0,d1par,0, //a_sar=a_shr+2
2,3,0,0, //a_bt
2,3,d1par,0, //a_bts
2,3,d1par,0, //a_btr
2,3,d1par,0, //a_btc
1,0,d1par,0, //a_inc
1,0,d1par,0, //a_dec
2,0,0,0, //a_test
0x31,0,d1par|dEAX|dEDX,0, //a_imul
3,3,d1par,0, //a_shld
3,3,d1par,0, //a_shrd
0,0,dEAX,0, //a_daa
0,0,dEAX,0, //a_das
0,0,dEAX,0, //a_aaa
0,0,dEAX,0, //a_aas
0x10,0,dEAX,0, //a_aam
0x10,0,dEAX,0, //a_aad
2,3,d1par,0, //a_movzx
2,3,d1par,0, //a_movsx
0,0,dEAX,0, //a_cbw
0,3,dEAX,0, //a_cwde
0,0,dEDX,0, //a_cwd
0,3,dEDX,0, //a_cdq,
1,4,d1par,0, //a_bswap
0,0,dEAX,0, //a_xlat
2,3,d1par,0, //a_bsf
2,3,d1par,0, //a_bsr
2,4,d1par|dEAX,0, //a_cmpxchg
1,5,d1par|dEDX|dEAX,0, //a_cmpxchg8b
2,4,d1par|d2par,0, //a_xadd
0,0,0,0, //a_nop
0,0,0,0, //a_wait
0,0,0,0, //a_lock
0,0,0,0, //a_hlt
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_int
0,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_into
0,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_iret
0,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_iretd
0,0,0,0, //a_popf
0,3,0,0, //a_popfd
0,0,0,0, //a_pushf
0,3,0,0, //a_pushfd
0,0,0,0, //a_sahf
0,0,dEAX,0, //a_lahf
0,0,0,0, //a_cmc
0,0,0,0, //a_clc
0,0,0,0, //a_stc
0,0,0,0, //a_cli
0,0,0,0, //a_sti
0,0,0,0, //a_cld
0,0,0,0, //a_std
0xF1,0,0,m_int|m_word|m_long|m_dword, //a_push
0,2,0,0, //a_pusha
0,3,0,0, //a_pushad
0xF1,0,d1par,0, //a_pop
0,2,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_popa
0,3,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_popad
2,0,d1par|d2par,0, //a_xchg
2,0,d1par,0, //a_mov
2,0,d1par,0, //a_lea
2,3,d1par,0, //a_lfs
2,3,d1par,0, //a_lgs
2,3,d1par,0, //a_lss
2,0,d1par,0, //a_les
2,0,d1par,0, //a_lds
0,3,0,0, //a_adrsiz
2,0,dEAX,0, //a_in
2,0,0,0, //a_out
0,2,dEAX|dEDI,0, //a_insb
0,2,dEAX|dEDI,0, //a_insw
0,3,dEAX|dEDI,0, //a_insd
0,2,dESI,0, //a_outsb
0,2,dESI,0, //a_outsw
0,3,dESI,0, //a_outsd
0,0,dEDI|dESI,0, //a_movsb
0,0,dEDI|dESI,0, //a_movsw
0x20,3,dEDI|dESI,0, //a_movsd
0,0,dEDI|dESI,0, //a_cmpsb
0,0,dEDI|dESI,0, //a_cmpsw
0x20,3,dEDI|dESI,0, //a_cmpsd
0,0,dEDI,0, //a_stosb
0,0,dEDI,0, //a_stosw
0,3,dEDI,0, //a_stosd
0,0,dEAX|dESI,0, //a_lodsb
0,0,dEAX|dESI,0, //a_lodsw
0,3,dEAX|dESI,0, //a_lodsd
0,0,dEDI,0, //a_scasb
0,0,dEDI,0, //a_scasw
0,3,dEDI,0, //a_scasd
0,0,dECX,0, //a_repnz
0,0,dECX,0, //a_rep
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jcxz
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jecxz
1,0,dECX,0, //a_loop
1,3,dECX,0, //a_loopd
1,0,dECX,0, //a_loopz
1,0,dECX,0, //a_loopnz
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jo
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jno
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jc
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jnc
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jz
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jnz
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jna
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_ja
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_js
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jns
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jp
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jnp
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jl
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jnl
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jng
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jg
1,3,d1par,0, //a_seto
1,3,d1par,0, //a_setno
1,3,d1par,0, //a_setc
1,3,d1par,0, //a_setnc
1,3,d1par,0, //a_setz
1,3,d1par,0, //a_setnz
1,3,d1par,0, //a_setna
1,3,d1par,0, //a_seta
1,3,d1par,0, //a_sets
1,3,d1par,0, //a_setns
1,3,d1par,0, //a_setp
1,3,d1par,0, //a_setnp
1,3,d1par,0, //a_setl
1,3,d1par,0, //a_setnl
1,3,d1par,0, //a_setng
1,3,d1par,0, //a_setg
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near|m_short, //a_jmp
1,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,m_far|m_near, //a_call/*a_callf,*/
0x10,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_ret
0x10,0,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_retf
2,2,dEBP|dESP,0, //a_enter
0,2,dEBP|dESP,0, //a_leave
2,2,dEAX|dEBX|dECX|dEDX|dESI|dEDI|dEBP|dESP,0, //a_bound
2,2,d1par,0, //a_arpl
1,2,d1par,0, //a_sldt
1,2,d1par,0, //a_str
1,2,0,0, //a_lldt
1,2,0,0, //a_ltr
1,2,0,0, //a_verr
1,2,0,0, //a_verw
2,2,d1par,0, //a_lar
2,2,d1par,0, //a_lsl
1,2,d1par,0, //a_sgdt
1,2,d1par,0, //a_sidt
1,2,0,0, //a_lgdt
1,2,0,0, //a_lidt
1,2,d1par,0, //a_smsw
1,2,0,0, //a_lmsw
0,2,0,0, //a_clts
0,4,0,0, //a_invd
0,4,0,0, //a_wbinvd
//a_invlpd,
0,5,0,0, //a_wrmsr
0,5,dEAX|dEBX|dECX|dEDX,0, //a_cpuid
0,5,dEAX|dEDX,0, //a_rdmsr
0,5,dEAX|dEDX,0, //a_rdtsc
0,5,0,0, //a_rsm
0,7,dEAX|dEDX,0, //a_rdpmc
0,7,0,0, //a_ud2
/*a_emmx,a_setalc,*/
2,8,0,0, //a_punpcklbw
2,8,0,0, //a_punpcklwd
2,8,0,0, //a_punpckldq
2,8,0,0, //a_packsswb
2,8,0,0, //a_pcmpgtb
2,8,0,0, //a_pcmpgtw
2,8,0,0, //a_pcmpgtd
2,8,0,0, //a_packuswb
2,8,0,0, //a_punpckhbw
2,8,0,0, //a_punpckhwd
2,8,0,0, //a_punpckhdq
2,8,0,0, //a_packssdw
2,6,0,0, //a_psrlw
2,6,0,0, //a_psrld
2,6,0,0, //a_psrlq
2,6,0,0, //a_psraw
2,6,0,0, //a_psrad
2,6,0,0, //a_psllw
2,6,0,0, //a_pslld
2,6,0,0, //a_psllq
2,8,0,0, //a_pcmpeqb
2,8,0,0, //a_pcmpeqw
2,8,0,0, //a_pcmpeqd
2,8,0,0, //a_pmullw
2,6,d1par,0, //a_movd
2,6,d1par,0, //a_movq
2,8,0,0, //a_psubusb
2,8,0,0, //a_psubusw
0,6,0,0, //a_emms
2,8,0,0, //a_pand
2,8,0,0, //a_paddusb
2,8,0,0, //a_paddusw
2,8,0,0, //a_pandn
2,8,0,0, //a_pmulhw
2,8,0,0, //a_psubsb
2,8,0,0, //a_psubsw
2,8,0,0, //a_por
2,8,0,0, //a_paddsb
2,8,0,0, //a_paddsw
2,8,0,0, //a_pxor
2,8,0,0, //a_pmaddwd
2,8,0,0, //a_psubb
2,8,0,0, //a_psubw
2,8,0,0, //a_psubd
2,8,0,0, //a_paddb
2,8,0,0, //a_paddw
2,8,0,0, //a_paddd
0xF1,0,0,m_dup, //a_db
0xF1,0,0,m_dup, //a_dw
0xF1,3,0,m_dup, //a_dd
1,4,0,0, //a_invlpg
0,2,0,0, //a_loadall
0,3,0,0, //a_opsiz
0,2,0,0, //a_f2xm1
0,0,0,0, //a_fabs
0x21,0,0,m_double, //a_fadd
0x20,0,0,0, //a_faddp
1,0,0,m_qword|m_tbyte, //a_fbld
1,0,d1par,m_qword|m_tbyte, //a_fbstp
0,0,0,0, //a_fchs
0,0,0,0, //a_fclex
0x10,0,0,m_double, //a_fcom
0x10,0,0,m_double, //a_fcomp
0,0,0,0, //a_fnclex
0,0,0,0, //a_fcompp
0,3,0,0, //a_fcos
0,0,0,0, //a_fdecstr
0,0,0,0, //a_fdisi
0x21,0,0,m_double, //a_fdiv
0x20,0,0,0, //a_fdivp
0x21,0,0,m_double, //a_fdivr
0x20,0,0,0, //a_fdivrp
1,0,0,0, //a_ffree
1,0,0,0, //a_fiadd
1,0,0,0, //a_ficom
1,0,0,0, //a_ficomp
1,0,0,0, //a_fidiv
1,0,0,0, //a_fidivr
1,0,0,0, //a_fild
1,0,0,m_qword|m_tbyte, //a_fildq
1,0,0,0, //a_fimul
1,0,d1par,0, //a_fist
1,0,d1par,0, //a_fistp
1,0,0,0, //a_fisub
1,0,0,0, //a_fisubr
0,0,0,0, //a_feni
0,0,0,0, //a_fincstr
0,0,0,0, //a_finit
0,0,0,0, //a_fninit
1,0,0,m_qword|m_double|m_tbyte|m_ldouble, //a_fld
1,0,0,0, //a_fldcw
1,0,0,m_tbyte|m_qword, //a_fldenv
0,0,0,0, //a_fldlg2
0,0,0,0, //a_fldln2
0,0,0,0, //a_fldl2e
0,0,0,0, //a_fldl2t
0,0,0,0, //a_fldpi
0,0,0,0, //a_fldz
0,0,0,0, //a_fld1
0x21,0,0,0, //a_fmul
0x20,0,0,0, //a_fmulp
0,0,0,0, //a_fnop
0,0,0,0, //a_fpatan
0,0,0,0, //a_fprem
0,3,0,0, //a_fprem1
0,0,0,0, //a_fptan
0,0,0,0, //a_frndint
0,2,0,0, //a_fsetpm
1,0,0,m_tbyte|m_qword, //a_frstor
1,0,d1par,m_tbyte|m_qword, //a_fsave
1,0,d1par,m_tbyte|m_qword, //a_fnsave
0,0,0,0, //a_fscale
0,3,0,0, //a_fsin
0,3,0,0, //a_fsincos
0,0,0,0, //a_fsqrt
1,0,d1par,m_qword|m_double|m_tbyte|m_ldouble, //a_fst
1,0,d1par,0, //a_fstcw
1,0,d1par,0, //a_fnstcw
1,0,d1par,m_qword|m_double|m_tbyte|m_ldouble, //a_fstp
1,0,d1par,0, //a_fstsw
1,0,d1par,0, //a_fnstsw
1,0,d1par,m_tbyte|m_qword, //a_fstenv
1,0,d1par,m_tbyte|m_qword, //a_fnstenv
0x21,0,0,m_double, //a_fsub
0x20,0,0,0, //a_fsubp
0x21,0,0,m_double, //a_fsubr
0x20,0,0,0, //a_fsubrp
0,0,0,0, //a_ftst
0x10,0,0,0, //a_fucom
0x10,0,0,0, //a_fucomp
0,3,0,0, //a_fucompp
0x10,0,0,0, //a_fxch
0,0,0,0, //a_fwait
0,0,0,0, //a_fxam
0,0,0,0, //a_fxtract
0,0,0,0, //a_fyl2x
0,0,0,0, //a_fyl2xp1
0,7,0,0, //a_sysenter
0,7,0,0, //a_sysexit
0x21,7,0,0, //a_fcmovb
0x21,7,0,0, //a_fcmove
0x21,7,0,0, //a_fcmovbe
0x21,7,0,0, //a_fcmovu
0x21,7,0,0, //a_fcmovnb
0x21,7,0,0, //a_fcmovne
0x21,7,0,0, //a_fcmovnbe
0x21,7,0,0, //a_fcmovnu
0x21,7,0,0, //a_fcomi
0x21,7,0,0, //a_fcomip
0x21,7,0,0, //a_fucomi
0x21,7,0,0, //a_fucomip
1,8,0,0, //a_fxrstor
1,8,d1par,0, //a_fxsave
0,0,0,0, //a_fndisi
0,0,0,0, //a_fneni
0,2,0,0, //a_fnsetpm
2,7,d1par,0, //a_cmovo
2,7,d1par,0, //a_cmovno
2,7,d1par,0, //a_cmovc
2,7,d1par,0, //a_cmovnc
2,7,d1par,0, //a_cmovz
2,7,d1par,0, //a_cmovnz
2,7,d1par,0, //a_cmovna
2,7,d1par,0, //a_cmova
2,7,d1par,0, //a_cmovs
2,7,d1par,0, //a_cmovns
2,7,d1par,0, //a_cmovp
2,7,d1par,0, //a_cmovnp
2,7,d1par,0, //a_cmovl
2,7,d1par,0, //a_cmovnl
2,7,d1par,0, //a_cmovng
2,7,d1par,0, //a_cmovg
2,8,dEDI,0, //a_maskmovq
2,8,d1par,0, //a_movntq
2,8,0,0, //a_pavgb
2,8,0,0, //a_pavgw
3,8,d1par,0, //a_pextrw
3,8,0,0, //a_pinsrw
2,8,0,0, //a_pmaxub
2,8,0,0, //a_pmaxsw
2,8,0,0, //a_pminub
2,8,0,0, //a_pminsw
2,8,d1par,0, //a_pmovmskb
2,8,0,0, //a_pmulhuw
1,8,0,0, //a_prefetcht0
1,8,0,0, //a_prefetcht1
1,8,0,0, //a_prefetcht2
1,8,0,0, //a_prefetchnta
0,8,0,0, //a_sfence
2,8,0,0, //a_psadbw
3,8,0,0, //a_pshufw
2,8,0,0, //a_addps
2,8,0,0, //a_addss
2,8,0,0, //a_andnps
2,8,0,0, //a_andps
3,8,0,0, //a_cmpps
3,8,0,0, //a_cmpss
2,8,0,0, //a_comiss
2,8,0,0, //a_cvtpi2ps
2,8,0,0, //a_cvtps2pi
2,8,0,0, //a_cvtsi2ss
2,8,d1par,0, //a_cvtss2si
2,8,0,0, //a_cvttps2pi
2,8,d1par,0, //a_cvttss2si
2,8,0,0, //a_divps
2,8,0,0, //a_divss
1,8,0,0, //a_ldmxcsr
2,8,0,0, //a_maxps
2,8,0,0, //a_maxss
2,8,0,0, //a_minps
2,8,0,0, //a_minss
2,8,d1par,0, //a_movaps
2,8,0,0, //a_movhlps
2,8,d1par,0, //a_movhps
2,8,0,0, //a_movlhps
2,8,d1par,0, //a_movlps
2,8,d1par,0, //a_movmskps
2,8,d1par,0, //a_movss
2,8,d1par,0, //a_movups
2,8,0,0, //a_mulps
2,8,0,0, //a_mulss,
2,8,d1par,0, //a_movntps
2,8,0,0, //a_orps
2,8,0,0, //a_rcpps
2,8,0,0, //a_rcpss
2,8,0,0, //a_rsqrtps
2,8,0,0, //a_rsqrtss
3,8,0,0, //a_shufps
2,8,0,0, //a_sqrtps
2,8,0,0, //a_sqrtss
1,8,d1par,0, //a_stmxcsr
2,8,0,0, //a_subps
2,8,0,0, //a_subss
2,8,0,0, //a_ucomiss
2,8,0,0, //a_unpckhps
2,8,0,0, //a_unpcklps
2,8,0,0, //a_xorps
// Pentium IV
0,9,0,0, //a_lfence
0,9,0,0, //a_mfence
2,9,0,0, //a_addpd
2,9,0,0, //a_addsd
2,9,0,0, //a_andpd
2,9,0,0, //a_andnpd
3,9,0,0, //a_cmppd
2,9,0,0, //a_comisd
2,9,0,0, //a_cvtdq2pd
2,9,0,0, //a_cvtdq2ps
2,9,0,0, //a_cvtpd2dq
2,9,0,0, //a_cvtpd2pi
2,9,0,0, //a_cvtpd2ps
2,9,0,0, //a_cvtpi2pd
2,9,0,0, //a_cvtps2dq
2,9,0,0, //a_cvtps2pd
2,9,d1par,0, //a_cvtsd2si
2,9,0,0, //a_cvtsd2ss
2,9,0,0, //a_cvtsi2sd
2,9,0,0, //a_cvtss2sd
2,9,0,0, //a_cvttpd2pi
2,9,0,0, //a_cvttpd2dq
2,9,0,0, //a_cvttps2dq
2,9,d1par,0, //a_cvttsd2si
2,9,0,0, //a_divpd
2,9,0,0, //a_divsd
2,9,0,0, //a_maskmovdqu
2,9,0,0, //a_maxpd
2,9,0,0, //a_maxsd
2,9,0,0, //a_minpd
2,9,0,0, //a_minsd
2,9,d1par,0, //a_movapd
2,9,d1par,0, //a_movdqa
2,9,d1par,0, //a_movdqu
2,9,0,0, //a_movdq2q
2,9,d1par,0, //a_movhpd
2,9,d1par,0, //a_movlpd
2,9,d1par,0, //a_movmskpd
2,9,d1par,0, //a_movntdq
2,9,d1par,0, //a_movntpd
2,9,d1par,0, //a_movnti
2,9,0,0, //a_movq2dq
2,9,0,0, //a_movupd
2,9,0,0, //a_mulpd
2,9,0,0, //a_mulsd
2,9,0,0, //a_orpd
3,9,0,0, //a_pshufd,
3,9,0,0, //a_pshufhw
3,9,0,0, //a_pshuflw
2,9,0,0, //a_pslldq
2,9,0,0, //a_psrldq
3,9,0,0, //a_shufpd
2,9,0,0, //a_sqrtpd
2,9,0,0, //a_sqrtsd
2,9,0,0, //a_subpd
2,9,0,0, //a_subsd
2,9,0,0, //a_ucomisd
2,9,0,0, //a_unpckhpd
2,9,0,0, //a_unpcklpd
2,9,0,0, //a_xorpd
2,9,0,0, //a_paddq
2,9,0,0, //a_pmuludq
2,9,0,0, //a_psubq
2,9,0,0, //a_punpckhqdq
2,9,0,0, //a_punpcklqdq
1,9,0,0, //a_clflush
0,9,0,0, //a_monitor
0,9,0,0, //a_mwait
2,9,0,0, //a_addsubpd
2,9,0,0, //a_addsubps
2,9,0,0, //a_cmpeqsd
2,9,0,0, //a_cmpltsd
2,9,0,0, //a_cmplesd
2,9,0,0, //a_cmpunordsd
2,9,0,0, //a_cmpneqsd
2,9,0,0, //a_cmpnltsd
2,9,0,0, //a_cmpnlesd
2,9,0,0, //a_cmpordsd
2,9,0,0, //a_cmpeqpd
2,9,0,0, //a_cmpltpd
2,9,0,0, //a_cmplepd
2,9,0,0, //a_cmpunordpd
2,9,0,0, //a_cmpneqpd
2,9,0,0, //a_cmpnltpd
2,9,0,0, //a_cmpnlepd
2,9,0,0, //a_cmpordpd
2,9,0,0, //a_cmpeqps
2,9,0,0, //a_cmpltps
2,9,0,0, //a_cmpleps
2,9,0,0, //a_cmpunordps
2,9,0,0, //a_cmpneqps
2,9,0,0, //a_cmpnltps
2,9,0,0, //a_cmpnleps
2,9,0,0, //a_cmpordps
2,9,0,0, //a_cmpeqss
2,9,0,0, //a_cmpltss
2,9,0,0, //a_cmpless
2,9,0,0, //a_cmpunordss
2,9,0,0, //a_cmpneqss
2,9,0,0, //a_cmpnltss
2,9,0,0, //a_cmpnless
2,9,0,0, //a_cmpordss
2,9,0,0, //a_haddpd
2,9,0,0, //a_haddps
2,9,0,0, //a_hsubpd
2,9,0,0, //a_hsubps
2,9,0,0, //a_lddqu
2,9,0,0, //a_movddup
2,9,0,0, //a_movshdup
2,9,0,0, //a_movsldup
0,9,0,0 //a_pause
};

View File

@ -0,0 +1,144 @@
char *Mnemonics[]={
// FIRST OF ALL THE COMMANDS WITH A P-FLAG. THIS"LL MAKE THINGS EASIER FOR
// COMPARISON IN THE PARSE ENGINE
//P1=0-7
"ADD","OR","ADC","SBB/BC","AND","SUB","XOR","CMP",
//P2=4-7
"NOT","NEG","MUL","-","DIV","IDIV",
// IMUL ENTFERNT
//P3=0-5/7
"ROL","ROR","RCL","RCR","SHL/AL","SHR","-","SAR",
//P4=4-7
"BT","BTS","BTR","BTC",
// USUAL COMMANDS
"INC","DEC","TEST", "IMUL","SHLD","SHRD",
"DAA","DAS","AAA","AAS","AAM","AAD",
"MOVZX","MOVSX","CBW","CWDE","CWD","CDQ",
"BSWAP","XLAT/LATB","BSF","BSR",
"CMPXCHG","CMPXCHG8B","XADD",
"NOP","WAIT","LOCK","HLT/ALT","INT",
"INTO","IRET","IRETD",
"POPF","POPFD","PUSHF","PUSHFD","SAHF","LAHF",
"CMC","CLC","STC","CLI","STI","CLD","STD",
"PUSH","PUSHA","PUSHAD","POP","POPA","POPAD",
"XCHG","MOV","LEA",
"LFS","LGS","LSS",
"LES","LDS",
"ADRSIZE",
"IN","OUT","INSB","INSW","INSD","OUTSB","OUTSW","OUTSD",
"MOVSB","MOVSW","MOVSD","CMPSB","CMPSW","CMPSD",
"STOSB","STOSW","STOSD","LODSB","LODSW","LODSD",
"SCASB","SCASW","SCASD","REPNE/EPNZ","REP/EPE/EPZ",
"JCXZ","JECXZ","LOOP/OOPW","LOOPD","LOOPZ/OOPE","LOOPNZ/OOPNE",
"JO","JNO","JC/B/NAE","JNC/AE/NB",
"JE/Z","JNE/NZ","JBE/NA","JA/NBE",
"JS","JNS","JP/PE","JNP/PO","JL/NGE","JGE/NL",
"JLE/NG","JG/NLE",
"SETO","SETNO","SETC/ETB/ETNAE","SETNC/ETAE/ETNB",
"SETE/ETZ","SETNE/ETNZ","SETBE/ETNA","SETA/ETNBE",
"SETS","SETNS","SETP/ETPE","SETNP/ETPO","SETL/ETNGE","SETGE/ETNL",
"SETLE/ETNG","SETG/ETNLE",
/*"JMPS","JMPN","JMPF",*/"JMP",
"CALL",/*"CALLF",*/"RET","RETF",
"ENTER","LEAVE","BOUND","ARPL",
"SLDT","STR","LLDT","LTR","VERR","VERW","LAR","LSL",
"SGDT","SIDT","LGDT","LIDT","SMSW","LMSW","CLTS",
"INVD","WBINVD",//"INVLPD",
//INTEL PENTIUM COMMANDS
"WRMSR","CPUID","RDMSR","RDTSC","RSM",
//INTEL PENTIUM PRO INSTRUCTIONS
"RDPMC","UD2",/*"EMMX","SETALC",*/
//MMX INSTRUCTIONS
"PUNPCKLBW","PUNPCKLWD","PUNPCKLDQ", //UNPACK LOW ORDER 60 -
"PACKSSWB",
"PCMPGTB","PCMPGTW","PCMPGTD",
"PACKUSWB", //PACK MMX REG WITH UNSIGNED SATURATION
"PUNPCKHBW","PUNPCKHWD","PUNPCKHDQ", //UNPACK HIGH ORDER
"PACKSSDW", //PACK MMX REG WITH SIGNED SATURATION - 6B
"PSRLW","PSRLD","PSRLQ",
"PSRAW","PSRAD",
"PSLLW","PSLLD","PSLLQ",
"PCMPEQB","PCMPEQW","PCMPEQD",//74-76
"PMULLW", //d5
"MOVD","MOVQ", //MOVE MMX REG
"PSUBUSB","PSUBUSW",//d8-d9
"EMMS",
"PAND", //db
"PADDUSB","PADDUSW", //" WITH UNSIGNED SATURATION
"PANDN", //df
"PMULHW", //e5
"PSUBSB","PSUBSW", //e8-e9
"POR", //eb
"PADDSB","PADDSW", //" WITH SIGNED SATURATION
"PXOR", //ef
"PMADDWD", //f5
"PSUBB","PSUBW","PSUBD", //SUBTRACT MMX REG f8-fa
"PADDB","PADDW","PADDD", //ADD MMX REG WITH WRAP-AROUND fc-fe
"DB","DW","DD","INVLPG","LOADALL","OPSIZE",
"F2XM1","FABS","FADD","FADDP","FBLD","FBSTP","FCHS","FCLEX","FCOM",
"FCOMP","FNCLEX","FCOMPP","FCOS","FDECSTP","FDISI","FDIV","FDIVP",
"FDIVR","FDIVRP","FFREE","FIADD","FICOM","FICOMP","FIDIV","FIDIVR",
"FILD","FILDQ","FIMUL","FIST","FISTP","FISUB","FISUBR","FENI","FINCSTP",
"FINIT","FNINIT","FLD","FLDCW","FLDENV","FLDLG2","FLDLN2","FLDL2E",
"FLDL2T","FLDPI","FLDZ","FLD1","FMUL","FMULP","FNOP","FPATAN","FPREM",
"FPREM1","FPTAN","FRNDINT","FSETPM","FRSTOR","FSAVE","FNSAVE","FSCALE",
"FSIN","FSINCOS","FSQRT","FST","FSTCW","FNSTCW","FSTP","FSTSW","FNSTSW",
"FSTENV","FNSTENV","FSUB","FSUBP","FSUBR","FSUBRP","FTST","FUCOM","FUCOMP",
"FUCOMPP","FXCH","FWAIT","FXAM","FXTRACT","FYL2X","FYL2XP1",
"SYSENTER","SYSEXIT","FCMOVB","FCMOVE","FCMOVBE","FCMOVU","FCMOVNB",
"FCMOVNE","FCMOVNBE","FCMOVNU","FCOMI","FCOMIP","FUCOMI","FUCOMIP",
"FXRSTOR","FXSAVE", "FNDISI", "FNENI", "FNSETPM",
"CMOVO","CMOVNO","CMOVB/MOVNAE/MOVC","CMOVAE/MOVNB/MOVNC","CMOVE/MOVZ",
"CMOVNE/MOVNZ","CMOVBE/MOVNA","CMOVA/MOVNBE","CMOVS","CMOVNS",
"CMOVP/MOVPE","CMOVNP/MOVPO","CMOVL/MOVNGE","CMOVGE/MOVNL",
"CMOVLE/MOVNG","CMOVG/MOVNLE",
//MMX Pentium III extention
"MASKMOVQ", "MOVNTQ", "PAVGB", "PAVGW", "PEXTRW", "PINSRW",
"PMAXUB", "PMAXSW", "PMINUB", "PMINSW", "PMOVMSKB","PMULHUW",
"PREFETCHT0","PREFETCHT1","PREFETCHT2","PREFETCHNTA","SFENCE", "PSADBW",
"PSHUFW",
//XMM extentions Pentium III
"ADDPS", "ADDSS", "ANDNPS", "ANDPS", "CMPPS", "CMPSS",
"COMISS", "CVTPI2PS","CVTPS2PI","CVTSI2SS","CVTSS2SI","CVTTPS2PI",
"CVTTSS2SI","DIVPS", "DIVSS", "LDMXCSR", "MAXPS", "MAXSS",
"MINPS", "MINSS", "MOVAPS", "MOVHLPS", "MOVHPS", "MOVLHPS",
"MOVLPS", "MOVMSKPS","MOVSS", "MOVUPS", "MULPS", "MULSS",
"MOVNTPS", "ORPS", "RCPPS", "RCPSS", "RSQRTPS", "RSQRTSS",
"SHUFPS", "SQRTPS", "SQRTSS", "STMXCSR", "SUBPS", "SUBSS",
"UCOMISS", "UNPCKHPS","UNPCKLPS","XORPS",
// Pentium IV
"LFENCE", "MFENCE", "ADDPD", "ADDSD", "ANDPD", "ANDNPD",
"CMPPD", "COMISD", "CVTDQ2PD", "CVTDQ2PS", "CVTPD2DQ", "CVTPD2PI",
"CVTPD2PS","CVTPI2PD", "CVTPS2DQ", "CVTPS2PD", "CVTSD2SI", "CVTSD2SS",
"CVTSI2SD","CVTSS2SD", "CVTTPD2PI", "CVTTPD2DQ", "CVTTPS2DQ", "CVTTSD2SI",
"DIVPD", "DIVSD", "MASKMOVDQU","MAXPD", "MAXSD", "MINPD",
"MINSD", "MOVAPD", "MOVDQA", "MOVDQU", "MOVDQ2Q", "MOVHPD",
"MOVLPD", "MOVMSKPD", "MOVNTDQ", "MOVNTPD", "MOVNTI", "MOVQ2DQ",
"MOVUPD", "MULPD", "MULSD", "ORPD", "PSHUFD", "PSHUFHW",
"PSHUFLW", "PSLLDQ", "PSRLDQ", "SHUFPD", "SQRTPD", "SQRTSD",
"SUBPD", "SUBSD", "UCOMISD", "UNPCKHPD", "UNPCKLPD", "XORPD",
"PADDQ", "PMULUDQ", "PSUBQ", "PUNPCKHQDQ","PUNPCKLQDQ","CLFLUSH",
"MONITOR", "MWAIT", "ADDSUBPD", "ADDSUBPS", "CMPEQSD", "CMPLTSD",
"CMPLESD", "CMPUNORDSD","CMPNEQSD", "CMPNLTSD", "CMPNLESD", "CMPORDSD",
"CMPEQPD", "CMPLTPD", "CMPLEPD", "CMPUNORDPD","CMPNEQPD", "CMPNLTPD",
"CMPNLEPD","CMPORDPD", "CMPEQPS", "CMPLTPS", "CMPLEPS", "CMPUNORDPS",
"CMPNEQPS","CMPNLTPS", "CMPNLEPS", "CMPORDPS", "CMPEQSS", "CMPLTSS",
"CMPLESS", "CMPUNORDSS","CMPNEQSS", "CMPNLTSS", "CMPNLESS", "CMPORDSS",
"HADDPD", "HADDPS", "HSUBPD", "HSUBPS", "LDDQU", "MOVDDUP",
"MOVSHDUP","MOVSLDUP", "PAUSE",
NULL};

View File

@ -0,0 +1,620 @@
/* 吲栽 <20>帖 嶂平丞兒恥<E58592> 能恐<E883BD>洵悟 'FASTLIST.EXE' */
short ofsmnem[26]={
0x0000,0x0082, //A B
0x00AF,0x0451, //C D
0x048F,0x049E, //E F
0xFFFF,0x078A, //G H
0x07B7,0x0806, //I J
0xFFFF,0x08AA, //K L
0x096C,0x0B00, //M N
0x0B11,0x0B45, //O P
0xFFFF,0x0DE9, //Q R
0x0E63,0x102C, //S T
0x1034,0x1075, //U V
0x1083,0x109A, //W X
0xFFFF,0xFFFF}; //Y Z
unsigned char asmMnem[]={
0x22,0x00,0x41,0x41,0, // AAA
0x25,0x00,0x41,0x44,0, // AAD
0x24,0x00,0x41,0x4D,0, // AAM
0x23,0x00,0x41,0x53,0, // AAS
0x02,0x00,0x44,0x43,0, // ADC
0x00,0x00,0x44,0x44,0, // ADD
0xA5,0x01,0x44,0x44,0x50,0x44,0, // ADDPD
0x75,0x01,0x44,0x44,0x50,0x53,0, // ADDPS
0xA6,0x01,0x44,0x44,0x53,0x44,0, // ADDSD
0x76,0x01,0x44,0x44,0x53,0x53,0, // ADDSS
0xE7,0x01,0x44,0x44,0x53,0x55,0x42,0x50,0x44,0, // ADDSUBPD
0xE8,0x01,0x44,0x44,0x53,0x55,0x42,0x50,0x53,0, // ADDSUBPS
0x56,0x00,0x44,0x52,0x53,0x49,0x5A,0x45,0, // ADRSIZE
0x04,0x00,0x4E,0x44,0, // AND
0xA8,0x01,0x4E,0x44,0x4E,0x50,0x44,0, // ANDNPD
0x77,0x01,0x4E,0x44,0x4E,0x50,0x53,0, // ANDNPS
0xA7,0x01,0x4E,0x44,0x50,0x44,0, // ANDPD
0x78,0x01,0x4E,0x44,0x50,0x53,0, // ANDPS
0x9D,0x00,0x52,0x50,0x4C,0, // ARPL
0xFF,0xFF, // end char 'A'
0x9C,0x00,0x4F,0x55,0x4E,0x44,0, // BOUND
0x2E,0x00,0x53,0x46,0, // BSF
0x2F,0x00,0x53,0x52,0, // BSR
0x2C,0x00,0x53,0x57,0x41,0x50,0, // BSWAP
0x16,0x00,0x54,0, // BT
0x19,0x00,0x54,0x43,0, // BTC
0x18,0x00,0x54,0x52,0, // BTR
0x17,0x00,0x54,0x53,0, // BTS
0xFF,0xFF, // end char 'B'
0x97,0x00,0x41,0x4C,0x4C,0, // CALL
0x28,0x00,0x42,0x57,0, // CBW
0x2B,0x00,0x44,0x51,0, // CDQ
0x42,0x00,0x4C,0x43,0, // CLC
0x46,0x00,0x4C,0x44,0, // CLD
0xE4,0x01,0x4C,0x46,0x4C,0x55,0x53,0x48,0, // CLFLUSH
0x44,0x00,0x4C,0x49,0, // CLI
0xAC,0x00,0x4C,0x54,0x53,0, // CLTS
0x41,0x00,0x4D,0x43,0, // CMC
0x59,0x01,0x4D,0x4F,0x56,0x41,0, // CMOVA
0x55,0x01,0x4D,0x4F,0x56,0x41,0x45,0, // CMOVAE
0x54,0x01,0x4D,0x4F,0x56,0x42,0, // CMOVB
0x58,0x01,0x4D,0x4F,0x56,0x42,0x45,0, // CMOVBE
0x54,0x01,0x4D,0x4F,0x56,0x43,0, // CMOVC
0x56,0x01,0x4D,0x4F,0x56,0x45,0, // CMOVE
0x61,0x01,0x4D,0x4F,0x56,0x47,0, // CMOVG
0x5F,0x01,0x4D,0x4F,0x56,0x47,0x45,0, // CMOVGE
0x5E,0x01,0x4D,0x4F,0x56,0x4C,0, // CMOVL
0x60,0x01,0x4D,0x4F,0x56,0x4C,0x45,0, // CMOVLE
0x58,0x01,0x4D,0x4F,0x56,0x4E,0x41,0, // CMOVNA
0x54,0x01,0x4D,0x4F,0x56,0x4E,0x41,0x45,0, // CMOVNAE
0x55,0x01,0x4D,0x4F,0x56,0x4E,0x42,0, // CMOVNB
0x59,0x01,0x4D,0x4F,0x56,0x4E,0x42,0x45,0, // CMOVNBE
0x55,0x01,0x4D,0x4F,0x56,0x4E,0x43,0, // CMOVNC
0x57,0x01,0x4D,0x4F,0x56,0x4E,0x45,0, // CMOVNE
0x60,0x01,0x4D,0x4F,0x56,0x4E,0x47,0, // CMOVNG
0x5E,0x01,0x4D,0x4F,0x56,0x4E,0x47,0x45,0, // CMOVNGE
0x5F,0x01,0x4D,0x4F,0x56,0x4E,0x4C,0, // CMOVNL
0x61,0x01,0x4D,0x4F,0x56,0x4E,0x4C,0x45,0, // CMOVNLE
0x53,0x01,0x4D,0x4F,0x56,0x4E,0x4F,0, // CMOVNO
0x5D,0x01,0x4D,0x4F,0x56,0x4E,0x50,0, // CMOVNP
0x5B,0x01,0x4D,0x4F,0x56,0x4E,0x53,0, // CMOVNS
0x57,0x01,0x4D,0x4F,0x56,0x4E,0x5A,0, // CMOVNZ
0x52,0x01,0x4D,0x4F,0x56,0x4F,0, // CMOVO
0x5C,0x01,0x4D,0x4F,0x56,0x50,0, // CMOVP
0x5C,0x01,0x4D,0x4F,0x56,0x50,0x45,0, // CMOVPE
0x5D,0x01,0x4D,0x4F,0x56,0x50,0x4F,0, // CMOVPO
0x5A,0x01,0x4D,0x4F,0x56,0x53,0, // CMOVS
0x56,0x01,0x4D,0x4F,0x56,0x5A,0, // CMOVZ
0x07,0x00,0x4D,0x50,0, // CMP
0xF1,0x01,0x4D,0x50,0x45,0x51,0x50,0x44,0, // CMPEQPD
0xF9,0x01,0x4D,0x50,0x45,0x51,0x50,0x53,0, // CMPEQPS
0xE9,0x01,0x4D,0x50,0x45,0x51,0x53,0x44,0, // CMPEQSD
0x01,0x02,0x4D,0x50,0x45,0x51,0x53,0x53,0, // CMPEQSS
0xF3,0x01,0x4D,0x50,0x4C,0x45,0x50,0x44,0, // CMPLEPD
0xFB,0x01,0x4D,0x50,0x4C,0x45,0x50,0x53,0, // CMPLEPS
0xEB,0x01,0x4D,0x50,0x4C,0x45,0x53,0x44,0, // CMPLESD
0x03,0x02,0x4D,0x50,0x4C,0x45,0x53,0x53,0, // CMPLESS
0xF2,0x01,0x4D,0x50,0x4C,0x54,0x50,0x44,0, // CMPLTPD
0xFA,0x01,0x4D,0x50,0x4C,0x54,0x50,0x53,0, // CMPLTPS
0xEA,0x01,0x4D,0x50,0x4C,0x54,0x53,0x44,0, // CMPLTSD
0x02,0x02,0x4D,0x50,0x4C,0x54,0x53,0x53,0, // CMPLTSS
0xF5,0x01,0x4D,0x50,0x4E,0x45,0x51,0x50,0x44,0, // CMPNEQPD
0xFD,0x01,0x4D,0x50,0x4E,0x45,0x51,0x50,0x53,0, // CMPNEQPS
0xED,0x01,0x4D,0x50,0x4E,0x45,0x51,0x53,0x44,0, // CMPNEQSD
0x05,0x02,0x4D,0x50,0x4E,0x45,0x51,0x53,0x53,0, // CMPNEQSS
0xF7,0x01,0x4D,0x50,0x4E,0x4C,0x45,0x50,0x44,0, // CMPNLEPD
0xFF,0x01,0x4D,0x50,0x4E,0x4C,0x45,0x50,0x53,0, // CMPNLEPS
0xEF,0x01,0x4D,0x50,0x4E,0x4C,0x45,0x53,0x44,0, // CMPNLESD
0x07,0x02,0x4D,0x50,0x4E,0x4C,0x45,0x53,0x53,0, // CMPNLESS
0xF6,0x01,0x4D,0x50,0x4E,0x4C,0x54,0x50,0x44,0, // CMPNLTPD
0xFE,0x01,0x4D,0x50,0x4E,0x4C,0x54,0x50,0x53,0, // CMPNLTPS
0xEE,0x01,0x4D,0x50,0x4E,0x4C,0x54,0x53,0x44,0, // CMPNLTSD
0x06,0x02,0x4D,0x50,0x4E,0x4C,0x54,0x53,0x53,0, // CMPNLTSS
0xF8,0x01,0x4D,0x50,0x4F,0x52,0x44,0x50,0x44,0, // CMPORDPD
0x00,0x02,0x4D,0x50,0x4F,0x52,0x44,0x50,0x53,0, // CMPORDPS
0xF0,0x01,0x4D,0x50,0x4F,0x52,0x44,0x53,0x44,0, // CMPORDSD
0x08,0x02,0x4D,0x50,0x4F,0x52,0x44,0x53,0x53,0, // CMPORDSS
0xA9,0x01,0x4D,0x50,0x50,0x44,0, // CMPPD
0x79,0x01,0x4D,0x50,0x50,0x53,0, // CMPPS
0x62,0x00,0x4D,0x50,0x53,0x42,0, // CMPSB
0x64,0x00,0x4D,0x50,0x53,0x44,0, // CMPSD
0x7A,0x01,0x4D,0x50,0x53,0x53,0, // CMPSS
0x63,0x00,0x4D,0x50,0x53,0x57,0, // CMPSW
0xF4,0x01,0x4D,0x50,0x55,0x4E,0x4F,0x52,0x44,0x50,0x44,0, // CMPUNORDPD
0xFC,0x01,0x4D,0x50,0x55,0x4E,0x4F,0x52,0x44,0x50,0x53,0, // CMPUNORDPS
0xEC,0x01,0x4D,0x50,0x55,0x4E,0x4F,0x52,0x44,0x53,0x44,0, // CMPUNORDSD
0x04,0x02,0x4D,0x50,0x55,0x4E,0x4F,0x52,0x44,0x53,0x53,0, // CMPUNORDSS
0x30,0x00,0x4D,0x50,0x58,0x43,0x48,0x47,0, // CMPXCHG
0x31,0x00,0x4D,0x50,0x58,0x43,0x48,0x47,0x38,0x42,0, // CMPXCHG8B
0xAA,0x01,0x4F,0x4D,0x49,0x53,0x44,0, // COMISD
0x7B,0x01,0x4F,0x4D,0x49,0x53,0x53,0, // COMISS
0xB0,0x00,0x50,0x55,0x49,0x44,0, // CPUID
0xAB,0x01,0x56,0x54,0x44,0x51,0x32,0x50,0x44,0, // CVTDQ2PD
0xAC,0x01,0x56,0x54,0x44,0x51,0x32,0x50,0x53,0, // CVTDQ2PS
0xAD,0x01,0x56,0x54,0x50,0x44,0x32,0x44,0x51,0, // CVTPD2DQ
0xAE,0x01,0x56,0x54,0x50,0x44,0x32,0x50,0x49,0, // CVTPD2PI
0xAF,0x01,0x56,0x54,0x50,0x44,0x32,0x50,0x53,0, // CVTPD2PS
0xB0,0x01,0x56,0x54,0x50,0x49,0x32,0x50,0x44,0, // CVTPI2PD
0x7C,0x01,0x56,0x54,0x50,0x49,0x32,0x50,0x53,0, // CVTPI2PS
0xB1,0x01,0x56,0x54,0x50,0x53,0x32,0x44,0x51,0, // CVTPS2DQ
0xB2,0x01,0x56,0x54,0x50,0x53,0x32,0x50,0x44,0, // CVTPS2PD
0x7D,0x01,0x56,0x54,0x50,0x53,0x32,0x50,0x49,0, // CVTPS2PI
0xB3,0x01,0x56,0x54,0x53,0x44,0x32,0x53,0x49,0, // CVTSD2SI
0xB4,0x01,0x56,0x54,0x53,0x44,0x32,0x53,0x53,0, // CVTSD2SS
0xB5,0x01,0x56,0x54,0x53,0x49,0x32,0x53,0x44,0, // CVTSI2SD
0x7E,0x01,0x56,0x54,0x53,0x49,0x32,0x53,0x53,0, // CVTSI2SS
0xB6,0x01,0x56,0x54,0x53,0x53,0x32,0x53,0x44,0, // CVTSS2SD
0x7F,0x01,0x56,0x54,0x53,0x53,0x32,0x53,0x49,0, // CVTSS2SI
0xB8,0x01,0x56,0x54,0x54,0x50,0x44,0x32,0x44,0x51,0, // CVTTPD2DQ
0xB7,0x01,0x56,0x54,0x54,0x50,0x44,0x32,0x50,0x49,0, // CVTTPD2PI
0xB9,0x01,0x56,0x54,0x54,0x50,0x53,0x32,0x44,0x51,0, // CVTTPS2DQ
0x80,0x01,0x56,0x54,0x54,0x50,0x53,0x32,0x50,0x49,0, // CVTTPS2PI
0xBA,0x01,0x56,0x54,0x54,0x53,0x44,0x32,0x53,0x49,0, // CVTTSD2SI
0x81,0x01,0x56,0x54,0x54,0x53,0x53,0x32,0x53,0x49,0, // CVTTSS2SI
0x2A,0x00,0x57,0x44,0, // CWD
0x29,0x00,0x57,0x44,0x45,0, // CWDE
0xFF,0xFF, // end char 'C'
0x20,0x00,0x41,0x41,0, // DAA
0x21,0x00,0x41,0x53,0, // DAS
0xE5,0x00,0x42,0, // DB
0xE7,0x00,0x44,0, // DD
0x1B,0x00,0x45,0x43,0, // DEC
0x0C,0x00,0x49,0x56,0, // DIV
0xBB,0x01,0x49,0x56,0x50,0x44,0, // DIVPD
0x82,0x01,0x49,0x56,0x50,0x53,0, // DIVPS
0xBC,0x01,0x49,0x56,0x53,0x44,0, // DIVSD
0x83,0x01,0x49,0x56,0x53,0x53,0, // DIVSS
0xE6,0x00,0x57,0, // DW
0xFF,0xFF, // end char 'D'
0xD2,0x00,0x4D,0x4D,0x53,0, // EMMS
0x9A,0x00,0x4E,0x54,0x45,0x52,0, // ENTER
0xFF,0xFF, // end char 'E'
0xEB,0x00,0x32,0x58,0x4D,0x31,0, // F2XM1
0xEC,0x00,0x41,0x42,0x53,0, // FABS
0xED,0x00,0x41,0x44,0x44,0, // FADD
0xEE,0x00,0x41,0x44,0x44,0x50,0, // FADDP
0xEF,0x00,0x42,0x4C,0x44,0, // FBLD
0xF0,0x00,0x42,0x53,0x54,0x50,0, // FBSTP
0xF1,0x00,0x43,0x48,0x53,0, // FCHS
0xF2,0x00,0x43,0x4C,0x45,0x58,0, // FCLEX
0x41,0x01,0x43,0x4D,0x4F,0x56,0x42,0, // FCMOVB
0x43,0x01,0x43,0x4D,0x4F,0x56,0x42,0x45,0, // FCMOVBE
0x42,0x01,0x43,0x4D,0x4F,0x56,0x45,0, // FCMOVE
0x45,0x01,0x43,0x4D,0x4F,0x56,0x4E,0x42,0, // FCMOVNB
0x47,0x01,0x43,0x4D,0x4F,0x56,0x4E,0x42,0x45,0, // FCMOVNBE
0x46,0x01,0x43,0x4D,0x4F,0x56,0x4E,0x45,0, // FCMOVNE
0x48,0x01,0x43,0x4D,0x4F,0x56,0x4E,0x55,0, // FCMOVNU
0x44,0x01,0x43,0x4D,0x4F,0x56,0x55,0, // FCMOVU
0xF3,0x00,0x43,0x4F,0x4D,0, // FCOM
0x49,0x01,0x43,0x4F,0x4D,0x49,0, // FCOMI
0x4A,0x01,0x43,0x4F,0x4D,0x49,0x50,0, // FCOMIP
0xF4,0x00,0x43,0x4F,0x4D,0x50,0, // FCOMP
0xF6,0x00,0x43,0x4F,0x4D,0x50,0x50,0, // FCOMPP
0xF7,0x00,0x43,0x4F,0x53,0, // FCOS
0xF8,0x00,0x44,0x45,0x43,0x53,0x54,0x50,0, // FDECSTP
0xF9,0x00,0x44,0x49,0x53,0x49,0, // FDISI
0xFA,0x00,0x44,0x49,0x56,0, // FDIV
0xFB,0x00,0x44,0x49,0x56,0x50,0, // FDIVP
0xFC,0x00,0x44,0x49,0x56,0x52,0, // FDIVR
0xFD,0x00,0x44,0x49,0x56,0x52,0x50,0, // FDIVRP
0x0B,0x01,0x45,0x4E,0x49,0, // FENI
0xFE,0x00,0x46,0x52,0x45,0x45,0, // FFREE
0xFF,0x00,0x49,0x41,0x44,0x44,0, // FIADD
0x00,0x01,0x49,0x43,0x4F,0x4D,0, // FICOM
0x01,0x01,0x49,0x43,0x4F,0x4D,0x50,0, // FICOMP
0x02,0x01,0x49,0x44,0x49,0x56,0, // FIDIV
0x03,0x01,0x49,0x44,0x49,0x56,0x52,0, // FIDIVR
0x04,0x01,0x49,0x4C,0x44,0, // FILD
0x05,0x01,0x49,0x4C,0x44,0x51,0, // FILDQ
0x06,0x01,0x49,0x4D,0x55,0x4C,0, // FIMUL
0x0C,0x01,0x49,0x4E,0x43,0x53,0x54,0x50,0, // FINCSTP
0x0D,0x01,0x49,0x4E,0x49,0x54,0, // FINIT
0x07,0x01,0x49,0x53,0x54,0, // FIST
0x08,0x01,0x49,0x53,0x54,0x50,0, // FISTP
0x09,0x01,0x49,0x53,0x55,0x42,0, // FISUB
0x0A,0x01,0x49,0x53,0x55,0x42,0x52,0, // FISUBR
0x0F,0x01,0x4C,0x44,0, // FLD
0x18,0x01,0x4C,0x44,0x31,0, // FLD1
0x10,0x01,0x4C,0x44,0x43,0x57,0, // FLDCW
0x11,0x01,0x4C,0x44,0x45,0x4E,0x56,0, // FLDENV
0x14,0x01,0x4C,0x44,0x4C,0x32,0x45,0, // FLDL2E
0x15,0x01,0x4C,0x44,0x4C,0x32,0x54,0, // FLDL2T
0x12,0x01,0x4C,0x44,0x4C,0x47,0x32,0, // FLDLG2
0x13,0x01,0x4C,0x44,0x4C,0x4E,0x32,0, // FLDLN2
0x16,0x01,0x4C,0x44,0x50,0x49,0, // FLDPI
0x17,0x01,0x4C,0x44,0x5A,0, // FLDZ
0x19,0x01,0x4D,0x55,0x4C,0, // FMUL
0x1A,0x01,0x4D,0x55,0x4C,0x50,0, // FMULP
0xF5,0x00,0x4E,0x43,0x4C,0x45,0x58,0, // FNCLEX
0x4F,0x01,0x4E,0x44,0x49,0x53,0x49,0, // FNDISI
0x50,0x01,0x4E,0x45,0x4E,0x49,0, // FNENI
0x0E,0x01,0x4E,0x49,0x4E,0x49,0x54,0, // FNINIT
0x1B,0x01,0x4E,0x4F,0x50,0, // FNOP
0x24,0x01,0x4E,0x53,0x41,0x56,0x45,0, // FNSAVE
0x51,0x01,0x4E,0x53,0x45,0x54,0x50,0x4D,0, // FNSETPM
0x2B,0x01,0x4E,0x53,0x54,0x43,0x57,0, // FNSTCW
0x30,0x01,0x4E,0x53,0x54,0x45,0x4E,0x56,0, // FNSTENV
0x2E,0x01,0x4E,0x53,0x54,0x53,0x57,0, // FNSTSW
0x1C,0x01,0x50,0x41,0x54,0x41,0x4E,0, // FPATAN
0x1D,0x01,0x50,0x52,0x45,0x4D,0, // FPREM
0x1E,0x01,0x50,0x52,0x45,0x4D,0x31,0, // FPREM1
0x1F,0x01,0x50,0x54,0x41,0x4E,0, // FPTAN
0x20,0x01,0x52,0x4E,0x44,0x49,0x4E,0x54,0, // FRNDINT
0x22,0x01,0x52,0x53,0x54,0x4F,0x52,0, // FRSTOR
0x23,0x01,0x53,0x41,0x56,0x45,0, // FSAVE
0x25,0x01,0x53,0x43,0x41,0x4C,0x45,0, // FSCALE
0x21,0x01,0x53,0x45,0x54,0x50,0x4D,0, // FSETPM
0x26,0x01,0x53,0x49,0x4E,0, // FSIN
0x27,0x01,0x53,0x49,0x4E,0x43,0x4F,0x53,0, // FSINCOS
0x28,0x01,0x53,0x51,0x52,0x54,0, // FSQRT
0x29,0x01,0x53,0x54,0, // FST
0x2A,0x01,0x53,0x54,0x43,0x57,0, // FSTCW
0x2F,0x01,0x53,0x54,0x45,0x4E,0x56,0, // FSTENV
0x2C,0x01,0x53,0x54,0x50,0, // FSTP
0x2D,0x01,0x53,0x54,0x53,0x57,0, // FSTSW
0x31,0x01,0x53,0x55,0x42,0, // FSUB
0x32,0x01,0x53,0x55,0x42,0x50,0, // FSUBP
0x33,0x01,0x53,0x55,0x42,0x52,0, // FSUBR
0x34,0x01,0x53,0x55,0x42,0x52,0x50,0, // FSUBRP
0x35,0x01,0x54,0x53,0x54,0, // FTST
0x36,0x01,0x55,0x43,0x4F,0x4D,0, // FUCOM
0x4B,0x01,0x55,0x43,0x4F,0x4D,0x49,0, // FUCOMI
0x4C,0x01,0x55,0x43,0x4F,0x4D,0x49,0x50,0, // FUCOMIP
0x37,0x01,0x55,0x43,0x4F,0x4D,0x50,0, // FUCOMP
0x38,0x01,0x55,0x43,0x4F,0x4D,0x50,0x50,0, // FUCOMPP
0x3A,0x01,0x57,0x41,0x49,0x54,0, // FWAIT
0x3B,0x01,0x58,0x41,0x4D,0, // FXAM
0x39,0x01,0x58,0x43,0x48,0, // FXCH
0x4D,0x01,0x58,0x52,0x53,0x54,0x4F,0x52,0, // FXRSTOR
0x4E,0x01,0x58,0x53,0x41,0x56,0x45,0, // FXSAVE
0x3C,0x01,0x58,0x54,0x52,0x41,0x43,0x54,0, // FXTRACT
0x3D,0x01,0x59,0x4C,0x32,0x58,0, // FYL2X
0x3E,0x01,0x59,0x4C,0x32,0x58,0x50,0x31,0, // FYL2XP1
0xFF,0xFF, // end char 'F'
0x09,0x02,0x41,0x44,0x44,0x50,0x44,0, // HADDPD
0x0A,0x02,0x41,0x44,0x44,0x50,0x53,0, // HADDPS
0x36,0x00,0x41,0x4C,0x54,0, // HALT
0x36,0x00,0x4C,0x54,0, // HLT
0x0B,0x02,0x53,0x55,0x42,0x50,0x44,0, // HSUBPD
0x0C,0x02,0x53,0x55,0x42,0x50,0x53,0, // HSUBPS
0xFF,0xFF, // end char 'H'
0x0D,0x00,0x44,0x49,0x56,0, // IDIV
0x1D,0x00,0x4D,0x55,0x4C,0, // IMUL
0x57,0x00,0x4E,0, // IN
0x1A,0x00,0x4E,0x43,0, // INC
0x59,0x00,0x4E,0x53,0x42,0, // INSB
0x5B,0x00,0x4E,0x53,0x44,0, // INSD
0x5A,0x00,0x4E,0x53,0x57,0, // INSW
0x37,0x00,0x4E,0x54,0, // INT
0x38,0x00,0x4E,0x54,0x4F,0, // INTO
0xAD,0x00,0x4E,0x56,0x44,0, // INVD
0xE8,0x00,0x4E,0x56,0x4C,0x50,0x47,0, // INVLPG
0x39,0x00,0x52,0x45,0x54,0, // IRET
0x3A,0x00,0x52,0x45,0x54,0x44,0, // IRETD
0xFF,0xFF, // end char 'I'
0x7D,0x00,0x41,0, // JA
0x79,0x00,0x41,0x45,0, // JAE
0x78,0x00,0x42,0, // JB
0x7C,0x00,0x42,0x45,0, // JBE
0x78,0x00,0x43,0, // JC
0x70,0x00,0x43,0x58,0x5A,0, // JCXZ
0x7A,0x00,0x45,0, // JE
0x71,0x00,0x45,0x43,0x58,0x5A,0, // JECXZ
0x85,0x00,0x47,0, // JG
0x83,0x00,0x47,0x45,0, // JGE
0x82,0x00,0x4C,0, // JL
0x84,0x00,0x4C,0x45,0, // JLE
0x96,0x00,0x4D,0x50,0, // JMP
0x7C,0x00,0x4E,0x41,0, // JNA
0x78,0x00,0x4E,0x41,0x45,0, // JNAE
0x79,0x00,0x4E,0x42,0, // JNB
0x7D,0x00,0x4E,0x42,0x45,0, // JNBE
0x79,0x00,0x4E,0x43,0, // JNC
0x7B,0x00,0x4E,0x45,0, // JNE
0x84,0x00,0x4E,0x47,0, // JNG
0x82,0x00,0x4E,0x47,0x45,0, // JNGE
0x83,0x00,0x4E,0x4C,0, // JNL
0x85,0x00,0x4E,0x4C,0x45,0, // JNLE
0x77,0x00,0x4E,0x4F,0, // JNO
0x81,0x00,0x4E,0x50,0, // JNP
0x7F,0x00,0x4E,0x53,0, // JNS
0x7B,0x00,0x4E,0x5A,0, // JNZ
0x76,0x00,0x4F,0, // JO
0x80,0x00,0x50,0, // JP
0x80,0x00,0x50,0x45,0, // JPE
0x81,0x00,0x50,0x4F,0, // JPO
0x7E,0x00,0x53,0, // JS
0x7A,0x00,0x5A,0, // JZ
0xFF,0xFF, // end char 'J'
0x40,0x00,0x41,0x48,0x46,0, // LAHF
0xA4,0x00,0x41,0x52,0, // LAR
0x0D,0x02,0x44,0x44,0x51,0x55,0, // LDDQU
0x84,0x01,0x44,0x4D,0x58,0x43,0x53,0x52,0, // LDMXCSR
0x55,0x00,0x44,0x53,0, // LDS
0x50,0x00,0x45,0x41,0, // LEA
0x9B,0x00,0x45,0x41,0x56,0x45,0, // LEAVE
0x54,0x00,0x45,0x53,0, // LES
0xA3,0x01,0x46,0x45,0x4E,0x43,0x45,0, // LFENCE
0x51,0x00,0x46,0x53,0, // LFS
0xA8,0x00,0x47,0x44,0x54,0, // LGDT
0x52,0x00,0x47,0x53,0, // LGS
0xA9,0x00,0x49,0x44,0x54,0, // LIDT
0xA0,0x00,0x4C,0x44,0x54,0, // LLDT
0xAB,0x00,0x4D,0x53,0x57,0, // LMSW
0xE9,0x00,0x4F,0x41,0x44,0x41,0x4C,0x4C,0, // LOADALL
0x35,0x00,0x4F,0x43,0x4B,0, // LOCK
0x68,0x00,0x4F,0x44,0x53,0x42,0, // LODSB
0x6A,0x00,0x4F,0x44,0x53,0x44,0, // LODSD
0x69,0x00,0x4F,0x44,0x53,0x57,0, // LODSW
0x72,0x00,0x4F,0x4F,0x50,0, // LOOP
0x73,0x00,0x4F,0x4F,0x50,0x44,0, // LOOPD
0x74,0x00,0x4F,0x4F,0x50,0x45,0, // LOOPE
0x75,0x00,0x4F,0x4F,0x50,0x4E,0x45,0, // LOOPNE
0x75,0x00,0x4F,0x4F,0x50,0x4E,0x5A,0, // LOOPNZ
0x72,0x00,0x4F,0x4F,0x50,0x57,0, // LOOPW
0x74,0x00,0x4F,0x4F,0x50,0x5A,0, // LOOPZ
0xA5,0x00,0x53,0x4C,0, // LSL
0x53,0x00,0x53,0x53,0, // LSS
0xA1,0x00,0x54,0x52,0, // LTR
0xFF,0xFF, // end char 'L'
0xBD,0x01,0x41,0x53,0x4B,0x4D,0x4F,0x56,0x44,0x51,0x55,0, // MASKMOVDQU
0x62,0x01,0x41,0x53,0x4B,0x4D,0x4F,0x56,0x51,0, // MASKMOVQ
0xBE,0x01,0x41,0x58,0x50,0x44,0, // MAXPD
0x85,0x01,0x41,0x58,0x50,0x53,0, // MAXPS
0xBF,0x01,0x41,0x58,0x53,0x44,0, // MAXSD
0x86,0x01,0x41,0x58,0x53,0x53,0, // MAXSS
0xA4,0x01,0x46,0x45,0x4E,0x43,0x45,0, // MFENCE
0xC0,0x01,0x49,0x4E,0x50,0x44,0, // MINPD
0x87,0x01,0x49,0x4E,0x50,0x53,0, // MINPS
0xC1,0x01,0x49,0x4E,0x53,0x44,0, // MINSD
0x88,0x01,0x49,0x4E,0x53,0x53,0, // MINSS
0xE5,0x01,0x4F,0x4E,0x49,0x54,0x4F,0x52,0, // MONITOR
0x4F,0x00,0x4F,0x56,0, // MOV
0xC2,0x01,0x4F,0x56,0x41,0x50,0x44,0, // MOVAPD
0x89,0x01,0x4F,0x56,0x41,0x50,0x53,0, // MOVAPS
0xCE,0x00,0x4F,0x56,0x44,0, // MOVD
0x0E,0x02,0x4F,0x56,0x44,0x44,0x55,0x50,0, // MOVDDUP
0xC5,0x01,0x4F,0x56,0x44,0x51,0x32,0x51,0, // MOVDQ2Q
0xC3,0x01,0x4F,0x56,0x44,0x51,0x41,0, // MOVDQA
0xC4,0x01,0x4F,0x56,0x44,0x51,0x55,0, // MOVDQU
0x8A,0x01,0x4F,0x56,0x48,0x4C,0x50,0x53,0, // MOVHLPS
0xC6,0x01,0x4F,0x56,0x48,0x50,0x44,0, // MOVHPD
0x8B,0x01,0x4F,0x56,0x48,0x50,0x53,0, // MOVHPS
0x8C,0x01,0x4F,0x56,0x4C,0x48,0x50,0x53,0, // MOVLHPS
0xC7,0x01,0x4F,0x56,0x4C,0x50,0x44,0, // MOVLPD
0x8D,0x01,0x4F,0x56,0x4C,0x50,0x53,0, // MOVLPS
0xC8,0x01,0x4F,0x56,0x4D,0x53,0x4B,0x50,0x44,0, // MOVMSKPD
0x8E,0x01,0x4F,0x56,0x4D,0x53,0x4B,0x50,0x53,0, // MOVMSKPS
0xC9,0x01,0x4F,0x56,0x4E,0x54,0x44,0x51,0, // MOVNTDQ
0xCB,0x01,0x4F,0x56,0x4E,0x54,0x49,0, // MOVNTI
0xCA,0x01,0x4F,0x56,0x4E,0x54,0x50,0x44,0, // MOVNTPD
0x93,0x01,0x4F,0x56,0x4E,0x54,0x50,0x53,0, // MOVNTPS
0x63,0x01,0x4F,0x56,0x4E,0x54,0x51,0, // MOVNTQ
0xCF,0x00,0x4F,0x56,0x51,0, // MOVQ
0xCC,0x01,0x4F,0x56,0x51,0x32,0x44,0x51,0, // MOVQ2DQ
0x5F,0x00,0x4F,0x56,0x53,0x42,0, // MOVSB
0x61,0x00,0x4F,0x56,0x53,0x44,0, // MOVSD
0x0F,0x02,0x4F,0x56,0x53,0x48,0x44,0x55,0x50,0, // MOVSHDUP
0x10,0x02,0x4F,0x56,0x53,0x4C,0x44,0x55,0x50,0, // MOVSLDUP
0x8F,0x01,0x4F,0x56,0x53,0x53,0, // MOVSS
0x60,0x00,0x4F,0x56,0x53,0x57,0, // MOVSW
0x27,0x00,0x4F,0x56,0x53,0x58,0, // MOVSX
0xCD,0x01,0x4F,0x56,0x55,0x50,0x44,0, // MOVUPD
0x90,0x01,0x4F,0x56,0x55,0x50,0x53,0, // MOVUPS
0x26,0x00,0x4F,0x56,0x5A,0x58,0, // MOVZX
0x0A,0x00,0x55,0x4C,0, // MUL
0xCE,0x01,0x55,0x4C,0x50,0x44,0, // MULPD
0x91,0x01,0x55,0x4C,0x50,0x53,0, // MULPS
0xCF,0x01,0x55,0x4C,0x53,0x44,0, // MULSD
0x92,0x01,0x55,0x4C,0x53,0x53,0, // MULSS
0xE6,0x01,0x57,0x41,0x49,0x54,0, // MWAIT
0xFF,0xFF, // end char 'M'
0x09,0x00,0x45,0x47,0, // NEG
0x33,0x00,0x4F,0x50,0, // NOP
0x08,0x00,0x4F,0x54,0, // NOT
0xFF,0xFF, // end char 'N'
0xEA,0x00,0x50,0x53,0x49,0x5A,0x45,0, // OPSIZE
0x01,0x00,0x52,0, // OR
0xD0,0x01,0x52,0x50,0x44,0, // ORPD
0x94,0x01,0x52,0x50,0x53,0, // ORPS
0x58,0x00,0x55,0x54,0, // OUT
0x5C,0x00,0x55,0x54,0x53,0x42,0, // OUTSB
0x5E,0x00,0x55,0x54,0x53,0x44,0, // OUTSD
0x5D,0x00,0x55,0x54,0x53,0x57,0, // OUTSW
0xFF,0xFF, // end char 'O'
0xC1,0x00,0x41,0x43,0x4B,0x53,0x53,0x44,0x57,0, // PACKSSDW
0xB9,0x00,0x41,0x43,0x4B,0x53,0x53,0x57,0x42,0, // PACKSSWB
0xBD,0x00,0x41,0x43,0x4B,0x55,0x53,0x57,0x42,0, // PACKUSWB
0xE2,0x00,0x41,0x44,0x44,0x42,0, // PADDB
0xE4,0x00,0x41,0x44,0x44,0x44,0, // PADDD
0xDF,0x01,0x41,0x44,0x44,0x51,0, // PADDQ
0xDB,0x00,0x41,0x44,0x44,0x53,0x42,0, // PADDSB
0xDC,0x00,0x41,0x44,0x44,0x53,0x57,0, // PADDSW
0xD4,0x00,0x41,0x44,0x44,0x55,0x53,0x42,0, // PADDUSB
0xD5,0x00,0x41,0x44,0x44,0x55,0x53,0x57,0, // PADDUSW
0xE3,0x00,0x41,0x44,0x44,0x57,0, // PADDW
0xD3,0x00,0x41,0x4E,0x44,0, // PAND
0xD6,0x00,0x41,0x4E,0x44,0x4E,0, // PANDN
0x11,0x02,0x41,0x55,0x53,0x45,0, // PAUSE
0x64,0x01,0x41,0x56,0x47,0x42,0, // PAVGB
0x65,0x01,0x41,0x56,0x47,0x57,0, // PAVGW
0xCA,0x00,0x43,0x4D,0x50,0x45,0x51,0x42,0, // PCMPEQB
0xCC,0x00,0x43,0x4D,0x50,0x45,0x51,0x44,0, // PCMPEQD
0xCB,0x00,0x43,0x4D,0x50,0x45,0x51,0x57,0, // PCMPEQW
0xBA,0x00,0x43,0x4D,0x50,0x47,0x54,0x42,0, // PCMPGTB
0xBC,0x00,0x43,0x4D,0x50,0x47,0x54,0x44,0, // PCMPGTD
0xBB,0x00,0x43,0x4D,0x50,0x47,0x54,0x57,0, // PCMPGTW
0x66,0x01,0x45,0x58,0x54,0x52,0x57,0, // PEXTRW
0x67,0x01,0x49,0x4E,0x53,0x52,0x57,0, // PINSRW
0xDE,0x00,0x4D,0x41,0x44,0x44,0x57,0x44,0, // PMADDWD
0x69,0x01,0x4D,0x41,0x58,0x53,0x57,0, // PMAXSW
0x68,0x01,0x4D,0x41,0x58,0x55,0x42,0, // PMAXUB
0x6B,0x01,0x4D,0x49,0x4E,0x53,0x57,0, // PMINSW
0x6A,0x01,0x4D,0x49,0x4E,0x55,0x42,0, // PMINUB
0x6C,0x01,0x4D,0x4F,0x56,0x4D,0x53,0x4B,0x42,0, // PMOVMSKB
0x6D,0x01,0x4D,0x55,0x4C,0x48,0x55,0x57,0, // PMULHUW
0xD7,0x00,0x4D,0x55,0x4C,0x48,0x57,0, // PMULHW
0xCD,0x00,0x4D,0x55,0x4C,0x4C,0x57,0, // PMULLW
0xE0,0x01,0x4D,0x55,0x4C,0x55,0x44,0x51,0, // PMULUDQ
0x4B,0x00,0x4F,0x50,0, // POP
0x4C,0x00,0x4F,0x50,0x41,0, // POPA
0x4D,0x00,0x4F,0x50,0x41,0x44,0, // POPAD
0x3B,0x00,0x4F,0x50,0x46,0, // POPF
0x3C,0x00,0x4F,0x50,0x46,0x44,0, // POPFD
0xDA,0x00,0x4F,0x52,0, // POR
0x71,0x01,0x52,0x45,0x46,0x45,0x54,0x43,0x48,0x4E,0x54,0x41,0, // PREFETCHNTA
0x6E,0x01,0x52,0x45,0x46,0x45,0x54,0x43,0x48,0x54,0x30,0, // PREFETCHT0
0x6F,0x01,0x52,0x45,0x46,0x45,0x54,0x43,0x48,0x54,0x31,0, // PREFETCHT1
0x70,0x01,0x52,0x45,0x46,0x45,0x54,0x43,0x48,0x54,0x32,0, // PREFETCHT2
0x73,0x01,0x53,0x41,0x44,0x42,0x57,0, // PSADBW
0xD1,0x01,0x53,0x48,0x55,0x46,0x44,0, // PSHUFD
0xD2,0x01,0x53,0x48,0x55,0x46,0x48,0x57,0, // PSHUFHW
0xD3,0x01,0x53,0x48,0x55,0x46,0x4C,0x57,0, // PSHUFLW
0x74,0x01,0x53,0x48,0x55,0x46,0x57,0, // PSHUFW
0xC8,0x00,0x53,0x4C,0x4C,0x44,0, // PSLLD
0xD4,0x01,0x53,0x4C,0x4C,0x44,0x51,0, // PSLLDQ
0xC9,0x00,0x53,0x4C,0x4C,0x51,0, // PSLLQ
0xC7,0x00,0x53,0x4C,0x4C,0x57,0, // PSLLW
0xC6,0x00,0x53,0x52,0x41,0x44,0, // PSRAD
0xC5,0x00,0x53,0x52,0x41,0x57,0, // PSRAW
0xC3,0x00,0x53,0x52,0x4C,0x44,0, // PSRLD
0xD5,0x01,0x53,0x52,0x4C,0x44,0x51,0, // PSRLDQ
0xC4,0x00,0x53,0x52,0x4C,0x51,0, // PSRLQ
0xC2,0x00,0x53,0x52,0x4C,0x57,0, // PSRLW
0xDF,0x00,0x53,0x55,0x42,0x42,0, // PSUBB
0xE1,0x00,0x53,0x55,0x42,0x44,0, // PSUBD
0xE1,0x01,0x53,0x55,0x42,0x51,0, // PSUBQ
0xD8,0x00,0x53,0x55,0x42,0x53,0x42,0, // PSUBSB
0xD9,0x00,0x53,0x55,0x42,0x53,0x57,0, // PSUBSW
0xD0,0x00,0x53,0x55,0x42,0x55,0x53,0x42,0, // PSUBUSB
0xD1,0x00,0x53,0x55,0x42,0x55,0x53,0x57,0, // PSUBUSW
0xE0,0x00,0x53,0x55,0x42,0x57,0, // PSUBW
0xBE,0x00,0x55,0x4E,0x50,0x43,0x4B,0x48,0x42,0x57,0, // PUNPCKHBW
0xC0,0x00,0x55,0x4E,0x50,0x43,0x4B,0x48,0x44,0x51,0, // PUNPCKHDQ
0xE2,0x01,0x55,0x4E,0x50,0x43,0x4B,0x48,0x51,0x44,0x51,0, // PUNPCKHQDQ
0xBF,0x00,0x55,0x4E,0x50,0x43,0x4B,0x48,0x57,0x44,0, // PUNPCKHWD
0xB6,0x00,0x55,0x4E,0x50,0x43,0x4B,0x4C,0x42,0x57,0, // PUNPCKLBW
0xB8,0x00,0x55,0x4E,0x50,0x43,0x4B,0x4C,0x44,0x51,0, // PUNPCKLDQ
0xE3,0x01,0x55,0x4E,0x50,0x43,0x4B,0x4C,0x51,0x44,0x51,0, // PUNPCKLQDQ
0xB7,0x00,0x55,0x4E,0x50,0x43,0x4B,0x4C,0x57,0x44,0, // PUNPCKLWD
0x48,0x00,0x55,0x53,0x48,0, // PUSH
0x49,0x00,0x55,0x53,0x48,0x41,0, // PUSHA
0x4A,0x00,0x55,0x53,0x48,0x41,0x44,0, // PUSHAD
0x3D,0x00,0x55,0x53,0x48,0x46,0, // PUSHF
0x3E,0x00,0x55,0x53,0x48,0x46,0x44,0, // PUSHFD
0xDD,0x00,0x58,0x4F,0x52,0, // PXOR
0xFF,0xFF, // end char 'P'
0x10,0x00,0x43,0x4C,0, // RCL
0x95,0x01,0x43,0x50,0x50,0x53,0, // RCPPS
0x96,0x01,0x43,0x50,0x53,0x53,0, // RCPSS
0x11,0x00,0x43,0x52,0, // RCR
0xB1,0x00,0x44,0x4D,0x53,0x52,0, // RDMSR
0xB4,0x00,0x44,0x50,0x4D,0x43,0, // RDPMC
0xB2,0x00,0x44,0x54,0x53,0x43,0, // RDTSC
0x6F,0x00,0x45,0x50,0, // REP
0x6F,0x00,0x45,0x50,0x45,0, // REPE
0x6E,0x00,0x45,0x50,0x4E,0x45,0, // REPNE
0x6E,0x00,0x45,0x50,0x4E,0x5A,0, // REPNZ
0x6F,0x00,0x45,0x50,0x5A,0, // REPZ
0x98,0x00,0x45,0x54,0, // RET
0x99,0x00,0x45,0x54,0x46,0, // RETF
0x0E,0x00,0x4F,0x4C,0, // ROL
0x0F,0x00,0x4F,0x52,0, // ROR
0xB3,0x00,0x53,0x4D,0, // RSM
0x97,0x01,0x53,0x51,0x52,0x54,0x50,0x53,0, // RSQRTPS
0x98,0x01,0x53,0x51,0x52,0x54,0x53,0x53,0, // RSQRTSS
0xFF,0xFF, // end char 'R'
0x3F,0x00,0x41,0x48,0x46,0, // SAHF
0x12,0x00,0x41,0x4C,0, // SAL
0x15,0x00,0x41,0x52,0, // SAR
0x03,0x00,0x42,0x42,0, // SBB
0x03,0x00,0x42,0x43,0, // SBC
0x6B,0x00,0x43,0x41,0x53,0x42,0, // SCASB
0x6D,0x00,0x43,0x41,0x53,0x44,0, // SCASD
0x6C,0x00,0x43,0x41,0x53,0x57,0, // SCASW
0x8D,0x00,0x45,0x54,0x41,0, // SETA
0x89,0x00,0x45,0x54,0x41,0x45,0, // SETAE
0x88,0x00,0x45,0x54,0x42,0, // SETB
0x8C,0x00,0x45,0x54,0x42,0x45,0, // SETBE
0x88,0x00,0x45,0x54,0x43,0, // SETC
0x8A,0x00,0x45,0x54,0x45,0, // SETE
0x95,0x00,0x45,0x54,0x47,0, // SETG
0x93,0x00,0x45,0x54,0x47,0x45,0, // SETGE
0x92,0x00,0x45,0x54,0x4C,0, // SETL
0x94,0x00,0x45,0x54,0x4C,0x45,0, // SETLE
0x8C,0x00,0x45,0x54,0x4E,0x41,0, // SETNA
0x88,0x00,0x45,0x54,0x4E,0x41,0x45,0, // SETNAE
0x89,0x00,0x45,0x54,0x4E,0x42,0, // SETNB
0x8D,0x00,0x45,0x54,0x4E,0x42,0x45,0, // SETNBE
0x89,0x00,0x45,0x54,0x4E,0x43,0, // SETNC
0x8B,0x00,0x45,0x54,0x4E,0x45,0, // SETNE
0x94,0x00,0x45,0x54,0x4E,0x47,0, // SETNG
0x92,0x00,0x45,0x54,0x4E,0x47,0x45,0, // SETNGE
0x93,0x00,0x45,0x54,0x4E,0x4C,0, // SETNL
0x95,0x00,0x45,0x54,0x4E,0x4C,0x45,0, // SETNLE
0x87,0x00,0x45,0x54,0x4E,0x4F,0, // SETNO
0x91,0x00,0x45,0x54,0x4E,0x50,0, // SETNP
0x8F,0x00,0x45,0x54,0x4E,0x53,0, // SETNS
0x8B,0x00,0x45,0x54,0x4E,0x5A,0, // SETNZ
0x86,0x00,0x45,0x54,0x4F,0, // SETO
0x90,0x00,0x45,0x54,0x50,0, // SETP
0x90,0x00,0x45,0x54,0x50,0x45,0, // SETPE
0x91,0x00,0x45,0x54,0x50,0x4F,0, // SETPO
0x8E,0x00,0x45,0x54,0x53,0, // SETS
0x8A,0x00,0x45,0x54,0x5A,0, // SETZ
0x72,0x01,0x46,0x45,0x4E,0x43,0x45,0, // SFENCE
0xA6,0x00,0x47,0x44,0x54,0, // SGDT
0x12,0x00,0x48,0x4C,0, // SHL
0x1E,0x00,0x48,0x4C,0x44,0, // SHLD
0x13,0x00,0x48,0x52,0, // SHR
0x1F,0x00,0x48,0x52,0x44,0, // SHRD
0xD6,0x01,0x48,0x55,0x46,0x50,0x44,0, // SHUFPD
0x99,0x01,0x48,0x55,0x46,0x50,0x53,0, // SHUFPS
0xA7,0x00,0x49,0x44,0x54,0, // SIDT
0x9E,0x00,0x4C,0x44,0x54,0, // SLDT
0xAA,0x00,0x4D,0x53,0x57,0, // SMSW
0xD7,0x01,0x51,0x52,0x54,0x50,0x44,0, // SQRTPD
0x9A,0x01,0x51,0x52,0x54,0x50,0x53,0, // SQRTPS
0xD8,0x01,0x51,0x52,0x54,0x53,0x44,0, // SQRTSD
0x9B,0x01,0x51,0x52,0x54,0x53,0x53,0, // SQRTSS
0x43,0x00,0x54,0x43,0, // STC
0x47,0x00,0x54,0x44,0, // STD
0x45,0x00,0x54,0x49,0, // STI
0x9C,0x01,0x54,0x4D,0x58,0x43,0x53,0x52,0, // STMXCSR
0x65,0x00,0x54,0x4F,0x53,0x42,0, // STOSB
0x67,0x00,0x54,0x4F,0x53,0x44,0, // STOSD
0x66,0x00,0x54,0x4F,0x53,0x57,0, // STOSW
0x9F,0x00,0x54,0x52,0, // STR
0x05,0x00,0x55,0x42,0, // SUB
0xD9,0x01,0x55,0x42,0x50,0x44,0, // SUBPD
0x9D,0x01,0x55,0x42,0x50,0x53,0, // SUBPS
0xDA,0x01,0x55,0x42,0x53,0x44,0, // SUBSD
0x9E,0x01,0x55,0x42,0x53,0x53,0, // SUBSS
0x3F,0x01,0x59,0x53,0x45,0x4E,0x54,0x45,0x52,0, // SYSENTER
0x40,0x01,0x59,0x53,0x45,0x58,0x49,0x54,0, // SYSEXIT
0xFF,0xFF, // end char 'S'
0x1C,0x00,0x45,0x53,0x54,0, // TEST
0xFF,0xFF, // end char 'T'
0xDB,0x01,0x43,0x4F,0x4D,0x49,0x53,0x44,0, // UCOMISD
0x9F,0x01,0x43,0x4F,0x4D,0x49,0x53,0x53,0, // UCOMISS
0xB5,0x00,0x44,0x32,0, // UD2
0xDC,0x01,0x4E,0x50,0x43,0x4B,0x48,0x50,0x44,0, // UNPCKHPD
0xA0,0x01,0x4E,0x50,0x43,0x4B,0x48,0x50,0x53,0, // UNPCKHPS
0xDD,0x01,0x4E,0x50,0x43,0x4B,0x4C,0x50,0x44,0, // UNPCKLPD
0xA1,0x01,0x4E,0x50,0x43,0x4B,0x4C,0x50,0x53,0, // UNPCKLPS
0xFF,0xFF, // end char 'U'
0xA2,0x00,0x45,0x52,0x52,0, // VERR
0xA3,0x00,0x45,0x52,0x57,0, // VERW
0xFF,0xFF, // end char 'V'
0x34,0x00,0x41,0x49,0x54,0, // WAIT
0xAE,0x00,0x42,0x49,0x4E,0x56,0x44,0, // WBINVD
0xAF,0x00,0x52,0x4D,0x53,0x52,0, // WRMSR
0xFF,0xFF, // end char 'W'
0x32,0x00,0x41,0x44,0x44,0, // XADD
0x4E,0x00,0x43,0x48,0x47,0, // XCHG
0x2D,0x00,0x4C,0x41,0x54,0, // XLAT
0x2D,0x00,0x4C,0x41,0x54,0x42,0, // XLATB
0x06,0x00,0x4F,0x52,0, // XOR
0xDE,0x01,0x4F,0x52,0x50,0x44,0, // XORPD
0xA2,0x01,0x4F,0x52,0x50,0x53,0, // XORPS
0xFF,0xFF // end char 'X'
};

View File

@ -0,0 +1,14 @@
; В этом файле можно изменить настройки компилятора по умолчанию.
J0 ; не делать начальный jump на main()
8 ; оптимизация для Pentium II процессора.
r- ; запретить изменение доступной памяти в *.com файлах
X ; запретить включение в выходной файл надписи SPHINXC--
oc ; опримизация по размеру кода
w ; выдавать предупреждения
wf=warning.txt ; предупреждения выводить в файл warning
nw=1 ; не показывать кое-какие ошибки в warning.txt
nw=2 ; не показывать кое-какие ошибки в warning.txt
;de ; использовать временное расширение типа при делении
;ON ; включить оптимизацию чисел
;ost ; оптимизировать текстовые константы
IP=..\lib

View File

@ -0,0 +1,88 @@
#define _CLASS_
#include "tok.h"
structteg *searchteg=NULL;
int destructor=FALSE;
void notclassname(char *name)
{
char buf[90];
sprintf(buf,"'%s' not class name",name);
preerror(buf);
nexttok(); //¯à®¯ã᪠::
nexttok();
}
void notclassproc(char *classname, char* procname)
{
char buf[160];
sprintf(buf,"'%s' not member class '%s'",procname,classname);
preerror(buf);
}
void AddThis()
{
int lsize=(am32==TRUE?4:2);
localrec *lrec=addlocalvar("this",(am32==TRUE?tk_dwordvar:tk_wordvar),paramsize);
lrec->rec.recsize=lsize;
lrec->rec.type=tp_paramvar;
lrec->fuse=USEDVAR;
paramsize+=lsize;
}
void doclassproc(unsigned int tproc)
{
int type=itok.rm; //⨯ ¢®§¢à â 
unsigned int flag=itok.flag;
unsigned int npointr=itok.npointr;
char classname[IDLENGTH];
if((searchteg=FindTeg(TRUE,itok.name))!=NULL){
strcpy(classname,itok.name);
nexttok(); //¯à®¯ã᪠::
if(tok2==tk_tilda){
nexttok();
destructor=TRUE;
flag|=fs_destructor;
type=tk_void;
}
nexttok();
char *tn;
char name[IDLENGTH];
strcpy(name,itok.name);
if((tn=strchr(name,'@'))!=NULL)*tn=0;
if(strcmp(classname,name)==0&&(flag&fs_destructor)==0)flag|=fs_constructor;
if((tok!=tk_declare&&tok!=tk_undefproc)||(itok.flag&f_classproc)==0){
notclassproc(classname,name);
searchteg=NULL;
define_procedure();
return;
}
if(tproc==0){
if(CidOrID()==tk_ID)tproc=tk_fastcall;
else tproc=(comfile==file_w32?tk_stdcall:tk_pascal);
}
flag|=(tproc-tk_pascal)*2;
if(type==tokens)type=am32==FALSE?tk_word:tk_dword;
if(flag!=itok.flag||type!=itok.rm||(unsigned short)npointr!=itok.npointr){
// printf("flag %08X - %08X\n",flag,itok.flag);
// printf("type %u - %u\n",type,itok.rm);
redeclare(name);
}
if(dynamic_flag){
dynamic_proc();
searchteg=NULL;
return;
}
// if(itok.flag&f_static)searchteg=NULL;
if(AlignProc!=FALSE)AlignCD(CS,alignproc);
if(dbg)AddLine();
setproc(1);
}
else{
notclassname(itok.name);
setproc(0);
}
dopoststrings();
}

106
programs/develop/cmm/coff.h Normal file
View File

@ -0,0 +1,106 @@
//
// Section characteristics.
//
// IMAGE_SCN_TYPE_REG 0x00000000 // Reserved.
// IMAGE_SCN_TYPE_DSECT 0x00000001 // Reserved.
// IMAGE_SCN_TYPE_NOLOAD 0x00000002 // Reserved.
// IMAGE_SCN_TYPE_GROUP 0x00000004 // Reserved.
#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
// IMAGE_SCN_TYPE_COPY 0x00000010 // Reserved.
#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code.
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data.
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data.
#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
// IMAGE_SCN_TYPE_OVER 0x00000400 // Reserved.
#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat.
// 0x00002000 // Reserved.
// IMAGE_SCN_MEM_PROTECTED - Obsolete 0x00004000
#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 // Reset speculative exceptions handling bits in the TLB entries for this section.
#define IMAGE_SCN_GPREL 0x00008000 // Section content can be accessed relative to GP
#define IMAGE_SCN_MEM_FARDATA 0x00008000
// IMAGE_SCN_MEM_SYSHEAP - Obsolete 0x00010000
#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
#define IMAGE_SCN_MEM_16BIT 0x00020000
#define IMAGE_SCN_MEM_LOCKED 0x00040000
#define IMAGE_SCN_MEM_PRELOAD 0x00080000
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified.
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
#define IMAGE_SCN_ALIGN_128BYTES 0x00800000 //
#define IMAGE_SCN_ALIGN_256BYTES 0x00900000 //
#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 //
#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 //
#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 //
#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 //
#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 //
// Unused 0x00F00000
#define IMAGE_SCN_ALIGN_MASK 0x00F00000
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 // Section contains extended relocations.
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded.
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable.
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable.
#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable.
#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable.
#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable.
#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable.
//
// I386 relocation types.
//
#define IMAGE_REL_I386_ABSOLUTE 0x0000 //Reference is absolute, no relocation is necessary
#define IMAGE_REL_I386_DIR16 0x0001 //Direct 16-bit reference to the symbols virtual address
#define IMAGE_REL_I386_REL16 0x0002 //PC-relative 16-bit reference to the symbols virtual address
#define IMAGE_REL_I386_DIR32 0x0006 //Direct 32-bit reference to the symbols virtual address
#define IMAGE_REL_I386_DIR32NB 0x0007 //Direct 32-bit reference to the symbols virtual address, base not included
#define IMAGE_REL_I386_SEG12 0x0009 //Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
#define IMAGE_REL_I386_SECTION 0x000A
#define IMAGE_REL_I386_SECREL 0x000B
#define IMAGE_REL_I386_REL32 0x0014 //PC-relative 32-bit reference to the symbols virtual address
typedef struct _COFF_HEADER_
{
short cpu; //¬¨­ ⨯ CPU - ¢á¥£¤  0x14C
short numobj; //ç¨á«® ¢å®¤®¢ ¢ â ¡«¨æã ®¡ê¥ªâ®¢
long date_time; //¤ â  ¬®¤¨ä¨ª æ¨¨ «¨­ª¥à®¬
long pCOFF;
long COFFsize;
short SizeOfOptionalHeader;
short Characteristics;
}COFF_HEADER;
typedef struct _IMAGE_SYMBOL
{
union{
char sname[8];
struct{
unsigned long Short;
unsigned long Long;
}Name;
char *LongName[2];
}N;
unsigned long Value;
short SectionNumber;
unsigned short Type;
unsigned char StorageClass;
unsigned char NumberOfAuxSymbols;
}IMAGE_SYMBOL;
typedef struct _IMAGE_RELOCATION {
union {
unsigned long VirtualAddress;
unsigned long RelocCount; // Set to the real count when IMAGE_SCN_LNK_NRELOC_OVFL is set
};
unsigned long SymbolTableIndex;
unsigned short Type;
}IMAGE_RELOCATION;

View File

@ -0,0 +1,513 @@
#define FALSE 0
#define TRUE 1
#define LOCAL -1
#define DYNAMIC_POST 2
#define DYNAMIC_VAR 3
#define USED_DIN_VAR 4
#define r_undef 0
#define r8 1
#define r16 2
#define r32 4
#define r64 8
#define r128 16
#define CODE16 0x100
#define CODE32 0x200
#define THIS_PARAM 0x300
#define THIS_REG 0x400
#define THIS_NEW 0x500
#define THIS_ZEROSIZE 0x600
enum{
dm_other,
dm_none,
dm_def0,
dm_def,
dm_if,
};
enum{
STDLEX,
RESLEX,
DEFLEX,
DEFLEX2,
ASMLEX,
};
enum{
zero_term,
dos_term,
no_term,
s_unicod=4
};
enum{
NOTINITVAR,
INITVAR,
USEDVAR,
INITUSEVAR
};
enum{
tp_ucnovn,
tp_declare,
tp_localvar,
tp_paramvar,
tp_postvar,
tp_gvar,
tp_label,
tp_stopper,
tp_opperand,
tp_compare,
tp_modif,
tp_ofs,
tp_classvar,
};
enum{
stdcompr,
voidcompr=4,
zerocompr=8,
ecxzcompr=0xc,
cxzcompr=0x10,
ecxnzcompr=0x14,
cxnzcompr=0x18
};
enum{
tk_eof, tk_number, tk_string, tk_id, tk_ID,
tk_assign, tk_swap, tk_minus, tk_plus, tk_minusminus,
tk_plusplus, tk_mult, tk_div, tk_mod, tk_multminus,
tk_divminus, tk_modminus, tk_rr, tk_ll, tk_rrminus,
tk_llminus, tk_minusequals, tk_plusequals, tk_rrequals, tk_llequals,
tk_or, tk_and, tk_xor, tk_not, tk_orminus,
tk_andminus, tk_xorminus, tk_orequals, tk_andequals, tk_xorequals,
tk_equalto, tk_notequal, tk_greater, tk_greaterequal,tk_less,
//40
tk_lessequal, tk_oror, tk_andand, tk_openbrace, tk_closebrace,
tk_openbracket, tk_closebracket,tk_openblock, tk_closeblock, tk_colon,
tk_semicolon, tk_camma, tk_period, tk_at, tk_numsign,
tk_dollar, tk_question, tk_tilda,
tk_void, tk_char,
//60
tk_byte, tk_int, tk_word, tk_long, tk_dword,
tk_float, tk_qword, tk_double,
tk_if, tk_IF,
tk_else, tk_ELSE, tk_loop, tk_do, tk_while,
tk_return, tk_from, tk_extract, tk_interrupt, tk_far,
//80
tk_enum, tk_seg, tk_debugreg, tk_controlreg, tk_testreg,
tk_undefproc, tk_proc, tk_interruptproc,
tk_bits, tk_charvar,
//90
tk_bytevar, tk_intvar, tk_wordvar, tk_longvar, tk_dwordvar,
tk_floatvar, tk_qwordvar, tk_doublevar, tk_reg, tk_beg,
//100
tk_reg32, tk_rmnumber, tk_postnumber, tk_locallabel, tk_overflowflag,
tk_notoverflowflag,tk_carryflag,tk_notcarryflag,tk_zeroflag, tk_notzeroflag,
//110
tk_comment1, tk_comment2, tk_minusflag, tk_plusflag, tk_RETURN,
tk_dataptr, tk_codeptr, tk_postptr, tk_stackstart, tk_inline,
//120
tk_GOTO, tk_goto, tk_BREAK, tk_break, tk_CONTINUE,
tk_continue, tk_WHILE, tk_FOR, tk_for, tk_asm,
//130
tk_switch, tk_case, tk_default, tk_mmxreg, tk_fpust,
tk_multequals, tk_divequals, tk_struct, tk_structvar, tk_sizeof,
//140
tk_undefofs, tk_pointer, tk_localpointer,tk_parampointer,tk_apiproc,
tk_extern, tk_declare, tk_pascal, tk_cdecl, tk_stdcall,
//150
tk_fastcall, tk_union, tk_export, tk_multipoint, tk_LOOPNZ,
tk_loopnz, tk_idasm, tk_short, tk_unsigned, tk_signed,
//160
tk_file, tk_line, tk_SWITCH, tk_CASE, tk_xmmreg,
tk_dblcolon, tk_static, tk_baseclass, tk_rescommand, tk_endline,
//170
tk_singlquote, tk_new, tk_delete, tk_macro, tk_reg64,
tk_newline, tk_apioffset, tokens
};
// 16-bit word regs
#define AX 0
#define CX 1
#define DX 2
#define BX 3
#define SP 4
#define BP 5
#define SI 6
#define DI 7
// 8-bit byte regs
#define AL 0
#define CL 1
#define DL 2
#define BL 3
#define AH 4
#define CH 5
#define DH 6
#define BH 7
// 386+ 32-bit regs
#define EAX 0
#define ECX 1
#define EDX 2
#define EBX 3
#define ESP 4
#define EBP 5
#define ESI 6
#define EDI 7
//ª®­à®«ì à §àã襭¨ï ॣ¨áâ஢
#define dEAX 1
#define dECX 2
#define dEDX 4
#define dEBX 8
#define dESP 16
#define dEBP 32
#define dESI 64
#define dEDI 128
#define ES 0
#define CS 1
#define SS 2
#define DS 3
#define FS 4
#define GS 5
#define VARPOST 9
#define USEDSTR 10
// 386+ control regs
#define CR0 0
#define CR1 1
#define CR2 2
#define CR3 3
#define CR4 4
#define CR5 5
#define CR6 6
#define CR7 7
// 386+ test regs
#define TR0 0
#define TR1 1
#define TR2 2
#define TR3 3
#define TR4 4
#define TR5 5
#define TR6 6
#define TR7 7
// 386+ debug regs
#define DR0 0
#define DR1 1
#define DR2 2
#define DR3 3
#define DR4 4
#define DR5 5
#define DR6 6
#define DR7 7
//¯¥à¥¬¥­­ ï, 㪠§ â¥«ì, ¤ «ì­¨© 㪠§ â¥«ì,ᥣ¬¥­â­ë© 㪠§ â¥«ì.
#define variable 0
#define pointer 1
//#define farpointer 2
// define exit codes
#define e_ok 0
#define e_outofmemory 1
#define e_cannotopeninput 2
#define e_toomanyerrors 3
#define e_internalerror 4
#define e_noinputspecified 5
#define e_unknowncommandline 6
#define e_entrynotfound 7
#define e_outputtoobig 8
#define e_notcreateoutput 9
#define e_preprocess 10
#define e_someerrors 13
#define e_badinputfilename 14
#define e_symbioerror 15
#define e_manyinclude 16
#define rm_mod00 0
#define rm_mod01 64
#define rm_mod10 128
#define rm_mod11 192
#define rm_d16 6
#define rm_BXSI 0
#define rm_BXDI 1
#define rm_BPSI 2
#define rm_BPDI 3
#define rm_SI 4
#define rm_DI 5
#define rm_BP 6
#define rm_BX 7
#define rm_sib 4
#define rm_d32 5
#define rm_EBP 5
// posttype values for call or jump types or post variables
enum{
CALL_NONE, //0
CALL_SHORT, // 1
BREAK_SHORT, // 2
CONTINUE_SHORT, // 3
CALL_NEAR, // 4
//CALL_NEARD,
JMP_NEAR, // 5
BREAK_NEAR, // 6
CONTINUE_NEAR, // 7
CALL_32, //8
//CALL_32D,
JMP_32, // 9
BREAK_32, // 10
CONTINUE_32, // 11
UNDEF_OFSET, //12
POST_STRING, //13
POST_STRING32,
CALL_EXT, // 14
EXT_VAR, // 15
CALL_32I, // 16
POST_VAR, // 17
FIX_VAR, // 18
FIX_CODE, // 19
POST_VAR32, // 20
FIX_VAR32, // 21
FIX_CODE32, // 22
POST_FLOATNUM, // 23
DATABLOCK_VAR, //24
DATABLOCK_VAR32, //25
DIN_VAR, //26
DIN_VAR32, //27
CODE_SIZE,
CODE_SIZE32,
DATA_SIZE,
DATA_SIZE32,
POST_SIZE,
POST_SIZE32,
STACK_SIZE,
STACK_SIZE32,
FIX_CODE_ADD,
//DATABLOCK_STRING, // 26
//DATABLOCK_STRING32 // 27
};
#define POINTER 0x8000
#define NOTPOINTER (~POINTER)
// format of output file
#define file_exe 0
#define file_com 1
#define file_sys 2
#define file_rom 3
#define file_w32 4
#define file_d32 5
#define file_meos 6
#define file_bin 7
//â¨¯ë ¬®¤¥«¥© ¯ ¬ïâ¨
#define TINY 0
#define SMALL 1
//ä« £¨
#define f_reloc 1 // ¤à¥á ¬®¦¥â ¨§¬¥­¨âìáï
#define f_typeproc 6 //⨯ ¢ë§®¢  ¯à®æ¥¤ãàë
#define f_far 8 //¤ «ì­ïï ¯à®æ¥¤ãà 
#define f_extern 0x10 //¢­¥è­ïï ¯à®æ¥¤ãà , ¯¥à¥¬¥­­ ï
#define f_interrupt 0x20 //¯à¥à뢠­¨¥
#define f_export 0x40 //íªá¯®àâ¨à㥬 ï ¯à®æ¥¤ãà 
#define f_inline 0x80 //inline ¯à®æ¥¤ãà 
#define f_retproc 0xf00 //¢®§¢à â ä« £  ¨§ ¯à®æ¥¤ãàë
#define f_static 0x1000 //
#define f_classproc 0x2000 //¯à®æ¥¤ãà  ¨§ ª« áá 
//ä« £¨ ¯à®æ¥¤ãà ¢ áâàãªâãà å
#define fs_constructor 0x4000
#define fs_destructor 0x8000
#define f_useidx 0x10000 //¯¥à¥¬¥­­ ï ¨á¯®«ì§ã¥â ¨­¤¥ªá []
//â¨¯ë ¯à®æ¥¤ãà
#define tp_pascal 0
#define tp_cdecl 2
#define tp_stdcall 4
#define tp_fastcall 6
//â¨¯ë ¢ë§®¢  API ¯à®æ¥¤ãà
#define API_FAST 1
#define API_JMP 2
#define USEALLREG 8//0
//#define USEFIRST4REG 1
//#define USEONLY_AX 2
//­ã¬¥à æ¨ï ᯨ᪠ ¤¨à¥ªâ¨¢
enum{
d_ctrl, d_jump, d_command,d_argc, d_resize,
d_resmes,d_stack,d_start, d_atr, d_name,
d_com, d_atex, d_dseg, d_rsize,d_mdr,
d_stm, d_fca, d_suv, d_us, d_ib,
d_end1,
d_align=d_end1, d_aligner,d_alignw, //d_beep,
d_code, d_define, d_DOS, d_endif, d_ifdef,
d_ifndef,d_incl, d_error, /*d_pause,*/ d_print,
d_prnex, d_random, d_speed, d_8086, d_8088,
d_80186, d_80286, d_80386, d_80486, d_80586,
d_80686, d_80786, d_sdp, d_warning,d_ip,
d_iav, d_am32, d_undef, d_alignc,
d_fut, d_dstr, d_cv, d_else, d_wmb,
d_pragma,d_inline, d_if, d_elif, d_end};
enum{
a_add,a_or, a_adc,a_sbb,a_and, a_sub, a_xor, a_cmp,
a_not,a_neg,a_mul,a_div=a_mul+2,a_idiv,
a_rol,a_ror,a_rcl,a_rcr,a_shl, a_shr, a_sar=a_shr+2,
a_bt, a_bts,a_btr,a_btc,
a_inc,a_dec,
a_test,a_imul,
a_shld,a_shrd,
a_daa,a_das,a_aaa,a_aas,a_aam, a_aad,
a_movzx,a_movsx,a_cbw,a_cwde,a_cwd,a_cdq,
a_bswap,a_xlat,
a_bsf,a_bsr,
a_cmpxchg,a_cmpxchg8b,a_xadd,
a_nop,a_wait,a_lock,a_hlt,a_int,
a_into,a_iret,a_iretd,
a_popf,a_popfd,a_pushf,a_pushfd,a_sahf,a_lahf,
a_cmc,a_clc,a_stc,a_cli,a_sti,a_cld,a_std,
a_push,a_pusha,a_pushad,a_pop,a_popa,a_popad,
a_xchg,a_mov,a_lea,
a_lfs,a_lgs,a_lss,
a_les,a_lds,
a_adrsiz,
a_in,a_out,a_insb,a_insw,a_insd,a_outsb,a_outsw,a_outsd,
a_movsb,a_movsw,a_movsd,a_cmpsb,a_cmpsw,a_cmpsd,
a_stosb,a_stosw,a_stosd,a_lodsb,a_lodsw,a_lodsd,
a_scasb,a_scasw,a_scasd,a_repnz,a_rep,
a_jcxz,a_jecxz,a_loop,a_loopd,a_loopz,a_loopnz,
a_jo,a_jno,a_jc,a_jnc,a_jz,a_jnz,a_jna,a_ja,
a_js,a_jns,a_jp,a_jnp,a_jl,a_jnl,a_jng,a_jg,
a_seto,a_setno,a_setc,a_setnc,a_setz,a_setnz,a_setna,a_seta,
a_sets,a_setns,a_setp,a_setnp,a_setl,a_setnl,a_setng,a_setg,
/*a_jmps,a_jmpn,a_jmpf,*/a_jmp,
a_call,/*a_callf,*/a_ret,a_retf,
a_enter,a_leave,a_bound,a_arpl,
a_sldt,a_str,a_lldt,a_ltr,a_verr,a_verw,
a_lar,a_lsl,
a_sgdt,a_sidt,a_lgdt,a_lidt,a_smsw,a_lmsw,a_clts,
a_invd,a_wbinvd,//a_invlpd,
a_wrmsr,a_cpuid,a_rdmsr,a_rdtsc,a_rsm,
a_rdpmc,a_ud2,/*a_emmx,a_setalc,*/
a_punpcklbw,a_punpcklwd,a_punpckldq,
a_packsswb,
a_pcmpgtb,a_pcmpgtw,a_pcmpgtd,
a_packuswb,
a_punpckhbw,a_punpckhwd,a_punpckhdq,
a_packssdw,
a_psrlw,a_psrld,a_psrlq,
a_psraw,a_psrad,
a_psllw,a_pslld,a_psllq,
a_pcmpeqb,a_pcmpeqw,a_pcmpeqd,
a_pmullw,
a_movd,a_movq,
a_psubusb,a_psubusw,
a_emms,
a_pand,
a_paddusb,a_paddusw,
a_pandn,a_pmulhw,
a_psubsb,a_psubsw,
a_por,
a_paddsb,a_paddsw,
a_pxor,
a_pmaddwd,
a_psubb,a_psubw,a_psubd,
a_paddb,a_paddw,a_paddd,
a_db,a_dw,a_dd,a_invlpg,a_loadall,a_opsiz,
a_f2xm1,a_fabs,a_fadd,a_faddp,a_fbld,a_fbstp,a_fchs,a_fclex,a_fcom,
a_fcomp,a_fnclex,a_fcompp,a_fcos,a_fdecstr,a_fdisi,a_fdiv,a_fdivp,
a_fdivr,a_fdivrp,a_ffree,a_fiadd,a_ficom,a_ficomp,a_fidiv,a_fidivr,
a_fild,a_fildq,a_fimul,a_fist,a_fistp,a_fisub,a_fisubr,a_feni,a_fincstr,
a_finit,a_fninit,a_fld,a_fldcw,a_fldenv,a_fldlg2,a_fldln2,a_fldl2e,
a_fldl2t,a_fldpi,a_fldz,a_fld1,a_fmul,a_fmulp,a_fnop,a_fpatan,a_fprem,
a_fprem1,a_fptan,a_frndint,a_fsetpm,a_frstor,a_fsave,a_fnsave,a_fscale,
a_fsin,a_fsincos,a_fsqrt,a_fst,a_fstcw,a_fnstcw,a_fstp,a_fstsw,a_fnstsw,
a_fstenv,a_fnstenv,a_fsub,a_fsubp,a_fsubr,a_fsubrp,a_ftst,a_fucom,a_fucomp,
a_fucompp,a_fxch,a_fwait,a_fxam,a_fxtract,a_fyl2x,a_fyl2xp1,
a_sysenter,a_sysexit,a_fcmovb,a_fcmove,a_fcmovbe,a_fcmovu,a_fcmovnb,
a_fcmovne,a_fcmovnbe,a_fcmovnu,a_fcomi,a_fcomip,a_fucomi,a_fucomip,
a_fxrstor,a_fxsave,a_fndisi,a_fneni,a_fnsetpm,
a_cmovo,a_cmovno,a_cmovc,a_cmovnc,a_cmovz,a_cmovnz,a_cmovna,a_cmova,
a_cmovs,a_cmovns,a_cmovp,a_cmovnp,a_cmovl,a_cmovnl,a_cmovng,a_cmovg,
//MMX Pentium III extention
a_maskmovq, a_movntq, a_pavgb, a_pavgw, a_pextrw, a_pinsrw,
a_pmaxub, a_pmaxsw, a_pminub, a_pminsw, a_pmovmskb,a_pmulhuw,
a_prefetcht0,a_prefetcht1,a_prefetcht2, a_prefetchnta,a_sfence, a_psadbw,
a_pshufw,
//XMM extentions Pentium III
a_addps, a_addss, a_andnps, a_andps, a_cmpps, a_cmpss,
a_comiss, a_cvtpi2ps,a_cvtps2pi,a_cvtsi2ss,a_cvtss2si,a_cvttps2pi,
a_cvttss2si,a_divps, a_divss, a_ldmxcsr, a_maxps, a_maxss,
a_minps, a_minss, a_movaps, a_movhlps, a_movhps, a_movlhps,
a_movlps, a_movmskps,a_movss, a_movups, a_mulps, a_mulss,
a_movntps, a_orps, a_rcpps, a_rcpss, a_rsqrtps, a_rsqrtss,
a_shufps, a_sqrtps, a_sqrtss, a_stmxcsr, a_subps, a_subss,
a_ucomiss, a_unpckhps,a_unpcklps,a_xorps,
// Pentium IV
a_lfence, a_mfence, a_addpd, a_addsd, a_andpd, a_andnpd,
a_cmppd, a_comisd, a_cvtdq2pd, a_cvtdq2ps, a_cvtpd2dq, a_cvtpd2pi,
a_cvtpd2ps,a_cvtpi2pd, a_cvtps2dq, a_cvtps2pd, a_cvtsd2si, a_cvtsd2ss,
a_cvtsi2sd,a_cvtss2sd, a_cvttpd2pi, a_cvttpd2dq, a_cvttps2dq, a_cvttsd2si,
a_divpd, a_divsd, a_maskmovdqu,a_maxpd, a_maxsd, a_minpd,
a_minsd, a_movapd, a_movdqa, a_movdqu, a_movdq2q, a_movhpd,
a_movlpd, a_movmskpd, a_movntdq, a_movntpd, a_movnti, a_movq2dq,
a_movupd, a_mulpd, a_mulsd, a_orpd, a_pshufd, a_pshufhw,
a_pshuflw, a_pslldq, a_psrldq, a_shufpd, a_sqrtpd, a_sqrtsd,
a_subpd, a_subsd, a_ucomisd, a_unpckhpd, a_unpcklpd, a_xorpd,
a_paddq, a_pmuludq, a_psubq, a_punpckhqdq,a_punpcklqdq,a_clflush,
a_monitor, a_mwait, a_addsubpd, a_addsubps, a_cmpeqsd, a_cmpltsd,
a_cmplesd, a_cmpunordsd,a_cmpneqsd, a_cmpnltsd, a_cmpnlesd, a_cmpordsd,
a_cmpeqpd, a_cmpltpd, a_cmplepd, a_cmpunordpd,a_cmpneqpd, a_cmpnltpd,
a_cmpnlepd,a_cmpordpd, a_cmpeqps, a_cmpltps, a_cmpleps, a_cmpunordps,
a_cmpneqps,a_cmpnltps, a_cmpnleps, a_cmpordps, a_cmpeqss, a_cmpltss,
a_cmpless, a_cmpunordss,a_cmpneqss, a_cmpnltss, a_cmpnless, a_cmpordss,
a_haddpd, a_haddps, a_hsubpd, a_hsubps, a_lddqu, a_movddup,
a_movshdup,a_movsldup, a_pause,
a_end};
enum{
pF3=1,
pF2,
p66
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
/* 吲栽 <20>帖 嶂平丞兒恥<E58592> 能恐<E883BD>洵悟 'FASTLIST.EXE' */
short ofsdir[27]={
0x0000,0x000F, //D a
0xFFFF,0x0045, //b c
0x0072,0x0090, //d e
0x00A5,0xFFFF, //f g
0xFFFF,0x00C0, //h i
0x010A,0xFFFF, //j k
0xFFFF,0x0118, //l m
0xFFFF,0xFFFF, //n o
0x0132,0xFFFF, //p q
0x015F,0x0184, //r s
0xFFFF,0x01F6, //t u
0xFFFF,0x0263, //v w
0xFFFF,0xFFFF, //x y
0xFFFF}; //z
unsigned char dirlist[]={
0x19,0x00,0x4F,0x53,0x72,0x65,0x71,0x75,0x69,0x72,0x65,0x64,0, // DOSrequired
0xFF,0xFF, // end char 'D'
0x14,0x00,0x6C,0x69,0x67,0x6E,0, // align
0x32,0x00,0x6C,0x69,0x67,0x6E,0x63,0x6F,0x64,0x65,0, // aligncode
0x15,0x00,0x6C,0x69,0x67,0x6E,0x65,0x72,0, // aligner
0x16,0x00,0x6C,0x69,0x67,0x6E,0x77,0x6F,0x72,0x64,0, // alignword
0x03,0x00,0x72,0x67,0x63,0, // argc
0x0B,0x00,0x74,0x65,0x78,0x69,0x74,0, // atexit
0xFF,0xFF, // end char 'a'
0x30,0x00,0x6F,0x64,0x65,0x33,0x32,0, // code32
0x17,0x00,0x6F,0x64,0x65,0x73,0x69,0x7A,0x65,0, // codesize
0x35,0x00,0x6F,0x6D,0x70,0x69,0x6C,0x65,0x72,0x76,0x65,0x72,0x73,0x69,0x6F,0x6E,0, // compilerversion
0x00,0x00,0x74,0x72,0x6C,0x5F,0x63,0, // ctrl_c
0xFF,0xFF, // end char 'c'
0x0C,0x00,0x61,0x74,0x61,0x73,0x65,0x67,0, // dataseg
0x18,0x00,0x65,0x66,0x69,0x6E,0x65,0, // define
0x34,0x00,0x6F,0x73,0x73,0x74,0x72,0x69,0x6E,0x67,0, // dosstring
0xFF,0xFF, // end char 'd'
0x3B,0x00,0x6C,0x69,0x66,0, // elif
0x36,0x00,0x6C,0x73,0x65,0, // else
0x1A,0x00,0x6E,0x64,0x69,0x66,0, // endif
0xFF,0xFF, // end char 'e'
0x10,0x00,0x61,0x73,0x74,0x63,0x61,0x6C,0x6C,0x61,0x70,0x69,0, // fastcallapi
0x33,0x00,0x69,0x78,0x75,0x70,0x74,0x61,0x62,0x6C,0x65,0, // fixuptable
0xFF,0xFF, // end char 'f'
0x3A,0x00,0x66,0, // if
0x1B,0x00,0x66,0x64,0x65,0x66,0, // ifdef
0x1C,0x00,0x66,0x6E,0x64,0x65,0x66,0, // ifndef
0x13,0x00,0x6D,0x61,0x67,0x65,0x62,0x61,0x73,0x65,0, // imagebase
0x1D,0x00,0x6E,0x63,0x6C,0x75,0x64,0x65,0, // include
0x2E,0x00,0x6E,0x63,0x6C,0x75,0x64,0x65,0x70,0x61,0x74,0x68,0, // includepath
0x2F,0x00,0x6E,0x69,0x74,0x61,0x6C,0x6C,0x76,0x61,0x72,0, // initallvar
0x39,0x00,0x6E,0x6C,0x69,0x6E,0x65,0, // inline
0xFF,0xFF, // end char 'i'
0x01,0x00,0x75,0x6D,0x70,0x74,0x6F,0x6D,0x61,0x69,0x6E,0, // jumptomain
0xFF,0xFF, // end char 'j'
0x1E,0x00,0x61,0x78,0x65,0x72,0x72,0x6F,0x72,0x73,0, // maxerrors
0x0E,0x00,0x6F,0x76,0x65,0x64,0x61,0x74,0x61,0x72,0x6F,0x6D,0, // movedatarom
0xFF,0xFF, // end char 'm'
0x02,0x00,0x61,0x72,0x73,0x65,0x63,0x6F,0x6D,0x6D,0x61,0x6E,0x64,0x6C,0x69,0x6E,0x65,0, // parsecommandline
0x38,0x00,0x72,0x61,0x67,0x6D,0x61,0, // pragma
0x1F,0x00,0x72,0x69,0x6E,0x74,0, // print
0x20,0x00,0x72,0x69,0x6E,0x74,0x68,0x65,0x78,0, // printhex
0xFF,0xFF, // end char 'p'
0x21,0x00,0x61,0x6E,0x64,0x6F,0x6D,0x62,0x79,0x74,0x65,0, // randombyte
0x04,0x00,0x65,0x73,0x69,0x7A,0x65,0, // resize
0x05,0x00,0x65,0x73,0x69,0x7A,0x65,0x6D,0x65,0x73,0x73,0x61,0x67,0x65,0, // resizemessage
0xFF,0xFF, // end char 'r'
0x2C,0x00,0x65,0x74,0x64,0x69,0x6E,0x70,0x72,0x6F,0x63,0, // setdinproc
0x0D,0x00,0x69,0x7A,0x65,0x72,0x6F,0x6D,0, // sizerom
0x22,0x00,0x70,0x65,0x65,0x64,0, // speed
0x06,0x00,0x74,0x61,0x63,0x6B,0, // stack
0x07,0x00,0x74,0x61,0x72,0x74,0x61,0x64,0x64,0x72,0x65,0x73,0x73,0, // startaddress
0x0F,0x00,0x74,0x61,0x72,0x74,0x75,0x70,0x74,0x6F,0x6D,0x61,0x69,0x6E,0, // startuptomain
0x11,0x00,0x74,0x61,0x72,0x74,0x75,0x73,0x65,0x76,0x61,0x72,0, // startusevar
0x08,0x00,0x79,0x73,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0, // sysattribute
0x0A,0x00,0x79,0x73,0x63,0x6F,0x6D,0x6D,0x61,0x6E,0x64,0, // syscommand
0x09,0x00,0x79,0x73,0x6E,0x61,0x6D,0x65,0, // sysname
0xFF,0xFF, // end char 's'
0x31,0x00,0x6E,0x64,0x65,0x66,0, // undef
0x25,0x00,0x73,0x65,0x38,0x30,0x31,0x38,0x36,0, // use80186
0x26,0x00,0x73,0x65,0x38,0x30,0x32,0x38,0x36,0, // use80286
0x27,0x00,0x73,0x65,0x38,0x30,0x33,0x38,0x36,0, // use80386
0x28,0x00,0x73,0x65,0x38,0x30,0x34,0x38,0x36,0, // use80486
0x2B,0x00,0x73,0x65,0x38,0x30,0x37,0x38,0x36,0, // use80786
0x23,0x00,0x73,0x65,0x38,0x30,0x38,0x36,0, // use8086
0x24,0x00,0x73,0x65,0x38,0x30,0x38,0x38,0, // use8088
0x2A,0x00,0x73,0x65,0x4D,0x4D,0x58,0, // useMMX
0x29,0x00,0x73,0x65,0x50,0x65,0x6E,0x74,0x69,0x75,0x6D,0, // usePentium
0x12,0x00,0x73,0x65,0x73,0x74,0x61,0x72,0x74,0x75,0x70,0, // usestartup
0xFF,0xFF, // end char 'u'
0x2D,0x00,0x61,0x72,0x6E,0x69,0x6E,0x67,0, // warning
0x37,0x00,0x69,0x6E,0x6D,0x6F,0x6E,0x6F,0x62,0x6C,0x6F,0x63,0x6B,0, // winmonoblock
0xFF,0xFF // end char 'w'
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

136
programs/develop/cmm/id.h Normal file
View File

@ -0,0 +1,136 @@
/* 吲栽 <20>帖 嶂平丞兒恥<E58592> 能恐<E883BD>洵悟 'FASTLIST.EXE' */
short idofs[53]={
0xFFFF,0x0000, //A B
0x0009,0xFFFF, //C D
0x0026,0x0037, //E F
0x0044,0xFFFF, //G H
0x004C,0xFFFF, //I J
0xFFFF,0x0052, //K L
0x005C,0x0069, //M N
0x0093,0x009F, //O P
0xFFFF,0x00AB, //Q R
0x00B5,0xFFFF, //S T
0xFFFF,0xFFFF, //U V
0x00BF,0xFFFF, //W X
0xFFFF,0x00C8, //Y Z
0x00D4,0x011A, //_ a
0x0121,0x0130, //b c
0x014F,0x0175, //d e
0x018B,0x01A8, //f g
0xFFFF,0x01B0, //h i
0xFFFF,0xFFFF, //j k
0x01CE,0xFFFF, //l m
0x01E4,0xFFFF, //n o
0x01EB,0x01F5, //p q
0x01FE,0x0208, //r s
0xFFFF,0x0242, //t u
0x0255,0x025D, //v w
0xFFFF,0xFFFF, //x y
0xFFFF}; //z
unsigned char id[]={
0x7A,0x00,0x52,0x45,0x41,0x4B,0, // BREAK
0xFF,0xFF, // end char 'B'
0x6A,0x00,0x41,0x52,0x52,0x59,0x46,0x4C,0x41,0x47,0, // CARRYFLAG
0xA3,0x00,0x41,0x53,0x45,0, // CASE
0x7C,0x00,0x4F,0x4E,0x54,0x49,0x4E,0x55,0x45,0, // CONTINUE
0xFF,0xFF, // end char 'C'
0x47,0x00,0x4C,0x53,0x45,0, // ELSE
0x4D,0x00,0x58,0x54,0x52,0x41,0x43,0x54,0, // EXTRACT
0xFF,0xFF, // end char 'E'
0x7F,0x00,0x4F,0x52,0, // FOR
0x4C,0x00,0x52,0x4F,0x4D,0, // FROM
0xFF,0xFF, // end char 'F'
0x78,0x00,0x4F,0x54,0x4F,0, // GOTO
0xFF,0xFF, // end char 'G'
0x45,0x00,0x46,0, // IF
0xFF,0xFF, // end char 'I'
0x9A,0x00,0x4F,0x4F,0x50,0x4E,0x5A,0, // LOOPNZ
0xFF,0xFF, // end char 'L'
0x70,0x00,0x49,0x4E,0x55,0x53,0x46,0x4C,0x41,0x47,0, // MINUSFLAG
0xFF,0xFF, // end char 'M'
0x6B,0x00,0x4F,0x54,0x43,0x41,0x52,0x52,0x59,0x46,0x4C,0x41,0x47,0, // NOTCARRYFLAG
0x69,0x00,0x4F,0x54,0x4F,0x56,0x45,0x52,0x46,0x4C,0x4F,0x57,0, // NOTOVERFLOW
0x6D,0x00,0x4F,0x54,0x5A,0x45,0x52,0x4F,0x46,0x4C,0x41,0x47,0, // NOTZEROFLAG
0xFF,0xFF, // end char 'N'
0x68,0x00,0x56,0x45,0x52,0x46,0x4C,0x4F,0x57,0, // OVERFLOW
0xFF,0xFF, // end char 'O'
0x71,0x00,0x4C,0x55,0x53,0x46,0x4C,0x41,0x47,0, // PLUSFLAG
0xFF,0xFF, // end char 'P'
0x72,0x00,0x45,0x54,0x55,0x52,0x4E,0, // RETURN
0xFF,0xFF, // end char 'R'
0xA2,0x00,0x57,0x49,0x54,0x43,0x48,0, // SWITCH
0xFF,0xFF, // end char 'S'
0x7E,0x00,0x48,0x49,0x4C,0x45,0, // WHILE
0xFF,0xFF, // end char 'W'
0x6C,0x00,0x45,0x52,0x4F,0x46,0x4C,0x41,0x47,0, // ZEROFLAG
0xFF,0xFF, // end char 'Z'
0x74,0x00,0x5F,0x43,0x4F,0x44,0x45,0x50,0x54,0x52,0x5F,0x5F,0, // __CODEPTR__
0x73,0x00,0x5F,0x44,0x41,0x54,0x41,0x50,0x54,0x52,0x5F,0x5F,0, // __DATAPTR__
0xA0,0x00,0x5F,0x46,0x49,0x4C,0x45,0x5F,0x5F,0, // __FILE__
0xA1,0x00,0x5F,0x4C,0x49,0x4E,0x45,0x5F,0x5F,0, // __LINE__
0x75,0x00,0x5F,0x50,0x4F,0x53,0x54,0x50,0x54,0x52,0x5F,0x5F,0, // __POSTPTR__
0x98,0x00,0x65,0x78,0x70,0x6F,0x72,0x74,0, // _export
0xFF,0xFF, // end char '_'
0x81,0x00,0x73,0x6D,0, // asm
0xFF,0xFF, // end char 'a'
0x7B,0x00,0x72,0x65,0x61,0x6B,0, // break
0x3C,0x00,0x79,0x74,0x65,0, // byte
0xFF,0xFF, // end char 'b'
0x83,0x00,0x61,0x73,0x65,0, // case
0x94,0x00,0x64,0x65,0x63,0x6C,0, // cdecl
0x3B,0x00,0x68,0x61,0x72,0, // char
0x7D,0x00,0x6F,0x6E,0x74,0x69,0x6E,0x75,0x65,0, // continue
0xFF,0xFF, // end char 'c'
0x84,0x00,0x65,0x66,0x61,0x75,0x6C,0x74,0, // default
0xAC,0x00,0x65,0x6C,0x65,0x74,0x65,0, // delete
0x49,0x00,0x6F,0, // do
0x43,0x00,0x6F,0x75,0x62,0x6C,0x65,0, // double
0x40,0x00,0x77,0x6F,0x72,0x64,0, // dword
0xFF,0xFF, // end char 'd'
0x46,0x00,0x6C,0x73,0x65,0, // else
0x50,0x00,0x6E,0x75,0x6D,0, // enum
0x91,0x00,0x78,0x74,0x65,0x72,0x6E,0, // extern
0xFF,0xFF, // end char 'e'
0x4F,0x00,0x61,0x72,0, // far
0x96,0x00,0x61,0x73,0x74,0x63,0x61,0x6C,0x6C,0, // fastcall
0x41,0x00,0x6C,0x6F,0x61,0x74,0, // float
0x80,0x00,0x6F,0x72,0, // for
0xFF,0xFF, // end char 'f'
0x79,0x00,0x6F,0x74,0x6F,0, // goto
0xFF,0xFF, // end char 'g'
0x44,0x00,0x66,0, // if
0x77,0x00,0x6E,0x6C,0x69,0x6E,0x65,0, // inline
0x3D,0x00,0x6E,0x74,0, // int
0x4E,0x00,0x6E,0x74,0x65,0x72,0x72,0x75,0x70,0x74,0, // interrupt
0xFF,0xFF, // end char 'i'
0x3F,0x00,0x6F,0x6E,0x67,0, // long
0x48,0x00,0x6F,0x6F,0x70,0, // loop
0x9B,0x00,0x6F,0x6F,0x70,0x6E,0x7A,0, // loopnz
0xFF,0xFF, // end char 'l'
0xAB,0x00,0x65,0x77,0, // new
0xFF,0xFF, // end char 'n'
0x93,0x00,0x61,0x73,0x63,0x61,0x6C,0, // pascal
0xFF,0xFF, // end char 'p'
0x42,0x00,0x77,0x6F,0x72,0x64,0, // qword
0xFF,0xFF, // end char 'q'
0x4B,0x00,0x65,0x74,0x75,0x72,0x6E,0, // return
0xFF,0xFF, // end char 'r'
0x9D,0x00,0x68,0x6F,0x72,0x74,0, // short
0x9F,0x00,0x69,0x67,0x6E,0x65,0x64,0, // signed
0x8B,0x00,0x69,0x7A,0x65,0x6F,0x66,0, // sizeof
0xA6,0x00,0x74,0x61,0x74,0x69,0x63,0, // static
0x95,0x00,0x74,0x64,0x63,0x61,0x6C,0x6C,0, // stdcall
0x89,0x00,0x74,0x72,0x75,0x63,0x74,0, // struct
0x82,0x00,0x77,0x69,0x74,0x63,0x68,0, // switch
0xFF,0xFF, // end char 's'
0x97,0x00,0x6E,0x69,0x6F,0x6E,0, // union
0x9E,0x00,0x6E,0x73,0x69,0x67,0x6E,0x65,0x64,0, // unsigned
0xFF,0xFF, // end char 'u'
0x3A,0x00,0x6F,0x69,0x64,0, // void
0xFF,0xFF, // end char 'v'
0x4A,0x00,0x68,0x69,0x6C,0x65,0, // while
0x3E,0x00,0x6F,0x72,0x64,0, // word
0xFF,0xFF // end char 'w'
};

228
programs/develop/cmm/le.h Normal file
View File

@ -0,0 +1,228 @@
/*****************************************************************************
;* *
;* This structure define format of LE header for OS/2,Windows exe files *
;* ---------------------------------------------------------- *
;* *
;* Author Trigub Serge. B&M&T Corp. *
;* 10 January 1993 *
;* *
;*****************************************************************************/
enum CPU_Type
{
i80286 =0x01,
i80386 =0x02,
i80486 =0x03,
i80586 =0x04,
i860_N10 =0x20,
i860_N11 =0x21,
MIPS_Mark_I =0x40,
MIPS_Mark_II =0x41,
MIPS_Mark_III=0x42
};
struct Module_Type_Flags
{
unsigned long Module_Is_DLL [1];
unsigned long Reserved1 [1];
unsigned long Errors_In_Module [1];
unsigned long Reserved2 [1];
unsigned long Code_Load_Application[1];
unsigned long Application_Type [3];
unsigned long Reserved3 [2];
unsigned long No_External_FIXUP [1];
unsigned long No_Internal_FIXUP [1];
unsigned long Protected_Mode_Only [1];
unsigned long Global_Initialization[1];
unsigned long Multipledata [1];
unsigned long Singledata [1];
};
struct LE_Header
{
unsigned short Signature; // Signature 'LE' for exe header
unsigned char Byte_Order;
unsigned char Word_Order;
unsigned long Exec_Format_Level;
unsigned short CPU_Type;
unsigned short Target_OS;
unsigned long Module_Version;
union{
unsigned long Type_Flags;
Module_Type_Flags Flags;
};
unsigned long Number_Of_Memory_Pages;
unsigned long Initial_CS;
unsigned long Initial_EI;
unsigned long Initial_SS;
unsigned long Initial_ESP;
unsigned long Memory_Page_Size;
unsigned long Bytes_On_Last_Page;
unsigned long Fixup_Section_Size;
unsigned long Fixup_Section_Checksum;
unsigned long Loader_Section_Size;
unsigned long Loader_Section_CheckSum;
unsigned long Object_Table_Offset;
unsigned long Object_Table_Entries;
unsigned long Object_Page_Map_Table_Offset;
unsigned long Object_Iterate_Data_Map_Offset;
unsigned long Resource_Table_Offset;
unsigned long Resource_Table_Entries;
unsigned long Resident_Names_Table_Offset;
unsigned long Entry_Table_Offset;
unsigned long Module_Directives_Table_Offset;
unsigned long Module_Directives_Table_Entries;
unsigned long Fixup_Page_Table_Offset;
unsigned long Fixup_Record_Table_Offset;
unsigned long Imported_Module_Names_Table_Offset;
unsigned long Imported_Modules_Count;
unsigned long Imported_Procedure_Name_Table_Offset;
unsigned long Per_page_Checksum_Table_Offset;
unsigned long Data_Pages_Offset;
unsigned long Preload_Page_Count;
unsigned long Nonresident_Names_Table_Offset;
unsigned long Nonresident_Names_Table_Length;
unsigned long Nonresident_Names_Table_Checksum;
unsigned long Automatic_Data_Object;
unsigned long Debug_Information_Offset;
unsigned long Debug_Information_Length;
unsigned long Preload_Instance_Pages_Number;
unsigned long Demand_Instance_Pages_Number;
unsigned long Extra_Heap_Allocation;
unsigned long Unknown[1];
};
struct OBJ_FLAGS
{
unsigned long I_O_Privilage_Level [1];
unsigned long Conforming_Segment [1];
unsigned long BIG_Segment [1];
unsigned long Alias_16_16 [1];
unsigned long Reserved [1];
unsigned long Resident_Long_Locable[1];
unsigned long Segment_Type [2];
unsigned long Segment_Invalid [1];
unsigned long Segment_Preloaded [1];
unsigned long Segment_Shared [1];
unsigned long Segment_Discardable [1];
unsigned long Segment_Resource [1];
unsigned long Segment_Executable [1];
unsigned long Segment_Writable [1];
unsigned long Segment_Readable [1];
};
struct Object_Table
{
unsigned long Virtual_Segment_Size;
unsigned long Relocation_Base_Address;
union {
unsigned long ObjTableFlags;
OBJ_FLAGS FLAGS;
};
unsigned long Page_MAP_Index;
unsigned long Page_MAP_Entries;
unsigned long Reserved;
};
enum {
Segment_Type_Normal,
Segment_Zero_Filled,
Segment_Resident,
Segment_Resident_contiguous
};
struct PM_FLAGS
{
unsigned char Page_Type:2;
unsigned char Reserved :6;
unsigned char End_Page :2;
};
struct Page_Map_Table
{
unsigned short High_Page_Number;
unsigned char Low_Page_Number;
// union{
// PM_FLAGS SFLAGS;
unsigned char FLAGS;
// };
};
enum{//LE_PM_FLG_Page_Type_Enum ENUM {
Legal_Page =0,
Iterated_Page =1,
Invalid_Page =2,
Zero_Filled_Page=3
};
struct Entry_Table
{
unsigned char Number_of_Entries;
unsigned char Bungle_Flags;
unsigned short Object_Index;
//LE_Entry_First_Entry equ $
};
struct Entry
{
unsigned char Entry_Flags;
union{
unsigned short Word_Offset;
unsigned long Dword_Offset;
};
};
struct Entry_Bungle_Flags
{
unsigned char Bits_Entry :1;
unsigned char Valid_Entry:1;
};
struct Fixup_Record_Table
{
unsigned char Relocation_Address_Type;
unsigned char Relocation_Type;
unsigned short Relocation_Page_Offset;
unsigned char Segment_or_Module_Index;
unsigned short Offset_Or_Ordinal_Value;
};
struct Rel_Addr_Type
{
unsigned char Repeat_Offset :1;
unsigned char Target_OFFSET_Absent:1;
unsigned char Rel_Addr_Type [4];
};
enum// LE_Relocation_Address_Type_ENUM
{
RA_Low_Byte =0,
RA_16_bits_selector =2,
RA_32_bits_Far_Pointer=3,
RA_16_bits_Offset =5,
RA_48_bits_Far_Pointer=6,
RA_32_bits_Offset =7,
RA_32_bits_EIP_Rel =8
};
struct Reloc_Type
{
unsigned char Ordinal_Byte :1;
unsigned char Reserv1 :1;
unsigned char ABS_Dword :1;
unsigned char Target_Offset_32:1;
unsigned char Reserv2 :1;
unsigned char ADDITIVE_Type :1;
unsigned char Reloc_Type [2];
};
enum //LE_Relocation_Type_ENUM
{
Internal_Reference=0,
Imported_Ordinal =1,
Imported_Name =2,
OS_FIXUP =3
};

View File

@ -0,0 +1,534 @@
#include "tok.h"
#include "coff.h"
char *meserr="Plese, send this obj and sources files to me (sheker@mail.ru)";
struct LISTINCLFILE{
char *name;
int typefind;
int type;
};
enum{
s_extern,
s_code,
s_data,
s_bss
};
struct LISTNAMESYMBOL{
int idx; //¨­¤¥ªá ¨¬¥­¨
int seg;
int adr;
idrec *rec;
int dbg;
char name[IDLENGTH];
}*listnamesymbol;
char *curobjname;
int numobj=0,numname;
LISTINCLFILE *listobj;
unsigned int adr_end;
void LoadObj();
void AddPost(unsigned long loc,int type,unsigned int num);
int searchtree2(idrec *fptr,ITOK *itok4,int *tok4,unsigned char *string4);
int GetSegm(int seg)
{
OBJECT_ENTRY *obj;
if(seg){
seg--;
obj=(OBJECT_ENTRY *)(input+(sizeof(COFF_HEADER)+sizeof(OBJECT_ENTRY)*seg));
seg=obj->vsize;
}
return seg;
}
int GetOffSec(int seg)
{
OBJECT_ENTRY *obj;
if(seg){
seg--;
obj=(OBJECT_ENTRY *)(input+(sizeof(COFF_HEADER)+sizeof(OBJECT_ENTRY)*seg));
seg=obj->sectionRVA;
}
return seg;
}
void AddNameObj(char *name,int typefind,int type)
{
int len;
len=strlen(name);
if(!numobj)listobj=(LISTINCLFILE *)MALLOC(sizeof(LISTINCLFILE));
else listobj=(LISTINCLFILE *)REALLOC(listobj,sizeof(LISTINCLFILE)*(numobj+1));
(listobj+numobj)->name=BackString(name);
(listobj+numobj)->typefind=typefind;
(listobj+numobj)->type=type;
numobj++;
}
void AddObj()
{
int hold;
for(int i=0;i<numobj;i++){
curobjname=(listobj+i)->name;
// puts(curobjname);
hold=loadfile(curobjname,(listobj+i)->typefind);
if(hold==1||hold==-1){
unableopenfile(curobjname);
continue;
}
if((listobj+i)->type==0)LoadObj();
free(input);
}
}
int GetAlighSize(long flag)
{
int align=0;
int i=(flag&IMAGE_SCN_ALIGN_MASK)>>20;
if(i)align=1<<(i-1);
if(align==1)align=0;
return align;
}
void ConvertName(char *name)
{
int i1,i2;
char c;
tok=tk_ID;
i1=i2=0;
c=name[i1];
if(c=='?'){
i1++;
c=name[i1];
if(c=='?'){
i1=2;
c=name[i1];
}
}
else if(c=='_'){
if(strncmp(name,"__imp__",7)==0){
i1=7;
c=name[i1];
}
else if(name[1]=='$'){
i1=2;
c=name[i1];
}
}
while(c!=0){
if(c>='a'&&c<='z')tok=tk_id;
name[i2]=c;
i1++;
i2++;
c=name[i1];
if(c=='@'||c=='$')break;
}
name[i2]=0;
}
void AddPost(unsigned long loc,int type,unsigned int num)
{
CheckPosts();
(postbuf+posts)->num=num;
(postbuf+posts)->type=type;
(postbuf+posts)->loc=loc;
posts++;
}
void ScanSection(int numobj)
{
int poutptr,poutptrdata,ppostsize,align;
OBJECT_ENTRY *obj;
long flag;
poutptr=outptr;
poutptrdata=outptrdata;
ppostsize=postsize;
for(int i=0;i<numobj;i++){
obj=(OBJECT_ENTRY *)(input+(sizeof(COFF_HEADER)+sizeof(OBJECT_ENTRY)*i));
flag=obj->flags;
align=GetAlighSize(flag);
obj->vsize=-1;
if((flag&IMAGE_SCN_CNT_CODE)&&(flag&IMAGE_SCN_MEM_EXECUTE)){//ᥪæ¨ï ª®¤ 
obj->vsize=s_code;
obj->sectionRVA=poutptr=Align(poutptr,align);
poutptr+=obj->psize;
if(splitdata==FALSE)poutptrdata=poutptr;
}
else{
if((flag&IMAGE_SCN_MEM_READ)&&(flag&IMAGE_SCN_MEM_WRITE)){
if(flag&IMAGE_SCN_CNT_INITIALIZED_DATA){ //ᥪæ¨ï ¨­¨æ¨ «¨§¨à®¢ ­­ëå ¤ ­­ëå
obj->vsize=s_data;
obj->sectionRVA=poutptrdata=Align(poutptrdata,align);
poutptrdata+=obj->psize;
if(splitdata==FALSE)poutptr=poutptrdata;
}
else if(flag&IMAGE_SCN_CNT_UNINITIALIZED_DATA){ //ᥪæ¨ï bss
obj->vsize=s_bss;
obj->sectionRVA=ppostsize=Align(postsize,align);
postsize+=obj->psize;
}
}
}
}
}
void AddLstName(int numname)
{
unsigned int minofs;
int i,j,minname;
int oseg;
unsigned int ooutptr,ooutptrdata;
ooutptr=outptr;
ooutptrdata=outptrdata;
for(i=0;i<numname;i++){
if((listnamesymbol+i)->dbg==0){
oseg=(listnamesymbol+i)->seg;
minofs=(listnamesymbol+i)->adr;
minname=i;
for(j=i+1;j<numname;j++){
if(splitdata==FALSE)goto checkadr;
else if((listnamesymbol+j)->seg==oseg){
checkadr:
if(minofs>=(listnamesymbol+j)->adr&&(listnamesymbol+j)->dbg==0){
if(minofs==(listnamesymbol+j)->adr){
(listnamesymbol+minname)->dbg=1;
}
minofs=(listnamesymbol+j)->adr;
minname=j;
oseg=(listnamesymbol+j)->seg;
}
}
}
if(minname!=i)i--;
// printf("seg=%d adr=%d %s\n",oseg,(listnamesymbol+minname)->adr,(listnamesymbol+minname)->name);
if(oseg==s_code){
if((listnamesymbol+minname)->rec){
idrec *ptr;
ptr=(listnamesymbol+minname)->rec;
if(ptr->rectok==tk_undefproc||ptr->rectok==tk_proc||ptr->rectok==tk_interruptproc)goto dproc;
outptrdata=(listnamesymbol+minname)->adr;
if(splitdata==FALSE)outptr=outptrdata;
AddDataNullLine(3,(listnamesymbol+minname)->name);
}
else{
dproc:
outptr=(listnamesymbol+minname)->adr;//12.08.04 00:05 +ooutptr;
AddCodeNullLine((listnamesymbol+minname)->name);
}
}
else if(oseg==s_data){
outptrdata=(listnamesymbol+minname)->adr;//12.08.04 01:19 +ooutptrdata;
if(splitdata==FALSE)outptr=outptrdata;
AddDataNullLine(3,(listnamesymbol+minname)->name);
}
(listnamesymbol+minname)->dbg=1;
}
}
outptr=ooutptr;
outptrdata=ooutptrdata;
}
int ScanName(COFF_HEADER *head)
{
int size,i,j,numname,seg,count;
IMAGE_SYMBOL *tsym;
unsigned int ooutptr,ooutptrdata,opostsize;
idrec *rec;
ooutptr=outptr;
ooutptrdata=outptrdata;
opostsize=postsize;
numname=head->COFFsize;
size=numname*sizeof(IMAGE_SYMBOL)+head->pCOFF;
listnamesymbol=(LISTNAMESYMBOL *)MALLOC(sizeof(LISTNAMESYMBOL)*numname);
for(i=0,j=0;i<numname;i++){
tsym=(IMAGE_SYMBOL *)(input+head->pCOFF+i*sizeof(IMAGE_SYMBOL));
(listnamesymbol+j)->rec=0;
if(tsym->SectionNumber>=0){
(listnamesymbol+j)->idx=i;
if(tsym->N.Name.Short==0){
strcpy((char *)string,(char *)(input+size+tsym->N.Name.Long));
}
else{
strncpy((char *)string,(char *)tsym->N.sname,8);
string[8]=0;
}
//¯à¥®¡à §®¢ âì ¨¬ï
ConvertName((char *)string);
seg=(listnamesymbol+j)->seg=GetSegm(tsym->SectionNumber);
// printf("find name \"%s\" seg=%d type=%d class=%d\n",(char *)string,seg,tsym->Type,tsym->StorageClass);
(listnamesymbol+j)->adr=tsym->Value+GetOffSec(tsym->SectionNumber);
(listnamesymbol+j)->dbg=0;
strcpy((listnamesymbol+j)->name,(char *)string);
if(seg==s_data){
outptrdata=(listnamesymbol+j)->adr;//12.08.04 01:20 +ooutptrdata;
count=FindOff(string,DS);
}
else if(seg==s_bss){
postsize=(listnamesymbol+j)->adr;//12.08.04 01:20 +opostsize;
count=FindOff(string,VARPOST);
}
else if(seg==s_code){
outptr=(listnamesymbol+j)->adr;//11.08.04 23:59 +ooutptr;
count=FindOff(string,CS);
// printf("adr=%08X count=%d\n",outptr,count);
}
displaytokerrors=FALSE;
if(searchtree2(treestart,&itok,&tok,string)){
rec=(listnamesymbol+j)->rec=itok.rec;
rec->count+=count;
if(tok==tk_undefproc||tok==tk_declare){
tok=tk_proc;
itok.number=outptr;
// printf("%08X %08X %s\n",(listnamesymbol+j)->adr,ooutptr,itok.name);
updatecall(updatetree(),(unsigned int)itok.number,0);
}
else if(tok!=tk_apiproc&&tsym->SectionNumber!=0)idalreadydefined();
// if(tok==tk_proc||(tok>=tk_charvar&&tok<=tk_floatvar))
// printf("tok=%d %s\n",tok,itok.name);
}
else{
if(seg==s_extern/*&&tsym->Type==32*/){ //¢­¥è­¨© ®¡ê¥ªâ «î¡®£® ⨯ 
strcpy(itok.name,(char *)string);
// printf("undef proc \"%s\"\n",itok.name);
string[0]=0;
itok.flag=(unsigned char)(tok==tk_ID?tp_fastcall:(comfile==file_w32?tp_stdcall:tp_pascal));
tok=tk_undefproc;
itok.number=secondcallnum;
itok.segm=NOT_DYNAMIC;
itok.rm=tk_void;
itok.post=0;
rec=(listnamesymbol+j)->rec=addtotree(itok.name);
rec->count=count;
secondcallnum++;
}
else{
// printf("type=%d seg=%d\n",tsym->Type,seg);
if(/*tsym->Type==32*/tsym->StorageClass!=3&&seg==s_code){
tok=tk_proc;
itok.number=outptr;
itok.segm=NOT_DYNAMIC;
itok.rm=tk_void;
itok.post=0;
strcpy(itok.name,(char *)string);
string[0]=0;
itok.flag=(unsigned char)(tok==tk_ID?tp_fastcall:(comfile==file_w32?tp_stdcall:tp_pascal));
rec=(listnamesymbol+j)->rec=addtotree(itok.name);
rec->count=count;
}
else{
(listnamesymbol+j)->rec=NULL;
// printf("undef \"%s\"\n",string);
if(seg==s_extern){
// puts("323");
preerror(meserr);
// printf("Type=%d Class=%d seg=%d %s\n",tsym->Type,tsym->StorageClass,seg,string);
// printf("??? %s\n",string);
}
}
}
}
// printf("Type=%d Class=%d %s\n",tsym->Type,tsym->StorageClass,string);
j++;
}
i+=tsym->NumberOfAuxSymbols;
}
if(j!=numname){
listnamesymbol=(LISTNAMESYMBOL *)REALLOC(listnamesymbol,sizeof(LISTNAMESYMBOL)*j);
}
outptr=ooutptr;
outptrdata=ooutptrdata;
postsize=opostsize;
if(dbg&2)AddLstName(j);
return j;
}
void LoadObj()
{
COFF_HEADER *head;
int numobj,align,size,i,j,numrel;
OBJECT_ENTRY *obj;
unsigned char *buf;
IMAGE_RELOCATION *trel;
head=(COFF_HEADER *)input;
if(head->cpu!=0x14C){
sprintf((char *)string,"file %s is not supported format",curobjname);
preerror((char *)string);
return;
}
if(comfile!=file_w32){
preerror("include obj file posible only for windows programs");
return;
}
linenumber=0;
numobj=head->numobj;
ScanSection(numobj);
numname=ScanName(head);
for(i=0;i<numobj;i++){
obj=(OBJECT_ENTRY *)(input+(sizeof(COFF_HEADER)+sizeof(OBJECT_ENTRY)*i));
align=GetAlighSize(obj->flags);
size=obj->psize;
adr_end=outptr+size;
numrel=obj->NumberOfRelocations;
trel=(IMAGE_RELOCATION *)(input+obj->PointerToRelocations);
buf=(unsigned char *)(input+obj->pOffset);
// printf("type=%d section=%d\n",(trel+j)->Type,obj->vsize);
switch(obj->vsize){
case s_code:
if(align)AlignCD(CS,align);
adr_end=Align(outptr+size,4);
for(j=0;j<numrel;j++){
int adr;
LISTNAMESYMBOL *lns;
int ii;
for(ii=0;ii<numname;ii++){
if((listnamesymbol+ii)->idx==(trel+j)->SymbolTableIndex)break;
}
lns=(LISTNAMESYMBOL *)(listnamesymbol+ii);
idrec *rec=lns->rec;
// printf("type=%d seg=%d tok=%d num=%d %s\n",(trel+j)->Type,lns->seg,rec->rectok,rec->recnumber,lns->name);
switch((trel+j)->Type){
case IMAGE_REL_I386_DIR32:
*(long *)&buf[(trel+j)->VirtualAddress]+=lns->adr;
switch(lns->seg){
case s_code:
adr=(trel+j)->VirtualAddress+outptr;
AddPost(adr,FIX_CODE32,0);
break;
case s_data:
adr=(trel+j)->VirtualAddress+outptrdata;
AddPost(adr,FIX_VAR32,0);
break;
case s_bss:
adr=(trel+j)->VirtualAddress+outptr;
AddPost(adr,POST_VAR32,0);
*(long *)&buf[(trel+j)->VirtualAddress]+=postsize;
break;
default:
if(rec!=NULL){
adr=(trel+j)->VirtualAddress+outptr;
if(rec->rectok==tk_apiproc){
AddPost(adr,CALL_32I,rec->recnumber);
}
else if(rec->rectok==tk_undefproc){
AddPost(adr,CALL_32,rec->recnumber);
}
else if(rec->rectok==tk_proc){
AddPost(adr,FIX_CODE_ADD,adr_end);
AddPost(adr_end,FIX_CODE32,0);
if(dbg&2){
int ooutptr=outptr;
outptr=adr_end;
AddDataNullLine(4,lns->name);
outptr=ooutptr;
}
*(long *)&output[adr_end]=rec->recnumber;
adr_end+=4;
}
rec->count++;
}
break;
}
break;
case IMAGE_REL_I386_REL32:
adr=(trel+j)->VirtualAddress+outptr;
if(rec!=NULL){
if(rec->rectok!=tk_proc){
AddPost(adr,CALL_32,rec->recnumber);
}
else{
*(long *)&buf[(trel+j)->VirtualAddress]=rec->recnumber-adr-4;
}
}
else{
*(long *)&buf[(trel+j)->VirtualAddress]=lns->adr-adr-4;
}
if(rec)rec->count++;
break;
default:
// puts("432");
preerror(meserr);
break;
}
}
/* if(dbg&2){
sprintf((char *)string,"code from %s",curobjname);
AddCodeNullLine((char *)string);
}*/
for(j=0;j<size;j++)op(buf[j]);
outptr=adr_end;
break;
case s_data:
if(align)AlignCD(DS,align);
for(j=0;j<numrel;j++){
int adr;
LISTNAMESYMBOL *lns;
int ii;
for(ii=0;ii<numname;ii++){
if((listnamesymbol+ii)->idx==(trel+j)->SymbolTableIndex)break;
}
lns=(LISTNAMESYMBOL *)(listnamesymbol+ii);
idrec *rec=lns->rec;
switch((trel+j)->Type){
case IMAGE_REL_I386_DIR32:
*(long *)&buf[(trel+j)->VirtualAddress]+=lns->adr;
switch(lns->seg){
case s_code:
adr=(trel+j)->VirtualAddress+outptr;
AddPost(adr,FIX_CODE32,0);
break;
case s_data:
adr=(trel+j)->VirtualAddress+outptrdata;
AddPost(adr,FIX_VAR32,0);
break;
case s_bss:
adr=(trel+j)->VirtualAddress+outptr;
AddPost(adr,POST_VAR32,0);
*(long *)&buf[(trel+j)->VirtualAddress]+=postsize;
break;
default:
// puts("472");
preerror(meserr);
/* if(rec!=NULL){
adr=(trel+j)->VirtualAddress+outptr;
if(rec->rectok==tk_apiproc){
AddPost(adr,CALL_32I,rec->recnumber);
}
else if(rec->rectok==tk_undefproc){
AddPost(adr,CALL_32,rec->recnumber);
}
rec->count++;
}*/
break;
}
break;
case IMAGE_REL_I386_REL32:
// puts("488");
preerror(meserr);
/* adr=(trel+j)->VirtualAddress+outptr;
if(rec!=NULL){
if(rec->rectok!=tk_proc){
AddPost(adr,CALL_32,rec->recnumber);
}
else{
*(long *)&buf[(trel+j)->VirtualAddress]=rec->recnumber-adr-4;
}
}
else{
*(long *)&buf[(trel+j)->VirtualAddress]=lns->adr-adr-4;
}
if(rec)rec->count++;*/
break;
}
}
for(j=0;j<size;j++)opd(buf[j]);
break;
case s_bss:
if(align)postsize=Align(postsize,align);
postsize+=size;
break;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
#define _NEW_TYPE_
#include "tok.h"
void convert_type(int *sign,int *rettype,int *pointr,int reg)
{
int usebracket=FALSE;
if(tok==tk_openbracket&&(tok2>=tk_char&&tok2<=tk_double)){
nexttok();
usebracket=TRUE;
}
switch ( tok ){
case tk_byte:
case tk_word:
case tk_dword:
case tk_float:
case tk_double:
case tk_qword:
*sign=0;
*rettype=tok;
if(usebracket)nexttok();
else getoperand(reg);
break;
case tk_char:
case tk_int:
case tk_long:
*sign=1;
*rettype=tok;
if(usebracket)nexttok();
else getoperand(reg);
break;
}
if(usebracket){
while(tok==tk_mult){
nexttok();
*pointr++;
}
if(tok!=tk_closebracket)expected(')');
else getoperand(reg);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,197 @@
#include "tok.h"
#include "le.h"
#define _OUTLE_
unsigned short swapshort(unsigned int var)
{
unsigned short h,l;
l=var>>8;
h=var<<8;
return l|h;
}
int MakeBin32()
{
hout=CreateOutPut(outext,"wb");
if(fwrite(output,outptr,1,hout)!=1){
ErrWrite();
fclose(hout);
hout=NULL;
return(-1);
}
return 0;
}
unsigned int EntryParamStr()
{
ITOK btok;
int bb=tk_id;
unsigned char *buf=(unsigned char *)"__bufcomstr";
btok.number=0;
searchtree(&btok,&bb,buf);
if(bb==tk_id)btok.number=0;
else{
btok.number+=outptrdata;
if((outptrdata%2)==1)btok.number++; /* alignment of entire post data block manditory */
}
return btok.number;
}
int MakeMEOS()
{
MEOSheader hdr;
hout=CreateOutPut(outext,"wb");
strcpy((char *)hdr.sign,"MENUET01");
hdr.vers=1;
hdr.start=EntryPoint();
hdr.size=outptr;
hdr.alloc_mem=Align(outptr+postsize+stacksize,16);
hdr.esp=hdr.alloc_mem-4;
hdr.I_Param=EntryParamStr();
hdr.I_Icon=0;
memcpy(output+startptr,&hdr,sizeof(MEOSheader));
if(fwrite(output,outptr,1,hout)!=1){
ErrWrite();
fclose(hout);
hout=NULL;
return(-1);
}
return 0;
}
int MakeLE()
{
LE_Header hdr;
Object_Table ot[2];
Page_Map_Table *pmt;
unsigned int i;
int headerofs;
int headsize=sizeof(LE_Header);
unsigned long *fpto;
int sizeb;
CreatStub(stubfile);
memset(&hdr,0,sizeof(LE_Header));
#ifdef _WC_
hdr.Signature='EL';
#else
hdr.Signature='LE';
#endif
hdr.CPU_Type=i80386;
hdr.Target_OS=1;
hdr.Type_Flags=0x200;
hdr.Number_Of_Memory_Pages=outptr/0x1000+1;
hdr.Initial_CS=1;
hdr.Initial_EI=EntryPoint();
hdr.Initial_SS=2;
hdr.Initial_ESP=stacksize;
hdr.Memory_Page_Size=0x1000;
hdr.Bytes_On_Last_Page=outptr%0x1000;
hdr.Object_Table_Offset=sizeof(LE_Header);
hdr.Object_Table_Entries=2;
headerofs=ftell(hout);
if(fwrite(&hdr,sizeof(LE_Header),1,hout)!=1){
errwrite:
ErrWrite();
fclose(hout);
hout=NULL;
return(-1);
}
ot[0].Virtual_Segment_Size=outptr+postsize;//hdr.Initial_ESP;
ot[0].Relocation_Base_Address=0x10000;
ot[0].ObjTableFlags=0x2045;
ot[0].Page_MAP_Index=1;
ot[0].Page_MAP_Entries=hdr.Number_Of_Memory_Pages;
ot[1].Virtual_Segment_Size=hdr.Initial_ESP;
ot[1].Relocation_Base_Address=Align(outptr+postsize,0x10000)+0x10000;
ot[1].ObjTableFlags=0x2043;
ot[1].Page_MAP_Index=2;
ot[0].Reserved=ot[1].Reserved=ot[1].Page_MAP_Entries=0;
if(fwrite(&ot,sizeof(Object_Table)*2,1,hout)!=1)goto errwrite;
hdr.Object_Page_Map_Table_Offset=headsize+=sizeof(Object_Table)*2;
sizeb=sizeof(Page_Map_Table)*hdr.Number_Of_Memory_Pages;
pmt=(Page_Map_Table *)MALLOC(sizeb);
for(i=0;i<hdr.Number_Of_Memory_Pages;i++){
(pmt+i)->High_Page_Number=swapshort(((i+1)/256));
(pmt+i)->Low_Page_Number=(unsigned char)((i+1)%256);
(pmt+i)->FLAGS=0;
}
if(fwrite(pmt,sizeb,1,hout)!=1)goto errwrite;
free(pmt);
hdr.Resource_Table_Offset=hdr.Resident_Names_Table_Offset=headsize+=sizeb;
i=strlen(rawfilename);
string2[0]=(unsigned char)i;
strcpy((char *)&string2[1],rawfilename);
*(long *)&string2[i+2]=0;
if(fwrite(string2,i+5,1,hout)!=1)goto errwrite;
hdr.Entry_Table_Offset=headsize+=i+4;
headsize++;
sizeb=sizeof(unsigned long)*(hdr.Number_Of_Memory_Pages+1);
fpto=(unsigned long *)MALLOC(sizeb);
hdr.Fixup_Page_Table_Offset=headsize;
memset(fpto,0,sizeb);
// for(i=0;i<(hdr.Number_Of_Memory_Pages+1);i++){
// fpto[i]=0;
// }
if(fwrite(fpto,sizeb,1,hout)!=1)goto errwrite;
headsize+=sizeb;
//Fixup_Record_Table
int sizefixpage=0;
hdr.Fixup_Record_Table_Offset=headsize;
for(i=0;i<hdr.Number_Of_Memory_Pages;i++){
unsigned int startblc=i*4096; // ¤à¥á ¯¥à¢®£® ¡«®ª 
for(unsigned int j=0;j<posts;j++){ //®¡å®¤¨¬ ¢áî â ¡«¨æã post
if(((postbuf+j)->type==CALL_32I||
((postbuf+j)->type>=POST_VAR32&&(postbuf+j)->type<=FIX_CODE32))&&
(postbuf+j)->loc>=startblc&&(postbuf+j)->loc<(startblc+4096)){
int sizerec;
string2[0]=7;
*(unsigned short *)&string2[2]=(unsigned short)((postbuf+j)->loc-startblc);
string2[4]=1;
unsigned int val=*(unsigned long *)&output[(postbuf+j)->loc];
if(val<65536){
string2[1]=0;
*(unsigned short *)&string2[5]=(unsigned short)val;
sizerec=7;
}
else{
string2[1]=0x10;
*(unsigned long *)&string2[5]=val;
sizerec=9;
}
sizefixpage+=sizerec;
if(fwrite(string2,sizerec,1,hout)!=1)goto errwrite;
}
fpto[i+1]=sizefixpage;
}
}
headsize+=sizefixpage;
//Imported_Procedure_Name_Table
hdr.Imported_Module_Names_Table_Offset=
hdr.Imported_Procedure_Name_Table_Offset=headsize;
string2[0]=0;
if(fwrite(string2,1,1,hout)!=1)goto errwrite;
headsize++;
hdr.Fixup_Section_Size=headsize-hdr.Fixup_Page_Table_Offset;//9+sizefixpage;
hdr.Loader_Section_Size=headsize-sizeof(LE_Header);
hdr.Automatic_Data_Object=2;
hdr.Data_Pages_Offset=Align(headsize+headerofs,16/*1024*/);
ChSize(hdr.Data_Pages_Offset);
fseek(hout,headerofs,SEEK_SET);
if(fwrite(&hdr,sizeof(LE_Header),1,hout)!=1)goto errwrite;
fseek(hout,headerofs+hdr.Fixup_Page_Table_Offset,SEEK_SET);
if(fwrite(fpto,sizeof(unsigned long)*(hdr.Number_Of_Memory_Pages+1),1,hout)!=1)goto errwrite;
free(fpto);
fseek(hout,0,SEEK_END);
return 0;
}

View File

@ -0,0 +1,385 @@
#include "tok.h"
void obj_outrecord(int recordtype,unsigned int recordlength,unsigned char *data);
void outeachPUBDEF(struct idrec *ptr);
void obj_outLEDATA(unsigned int segm,unsigned int offset,unsigned int recordlength,
unsigned char *data);
#define MAXNUMEXTNAME 1024;
int *numextname;
int maxnumextname=MAXNUMEXTNAME;
unsigned int lenextstr=0; //¤«¨­  áâப¨ á ¢­¥è­¨¬¨ ¨¬¥­ ¬¨
int numextern=0;
int postseg,stackseg;
unsigned int findextname(int extnum)
{
for(unsigned int i=0;i<externnum;i++){
if(numextname[i]==extnum)return i+1;
}
return 0;
}
int MakeObj()
{
unsigned int i;
unsigned int count,sizeblock;
hout=CreateOutPut("obj","wb");
i=strlen(startfileinfo->filename);
string2[0]=(unsigned char)i;
strcpy((char *)&string2[1],startfileinfo->filename);
obj_outrecord(0x80,i+1,&string2[0]);// output the LNAMES
sprintf((char *)&string2[3],"%s %s",compilerstr,__DATE__);
i=strlen((char *)&string2[3]);
*(short *)&string2[0]=0;
string2[2]=(unsigned char)i;
obj_outrecord(0x88,i+3,&string2[0]);// output the LNAMES
for(count=0;count<totalmodule;count++){ //¨¬¥­  ¢ª«îç ¥¬ëå ä ©«®¢
*(struct ftime *)&string2[2]=(startfileinfo+count)->time;
strcpy((char *)&string2[7],(startfileinfo+count)->filename);
i=strlen((startfileinfo+count)->filename);
*(short *)&string2[0]=0xE940;
string2[6]=(unsigned char)i;
obj_outrecord(0x88,i+7,&string2[0]);// output the LNAMES
}
count=outptr-startptr; //à §¬¥à ª®¤ 
unsigned char *data=output+startptr; //­ ç «® ¤ ­­ëå
*(short *)&string2[0]=0xE940;
obj_outrecord(0x88,2,&string2[0]);//ª®­¥æ ª®¬¥­â à¨©
if(!am32){
*(short *)&string2[0]=0xEA00;
string2[2]=1;
string2[3]=(unsigned char)(modelmem==SMALL?9:8);
obj_outrecord(0x88,4,&string2[0]);
}
else{
*(short *)&string2[0]=0xA140;
obj_outrecord(0x88,2,&string2[0]);
}
obj_outrecord(0x96,39,(unsigned char *)"\000\005_TEXT\004CODE\004_BSS\003BSS\006DGROUP\005_DATA\004DATA");
// output the SEGDEF
if(!am32){
string2[0]=(unsigned char)0x28;
*(short *)&string2[1]=(short)outptr;//count;// Set the length of the segment of DATA or CODE
string2[3]=0x02; //¨¬ï ᥣ¬¥­â  _TEXT
*(short *)&string2[4]=0x0103; //ª« áá CODE Overlay NONE 1
obj_outrecord(0x98,6,string2);
i=2;
if(comfile==file_exe&&modelmem==SMALL){
string2[0]=(unsigned char)0x48;
*(short *)&string2[1]=outptrdata;// Set the length of the segment DATA
string2[3]=0x07; //¨¬ï ᥣ¬¥­â  _DATA
*(short *)&string2[4]=0x0108; //ª« áá DATA Overlay NONE
obj_outrecord(0x98,6,string2);
i++;
}
postseg=i;
string2[0]=(unsigned char)0x48;
*(short *)&string2[1]=(short)postsize;// Set the length of the segment BSS
string2[3]=0x04; //¨¬ï ᥣ¬¥­â  _BSS
*(short *)&string2[4]=0x0105; //ª« áá BSS Overlay NONE
obj_outrecord(0x98,6,string2);
i++;
if(comfile==file_exe&&modelmem==SMALL){
obj_outrecord(0x96,6,(unsigned char *)"\005STACK");
string2[0]=0x74;
*(short *)&string2[1]=(short)stacksize;// Set the length of the segment STACK
string2[3]=0x09; //¨¬ï ᥣ¬¥­â  STACK
*(short *)&string2[4]=0x0109; //ª« áá STACK Overlay NONE
obj_outrecord(0x98,6,string2);
stackseg=i;
}
string2[0]=6; //¨¬ï DGROUP
if(comfile==file_exe&&modelmem==SMALL){
*(short *)&string2[1]=0x2FF;
*(short *)&string2[3]=0x3FF;//postseg*256+255;//0x3FF;
*(short *)&string2[5]=0x4ff;//stackseg*256+255;//0x4FF;
i=7;
}
else{
*(short *)&string2[1]=0x1FF;
// *(short *)&string2[3]=0x2FF;
*(short *)&string2[3]=0x2ff;//postseg*256+255;//0x3FF;
i=5;
}
obj_outrecord(0x9A,i,string2);
}
else{
string2[0]=(unsigned char)0xA9;
*(long *)&string2[1]=(long)outptr;//count;// Set the length of the segment of DATA or CODE
string2[5]=0x02; //¨¬ï ᥣ¬¥­â  _TEXT
*(short *)&string2[6]=0x0103; //ª« áá CODE Overlay NONE
obj_outrecord(0x99,8,string2);
i=2;
/*
string2[0]=(unsigned char)0xA9;
*(long *)&string2[1]=0;// Set the length of the segment DATA
string2[5]=0x07; //¨¬ï ᥣ¬¥­â  _DATA
*(short *)&string2[6]=0x0108; //ª« áá DATA Overlay NONE
obj_outrecord(0x99,8,string2);
i++;*/
postseg=i;
string2[0]=(unsigned char)0xA9;
*(long *)&string2[1]=(long)postsize;// Set the length of the segment BSS
string2[5]=0x04; //¨¬ï ᥣ¬¥­â  _BSS
*(short *)&string2[6]=0x0105; //ª« áá BSS Overlay NONE
obj_outrecord(0x99,8,string2);
i++;
obj_outrecord(0x96,11,(unsigned char *)"\005STACK\004FLAT");//9,10
if(comfile!=file_w32){
string2[0]=0x75;
*(long *)&string2[1]=(long)stacksize;// Set the length of the segment STACK
string2[5]=0x09; //¨¬ï ᥣ¬¥­â  STACK
*(short *)&string2[6]=0x0109; //ª« áá STACK Overlay NONE
obj_outrecord(0x99,8,string2);
stackseg=i;
}
string2[0]=10;
obj_outrecord(0x9A,1,string2); //GRPDEF Group: FLAT
string2[0]=6; //¨¬ï DGROUP
i=1;
// *(short *)&string2[i]=0x2FF; //DATA
// i+=2;
*(short *)&string2[i]=postseg*256+255;//0x3FF; //BSS
i+=2;
if(comfile!=file_w32){
*(short *)&string2[i]=stackseg*256+255;//0x4FF
i+=2;
}
obj_outrecord(0x9A,i,string2);
}
// ¢ë¢®¤ EXTDEF
while(externnum>maxnumextname)maxnumextname+=MAXNUMEXTNAME;
numextname=(int *)MALLOC(maxnumextname*sizeof(int));
// output the PUBDEF records for each exteral procedures (all procedures)
outeachPUBDEF(treestart);
if(lenextstr!=0)obj_outrecord(0x8c,lenextstr,&string[0]);
// output the data (LEDATA) in 1K chunks as required!
i=0;
char *bufobj=(char *)MALLOC(512*5);
while(i<count){
unsigned int j;
sizeblock=1024;
restart:
for(j=0;j<posts;j++){
if((postbuf+j)->type>=CALL_EXT&&(postbuf+j)->type<=FIX_CODE32&&
(postbuf+j)->loc>=(i+startptr)&&(postbuf+j)->loc<(i+sizeblock+startptr)){
if((postbuf+j)->loc>(i+startptr+sizeblock-(am32==FALSE?2:4))){
sizeblock=(postbuf+j)->loc-i-startptr;//¨§¬¥­¨âì à §¬¥à ¡«®ª 
goto restart;
}
}
}
if((i+sizeblock)>count)sizeblock=count-i;
obj_outLEDATA(1,i+startptr,sizeblock,data+i);
int ofsfix=0;
for(j=0;j<posts;j++){
if((postbuf+j)->loc>=(i+startptr)&&(postbuf+j)->loc<(i+sizeblock+startptr)){
int hold=(postbuf+j)->loc-i-startptr;
if((postbuf+j)->type>=CALL_32I/*POST_VAR*/&&(postbuf+j)->type<=FIX_CODE32){
bufobj[ofsfix++]=(unsigned char)((am32==FALSE?0xC4:0xE4)|(hold/256));
bufobj[ofsfix++]=(unsigned char)(hold%256);
bufobj[ofsfix++]=0x14;
bufobj[ofsfix++]=1;
switch((postbuf+j)->type){
case POST_VAR:
case POST_VAR32:
bufobj[ofsfix++]=postseg;
break;
case FIX_VAR:
case FIX_VAR32:
bufobj[ofsfix++]=(unsigned char)((comfile==file_exe&&modelmem==SMALL)?2:1);
break;
case FIX_CODE:
case FIX_CODE32:
bufobj[ofsfix++]=1;
break;
}
}
if((postbuf+j)->type>=POST_VAR32&&(postbuf+j)->type<=FIX_CODE32){
}
else if((postbuf+j)->type==CALL_EXT){
int numext=findextname((postbuf+j)->num);
if(numext!=0){
bufobj[ofsfix++]=(unsigned char)((am32==FALSE?0x84:0xA4)|(hold/256));
bufobj[ofsfix++]=(unsigned char)(hold%256);
bufobj[ofsfix++]=0x56;
bufobj[ofsfix++]=(unsigned char)numext;
}
}
else if((postbuf+j)->type==EXT_VAR){
int numext=findextname((postbuf+j)->num);
if(numext!=0){
bufobj[ofsfix++]=(unsigned char)((am32==FALSE?0xC4:0xE4)|(hold/256));
bufobj[ofsfix++]=(unsigned char)(hold%256);
bufobj[ofsfix++]=0x16;
bufobj[ofsfix++]=1;
bufobj[ofsfix++]=(unsigned char)numext;
}
}
}
}
if(ofsfix!=0)obj_outrecord(0x9C+am32,ofsfix,(unsigned char *)bufobj);
i+=sizeblock;
}
free(bufobj);
if(comfile==file_exe&&modelmem==SMALL){
i=0;
while(i<outptrdata){
if((i+1024)>outptrdata)obj_outLEDATA(2,i,outptrdata-i,outputdata+i);
else obj_outLEDATA(2,i,1024,outputdata+i);
i+=1024;
}
}
if(sobj!=FALSE){
// output end of OBJ notifier
string2[0]=0;
i=1;
}
else{
count=EntryPoint();
*(short *)&string2[0]=0xC1; //£« ¢­ë© ¬®¤ã«ì ¨¬¥¥â áâ àâ®¢ë©  ¤à¥á ª®â®à ­¥«ì§ï ¬¥­ïâì.
*(short *)&string2[2]=0x101;
if(count<65536){
*(short *)&string2[4]=(short)count;
i=6;
}
else{
*(long *)&string2[4]=(long)count;
i=8;
}
}
obj_outrecord(i==8?0x8B:0x8A,i,string2);
free(numextname);
runfilesize=ftell(hout);
fclose(hout);
hout=NULL;
return 0;
}
void obj_outLEDATA(unsigned int segm,unsigned int offset,unsigned int recordlength,unsigned char *data)
{
int checksum=0;
int i;
unsigned char buf[8];
buf[3]=(unsigned char)segm;
if(offset>(65536-1024)){
*(short *)&buf[1]=(short)(recordlength+6);
buf[0]=0xA1;
*(long *)&buf[4]=(long)offset;
i=8;
}
else{
*(short *)&buf[1]=(short)(recordlength+4);
buf[0]=0xA0;
*(short *)&buf[4]=(short)offset;
i=6;
}
fwrite(buf,i,1,hout);
for(i--;i>=0;i--)checksum+=buf[i];
for(i=0;(unsigned int)i<recordlength;i++)checksum+=data[i];
fwrite(data,recordlength,1,hout);
checksum=-checksum;
fwrite(&checksum,1,1,hout);
}
void obj_outrecord(int recordtype,unsigned int recordlength,unsigned char *data)
// Outputs an OBJ record.
{
int checksum;
unsigned int i;
recordlength++;
checksum=recordtype;
fwrite(&recordtype,1,1,hout);
checksum+=(recordlength/256);
checksum+=(recordlength&255);
fwrite(&recordlength,2,1,hout);
recordlength--;
for(i=0;i<recordlength;i++)checksum+=data[i];
fwrite(data,recordlength,1,hout);
checksum=-checksum;
fwrite(&checksum,1,1,hout);
}
void outeachPUBDEF(struct idrec *ptr)
{
unsigned int i;
if(ptr!=NULL){
outeachPUBDEF(ptr->right);
if(ptr->rectok==tk_apiproc){
i=0;
for(unsigned int j=0;j<posts;j++){ //¯®¨áª ¨á¯®«ì§®¢ ­¨ï ¯à®æ¥¤ãàë
if((postbuf+j)->num==(unsigned long)ptr->recnumber&&((postbuf+j)->type==CALL_32I||(postbuf+j)->type==CALL_32)){
i++;
(postbuf+j)->type=CALL_EXT;
externnum++;
if(externnum>=maxnumextname){
maxnumextname+=MAXNUMEXTNAME;
numextname=(int *)REALLOC(numextname,maxnumextname*sizeof(int));
}
}
}
if(i)goto nameext;
goto endp;
}
if(externnum!=0&&ptr->rectok==tk_undefproc&&(ptr->flag&f_extern)!=0){
nameext:
numextname[numextern++]=ptr->recnumber;
i=strlen(ptr->recid);
if((lenextstr+i+2)>=STRLEN){
obj_outrecord(0x8c,lenextstr,&string[0]);
lenextstr=0;
}
string[lenextstr++]=(unsigned char)i;
strcpy((char *)&string[lenextstr],ptr->recid);
lenextstr+=i+1;
}
else{
if((ptr->rectok==tk_proc||ptr->rectok==tk_interruptproc)&&ptr->recsegm>=NOT_DYNAMIC){
string2[0]=(unsigned char)(am32==0?0:1);
string2[1]=0x01;
}
else if((ptr->rectok>=tk_bits&&ptr->rectok<=tk_doublevar)||ptr->rectok==tk_structvar){
if((ptr->flag&f_extern))goto nameext;
if(am32){
string2[0]=1;
string2[1]=(unsigned char)(ptr->recpost==0?1:postseg);
}
else if(comfile==file_exe&&modelmem==SMALL){
string2[0]=1;
string2[1]=(unsigned char)(ptr->recpost==0?2:postseg);
}
else{
string2[0]=(unsigned char)(ptr->recpost==0?0:1);
string2[1]=(unsigned char)(ptr->recpost==0?1:postseg);
}
}
else goto endp;
for(i=0;ptr->recid[i]!=0;i++)string2[i+3]=ptr->recid[i];
string2[2]=(unsigned char)i;
if(ptr->recnumber<65536){
*(short *)&string2[i+3]=(short)ptr->recnumber;
string2[i+5]=0x00;
obj_outrecord(0x90,i+6,&string2[0]);
}
else{
*(long *)&string2[i+3]=(long)ptr->recnumber;
string2[i+7]=0x00;
obj_outrecord(0x91,i+8,&string2[0]);
}
}
endp:
outeachPUBDEF(ptr->left);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,277 @@
#define _POINTER_
#include "tok.h"
void dopointerproc()
{
unsigned int snum;
int razr=r16;
ITOK wtok;
char *wbuf;
SINFO wstr;
if(am32)razr=r32;
itok.rm=itok.sib;
itok.sib=am32==0?CODE16:CODE32;
if((FixUp)
&&((itok.rm==rm_d32&&am32)||(itok.rm==rm_d16&&am32==0)))//16.07.04 16:01
//18.08.04 18:03 itok.rm==rm_d32 was itok.rm==CODE32
itok.flag|=f_reloc;
else compressoffset(&itok);
wstr=strinf;
strinf.bufstr=NULL;
wtok=itok;
wbuf=bufrm;
bufrm=NULL;
unsigned int oaddESP=addESP;
if(wtok.npointr<2){
itok.flag&=~f_far;
// itok.post=0;
snum=initparamproc();
CheckAllMassiv(wbuf,razr,&wstr,&wtok);
outseg(&wtok,2);
op(0xFF); op(0x10+wtok.rm+((wtok.flag&f_far)!=0?8:0));
outaddress(&wtok);
}
else{
int reg=BX;
getpointeradr(&wtok,wbuf,&wstr,wtok.npointr-1,am32==0?r16:r32,reg);
snum=initparamproc();
op66(razr);
op(0xFF);
op(0xD0+reg); /* CALL reg with stack params */
}
if((wtok.flag&f_typeproc)==tp_cdecl)CorrectStack(snum);
else addESP=oaddESP;
clearregstat(0);
}
void dopointer()
{
if(itok.type==tk_proc){
if(tok2==tk_openbracket){
dopointerproc();
nexttok();
return;
}
itok.rm=itok.sib;
itok.sib=am32==0?CODE16:CODE32;
compressoffset(&itok);
}
int razr=r16;
if(am32||(itok.flag&f_far))razr=r32;
do_d_wordvar(0,razr);
}
void getpointeradr(ITOK *gstok,char *&gbuf,SINFO *gstr,int numpointer,int razr, int reg)
{
if(gstok->flag&f_far){
CheckAllMassiv(gbuf,4,gstr,gstok);
outseg(gstok,2);
op(0xC4);
op(gstok->rm+8*reg);
outaddress(gstok);
itok.segm=ES;
itok.sib=CODE16;
if(reg==BX)itok.rm=rm_BX;
else if(reg==SI)itok.rm=rm_SI;
else if(reg==DI)itok.rm=rm_DI;
warningreg(segs[0]);
}
else{
int retreg;
if((gstok->flag&f_useidx)==0&&(retreg=CheckIDZReg(gstok->name,reg,razr))!=NOINREG){
if(am32==0&&retreg!=BX&&retreg!=SI&&retreg!=DI){
GenRegToReg(reg,retreg,razr);
IDZToReg(gstok->name,reg,razr);
}
else if(retreg!=SKIPREG)reg=retreg;
if(gbuf){
free(gbuf);
gbuf=NULL;
}
if(gstr->bufstr){
free(gstr->bufstr);
gstr->bufstr=NULL;
}
goto nomov;
}
if((gstok->flag&f_useidx))IDZToReg(gstok->name,reg,razr);
CheckAllMassiv(gbuf,razr,gstr,gstok);
outseg(gstok,2);
op(0x8B);
op(reg*8+gstok->rm);
outaddress(gstok);
nomov:
itok.segm=DS;
if(am32==0){
itok.sib=CODE16;
if(reg==BX)itok.rm=rm_BX;
else if(reg==SI)itok.rm=rm_SI;
else if(reg==DI)itok.rm=rm_DI;
}
else{
itok.sib=CODE32;
itok.rm=reg;
}
}
itok.post=0;
itok.number=0;
itok.flag=gstok->flag&(!f_reloc);
warningreg(regs[am32][reg]);
while(numpointer){
outseg(&itok,2);
op(0x8B);
op(itok.rm+reg*8);
outaddress(&itok);
numpointer--;
}
}
void dovalpointer()
{
int sign=0,rettype,pointr,razr=r8;
int rrettype;
int numpointer=0;
int hnumber=0;
//int i=0;
int reg=BX;
int npointr=0;
do{
nexttok();
numpointer++;
}while(tok==tk_mult);
ITOK wtok;
char *wbuf;
SINFO wstr;
unsigned char ocha;
unsigned int oinptr;
unsigned int olinenum;
int otok2;
wstr=strinf;
strinf.bufstr=NULL;
wtok=itok;
wbuf=bufrm;
bufrm=NULL;
if(numpointer==itok.npointr){
switch(itok.type){
case tk_qword:
case tk_double:
razr+=4;
case tk_dword:
case tk_float:
razr+=2;
case tk_word:
razr++;
break;
case tk_long:
razr+=2;
case tk_int:
razr++;
case tk_char:
sign=1;
break;
}
rrettype=rettype=itok.type;
oinptr=inptr2;
ocha=cha2;
olinenum=linenumber;
otok2=tok2;
nexttok();
if(tok==tk_assign){
nexttok();
convert_type(&sign,(int *)&rettype,&pointr);
while(tok==tk_mult){
nexttok();
npointr++;
}
if(npointr>itok.npointr)unuseableinput();
if(tok2==tk_assign){
hnumber=MultiAssign(razr,USEALLREG,npointr);
if(reg==hnumber)reg=DI;
goto getfromax;
}
}
linenumber=linenum2=olinenum;
cha2=ocha;
inptr2=oinptr;
tok2=otok2;
itok=wtok;
if(itok.type==tk_proc){
dopointer();
return;
}
getpointeradr(&itok,wbuf,&wstr,numpointer-1,razr,reg);
tok=tk_charvar+itok.type-tk_char;
switch(itok.type){
case tk_long:
case tk_dword:
case tk_int:
case tk_word:
do_d_wordvar(sign,razr);
return;
case tk_char:
case tk_byte:
dobytevar(sign);
return;
case tk_float:
dofloatvar();
return;
case tk_qword:
doqwordvar();
return;
case tk_double:
// dodoublevar();
return;
}
getfromax:
convert_returnvalue(rrettype,rettype);
ITOK otok=itok;
getpointeradr(&wtok,wbuf,&wstr,numpointer-1,razr,reg);
switch(rrettype){
case tk_char:
case tk_byte:
outseg(&itok,2);
op(0x88);
op(itok.rm+hnumber*8); //[reg]=AL
break;
case tk_int:
case tk_word:
case tk_long:
case tk_dword:
case tk_qword:
op66(razr);
outseg(&itok,2);
op(0x89);
op(itok.rm+hnumber*8); // MOV [rmword],AX
break;
case tk_float:
outseg(&itok,2); //fstp var
op(0xd9);
op(itok.rm+0x18);
fwait3();
break;
case tk_double:
outseg(&itok,2); //fstpq var
op(0xdd);
op(itok.rm+0x18);
fwait3();
break;
}
itok=otok;
}
else if(numpointer<itok.npointr){
razr=r16;
rettype=tk_word;
if(am32||(itok.flag&f_far)){
razr=r32;
rettype=tk_dword;
}
rrettype=rettype;
doreg_32(AX,razr);
goto getfromax;
}
else unuseableinput();
}

View File

@ -0,0 +1,174 @@
#define SEEK_SET (0)
#define SEEK_CUR (1)
#define SEEK_END (2)
#define _PORT_CPP_
#include "port.h"
long getfilelen(int fd)
{
long reslt,curr;
curr = lseek(fd,0,SEEK_CUR);
reslt = lseek(fd,0,SEEK_END);
lseek(fd,curr,SEEK_SET);
return reslt;
}
#ifndef _WIN32_
char* strupr(char* s)
{
char* p = s;
while (*p = toupper(*p)) p++;
return s;
}
char* strlwr(char* s)
{
char* p = s;
while (*p = tolower(*p)) p++;
return s;
}
int strnicmp(const char* s1, const char* s2, int len)
{
unsigned char c1,c2;
if(!len)
return 0;
do{
c1 = *s1++;
c2 = *s2++;
if (!c1||!c2)
break;
if (c1 == c2)
continue;
c1 = tolower(c1);
c2 = tolower(c2);
if (c1!=c2)
break;
} while (--len);
return (int)c1 - (int)c2;
}
int stricmp(const char* s1, const char* s2)
{
unsigned char c1,c2;
do{
c1 = *s1++;
c2 = *s2++;
if (!c1||!c2)
break;
if (c1 == c2)
continue;
c1 = tolower(c1);
c2 = tolower(c2);
if (c1!=c2)
break;
} while (c1);
return (int)c1 - (int)c2;
}
bool OemToCharA(char* a, char* b)
{
*b = *a;
return true;
}
bool CharToOemA(char* a, char* b)
{
*b = *a;
return true;
}
//ñòðîêà-ðåçóëüòàò íå èñïîëüçóåòñÿ
int MultiByteToWideChar(
unsigned int CodePage, // code page
unsigned int dwFlags, // character-type options
char* lpMultiByteStr, // address of string to map
int cchMultiByte, // number of characters in string
wchar_t* lpWideCharStr, // address of wide-character buffer
int cchWideChar // size of buffer
)
{
int i;
while ((lpMultiByteStr[i*2]!=0) && (lpMultiByteStr[i*2+1]!=0)) i++;
return i/2;
}
#ifdef _KOS_
typedef struct _fs
{
int cmd;
int numL;
int numH;
int size;
void* pointer;
unsigned char nul;
char* path;
} fs;
int stat (const char* path, struct _stat* buf)
{
//fs fstruc;
char buff[40];
int __ret;
char pathin[256];
int i;
char fstruc[25];
for(i=0; i<256; i++){
pathin[i]=path[i];
if (pathin[i]==0) break;
}
pathin[255]=0;
*((int*)(fstruc+0)) = 5;
*((int*)(fstruc+4)) = 0;
*((int*)(fstruc+8)) = 0;
*((int*)(fstruc+12)) = 0;
*((char**)(fstruc+16)) = buff;
*((char*)(fstruc+20)) = 0;
*((char**)(fstruc+21)) = pathin;
__asm__ __volatile__("int $0x40":"=a"(__ret):"a"(70),"b"(&fstruc));
return __ret;
}
char * getcwd (char *buffer, int size)
{
int len=0;
if (size==0){
if (buffer!=0)
return 0;
size = 256;
}
if (buffer==0)
buffer = (char*)malloc(size);
__asm__ __volatile__("int $0x40":"=a"(len):"a"(30),"b"(2),"c"(buffer),"d"(size));
if (len!=0)
return buffer;
else
return 0;
}
void exit(int a){
__asm__ __volatile__("int $0x40"::"a"(-1));
}
#endif //_KOS_
#endif //not _WIN32_

120
programs/develop/cmm/port.h Normal file
View File

@ -0,0 +1,120 @@
#ifndef ___PORT_H___
#define ___PORT_H___
#ifdef __cplusplus
extern "C" {
#endif
#define _BORLAND_DOS_REGS
struct DWORDREGS {
unsigned long edi;
unsigned long esi;
unsigned long ebp;
unsigned long cflag;
unsigned long ebx;
unsigned long edx;
unsigned long ecx;
unsigned long eax;
unsigned short eflags;
};
struct DWORDREGS_W {
unsigned long di;
unsigned long si;
unsigned long bp;
unsigned long cflag;
unsigned long bx;
unsigned long dx; unsigned long cx;
unsigned long ax;
unsigned short flags;
};
struct WORDREGS {
unsigned short di, _upper_di;
unsigned short si, _upper_si;
unsigned short bp, _upper_bp;
unsigned short cflag, _upper_cflag;
unsigned short bx, _upper_bx;
unsigned short dx, _upper_dx;
unsigned short cx, _upper_cx;
unsigned short ax, _upper_ax;
unsigned short flags;
};
struct BYTEREGS {
unsigned short di, _upper_di;
unsigned short si, _upper_si;
unsigned short bp, _upper_bp;
unsigned long cflag;
unsigned char bl;
unsigned char bh;
unsigned short _upper_bx;
unsigned char dl;
unsigned char dh;
unsigned short _upper_dx;
unsigned char cl;
unsigned char ch;
unsigned short _upper_cx;
unsigned char al;
unsigned char ah;
unsigned short _upper_ax;
unsigned short flags;
};
union REGS {
struct DWORDREGS d;
#ifdef _NAIVE_DOS_REGS
struct WORDREGS x;
#else
#ifdef _BORLAND_DOS_REGS
struct DWORDREGS x;
#else
struct DWORDREGS_W x;
#endif
#endif
struct WORDREGS w;
struct BYTEREGS h;
};
long getfilelen(int);
#ifndef _WIN32_
#define CP_ACP 0
#define MB_PRECOMPOSED 1
#define OemToChar OemToCharA
#define CharToOem CharToOemA
bool OemToCharA(char*, char*);
bool CharToOemA(char*, char*);
int MultiByteToWideChar(unsigned int,unsigned int,char*,int,wchar_t *,int);
#endif
#ifdef _PORT_CPP_
long lseek (int, long, int);
char tolower(char c);
char toupper(char c);
char* strupr(char* s);
char* strlwr(char* s);
int stricmp(const char*, const char*);
int strnicmp(const char*, const char*, int);
char * getcwd (char *buffer, int size);
int stat (const char*, struct _stat*);
void exit(int);
void* malloc(int);
#endif //_PORT_CPP_
#ifdef __cplusplus
}
#endif
#endif // ___PORT_H___

1546
programs/develop/cmm/res.cpp Normal file

File diff suppressed because it is too large Load Diff

218
programs/develop/cmm/res.h Normal file
View File

@ -0,0 +1,218 @@
#define CRT_NEWRESOURCE 0x2000
#define CRT_ERROR 0x7FFF
#define CRT_CURSOR 1
#define CRT_BITMAP 2
#define CRT_ICON 3
#define CRT_MENU 4
#define CRT_DIALOG 5
#define CRT_STRING 6
#define CRT_FONTDIR 7
#define CRT_FONT 8
#define CRT_ACCELERATOR 9
#define CRT_RCDATA 10
#define CRT_MESSAGETABLE 11
#define CRT_GROUP_CURSOR 12
#define CRT_GROUP_ICON 14
#define CRT_VERSION 16
#define CRT_DLGINCLUDE 17
#define CRT_PLUGPLAY 19
#define CRT_VXD 20
#define CRT_ANICURSOR 21
#define CRT_ANIICON 22
#define CRT_NEWBITMAP (CRT_BITMAP|CRT_NEWRESOURCE)
#define CRT_NEWMENU (CRT_MENU|CRT_NEWRESOURCE)
#define CRT_NEWDIALOG (CRT_DIALOG|CRT_NEWRESOURCE)
#define TOTALTYPERES 22
#define NUMMENUPOPUP 8
struct RES{
int type; //⨯ à¥áãàá¢
char *tname; //¨¬ï ⨯ 
int id; //¥£® id
char *name; //¨¬ï à¥áãàá 
unsigned short lang; //ï§ëª
unsigned char *res; //㪠§ â¥«ì ­  â ¡«¨æã à¥áãàá 
unsigned int size; //à §¬¥à â ¡«¨æë
};
#define DRESNUM 100
#define SIZERESBUF 2048
struct _STRINGS_{
char *id;
short val;
};
_STRINGS_ typemem[7]={
"MOVEABLE", 0x0010,
"FIXED", ~0x0010,
"PURE", 0x0020,
"IMPURE", ~0x0020,
"PRELOAD", 0x0040,
"LOADONCALL", ~0x0040,
"DISCARDABLE",0x1000
};
_STRINGS_ typeclass[6]={
"BUTTON", 0x80,
"EDIT", 0x81,
"STATIC", 0x82,
"LISTBOX", 0x83,
"SCROLLBAR",0x84,
"COMBOBOX", 0x85
};
_STRINGS_ typemenu[NUMMENUPOPUP]={
"GREYED", 0x0001,
"INACTIVE", 0x0002,
"BITMAP", 0x0004,
"OWNERDRAW", 0x0100,
"CHECKED", 0x0008,
"MENUBARBREAK",0x0020,
"MENUBREAK", 0x0040,
"HELP", 0x4000
};
_STRINGS_ typeacceler[5]={
"VIRTKEY", 0x01,
"NOINVERT", 0x02,
"SHIFT", 0x04,
"CONTROL", 0x08,
"ALT", 0x10
};
enum {v_fv=1,v_pv,v_ffm,v_ff,v_fo,v_ft,v_fs};
_STRINGS_ typeversion[7]={
"FILEVERSION",v_fv,
"PRODUCTVERSION",v_pv,
"FILEFLAGSMASK",v_ffm,
"FILEFLAGS",v_ff,
"FILEOS",v_fo,
"FILETYPE",v_ft,
"FILESUBTYPE",v_fs
};
enum{
rc_accelerators,rc_auto3state, rc_autocheckbox,rc_autoradiobutton,rc_bitmap,
rc_caption, rc_characteristics,rc_checkbox, rc_class, rc_combobox,
rc_control, rc_ctext, rc_cursor, rc_defpushbutton, rc_dialog,
rc_dialogex, rc_edittext, rc_exstyle, rc_font, rc_groupbox,
rc_icon, rc_listbox, rc_ltext, rc_menu, rc_menuex,
rc_menuitem, rc_messagetable, rc_popup, rc_pushbox, rc_pushbutton,
rc_radiobutton, rc_rcdata, rc_rtext, rc_scrollbar, rc_state3,
rc_stringtable, rc_style, rc_version, rc_versioninfo, rc_begin,
rc_end, rc_language
};
struct{
unsigned short dclass;
unsigned long style;
}defdialog[rc_state3+1]={
0,0,
0x80,6,//BS_AUTO3STATE
0X80,3|0x00010000,//BS_AUTOCHECKBOX|WS_TABSTOP,
0X80,9,//BS_AUTORADIOBUTTON,
0,0,
0,0,
0,0,
0X80,0x00010002,//BS_CHECKBOX|WS_TABSTOP,
0,0,
0X85,0x00010000,//0,WS_TABSTOP
0,0x40000000|0x10000000,//WS_CHILD|WS_VISIBLE,
0X82,1,//ES_CENTER,
0,0,
0X80,1|0x00010000,//BS_DEFPUSHBUTTON|WS_TABSTOP,
0,0,
0,0,
0X81,0x00800000|0x00010000,//ES_LEFT|WS_BORDER|WS_TABSTOP,
0,0,
0,0,
0X80,7|0x00010000,//BS_GROUPBOX,
0X82,3,//SS_ICON,
0X83,0x00800000|1,//WS_BORDER|LBS_NOTIFY,
0X82,0x00020000,//ES_LEFT|WS_GROUP,
0,0,
0,0,
0,0,
0,0,
0,0,
0X80,0x00010000,// ??? BS_PUSHBOX,
0X80,0x00010000,//BS_PUSHBUTTON|WS_TABSTOP,
0X80,4,//BS_RADIOBUTTON,
0,0,
0X82,2|0x00020000,//ES_RIGHT|WS_GROUP,
0X84,0,
0X80,5//BS_3STATE
};
union NameOrdinal
{
unsigned char *name;
unsigned short ordinal[2];
};
struct _DBH_ //áâàãªâãà  ¤¨ «®£ 
{
unsigned long lStyle;
unsigned long lExtendedStyle;
unsigned short NumberOfItems;
unsigned short x;
unsigned short y;
unsigned short cx;
unsigned short cy;
NameOrdinal MenuName;
NameOrdinal ClassName;
char *Caption;
unsigned short FontSize;
char *FontName;
};
struct _CD_ //ª®­â஫ì­ë¥ ¤ ­­ë¥ ¤¨ «®£ 
{
unsigned long lStyle;
unsigned long lExtendedStyle;
unsigned short x;
unsigned short y;
unsigned short cx;
unsigned short cy;
unsigned short Id;
NameOrdinal ClassId;
NameOrdinal Text;
unsigned short Extra;
};
struct _ICOHEAD_
{
unsigned short res1;
unsigned short type;
unsigned short count;
// unsigned short res2;
};
struct _RESDIR_
{
unsigned char width;
unsigned char heigth;
unsigned char color;
unsigned char res1;
unsigned short planes;
unsigned short bitcount;
unsigned long binres;
unsigned short nameord;
// unsigned short res2;
};
struct _CURDIR_
{
unsigned short width;
unsigned short heigth;
unsigned short planes;
unsigned short bitcount;
unsigned long binres;
unsigned short nameord;
// unsigned short res2;
};

View File

@ -0,0 +1,75 @@
/* 吲栽 <20>帖 嶂平丞兒恥<E58592> 能恐<E883BD>洵悟 'FASTLIST.EXE' */
short ofsres[26]={
0x0000,0x003B, //a b
0x004C,0x009B, //c d
0x00BE,0x00D8, //e f
0x00E0,0xFFFF, //g h
0x00EC,0xFFFF, //i j
0xFFFF,0x00F4, //k l
0x0110,0xFFFF, //m n
0xFFFF,0x0138, //o p
0xFFFF,0x0156, //q r
0x0174,0xFFFF, //s t
0xFFFF,0x019D, //u v
0xFFFF,0xFFFF, //w x
0xFFFF,0xFFFF}; //y z
unsigned char resMnem[]={
0x00,0x00,0x63,0x63,0x65,0x6C,0x65,0x72,0x61,0x74,0x6F,0x72,0x73,0, // accelerators
0x01,0x00,0x75,0x74,0x6F,0x33,0x73,0x74,0x61,0x74,0x65,0, // auto3state
0x02,0x00,0x75,0x74,0x6F,0x63,0x68,0x65,0x63,0x6B,0x62,0x6F,0x78,0, // autocheckbox
0x03,0x00,0x75,0x74,0x6F,0x72,0x61,0x64,0x69,0x6F,0x62,0x75,0x74,0x74,0x6F,0x6E,0, // autoradiobutton
0xFF,0xFF, // end char 'a'
0x27,0x00,0x65,0x67,0x69,0x6E,0, // begin
0x04,0x00,0x69,0x74,0x6D,0x61,0x70,0, // bitmap
0xFF,0xFF, // end char 'b'
0x05,0x00,0x61,0x70,0x74,0x69,0x6F,0x6E,0, // caption
0x06,0x00,0x68,0x61,0x72,0x61,0x63,0x74,0x65,0x72,0x69,0x73,0x74,0x69,0x63,0x73,0, // characteristics
0x07,0x00,0x68,0x65,0x63,0x6B,0x62,0x6F,0x78,0, // checkbox
0x08,0x00,0x6C,0x61,0x73,0x73,0, // class
0x09,0x00,0x6F,0x6D,0x62,0x6F,0x62,0x6F,0x78,0, // combobox
0x0A,0x00,0x6F,0x6E,0x74,0x72,0x6F,0x6C,0, // control
0x0B,0x00,0x74,0x65,0x78,0x74,0, // ctext
0x0C,0x00,0x75,0x72,0x73,0x6F,0x72,0, // cursor
0xFF,0xFF, // end char 'c'
0x0D,0x00,0x65,0x66,0x70,0x75,0x73,0x68,0x62,0x75,0x74,0x74,0x6F,0x6E,0, // defpushbutton
0x0E,0x00,0x69,0x61,0x6C,0x6F,0x67,0, // dialog
0x0F,0x00,0x69,0x61,0x6C,0x6F,0x67,0x65,0x78,0, // dialogex
0xFF,0xFF, // end char 'd'
0x10,0x00,0x64,0x69,0x74,0x74,0x65,0x78,0x74,0, // edittext
0x28,0x00,0x6E,0x64,0, // end
0x11,0x00,0x78,0x73,0x74,0x79,0x6C,0x65,0, // exstyle
0xFF,0xFF, // end char 'e'
0x12,0x00,0x6F,0x6E,0x74,0, // font
0xFF,0xFF, // end char 'f'
0x13,0x00,0x72,0x6F,0x75,0x70,0x62,0x6F,0x78,0, // groupbox
0xFF,0xFF, // end char 'g'
0x14,0x00,0x63,0x6F,0x6E,0, // icon
0xFF,0xFF, // end char 'i'
0x29,0x00,0x61,0x6E,0x67,0x75,0x61,0x67,0x65,0, // language
0x15,0x00,0x69,0x73,0x74,0x62,0x6F,0x78,0, // listbox
0x16,0x00,0x74,0x65,0x78,0x74,0, // ltext
0xFF,0xFF, // end char 'l'
0x17,0x00,0x65,0x6E,0x75,0, // menu
0x18,0x00,0x65,0x6E,0x75,0x65,0x78,0, // menuex
0x19,0x00,0x65,0x6E,0x75,0x69,0x74,0x65,0x6D,0, // menuitem
0x1A,0x00,0x65,0x73,0x73,0x61,0x67,0x65,0x74,0x61,0x62,0x6C,0x65,0, // messagetable
0xFF,0xFF, // end char 'm'
0x1B,0x00,0x6F,0x70,0x75,0x70,0, // popup
0x1C,0x00,0x75,0x73,0x68,0x62,0x6F,0x78,0, // pushbox
0x1D,0x00,0x75,0x73,0x68,0x62,0x75,0x74,0x74,0x6F,0x6E,0, // pushbutton
0xFF,0xFF, // end char 'p'
0x1E,0x00,0x61,0x64,0x69,0x6F,0x62,0x75,0x74,0x74,0x6F,0x6E,0, // radiobutton
0x1F,0x00,0x63,0x64,0x61,0x74,0x61,0, // rcdata
0x20,0x00,0x74,0x65,0x78,0x74,0, // rtext
0xFF,0xFF, // end char 'r'
0x21,0x00,0x63,0x72,0x6F,0x6C,0x6C,0x62,0x61,0x72,0, // scrollbar
0x22,0x00,0x74,0x61,0x74,0x65,0x33,0, // state3
0x23,0x00,0x74,0x72,0x69,0x6E,0x67,0x74,0x61,0x62,0x6C,0x65,0, // stringtable
0x24,0x00,0x74,0x79,0x6C,0x65,0, // style
0xFF,0xFF, // end char 's'
0x25,0x00,0x65,0x72,0x73,0x69,0x6F,0x6E,0, // version
0x26,0x00,0x65,0x72,0x73,0x69,0x6F,0x6E,0x69,0x6E,0x66,0x6F,0, // versioninfo
0xFF,0xFF // end char 'v'
};

View File

@ -0,0 +1,113 @@
/*OUTPUT_FORMAT("binary")*/
ENTRY(__start)
SECTIONS
{
.text 0x000000:
{
LONG(0x554e454D);
LONG(0x32305445);
LONG(1);
LONG(__start);
LONG(___iend);
LONG(___memsize);
LONG(___stacktop);
LONG(___cmdline);
LONG(___pgmname); /* full path */
LONG(0); /*FIXME tls data */
*(.init)
*(.text)
*(SORT(.text$*))
*(.text.*)
*(.glue_7t)
*(.glue_7)
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0);
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0);
*(.fini)
/* ??? Why is .gcc_exc here? */
*(.gcc_exc)
PROVIDE (etext = .);
*(.gcc_except_table)
}
.rdata ALIGN(16) :
{
*(.rdata)
*(SORT(.rdata$*))
___RUNTIME_PSEUDO_RELOC_LIST__ = .;
__RUNTIME_PSEUDO_RELOC_LIST__ = .;
*(.rdata_runtime_pseudo_reloc)
___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
}
.CRT ALIGN(16) :
{
___crt_xc_start__ = . ;
*(SORT(.CRT$XC*)) /* C initialization */
___crt_xc_end__ = . ;
___crt_xi_start__ = . ;
*(SORT(.CRT$XI*)) /* C++ initialization */
___crt_xi_end__ = . ;
___crt_xl_start__ = . ;
*(SORT(.CRT$XL*)) /* TLS callbacks */
/* ___crt_xl_end__ is defined in the TLS Directory support code */
___crt_xp_start__ = . ;
*(SORT(.CRT$XP*)) /* Pre-termination */
___crt_xp_end__ = . ;
___crt_xt_start__ = . ;
*(SORT(.CRT$XT*)) /* Termination */
___crt_xt_end__ = . ;
}
.data ALIGN(16) :
{
__data_start__ = . ;
*(.data)
*(.data2)
*(SORT(.data$*))
*(.jcr)
__CRT_MT = .;
LONG(0);
__data_end__ = . ;
*(.data_cygwin_nocopy)
}
.eh_frame ALIGN(16) :
{
*(.eh_frame)
___iend = . ;
}
bss ALIGN(16):
{
*(.bss)
*(COMMON)
. = ALIGN(16);
___menuet__app_path_area = .;
. = . + 1024 + 16;
___stacktop = .;
___memsize = . ;
}
/DISCARD/ :
{
*(.debug$S)
*(.debug$T)
*(.debug$F)
*(.drectve)
*(.note.GNU-stack)
*(.comment)
*(.debug_abbrev)
*(.debug_info)
*(.debug_line)
*(.debug_frame)
*(.debug_loc)
*(.debug_pubnames)
*(.debug_aranges)
*(.debug_ranges)
}
}

View File

@ -0,0 +1,546 @@
#include <stdio.h>
#include <sys/stat.h>
typedef struct _BIT_{
unsigned int siz:8;
unsigned int ofs:24;
}BIT;
struct _PROCINFO_
{
char *buf; // ¤à¥á ⥪áâ  ¯à®æ¥¤ãàë
void *classteg; // ¤à¥á ⥣ , £¤¥ ®¯à¥¤¥«¥­  ¯à®æ¥¤ãà 
unsigned int warn:1;
unsigned int speed:1;
unsigned int lst:1;
unsigned int typestring:2;
unsigned int inlinest:1;
unsigned int code32:1;
unsigned int align:1;
unsigned int acycle:1;
unsigned int idasm:1;
unsigned int opnum:1;
unsigned int de:1;
unsigned int ostring:1;
unsigned int uselea:1;
unsigned int regoverstack:1;
unsigned int sizeacycle;
char chip;
};
struct idrec
{
union{
struct idrec *left;
struct localrec *next;
};
struct idrec *right; //¯à¥¤ë¤ãé ¨ á«¥¤ãîé § ¯¨áì
char recid[IDLENGTH]; //¨¬ï
unsigned int flag;
char *newid; //¡«®ª á ¤ ­ë¬¨, ¤«ï áâàãªâãà  ¤à¥á ⥣ ,¤«ï ¯à®æ¥¤ãà ¯ à ¬¥âàë
int rectok; //⨯
int recrm; //¤«ï áâàãªâãà ç¨á«® ª®¯¨©
int recsegm;
int recpost;
int recsize;
int recsib;
int line; //­®¬¥à «¨­¨¨
int file; //ä ©«
int count; //áç¥â稪 ¨á¯®«ì§®¢ ­¨ï
unsigned short type;
unsigned short npointr;
union{
char *sbuf; //㪠§ â¥«ì ­  ¡«®ª ¨á室­®£® ⥪áâ 
_PROCINFO_ *pinfo;
};
union{
long recnumber;
long long reclnumber;
double recdnumber;
float recfnumber;
};
};
struct localinfo
{
int usedfirst;
int usedlast;
int start;
int end;
int level;
int count;
};
struct localrec
{
/* struct localrec *next;
int localtok;
unsigned short type;
unsigned short npointr;
union{
unsigned int localnumber;
idrec *rec;
};
int locsize;
char localid[IDLENGTH];
unsigned char fuse; //ä« £ ¨á¯®«ì§®¢ ­¨ï
unsigned char flag; //ä« £ static*/
idrec rec;
localinfo li;
unsigned char fuse; //ä« £ ¨á¯®«ì§®¢ ­¨ï
};
#define INITBPPAR 1 //¨­¨æ¨ «¨§ æ¨ï BP ¯®á«¥ ¯ à ¬¥â஢
#define INITBPLOC 2 //¨­¨æ¨ «¨§ æ¨ï BP ¯®á«¥ «®ª «ì­ëå
#define INITBPENTER 4
#define INITBPADDESP 8
struct HEADLOC
{
int type; //⨯ § £®«®¢ª 
unsigned int ofs; // ¤à¥á §­ ç¥­¨ï
unsigned int num; //¢¥«¨ç¨­  §­ ç¥­¨ï
};
struct treelocalrec
{
treelocalrec *next;
localrec *lrec;
int initbp;
int level;
unsigned int addesp;
int endline;
};
typedef struct _ITOK_
{
int rm;
int segm;
int post;
int sib;
union{
long number;
long long lnumber;
double dnumber;
float fnumber;
};
union{
int size;
BIT bit;
};
unsigned short type;
unsigned short npointr;
union{
idrec *rec;
localrec *locrec;
};
char name[IDLENGTH];
unsigned int flag;
}ITOK;
struct elementteg
{
union{
void *nteg; // ¤à¥á ⥣  ¢«®¦¥­­®© áâàãªâãàë
idrec *rec;
};
int tok;
union{
unsigned int numel; //ç¨á«® í«¥¬¥­â®¢ í⮣® ⨯ 
BIT bit;
};
unsigned int ofs; //ᬥ饭¨¥ ®â ­ ç «  áâàãªâãàë
char name[IDLENGTH];
};
struct structteg
{
struct structteg *left; //á«¥¤ãî騩 ⥣
struct structteg *right; //á«¥¤ãî騩 ⥣
unsigned int size; //à §¬¥à ⥣ 
unsigned int numoper; //ç¨á«® ®¯¥à ­¤®¢ áâàãªâãàë
struct elementteg *baza; // ¤à¥á á ®¯¨á ­¨¥¬ í«¥¬¥­â®¢ ⥣ 
unsigned int flag;
char name[IDLENGTH];
};
struct listexport
{
long address;
char name[IDLENGTH];
};
typedef struct _IOFS_
{
unsigned int ofs;
unsigned int line; //­®¬¥à «¨­¨¨
unsigned int file; //ä ©«
unsigned char dataseg;
}IOFS;
typedef struct _UNDEFOFF_
{
struct _UNDEFOFF_ *next;
IOFS *pos; //¡ãä¥à á  ¤à¥á ¬¨ ®âªã¤  áá뫪¨
int num; //ç¨á«® ááë«®ª ­  íâã ¬¥âªã
char name[IDLENGTH];
}UNDEFOFF;
typedef struct _LISTCOM_
{
char name[IDLENGTH];
}LISTCOM;
typedef struct _SINFO_
{
char *bufstr;
int size;
}SINFO;
//áâàãªâãà  á¯¨áª  api-¯à®æ¥¤ãà
typedef struct _APIPROC_
{
struct idrec *recapi;
}APIPROC;
//
typedef struct _DLLLIST_
{
struct _DLLLIST_ *next; //á«¥¤ãîé ï DLL
struct _APIPROC_ *list; //ᯨ᮪ ¯à®æ¥¤ãà
unsigned short num; //ç¨á«® ¯à®æ¥¤ãà
char name[IDLENGTH]; //¨¬ï DLL
}DLLLIST;
typedef struct _PE_HEADER_
{
long sign; //ᨣ­ âãà  - ¢á¥£¤  'PE'
short cpu; //¬¨­ ⨯ CPU - ¢á¥£¤  0x14C
short numobj; //ç¨á«® ¢å®¤®¢ ¢ â ¡«¨æã ®¡ê¥ªâ®¢
long date_time; //¤ â  ¬®¤¨ä¨ª æ¨¨ «¨­ª¥à®¬
long pCOFF;
long COFFsize;
short NTheadsize; //à §¬¥à § £®«®¢ª  PE ®â MAGIC - ¢á¥£¤  0xE0
short flags;
short Magic; //­ §­ ç¥­¨¥ ¯à£à ¬¬ë
short LinkVer; //¢¥àá¨ï «¨­ª¥à 
long sizecode;
long sizeinitdata;
long sizeuninitdata;
long EntryRVA; // ¤à¥á ®â­®á¨â IMAGE BASE ¯® ª®â®à®¬ã ¯¥à¥¤ ¥âáï ã¯à ¢«¥­¨¥
long basecode; //RVA ᥪæ¨ï, ª®â®à ï ᮤ¥à¦¨â ¯à®£à ¬¬­ë© ª®¤
long basedata; //RVA ᥪæ¨ï,ᮤ¥à¦ é ï ¤ ­­ë¥
long ImageBase; //¢¨àâã «ì­ë© ­ ç «ì­ë©  ¤à¥á § £à㧪¨ ¯à®£à ¬¬ë
long objAlig; //¢ëà ¢­¨¢ ­¨¥ ¯à®£à ¬¬­ëå ᥪ権
long fileAlig; //‚ëà ¢­¨¢ ­¨¥ ᥪ権 ¢ ä ©«¥
long OSver; //­®¬¥à ¢¥àᨨ ®¯¥à á¨áâ¥¬ë ­¥®¡å ¯à®£à ¬¬¥
long userver;
long SubSysVer;
long rez;
long imagesize; //à §¬¥à ¢ ¡ ©â å § £à㦠¥¬®£® ®¡à §  á § £®«®¢ª ¬¨ ¢ëà ¢­¥­ë©
long headsize; //à §¬ ¢á¥å § £®«®¢ª®¢ stub+PE+objtabl
long checksum;
short SubSys; //®¯¥à æ¨®­­ ï á¨áâ ­¥®¡å ¤«ï § ¯ã᪠
short DLLflag;
long stackRezSize;
long stackComSize;
long heapRezSize;
long heapComSize;
long loaderFlag;
long numRVA; //¢á¥£¤  10
long exportRVA;
long exportSize;
long importRVA;
long importSize;
long resourRVA;
long resourSize;
long exceptRVA;
long exceptSize;
long securRVA;
long securSize;
long fixupRVA;
long fixupSize;
long debugRVA;
long debugSize;
long descripRVA;
long descripSize;
long machinRVA;
long machinSize;
long tlsRVA;
long tlsSize;
long loadConfRVA;
long loadConfSize;
long rez2[2];
long iatRVA;
long iatSize;
long rez3[6];
}PE_HEADER;
typedef struct _OBJECT_ENTRY_
{
char name[8];
long vsize;
long sectionRVA;
long psize;
long pOffset;
unsigned long PointerToRelocations;
unsigned long PointerToLinenumbers;
unsigned short NumberOfRelocations;
unsigned short NumberOfLinenumbers;
long flags;
}OBJECT_ENTRY;
typedef struct _EXPORT_TABLE_
{
unsigned long Flags;
unsigned long Time;
unsigned short Version[2];
unsigned long NameRVA;
unsigned long OriginalBase;
unsigned long NumFunc;
unsigned long NumName;
unsigned long AddressRVA;
unsigned long NamePRVA;
unsigned long OrdinalRVA;
}EXPORT_TABLE;
struct ftime {
unsigned ft_tsec:5; /* ¤¢¥ ᥪ㭤ë */
unsigned ft_min:6; /* ¬¨­ãâë */
unsigned ft_hour:5; /* ç áë */
unsigned ft_day:5; /* ¤¥­ì */
unsigned ft_month:4; /* ¬¥áïæ */
unsigned ft_year:7; /* £®¤-1980 */
};
typedef struct _STRING_LIST_
{
void *next; //á«¥¤ãîé ï áâàãªâãà 
unsigned int len; //¤«¨­  áâப¨
unsigned int ofs; // ¤à¥á ¢ ¢ë室­®¬ ä ©«¥
unsigned char type; //⨯ â¥à¬¨­ â®à 
unsigned char plase; //£¤¥ ᥩç á áâப  - post or data
}STRING_LIST;
struct FILEINFO
{
char *filename;
int numdline;
idrec *stlist;
union{
struct ftime time;
unsigned short lineidx[2];
};
};
struct EWAR{
FILE *file;
char *name;
};
typedef struct _ICOMP_
{
unsigned int type;
unsigned int loc;
unsigned int use_cxz;
}ICOMP;
typedef struct _RETLIST_
{
unsigned int line;
unsigned int loc;
unsigned int type;
// int use;
}RETLIST;
enum{
singlcase,startmulti,endmulti};
typedef struct _ISW_
{
unsigned char type;
unsigned int postcase;
unsigned long value;
}ISW;
struct postinfo
{
unsigned int loc;
unsigned int num;
unsigned short type;
unsigned short line;
unsigned short file;
};
typedef struct _EXE_DOS_HEADER_
{
unsigned short sign;
unsigned short numlastbyte;
unsigned short numpage;
unsigned short numreloc;
unsigned short headsize;
unsigned short minmem;
unsigned short maxmem;
unsigned short initSS;
unsigned short initSP;
unsigned short checksum;
unsigned short initIP;
unsigned short initCS;
unsigned short ofsreloc;
unsigned short overlay;
unsigned long fullsize;
}EXE_DOS_HEADER;
typedef struct _FSWI_
{
ISW *info;
int sizetab; //ç¨á«® í«¥¬¥­â®¢
int type; //à §à來®áâì
int numcase; //ç¨á«® ¨á¯®«ì§ã¥¬ëå í«¥¬¥­â®¢
int defal; //§­ ç¥­¨¥ ¯® 㬮«ç ­¨î.
int ptb; // ¤à¥á 㪠§ â¥«ï ­  íâã â ¡«¨æã ¢ ¡«®ª¥ ª®¤ 
int ptv; // ¤à¥á â ¢«¨æë ¢¥«¨ç¨­
int mode; //⨯ switch
int razr; //à §à來®áâì ¢¥«¨ç¨­
}FSWI;
struct paraminfo
{
unsigned int ofspar;
unsigned char type[8];
};
struct MEOSheader
{
unsigned char sign[8];
unsigned long vers;
unsigned long start;
unsigned long size;
unsigned long alloc_mem;
unsigned long esp;
unsigned long I_Param;
unsigned long I_Icon;
};
#ifdef OPTVARCONST
struct LVIC{
idrec *rec;
// int blocks;
int typevar;
int contype; //⨯ ᮤ¥à¦¨¬®£®
union{
long number;
long long lnumber;
double dnumber;
float fnumber;
};
};
struct BLVIC
{
int sizevic;
LVIC *listvic;
};
#endif
#define SIZEIDREG 256
#define NOINREG 8
#define SKIPREG 9
struct REGEQVAR
{
REGEQVAR *next;
char name[IDLENGTH];
unsigned char razr;
};
struct REGISTERSTAT
{
union{
REGEQVAR *next;
#ifdef OPTVARCONST
BLVIC *bakvic;
#endif
};
union{
char id[SIZEIDREG];
void *stringpar;
unsigned long number;
};
unsigned char type;
unsigned char razr;
};
struct SAVEREG
{
unsigned int size; //à §¬¥à ¯ ¬ï⨠¤«ï ॣ¨áâ஢
unsigned char all; //¢á¥ ॣ¨áâàë
unsigned char reg[8]; //ª àâ  à¥£¨áâ஢
};
struct SAVEPAR
{
unsigned char ooptimizespeed;
unsigned char owarning;
unsigned char odbg;
unsigned char odosstring;
unsigned char ouseinline;
unsigned char oam32; // ०¨¬ 32 ¡¨â­®©  ¤à¥á æ¨¨
unsigned char oalignword;
unsigned char oAlignCycle; //¢ëà ¢­¨¢ âì ­ ç «  横«®¢
unsigned char oidasm; // áᥬ¡«¥à­ë¥ ¨­áâàãªæ¨¨ áç¨â âì ¨¤¥­â¨ä¨ª â®à ¬¨
int ooptnumber;
int odivexpand;
unsigned char ooptstr; //®¯â¨¬¨§ æ¨ï áâப®¢ëå ª®­áâ ­â
unsigned char ochip;
int oaligncycle;
unsigned char ouselea;
unsigned char oregoverstack;
};
struct COM_MOD
{
COM_MOD *next;
unsigned char *input; /* dynamic input buffer */
unsigned int endinptr; /* end index of input array */
unsigned int inptr; /* index in input buffer */
unsigned int inptr2; /* index in input buffer */
unsigned int linenumber;
unsigned int currentfileinfo;
int numparamdef; //ç¨á«® ¯ à ¬¥â஢ ¢ ⥪ã饬 define
char *declareparamdef; //ᯨ᮪ ®¡ê¥­ëå ¯ à ¬¥â஢ define
char *paramdef; //ᯨ᮪ ­®¢ëå ¯ à ¬¥â஢
int freze; //ä« £ § ¯à¥é¥­¨ï 㤠«¥­¨ï áâàãªâãàë
};
struct LISTRELOC {
unsigned int val;
};
struct LISTFLOAT
{
union{
float fnum;
double dnum;
unsigned long num[2];
};
int type;
unsigned int ofs;
};
struct LILV
{
unsigned int ofs;
int size;
localrec *rec;
};
struct WARNACT
{
void (*fwarn)(char *str,unsigned int line,unsigned int file);
unsigned char usewarn;
};

View File

@ -0,0 +1,829 @@
#define _SWITCH_
#include "tok.h"
extern int lastcommand; //¯®á«¥¤­¨© ®¯¥à â®à ¢ ¡«®ª¥
#define MAXCASE 1024
FSWI *swtables; //â ¡«¨æ  ¨­ä®à¬ æ¨© ®¡ switch
int numswtable=0; //ç¨á«® ¡«®ª®¢ ¢ í⮩ â ¡«¨æ¥
char mesSWITCH[]="SWITCH";
char mesCASE[]="CASE";
int numexpandcase;
int numberbreak=0;
void CheckJmpSW(int line,int endsw,int startsw,int shortjmp,char *mes)
{
int size=startsw-endsw;
if(shortjmp==FALSE){
if((unsigned int)size<128)warningjmp(mes,line);
if(am32==FALSE)*(unsigned short *)&output[endsw-2]=(unsigned short)size;
else *(unsigned long *)&output[endsw-4]=(unsigned long)size;
}
else{
if((unsigned int)size>127)jumperror(line,mes);
output[endsw-1]=(unsigned char) size;
}
}
void CmpRegNum(int tokr,unsigned long value,int reg)
{
if(tokr!=r8){
op66(tokr); //CMP EAX,val
if(value==0){
op(0x85);
op(0xC0+reg*9); //test AX,AX
}
else{
if(short_ok(value,tokr==r32?TRUE:FALSE)){
op(0x83);
op(0xF8+reg);
op(value);
}
else{
if(reg==0)op(0x3D);
else{
op(0x81);
op(0xF8+reg);
}
tokr==r32?outdword(value):outword(value);
}
}
}
else{ //CMP AL,val
if(value==0){
op(0x84);
op(0xC0+reg*9);
}
else{
if(reg==0)op(0x3c);
else{
op(0x80);
op(0xF8+reg);
}
op(value);
}
}
}
int ScanSwitch(int *numcase,ISW *caseinf,COM_MOD *startmod)
{
unsigned char dcha;
int dtok,line,oinptr,i,otok2;
//new
unsigned char *oinput;
int oendinptr;
ITOK otok;
int retcode=TRUE;
dtok=tok;
otok=itok;
otok2=tok2;
line=linenum2;
dcha=cha2;
oinptr=inptr=inptr2;
cha=cha2;
//new
oinput=input;
oendinptr=endinptr;
if(startmod!=cur_mod){
COM_MOD *pmod=cur_mod;
while(pmod->next!=startmod){
pmod=pmod->next;
}
input=pmod->input;
inptr=pmod->inptr;
endinptr=pmod->endinptr;
cha=input[inptr];
inptr++;
}
if(SkipParam()){
FastTok(0);
if(tok!=tk_openbrace){
SwTok(tk_openbrace);
retcode=FALSE;
}
else{
for(i=1;i!=0;){
FastTok(1);
if(tok==tk_question)CheckDir();
switch(tok){
case tk_eof:
unexpectedeof();
retcode=FALSE;
i=0;
break;
case tk_openbrace: i++; break;
case tk_closebrace: i--; break;
case tk_id:
case tk_case:
case tk_CASE:
if(i==1){
if(stricmp(itok.name,"case")==0){
inptr2=inptr;
cha2=cha;
linenum2=linenumber;
(caseinf+*numcase)->postcase=(itok.name[0]=='c'?FALSE:TRUE);
nexttok();
if(tok==tk_number||(tok==tk_minus&&tok2==tk_number)){
if(*numcase==MAXCASE){
preerror("Many to use <case>");
retcode=FALSE;
}
else{
unsigned long val=doconstlongmath();
for(int j=0;j<*numcase;j++){
if(val==(caseinf+j)->value){
preerror("Duplicate 'case'");
retcode=FALSE;
break;
}
}
(caseinf+*numcase)->value=val;
if(tok==tk_multipoint){
(caseinf+*numcase)->type=startmulti;
nexttok();
val=doconstlongmath();
numexpandcase+=val-(caseinf+*numcase)->value-1;
if(val<(caseinf+*numcase)->value){
preerror("The first value 'case' should be smaller");
retcode=FALSE;
}
*numcase=*numcase+1;
(caseinf+*numcase)->type=endmulti;
(caseinf+*numcase)->value=val;
(caseinf+*numcase)->postcase=(caseinf+*numcase-1)->postcase;
}
else (caseinf+*numcase)->type=singlcase;
*numcase=*numcase+1;
}
}
else{
numexpected();
retcode=FALSE;
}
inptr=inptr2;
cha=cha2;
}
}
break;
}
}
}
}
if(retcode){ //¥á«¨ ­¥ ­ ©¤¥­® ®è¨¡®ª
tok=dtok;
itok=otok;
linenum2=line;
cha2=dcha;
inptr2=oinptr;
tok2=otok2;
}
else{
inptr2=inptr;
cha2=cha;
linenum2=linenumber;
}
//new
input=oinput;
endinptr=oendinptr;
return retcode;
}
void doswitch()
{
ISW *caseinf;
int numcase=0,reg=AX,mode=0;
unsigned int endsw,defaul=0,tokr,endsw2=0;
int shortjmp=(tok==tk_switch?FALSE:TRUE);
int sline=linenumber;
REGISTERSTAT *bakregstat,*changeregstat;
char *ofsstr=NULL;
//new
COM_MOD *startmod=cur_mod;
unsigned char oinline=useinline;
#ifdef OPTVARCONST
ITOK otok;
int swvar=FALSE;
unsigned long numbervar;
int numrm;
int nonum;
#endif
useinline=0;
caseinf=(ISW *)MALLOC(sizeof(ISW)*MAXCASE); //¡«®ª ¤«ï ¨­ä® ® case
numexpandcase=0;
uptdbr(/*TRUE*/);
getoperand();
char signflag=0;
expecting(tk_openbracket);
switch(tok){
case tk_intvar:
signflag=1;
goto dint;
case tk_int:
signflag=1;
case tk_word:
getoperand();
case tk_wordvar:
case tk_reg:
dint:
tokr=r16;
break;
case tk_charvar:
signflag=1;
goto dchar;
case tk_char:
signflag=1;
case tk_byte:
getoperand();
case tk_bytevar:
case tk_beg:
dchar:
tokr=r8;
break;
case tk_long:
signflag=1;
case tk_dword:
getoperand();
goto dlong;
case tk_qword:
getoperand();
goto qword;
case tk_floatvar:
case tk_longvar: signflag=1;
case tk_dwordvar:
case tk_reg32:
dlong:
tokr=r32;
break;
case tk_doublevar: signflag=1;
case tk_qwordvar:
qword:
tokr=r64;
break;
case tk_openbracket:
nexttok();
if(tok>=tk_char&&tok<=tk_double){
tokr=typesize(tok);
switch(tok){
case tk_double:
case tk_float:
case tk_char:
case tk_int:
case tk_long:
signflag=1;
}
}
nexttok();
expectingoperand(tk_closebracket);
break;
default:
tokr=(am32+1)*2;
break;
}
#ifdef OPTVARCONST
if(tok>=tk_charvar&&tok<=tk_dwordvar&&tok2==tk_closebracket){
otok=itok;
swvar=TRUE;
}
#endif
if(ScanSwitch(&numcase,caseinf,startmod)){
int i;
unsigned int sizetab; //à §¬¥à â ¡«¨æë
unsigned long min=0xffffffff,max=0;
unsigned int size0=0,size1;
int reg0=0,svop=0;
long smin=0x7fffffff,smax=-0x7fffffff;
unsigned int size2=0;
unsigned oaddESP=addESP;
if(numcase>2){
if(!optimizespeed){
if((am32==FALSE&&tokr==r32)||(am32&&tokr==r16))size0=numcase;
else if(tokr==r8)size0=numcase*2;
if((tok==tk_beg||tok==tk_reg||tok==tk_reg32)&&tok2==tk_closebracket)
reg0=itok.number; //¯à¥¤¯®« £ ¥¬ë© ॣ¨áâà ¬¥â®¤  0
}
for(i=0;i<numcase;i++){ //à áç¥â à §¬¥à  ¯® ¬¥â®¤ã 0
if((caseinf+i)->value>max)max=(caseinf+i)->value;
if((caseinf+i)->value<min)min=(caseinf+i)->value;
if((long) (caseinf+i)->value>smax)smax=(caseinf+i)->value;
if((long) (caseinf+i)->value<smin)smin=(caseinf+i)->value;
if((!optimizespeed)&&tokr!=r8){
if((caseinf+i)->value==0)size0+=2;
else if((caseinf+i)->value<128)size0+=3;
else{
size0+=(reg0==0?3:4);
if(am32)size0+=2;
}
}
if(i!=0){
if((caseinf+i)->postcase==0)size0+=(am32==FALSE?(chip<3?5:4):6);
else size0+=2;
}
}
if((unsigned int)(smax-smin)<(max-min)){
max=smax-smin;
svop=8;
min=-smin;
}
else{
smin=min;
max-=min;
}
sizetab=max+1; //à §¬¥à â ¡«¨æë ¤«ï ¬¥â®¤  1
if(sizetab<0x1000000&&(!(am32==FALSE&&tokr==r32))){
if(optimizespeed){
if((unsigned int)(sizetab/numcase)<(unsigned int)(am32==FALSE?3:4)){
mode=1;
if(am32==FALSE)reg=BX;
/* ¥á«¨ ®â­®è¥­¨¥ ç¨á«  í«¥¬¥­â®¢ ¢ â ¡«¨æ¥ ª ç¨á«ã case ¬¥­¥¥
3 ¤«ï 16-¡¨â­®£® ०¨¬  ¨ 4 ¤«ï 32-¡¨â­®£®, â® ¡¥à¥âáï ¬¥â®¤ 1 */
}
}
else{ //¢ëç¨á«¨âì à §¬¥à ¤«ï ®¯â¨¬¨§ æ¨¨ ¯® à §¬¥àã
if(shortjmp)size0+=2;
else size0+=(am32==FALSE?(chip<3?5:4):6);
size1=sizetab*(am32==FALSE?2:4);
size1+=(max<128?3:am32==FALSE?4:6)+(shortjmp==FALSE?(chip<3?5:4):2);
if(max>127&&reg0==AX)size1--;
if(min!=0){
if(min==1)size1++;
else if(min==2&&(!optimizespeed))size1+=2;
else if(min<128)size1+=3;
else{
size1+=(am32==FALSE?4:6);
if(reg0==AX)size1--;
}
}
size1+=(am32==FALSE?6:9);
if(am32){
if(tokr!=r32)size1+=3;
if(shortjmp)size1-=2;
}
else{
if(reg0!=BX)size1+=2;
}
//¢ë¡®à ¬¥â®¤  á ¬¥­ì訬 à §¬¥à®¬
if(size1<=size0){
mode=1;
size0=size1;
if(am32==FALSE)reg=BX;
}
}
}
}
if(numcase>9&&(!optimizespeed)){
// à áç¥â ¬¥â®¤  2
size2=numcase+numexpandcase;
switch(tokr){
case r8:
if(am32)size2=size2*5;
else size2=size2*3+8;
break;
case r16:
if(am32)size2=size2*6+1;
else size2=size2*4+8;
break;
case r32:
if(am32)size2=size2*8;
else size2=size2*6+9;
break;
}
size2+=29;
//¢ë¡®à ¬¥â®¤  á ¬¥­ì訬 à §¬¥à®¬
if(size2<=size0)mode=2;
}
// printf("Num CASE %d Metod 0 size=%d. Metod 1 size=%d. Metod 2 size=%d\n",numcase,size0,size1,size2);
if(mode==2){
reg=AX;
reg0=idxregs[1];
if((!am32)||(am32&&(!((tok==tk_beg||tok==tk_reg||tok==tk_reg32)&&tok2==tk_closebracket)))){
if(tokr==r8)doalmath(signflag,&ofsstr);
else do_e_axmath(signflag,tokr,&ofsstr);
}
else{
reg=itok.number;
if(reg==reg0)reg0=idxregs[0];
nexttok();
}
ClearReg(reg);
ClearReg(reg0);
warningreg(regs[am32][reg0]);
}
else if((tok==tk_beg||tok==tk_reg||tok==tk_reg32)&&tok2==tk_closebracket){
if(reg==AX){
reg=itok.number;
if(mode&&am32)getintoreg_32(reg,r32,0,&ofsstr);
else nexttok();
ClearReg(AX);
}
else{
getintoreg_32(BX,r16,0,&ofsstr);
ClearReg(BX);
warningreg("BX");
}
}
else{
if(tokr==r8)doalmath(signflag,&ofsstr);
else do_e_axmath(signflag,tokr,&ofsstr);
if(reg!=AX){
ClearReg(BX);
if(tokr==r8)outword(0xB4); //mov ah,0
if(optimizespeed)outword(0xC389); //mov bx,ax
else op(0x93); //xchg ax,bx
}
else{
ClearReg(AX);
if(mode&&am32&&tokr!=r32){
op(0x0F);
op(tokr==r8?0xB6:0xB7);
op(0xC0);
}
}
}
nextexpecting2(tk_openbrace); //¯à®¢ ­  ®âªà ᪮¡ªã
if(numcase){
if(mode==1){ //¯¥à¢ë© ¬¥â®¤
if(min!=0){
if(min==1)op(0x48+reg-svop); //dec reg
else if(min==2&&(!optimizespeed)){
op(0x48+reg-svop); //dec reg
op(0x48+reg-svop); //dec reg
}
else if(min<128){
op(0x83);
op(0xE8+reg-svop*5);
op(min);
}
else{
if(reg==AX)op(0x2D-svop*5);
else{
op(0x81);
op(0xE8+reg-svop*5);
}
if(am32)outdword(min);
else outword(min);
}
if(am32)warningreg(regs[1][reg]);
}
if(max<128){
op(0x83); //cmp reg,max
op(0xF8+reg);
op(max);
}
else{
if(reg==AX)op(0x3D);
else{
op(0x81);
op(0xF8+reg);
}
if(am32)outdword(max);
else outword(max);
}
if(shortjmp==FALSE){
if(chip<3){
outword(0x376); //jbe 3
op(0xE9); //jmp to default
}
else outword(0x870F); //ja default
outword(0);
if(am32)outword(0);
}
else{
op(0x77);
op(0);
}
endsw=outptr; // ¤à¥á ª®­æ  switch ¨«¨ default
if(am32){
outword(0x24FF);
op(0x85+reg*8);
}
else outdword(0xA7FFDB01); //add bx,bx jmp [bx+table]
AddReloc(CS);
size1=outptr;
outword(0);
if(am32)outword(0);
}
else if(mode==0){
svop=numcase;
for(;numcase>0;){ //¢¥â¢«¥­¨¥
numcase--;
CmpRegNum(tokr,(caseinf+numcase)->value,reg);
if((caseinf+numcase)->type==singlcase){
if(numcase){
if((caseinf+numcase)->postcase==FALSE){
if(chip<3){
outword(0x375); //jnz 3
op(0xE9); //jmp to default
}
else outword(0x840F); //jz default
outword(0);
if(am32)outword(0);
}
else outword(0x74);
(caseinf+numcase)->postcase=outptr;
}
else{
if(shortjmp==FALSE){
if(chip<3){
outword(0x374); //jnz 3
op(0xE9); //jmp to default
}
else outword(0x850F); //jz default
outword(0);
if(am32)outword(0);
}
else outword(0x75);
endsw=outptr; // ¤à¥á ª®­æ  switch ¨«¨ default
}
}
else{ //case 1...5
numcase--;
max=(caseinf+numcase)->value;
if(numcase!=0){
if((caseinf+numcase+1)->postcase==FALSE){
if(max==0){
if(chip>2){
outdword(0x860F);
if(am32)outword(0);
}
else{
outword(am32==FALSE?0x0377:0x577);
jumploc0();
}
}
else{
outword(0x77);
endsw=outptr;
CmpRegNum(tokr,max,reg);
if(chip>2){
outdword(0x830F);
if(am32)outword(0);
}
else{
outword(am32==FALSE?0x0372:0x572);
jumploc0();
}
output[endsw-1]=(unsigned char)(outptr-endsw);
}
}
else{
if(max==0)outword(0x76);
else{
outword(0x77);
endsw=outptr;
CmpRegNum(tokr,max,reg);
outword(0x73);
output[endsw-1]=(unsigned char)(outptr-endsw);
}
}
(caseinf+numcase)->postcase=outptr;
}
else{
if(shortjmp==FALSE){
if((optimizespeed&&chip>2)||(chip>2&&max==0)){
outdword(0x870F);
if(am32)outword(0);
if(max!=0){
endsw2=outptr;
CmpRegNum(tokr,max,reg);
outdword(0x820F);
if(am32)outword(0);
}
}
else{
if(max==0) outword(am32==FALSE?0x0376:0x576);
else{
outword(0x77);
endsw=outptr-1;
CmpRegNum(tokr,max,reg);
outword(am32==FALSE?0x0373:0x573);
output[endsw]=(unsigned char)(outptr-endsw-1);
}
jumploc0();
}
}
else{
outword(0x77);
if(max!=0){
endsw2=outptr;
CmpRegNum(tokr,max,reg);
outword(0x72);
}
}
endsw=outptr; // ¤à¥á ª®­æ  switch ¨«¨ default
}
}
}
}
else if(mode==2){
if(!am32){
outdword(0x071E0651); //push cx,es,ds pop es
op(0xB9); //mov CX,numcase
outword(numcase+numexpandcase);
op(0xBF); //mov DI,tableval
AddReloc(CS);
size2=outptr;
outword(0);
op(0xF2); //repnz
switch(tokr){
case r8: op(0xAE); break;
case r32: op(0x66);
case r16: op(0xAF); break;
}
outword(0x7407); //pop es ,jz
op(shortjmp==FALSE?4:3);
op(0x59); //pop cx
if(shortjmp==FALSE)jumploc0();
else outword(0xEB);
endsw=outptr; // ¤à¥á ª®­æ  switch ¨«¨ default
op(0xBF); //mov DI,numcase
outword(numcase+numexpandcase);
outdword(0x014FCF29); //sub di,cx dec di add di,di
op(0xFF);
outword(0xC781); //add di,tableadr
AddReloc(CS);
size1=outptr;
outword(0);
op(0x59); //pop cx
outword(0x25FF); //jmp [di]
}
else{
op(0x31);
op(0xC0+reg0*9); //xor reg0,reg0
switch(tokr){ //cmp [reg0*size+tableadr],reg
case r8: op(0x38); op(0x4+reg*8); op(5+reg0*8); break;
case r32: op(0x39); op(0x4+reg*8); op(0x85+reg0*8); break;
case r16: op(0x66); op(0x39); op(0x4+reg*8); op(0x45+reg0*8); break;
}
AddReloc(CS);
size2=outptr;
outdword(0);
outword(0x0775); //jne
outword(0x24FF); //jmp [reg0*4+tableadr]
op(0x85+reg0*8);
AddReloc(CS);
size1=outptr;
outdword(0);
op(0x40+reg0); //inc reg0
if((numcase+numexpandcase)>127){ //cmp reg0,numcase
op(0x81);
op(0xF8+reg0);
outdword(numcase+numexpandcase);
}
else{
op(0x83);
op(0xF8+reg0);
op(numcase+numexpandcase);
}
op(0x72);
if((numcase+numexpandcase)>127)op(tokr==r16?0xE6:0xE7);
else op(tokr==r16?0xE9:0xEA);
if(shortjmp==FALSE)jumploc0();
else outword(0xEB);
endsw=outptr; // ¤à¥á ª®­æ  switch ¨«¨ default
}
}
}
numcase=0;
useinline=oinline;
bakregstat=BakRegStat();
changeregstat=BakRegStat();
lastcommand=tk_switch;
do{
if(tok==tk_case||tok==tk_CASE||tok==tk_default){ //¥á«¨ case - § ¯®¬­¨âì ¯®§¨æ¨î ¨ ¢¥«¨ç¨­ã
RestoreStack();
CompareRegStat(changeregstat);
switch(lastcommand){
case tk_goto:
case tk_GOTO:
case tk_break:
case tk_BREAK:
case tk_return:
case tk_RETURN:
case tk_switch:
CopyRegStat(bakregstat);
#ifdef OPTVARCONST
nonum=FALSE;
#endif
addESP=oaddESP;
break;
default:
CopyRegStat(changeregstat);
#ifdef OPTVARCONST
nonum=TRUE;
#endif
if(ESPloc&&am32&&oaddESP!=addESP)warESP();
break;
}
if(tok==tk_default){ //⮦¥ ¤«ï default
if(mode==0&&svop){
if(numcase==0)jumploc0(); //default á ¬ë© ¯¥à¢ë©
CheckJmpSW(sline,endsw,outptr,shortjmp,mesSWITCH);
if(endsw2)CheckJmpSW(sline,endsw2,outptr,shortjmp,mesSWITCH);
}
if(defaul)preerror("Duplicate 'default'");
defaul=outptr;
nexttok();
expecting(tk_colon); //¯à®¢ ­  : ¨ ç⥭¨¥ á«¥¤ãîé tok
continue;
}
if(mode==0){
if(numcase==0&&defaul){ //default á ¬ë© ¯¥à¢ë©
if(am32==FALSE)*(unsigned short *)&output[defaul-2]=(unsigned short)(outptr-defaul);
else *(unsigned long *)&output[defaul-4]=(unsigned long)(outptr-defaul);
}
else if(numcase)CheckJmpSW(linenumber,(caseinf+numcase)->postcase,outptr,tok==tk_case?FALSE:TRUE,mesCASE);
}
else (caseinf+numcase)->postcase=outptr;
lastcommand=tok; //new 12.12.07 14:27
nexttok();
#ifdef OPTVARCONST
numrm=itok.rm;
numbervar=doconstlongmath();
(caseinf+numcase)->value=numbervar-(mode==1?smin:0);
#else
(caseinf+numcase)->value=doconstlongmath()-(mode==1?smin:0);
#endif
numcase++;
if(tok==tk_multipoint){
nexttok();
(caseinf+numcase)->value=doconstlongmath()-(mode==1?smin:0);
numcase++;
}
#ifdef OPTVARCONST
else if(swvar&&nonum==FALSE)Const2Var(&otok,numbervar,numrm);
#endif
expecting(tk_colon); //¯à®¢ ­  : ¨ ç⥭¨¥ á«¥¤ãîé tok
if(tok==tk_closebrace)numcase--;
continue;//goto checkcase;
}
startblock();
docommand();
endblock();
}while(tok!=tk_closebrace);
RestoreStack();
if(numberbreak==0){
switch(lastcommand){
case tk_break:
posts--;
outptr-=(am32==FALSE?3:5);
break;
case tk_BREAK:
posts--;
outptr-=2;
break;
}
}
if(defaul&&outptr<defaul){
if(mode==0&&svop){
if(numcase==0)jumploc0(); //default á ¬ë© ¯¥à¢ë©
CheckJmpSW(sline,endsw,outptr,shortjmp,mesSWITCH);
if(endsw2)CheckJmpSW(sline,endsw2,outptr,shortjmp,mesSWITCH);
}
defaul=outptr;
}
// printf("outptr=%08X defaul=%08X\n",outptr,defaul);
CompareRegStat(changeregstat);
FreeStat(bakregstat);
CopyRegStat(changeregstat);
FreeStat(changeregstat);
if(numcase){
if(mode==0){
if(defaul==0){
CheckJmpSW(sline,endsw,outptr,shortjmp,mesSWITCH);
if(endsw2)CheckJmpSW(sline,endsw2,outptr,shortjmp,mesSWITCH);
}
free(caseinf);
}
else{
if(defaul==0||defaul>outptr)defaul=outptr;
CheckJmpSW(sline,endsw,defaul,shortjmp,mesSWITCH);
caseinf=(ISW *)REALLOC(caseinf,sizeof(ISW)*numcase);
if(!numswtable)swtables=(FSWI *)MALLOC(sizeof(FSWI));
else swtables=(FSWI *)REALLOC(swtables,sizeof(FSWI)*(numswtable+1));
FSWI *swt=swtables+numswtable;
swt->info=caseinf;
swt->sizetab=(mode==2?numcase:sizetab)+numexpandcase;
swt->type=(am32==FALSE?2:4);
swt->numcase=numcase;
swt->defal=defaul;
swt->ptb=size1;
swt->ptv=size2;
swt->mode=mode;
swt->razr=tokr;
numswtable++;
}
}
else free(caseinf);
SetBreakLabel();
SetContinueLabel();
}
nexttok();
lastcommand=tk_switch;
retproc=FALSE;
}

View File

@ -0,0 +1,32 @@
/* some defines for extracting instruction bit fields from bytes */
#define MOD(a) (((a)>>6)&3)
#define REG(a) (((a)>>3)&7)
#define RM(a) ((a)&7)
#define SCALE(a) (((a)>>6)&3)
#define INDEX(a) (((a)>>3)&7)
#define BASE(a) ((a)&7)
typedef union{
struct{
unsigned short ofs;
unsigned short seg;
}w;
unsigned long dword;
}WORD32;
/* prototypes */
void ua_str(char *);
unsigned char getbyte(void);
int modrm();
int sib();
void uprintf(char *, ...);
void uputchar(char );
int bytes(char );
void outhex(char , int , int , int , int );
void reg_name(int , char );
void do_sib(int );
void do_modrm(char );
void floating_point(int );
void percent(char , char );
void undata(unsigned ofs,unsigned long len,unsigned int type);

793
programs/develop/cmm/tok.h Normal file
View File

@ -0,0 +1,793 @@
//void PrintMem(void *mem);
//void CheckMem();
#include "port.h"
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
//#define DEBUGMODE
#define OPTVARCONST // Çàìåíà ïåðåìåííûõ ñîíñòàíòàìè
#define MAXNUMPATH 16
#define DATATYPES 9 // number of data types
#define MAXDATA 65500 /* output run file buffer 65500 bytes */
#define DYNAMIC_USED 0
#define DYNAMIC 1
#define NOT_DYNAMIC 2 /* flag value specifing a non-dynamic proc */
#define DYNAMIC_SET 3
#define FILENAMESIZE 80
#define SHORTMAX 127 // largest 8 bit signed value
#define SHORTMIN -128 // smallest 8 bit signed value
#define IDLENGTH 65 /* length of significance of IDS + NULL, therefore 32 */
#define STRLEN 2048 /* length of string token holder */
#define MAXPOSTS 2048
#define SIZEBUF 16384
#define ID2S 6*DATATYPES
#define MAXSYSCOM 25
#define NUMNUM 32
#define NUMNUM64 64
#define OBJECTALIGN 4096 //âûðàâíèâàíèå ñåêöèé â ïàìÿòè
#define WARNCOUNT 15 //÷èñëî ðàçëè÷íûõ ïðåäóïðåæäåíèé
#define ver1 0
#define ver2 239
#define BETTA
#ifdef BETTA
#define betta " b26"
#else
#define betta ""
#endif
#include "const.h"
#include "struct.h"
#ifdef _UNIX_
#ifndef stricmp
#define stricmp strcasecmp
#endif
#endif
#ifdef _UNIX_
#ifndef O_BINARY
#define O_BINARY 0
#endif
#endif
extern unsigned char FixUpTable; //çàïðåòèòü ñîçäàíèå òàáëèöè Fix UP for Windows
extern unsigned char WinMonoBlock;
extern unsigned int currentfileinfo;
#if !defined (_MAIN_)
extern char fobj; //ïðèçíàê ãåíåðàöèè obj
extern char *rawfilename;
extern struct tm timeptr;
extern char outext[];
extern unsigned char compilerstr[]; /* compiler ID string */
extern LISTCOM *listcom;
extern unsigned char gwarning;
extern EWAR wartype,errfile;
extern int numfindpath;
extern char *findpath[];
extern char bufpath[];
extern unsigned int startptr;
extern unsigned char wconsole;//ïðèçíàê ãåíåðàöèè êîíñîëüíîãî ïðèëîæåíèÿ windows
extern unsigned long ImageBase;
extern int numexport;
extern struct listexport *lexport;
extern unsigned char optstr; //îïòèìèçàöèÿ ñòðîêîâûõ êîíñòàíò
extern unsigned char crif; //check reply include file
extern unsigned char idasm; //àññåìáëåðíûå èíñòðóêöèè ñ÷èòàòü èäåíòèôèêàòîðàìè
extern char modelmem;
extern char *stubfile;
extern char comsymbios;
extern unsigned char sobj;
extern short dllflag;
extern char *bufstr; //áóôåð äëÿ ñòðîê èç ïðîöåäóð
extern int sbufstr; //íà÷àëüíûé ðàçìåð ýòîãî áóôåðà
extern unsigned char wbss; //ïîñò ïåðåìåííûå â îòäåëüíóþ ñåêöèþ
extern int numrel; //÷èñëî ýëåìåíòîâ â òàáëèöå ïåðåìåùåíèé
extern unsigned char usestub;
extern char *winstub;
extern unsigned char dpmistub;
extern unsigned char useordinal;
extern int startupfile;
extern int alignproc,aligncycle;
extern FILE *hout;
extern unsigned char useDOS4GW;
extern unsigned char use_env; //ïåðåìåííàÿ îêðóæåíèÿ
extern unsigned char clearpost;
extern unsigned char uselea;
extern unsigned char regoverstack;
extern unsigned char shortimport;
extern char *namestartupfile;
extern unsigned char useinline;
extern unsigned char ocoff;
extern unsigned char ESPloc;
#endif
extern unsigned char string[STRLEN],string2[STRLEN+20];
#if !defined (_TOKC_)
extern unsigned int outptrsize; //ðàçìåð âûõîäíîãî áóôåðà
extern unsigned char string3[STRLEN];
extern char *BackTextBlock; //áóôåð äëÿ ïåðåíåñåííîãî òåêñòà
extern int SizeBackBuf;
extern unsigned char cha;
extern unsigned int inptr;
extern unsigned char AlignProc;
extern unsigned int secondcallnum; //# of different second calls and labels
extern unsigned char header;
extern unsigned char killctrlc;
extern unsigned char optimizespeed;
extern unsigned char alignword;
extern unsigned int outptr,outptrdata;
extern unsigned char comfile;
extern unsigned char chip;
extern unsigned char dos1,dos2;
extern unsigned int stacksize;
extern int error;
extern unsigned char *output,*outputdata;
extern unsigned char notdoneprestuff;
extern unsigned long postsize;
extern unsigned int posts;
extern postinfo *postbuf;
extern int maxposts;
extern unsigned char cpu;
extern long runfilesize;
extern unsigned char *input; /* dynamic input buffer */
extern unsigned int endinptr; /* end index of input array */
extern unsigned int localsize,paramsize;
extern char endoffile;
extern unsigned int current_proc_type; /* current procedure type */
extern unsigned char aligner;
extern unsigned int alignersize;
extern unsigned int datasize;
extern unsigned char warning;
extern unsigned int startStartup;
extern unsigned char useStartup;
extern unsigned int endStartup;
extern unsigned char notpost;
extern unsigned char am32; // ðåæèì 32 áèòíîé àäðåñàöèè
extern unsigned int externnum;
extern unsigned char FastCallApi; //ðàçðåøèòü áûñòðûé âûçîâ API ïðîöåäóð
extern unsigned char FixUp; //Äåëàòü ëè òàáëèöó ïåðåìåùåíèé
extern void *liststring; //öåïî÷êà èíôîðìàöèîííûõ áëîêîâ î ñòðîêàõ
extern struct FILEINFO *startfileinfo;
extern unsigned int totalmodule;
extern int retproc;
extern unsigned char splitdata; //îòäåëèòü äàííûå îò êîäà
extern unsigned char AlignCycle; //âûðàâíèâàòü íà÷àëà öèêëîâ
extern char param[]; //áóôåð äëÿ ïàðàìåòðîâ ïðîöåäóðû
extern unsigned char dynamic_flag; //ôëàã îáðàáîòêè äèíàìè÷åñêèõ ýëåìåíòîâ
extern unsigned char setzeroflag; //îïåðàöèÿ ìåíÿåò zero flag
extern unsigned char insertmode;
extern unsigned int numblocks; //íîìåð âëîæåííîãî áëîêà
extern unsigned char notunreach;
extern idrec *staticlist;
extern unsigned int procedure_start; /* address of start of procedure */
extern int lastcommand; //ïîñëåäíèé îïåðàòîð â áëîêå
extern unsigned int initBP;
extern unsigned char fstatic;
//extern int sizestack; //ðàçìåð íå êîìïåíñèðîâàííûõ ïàðàìåòðîâ ôóíêöèé
extern unsigned char addstack;
extern unsigned long addESP; //äîáàâêà ñòåêà
extern unsigned char blockproc; //èäåòðàçáîðêà áëîêà ôóíêöèè
extern treelocalrec *tlr; //öåïî÷êà ëîêàëüíûõ áëîêîâ
extern treelocalrec *btlr; //öåïî÷êà èñïîëüçîâàíûõ ëîêàëüíûõ áëîêîâ
extern int returntype; /* return type, (void, byte, word, ...) */
#endif
extern int tok,tok2;
#if !defined (_TOKR_)
extern char useasm;
extern short ofsmnem[];
extern unsigned char asmMnem[];
extern char asmparam;
#endif
#if !defined (_TOKA_)
extern unsigned char id[];
extern short idofs[];
extern char id2[ID2S][9];
extern char regs[2][8][4];
extern char begs[8][3];
extern char segs[8][3];
extern struct idrec *treestart;
extern unsigned int linenum2;
extern unsigned int inptr2;
extern unsigned char cha2;
extern char displaytokerrors;
extern char *bufrm;
extern UNDEFOFF *undefoffstart;
extern DLLLIST *listdll;
extern char skipfind;
extern struct structteg *tegtree; //ãëîáàëüíûé ñðèñîê òåãîâ
extern struct structteg *ltegtree; //ëîêàëüíûé ñðèñîê òåãîâ
//extern struct idrec *lstructlist; //ñïèñîê ëîêàëüíûõ ñòðóêòóð
extern struct idrec *definestart;
extern SINFO strinf;
extern char *startline, *endinput;
extern ITOK structadr;
extern int scanlexmode;
extern COM_MOD *cur_mod;
extern unsigned char bytesize;
#endif
#if !defined (_TOKE_)
extern int maxerrors;
extern char mesmain[];
extern int endifcount;
extern int sysstack;
extern int sysnumcom;
extern int syscom;
extern unsigned char fargc;
extern unsigned char jumptomain;
extern unsigned int startptrdata;
extern unsigned char parsecommandline;
extern unsigned int romsize;
extern unsigned char resizemem;
extern unsigned int resizesizeaddress;
extern unsigned int stackstartaddress;
extern int dataromstart,dataromsize;
extern unsigned char startuptomain;
extern unsigned char dosstring;
extern unsigned int numdomain; //÷èñëî ïðîöåäóð çàïóñêàåìûõ äî main
extern char *domain; //áóôåð èìåí ïðîöåäóð çàïóñêàåìûõ äî main
extern unsigned char usedirectiv; //èäåò îáðàáîòêà äèðåêòèâû
extern unsigned char atex;
extern unsigned int postnumflag; //ôëàã ïîñëåäíåãî èäåíòèôèêàòîðà â âû÷èñëåíèè íîìåðà
extern unsigned char sdp_mode; //ðåæèì ïðèíóäèòåëüíîé âûãðóçêè äèíàìè÷åñêèõ ïðîöåäóð
extern int calcnumber;
extern int strpackdef;
extern int strpackcur;
#ifdef DEBUGMODE
extern int debug;
#endif
extern int dirmode;
#endif
extern ITOK itok,itok2,ptok;
#if !defined (_TOKB_)
extern int divexpand;
extern int optnumber;
extern char *badadr;
extern LISTFLOAT *floatnum; //ñïèñîê float êîíñòàíò
extern unsigned int numfloatconst;
extern unsigned int ofsfloatlist;
#endif
extern unsigned int linenumber;
#if !defined (_DEBUG_)
extern unsigned int ooutptr;
extern unsigned int outputcodestart;
extern unsigned char dbg,dbgact;
extern unsigned int pdbg; // number of post entrys
#endif
#if !defined (_OUTPE_)
extern unsigned long ImageBase;
extern unsigned long vsizeheader; //âèðòóàëüíûé ðàçìåð çàãîëîâêà.
extern int filingzerope;
extern unsigned long FILEALIGN; // âûðàâíèâàíèå ñåêöèé â ôàéëå
#endif
#if !defined (_ERRORS_)
extern WARNACT wact[];
extern unsigned char mapfile;
#endif
#if !defined (_DISASM_)
extern unsigned char seg_size; /* default size is 16 */
extern unsigned long instruction_offset;
#endif
#if !defined (_SWITCH_)
extern FSWI *swtables;
extern int numswtable;
#endif
#if !defined (_CLASS_)
extern structteg *searchteg;
extern int destructor;
#endif
#if !defined (_RES_)
extern unsigned char *resbuf;
extern unsigned int curposbuf;
extern int numres; //òåêóùåå ÷èñëî ðåñóðñîâ
extern int numstrtbl;
#endif
extern unsigned char idxregs[5];
// start of procedure pre-definitions
/*-----------------19.09.98 17:18-------------------
Ôóíêöèè îïðåäåëåííûå â main.cpp
--------------------------------------------------*/
void *MALLOC(unsigned long size);
void *REALLOC(void *block,unsigned long size);
void IncludePath(char *buf);
int SelectComand(char *pptr,int *count);
void strbtrim(char *st);
unsigned long Align(unsigned long size,unsigned long val);
int AlignCD(char segm,int val); //âûðàâíÿòü äàííûå èëè êîä
void ErrOpenFile(char *str);
unsigned int EntryPoint();
long CopyFile(FILE *in,FILE *out);
unsigned long getnumber(unsigned char *buf);
void addinitvar();
FILE *CreateOutPut(char *ext,char *mode);
void SetLST(unsigned char neg);
void AddUndefClassProc();
int MakeCoff();
void setdindata(idrec *ptr,int i);
/*-----------------08.03.98 20:10-------------------
Ôóíêöèè îïðåäåëåíûå â toka.c
--------------------------------------------------*/
void CheckAllMassiv(char *&buf,int sizeel,SINFO *strc,ITOK *ctok=&itok,int reg1=idxregs[0],int reg2=idxregs[1]);
void docalls(); //attempt to declare undefs from library and dynamic proc's
int FindOff(unsigned char *name,int base);
void nextchar(); //îïð â toke
void nexttok();
void whitespace(); //ïðîïóñê íçíà÷àùèõ ñèìâîëîâ
int searchtree(ITOK *itk4,int *tk4,unsigned char *strin4);
void AddUndefOff(int segm,char *ostring);
void InitStruct(); //èíèöèàëèçèðîâàòü ñòðóêòóðó
unsigned long LocalStruct(int flag,int *localline); //èíèöèàëèçèðîâàòü ëîêàëüíóþ ñòðóêòóðó
struct structteg * FindTeg(int Global,char *name=itok.name); //íàéòè òåã
void dostruct();
int FastSearch(unsigned char *list,short *ofs,int type,char *str);
void FindDirectiv();
unsigned long long scannumber(int *rm);
void FastTok(int mode,int *tok4=&tok,ITOK *itok4=&itok);
unsigned int initstructvar(structteg *tteg,int numel);
unsigned int ScanTok3();
int GetVarSize(int var);
void compressoffset(ITOK *thetok);
void AddDynamicList(idrec *ptr);
int CheckUseAsUndef(unsigned char *name);
int CheckMassiv(char *&buf,int sizeel,int treg,int *idx=0,int *base=0,long *num=0);
void AutoDestructor();
void dodelete();
void donew();
void RunNew(int size);
int CallDestructor(structteg *searcht);
int FindUseName(char *name); //ïîèñê ññûëîê íà òåêóùåå èìÿ
void DateToStr(char *buf);
int CalcRm16(int base,int idx);
int CheckDef();
void SetNewStr(char *name);
struct structteg *CreatTeg(int Global,int useunion=FALSE,int noname=FALSE);
void InitStruct2(unsigned int flag,structteg *tteg);
unsigned long LocalStruct2(int flag,int *localline,int binptr,char bcha,structteg *tteg);
void retoldscanmode(int mode);
void ExpandRm(int rm,int sib,int *zoom,int *base,int *idx);
void BackMod();
/*-----------------08.03.98 21:45-------------------
Ôóíêöèè îïðåäåëåíûå â tokb.h
--------------------------------------------------*/
void AddReloc(int segm=itok.segm);
int doalmath(int sign,char **ofsstr);
int do_e_axmath(int sign,int razr,char **ofsstr);
void getintoal(int gtok,ITOK *gstok,char *&gbuf,SINFO *gstr); /* AH may also be changed */
void getinto_e_ax(int sign,int gtok,ITOK *gstok,char *&gbuf,SINFO *gstr,int razr,int useAX=FALSE);
int doeaxfloatmath(int itreturn=tk_reg32,int reg=AX,int addop=0);
int dobytevar(int sign,int terminater=tk_semicolon); // byte, char
int do_d_wordvar(int sign,int razr,int terminater=tk_semicolon); /* signed or unsigned 16 bit memory variable */
int doreg_32(int reg,int razr,int terminater=tk_semicolon);
void doseg(int seg);
int caselong(unsigned long val);
int dobeg(int beg,int terminater=tk_semicolon);
void dobegmath(int beg); /* math done is on all begs except AL */
void doregmath_32(int reg,int razr,int sign,char **ofsstr,int i=0); /* math done is on all regs except AX */
int getintobeg(int beg,char **ofsstr);
int getintoreg_32(int reg,int razr,int sign,char **ofsstr,int useloop=TRUE); /* get into word reg (except AX) with enum */
void outaddress(ITOK *outtok);
void FloatToNumer(int addop=0);
int dofloatvar(int addop=0,int retrez=tk_floatvar,int terminater=tk_semicolon);
void fwait3();
void AddFloatConst(long long fnumber,int type=tk_float);
void setwordpost(ITOK *); /* for post word num setting */
void setwordext(long *id);
void RegMulNum(int reg,unsigned long num,int razr,int sign,int *expand,int flag);
int OnlyNumber(int sign);
void PopSeg(int seg);
void PushSeg(int seg);
void MovRegNum(int razr,int relocf,unsigned long number,int reg);
int CheckMinusNum();
int getintoreg(int reg,int razr,int sign,char **ofsstr);
void dobits();
void bits2reg(int reg,int razr);
void getoperand(int reg=BX);
int optnumadd(unsigned long num,int reg,int razr,int vop);
int MultiAssign(int razr,int usereg,int npointr=0);
void CheckInitBP();
void RestoreBP();
void fistp_stack(int addop=0);
void fld_stack(int size);
void fildq_stack();
void cpointr(int reg,int numpointr);
int doqwordvar(int terminater=tk_semicolon); //64 bit memory variable
void doreg64(int reg,int terminater=tk_semicolon);
void doregmath64(int reg);
void getintoreg64(int reg);
void float2stack(int num);
void dofloatstack(int num);
/*-----------------08.03.98 20:59-------------------
Ôóíêöèè îïðåäåëåíûå â tokc.c
--------------------------------------------------*/
localrec * addlocalvar(char *str,int tok,unsigned int num,int addmain=FALSE);
int addpoststring(int segm=CS,int len=itok.number, int term=itok.flag); /* add a string to the post queue */
void define_locallabel();
unsigned int dofrom();
unsigned int doextract();
int doparams(); /* do stack procedure parameter pushing */
int swapparam();
long updatetree();
void addacall(unsigned int idnum,unsigned char callkind);
idrec * addtotree(char *keystring);
void compilefile(char *filename,int firstflag);
void convert_returnvalue(int expectedreturn,int actualreturn);
int doid (char uppercase,int expectedreturn);
void insert_dynamic(int insert=FALSE);
int macros(int expectedreturn);
void op(int byte);
void opd(int byte); //âûâîä áàéòà â ñåãìåíò äàííûõ
void op66(int ctoc);
int op67(int ctok);
void outqwordd (unsigned long long);
void outqword (unsigned long long);
void outdwordd (unsigned long);
void outdword (unsigned long);
void outwordd (unsigned int);
void outword (unsigned int);
void outseg(ITOK *outtok,unsigned int locadd);
int procdo(int expectedreturn);
int updatecall(unsigned int which,unsigned int where,unsigned int top);
void AddBackBuf(int,char);
void CharToBackBuf(char c);
void missingpar(char *name="");
int CheckCodeSize();
void CheckPosts();
int doanyundefproc(int jumpsend=FALSE);
int doanyproc(int jumpsend=FALSE);
void killpost(unsigned int poz);
char *BackString(char *str);
DLLLIST *FindDLL();
long initglobalvar(int type,long elements,long ssize,char typev);
int typesize(int vartype);
void dopoststrings();
char *dynamic_var();
void uptdbr(/*int usesw=FALSE*/);
void docommand(); /* do a single command */
//int CheckStopBlock();
void MakeBreak(unsigned char typeb);
void SetBreakLabel();
void SetContinueLabel();
void CheckDir();
int SkipParam();
long GetBitMask(int ofs,int size);
void AddPostData(unsigned int loop);
//void NotPostUnion();
unsigned int initparamproc();
void CorrectStack(unsigned int num);
int testInitVar(int checkaldef=TRUE);
void declareparamreg();
void declareparamstack(); /* declare procedure parameters */
void declareparams(); /* declare procedure parameters */
void declarelocals(int mode,int finline=FALSE); /* declare locals */
void doblock2();
void doblock();
void setreturn();
int CidOrID();
void dynamic_proc();
void setproc(int defflag);
void define_procedure();
void doregparams();
int CheckDeclareProc();
int loadfile(char *filename,int firstflag);
void RestoreStack();
void IsUses(idrec *rec);
int SkipBlock();
void declareanonim();
void declareunion();
void startblock();
void endblock();
void LLabel();
void AddApiToPost(unsigned int num);
/*-----------------08.03.98 20:06-------------------
ôóíêöèè îïðåäåëåíû â toke.c
--------------------------------------------------*/
void jumperror(unsigned int line,char *type);
void beep(); /* beep for any internal errors */
void codeexpected();
void datatype_expected(int type=0);
unsigned long doconstdwordmath();
signed long doconstlongmath();
long doconstfloatmath();
void dwordvalexpected();
void idalreadydefined();
void illegalfloat();
void internalerror (char *str);// serious internal compiler error message
void maxoutputerror();
void maxwordpostserror();
void nextseminext();
void numexpected(int type=0);
void operatorexpected();
void seminext();
void shortjumptoolarge();
void stringexpected();
void swaperror();
void SwTok(int want);
void unabletoopen(char *str);
void unexpectedeof();
void unknowncompop();
void valueexpected();
void varexpected(int type);
void wordvalexpected();
int includeit(int type);
int includeproc();
int CheckMacros();
void tobigpost();
void expected (char ch);
int expecting(int want);
void outprocedure(unsigned char *array,unsigned int length);
void preerror(char *str);//error on currentline with line number and file name
void thisundefined(char *str,int next=TRUE);
void addconsttotree(char *keystring,long long constvalue,int type=tk_dword);
void directive();
void doenum();
void doprestuff(); //do initial code things, like resize mem, jump to main...
void searchvar(char *name,int err=1);
void expectingoperand(int want);
void InitDefineConst();
unsigned long long doconstqwordmath();
long long doconstdoublemath();
int calclongnumber(long *retnum,long number,int operand);
int calcqwordnumber(unsigned long long *retnum,unsigned long long number,int operand);
int calcdwordnumber(unsigned long *retnum,unsigned long number,int operand);
int calcfloatnumber(float *retnum,float number,int operand);
int calcdoublenumber(double *retnum,double number,int operand);
/*-----------------08.03.98 22:24-------------------
Ôóíêöèè îïðåäåëåíûå â tokr.c
--------------------------------------------------*/
void doasm(int next=FALSE);
int short_ok(long thenumber,int reg32=FALSE);
void callloc(long loc); /* produce CALL # */
void callloc0();
void cbw(void);
int GOTO();
void expecting2(int want);
unsigned char gotol(int faradd);
void jumploc(long loc); /* produce JUMP # */
void jumploc0();
void movsb(void);
void movsd(void);
void movsw(void);
void popes(); /* produce POP ES */
void pushds(); /* produce PUSH DS */
void pushss();
void ret(); /* produce RET */
void retf(); /* produce RETF */
void stosb(void);
void stosd(void);
void stosw(void);
void fwait();
void xorAHAH(void); /* produce XOR AH,AH */
void xorAXAX(void); /* produce XOR AX,AX */
void xorEAXEAX(void); /* produce XOR EAX,EAX */
void nextexpecting2(int want);
void tobedefined(int callkind,int expectedreturn);
void cwdq(int razr);
void Leave();
void CheckIP();
int iTest(int mode=0);
void ZeroReg(int reg, int razr);
int Push(ITOK *wtok=NULL);
/*-----------------08.08.00 22:50-------------------
errors.cpp
--------------------------------------------------*/
void warningstring();
void warningexpand();
void warningjmp(char *str2,int line=linenumber,int file=currentfileinfo);
void warningreg(char *str2);
void preerror3(char *str,unsigned int line,unsigned int file=currentfileinfo);// error message at a different than current line
void unableopenfile(char *name);
void tegnotfound();
void errstruct();
void warningdefined(char *);
void extraparam(char *name="");
void warningretsign();
void ErrWrite();
void ErrReadStub();
void warningnotused(char *name,int type);
void regBXDISIBPexpected();
void reg32expected(int type=0);
void InvOperComp();
void warningusenotintvar(char *name);
void warningdestroyflags();
void warningunreach();
void unuseableinput();
void redeclare(char *name);
void undefclass(char *name);
void badinfile(char *name);
void errorreadingfile(char *name);
void expectederror(char *str);
void unknowntype();
void unknownstruct (char *name,char *sname);
void unknowntagstruct (char *name);
void warninline();
void ZeroMassiv();
void bytevalexpected(int type);
void FindStopTok();
//void not_union_static();
extern void edpip(int num=0);
void waralreadinit(char *reg);
void waralreadinitreg(char *reg,char *reg2);
void OnlyComFile();
void warnsize();
void destrdestreg();
void qwordvalexpected();
void fpustdestroed();
void unknownobj(char *name);
void FindEndLex();
void fpu0expected();
void unknownpragma(char *name);
void warpragmapackpop();
void SkipBlock2();
void warreplasevar(char *name);
void warcompneqconst();
void warcompeqconst();
void warpointerstruct();
void warESP();
void waralreadinitvar(char *name,unsigned int num);
void warningprint(char *str,unsigned int line,unsigned int file);
void notexternfun();
void AddDataLine(char ssize/*,char typev*/);
void mapfun(int);
/*-----------------24.01.01 01:42-------------------
disasm.cpp
--------------------------------------------------*/
void undata(unsigned ofs,unsigned long len,unsigned int type);
void unassemble(unsigned long ofs);
/*-----------------25.01.01 23:02-------------------
debug.cpp
--------------------------------------------------*/
void AddLine(int SkipLine=FALSE);
void DoTDS();
void InitDbg();
void KillLastLine();
void AddDataNullLine(char ssize/* new!!! */,char *name=NULL);
void AddCodeNullLine(char *name=NULL);
void AddEndLine();
#ifdef DEBUGMODE
void printdebuginfo();
#endif
//void AddMainLine();
/*-----------------12.04.01 22:46-------------------
outpe
--------------------------------------------------*/
void CreatStub(char *name);
void CreatWinStub();
void ChSize(long size);
/*-----------------12.04.01 22:57-------------------
outle
--------------------------------------------------*/
int MakeLE();
int MakeMEOS();
int MakeBin32();
/*-----------------08.12.01 23:43-------------------
pointer
--------------------------------------------------*/
void dopointer();
void dovalpointer();
void getpointeradr(ITOK *gstok,char *&gbuf,SINFO *gstr,int numpointer,int razr,int reg=BX);
void dopointerproc();
/*-----------------09.12.01 00:28-------------------
new_type
--------------------------------------------------*/
void convert_type(int *sign,int *rettype,int *pointr,int reg=BX);
/*-----------------23.12.01 02:39-------------------
class
--------------------------------------------------*/
void doclassproc(unsigned int);
void AddThis();
/*-----------------27.01.02 23:39-------------------
res
--------------------------------------------------*/
void input_res();
int MakeRes(unsigned long ofsres,LISTRELOC **listrel);
void CreatStrTabRes();
/*-----------------14.04.03 21:31-------------------
optreg
--------------------------------------------------*/
void initregstat();
void deinitregstat();
void IDXToReg(char *name,int size,int reg);
int CheckIDXReg(char *name,int size,int reg);
void IDZToReg(char *name,int reg,int razr);
int CheckIDZReg(char *name,int reg,int razr);
void clearregstat(int regs=0);
void ConstToReg(unsigned long num,int reg,int razr);
void ClearReg(int reg);
int RegSwapReg(int reg1,int reg2,int razr);
char *GetLecsem(int stop1,int stop2=tk_eof,int type=-1);
REGISTERSTAT *BakRegStat();
void CopyRegStat(REGISTERSTAT *bak);
void KillVar(char *name);
void CompareRegStat(REGISTERSTAT *bak);
int RegToReg(int regd,int regs,int razr);
void GenRegToReg(int regd,int reds,int razr);
void GetEndLex(int stop1,int stop2=tk_eof,int type=-1);
int GetRegNumber(int reg,unsigned long *num,int razr);
int GetNumberR(int reg,unsigned long *num,int razr,unsigned long number);
void FreeStat(REGISTERSTAT *bak);
void AddRegVar(int reg, int razr,ITOK *itok4);
int GetRegVar(ITOK *itok4);
#ifdef OPTVARCONST
void CreateMainLVIC();
void KillMainLVIC();
void ClearLVIC();
int Const2Var(ITOK *itok4,long long num,int typenum);
void ClearVarByNum(ITOK *itok4);
int UpdVarConst(ITOK *itok4,long long num,int typenum,int operand);
void FreeGlobalConst();
int CheckRegToConst(int reg,ITOK *itok4,int razr);
int CheckUpdRegToConst(int reg,ITOK *itok4,int operand,int razr);
int SwapVarConst(ITOK *itok2,ITOK *itok4);
int SwapVarRegConst(int reg,ITOK *itok4,int razr);
int CheckConstVar(ITOK *itok4);
//int CheckConstVar2(ITOK *itok4,long long *num,int *typenum);
void CheckConstVar3(int *tok4,ITOK *itok4,int razr);
void Const2VarRec(LVIC *varconst);
#endif
#ifndef _REGOPT_
extern unsigned char optinitreg;
#ifdef OPTVARCONST
extern unsigned char replasevar;
extern LVIC *listvic;
#endif
#endif
/*-----------------------
libobj
-------------------------*/
void AddNameObj(char *name,int typefind,int type);
void AddObj();
#ifdef __NEWLEX__
void inittokn();
void doblockstart(char *);
#endif
/* end of TOK.H */

File diff suppressed because it is too large Load Diff

12194
programs/develop/cmm/tokb.cpp Normal file

File diff suppressed because it is too large Load Diff

10266
programs/develop/cmm/tokc.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff