Subversion Repositories Kolibri OS

Rev

Rev 2665 | 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.         xor     ebx,ebx
  3316.         call    store_segment_prefix_if_necessary
  3317.         mov     al,0A4h
  3318.       movs_check_size:
  3319.         mov     bl,[operand_size]
  3320.         cmp     bl,1
  3321.         je      simple_instruction
  3322.         inc     al
  3323.         cmp     bl,2
  3324.         je      simple_instruction_16bit
  3325.         cmp     bl,4
  3326.         je      simple_instruction_32bit
  3327.         cmp     bl,8
  3328.         je      simple_instruction_64bit
  3329.         or      bl,bl
  3330.         jnz     invalid_operand_size
  3331.         call    recoverable_unknown_size
  3332.         jmp     simple_instruction
  3333. lods_instruction:
  3334.         lods    byte [esi]
  3335.         call    get_size_operator
  3336.         cmp     al,'['
  3337.         jne     invalid_operand
  3338.         call    get_address
  3339.         or      eax,eax
  3340.         jnz     invalid_address
  3341.         or      bl,ch
  3342.         jnz     invalid_address
  3343.         cmp     bh,26h
  3344.         je      lods_address_16bit
  3345.         cmp     bh,46h
  3346.         je      lods_address_32bit
  3347.         cmp     bh,86h
  3348.         jne     invalid_address
  3349.         cmp     [code_type],64
  3350.         jne     invalid_address_size
  3351.         jmp     lods_store
  3352.       lods_address_32bit:
  3353.         call    address_32bit_prefix
  3354.         jmp     lods_store
  3355.       lods_address_16bit:
  3356.         cmp     [code_type],64
  3357.         je      invalid_address_size
  3358.         call    address_16bit_prefix
  3359.       lods_store:
  3360.         xor     ebx,ebx
  3361.         call    store_segment_prefix_if_necessary
  3362.         mov     al,0ACh
  3363.         jmp     movs_check_size
  3364. stos_instruction:
  3365.         mov     [base_code],al
  3366.         lods    byte [esi]
  3367.         call    get_size_operator
  3368.         cmp     al,'['
  3369.         jne     invalid_operand
  3370.         call    get_address
  3371.         or      eax,eax
  3372.         jnz     invalid_address
  3373.         or      bl,ch
  3374.         jnz     invalid_address
  3375.         cmp     bh,27h
  3376.         je      stos_address_16bit
  3377.         cmp     bh,47h
  3378.         je      stos_address_32bit
  3379.         cmp     bh,87h
  3380.         jne     invalid_address
  3381.         cmp     [code_type],64
  3382.         jne     invalid_address_size
  3383.         jmp     stos_store
  3384.       stos_address_32bit:
  3385.         call    address_32bit_prefix
  3386.         jmp     stos_store
  3387.       stos_address_16bit:
  3388.         cmp     [code_type],64
  3389.         je      invalid_address_size
  3390.         call    address_16bit_prefix
  3391.       stos_store:
  3392.         cmp     [segment_register],1
  3393.         ja      invalid_address
  3394.         mov     al,[base_code]
  3395.         jmp     movs_check_size
  3396. cmps_instruction:
  3397.         lods    byte [esi]
  3398.         call    get_size_operator
  3399.         cmp     al,'['
  3400.         jne     invalid_operand
  3401.         call    get_address
  3402.         or      eax,eax
  3403.         jnz     invalid_address
  3404.         or      bl,ch
  3405.         jnz     invalid_address
  3406.         mov     al,[segment_register]
  3407.         push    eax ebx
  3408.         lods    byte [esi]
  3409.         cmp     al,','
  3410.         jne     invalid_operand
  3411.         lods    byte [esi]
  3412.         call    get_size_operator
  3413.         cmp     al,'['
  3414.         jne     invalid_operand
  3415.         call    get_address
  3416.         or      eax,eax
  3417.         jnz     invalid_address
  3418.         or      bl,ch
  3419.         jnz     invalid_address
  3420.         pop     edx eax
  3421.         cmp     [segment_register],1
  3422.         ja      invalid_address
  3423.         mov     [segment_register],al
  3424.         mov     al,dh
  3425.         mov     ah,bh
  3426.         shr     al,4
  3427.         shr     ah,4
  3428.         cmp     al,ah
  3429.         jne     address_sizes_do_not_agree
  3430.         and     bh,111b
  3431.         and     dh,111b
  3432.         cmp     bh,7
  3433.         jne     invalid_address
  3434.         cmp     dh,6
  3435.         jne     invalid_address
  3436.         cmp     al,2
  3437.         je      cmps_address_16bit
  3438.         cmp     al,4
  3439.         je      cmps_address_32bit
  3440.         cmp     [code_type],64
  3441.         jne     invalid_address_size
  3442.         jmp     cmps_store
  3443.       cmps_address_32bit:
  3444.         call    address_32bit_prefix
  3445.         jmp     cmps_store
  3446.       cmps_address_16bit:
  3447.         cmp     [code_type],64
  3448.         je      invalid_address_size
  3449.         call    address_16bit_prefix
  3450.       cmps_store:
  3451.         xor     ebx,ebx
  3452.         call    store_segment_prefix_if_necessary
  3453.         mov     al,0A6h
  3454.         jmp     movs_check_size
  3455. ins_instruction:
  3456.         lods    byte [esi]
  3457.         call    get_size_operator
  3458.         cmp     al,'['
  3459.         jne     invalid_operand
  3460.         call    get_address
  3461.         or      eax,eax
  3462.         jnz     invalid_address
  3463.         or      bl,ch
  3464.         jnz     invalid_address
  3465.         cmp     bh,27h
  3466.         je      ins_address_16bit
  3467.         cmp     bh,47h
  3468.         je      ins_address_32bit
  3469.         cmp     bh,87h
  3470.         jne     invalid_address
  3471.         cmp     [code_type],64
  3472.         jne     invalid_address_size
  3473.         jmp     ins_store
  3474.       ins_address_32bit:
  3475.         call    address_32bit_prefix
  3476.         jmp     ins_store
  3477.       ins_address_16bit:
  3478.         cmp     [code_type],64
  3479.         je      invalid_address_size
  3480.         call    address_16bit_prefix
  3481.       ins_store:
  3482.         cmp     [segment_register],1
  3483.         ja      invalid_address
  3484.         lods    byte [esi]
  3485.         cmp     al,','
  3486.         jne     invalid_operand
  3487.         lods    byte [esi]
  3488.         cmp     al,10h
  3489.         jne     invalid_operand
  3490.         lods    byte [esi]
  3491.         cmp     al,22h
  3492.         jne     invalid_operand
  3493.         mov     al,6Ch
  3494.       ins_check_size:
  3495.         cmp     [operand_size],8
  3496.         jne     movs_check_size
  3497.         jmp     invalid_operand_size
  3498. outs_instruction:
  3499.         lods    byte [esi]
  3500.         cmp     al,10h
  3501.         jne     invalid_operand
  3502.         lods    byte [esi]
  3503.         cmp     al,22h
  3504.         jne     invalid_operand
  3505.         lods    byte [esi]
  3506.         cmp     al,','
  3507.         jne     invalid_operand
  3508.         lods    byte [esi]
  3509.         call    get_size_operator
  3510.         cmp     al,'['
  3511.         jne     invalid_operand
  3512.         call    get_address
  3513.         or      eax,eax
  3514.         jnz     invalid_address
  3515.         or      bl,ch
  3516.         jnz     invalid_address
  3517.         cmp     bh,26h
  3518.         je      outs_address_16bit
  3519.         cmp     bh,46h
  3520.         je      outs_address_32bit
  3521.         cmp     bh,86h
  3522.         jne     invalid_address
  3523.         cmp     [code_type],64
  3524.         jne     invalid_address_size
  3525.         jmp     outs_store
  3526.       outs_address_32bit:
  3527.         call    address_32bit_prefix
  3528.         jmp     outs_store
  3529.       outs_address_16bit:
  3530.         cmp     [code_type],64
  3531.         je      invalid_address_size
  3532.         call    address_16bit_prefix
  3533.       outs_store:
  3534.         xor     ebx,ebx
  3535.         call    store_segment_prefix_if_necessary
  3536.         mov     al,6Eh
  3537.         jmp     ins_check_size
  3538. xlat_instruction:
  3539.         lods    byte [esi]
  3540.         call    get_size_operator
  3541.         cmp     al,'['
  3542.         jne     invalid_operand
  3543.         call    get_address
  3544.         or      eax,eax
  3545.         jnz     invalid_address
  3546.         or      bl,ch
  3547.         jnz     invalid_address
  3548.         cmp     bh,23h
  3549.         je      xlat_address_16bit
  3550.         cmp     bh,43h
  3551.         je      xlat_address_32bit
  3552.         cmp     bh,83h
  3553.         jne     invalid_address
  3554.         cmp     [code_type],64
  3555.         jne     invalid_address_size
  3556.         jmp     xlat_store
  3557.       xlat_address_32bit:
  3558.         call    address_32bit_prefix
  3559.         jmp     xlat_store
  3560.       xlat_address_16bit:
  3561.         cmp     [code_type],64
  3562.         je      invalid_address_size
  3563.         call    address_16bit_prefix
  3564.       xlat_store:
  3565.         call    store_segment_prefix_if_necessary
  3566.         mov     al,0D7h
  3567.         cmp     [operand_size],1
  3568.         jbe     simple_instruction
  3569.         jmp     invalid_operand_size
  3570.  
  3571. pm_word_instruction:
  3572.         mov     ah,al
  3573.         shr     ah,4
  3574.         and     al,111b
  3575.         mov     [base_code],0Fh
  3576.         mov     [extended_code],ah
  3577.         mov     [postbyte_register],al
  3578.         lods    byte [esi]
  3579.         call    get_size_operator
  3580.         cmp     al,10h
  3581.         je      pm_reg
  3582.       pm_mem:
  3583.         cmp     al,'['
  3584.         jne     invalid_operand
  3585.         call    get_address
  3586.         mov     al,[operand_size]
  3587.         cmp     al,2
  3588.         je      pm_mem_store
  3589.         or      al,al
  3590.         jnz     invalid_operand_size
  3591.       pm_mem_store:
  3592.         jmp     instruction_ready
  3593.       pm_reg:
  3594.         lods    byte [esi]
  3595.         call    convert_register
  3596.         mov     bl,al
  3597.         cmp     ah,2
  3598.         jne     invalid_operand_size
  3599.         jmp     nomem_instruction_ready
  3600. pm_store_word_instruction:
  3601.         mov     ah,al
  3602.         shr     ah,4
  3603.         and     al,111b
  3604.         mov     [base_code],0Fh
  3605.         mov     [extended_code],ah
  3606.         mov     [postbyte_register],al
  3607.         lods    byte [esi]
  3608.         call    get_size_operator
  3609.         cmp     al,10h
  3610.         jne     pm_mem
  3611.         lods    byte [esi]
  3612.         call    convert_register
  3613.         mov     bl,al
  3614.         mov     al,ah
  3615.         call    operand_autodetect
  3616.         jmp     nomem_instruction_ready
  3617. lgdt_instruction:
  3618.         mov     [base_code],0Fh
  3619.         mov     [extended_code],1
  3620.         mov     [postbyte_register],al
  3621.         lods    byte [esi]
  3622.         call    get_size_operator
  3623.         cmp     al,'['
  3624.         jne     invalid_operand
  3625.         call    get_address
  3626.         mov     al,[operand_size]
  3627.         cmp     al,6
  3628.         je      lgdt_mem_48bit
  3629.         cmp     al,10
  3630.         je      lgdt_mem_80bit
  3631.         or      al,al
  3632.         jnz     invalid_operand_size
  3633.         jmp     lgdt_mem_store
  3634.       lgdt_mem_80bit:
  3635.         cmp     [code_type],64
  3636.         jne     illegal_instruction
  3637.         jmp     lgdt_mem_store
  3638.       lgdt_mem_48bit:
  3639.         cmp     [code_type],64
  3640.         je      illegal_instruction
  3641.         cmp     [postbyte_register],2
  3642.         jb      lgdt_mem_store
  3643.         call    operand_32bit
  3644.       lgdt_mem_store:
  3645.         jmp     instruction_ready
  3646. lar_instruction:
  3647.         mov     [extended_code],al
  3648.         mov     [base_code],0Fh
  3649.         lods    byte [esi]
  3650.         call    get_size_operator
  3651.         cmp     al,10h
  3652.         jne     invalid_operand
  3653.         lods    byte [esi]
  3654.         call    convert_register
  3655.         mov     [postbyte_register],al
  3656.         lods    byte [esi]
  3657.         cmp     al,','
  3658.         jne     invalid_operand
  3659.         xor     al,al
  3660.         xchg    al,[operand_size]
  3661.         call    operand_autodetect
  3662.         lods    byte [esi]
  3663.         call    get_size_operator
  3664.         cmp     al,10h
  3665.         je      lar_reg_reg
  3666.         cmp     al,'['
  3667.         jne     invalid_operand
  3668.         call    get_address
  3669.         mov     al,[operand_size]
  3670.         or      al,al
  3671.         jz      lar_reg_mem
  3672.         cmp     al,2
  3673.         jne     invalid_operand_size
  3674.       lar_reg_mem:
  3675.         jmp     instruction_ready
  3676.       lar_reg_reg:
  3677.         lods    byte [esi]
  3678.         call    convert_register
  3679.         cmp     ah,2
  3680.         jne     invalid_operand_size
  3681.         mov     bl,al
  3682.         jmp     nomem_instruction_ready
  3683. invlpg_instruction:
  3684.         mov     [base_code],0Fh
  3685.         mov     [extended_code],1
  3686.         mov     [postbyte_register],7
  3687.         lods    byte [esi]
  3688.         call    get_size_operator
  3689.         cmp     al,'['
  3690.         jne     invalid_operand
  3691.         call    get_address
  3692.         jmp     instruction_ready
  3693. swapgs_instruction:
  3694.         cmp     [code_type],64
  3695.         jne     illegal_instruction
  3696. rdtscp_instruction:
  3697.         mov     [base_code],0Fh
  3698.         mov     [extended_code],1
  3699.         mov     [postbyte_register],7
  3700.         mov     bl,al
  3701.         jmp     nomem_instruction_ready
  3702.  
  3703. basic_486_instruction:
  3704.         mov     [base_code],0Fh
  3705.         mov     [extended_code],al
  3706.         lods    byte [esi]
  3707.         call    get_size_operator
  3708.         cmp     al,10h
  3709.         je      basic_486_reg
  3710.         cmp     al,'['
  3711.         jne     invalid_operand
  3712.         call    get_address
  3713.         push    edx ebx ecx
  3714.         lods    byte [esi]
  3715.         cmp     al,','
  3716.         jne     invalid_operand
  3717.         lods    byte [esi]
  3718.         call    get_size_operator
  3719.         cmp     al,10h
  3720.         jne     invalid_operand
  3721.         lods    byte [esi]
  3722.         call    convert_register
  3723.         mov     [postbyte_register],al
  3724.         pop     ecx ebx edx
  3725.         mov     al,ah
  3726.         cmp     al,1
  3727.         je      basic_486_mem_reg_8bit
  3728.         call    operand_autodetect
  3729.         inc     [extended_code]
  3730.       basic_486_mem_reg_8bit:
  3731.         jmp     instruction_ready
  3732.       basic_486_reg:
  3733.         lods    byte [esi]
  3734.         call    convert_register
  3735.         mov     [postbyte_register],al
  3736.         lods    byte [esi]
  3737.         cmp     al,','
  3738.         jne     invalid_operand
  3739.         lods    byte [esi]
  3740.         call    get_size_operator
  3741.         cmp     al,10h
  3742.         jne     invalid_operand
  3743.         lods    byte [esi]
  3744.         call    convert_register
  3745.         mov     bl,[postbyte_register]
  3746.         mov     [postbyte_register],al
  3747.         mov     al,ah
  3748.         cmp     al,1
  3749.         je      basic_486_reg_reg_8bit
  3750.         call    operand_autodetect
  3751.         inc     [extended_code]
  3752.       basic_486_reg_reg_8bit:
  3753.         jmp     nomem_instruction_ready
  3754. bswap_instruction:
  3755.         lods    byte [esi]
  3756.         call    get_size_operator
  3757.         cmp     al,10h
  3758.         jne     invalid_operand
  3759.         lods    byte [esi]
  3760.         call    convert_register
  3761.         test    al,1000b
  3762.         jz      bswap_reg_code_ok
  3763.         or      [rex_prefix],41h
  3764.         and     al,111b
  3765.       bswap_reg_code_ok:
  3766.         add     al,0C8h
  3767.         mov     [extended_code],al
  3768.         mov     [base_code],0Fh
  3769.         cmp     ah,8
  3770.         je      bswap_reg64
  3771.         cmp     ah,4
  3772.         jne     invalid_operand_size
  3773.         call    operand_32bit
  3774.         call    store_instruction_code
  3775.         jmp     instruction_assembled
  3776.       bswap_reg64:
  3777.         call    operand_64bit
  3778.         call    store_instruction_code
  3779.         jmp     instruction_assembled
  3780. cmpxchgx_instruction:
  3781.         mov     [base_code],0Fh
  3782.         mov     [extended_code],0C7h
  3783.         mov     [postbyte_register],al
  3784.         lods    byte [esi]
  3785.         call    get_size_operator
  3786.         cmp     al,'['
  3787.         jne     invalid_operand
  3788.         call    get_address
  3789.         mov     ah,1
  3790.         xchg    [postbyte_register],ah
  3791.         mov     al,[operand_size]
  3792.         or      al,al
  3793.         jz      cmpxchgx_size_ok
  3794.         cmp     al,ah
  3795.         jne     invalid_operand_size
  3796.       cmpxchgx_size_ok:
  3797.         cmp     ah,16
  3798.         jne     cmpxchgx_store
  3799.         call    operand_64bit
  3800.       cmpxchgx_store:
  3801.         jmp     instruction_ready
  3802. nop_instruction:
  3803.         mov     ah,[esi]
  3804.         cmp     ah,10h
  3805.         je      extended_nop
  3806.         cmp     ah,11h
  3807.         je      extended_nop
  3808.         cmp     ah,'['
  3809.         je      extended_nop
  3810.         stos    byte [edi]
  3811.         jmp     instruction_assembled
  3812.       extended_nop:
  3813.         mov     [base_code],0Fh
  3814.         mov     [extended_code],1Fh
  3815.         mov     [postbyte_register],0
  3816.         lods    byte [esi]
  3817.         call    get_size_operator
  3818.         cmp     al,10h
  3819.         je      extended_nop_reg
  3820.         cmp     al,'['
  3821.         jne     invalid_operand
  3822.         call    get_address
  3823.         mov     al,[operand_size]
  3824.         or      al,al
  3825.         jz      extended_nop_store
  3826.         call    operand_autodetect
  3827.       extended_nop_store:
  3828.         jmp     instruction_ready
  3829.       extended_nop_reg:
  3830.         lods    byte [esi]
  3831.         call    convert_register
  3832.         mov     bl,al
  3833.         mov     al,ah
  3834.         call    operand_autodetect
  3835.         jmp     nomem_instruction_ready
  3836.  
  3837. basic_fpu_instruction:
  3838.         mov     [postbyte_register],al
  3839.         mov     [base_code],0D8h
  3840.         lods    byte [esi]
  3841.         call    get_size_operator
  3842.         cmp     al,10h
  3843.         je      basic_fpu_streg
  3844.         cmp     al,'['
  3845.         je      basic_fpu_mem
  3846.         dec     esi
  3847.         mov     ah,[postbyte_register]
  3848.         cmp     ah,2
  3849.         jb      invalid_operand
  3850.         cmp     ah,3
  3851.         ja      invalid_operand
  3852.         mov     bl,1
  3853.         jmp     nomem_instruction_ready
  3854.       basic_fpu_mem:
  3855.         call    get_address
  3856.         mov     al,[operand_size]
  3857.         cmp     al,4
  3858.         je      basic_fpu_mem_32bit
  3859.         cmp     al,8
  3860.         je      basic_fpu_mem_64bit
  3861.         or      al,al
  3862.         jnz     invalid_operand_size
  3863.         call    recoverable_unknown_size
  3864.       basic_fpu_mem_32bit:
  3865.         jmp     instruction_ready
  3866.       basic_fpu_mem_64bit:
  3867.         mov     [base_code],0DCh
  3868.         jmp     instruction_ready
  3869.       basic_fpu_streg:
  3870.         lods    byte [esi]
  3871.         call    convert_fpu_register
  3872.         mov     bl,al
  3873.         mov     ah,[postbyte_register]
  3874.         cmp     ah,2
  3875.         je      basic_fpu_single_streg
  3876.         cmp     ah,3
  3877.         je      basic_fpu_single_streg
  3878.         or      al,al
  3879.         jz      basic_fpu_st0
  3880.         test    ah,110b
  3881.         jz      basic_fpu_streg_st0
  3882.         xor     [postbyte_register],1
  3883.       basic_fpu_streg_st0:
  3884.         lods    byte [esi]
  3885.         cmp     al,','
  3886.         jne     invalid_operand
  3887.         lods    byte [esi]
  3888.         call    get_size_operator
  3889.         cmp     al,10h
  3890.         jne     invalid_operand
  3891.         lods    byte [esi]
  3892.         call    convert_fpu_register
  3893.         or      al,al
  3894.         jnz     invalid_operand
  3895.         mov     [base_code],0DCh
  3896.         jmp     nomem_instruction_ready
  3897.       basic_fpu_st0:
  3898.         lods    byte [esi]
  3899.         cmp     al,','
  3900.         jne     invalid_operand
  3901.         lods    byte [esi]
  3902.         call    get_size_operator
  3903.         cmp     al,10h
  3904.         jne     invalid_operand
  3905.         lods    byte [esi]
  3906.         call    convert_fpu_register
  3907.         mov     bl,al
  3908.       basic_fpu_single_streg:
  3909.         mov     [base_code],0D8h
  3910.         jmp     nomem_instruction_ready
  3911. simple_fpu_instruction:
  3912.         mov     ah,al
  3913.         or      ah,11000000b
  3914.         mov     al,0D9h
  3915.         stos    word [edi]
  3916.         jmp     instruction_assembled
  3917. fi_instruction:
  3918.         mov     [postbyte_register],al
  3919.         lods    byte [esi]
  3920.         call    get_size_operator
  3921.         cmp     al,'['
  3922.         jne     invalid_operand
  3923.         call    get_address
  3924.         mov     al,[operand_size]
  3925.         cmp     al,2
  3926.         je      fi_mem_16bit
  3927.         cmp     al,4
  3928.         je      fi_mem_32bit
  3929.         or      al,al
  3930.         jnz     invalid_operand_size
  3931.         call    recoverable_unknown_size
  3932.       fi_mem_32bit:
  3933.         mov     [base_code],0DAh
  3934.         jmp     instruction_ready
  3935.       fi_mem_16bit:
  3936.         mov     [base_code],0DEh
  3937.         jmp     instruction_ready
  3938. fld_instruction:
  3939.         mov     [postbyte_register],al
  3940.         lods    byte [esi]
  3941.         call    get_size_operator
  3942.         cmp     al,10h
  3943.         je      fld_streg
  3944.         cmp     al,'['
  3945.         jne     invalid_operand
  3946.         call    get_address
  3947.         mov     al,[operand_size]
  3948.         cmp     al,4
  3949.         je      fld_mem_32bit
  3950.         cmp     al,8
  3951.         je      fld_mem_64bit
  3952.         cmp     al,10
  3953.         je      fld_mem_80bit
  3954.         or      al,al
  3955.         jnz     invalid_operand_size
  3956.         call    recoverable_unknown_size
  3957.       fld_mem_32bit:
  3958.         mov     [base_code],0D9h
  3959.         jmp     instruction_ready
  3960.       fld_mem_64bit:
  3961.         mov     [base_code],0DDh
  3962.         jmp     instruction_ready
  3963.       fld_mem_80bit:
  3964.         mov     al,[postbyte_register]
  3965.         cmp     al,0
  3966.         je      fld_mem_80bit_store
  3967.         dec     [postbyte_register]
  3968.         cmp     al,3
  3969.         je      fld_mem_80bit_store
  3970.         jmp     invalid_operand_size
  3971.       fld_mem_80bit_store:
  3972.         add     [postbyte_register],5
  3973.         mov     [base_code],0DBh
  3974.         jmp     instruction_ready
  3975.       fld_streg:
  3976.         lods    byte [esi]
  3977.         call    convert_fpu_register
  3978.         mov     bl,al
  3979.         cmp     [postbyte_register],2
  3980.         jae     fst_streg
  3981.         mov     [base_code],0D9h
  3982.         jmp     nomem_instruction_ready
  3983.       fst_streg:
  3984.         mov     [base_code],0DDh
  3985.         jmp     nomem_instruction_ready
  3986. fild_instruction:
  3987.         mov     [postbyte_register],al
  3988.         lods    byte [esi]
  3989.         call    get_size_operator
  3990.         cmp     al,'['
  3991.         jne     invalid_operand
  3992.         call    get_address
  3993.         mov     al,[operand_size]
  3994.         cmp     al,2
  3995.         je      fild_mem_16bit
  3996.         cmp     al,4
  3997.         je      fild_mem_32bit
  3998.         cmp     al,8
  3999.         je      fild_mem_64bit
  4000.         or      al,al
  4001.         jnz     invalid_operand_size
  4002.         call    recoverable_unknown_size
  4003.       fild_mem_32bit:
  4004.         mov     [base_code],0DBh
  4005.         jmp     instruction_ready
  4006.       fild_mem_16bit:
  4007.         mov     [base_code],0DFh
  4008.         jmp     instruction_ready
  4009.       fild_mem_64bit:
  4010.         mov     al,[postbyte_register]
  4011.         cmp     al,1
  4012.         je      fisttp_64bit_store
  4013.         jb      fild_mem_64bit_store
  4014.         dec     [postbyte_register]
  4015.         cmp     al,3
  4016.         je      fild_mem_64bit_store
  4017.         jmp     invalid_operand_size
  4018.       fild_mem_64bit_store:
  4019.         add     [postbyte_register],5
  4020.         mov     [base_code],0DFh
  4021.         jmp     instruction_ready
  4022.       fisttp_64bit_store:
  4023.         mov     [base_code],0DDh
  4024.         jmp     instruction_ready
  4025. fbld_instruction:
  4026.         mov     [postbyte_register],al
  4027.         lods    byte [esi]
  4028.         call    get_size_operator
  4029.         cmp     al,'['
  4030.         jne     invalid_operand
  4031.         call    get_address
  4032.         mov     al,[operand_size]
  4033.         or      al,al
  4034.         jz      fbld_mem_80bit
  4035.         cmp     al,10
  4036.         je      fbld_mem_80bit
  4037.         jmp     invalid_operand_size
  4038.       fbld_mem_80bit:
  4039.         mov     [base_code],0DFh
  4040.         jmp     instruction_ready
  4041. faddp_instruction:
  4042.         mov     [postbyte_register],al
  4043.         mov     [base_code],0DEh
  4044.         mov     edx,esi
  4045.         lods    byte [esi]
  4046.         call    get_size_operator
  4047.         cmp     al,10h
  4048.         je      faddp_streg
  4049.         mov     esi,edx
  4050.         mov     bl,1
  4051.         jmp     nomem_instruction_ready
  4052.       faddp_streg:
  4053.         lods    byte [esi]
  4054.         call    convert_fpu_register
  4055.         mov     bl,al
  4056.         lods    byte [esi]
  4057.         cmp     al,','
  4058.         jne     invalid_operand
  4059.         lods    byte [esi]
  4060.         call    get_size_operator
  4061.         cmp     al,10h
  4062.         jne     invalid_operand
  4063.         lods    byte [esi]
  4064.         call    convert_fpu_register
  4065.         or      al,al
  4066.         jnz     invalid_operand
  4067.         jmp     nomem_instruction_ready
  4068. fcompp_instruction:
  4069.         mov     ax,0D9DEh
  4070.         stos    word [edi]
  4071.         jmp     instruction_assembled
  4072. fucompp_instruction:
  4073.         mov     ax,0E9DAh
  4074.         stos    word [edi]
  4075.         jmp     instruction_assembled
  4076. fxch_instruction:
  4077.         mov     dx,01D9h
  4078.         jmp     fpu_single_operand
  4079. ffreep_instruction:
  4080.         mov     dx,00DFh
  4081.         jmp     fpu_single_operand
  4082. ffree_instruction:
  4083.         mov     dl,0DDh
  4084.         mov     dh,al
  4085.       fpu_single_operand:
  4086.         mov     ebx,esi
  4087.         lods    byte [esi]
  4088.         call    get_size_operator
  4089.         cmp     al,10h
  4090.         je      fpu_streg
  4091.         or      dh,dh
  4092.         jz      invalid_operand
  4093.         mov     esi,ebx
  4094.         shl     dh,3
  4095.         or      dh,11000001b
  4096.         mov     ax,dx
  4097.         stos    word [edi]
  4098.         jmp     instruction_assembled
  4099.       fpu_streg:
  4100.         lods    byte [esi]
  4101.         call    convert_fpu_register
  4102.         shl     dh,3
  4103.         or      dh,al
  4104.         or      dh,11000000b
  4105.         mov     ax,dx
  4106.         stos    word [edi]
  4107.         jmp     instruction_assembled
  4108.  
  4109. fstenv_instruction:
  4110.         mov     byte [edi],9Bh
  4111.         inc     edi
  4112. fldenv_instruction:
  4113.         mov     [base_code],0D9h
  4114.         jmp     fpu_mem
  4115. fstenv_instruction_16bit:
  4116.         mov     byte [edi],9Bh
  4117.         inc     edi
  4118. fldenv_instruction_16bit:
  4119.         call    operand_16bit
  4120.         jmp     fldenv_instruction
  4121. fstenv_instruction_32bit:
  4122.         mov     byte [edi],9Bh
  4123.         inc     edi
  4124. fldenv_instruction_32bit:
  4125.         call    operand_32bit
  4126.         jmp     fldenv_instruction
  4127. fsave_instruction_32bit:
  4128.         mov     byte [edi],9Bh
  4129.         inc     edi
  4130. fnsave_instruction_32bit:
  4131.         call    operand_32bit
  4132.         jmp     fnsave_instruction
  4133. fsave_instruction_16bit:
  4134.         mov     byte [edi],9Bh
  4135.         inc     edi
  4136. fnsave_instruction_16bit:
  4137.         call    operand_16bit
  4138.         jmp     fnsave_instruction
  4139. fsave_instruction:
  4140.         mov     byte [edi],9Bh
  4141.         inc     edi
  4142. fnsave_instruction:
  4143.         mov     [base_code],0DDh
  4144.       fpu_mem:
  4145.         mov     [postbyte_register],al
  4146.         lods    byte [esi]
  4147.         call    get_size_operator
  4148.         cmp     al,'['
  4149.         jne     invalid_operand
  4150.         call    get_address
  4151.         cmp     [operand_size],0
  4152.         jne     invalid_operand_size
  4153.         jmp     instruction_ready
  4154. fstcw_instruction:
  4155.         mov     byte [edi],9Bh
  4156.         inc     edi
  4157. fldcw_instruction:
  4158.         mov     [postbyte_register],al
  4159.         mov     [base_code],0D9h
  4160.         lods    byte [esi]
  4161.         call    get_size_operator
  4162.         cmp     al,'['
  4163.         jne     invalid_operand
  4164.         call    get_address
  4165.         mov     al,[operand_size]
  4166.         or      al,al
  4167.         jz      fldcw_mem_16bit
  4168.         cmp     al,2
  4169.         je      fldcw_mem_16bit
  4170.         jmp     invalid_operand_size
  4171.       fldcw_mem_16bit:
  4172.         jmp     instruction_ready
  4173. fstsw_instruction:
  4174.         mov     al,9Bh
  4175.         stos    byte [edi]
  4176. fnstsw_instruction:
  4177.         mov     [base_code],0DDh
  4178.         mov     [postbyte_register],7
  4179.         lods    byte [esi]
  4180.         call    get_size_operator
  4181.         cmp     al,10h
  4182.         je      fstsw_reg
  4183.         cmp     al,'['
  4184.         jne     invalid_operand
  4185.         call    get_address
  4186.         mov     al,[operand_size]
  4187.         or      al,al
  4188.         jz      fstsw_mem_16bit
  4189.         cmp     al,2
  4190.         je      fstsw_mem_16bit
  4191.         jmp     invalid_operand_size
  4192.       fstsw_mem_16bit:
  4193.         jmp     instruction_ready
  4194.       fstsw_reg:
  4195.         lods    byte [esi]
  4196.         call    convert_register
  4197.         cmp     ax,0200h
  4198.         jne     invalid_operand
  4199.         mov     ax,0E0DFh
  4200.         stos    word [edi]
  4201.         jmp     instruction_assembled
  4202. finit_instruction:
  4203.         mov     byte [edi],9Bh
  4204.         inc     edi
  4205. fninit_instruction:
  4206.         mov     ah,al
  4207.         mov     al,0DBh
  4208.         stos    word [edi]
  4209.         jmp     instruction_assembled
  4210. fcmov_instruction:
  4211.         mov     dh,0DAh
  4212.         jmp     fcomi_streg
  4213. fcomi_instruction:
  4214.         mov     dh,0DBh
  4215.         jmp     fcomi_streg
  4216. fcomip_instruction:
  4217.         mov     dh,0DFh
  4218.       fcomi_streg:
  4219.         mov     dl,al
  4220.         lods    byte [esi]
  4221.         call    get_size_operator
  4222.         cmp     al,10h
  4223.         jne     invalid_operand
  4224.         lods    byte [esi]
  4225.         call    convert_fpu_register
  4226.         mov     ah,al
  4227.         cmp     byte [esi],','
  4228.         je      fcomi_st0_streg
  4229.         add     ah,dl
  4230.         mov     al,dh
  4231.         stos    word [edi]
  4232.         jmp     instruction_assembled
  4233.       fcomi_st0_streg:
  4234.         or      ah,ah
  4235.         jnz     invalid_operand
  4236.         inc     esi
  4237.         lods    byte [esi]
  4238.         call    get_size_operator
  4239.         cmp     al,10h
  4240.         jne     invalid_operand
  4241.         lods    byte [esi]
  4242.         call    convert_fpu_register
  4243.         mov     ah,al
  4244.         add     ah,dl
  4245.         mov     al,dh
  4246.         stos    word [edi]
  4247.         jmp     instruction_assembled
  4248.  
  4249. basic_mmx_instruction:
  4250.         mov     [base_code],0Fh
  4251.         mov     [extended_code],al
  4252.       mmx_instruction:
  4253.         lods    byte [esi]
  4254.         call    get_size_operator
  4255.         cmp     al,10h
  4256.         jne     invalid_operand
  4257.         lods    byte [esi]
  4258.         call    convert_mmx_register
  4259.         call    make_mmx_prefix
  4260.         mov     [postbyte_register],al
  4261.         lods    byte [esi]
  4262.         cmp     al,','
  4263.         jne     invalid_operand
  4264.         lods    byte [esi]
  4265.         call    get_size_operator
  4266.         cmp     al,10h
  4267.         je      mmx_mmreg_mmreg
  4268.         cmp     al,'['
  4269.         jne     invalid_operand
  4270.       mmx_mmreg_mem:
  4271.         call    get_address
  4272.         jmp     instruction_ready
  4273.       mmx_mmreg_mmreg:
  4274.         lods    byte [esi]
  4275.         call    convert_mmx_register
  4276.         mov     bl,al
  4277.         jmp     nomem_instruction_ready
  4278. mmx_bit_shift_instruction:
  4279.         mov     [base_code],0Fh
  4280.         mov     [extended_code],al
  4281.         lods    byte [esi]
  4282.         call    get_size_operator
  4283.         cmp     al,10h
  4284.         jne     invalid_operand
  4285.         lods    byte [esi]
  4286.         call    convert_mmx_register
  4287.         call    make_mmx_prefix
  4288.         mov     [postbyte_register],al
  4289.         lods    byte [esi]
  4290.         cmp     al,','
  4291.         jne     invalid_operand
  4292.         mov     [operand_size],0
  4293.         lods    byte [esi]
  4294.         call    get_size_operator
  4295.         cmp     al,10h
  4296.         je      mmx_mmreg_mmreg
  4297.         cmp     al,'('
  4298.         je      mmx_ps_mmreg_imm8
  4299.         cmp     al,'['
  4300.         je      mmx_mmreg_mem
  4301.         jmp     invalid_operand
  4302.       mmx_ps_mmreg_imm8:
  4303.         call    get_byte_value
  4304.         mov     byte [value],al
  4305.         test    [operand_size],not 1
  4306.         jnz     invalid_value
  4307.         mov     bl,[extended_code]
  4308.         mov     al,bl
  4309.         shr     bl,4
  4310.         and     al,1111b
  4311.         add     al,70h
  4312.         mov     [extended_code],al
  4313.         sub     bl,0Ch
  4314.         shl     bl,1
  4315.         xchg    bl,[postbyte_register]
  4316.         call    store_nomem_instruction
  4317.         mov     al,byte [value]
  4318.         stos    byte [edi]
  4319.         jmp     instruction_assembled
  4320. pmovmskb_instruction:
  4321.         mov     [base_code],0Fh
  4322.         mov     [extended_code],al
  4323.         lods    byte [esi]
  4324.         call    get_size_operator
  4325.         cmp     al,10h
  4326.         jne     invalid_operand
  4327.         lods    byte [esi]
  4328.         call    convert_register
  4329.         cmp     ah,4
  4330.         je      pmovmskb_reg_size_ok
  4331.         cmp     [code_type],64
  4332.         jne     invalid_operand_size
  4333.         cmp     ah,8
  4334.         jnz     invalid_operand_size
  4335.       pmovmskb_reg_size_ok:
  4336.         mov     [postbyte_register],al
  4337.         mov     [operand_size],0
  4338.         lods    byte [esi]
  4339.         cmp     al,','
  4340.         jne     invalid_operand
  4341.         lods    byte [esi]
  4342.         call    get_size_operator
  4343.         cmp     al,10h
  4344.         jne     invalid_operand
  4345.         lods    byte [esi]
  4346.         call    convert_mmx_register
  4347.         mov     bl,al
  4348.         call    make_mmx_prefix
  4349.         cmp     [extended_code],0C5h
  4350.         je      mmx_nomem_imm8
  4351.         jmp     nomem_instruction_ready
  4352.       mmx_imm8:
  4353.         push    ebx ecx edx
  4354.         xor     cl,cl
  4355.         xchg    cl,[operand_size]
  4356.         lods    byte [esi]
  4357.         cmp     al,','
  4358.         jne     invalid_operand
  4359.         lods    byte [esi]
  4360.         call    get_size_operator
  4361.         test    ah,not 1
  4362.         jnz     invalid_operand_size
  4363.         mov     [operand_size],cl
  4364.         cmp     al,'('
  4365.         jne     invalid_operand
  4366.         call    get_byte_value
  4367.         mov     byte [value],al
  4368.         pop     edx ecx ebx
  4369.         call    store_instruction_with_imm8
  4370.         jmp     instruction_assembled
  4371.       mmx_nomem_imm8:
  4372.         call    store_nomem_instruction
  4373.         call    append_imm8
  4374.         jmp     instruction_assembled
  4375.       append_imm8:
  4376.         mov     [operand_size],0
  4377.         lods    byte [esi]
  4378.         cmp     al,','
  4379.         jne     invalid_operand
  4380.         lods    byte [esi]
  4381.         call    get_size_operator
  4382.         test    ah,not 1
  4383.         jnz     invalid_operand_size
  4384.         cmp     al,'('
  4385.         jne     invalid_operand
  4386.         call    get_byte_value
  4387.         stosb
  4388.         ret
  4389. pinsrw_instruction:
  4390.         mov     [extended_code],al
  4391.         mov     [base_code],0Fh
  4392.         lods    byte [esi]
  4393.         call    get_size_operator
  4394.         cmp     al,10h
  4395.         jne     invalid_operand
  4396.         lods    byte [esi]
  4397.         call    convert_mmx_register
  4398.         call    make_mmx_prefix
  4399.         mov     [postbyte_register],al
  4400.         mov     [operand_size],0
  4401.         lods    byte [esi]
  4402.         cmp     al,','
  4403.         jne     invalid_operand
  4404.         lods    byte [esi]
  4405.         call    get_size_operator
  4406.         cmp     al,10h
  4407.         je      pinsrw_mmreg_reg
  4408.         cmp     al,'['
  4409.         jne     invalid_operand
  4410.         call    get_address
  4411.         cmp     [operand_size],0
  4412.         je      mmx_imm8
  4413.         cmp     [operand_size],2
  4414.         jne     invalid_operand_size
  4415.         jmp     mmx_imm8
  4416.       pinsrw_mmreg_reg:
  4417.         lods    byte [esi]
  4418.         call    convert_register
  4419.         cmp     ah,4
  4420.         jne     invalid_operand_size
  4421.         mov     bl,al
  4422.         jmp     mmx_nomem_imm8
  4423. pshufw_instruction:
  4424.         mov     [mmx_size],8
  4425.         mov     [opcode_prefix],al
  4426.         jmp     pshuf_instruction
  4427. pshufd_instruction:
  4428.         mov     [mmx_size],16
  4429.         mov     [opcode_prefix],al
  4430.       pshuf_instruction:
  4431.         mov     [base_code],0Fh
  4432.         mov     [extended_code],70h
  4433.         lods    byte [esi]
  4434.         call    get_size_operator
  4435.         cmp     al,10h
  4436.         jne     invalid_operand
  4437.         lods    byte [esi]
  4438.         call    convert_mmx_register
  4439.         cmp     ah,[mmx_size]
  4440.         jne     invalid_operand_size
  4441.         mov     [postbyte_register],al
  4442.         lods    byte [esi]
  4443.         cmp     al,','
  4444.         jne     invalid_operand
  4445.         lods    byte [esi]
  4446.         call    get_size_operator
  4447.         cmp     al,10h
  4448.         je      pshuf_mmreg_mmreg
  4449.         cmp     al,'['
  4450.         jne     invalid_operand
  4451.         call    get_address
  4452.         jmp     mmx_imm8
  4453.       pshuf_mmreg_mmreg:
  4454.         lods    byte [esi]
  4455.         call    convert_mmx_register
  4456.         mov     bl,al
  4457.         jmp     mmx_nomem_imm8
  4458. movd_instruction:
  4459.         mov     [base_code],0Fh
  4460.         mov     [extended_code],7Eh
  4461.         lods    byte [esi]
  4462.         call    get_size_operator
  4463.         cmp     al,10h
  4464.         je      movd_reg
  4465.         cmp     al,'['
  4466.         jne     invalid_operand
  4467.         call    get_address
  4468.         test    [operand_size],not 4
  4469.         jnz     invalid_operand_size
  4470.         mov     [operand_size],0
  4471.         lods    byte [esi]
  4472.         cmp     al,','
  4473.         jne     invalid_operand
  4474.         lods    byte [esi]
  4475.         call    get_size_operator
  4476.         cmp     al,10h
  4477.         jne     invalid_operand
  4478.         lods    byte [esi]
  4479.         call    convert_mmx_register
  4480.         call    make_mmx_prefix
  4481.         mov     [postbyte_register],al
  4482.         jmp     instruction_ready
  4483.       movd_reg:
  4484.         lods    byte [esi]
  4485.         cmp     al,0B0h
  4486.         jae     movd_mmreg
  4487.         call    convert_register
  4488.         cmp     ah,4
  4489.         jne     invalid_operand_size
  4490.         mov     [operand_size],0
  4491.         mov     bl,al
  4492.         lods    byte [esi]
  4493.         cmp     al,','
  4494.         jne     invalid_operand
  4495.         lods    byte [esi]
  4496.         call    get_size_operator
  4497.         cmp     al,10h
  4498.         jne     invalid_operand
  4499.         lods    byte [esi]
  4500.         call    convert_mmx_register
  4501.         mov     [postbyte_register],al
  4502.         call    make_mmx_prefix
  4503.         jmp     nomem_instruction_ready
  4504.       movd_mmreg:
  4505.         mov     [extended_code],6Eh
  4506.         call    convert_mmx_register
  4507.         call    make_mmx_prefix
  4508.         mov     [postbyte_register],al
  4509.         mov     [operand_size],0
  4510.         lods    byte [esi]
  4511.         cmp     al,','
  4512.         jne     invalid_operand
  4513.         lods    byte [esi]
  4514.         call    get_size_operator
  4515.         cmp     al,10h
  4516.         je      movd_mmreg_reg
  4517.         cmp     al,'['
  4518.         jne     invalid_operand
  4519.         call    get_address
  4520.         test    [operand_size],not 4
  4521.         jnz     invalid_operand_size
  4522.         jmp     instruction_ready
  4523.       movd_mmreg_reg:
  4524.         lods    byte [esi]
  4525.         call    convert_register
  4526.         cmp     ah,4
  4527.         jne     invalid_operand_size
  4528.         mov     bl,al
  4529.         jmp     nomem_instruction_ready
  4530.       make_mmx_prefix:
  4531.         cmp     [vex_required],0
  4532.         jne     mmx_prefix_for_vex
  4533.         cmp     [operand_size],16
  4534.         jne     no_mmx_prefix
  4535.         mov     [operand_prefix],66h
  4536.       no_mmx_prefix:
  4537.         ret
  4538.       mmx_prefix_for_vex:
  4539.         cmp     [operand_size],16
  4540.         jne     invalid_operand
  4541.         mov     [opcode_prefix],66h
  4542.         ret
  4543. movq_instruction:
  4544.         mov     [base_code],0Fh
  4545.         lods    byte [esi]
  4546.         call    get_size_operator
  4547.         cmp     al,10h
  4548.         je      movq_reg
  4549.         cmp     al,'['
  4550.         jne     invalid_operand
  4551.         call    get_address
  4552.         test    [operand_size],not 8
  4553.         jnz     invalid_operand_size
  4554.         mov     [operand_size],0
  4555.         lods    byte [esi]
  4556.         cmp     al,','
  4557.         jne     invalid_operand
  4558.         lods    byte [esi]
  4559.         cmp     al,10h
  4560.         jne     invalid_operand
  4561.         lods    byte [esi]
  4562.         call    convert_mmx_register
  4563.         mov     [postbyte_register],al
  4564.         cmp     ah,16
  4565.         je      movq_mem_xmmreg
  4566.         mov     [extended_code],7Fh
  4567.         jmp     instruction_ready
  4568.      movq_mem_xmmreg:
  4569.         mov     [extended_code],0D6h
  4570.         mov     [opcode_prefix],66h
  4571.         jmp     instruction_ready
  4572.      movq_reg:
  4573.         lods    byte [esi]
  4574.         cmp     al,0B0h
  4575.         jae     movq_mmreg
  4576.         call    convert_register
  4577.         cmp     ah,8
  4578.         jne     invalid_operand_size
  4579.         mov     bl,al
  4580.         lods    byte [esi]
  4581.         cmp     al,','
  4582.         jne     invalid_operand
  4583.         lods    byte [esi]
  4584.         call    get_size_operator
  4585.         cmp     al,10h
  4586.         jne     invalid_operand
  4587.         mov     [operand_size],0
  4588.         lods    byte [esi]
  4589.         call    convert_mmx_register
  4590.         mov     [postbyte_register],al
  4591.         call    make_mmx_prefix
  4592.         mov     [extended_code],7Eh
  4593.         call    operand_64bit
  4594.         jmp     nomem_instruction_ready
  4595.      movq_mmreg:
  4596.         call    convert_mmx_register
  4597.         mov     [postbyte_register],al
  4598.         mov     [extended_code],6Fh
  4599.         mov     [mmx_size],ah
  4600.         cmp     ah,16
  4601.         jne     movq_mmreg_
  4602.         mov     [extended_code],7Eh
  4603.         mov     [opcode_prefix],0F3h
  4604.       movq_mmreg_:
  4605.         lods    byte [esi]
  4606.         cmp     al,','
  4607.         jne     invalid_operand
  4608.         mov     [operand_size],0
  4609.         lods    byte [esi]
  4610.         call    get_size_operator
  4611.         cmp     al,10h
  4612.         je      movq_mmreg_reg
  4613.         call    get_address
  4614.         test    [operand_size],not 8
  4615.         jnz     invalid_operand_size
  4616.         jmp     instruction_ready
  4617.       movq_mmreg_reg:
  4618.         lods    byte [esi]
  4619.         cmp     al,0B0h
  4620.         jae     movq_mmreg_mmreg
  4621.         mov     [operand_size],0
  4622.         call    convert_register
  4623.         cmp     ah,8
  4624.         jne     invalid_operand_size
  4625.         mov     [extended_code],6Eh
  4626.         mov     [opcode_prefix],0
  4627.         mov     bl,al
  4628.         cmp     [mmx_size],16
  4629.         jne     movq_mmreg_reg_store
  4630.         mov     [opcode_prefix],66h
  4631.       movq_mmreg_reg_store:
  4632.         call    operand_64bit
  4633.         jmp     nomem_instruction_ready
  4634.       movq_mmreg_mmreg:
  4635.         call    convert_mmx_register
  4636.         cmp     ah,[mmx_size]
  4637.         jne     invalid_operand_size
  4638.         mov     bl,al
  4639.         jmp     nomem_instruction_ready
  4640. movdq_instruction:
  4641.         mov     [opcode_prefix],al
  4642.         mov     [base_code],0Fh
  4643.         mov     [extended_code],6Fh
  4644.         lods    byte [esi]
  4645.         call    get_size_operator
  4646.         cmp     al,10h
  4647.         je      movdq_mmreg
  4648.         cmp     al,'['
  4649.         jne     invalid_operand
  4650.         call    get_address
  4651.         lods    byte [esi]
  4652.         cmp     al,','
  4653.         jne     invalid_operand
  4654.         lods    byte [esi]
  4655.         call    get_size_operator
  4656.         cmp     al,10h
  4657.         jne     invalid_operand
  4658.         lods    byte [esi]
  4659.         call    convert_xmm_register
  4660.         mov     [postbyte_register],al
  4661.         mov     [extended_code],7Fh
  4662.         jmp     instruction_ready
  4663.       movdq_mmreg:
  4664.         lods    byte [esi]
  4665.         call    convert_xmm_register
  4666.         mov     [postbyte_register],al
  4667.         lods    byte [esi]
  4668.         cmp     al,','
  4669.         jne     invalid_operand
  4670.         lods    byte [esi]
  4671.         call    get_size_operator
  4672.         cmp     al,10h
  4673.         je      movdq_mmreg_mmreg
  4674.         cmp     al,'['
  4675.         jne     invalid_operand
  4676.         call    get_address
  4677.         jmp     instruction_ready
  4678.       movdq_mmreg_mmreg:
  4679.         lods    byte [esi]
  4680.         call    convert_xmm_register
  4681.         mov     bl,al
  4682.         jmp     nomem_instruction_ready
  4683. lddqu_instruction:
  4684.         lods    byte [esi]
  4685.         call    get_size_operator
  4686.         cmp     al,10h
  4687.         jne     invalid_operand
  4688.         lods    byte [esi]
  4689.         call    convert_xmm_register
  4690.         push    eax
  4691.         lods    byte [esi]
  4692.         cmp     al,','
  4693.         jne     invalid_operand
  4694.         lods    byte [esi]
  4695.         call    get_size_operator
  4696.         cmp     al,'['
  4697.         jne     invalid_operand
  4698.         call    get_address
  4699.         pop     eax
  4700.         mov     [postbyte_register],al
  4701.         mov     [opcode_prefix],0F2h
  4702.         mov     [base_code],0Fh
  4703.         mov     [extended_code],0F0h
  4704.         jmp     instruction_ready
  4705.  
  4706. movdq2q_instruction:
  4707.         mov     [opcode_prefix],0F2h
  4708.         mov     [mmx_size],8
  4709.         jmp     movq2dq_
  4710. movq2dq_instruction:
  4711.         mov     [opcode_prefix],0F3h
  4712.         mov     [mmx_size],16
  4713.       movq2dq_:
  4714.         lods    byte [esi]
  4715.         call    get_size_operator
  4716.         cmp     al,10h
  4717.         jne     invalid_operand
  4718.         lods    byte [esi]
  4719.         call    convert_mmx_register
  4720.         cmp     ah,[mmx_size]
  4721.         jne     invalid_operand_size
  4722.         mov     [postbyte_register],al
  4723.         mov     [operand_size],0
  4724.         lods    byte [esi]
  4725.         cmp     al,','
  4726.         jne     invalid_operand
  4727.         lods    byte [esi]
  4728.         call    get_size_operator
  4729.         cmp     al,10h
  4730.         jne     invalid_operand
  4731.         lods    byte [esi]
  4732.         call    convert_mmx_register
  4733.         xor     [mmx_size],8+16
  4734.         cmp     ah,[mmx_size]
  4735.         jne     invalid_operand_size
  4736.         mov     bl,al
  4737.         mov     [base_code],0Fh
  4738.         mov     [extended_code],0D6h
  4739.         jmp     nomem_instruction_ready
  4740.  
  4741. sse_ps_instruction_imm8:
  4742.         mov     [immediate_size],1
  4743. sse_ps_instruction:
  4744.         mov     [mmx_size],16
  4745.         jmp     sse_instruction
  4746. sse_pd_instruction_imm8:
  4747.         mov     [immediate_size],1
  4748. sse_pd_instruction:
  4749.         mov     [mmx_size],16
  4750.         mov     [opcode_prefix],66h
  4751.         jmp     sse_instruction
  4752. sse_ss_instruction:
  4753.         mov     [mmx_size],4
  4754.         mov     [opcode_prefix],0F3h
  4755.         jmp     sse_instruction
  4756. sse_sd_instruction:
  4757.         mov     [mmx_size],8
  4758.         mov     [opcode_prefix],0F2h
  4759.         jmp     sse_instruction
  4760. cmp_pd_instruction:
  4761.         mov     [opcode_prefix],66h
  4762. cmp_ps_instruction:
  4763.         mov     [mmx_size],16
  4764.         mov     byte [value],al
  4765.         mov     al,0C2h
  4766.         jmp     sse_instruction
  4767. cmp_ss_instruction:
  4768.         mov     [mmx_size],4
  4769.         mov     [opcode_prefix],0F3h
  4770.         jmp     cmp_sx_instruction
  4771. cmpsd_instruction:
  4772.         mov     al,0A7h
  4773.         mov     ah,[esi]
  4774.         or      ah,ah
  4775.         jz      simple_instruction_32bit
  4776.         cmp     ah,0Fh
  4777.         je      simple_instruction_32bit
  4778.         mov     al,-1
  4779. cmp_sd_instruction:
  4780.         mov     [mmx_size],8
  4781.         mov     [opcode_prefix],0F2h
  4782.       cmp_sx_instruction:
  4783.         mov     byte [value],al
  4784.         mov     al,0C2h
  4785.         jmp     sse_instruction
  4786. comiss_instruction:
  4787.         mov     [mmx_size],4
  4788.         jmp     sse_instruction
  4789. comisd_instruction:
  4790.         mov     [mmx_size],8
  4791.         mov     [opcode_prefix],66h
  4792.         jmp     sse_instruction
  4793. cvtdq2pd_instruction:
  4794.         mov     [opcode_prefix],0F3h
  4795. cvtps2pd_instruction:
  4796.         mov     [mmx_size],8
  4797.         jmp     sse_instruction
  4798. cvtpd2dq_instruction:
  4799.         mov     [mmx_size],16
  4800.         mov     [opcode_prefix],0F2h
  4801.         jmp     sse_instruction
  4802. movshdup_instruction:
  4803.         mov     [mmx_size],16
  4804.         mov     [opcode_prefix],0F3h
  4805. sse_instruction:
  4806.         mov     [base_code],0Fh
  4807.         mov     [extended_code],al
  4808.         lods    byte [esi]
  4809.         call    get_size_operator
  4810.         cmp     al,10h
  4811.         jne     invalid_operand
  4812.       sse_xmmreg:
  4813.         lods    byte [esi]
  4814.         call    convert_xmm_register
  4815.       sse_reg:
  4816.         mov     [postbyte_register],al
  4817.         mov     [operand_size],0
  4818.         lods    byte [esi]
  4819.         cmp     al,','
  4820.         jne     invalid_operand
  4821.         lods    byte [esi]
  4822.         call    get_size_operator
  4823.         cmp     al,10h
  4824.         je      sse_xmmreg_xmmreg
  4825.       sse_reg_mem:
  4826.         cmp     al,'['
  4827.         jne     invalid_operand
  4828.         call    get_address
  4829.         cmp     [operand_size],0
  4830.         je      sse_mem_size_ok
  4831.         mov     al,[mmx_size]
  4832.         cmp     [operand_size],al
  4833.         jne     invalid_operand_size
  4834.       sse_mem_size_ok:
  4835.         mov     al,[extended_code]
  4836.         mov     ah,[supplemental_code]
  4837.         cmp     al,0C2h
  4838.         je      sse_cmp_mem_ok
  4839.         cmp     ax,443Ah
  4840.         je      sse_cmp_mem_ok
  4841.         cmp     [immediate_size],1
  4842.         je      mmx_imm8
  4843.         cmp     [immediate_size],-1
  4844.         jne     sse_ok
  4845.         call    take_additional_xmm0
  4846.         mov     [immediate_size],0
  4847.       sse_ok:
  4848.         jmp     instruction_ready
  4849.       sse_cmp_mem_ok:
  4850.         cmp     byte [value],-1
  4851.         je      mmx_imm8
  4852.         call    store_instruction_with_imm8
  4853.         jmp     instruction_assembled
  4854.       sse_xmmreg_xmmreg:
  4855.         cmp     [operand_prefix],66h
  4856.         jne     sse_xmmreg_xmmreg_ok
  4857.         cmp     [extended_code],12h
  4858.         je      invalid_operand
  4859.         cmp     [extended_code],16h
  4860.         je      invalid_operand
  4861.       sse_xmmreg_xmmreg_ok:
  4862.         lods    byte [esi]
  4863.         call    convert_xmm_register
  4864.         mov     bl,al
  4865.         mov     al,[extended_code]
  4866.         mov     ah,[supplemental_code]
  4867.         cmp     al,0C2h
  4868.         je      sse_cmp_nomem_ok
  4869.         cmp     ax,443Ah
  4870.         je      sse_cmp_nomem_ok
  4871.         cmp     [immediate_size],1
  4872.         je      mmx_nomem_imm8
  4873.         cmp     [immediate_size],-1
  4874.         jne     sse_nomem_ok
  4875.         call    take_additional_xmm0
  4876.         mov     [immediate_size],0
  4877.       sse_nomem_ok:
  4878.         jmp     nomem_instruction_ready
  4879.       sse_cmp_nomem_ok:
  4880.         cmp     byte [value],-1
  4881.         je      mmx_nomem_imm8
  4882.         call    store_nomem_instruction
  4883.         mov     al,byte [value]
  4884.         stosb
  4885.         jmp     instruction_assembled
  4886.       take_additional_xmm0:
  4887.         cmp     byte [esi],','
  4888.         jne     additional_xmm0_ok
  4889.         inc     esi
  4890.         lods    byte [esi]
  4891.         cmp     al,10h
  4892.         jne     invalid_operand
  4893.         lods    byte [esi]
  4894.         call    convert_xmm_register
  4895.         test    al,al
  4896.         jnz     invalid_operand
  4897.       additional_xmm0_ok:
  4898.         ret
  4899.  
  4900. pslldq_instruction:
  4901.         mov     [postbyte_register],al
  4902.         mov     [opcode_prefix],66h
  4903.         mov     [base_code],0Fh
  4904.         mov     [extended_code],73h
  4905.         lods    byte [esi]
  4906.         call    get_size_operator
  4907.         cmp     al,10h
  4908.         jne     invalid_operand
  4909.         lods    byte [esi]
  4910.         call    convert_xmm_register
  4911.         mov     bl,al
  4912.         jmp     mmx_nomem_imm8
  4913. movpd_instruction:
  4914.         mov     [opcode_prefix],66h
  4915. movps_instruction:
  4916.         mov     [base_code],0Fh
  4917.         mov     [extended_code],al
  4918.         mov     [mmx_size],16
  4919.         jmp     sse_mov_instruction
  4920. movss_instruction:
  4921.         mov     [mmx_size],4
  4922.         mov     [opcode_prefix],0F3h
  4923.         jmp     sse_movs
  4924. movsd_instruction:
  4925.         mov     al,0A5h
  4926.         mov     ah,[esi]
  4927.         or      ah,ah
  4928.         jz      simple_instruction_32bit
  4929.         cmp     ah,0Fh
  4930.         je      simple_instruction_32bit
  4931.         mov     [mmx_size],8
  4932.         mov     [opcode_prefix],0F2h
  4933.       sse_movs:
  4934.         mov     [base_code],0Fh
  4935.         mov     [extended_code],10h
  4936.         jmp     sse_mov_instruction
  4937. sse_mov_instruction:
  4938.         lods    byte [esi]
  4939.         call    get_size_operator
  4940.         cmp     al,10h
  4941.         je      sse_xmmreg
  4942.       sse_mem:
  4943.         cmp     al,'['
  4944.         jne     invalid_operand
  4945.         inc     [extended_code]
  4946.         call    get_address
  4947.         cmp     [operand_size],0
  4948.         je      sse_mem_xmmreg
  4949.         mov     al,[mmx_size]
  4950.         cmp     [operand_size],al
  4951.         jne     invalid_operand_size
  4952.         mov     [operand_size],0
  4953.       sse_mem_xmmreg:
  4954.         lods    byte [esi]
  4955.         cmp     al,','
  4956.         jne     invalid_operand
  4957.         lods    byte [esi]
  4958.         call    get_size_operator
  4959.         cmp     al,10h
  4960.         jne     invalid_operand
  4961.         lods    byte [esi]
  4962.         call    convert_xmm_register
  4963.         mov     [postbyte_register],al
  4964.         jmp     instruction_ready
  4965. movlpd_instruction:
  4966.         mov     [opcode_prefix],66h
  4967. movlps_instruction:
  4968.         mov     [base_code],0Fh
  4969.         mov     [extended_code],al
  4970.         mov     [mmx_size],8
  4971.         lods    byte [esi]
  4972.         call    get_size_operator
  4973.         cmp     al,10h
  4974.         jne     sse_mem
  4975.         lods    byte [esi]
  4976.         call    convert_xmm_register
  4977.         mov     [postbyte_register],al
  4978.         mov     [operand_size],0
  4979.         lods    byte [esi]
  4980.         cmp     al,','
  4981.         jne     invalid_operand
  4982.         lods    byte [esi]
  4983.         call    get_size_operator
  4984.         jmp     sse_reg_mem
  4985. movhlps_instruction:
  4986.         mov     [base_code],0Fh
  4987.         mov     [extended_code],al
  4988.         mov     [mmx_size],0
  4989.         lods    byte [esi]
  4990.         call    get_size_operator
  4991.         cmp     al,10h
  4992.         jne     invalid_operand
  4993.         lods    byte [esi]
  4994.         call    convert_xmm_register
  4995.         mov     [postbyte_register],al
  4996.         lods    byte [esi]
  4997.         cmp     al,','
  4998.         jne     invalid_operand
  4999.         lods    byte [esi]
  5000.         call    get_size_operator
  5001.         cmp     al,10h
  5002.         je      sse_xmmreg_xmmreg_ok
  5003.         jmp     invalid_operand
  5004. maskmovq_instruction:
  5005.         mov     cl,8
  5006.         jmp     maskmov_instruction
  5007. maskmovdqu_instruction:
  5008.         mov     cl,16
  5009.         mov     [opcode_prefix],66h
  5010.       maskmov_instruction:
  5011.         mov     [base_code],0Fh
  5012.         mov     [extended_code],0F7h
  5013.         lods    byte [esi]
  5014.         call    get_size_operator
  5015.         cmp     al,10h
  5016.         jne     invalid_operand
  5017.         lods    byte [esi]
  5018.         call    convert_mmx_register
  5019.         cmp     ah,cl
  5020.         jne     invalid_operand_size
  5021.         mov     [postbyte_register],al
  5022.         lods    byte [esi]
  5023.         cmp     al,','
  5024.         jne     invalid_operand
  5025.         lods    byte [esi]
  5026.         call    get_size_operator
  5027.         cmp     al,10h
  5028.         jne     invalid_operand
  5029.         lods    byte [esi]
  5030.         call    convert_mmx_register
  5031.         mov     bl,al
  5032.         jmp     nomem_instruction_ready
  5033. movmskpd_instruction:
  5034.         mov     [opcode_prefix],66h
  5035. movmskps_instruction:
  5036.         mov     [base_code],0Fh
  5037.         mov     [extended_code],50h
  5038.         lods    byte [esi]
  5039.         call    get_size_operator
  5040.         cmp     al,10h
  5041.         jne     invalid_operand
  5042.         lods    byte [esi]
  5043.         call    convert_register
  5044.         mov     [postbyte_register],al
  5045.         cmp     ah,4
  5046.         je      movmskps_reg_ok
  5047.         cmp     ah,8
  5048.         jne     invalid_operand_size
  5049.         cmp     [code_type],64
  5050.         jne     invalid_operand
  5051.       movmskps_reg_ok:
  5052.         mov     [operand_size],0
  5053.         lods    byte [esi]
  5054.         cmp     al,','
  5055.         jne     invalid_operand
  5056.         lods    byte [esi]
  5057.         call    get_size_operator
  5058.         cmp     al,10h
  5059.         je      sse_xmmreg_xmmreg_ok
  5060.         jmp     invalid_operand
  5061.  
  5062. cvtpi2pd_instruction:
  5063.         mov     [opcode_prefix],66h
  5064. cvtpi2ps_instruction:
  5065.         mov     [base_code],0Fh
  5066.         mov     [extended_code],al
  5067.         lods    byte [esi]
  5068.         call    get_size_operator
  5069.         cmp     al,10h
  5070.         jne     invalid_operand
  5071.         lods    byte [esi]
  5072.         call    convert_xmm_register
  5073.         mov     [postbyte_register],al
  5074.         mov     [operand_size],0
  5075.         lods    byte [esi]
  5076.         cmp     al,','
  5077.         jne     invalid_operand
  5078.         lods    byte [esi]
  5079.         call    get_size_operator
  5080.         cmp     al,10h
  5081.         je      cvtpi_xmmreg_xmmreg
  5082.         cmp     al,'['
  5083.         jne     invalid_operand
  5084.         call    get_address
  5085.         cmp     [operand_size],0
  5086.         je      cvtpi_size_ok
  5087.         cmp     [operand_size],8
  5088.         jne     invalid_operand_size
  5089.       cvtpi_size_ok:
  5090.         jmp     instruction_ready
  5091.       cvtpi_xmmreg_xmmreg:
  5092.         lods    byte [esi]
  5093.         call    convert_mmx_register
  5094.         cmp     ah,8
  5095.         jne     invalid_operand_size
  5096.         mov     bl,al
  5097.         jmp     nomem_instruction_ready
  5098. cvtsi2ss_instruction:
  5099.         mov     [opcode_prefix],0F3h
  5100.         jmp     cvtsi_instruction
  5101. cvtsi2sd_instruction:
  5102.         mov     [opcode_prefix],0F2h
  5103.       cvtsi_instruction:
  5104.         mov     [base_code],0Fh
  5105.         mov     [extended_code],al
  5106.         lods    byte [esi]
  5107.         call    get_size_operator
  5108.         cmp     al,10h
  5109.         jne     invalid_operand
  5110.         lods    byte [esi]
  5111.         call    convert_xmm_register
  5112.         mov     [postbyte_register],al
  5113.       cvtsi_xmmreg:
  5114.         mov     [operand_size],0
  5115.         lods    byte [esi]
  5116.         cmp     al,','
  5117.         jne     invalid_operand
  5118.         lods    byte [esi]
  5119.         call    get_size_operator
  5120.         cmp     al,10h
  5121.         je      cvtsi_xmmreg_reg
  5122.         cmp     al,'['
  5123.         jne     invalid_operand
  5124.         call    get_address
  5125.         cmp     [operand_size],0
  5126.         je      cvtsi_size_ok
  5127.         cmp     [operand_size],4
  5128.         je      cvtsi_size_ok
  5129.         cmp     [operand_size],8
  5130.         jne     invalid_operand_size
  5131.         call    operand_64bit
  5132.       cvtsi_size_ok:
  5133.         jmp     instruction_ready
  5134.       cvtsi_xmmreg_reg:
  5135.         lods    byte [esi]
  5136.         call    convert_register
  5137.         cmp     ah,4
  5138.         je      cvtsi_xmmreg_reg_store
  5139.         cmp     ah,8
  5140.         jne     invalid_operand_size
  5141.         call    operand_64bit
  5142.       cvtsi_xmmreg_reg_store:
  5143.         mov     bl,al
  5144.         jmp     nomem_instruction_ready
  5145. cvtps2pi_instruction:
  5146.         mov     [mmx_size],8
  5147.         jmp     cvtpd_instruction
  5148. cvtpd2pi_instruction:
  5149.         mov     [opcode_prefix],66h
  5150.         mov     [mmx_size],16
  5151.       cvtpd_instruction:
  5152.         mov     [base_code],0Fh
  5153.         mov     [extended_code],al
  5154.         lods    byte [esi]
  5155.         call    get_size_operator
  5156.         cmp     al,10h
  5157.         jne     invalid_operand
  5158.         lods    byte [esi]
  5159.         call    convert_mmx_register
  5160.         cmp     ah,8
  5161.         jne     invalid_operand_size
  5162.         mov     [operand_size],0
  5163.         jmp     sse_reg
  5164. cvtss2si_instruction:
  5165.         mov     [opcode_prefix],0F3h
  5166.         mov     [mmx_size],4
  5167.         jmp     cvt2si_instruction
  5168. cvtsd2si_instruction:
  5169.         mov     [opcode_prefix],0F2h
  5170.         mov     [mmx_size],8
  5171.       cvt2si_instruction:
  5172.         mov     [extended_code],al
  5173.         mov     [base_code],0Fh
  5174.         lods    byte [esi]
  5175.         call    get_size_operator
  5176.         cmp     al,10h
  5177.         jne     invalid_operand
  5178.         lods    byte [esi]
  5179.         call    convert_register
  5180.         mov     [operand_size],0
  5181.         cmp     ah,4
  5182.         je      sse_reg
  5183.         cmp     ah,8
  5184.         jne     invalid_operand_size
  5185.         call    operand_64bit
  5186.         jmp     sse_reg
  5187.  
  5188. ssse3_instruction:
  5189.         mov     [base_code],0Fh
  5190.         mov     [extended_code],38h
  5191.         mov     [supplemental_code],al
  5192.         jmp     mmx_instruction
  5193. palignr_instruction:
  5194.         mov     [base_code],0Fh
  5195.         mov     [extended_code],3Ah
  5196.         mov     [supplemental_code],0Fh
  5197.         lods    byte [esi]
  5198.         call    get_size_operator
  5199.         cmp     al,10h
  5200.         jne     invalid_operand
  5201.         lods    byte [esi]
  5202.         call    convert_mmx_register
  5203.         call    make_mmx_prefix
  5204.         mov     [postbyte_register],al
  5205.         lods    byte [esi]
  5206.         cmp     al,','
  5207.         jne     invalid_operand
  5208.         lods    byte [esi]
  5209.         call    get_size_operator
  5210.         cmp     al,10h
  5211.         je      palignr_mmreg_mmreg
  5212.         cmp     al,'['
  5213.         jne     invalid_operand
  5214.         call    get_address
  5215.         jmp     mmx_imm8
  5216.       palignr_mmreg_mmreg:
  5217.         lods    byte [esi]
  5218.         call    convert_mmx_register
  5219.         mov     bl,al
  5220.         jmp     mmx_nomem_imm8
  5221. amd3dnow_instruction:
  5222.         mov     [base_code],0Fh
  5223.         mov     [extended_code],0Fh
  5224.         mov     byte [value],al
  5225.         lods    byte [esi]
  5226.         call    get_size_operator
  5227.         cmp     al,10h
  5228.         jne     invalid_operand
  5229.         lods    byte [esi]
  5230.         call    convert_mmx_register
  5231.         cmp     ah,8
  5232.         jne     invalid_operand_size
  5233.         mov     [postbyte_register],al
  5234.         lods    byte [esi]
  5235.         cmp     al,','
  5236.         jne     invalid_operand
  5237.         lods    byte [esi]
  5238.         call    get_size_operator
  5239.         cmp     al,10h
  5240.         je      amd3dnow_mmreg_mmreg
  5241.         cmp     al,'['
  5242.         jne     invalid_operand
  5243.         call    get_address
  5244.         call    store_instruction_with_imm8
  5245.         jmp     instruction_assembled
  5246.       amd3dnow_mmreg_mmreg:
  5247.         lods    byte [esi]
  5248.         call    convert_mmx_register
  5249.         cmp     ah,8
  5250.         jne     invalid_operand_size
  5251.         mov     bl,al
  5252.         call    store_nomem_instruction
  5253.         mov     al,byte [value]
  5254.         stos    byte [edi]
  5255.         jmp     instruction_assembled
  5256.  
  5257. sse4_instruction_38_xmm0:
  5258.         mov     [immediate_size],-1
  5259. sse4_instruction_38:
  5260.         mov     [mmx_size],16
  5261.         mov     [opcode_prefix],66h
  5262.         mov     [supplemental_code],al
  5263.         mov     al,38h
  5264.         jmp     sse_instruction
  5265. sse4_ss_instruction_3a_imm8:
  5266.         mov     [immediate_size],1
  5267.         mov     [mmx_size],4
  5268.         jmp     sse4_instruction_3a_setup
  5269. sse4_sd_instruction_3a_imm8:
  5270.         mov     [immediate_size],1
  5271.         mov     [mmx_size],8
  5272.         jmp     sse4_instruction_3a_setup
  5273. sse4_instruction_3a_imm8:
  5274.         mov     [immediate_size],1
  5275.         mov     [mmx_size],16
  5276.       sse4_instruction_3a_setup:
  5277.         mov     [opcode_prefix],66h
  5278.         mov     [supplemental_code],al
  5279.         mov     al,3Ah
  5280.         jmp     sse_instruction
  5281. pclmulqdq_instruction:
  5282.         mov     byte [value],al
  5283.         mov     [mmx_size],16
  5284.         mov     al,44h
  5285.         jmp     sse4_instruction_3a_setup
  5286. extractps_instruction:
  5287.         mov     [opcode_prefix],66h
  5288.         mov     [base_code],0Fh
  5289.         mov     [extended_code],3Ah
  5290.         mov     [supplemental_code],17h
  5291.         lods    byte [esi]
  5292.         call    get_size_operator
  5293.         cmp     al,10h
  5294.         je      extractps_reg
  5295.         cmp     al,'['
  5296.         jne     invalid_operand
  5297.         call    get_address
  5298.         cmp     [operand_size],4
  5299.         je      extractps_size_ok
  5300.         cmp     [operand_size],0
  5301.         jne     invalid_operand_size
  5302.       extractps_size_ok:
  5303.         push    edx ebx ecx
  5304.         mov     [operand_size],0
  5305.         lods    byte [esi]
  5306.         cmp     al,','
  5307.         jne     invalid_operand
  5308.         lods    byte [esi]
  5309.         call    get_size_operator
  5310.         cmp     al,10h
  5311.         jne     invalid_operand
  5312.         lods    byte [esi]
  5313.         call    convert_xmm_register
  5314.         mov     [postbyte_register],al
  5315.         pop     ecx ebx edx
  5316.         jmp     mmx_imm8
  5317.       extractps_reg:
  5318.         lods    byte [esi]
  5319.         call    convert_register
  5320.         push    eax
  5321.         mov     [operand_size],0
  5322.         lods    byte [esi]
  5323.         cmp     al,','
  5324.         jne     invalid_operand
  5325.         lods    byte [esi]
  5326.         call    get_size_operator
  5327.         cmp     al,10h
  5328.         jne     invalid_operand
  5329.         lods    byte [esi]
  5330.         call    convert_xmm_register
  5331.         mov     [postbyte_register],al
  5332.         pop     ebx
  5333.         mov     al,bh
  5334.         cmp     al,4
  5335.         je      mmx_nomem_imm8
  5336.         cmp     al,8
  5337.         jne     invalid_operand_size
  5338.         call    operand_64bit
  5339.         jmp     mmx_nomem_imm8
  5340. insertps_instruction:
  5341.         lods    byte [esi]
  5342.         call    get_size_operator
  5343.         cmp     al,10h
  5344.         jne     invalid_operand
  5345.         lods    byte [esi]
  5346.         call    convert_xmm_register
  5347.         mov     [postbyte_register],al
  5348.       insertps_xmmreg:
  5349.         mov     [opcode_prefix],66h
  5350.         mov     [base_code],0Fh
  5351.         mov     [extended_code],3Ah
  5352.         mov     [supplemental_code],21h
  5353.         mov     [operand_size],0
  5354.         lods    byte [esi]
  5355.         cmp     al,','
  5356.         jne     invalid_operand
  5357.         lods    byte [esi]
  5358.         call    get_size_operator
  5359.         cmp     al,10h
  5360.         je      insertps_xmmreg_reg
  5361.         cmp     al,'['
  5362.         jne     invalid_operand
  5363.         call    get_address
  5364.         cmp     [operand_size],4
  5365.         je      insertps_size_ok
  5366.         cmp     [operand_size],0
  5367.         jne     invalid_operand_size
  5368.       insertps_size_ok:
  5369.         jmp     mmx_imm8
  5370.       insertps_xmmreg_reg:
  5371.         lods    byte [esi]
  5372.         call    convert_mmx_register
  5373.         mov     bl,al
  5374.         jmp     mmx_nomem_imm8
  5375. pextrq_instruction:
  5376.         mov     [mmx_size],8
  5377.         jmp     pextr_instruction
  5378. pextrd_instruction:
  5379.         mov     [mmx_size],4
  5380.         jmp     pextr_instruction
  5381. pextrw_instruction:
  5382.         mov     [mmx_size],2
  5383.         jmp     pextr_instruction
  5384. pextrb_instruction:
  5385.         mov     [mmx_size],1
  5386.       pextr_instruction:
  5387.         mov     [opcode_prefix],66h
  5388.         mov     [base_code],0Fh
  5389.         mov     [extended_code],3Ah
  5390.         mov     [supplemental_code],al
  5391.         lods    byte [esi]
  5392.         call    get_size_operator
  5393.         cmp     al,10h
  5394.         je      pextr_reg
  5395.         cmp     al,'['
  5396.         jne     invalid_operand
  5397.         call    get_address
  5398.         mov     al,[mmx_size]
  5399.         cmp     al,[operand_size]
  5400.         je      pextr_size_ok
  5401.         cmp     [operand_size],0
  5402.         jne     invalid_operand_size
  5403.       pextr_size_ok:
  5404.         cmp     al,8
  5405.         jne     pextr_prefix_ok
  5406.         call    operand_64bit
  5407.       pextr_prefix_ok:
  5408.         push    edx ebx ecx
  5409.         mov     [operand_size],0
  5410.         lods    byte [esi]
  5411.         cmp     al,','
  5412.         jne     invalid_operand
  5413.         lods    byte [esi]
  5414.         call    get_size_operator
  5415.         cmp     al,10h
  5416.         jne     invalid_operand
  5417.         lods    byte [esi]
  5418.         call    convert_xmm_register
  5419.         mov     [postbyte_register],al
  5420.         pop     ecx ebx edx
  5421.         jmp     mmx_imm8
  5422.       pextr_reg:
  5423.         lods    byte [esi]
  5424.         call    convert_register
  5425.         cmp     [mmx_size],4
  5426.         ja      pextrq_reg
  5427.         cmp     ah,4
  5428.         je      pextr_reg_size_ok
  5429.         cmp     [code_type],64
  5430.         jne     pextr_invalid_size
  5431.         cmp     ah,8
  5432.         je      pextr_reg_size_ok
  5433.       pextr_invalid_size:
  5434.         jmp     invalid_operand_size
  5435.       pextrq_reg:
  5436.         cmp     ah,8
  5437.         jne     pextr_invalid_size
  5438.         call    operand_64bit
  5439.       pextr_reg_size_ok:
  5440.         mov     [operand_size],0
  5441.         push    eax
  5442.         lods    byte [esi]
  5443.         cmp     al,','
  5444.         jne     invalid_operand
  5445.         lods    byte [esi]
  5446.         call    get_size_operator
  5447.         cmp     al,10h
  5448.         jne     invalid_operand
  5449.         lods    byte [esi]
  5450.         call    convert_mmx_register
  5451.         mov     ebx,eax
  5452.         pop     eax
  5453.         mov     [postbyte_register],al
  5454.         mov     al,ah
  5455.         cmp     [mmx_size],2
  5456.         jne     pextr_reg_store
  5457.         mov     [opcode_prefix],0
  5458.         mov     [extended_code],0C5h
  5459.         call    make_mmx_prefix
  5460.         jmp     mmx_nomem_imm8
  5461.       pextr_reg_store:
  5462.         cmp     bh,16
  5463.         jne     invalid_operand_size
  5464.         xchg    bl,[postbyte_register]
  5465.         call    operand_autodetect
  5466.         jmp     mmx_nomem_imm8
  5467. pinsrb_instruction:
  5468.         mov     [mmx_size],1
  5469.         jmp     pinsr_instruction
  5470. pinsrd_instruction:
  5471.         mov     [mmx_size],4
  5472.         jmp     pinsr_instruction
  5473. pinsrq_instruction:
  5474.         mov     [mmx_size],8
  5475.         call    operand_64bit
  5476.       pinsr_instruction:
  5477.         mov     [opcode_prefix],66h
  5478.         mov     [base_code],0Fh
  5479.         mov     [extended_code],3Ah
  5480.         mov     [supplemental_code],al
  5481.         lods    byte [esi]
  5482.         call    get_size_operator
  5483.         cmp     al,10h
  5484.         jne     invalid_operand
  5485.         lods    byte [esi]
  5486.         call    convert_xmm_register
  5487.         mov     [postbyte_register],al
  5488.       pinsr_xmmreg:
  5489.         mov     [operand_size],0
  5490.         lods    byte [esi]
  5491.         cmp     al,','
  5492.         jne     invalid_operand
  5493.         lods    byte [esi]
  5494.         call    get_size_operator
  5495.         cmp     al,10h
  5496.         je      pinsr_xmmreg_reg
  5497.         cmp     al,'['
  5498.         jne     invalid_operand
  5499.         call    get_address
  5500.         cmp     [operand_size],0
  5501.         je      mmx_imm8
  5502.         mov     al,[mmx_size]
  5503.         cmp     al,[operand_size]
  5504.         je      mmx_imm8
  5505.         jmp     invalid_operand_size
  5506.       pinsr_xmmreg_reg:
  5507.         lods    byte [esi]
  5508.         call    convert_register
  5509.         mov     bl,al
  5510.         cmp     [mmx_size],8
  5511.         je      pinsrq_xmmreg_reg
  5512.         cmp     ah,4
  5513.         je      mmx_nomem_imm8
  5514.         jmp     invalid_operand_size
  5515.       pinsrq_xmmreg_reg:
  5516.         cmp     ah,8
  5517.         je      mmx_nomem_imm8
  5518.         jmp     invalid_operand_size
  5519. pmovsxbw_instruction:
  5520.         mov     [mmx_size],8
  5521.         jmp     pmovsx_instruction
  5522. pmovsxbd_instruction:
  5523.         mov     [mmx_size],4
  5524.         jmp     pmovsx_instruction
  5525. pmovsxbq_instruction:
  5526.         mov     [mmx_size],2
  5527.         jmp     pmovsx_instruction
  5528. pmovsxwd_instruction:
  5529.         mov     [mmx_size],8
  5530.         jmp     pmovsx_instruction
  5531. pmovsxwq_instruction:
  5532.         mov     [mmx_size],4
  5533.         jmp     pmovsx_instruction
  5534. pmovsxdq_instruction:
  5535.         mov     [mmx_size],8
  5536.       pmovsx_instruction:
  5537.         mov     [opcode_prefix],66h
  5538.         mov     [base_code],0Fh
  5539.         mov     [extended_code],38h
  5540.         mov     [supplemental_code],al
  5541.         lods    byte [esi]
  5542.         call    get_size_operator
  5543.         cmp     al,10h
  5544.         jne     invalid_operand
  5545.         lods    byte [esi]
  5546.         call    convert_xmm_register
  5547.         mov     [postbyte_register],al
  5548.         lods    byte [esi]
  5549.         cmp     al,','
  5550.         jne     invalid_operand
  5551.         mov     [operand_size],0
  5552.         lods    byte [esi]
  5553.         call    get_size_operator
  5554.         cmp     al,10h
  5555.         je      pmovsx_xmmreg_reg
  5556.         cmp     al,'['
  5557.         jne     invalid_operand
  5558.         call    get_address
  5559.         cmp     [operand_size],0
  5560.         je      instruction_ready
  5561.         mov     al,[mmx_size]
  5562.         cmp     al,[operand_size]
  5563.         jne     invalid_operand_size
  5564.         jmp     instruction_ready
  5565.       pmovsx_xmmreg_reg:
  5566.         lods    byte [esi]
  5567.         call    convert_xmm_register
  5568.         mov     bl,al
  5569.         jmp     nomem_instruction_ready
  5570.  
  5571. fxsave_instruction_64bit:
  5572.         call    operand_64bit
  5573. fxsave_instruction:
  5574.         mov     [extended_code],0AEh
  5575.         mov     [base_code],0Fh
  5576.         mov     [postbyte_register],al
  5577.         lods    byte [esi]
  5578.         call    get_size_operator
  5579.         cmp     al,'['
  5580.         jne     invalid_operand
  5581.         call    get_address
  5582.         mov     ah,[operand_size]
  5583.         or      ah,ah
  5584.         jz      fxsave_size_ok
  5585.         mov     al,[postbyte_register]
  5586.         cmp     al,111b
  5587.         je      clflush_size_check
  5588.         cmp     al,10b
  5589.         jb      invalid_operand_size
  5590.         cmp     al,11b
  5591.         ja      invalid_operand_size
  5592.         cmp     ah,4
  5593.         jne     invalid_operand_size
  5594.         jmp     fxsave_size_ok
  5595.       clflush_size_check:
  5596.         cmp     ah,1
  5597.         jne     invalid_operand_size
  5598.       fxsave_size_ok:
  5599.         jmp     instruction_ready
  5600. prefetch_instruction:
  5601.         mov     [extended_code],18h
  5602.       prefetch_mem_8bit:
  5603.         mov     [base_code],0Fh
  5604.         mov     [postbyte_register],al
  5605.         lods    byte [esi]
  5606.         call    get_size_operator
  5607.         cmp     al,'['
  5608.         jne     invalid_operand
  5609.         or      ah,ah
  5610.         jz      prefetch_size_ok
  5611.         cmp     ah,1
  5612.         jne     invalid_operand_size
  5613.       prefetch_size_ok:
  5614.         call    get_address
  5615.         jmp     instruction_ready
  5616. amd_prefetch_instruction:
  5617.         mov     [extended_code],0Dh
  5618.         jmp     prefetch_mem_8bit
  5619. fence_instruction:
  5620.         mov     bl,al
  5621.         mov     ax,0AE0Fh
  5622.         stos    word [edi]
  5623.         mov     al,bl
  5624.         stos    byte [edi]
  5625.         jmp     instruction_assembled
  5626. pause_instruction:
  5627.         mov     ax,90F3h
  5628.         stos    word [edi]
  5629.         jmp     instruction_assembled
  5630. movntq_instruction:
  5631.         mov     [mmx_size],8
  5632.         jmp     movnt_instruction
  5633. movntpd_instruction:
  5634.         mov     [opcode_prefix],66h
  5635. movntps_instruction:
  5636.         mov     [mmx_size],16
  5637.       movnt_instruction:
  5638.         mov     [extended_code],al
  5639.         mov     [base_code],0Fh
  5640.         lods    byte [esi]
  5641.         call    get_size_operator
  5642.         cmp     al,'['
  5643.         jne     invalid_operand
  5644.         call    get_address
  5645.         lods    byte [esi]
  5646.         cmp     al,','
  5647.         jne     invalid_operand
  5648.         lods    byte [esi]
  5649.         call    get_size_operator
  5650.         cmp     al,10h
  5651.         jne     invalid_operand
  5652.         lods    byte [esi]
  5653.         call    convert_mmx_register
  5654.         cmp     ah,[mmx_size]
  5655.         jne     invalid_operand_size
  5656.         mov     [postbyte_register],al
  5657.         jmp     instruction_ready
  5658.  
  5659. movntsd_instruction:
  5660.         mov     [opcode_prefix],0F2h
  5661.         mov     [mmx_size],8
  5662.         jmp     movnts_instruction
  5663. movntss_instruction:
  5664.         mov     [opcode_prefix],0F3h
  5665.         mov     [mmx_size],4
  5666.       movnts_instruction:
  5667.         mov     [extended_code],al
  5668.         mov     [base_code],0Fh
  5669.         lods    byte [esi]
  5670.         call    get_size_operator
  5671.         cmp     al,'['
  5672.         jne     invalid_operand
  5673.         call    get_address
  5674.         mov     al,[operand_size]
  5675.         cmp     al,[mmx_size]
  5676.         je      movnts_size_ok
  5677.         test    al,al
  5678.         jnz     invalid_operand_size
  5679.       movnts_size_ok:
  5680.         lods    byte [esi]
  5681.         cmp     al,','
  5682.         jne     invalid_operand
  5683.         mov     [operand_size],0
  5684.         lods    byte [esi]
  5685.         call    get_size_operator
  5686.         cmp     al,10h
  5687.         jne     invalid_operand
  5688.         lods    byte [esi]
  5689.         call    convert_xmm_register
  5690.         mov     [postbyte_register],al
  5691.         jmp     instruction_ready
  5692.  
  5693. movnti_instruction:
  5694.         mov     [base_code],0Fh
  5695.         mov     [extended_code],al
  5696.         lods    byte [esi]
  5697.         call    get_size_operator
  5698.         cmp     al,'['
  5699.         jne     invalid_operand
  5700.         call    get_address
  5701.         lods    byte [esi]
  5702.         cmp     al,','
  5703.         jne     invalid_operand
  5704.         lods    byte [esi]
  5705.         call    get_size_operator
  5706.         cmp     al,10h
  5707.         jne     invalid_operand
  5708.         lods    byte [esi]
  5709.         call    convert_register
  5710.         cmp     ah,4
  5711.         je      movnti_store
  5712.         cmp     ah,8
  5713.         jne     invalid_operand_size
  5714.         call    operand_64bit
  5715.       movnti_store:
  5716.         mov     [postbyte_register],al
  5717.         jmp     instruction_ready
  5718. monitor_instruction:
  5719.         mov     [postbyte_register],al
  5720.         cmp     byte [esi],0
  5721.         je      monitor_instruction_store
  5722.         cmp     byte [esi],0Fh
  5723.         je      monitor_instruction_store
  5724.         lods    byte [esi]
  5725.         call    get_size_operator
  5726.         cmp     al,10h
  5727.         jne     invalid_operand
  5728.         lods    byte [esi]
  5729.         call    convert_register
  5730.         cmp     ax,0400h
  5731.         jne     invalid_operand
  5732.         lods    byte [esi]
  5733.         cmp     al,','
  5734.         jne     invalid_operand
  5735.         lods    byte [esi]
  5736.         call    get_size_operator
  5737.         cmp     al,10h
  5738.         jne     invalid_operand
  5739.         lods    byte [esi]
  5740.         call    convert_register
  5741.         cmp     ax,0401h
  5742.         jne     invalid_operand
  5743.         cmp     [postbyte_register],0C8h
  5744.         jne     monitor_instruction_store
  5745.         lods    byte [esi]
  5746.         cmp     al,','
  5747.         jne     invalid_operand
  5748.         lods    byte [esi]
  5749.         call    get_size_operator
  5750.         cmp     al,10h
  5751.         jne     invalid_operand
  5752.         lods    byte [esi]
  5753.         call    convert_register
  5754.         cmp     ax,0402h
  5755.         jne     invalid_operand
  5756.       monitor_instruction_store:
  5757.         mov     ax,010Fh
  5758.         stos    word [edi]
  5759.         mov     al,[postbyte_register]
  5760.         stos    byte [edi]
  5761.         jmp     instruction_assembled
  5762. movntdqa_instruction:
  5763.         mov     [opcode_prefix],66h
  5764.         mov     [base_code],0Fh
  5765.         mov     [extended_code],38h
  5766.         mov     [supplemental_code],al
  5767.         lods    byte [esi]
  5768.         call    get_size_operator
  5769.         cmp     al,10h
  5770.         jne     invalid_operand
  5771.         lods    byte [esi]
  5772.         call    convert_xmm_register
  5773.         mov     [postbyte_register],al
  5774.         lods    byte [esi]
  5775.         cmp     al,','
  5776.         jne     invalid_operand
  5777.         lods    byte [esi]
  5778.         call    get_size_operator
  5779.         cmp     al,'['
  5780.         jne     invalid_operand
  5781.         call    get_address
  5782.         jmp     instruction_ready
  5783.  
  5784. extrq_instruction:
  5785.         mov     [opcode_prefix],66h
  5786.         mov     [base_code],0Fh
  5787.         mov     [extended_code],78h
  5788.         lods    byte [esi]
  5789.         call    get_size_operator
  5790.         cmp     al,10h
  5791.         jne     invalid_operand
  5792.         lods    byte [esi]
  5793.         call    convert_xmm_register
  5794.         mov     [postbyte_register],al
  5795.         mov     [operand_size],0
  5796.         lods    byte [esi]
  5797.         cmp     al,','
  5798.         jne     invalid_operand
  5799.         lods    byte [esi]
  5800.         call    get_size_operator
  5801.         cmp     al,10h
  5802.         je      extrq_xmmreg_xmmreg
  5803.         test    ah,not 1
  5804.         jnz     invalid_operand_size
  5805.         cmp     al,'('
  5806.         jne     invalid_operand
  5807.         xor     bl,bl
  5808.         xchg    bl,[postbyte_register]
  5809.         call    store_nomem_instruction
  5810.         call    get_byte_value
  5811.         stosb
  5812.         call    append_imm8
  5813.         jmp     instruction_assembled
  5814.       extrq_xmmreg_xmmreg:
  5815.         inc     [extended_code]
  5816.         lods    byte [esi]
  5817.         call    convert_xmm_register
  5818.         mov     bl,al
  5819.         jmp     nomem_instruction_ready
  5820. insertq_instruction:
  5821.         mov     [opcode_prefix],0F2h
  5822.         mov     [base_code],0Fh
  5823.         mov     [extended_code],78h
  5824.         lods    byte [esi]
  5825.         call    get_size_operator
  5826.         cmp     al,10h
  5827.         jne     invalid_operand
  5828.         lods    byte [esi]
  5829.         call    convert_xmm_register
  5830.         mov     [postbyte_register],al
  5831.         mov     [operand_size],0
  5832.         lods    byte [esi]
  5833.         cmp     al,','
  5834.         jne     invalid_operand
  5835.         lods    byte [esi]
  5836.         call    get_size_operator
  5837.         cmp     al,10h
  5838.         jne     invalid_operand
  5839.         lods    byte [esi]
  5840.         call    convert_xmm_register
  5841.         mov     bl,al
  5842.         cmp     byte [esi],','
  5843.         je      insertq_with_imm
  5844.         inc     [extended_code]
  5845.         jmp     nomem_instruction_ready
  5846.       insertq_with_imm:
  5847.         call    store_nomem_instruction
  5848.         call    append_imm8
  5849.         call    append_imm8
  5850.         jmp     instruction_assembled
  5851.  
  5852. crc32_instruction:
  5853.         mov     [opcode_prefix],0F2h
  5854.         mov     [base_code],0Fh
  5855.         mov     [extended_code],38h
  5856.         mov     [supplemental_code],0F0h
  5857.         lods    byte [esi]
  5858.         call    get_size_operator
  5859.         cmp     al,10h
  5860.         jne     invalid_operand
  5861.         lods    byte [esi]
  5862.         call    convert_register
  5863.         mov     [postbyte_register],al
  5864.         cmp     ah,8
  5865.         je      crc32_reg64
  5866.         cmp     ah,4
  5867.         jne     invalid_operand
  5868.         lods    byte [esi]
  5869.         cmp     al,','
  5870.         jne     invalid_operand
  5871.         mov     [operand_size],0
  5872.         lods    byte [esi]
  5873.         call    get_size_operator
  5874.         cmp     al,10h
  5875.         je      crc32_reg32_reg
  5876.         cmp     al,'['
  5877.         jne     invalid_operand
  5878.         call    get_address
  5879.         mov     al,[operand_size]
  5880.         test    al,al
  5881.         jz      crc32_unknown_size
  5882.         cmp     al,1
  5883.         je      crc32_reg32_mem_store
  5884.         cmp     al,4
  5885.         ja      invalid_operand_size
  5886.         inc     [supplemental_code]
  5887.         call    operand_autodetect
  5888.       crc32_reg32_mem_store:
  5889.         jmp     instruction_ready
  5890.       crc32_unknown_size:
  5891.         call    recoverable_unknown_size
  5892.         jmp     crc32_reg32_mem_store
  5893.       crc32_reg32_reg:
  5894.         lods    byte [esi]
  5895.         call    convert_register
  5896.         mov     bl,al
  5897.         mov     al,ah
  5898.         cmp     al,1
  5899.         je      crc32_reg32_reg_store
  5900.         cmp     al,4
  5901.         ja      invalid_operand_size
  5902.         inc     [supplemental_code]
  5903.         call    operand_autodetect
  5904.       crc32_reg32_reg_store:
  5905.         jmp     nomem_instruction_ready
  5906.       crc32_reg64:
  5907.         lods    byte [esi]
  5908.         cmp     al,','
  5909.         jne     invalid_operand
  5910.         mov     [operand_size],0
  5911.         call    operand_64bit
  5912.         lods    byte [esi]
  5913.         call    get_size_operator
  5914.         cmp     al,10h
  5915.         je      crc32_reg64_reg
  5916.         cmp     al,'['
  5917.         jne     invalid_operand
  5918.         call    get_address
  5919.         mov     ah,[operand_size]
  5920.         mov     al,8
  5921.         test    ah,ah
  5922.         jz      crc32_unknown_size
  5923.         cmp     ah,1
  5924.         je      crc32_reg32_mem_store
  5925.         cmp     ah,al
  5926.         jne     invalid_operand_size
  5927.         inc     [supplemental_code]
  5928.         jmp     crc32_reg32_mem_store
  5929.       crc32_reg64_reg:
  5930.         lods    byte [esi]
  5931.         call    convert_register
  5932.         mov     bl,al
  5933.         mov     al,8
  5934.         cmp     ah,1
  5935.         je      crc32_reg32_reg_store
  5936.         cmp     ah,al
  5937.         jne     invalid_operand_size
  5938.         inc     [supplemental_code]
  5939.         jmp     crc32_reg32_reg_store
  5940. popcnt_instruction:
  5941.         mov     [opcode_prefix],0F3h
  5942.         jmp     bs_instruction
  5943. movbe_instruction:
  5944.         mov     [supplemental_code],al
  5945.         mov     [extended_code],38h
  5946.         mov     [base_code],0Fh
  5947.         lods    byte [esi]
  5948.         call    get_size_operator
  5949.         cmp     al,'['
  5950.         je      movbe_mem
  5951.         cmp     al,10h
  5952.         jne     invalid_operand
  5953.         lods    byte [esi]
  5954.         call    convert_register
  5955.         mov     [postbyte_register],al
  5956.         lods    byte [esi]
  5957.         cmp     al,','
  5958.         jne     invalid_operand
  5959.         lods    byte [esi]
  5960.         call    get_size_operator
  5961.         cmp     al,'['
  5962.         jne     invalid_argument
  5963.         call    get_address
  5964.         mov     al,[operand_size]
  5965.         call    operand_autodetect
  5966.         jmp     instruction_ready
  5967.       movbe_mem:
  5968.         inc     [supplemental_code]
  5969.         call    get_address
  5970.         push    edx ebx ecx
  5971.         lods    byte [esi]
  5972.         cmp     al,','
  5973.         jne     invalid_operand
  5974.         lods    byte [esi]
  5975.         call    get_size_operator
  5976.         cmp     al,10h
  5977.         jne     invalid_operand
  5978.         lods    byte [esi]
  5979.         call    convert_register
  5980.         mov     [postbyte_register],al
  5981.         pop     ecx ebx edx
  5982.         mov     al,[operand_size]
  5983.         call    operand_autodetect
  5984.         jmp     instruction_ready
  5985.  
  5986. simple_vmx_instruction:
  5987.         mov     ah,al
  5988.         mov     al,0Fh
  5989.         stos    byte [edi]
  5990.         mov     al,1
  5991.         stos    word [edi]
  5992.         jmp     instruction_assembled
  5993. vmclear_instruction:
  5994.         mov     [opcode_prefix],66h
  5995.         jmp     vmx_instruction
  5996. vmxon_instruction:
  5997.         mov     [opcode_prefix],0F3h
  5998. vmx_instruction:
  5999.         mov     [postbyte_register],al
  6000.         mov     [extended_code],0C7h
  6001.         lods    byte [esi]
  6002.         call    get_size_operator
  6003.         cmp     al,'['
  6004.         jne     invalid_operand
  6005.         call    get_address
  6006.         mov     al,[operand_size]
  6007.         or      al,al
  6008.         jz      vmx_size_ok
  6009.         cmp     al,8
  6010.         jne     invalid_operand_size
  6011.       vmx_size_ok:
  6012.         mov     [base_code],0Fh
  6013.         jmp     instruction_ready
  6014. vmread_instruction:
  6015.         mov     [extended_code],78h
  6016.         lods    byte [esi]
  6017.         call    get_size_operator
  6018.         cmp     al,10h
  6019.         je      vmread_nomem
  6020.         cmp     al,'['
  6021.         jne     invalid_operand
  6022.         call    get_address
  6023.         lods    byte [esi]
  6024.         cmp     al,','
  6025.         jne     invalid_operand
  6026.         lods    byte [esi]
  6027.         call    get_size_operator
  6028.         cmp     al,10h
  6029.         jne     invalid_operand
  6030.         lods    byte [esi]
  6031.         call    convert_register
  6032.         mov     [postbyte_register],al
  6033.         call    vmread_check_size
  6034.         jmp     vmx_size_ok
  6035.       vmread_nomem:
  6036.         lods    byte [esi]
  6037.         call    convert_register
  6038.         push    eax
  6039.         call    vmread_check_size
  6040.         lods    byte [esi]
  6041.         cmp     al,','
  6042.         jne     invalid_operand
  6043.         lods    byte [esi]
  6044.         call    get_size_operator
  6045.         cmp     al,10h
  6046.         jne     invalid_operand
  6047.         lods    byte [esi]
  6048.         call    convert_register
  6049.         mov     [postbyte_register],al
  6050.         call    vmread_check_size
  6051.         pop     ebx
  6052.         mov     [base_code],0Fh
  6053.         jmp     nomem_instruction_ready
  6054.       vmread_check_size:
  6055.         cmp     [code_type],64
  6056.         je      vmread_long
  6057.         cmp     [operand_size],4
  6058.         jne     invalid_operand_size
  6059.         ret
  6060.       vmread_long:
  6061.         cmp     [operand_size],8
  6062.         jne     invalid_operand_size
  6063.         ret
  6064. vmwrite_instruction:
  6065.         mov     [extended_code],79h
  6066.         lods    byte [esi]
  6067.         call    get_size_operator
  6068.         cmp     al,10h
  6069.         jne     invalid_operand
  6070.         lods    byte [esi]
  6071.         call    convert_register
  6072.         mov     [postbyte_register],al
  6073.         lods    byte [esi]
  6074.         cmp     al,','
  6075.         jne     invalid_operand
  6076.         lods    byte [esi]
  6077.         call    get_size_operator
  6078.         cmp     al,10h
  6079.         je      vmwrite_nomem
  6080.         cmp     al,'['
  6081.         jne     invalid_operand
  6082.         call    get_address
  6083.         call    vmread_check_size
  6084.         jmp     vmx_size_ok
  6085.       vmwrite_nomem:
  6086.         lods    byte [esi]
  6087.         call    convert_register
  6088.         mov     bl,al
  6089.         mov     [base_code],0Fh
  6090.         jmp     nomem_instruction_ready
  6091. vmx_inv_instruction:
  6092.         mov     [opcode_prefix],66h
  6093.         mov     [extended_code],38h
  6094.         mov     [supplemental_code],al
  6095.         lods    byte [esi]
  6096.         call    get_size_operator
  6097.         cmp     al,10h
  6098.         jne     invalid_operand
  6099.         lods    byte [esi]
  6100.         call    convert_register
  6101.         mov     [postbyte_register],al
  6102.         call    vmread_check_size
  6103.         mov     [operand_size],0
  6104.         lods    byte [esi]
  6105.         cmp     al,','
  6106.         jne     invalid_operand
  6107.         lods    byte [esi]
  6108.         call    get_size_operator
  6109.         cmp     al,'['
  6110.         jne     invalid_operand
  6111.         call    get_address
  6112.         mov     al,[operand_size]
  6113.         or      al,al
  6114.         jz      vmx_size_ok
  6115.         cmp     al,16
  6116.         jne     invalid_operand_size
  6117.         jmp     vmx_size_ok
  6118. simple_svm_instruction:
  6119.         push    eax
  6120.         mov     [base_code],0Fh
  6121.         mov     [extended_code],1
  6122.         lods    byte [esi]
  6123.         call    get_size_operator
  6124.         cmp     al,10h
  6125.         jne     invalid_operand
  6126.         lods    byte [esi]
  6127.         call    convert_register
  6128.         or      al,al
  6129.         jnz     invalid_operand
  6130.       simple_svm_detect_size:
  6131.         cmp     ah,2
  6132.         je      simple_svm_16bit
  6133.         cmp     ah,4
  6134.         je      simple_svm_32bit
  6135.         cmp     [code_type],64
  6136.         jne     invalid_operand_size
  6137.         jmp     simple_svm_store
  6138.       simple_svm_16bit:
  6139.         cmp     [code_type],16
  6140.         je      simple_svm_store
  6141.         cmp     [code_type],64
  6142.         je      invalid_operand_size
  6143.         jmp     prefixed_svm_store
  6144.       simple_svm_32bit:
  6145.         cmp     [code_type],32
  6146.         je      simple_svm_store
  6147.       prefixed_svm_store:
  6148.         mov     al,67h
  6149.         stos    byte [edi]
  6150.       simple_svm_store:
  6151.         call    store_instruction_code
  6152.         pop     eax
  6153.         stos    byte [edi]
  6154.         jmp     instruction_assembled
  6155. skinit_instruction:
  6156.         lods    byte [esi]
  6157.         call    get_size_operator
  6158.         cmp     al,10h
  6159.         jne     invalid_operand
  6160.         lods    byte [esi]
  6161.         call    convert_register
  6162.         cmp     ax,0400h
  6163.         jne     invalid_operand
  6164.         mov     al,0DEh
  6165.         jmp     simple_vmx_instruction
  6166. invlpga_instruction:
  6167.         push    eax
  6168.         mov     [base_code],0Fh
  6169.         mov     [extended_code],1
  6170.         lods    byte [esi]
  6171.         call    get_size_operator
  6172.         cmp     al,10h
  6173.         jne     invalid_operand
  6174.         lods    byte [esi]
  6175.         call    convert_register
  6176.         or      al,al
  6177.         jnz     invalid_operand
  6178.         mov     bl,ah
  6179.         mov     [operand_size],0
  6180.         lods    byte [esi]
  6181.         cmp     al,','
  6182.         jne     invalid_operand
  6183.         lods    byte [esi]
  6184.         call    get_size_operator
  6185.         cmp     al,10h
  6186.         jne     invalid_operand
  6187.         lods    byte [esi]
  6188.         call    convert_register
  6189.         cmp     ax,0401h
  6190.         jne     invalid_operand
  6191.         mov     ah,bl
  6192.         jmp     simple_svm_detect_size
  6193.  
  6194. rdrand_instruction:
  6195.         mov     [base_code],0Fh
  6196.         mov     [extended_code],0C7h
  6197.         mov     [postbyte_register],al
  6198.         lods    byte [esi]
  6199.         call    get_size_operator
  6200.         cmp     al,10h
  6201.         jne     invalid_operand
  6202.         lods    byte [esi]
  6203.         call    convert_register
  6204.         mov     bl,al
  6205.         mov     al,ah
  6206.         call    operand_autodetect
  6207.         jmp     nomem_instruction_ready
  6208. rdfsbase_instruction:
  6209.         cmp     [code_type],64
  6210.         jne     illegal_instruction
  6211.         mov     [opcode_prefix],0F3h
  6212.         mov     [base_code],0Fh
  6213.         mov     [extended_code],0AEh
  6214.         mov     [postbyte_register],al
  6215.         lods    byte [esi]
  6216.         call    get_size_operator
  6217.         cmp     al,10h
  6218.         jne     invalid_operand
  6219.         lods    byte [esi]
  6220.         call    convert_register
  6221.         mov     bl,al
  6222.         mov     al,ah
  6223.         cmp     ah,2
  6224.         je      invalid_operand_size
  6225.         call    operand_autodetect
  6226.         jmp     nomem_instruction_ready
  6227.  
  6228. xabort_instruction:
  6229.         lods    byte [esi]
  6230.         call    get_size_operator
  6231.         cmp     ah,1
  6232.         ja      invalid_operand_size
  6233.         cmp     al,'('
  6234.         jne     invalid_operand
  6235.         call    get_byte_value
  6236.         mov     dl,al
  6237.         mov     ax,0F8C6h
  6238.         stos    word [edi]
  6239.         mov     al,dl
  6240.         stos    byte [edi]
  6241.         jmp     instruction_assembled
  6242. xbegin_instruction:
  6243.         lods    byte [esi]
  6244.         cmp     al,'('
  6245.         jne     invalid_operand
  6246.         mov     al,[code_type]
  6247.         cmp     al,64
  6248.         je      xbegin_64bit
  6249.         cmp     al,32
  6250.         je      xbegin_32bit
  6251.       xbegin_16bit:
  6252.         call    get_address_word_value
  6253.         add     edi,4
  6254.         call    calculate_relative_offset
  6255.         sub     edi,4
  6256.         shl     eax,16
  6257.         mov     ax,0F8C7h
  6258.         stos    dword [edi]
  6259.         jmp     instruction_assembled
  6260.       xbegin_32bit:
  6261.         call    get_address_dword_value
  6262.         jmp     xbegin_address_ok
  6263.       xbegin_64bit:
  6264.         call    get_address_qword_value
  6265.       xbegin_address_ok:
  6266.         add     edi,5
  6267.         call    calculate_relative_offset
  6268.         sub     edi,5
  6269.         mov     edx,eax
  6270.         cwde
  6271.         cmp     eax,edx
  6272.         jne     xbegin_rel32
  6273.         mov     al,66h
  6274.         stos    byte [edi]
  6275.         mov     eax,edx
  6276.         shl     eax,16
  6277.         mov     ax,0F8C7h
  6278.         stos    dword [edi]
  6279.         jmp     instruction_assembled
  6280.       xbegin_rel32:
  6281.         sub     edx,1
  6282.         jno     xbegin_rel32_ok
  6283.         cmp     [code_type],64
  6284.         je      relative_jump_out_of_range
  6285.       xbegin_rel32_ok:
  6286.         mov     ax,0F8C7h
  6287.         stos    word [edi]
  6288.         mov     eax,edx
  6289.         stos    dword [edi]
  6290.         jmp     instruction_assembled
  6291.  
  6292. convert_register:
  6293.         mov     ah,al
  6294.         shr     ah,4
  6295.         and     al,0Fh
  6296.         cmp     ah,8
  6297.         je      match_register_size
  6298.         cmp     ah,4
  6299.         ja      invalid_operand
  6300.         cmp     ah,1
  6301.         ja      match_register_size
  6302.         cmp     al,4
  6303.         jb      match_register_size
  6304.         or      ah,ah
  6305.         jz      high_byte_register
  6306.         or      [rex_prefix],40h
  6307.       match_register_size:
  6308.         cmp     ah,[operand_size]
  6309.         je      register_size_ok
  6310.         cmp     [operand_size],0
  6311.         jne     operand_sizes_do_not_match
  6312.         mov     [operand_size],ah
  6313.       register_size_ok:
  6314.         ret
  6315.       high_byte_register:
  6316.         mov     ah,1
  6317.         or      [rex_prefix],80h
  6318.         jmp     match_register_size
  6319. convert_fpu_register:
  6320.         mov     ah,al
  6321.         shr     ah,4
  6322.         and     al,111b
  6323.         cmp     ah,10
  6324.         jne     invalid_operand
  6325.         jmp     match_register_size
  6326. convert_mmx_register:
  6327.         mov     ah,al
  6328.         shr     ah,4
  6329.         cmp     ah,0Ch
  6330.         je      xmm_register
  6331.         ja      invalid_operand
  6332.         and     al,111b
  6333.         cmp     ah,0Bh
  6334.         jne     invalid_operand
  6335.         mov     ah,8
  6336.         cmp     [vex_required],0
  6337.         jne     invalid_operand
  6338.         jmp     match_register_size
  6339.       xmm_register:
  6340.         and     al,0Fh
  6341.         mov     ah,16
  6342.         cmp     al,8
  6343.         jb      match_register_size
  6344.         cmp     [code_type],64
  6345.         jne     invalid_operand
  6346.         jmp     match_register_size
  6347. convert_xmm_register:
  6348.         mov     ah,al
  6349.         shr     ah,4
  6350.         cmp     ah,0Ch
  6351.         je      xmm_register
  6352.         jmp     invalid_operand
  6353. get_size_operator:
  6354.         xor     ah,ah
  6355.         cmp     al,11h
  6356.         jne     no_size_operator
  6357.         mov     [size_declared],1
  6358.         lods    word [esi]
  6359.         xchg    al,ah
  6360.         mov     [size_override],1
  6361.         cmp     ah,[operand_size]
  6362.         je      size_operator_ok
  6363.         cmp     [operand_size],0
  6364.         jne     operand_sizes_do_not_match
  6365.         mov     [operand_size],ah
  6366.       size_operator_ok:
  6367.         ret
  6368.       no_size_operator:
  6369.         mov     [size_declared],0
  6370.         cmp     al,'['
  6371.         jne     size_operator_ok
  6372.         mov     [size_override],0
  6373.         ret
  6374. get_jump_operator:
  6375.         mov     [jump_type],0
  6376.         cmp     al,12h
  6377.         jne     jump_operator_ok
  6378.         lods    word [esi]
  6379.         mov     [jump_type],al
  6380.         mov     al,ah
  6381.       jump_operator_ok:
  6382.         ret
  6383. get_address:
  6384.         mov     [segment_register],0
  6385.         mov     [address_size],0
  6386.         mov     al,[code_type]
  6387.         shr     al,3
  6388.         mov     [value_size],al
  6389.         mov     al,[esi]
  6390.         and     al,11110000b
  6391.         cmp     al,60h
  6392.         jne     get_size_prefix
  6393.         lods    byte [esi]
  6394.         sub     al,60h
  6395.         mov     [segment_register],al
  6396.         mov     al,[esi]
  6397.         and     al,11110000b
  6398.       get_size_prefix:
  6399.         cmp     al,70h
  6400.         jne     address_size_prefix_ok
  6401.         lods    byte [esi]
  6402.         sub     al,70h
  6403.         cmp     al,2
  6404.         jb      invalid_address_size
  6405.         cmp     al,8
  6406.         ja      invalid_address_size
  6407.         mov     [address_size],al
  6408.         mov     [value_size],al
  6409.       address_size_prefix_ok:
  6410.         call    calculate_address
  6411.         cmp     byte [esi-1],']'
  6412.         jne     invalid_address
  6413.         mov     [address_high],edx
  6414.         mov     edx,eax
  6415.         cmp     [code_type],64
  6416.         jne     address_ok
  6417.         or      bx,bx
  6418.         jnz     address_ok
  6419.         test    ch,0Fh
  6420.         jnz     address_ok
  6421.       calculate_relative_address:
  6422.         mov     edx,[address_symbol]
  6423.         mov     [symbol_identifier],edx
  6424.         mov     edx,[address_high]
  6425.         call    calculate_relative_offset
  6426.         mov     [address_high],edx
  6427.         cdq
  6428.         cmp     edx,[address_high]
  6429.         je      address_high_ok
  6430.         call    recoverable_overflow
  6431.       address_high_ok:
  6432.         mov     edx,eax
  6433.         ror     ecx,16
  6434.         mov     cl,[value_type]
  6435.         rol     ecx,16
  6436.         mov     bx,0FF00h
  6437.       address_ok:
  6438.         ret
  6439. operand_16bit:
  6440.         cmp     [code_type],16
  6441.         je      size_prefix_ok
  6442.         mov     [operand_prefix],66h
  6443.         ret
  6444. operand_32bit:
  6445.         cmp     [code_type],16
  6446.         jne     size_prefix_ok
  6447.         mov     [operand_prefix],66h
  6448.       size_prefix_ok:
  6449.         ret
  6450. operand_64bit:
  6451.         cmp     [code_type],64
  6452.         jne     illegal_instruction
  6453.         or      [rex_prefix],48h
  6454.         ret
  6455. operand_autodetect:
  6456.         cmp     al,2
  6457.         je      operand_16bit
  6458.         cmp     al,4
  6459.         je      operand_32bit
  6460.         cmp     al,8
  6461.         je      operand_64bit
  6462.         jmp     invalid_operand_size
  6463. store_segment_prefix_if_necessary:
  6464.         mov     al,[segment_register]
  6465.         or      al,al
  6466.         jz      segment_prefix_ok
  6467.         cmp     al,4
  6468.         ja      segment_prefix_386
  6469.         cmp     [code_type],64
  6470.         je      segment_prefix_ok
  6471.         cmp     al,3
  6472.         je      ss_prefix
  6473.         jb      segment_prefix_86
  6474.         cmp     bl,25h
  6475.         je      segment_prefix_86
  6476.         cmp     bh,25h
  6477.         je      segment_prefix_86
  6478.         cmp     bh,45h
  6479.         je      segment_prefix_86
  6480.         cmp     bh,44h
  6481.         je      segment_prefix_86
  6482.         ret
  6483.       ss_prefix:
  6484.         cmp     bl,25h
  6485.         je      segment_prefix_ok
  6486.         cmp     bh,25h
  6487.         je      segment_prefix_ok
  6488.         cmp     bh,45h
  6489.         je      segment_prefix_ok
  6490.         cmp     bh,44h
  6491.         je      segment_prefix_ok
  6492.         jmp     segment_prefix_86
  6493. store_segment_prefix:
  6494.         mov     al,[segment_register]
  6495.         or      al,al
  6496.         jz      segment_prefix_ok
  6497.         cmp     al,5
  6498.         jae     segment_prefix_386
  6499.       segment_prefix_86:
  6500.         dec     al
  6501.         shl     al,3
  6502.         add     al,26h
  6503.         stos    byte [edi]
  6504.         jmp     segment_prefix_ok
  6505.       segment_prefix_386:
  6506.         add     al,64h-5
  6507.         stos    byte [edi]
  6508.       segment_prefix_ok:
  6509.         ret
  6510. store_instruction_code:
  6511.         cmp     [vex_required],0
  6512.         jne     store_vex_instruction_code
  6513.         mov     al,[operand_prefix]
  6514.         or      al,al
  6515.         jz      operand_prefix_ok
  6516.         stos    byte [edi]
  6517.       operand_prefix_ok:
  6518.         mov     al,[opcode_prefix]
  6519.         or      al,al
  6520.         jz      opcode_prefix_ok
  6521.         stos    byte [edi]
  6522.       opcode_prefix_ok:
  6523.         mov     al,[rex_prefix]
  6524.         test    al,40h
  6525.         jz      rex_prefix_ok
  6526.         cmp     [code_type],64
  6527.         jne     invalid_operand
  6528.         test    al,0B0h
  6529.         jnz     disallowed_combination_of_registers
  6530.         stos    byte [edi]
  6531.       rex_prefix_ok:
  6532.         mov     al,[base_code]
  6533.         stos    byte [edi]
  6534.         cmp     al,0Fh
  6535.         jne     instruction_code_ok
  6536.       store_extended_code:
  6537.         mov     al,[extended_code]
  6538.         stos    byte [edi]
  6539.         cmp     al,38h
  6540.         je      store_supplemental_code
  6541.         cmp     al,3Ah
  6542.         je      store_supplemental_code
  6543.       instruction_code_ok:
  6544.         ret
  6545.       store_supplemental_code:
  6546.         mov     al,[supplemental_code]
  6547.         stos    byte [edi]
  6548.         ret
  6549. store_nomem_instruction:
  6550.         test    [postbyte_register],1000b
  6551.         jz      nomem_reg_code_ok
  6552.         or      [rex_prefix],44h
  6553.         and     [postbyte_register],111b
  6554.       nomem_reg_code_ok:
  6555.         test    bl,1000b
  6556.         jz      nomem_rm_code_ok
  6557.         or      [rex_prefix],41h
  6558.         and     bl,111b
  6559.       nomem_rm_code_ok:
  6560.         call    store_instruction_code
  6561.         mov     al,[postbyte_register]
  6562.         shl     al,3
  6563.         or      al,bl
  6564.         or      al,11000000b
  6565.         stos    byte [edi]
  6566.         ret
  6567. store_instruction:
  6568.         mov     [current_offset],edi
  6569.         test    [postbyte_register],1000b
  6570.         jz      reg_code_ok
  6571.         or      [rex_prefix],44h
  6572.         and     [postbyte_register],111b
  6573.       reg_code_ok:
  6574.         cmp     [code_type],64
  6575.         jne     address_value_ok
  6576.         xor     eax,eax
  6577.         bt      edx,31
  6578.         sbb     eax,[address_high]
  6579.         jz      address_value_ok
  6580.         cmp     [address_high],0
  6581.         jne     address_value_out_of_range
  6582.         test    ch,44h
  6583.         jnz     address_value_ok
  6584.         test    bx,8080h
  6585.         jz      address_value_ok
  6586.       address_value_out_of_range:
  6587.         call    recoverable_overflow
  6588.       address_value_ok:
  6589.         call    store_segment_prefix_if_necessary
  6590.         test    [vex_required],4
  6591.         jnz     address_vsib
  6592.         or      bx,bx
  6593.         jz      address_immediate
  6594.         cmp     bx,0F800h
  6595.         je      address_rip_based
  6596.         cmp     bx,0F400h
  6597.         je      address_eip_based
  6598.         cmp     bx,0FF00h
  6599.         je      address_relative
  6600.         mov     al,bl
  6601.         or      al,bh
  6602.         and     al,11110000b
  6603.         cmp     al,80h
  6604.         je      postbyte_64bit
  6605.         cmp     al,40h
  6606.         je      postbyte_32bit
  6607.         cmp     al,20h
  6608.         jne     invalid_address
  6609.         cmp     [code_type],64
  6610.         je      invalid_address_size
  6611.         call    address_16bit_prefix
  6612.         call    store_instruction_code
  6613.         cmp     bl,bh
  6614.         jbe     determine_16bit_address
  6615.         xchg    bl,bh
  6616.       determine_16bit_address:
  6617.         cmp     bx,2600h
  6618.         je      address_si
  6619.         cmp     bx,2700h
  6620.         je      address_di
  6621.         cmp     bx,2300h
  6622.         je      address_bx
  6623.         cmp     bx,2500h
  6624.         je      address_bp
  6625.         cmp     bx,2625h
  6626.         je      address_bp_si
  6627.         cmp     bx,2725h
  6628.         je      address_bp_di
  6629.         cmp     bx,2723h
  6630.         je      address_bx_di
  6631.         cmp     bx,2623h
  6632.         jne     invalid_address
  6633.       address_bx_si:
  6634.         xor     al,al
  6635.         jmp     postbyte_16bit
  6636.       address_bx_di:
  6637.         mov     al,1
  6638.         jmp     postbyte_16bit
  6639.       address_bp_si:
  6640.         mov     al,10b
  6641.         jmp     postbyte_16bit
  6642.       address_bp_di:
  6643.         mov     al,11b
  6644.         jmp     postbyte_16bit
  6645.       address_si:
  6646.         mov     al,100b
  6647.         jmp     postbyte_16bit
  6648.       address_di:
  6649.         mov     al,101b
  6650.         jmp     postbyte_16bit
  6651.       address_bx:
  6652.         mov     al,111b
  6653.         jmp     postbyte_16bit
  6654.       address_bp:
  6655.         mov     al,110b
  6656.       postbyte_16bit:
  6657.         test    ch,22h
  6658.         jnz     address_16bit_value
  6659.         or      ch,ch
  6660.         jnz     address_sizes_do_not_agree
  6661.         cmp     edx,10000h
  6662.         jge     value_out_of_range
  6663.         cmp     edx,-8000h
  6664.         jl      value_out_of_range
  6665.         or      dx,dx
  6666.         jz      address
  6667.         cmp     dx,80h
  6668.         jb      address_8bit_value
  6669.         cmp     dx,-80h
  6670.         jae     address_8bit_value
  6671.       address_16bit_value:
  6672.         or      al,10000000b
  6673.         mov     cl,[postbyte_register]
  6674.         shl     cl,3
  6675.         or      al,cl
  6676.         stos    byte [edi]
  6677.         mov     eax,edx
  6678.         stos    word [edi]
  6679.         ret
  6680.       address_8bit_value:
  6681.         or      al,01000000b
  6682.         mov     cl,[postbyte_register]
  6683.         shl     cl,3
  6684.         or      al,cl
  6685.         stos    byte [edi]
  6686.         mov     al,dl
  6687.         stos    byte [edi]
  6688.         cmp     dx,80h
  6689.         jge     value_out_of_range
  6690.         cmp     dx,-80h
  6691.         jl      value_out_of_range
  6692.         ret
  6693.       address:
  6694.         cmp     al,110b
  6695.         je      address_8bit_value
  6696.         mov     cl,[postbyte_register]
  6697.         shl     cl,3
  6698.         or      al,cl
  6699.         stos    byte [edi]
  6700.         ret
  6701.       address_vsib:
  6702.         mov     al,bl
  6703.         shr     al,4
  6704.         cmp     al,0Ch
  6705.         je      vector_index_ok
  6706.         cmp     al,0Dh
  6707.         jne     invalid_address
  6708.       vector_index_ok:
  6709.         mov     al,bh
  6710.         shr     al,4
  6711.         cmp     al,4
  6712.         je      postbyte_32bit
  6713.         cmp     [code_type],64
  6714.         je      address_prefix_ok
  6715.         test    al,al
  6716.         jnz     invalid_address
  6717.       postbyte_32bit:
  6718.         call    address_32bit_prefix
  6719.         jmp     address_prefix_ok
  6720.       postbyte_64bit:
  6721.         cmp     [code_type],64
  6722.         jne     invalid_address_size
  6723.       address_prefix_ok:
  6724.         cmp     bl,44h
  6725.         je      invalid_address
  6726.         cmp     bl,84h
  6727.         je      invalid_address
  6728.         test    bh,1000b
  6729.         jz      base_code_ok
  6730.         or      [rex_prefix],41h
  6731.       base_code_ok:
  6732.         test    bl,1000b
  6733.         jz      index_code_ok
  6734.         or      [rex_prefix],42h
  6735.       index_code_ok:
  6736.         call    store_instruction_code
  6737.         or      cl,cl
  6738.         jz      only_base_register
  6739.       base_and_index:
  6740.         mov     al,100b
  6741.         xor     ah,ah
  6742.         cmp     cl,1
  6743.         je      scale_ok
  6744.         cmp     cl,2
  6745.         je      scale_1
  6746.         cmp     cl,4
  6747.         je      scale_2
  6748.         or      ah,11000000b
  6749.         jmp     scale_ok
  6750.       scale_2:
  6751.         or      ah,10000000b
  6752.         jmp     scale_ok
  6753.       scale_1:
  6754.         or      ah,01000000b
  6755.       scale_ok:
  6756.         or      bh,bh
  6757.         jz      only_index_register
  6758.         and     bl,111b
  6759.         shl     bl,3
  6760.         or      ah,bl
  6761.         and     bh,111b
  6762.         or      ah,bh
  6763.       sib_ready:
  6764.         test    ch,44h
  6765.         jnz     sib_address_32bit_value
  6766.         test    ch,88h
  6767.         jnz     sib_address_32bit_value
  6768.         or      ch,ch
  6769.         jnz     address_sizes_do_not_agree
  6770.         cmp     bh,5
  6771.         je      address_value
  6772.         or      edx,edx
  6773.         jz      sib_address
  6774.       address_value:
  6775.         cmp     edx,80h
  6776.         jb      sib_address_8bit_value
  6777.         cmp     edx,-80h
  6778.         jae     sib_address_8bit_value
  6779.       sib_address_32bit_value:
  6780.         or      al,10000000b
  6781.         mov     cl,[postbyte_register]
  6782.         shl     cl,3
  6783.         or      al,cl
  6784.         stos    word [edi]
  6785.         jmp     store_address_32bit_value
  6786.       sib_address_8bit_value:
  6787.         or      al,01000000b
  6788.         mov     cl,[postbyte_register]
  6789.         shl     cl,3
  6790.         or      al,cl
  6791.         stos    word [edi]
  6792.         mov     al,dl
  6793.         stos    byte [edi]
  6794.         cmp     edx,80h
  6795.         jge     value_out_of_range
  6796.         cmp     edx,-80h
  6797.         jl      value_out_of_range
  6798.         ret
  6799.       sib_address:
  6800.         mov     cl,[postbyte_register]
  6801.         shl     cl,3
  6802.         or      al,cl
  6803.         stos    word [edi]
  6804.         ret
  6805.       only_index_register:
  6806.         or      ah,101b
  6807.         and     bl,111b
  6808.         shl     bl,3
  6809.         or      ah,bl
  6810.         mov     cl,[postbyte_register]
  6811.         shl     cl,3
  6812.         or      al,cl
  6813.         stos    word [edi]
  6814.         test    ch,44h
  6815.         jnz     store_address_32bit_value
  6816.         test    ch,88h
  6817.         jnz     store_address_32bit_value
  6818.         or      ch,ch
  6819.         jnz     invalid_address_size
  6820.         jmp     store_address_32bit_value
  6821.       zero_index_register:
  6822.         mov     bl,4
  6823.         mov     cl,1
  6824.         jmp     base_and_index
  6825.       only_base_register:
  6826.         mov     al,bh
  6827.         and     al,111b
  6828.         cmp     al,4
  6829.         je      zero_index_register
  6830.         test    ch,44h
  6831.         jnz     simple_address_32bit_value
  6832.         test    ch,88h
  6833.         jnz     simple_address_32bit_value
  6834.         or      ch,ch
  6835.         jnz     address_sizes_do_not_agree
  6836.         or      edx,edx
  6837.         jz      simple_address
  6838.         cmp     edx,80h
  6839.         jb      simple_address_8bit_value
  6840.         cmp     edx,-80h
  6841.         jae     simple_address_8bit_value
  6842.       simple_address_32bit_value:
  6843.         or      al,10000000b
  6844.         mov     cl,[postbyte_register]
  6845.         shl     cl,3
  6846.         or      al,cl
  6847.         stos    byte [edi]
  6848.         jmp     store_address_32bit_value
  6849.       simple_address_8bit_value:
  6850.         or      al,01000000b
  6851.         mov     cl,[postbyte_register]
  6852.         shl     cl,3
  6853.         or      al,cl
  6854.         stos    byte [edi]
  6855.         mov     al,dl
  6856.         stos    byte [edi]
  6857.         cmp     edx,80h
  6858.         jge     value_out_of_range
  6859.         cmp     edx,-80h
  6860.         jl      value_out_of_range
  6861.         ret
  6862.       simple_address:
  6863.         cmp     al,5
  6864.         je      simple_address_8bit_value
  6865.         mov     cl,[postbyte_register]
  6866.         shl     cl,3
  6867.         or      al,cl
  6868.         stos    byte [edi]
  6869.         ret
  6870.       address_immediate:
  6871.         cmp     [code_type],64
  6872.         je      address_immediate_sib
  6873.         test    ch,44h
  6874.         jnz     address_immediate_32bit
  6875.         test    ch,88h
  6876.         jnz     address_immediate_32bit
  6877.         test    ch,22h
  6878.         jnz     address_immediate_16bit
  6879.         or      ch,ch
  6880.         jnz     invalid_address_size
  6881.         cmp     [code_type],16
  6882.         je      addressing_16bit
  6883.       address_immediate_32bit:
  6884.         call    address_32bit_prefix
  6885.         call    store_instruction_code
  6886.       store_immediate_address:
  6887.         mov     al,101b
  6888.         mov     cl,[postbyte_register]
  6889.         shl     cl,3
  6890.         or      al,cl
  6891.         stos    byte [edi]
  6892.       store_address_32bit_value:
  6893.         test    ch,0F0h
  6894.         jz      address_32bit_relocation_ok
  6895.         mov     eax,ecx
  6896.         shr     eax,16
  6897.         cmp     al,4
  6898.         jne     address_32bit_relocation
  6899.         mov     al,2
  6900.       address_32bit_relocation:
  6901.         xchg    [value_type],al
  6902.         mov     ebx,[address_symbol]
  6903.         xchg    ebx,[symbol_identifier]
  6904.         call    mark_relocation
  6905.         mov     [value_type],al
  6906.         mov     [symbol_identifier],ebx
  6907.       address_32bit_relocation_ok:
  6908.         mov     eax,edx
  6909.         stos    dword [edi]
  6910.         ret
  6911.       store_address_64bit_value:
  6912.         test    ch,0F0h
  6913.         jz      address_64bit_relocation_ok
  6914.         mov     eax,ecx
  6915.         shr     eax,16
  6916.         xchg    [value_type],al
  6917.         mov     ebx,[address_symbol]
  6918.         xchg    ebx,[symbol_identifier]
  6919.         call    mark_relocation
  6920.         mov     [value_type],al
  6921.         mov     [symbol_identifier],ebx
  6922.       address_64bit_relocation_ok:
  6923.         mov     eax,edx
  6924.         stos    dword [edi]
  6925.         mov     eax,[address_high]
  6926.         stos    dword [edi]
  6927.         ret
  6928.       address_immediate_sib:
  6929.         test    ch,44h
  6930.         jnz     address_immediate_sib_32bit
  6931.         test    ch,not 88h
  6932.         jnz     invalid_address_size
  6933.       address_immediate_sib_store:
  6934.         call    store_instruction_code
  6935.         mov     al,100b
  6936.         mov     ah,100101b
  6937.         mov     cl,[postbyte_register]
  6938.         shl     cl,3
  6939.         or      al,cl
  6940.         stos    word [edi]
  6941.         jmp     store_address_32bit_value
  6942.       address_immediate_sib_32bit:
  6943.         test    ecx,0FF0000h
  6944.         jnz     address_immediate_sib_nosignextend
  6945.         test    edx,80000000h
  6946.         jz      address_immediate_sib_store
  6947.       address_immediate_sib_nosignextend:
  6948.         call    address_32bit_prefix
  6949.         jmp     address_immediate_sib_store
  6950.       address_eip_based:
  6951.         mov     al,67h
  6952.         stos    byte [edi]
  6953.       address_rip_based:
  6954.         cmp     [code_type],64
  6955.         jne     invalid_address
  6956.         call    store_instruction_code
  6957.         jmp     store_immediate_address
  6958.       address_relative:
  6959.         call    store_instruction_code
  6960.         movzx   eax,[immediate_size]
  6961.         add     eax,edi
  6962.         sub     eax,[current_offset]
  6963.         add     eax,5
  6964.         sub     edx,eax
  6965.         jo      value_out_of_range
  6966.         mov     al,101b
  6967.         mov     cl,[postbyte_register]
  6968.         shl     cl,3
  6969.         or      al,cl
  6970.         stos    byte [edi]
  6971.         shr     ecx,16
  6972.         xchg    [value_type],cl
  6973.         mov     ebx,[address_symbol]
  6974.         xchg    ebx,[symbol_identifier]
  6975.         mov     eax,edx
  6976.         call    mark_relocation
  6977.         mov     [value_type],cl
  6978.         mov     [symbol_identifier],ebx
  6979.         stos    dword [edi]
  6980.         ret
  6981.       addressing_16bit:
  6982.         cmp     edx,10000h
  6983.         jge     address_immediate_32bit
  6984.         cmp     edx,-8000h
  6985.         jl      address_immediate_32bit
  6986.         movzx   edx,dx
  6987.       address_immediate_16bit:
  6988.         call    address_16bit_prefix
  6989.         call    store_instruction_code
  6990.         mov     al,110b
  6991.         mov     cl,[postbyte_register]
  6992.         shl     cl,3
  6993.         or      al,cl
  6994.         stos    byte [edi]
  6995.         mov     eax,edx
  6996.         stos    word [edi]
  6997.         cmp     edx,10000h
  6998.         jge     value_out_of_range
  6999.         cmp     edx,-8000h
  7000.         jl      value_out_of_range
  7001.         ret
  7002.       address_16bit_prefix:
  7003.         cmp     [code_type],16
  7004.         je      instruction_prefix_ok
  7005.         mov     al,67h
  7006.         stos    byte [edi]
  7007.         ret
  7008.       address_32bit_prefix:
  7009.         cmp     [code_type],32
  7010.         je      instruction_prefix_ok
  7011.         mov     al,67h
  7012.         stos    byte [edi]
  7013.       instruction_prefix_ok:
  7014.         ret
  7015. store_instruction_with_imm8:
  7016.         mov     [immediate_size],1
  7017.         call    store_instruction
  7018.         mov     al,byte [value]
  7019.         stos    byte [edi]
  7020.         ret
  7021. store_instruction_with_imm16:
  7022.         mov     [immediate_size],2
  7023.         call    store_instruction
  7024.         mov     ax,word [value]
  7025.         call    mark_relocation
  7026.         stos    word [edi]
  7027.         ret
  7028. store_instruction_with_imm32:
  7029.         mov     [immediate_size],4
  7030.         call    store_instruction
  7031.         mov     eax,dword [value]
  7032.         call    mark_relocation
  7033.         stos    dword [edi]
  7034.         ret
  7035.