; ; GRDP ; ; Copyright(c) LADsoft ; ; David Lindauer, gclind01@starbase.spd.louisville.edu ; ; ; opcodes.asm ; ; Locate the opcode table entry for a given opcode byte ; ;MASM MODE .model small .386p include opcodes.asi include options.ase include opcom.ase PUBLIC FindOpcode, opmatch, opmatchtab, LookupOpName .data ; ; Following is a table of opcodes. Each entry consists of a mask value, ; a comparison value, a pointer to the name, the addressing mode to be ; used in dissassembly, and the base length of the instruction (possibly ; modified by the exact addressing mode encountered) ; ; added two new bytes: first is evalutation flags, second is unused ; groupx0 dw 0fch dw 00h dw dgroup:opn_add db OP_REGRMREG db 2 db 0 db 0 dw 0e7h dw 06h dw dgroup:opn_push db OP_SEG35 db 1 db 0 db 0 dw 0feh dw 04h dw dgroup:opn_add db OP_ACCIMM db 1 db 0 db 0 dw 0e7h dw 07h dw dgroup:opn_pop db OP_SEG35 db 1 db 0 db 0 dw 0fch dw 08h dw dgroup:opn_or db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 0ch dw dgroup:opn_or db OP_ACCIMM db 1 db 0 db 0 dw 0fch dw 010h dw dgroup:opn_adc db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 014h dw dgroup:opn_adc db OP_ACCIMM db 1 db 0 db 0 dw 0fch dw 018h dw dgroup:opn_sbb db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 01ch dw dgroup:opn_sbb db OP_ACCIMM db 1 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx1 dw 0fch dw 020h dw dgroup:opn_and db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 024h dw dgroup:opn_and db OP_ACCIMM db 1 db 0 db 0 dw 0ffh dw 027h dw dgroup:opn_daa db OP_CODEONLY db 1 db 0 db 0 dw 0fch dw 028h dw dgroup:opn_sub db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 02ch dw dgroup:opn_sub db OP_ACCIMM db 1 db 0 db 0 dw 0ffh dw 02fh dw dgroup:opn_das db OP_CODEONLY db 1 db 0 db 0 dw 0fch dw 030h dw dgroup:opn_xor db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 034h dw dgroup:opn_xor db OP_ACCIMM db 1 db 0 db 0 dw 0ffh dw 037h dw dgroup:opn_aaa db OP_CODEONLY db 1 db 0 db 0 dw 0fch dw 038h dw dgroup:opn_cmp db OP_REGRMREG db 2 db 0 db 0 dw 0feh dw 03ch dw dgroup:opn_cmp db OP_ACCIMM db 1 db 0 db 0 dw 0ffh dw 03fh dw dgroup:opn_aas db OP_CODEONLY db 1 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx2 dw 0f8h dw 040h dw dgroup:opn_inc db OP_WREG02 db 1 db 0 db 0 dw 0f8h dw 048h dw dgroup:opn_dec db OP_WREG02 db 1 db 0 db 0 dw 0f8h dw 050h dw dgroup:opn_push db OP_WREG02 db 1 db 0 db 0 dw 0f8h dw 058h dw dgroup:opn_pop db OP_WREG02 db 1 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx3 dw 0ffh dw 060h dw dgroup:opn_pusha db OP_INSWORDSIZE db 1 db 1 db 0 dw 0ffh dw 061h dw dgroup:opn_popa db OP_INSWORDSIZE db 1 db 1 db 0 dw 0ffh dw 062h dw dgroup:opn_bound db OP_WORDREGRM db 2 db 1 db 0 dw 0ffh dw 063h dw dgroup:opn_arpl db OP_WORDRMREG db 2 db 1 db 0 dw 0fdh dw 068h dw dgroup:opn_push db OP_IMM db 1 db 1 db 0 dw 0fdh dw 069h dw dgroup:opn_imul db OP_IMUL db 2 db 0 db 0 dw 0ffh dw 06ch dw dgroup:opn_insb db OP_CODEONLY db 1 db 1 db 0 dw 0ffh dw 06dh dw dgroup:opn_ins db OP_CODEONLY db 1 db 1 db 0 dw 0ffh dw 06eh dw dgroup:opn_outsb db OP_CODEONLY db 1 db 1 db 0 dw 0ffh dw 06fh dw dgroup:opn_outs db OP_CODEONLY db 1 db 1 db 0 dw 0ffh dw 070h dw dgroup:opn_jo db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 071h dw dgroup:opn_jno db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 072h dw dgroup:opn_jb db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 073h dw dgroup:opn_jnb db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 074h dw dgroup:opn_jz db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 075h dw dgroup:opn_jnz db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 076h dw dgroup:opn_jbe db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 077h dw dgroup:opn_ja db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 078h dw dgroup:opn_js db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 079h dw dgroup:opn_jns db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 07ah dw dgroup:opn_jp db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 07bh dw dgroup:opn_jnp db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 07ch dw dgroup:opn_jl db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 07dh dw dgroup:opn_jge db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 07eh dw dgroup:opn_jle db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 07fh dw dgroup:opn_jg db OP_SHORTBRANCH db 2 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx4 dw 038fch dw 080h dw dgroup:opn_add db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038feh dw 0880h dw dgroup:opn_or db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 0880h dw dgroup:opn_or db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 01080h dw dgroup:opn_adc db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 01880h dw dgroup:opn_sbb db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038feh dw 02080h dw dgroup:opn_and db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 02080h dw dgroup:opn_and db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 02880h dw dgroup:opn_sub db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038feh dw 03080h dw dgroup:opn_xor db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 03080h dw dgroup:opn_xor db OP_RMIMMSIGNED db 2 db 0 db 0 dw 038fch dw 03880h dw dgroup:opn_cmp db OP_RMIMMSIGNED db 2 db 0 db 0 dw 0feh dw 084h dw dgroup:opn_test db OP_REGRM db 2 db 0 db 0 dw 0feh dw 086h dw dgroup:opn_xchg db OP_REGRM db 2 db 0 db 0 dw 0fch dw 088h dw dgroup:opn_mov db OP_REGRMREG db 2 db 0 db 0 dw 020fdh dw 08ch dw dgroup:opn_mov db OP_SEGRMSEG db 2 db 0 db 0 dw 0fdh dw 08ch dw dgroup:opn_mov db OP_SEGRMSEG db 2 db 0 db 0 dw 0ffh dw 08dh dw dgroup:opn_lea db OP_WORDREGRM db 2 db 0 db 0 dw 038ffh dw 08fh dw dgroup:opn_pop db OP_PUSHW db 2 db 0 db 0 dw 0ffh dw 090h dw dgroup:opn_nop db OP_CODEONLY db 1 db 0 db 0 dw 0f8h dw 090h dw dgroup:opn_xchg db OP_ACCREG02 db 1 db 0 db 0 dw 0ffh dw 098h dw dgroup:opn_cbw db OP_CBW db 1 db 0 db 0 dw 0ffh dw 099h dw dgroup:opn_cwd db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 09ah dw dgroup:opn_call db OP_SEGBRANCH db 5 db 0 db 0 dw 0ffh dw 09bh dw dgroup:opn_wait db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 09ch dw dgroup:opn_pushf db OP_INSWORDSIZE db 1 db 0 db 0 dw 0ffh dw 09dh dw dgroup:opn_popf db OP_INSWORDSIZE db 1 db 0 db 0 dw 0ffh dw 09eh dw dgroup:opn_sahf db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 09fh dw dgroup:opn_lahf db OP_CODEONLY db 1 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx5 dw 0feh dw 0a0h dw dgroup:opn_mov db OP_ACCABS db 3 db 0 db 0 dw 0feh dw 0a2h dw dgroup:opn_mov db OP_ABSACC db 3 db 0 db 0 dw 0ffh dw 0a5h dw dgroup:opn_movs db OP_INSWORDSIZE db 1 db 0 db 0 dw 0ffh dw 0a7h dw dgroup:opn_cmps db OP_INSWORDSIZE db 1 db 0 db 0 dw 0feh dw 0a8h dw dgroup:opn_test db OP_ACCIMM db 1 db 0 db 0 dw 0ffh dw 0abh dw dgroup:opn_stos db OP_INSWORDSIZE db 1 db 0 db 0 dw 0ffh dw 0adh dw dgroup:opn_lods db OP_INSWORDSIZE db 1 db 0 db 0 dw 0ffh dw 0afh dw dgroup:opn_scas db OP_INSWORDSIZE db 1 db 0 db 0 dw 0ffh dw 0a4h dw dgroup:opn_movsb db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0a6h dw dgroup:opn_cmpsb db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0aah dw dgroup:opn_stosb db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0ach dw dgroup:opn_lodsb db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0aeh dw dgroup:opn_scasb db OP_CODEONLY db 1 db 0 db 0 dw 0f0h dw 0b0h dw dgroup:opn_mov db OP_ACCIMMB3 db 1 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx6 dw 038feh dw 0c0h dw dgroup:opn_rol db OP_RMSHIFT db 2 db 1 db 0 dw 038feh dw 08c0h dw dgroup:opn_ror db OP_RMSHIFT db 2 db 1 db 0 dw 038feh dw 010c0h dw dgroup:opn_rcl db OP_RMSHIFT db 2 db 1 db 0 dw 038feh dw 018c0h dw dgroup:opn_rcr db OP_RMSHIFT db 2 db 1 db 0 dw 038feh dw 020c0h dw dgroup:opn_shl db OP_RMSHIFT db 2 db 1 db 0 dw 038feh dw 028c0h dw dgroup:opn_shr db OP_RMSHIFT db 2 db 1 db 0 dw 038feh dw 038c0h dw dgroup:opn_sar db OP_RMSHIFT db 2 db 1 db 0 dw 0ffh dw 0c2h dw dgroup:opn_ret db OP_RET db 3 db 0 db 0 dw 0ffh dw 0c3h dw dgroup:opn_ret db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0c4h dw dgroup:opn_les db OP_WORDREGRM db 2 db 0 db 0 dw 0ffh dw 0c5h dw dgroup:opn_lds db OP_WORDREGRM db 2 db 0 db 0 dw 038feh dw 0c6h dw dgroup:opn_mov db OP_RMIMM db 2 db 0 db 0 dw 0ffh dw 0c8h dw dgroup:opn_enter db OP_ENTER db 4 db 1 db 0 dw 0ffh dw 0cah dw dgroup:opn_retf db OP_RET db 3 db 0 db 0 dw 0ffh dw 0cbh dw dgroup:opn_retf db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0cch dw dgroup:opn_int db OP_INTR db 1 db 0 db 0 dw 0ffh dw 0cdh dw dgroup:opn_int db OP_INTR db 2 db 0 db 0 dw 0ffh dw 0ceh dw dgroup:opn_into db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0cfh dw dgroup:opn_iret db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0c9h dw dgroup:opn_leave db OP_CODEONLY db 1 db 1 db 0 dw 038fch dw 0d0h dw dgroup:opn_rol db OP_RMSHIFT db 2 db 0 db 0 dw 038fch dw 08d0h dw dgroup:opn_ror db OP_RMSHIFT db 2 db 0 db 0 dw 038fch dw 010d0h dw dgroup:opn_rcl db OP_RMSHIFT db 2 db 0 db 0 dw 038fch dw 018d0h dw dgroup:opn_rcr db OP_RMSHIFT db 2 db 0 db 0 dw 038fch dw 020d0h dw dgroup:opn_shl db OP_RMSHIFT db 2 db 0 db 0 dw 038fch dw 028d0h dw dgroup:opn_shr db OP_RMSHIFT db 2 db 0 db 0 dw 038fch dw 038d0h dw dgroup:opn_sar db OP_RMSHIFT db 2 db 0 db 0 dw 0ffffh dw 0ad4h dw dgroup:opn_aam db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0ad5h dw dgroup:opn_aad db OP_CODEONLY db 2 db 0 db 0 dw 0ffh dw 0d7h dw dgroup:opn_xlat db OP_CODEONLY db 1 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx7 dw 0ffh dw 0e0h dw dgroup:opn_loopnz db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 0e1h dw dgroup:opn_loopz db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 0e2h dw dgroup:opn_loop db OP_SHORTBRANCH db 2 db 0 db 0 dw 0ffh dw 0e3h dw dgroup:opn_jcxz db OP_SHORTBRANCH db 2 db 0 db 0 dw 0feh dw 0e4h dw dgroup:opn_in db OP_PORTACCPORT db 2 db 0 db 0 dw 0feh dw 0e6h dw dgroup:opn_out db OP_PORTACCPORT db 2 db 0 db 0 dw 0ffh dw 0e8h dw dgroup:opn_call db OP_BRANCH db 3 db 0 db 0 dw 0ffh dw 0e9h dw dgroup:opn_jmp db OP_BRANCH db 3 db 0 db 0 dw 0ffh dw 0eah dw dgroup:opn_jmp db OP_SEGBRANCH db 5 db 0 db 0 dw 0ffh dw 0ebh dw dgroup:opn_jmp db OP_SHORTBRANCH db 2 db 0 db 0 dw 0feh dw 0ech dw dgroup:opn_in db OP_ACCDX db 1 db 0 db 0 dw 0feh dw 0eeh dw dgroup:opn_out db OP_DXACC db 1 db 0 db 0 dw 0ffh dw 0f0h dw dgroup:opn_lock db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0f2h dw dgroup:opn_repnz db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0f3h dw dgroup:opn_repz db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0f4h dw dgroup:opn_hlt db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0f5h dw dgroup:opn_cmc db OP_CODEONLY db 1 db 0 db 0 dw 038feh dw 0f6h dw dgroup:opn_test db OP_RMIMM db 2 db 0 db 0 dw 038feh dw 010f6h dw dgroup:opn_not db OP_RM db 2 db 0 db 0 dw 038feh dw 018f6h dw dgroup:opn_neg db OP_RM db 2 db 0 db 0 dw 038feh dw 020f6h dw dgroup:opn_mul db OP_RM db 2 db 0 db 0 dw 038feh dw 028f6h dw dgroup:opn_imul db OP_RM db 2 db 0 db 0 dw 038feh dw 030f6h dw dgroup:opn_div db OP_RM db 2 db 0 db 0 dw 038feh dw 038f6h dw dgroup:opn_idiv db OP_RM db 2 db 0 db 0 dw 0ffh dw 0f8h dw dgroup:opn_clc db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0f9h dw dgroup:opn_stc db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0fah dw dgroup:opn_cli db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0fbh dw dgroup:opn_sti db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0fch dw dgroup:opn_cld db OP_CODEONLY db 1 db 0 db 0 dw 0ffh dw 0fdh dw dgroup:opn_std db OP_CODEONLY db 1 db 0 db 0 dw 038feh dw 0feh dw dgroup:opn_inc db OP_RM db 2 db 0 db 0 dw 038feh dw 08feh dw dgroup:opn_dec db OP_RM db 2 db 0 db 0 dw 038ffh dw 010ffh dw dgroup:opn_call db OP_RM db 2 db 0 db 0 dw 038ffh dw 018ffh dw dgroup:opn_call db OP_FARRM db 2 db 0 db 0 dw 038ffh dw 020ffh dw dgroup:opn_jmp db OP_RM db 2 db 0 db 0 dw 038ffh dw 028ffh dw dgroup:opn_jmp db OP_FARRM db 2 db 0 db 0 dw 038ffh dw 030ffh dw dgroup:opn_push db OP_PUSHW db 2 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 groupx386 dw 0feh dw 0beh dw dgroup:opn_movsx db OP_MIXEDREGRM db 2 db 3 db 0 dw 0feh dw 0b6h dw dgroup:opn_movzx db OP_MIXEDREGRM db 2 db 3 db 0 dw 0f8h dw 0c8h dw dgroup:opn_bswap db OP_REG02 db 1 db 3 db 0 dw 0f7h dw 0a0h dw dgroup:opn_push db OP_SEG35 db 1 db 3 db 0 dw 0f7h dw 0a1h dw dgroup:opn_pop db OP_SEG35 db 1 db 3 db 0 dw 0ffh dw 0b4h dw dgroup:opn_lfs db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 0b5h dw dgroup:opn_lgs db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 0b2h dw dgroup:opn_lss db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 06h dw dgroup:opn_clts db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 08h dw dgroup:opn_invd db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 09h dw dgroup:opn_wbinvd db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 0afh dw dgroup:opn_imul db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 0a4h dw dgroup:opn_shld db OP_REGRMSHIFT db 3 db 3 db 0 dw 0ffh dw 0a5h dw dgroup:opn_shld db OP_REGRMSHIFT db 2 db 3 db 0 dw 0ffh dw 0ach dw dgroup:opn_shrd db OP_REGRMSHIFT db 3 db 3 db 0 dw 0ffh dw 0adh dw dgroup:opn_shrd db OP_REGRMSHIFT db 2 db 3 db 0 dw 0ffh dw 0bch dw dgroup:opn_bsf db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 0bdh dw dgroup:opn_bsr db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 0a3h dw dgroup:opn_bt db OP_WORDRMREG db 2 db 3 db 0 dw 0ffh dw 0abh dw dgroup:opn_bts db OP_WORDRMREG db 2 db 3 db 0 dw 0ffh dw 0b3h dw dgroup:opn_btr db OP_WORDRMREG db 2 db 3 db 0 dw 0ffh dw 0bbh dw dgroup:opn_btc db OP_WORDRMREG db 2 db 3 db 0 dw 0ffh dw 040h dw dgroup:opn_cmovo db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 041h dw dgroup:opn_cmovno db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 042h dw dgroup:opn_cmovb db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 043h dw dgroup:opn_cmovnb db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 044h dw dgroup:opn_cmovz db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 045h dw dgroup:opn_cmovnz db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 046h dw dgroup:opn_cmovbe db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 047h dw dgroup:opn_cmova db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 048h dw dgroup:opn_cmovs db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 049h dw dgroup:opn_cmovns db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 04ah dw dgroup:opn_cmovp db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 04bh dw dgroup:opn_cmovnp db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 04ch dw dgroup:opn_cmovl db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 04dh dw dgroup:opn_cmovge db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 04eh dw dgroup:opn_cmovle db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 04fh dw dgroup:opn_cmovg db OP_WORDREGRM db 2 db 3 db 0 dw 038ffh dw 020bah dw dgroup:opn_bt db OP_BITNUM db 3 db 3 db 0 dw 038ffh dw 028bah dw dgroup:opn_bts db OP_BITNUM db 3 db 3 db 0 dw 038ffh dw 030bah dw dgroup:opn_btr db OP_BITNUM db 3 db 3 db 0 dw 038ffh dw 038bah dw dgroup:opn_btc db OP_BITNUM db 3 db 3 db 0 dw 0ffh dw 0a7h dw dgroup:opn_ibts db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 0aah dw dgroup:opn_rsm db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 0a6h dw dgroup:opn_xbts db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 0a2h dw dgroup:opn_cpuid db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 080h dw dgroup:opn_jo db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 081h dw dgroup:opn_jno db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 082h dw dgroup:opn_jb db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 083h dw dgroup:opn_jnb db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 084h dw dgroup:opn_jz db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 085h dw dgroup:opn_jnz db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 086h dw dgroup:opn_jbe db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 087h dw dgroup:opn_ja db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 088h dw dgroup:opn_js db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 089h dw dgroup:opn_jns db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 08ah dw dgroup:opn_jp db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 08bh dw dgroup:opn_jnp db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 08ch dw dgroup:opn_jl db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 08dh dw dgroup:opn_jge db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 08eh dw dgroup:opn_jle db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 08fh dw dgroup:opn_jg db OP_BRANCH db 3 db 3 db 0 dw 0ffh dw 033h dw dgroup:opn_rdtsc db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 031h dw dgroup:opn_rdpmc db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 032h dw dgroup:opn_rdmsr db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 030h dw dgroup:opn_wrmsr db OP_CODEONLY db 1 db 3 db 0 dw 038ffh dw 090h dw dgroup:opn_seto db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 091h dw dgroup:opn_setno db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 092h dw dgroup:opn_setb db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 093h dw dgroup:opn_setnb db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 094h dw dgroup:opn_setz db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 095h dw dgroup:opn_setnz db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 096h dw dgroup:opn_setbe db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 097h dw dgroup:opn_seta db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 098h dw dgroup:opn_sets db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 099h dw dgroup:opn_setns db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 09ah dw dgroup:opn_setp db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 09bh dw dgroup:opn_setnp db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 09ch dw dgroup:opn_setl db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 09dh dw dgroup:opn_setge db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 09eh dw dgroup:opn_setle db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 09fh dw dgroup:opn_setg db OP_NOSTRICTRM db 2 db 3 db 0 dw 0feh dw 0c0h dw dgroup:opn_xadd db OP_BYTERMREG db 2 db 3 db 0 dw 0feh dw 0b0h dw dgroup:opn_cmpxchg db OP_BYTERMREG db 2 db 3 db 0 dw 0c0fdh dw 0c020h dw dgroup:opn_mov db OP_386REG db 2 db 3 db 0 dw 0c0fdh dw 0c021h dw dgroup:opn_mov db OP_386REG db 2 db 3 db 0 dw 0c0fdh dw 0c024h dw dgroup:opn_mov db OP_386REG db 2 db 3 db 0 dw 0ffh dw 00bh dw dgroup:opn_ud2 db OP_CODEONLY db 1 db 3 db 0 dw 0ffh dw 02h dw dgroup:opn_lar db OP_WORDREGRM db 2 db 3 db 0 dw 0ffh dw 03h dw dgroup:opn_lsl db OP_WORDREGRM db 2 db 3 db 0 dw 038ffh dw 01001h dw dgroup:opn_lgdt db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 01801h dw dgroup:opn_lidt db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 008c7h dw dgroup:opn_cmpxchg8b db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 01000h dw dgroup:opn_lldt db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 03001h dw dgroup:opn_lmsw db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 01800h dw dgroup:opn_ltr db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 01h dw dgroup:opn_sgdt db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 0801h dw dgroup:opn_sidt db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 00h dw dgroup:opn_sldt db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 02001h dw dgroup:opn_smsw db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 0800h dw dgroup:opn_str db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 02000h dw dgroup:opn_verr db OP_NOSTRICTRM db 2 db 3 db 0 dw 038ffh dw 02800h dw dgroup:opn_verw db OP_NOSTRICTRM db 2 db 3 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 ;/* single byte commands */ floats dw 0ffffh dw 0d0d9h dw dgroup:opn_fnop db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e0d9h dw dgroup:opn_fchs db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e1d9h dw dgroup:opn_fabs db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e4d9h dw dgroup:opn_ftst db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e5d9h dw dgroup:opn_fxam db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e8d9h dw dgroup:opn_fld1 db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e9d9h dw dgroup:opn_fldl2t db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0ead9h dw dgroup:opn_fldl2e db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0ebd9h dw dgroup:opn_fldpi db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0ecd9h dw dgroup:opn_fldlg2 db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0edd9h dw dgroup:opn_fldln2 db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0eed9h dw dgroup:opn_fldz db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f0d9h dw dgroup:opn_f2xm1 db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f1d9h dw dgroup:opn_fyl2x db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f2d9h dw dgroup:opn_fptan db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f3d9h dw dgroup:opn_fpatan db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f5d9h dw dgroup:opn_fprem1 db OP_CODEONLY db 2 db 1 db 0 dw 0ffffh dw 0f4d9h dw dgroup:opn_fxtract db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f6d9h dw dgroup:opn_fdecstp db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f7d9h dw dgroup:opn_fincstp db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f8d9h dw dgroup:opn_fprem db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0f9d9h dw dgroup:opn_fyl2xp1 db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0fad9h dw dgroup:opn_fsqrt db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0fbd9h dw dgroup:opn_fsincos db OP_CODEONLY db 2 db 1 db 0 dw 0ffffh dw 0fcd9h dw dgroup:opn_frndint db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0fdd9h dw dgroup:opn_fscale db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0fed9h dw dgroup:opn_fsin db OP_CODEONLY db 2 db 1 db 0 dw 0ffffh dw 0ffd9h dw dgroup:opn_fcos db OP_CODEONLY db 2 db 1 db 0 dw 0ffffh dw 0e9dah dw dgroup:opn_fucompp db OP_CODEONLY db 2 db 1 db 0 dw 0ffffh dw 0e0dbh dw dgroup:opn_feni db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e1dbh dw dgroup:opn_fdisi db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e2dbh dw dgroup:opn_fclex db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e3dbh dw dgroup:opn_finit db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e4dbh dw dgroup:opn_fsetpm db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0d9deh dw dgroup:opn_fcompp db OP_CODEONLY db 2 db 0 db 0 dw 0ffffh dw 0e0dfh dw dgroup:opn_fnstsw db OP_AX db 2 db 0 db 0 ; /* Group 1, RM 3 */ dw 0f8ffh dw 0c0d9h dw dgroup:opn_fld db OP_FLOATRM db 2 db 0 db 0 dw 0f8ffh dw 0c8d9h dw dgroup:opn_fxch db OP_FLOATRM db 2 db 0 db 0 dw 0f8fbh dw 0d8d9h dw dgroup:opn_fstp db OP_FLOATRM db 2 db 0 db 0 dw 0c0ffh dw 0c0d9h dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 ; /* Group 1, RM0-2 */ dw 038ffh dw 020d9h dw dgroup:opn_fldenv db OP_FLOATNOPTR db 2 db 0 db 0 dw 038ffh dw 028d9h dw dgroup:opn_fldcw db OP_FLOATNOPTR db 2 db 0 db 0 dw 038ffh dw 030d9h dw dgroup:opn_fnstenv db OP_FLOATNOPTR db 2 db 0 db 0 dw 038ffh dw 038d9h dw dgroup:opn_fnstcw db OP_FLOATNOPTR db 2 db 0 db 0 ; /* Group 5, RM3 */ dw 0f8ffh dw 0c0ddh dw dgroup:opn_ffree db OP_FLOATRM db 2 db 0 db 0 dw 0f8ffh dw 0d0ddh dw dgroup:opn_fst db OP_FLOATRM db 2 db 0 db 0 dw 0f8ffh dw 0e0ddh dw dgroup:opn_fucom db OP_FLOATRM db 2 db 1 db 0 dw 0f8ffh dw 0e8ddh dw dgroup:opn_fucomp db OP_FLOATRM db 2 db 1 db 0 dw 0c0ffh dw 0c0ddh dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 ; /* Group 5, RM0-2 */ dw 038ffh dw 020ddh dw dgroup:opn_frstor db OP_FLOATNOPTR db 2 db 0 db 0 dw 038ffh dw 030ddh dw dgroup:opn_fnsave db OP_FLOATNOPTR db 2 db 0 db 0 dw 038ffh dw 038ddh dw dgroup:opn_fnstsw db OP_FLOATNOPTR db 2 db 0 db 0 ; /* Group 3 & 7*/ dw 0c0fbh dw 0c0dbh dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 dw 038ffh dw 028dbh dw dgroup:opn_fld db OP_SIZEFLOATRM db 2 db 0 db 0 dw 038ffh dw 038dbh dw dgroup:opn_fstp db OP_SIZEFLOATRM db 2 db 0 db 0 ; /* Group 7 */ dw 038ffh dw 020dfh dw dgroup:opn_fbld db OP_SIZEFLOATRM db 2 db 0 db 0 dw 038ffh dw 028dfh dw dgroup:opn_fild db OP_SIZEFLOATRM db 2 db 0 db 0 dw 038ffh dw 030dfh dw dgroup:opn_fbstp db OP_SIZEFLOATRM db 2 db 0 db 0 dw 038ffh dw 038dfh dw dgroup:opn_fistp db OP_SIZEFLOATRM db 2 db 0 db 0 ; /* Math, group 0,2,4,6 special RM 3*/ dw 0c0ffh dw 0c0dah dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 dw 0f8ffh dw 0c0deh dw dgroup:opn_fadd db OP_FLOATMATH db 2 db 0 db 0 dw 0f8ffh dw 0c8deh dw dgroup:opn_fmul db OP_FLOATMATH db 2 db 0 db 0 dw 0f8ffh dw 0d0deh dw dgroup:opn_fcom db OP_FLOATRM db 2 db 0 db 0 dw 0f8ffh dw 0d8deh dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 dw 0f0ffh dw 0e0deh dw dgroup:opn_fsub db OP_FLOATMATH db 2 db 0 db 0 dw 0f0ffh dw 0f0deh dw dgroup:opn_fdiv db OP_FLOATMATH db 2 db 0 db 0 ; /* Math, other */ dw 038fbh dw 0d8h dw dgroup:opn_fadd db OP_FLOATMATH db 2 db 0 db 0 dw 038fbh dw 08d8h dw dgroup:opn_fmul db OP_FLOATMATH db 2 db 0 db 0 dw 038fbh dw 010d8h dw dgroup:opn_fcom db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 018d8h dw dgroup:opn_fcomp db OP_FLOATRM db 2 db 0 db 0 dw 030fbh dw 020d8h dw dgroup:opn_fsub db OP_FLOATMATH db 2 db 0 db 0 dw 030fbh dw 030d8h dw dgroup:opn_fdiv db OP_FLOATMATH db 2 db 0 db 0 dw 038fbh dw 0dah dw dgroup:opn_fiadd db OP_FLOATMATH db 2 db 0 db 0 dw 038fbh dw 08dah dw dgroup:opn_fimul db OP_FLOATMATH db 2 db 0 db 0 dw 038fbh dw 010dah dw dgroup:opn_ficom db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 018dah dw dgroup:opn_ficomp db OP_FLOATRM db 2 db 0 db 0 dw 030fbh dw 020dah dw dgroup:opn_fisub db OP_FLOATMATH db 2 db 0 db 0 dw 030fbh dw 030dah dw dgroup:opn_fidiv db OP_FLOATMATH db 2 db 0 db 0 ; /* groups 1, 3, 5, 7 */ ; /* keep the follwing from going into error, RM3 */ dw 0e0f9h dw 0c0d9h dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 dw 038fbh dw 0d9h dw dgroup:opn_fld db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 010d9h dw dgroup:opn_fst db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 018d9h dw dgroup:opn_fstp db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 0dbh dw dgroup:opn_fild db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 010dbh dw dgroup:opn_fist db OP_FLOATRM db 2 db 0 db 0 dw 038fbh dw 018dbh dw dgroup:opn_fistp db OP_FLOATRM db 2 db 0 db 0 ; /* Catch- all */ dw 0f8h dw 0d8h dw dgroup:opn_esc db OP_ESC db 2 db 0 db 0 dw 0 dw 0 dw 0 db 0 db 0 db 0 db 0 indexes dw dgroup:groupx0, dgroup:groupx1, dgroup:groupx2, dgroup:groupx3 dw dgroup:groupx4, dgroup:groupx5, dgroup:groupx6, dgroup:groupx7 opmatch dw 0 opmatchtab dw 16 DUP (0) .CODE ; ; find an opcode ; FindOpcode PROC mov bx,offset dgroup:groupx386 ; Assume it is an 0F opcode inc si ; Point to next byte cmp BYTE PTR fs:[si-1],0fh ; Is it? jz short gotable ; Yes, go parse second byte dec si ; Else point back to first byte mov bx,offset dgroup:floats ; Assume floating movzx eax,byte ptr fs:[si] ; Get the opcode and al,0f8h ; Apply the FLOAT mask cmp al,0d8h ; Apply FLOAT compare jz short gotable ; Yes, go look for opcode shr al,5 ; Else use upper three bits of mov bx,[indexes + eax * 2] ; opcode to select a table gotable: test WORD PTR [bx],-1 ; See if at end of table jz short noentry ; Yes, not found mov ax,fs:[si] ; Get the opcode and ax,[bx + OPCODE.MSK] ; Mask it cmp ax,[bx + OPCODE.COMPARE]; Compare with the compare value jz short gotentry ; Quit if found add bx,OPCODESIZE ; Else go to next entry jmp gotable ; gotentry: test [opt32ins],1 jnz okentry test [bx + OPCODE.FLAGS],1 jnz noentry okentry: clc ; Found, exit ret noentry: stc ; Not found, exit ret FindOpcode ENDP ; ; scan a table for matches with this opcode ; lookandenter PROC test word ptr [di],0 ; end of table? jz nomorent mov cx,ax ; get len push di mov di,[di + opcode.mnemonic] ; no get mnemonic push si repe cmpsb ; scan for match pop si pop di jnz nomatch ; no match? test [opt32ins],1 ; yes match, check for 386 match jnz okentrymatch test [bx + OPCODE.FLAGS],1 jnz nomatch ; not allowing 386 opscodes okentrymatch: mov [bx + opmatch],di ; match, put it in match tab add bx,2 nomatch: add di,OPCODESIZE ; next entry jmp lookandenter nomorent: ret lookandenter ENDP ; ; main opcode lookup routine ; LookupOpName PROC mov bx,0 ; no matches mov di,offset dgroup:indexes ; match the main tabs mov cx,8 lp: push di push cx mov di,[di] call lookandenter pop cx pop di add di,2 loop lp mov di,offset dgroup:floats ; match the float tab call lookandenter mov di,offset dgroup:groupx386 ; match the x386 tab (0F prefix) call lookandenter or bx,bx ; see if any matches mov [opmatch],bx ; and save count jnz lox stc ; no match, error lox: ret ; back to caller LookupOpName ENDP END