Subversion Repositories Kolibri OS

Rev

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

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