Subversion Repositories Kolibri OS

Rev

Rev 2664 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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