Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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