Subversion Repositories Kolibri OS

Rev

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

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