Subversion Repositories Kolibri OS

Rev

Rev 7836 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ; flat assembler core
  3. ; Copyright (c) 1999-2021, Tomasz Grysztar.
  4. ; All rights reserved.
  5.  
  6. simple_instruction_except64:
  7.         cmp     [code_type],64
  8.         je      illegal_instruction
  9. simple_instruction:
  10.         stos    byte [edi]
  11.         jmp     instruction_assembled
  12. simple_instruction_only64:
  13.         cmp     [code_type],64
  14.         jne     illegal_instruction
  15.         jmp     simple_instruction
  16. simple_instruction_16bit_except64:
  17.         cmp     [code_type],64
  18.         je      illegal_instruction
  19. simple_instruction_16bit:
  20.         cmp     [code_type],16
  21.         jne     size_prefix
  22.         stos    byte [edi]
  23.         jmp     instruction_assembled
  24.       size_prefix:
  25.         mov     ah,al
  26.         mov     al,66h
  27.         stos    word [edi]
  28.         jmp     instruction_assembled
  29. simple_instruction_32bit_except64:
  30.         cmp     [code_type],64
  31.         je      illegal_instruction
  32. simple_instruction_32bit:
  33.         cmp     [code_type],16
  34.         je      size_prefix
  35.         stos    byte [edi]
  36.         jmp     instruction_assembled
  37. iret_instruction:
  38.         cmp     [code_type],64
  39.         jne     simple_instruction
  40. simple_instruction_64bit:
  41.         cmp     [code_type],64
  42.         jne     illegal_instruction
  43.         mov     ah,al
  44.         mov     al,48h
  45.         stos    word [edi]
  46.         jmp     instruction_assembled
  47. simple_extended_instruction_64bit:
  48.         cmp     [code_type],64
  49.         jne     illegal_instruction
  50.         mov     byte [edi],48h
  51.         inc     edi
  52. simple_extended_instruction:
  53.         mov     ah,al
  54.         mov     al,0Fh
  55.         stos    word [edi]
  56.         jmp     instruction_assembled
  57. simple_extended_instruction_f3:
  58.         mov     byte [edi],0F3h
  59.         inc     edi
  60.         jmp     simple_extended_instruction
  61. prefix_instruction:
  62.         stos    byte [edi]
  63.         or      [prefix_flags],1
  64.         jmp     continue_line
  65. segment_prefix:
  66.         mov     ah,al
  67.         shr     ah,4
  68.         cmp     ah,3
  69.         jne     illegal_instruction
  70.         and     al,1111b
  71.         mov     [segment_register],al
  72.         call    store_segment_prefix
  73.         or      [prefix_flags],1
  74.         jmp     continue_line
  75. bnd_prefix_instruction:
  76.         stos    byte [edi]
  77.         or      [prefix_flags],1 + 10h
  78.         jmp     continue_line
  79. int_instruction:
  80.         lods    byte [esi]
  81.         call    get_size_operator
  82.         cmp     ah,1
  83.         ja      invalid_operand_size
  84.         cmp     al,'('
  85.         jne     invalid_operand
  86.         call    get_byte_value
  87.         test    eax,eax
  88.         jns     int_imm_ok
  89.         call    recoverable_overflow
  90.       int_imm_ok:
  91.         mov     ah,al
  92.         mov     al,0CDh
  93.         stos    word [edi]
  94.         jmp     instruction_assembled
  95. aa_instruction:
  96.         cmp     [code_type],64
  97.         je      illegal_instruction
  98.         push    eax
  99.         mov     bl,10
  100.         cmp     byte [esi],'('
  101.         jne     aa_store
  102.         inc     esi
  103.         xor     al,al
  104.         xchg    al,[operand_size]
  105.         cmp     al,1
  106.         ja      invalid_operand_size
  107.         call    get_byte_value
  108.         mov     bl,al
  109.       aa_store:
  110.         cmp     [operand_size],0
  111.         jne     invalid_operand
  112.         pop     eax
  113.         mov     ah,bl
  114.         stos    word [edi]
  115.         jmp     instruction_assembled
  116.  
  117. basic_instruction:
  118.         mov     [base_code],al
  119.         lods    byte [esi]
  120.         call    get_size_operator
  121.         cmp     al,10h
  122.         je      basic_reg
  123.         cmp     al,'['
  124.         jne     invalid_operand
  125.       basic_mem:
  126.         call    get_address
  127.         push    edx ebx ecx
  128.         lods    byte [esi]
  129.         cmp     al,','
  130.         jne     invalid_operand
  131.         lods    byte [esi]
  132.         call    get_size_operator
  133.         cmp     al,'('
  134.         je      basic_mem_imm
  135.         cmp     al,10h
  136.         jne     invalid_operand
  137.       basic_mem_reg:
  138.         lods    byte [esi]
  139.         call    convert_register
  140.         mov     [postbyte_register],al
  141.         pop     ecx ebx edx
  142.         mov     al,ah
  143.         cmp     al,1
  144.         je      instruction_ready
  145.         call    operand_autodetect
  146.         inc     [base_code]
  147.       instruction_ready:
  148.         call    store_instruction
  149.         jmp     instruction_assembled
  150.       basic_mem_imm:
  151.         mov     al,[operand_size]
  152.         cmp     al,1
  153.         jb      basic_mem_imm_nosize
  154.         je      basic_mem_imm_8bit
  155.         cmp     al,2
  156.         je      basic_mem_imm_16bit
  157.         cmp     al,4
  158.         je      basic_mem_imm_32bit
  159.         cmp     al,8
  160.         jne     invalid_operand_size
  161.       basic_mem_imm_64bit:
  162.         cmp     [size_declared],0
  163.         jne     long_immediate_not_encodable
  164.         call    operand_64bit
  165.         call    get_simm32
  166.         cmp     [value_type],4
  167.         jae     long_immediate_not_encodable
  168.         jmp     basic_mem_imm_32bit_ok
  169.       basic_mem_imm_nosize:
  170.         call    recoverable_unknown_size
  171.       basic_mem_imm_8bit:
  172.         call    get_byte_value
  173.         mov     byte [value],al
  174.         mov     al,[base_code]
  175.         shr     al,3
  176.         mov     [postbyte_register],al
  177.         pop     ecx ebx edx
  178.         mov     [base_code],80h
  179.         call    store_instruction_with_imm8
  180.         jmp     instruction_assembled
  181.       basic_mem_imm_16bit:
  182.         call    operand_16bit
  183.         call    get_word_value
  184.         mov     word [value],ax
  185.         mov     al,[base_code]
  186.         shr     al,3
  187.         mov     [postbyte_register],al
  188.         pop     ecx ebx edx
  189.         cmp     [value_type],0
  190.         jne     basic_mem_imm_16bit_store
  191.         cmp     [size_declared],0
  192.         jne     basic_mem_imm_16bit_store
  193.         cmp     word [value],80h
  194.         jb      basic_mem_simm_8bit
  195.         cmp     word [value],-80h
  196.         jae     basic_mem_simm_8bit
  197.       basic_mem_imm_16bit_store:
  198.         mov     [base_code],81h
  199.         call    store_instruction_with_imm16
  200.         jmp     instruction_assembled
  201.       basic_mem_simm_8bit:
  202.         mov     [base_code],83h
  203.         call    store_instruction_with_imm8
  204.         jmp     instruction_assembled
  205.       basic_mem_imm_32bit:
  206.         call    operand_32bit
  207.         call    get_dword_value
  208.       basic_mem_imm_32bit_ok:
  209.         mov     dword [value],eax
  210.         mov     al,[base_code]
  211.         shr     al,3
  212.         mov     [postbyte_register],al
  213.         pop     ecx ebx edx
  214.         cmp     [value_type],0
  215.         jne     basic_mem_imm_32bit_store
  216.         cmp     [size_declared],0
  217.         jne     basic_mem_imm_32bit_store
  218.         cmp     dword [value],80h
  219.         jb      basic_mem_simm_8bit
  220.         cmp     dword [value],-80h
  221.         jae     basic_mem_simm_8bit
  222.       basic_mem_imm_32bit_store:
  223.         mov     [base_code],81h
  224.         call    store_instruction_with_imm32
  225.         jmp     instruction_assembled
  226.       get_simm32:
  227.         call    get_qword_value
  228.         mov     ecx,edx
  229.         cdq
  230.         cmp     ecx,edx
  231.         je      simm32_range_ok
  232.         call    recoverable_overflow
  233.       simm32_range_ok:
  234.         cmp     [value_type],4
  235.         jne     get_simm32_ok
  236.         mov     [value_type],2
  237.       get_simm32_ok:
  238.         ret
  239.       basic_reg:
  240.         lods    byte [esi]
  241.         call    convert_register
  242.         mov     [postbyte_register],al
  243.         lods    byte [esi]
  244.         cmp     al,','
  245.         jne     invalid_operand
  246.         lods    byte [esi]
  247.         call    get_size_operator
  248.         cmp     al,10h
  249.         je      basic_reg_reg
  250.         cmp     al,'('
  251.         je      basic_reg_imm
  252.         cmp     al,'['
  253.         jne     invalid_operand
  254.       basic_reg_mem:
  255.         call    get_address
  256.         mov     al,[operand_size]
  257.         cmp     al,1
  258.         je      basic_reg_mem_8bit
  259.         call    operand_autodetect
  260.         add     [base_code],3
  261.         jmp     instruction_ready
  262.       basic_reg_mem_8bit:
  263.         add     [base_code],2
  264.         jmp     instruction_ready
  265.       basic_reg_reg:
  266.         lods    byte [esi]
  267.         call    convert_register
  268.         mov     bl,[postbyte_register]
  269.         mov     [postbyte_register],al
  270.         mov     al,ah
  271.         cmp     al,1
  272.         je      nomem_instruction_ready
  273.         call    operand_autodetect
  274.         inc     [base_code]
  275.       nomem_instruction_ready:
  276.         call    store_nomem_instruction
  277.         jmp     instruction_assembled
  278.       basic_reg_imm:
  279.         mov     al,[operand_size]
  280.         cmp     al,1
  281.         je      basic_reg_imm_8bit
  282.         cmp     al,2
  283.         je      basic_reg_imm_16bit
  284.         cmp     al,4
  285.         je      basic_reg_imm_32bit
  286.         cmp     al,8
  287.         jne     invalid_operand_size
  288.       basic_reg_imm_64bit:
  289.         cmp     [size_declared],0
  290.         jne     long_immediate_not_encodable
  291.         call    operand_64bit
  292.         call    get_simm32
  293.         cmp     [value_type],4
  294.         jae     long_immediate_not_encodable
  295.         jmp     basic_reg_imm_32bit_ok
  296.       basic_reg_imm_8bit:
  297.         call    get_byte_value
  298.         mov     dl,al
  299.         mov     bl,[base_code]
  300.         shr     bl,3
  301.         xchg    bl,[postbyte_register]
  302.         or      bl,bl
  303.         jz      basic_al_imm
  304.         mov     [base_code],80h
  305.         call    store_nomem_instruction
  306.         mov     al,dl
  307.         stos    byte [edi]
  308.         jmp     instruction_assembled
  309.       basic_al_imm:
  310.         mov     al,[base_code]
  311.         add     al,4
  312.         stos    byte [edi]
  313.         mov     al,dl
  314.         stos    byte [edi]
  315.         jmp     instruction_assembled
  316.       basic_reg_imm_16bit:
  317.         call    operand_16bit
  318.         call    get_word_value
  319.         mov     dx,ax
  320.         mov     bl,[base_code]
  321.         shr     bl,3
  322.         xchg    bl,[postbyte_register]
  323.         cmp     [value_type],0
  324.         jne     basic_reg_imm_16bit_store
  325.         cmp     [size_declared],0
  326.         jne     basic_reg_imm_16bit_store
  327.         cmp     dx,80h
  328.         jb      basic_reg_simm_8bit
  329.         cmp     dx,-80h
  330.         jae     basic_reg_simm_8bit
  331.       basic_reg_imm_16bit_store:
  332.         or      bl,bl
  333.         jz      basic_ax_imm
  334.         mov     [base_code],81h
  335.         call    store_nomem_instruction
  336.       basic_store_imm_16bit:
  337.         mov     ax,dx
  338.         call    mark_relocation
  339.         stos    word [edi]
  340.         jmp     instruction_assembled
  341.       basic_reg_simm_8bit:
  342.         mov     [base_code],83h
  343.         call    store_nomem_instruction
  344.         mov     al,dl
  345.         stos    byte [edi]
  346.         jmp     instruction_assembled
  347.       basic_ax_imm:
  348.         add     [base_code],5
  349.         call    store_classic_instruction_code
  350.         jmp     basic_store_imm_16bit
  351.       basic_reg_imm_32bit:
  352.         call    operand_32bit
  353.         call    get_dword_value
  354.       basic_reg_imm_32bit_ok:
  355.         mov     edx,eax
  356.         mov     bl,[base_code]
  357.         shr     bl,3
  358.         xchg    bl,[postbyte_register]
  359.         cmp     [value_type],0
  360.         jne     basic_reg_imm_32bit_store
  361.         cmp     [size_declared],0
  362.         jne     basic_reg_imm_32bit_store
  363.         cmp     edx,80h
  364.         jb      basic_reg_simm_8bit
  365.         cmp     edx,-80h
  366.         jae     basic_reg_simm_8bit
  367.       basic_reg_imm_32bit_store:
  368.         or      bl,bl
  369.         jz      basic_eax_imm
  370.         mov     [base_code],81h
  371.         call    store_nomem_instruction
  372.       basic_store_imm_32bit:
  373.         mov     eax,edx
  374.         call    mark_relocation
  375.         stos    dword [edi]
  376.         jmp     instruction_assembled
  377.       basic_eax_imm:
  378.         add     [base_code],5
  379.         call    store_classic_instruction_code
  380.         jmp     basic_store_imm_32bit
  381.       recoverable_unknown_size:
  382.         cmp     [error_line],0
  383.         jne     ignore_unknown_size
  384.         push    [current_line]
  385.         pop     [error_line]
  386.         mov     [error],operand_size_not_specified
  387.       ignore_unknown_size:
  388.         ret
  389. single_operand_instruction:
  390.         mov     [base_code],0F6h
  391.         mov     [postbyte_register],al
  392.         lods    byte [esi]
  393.         call    get_size_operator
  394.         cmp     al,10h
  395.         je      single_reg
  396.         cmp     al,'['
  397.         jne     invalid_operand
  398.       single_mem:
  399.         call    get_address
  400.         mov     al,[operand_size]
  401.         cmp     al,1
  402.         je      single_mem_8bit
  403.         jb      single_mem_nosize
  404.         call    operand_autodetect
  405.         inc     [base_code]
  406.         jmp     instruction_ready
  407.       single_mem_nosize:
  408.         call    recoverable_unknown_size
  409.       single_mem_8bit:
  410.         jmp     instruction_ready
  411.       single_reg:
  412.         lods    byte [esi]
  413.         call    convert_register
  414.         mov     bl,al
  415.         mov     al,ah
  416.         cmp     al,1
  417.         je      single_reg_8bit
  418.         call    operand_autodetect
  419.         inc     [base_code]
  420.       single_reg_8bit:
  421.         jmp     nomem_instruction_ready
  422. mov_instruction:
  423.         mov     [base_code],88h
  424.         lods    byte [esi]
  425.         call    get_size_operator
  426.         cmp     al,10h
  427.         je      mov_reg
  428.         cmp     al,14h
  429.         je      mov_creg
  430.         cmp     al,'['
  431.         jne     invalid_operand
  432.       mov_mem:
  433.         call    get_address
  434.         push    edx ebx ecx
  435.         lods    byte [esi]
  436.         cmp     al,','
  437.         jne     invalid_operand
  438.         lods    byte [esi]
  439.         call    get_size_operator
  440.         cmp     al,'('
  441.         je      mov_mem_imm
  442.         cmp     al,10h
  443.         jne     invalid_operand
  444.       mov_mem_reg:
  445.         lods    byte [esi]
  446.         cmp     al,30h
  447.         jb      mov_mem_general_reg
  448.         cmp     al,40h
  449.         jb      mov_mem_sreg
  450.       mov_mem_general_reg:
  451.         call    convert_register
  452.         mov     [postbyte_register],al
  453.         pop     ecx ebx edx
  454.         cmp     ah,1
  455.         je      mov_mem_reg_8bit
  456.         inc     [base_code]
  457.         mov     al,ah
  458.         call    operand_autodetect
  459.         mov     al,[postbyte_register]
  460.         or      al,bl
  461.         or      al,bh
  462.         jz      mov_mem_ax
  463.         jmp     instruction_ready
  464.       mov_mem_reg_8bit:
  465.         or      al,bl
  466.         or      al,bh
  467.         jnz     instruction_ready
  468.       mov_mem_al:
  469.         test    ch,22h
  470.         jnz     mov_mem_address16_al
  471.         test    ch,44h
  472.         jnz     mov_mem_address32_al
  473.         test    ch,not 88h
  474.         jnz     invalid_address_size
  475.         call    check_mov_address64
  476.         cmp     al,0
  477.         jg      mov_mem_address64_al
  478.         jl      instruction_ready
  479.         cmp     [code_type],16
  480.         jne     mov_mem_address32_al
  481.         cmp     edx,10000h
  482.         jb      mov_mem_address16_al
  483.       mov_mem_address32_al:
  484.         call    store_segment_prefix_if_necessary
  485.         call    address_32bit_prefix
  486.         mov     [base_code],0A2h
  487.       store_mov_address32:
  488.         call    store_classic_instruction_code
  489.         call    store_address_32bit_value
  490.         jmp     instruction_assembled
  491.       mov_mem_address16_al:
  492.         call    store_segment_prefix_if_necessary
  493.         call    address_16bit_prefix
  494.         mov     [base_code],0A2h
  495.       store_mov_address16:
  496.         cmp     [code_type],64
  497.         je      invalid_address
  498.         call    store_classic_instruction_code
  499.         mov     eax,edx
  500.         stos    word [edi]
  501.         cmp     edx,10000h
  502.         jge     value_out_of_range
  503.         jmp     instruction_assembled
  504.       check_mov_address64:
  505.         cmp     [code_type],64
  506.         jne     no_address64
  507.         test    ch,88h
  508.         jnz     address64_required
  509.         mov     eax,[address_high]
  510.         or      eax,eax
  511.         jz      no_address64
  512.         bt      edx,31
  513.         adc     eax,0
  514.         jz      address64_simm32
  515.       address64_required:
  516.         mov     al,1
  517.         ret
  518.       address64_simm32:
  519.         mov     al,-1
  520.         ret
  521.       no_address64:
  522.         test    ch,08h
  523.         jnz     invalid_address_size
  524.         xor     al,al
  525.         ret
  526.       mov_mem_address64_al:
  527.         call    store_segment_prefix_if_necessary
  528.         mov     [base_code],0A2h
  529.       store_mov_address64:
  530.         call    store_classic_instruction_code
  531.         call    store_address_64bit_value
  532.         jmp     instruction_assembled
  533.       mov_mem_ax:
  534.         test    ch,22h
  535.         jnz     mov_mem_address16_ax
  536.         test    ch,44h
  537.         jnz     mov_mem_address32_ax
  538.         test    ch,not 88h
  539.         jnz     invalid_address_size
  540.         call    check_mov_address64
  541.         cmp     al,0
  542.         jg      mov_mem_address64_ax
  543.         jl      instruction_ready
  544.         cmp     [code_type],16
  545.         jne     mov_mem_address32_ax
  546.         cmp     edx,10000h
  547.         jb      mov_mem_address16_ax
  548.       mov_mem_address32_ax:
  549.         call    store_segment_prefix_if_necessary
  550.         call    address_32bit_prefix
  551.         mov     [base_code],0A3h
  552.         jmp     store_mov_address32
  553.       mov_mem_address16_ax:
  554.         call    store_segment_prefix_if_necessary
  555.         call    address_16bit_prefix
  556.         mov     [base_code],0A3h
  557.         jmp     store_mov_address16
  558.       mov_mem_address64_ax:
  559.         call    store_segment_prefix_if_necessary
  560.         mov     [base_code],0A3h
  561.         jmp     store_mov_address64
  562.       mov_mem_sreg:
  563.         sub     al,31h
  564.         mov     [postbyte_register],al
  565.         pop     ecx ebx edx
  566.         mov     ah,[operand_size]
  567.         or      ah,ah
  568.         jz      mov_mem_sreg_store
  569.         cmp     ah,2
  570.         jne     invalid_operand_size
  571.       mov_mem_sreg_store:
  572.         mov     [base_code],8Ch
  573.         jmp     instruction_ready
  574.       mov_mem_imm:
  575.         mov     al,[operand_size]
  576.         cmp     al,1
  577.         jb      mov_mem_imm_nosize
  578.         je      mov_mem_imm_8bit
  579.         cmp     al,2
  580.         je      mov_mem_imm_16bit
  581.         cmp     al,4
  582.         je      mov_mem_imm_32bit
  583.         cmp     al,8
  584.         jne     invalid_operand_size
  585.       mov_mem_imm_64bit:
  586.         cmp     [size_declared],0
  587.         jne     long_immediate_not_encodable
  588.         call    operand_64bit
  589.         call    get_simm32
  590.         cmp     [value_type],4
  591.         jae     long_immediate_not_encodable
  592.         jmp     mov_mem_imm_32bit_store
  593.       mov_mem_imm_nosize:
  594.         call    recoverable_unknown_size
  595.       mov_mem_imm_8bit:
  596.         call    get_byte_value
  597.         mov     byte [value],al
  598.         mov     [postbyte_register],0
  599.         mov     [base_code],0C6h
  600.         pop     ecx ebx edx
  601.         call    store_instruction_with_imm8
  602.         jmp     instruction_assembled
  603.       mov_mem_imm_16bit:
  604.         call    operand_16bit
  605.         call    get_word_value
  606.         mov     word [value],ax
  607.         mov     [postbyte_register],0
  608.         mov     [base_code],0C7h
  609.         pop     ecx ebx edx
  610.         call    store_instruction_with_imm16
  611.         jmp     instruction_assembled
  612.       mov_mem_imm_32bit:
  613.         call    operand_32bit
  614.         call    get_dword_value
  615.       mov_mem_imm_32bit_store:
  616.         mov     dword [value],eax
  617.         mov     [postbyte_register],0
  618.         mov     [base_code],0C7h
  619.         pop     ecx ebx edx
  620.         call    store_instruction_with_imm32
  621.         jmp     instruction_assembled
  622.       mov_reg:
  623.         lods    byte [esi]
  624.         mov     ah,al
  625.         sub     ah,10h
  626.         and     ah,al
  627.         test    ah,0F0h
  628.         jnz     mov_sreg
  629.         call    convert_register
  630.         mov     [postbyte_register],al
  631.         lods    byte [esi]
  632.         cmp     al,','
  633.         jne     invalid_operand
  634.         lods    byte [esi]
  635.         call    get_size_operator
  636.         cmp     al,'['
  637.         je      mov_reg_mem
  638.         cmp     al,'('
  639.         je      mov_reg_imm
  640.         cmp     al,14h
  641.         je      mov_reg_creg
  642.         cmp     al,10h
  643.         jne     invalid_operand
  644.       mov_reg_reg:
  645.         lods    byte [esi]
  646.         mov     ah,al
  647.         sub     ah,10h
  648.         and     ah,al
  649.         test    ah,0F0h
  650.         jnz     mov_reg_sreg
  651.         call    convert_register
  652.         mov     bl,[postbyte_register]
  653.         mov     [postbyte_register],al
  654.         mov     al,ah
  655.         cmp     al,1
  656.         je      mov_reg_reg_8bit
  657.         call    operand_autodetect
  658.         inc     [base_code]
  659.       mov_reg_reg_8bit:
  660.         jmp     nomem_instruction_ready
  661.       mov_reg_sreg:
  662.         mov     bl,[postbyte_register]
  663.         mov     ah,al
  664.         and     al,1111b
  665.         mov     [postbyte_register],al
  666.         shr     ah,4
  667.         cmp     ah,3
  668.         jne     invalid_operand
  669.         dec     [postbyte_register]
  670.         cmp     [operand_size],8
  671.         je      mov_reg_sreg64
  672.         cmp     [operand_size],4
  673.         je      mov_reg_sreg32
  674.         cmp     [operand_size],2
  675.         jne     invalid_operand_size
  676.         call    operand_16bit
  677.         jmp     mov_reg_sreg_store
  678.       mov_reg_sreg64:
  679.         call    operand_64bit
  680.         jmp     mov_reg_sreg_store
  681.       mov_reg_sreg32:
  682.         call    operand_32bit
  683.       mov_reg_sreg_store:
  684.         mov     [base_code],8Ch
  685.         jmp     nomem_instruction_ready
  686.       mov_reg_creg:
  687.         lods    byte [esi]
  688.         mov     bl,al
  689.         shr     al,4
  690.         cmp     al,4
  691.         ja      invalid_operand
  692.         add     al,20h
  693.         mov     [extended_code],al
  694.         and     bl,1111b
  695.         xchg    bl,[postbyte_register]
  696.         mov     [base_code],0Fh
  697.         cmp     [code_type],64
  698.         je      mov_reg_creg_64bit
  699.         cmp     [operand_size],4
  700.         jne     invalid_operand_size
  701.         cmp     [postbyte_register],8
  702.         jne     mov_reg_creg_store
  703.         cmp     [extended_code],20h
  704.         jne     mov_reg_creg_store
  705.         mov     al,0F0h
  706.         stos    byte [edi]
  707.         mov     [postbyte_register],0
  708.       mov_reg_creg_store:
  709.         jmp     nomem_instruction_ready
  710.       mov_reg_creg_64bit:
  711.         cmp     [operand_size],8
  712.         jne     invalid_operand_size
  713.         jmp     nomem_instruction_ready
  714.       mov_reg_mem:
  715.         add     [base_code],2
  716.         call    get_address
  717.         mov     al,[operand_size]
  718.         cmp     al,1
  719.         je      mov_reg_mem_8bit
  720.         inc     [base_code]
  721.         call    operand_autodetect
  722.         mov     al,[postbyte_register]
  723.         or      al,bl
  724.         or      al,bh
  725.         jz      mov_ax_mem
  726.         jmp     instruction_ready
  727.       mov_reg_mem_8bit:
  728.         mov     al,[postbyte_register]
  729.         or      al,bl
  730.         or      al,bh
  731.         jz      mov_al_mem
  732.         jmp     instruction_ready
  733.       mov_al_mem:
  734.         test    ch,22h
  735.         jnz     mov_al_mem_address16
  736.         test    ch,44h
  737.         jnz     mov_al_mem_address32
  738.         test    ch,not 88h
  739.         jnz     invalid_address_size
  740.         call    check_mov_address64
  741.         cmp     al,0
  742.         jg      mov_al_mem_address64
  743.         jl      instruction_ready
  744.         cmp     [code_type],16
  745.         jne     mov_al_mem_address32
  746.         cmp     edx,10000h
  747.         jb      mov_al_mem_address16
  748.       mov_al_mem_address32:
  749.         call    store_segment_prefix_if_necessary
  750.         call    address_32bit_prefix
  751.         mov     [base_code],0A0h
  752.         jmp     store_mov_address32
  753.       mov_al_mem_address16:
  754.         call    store_segment_prefix_if_necessary
  755.         call    address_16bit_prefix
  756.         mov     [base_code],0A0h
  757.         jmp     store_mov_address16
  758.       mov_al_mem_address64:
  759.         call    store_segment_prefix_if_necessary
  760.         mov     [base_code],0A0h
  761.         jmp     store_mov_address64
  762.       mov_ax_mem:
  763.         test    ch,22h
  764.         jnz     mov_ax_mem_address16
  765.         test    ch,44h
  766.         jnz     mov_ax_mem_address32
  767.         test    ch,not 88h
  768.         jnz     invalid_address_size
  769.         call    check_mov_address64
  770.         cmp     al,0
  771.         jg      mov_ax_mem_address64
  772.         jl      instruction_ready
  773.         cmp     [code_type],16
  774.         jne     mov_ax_mem_address32
  775.         cmp     edx,10000h
  776.         jb      mov_ax_mem_address16
  777.       mov_ax_mem_address32:
  778.         call    store_segment_prefix_if_necessary
  779.         call    address_32bit_prefix
  780.         mov     [base_code],0A1h
  781.         jmp     store_mov_address32
  782.       mov_ax_mem_address16:
  783.         call    store_segment_prefix_if_necessary
  784.         call    address_16bit_prefix
  785.         mov     [base_code],0A1h
  786.         jmp     store_mov_address16
  787.       mov_ax_mem_address64:
  788.         call    store_segment_prefix_if_necessary
  789.         mov     [base_code],0A1h
  790.         jmp     store_mov_address64
  791.       mov_reg_imm:
  792.         mov     al,[operand_size]
  793.         cmp     al,1
  794.         je      mov_reg_imm_8bit
  795.         cmp     al,2
  796.         je      mov_reg_imm_16bit
  797.         cmp     al,4
  798.         je      mov_reg_imm_32bit
  799.         cmp     al,8
  800.         jne     invalid_operand_size
  801.       mov_reg_imm_64bit:
  802.         call    operand_64bit
  803.         call    get_qword_value
  804.         mov     ecx,edx
  805.         cmp     [size_declared],0
  806.         jne     mov_reg_imm_64bit_store
  807.         cmp     [value_type],4
  808.         jae     mov_reg_imm_64bit_store
  809.         cdq
  810.         cmp     ecx,edx
  811.         je      mov_reg_64bit_imm_32bit
  812.       mov_reg_imm_64bit_store:
  813.         push    eax ecx
  814.         mov     al,0B8h
  815.         call    store_mov_reg_imm_code
  816.         pop     edx eax
  817.         call    mark_relocation
  818.         stos    dword [edi]
  819.         mov     eax,edx
  820.         stos    dword [edi]
  821.         jmp     instruction_assembled
  822.       mov_reg_imm_8bit:
  823.         call    get_byte_value
  824.         mov     dl,al
  825.         mov     al,0B0h
  826.         call    store_mov_reg_imm_code
  827.         mov     al,dl
  828.         stos    byte [edi]
  829.         jmp     instruction_assembled
  830.       mov_reg_imm_16bit:
  831.         call    get_word_value
  832.         mov     dx,ax
  833.         call    operand_16bit
  834.         mov     al,0B8h
  835.         call    store_mov_reg_imm_code
  836.         mov     ax,dx
  837.         call    mark_relocation
  838.         stos    word [edi]
  839.         jmp     instruction_assembled
  840.       mov_reg_imm_32bit:
  841.         call    operand_32bit
  842.         call    get_dword_value
  843.         mov     edx,eax
  844.         mov     al,0B8h
  845.         call    store_mov_reg_imm_code
  846.       mov_store_imm_32bit:
  847.         mov     eax,edx
  848.         call    mark_relocation
  849.         stos    dword [edi]
  850.         jmp     instruction_assembled
  851.       store_mov_reg_imm_code:
  852.         mov     ah,[postbyte_register]
  853.         test    ah,1000b
  854.         jz      mov_reg_imm_prefix_ok
  855.         or      [rex_prefix],41h
  856.       mov_reg_imm_prefix_ok:
  857.         and     ah,111b
  858.         add     al,ah
  859.         mov     [base_code],al
  860.         call    store_classic_instruction_code
  861.         ret
  862.       mov_reg_64bit_imm_32bit:
  863.         mov     edx,eax
  864.         mov     bl,[postbyte_register]
  865.         mov     [postbyte_register],0
  866.         mov     [base_code],0C7h
  867.         call    store_nomem_instruction
  868.         jmp     mov_store_imm_32bit
  869.       mov_sreg:
  870.         mov     ah,al
  871.         and     al,1111b
  872.         mov     [postbyte_register],al
  873.         shr     ah,4
  874.         cmp     ah,3
  875.         jne     invalid_operand
  876.         cmp     al,2
  877.         je      illegal_instruction
  878.         dec     [postbyte_register]
  879.         lods    byte [esi]
  880.         cmp     al,','
  881.         jne     invalid_operand
  882.         lods    byte [esi]
  883.         call    get_size_operator
  884.         cmp     al,'['
  885.         je      mov_sreg_mem
  886.         cmp     al,10h
  887.         jne     invalid_operand
  888.       mov_sreg_reg:
  889.         lods    byte [esi]
  890.         call    convert_register
  891.         or      ah,ah
  892.         jz      mov_sreg_reg_size_ok
  893.         cmp     ah,2
  894.         jne     invalid_operand_size
  895.         mov     bl,al
  896.       mov_sreg_reg_size_ok:
  897.         mov     [base_code],8Eh
  898.         jmp     nomem_instruction_ready
  899.       mov_sreg_mem:
  900.         call    get_address
  901.         mov     al,[operand_size]
  902.         or      al,al
  903.         jz      mov_sreg_mem_size_ok
  904.         cmp     al,2
  905.         jne     invalid_operand_size
  906.       mov_sreg_mem_size_ok:
  907.         mov     [base_code],8Eh
  908.         jmp     instruction_ready
  909.       mov_creg:
  910.         lods    byte [esi]
  911.         mov     ah,al
  912.         shr     ah,4
  913.         cmp     ah,4
  914.         ja      invalid_operand
  915.         add     ah,22h
  916.         mov     [extended_code],ah
  917.         and     al,1111b
  918.         mov     [postbyte_register],al
  919.         mov     [base_code],0Fh
  920.         lods    byte [esi]
  921.         cmp     al,','
  922.         jne     invalid_operand
  923.         call    take_register
  924.         mov     bl,al
  925.         cmp     [code_type],64
  926.         je      mov_creg_64bit
  927.         cmp     ah,4
  928.         jne     invalid_operand_size
  929.         cmp     [postbyte_register],8
  930.         jne     mov_creg_store
  931.         cmp     [extended_code],22h
  932.         jne     mov_creg_store
  933.         mov     al,0F0h
  934.         stos    byte [edi]
  935.         mov     [postbyte_register],0
  936.       mov_creg_store:
  937.         jmp     nomem_instruction_ready
  938.       mov_creg_64bit:
  939.         cmp     ah,8
  940.         je      mov_creg_store
  941.         jmp     invalid_operand_size
  942. test_instruction:
  943.         mov     [base_code],84h
  944.         lods    byte [esi]
  945.         call    get_size_operator
  946.         cmp     al,10h
  947.         je      test_reg
  948.         cmp     al,'['
  949.         jne     invalid_operand
  950.       test_mem:
  951.         call    get_address
  952.         push    edx ebx ecx
  953.         lods    byte [esi]
  954.         cmp     al,','
  955.         jne     invalid_operand
  956.         lods    byte [esi]
  957.         call    get_size_operator
  958.         cmp     al,'('
  959.         je      test_mem_imm
  960.         cmp     al,10h
  961.         jne     invalid_operand
  962.       test_mem_reg:
  963.         lods    byte [esi]
  964.         call    convert_register
  965.         mov     [postbyte_register],al
  966.         pop     ecx ebx edx
  967.         mov     al,ah
  968.         cmp     al,1
  969.         je      test_mem_reg_8bit
  970.         call    operand_autodetect
  971.         inc     [base_code]
  972.       test_mem_reg_8bit:
  973.         jmp     instruction_ready
  974.       test_mem_imm:
  975.         mov     al,[operand_size]
  976.         cmp     al,1
  977.         jb      test_mem_imm_nosize
  978.         je      test_mem_imm_8bit
  979.         cmp     al,2
  980.         je      test_mem_imm_16bit
  981.         cmp     al,4
  982.         je      test_mem_imm_32bit
  983.         cmp     al,8
  984.         jne     invalid_operand_size
  985.       test_mem_imm_64bit:
  986.         cmp     [size_declared],0
  987.         jne     long_immediate_not_encodable
  988.         call    operand_64bit
  989.         call    get_simm32
  990.         cmp     [value_type],4
  991.         jae     long_immediate_not_encodable
  992.         jmp     test_mem_imm_32bit_store
  993.       test_mem_imm_nosize:
  994.         call    recoverable_unknown_size
  995.       test_mem_imm_8bit:
  996.         call    get_byte_value
  997.         mov     byte [value],al
  998.         mov     [postbyte_register],0
  999.         mov     [base_code],0F6h
  1000.         pop     ecx ebx edx
  1001.         call    store_instruction_with_imm8
  1002.         jmp     instruction_assembled
  1003.       test_mem_imm_16bit:
  1004.         call    operand_16bit
  1005.         call    get_word_value
  1006.         mov     word [value],ax
  1007.         mov     [postbyte_register],0
  1008.         mov     [base_code],0F7h
  1009.         pop     ecx ebx edx
  1010.         call    store_instruction_with_imm16
  1011.         jmp     instruction_assembled
  1012.       test_mem_imm_32bit:
  1013.         call    operand_32bit
  1014.         call    get_dword_value
  1015.       test_mem_imm_32bit_store:
  1016.         mov     dword [value],eax
  1017.         mov     [postbyte_register],0
  1018.         mov     [base_code],0F7h
  1019.         pop     ecx ebx edx
  1020.         call    store_instruction_with_imm32
  1021.         jmp     instruction_assembled
  1022.       test_reg:
  1023.         lods    byte [esi]
  1024.         call    convert_register
  1025.         mov     [postbyte_register],al
  1026.         lods    byte [esi]
  1027.         cmp     al,','
  1028.         jne     invalid_operand
  1029.         lods    byte [esi]
  1030.         call    get_size_operator
  1031.         cmp     al,'['
  1032.         je      test_reg_mem
  1033.         cmp     al,'('
  1034.         je      test_reg_imm
  1035.         cmp     al,10h
  1036.         jne     invalid_operand
  1037.       test_reg_reg:
  1038.         lods    byte [esi]
  1039.         call    convert_register
  1040.         mov     bl,[postbyte_register]
  1041.         mov     [postbyte_register],al
  1042.         mov     al,ah
  1043.         cmp     al,1
  1044.         je      test_reg_reg_8bit
  1045.         call    operand_autodetect
  1046.         inc     [base_code]
  1047.       test_reg_reg_8bit:
  1048.         jmp     nomem_instruction_ready
  1049.       test_reg_imm:
  1050.         mov     al,[operand_size]
  1051.         cmp     al,1
  1052.         je      test_reg_imm_8bit
  1053.         cmp     al,2
  1054.         je      test_reg_imm_16bit
  1055.         cmp     al,4
  1056.         je      test_reg_imm_32bit
  1057.         cmp     al,8
  1058.         jne     invalid_operand_size
  1059.       test_reg_imm_64bit:
  1060.         cmp     [size_declared],0
  1061.         jne     long_immediate_not_encodable
  1062.         call    operand_64bit
  1063.         call    get_simm32
  1064.         cmp     [value_type],4
  1065.         jae     long_immediate_not_encodable
  1066.         jmp     test_reg_imm_32bit_store
  1067.       test_reg_imm_8bit:
  1068.         call    get_byte_value
  1069.         mov     dl,al
  1070.         mov     bl,[postbyte_register]
  1071.         mov     [postbyte_register],0
  1072.         mov     [base_code],0F6h
  1073.         or      bl,bl
  1074.         jz      test_al_imm
  1075.         call    store_nomem_instruction
  1076.         mov     al,dl
  1077.         stos    byte [edi]
  1078.         jmp     instruction_assembled
  1079.       test_al_imm:
  1080.         mov     [base_code],0A8h
  1081.         call    store_classic_instruction_code
  1082.         mov     al,dl
  1083.         stos    byte [edi]
  1084.         jmp     instruction_assembled
  1085.       test_reg_imm_16bit:
  1086.         call    operand_16bit
  1087.         call    get_word_value
  1088.         mov     dx,ax
  1089.         mov     bl,[postbyte_register]
  1090.         mov     [postbyte_register],0
  1091.         mov     [base_code],0F7h
  1092.         or      bl,bl
  1093.         jz      test_ax_imm
  1094.         call    store_nomem_instruction
  1095.         mov     ax,dx
  1096.         call    mark_relocation
  1097.         stos    word [edi]
  1098.         jmp     instruction_assembled
  1099.       test_ax_imm:
  1100.         mov     [base_code],0A9h
  1101.         call    store_classic_instruction_code
  1102.         mov     ax,dx
  1103.         stos    word [edi]
  1104.         jmp     instruction_assembled
  1105.       test_reg_imm_32bit:
  1106.         call    operand_32bit
  1107.         call    get_dword_value
  1108.       test_reg_imm_32bit_store:
  1109.         mov     edx,eax
  1110.         mov     bl,[postbyte_register]
  1111.         mov     [postbyte_register],0
  1112.         mov     [base_code],0F7h
  1113.         or      bl,bl
  1114.         jz      test_eax_imm
  1115.         call    store_nomem_instruction
  1116.         mov     eax,edx
  1117.         call    mark_relocation
  1118.         stos    dword [edi]
  1119.         jmp     instruction_assembled
  1120.       test_eax_imm:
  1121.         mov     [base_code],0A9h
  1122.         call    store_classic_instruction_code
  1123.         mov     eax,edx
  1124.         stos    dword [edi]
  1125.         jmp     instruction_assembled
  1126.       test_reg_mem:
  1127.         call    get_address
  1128.         mov     al,[operand_size]
  1129.         cmp     al,1
  1130.         je      test_reg_mem_8bit
  1131.         call    operand_autodetect
  1132.         inc     [base_code]
  1133.       test_reg_mem_8bit:
  1134.         jmp     instruction_ready
  1135. xchg_instruction:
  1136.         mov     [base_code],86h
  1137.         lods    byte [esi]
  1138.         call    get_size_operator
  1139.         cmp     al,10h
  1140.         je      xchg_reg
  1141.         cmp     al,'['
  1142.         jne     invalid_operand
  1143.       xchg_mem:
  1144.         call    get_address
  1145.         push    edx ebx ecx
  1146.         lods    byte [esi]
  1147.         cmp     al,','
  1148.         jne     invalid_operand
  1149.         lods    byte [esi]
  1150.         call    get_size_operator
  1151.         cmp     al,10h
  1152.         je      test_mem_reg
  1153.         jmp     invalid_operand
  1154.       xchg_reg:
  1155.         lods    byte [esi]
  1156.         call    convert_register
  1157.         mov     [postbyte_register],al
  1158.         lods    byte [esi]
  1159.         cmp     al,','
  1160.         jne     invalid_operand
  1161.         lods    byte [esi]
  1162.         call    get_size_operator
  1163.         cmp     al,'['
  1164.         je      test_reg_mem
  1165.         cmp     al,10h
  1166.         jne     invalid_operand
  1167.       xchg_reg_reg:
  1168.         lods    byte [esi]
  1169.         call    convert_register
  1170.         mov     bl,al
  1171.         mov     al,ah
  1172.         cmp     al,1
  1173.         je      xchg_reg_reg_8bit
  1174.         call    operand_autodetect
  1175.         cmp     [postbyte_register],0
  1176.         je      xchg_ax_reg
  1177.         or      bl,bl
  1178.         jnz     xchg_reg_reg_store
  1179.         mov     bl,[postbyte_register]
  1180.       xchg_ax_reg:
  1181.         cmp     [code_type],64
  1182.         jne     xchg_ax_reg_ok
  1183.         cmp     ah,4
  1184.         jne     xchg_ax_reg_ok
  1185.         or      bl,bl
  1186.         jz      xchg_reg_reg_store
  1187.       xchg_ax_reg_ok:
  1188.         test    bl,1000b
  1189.         jz      xchg_ax_reg_store
  1190.         or      [rex_prefix],41h
  1191.         and     bl,111b
  1192.       xchg_ax_reg_store:
  1193.         add     bl,90h
  1194.         mov     [base_code],bl
  1195.         call    store_classic_instruction_code
  1196.         jmp     instruction_assembled
  1197.       xchg_reg_reg_store:
  1198.         inc     [base_code]
  1199.       xchg_reg_reg_8bit:
  1200.         jmp     nomem_instruction_ready
  1201. push_instruction:
  1202.         mov     [push_size],al
  1203.       push_next:
  1204.         lods    byte [esi]
  1205.         call    get_size_operator
  1206.         cmp     al,10h
  1207.         je      push_reg
  1208.         cmp     al,'('
  1209.         je      push_imm
  1210.         cmp     al,'['
  1211.         jne     invalid_operand
  1212.       push_mem:
  1213.         call    get_address
  1214.         mov     al,[operand_size]
  1215.         mov     ah,[push_size]
  1216.         cmp     al,2
  1217.         je      push_mem_16bit
  1218.         cmp     al,4
  1219.         je      push_mem_32bit
  1220.         cmp     al,8
  1221.         je      push_mem_64bit
  1222.         or      al,al
  1223.         jnz     invalid_operand_size
  1224.         cmp     ah,2
  1225.         je      push_mem_16bit
  1226.         cmp     ah,4
  1227.         je      push_mem_32bit
  1228.         cmp     ah,8
  1229.         je      push_mem_64bit
  1230.         call    recoverable_unknown_size
  1231.         jmp     push_mem_store
  1232.       push_mem_16bit:
  1233.         test    ah,not 2
  1234.         jnz     invalid_operand_size
  1235.         call    operand_16bit
  1236.         jmp     push_mem_store
  1237.       push_mem_32bit:
  1238.         test    ah,not 4
  1239.         jnz     invalid_operand_size
  1240.         cmp     [code_type],64
  1241.         je      illegal_instruction
  1242.         call    operand_32bit
  1243.         jmp     push_mem_store
  1244.       push_mem_64bit:
  1245.         test    ah,not 8
  1246.         jnz     invalid_operand_size
  1247.         cmp     [code_type],64
  1248.         jne     illegal_instruction
  1249.       push_mem_store:
  1250.         mov     [base_code],0FFh
  1251.         mov     [postbyte_register],110b
  1252.         call    store_instruction
  1253.         jmp     push_done
  1254.       push_reg:
  1255.         lods    byte [esi]
  1256.         mov     ah,al
  1257.         sub     ah,10h
  1258.         and     ah,al
  1259.         test    ah,0F0h
  1260.         jnz     push_sreg
  1261.         call    convert_register
  1262.         test    al,1000b
  1263.         jz      push_reg_ok
  1264.         or      [rex_prefix],41h
  1265.         and     al,111b
  1266.       push_reg_ok:
  1267.         add     al,50h
  1268.         mov     [base_code],al
  1269.         mov     al,ah
  1270.         mov     ah,[push_size]
  1271.         cmp     al,2
  1272.         je      push_reg_16bit
  1273.         cmp     al,4
  1274.         je      push_reg_32bit
  1275.         cmp     al,8
  1276.         jne     invalid_operand_size
  1277.       push_reg_64bit:
  1278.         test    ah,not 8
  1279.         jnz     invalid_operand_size
  1280.         cmp     [code_type],64
  1281.         jne     illegal_instruction
  1282.         jmp     push_reg_store
  1283.       push_reg_32bit:
  1284.         test    ah,not 4
  1285.         jnz     invalid_operand_size
  1286.         cmp     [code_type],64
  1287.         je      illegal_instruction
  1288.         call    operand_32bit
  1289.         jmp     push_reg_store
  1290.       push_reg_16bit:
  1291.         test    ah,not 2
  1292.         jnz     invalid_operand_size
  1293.         call    operand_16bit
  1294.       push_reg_store:
  1295.         call    store_classic_instruction_code
  1296.         jmp     push_done
  1297.       push_sreg:
  1298.         mov     bl,al
  1299.         mov     dl,[operand_size]
  1300.         mov     dh,[push_size]
  1301.         cmp     dl,2
  1302.         je      push_sreg16
  1303.         cmp     dl,4
  1304.         je      push_sreg32
  1305.         cmp     dl,8
  1306.         je      push_sreg64
  1307.         or      dl,dl
  1308.         jnz     invalid_operand_size
  1309.         cmp     dh,2
  1310.         je      push_sreg16
  1311.         cmp     dh,4
  1312.         je      push_sreg32
  1313.         cmp     dh,8
  1314.         je      push_sreg64
  1315.         jmp     push_sreg_store
  1316.       push_sreg16:
  1317.         test    dh,not 2
  1318.         jnz     invalid_operand_size
  1319.         call    operand_16bit
  1320.         jmp     push_sreg_store
  1321.       push_sreg32:
  1322.         test    dh,not 4
  1323.         jnz     invalid_operand_size
  1324.         cmp     [code_type],64
  1325.         je      illegal_instruction
  1326.         call    operand_32bit
  1327.         jmp     push_sreg_store
  1328.       push_sreg64:
  1329.         test    dh,not 8
  1330.         jnz     invalid_operand_size
  1331.         cmp     [code_type],64
  1332.         jne     illegal_instruction
  1333.       push_sreg_store:
  1334.         mov     al,bl
  1335.         cmp     al,40h
  1336.         jae     invalid_operand
  1337.         sub     al,31h
  1338.         jc      invalid_operand
  1339.         cmp     al,4
  1340.         jae     push_sreg_386
  1341.         shl     al,3
  1342.         add     al,6
  1343.         mov     [base_code],al
  1344.         cmp     [code_type],64
  1345.         je      illegal_instruction
  1346.         jmp     push_reg_store
  1347.       push_sreg_386:
  1348.         sub     al,4
  1349.         shl     al,3
  1350.         add     al,0A0h
  1351.         mov     [extended_code],al
  1352.         mov     [base_code],0Fh
  1353.         jmp     push_reg_store
  1354.       push_imm:
  1355.         mov     al,[operand_size]
  1356.         mov     ah,[push_size]
  1357.         or      al,al
  1358.         je      push_imm_size_ok
  1359.         or      ah,ah
  1360.         je      push_imm_size_ok
  1361.         cmp     al,ah
  1362.         jne     invalid_operand_size
  1363.       push_imm_size_ok:
  1364.         cmp     al,2
  1365.         je      push_imm_16bit
  1366.         cmp     al,4
  1367.         je      push_imm_32bit
  1368.         cmp     al,8
  1369.         je      push_imm_64bit
  1370.         cmp     ah,2
  1371.         je      push_imm_optimized_16bit
  1372.         cmp     ah,4
  1373.         je      push_imm_optimized_32bit
  1374.         cmp     ah,8
  1375.         je      push_imm_optimized_64bit
  1376.         or      al,al
  1377.         jnz     invalid_operand_size
  1378.         cmp     [code_type],16
  1379.         je      push_imm_optimized_16bit
  1380.         cmp     [code_type],32
  1381.         je      push_imm_optimized_32bit
  1382.       push_imm_optimized_64bit:
  1383.         cmp     [code_type],64
  1384.         jne     illegal_instruction
  1385.         call    get_simm32
  1386.         mov     edx,eax
  1387.         cmp     [value_type],0
  1388.         jne     push_imm_32bit_store
  1389.         cmp     eax,-80h
  1390.         jl      push_imm_32bit_store
  1391.         cmp     eax,80h
  1392.         jge     push_imm_32bit_store
  1393.         jmp     push_imm_8bit
  1394.       push_imm_optimized_32bit:
  1395.         cmp     [code_type],64
  1396.         je      illegal_instruction
  1397.         call    get_dword_value
  1398.         mov     edx,eax
  1399.         call    operand_32bit
  1400.         cmp     [value_type],0
  1401.         jne     push_imm_32bit_store
  1402.         cmp     eax,-80h
  1403.         jl      push_imm_32bit_store
  1404.         cmp     eax,80h
  1405.         jge     push_imm_32bit_store
  1406.         jmp     push_imm_8bit
  1407.       push_imm_optimized_16bit:
  1408.         call    get_word_value
  1409.         mov     dx,ax
  1410.         call    operand_16bit
  1411.         cmp     [value_type],0
  1412.         jne     push_imm_16bit_store
  1413.         cmp     ax,-80h
  1414.         jl      push_imm_16bit_store
  1415.         cmp     ax,80h
  1416.         jge     push_imm_16bit_store
  1417.       push_imm_8bit:
  1418.         mov     ah,al
  1419.         mov     [base_code],6Ah
  1420.         call    store_classic_instruction_code
  1421.         mov     al,ah
  1422.         stos    byte [edi]
  1423.         jmp     push_done
  1424.       push_imm_16bit:
  1425.         call    get_word_value
  1426.         mov     dx,ax
  1427.         call    operand_16bit
  1428.       push_imm_16bit_store:
  1429.         mov     [base_code],68h
  1430.         call    store_classic_instruction_code
  1431.         mov     ax,dx
  1432.         call    mark_relocation
  1433.         stos    word [edi]
  1434.         jmp     push_done
  1435.       push_imm_64bit:
  1436.         cmp     [code_type],64
  1437.         jne     illegal_instruction
  1438.         call    get_simm32
  1439.         mov     edx,eax
  1440.         jmp     push_imm_32bit_store
  1441.       push_imm_32bit:
  1442.         cmp     [code_type],64
  1443.         je      illegal_instruction
  1444.         call    get_dword_value
  1445.         mov     edx,eax
  1446.         call    operand_32bit
  1447.       push_imm_32bit_store:
  1448.         mov     [base_code],68h
  1449.         call    store_classic_instruction_code
  1450.         mov     eax,edx
  1451.         call    mark_relocation
  1452.         stos    dword [edi]
  1453.       push_done:
  1454.         lods    byte [esi]
  1455.         dec     esi
  1456.         cmp     al,0Fh
  1457.         je      instruction_assembled
  1458.         or      al,al
  1459.         jz      instruction_assembled
  1460. ;        mov     [operand_size],0
  1461. ;        mov     [operand_flags],0
  1462. ;        mov     [operand_prefix],0
  1463. ;        mov     [rex_prefix],0
  1464.         and     dword [operand_size],0
  1465.         jmp     push_next
  1466. pop_instruction:
  1467.         mov     [push_size],al
  1468.       pop_next:
  1469.         lods    byte [esi]
  1470.         call    get_size_operator
  1471.         cmp     al,10h
  1472.         je      pop_reg
  1473.         cmp     al,'['
  1474.         jne     invalid_operand
  1475.       pop_mem:
  1476.         call    get_address
  1477.         mov     al,[operand_size]
  1478.         mov     ah,[push_size]
  1479.         cmp     al,2
  1480.         je      pop_mem_16bit
  1481.         cmp     al,4
  1482.         je      pop_mem_32bit
  1483.         cmp     al,8
  1484.         je      pop_mem_64bit
  1485.         or      al,al
  1486.         jnz     invalid_operand_size
  1487.         cmp     ah,2
  1488.         je      pop_mem_16bit
  1489.         cmp     ah,4
  1490.         je      pop_mem_32bit
  1491.         cmp     ah,8
  1492.         je      pop_mem_64bit
  1493.         call    recoverable_unknown_size
  1494.         jmp     pop_mem_store
  1495.       pop_mem_16bit:
  1496.         test    ah,not 2
  1497.         jnz     invalid_operand_size
  1498.         call    operand_16bit
  1499.         jmp     pop_mem_store
  1500.       pop_mem_32bit:
  1501.         test    ah,not 4
  1502.         jnz     invalid_operand_size
  1503.         cmp     [code_type],64
  1504.         je      illegal_instruction
  1505.         call    operand_32bit
  1506.         jmp     pop_mem_store
  1507.       pop_mem_64bit:
  1508.         test    ah,not 8
  1509.         jnz     invalid_operand_size
  1510.         cmp     [code_type],64
  1511.         jne     illegal_instruction
  1512.       pop_mem_store:
  1513.         mov     [base_code],08Fh
  1514.         mov     [postbyte_register],0
  1515.         call    store_instruction
  1516.         jmp     pop_done
  1517.       pop_reg:
  1518.         lods    byte [esi]
  1519.         mov     ah,al
  1520.         sub     ah,10h
  1521.         and     ah,al
  1522.         test    ah,0F0h
  1523.         jnz     pop_sreg
  1524.         call    convert_register
  1525.         test    al,1000b
  1526.         jz      pop_reg_ok
  1527.         or      [rex_prefix],41h
  1528.         and     al,111b
  1529.       pop_reg_ok:
  1530.         add     al,58h
  1531.         mov     [base_code],al
  1532.         mov     al,ah
  1533.         mov     ah,[push_size]
  1534.         cmp     al,2
  1535.         je      pop_reg_16bit
  1536.         cmp     al,4
  1537.         je      pop_reg_32bit
  1538.         cmp     al,8
  1539.         je      pop_reg_64bit
  1540.         jmp     invalid_operand_size
  1541.       pop_reg_64bit:
  1542.         test    ah,not 8
  1543.         jnz     invalid_operand_size
  1544.         cmp     [code_type],64
  1545.         jne     illegal_instruction
  1546.         jmp     pop_reg_store
  1547.       pop_reg_32bit:
  1548.         test    ah,not 4
  1549.         jnz     invalid_operand_size
  1550.         cmp     [code_type],64
  1551.         je      illegal_instruction
  1552.         call    operand_32bit
  1553.         jmp     pop_reg_store
  1554.       pop_reg_16bit:
  1555.         test    ah,not 2
  1556.         jnz     invalid_operand_size
  1557.         call    operand_16bit
  1558.       pop_reg_store:
  1559.         call    store_classic_instruction_code
  1560.       pop_done:
  1561.         lods    byte [esi]
  1562.         dec     esi
  1563.         cmp     al,0Fh
  1564.         je      instruction_assembled
  1565.         or      al,al
  1566.         jz      instruction_assembled
  1567. ;        mov     [operand_size],0
  1568. ;        mov     [operand_flags],0
  1569. ;        mov     [operand_prefix],0
  1570. ;        mov     [rex_prefix],0
  1571.         and     dword [operand_size],0
  1572.         jmp     pop_next
  1573.       pop_sreg:
  1574.         mov     dl,[operand_size]
  1575.         mov     dh,[push_size]
  1576.         cmp     al,32h
  1577.         je      pop_cs
  1578.         mov     bl,al
  1579.         cmp     dl,2
  1580.         je      pop_sreg16
  1581.         cmp     dl,4
  1582.         je      pop_sreg32
  1583.         cmp     dl,8
  1584.         je      pop_sreg64
  1585.         or      dl,dl
  1586.         jnz     invalid_operand_size
  1587.         cmp     dh,2
  1588.         je      pop_sreg16
  1589.         cmp     dh,4
  1590.         je      pop_sreg32
  1591.         cmp     dh,8
  1592.         je      pop_sreg64
  1593.         jmp     pop_sreg_store
  1594.       pop_sreg16:
  1595.         test    dh,not 2
  1596.         jnz     invalid_operand_size
  1597.         call    operand_16bit
  1598.         jmp     pop_sreg_store
  1599.       pop_sreg32:
  1600.         test    dh,not 4
  1601.         jnz     invalid_operand_size
  1602.         cmp     [code_type],64
  1603.         je      illegal_instruction
  1604.         call    operand_32bit
  1605.         jmp     pop_sreg_store
  1606.       pop_sreg64:
  1607.         test    dh,not 8
  1608.         jnz     invalid_operand_size
  1609.         cmp     [code_type],64
  1610.         jne     illegal_instruction
  1611.       pop_sreg_store:
  1612.         mov     al,bl
  1613.         cmp     al,40h
  1614.         jae     invalid_operand
  1615.         sub     al,31h
  1616.         jc      invalid_operand
  1617.         cmp     al,4
  1618.         jae     pop_sreg_386
  1619.         shl     al,3
  1620.         add     al,7
  1621.         mov     [base_code],al
  1622.         cmp     [code_type],64
  1623.         je      illegal_instruction
  1624.         jmp     pop_reg_store
  1625.       pop_cs:
  1626.         cmp     [code_type],16
  1627.         jne     illegal_instruction
  1628.         cmp     dl,2
  1629.         je      pop_cs_store
  1630.         or      dl,dl
  1631.         jnz     invalid_operand_size
  1632.         cmp     dh,2
  1633.         je      pop_cs_store
  1634.         or      dh,dh
  1635.         jnz     illegal_instruction
  1636.       pop_cs_store:
  1637.         test    dh,not 2
  1638.         jnz     invalid_operand_size
  1639.         mov     al,0Fh
  1640.         stos    byte [edi]
  1641.         jmp     pop_done
  1642.       pop_sreg_386:
  1643.         sub     al,4
  1644.         shl     al,3
  1645.         add     al,0A1h
  1646.         mov     [extended_code],al
  1647.         mov     [base_code],0Fh
  1648.         jmp     pop_reg_store
  1649. inc_instruction:
  1650.         mov     [base_code],al
  1651.         lods    byte [esi]
  1652.         call    get_size_operator
  1653.         cmp     al,10h
  1654.         je      inc_reg
  1655.         cmp     al,'['
  1656.         je      inc_mem
  1657.         jne     invalid_operand
  1658.       inc_mem:
  1659.         call    get_address
  1660.         mov     al,[operand_size]
  1661.         cmp     al,1
  1662.         je      inc_mem_8bit
  1663.         jb      inc_mem_nosize
  1664.         call    operand_autodetect
  1665.         mov     al,0FFh
  1666.         xchg    al,[base_code]
  1667.         mov     [postbyte_register],al
  1668.         jmp     instruction_ready
  1669.       inc_mem_nosize:
  1670.         call    recoverable_unknown_size
  1671.       inc_mem_8bit:
  1672.         mov     al,0FEh
  1673.         xchg    al,[base_code]
  1674.         mov     [postbyte_register],al
  1675.         jmp     instruction_ready
  1676.       inc_reg:
  1677.         lods    byte [esi]
  1678.         call    convert_register
  1679.         mov     bl,al
  1680.         mov     al,0FEh
  1681.         xchg    al,[base_code]
  1682.         mov     [postbyte_register],al
  1683.         mov     al,ah
  1684.         cmp     al,1
  1685.         je      inc_reg_8bit
  1686.         call    operand_autodetect
  1687.         cmp     [code_type],64
  1688.         je      inc_reg_long_form
  1689.         mov     al,[postbyte_register]
  1690.         shl     al,3
  1691.         add     al,bl
  1692.         add     al,40h
  1693.         mov     [base_code],al
  1694.         call    store_classic_instruction_code
  1695.         jmp     instruction_assembled
  1696.       inc_reg_long_form:
  1697.         inc     [base_code]
  1698.       inc_reg_8bit:
  1699.         jmp     nomem_instruction_ready
  1700. set_instruction:
  1701.         mov     [base_code],0Fh
  1702.         mov     [extended_code],al
  1703.         lods    byte [esi]
  1704.         call    get_size_operator
  1705.         cmp     al,10h
  1706.         je      set_reg
  1707.         cmp     al,'['
  1708.         jne     invalid_operand
  1709.       set_mem:
  1710.         call    get_address
  1711.         cmp     [operand_size],1
  1712.         ja      invalid_operand_size
  1713.         mov     [postbyte_register],0
  1714.         jmp     instruction_ready
  1715.       set_reg:
  1716.         lods    byte [esi]
  1717.         call    convert_register
  1718.         cmp     ah,1
  1719.         jne     invalid_operand_size
  1720.         mov     bl,al
  1721.         mov     [postbyte_register],0
  1722.         jmp     nomem_instruction_ready
  1723. arpl_instruction:
  1724.         cmp     [code_type],64
  1725.         je      illegal_instruction
  1726.         mov     [base_code],63h
  1727.         lods    byte [esi]
  1728.         call    get_size_operator
  1729.         cmp     al,10h
  1730.         je      arpl_reg
  1731.         cmp     al,'['
  1732.         jne     invalid_operand
  1733.         call    get_address
  1734.         lods    byte [esi]
  1735.         cmp     al,','
  1736.         jne     invalid_operand
  1737.         call    take_register
  1738.         mov     [postbyte_register],al
  1739.         cmp     ah,2
  1740.         jne     invalid_operand_size
  1741.         jmp     instruction_ready
  1742.       arpl_reg:
  1743.         lods    byte [esi]
  1744.         call    convert_register
  1745.         cmp     ah,2
  1746.         jne     invalid_operand_size
  1747.         mov     bl,al
  1748.         lods    byte [esi]
  1749.         cmp     al,','
  1750.         jne     invalid_operand
  1751.         call    take_register
  1752.         mov     [postbyte_register],al
  1753.         jmp     nomem_instruction_ready
  1754. bound_instruction:
  1755.         cmp     [code_type],64
  1756.         je      illegal_instruction
  1757.         call    take_register
  1758.         mov     [postbyte_register],al
  1759.         lods    byte [esi]
  1760.         cmp     al,','
  1761.         jne     invalid_operand
  1762.         lods    byte [esi]
  1763.         call    get_size_operator
  1764.         cmp     al,'['
  1765.         jne     invalid_operand
  1766.         call    get_address
  1767.         mov     al,[operand_size]
  1768.         cmp     al,2
  1769.         je      bound_store
  1770.         cmp     al,4
  1771.         jne     invalid_operand_size
  1772.       bound_store:
  1773.         call    operand_autodetect
  1774.         mov     [base_code],62h
  1775.         jmp     instruction_ready
  1776. enter_instruction:
  1777.         lods    byte [esi]
  1778.         call    get_size_operator
  1779.         cmp     ah,2
  1780.         je      enter_imm16_size_ok
  1781.         or      ah,ah
  1782.         jnz     invalid_operand_size
  1783.       enter_imm16_size_ok:
  1784.         cmp     al,'('
  1785.         jne     invalid_operand
  1786.         call    get_word_value
  1787.         cmp     [next_pass_needed],0
  1788.         jne     enter_imm16_ok
  1789.         cmp     [value_type],0
  1790.         jne     invalid_use_of_symbol
  1791.         test    eax,eax
  1792.         js      value_out_of_range
  1793.       enter_imm16_ok:
  1794.         push    eax
  1795.         mov     [operand_size],0
  1796.         lods    byte [esi]
  1797.         cmp     al,','
  1798.         jne     invalid_operand
  1799.         lods    byte [esi]
  1800.         call    get_size_operator
  1801.         cmp     ah,1
  1802.         je      enter_imm8_size_ok
  1803.         or      ah,ah
  1804.         jnz     invalid_operand_size
  1805.       enter_imm8_size_ok:
  1806.         cmp     al,'('
  1807.         jne     invalid_operand
  1808.         call    get_byte_value
  1809.         cmp     [next_pass_needed],0
  1810.         jne     enter_imm8_ok
  1811.         test    eax,eax
  1812.         js      value_out_of_range
  1813.       enter_imm8_ok:
  1814.         mov     dl,al
  1815.         pop     ebx
  1816.         mov     al,0C8h
  1817.         stos    byte [edi]
  1818.         mov     ax,bx
  1819.         stos    word [edi]
  1820.         mov     al,dl
  1821.         stos    byte [edi]
  1822.         jmp     instruction_assembled
  1823. ret_instruction_only64:
  1824.         cmp     [code_type],64
  1825.         jne     illegal_instruction
  1826.         jmp     ret_instruction
  1827. ret_instruction_32bit_except64:
  1828.         cmp     [code_type],64
  1829.         je      illegal_instruction
  1830. ret_instruction_32bit:
  1831.         call    operand_32bit
  1832.         jmp     ret_instruction
  1833. ret_instruction_16bit:
  1834.         call    operand_16bit
  1835.         jmp     ret_instruction
  1836. ret_instruction_64bit:
  1837.         call    operand_64bit
  1838. ret_instruction:
  1839.         and     [prefix_flags],not 10h
  1840.       ret_common:
  1841.         mov     [base_code],al
  1842.         lods    byte [esi]
  1843.         dec     esi
  1844.         or      al,al
  1845.         jz      simple_ret
  1846.         cmp     al,0Fh
  1847.         je      simple_ret
  1848.         lods    byte [esi]
  1849.         call    get_size_operator
  1850.         or      ah,ah
  1851.         jz      ret_imm
  1852.         cmp     ah,2
  1853.         je      ret_imm
  1854.         jmp     invalid_operand_size
  1855.       ret_imm:
  1856.         cmp     al,'('
  1857.         jne     invalid_operand
  1858.         call    get_word_value
  1859.         cmp     [next_pass_needed],0
  1860.         jne     ret_imm_ok
  1861.         cmp     [value_type],0
  1862.         jne     invalid_use_of_symbol
  1863.         test    eax,eax
  1864.         js      value_out_of_range
  1865.       ret_imm_ok:
  1866.         cmp     [size_declared],0
  1867.         jne     ret_imm_store
  1868.         or      ax,ax
  1869.         jz      simple_ret
  1870.       ret_imm_store:
  1871.         mov     dx,ax
  1872.         call    store_classic_instruction_code
  1873.         mov     ax,dx
  1874.         stos    word [edi]
  1875.         jmp     instruction_assembled
  1876.       simple_ret:
  1877.         inc     [base_code]
  1878.         call    store_classic_instruction_code
  1879.         jmp     instruction_assembled
  1880. retf_instruction:
  1881.         cmp     [code_type],64
  1882.         jne     ret_common
  1883. retf_instruction_64bit:
  1884.         call    operand_64bit
  1885.         jmp     ret_common
  1886. retf_instruction_32bit:
  1887.         call    operand_32bit
  1888.         jmp     ret_common
  1889. retf_instruction_16bit:
  1890.         call    operand_16bit
  1891.         jmp     ret_common
  1892. lea_instruction:
  1893.         mov     [base_code],8Dh
  1894.         call    take_register
  1895.         mov     [postbyte_register],al
  1896.         lods    byte [esi]
  1897.         cmp     al,','
  1898.         jne     invalid_operand
  1899.         xor     al,al
  1900.         xchg    al,[operand_size]
  1901.         push    eax
  1902.         lods    byte [esi]
  1903.         call    get_size_operator
  1904.         cmp     al,'['
  1905.         jne     invalid_operand
  1906.         or      [operand_flags],1
  1907.         call    get_address
  1908.         pop     eax
  1909.         mov     [operand_size],al
  1910.         call    operand_autodetect
  1911.         jmp     instruction_ready
  1912. ls_instruction:
  1913.         or      al,al
  1914.         jz      les_instruction
  1915.         cmp     al,3
  1916.         jz      lds_instruction
  1917.         add     al,0B0h
  1918.         mov     [extended_code],al
  1919.         mov     [base_code],0Fh
  1920.         jmp     ls_code_ok
  1921.       les_instruction:
  1922.         mov     [base_code],0C4h
  1923.         jmp     ls_short_code
  1924.       lds_instruction:
  1925.         mov     [base_code],0C5h
  1926.       ls_short_code:
  1927.         cmp     [code_type],64
  1928.         je      illegal_instruction
  1929.       ls_code_ok:
  1930.         call    take_register
  1931.         mov     [postbyte_register],al
  1932.         lods    byte [esi]
  1933.         cmp     al,','
  1934.         jne     invalid_operand
  1935.         add     [operand_size],2
  1936.         lods    byte [esi]
  1937.         call    get_size_operator
  1938.         cmp     al,'['
  1939.         jne     invalid_operand
  1940.         call    get_address
  1941.         mov     al,[operand_size]
  1942.         cmp     al,4
  1943.         je      ls_16bit
  1944.         cmp     al,6
  1945.         je      ls_32bit
  1946.         cmp     al,10
  1947.         je      ls_64bit
  1948.         jmp     invalid_operand_size
  1949.       ls_16bit:
  1950.         call    operand_16bit
  1951.         jmp     instruction_ready
  1952.       ls_32bit:
  1953.         call    operand_32bit
  1954.         jmp     instruction_ready
  1955.       ls_64bit:
  1956.         call    operand_64bit
  1957.         jmp     instruction_ready
  1958. sh_instruction:
  1959.         mov     [postbyte_register],al
  1960.         lods    byte [esi]
  1961.         call    get_size_operator
  1962.         cmp     al,10h
  1963.         je      sh_reg
  1964.         cmp     al,'['
  1965.         jne     invalid_operand
  1966.       sh_mem:
  1967.         call    get_address
  1968.         push    edx ebx ecx
  1969.         mov     al,[operand_size]
  1970.         push    eax
  1971.         mov     [operand_size],0
  1972.         lods    byte [esi]
  1973.         cmp     al,','
  1974.         jne     invalid_operand
  1975.         lods    byte [esi]
  1976.         call    get_size_operator
  1977.         cmp     al,'('
  1978.         je      sh_mem_imm
  1979.         cmp     al,10h
  1980.         jne     invalid_operand
  1981.       sh_mem_reg:
  1982.         lods    byte [esi]
  1983.         cmp     al,11h
  1984.         jne     invalid_operand
  1985.         pop     eax ecx ebx edx
  1986.         cmp     al,1
  1987.         je      sh_mem_cl_8bit
  1988.         jb      sh_mem_cl_nosize
  1989.         call    operand_autodetect
  1990.         mov     [base_code],0D3h
  1991.         jmp     instruction_ready
  1992.       sh_mem_cl_nosize:
  1993.         call    recoverable_unknown_size
  1994.       sh_mem_cl_8bit:
  1995.         mov     [base_code],0D2h
  1996.         jmp     instruction_ready
  1997.       sh_mem_imm:
  1998.         mov     al,[operand_size]
  1999.         or      al,al
  2000.         jz      sh_mem_imm_size_ok
  2001.         cmp     al,1
  2002.         jne     invalid_operand_size
  2003.       sh_mem_imm_size_ok:
  2004.         call    get_byte_value
  2005.         mov     byte [value],al
  2006.         pop     eax ecx ebx edx
  2007.         cmp     al,1
  2008.         je      sh_mem_imm_8bit
  2009.         jb      sh_mem_imm_nosize
  2010.         call    operand_autodetect
  2011.         cmp     byte [value],1
  2012.         je      sh_mem_1
  2013.         mov     [base_code],0C1h
  2014.         call    store_instruction_with_imm8
  2015.         jmp     instruction_assembled
  2016.       sh_mem_1:
  2017.         mov     [base_code],0D1h
  2018.         jmp     instruction_ready
  2019.       sh_mem_imm_nosize:
  2020.         call    recoverable_unknown_size
  2021.       sh_mem_imm_8bit:
  2022.         cmp     byte [value],1
  2023.         je      sh_mem_1_8bit
  2024.         mov     [base_code],0C0h
  2025.         call    store_instruction_with_imm8
  2026.         jmp     instruction_assembled
  2027.       sh_mem_1_8bit:
  2028.         mov     [base_code],0D0h
  2029.         jmp     instruction_ready
  2030.       sh_reg:
  2031.         lods    byte [esi]
  2032.         call    convert_register
  2033.         mov     bx,ax
  2034.         mov     [operand_size],0
  2035.         lods    byte [esi]
  2036.         cmp     al,','
  2037.         jne     invalid_operand
  2038.         lods    byte [esi]
  2039.         call    get_size_operator
  2040.         cmp     al,'('
  2041.         je      sh_reg_imm
  2042.         cmp     al,10h
  2043.         jne     invalid_operand
  2044.       sh_reg_reg:
  2045.         lods    byte [esi]
  2046.         cmp     al,11h
  2047.         jne     invalid_operand
  2048.         mov     al,bh
  2049.         cmp     al,1
  2050.         je      sh_reg_cl_8bit
  2051.         call    operand_autodetect
  2052.         mov     [base_code],0D3h
  2053.         jmp     nomem_instruction_ready
  2054.       sh_reg_cl_8bit:
  2055.         mov     [base_code],0D2h
  2056.         jmp     nomem_instruction_ready
  2057.       sh_reg_imm:
  2058.         mov     al,[operand_size]
  2059.         or      al,al
  2060.         jz      sh_reg_imm_size_ok
  2061.         cmp     al,1
  2062.         jne     invalid_operand_size
  2063.       sh_reg_imm_size_ok:
  2064.         push    ebx
  2065.         call    get_byte_value
  2066.         mov     dl,al
  2067.         pop     ebx
  2068.         mov     al,bh
  2069.         cmp     al,1
  2070.         je      sh_reg_imm_8bit
  2071.         call    operand_autodetect
  2072.         cmp     dl,1
  2073.         je      sh_reg_1
  2074.         mov     [base_code],0C1h
  2075.         call    store_nomem_instruction
  2076.         mov     al,dl
  2077.         stos    byte [edi]
  2078.         jmp     instruction_assembled
  2079.       sh_reg_1:
  2080.         mov     [base_code],0D1h
  2081.         jmp     nomem_instruction_ready
  2082.       sh_reg_imm_8bit:
  2083.         cmp     dl,1
  2084.         je      sh_reg_1_8bit
  2085.         mov     [base_code],0C0h
  2086.         call    store_nomem_instruction
  2087.         mov     al,dl
  2088.         stos    byte [edi]
  2089.         jmp     instruction_assembled
  2090.       sh_reg_1_8bit:
  2091.         mov     [base_code],0D0h
  2092.         jmp     nomem_instruction_ready
  2093. shd_instruction:
  2094.         mov     [base_code],0Fh
  2095.         mov     [extended_code],al
  2096.         lods    byte [esi]
  2097.         call    get_size_operator
  2098.         cmp     al,10h
  2099.         je      shd_reg
  2100.         cmp     al,'['
  2101.         jne     invalid_operand
  2102.       shd_mem:
  2103.         call    get_address
  2104.         push    edx ebx ecx
  2105.         lods    byte [esi]
  2106.         cmp     al,','
  2107.         jne     invalid_operand
  2108.         call    take_register
  2109.         mov     [postbyte_register],al
  2110.         lods    byte [esi]
  2111.         cmp     al,','
  2112.         jne     invalid_operand
  2113.         mov     al,ah
  2114.         mov     [operand_size],0
  2115.         push    eax
  2116.         lods    byte [esi]
  2117.         call    get_size_operator
  2118.         cmp     al,'('
  2119.         je      shd_mem_reg_imm
  2120.         cmp     al,10h
  2121.         jne     invalid_operand
  2122.         lods    byte [esi]
  2123.         cmp     al,11h
  2124.         jne     invalid_operand
  2125.         pop     eax ecx ebx edx
  2126.         call    operand_autodetect
  2127.         inc     [extended_code]
  2128.         jmp     instruction_ready
  2129.       shd_mem_reg_imm:
  2130.         mov     al,[operand_size]
  2131.         or      al,al
  2132.         jz      shd_mem_reg_imm_size_ok
  2133.         cmp     al,1
  2134.         jne     invalid_operand_size
  2135.       shd_mem_reg_imm_size_ok:
  2136.         call    get_byte_value
  2137.         mov     byte [value],al
  2138.         pop     eax ecx ebx edx
  2139.         call    operand_autodetect
  2140.         call    store_instruction_with_imm8
  2141.         jmp     instruction_assembled
  2142.       shd_reg:
  2143.         lods    byte [esi]
  2144.         call    convert_register
  2145.         mov     [postbyte_register],al
  2146.         lods    byte [esi]
  2147.         cmp     al,','
  2148.         jne     invalid_operand
  2149.         call    take_register
  2150.         mov     bl,[postbyte_register]
  2151.         mov     [postbyte_register],al
  2152.         mov     al,ah
  2153.         push    eax ebx
  2154.         lods    byte [esi]
  2155.         cmp     al,','
  2156.         jne     invalid_operand
  2157.         mov     [operand_size],0
  2158.         lods    byte [esi]
  2159.         call    get_size_operator
  2160.         cmp     al,'('
  2161.         je      shd_reg_reg_imm
  2162.         cmp     al,10h
  2163.         jne     invalid_operand
  2164.         lods    byte [esi]
  2165.         cmp     al,11h
  2166.         jne     invalid_operand
  2167.         pop     ebx eax
  2168.         call    operand_autodetect
  2169.         inc     [extended_code]
  2170.         jmp     nomem_instruction_ready
  2171.       shd_reg_reg_imm:
  2172.         mov     al,[operand_size]
  2173.         or      al,al
  2174.         jz      shd_reg_reg_imm_size_ok
  2175.         cmp     al,1
  2176.         jne     invalid_operand_size
  2177.       shd_reg_reg_imm_size_ok:
  2178.         call    get_byte_value
  2179.         mov     dl,al
  2180.         pop     ebx eax
  2181.         call    operand_autodetect
  2182.         call    store_nomem_instruction
  2183.         mov     al,dl
  2184.         stos    byte [edi]
  2185.         jmp     instruction_assembled
  2186. movx_instruction:
  2187.         mov     [base_code],0Fh
  2188.         mov     [extended_code],al
  2189.         call    take_register
  2190.         mov     [postbyte_register],al
  2191.         mov     al,ah
  2192.         push    eax
  2193.         lods    byte [esi]
  2194.         cmp     al,','
  2195.         jne     invalid_operand
  2196.         mov     [operand_size],0
  2197.         lods    byte [esi]
  2198.         call    get_size_operator
  2199.         cmp     al,10h
  2200.         je      movx_reg
  2201.         cmp     al,'['
  2202.         jne     invalid_operand
  2203.         call    get_address
  2204.         pop     eax
  2205.         mov     ah,[operand_size]
  2206.         or      ah,ah
  2207.         jz      movx_unknown_size
  2208.         cmp     ah,al
  2209.         jae     invalid_operand_size
  2210.         cmp     ah,1
  2211.         je      movx_mem_store
  2212.         cmp     ah,2
  2213.         jne     invalid_operand_size
  2214.         inc     [extended_code]
  2215.       movx_mem_store:
  2216.         call    operand_autodetect
  2217.         jmp     instruction_ready
  2218.       movx_unknown_size:
  2219.         cmp     al,2
  2220.         je      movx_mem_store
  2221.         call    recoverable_unknown_size
  2222.         jmp     movx_mem_store
  2223.       movx_reg:
  2224.         lods    byte [esi]
  2225.         call    convert_register
  2226.         pop     ebx
  2227.         xchg    bl,al
  2228.         cmp     ah,al
  2229.         jae     invalid_operand_size
  2230.         cmp     ah,1
  2231.         je      movx_reg_8bit
  2232.         cmp     ah,2
  2233.         je      movx_reg_16bit
  2234.         jmp     invalid_operand_size
  2235.       movx_reg_8bit:
  2236.         call    operand_autodetect
  2237.         jmp     nomem_instruction_ready
  2238.       movx_reg_16bit:
  2239.         call    operand_autodetect
  2240.         inc     [extended_code]
  2241.         jmp     nomem_instruction_ready
  2242. movsxd_instruction:
  2243.         mov     [base_code],al
  2244.         call    take_register
  2245.         mov     [postbyte_register],al
  2246.         cmp     ah,8
  2247.         jne     invalid_operand_size
  2248.         lods    byte [esi]
  2249.         cmp     al,','
  2250.         jne     invalid_operand
  2251.         mov     [operand_size],0
  2252.         lods    byte [esi]
  2253.         call    get_size_operator
  2254.         cmp     al,10h
  2255.         je      movsxd_reg
  2256.         cmp     al,'['
  2257.         jne     invalid_operand
  2258.         call    get_address
  2259.         cmp     [operand_size],4
  2260.         je      movsxd_mem_store
  2261.         cmp     [operand_size],0
  2262.         jne     invalid_operand_size
  2263.       movsxd_mem_store:
  2264.         call    operand_64bit
  2265.         jmp     instruction_ready
  2266.       movsxd_reg:
  2267.         lods    byte [esi]
  2268.         call    convert_register
  2269.         cmp     ah,4
  2270.         jne     invalid_operand_size
  2271.         mov     bl,al
  2272.         call    operand_64bit
  2273.         jmp     nomem_instruction_ready
  2274. bt_instruction:
  2275.         mov     [postbyte_register],al
  2276.         shl     al,3
  2277.         add     al,83h
  2278.         mov     [extended_code],al
  2279.         mov     [base_code],0Fh
  2280.         lods    byte [esi]
  2281.         call    get_size_operator
  2282.         cmp     al,10h
  2283.         je      bt_reg
  2284.         cmp     al,'['
  2285.         jne     invalid_operand
  2286.         call    get_address
  2287.         push    eax ebx ecx
  2288.         lods    byte [esi]
  2289.         cmp     al,','
  2290.         jne     invalid_operand
  2291.         cmp     byte [esi],'('
  2292.         je      bt_mem_imm
  2293.         cmp     byte [esi],11h
  2294.         jne     bt_mem_reg
  2295.         cmp     byte [esi+2],'('
  2296.         je      bt_mem_imm
  2297.       bt_mem_reg:
  2298.         call    take_register
  2299.         mov     [postbyte_register],al
  2300.         pop     ecx ebx edx
  2301.         mov     al,ah
  2302.         call    operand_autodetect
  2303.         jmp     instruction_ready
  2304.       bt_mem_imm:
  2305.         xor     al,al
  2306.         xchg    al,[operand_size]
  2307.         push    eax
  2308.         lods    byte [esi]
  2309.         call    get_size_operator
  2310.         cmp     al,'('
  2311.         jne     invalid_operand
  2312.         mov     al,[operand_size]
  2313.         or      al,al
  2314.         jz      bt_mem_imm_size_ok
  2315.         cmp     al,1
  2316.         jne     invalid_operand_size
  2317.       bt_mem_imm_size_ok:
  2318.         call    get_byte_value
  2319.         mov     byte [value],al
  2320.         pop     eax
  2321.         or      al,al
  2322.         jz      bt_mem_imm_nosize
  2323.         call    operand_autodetect
  2324.       bt_mem_imm_store:
  2325.         pop     ecx ebx edx
  2326.         mov     [extended_code],0BAh
  2327.         call    store_instruction_with_imm8
  2328.         jmp     instruction_assembled
  2329.       bt_mem_imm_nosize:
  2330.         call    recoverable_unknown_size
  2331.         jmp     bt_mem_imm_store
  2332.       bt_reg:
  2333.         lods    byte [esi]
  2334.         call    convert_register
  2335.         mov     bl,al
  2336.         lods    byte [esi]
  2337.         cmp     al,','
  2338.         jne     invalid_operand
  2339.         cmp     byte [esi],'('
  2340.         je      bt_reg_imm
  2341.         cmp     byte [esi],11h
  2342.         jne     bt_reg_reg
  2343.         cmp     byte [esi+2],'('
  2344.         je      bt_reg_imm
  2345.       bt_reg_reg:
  2346.         call    take_register
  2347.         mov     [postbyte_register],al
  2348.         mov     al,ah
  2349.         call    operand_autodetect
  2350.         jmp     nomem_instruction_ready
  2351.       bt_reg_imm:
  2352.         xor     al,al
  2353.         xchg    al,[operand_size]
  2354.         push    eax ebx
  2355.         lods    byte [esi]
  2356.         call    get_size_operator
  2357.         cmp     al,'('
  2358.         jne     invalid_operand
  2359.         mov     al,[operand_size]
  2360.         or      al,al
  2361.         jz      bt_reg_imm_size_ok
  2362.         cmp     al,1
  2363.         jne     invalid_operand_size
  2364.       bt_reg_imm_size_ok:
  2365.         call    get_byte_value
  2366.         mov     byte [value],al
  2367.         pop     ebx eax
  2368.         call    operand_autodetect
  2369.       bt_reg_imm_store:
  2370.         mov     [extended_code],0BAh
  2371.         call    store_nomem_instruction
  2372.         mov     al,byte [value]
  2373.         stos    byte [edi]
  2374.         jmp     instruction_assembled
  2375. bs_instruction:
  2376.         mov     [extended_code],al
  2377.         mov     [base_code],0Fh
  2378.         call    get_reg_mem
  2379.         jc      bs_reg_reg
  2380.         mov     al,[operand_size]
  2381.         call    operand_autodetect
  2382.         jmp     instruction_ready
  2383.       bs_reg_reg:
  2384.         mov     al,ah
  2385.         call    operand_autodetect
  2386.         jmp     nomem_instruction_ready
  2387.       get_reg_mem:
  2388.         call    take_register
  2389.         mov     [postbyte_register],al
  2390.         lods    byte [esi]
  2391.         cmp     al,','
  2392.         jne     invalid_operand
  2393.         lods    byte [esi]
  2394.         call    get_size_operator
  2395.         cmp     al,10h
  2396.         je      get_reg_reg
  2397.         cmp     al,'['
  2398.         jne     invalid_argument
  2399.         call    get_address
  2400.         clc
  2401.         ret
  2402.       get_reg_reg:
  2403.         lods    byte [esi]
  2404.         call    convert_register
  2405.         mov     bl,al
  2406.         stc
  2407.         ret
  2408. ud_instruction:
  2409.         mov     [extended_code],al
  2410.         mov     [base_code],0Fh
  2411.         call    get_reg_mem
  2412.         jc      ud_reg_reg
  2413.         cmp     [operand_size],4
  2414.         jne     invalid_operand_size
  2415.         jmp     instruction_ready
  2416.       ud_reg_reg:
  2417.         cmp     ah,4
  2418.         jne     invalid_operand_size
  2419.         jmp     nomem_instruction_ready
  2420.  
  2421. imul_instruction:
  2422.         mov     [base_code],0F6h
  2423.         mov     [postbyte_register],5
  2424.         lods    byte [esi]
  2425.         call    get_size_operator
  2426.         cmp     al,10h
  2427.         je      imul_reg
  2428.         cmp     al,'['
  2429.         jne     invalid_operand
  2430.       imul_mem:
  2431.         call    get_address
  2432.         mov     al,[operand_size]
  2433.         cmp     al,1
  2434.         je      imul_mem_8bit
  2435.         jb      imul_mem_nosize
  2436.         call    operand_autodetect
  2437.         inc     [base_code]
  2438.         jmp     instruction_ready
  2439.       imul_mem_nosize:
  2440.         call    recoverable_unknown_size
  2441.       imul_mem_8bit:
  2442.         jmp     instruction_ready
  2443.       imul_reg:
  2444.         lods    byte [esi]
  2445.         call    convert_register
  2446.         cmp     byte [esi],','
  2447.         je      imul_reg_
  2448.         mov     bl,al
  2449.         mov     al,ah
  2450.         cmp     al,1
  2451.         je      imul_reg_8bit
  2452.         call    operand_autodetect
  2453.         inc     [base_code]
  2454.       imul_reg_8bit:
  2455.         jmp     nomem_instruction_ready
  2456.       imul_reg_:
  2457.         mov     [postbyte_register],al
  2458.         inc     esi
  2459.         cmp     byte [esi],'('
  2460.         je      imul_reg_imm
  2461.         cmp     byte [esi],11h
  2462.         jne     imul_reg_noimm
  2463.         cmp     byte [esi+2],'('
  2464.         je      imul_reg_imm
  2465.       imul_reg_noimm:
  2466.         lods    byte [esi]
  2467.         call    get_size_operator
  2468.         cmp     al,10h
  2469.         je      imul_reg_reg
  2470.         cmp     al,'['
  2471.         jne     invalid_operand
  2472.       imul_reg_mem:
  2473.         call    get_address
  2474.         push    edx ebx ecx
  2475.         cmp     byte [esi],','
  2476.         je      imul_reg_mem_imm
  2477.         mov     al,[operand_size]
  2478.         call    operand_autodetect
  2479.         pop     ecx ebx edx
  2480.         mov     [base_code],0Fh
  2481.         mov     [extended_code],0AFh
  2482.         jmp     instruction_ready
  2483.       imul_reg_mem_imm:
  2484.         inc     esi
  2485.         lods    byte [esi]
  2486.         call    get_size_operator
  2487.         cmp     al,'('
  2488.         jne     invalid_operand
  2489.         mov     al,[operand_size]
  2490.         cmp     al,2
  2491.         je      imul_reg_mem_imm_16bit
  2492.         cmp     al,4
  2493.         je      imul_reg_mem_imm_32bit
  2494.         cmp     al,8
  2495.         jne     invalid_operand_size
  2496.       imul_reg_mem_imm_64bit:
  2497.         cmp     [size_declared],0
  2498.         jne     long_immediate_not_encodable
  2499.         call    operand_64bit
  2500.         call    get_simm32
  2501.         cmp     [value_type],4
  2502.         jae     long_immediate_not_encodable
  2503.         jmp     imul_reg_mem_imm_32bit_ok
  2504.       imul_reg_mem_imm_16bit:
  2505.         call    operand_16bit
  2506.         call    get_word_value
  2507.         mov     word [value],ax
  2508.         cmp     [value_type],0
  2509.         jne     imul_reg_mem_imm_16bit_store
  2510.         cmp     [size_declared],0
  2511.         jne     imul_reg_mem_imm_16bit_store
  2512.         cmp     ax,-80h
  2513.         jl      imul_reg_mem_imm_16bit_store
  2514.         cmp     ax,80h
  2515.         jl      imul_reg_mem_imm_8bit_store
  2516.       imul_reg_mem_imm_16bit_store:
  2517.         pop     ecx ebx edx
  2518.         mov     [base_code],69h
  2519.         call    store_instruction_with_imm16
  2520.         jmp     instruction_assembled
  2521.       imul_reg_mem_imm_32bit:
  2522.         call    operand_32bit
  2523.         call    get_dword_value
  2524.       imul_reg_mem_imm_32bit_ok:
  2525.         mov     dword [value],eax
  2526.         cmp     [value_type],0
  2527.         jne     imul_reg_mem_imm_32bit_store
  2528.         cmp     [size_declared],0
  2529.         jne     imul_reg_mem_imm_32bit_store
  2530.         cmp     eax,-80h
  2531.         jl      imul_reg_mem_imm_32bit_store
  2532.         cmp     eax,80h
  2533.         jl      imul_reg_mem_imm_8bit_store
  2534.       imul_reg_mem_imm_32bit_store:
  2535.         pop     ecx ebx edx
  2536.         mov     [base_code],69h
  2537.         call    store_instruction_with_imm32
  2538.         jmp     instruction_assembled
  2539.       imul_reg_mem_imm_8bit_store:
  2540.         pop     ecx ebx edx
  2541.         mov     [base_code],6Bh
  2542.         call    store_instruction_with_imm8
  2543.         jmp     instruction_assembled
  2544.       imul_reg_imm:
  2545.         mov     bl,[postbyte_register]
  2546.         dec     esi
  2547.         jmp     imul_reg_reg_imm
  2548.       imul_reg_reg:
  2549.         lods    byte [esi]
  2550.         call    convert_register
  2551.         mov     bl,al
  2552.         cmp     byte [esi],','
  2553.         je      imul_reg_reg_imm
  2554.         mov     al,ah
  2555.         call    operand_autodetect
  2556.         mov     [base_code],0Fh
  2557.         mov     [extended_code],0AFh
  2558.         jmp     nomem_instruction_ready
  2559.       imul_reg_reg_imm:
  2560.         inc     esi
  2561.         lods    byte [esi]
  2562.         call    get_size_operator
  2563.         cmp     al,'('
  2564.         jne     invalid_operand
  2565.         mov     al,[operand_size]
  2566.         cmp     al,2
  2567.         je      imul_reg_reg_imm_16bit
  2568.         cmp     al,4
  2569.         je      imul_reg_reg_imm_32bit
  2570.         cmp     al,8
  2571.         jne     invalid_operand_size
  2572.       imul_reg_reg_imm_64bit:
  2573.         cmp     [size_declared],0
  2574.         jne     long_immediate_not_encodable
  2575.         call    operand_64bit
  2576.         push    ebx
  2577.         call    get_simm32
  2578.         cmp     [value_type],4
  2579.         jae     long_immediate_not_encodable
  2580.         jmp     imul_reg_reg_imm_32bit_ok
  2581.       imul_reg_reg_imm_16bit:
  2582.         call    operand_16bit
  2583.         push    ebx
  2584.         call    get_word_value
  2585.         pop     ebx
  2586.         mov     dx,ax
  2587.         cmp     [value_type],0
  2588.         jne     imul_reg_reg_imm_16bit_store
  2589.         cmp     [size_declared],0
  2590.         jne     imul_reg_reg_imm_16bit_store
  2591.         cmp     ax,-80h
  2592.         jl      imul_reg_reg_imm_16bit_store
  2593.         cmp     ax,80h
  2594.         jl      imul_reg_reg_imm_8bit_store
  2595.       imul_reg_reg_imm_16bit_store:
  2596.         mov     [base_code],69h
  2597.         call    store_nomem_instruction
  2598.         mov     ax,dx
  2599.         call    mark_relocation
  2600.         stos    word [edi]
  2601.         jmp     instruction_assembled
  2602.       imul_reg_reg_imm_32bit:
  2603.         call    operand_32bit
  2604.         push    ebx
  2605.         call    get_dword_value
  2606.       imul_reg_reg_imm_32bit_ok:
  2607.         pop     ebx
  2608.         mov     edx,eax
  2609.         cmp     [value_type],0
  2610.         jne     imul_reg_reg_imm_32bit_store
  2611.         cmp     [size_declared],0
  2612.         jne     imul_reg_reg_imm_32bit_store
  2613.         cmp     eax,-80h
  2614.         jl      imul_reg_reg_imm_32bit_store
  2615.         cmp     eax,80h
  2616.         jl      imul_reg_reg_imm_8bit_store
  2617.       imul_reg_reg_imm_32bit_store:
  2618.         mov     [base_code],69h
  2619.         call    store_nomem_instruction
  2620.         mov     eax,edx
  2621.         call    mark_relocation
  2622.         stos    dword [edi]
  2623.         jmp     instruction_assembled
  2624.       imul_reg_reg_imm_8bit_store:
  2625.         mov     [base_code],6Bh
  2626.         call    store_nomem_instruction
  2627.         mov     al,dl
  2628.         stos    byte [edi]
  2629.         jmp     instruction_assembled
  2630. in_instruction:
  2631.         call    take_register
  2632.         or      al,al
  2633.         jnz     invalid_operand
  2634.         lods    byte [esi]
  2635.         cmp     al,','
  2636.         jne     invalid_operand
  2637.         mov     al,ah
  2638.         push    eax
  2639.         mov     [operand_size],0
  2640.         lods    byte [esi]
  2641.         call    get_size_operator
  2642.         cmp     al,'('
  2643.         je      in_imm
  2644.         cmp     al,10h
  2645.         je      in_reg
  2646.         jmp     invalid_operand
  2647.       in_reg:
  2648.         lods    byte [esi]
  2649.         cmp     al,22h
  2650.         jne     invalid_operand
  2651.         pop     eax
  2652.         cmp     al,1
  2653.         je      in_al_dx
  2654.         cmp     al,2
  2655.         je      in_ax_dx
  2656.         cmp     al,4
  2657.         jne     invalid_operand_size
  2658.       in_ax_dx:
  2659.         call    operand_autodetect
  2660.         mov     [base_code],0EDh
  2661.         call    store_classic_instruction_code
  2662.         jmp     instruction_assembled
  2663.       in_al_dx:
  2664.         mov     al,0ECh
  2665.         stos    byte [edi]
  2666.         jmp     instruction_assembled
  2667.       in_imm:
  2668.         mov     al,[operand_size]
  2669.         or      al,al
  2670.         jz      in_imm_size_ok
  2671.         cmp     al,1
  2672.         jne     invalid_operand_size
  2673.       in_imm_size_ok:
  2674.         call    get_byte_value
  2675.         mov     dl,al
  2676.         pop     eax
  2677.         cmp     al,1
  2678.         je      in_al_imm
  2679.         cmp     al,2
  2680.         je      in_ax_imm
  2681.         cmp     al,4
  2682.         jne     invalid_operand_size
  2683.       in_ax_imm:
  2684.         call    operand_autodetect
  2685.         mov     [base_code],0E5h
  2686.         call    store_classic_instruction_code
  2687.         mov     al,dl
  2688.         stos    byte [edi]
  2689.         jmp     instruction_assembled
  2690.       in_al_imm:
  2691.         mov     al,0E4h
  2692.         stos    byte [edi]
  2693.         mov     al,dl
  2694.         stos    byte [edi]
  2695.         jmp     instruction_assembled
  2696. out_instruction:
  2697.         lods    byte [esi]
  2698.         call    get_size_operator
  2699.         cmp     al,'('
  2700.         je      out_imm
  2701.         cmp     al,10h
  2702.         jne     invalid_operand
  2703.         lods    byte [esi]
  2704.         cmp     al,22h
  2705.         jne     invalid_operand
  2706.         lods    byte [esi]
  2707.         cmp     al,','
  2708.         jne     invalid_operand
  2709.         mov     [operand_size],0
  2710.         call    take_register
  2711.         or      al,al
  2712.         jnz     invalid_operand
  2713.         mov     al,ah
  2714.         cmp     al,1
  2715.         je      out_dx_al
  2716.         cmp     al,2
  2717.         je      out_dx_ax
  2718.         cmp     al,4
  2719.         jne     invalid_operand_size
  2720.       out_dx_ax:
  2721.         call    operand_autodetect
  2722.         mov     [base_code],0EFh
  2723.         call    store_classic_instruction_code
  2724.         jmp     instruction_assembled
  2725.       out_dx_al:
  2726.         mov     al,0EEh
  2727.         stos    byte [edi]
  2728.         jmp     instruction_assembled
  2729.       out_imm:
  2730.         mov     al,[operand_size]
  2731.         or      al,al
  2732.         jz      out_imm_size_ok
  2733.         cmp     al,1
  2734.         jne     invalid_operand_size
  2735.       out_imm_size_ok:
  2736.         call    get_byte_value
  2737.         mov     dl,al
  2738.         lods    byte [esi]
  2739.         cmp     al,','
  2740.         jne     invalid_operand
  2741.         mov     [operand_size],0
  2742.         call    take_register
  2743.         or      al,al
  2744.         jnz     invalid_operand
  2745.         mov     al,ah
  2746.         cmp     al,1
  2747.         je      out_imm_al
  2748.         cmp     al,2
  2749.         je      out_imm_ax
  2750.         cmp     al,4
  2751.         jne     invalid_operand_size
  2752.       out_imm_ax:
  2753.         call    operand_autodetect
  2754.         mov     [base_code],0E7h
  2755.         call    store_classic_instruction_code
  2756.         mov     al,dl
  2757.         stos    byte [edi]
  2758.         jmp     instruction_assembled
  2759.       out_imm_al:
  2760.         mov     al,0E6h
  2761.         stos    byte [edi]
  2762.         mov     al,dl
  2763.         stos    byte [edi]
  2764.         jmp     instruction_assembled
  2765.  
  2766. call_instruction:
  2767.         mov     [postbyte_register],10b
  2768.         mov     [base_code],0E8h
  2769.         mov     [extended_code],9Ah
  2770.         jmp     process_jmp
  2771. jmp_instruction:
  2772.         mov     [postbyte_register],100b
  2773.         mov     [base_code],0E9h
  2774.         mov     [extended_code],0EAh
  2775.       process_jmp:
  2776.         lods    byte [esi]
  2777.         call    get_jump_operator
  2778.         test    [prefix_flags],10h
  2779.         jz      jmp_type_ok
  2780.         test    [jump_type],not 2
  2781.         jnz     illegal_instruction
  2782.         mov     [jump_type],2
  2783.         and     [prefix_flags],not 10h
  2784.       jmp_type_ok:
  2785.         call    get_size_operator
  2786.         cmp     al,'('
  2787.         je      jmp_imm
  2788.         mov     [base_code],0FFh
  2789.         cmp     al,10h
  2790.         je      jmp_reg
  2791.         cmp     al,'['
  2792.         jne     invalid_operand
  2793.       jmp_mem:
  2794.         cmp     [jump_type],1
  2795.         je      illegal_instruction
  2796.         call    get_address
  2797.         mov     edx,eax
  2798.         mov     al,[operand_size]
  2799.         or      al,al
  2800.         jz      jmp_mem_size_not_specified
  2801.         cmp     al,2
  2802.         je      jmp_mem_16bit
  2803.         cmp     al,4
  2804.         je      jmp_mem_32bit
  2805.         cmp     al,6
  2806.         je      jmp_mem_48bit
  2807.         cmp     al,8
  2808.         je      jmp_mem_64bit
  2809.         cmp     al,10
  2810.         je      jmp_mem_80bit
  2811.         jmp     invalid_operand_size
  2812.       jmp_mem_size_not_specified:
  2813.         cmp     [jump_type],3
  2814.         je      jmp_mem_far
  2815.         cmp     [jump_type],2
  2816.         je      jmp_mem_near
  2817.         call    recoverable_unknown_size
  2818.       jmp_mem_near:
  2819.         cmp     [code_type],16
  2820.         je      jmp_mem_16bit
  2821.         cmp     [code_type],32
  2822.         je      jmp_mem_near_32bit
  2823.       jmp_mem_64bit:
  2824.         cmp     [jump_type],3
  2825.         je      invalid_operand_size
  2826.         cmp     [code_type],64
  2827.         jne     illegal_instruction
  2828.         jmp     instruction_ready
  2829.       jmp_mem_far:
  2830.         cmp     [code_type],16
  2831.         je      jmp_mem_far_32bit
  2832.       jmp_mem_48bit:
  2833.         call    operand_32bit
  2834.       jmp_mem_far_store:
  2835.         cmp     [jump_type],2
  2836.         je      invalid_operand_size
  2837.         inc     [postbyte_register]
  2838.         jmp     instruction_ready
  2839.       jmp_mem_80bit:
  2840.         call    operand_64bit
  2841.         jmp     jmp_mem_far_store
  2842.       jmp_mem_far_32bit:
  2843.         call    operand_16bit
  2844.         jmp     jmp_mem_far_store
  2845.       jmp_mem_32bit:
  2846.         cmp     [jump_type],3
  2847.         je      jmp_mem_far_32bit
  2848.         cmp     [jump_type],2
  2849.         je      jmp_mem_near_32bit
  2850.         cmp     [code_type],16
  2851.         je      jmp_mem_far_32bit
  2852.       jmp_mem_near_32bit:
  2853.         cmp     [code_type],64
  2854.         je      illegal_instruction
  2855.         call    operand_32bit
  2856.         jmp     instruction_ready
  2857.       jmp_mem_16bit:
  2858.         cmp     [jump_type],3
  2859.         je      invalid_operand_size
  2860.         call    operand_16bit
  2861.         jmp     instruction_ready
  2862.       jmp_reg:
  2863.         test    [jump_type],1
  2864.         jnz     invalid_operand
  2865.         lods    byte [esi]
  2866.         call    convert_register
  2867.         mov     bl,al
  2868.         mov     al,ah
  2869.         cmp     al,2
  2870.         je      jmp_reg_16bit
  2871.         cmp     al,4
  2872.         je      jmp_reg_32bit
  2873.         cmp     al,8
  2874.         jne     invalid_operand_size
  2875.       jmp_reg_64bit:
  2876.         cmp     [code_type],64
  2877.         jne     illegal_instruction
  2878.         jmp     nomem_instruction_ready
  2879.       jmp_reg_32bit:
  2880.         cmp     [code_type],64
  2881.         je      illegal_instruction
  2882.         call    operand_32bit
  2883.         jmp     nomem_instruction_ready
  2884.       jmp_reg_16bit:
  2885.         call    operand_16bit
  2886.         jmp     nomem_instruction_ready
  2887.       jmp_imm:
  2888.         cmp     byte [esi],'.'
  2889.         je      invalid_value
  2890.         mov     ebx,esi
  2891.         dec     esi
  2892.         call    skip_symbol
  2893.         xchg    esi,ebx
  2894.         cmp     byte [ebx],':'
  2895.         je      jmp_far
  2896.         cmp     [jump_type],3
  2897.         je      invalid_operand
  2898.       jmp_near:
  2899.         mov     al,[operand_size]
  2900.         cmp     al,2
  2901.         je      jmp_imm_16bit
  2902.         cmp     al,4
  2903.         je      jmp_imm_32bit
  2904.         cmp     al,8
  2905.         je      jmp_imm_64bit
  2906.         or      al,al
  2907.         jnz     invalid_operand_size
  2908.         cmp     [code_type],16
  2909.         je      jmp_imm_16bit
  2910.         cmp     [code_type],64
  2911.         je      jmp_imm_64bit
  2912.       jmp_imm_32bit:
  2913.         cmp     [code_type],64
  2914.         je      invalid_operand_size
  2915.         call    get_address_dword_value
  2916.         cmp     [code_type],16
  2917.         jne     jmp_imm_32bit_prefix_ok
  2918.         mov     byte [edi],66h
  2919.         inc     edi
  2920.       jmp_imm_32bit_prefix_ok:
  2921.         call    calculate_jump_offset
  2922.         cdq
  2923.         call    check_for_short_jump
  2924.         jc      jmp_short
  2925.       jmp_imm_32bit_store:
  2926.         mov     edx,eax
  2927.         sub     edx,3
  2928.         jno     jmp_imm_32bit_ok
  2929.         cmp     [code_type],64
  2930.         je      jump_out_of_range
  2931.       jmp_imm_32bit_ok:
  2932.         mov     al,[base_code]
  2933.         stos    byte [edi]
  2934.         mov     eax,edx
  2935.         call    mark_relocation
  2936.         stos    dword [edi]
  2937.         jmp     instruction_assembled
  2938.       jmp_imm_64bit:
  2939.         cmp     [code_type],64
  2940.         jne     invalid_operand_size
  2941.         call    get_address_qword_value
  2942.         call    calculate_jump_offset
  2943.         mov     ecx,edx
  2944.         cdq
  2945.         cmp     edx,ecx
  2946.         jne     jump_out_of_range
  2947.         call    check_for_short_jump
  2948.         jnc     jmp_imm_32bit_store
  2949.       jmp_short:
  2950.         mov     ah,al
  2951.         mov     al,0EBh
  2952.         stos    word [edi]
  2953.         jmp     instruction_assembled
  2954.       jmp_imm_16bit:
  2955.         call    get_address_word_value
  2956.         cmp     [code_type],16
  2957.         je      jmp_imm_16bit_prefix_ok
  2958.         mov     byte [edi],66h
  2959.         inc     edi
  2960.       jmp_imm_16bit_prefix_ok:
  2961.         call    calculate_jump_offset
  2962.         cwde
  2963.         cdq
  2964.         call    check_for_short_jump
  2965.         jc      jmp_short
  2966.         cmp     [value_type],0
  2967.         jne     invalid_use_of_symbol
  2968.         mov     edx,eax
  2969.         dec     edx
  2970.         mov     al,[base_code]
  2971.         stos    byte [edi]
  2972.         mov     eax,edx
  2973.         stos    word [edi]
  2974.         jmp     instruction_assembled
  2975.       calculate_jump_offset:
  2976.         add     edi,2
  2977.         mov     ebp,[addressing_space]
  2978.         call    calculate_relative_offset
  2979.         sub     edi,2
  2980.         ret
  2981.       check_for_short_jump:
  2982.         cmp     [jump_type],1
  2983.         je      forced_short
  2984.         ja      no_short_jump
  2985.         cmp     [base_code],0E8h
  2986.         je      no_short_jump
  2987.         cmp     [value_type],0
  2988.         jne     no_short_jump
  2989.         cmp     eax,80h
  2990.         jb      short_jump
  2991.         cmp     eax,-80h
  2992.         jae     short_jump
  2993.       no_short_jump:
  2994.         clc
  2995.         ret
  2996.       forced_short:
  2997.         cmp     [base_code],0E8h
  2998.         je      illegal_instruction
  2999.         cmp     [next_pass_needed],0
  3000.         jne     jmp_short_value_type_ok
  3001.         cmp     [value_type],0
  3002.         jne     invalid_use_of_symbol
  3003.       jmp_short_value_type_ok:
  3004.         cmp     eax,-80h
  3005.         jae     short_jump
  3006.         cmp     eax,80h
  3007.         jae     jump_out_of_range
  3008.       short_jump:
  3009.         stc
  3010.         ret
  3011.       jump_out_of_range:
  3012.         cmp     [error_line],0
  3013.         jne     instruction_assembled
  3014.         mov     eax,[current_line]
  3015.         mov     [error_line],eax
  3016.         mov     [error],relative_jump_out_of_range
  3017.         jmp     instruction_assembled
  3018.       jmp_far:
  3019.         cmp     [jump_type],2
  3020.         je      invalid_operand
  3021.         cmp     [code_type],64
  3022.         je      illegal_instruction
  3023.         mov     al,[extended_code]
  3024.         mov     [base_code],al
  3025.         call    get_word_value
  3026.         push    eax
  3027.         inc     esi
  3028.         lods    byte [esi]
  3029.         cmp     al,'('
  3030.         jne     invalid_operand
  3031.         mov     al,[value_type]
  3032.         push    eax
  3033.         push    [symbol_identifier]
  3034.         cmp     byte [esi],'.'
  3035.         je      invalid_value
  3036.         mov     al,[operand_size]
  3037.         cmp     al,4
  3038.         je      jmp_far_16bit
  3039.         cmp     al,6
  3040.         je      jmp_far_32bit
  3041.         or      al,al
  3042.         jnz     invalid_operand_size
  3043.         cmp     [code_type],16
  3044.         jne     jmp_far_32bit
  3045.       jmp_far_16bit:
  3046.         call    get_word_value
  3047.         mov     ebx,eax
  3048.         call    operand_16bit
  3049.         call    store_classic_instruction_code
  3050.         mov     ax,bx
  3051.         call    mark_relocation
  3052.         stos    word [edi]
  3053.       jmp_far_segment:
  3054.         pop     [symbol_identifier]
  3055.         pop     eax
  3056.         mov     [value_type],al
  3057.         pop     eax
  3058.         call    mark_relocation
  3059.         stos    word [edi]
  3060.         jmp     instruction_assembled
  3061.       jmp_far_32bit:
  3062.         call    get_dword_value
  3063.         mov     ebx,eax
  3064.         call    operand_32bit
  3065.         call    store_classic_instruction_code
  3066.         mov     eax,ebx
  3067.         call    mark_relocation
  3068.         stos    dword [edi]
  3069.         jmp     jmp_far_segment
  3070. conditional_jump:
  3071.         mov     [base_code],al
  3072.         and     [prefix_flags],not 10h
  3073.         lods    byte [esi]
  3074.         call    get_jump_operator
  3075.         cmp     [jump_type],3
  3076.         je      invalid_operand
  3077.         call    get_size_operator
  3078.         cmp     al,'('
  3079.         jne     invalid_operand
  3080.         cmp     byte [esi],'.'
  3081.         je      invalid_value
  3082.         mov     al,[operand_size]
  3083.         cmp     al,2
  3084.         je      conditional_jump_16bit
  3085.         cmp     al,4
  3086.         je      conditional_jump_32bit
  3087.         cmp     al,8
  3088.         je      conditional_jump_64bit
  3089.         or      al,al
  3090.         jnz     invalid_operand_size
  3091.         cmp     [code_type],16
  3092.         je      conditional_jump_16bit
  3093.         cmp     [code_type],64
  3094.         je      conditional_jump_64bit
  3095.       conditional_jump_32bit:
  3096.         cmp     [code_type],64
  3097.         je      invalid_operand_size
  3098.         call    get_address_dword_value
  3099.         cmp     [code_type],16
  3100.         jne     conditional_jump_32bit_prefix_ok
  3101.         mov     byte [edi],66h
  3102.         inc     edi
  3103.       conditional_jump_32bit_prefix_ok:
  3104.         call    calculate_jump_offset
  3105.         cdq
  3106.         call    check_for_short_jump
  3107.         jc      conditional_jump_short
  3108.       conditional_jump_32bit_store:
  3109.         mov     edx,eax
  3110.         sub     edx,4
  3111.         jno     conditional_jump_32bit_range_ok
  3112.         cmp     [code_type],64
  3113.         je      jump_out_of_range
  3114.       conditional_jump_32bit_range_ok:
  3115.         mov     ah,[base_code]
  3116.         add     ah,10h
  3117.         mov     al,0Fh
  3118.         stos    word [edi]
  3119.         mov     eax,edx
  3120.         call    mark_relocation
  3121.         stos    dword [edi]
  3122.         jmp     instruction_assembled
  3123.       conditional_jump_64bit:
  3124.         cmp     [code_type],64
  3125.         jne     invalid_operand_size
  3126.         call    get_address_qword_value
  3127.         call    calculate_jump_offset
  3128.         mov     ecx,edx
  3129.         cdq
  3130.         cmp     edx,ecx
  3131.         jne     jump_out_of_range
  3132.         call    check_for_short_jump
  3133.         jnc     conditional_jump_32bit_store
  3134.       conditional_jump_short:
  3135.         mov     ah,al
  3136.         mov     al,[base_code]
  3137.         stos    word [edi]
  3138.         jmp     instruction_assembled
  3139.       conditional_jump_16bit:
  3140.         call    get_address_word_value
  3141.         cmp     [code_type],16
  3142.         je      conditional_jump_16bit_prefix_ok
  3143.         mov     byte [edi],66h
  3144.         inc     edi
  3145.       conditional_jump_16bit_prefix_ok:
  3146.         call    calculate_jump_offset
  3147.         cwde
  3148.         cdq
  3149.         call    check_for_short_jump
  3150.         jc      conditional_jump_short
  3151.         cmp     [value_type],0
  3152.         jne     invalid_use_of_symbol
  3153.         mov     edx,eax
  3154.         sub     dx,2
  3155.         mov     ah,[base_code]
  3156.         add     ah,10h
  3157.         mov     al,0Fh
  3158.         stos    word [edi]
  3159.         mov     eax,edx
  3160.         stos    word [edi]
  3161.         jmp     instruction_assembled
  3162. loop_instruction_16bit:
  3163.         cmp     [code_type],64
  3164.         je      illegal_instruction
  3165.         cmp     [code_type],16
  3166.         je      loop_instruction
  3167.         mov     [operand_prefix],67h
  3168.         jmp     loop_instruction
  3169. loop_instruction_32bit:
  3170.         cmp     [code_type],32
  3171.         je      loop_instruction
  3172.         mov     [operand_prefix],67h
  3173.       jmp     loop_instruction
  3174. loop_instruction_64bit:
  3175.         cmp     [code_type],64
  3176.         jne     illegal_instruction
  3177. loop_instruction:
  3178.         mov     [base_code],al
  3179.         lods    byte [esi]
  3180.         call    get_jump_operator
  3181.         cmp     [jump_type],1
  3182.         ja      invalid_operand
  3183.         call    get_size_operator
  3184.         cmp     al,'('
  3185.         jne     invalid_operand
  3186.         cmp     byte [esi],'.'
  3187.         je      invalid_value
  3188.         mov     al,[operand_size]
  3189.         cmp     al,2
  3190.         je      loop_jump_16bit
  3191.         cmp     al,4
  3192.         je      loop_jump_32bit
  3193.         cmp     al,8
  3194.         je      loop_jump_64bit
  3195.         or      al,al
  3196.         jnz     invalid_operand_size
  3197.         cmp     [code_type],16
  3198.         je      loop_jump_16bit
  3199.         cmp     [code_type],64
  3200.         je      loop_jump_64bit
  3201.       loop_jump_32bit:
  3202.         cmp     [code_type],64
  3203.         je      invalid_operand_size
  3204.         call    get_address_dword_value
  3205.         cmp     [code_type],16
  3206.         jne     loop_jump_32bit_prefix_ok
  3207.         mov     byte [edi],66h
  3208.         inc     edi
  3209.       loop_jump_32bit_prefix_ok:
  3210.         call    loop_counter_size
  3211.         call    calculate_jump_offset
  3212.         cdq
  3213.       make_loop_jump:
  3214.         call    check_for_short_jump
  3215.         jc      conditional_jump_short
  3216.         scas    word [edi]
  3217.         jmp     jump_out_of_range
  3218.       loop_counter_size:
  3219.         cmp     [operand_prefix],0
  3220.         je      loop_counter_size_ok
  3221.         push    eax
  3222.         mov     al,[operand_prefix]
  3223.         stos    byte [edi]
  3224.         pop     eax
  3225.       loop_counter_size_ok:
  3226.         ret
  3227.       loop_jump_64bit:
  3228.         cmp     [code_type],64
  3229.         jne     invalid_operand_size
  3230.         call    get_address_qword_value
  3231.         call    loop_counter_size
  3232.         call    calculate_jump_offset
  3233.         mov     ecx,edx
  3234.         cdq
  3235.         cmp     edx,ecx
  3236.         jne     jump_out_of_range
  3237.         jmp     make_loop_jump
  3238.       loop_jump_16bit:
  3239.         call    get_address_word_value
  3240.         cmp     [code_type],16
  3241.         je      loop_jump_16bit_prefix_ok
  3242.         mov     byte [edi],66h
  3243.         inc     edi
  3244.       loop_jump_16bit_prefix_ok:
  3245.         call    loop_counter_size
  3246.         call    calculate_jump_offset
  3247.         cwde
  3248.         cdq
  3249.         jmp     make_loop_jump
  3250.  
  3251. movs_instruction:
  3252.         lods    byte [esi]
  3253.         call    get_size_operator
  3254.         cmp     al,'['
  3255.         jne     invalid_operand
  3256.         call    get_address
  3257.         or      eax,eax
  3258.         jnz     invalid_address
  3259.         or      bl,ch
  3260.         jnz     invalid_address
  3261.         cmp     [segment_register],1
  3262.         ja      invalid_address
  3263.         push    ebx
  3264.         lods    byte [esi]
  3265.         cmp     al,','
  3266.         jne     invalid_operand
  3267.         lods    byte [esi]
  3268.         call    get_size_operator
  3269.         cmp     al,'['
  3270.         jne     invalid_operand
  3271.         call    get_address
  3272.         pop     edx
  3273.         or      eax,eax
  3274.         jnz     invalid_address
  3275.         or      bl,ch
  3276.         jnz     invalid_address
  3277.         mov     al,dh
  3278.         mov     ah,bh
  3279.         shr     al,4
  3280.         shr     ah,4
  3281.         cmp     al,ah
  3282.         jne     address_sizes_do_not_agree
  3283.         and     bh,111b
  3284.         and     dh,111b
  3285.         cmp     bh,6
  3286.         jne     invalid_address
  3287.         cmp     dh,7
  3288.         jne     invalid_address
  3289.         cmp     al,2
  3290.         je      movs_address_16bit
  3291.         cmp     al,4
  3292.         je      movs_address_32bit
  3293.         cmp     [code_type],64
  3294.         jne     invalid_address_size
  3295.         jmp     movs_store
  3296.       movs_address_32bit:
  3297.         call    address_32bit_prefix
  3298.         jmp     movs_store
  3299.       movs_address_16bit:
  3300.         cmp     [code_type],64
  3301.         je      invalid_address_size
  3302.         call    address_16bit_prefix
  3303.       movs_store:
  3304.         xor     ebx,ebx
  3305.         call    store_segment_prefix_if_necessary
  3306.         mov     al,0A4h
  3307.       movs_check_size:
  3308.         mov     bl,[operand_size]
  3309.         cmp     bl,1
  3310.         je      simple_instruction
  3311.         inc     al
  3312.         cmp     bl,2
  3313.         je      simple_instruction_16bit
  3314.         cmp     bl,4
  3315.         je      simple_instruction_32bit
  3316.         cmp     bl,8
  3317.         je      simple_instruction_64bit
  3318.         or      bl,bl
  3319.         jnz     invalid_operand_size
  3320.         call    recoverable_unknown_size
  3321.         jmp     simple_instruction
  3322. lods_instruction:
  3323.         lods    byte [esi]
  3324.         call    get_size_operator
  3325.         cmp     al,'['
  3326.         jne     invalid_operand
  3327.         call    get_address
  3328.         or      eax,eax
  3329.         jnz     invalid_address
  3330.         or      bl,ch
  3331.         jnz     invalid_address
  3332.         cmp     bh,26h
  3333.         je      lods_address_16bit
  3334.         cmp     bh,46h
  3335.         je      lods_address_32bit
  3336.         cmp     bh,86h
  3337.         jne     invalid_address
  3338.         cmp     [code_type],64
  3339.         jne     invalid_address_size
  3340.         jmp     lods_store
  3341.       lods_address_32bit:
  3342.         call    address_32bit_prefix
  3343.         jmp     lods_store
  3344.       lods_address_16bit:
  3345.         cmp     [code_type],64
  3346.         je      invalid_address_size
  3347.         call    address_16bit_prefix
  3348.       lods_store:
  3349.         xor     ebx,ebx
  3350.         call    store_segment_prefix_if_necessary
  3351.         mov     al,0ACh
  3352.         jmp     movs_check_size
  3353. stos_instruction:
  3354.         mov     [base_code],al
  3355.         lods    byte [esi]
  3356.         call    get_size_operator
  3357.         cmp     al,'['
  3358.         jne     invalid_operand
  3359.         call    get_address
  3360.         or      eax,eax
  3361.         jnz     invalid_address
  3362.         or      bl,ch
  3363.         jnz     invalid_address
  3364.         cmp     bh,27h
  3365.         je      stos_address_16bit
  3366.         cmp     bh,47h
  3367.         je      stos_address_32bit
  3368.         cmp     bh,87h
  3369.         jne     invalid_address
  3370.         cmp     [code_type],64
  3371.         jne     invalid_address_size
  3372.         jmp     stos_store
  3373.       stos_address_32bit:
  3374.         call    address_32bit_prefix
  3375.         jmp     stos_store
  3376.       stos_address_16bit:
  3377.         cmp     [code_type],64
  3378.         je      invalid_address_size
  3379.         call    address_16bit_prefix
  3380.       stos_store:
  3381.         cmp     [segment_register],1
  3382.         ja      invalid_address
  3383.         mov     al,[base_code]
  3384.         jmp     movs_check_size
  3385. cmps_instruction:
  3386.         lods    byte [esi]
  3387.         call    get_size_operator
  3388.         cmp     al,'['
  3389.         jne     invalid_operand
  3390.         call    get_address
  3391.         or      eax,eax
  3392.         jnz     invalid_address
  3393.         or      bl,ch
  3394.         jnz     invalid_address
  3395.         mov     al,[segment_register]
  3396.         push    eax ebx
  3397.         lods    byte [esi]
  3398.         cmp     al,','
  3399.         jne     invalid_operand
  3400.         lods    byte [esi]
  3401.         call    get_size_operator
  3402.         cmp     al,'['
  3403.         jne     invalid_operand
  3404.         call    get_address
  3405.         or      eax,eax
  3406.         jnz     invalid_address
  3407.         or      bl,ch
  3408.         jnz     invalid_address
  3409.         pop     edx eax
  3410.         cmp     [segment_register],1
  3411.         ja      invalid_address
  3412.         mov     [segment_register],al
  3413.         mov     al,dh
  3414.         mov     ah,bh
  3415.         shr     al,4
  3416.         shr     ah,4
  3417.         cmp     al,ah
  3418.         jne     address_sizes_do_not_agree
  3419.         and     bh,111b
  3420.         and     dh,111b
  3421.         cmp     bh,7
  3422.         jne     invalid_address
  3423.         cmp     dh,6
  3424.         jne     invalid_address
  3425.         cmp     al,2
  3426.         je      cmps_address_16bit
  3427.         cmp     al,4
  3428.         je      cmps_address_32bit
  3429.         cmp     [code_type],64
  3430.         jne     invalid_address_size
  3431.         jmp     cmps_store
  3432.       cmps_address_32bit:
  3433.         call    address_32bit_prefix
  3434.         jmp     cmps_store
  3435.       cmps_address_16bit:
  3436.         cmp     [code_type],64
  3437.         je      invalid_address_size
  3438.         call    address_16bit_prefix
  3439.       cmps_store:
  3440.         xor     ebx,ebx
  3441.         call    store_segment_prefix_if_necessary
  3442.         mov     al,0A6h
  3443.         jmp     movs_check_size
  3444. ins_instruction:
  3445.         lods    byte [esi]
  3446.         call    get_size_operator
  3447.         cmp     al,'['
  3448.         jne     invalid_operand
  3449.         call    get_address
  3450.         or      eax,eax
  3451.         jnz     invalid_address
  3452.         or      bl,ch
  3453.         jnz     invalid_address
  3454.         cmp     bh,27h
  3455.         je      ins_address_16bit
  3456.         cmp     bh,47h
  3457.         je      ins_address_32bit
  3458.         cmp     bh,87h
  3459.         jne     invalid_address
  3460.         cmp     [code_type],64
  3461.         jne     invalid_address_size
  3462.         jmp     ins_store
  3463.       ins_address_32bit:
  3464.         call    address_32bit_prefix
  3465.         jmp     ins_store
  3466.       ins_address_16bit:
  3467.         cmp     [code_type],64
  3468.         je      invalid_address_size
  3469.         call    address_16bit_prefix
  3470.       ins_store:
  3471.         cmp     [segment_register],1
  3472.         ja      invalid_address
  3473.         lods    byte [esi]
  3474.         cmp     al,','
  3475.         jne     invalid_operand
  3476.         lods    byte [esi]
  3477.         cmp     al,10h
  3478.         jne     invalid_operand
  3479.         lods    byte [esi]
  3480.         cmp     al,22h
  3481.         jne     invalid_operand
  3482.         mov     al,6Ch
  3483.       ins_check_size:
  3484.         cmp     [operand_size],8
  3485.         jne     movs_check_size
  3486.         jmp     invalid_operand_size
  3487. outs_instruction:
  3488.         lods    byte [esi]
  3489.         cmp     al,10h
  3490.         jne     invalid_operand
  3491.         lods    byte [esi]
  3492.         cmp     al,22h
  3493.         jne     invalid_operand
  3494.         lods    byte [esi]
  3495.         cmp     al,','
  3496.         jne     invalid_operand
  3497.         lods    byte [esi]
  3498.         call    get_size_operator
  3499.         cmp     al,'['
  3500.         jne     invalid_operand
  3501.         call    get_address
  3502.         or      eax,eax
  3503.         jnz     invalid_address
  3504.         or      bl,ch
  3505.         jnz     invalid_address
  3506.         cmp     bh,26h
  3507.         je      outs_address_16bit
  3508.         cmp     bh,46h
  3509.         je      outs_address_32bit
  3510.         cmp     bh,86h
  3511.         jne     invalid_address
  3512.         cmp     [code_type],64
  3513.         jne     invalid_address_size
  3514.         jmp     outs_store
  3515.       outs_address_32bit:
  3516.         call    address_32bit_prefix
  3517.         jmp     outs_store
  3518.       outs_address_16bit:
  3519.         cmp     [code_type],64
  3520.         je      invalid_address_size
  3521.         call    address_16bit_prefix
  3522.       outs_store:
  3523.         xor     ebx,ebx
  3524.         call    store_segment_prefix_if_necessary
  3525.         mov     al,6Eh
  3526.         jmp     ins_check_size
  3527. xlat_instruction:
  3528.         lods    byte [esi]
  3529.         call    get_size_operator
  3530.         cmp     al,'['
  3531.         jne     invalid_operand
  3532.         call    get_address
  3533.         or      eax,eax
  3534.         jnz     invalid_address
  3535.         or      bl,ch
  3536.         jnz     invalid_address
  3537.         cmp     bh,23h
  3538.         je      xlat_address_16bit
  3539.         cmp     bh,43h
  3540.         je      xlat_address_32bit
  3541.         cmp     bh,83h
  3542.         jne     invalid_address
  3543.         cmp     [code_type],64
  3544.         jne     invalid_address_size
  3545.         jmp     xlat_store
  3546.       xlat_address_32bit:
  3547.         call    address_32bit_prefix
  3548.         jmp     xlat_store
  3549.       xlat_address_16bit:
  3550.         cmp     [code_type],64
  3551.         je      invalid_address_size
  3552.         call    address_16bit_prefix
  3553.       xlat_store:
  3554.         call    store_segment_prefix_if_necessary
  3555.         mov     al,0D7h
  3556.         cmp     [operand_size],1
  3557.         jbe     simple_instruction
  3558.         jmp     invalid_operand_size
  3559.  
  3560. pm_word_instruction:
  3561.         mov     ah,al
  3562.         shr     ah,4
  3563.         and     al,111b
  3564.         mov     [base_code],0Fh
  3565.         mov     [extended_code],ah
  3566.         mov     [postbyte_register],al
  3567.         lods    byte [esi]
  3568.         call    get_size_operator
  3569.         cmp     al,10h
  3570.         je      pm_reg
  3571.       pm_mem:
  3572.         cmp     al,'['
  3573.         jne     invalid_operand
  3574.         call    get_address
  3575.         mov     al,[operand_size]
  3576.         cmp     al,2
  3577.         je      pm_mem_store
  3578.         or      al,al
  3579.         jnz     invalid_operand_size
  3580.       pm_mem_store:
  3581.         jmp     instruction_ready
  3582.       pm_reg:
  3583.         lods    byte [esi]
  3584.         call    convert_register
  3585.         mov     bl,al
  3586.         cmp     ah,2
  3587.         jne     invalid_operand_size
  3588.         jmp     nomem_instruction_ready
  3589. pm_store_word_instruction:
  3590.         mov     ah,al
  3591.         shr     ah,4
  3592.         and     al,111b
  3593.         mov     [base_code],0Fh
  3594.         mov     [extended_code],ah
  3595.         mov     [postbyte_register],al
  3596.         lods    byte [esi]
  3597.         call    get_size_operator
  3598.         cmp     al,10h
  3599.         jne     pm_mem
  3600.         lods    byte [esi]
  3601.         call    convert_register
  3602.         mov     bl,al
  3603.         mov     al,ah
  3604.         call    operand_autodetect
  3605.         jmp     nomem_instruction_ready
  3606. lgdt_instruction:
  3607.         mov     [base_code],0Fh
  3608.         mov     [extended_code],1
  3609.         mov     [postbyte_register],al
  3610.         lods    byte [esi]
  3611.         call    get_size_operator
  3612.         cmp     al,'['
  3613.         jne     invalid_operand
  3614.         call    get_address
  3615.         mov     al,[operand_size]
  3616.         cmp     al,6
  3617.         je      lgdt_mem_48bit
  3618.         cmp     al,10
  3619.         je      lgdt_mem_80bit
  3620.         or      al,al
  3621.         jnz     invalid_operand_size
  3622.         jmp     lgdt_mem_store
  3623.       lgdt_mem_80bit:
  3624.         cmp     [code_type],64
  3625.         jne     illegal_instruction
  3626.         jmp     lgdt_mem_store
  3627.       lgdt_mem_48bit:
  3628.         cmp     [code_type],64
  3629.         je      illegal_instruction
  3630.         cmp     [postbyte_register],2
  3631.         jb      lgdt_mem_store
  3632.         call    operand_32bit
  3633.       lgdt_mem_store:
  3634.         jmp     instruction_ready
  3635. lar_instruction:
  3636.         mov     [extended_code],al
  3637.         mov     [base_code],0Fh
  3638.         call    take_register
  3639.         mov     [postbyte_register],al
  3640.         lods    byte [esi]
  3641.         cmp     al,','
  3642.         jne     invalid_operand
  3643.         xor     al,al
  3644.         xchg    al,[operand_size]
  3645.         call    operand_autodetect
  3646.         lods    byte [esi]
  3647.         call    get_size_operator
  3648.         cmp     al,10h
  3649.         je      lar_reg_reg
  3650.         cmp     al,'['
  3651.         jne     invalid_operand
  3652.         call    get_address
  3653.         mov     al,[operand_size]
  3654.         or      al,al
  3655.         jz      lar_reg_mem
  3656.         cmp     al,2
  3657.         jne     invalid_operand_size
  3658.       lar_reg_mem:
  3659.         jmp     instruction_ready
  3660.       lar_reg_reg:
  3661.         lods    byte [esi]
  3662.         call    convert_register
  3663.         cmp     ah,2
  3664.         jne     invalid_operand_size
  3665.         mov     bl,al
  3666.         jmp     nomem_instruction_ready
  3667. invlpg_instruction:
  3668.         mov     [base_code],0Fh
  3669.         mov     [extended_code],1
  3670.         mov     [postbyte_register],7
  3671.         lods    byte [esi]
  3672.         call    get_size_operator
  3673.         cmp     al,'['
  3674.         jne     invalid_operand
  3675.         call    get_address
  3676.         jmp     instruction_ready
  3677. simple_instruction_f2_0f_01:
  3678.         mov     byte [edi],0F2h
  3679.         inc     edi
  3680.         jmp     simple_instruction_0f_01
  3681. simple_instruction_f3_0f_01:
  3682.         mov     byte [edi],0F3h
  3683.         inc     edi
  3684.         jmp     simple_instruction_0f_01
  3685. swapgs_instruction:
  3686.         cmp     [code_type],64
  3687.         jne     illegal_instruction
  3688. simple_instruction_0f_01:
  3689.         mov     ah,al
  3690.         mov     al,0Fh
  3691.         stos    byte [edi]
  3692.         mov     al,1
  3693.         stos    word [edi]
  3694.         jmp     instruction_assembled
  3695.  
  3696. basic_486_instruction:
  3697.         mov     [base_code],0Fh
  3698.         mov     [extended_code],al
  3699.         lods    byte [esi]
  3700.         call    get_size_operator
  3701.         cmp     al,10h
  3702.         je      basic_486_reg
  3703.         cmp     al,'['
  3704.         jne     invalid_operand
  3705.         call    get_address
  3706.         push    edx ebx ecx
  3707.         lods    byte [esi]
  3708.         cmp     al,','
  3709.         jne     invalid_operand
  3710.         call    take_register
  3711.         mov     [postbyte_register],al
  3712.         pop     ecx ebx edx
  3713.         mov     al,ah
  3714.         cmp     al,1
  3715.         je      basic_486_mem_reg_8bit
  3716.         call    operand_autodetect
  3717.         inc     [extended_code]
  3718.       basic_486_mem_reg_8bit:
  3719.         jmp     instruction_ready
  3720.       basic_486_reg:
  3721.         lods    byte [esi]
  3722.         call    convert_register
  3723.         mov     [postbyte_register],al
  3724.         lods    byte [esi]
  3725.         cmp     al,','
  3726.         jne     invalid_operand
  3727.         call    take_register
  3728.         mov     bl,al
  3729.         xchg    bl,[postbyte_register]
  3730.         mov     al,ah
  3731.         cmp     al,1
  3732.         je      basic_486_reg_reg_8bit
  3733.         call    operand_autodetect
  3734.         inc     [extended_code]
  3735.       basic_486_reg_reg_8bit:
  3736.         jmp     nomem_instruction_ready
  3737. bswap_instruction:
  3738.         call    take_register
  3739.         test    al,1000b
  3740.         jz      bswap_reg_code_ok
  3741.         or      [rex_prefix],41h
  3742.         and     al,111b
  3743.       bswap_reg_code_ok:
  3744.         add     al,0C8h
  3745.         mov     [extended_code],al
  3746.         mov     [base_code],0Fh
  3747.         cmp     ah,8
  3748.         je      bswap_reg64
  3749.         cmp     ah,4
  3750.         jne     invalid_operand_size
  3751.         call    operand_32bit
  3752.         call    store_classic_instruction_code
  3753.         jmp     instruction_assembled
  3754.       bswap_reg64:
  3755.         call    operand_64bit
  3756.         call    store_classic_instruction_code
  3757.         jmp     instruction_assembled
  3758. cmpxchgx_instruction:
  3759.         mov     [base_code],0Fh
  3760.         mov     [extended_code],0C7h
  3761.         mov     [postbyte_register],al
  3762.         lods    byte [esi]
  3763.         call    get_size_operator
  3764.         cmp     al,'['
  3765.         jne     invalid_operand
  3766.         call    get_address
  3767.         mov     ah,1
  3768.         xchg    [postbyte_register],ah
  3769.         mov     al,[operand_size]
  3770.         or      al,al
  3771.         jz      cmpxchgx_size_ok
  3772.         cmp     al,ah
  3773.         jne     invalid_operand_size
  3774.       cmpxchgx_size_ok:
  3775.         cmp     ah,16
  3776.         jne     cmpxchgx_store
  3777.         call    operand_64bit
  3778.       cmpxchgx_store:
  3779.         jmp     instruction_ready
  3780. nop_instruction:
  3781.         mov     ah,[esi]
  3782.         cmp     ah,10h
  3783.         je      extended_nop
  3784.         cmp     ah,11h
  3785.         je      extended_nop
  3786.         cmp     ah,'['
  3787.         je      extended_nop
  3788.         stos    byte [edi]
  3789.         jmp     instruction_assembled
  3790.       extended_nop:
  3791.         mov     [base_code],0Fh
  3792.         mov     [extended_code],1Fh
  3793.         mov     [postbyte_register],0
  3794.         lods    byte [esi]
  3795.         call    get_size_operator
  3796.         cmp     al,10h
  3797.         je      extended_nop_reg
  3798.         cmp     al,'['
  3799.         jne     invalid_operand
  3800.         call    get_address
  3801.         mov     al,[operand_size]
  3802.         or      al,al
  3803.         jz      extended_nop_store
  3804.         call    operand_autodetect
  3805.       extended_nop_store:
  3806.         jmp     instruction_ready
  3807.       extended_nop_reg:
  3808.         lods    byte [esi]
  3809.         call    convert_register
  3810.         mov     bl,al
  3811.         mov     al,ah
  3812.         call    operand_autodetect
  3813.         jmp     nomem_instruction_ready
  3814.  
  3815. basic_fpu_instruction:
  3816.         mov     [postbyte_register],al
  3817.         mov     [base_code],0D8h
  3818.         lods    byte [esi]
  3819.         call    get_size_operator
  3820.         cmp     al,10h
  3821.         je      basic_fpu_streg
  3822.         cmp     al,'['
  3823.         je      basic_fpu_mem
  3824.         dec     esi
  3825.         mov     ah,[postbyte_register]
  3826.         cmp     ah,2
  3827.         jb      invalid_operand
  3828.         cmp     ah,3
  3829.         ja      invalid_operand
  3830.         mov     bl,1
  3831.         jmp     nomem_instruction_ready
  3832.       basic_fpu_mem:
  3833.         call    get_address
  3834.         mov     al,[operand_size]
  3835.         cmp     al,4
  3836.         je      basic_fpu_mem_32bit
  3837.         cmp     al,8
  3838.         je      basic_fpu_mem_64bit
  3839.         or      al,al
  3840.         jnz     invalid_operand_size
  3841.         call    recoverable_unknown_size
  3842.       basic_fpu_mem_32bit:
  3843.         jmp     instruction_ready
  3844.       basic_fpu_mem_64bit:
  3845.         mov     [base_code],0DCh
  3846.         jmp     instruction_ready
  3847.       basic_fpu_streg:
  3848.         lods    byte [esi]
  3849.         call    convert_fpu_register
  3850.         mov     bl,al
  3851.         mov     ah,[postbyte_register]
  3852.         cmp     ah,2
  3853.         je      basic_fpu_single_streg
  3854.         cmp     ah,3
  3855.         je      basic_fpu_single_streg
  3856.         or      al,al
  3857.         jz      basic_fpu_st0
  3858.         test    ah,110b
  3859.         jz      basic_fpu_streg_st0
  3860.         xor     [postbyte_register],1
  3861.       basic_fpu_streg_st0:
  3862.         lods    byte [esi]
  3863.         cmp     al,','
  3864.         jne     invalid_operand
  3865.         lods    byte [esi]
  3866.         call    get_size_operator
  3867.         cmp     al,10h
  3868.         jne     invalid_operand
  3869.         lods    byte [esi]
  3870.         call    convert_fpu_register
  3871.         or      al,al
  3872.         jnz     invalid_operand
  3873.         mov     [base_code],0DCh
  3874.         jmp     nomem_instruction_ready
  3875.       basic_fpu_st0:
  3876.         lods    byte [esi]
  3877.         cmp     al,','
  3878.         jne     invalid_operand
  3879.         lods    byte [esi]
  3880.         call    get_size_operator
  3881.         cmp     al,10h
  3882.         jne     invalid_operand
  3883.         lods    byte [esi]
  3884.         call    convert_fpu_register
  3885.         mov     bl,al
  3886.       basic_fpu_single_streg:
  3887.         mov     [base_code],0D8h
  3888.         jmp     nomem_instruction_ready
  3889. simple_fpu_instruction:
  3890.         mov     ah,al
  3891.         or      ah,11000000b
  3892.         mov     al,0D9h
  3893.         stos    word [edi]
  3894.         jmp     instruction_assembled
  3895. fi_instruction:
  3896.         mov     [postbyte_register],al
  3897.         lods    byte [esi]
  3898.         call    get_size_operator
  3899.         cmp     al,'['
  3900.         jne     invalid_operand
  3901.         call    get_address
  3902.         mov     al,[operand_size]
  3903.         cmp     al,2
  3904.         je      fi_mem_16bit
  3905.         cmp     al,4
  3906.         je      fi_mem_32bit
  3907.         or      al,al
  3908.         jnz     invalid_operand_size
  3909.         call    recoverable_unknown_size
  3910.       fi_mem_32bit:
  3911.         mov     [base_code],0DAh
  3912.         jmp     instruction_ready
  3913.       fi_mem_16bit:
  3914.         mov     [base_code],0DEh
  3915.         jmp     instruction_ready
  3916. fld_instruction:
  3917.         mov     [postbyte_register],al
  3918.         lods    byte [esi]
  3919.         call    get_size_operator
  3920.         cmp     al,10h
  3921.         je      fld_streg
  3922.         cmp     al,'['
  3923.         jne     invalid_operand
  3924.         call    get_address
  3925.         mov     al,[operand_size]
  3926.         cmp     al,4
  3927.         je      fld_mem_32bit
  3928.         cmp     al,8
  3929.         je      fld_mem_64bit
  3930.         cmp     al,10
  3931.         je      fld_mem_80bit
  3932.         or      al,al
  3933.         jnz     invalid_operand_size
  3934.         call    recoverable_unknown_size
  3935.       fld_mem_32bit:
  3936.         mov     [base_code],0D9h
  3937.         jmp     instruction_ready
  3938.       fld_mem_64bit:
  3939.         mov     [base_code],0DDh
  3940.         jmp     instruction_ready
  3941.       fld_mem_80bit:
  3942.         mov     al,[postbyte_register]
  3943.         cmp     al,0
  3944.         je      fld_mem_80bit_store
  3945.         dec     [postbyte_register]
  3946.         cmp     al,3
  3947.         je      fld_mem_80bit_store
  3948.         jmp     invalid_operand_size
  3949.       fld_mem_80bit_store:
  3950.         add     [postbyte_register],5
  3951.         mov     [base_code],0DBh
  3952.         jmp     instruction_ready
  3953.       fld_streg:
  3954.         lods    byte [esi]
  3955.         call    convert_fpu_register
  3956.         mov     bl,al
  3957.         cmp     [postbyte_register],2
  3958.         jae     fst_streg
  3959.         mov     [base_code],0D9h
  3960.         jmp     nomem_instruction_ready
  3961.       fst_streg:
  3962.         mov     [base_code],0DDh
  3963.         jmp     nomem_instruction_ready
  3964. fild_instruction:
  3965.         mov     [postbyte_register],al
  3966.         lods    byte [esi]
  3967.         call    get_size_operator
  3968.         cmp     al,'['
  3969.         jne     invalid_operand
  3970.         call    get_address
  3971.         mov     al,[operand_size]
  3972.         cmp     al,2
  3973.         je      fild_mem_16bit
  3974.         cmp     al,4
  3975.         je      fild_mem_32bit
  3976.         cmp     al,8
  3977.         je      fild_mem_64bit
  3978.         or      al,al
  3979.         jnz     invalid_operand_size
  3980.         call    recoverable_unknown_size
  3981.       fild_mem_32bit:
  3982.         mov     [base_code],0DBh
  3983.         jmp     instruction_ready
  3984.       fild_mem_16bit:
  3985.         mov     [base_code],0DFh
  3986.         jmp     instruction_ready
  3987.       fild_mem_64bit:
  3988.         mov     al,[postbyte_register]
  3989.         cmp     al,1
  3990.         je      fisttp_64bit_store
  3991.         jb      fild_mem_64bit_store
  3992.         dec     [postbyte_register]
  3993.         cmp     al,3
  3994.         je      fild_mem_64bit_store
  3995.         jmp     invalid_operand_size
  3996.       fild_mem_64bit_store:
  3997.         add     [postbyte_register],5
  3998.         mov     [base_code],0DFh
  3999.         jmp     instruction_ready
  4000.       fisttp_64bit_store:
  4001.         mov     [base_code],0DDh
  4002.         jmp     instruction_ready
  4003. fbld_instruction:
  4004.         mov     [postbyte_register],al
  4005.         lods    byte [esi]
  4006.         call    get_size_operator
  4007.         cmp     al,'['
  4008.         jne     invalid_operand
  4009.         call    get_address
  4010.         mov     al,[operand_size]
  4011.         or      al,al
  4012.         jz      fbld_mem_80bit
  4013.         cmp     al,10
  4014.         je      fbld_mem_80bit
  4015.         jmp     invalid_operand_size
  4016.       fbld_mem_80bit:
  4017.         mov     [base_code],0DFh
  4018.         jmp     instruction_ready
  4019. faddp_instruction:
  4020.         mov     [postbyte_register],al
  4021.         mov     [base_code],0DEh
  4022.         mov     edx,esi
  4023.         lods    byte [esi]
  4024.         call    get_size_operator
  4025.         cmp     al,10h
  4026.         je      faddp_streg
  4027.         mov     esi,edx
  4028.         mov     bl,1
  4029.         jmp     nomem_instruction_ready
  4030.       faddp_streg:
  4031.         lods    byte [esi]
  4032.         call    convert_fpu_register
  4033.         mov     bl,al
  4034.         lods    byte [esi]
  4035.         cmp     al,','
  4036.         jne     invalid_operand
  4037.         lods    byte [esi]
  4038.         call    get_size_operator
  4039.         cmp     al,10h
  4040.         jne     invalid_operand
  4041.         lods    byte [esi]
  4042.         call    convert_fpu_register
  4043.         or      al,al
  4044.         jnz     invalid_operand
  4045.         jmp     nomem_instruction_ready
  4046. fcompp_instruction:
  4047.         mov     ax,0D9DEh
  4048.         stos    word [edi]
  4049.         jmp     instruction_assembled
  4050. fucompp_instruction:
  4051.         mov     ax,0E9DAh
  4052.         stos    word [edi]
  4053.         jmp     instruction_assembled
  4054. fxch_instruction:
  4055.         mov     dx,01D9h
  4056.         jmp     fpu_single_operand
  4057. ffreep_instruction:
  4058.         mov     dx,00DFh
  4059.         jmp     fpu_single_operand
  4060. ffree_instruction:
  4061.         mov     dl,0DDh
  4062.         mov     dh,al
  4063.       fpu_single_operand:
  4064.         mov     ebx,esi
  4065.         lods    byte [esi]
  4066.         call    get_size_operator
  4067.         cmp     al,10h
  4068.         je      fpu_streg
  4069.         or      dh,dh
  4070.         jz      invalid_operand
  4071.         mov     esi,ebx
  4072.         shl     dh,3
  4073.         or      dh,11000001b
  4074.         mov     ax,dx
  4075.         stos    word [edi]
  4076.         jmp     instruction_assembled
  4077.       fpu_streg:
  4078.         lods    byte [esi]
  4079.         call    convert_fpu_register
  4080.         shl     dh,3
  4081.         or      dh,al
  4082.         or      dh,11000000b
  4083.         mov     ax,dx
  4084.         stos    word [edi]
  4085.         jmp     instruction_assembled
  4086.  
  4087. fstenv_instruction:
  4088.         mov     byte [edi],9Bh
  4089.         inc     edi
  4090. fldenv_instruction:
  4091.         mov     [base_code],0D9h
  4092.         jmp     fpu_mem
  4093. fstenv_instruction_16bit:
  4094.         mov     byte [edi],9Bh
  4095.         inc     edi
  4096. fldenv_instruction_16bit:
  4097.         call    operand_16bit
  4098.         jmp     fldenv_instruction
  4099. fstenv_instruction_32bit:
  4100.         mov     byte [edi],9Bh
  4101.         inc     edi
  4102. fldenv_instruction_32bit:
  4103.         call    operand_32bit
  4104.         jmp     fldenv_instruction
  4105. fsave_instruction_32bit:
  4106.         mov     byte [edi],9Bh
  4107.         inc     edi
  4108. fnsave_instruction_32bit:
  4109.         call    operand_32bit
  4110.         jmp     fnsave_instruction
  4111. fsave_instruction_16bit:
  4112.         mov     byte [edi],9Bh
  4113.         inc     edi
  4114. fnsave_instruction_16bit:
  4115.         call    operand_16bit
  4116.         jmp     fnsave_instruction
  4117. fsave_instruction:
  4118.         mov     byte [edi],9Bh
  4119.         inc     edi
  4120. fnsave_instruction:
  4121.         mov     [base_code],0DDh
  4122.       fpu_mem:
  4123.         mov     [postbyte_register],al
  4124.         lods    byte [esi]
  4125.         call    get_size_operator
  4126.         cmp     al,'['
  4127.         jne     invalid_operand
  4128.         call    get_address
  4129.         cmp     [operand_size],0
  4130.         jne     invalid_operand_size
  4131.         jmp     instruction_ready
  4132. fstcw_instruction:
  4133.         mov     byte [edi],9Bh
  4134.         inc     edi
  4135. fldcw_instruction:
  4136.         mov     [postbyte_register],al
  4137.         mov     [base_code],0D9h
  4138.         lods    byte [esi]
  4139.         call    get_size_operator
  4140.         cmp     al,'['
  4141.         jne     invalid_operand
  4142.         call    get_address
  4143.         mov     al,[operand_size]
  4144.         or      al,al
  4145.         jz      fldcw_mem_16bit
  4146.         cmp     al,2
  4147.         je      fldcw_mem_16bit
  4148.         jmp     invalid_operand_size
  4149.       fldcw_mem_16bit:
  4150.         jmp     instruction_ready
  4151. fstsw_instruction:
  4152.         mov     al,9Bh
  4153.         stos    byte [edi]
  4154. fnstsw_instruction:
  4155.         mov     [base_code],0DDh
  4156.         mov     [postbyte_register],7
  4157.         lods    byte [esi]
  4158.         call    get_size_operator
  4159.         cmp     al,10h
  4160.         je      fstsw_reg
  4161.         cmp     al,'['
  4162.         jne     invalid_operand
  4163.         call    get_address
  4164.         mov     al,[operand_size]
  4165.         or      al,al
  4166.         jz      fstsw_mem_16bit
  4167.         cmp     al,2
  4168.         je      fstsw_mem_16bit
  4169.         jmp     invalid_operand_size
  4170.       fstsw_mem_16bit:
  4171.         jmp     instruction_ready
  4172.       fstsw_reg:
  4173.         lods    byte [esi]
  4174.         call    convert_register
  4175.         cmp     ax,0200h
  4176.         jne     invalid_operand
  4177.         mov     ax,0E0DFh
  4178.         stos    word [edi]
  4179.         jmp     instruction_assembled
  4180. finit_instruction:
  4181.         mov     byte [edi],9Bh
  4182.         inc     edi
  4183. fninit_instruction:
  4184.         mov     ah,al
  4185.         mov     al,0DBh
  4186.         stos    word [edi]
  4187.         jmp     instruction_assembled
  4188. fcmov_instruction:
  4189.         mov     dh,0DAh
  4190.         jmp     fcomi_streg
  4191. fcomi_instruction:
  4192.         mov     dh,0DBh
  4193.         jmp     fcomi_streg
  4194. fcomip_instruction:
  4195.         mov     dh,0DFh
  4196.       fcomi_streg:
  4197.         mov     dl,al
  4198.         lods    byte [esi]
  4199.         call    get_size_operator
  4200.         cmp     al,10h
  4201.         jne     invalid_operand
  4202.         lods    byte [esi]
  4203.         call    convert_fpu_register
  4204.         mov     ah,al
  4205.         cmp     byte [esi],','
  4206.         je      fcomi_st0_streg
  4207.         add     ah,dl
  4208.         mov     al,dh
  4209.         stos    word [edi]
  4210.         jmp     instruction_assembled
  4211.       fcomi_st0_streg:
  4212.         or      ah,ah
  4213.         jnz     invalid_operand
  4214.         inc     esi
  4215.         lods    byte [esi]
  4216.         call    get_size_operator
  4217.         cmp     al,10h
  4218.         jne     invalid_operand
  4219.         lods    byte [esi]
  4220.         call    convert_fpu_register
  4221.         mov     ah,al
  4222.         add     ah,dl
  4223.         mov     al,dh
  4224.         stos    word [edi]
  4225.         jmp     instruction_assembled
  4226.  
  4227. basic_mmx_instruction:
  4228.         mov     [base_code],0Fh
  4229.         mov     [extended_code],al
  4230.       mmx_instruction:
  4231.         lods    byte [esi]
  4232.         call    get_size_operator
  4233.         cmp     al,10h
  4234.         jne     invalid_operand
  4235.         lods    byte [esi]
  4236.         call    convert_mmx_register
  4237.         call    make_mmx_prefix
  4238.         mov     [postbyte_register],al
  4239.         lods    byte [esi]
  4240.         cmp     al,','
  4241.         jne     invalid_operand
  4242.         lods    byte [esi]
  4243.         call    get_size_operator
  4244.         cmp     al,10h
  4245.         je      mmx_mmreg_mmreg
  4246.         cmp     al,'['
  4247.         jne     invalid_operand
  4248.       mmx_mmreg_mem:
  4249.         call    get_address
  4250.         jmp     instruction_ready
  4251.       mmx_mmreg_mmreg:
  4252.         lods    byte [esi]
  4253.         call    convert_mmx_register
  4254.         mov     bl,al
  4255.         jmp     nomem_instruction_ready
  4256. mmx_bit_shift_instruction:
  4257.         mov     [base_code],0Fh
  4258.         mov     [extended_code],al
  4259.         lods    byte [esi]
  4260.         call    get_size_operator
  4261.         cmp     al,10h
  4262.         jne     invalid_operand
  4263.         lods    byte [esi]
  4264.         call    convert_mmx_register
  4265.         call    make_mmx_prefix
  4266.         mov     [postbyte_register],al
  4267.         lods    byte [esi]
  4268.         cmp     al,','
  4269.         jne     invalid_operand
  4270.         mov     [operand_size],0
  4271.         lods    byte [esi]
  4272.         call    get_size_operator
  4273.         cmp     al,10h
  4274.         je      mmx_mmreg_mmreg
  4275.         cmp     al,'('
  4276.         je      mmx_ps_mmreg_imm8
  4277.         cmp     al,'['
  4278.         je      mmx_mmreg_mem
  4279.         jmp     invalid_operand
  4280.       mmx_ps_mmreg_imm8:
  4281.         call    get_byte_value
  4282.         mov     byte [value],al
  4283.         test    [operand_size],not 1
  4284.         jnz     invalid_value
  4285.         mov     bl,[extended_code]
  4286.         mov     al,bl
  4287.         shr     bl,4
  4288.         and     al,1111b
  4289.         add     al,70h
  4290.         mov     [extended_code],al
  4291.         sub     bl,0Ch
  4292.         shl     bl,1
  4293.         xchg    bl,[postbyte_register]
  4294.         call    store_nomem_instruction
  4295.         mov     al,byte [value]
  4296.         stos    byte [edi]
  4297.         jmp     instruction_assembled
  4298. pmovmskb_instruction:
  4299.         mov     [base_code],0Fh
  4300.         mov     [extended_code],al
  4301.         call    take_register
  4302.         cmp     ah,4
  4303.         je      pmovmskb_reg_size_ok
  4304.         cmp     [code_type],64
  4305.         jne     invalid_operand_size
  4306.         cmp     ah,8
  4307.         jnz     invalid_operand_size
  4308.       pmovmskb_reg_size_ok:
  4309.         mov     [postbyte_register],al
  4310.         mov     [operand_size],0
  4311.         lods    byte [esi]
  4312.         cmp     al,','
  4313.         jne     invalid_operand
  4314.         lods    byte [esi]
  4315.         call    get_size_operator
  4316.         cmp     al,10h
  4317.         jne     invalid_operand
  4318.         lods    byte [esi]
  4319.         call    convert_mmx_register
  4320.         mov     bl,al
  4321.         call    make_mmx_prefix
  4322.         cmp     [extended_code],0C5h
  4323.         je      mmx_nomem_imm8
  4324.         jmp     nomem_instruction_ready
  4325.       mmx_imm8:
  4326.         push    ebx ecx edx
  4327.         xor     cl,cl
  4328.         xchg    cl,[operand_size]
  4329.         lods    byte [esi]
  4330.         cmp     al,','
  4331.         jne     invalid_operand
  4332.         lods    byte [esi]
  4333.         call    get_size_operator
  4334.         test    ah,not 1
  4335.         jnz     invalid_operand_size
  4336.         mov     [operand_size],cl
  4337.         cmp     al,'('
  4338.         jne     invalid_operand
  4339.         call    get_byte_value
  4340.         mov     byte [value],al
  4341.         pop     edx ecx ebx
  4342.         call    store_instruction_with_imm8
  4343.         jmp     instruction_assembled
  4344.       mmx_nomem_imm8:
  4345.         call    store_nomem_instruction
  4346.         call    append_imm8
  4347.         jmp     instruction_assembled
  4348.       append_imm8:
  4349.         mov     [operand_size],0
  4350.         lods    byte [esi]
  4351.         cmp     al,','
  4352.         jne     invalid_operand
  4353.         lods    byte [esi]
  4354.         call    get_size_operator
  4355.         test    ah,not 1
  4356.         jnz     invalid_operand_size
  4357.         cmp     al,'('
  4358.         jne     invalid_operand
  4359.         call    get_byte_value
  4360.         stosb
  4361.         ret
  4362. pinsrw_instruction:
  4363.         mov     [extended_code],al
  4364.         mov     [base_code],0Fh
  4365.         lods    byte [esi]
  4366.         call    get_size_operator
  4367.         cmp     al,10h
  4368.         jne     invalid_operand
  4369.         lods    byte [esi]
  4370.         call    convert_mmx_register
  4371.         call    make_mmx_prefix
  4372.         mov     [postbyte_register],al
  4373.         mov     [operand_size],0
  4374.         lods    byte [esi]
  4375.         cmp     al,','
  4376.         jne     invalid_operand
  4377.         lods    byte [esi]
  4378.         call    get_size_operator
  4379.         cmp     al,10h
  4380.         je      pinsrw_mmreg_reg
  4381.         cmp     al,'['
  4382.         jne     invalid_operand
  4383.         call    get_address
  4384.         cmp     [operand_size],0
  4385.         je      mmx_imm8
  4386.         cmp     [operand_size],2
  4387.         jne     invalid_operand_size
  4388.         jmp     mmx_imm8
  4389.       pinsrw_mmreg_reg:
  4390.         lods    byte [esi]
  4391.         call    convert_register
  4392.         cmp     ah,4
  4393.         jne     invalid_operand_size
  4394.         mov     bl,al
  4395.         jmp     mmx_nomem_imm8
  4396. pshufw_instruction:
  4397.         mov     [mmx_size],8
  4398.         mov     [opcode_prefix],al
  4399.         jmp     pshuf_instruction
  4400. pshufd_instruction:
  4401.         mov     [mmx_size],16
  4402.         mov     [opcode_prefix],al
  4403.       pshuf_instruction:
  4404.         mov     [base_code],0Fh
  4405.         mov     [extended_code],70h
  4406.         lods    byte [esi]
  4407.         call    get_size_operator
  4408.         cmp     al,10h
  4409.         jne     invalid_operand
  4410.         lods    byte [esi]
  4411.         call    convert_mmx_register
  4412.         cmp     ah,[mmx_size]
  4413.         jne     invalid_operand_size
  4414.         mov     [postbyte_register],al
  4415.         lods    byte [esi]
  4416.         cmp     al,','
  4417.         jne     invalid_operand
  4418.         lods    byte [esi]
  4419.         call    get_size_operator
  4420.         cmp     al,10h
  4421.         je      pshuf_mmreg_mmreg
  4422.         cmp     al,'['
  4423.         jne     invalid_operand
  4424.         call    get_address
  4425.         jmp     mmx_imm8
  4426.       pshuf_mmreg_mmreg:
  4427.         lods    byte [esi]
  4428.         call    convert_mmx_register
  4429.         mov     bl,al
  4430.         jmp     mmx_nomem_imm8
  4431. movd_instruction:
  4432.         mov     [base_code],0Fh
  4433.         mov     [extended_code],7Eh
  4434.         lods    byte [esi]
  4435.         call    get_size_operator
  4436.         cmp     al,10h
  4437.         je      movd_reg
  4438.         cmp     al,'['
  4439.         jne     invalid_operand
  4440.         call    get_address
  4441.         test    [operand_size],not 4
  4442.         jnz     invalid_operand_size
  4443.         call    get_mmx_source_register
  4444.         jmp     instruction_ready
  4445.       movd_reg:
  4446.         lods    byte [esi]
  4447.         cmp     al,0B0h
  4448.         jae     movd_mmreg
  4449.         call    convert_register
  4450.         cmp     ah,4
  4451.         jne     invalid_operand_size
  4452.         mov     bl,al
  4453.         call    get_mmx_source_register
  4454.         jmp     nomem_instruction_ready
  4455.       movd_mmreg:
  4456.         mov     [extended_code],6Eh
  4457.         call    convert_mmx_register
  4458.         mov     [postbyte_register],al
  4459.         call    make_mmx_prefix
  4460.         mov     [operand_size],0
  4461.         lods    byte [esi]
  4462.         cmp     al,','
  4463.         jne     invalid_operand
  4464.         lods    byte [esi]
  4465.         call    get_size_operator
  4466.         cmp     al,10h
  4467.         je      movd_mmreg_reg
  4468.         cmp     al,'['
  4469.         jne     invalid_operand
  4470.         call    get_address
  4471.         test    [operand_size],not 4
  4472.         jnz     invalid_operand_size
  4473.         jmp     instruction_ready
  4474.       movd_mmreg_reg:
  4475.         lods    byte [esi]
  4476.         call    convert_register
  4477.         cmp     ah,4
  4478.         jne     invalid_operand_size
  4479.         mov     bl,al
  4480.         jmp     nomem_instruction_ready
  4481.       get_mmx_source_register:
  4482.         mov     [operand_size],0
  4483.         lods    byte [esi]
  4484.         cmp     al,','
  4485.         jne     invalid_operand
  4486.         lods    byte [esi]
  4487.         call    get_size_operator
  4488.         cmp     al,10h
  4489.         jne     invalid_operand
  4490.         lods    byte [esi]
  4491.         call    convert_mmx_register
  4492.         mov     [postbyte_register],al
  4493.       make_mmx_prefix:
  4494.         cmp     [operand_size],16
  4495.         jne     no_mmx_prefix
  4496.         mov     [operand_prefix],66h
  4497.       no_mmx_prefix:
  4498.         ret
  4499. movq_instruction:
  4500.         mov     [base_code],0Fh
  4501.         lods    byte [esi]
  4502.         call    get_size_operator
  4503.         cmp     al,10h
  4504.         je      movq_reg
  4505.         cmp     al,'['
  4506.         jne     invalid_operand
  4507.         call    get_address
  4508.         test    [operand_size],not 8
  4509.         jnz     invalid_operand_size
  4510.         call    get_mmx_source_register
  4511.         mov     al,7Fh
  4512.         cmp     ah,8
  4513.         je      movq_mem_ready
  4514.         mov     al,0D6h
  4515.      movq_mem_ready:
  4516.         mov     [extended_code],al
  4517.         jmp     instruction_ready
  4518.      movq_reg:
  4519.         lods    byte [esi]
  4520.         cmp     al,0B0h
  4521.         jae     movq_mmreg
  4522.         call    convert_register
  4523.         cmp     ah,8
  4524.         jne     invalid_operand_size
  4525.         mov     bl,al
  4526.         mov     [extended_code],7Eh
  4527.         call    operand_64bit
  4528.         call    get_mmx_source_register
  4529.         jmp     nomem_instruction_ready
  4530.      movq_mmreg:
  4531.         call    convert_mmx_register
  4532.         mov     [postbyte_register],al
  4533.         mov     [extended_code],6Fh
  4534.         mov     [mmx_size],ah
  4535.         cmp     ah,16
  4536.         jne     movq_mmreg_
  4537.         mov     [extended_code],7Eh
  4538.         mov     [opcode_prefix],0F3h
  4539.       movq_mmreg_:
  4540.         lods    byte [esi]
  4541.         cmp     al,','
  4542.         jne     invalid_operand
  4543.         mov     [operand_size],0
  4544.         lods    byte [esi]
  4545.         call    get_size_operator
  4546.         cmp     al,10h
  4547.         je      movq_mmreg_reg
  4548.         cmp     al,'['
  4549.         jne     invalid_operand
  4550.         call    get_address
  4551.         test    [operand_size],not 8
  4552.         jnz     invalid_operand_size
  4553.         jmp     instruction_ready
  4554.       movq_mmreg_reg:
  4555.         lods    byte [esi]
  4556.         cmp     al,0B0h
  4557.         jae     movq_mmreg_mmreg
  4558.         mov     [operand_size],0
  4559.         call    convert_register
  4560.         cmp     ah,8
  4561.         jne     invalid_operand_size
  4562.         mov     [extended_code],6Eh
  4563.         mov     [opcode_prefix],0
  4564.         mov     bl,al
  4565.         cmp     [mmx_size],16
  4566.         jne     movq_mmreg_reg_store
  4567.         mov     [opcode_prefix],66h
  4568.       movq_mmreg_reg_store:
  4569.         call    operand_64bit
  4570.         jmp     nomem_instruction_ready
  4571.       movq_mmreg_mmreg:
  4572.         call    convert_mmx_register
  4573.         cmp     ah,[mmx_size]
  4574.         jne     invalid_operand_size
  4575.         mov     bl,al
  4576.         jmp     nomem_instruction_ready
  4577. movdq_instruction:
  4578.         mov     [opcode_prefix],al
  4579.         mov     [base_code],0Fh
  4580.         mov     [extended_code],6Fh
  4581.         lods    byte [esi]
  4582.         call    get_size_operator
  4583.         cmp     al,10h
  4584.         je      movdq_mmreg
  4585.         cmp     al,'['
  4586.         jne     invalid_operand
  4587.         call    get_address
  4588.         lods    byte [esi]
  4589.         cmp     al,','
  4590.         jne     invalid_operand
  4591.         lods    byte [esi]
  4592.         call    get_size_operator
  4593.         cmp     al,10h
  4594.         jne     invalid_operand
  4595.         lods    byte [esi]
  4596.         call    convert_xmm_register
  4597.         mov     [postbyte_register],al
  4598.         mov     [extended_code],7Fh
  4599.         jmp     instruction_ready
  4600.       movdq_mmreg:
  4601.         lods    byte [esi]
  4602.         call    convert_xmm_register
  4603.         mov     [postbyte_register],al
  4604.         lods    byte [esi]
  4605.         cmp     al,','
  4606.         jne     invalid_operand
  4607.         lods    byte [esi]
  4608.         call    get_size_operator
  4609.         cmp     al,10h
  4610.         je      movdq_mmreg_mmreg
  4611.         cmp     al,'['
  4612.         jne     invalid_operand
  4613.         call    get_address
  4614.         jmp     instruction_ready
  4615.       movdq_mmreg_mmreg:
  4616.         lods    byte [esi]
  4617.         call    convert_xmm_register
  4618.         mov     bl,al
  4619.         jmp     nomem_instruction_ready
  4620. lddqu_instruction:
  4621.         lods    byte [esi]
  4622.         call    get_size_operator
  4623.         cmp     al,10h
  4624.         jne     invalid_operand
  4625.         lods    byte [esi]
  4626.         call    convert_xmm_register
  4627.         push    eax
  4628.         lods    byte [esi]
  4629.         cmp     al,','
  4630.         jne     invalid_operand
  4631.         lods    byte [esi]
  4632.         call    get_size_operator
  4633.         cmp     al,'['
  4634.         jne     invalid_operand
  4635.         call    get_address
  4636.         pop     eax
  4637.         mov     [postbyte_register],al
  4638.         mov     [opcode_prefix],0F2h
  4639.         mov     [base_code],0Fh
  4640.         mov     [extended_code],0F0h
  4641.         jmp     instruction_ready
  4642.  
  4643. movdq2q_instruction:
  4644.         mov     [opcode_prefix],0F2h
  4645.         mov     [mmx_size],8
  4646.         jmp     movq2dq_
  4647. movq2dq_instruction:
  4648.         mov     [opcode_prefix],0F3h
  4649.         mov     [mmx_size],16
  4650.       movq2dq_:
  4651.         lods    byte [esi]
  4652.         call    get_size_operator
  4653.         cmp     al,10h
  4654.         jne     invalid_operand
  4655.         lods    byte [esi]
  4656.         call    convert_mmx_register
  4657.         cmp     ah,[mmx_size]
  4658.         jne     invalid_operand_size
  4659.         mov     [postbyte_register],al
  4660.         mov     [operand_size],0
  4661.         lods    byte [esi]
  4662.         cmp     al,','
  4663.         jne     invalid_operand
  4664.         lods    byte [esi]
  4665.         call    get_size_operator
  4666.         cmp     al,10h
  4667.         jne     invalid_operand
  4668.         lods    byte [esi]
  4669.         call    convert_mmx_register
  4670.         xor     [mmx_size],8+16
  4671.         cmp     ah,[mmx_size]
  4672.         jne     invalid_operand_size
  4673.         mov     bl,al
  4674.         mov     [base_code],0Fh
  4675.         mov     [extended_code],0D6h
  4676.         jmp     nomem_instruction_ready
  4677.  
  4678. sse_ps_instruction_imm8:
  4679.         mov     [immediate_size],1
  4680. sse_ps_instruction:
  4681.         mov     [mmx_size],16
  4682.         jmp     sse_instruction
  4683. sse_pd_instruction_imm8:
  4684.         mov     [immediate_size],1
  4685. sse_pd_instruction:
  4686.         mov     [mmx_size],16
  4687.         mov     [opcode_prefix],66h
  4688.         jmp     sse_instruction
  4689. sse_ss_instruction:
  4690.         mov     [mmx_size],4
  4691.         mov     [opcode_prefix],0F3h
  4692.         jmp     sse_instruction
  4693. sse_sd_instruction:
  4694.         mov     [mmx_size],8
  4695.         mov     [opcode_prefix],0F2h
  4696.         jmp     sse_instruction
  4697. cmp_pd_instruction:
  4698.         mov     [opcode_prefix],66h
  4699. cmp_ps_instruction:
  4700.         mov     [mmx_size],16
  4701.         mov     byte [value],al
  4702.         mov     al,0C2h
  4703.         jmp     sse_instruction
  4704. cmp_ss_instruction:
  4705.         mov     [mmx_size],4
  4706.         mov     [opcode_prefix],0F3h
  4707.         jmp     cmp_sx_instruction
  4708. cmpsd_instruction:
  4709.         mov     al,0A7h
  4710.         mov     ah,[esi]
  4711.         or      ah,ah
  4712.         jz      simple_instruction_32bit
  4713.         cmp     ah,0Fh
  4714.         je      simple_instruction_32bit
  4715.         mov     al,-1
  4716. cmp_sd_instruction:
  4717.         mov     [mmx_size],8
  4718.         mov     [opcode_prefix],0F2h
  4719.       cmp_sx_instruction:
  4720.         mov     byte [value],al
  4721.         mov     al,0C2h
  4722.         jmp     sse_instruction
  4723. comiss_instruction:
  4724.         mov     [mmx_size],4
  4725.         jmp     sse_instruction
  4726. comisd_instruction:
  4727.         mov     [mmx_size],8
  4728.         mov     [opcode_prefix],66h
  4729.         jmp     sse_instruction
  4730. cvtdq2pd_instruction:
  4731.         mov     [opcode_prefix],0F3h
  4732. cvtps2pd_instruction:
  4733.         mov     [mmx_size],8
  4734.         jmp     sse_instruction
  4735. cvtpd2dq_instruction:
  4736.         mov     [mmx_size],16
  4737.         mov     [opcode_prefix],0F2h
  4738.         jmp     sse_instruction
  4739. movshdup_instruction:
  4740.         mov     [mmx_size],16
  4741.         mov     [opcode_prefix],0F3h
  4742. sse_instruction:
  4743.         mov     [base_code],0Fh
  4744.         mov     [extended_code],al
  4745.         lods    byte [esi]
  4746.         call    get_size_operator
  4747.         cmp     al,10h
  4748.         jne     invalid_operand
  4749.       sse_xmmreg:
  4750.         lods    byte [esi]
  4751.         call    convert_xmm_register
  4752.       sse_reg:
  4753.         mov     [postbyte_register],al
  4754.         mov     [operand_size],0
  4755.         lods    byte [esi]
  4756.         cmp     al,','
  4757.         jne     invalid_operand
  4758.         lods    byte [esi]
  4759.         call    get_size_operator
  4760.         cmp     al,10h
  4761.         je      sse_xmmreg_xmmreg
  4762.       sse_reg_mem:
  4763.         cmp     al,'['
  4764.         jne     invalid_operand
  4765.         call    get_address
  4766.         cmp     [operand_size],0
  4767.         je      sse_mem_size_ok
  4768.         mov     al,[mmx_size]
  4769.         cmp     [operand_size],al
  4770.         jne     invalid_operand_size
  4771.       sse_mem_size_ok:
  4772.         mov     al,[extended_code]
  4773.         mov     ah,[supplemental_code]
  4774.         cmp     al,0C2h
  4775.         je      sse_cmp_mem_ok
  4776.         cmp     ax,443Ah
  4777.         je      sse_cmp_mem_ok
  4778.         cmp     [immediate_size],1
  4779.         je      mmx_imm8
  4780.         cmp     [immediate_size],-1
  4781.         jne     sse_ok
  4782.         call    take_additional_xmm0
  4783.         mov     [immediate_size],0
  4784.       sse_ok:
  4785.         jmp     instruction_ready
  4786.       sse_cmp_mem_ok:
  4787.         cmp     byte [value],-1
  4788.         je      mmx_imm8
  4789.         call    store_instruction_with_imm8
  4790.         jmp     instruction_assembled
  4791.       sse_xmmreg_xmmreg:
  4792.         cmp     [operand_prefix],66h
  4793.         jne     sse_xmmreg_xmmreg_ok
  4794.         cmp     [extended_code],12h
  4795.         je      invalid_operand
  4796.         cmp     [extended_code],16h
  4797.         je      invalid_operand
  4798.       sse_xmmreg_xmmreg_ok:
  4799.         lods    byte [esi]
  4800.         call    convert_xmm_register
  4801.         mov     bl,al
  4802.         mov     al,[extended_code]
  4803.         mov     ah,[supplemental_code]
  4804.         cmp     al,0C2h
  4805.         je      sse_cmp_nomem_ok
  4806.         cmp     ax,443Ah
  4807.         je      sse_cmp_nomem_ok
  4808.         cmp     [immediate_size],1
  4809.         je      mmx_nomem_imm8
  4810.         cmp     [immediate_size],-1
  4811.         jne     sse_nomem_ok
  4812.         call    take_additional_xmm0
  4813.         mov     [immediate_size],0
  4814.       sse_nomem_ok:
  4815.         jmp     nomem_instruction_ready
  4816.       sse_cmp_nomem_ok:
  4817.         cmp     byte [value],-1
  4818.         je      mmx_nomem_imm8
  4819.         call    store_nomem_instruction
  4820.         mov     al,byte [value]
  4821.         stosb
  4822.         jmp     instruction_assembled
  4823.       take_additional_xmm0:
  4824.         cmp     byte [esi],','
  4825.         jne     additional_xmm0_ok
  4826.         inc     esi
  4827.         lods    byte [esi]
  4828.         cmp     al,10h
  4829.         jne     invalid_operand
  4830.         lods    byte [esi]
  4831.         call    convert_xmm_register
  4832.         test    al,al
  4833.         jnz     invalid_operand
  4834.       additional_xmm0_ok:
  4835.         ret
  4836.  
  4837. pslldq_instruction:
  4838.         mov     [postbyte_register],al
  4839.         mov     [opcode_prefix],66h
  4840.         mov     [base_code],0Fh
  4841.         mov     [extended_code],73h
  4842.         lods    byte [esi]
  4843.         call    get_size_operator
  4844.         cmp     al,10h
  4845.         jne     invalid_operand
  4846.         lods    byte [esi]
  4847.         call    convert_xmm_register
  4848.         mov     bl,al
  4849.         jmp     mmx_nomem_imm8
  4850. movpd_instruction:
  4851.         mov     [opcode_prefix],66h
  4852. movps_instruction:
  4853.         mov     [base_code],0Fh
  4854.         mov     [extended_code],al
  4855.         mov     [mmx_size],16
  4856.         jmp     sse_mov_instruction
  4857. movss_instruction:
  4858.         mov     [mmx_size],4
  4859.         mov     [opcode_prefix],0F3h
  4860.         jmp     sse_movs
  4861. movsd_instruction:
  4862.         mov     al,0A5h
  4863.         mov     ah,[esi]
  4864.         or      ah,ah
  4865.         jz      simple_instruction_32bit
  4866.         cmp     ah,0Fh
  4867.         je      simple_instruction_32bit
  4868.         mov     [mmx_size],8
  4869.         mov     [opcode_prefix],0F2h
  4870.       sse_movs:
  4871.         mov     [base_code],0Fh
  4872.         mov     [extended_code],10h
  4873.         jmp     sse_mov_instruction
  4874. sse_mov_instruction:
  4875.         lods    byte [esi]
  4876.         call    get_size_operator
  4877.         cmp     al,10h
  4878.         je      sse_xmmreg
  4879.       sse_mem:
  4880.         cmp     al,'['
  4881.         jne     invalid_operand
  4882.         inc     [extended_code]
  4883.         call    get_address
  4884.         cmp     [operand_size],0
  4885.         je      sse_mem_xmmreg
  4886.         mov     al,[mmx_size]
  4887.         cmp     [operand_size],al
  4888.         jne     invalid_operand_size
  4889.         mov     [operand_size],0
  4890.       sse_mem_xmmreg:
  4891.         lods    byte [esi]
  4892.         cmp     al,','
  4893.         jne     invalid_operand
  4894.         lods    byte [esi]
  4895.         call    get_size_operator
  4896.         cmp     al,10h
  4897.         jne     invalid_operand
  4898.         lods    byte [esi]
  4899.         call    convert_xmm_register
  4900.         mov     [postbyte_register],al
  4901.         jmp     instruction_ready
  4902. movlpd_instruction:
  4903.         mov     [opcode_prefix],66h
  4904. movlps_instruction:
  4905.         mov     [base_code],0Fh
  4906.         mov     [extended_code],al
  4907.         mov     [mmx_size],8
  4908.         lods    byte [esi]
  4909.         call    get_size_operator
  4910.         cmp     al,10h
  4911.         jne     sse_mem
  4912.         lods    byte [esi]
  4913.         call    convert_xmm_register
  4914.         mov     [postbyte_register],al
  4915.         mov     [operand_size],0
  4916.         lods    byte [esi]
  4917.         cmp     al,','
  4918.         jne     invalid_operand
  4919.         lods    byte [esi]
  4920.         call    get_size_operator
  4921.         jmp     sse_reg_mem
  4922. movhlps_instruction:
  4923.         mov     [base_code],0Fh
  4924.         mov     [extended_code],al
  4925.         mov     [mmx_size],0
  4926.         lods    byte [esi]
  4927.         call    get_size_operator
  4928.         cmp     al,10h
  4929.         jne     invalid_operand
  4930.         lods    byte [esi]
  4931.         call    convert_xmm_register
  4932.         mov     [postbyte_register],al
  4933.         lods    byte [esi]
  4934.         cmp     al,','
  4935.         jne     invalid_operand
  4936.         lods    byte [esi]
  4937.         call    get_size_operator
  4938.         cmp     al,10h
  4939.         je      sse_xmmreg_xmmreg_ok
  4940.         jmp     invalid_operand
  4941. maskmovq_instruction:
  4942.         mov     cl,8
  4943.         jmp     maskmov_instruction
  4944. maskmovdqu_instruction:
  4945.         mov     cl,16
  4946.         mov     [opcode_prefix],66h
  4947.       maskmov_instruction:
  4948.         mov     [base_code],0Fh
  4949.         mov     [extended_code],0F7h
  4950.         lods    byte [esi]
  4951.         call    get_size_operator
  4952.         cmp     al,10h
  4953.         jne     invalid_operand
  4954.         lods    byte [esi]
  4955.         call    convert_mmx_register
  4956.         cmp     ah,cl
  4957.         jne     invalid_operand_size
  4958.         mov     [postbyte_register],al
  4959.         lods    byte [esi]
  4960.         cmp     al,','
  4961.         jne     invalid_operand
  4962.         lods    byte [esi]
  4963.         call    get_size_operator
  4964.         cmp     al,10h
  4965.         jne     invalid_operand
  4966.         lods    byte [esi]
  4967.         call    convert_mmx_register
  4968.         mov     bl,al
  4969.         jmp     nomem_instruction_ready
  4970. movmskpd_instruction:
  4971.         mov     [opcode_prefix],66h
  4972. movmskps_instruction:
  4973.         mov     [base_code],0Fh
  4974.         mov     [extended_code],50h
  4975.         call    take_register
  4976.         mov     [postbyte_register],al
  4977.         cmp     ah,4
  4978.         je      movmskps_reg_ok
  4979.         cmp     ah,8
  4980.         jne     invalid_operand_size
  4981.         cmp     [code_type],64
  4982.         jne     invalid_operand
  4983.       movmskps_reg_ok:
  4984.         mov     [operand_size],0
  4985.         lods    byte [esi]
  4986.         cmp     al,','
  4987.         jne     invalid_operand
  4988.         lods    byte [esi]
  4989.         call    get_size_operator
  4990.         cmp     al,10h
  4991.         je      sse_xmmreg_xmmreg_ok
  4992.         jmp     invalid_operand
  4993.  
  4994. cvtpi2pd_instruction:
  4995.         mov     [opcode_prefix],66h
  4996. cvtpi2ps_instruction:
  4997.         mov     [base_code],0Fh
  4998.         mov     [extended_code],al
  4999.         lods    byte [esi]
  5000.         call    get_size_operator
  5001.         cmp     al,10h
  5002.         jne     invalid_operand
  5003.         lods    byte [esi]
  5004.         call    convert_xmm_register
  5005.         mov     [postbyte_register],al
  5006.         mov     [operand_size],0
  5007.         lods    byte [esi]
  5008.         cmp     al,','
  5009.         jne     invalid_operand
  5010.         lods    byte [esi]
  5011.         call    get_size_operator
  5012.         cmp     al,10h
  5013.         je      cvtpi_xmmreg_xmmreg
  5014.         cmp     al,'['
  5015.         jne     invalid_operand
  5016.         call    get_address
  5017.         cmp     [operand_size],0
  5018.         je      cvtpi_size_ok
  5019.         cmp     [operand_size],8
  5020.         jne     invalid_operand_size
  5021.       cvtpi_size_ok:
  5022.         jmp     instruction_ready
  5023.       cvtpi_xmmreg_xmmreg:
  5024.         lods    byte [esi]
  5025.         call    convert_mmx_register
  5026.         cmp     ah,8
  5027.         jne     invalid_operand_size
  5028.         mov     bl,al
  5029.         jmp     nomem_instruction_ready
  5030. cvtsi2ss_instruction:
  5031.         mov     [opcode_prefix],0F3h
  5032.         jmp     cvtsi_instruction
  5033. cvtsi2sd_instruction:
  5034.         mov     [opcode_prefix],0F2h
  5035.       cvtsi_instruction:
  5036.         mov     [base_code],0Fh
  5037.         mov     [extended_code],al
  5038.         lods    byte [esi]
  5039.         call    get_size_operator
  5040.         cmp     al,10h
  5041.         jne     invalid_operand
  5042.         lods    byte [esi]
  5043.         call    convert_xmm_register
  5044.         mov     [postbyte_register],al
  5045.       cvtsi_xmmreg:
  5046.         mov     [operand_size],0
  5047.         lods    byte [esi]
  5048.         cmp     al,','
  5049.         jne     invalid_operand
  5050.         lods    byte [esi]
  5051.         call    get_size_operator
  5052.         cmp     al,10h
  5053.         je      cvtsi_xmmreg_reg
  5054.         cmp     al,'['
  5055.         jne     invalid_operand
  5056.         call    get_address
  5057.         cmp     [operand_size],0
  5058.         je      cvtsi_size_ok
  5059.         cmp     [operand_size],4
  5060.         je      cvtsi_size_ok
  5061.         cmp     [operand_size],8
  5062.         jne     invalid_operand_size
  5063.         call    operand_64bit
  5064.       cvtsi_size_ok:
  5065.         jmp     instruction_ready
  5066.       cvtsi_xmmreg_reg:
  5067.         lods    byte [esi]
  5068.         call    convert_register
  5069.         cmp     ah,4
  5070.         je      cvtsi_xmmreg_reg_store
  5071.         cmp     ah,8
  5072.         jne     invalid_operand_size
  5073.         call    operand_64bit
  5074.       cvtsi_xmmreg_reg_store:
  5075.         mov     bl,al
  5076.         jmp     nomem_instruction_ready
  5077. cvtps2pi_instruction:
  5078.         mov     [mmx_size],8
  5079.         jmp     cvtpd_instruction
  5080. cvtpd2pi_instruction:
  5081.         mov     [opcode_prefix],66h
  5082.         mov     [mmx_size],16
  5083.       cvtpd_instruction:
  5084.         mov     [base_code],0Fh
  5085.         mov     [extended_code],al
  5086.         lods    byte [esi]
  5087.         call    get_size_operator
  5088.         cmp     al,10h
  5089.         jne     invalid_operand
  5090.         lods    byte [esi]
  5091.         call    convert_mmx_register
  5092.         cmp     ah,8
  5093.         jne     invalid_operand_size
  5094.         mov     [operand_size],0
  5095.         jmp     sse_reg
  5096. cvtss2si_instruction:
  5097.         mov     [opcode_prefix],0F3h
  5098.         mov     [mmx_size],4
  5099.         jmp     cvt2si_instruction
  5100. cvtsd2si_instruction:
  5101.         mov     [opcode_prefix],0F2h
  5102.         mov     [mmx_size],8
  5103.       cvt2si_instruction:
  5104.         mov     [extended_code],al
  5105.         mov     [base_code],0Fh
  5106.         call    take_register
  5107.         mov     [operand_size],0
  5108.         cmp     ah,4
  5109.         je      sse_reg
  5110.         cmp     ah,8
  5111.         jne     invalid_operand_size
  5112.         call    operand_64bit
  5113.         jmp     sse_reg
  5114.  
  5115. ssse3_instruction:
  5116.         mov     [base_code],0Fh
  5117.         mov     [extended_code],38h
  5118.         mov     [supplemental_code],al
  5119.         jmp     mmx_instruction
  5120. palignr_instruction:
  5121.         mov     [base_code],0Fh
  5122.         mov     [extended_code],3Ah
  5123.         mov     [supplemental_code],0Fh
  5124.         lods    byte [esi]
  5125.         call    get_size_operator
  5126.         cmp     al,10h
  5127.         jne     invalid_operand
  5128.         lods    byte [esi]
  5129.         call    convert_mmx_register
  5130.         call    make_mmx_prefix
  5131.         mov     [postbyte_register],al
  5132.         lods    byte [esi]
  5133.         cmp     al,','
  5134.         jne     invalid_operand
  5135.         lods    byte [esi]
  5136.         call    get_size_operator
  5137.         cmp     al,10h
  5138.         je      palignr_mmreg_mmreg
  5139.         cmp     al,'['
  5140.         jne     invalid_operand
  5141.         call    get_address
  5142.         jmp     mmx_imm8
  5143.       palignr_mmreg_mmreg:
  5144.         lods    byte [esi]
  5145.         call    convert_mmx_register
  5146.         mov     bl,al
  5147.         jmp     mmx_nomem_imm8
  5148. amd3dnow_instruction:
  5149.         mov     [base_code],0Fh
  5150.         mov     [extended_code],0Fh
  5151.         mov     byte [value],al
  5152.         lods    byte [esi]
  5153.         call    get_size_operator
  5154.         cmp     al,10h
  5155.         jne     invalid_operand
  5156.         lods    byte [esi]
  5157.         call    convert_mmx_register
  5158.         cmp     ah,8
  5159.         jne     invalid_operand_size
  5160.         mov     [postbyte_register],al
  5161.         lods    byte [esi]
  5162.         cmp     al,','
  5163.         jne     invalid_operand
  5164.         lods    byte [esi]
  5165.         call    get_size_operator
  5166.         cmp     al,10h
  5167.         je      amd3dnow_mmreg_mmreg
  5168.         cmp     al,'['
  5169.         jne     invalid_operand
  5170.         call    get_address
  5171.         call    store_instruction_with_imm8
  5172.         jmp     instruction_assembled
  5173.       amd3dnow_mmreg_mmreg:
  5174.         lods    byte [esi]
  5175.         call    convert_mmx_register
  5176.         cmp     ah,8
  5177.         jne     invalid_operand_size
  5178.         mov     bl,al
  5179.         call    store_nomem_instruction
  5180.         mov     al,byte [value]
  5181.         stos    byte [edi]
  5182.         jmp     instruction_assembled
  5183.  
  5184. sse4_instruction_38_xmm0:
  5185.         mov     [immediate_size],-1
  5186.         jmp     sse4_instruction_38
  5187. sse4_instruction_66_38_xmm0:
  5188.         mov     [immediate_size],-1
  5189. sse4_instruction_66_38:
  5190.         mov     [opcode_prefix],66h
  5191. sse4_instruction_38:
  5192.         mov     [mmx_size],16
  5193.         mov     [supplemental_code],al
  5194.         mov     al,38h
  5195.         jmp     sse_instruction
  5196. sse4_ss_instruction_66_3a_imm8:
  5197.         mov     [immediate_size],1
  5198.         mov     cl,4
  5199.         jmp     sse4_instruction_66_3a_setup
  5200. sse4_sd_instruction_66_3a_imm8:
  5201.         mov     [immediate_size],1
  5202.         mov     cl,8
  5203.         jmp     sse4_instruction_66_3a_setup
  5204. sse4_instruction_66_3a_imm8:
  5205.         mov     [immediate_size],1
  5206.         mov     cl,16
  5207.       sse4_instruction_66_3a_setup:
  5208.         mov     [opcode_prefix],66h
  5209.       sse4_instruction_3a_setup:
  5210.         mov     [supplemental_code],al
  5211.         mov     al,3Ah
  5212.         mov     [mmx_size],cl
  5213.         jmp     sse_instruction
  5214. sse4_instruction_3a_imm8:
  5215.         mov     [immediate_size],1
  5216.         mov     cl,16
  5217.         jmp     sse4_instruction_3a_setup
  5218. pclmulqdq_instruction:
  5219.         mov     byte [value],al
  5220.         mov     al,44h
  5221.         mov     cl,16
  5222.         jmp     sse4_instruction_66_3a_setup
  5223. extractps_instruction:
  5224.         call    setup_66_0f_3a
  5225.         lods    byte [esi]
  5226.         call    get_size_operator
  5227.         cmp     al,10h
  5228.         je      extractps_reg
  5229.         cmp     al,'['
  5230.         jne     invalid_operand
  5231.         call    get_address
  5232.         cmp     [operand_size],4
  5233.         je      extractps_size_ok
  5234.         cmp     [operand_size],0
  5235.         jne     invalid_operand_size
  5236.       extractps_size_ok:
  5237.         push    edx ebx ecx
  5238.         mov     [operand_size],0
  5239.         lods    byte [esi]
  5240.         cmp     al,','
  5241.         jne     invalid_operand
  5242.         lods    byte [esi]
  5243.         call    get_size_operator
  5244.         cmp     al,10h
  5245.         jne     invalid_operand
  5246.         lods    byte [esi]
  5247.         call    convert_xmm_register
  5248.         mov     [postbyte_register],al
  5249.         pop     ecx ebx edx
  5250.         jmp     mmx_imm8
  5251.       extractps_reg:
  5252.         lods    byte [esi]
  5253.         call    convert_register
  5254.         push    eax
  5255.         mov     [operand_size],0
  5256.         lods    byte [esi]
  5257.         cmp     al,','
  5258.         jne     invalid_operand
  5259.         lods    byte [esi]
  5260.         call    get_size_operator
  5261.         cmp     al,10h
  5262.         jne     invalid_operand
  5263.         lods    byte [esi]
  5264.         call    convert_xmm_register
  5265.         mov     [postbyte_register],al
  5266.         pop     ebx
  5267.         mov     al,bh
  5268.         cmp     al,4
  5269.         je      mmx_nomem_imm8
  5270.         cmp     al,8
  5271.         jne     invalid_operand_size
  5272.         cmp     [code_type],64
  5273.         jne     illegal_instruction
  5274.         jmp     mmx_nomem_imm8
  5275.       setup_66_0f_3a:
  5276.         mov     [extended_code],3Ah
  5277.         mov     [supplemental_code],al
  5278.         mov     [base_code],0Fh
  5279.         mov     [opcode_prefix],66h
  5280.         ret
  5281. insertps_instruction:
  5282.         call    setup_66_0f_3a
  5283.         lods    byte [esi]
  5284.         call    get_size_operator
  5285.         cmp     al,10h
  5286.         jne     invalid_operand
  5287.         lods    byte [esi]
  5288.         call    convert_xmm_register
  5289.         mov     [postbyte_register],al
  5290.         mov     [operand_size],0
  5291.         lods    byte [esi]
  5292.         cmp     al,','
  5293.         jne     invalid_operand
  5294.         lods    byte [esi]
  5295.         call    get_size_operator
  5296.         cmp     al,10h
  5297.         je      insertps_xmmreg_reg
  5298.         cmp     al,'['
  5299.         jne     invalid_operand
  5300.         call    get_address
  5301.         cmp     [operand_size],4
  5302.         je      insertps_size_ok
  5303.         cmp     [operand_size],0
  5304.         jne     invalid_operand_size
  5305.       insertps_size_ok:
  5306.         jmp     mmx_imm8
  5307.       insertps_xmmreg_reg:
  5308.         lods    byte [esi]
  5309.         call    convert_mmx_register
  5310.         mov     bl,al
  5311.         jmp     mmx_nomem_imm8
  5312. pextrq_instruction:
  5313.         mov     [mmx_size],8
  5314.         jmp     pextr_instruction
  5315. pextrd_instruction:
  5316.         mov     [mmx_size],4
  5317.         jmp     pextr_instruction
  5318. pextrw_instruction:
  5319.         mov     [mmx_size],2
  5320.         jmp     pextr_instruction
  5321. pextrb_instruction:
  5322.         mov     [mmx_size],1
  5323.       pextr_instruction:
  5324.         call    setup_66_0f_3a
  5325.         lods    byte [esi]
  5326.         call    get_size_operator
  5327.         cmp     al,10h
  5328.         je      pextr_reg
  5329.         cmp     al,'['
  5330.         jne     invalid_operand
  5331.         call    get_address
  5332.         mov     al,[mmx_size]
  5333.         cmp     al,[operand_size]
  5334.         je      pextr_size_ok
  5335.         cmp     [operand_size],0
  5336.         jne     invalid_operand_size
  5337.       pextr_size_ok:
  5338.         cmp     al,8
  5339.         jne     pextr_prefix_ok
  5340.         call    operand_64bit
  5341.       pextr_prefix_ok:
  5342.         push    edx ebx ecx
  5343.         mov     [operand_size],0
  5344.         lods    byte [esi]
  5345.         cmp     al,','
  5346.         jne     invalid_operand
  5347.         lods    byte [esi]
  5348.         call    get_size_operator
  5349.         cmp     al,10h
  5350.         jne     invalid_operand
  5351.         lods    byte [esi]
  5352.         call    convert_xmm_register
  5353.         mov     [postbyte_register],al
  5354.         pop     ecx ebx edx
  5355.         jmp     mmx_imm8
  5356.       pextr_reg:
  5357.         lods    byte [esi]
  5358.         call    convert_register
  5359.         cmp     [mmx_size],4
  5360.         ja      pextrq_reg
  5361.         cmp     ah,4
  5362.         je      pextr_reg_size_ok
  5363.         cmp     [code_type],64
  5364.         jne     pextr_invalid_size
  5365.         cmp     ah,8
  5366.         je      pextr_reg_size_ok
  5367.       pextr_invalid_size:
  5368.         jmp     invalid_operand_size
  5369.       pextrq_reg:
  5370.         cmp     ah,8
  5371.         jne     pextr_invalid_size
  5372.         call    operand_64bit
  5373.       pextr_reg_size_ok:
  5374.         mov     [operand_size],0
  5375.         push    eax
  5376.         lods    byte [esi]
  5377.         cmp     al,','
  5378.         jne     invalid_operand
  5379.         lods    byte [esi]
  5380.         call    get_size_operator
  5381.         cmp     al,10h
  5382.         jne     invalid_operand
  5383.         lods    byte [esi]
  5384.         call    convert_mmx_register
  5385.         mov     ebx,eax
  5386.         pop     eax
  5387.         mov     [postbyte_register],al
  5388.         mov     al,ah
  5389.         cmp     [mmx_size],2
  5390.         jne     pextr_reg_store
  5391.         mov     [opcode_prefix],0
  5392.         mov     [extended_code],0C5h
  5393.         call    make_mmx_prefix
  5394.         jmp     mmx_nomem_imm8
  5395.       pextr_reg_store:
  5396.         cmp     bh,16
  5397.         jne     invalid_operand_size
  5398.         xchg    bl,[postbyte_register]
  5399.         jmp     mmx_nomem_imm8
  5400. pinsrb_instruction:
  5401.         mov     [mmx_size],1
  5402.         jmp     pinsr_instruction
  5403. pinsrd_instruction:
  5404.         mov     [mmx_size],4
  5405.         jmp     pinsr_instruction
  5406. pinsrq_instruction:
  5407.         mov     [mmx_size],8
  5408.         call    operand_64bit
  5409.       pinsr_instruction:
  5410.         call    setup_66_0f_3a
  5411.         lods    byte [esi]
  5412.         call    get_size_operator
  5413.         cmp     al,10h
  5414.         jne     invalid_operand
  5415.         lods    byte [esi]
  5416.         call    convert_xmm_register
  5417.         mov     [postbyte_register],al
  5418.       pinsr_xmmreg:
  5419.         mov     [operand_size],0
  5420.         lods    byte [esi]
  5421.         cmp     al,','
  5422.         jne     invalid_operand
  5423.         lods    byte [esi]
  5424.         call    get_size_operator
  5425.         cmp     al,10h
  5426.         je      pinsr_xmmreg_reg
  5427.         cmp     al,'['
  5428.         jne     invalid_operand
  5429.         call    get_address
  5430.         cmp     [operand_size],0
  5431.         je      mmx_imm8
  5432.         mov     al,[mmx_size]
  5433.         cmp     al,[operand_size]
  5434.         je      mmx_imm8
  5435.         jmp     invalid_operand_size
  5436.       pinsr_xmmreg_reg:
  5437.         lods    byte [esi]
  5438.         call    convert_register
  5439.         mov     bl,al
  5440.         cmp     [mmx_size],8
  5441.         je      pinsrq_xmmreg_reg
  5442.         cmp     ah,4
  5443.         je      mmx_nomem_imm8
  5444.         jmp     invalid_operand_size
  5445.       pinsrq_xmmreg_reg:
  5446.         cmp     ah,8
  5447.         je      mmx_nomem_imm8
  5448.         jmp     invalid_operand_size
  5449. pmovsxbw_instruction:
  5450.         mov     [mmx_size],8
  5451.         jmp     pmovsx_instruction
  5452. pmovsxbd_instruction:
  5453.         mov     [mmx_size],4
  5454.         jmp     pmovsx_instruction
  5455. pmovsxbq_instruction:
  5456.         mov     [mmx_size],2
  5457.         jmp     pmovsx_instruction
  5458. pmovsxwd_instruction:
  5459.         mov     [mmx_size],8
  5460.         jmp     pmovsx_instruction
  5461. pmovsxwq_instruction:
  5462.         mov     [mmx_size],4
  5463.         jmp     pmovsx_instruction
  5464. pmovsxdq_instruction:
  5465.         mov     [mmx_size],8
  5466.       pmovsx_instruction:
  5467.         call    setup_66_0f_38
  5468.         lods    byte [esi]
  5469.         call    get_size_operator
  5470.         cmp     al,10h
  5471.         jne     invalid_operand
  5472.         lods    byte [esi]
  5473.         call    convert_xmm_register
  5474.         mov     [postbyte_register],al
  5475.         lods    byte [esi]
  5476.         cmp     al,','
  5477.         jne     invalid_operand
  5478.         mov     [operand_size],0
  5479.         lods    byte [esi]
  5480.         call    get_size_operator
  5481.         cmp     al,10h
  5482.         je      pmovsx_xmmreg_reg
  5483.         cmp     al,'['
  5484.         jne     invalid_operand
  5485.         call    get_address
  5486.         cmp     [operand_size],0
  5487.         je      instruction_ready
  5488.         mov     al,[mmx_size]
  5489.         cmp     al,[operand_size]
  5490.         jne     invalid_operand_size
  5491.         jmp     instruction_ready
  5492.       pmovsx_xmmreg_reg:
  5493.         lods    byte [esi]
  5494.         call    convert_xmm_register
  5495.         mov     bl,al
  5496.         jmp     nomem_instruction_ready
  5497.       setup_66_0f_38:
  5498.         mov     [extended_code],38h
  5499.         mov     [supplemental_code],al
  5500.         mov     [base_code],0Fh
  5501.         mov     [opcode_prefix],66h
  5502.         ret
  5503.  
  5504. xsaves_instruction_64bit:
  5505.         call    operand_64bit
  5506. xsaves_instruction:
  5507.         mov     ah,0C7h
  5508.         jmp     xsave_common
  5509. fxsave_instruction_64bit:
  5510.         call    operand_64bit
  5511. fxsave_instruction:
  5512.         mov     ah,0AEh
  5513.         xor     cl,cl
  5514.       xsave_common:
  5515.         mov     [base_code],0Fh
  5516.         mov     [extended_code],ah
  5517.         mov     [postbyte_register],al
  5518.         mov     [mmx_size],cl
  5519.         lods    byte [esi]
  5520.         call    get_size_operator
  5521.         cmp     al,'['
  5522.         jne     invalid_operand
  5523.         call    get_address
  5524.         mov     ah,[operand_size]
  5525.         or      ah,ah
  5526.         jz      xsave_size_ok
  5527.         cmp     ah,[mmx_size]
  5528.         jne     invalid_operand_size
  5529.       xsave_size_ok:
  5530.         jmp     instruction_ready
  5531. clflush_instruction:
  5532.         mov     ah,0AEh
  5533.         mov     cl,1
  5534.         jmp     xsave_common
  5535. cldemote_instruction:
  5536.         mov     ah,1Ch
  5537.         mov     cl,1
  5538.         jmp     xsave_common
  5539. stmxcsr_instruction:
  5540.         mov     ah,0AEh
  5541.         mov     cl,4
  5542.         jmp     xsave_common
  5543. prefetch_instruction:
  5544.         mov     [extended_code],18h
  5545.       prefetch_mem_8bit:
  5546.         mov     [base_code],0Fh
  5547.         mov     [postbyte_register],al
  5548.         lods    byte [esi]
  5549.         call    get_size_operator
  5550.         cmp     al,'['
  5551.         jne     invalid_operand
  5552.         or      ah,ah
  5553.         jz      prefetch_size_ok
  5554.         cmp     ah,1
  5555.         jne     invalid_operand_size
  5556.       prefetch_size_ok:
  5557.         call    get_address
  5558.         jmp     instruction_ready
  5559. amd_prefetch_instruction:
  5560.         mov     [extended_code],0Dh
  5561.         jmp     prefetch_mem_8bit
  5562. clflushopt_instruction:
  5563.         mov     [extended_code],0AEh
  5564.         mov     [opcode_prefix],66h
  5565.         jmp     prefetch_mem_8bit
  5566. pcommit_instruction:
  5567.         mov     byte [edi],66h
  5568.         inc     edi
  5569. fence_instruction:
  5570.         mov     bl,al
  5571.         mov     ax,0AE0Fh
  5572.         stos    word [edi]
  5573.         mov     al,bl
  5574.         stos    byte [edi]
  5575.         jmp     instruction_assembled
  5576. pause_instruction:
  5577.         mov     ax,90F3h
  5578.         stos    word [edi]
  5579.         jmp     instruction_assembled
  5580. movntq_instruction:
  5581.         mov     [mmx_size],8
  5582.         jmp     movnt_instruction
  5583. movntpd_instruction:
  5584.         mov     [opcode_prefix],66h
  5585. movntps_instruction:
  5586.         mov     [mmx_size],16
  5587.       movnt_instruction:
  5588.         mov     [extended_code],al
  5589.         mov     [base_code],0Fh
  5590.         lods    byte [esi]
  5591.         call    get_size_operator
  5592.         cmp     al,'['
  5593.         jne     invalid_operand
  5594.         call    get_address
  5595.         lods    byte [esi]
  5596.         cmp     al,','
  5597.         jne     invalid_operand
  5598.         lods    byte [esi]
  5599.         call    get_size_operator
  5600.         cmp     al,10h
  5601.         jne     invalid_operand
  5602.         lods    byte [esi]
  5603.         call    convert_mmx_register
  5604.         cmp     ah,[mmx_size]
  5605.         jne     invalid_operand_size
  5606.         mov     [postbyte_register],al
  5607.         jmp     instruction_ready
  5608.  
  5609. movntsd_instruction:
  5610.         mov     [opcode_prefix],0F2h
  5611.         mov     [mmx_size],8
  5612.         jmp     movnts_instruction
  5613. movntss_instruction:
  5614.         mov     [opcode_prefix],0F3h
  5615.         mov     [mmx_size],4
  5616.       movnts_instruction:
  5617.         mov     [extended_code],al
  5618.         mov     [base_code],0Fh
  5619.         lods    byte [esi]
  5620.         call    get_size_operator
  5621.         cmp     al,'['
  5622.         jne     invalid_operand
  5623.         call    get_address
  5624.         mov     al,[operand_size]
  5625.         cmp     al,[mmx_size]
  5626.         je      movnts_size_ok
  5627.         test    al,al
  5628.         jnz     invalid_operand_size
  5629.       movnts_size_ok:
  5630.         lods    byte [esi]
  5631.         cmp     al,','
  5632.         jne     invalid_operand
  5633.         mov     [operand_size],0
  5634.         lods    byte [esi]
  5635.         call    get_size_operator
  5636.         cmp     al,10h
  5637.         jne     invalid_operand
  5638.         lods    byte [esi]
  5639.         call    convert_xmm_register
  5640.         mov     [postbyte_register],al
  5641.         jmp     instruction_ready
  5642.  
  5643. movdiri_instruction:
  5644.         mov     [supplemental_code],al
  5645.         mov     al,38h
  5646. movnti_instruction:
  5647.         mov     [base_code],0Fh
  5648.         mov     [extended_code],al
  5649.         lods    byte [esi]
  5650.         call    get_size_operator
  5651.         cmp     al,'['
  5652.         jne     invalid_operand
  5653.         call    get_address
  5654.         lods    byte [esi]
  5655.         cmp     al,','
  5656.         jne     invalid_operand
  5657.         call    take_register
  5658.         cmp     ah,4
  5659.         je      movnti_store
  5660.         cmp     ah,8
  5661.         jne     invalid_operand_size
  5662.         call    operand_64bit
  5663.       movnti_store:
  5664.         mov     [postbyte_register],al
  5665.         jmp     instruction_ready
  5666. monitor_instruction:
  5667.         mov     [postbyte_register],al
  5668.         cmp     byte [esi],0
  5669.         je      monitor_instruction_store
  5670.         cmp     byte [esi],0Fh
  5671.         je      monitor_instruction_store
  5672.         call    take_register
  5673.         cmp     ax,0400h
  5674.         jne     invalid_operand
  5675.         lods    byte [esi]
  5676.         cmp     al,','
  5677.         jne     invalid_operand
  5678.         call    take_register
  5679.         cmp     ax,0401h
  5680.         jne     invalid_operand
  5681.         cmp     [postbyte_register],0C8h
  5682.         jne     monitor_instruction_store
  5683.         lods    byte [esi]
  5684.         cmp     al,','
  5685.         jne     invalid_operand
  5686.         call    take_register
  5687.         cmp     ax,0402h
  5688.         jne     invalid_operand
  5689.       monitor_instruction_store:
  5690.         mov     ax,010Fh
  5691.         stos    word [edi]
  5692.         mov     al,[postbyte_register]
  5693.         stos    byte [edi]
  5694.         jmp     instruction_assembled
  5695. pconfig_instruction:
  5696.         mov     [postbyte_register],al
  5697.         jmp     monitor_instruction_store
  5698. movntdqa_instruction:
  5699.         call    setup_66_0f_38
  5700.         lods    byte [esi]
  5701.         call    get_size_operator
  5702.         cmp     al,10h
  5703.         jne     invalid_operand
  5704.         lods    byte [esi]
  5705.         call    convert_xmm_register
  5706.         mov     [postbyte_register],al
  5707.         lods    byte [esi]
  5708.         cmp     al,','
  5709.         jne     invalid_operand
  5710.         lods    byte [esi]
  5711.         call    get_size_operator
  5712.         cmp     al,'['
  5713.         jne     invalid_operand
  5714.         call    get_address
  5715.         jmp     instruction_ready
  5716.  
  5717. extrq_instruction:
  5718.         mov     [opcode_prefix],66h
  5719.         mov     [base_code],0Fh
  5720.         mov     [extended_code],78h
  5721.         lods    byte [esi]
  5722.         call    get_size_operator
  5723.         cmp     al,10h
  5724.         jne     invalid_operand
  5725.         lods    byte [esi]
  5726.         call    convert_xmm_register
  5727.         mov     [postbyte_register],al
  5728.         mov     [operand_size],0
  5729.         lods    byte [esi]
  5730.         cmp     al,','
  5731.         jne     invalid_operand
  5732.         lods    byte [esi]
  5733.         call    get_size_operator
  5734.         cmp     al,10h
  5735.         je      extrq_xmmreg_xmmreg
  5736.         test    ah,not 1
  5737.         jnz     invalid_operand_size
  5738.         cmp     al,'('
  5739.         jne     invalid_operand
  5740.         xor     bl,bl
  5741.         xchg    bl,[postbyte_register]
  5742.         call    store_nomem_instruction
  5743.         call    get_byte_value
  5744.         stosb
  5745.         call    append_imm8
  5746.         jmp     instruction_assembled
  5747.       extrq_xmmreg_xmmreg:
  5748.         inc     [extended_code]
  5749.         lods    byte [esi]
  5750.         call    convert_xmm_register
  5751.         mov     bl,al
  5752.         jmp     nomem_instruction_ready
  5753. insertq_instruction:
  5754.         mov     [opcode_prefix],0F2h
  5755.         mov     [base_code],0Fh
  5756.         mov     [extended_code],78h
  5757.         lods    byte [esi]
  5758.         call    get_size_operator
  5759.         cmp     al,10h
  5760.         jne     invalid_operand
  5761.         lods    byte [esi]
  5762.         call    convert_xmm_register
  5763.         mov     [postbyte_register],al
  5764.         mov     [operand_size],0
  5765.         lods    byte [esi]
  5766.         cmp     al,','
  5767.         jne     invalid_operand
  5768.         lods    byte [esi]
  5769.         call    get_size_operator
  5770.         cmp     al,10h
  5771.         jne     invalid_operand
  5772.         lods    byte [esi]
  5773.         call    convert_xmm_register
  5774.         mov     bl,al
  5775.         cmp     byte [esi],','
  5776.         je      insertq_with_imm
  5777.         inc     [extended_code]
  5778.         jmp     nomem_instruction_ready
  5779.       insertq_with_imm:
  5780.         call    store_nomem_instruction
  5781.         call    append_imm8
  5782.         call    append_imm8
  5783.         jmp     instruction_assembled
  5784.  
  5785. crc32_instruction:
  5786.         mov     [opcode_prefix],0F2h
  5787.         mov     [base_code],0Fh
  5788.         mov     [extended_code],38h
  5789.         mov     [supplemental_code],0F0h
  5790.         call    take_register
  5791.         mov     [postbyte_register],al
  5792.         cmp     ah,4
  5793.         je      crc32_reg_size_ok
  5794.         cmp     ah,8
  5795.         jne     invalid_operand
  5796.         cmp     [code_type],64
  5797.         jne     illegal_instruction
  5798.       crc32_reg_size_ok:
  5799.         lods    byte [esi]
  5800.         cmp     al,','
  5801.         jne     invalid_operand
  5802.         mov     [operand_size],0
  5803.         lods    byte [esi]
  5804.         call    get_size_operator
  5805.         cmp     al,10h
  5806.         je      crc32_reg_reg
  5807.         cmp     al,'['
  5808.         jne     invalid_operand
  5809.         call    get_address
  5810.         mov     al,[operand_size]
  5811.         test    al,al
  5812.         jz      crc32_unknown_size
  5813.         cmp     al,1
  5814.         je      crc32_reg_mem_store
  5815.         inc     [supplemental_code]
  5816.         call    operand_autodetect
  5817.       crc32_reg_mem_store:
  5818.         jmp     instruction_ready
  5819.       crc32_unknown_size:
  5820.         call    recoverable_unknown_size
  5821.         jmp     crc32_reg_mem_store
  5822.       crc32_reg_reg:
  5823.         lods    byte [esi]
  5824.         call    convert_register
  5825.         mov     bl,al
  5826.         mov     al,ah
  5827.         cmp     al,1
  5828.         je      crc32_reg_reg_store
  5829.         inc     [supplemental_code]
  5830.         call    operand_autodetect
  5831.       crc32_reg_reg_store:
  5832.         jmp     nomem_instruction_ready
  5833. popcnt_instruction:
  5834.         mov     [opcode_prefix],0F3h
  5835.         jmp     bs_instruction
  5836. movbe_instruction:
  5837.         mov     [supplemental_code],al
  5838.         mov     [extended_code],38h
  5839.         mov     [base_code],0Fh
  5840.         lods    byte [esi]
  5841.         call    get_size_operator
  5842.         cmp     al,'['
  5843.         je      movbe_mem
  5844.         cmp     al,10h
  5845.         jne     invalid_operand
  5846.         lods    byte [esi]
  5847.         call    convert_register
  5848.         mov     [postbyte_register],al
  5849.         lods    byte [esi]
  5850.         cmp     al,','
  5851.         jne     invalid_operand
  5852.         lods    byte [esi]
  5853.         call    get_size_operator
  5854.         cmp     al,'['
  5855.         jne     invalid_argument
  5856.         call    get_address
  5857.         mov     al,[operand_size]
  5858.         call    operand_autodetect
  5859.         jmp     instruction_ready
  5860.       movbe_mem:
  5861.         inc     [supplemental_code]
  5862.         call    get_address
  5863.         push    edx ebx ecx
  5864.         lods    byte [esi]
  5865.         cmp     al,','
  5866.         jne     invalid_operand
  5867.         call    take_register
  5868.         mov     [postbyte_register],al
  5869.         pop     ecx ebx edx
  5870.         mov     al,[operand_size]
  5871.         call    operand_autodetect
  5872.         jmp     instruction_ready
  5873. adx_instruction:
  5874.         mov     [base_code],0Fh
  5875.         mov     [extended_code],38h
  5876.         mov     [supplemental_code],0F6h
  5877.         mov     [operand_prefix],al
  5878.         call    get_reg_mem
  5879.         jc      adx_reg_reg
  5880.         mov     al,[operand_size]
  5881.         cmp     al,4
  5882.         je      instruction_ready
  5883.         cmp     al,8
  5884.         jne     invalid_operand_size
  5885.         call    operand_64bit
  5886.         jmp     instruction_ready
  5887.       adx_reg_reg:
  5888.         cmp     ah,4
  5889.         je      nomem_instruction_ready
  5890.         cmp     ah,8
  5891.         jne     invalid_operand_size
  5892.         call    operand_64bit
  5893.         jmp     nomem_instruction_ready
  5894. rdpid_instruction:
  5895.         mov     [postbyte_register],al
  5896.         mov     [extended_code],0C7h
  5897.         mov     [base_code],0Fh
  5898.         mov     [opcode_prefix],0F3h
  5899.         call    take_register
  5900.         cmp     [code_type],64
  5901.         je      rdpid_64bit
  5902.         cmp     ah,4
  5903.         jne     invalid_operand_size
  5904.         jmp     nomem_instruction_ready
  5905.       rdpid_64bit:
  5906.         cmp     ah,8
  5907.         jne     invalid_operand_size
  5908.         jmp     nomem_instruction_ready
  5909. ptwrite_instruction:
  5910.         mov     [base_code],0Fh
  5911.         mov     [extended_code],0AEh
  5912.         mov     [postbyte_register],al
  5913.         mov     [opcode_prefix],0F3h
  5914.         lods    byte [esi]
  5915.         call    get_size_operator
  5916.         cmp     al,10h
  5917.         je      ptwrite_reg
  5918.       ptwrite_mem:
  5919.         cmp     al,'['
  5920.         jne     invalid_operand
  5921.         call    get_address
  5922.         mov     al,[operand_size]
  5923.         cmp     al,4
  5924.         je      ptwrite_mem_store
  5925.         cmp     al,8
  5926.         je      ptwrite_mem_64bit
  5927.         or      al,al
  5928.         jnz     invalid_operand_size
  5929.         call    recoverable_unknown_size
  5930.         jmp     ptwrite_mem_store
  5931.       ptwrite_mem_64bit:
  5932.         call    operand_64bit
  5933.       ptwrite_mem_store:
  5934.         mov     al,[operand_size]
  5935.         call    operand_autodetect
  5936.         jmp     instruction_ready
  5937.       ptwrite_reg:
  5938.         lods    byte [esi]
  5939.         call    convert_register
  5940.         mov     bl,al
  5941.         mov     al,ah
  5942.         cmp     al,4
  5943.         je      nomem_instruction_ready
  5944.         cmp     al,8
  5945.         jne     invalid_operand_size
  5946.         call    operand_64bit
  5947.         jmp     nomem_instruction_ready
  5948.  
  5949. vmclear_instruction:
  5950.         mov     [opcode_prefix],66h
  5951.         jmp     vmx_instruction
  5952. vmxon_instruction:
  5953.         mov     [opcode_prefix],0F3h
  5954. vmx_instruction:
  5955.         mov     [postbyte_register],al
  5956.         mov     [extended_code],0C7h
  5957.         lods    byte [esi]
  5958.         call    get_size_operator
  5959.         cmp     al,'['
  5960.         jne     invalid_operand
  5961.         call    get_address
  5962.         mov     al,[operand_size]
  5963.         or      al,al
  5964.         jz      vmx_size_ok
  5965.         cmp     al,8
  5966.         jne     invalid_operand_size
  5967.       vmx_size_ok:
  5968.         mov     [base_code],0Fh
  5969.         jmp     instruction_ready
  5970. vmread_instruction:
  5971.         mov     [extended_code],78h
  5972.         lods    byte [esi]
  5973.         call    get_size_operator
  5974.         cmp     al,10h
  5975.         je      vmread_nomem
  5976.         cmp     al,'['
  5977.         jne     invalid_operand
  5978.         call    get_address
  5979.         lods    byte [esi]
  5980.         cmp     al,','
  5981.         jne     invalid_operand
  5982.         call    take_register
  5983.         mov     [postbyte_register],al
  5984.         call    vmread_check_size
  5985.         jmp     vmx_size_ok
  5986.       vmread_nomem:
  5987.         lods    byte [esi]
  5988.         call    convert_register
  5989.         push    eax
  5990.         call    vmread_check_size
  5991.         lods    byte [esi]
  5992.         cmp     al,','
  5993.         jne     invalid_operand
  5994.         call    take_register
  5995.         mov     [postbyte_register],al
  5996.         call    vmread_check_size
  5997.         pop     ebx
  5998.         mov     [base_code],0Fh
  5999.         jmp     nomem_instruction_ready
  6000.       vmread_check_size:
  6001.         cmp     [code_type],64
  6002.         je      vmread_long
  6003.         cmp     [operand_size],4
  6004.         jne     invalid_operand_size
  6005.         ret
  6006.       vmread_long:
  6007.         cmp     [operand_size],8
  6008.         jne     invalid_operand_size
  6009.         ret
  6010. vmwrite_instruction:
  6011.         mov     [extended_code],79h
  6012.         call    take_register
  6013.         mov     [postbyte_register],al
  6014.         lods    byte [esi]
  6015.         cmp     al,','
  6016.         jne     invalid_operand
  6017.         lods    byte [esi]
  6018.         call    get_size_operator
  6019.         cmp     al,10h
  6020.         je      vmwrite_nomem
  6021.         cmp     al,'['
  6022.         jne     invalid_operand
  6023.         call    get_address
  6024.         call    vmread_check_size
  6025.         jmp     vmx_size_ok
  6026.       vmwrite_nomem:
  6027.         lods    byte [esi]
  6028.         call    convert_register
  6029.         mov     bl,al
  6030.         mov     [base_code],0Fh
  6031.         jmp     nomem_instruction_ready
  6032. vmx_inv_instruction:
  6033.         call    setup_66_0f_38
  6034.         call    take_register
  6035.         mov     [postbyte_register],al
  6036.         call    vmread_check_size
  6037.         mov     [operand_size],0
  6038.         lods    byte [esi]
  6039.         cmp     al,','
  6040.         jne     invalid_operand
  6041.         lods    byte [esi]
  6042.         call    get_size_operator
  6043.         cmp     al,'['
  6044.         jne     invalid_operand
  6045.         call    get_address
  6046.         mov     al,[operand_size]
  6047.         or      al,al
  6048.         jz      vmx_size_ok
  6049.         cmp     al,16
  6050.         jne     invalid_operand_size
  6051.         jmp     vmx_size_ok
  6052. simple_svm_instruction:
  6053.         push    eax
  6054.         mov     [base_code],0Fh
  6055.         mov     [extended_code],1
  6056.         call    take_register
  6057.         or      al,al
  6058.         jnz     invalid_operand
  6059.       simple_svm_detect_size:
  6060.         cmp     ah,2
  6061.         je      simple_svm_16bit
  6062.         cmp     ah,4
  6063.         je      simple_svm_32bit
  6064.         cmp     [code_type],64
  6065.         jne     invalid_operand_size
  6066.         jmp     simple_svm_store
  6067.       simple_svm_16bit:
  6068.         cmp     [code_type],16
  6069.         je      simple_svm_store
  6070.         cmp     [code_type],64
  6071.         je      invalid_operand_size
  6072.         jmp     prefixed_svm_store
  6073.       simple_svm_32bit:
  6074.         cmp     [code_type],32
  6075.         je      simple_svm_store
  6076.       prefixed_svm_store:
  6077.         mov     al,67h
  6078.         stos    byte [edi]
  6079.       simple_svm_store:
  6080.         call    store_classic_instruction_code
  6081.         pop     eax
  6082.         stos    byte [edi]
  6083.         jmp     instruction_assembled
  6084. skinit_instruction:
  6085.         call    take_register
  6086.         cmp     ax,0400h
  6087.         jne     invalid_operand
  6088.         mov     al,0DEh
  6089.         jmp     simple_instruction_0f_01
  6090. clzero_instruction:
  6091.         call    take_register
  6092.         or      al,al
  6093.         jnz     invalid_operand
  6094.         mov     al,0FCh
  6095.         cmp     [code_type],64
  6096.         je      clzero_64bit
  6097.         cmp     ah,4
  6098.         jne     invalid_operand
  6099.         jmp     simple_instruction_0f_01
  6100.       clzero_64bit:
  6101.         cmp     ah,8
  6102.         jne     invalid_operand
  6103.         jmp     simple_instruction_0f_01
  6104. invlpga_instruction:
  6105.         push    eax
  6106.         mov     [base_code],0Fh
  6107.         mov     [extended_code],1
  6108.         call    take_register
  6109.         or      al,al
  6110.         jnz     invalid_operand
  6111.         mov     bl,ah
  6112.         mov     [operand_size],0
  6113.         lods    byte [esi]
  6114.         cmp     al,','
  6115.         jne     invalid_operand
  6116.         call    take_register
  6117.         cmp     ax,0401h
  6118.         jne     invalid_operand
  6119.         mov     ah,bl
  6120.         jmp     simple_svm_detect_size
  6121.  
  6122. rdrand_instruction:
  6123.         mov     [base_code],0Fh
  6124.         mov     [extended_code],0C7h
  6125.         mov     [postbyte_register],al
  6126.         call    take_register
  6127.         mov     bl,al
  6128.         mov     al,ah
  6129.         call    operand_autodetect
  6130.         jmp     nomem_instruction_ready
  6131. rdfsbase_instruction:
  6132.         cmp     [code_type],64
  6133.         jne     illegal_instruction
  6134.         mov     [opcode_prefix],0F3h
  6135.         mov     [base_code],0Fh
  6136.         mov     [extended_code],0AEh
  6137.         mov     [postbyte_register],al
  6138.         call    take_register
  6139.         mov     bl,al
  6140.         mov     al,ah
  6141.         cmp     ah,2
  6142.         je      invalid_operand_size
  6143.         call    operand_autodetect
  6144.         jmp     nomem_instruction_ready
  6145.  
  6146. xabort_instruction:
  6147.         lods    byte [esi]
  6148.         call    get_size_operator
  6149.         cmp     ah,1
  6150.         ja      invalid_operand_size
  6151.         cmp     al,'('
  6152.         jne     invalid_operand
  6153.         call    get_byte_value
  6154.         mov     dl,al
  6155.         mov     ax,0F8C6h
  6156.         stos    word [edi]
  6157.         mov     al,dl
  6158.         stos    byte [edi]
  6159.         jmp     instruction_assembled
  6160. xbegin_instruction:
  6161.         lods    byte [esi]
  6162.         cmp     al,'('
  6163.         jne     invalid_operand
  6164.         mov     al,[code_type]
  6165.         cmp     al,64
  6166.         je      xbegin_64bit
  6167.         cmp     al,32
  6168.         je      xbegin_32bit
  6169.       xbegin_16bit:
  6170.         call    get_address_word_value
  6171.         add     edi,4
  6172.         mov     ebp,[addressing_space]
  6173.         call    calculate_relative_offset
  6174.         sub     edi,4
  6175.         shl     eax,16
  6176.         mov     ax,0F8C7h
  6177.         stos    dword [edi]
  6178.         jmp     instruction_assembled
  6179.       xbegin_32bit:
  6180.         call    get_address_dword_value
  6181.         jmp     xbegin_address_ok
  6182.       xbegin_64bit:
  6183.         call    get_address_qword_value
  6184.       xbegin_address_ok:
  6185.         add     edi,5
  6186.         mov     ebp,[addressing_space]
  6187.         call    calculate_relative_offset
  6188.         sub     edi,5
  6189.         mov     edx,eax
  6190.         cwde
  6191.         cmp     eax,edx
  6192.         jne     xbegin_rel32
  6193.         mov     al,66h
  6194.         stos    byte [edi]
  6195.         mov     eax,edx
  6196.         shl     eax,16
  6197.         mov     ax,0F8C7h
  6198.         stos    dword [edi]
  6199.         jmp     instruction_assembled
  6200.       xbegin_rel32:
  6201.         sub     edx,1
  6202.         jno     xbegin_rel32_ok
  6203.         cmp     [code_type],64
  6204.         je      jump_out_of_range
  6205.       xbegin_rel32_ok:
  6206.         mov     ax,0F8C7h
  6207.         stos    word [edi]
  6208.         mov     eax,edx
  6209.         stos    dword [edi]
  6210.         jmp     instruction_assembled
  6211.  
  6212. bndcl_instruction:
  6213.         mov     ah,0F3h
  6214.         jmp     bndc_instruction
  6215. bndcu_instruction:
  6216.         mov     ah,0F2h
  6217.       bndc_instruction:
  6218.         mov     [opcode_prefix],ah
  6219.         mov     [base_code],0Fh
  6220.         mov     [extended_code],al
  6221.         call    take_bnd_register
  6222.         mov     [postbyte_register],al
  6223.         call    get_bnd_size
  6224.         mov     [operand_size],al
  6225.         lods    byte [esi]
  6226.         cmp     al,','
  6227.         jne     invalid_operand
  6228.         lods    byte [esi]
  6229.         call    get_size_operator
  6230.         cmp     al,'['
  6231.         je      bndc_mem
  6232.         cmp     al,10h
  6233.         jne     invalid_operand
  6234.         lods    byte [esi]
  6235.         call    convert_register
  6236.         mov     bl,al
  6237.         jmp     nomem_instruction_ready
  6238.       bndc_mem:
  6239.         call    get_address_of_required_size
  6240.         jmp     instruction_ready
  6241. bndmov_instruction:
  6242.         mov     [opcode_prefix],66h
  6243.         mov     [base_code],0Fh
  6244.         mov     [extended_code],al
  6245.         call    get_bnd_size
  6246.         shl     al,1
  6247.         mov     [operand_size],al
  6248.         lods    byte [esi]
  6249.         cmp     al,14h
  6250.         je      bndmov_reg
  6251.         call    get_size_operator
  6252.         cmp     al,'['
  6253.         jne     invalid_operand
  6254.         inc     [extended_code]
  6255.         call    get_address_of_required_size
  6256.         lods    byte [esi]
  6257.         cmp     al,','
  6258.         jne     invalid_operand
  6259.         call    take_bnd_register
  6260.         mov     [postbyte_register],al
  6261.         jmp     instruction_ready
  6262.        bndmov_reg:
  6263.         lods    byte [esi]
  6264.         call    convert_bnd_register
  6265.         mov     [postbyte_register],al
  6266.         lods    byte [esi]
  6267.         cmp     al,','
  6268.         jne     invalid_operand
  6269.         lods    byte [esi]
  6270.         cmp     al,14h
  6271.         je      bndmov_reg_reg
  6272.         call    get_size_operator
  6273.         cmp     al,'['
  6274.         jne     invalid_operand
  6275.         call    get_address_of_required_size
  6276.         jmp     instruction_ready
  6277.       bndmov_reg_reg:
  6278.         lods    byte [esi]
  6279.         call    convert_bnd_register
  6280.         mov     bl,al
  6281.         jmp     nomem_instruction_ready
  6282.     take_bnd_register:
  6283.         lods    byte [esi]
  6284.         cmp     al,14h
  6285.         jne     invalid_operand
  6286.         lods    byte [esi]
  6287.     convert_bnd_register:
  6288.         mov     ah,al
  6289.         shr     ah,4
  6290.         cmp     ah,6
  6291.         jne     invalid_operand
  6292.         and     al,1111b
  6293.         ret
  6294. bndmk_instruction:
  6295.         mov     [opcode_prefix],0F3h
  6296.         mov     [base_code],0Fh
  6297.         mov     [extended_code],al
  6298.         call    take_bnd_register
  6299.         mov     [postbyte_register],al
  6300.         lods    byte [esi]
  6301.         cmp     al,','
  6302.         jne     invalid_operand
  6303.         lods    byte [esi]
  6304.         call    get_size_operator
  6305.         cmp     al,'['
  6306.         jne     invalid_operand
  6307.         call    get_bnd_size
  6308.         call    get_address_prefixes
  6309.         call    get_address_component
  6310.         cmp     byte [esi-1],']'
  6311.         je      bndmk_ready
  6312.         lods    byte [esi]
  6313.         cmp     al,','
  6314.         jne     invalid_operand
  6315.         lods    byte [esi]
  6316.         cmp     al,'('
  6317.         jne     invalid_operand
  6318.         or      dl,bl
  6319.         or      dl,[address_sign]
  6320.         or      edx,[address_high]
  6321.         jnz     invalid_address
  6322.         mov     [address_register],bh
  6323.         call    get_address_component
  6324.         lods    byte [esi]
  6325.         cmp     al,']'
  6326.         jne     invalid_operand
  6327.         or      bh,bh
  6328.         jz      bndmk_selected_base
  6329.         cmp     bl,bh
  6330.         je      bndmk_to_index
  6331.         or      bl,bl
  6332.         jnz     invalid_address
  6333.         mov     bl,bh
  6334.       bndmk_to_index:
  6335.         inc     cl
  6336.       bndmk_selected_base:
  6337.         mov     bh,[address_register]
  6338.       bndmk_ready:
  6339.         or      bx,bx
  6340.         jz      instruction_ready
  6341.         cmp     [address_size_declared],0
  6342.         jne     instruction_ready
  6343.         and     ch,not 0Fh
  6344.         jmp     instruction_ready
  6345.     get_bnd_size:
  6346.         mov     al,4
  6347.         cmp     [code_type],64
  6348.         jne     bnd_size_ok
  6349.         add     al,4
  6350.       bnd_size_ok:
  6351.         mov     [address_size],al
  6352.         ret
  6353.     get_address_component:
  6354.         mov     [free_address_range],0
  6355.         call    calculate_address
  6356.         mov     [address_high],edx
  6357.         mov     edx,eax
  6358.         or      bx,bx
  6359.         jz      address_component_ok
  6360.         mov     al,bl
  6361.         or      al,bh
  6362.         shr     al,4
  6363.         cmp     al,[address_size]
  6364.         jne     invalid_address
  6365.       address_component_ok:
  6366.         ret
  6367. bndldx_instruction:
  6368.         mov     [base_code],0Fh
  6369.         mov     [extended_code],al
  6370.         call    take_bnd_register
  6371.         mov     [postbyte_register],al
  6372.         lods    byte [esi]
  6373.         cmp     al,','
  6374.         jne     invalid_operand
  6375.         call    take_bnd_mib
  6376.         jmp     bndmk_ready
  6377. bndstx_instruction:
  6378.         mov     [base_code],0Fh
  6379.         mov     [extended_code],al
  6380.         call    take_bnd_mib
  6381.         lods    byte [esi]
  6382.         cmp     al,','
  6383.         jne     invalid_operand
  6384.         call    take_bnd_register
  6385.         mov     [postbyte_register],al
  6386.         jmp     bndmk_ready
  6387.     take_bnd_mib:
  6388.         lods    byte [esi]
  6389.         cmp     al,'['
  6390.         jne     invalid_operand
  6391.         call    get_bnd_size
  6392.         call    get_address_prefixes
  6393.         call    get_address_component
  6394.         cmp     byte [esi-1],']'
  6395.         je      bnd_mib_ok
  6396.         lods    byte [esi]
  6397.         cmp     al,','
  6398.         jne     invalid_operand
  6399.         lods    byte [esi]
  6400.         cmp     al,'('
  6401.         jne     invalid_operand
  6402.         mov     al,[address_sign]
  6403.         push    eax ebx ecx edx
  6404.         push    [address_symbol]
  6405.         call    get_address_component
  6406.         lods    byte [esi]
  6407.         cmp     al,']'
  6408.         jne     invalid_operand
  6409.         or      dl,bl
  6410.         or      dl,[address_sign]
  6411.         or      edx,[address_high]
  6412.         jnz     invalid_address
  6413.         mov     [address_register],bh
  6414.         pop     [address_symbol]
  6415.         pop     edx ecx ebx eax
  6416.         mov     [address_sign],al
  6417.         or      bl,bl
  6418.         jz      mib_place_index
  6419.         or      bh,bh
  6420.         jnz     invalid_address
  6421.         cmp     cl,1
  6422.         jne     invalid_address
  6423.         mov     bh,bl
  6424.       mib_place_index:
  6425.         mov     bl,[address_register]
  6426.         xor     cl,cl
  6427.         or      bl,bl
  6428.         jz      bnd_mib_ok
  6429.         inc     cl
  6430.       bnd_mib_ok:
  6431.         ret
  6432.  
  6433. tpause_instruction:
  6434.         mov     [postbyte_register],6
  6435.         mov     [extended_code],0AEh
  6436.         mov     [base_code],0Fh
  6437.         mov     [opcode_prefix],al
  6438.         call    take_register
  6439.         cmp     ah,4
  6440.         jne     invalid_operand_size
  6441.         mov     bl,al
  6442.         cmp     byte [esi],','
  6443.         jne     nomem_instruction_ready
  6444.         inc     esi
  6445.         call    take_register
  6446.         cmp     ax,0402h
  6447.         jne     invalid_operand
  6448.         lods    byte [esi]
  6449.         cmp     al,','
  6450.         jne     invalid_operand
  6451.         call    take_register
  6452.         cmp     ax,0400h
  6453.         jne     invalid_operand
  6454.         jmp     nomem_instruction_ready
  6455. umonitor_instruction:
  6456.         mov     [postbyte_register],6
  6457.         mov     [extended_code],0AEh
  6458.         mov     [base_code],0Fh
  6459.         mov     [opcode_prefix],0F3h
  6460.         call    take_register
  6461.         mov     bl,al
  6462.         mov     al,ah
  6463.         call    operand_autodetect
  6464.         jmp     nomem_instruction_ready
  6465. movdir64b_instruction:
  6466.         call    setup_66_0f_38
  6467.         call    take_register
  6468.         mov     [postbyte_register],al
  6469.         xor     al,al
  6470.         xchg    al,[operand_size]
  6471.         push    eax
  6472.         lods    byte [esi]
  6473.         cmp     al,','
  6474.         jne     invalid_operand
  6475.         lods    byte [esi]
  6476.         call    get_size_operator
  6477.         cmp     al,'['
  6478.         jne     invalid_operand
  6479.         call    get_address
  6480.         mov     al,[operand_size]
  6481.         or      al,al
  6482.         jz      movdir64b_ready
  6483.         cmp     al,64
  6484.         jne     invalid_operand_size
  6485.       movdir64b_ready:
  6486.         push    edi
  6487.         call    store_instruction
  6488.         pop     ebx eax
  6489.         mov     cl,[code_type]
  6490.         cmp     byte [ebx],67h
  6491.         jne     movdir64b_size_check
  6492.         shr     cl,1
  6493.         cmp     cl,16
  6494.         jae     movdir64b_size_check
  6495.         mov     cl,32
  6496.       movdir64b_size_check:
  6497.         shl     al,3
  6498.         cmp     al,cl
  6499.         jne     invalid_operand_size
  6500.         jmp     instruction_assembled
  6501.  
  6502. setssbsy_instruction:
  6503.         shl     eax,24
  6504.         or      eax,010FF3h
  6505.         stos    dword [edi]
  6506.         jmp     instruction_assembled
  6507. rstorssp_instruction:
  6508.         mov     ah,1
  6509.         jmp     setup_clrssbsy
  6510. clrssbsy_instruction:
  6511.         mov     ah,0AEh
  6512.       setup_clrssbsy:
  6513.         mov     [base_code],0Fh
  6514.         mov     [extended_code],ah
  6515.         mov     [postbyte_register],al
  6516.         mov     [opcode_prefix],0F3h
  6517.         lods    byte [esi]
  6518.         call    get_size_operator
  6519.         cmp     al,'['
  6520.         jne     invalid_operand
  6521.         call    get_address
  6522.         test    [operand_size],not 8
  6523.         jnz     invalid_operand_size
  6524.         jmp     instruction_ready
  6525. rdsspq_instruction:
  6526.         mov     [rex_prefix],48h
  6527. rdsspd_instruction:
  6528.         mov     ah,1Eh
  6529.         jmp     setup_incssp
  6530. incsspq_instruction:
  6531.         mov     [rex_prefix],48h
  6532. incsspd_instruction:
  6533.         mov     ah,0AEh
  6534.       setup_incssp:
  6535.         mov     [base_code],0Fh
  6536.         mov     [extended_code],ah
  6537.         mov     [postbyte_register],al
  6538.         mov     [opcode_prefix],0F3h
  6539.         lods    byte [esi]
  6540.         call    get_size_operator
  6541.         cmp     al,10h
  6542.         jne     invalid_operand
  6543.         lods    byte [esi]
  6544.         call    convert_register
  6545.         mov     bl,al
  6546.         call    cet_size_check
  6547.         jmp     nomem_instruction_ready
  6548.       cet_size_check:
  6549.         cmp     [rex_prefix],0
  6550.         je      cet_dword
  6551.         cmp     [code_type],64
  6552.         jne     illegal_instruction
  6553.         shr     ah,1
  6554.       cet_dword:
  6555.         cmp     ah,4
  6556.         jne     invalid_operand_size
  6557.         ret
  6558. wrussq_instruction:
  6559.         mov     [opcode_prefix],66h
  6560. wrssq_instruction:
  6561.         mov     [rex_prefix],48h
  6562.         jmp     wrssd_instruction
  6563. wrussd_instruction:
  6564.         mov     [opcode_prefix],66h
  6565. wrssd_instruction:
  6566.         mov     [base_code],0Fh
  6567.         mov     [extended_code],38h
  6568.         mov     [supplemental_code],al
  6569.         lods    byte [esi]
  6570.         call    get_size_operator
  6571.         cmp     al,10h
  6572.         je      wrss_reg
  6573.         cmp     al,'['
  6574.         jne     invalid_operand
  6575.         call    get_address
  6576.         push    edx ebx ecx
  6577.         lods    byte [esi]
  6578.         cmp     al,','
  6579.         jne     invalid_operand
  6580.         call    take_register
  6581.         mov     [postbyte_register],al
  6582.         pop     ecx ebx edx
  6583.         call    cet_size_check
  6584.         jmp     instruction_ready
  6585.       wrss_reg:
  6586.         lods    byte [esi]
  6587.         call    convert_register
  6588.         mov     [postbyte_register],al
  6589.         lods    byte [esi]
  6590.         cmp     al,','
  6591.         jne     invalid_operand
  6592.         call    take_register
  6593.         mov     bl,al
  6594.         xchg    bl,[postbyte_register]
  6595.         call    cet_size_check
  6596.         jmp     nomem_instruction_ready
  6597. endbr_instruction:
  6598.         shl     eax,24
  6599.         or      eax,1E0FF3h
  6600.         stos    dword [edi]
  6601.         jmp     instruction_assembled
  6602.  
  6603. take_register:
  6604.         lods    byte [esi]
  6605.         call    get_size_operator
  6606.         cmp     al,10h
  6607.         jne     invalid_operand
  6608.         lods    byte [esi]
  6609. convert_register:
  6610.         mov     ah,al
  6611.         shr     ah,4
  6612.         and     al,0Fh
  6613.         cmp     ah,8
  6614.         je      match_register_size
  6615.         cmp     ah,4
  6616.         ja      invalid_operand
  6617.         cmp     ah,1
  6618.         ja      match_register_size
  6619.         cmp     al,4
  6620.         jb      match_register_size
  6621.         or      ah,ah
  6622.         jz      high_byte_register
  6623.         or      [rex_prefix],40h
  6624.       match_register_size:
  6625.         cmp     ah,[operand_size]
  6626.         je      register_size_ok
  6627.         cmp     [operand_size],0
  6628.         jne     operand_sizes_do_not_match
  6629.         mov     [operand_size],ah
  6630.       register_size_ok:
  6631.         ret
  6632.       high_byte_register:
  6633.         mov     ah,1
  6634.         or      [rex_prefix],10h
  6635.         jmp     match_register_size
  6636. convert_fpu_register:
  6637.         mov     ah,al
  6638.         shr     ah,4
  6639.         and     al,111b
  6640.         cmp     ah,10
  6641.         jne     invalid_operand
  6642.         jmp     match_register_size
  6643. convert_mmx_register:
  6644.         mov     ah,al
  6645.         shr     ah,4
  6646.         cmp     ah,0Ch
  6647.         je      xmm_register
  6648.         ja      invalid_operand
  6649.         and     al,111b
  6650.         cmp     ah,0Bh
  6651.         jne     invalid_operand
  6652.         mov     ah,8
  6653.         jmp     match_register_size
  6654.       xmm_register:
  6655.         and     al,0Fh
  6656.         mov     ah,16
  6657.         cmp     al,8
  6658.         jb      match_register_size
  6659.         cmp     [code_type],64
  6660.         jne     invalid_operand
  6661.         jmp     match_register_size
  6662. convert_xmm_register:
  6663.         mov     ah,al
  6664.         shr     ah,4
  6665.         cmp     ah,0Ch
  6666.         je      xmm_register
  6667.         jmp     invalid_operand
  6668. get_size_operator:
  6669.         xor     ah,ah
  6670.         cmp     al,11h
  6671.         jne     no_size_operator
  6672.         mov     [size_declared],1
  6673.         lods    word [esi]
  6674.         xchg    al,ah
  6675.         or      [operand_flags],1
  6676.         cmp     ah,[operand_size]
  6677.         je      size_operator_ok
  6678.         cmp     [operand_size],0
  6679.         jne     operand_sizes_do_not_match
  6680.         mov     [operand_size],ah
  6681.       size_operator_ok:
  6682.         ret
  6683.       no_size_operator:
  6684.         mov     [size_declared],0
  6685.         cmp     al,'['
  6686.         jne     size_operator_ok
  6687.         and     [operand_flags],not 1
  6688.         ret
  6689. get_jump_operator:
  6690.         mov     [jump_type],0
  6691.         cmp     al,12h
  6692.         jne     jump_operator_ok
  6693.         lods    word [esi]
  6694.         mov     [jump_type],al
  6695.         mov     al,ah
  6696.       jump_operator_ok:
  6697.         ret
  6698. get_address:
  6699.         and     [address_size],0
  6700.     get_address_of_required_size:
  6701.         call    get_address_prefixes
  6702.         and     [free_address_range],0
  6703.         call    calculate_address
  6704.         cmp     byte [esi-1],']'
  6705.         jne     invalid_address
  6706.         mov     [address_high],edx
  6707.         mov     edx,eax
  6708.         cmp     [address_size_declared],0
  6709.         jne     address_ok
  6710.         cmp     [segment_register],4
  6711.         ja      address_ok
  6712.         or      bx,bx
  6713.         jnz     clear_address_size
  6714.         cmp     [code_type],64
  6715.         jne     address_ok
  6716.       calculate_relative_address:
  6717.         mov     edx,[address_symbol]
  6718.         mov     [symbol_identifier],edx
  6719.         mov     edx,[address_high]
  6720.         mov     ebp,[addressing_space]
  6721.         call    calculate_relative_offset
  6722.         mov     [address_high],edx
  6723.         cdq
  6724.         cmp     edx,[address_high]
  6725.         je      address_high_ok
  6726.         call    recoverable_overflow
  6727.       address_high_ok:
  6728.         mov     edx,eax
  6729.         ror     ecx,16
  6730.         mov     cl,[value_type]
  6731.         rol     ecx,16
  6732.         mov     bx,9900h
  6733.       clear_address_size:
  6734.         and     ch,not 0Fh
  6735.       address_ok:
  6736.         ret
  6737. get_address_prefixes:
  6738.         and     [segment_register],0
  6739.         and     [address_size_declared],0
  6740.         mov     al,[code_type]
  6741.         shr     al,3
  6742.         mov     [value_size],al
  6743.         mov     al,[esi]
  6744.         and     al,11110000b
  6745.         cmp     al,60h
  6746.         jne     get_address_size_prefix
  6747.         lods    byte [esi]
  6748.         sub     al,60h
  6749.         mov     [segment_register],al
  6750.         mov     al,[esi]
  6751.         and     al,11110000b
  6752.       get_address_size_prefix:
  6753.         cmp     al,70h
  6754.         jne     address_size_prefix_ok
  6755.         lods    byte [esi]
  6756.         sub     al,70h
  6757.         cmp     al,2
  6758.         jb      invalid_address_size
  6759.         cmp     al,8
  6760.         ja      invalid_address_size
  6761.         mov     [value_size],al
  6762.         or      [address_size_declared],1
  6763.         or      [address_size],al
  6764.         cmp     al,[address_size]
  6765.         jne     invalid_address_size
  6766.       address_size_prefix_ok:
  6767.         ret
  6768. operand_16bit:
  6769.         cmp     [code_type],16
  6770.         je      size_prefix_ok
  6771.         mov     [operand_prefix],66h
  6772.         ret
  6773. operand_32bit:
  6774.         cmp     [code_type],16
  6775.         jne     size_prefix_ok
  6776.         mov     [operand_prefix],66h
  6777.       size_prefix_ok:
  6778.         ret
  6779. operand_64bit:
  6780.         cmp     [code_type],64
  6781.         jne     illegal_instruction
  6782.         or      [rex_prefix],48h
  6783.         ret
  6784. operand_autodetect:
  6785.         cmp     al,2
  6786.         je      operand_16bit
  6787.         cmp     al,4
  6788.         je      operand_32bit
  6789.         cmp     al,8
  6790.         je      operand_64bit
  6791.         jmp     invalid_operand_size
  6792. store_segment_prefix_if_necessary:
  6793.         mov     al,[segment_register]
  6794.         or      al,al
  6795.         jz      segment_prefix_ok
  6796.         cmp     al,4
  6797.         ja      segment_prefix_386
  6798.         cmp     [code_type],64
  6799.         je      segment_prefix_ok
  6800.         cmp     al,3
  6801.         je      ss_prefix
  6802.         jb      segment_prefix_86
  6803.         cmp     bl,25h
  6804.         je      segment_prefix_86
  6805.         cmp     bh,25h
  6806.         je      segment_prefix_86
  6807.         cmp     bh,45h
  6808.         je      segment_prefix_86
  6809.         cmp     bh,44h
  6810.         je      segment_prefix_86
  6811.         ret
  6812.       ss_prefix:
  6813.         cmp     bl,25h
  6814.         je      segment_prefix_ok
  6815.         cmp     bh,25h
  6816.         je      segment_prefix_ok
  6817.         cmp     bh,45h
  6818.         je      segment_prefix_ok
  6819.         cmp     bh,44h
  6820.         je      segment_prefix_ok
  6821.         jmp     segment_prefix_86
  6822. store_segment_prefix:
  6823.         mov     al,[segment_register]
  6824.         or      al,al
  6825.         jz      segment_prefix_ok
  6826.         cmp     al,5
  6827.         jae     segment_prefix_386
  6828.       segment_prefix_86:
  6829.         dec     al
  6830.         shl     al,3
  6831.         add     al,26h
  6832.         stos    byte [edi]
  6833.         jmp     segment_prefix_ok
  6834.       segment_prefix_386:
  6835.         add     al,64h-5
  6836.         stos    byte [edi]
  6837.       segment_prefix_ok:
  6838.         ret
  6839. store_instruction_code:
  6840.         cmp     [vex_required],0
  6841.         jne     store_vex_instruction_code
  6842. store_classic_instruction_code:
  6843.         mov     al,[operand_prefix]
  6844.         or      al,al
  6845.         jz      operand_prefix_ok
  6846.         stos    byte [edi]
  6847.       operand_prefix_ok:
  6848.         mov     al,[opcode_prefix]
  6849.         or      al,al
  6850.         jz      opcode_prefix_ok
  6851.         stos    byte [edi]
  6852.       opcode_prefix_ok:
  6853.         mov     al,[rex_prefix]
  6854.         test    al,40h
  6855.         jz      rex_prefix_ok
  6856.         cmp     [code_type],64
  6857.         jne     invalid_operand
  6858.         test    al,0B0h
  6859.         jnz     disallowed_combination_of_registers
  6860.         stos    byte [edi]
  6861.       rex_prefix_ok:
  6862.         mov     al,[base_code]
  6863.         stos    byte [edi]
  6864.         cmp     al,0Fh
  6865.         jne     instruction_code_ok
  6866.       store_extended_code:
  6867.         mov     al,[extended_code]
  6868.         stos    byte [edi]
  6869.         cmp     al,38h
  6870.         je      store_supplemental_code
  6871.         cmp     al,3Ah
  6872.         je      store_supplemental_code
  6873.       instruction_code_ok:
  6874.         ret
  6875.       store_supplemental_code:
  6876.         mov     al,[supplemental_code]
  6877.         stos    byte [edi]
  6878.         ret
  6879. store_nomem_instruction:
  6880.         test    [postbyte_register],10000b
  6881.         jz      nomem_reg_high_code_ok
  6882.         or      [vex_required],10h
  6883.         and     [postbyte_register],1111b
  6884.       nomem_reg_high_code_ok:
  6885.         test    [postbyte_register],1000b
  6886.         jz      nomem_reg_code_ok
  6887.         or      [rex_prefix],44h
  6888.         and     [postbyte_register],111b
  6889.       nomem_reg_code_ok:
  6890.         test    bl,10000b
  6891.         jz      nomem_rm_high_code_ok
  6892.         or      [rex_prefix],42h
  6893.         or      [vex_required],8
  6894.         and     bl,1111b
  6895.       nomem_rm_high_code_ok:
  6896.         test    bl,1000b
  6897.         jz      nomem_rm_code_ok
  6898.         or      [rex_prefix],41h
  6899.         and     bl,111b
  6900.       nomem_rm_code_ok:
  6901.         and     [displacement_compression],0
  6902.         call    store_instruction_code
  6903.         mov     al,[postbyte_register]
  6904.         shl     al,3
  6905.         or      al,bl
  6906.         or      al,11000000b
  6907.         stos    byte [edi]
  6908.         ret
  6909. store_instruction:
  6910.         mov     [current_offset],edi
  6911.         and     [displacement_compression],0
  6912.         test    [postbyte_register],10000b
  6913.         jz      reg_high_code_ok
  6914.         or      [vex_required],10h
  6915.         and     [postbyte_register],1111b
  6916.       reg_high_code_ok:
  6917.         test    [postbyte_register],1000b
  6918.         jz      reg_code_ok
  6919.         or      [rex_prefix],44h
  6920.         and     [postbyte_register],111b
  6921.       reg_code_ok:
  6922.         cmp     [code_type],64
  6923.         jne     address_value_ok
  6924.         xor     eax,eax
  6925.         bt      edx,31
  6926.         sbb     eax,[address_high]
  6927.         jz      address_value_ok
  6928.         cmp     [address_high],0
  6929.         jne     address_value_out_of_range
  6930.         test    ch,44h
  6931.         jnz     address_value_ok
  6932.         test    bx,8080h
  6933.         jz      address_value_ok
  6934.       address_value_out_of_range:
  6935.         call    recoverable_overflow
  6936.       address_value_ok:
  6937.         call    store_segment_prefix_if_necessary
  6938.         test    [vex_required],4
  6939.         jnz     address_vsib
  6940.         or      bx,bx
  6941.         jz      address_immediate
  6942.         cmp     bx,9800h
  6943.         je      address_rip_based
  6944.         cmp     bx,9400h
  6945.         je      address_eip_based
  6946.         cmp     bx,9900h
  6947.         je      address_relative
  6948.         mov     al,bl
  6949.         or      al,bh
  6950.         and     al,11110000b
  6951.         cmp     al,80h
  6952.         je      postbyte_64bit
  6953.         cmp     al,40h
  6954.         je      postbyte_32bit
  6955.         cmp     al,20h
  6956.         jne     invalid_address
  6957.         cmp     [code_type],64
  6958.         je      invalid_address_size
  6959.         call    address_16bit_prefix
  6960.         test    ch,22h
  6961.         setz    [displacement_compression]
  6962.         call    store_instruction_code
  6963.         cmp     bl,bh
  6964.         jbe     determine_16bit_address
  6965.         xchg    bl,bh
  6966.       determine_16bit_address:
  6967.         cmp     bx,2600h
  6968.         je      address_si
  6969.         cmp     bx,2700h
  6970.         je      address_di
  6971.         cmp     bx,2300h
  6972.         je      address_bx
  6973.         cmp     bx,2500h
  6974.         je      address_bp
  6975.         cmp     bx,2625h
  6976.         je      address_bp_si
  6977.         cmp     bx,2725h
  6978.         je      address_bp_di
  6979.         cmp     bx,2723h
  6980.         je      address_bx_di
  6981.         cmp     bx,2623h
  6982.         jne     invalid_address
  6983.       address_bx_si:
  6984.         xor     al,al
  6985.         jmp     postbyte_16bit
  6986.       address_bx_di:
  6987.         mov     al,1
  6988.         jmp     postbyte_16bit
  6989.       address_bp_si:
  6990.         mov     al,10b
  6991.         jmp     postbyte_16bit
  6992.       address_bp_di:
  6993.         mov     al,11b
  6994.         jmp     postbyte_16bit
  6995.       address_si:
  6996.         mov     al,100b
  6997.         jmp     postbyte_16bit
  6998.       address_di:
  6999.         mov     al,101b
  7000.         jmp     postbyte_16bit
  7001.       address_bx:
  7002.         mov     al,111b
  7003.         jmp     postbyte_16bit
  7004.       address_bp:
  7005.         mov     al,110b
  7006.       postbyte_16bit:
  7007.         test    ch,22h
  7008.         jnz     address_16bit_value
  7009.         or      ch,ch
  7010.         jnz     address_sizes_do_not_agree
  7011.         cmp     edx,10000h
  7012.         jge     value_out_of_range
  7013.         cmp     edx,-8000h
  7014.         jl      value_out_of_range
  7015.         or      dx,dx
  7016.         jz      address
  7017.         cmp     [displacement_compression],2
  7018.         ja      address_8bit_value
  7019.         je      address_16bit_value
  7020.         cmp     dx,80h
  7021.         jb      address_8bit_value
  7022.         cmp     dx,-80h
  7023.         jae     address_8bit_value
  7024.       address_16bit_value:
  7025.         or      al,10000000b
  7026.         mov     cl,[postbyte_register]
  7027.         shl     cl,3
  7028.         or      al,cl
  7029.         stos    byte [edi]
  7030.         mov     eax,edx
  7031.         stos    word [edi]
  7032.         ret
  7033.       address_8bit_value:
  7034.         or      al,01000000b
  7035.         mov     cl,[postbyte_register]
  7036.         shl     cl,3
  7037.         or      al,cl
  7038.         stos    byte [edi]
  7039.         mov     al,dl
  7040.         stos    byte [edi]
  7041.         ret
  7042.       address:
  7043.         cmp     al,110b
  7044.         je      address_8bit_value
  7045.         mov     cl,[postbyte_register]
  7046.         shl     cl,3
  7047.         or      al,cl
  7048.         stos    byte [edi]
  7049.         ret
  7050.       address_vsib:
  7051.         mov     al,bl
  7052.         shr     al,4
  7053.         test    al,1
  7054.         jz      vsib_high_code_ok
  7055.         or      [vex_register],10000b
  7056.         or      [vex_required],8
  7057.         xor     al,1
  7058.       vsib_high_code_ok:
  7059.         cmp     al,6
  7060.         je      vsib_index_ok
  7061.         cmp     al,0Ch
  7062.         jb      invalid_address
  7063.       vsib_index_ok:
  7064.         mov     al,bh
  7065.         shr     al,4
  7066.         cmp     al,4
  7067.         je      postbyte_32bit
  7068.         cmp     [code_type],64
  7069.         je      address_prefix_ok
  7070.         test    al,al
  7071.         jnz     invalid_address
  7072.       postbyte_32bit:
  7073.         call    address_32bit_prefix
  7074.         jmp     address_prefix_ok
  7075.       postbyte_64bit:
  7076.         cmp     [code_type],64
  7077.         jne     invalid_address_size
  7078.       address_prefix_ok:
  7079.         cmp     bl,44h
  7080.         je      invalid_address
  7081.         cmp     bl,84h
  7082.         je      invalid_address
  7083.         test    bh,1000b
  7084.         jz      base_code_ok
  7085.         or      [rex_prefix],41h
  7086.       base_code_ok:
  7087.         test    bl,1000b
  7088.         jz      index_code_ok
  7089.         or      [rex_prefix],42h
  7090.       index_code_ok:
  7091.         test    ch,44h or 88h
  7092.         setz    [displacement_compression]
  7093.         call    store_instruction_code
  7094.         or      cl,cl
  7095.         jz      only_base_register
  7096.       base_and_index:
  7097.         mov     al,100b
  7098.         xor     ah,ah
  7099.         cmp     cl,1
  7100.         je      scale_ok
  7101.         cmp     cl,2
  7102.         je      scale_1
  7103.         cmp     cl,4
  7104.         je      scale_2
  7105.         or      ah,11000000b
  7106.         jmp     scale_ok
  7107.       scale_2:
  7108.         or      ah,10000000b
  7109.         jmp     scale_ok
  7110.       scale_1:
  7111.         or      ah,01000000b
  7112.       scale_ok:
  7113.         or      bh,bh
  7114.         jz      only_index_register
  7115.         and     bl,111b
  7116.         shl     bl,3
  7117.         or      ah,bl
  7118.         and     bh,111b
  7119.         or      ah,bh
  7120.       sib_ready:
  7121.         test    ch,44h or 88h
  7122.         jnz     sib_address_32bit_value
  7123.         or      ch,ch
  7124.         jnz     address_sizes_do_not_agree
  7125.         cmp     bh,5
  7126.         je      address_value
  7127.         or      edx,edx
  7128.         jz      sib_address
  7129.       address_value:
  7130.         cmp     [displacement_compression],2
  7131.         ja      sib_address_8bit_value
  7132.         je      sib_address_32bit_value
  7133.         cmp     edx,80h
  7134.         jb      sib_address_8bit_value
  7135.         cmp     edx,-80h
  7136.         jnb     sib_address_8bit_value
  7137.       sib_address_32bit_value:
  7138.         or      al,10000000b
  7139.         mov     cl,[postbyte_register]
  7140.         shl     cl,3
  7141.         or      al,cl
  7142.         stos    word [edi]
  7143.         jmp     store_address_32bit_value
  7144.       sib_address_8bit_value:
  7145.         or      al,01000000b
  7146.         mov     cl,[postbyte_register]
  7147.         shl     cl,3
  7148.         or      al,cl
  7149.         stos    word [edi]
  7150.         mov     al,dl
  7151.         stos    byte [edi]
  7152.         ret
  7153.       sib_address:
  7154.         mov     cl,[postbyte_register]
  7155.         shl     cl,3
  7156.         or      al,cl
  7157.         stos    word [edi]
  7158.         ret
  7159.       only_index_register:
  7160.         or      ah,101b
  7161.         and     bl,111b
  7162.         shl     bl,3
  7163.         or      ah,bl
  7164.         mov     cl,[postbyte_register]
  7165.         shl     cl,3
  7166.         or      al,cl
  7167.         stos    word [edi]
  7168.         test    ch,44h or 88h
  7169.         jnz     store_address_32bit_value
  7170.         or      ch,ch
  7171.         jnz     invalid_address_size
  7172.         cmp     [displacement_compression],2
  7173.         jbe     store_address_32bit_value
  7174.         mov     edx,[uncompressed_displacement]
  7175.         jmp     store_address_32bit_value
  7176.       zero_index_register:
  7177.         mov     bl,4
  7178.         mov     cl,1
  7179.         jmp     base_and_index
  7180.       only_base_register:
  7181.         mov     al,bh
  7182.         and     al,111b
  7183.         cmp     al,4
  7184.         je      zero_index_register
  7185.         test    ch,44h or 88h
  7186.         jnz     simple_address_32bit_value
  7187.         or      ch,ch
  7188.         jnz     address_sizes_do_not_agree
  7189.         or      edx,edx
  7190.         jz      simple_address
  7191.         cmp     [displacement_compression],2
  7192.         ja      simple_address_8bit_value
  7193.         je      simple_address_32bit_value
  7194.         cmp     edx,80h
  7195.         jb      simple_address_8bit_value
  7196.         cmp     edx,-80h
  7197.         jnb     simple_address_8bit_value
  7198.       simple_address_32bit_value:
  7199.         or      al,10000000b
  7200.         mov     cl,[postbyte_register]
  7201.         shl     cl,3
  7202.         or      al,cl
  7203.         stos    byte [edi]
  7204.         jmp     store_address_32bit_value
  7205.       simple_address_8bit_value:
  7206.         or      al,01000000b
  7207.         mov     cl,[postbyte_register]
  7208.         shl     cl,3
  7209.         or      al,cl
  7210.         stos    byte [edi]
  7211.         mov     al,dl
  7212.         stos    byte [edi]
  7213.         ret
  7214.       simple_address:
  7215.         cmp     al,5
  7216.         je      simple_address_8bit_value
  7217.         mov     cl,[postbyte_register]
  7218.         shl     cl,3
  7219.         or      al,cl
  7220.         stos    byte [edi]
  7221.         ret
  7222.       address_immediate:
  7223.         cmp     [code_type],64
  7224.         je      address_immediate_sib
  7225.         test    ch,44h or 88h
  7226.         jnz     address_immediate_32bit
  7227.         test    ch,22h
  7228.         jnz     address_immediate_16bit
  7229.         or      ch,ch
  7230.         jnz     invalid_address_size
  7231.         cmp     [code_type],16
  7232.         je      addressing_16bit
  7233.       address_immediate_32bit:
  7234.         call    address_32bit_prefix
  7235.         call    store_instruction_code
  7236.       store_immediate_address:
  7237.         mov     al,101b
  7238.         mov     cl,[postbyte_register]
  7239.         shl     cl,3
  7240.         or      al,cl
  7241.         stos    byte [edi]
  7242.       store_address_32bit_value:
  7243.         test    ch,0F0h
  7244.         jz      address_32bit_relocation_ok
  7245.         mov     eax,ecx
  7246.         shr     eax,16
  7247.         cmp     al,4
  7248.         jne     address_32bit_relocation
  7249.         mov     al,2
  7250.       address_32bit_relocation:
  7251.         xchg    [value_type],al
  7252.         mov     ebx,[address_symbol]
  7253.         xchg    ebx,[symbol_identifier]
  7254.         call    mark_relocation
  7255.         mov     [value_type],al
  7256.         mov     [symbol_identifier],ebx
  7257.       address_32bit_relocation_ok:
  7258.         mov     eax,edx
  7259.         stos    dword [edi]
  7260.         ret
  7261.       store_address_64bit_value:
  7262.         test    ch,0F0h
  7263.         jz      address_64bit_relocation_ok
  7264.         mov     eax,ecx
  7265.         shr     eax,16
  7266.         xchg    [value_type],al
  7267.         mov     ebx,[address_symbol]
  7268.         xchg    ebx,[symbol_identifier]
  7269.         call    mark_relocation
  7270.         mov     [value_type],al
  7271.         mov     [symbol_identifier],ebx
  7272.       address_64bit_relocation_ok:
  7273.         mov     eax,edx
  7274.         stos    dword [edi]
  7275.         mov     eax,[address_high]
  7276.         stos    dword [edi]
  7277.         ret
  7278.       address_immediate_sib:
  7279.         test    ch,44h
  7280.         jnz     address_immediate_sib_32bit
  7281.         test    ch,not 88h
  7282.         jnz     invalid_address_size
  7283.         test    edx,80000000h
  7284.         jz      address_immediate_sib_store
  7285.         cmp     [address_high],0
  7286.         je      address_immediate_sib_nosignextend
  7287.       address_immediate_sib_store:
  7288.         call    store_instruction_code
  7289.         mov     al,100b
  7290.         mov     ah,100101b
  7291.         mov     cl,[postbyte_register]
  7292.         shl     cl,3
  7293.         or      al,cl
  7294.         stos    word [edi]
  7295.         jmp     store_address_32bit_value
  7296.       address_immediate_sib_32bit:
  7297.         test    ecx,0FF0000h
  7298.         jnz     address_immediate_sib_nosignextend
  7299.         test    edx,80000000h
  7300.         jz      address_immediate_sib_store
  7301.       address_immediate_sib_nosignextend:
  7302.         call    address_32bit_prefix
  7303.         jmp     address_immediate_sib_store
  7304.       address_eip_based:
  7305.         mov     al,67h
  7306.         stos    byte [edi]
  7307.       address_rip_based:
  7308.         cmp     [code_type],64
  7309.         jne     invalid_address
  7310.         call    store_instruction_code
  7311.         jmp     store_immediate_address
  7312.       address_relative:
  7313.         call    store_instruction_code
  7314.         movzx   eax,[immediate_size]
  7315.         add     eax,edi
  7316.         sub     eax,[current_offset]
  7317.         add     eax,5
  7318.         sub     edx,eax
  7319.         jno     address_relative_ok
  7320.         call    recoverable_overflow
  7321.       address_relative_ok:
  7322.         mov     al,101b
  7323.         mov     cl,[postbyte_register]
  7324.         shl     cl,3
  7325.         or      al,cl
  7326.         stos    byte [edi]
  7327.         shr     ecx,16
  7328.         xchg    [value_type],cl
  7329.         mov     ebx,[address_symbol]
  7330.         xchg    ebx,[symbol_identifier]
  7331.         mov     eax,edx
  7332.         call    mark_relocation
  7333.         mov     [value_type],cl
  7334.         mov     [symbol_identifier],ebx
  7335.         stos    dword [edi]
  7336.         ret
  7337.       addressing_16bit:
  7338.         cmp     edx,10000h
  7339.         jge     address_immediate_32bit
  7340.         cmp     edx,-8000h
  7341.         jl      address_immediate_32bit
  7342.         movzx   edx,dx
  7343.       address_immediate_16bit:
  7344.         call    address_16bit_prefix
  7345.         call    store_instruction_code
  7346.         mov     al,110b
  7347.         mov     cl,[postbyte_register]
  7348.         shl     cl,3
  7349.         or      al,cl
  7350.         stos    byte [edi]
  7351.         mov     eax,edx
  7352.         stos    word [edi]
  7353.         cmp     edx,10000h
  7354.         jge     value_out_of_range
  7355.         cmp     edx,-8000h
  7356.         jl      value_out_of_range
  7357.         ret
  7358.       address_16bit_prefix:
  7359.         cmp     [code_type],16
  7360.         je      instruction_prefix_ok
  7361.         mov     al,67h
  7362.         stos    byte [edi]
  7363.         ret
  7364.       address_32bit_prefix:
  7365.         cmp     [code_type],32
  7366.         je      instruction_prefix_ok
  7367.         mov     al,67h
  7368.         stos    byte [edi]
  7369.       instruction_prefix_ok:
  7370.         ret
  7371. store_instruction_with_imm8:
  7372.         mov     [immediate_size],1
  7373.         call    store_instruction
  7374.         mov     al,byte [value]
  7375.         stos    byte [edi]
  7376.         ret
  7377. store_instruction_with_imm16:
  7378.         mov     [immediate_size],2
  7379.         call    store_instruction
  7380.         mov     ax,word [value]
  7381.         call    mark_relocation
  7382.         stos    word [edi]
  7383.         ret
  7384. store_instruction_with_imm32:
  7385.         mov     [immediate_size],4
  7386.         call    store_instruction
  7387.         mov     eax,dword [value]
  7388.         call    mark_relocation
  7389.         stos    dword [edi]
  7390.         ret
  7391.