Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ; flat assembler core
  3. ; Copyright (c) 1999-2007, 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_8bit
  2341.         cmp     ah,2
  2342.         jne     invalid_operand_size
  2343.       movx_mem_16bit:
  2344.         inc     [extended_code]
  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_8bit
  2351.         mov     eax,[current_line]
  2352.         mov     [error_line],eax
  2353.         mov     [error],operand_size_not_specified
  2354.       movx_mem_8bit:
  2355.         call    operand_autodetect
  2356.         call    store_instruction
  2357.         jmp     instruction_assembled
  2358.       movx_reg:
  2359.         lods    byte [esi]
  2360.         call    convert_register
  2361.         pop     ebx
  2362.         xchg    bl,al
  2363.         cmp     ah,al
  2364.         jae     invalid_operand_size
  2365.         cmp     ah,1
  2366.         je      movx_reg_8bit
  2367.         cmp     ah,2
  2368.         je      movx_reg_16bit
  2369.         jmp     invalid_operand_size
  2370.       movx_reg_8bit:
  2371.         call    operand_autodetect
  2372.         call    store_nomem_instruction
  2373.         jmp     instruction_assembled
  2374.       movx_reg_16bit:
  2375.         call    operand_autodetect
  2376.         inc     [extended_code]
  2377.         call    store_nomem_instruction
  2378.         jmp     instruction_assembled
  2379. movsxd_instruction:
  2380.         mov     [base_code],al
  2381.         lods    byte [esi]
  2382.         call    get_size_operator
  2383.         cmp     al,10h
  2384.         jne     invalid_operand
  2385.         lods    byte [esi]
  2386.         call    convert_register
  2387.         mov     [postbyte_register],al
  2388.         cmp     ah,8
  2389.         jne     invalid_operand_size
  2390.         lods    byte [esi]
  2391.         cmp     al,','
  2392.         jne     invalid_operand
  2393.         mov     [operand_size],0
  2394.         lods    byte [esi]
  2395.         call    get_size_operator
  2396.         cmp     al,10h
  2397.         je      movsxd_reg
  2398.         cmp     al,'['
  2399.         jne     invalid_operand
  2400.         call    get_address
  2401.         cmp     [operand_size],4
  2402.         je      movsxd_mem_store
  2403.         cmp     [operand_size],0
  2404.         jne     invalid_operand_size
  2405.       movsxd_mem_store:
  2406.         call    operand_64bit
  2407.         call    store_instruction
  2408.         jmp     instruction_assembled
  2409.       movsxd_reg:
  2410.         lods    byte [esi]
  2411.         call    convert_register
  2412.         cmp     ah,4
  2413.         jne     invalid_operand_size
  2414.         mov     bl,al
  2415.         call    operand_64bit
  2416.         call    store_nomem_instruction
  2417.         jmp     instruction_assembled
  2418. bt_instruction:
  2419.         mov     [postbyte_register],al
  2420.         shl     al,3
  2421.         add     al,83h
  2422.         mov     [extended_code],al
  2423.         mov     [base_code],0Fh
  2424.         lods    byte [esi]
  2425.         call    get_size_operator
  2426.         cmp     al,10h
  2427.         je      bt_reg
  2428.         cmp     al,'['
  2429.         jne     invalid_operand
  2430.         call    get_address
  2431.         push    eax ebx ecx
  2432.         lods    byte [esi]
  2433.         cmp     al,','
  2434.         jne     invalid_operand
  2435.         cmp     byte [esi],'('
  2436.         je      bt_mem_imm
  2437.         cmp     byte [esi],11h
  2438.         jne     bt_mem_reg
  2439.         cmp     byte [esi+2],'('
  2440.         je      bt_mem_imm
  2441.       bt_mem_reg:
  2442.         lods    byte [esi]
  2443.         call    get_size_operator
  2444.         cmp     al,10h
  2445.         jne     invalid_operand
  2446.         lods    byte [esi]
  2447.         call    convert_register
  2448.         mov     [postbyte_register],al
  2449.         pop     ecx ebx edx
  2450.         mov     al,ah
  2451.         call    operand_autodetect
  2452.         call    store_instruction
  2453.         jmp     instruction_assembled
  2454.       bt_mem_imm:
  2455.         xor     al,al
  2456.         xchg    al,[operand_size]
  2457.         push    eax
  2458.         lods    byte [esi]
  2459.         call    get_size_operator
  2460.         cmp     al,'('
  2461.         jne     invalid_operand
  2462.         mov     al,[operand_size]
  2463.         or      al,al
  2464.         jz      bt_mem_imm_size_ok
  2465.         cmp     al,1
  2466.         jne     invalid_operand_size
  2467.       bt_mem_imm_size_ok:
  2468.         call    get_byte_value
  2469.         mov     byte [value],al
  2470.         pop     eax
  2471.         or      al,al
  2472.         jz      bt_mem_imm_nosize
  2473.         call    operand_autodetect
  2474.       bt_mem_imm_store:
  2475.         pop     ecx ebx edx
  2476.         mov     [extended_code],0BAh
  2477.         call    store_instruction_with_imm8
  2478.         jmp     instruction_assembled
  2479.       bt_mem_imm_nosize:
  2480.         cmp     [error_line],0
  2481.         jne     bt_mem_imm_store
  2482.         mov     eax,[current_line]
  2483.         mov     [error_line],eax
  2484.         mov     [error],operand_size_not_specified
  2485.         jmp     bt_mem_imm_store
  2486.       bt_reg:
  2487.         lods    byte [esi]
  2488.         call    convert_register
  2489.         mov     bl,al
  2490.         lods    byte [esi]
  2491.         cmp     al,','
  2492.         jne     invalid_operand
  2493.         cmp     byte [esi],'('
  2494.         je      bt_reg_imm
  2495.         cmp     byte [esi],11h
  2496.         jne     bt_reg_reg
  2497.         cmp     byte [esi+2],'('
  2498.         je      bt_reg_imm
  2499.       bt_reg_reg:
  2500.         lods    byte [esi]
  2501.         call    get_size_operator
  2502.         cmp     al,10h
  2503.         jne     invalid_operand
  2504.         lods    byte [esi]
  2505.         call    convert_register
  2506.         mov     [postbyte_register],al
  2507.         mov     al,ah
  2508.         call    operand_autodetect
  2509.         call    store_nomem_instruction
  2510.         jmp     instruction_assembled
  2511.       bt_reg_imm:
  2512.         xor     al,al
  2513.         xchg    al,[operand_size]
  2514.         push    eax ebx
  2515.         lods    byte [esi]
  2516.         call    get_size_operator
  2517.         cmp     al,'('
  2518.         jne     invalid_operand
  2519.         mov     al,[operand_size]
  2520.         or      al,al
  2521.         jz      bt_reg_imm_size_ok
  2522.         cmp     al,1
  2523.         jne     invalid_operand_size
  2524.       bt_reg_imm_size_ok:
  2525.         call    get_byte_value
  2526.         mov     byte [value],al
  2527.         pop     ebx eax
  2528.         call    operand_autodetect
  2529.       bt_reg_imm_store:
  2530.         mov     [extended_code],0BAh
  2531.         call    store_nomem_instruction
  2532.         mov     al,byte [value]
  2533.         stos    byte [edi]
  2534.         jmp     instruction_assembled
  2535. bs_instruction:
  2536.         mov     [extended_code],al
  2537.         mov     [base_code],0Fh
  2538.         lods    byte [esi]
  2539.         call    get_size_operator
  2540.         cmp     al,10h
  2541.         jne     invalid_operand
  2542.         lods    byte [esi]
  2543.         call    convert_register
  2544.         mov     [postbyte_register],al
  2545.         lods    byte [esi]
  2546.         cmp     al,','
  2547.         jne     invalid_operand
  2548.         lods    byte [esi]
  2549.         call    get_size_operator
  2550.         cmp     al,10h
  2551.         je      bs_reg_reg
  2552.         cmp     al,'['
  2553.         jne     invalid_argument
  2554.         call    get_address
  2555.         mov     al,[operand_size]
  2556.         call    operand_autodetect
  2557.         call    store_instruction
  2558.         jmp     instruction_assembled
  2559.       bs_reg_reg:
  2560.         lods    byte [esi]
  2561.         call    convert_register
  2562.         mov     bl,al
  2563.         mov     al,ah
  2564.         call    operand_autodetect
  2565.         call    store_nomem_instruction
  2566.         jmp     instruction_assembled
  2567. imul_instruction:
  2568.         mov     [base_code],0F6h
  2569.         mov     [postbyte_register],5
  2570.         lods    byte [esi]
  2571.         call    get_size_operator
  2572.         cmp     al,10h
  2573.         je      imul_reg
  2574.         cmp     al,'['
  2575.         jne     invalid_operand
  2576.       imul_mem:
  2577.         call    get_address
  2578.         mov     al,[operand_size]
  2579.         cmp     al,1
  2580.         je      imul_mem_8bit
  2581.         jb      imul_mem_nosize
  2582.         call    operand_autodetect
  2583.         inc     [base_code]
  2584.         call    store_instruction
  2585.         jmp     instruction_assembled
  2586.       imul_mem_nosize:
  2587.         cmp     [error_line],0
  2588.         jne     imul_mem_8bit
  2589.         mov     eax,[current_line]
  2590.         mov     [error_line],eax
  2591.         mov     [error],operand_size_not_specified
  2592.       imul_mem_8bit:
  2593.         call    store_instruction
  2594.         jmp     instruction_assembled
  2595.       imul_reg:
  2596.         lods    byte [esi]
  2597.         call    convert_register
  2598.         cmp     byte [esi],','
  2599.         je      imul_reg_
  2600.         mov     bl,al
  2601.         mov     al,ah
  2602.         cmp     al,1
  2603.         je      imul_reg_8bit
  2604.         call    operand_autodetect
  2605.         inc     [base_code]
  2606.         call    store_nomem_instruction
  2607.         jmp     instruction_assembled
  2608.       imul_reg_8bit:
  2609.         call    store_nomem_instruction
  2610.         jmp     instruction_assembled
  2611.       imul_reg_:
  2612.         mov     [postbyte_register],al
  2613.         inc     esi
  2614.         cmp     byte [esi],'('
  2615.         je      imul_reg_imm
  2616.         cmp     byte [esi],11h
  2617.         jne     imul_reg_noimm
  2618.         cmp     byte [esi+2],'('
  2619.         je      imul_reg_imm
  2620.       imul_reg_noimm:
  2621.         lods    byte [esi]
  2622.         call    get_size_operator
  2623.         cmp     al,10h
  2624.         je      imul_reg_reg
  2625.         cmp     al,'['
  2626.         jne     invalid_operand
  2627.       imul_reg_mem:
  2628.         call    get_address
  2629.         push    edx ebx ecx
  2630.         cmp     byte [esi],','
  2631.         je      imul_reg_mem_imm
  2632.         mov     al,[operand_size]
  2633.         call    operand_autodetect
  2634.         pop     ecx ebx edx
  2635.         mov     [base_code],0Fh
  2636.         mov     [extended_code],0AFh
  2637.         call    store_instruction
  2638.         jmp     instruction_assembled
  2639.       imul_reg_mem_imm:
  2640.         inc     esi
  2641.         lods    byte [esi]
  2642.         call    get_size_operator
  2643.         cmp     al,'('
  2644.         jne     invalid_operand
  2645.         mov     al,[operand_size]
  2646.         cmp     al,2
  2647.         je      imul_reg_mem_imm_16bit
  2648.         cmp     al,4
  2649.         je      imul_reg_mem_imm_32bit
  2650.         cmp     al,8
  2651.         je      imul_reg_mem_imm_64bit
  2652.         jmp     invalid_operand_size
  2653.       imul_reg_mem_imm_16bit:
  2654.         call    operand_16bit
  2655.         call    get_word_value
  2656.         mov     word [value],ax
  2657.         cmp     [value_type],0
  2658.         jne     imul_reg_mem_imm_16bit_store
  2659.         cmp     [size_declared],0
  2660.         jne     imul_reg_mem_imm_16bit_store
  2661.         cmp     ax,-80h
  2662.         jl      imul_reg_mem_imm_16bit_store
  2663.         cmp     ax,80h
  2664.         jl      imul_reg_mem_imm_8bit_store
  2665.       imul_reg_mem_imm_16bit_store:
  2666.         pop     ecx ebx edx
  2667.         mov     [base_code],69h
  2668.         call    store_instruction_with_imm16
  2669.         jmp     instruction_assembled
  2670.       imul_reg_mem_imm_32bit:
  2671.         call    operand_32bit
  2672.         call    get_dword_value
  2673.       imul_reg_mem_imm_32bit_ok:
  2674.         mov     dword [value],eax
  2675.         cmp     [value_type],0
  2676.         jne     imul_reg_mem_imm_32bit_store
  2677.         cmp     [size_declared],0
  2678.         jne     imul_reg_mem_imm_32bit_store
  2679.         cmp     eax,-80h
  2680.         jl      imul_reg_mem_imm_32bit_store
  2681.         cmp     eax,80h
  2682.         jl      imul_reg_mem_imm_8bit_store
  2683.       imul_reg_mem_imm_32bit_store:
  2684.         pop     ecx ebx edx
  2685.         mov     [base_code],69h
  2686.         call    store_instruction_with_imm32
  2687.         jmp     instruction_assembled
  2688.       imul_reg_mem_imm_64bit:
  2689.         cmp     [size_declared],0
  2690.         jne     long_immediate_not_encodable
  2691.         call    operand_64bit
  2692.         call    get_simm32
  2693.         cmp     [value_type],4
  2694.         jae     long_immediate_not_encodable
  2695.         jmp     imul_reg_mem_imm_32bit_ok
  2696.       imul_reg_mem_imm_8bit_store:
  2697.         pop     ecx ebx edx
  2698.         mov     [base_code],6Bh
  2699.         call    store_instruction_with_imm8
  2700.         jmp     instruction_assembled
  2701.       imul_reg_imm:
  2702.         mov     bl,[postbyte_register]
  2703.         dec     esi
  2704.         jmp     imul_reg_reg_imm
  2705.       imul_reg_reg:
  2706.         lods    byte [esi]
  2707.         call    convert_register
  2708.         mov     bl,al
  2709.         cmp     byte [esi],','
  2710.         je      imul_reg_reg_imm
  2711.         mov     al,ah
  2712.         call    operand_autodetect
  2713.         mov     [base_code],0Fh
  2714.         mov     [extended_code],0AFh
  2715.         call    store_nomem_instruction
  2716.         jmp     instruction_assembled
  2717.       imul_reg_reg_imm:
  2718.         inc     esi
  2719.         lods    byte [esi]
  2720.         call    get_size_operator
  2721.         cmp     al,'('
  2722.         jne     invalid_operand
  2723.         mov     al,[operand_size]
  2724.         cmp     al,2
  2725.         je      imul_reg_reg_imm_16bit
  2726.         cmp     al,4
  2727.         je      imul_reg_reg_imm_32bit
  2728.         cmp     al,8
  2729.         je      imul_reg_reg_imm_64bit
  2730.         jmp     invalid_operand_size
  2731.       imul_reg_reg_imm_16bit:
  2732.         call    operand_16bit
  2733.         push    ebx
  2734.         call    get_word_value
  2735.         pop     ebx
  2736.         mov     dx,ax
  2737.         cmp     [value_type],0
  2738.         jne     imul_reg_reg_imm_16bit_store
  2739.         cmp     [size_declared],0
  2740.         jne     imul_reg_reg_imm_16bit_store
  2741.         cmp     ax,-80h
  2742.         jl      imul_reg_reg_imm_16bit_store
  2743.         cmp     ax,80h
  2744.         jl      imul_reg_reg_imm_8bit_store
  2745.       imul_reg_reg_imm_16bit_store:
  2746.         mov     [base_code],69h
  2747.         call    store_nomem_instruction
  2748.         mov     ax,dx
  2749.         call    mark_relocation
  2750.         stos    word [edi]
  2751.         jmp     instruction_assembled
  2752.       imul_reg_reg_imm_32bit:
  2753.         call    operand_32bit
  2754.         push    ebx
  2755.         call    get_dword_value
  2756.       imul_reg_reg_imm_32bit_ok:
  2757.         pop     ebx
  2758.         mov     edx,eax
  2759.         cmp     [value_type],0
  2760.         jne     imul_reg_reg_imm_32bit_store
  2761.         cmp     [size_declared],0
  2762.         jne     imul_reg_reg_imm_32bit_store
  2763.         cmp     eax,-80h
  2764.         jl      imul_reg_reg_imm_32bit_store
  2765.         cmp     eax,80h
  2766.         jl      imul_reg_reg_imm_8bit_store
  2767.       imul_reg_reg_imm_32bit_store:
  2768.         mov     [base_code],69h
  2769.         call    store_nomem_instruction
  2770.         mov     eax,edx
  2771.         call    mark_relocation
  2772.         stos    dword [edi]
  2773.         jmp     instruction_assembled
  2774.       imul_reg_reg_imm_64bit:
  2775.         cmp     [size_declared],0
  2776.         jne     long_immediate_not_encodable
  2777.         call    operand_64bit
  2778.         push    ebx
  2779.         call    get_simm32
  2780.         cmp     [value_type],4
  2781.         jae     long_immediate_not_encodable
  2782.         jmp     imul_reg_reg_imm_32bit_ok
  2783.       imul_reg_reg_imm_8bit_store:
  2784.         mov     [base_code],6Bh
  2785.         call    store_nomem_instruction
  2786.         mov     al,dl
  2787.         stos    byte [edi]
  2788.         jmp     instruction_assembled
  2789. in_instruction:
  2790.         lods    byte [esi]
  2791.         call    get_size_operator
  2792.         cmp     al,10h
  2793.         jne     invalid_operand
  2794.         lods    byte [esi]
  2795.         call    convert_register
  2796.         or      al,al
  2797.         jnz     invalid_operand
  2798.         lods    byte [esi]
  2799.         cmp     al,','
  2800.         jne     invalid_operand
  2801.         mov     al,ah
  2802.         push    eax
  2803.         mov     [operand_size],0
  2804.         lods    byte [esi]
  2805.         call    get_size_operator
  2806.         cmp     al,'('
  2807.         je      in_imm
  2808.         cmp     al,10h
  2809.         je      in_reg
  2810.         jmp     invalid_operand
  2811.       in_reg:
  2812.         lods    byte [esi]
  2813.         cmp     al,22h
  2814.         jne     invalid_operand
  2815.         pop     eax
  2816.         cmp     al,1
  2817.         je      in_al_dx
  2818.         cmp     al,2
  2819.         je      in_ax_dx
  2820.         cmp     al,4
  2821.         je      in_eax_dx
  2822.         jmp     invalid_operand_size
  2823.       in_al_dx:
  2824.         mov     al,0ECh
  2825.         stos    byte [edi]
  2826.         jmp     instruction_assembled
  2827.       in_ax_dx:
  2828.         call    operand_16bit
  2829.         mov     [base_code],0EDh
  2830.         call    store_instruction_code
  2831.         jmp     instruction_assembled
  2832.       in_eax_dx:
  2833.         call    operand_32bit
  2834.         mov     [base_code],0EDh
  2835.         call    store_instruction_code
  2836.         jmp     instruction_assembled
  2837.       in_imm:
  2838.         mov     al,[operand_size]
  2839.         or      al,al
  2840.         jz      in_imm_size_ok
  2841.         cmp     al,1
  2842.         jne     invalid_operand_size
  2843.       in_imm_size_ok:
  2844.         call    get_byte_value
  2845.         mov     dl,al
  2846.         pop     eax
  2847.         cmp     al,1
  2848.         je      in_al_imm
  2849.         cmp     al,2
  2850.         je      in_ax_imm
  2851.         cmp     al,4
  2852.         je      in_eax_imm
  2853.         jmp     invalid_operand_size
  2854.       in_al_imm:
  2855.         mov     al,0E4h
  2856.         stos    byte [edi]
  2857.         mov     al,dl
  2858.         stos    byte [edi]
  2859.         jmp     instruction_assembled
  2860.       in_ax_imm:
  2861.         call    operand_16bit
  2862.         mov     [base_code],0E5h
  2863.         call    store_instruction_code
  2864.         mov     al,dl
  2865.         stos    byte [edi]
  2866.         jmp     instruction_assembled
  2867.       in_eax_imm:
  2868.         call    operand_32bit
  2869.         mov     [base_code],0E5h
  2870.         call    store_instruction_code
  2871.         mov     al,dl
  2872.         stos    byte [edi]
  2873.         jmp     instruction_assembled
  2874. out_instruction:
  2875.         lods    byte [esi]
  2876.         call    get_size_operator
  2877.         cmp     al,'('
  2878.         je      out_imm
  2879.         cmp     al,10h
  2880.         jne     invalid_operand
  2881.         lods    byte [esi]
  2882.         cmp     al,22h
  2883.         jne     invalid_operand
  2884.         lods    byte [esi]
  2885.         cmp     al,','
  2886.         jne     invalid_operand
  2887.         mov     [operand_size],0
  2888.         lods    byte [esi]
  2889.         call    get_size_operator
  2890.         cmp     al,10h
  2891.         jne     invalid_operand
  2892.         lods    byte [esi]
  2893.         call    convert_register
  2894.         or      al,al
  2895.         jnz     invalid_operand
  2896.         mov     al,ah
  2897.         cmp     al,1
  2898.         je      out_dx_al
  2899.         cmp     al,2
  2900.         je      out_dx_ax
  2901.         cmp     al,4
  2902.         je      out_dx_eax
  2903.         jmp     invalid_operand_size
  2904.       out_dx_al:
  2905.         mov     al,0EEh
  2906.         stos    byte [edi]
  2907.         jmp     instruction_assembled
  2908.       out_dx_ax:
  2909.         call    operand_16bit
  2910.         mov     [base_code],0EFh
  2911.         call    store_instruction_code
  2912.         jmp     instruction_assembled
  2913.       out_dx_eax:
  2914.         call    operand_32bit
  2915.         mov     [base_code],0EFh
  2916.         call    store_instruction_code
  2917.         jmp     instruction_assembled
  2918.       out_imm:
  2919.         mov     al,[operand_size]
  2920.         or      al,al
  2921.         jz      out_imm_size_ok
  2922.         cmp     al,1
  2923.         jne     invalid_operand_size
  2924.       out_imm_size_ok:
  2925.         call    get_byte_value
  2926.         mov     dl,al
  2927.         lods    byte [esi]
  2928.         cmp     al,','
  2929.         jne     invalid_operand
  2930.         mov     [operand_size],0
  2931.         lods    byte [esi]
  2932.         call    get_size_operator
  2933.         cmp     al,10h
  2934.         jne     invalid_operand
  2935.         lods    byte [esi]
  2936.         call    convert_register
  2937.         or      al,al
  2938.         jnz     invalid_operand
  2939.         mov     al,ah
  2940.         cmp     al,1
  2941.         je      out_imm_al
  2942.         cmp     al,2
  2943.         je      out_imm_ax
  2944.         cmp     al,4
  2945.         je      out_imm_eax
  2946.         jmp     invalid_operand_size
  2947.       out_imm_al:
  2948.         mov     al,0E6h
  2949.         stos    byte [edi]
  2950.         mov     al,dl
  2951.         stos    byte [edi]
  2952.         jmp     instruction_assembled
  2953.       out_imm_ax:
  2954.         call    operand_16bit
  2955.         mov     [base_code],0E7h
  2956.         call    store_instruction_code
  2957.         mov     al,dl
  2958.         stos    byte [edi]
  2959.         jmp     instruction_assembled
  2960.       out_imm_eax:
  2961.         call    operand_32bit
  2962.         mov     [base_code],0E7h
  2963.         call    store_instruction_code
  2964.         mov     al,dl
  2965.         stos    byte [edi]
  2966.         jmp     instruction_assembled
  2967.  
  2968. call_instruction:
  2969.         mov     [postbyte_register],10b
  2970.         mov     [base_code],0E8h
  2971.         mov     [extended_code],9Ah
  2972.         jmp     process_jmp
  2973. jmp_instruction:
  2974.         mov     [postbyte_register],100b
  2975.         mov     [base_code],0E9h
  2976.         mov     [extended_code],0EAh
  2977.       process_jmp:
  2978.         lods    byte [esi]
  2979.         call    get_jump_operator
  2980.         call    get_size_operator
  2981.         cmp     al,'('
  2982.         je      jmp_imm
  2983.         mov     [base_code],0FFh
  2984.         cmp     al,10h
  2985.         je      jmp_reg
  2986.         cmp     al,'['
  2987.         jne     invalid_operand
  2988.       jmp_mem:
  2989.         cmp     [jump_type],1
  2990.         je      illegal_instruction
  2991.         call    get_address
  2992.         mov     edx,eax
  2993.         mov     al,[operand_size]
  2994.         or      al,al
  2995.         jz      jmp_mem_size_not_specified
  2996.         cmp     al,2
  2997.         je      jmp_mem_16bit
  2998.         cmp     al,4
  2999.         je      jmp_mem_32bit
  3000.         cmp     al,6
  3001.         je      jmp_mem_48bit
  3002.         cmp     al,8
  3003.         je      jmp_mem_64bit
  3004.         cmp     al,10
  3005.         je      jmp_mem_80bit
  3006.         jmp     invalid_operand_size
  3007.       jmp_mem_size_not_specified:
  3008.         cmp     [jump_type],3
  3009.         je      jmp_mem_far
  3010.         cmp     [jump_type],2
  3011.         je      jmp_mem_near
  3012.         cmp     [error_line],0
  3013.         jne     jmp_mem_near
  3014.         mov     eax,[current_line]
  3015.         mov     [error_line],eax
  3016.         mov     [error],operand_size_not_specified
  3017.       jmp_mem_near:
  3018.         cmp     [code_type],16
  3019.         je      jmp_mem_16bit
  3020.         cmp     [code_type],32
  3021.         je      jmp_mem_near_32bit
  3022.       jmp_mem_64bit:
  3023.         cmp     [jump_type],3
  3024.         je      invalid_operand_size
  3025.         cmp     [code_type],64
  3026.         jne     illegal_instruction
  3027.         call    store_instruction
  3028.         jmp     instruction_assembled
  3029.       jmp_mem_far:
  3030.         cmp     [code_type],16
  3031.         je      jmp_mem_far_32bit
  3032.       jmp_mem_48bit:
  3033.         call    operand_32bit
  3034.       jmp_mem_far_store:
  3035.         cmp     [jump_type],2
  3036.         je      invalid_operand_size
  3037.         inc     [postbyte_register]
  3038.         call    store_instruction
  3039.         jmp     instruction_assembled
  3040.       jmp_mem_80bit:
  3041.         call    operand_64bit
  3042.         jmp     jmp_mem_far_store
  3043.       jmp_mem_far_32bit:
  3044.         call    operand_16bit
  3045.         jmp     jmp_mem_far_store
  3046.       jmp_mem_32bit:
  3047.         cmp     [jump_type],3
  3048.         je      jmp_mem_far_32bit
  3049.         cmp     [jump_type],2
  3050.         je      jmp_mem_near_32bit
  3051.         cmp     [code_type],16
  3052.         je      jmp_mem_far_32bit
  3053.       jmp_mem_near_32bit:
  3054.         cmp     [code_type],64
  3055.         je      illegal_instruction
  3056.         call    operand_32bit
  3057.         call    store_instruction
  3058.         jmp     instruction_assembled
  3059.       jmp_mem_16bit:
  3060.         cmp     [jump_type],3
  3061.         je      invalid_operand_size
  3062.         call    operand_16bit
  3063.         call    store_instruction
  3064.         jmp     instruction_assembled
  3065.       jmp_reg:
  3066.         test    [jump_type],1
  3067.         jnz     invalid_operand
  3068.         lods    byte [esi]
  3069.         call    convert_register
  3070.         mov     bl,al
  3071.         mov     al,ah
  3072.         cmp     al,2
  3073.         je      jmp_reg_16bit
  3074.         cmp     al,4
  3075.         je      jmp_reg_32bit
  3076.         cmp     al,8
  3077.         jne     invalid_operand_size
  3078.       jmp_reg_64bit:
  3079.         cmp     [code_type],64
  3080.         jne     illegal_instruction
  3081.         call    store_nomem_instruction
  3082.         jmp     instruction_assembled
  3083.       jmp_reg_32bit:
  3084.         cmp     [code_type],64
  3085.         je      illegal_instruction
  3086.         call    store_nomem_instruction
  3087.         jmp     instruction_assembled
  3088.       jmp_reg_16bit:
  3089.         call    operand_16bit
  3090.         call    store_nomem_instruction
  3091.         jmp     instruction_assembled
  3092.       jmp_imm:
  3093.         cmp     byte [esi],'.'
  3094.         je      invalid_value
  3095.         mov     ebx,esi
  3096.         dec     esi
  3097.         call    skip_symbol
  3098.         xchg    esi,ebx
  3099.         cmp     byte [ebx],':'
  3100.         je      jmp_far
  3101.         cmp     [jump_type],3
  3102.         je      invalid_operand
  3103.       jmp_near:
  3104.         mov     al,[operand_size]
  3105.         cmp     al,2
  3106.         je      jmp_imm_16bit
  3107.         cmp     al,4
  3108.         je      jmp_imm_32bit
  3109.         cmp     al,8
  3110.         je      jmp_imm_64bit
  3111.         or      al,al
  3112.         jnz     invalid_operand_size
  3113.         cmp     [code_type],16
  3114.         je      jmp_imm_16bit
  3115.         cmp     [code_type],64
  3116.         je      jmp_imm_64bit
  3117.       jmp_imm_32bit:
  3118.         cmp     [code_type],64
  3119.         je      invalid_operand_size
  3120.         call    get_address_dword_value
  3121.         cmp     [code_type],16
  3122.         jne     jmp_imm_32bit_prefix_ok
  3123.         mov     byte [edi],66h
  3124.         inc     edi
  3125.       jmp_imm_32bit_prefix_ok:
  3126.         call    calculate_jump_offset
  3127.         cdq
  3128.         call    check_for_short_jump
  3129.         jc      jmp_short
  3130.       jmp_imm_32bit_store:
  3131.         mov     edx,eax
  3132.         sub     edx,3
  3133.         mov     al,[base_code]
  3134.         stos    byte [edi]
  3135.         mov     eax,edx
  3136.         call    mark_relocation
  3137.         stos    dword [edi]
  3138.         jmp     instruction_assembled
  3139.       jmp_imm_64bit:
  3140.         cmp     [code_type],64
  3141.         jne     invalid_operand_size
  3142.         call    get_address_qword_value
  3143.         call    calculate_jump_offset
  3144.         mov     ecx,edx
  3145.         cdq
  3146.         cmp     edx,ecx
  3147.         jne     value_out_of_range
  3148.         call    check_for_short_jump
  3149.         jnc     jmp_imm_32bit_store
  3150.       jmp_short:
  3151.         mov     ah,al
  3152.         mov     al,0EBh
  3153.         stos    word [edi]
  3154.         jmp     instruction_assembled
  3155.       jmp_imm_16bit:
  3156.         call    get_address_word_value
  3157.         cmp     [code_type],16
  3158.         je      jmp_imm_16bit_prefix_ok
  3159.         mov     byte [edi],66h
  3160.         inc     edi
  3161.       jmp_imm_16bit_prefix_ok:
  3162.         call    calculate_jump_offset
  3163.         cwde
  3164.         cdq
  3165.         call    check_for_short_jump
  3166.         jc      jmp_short
  3167.         cmp     [value_type],0
  3168.         jne     invalid_use_of_symbol
  3169.         mov     edx,eax
  3170.         dec     edx
  3171.         mov     al,[base_code]
  3172.         stos    byte [edi]
  3173.         mov     eax,edx
  3174.         stos    word [edi]
  3175.         jmp     instruction_assembled
  3176.       calculate_jump_offset:
  3177.         add     edi,2
  3178.         call    calculate_relative_offset
  3179.         sub     edi,2
  3180.         ret
  3181.       check_for_short_jump:
  3182.         cmp     [jump_type],1
  3183.         je      forced_short
  3184.         ja      no_short_jump
  3185.         cmp     [base_code],0E8h
  3186.         je      no_short_jump
  3187.         cmp     [value_type],0
  3188.         jne     no_short_jump
  3189.         cmp     eax,80h
  3190.         jb      short_jump
  3191.         cmp     eax,-80h
  3192.         jae     short_jump
  3193.       no_short_jump:
  3194.         clc
  3195.         ret
  3196.       forced_short:
  3197.         cmp     [base_code],0E8h
  3198.         je      illegal_instruction
  3199.         cmp     [next_pass_needed],0
  3200.         jne     jmp_short_value_type_ok
  3201.         cmp     [value_type],0
  3202.         jne     invalid_use_of_symbol
  3203.       jmp_short_value_type_ok:
  3204.         cmp     eax,-80h
  3205.         jae     short_jump
  3206.         cmp     eax,80h
  3207.         jae     jump_out_of_range
  3208.       short_jump:
  3209.         stc
  3210.         ret
  3211.       jump_out_of_range:
  3212.         cmp     [error_line],0
  3213.         jne     instruction_assembled
  3214.         mov     eax,[current_line]
  3215.         mov     [error_line],eax
  3216.         mov     [error],relative_jump_out_of_range
  3217.         jmp     instruction_assembled
  3218.       jmp_far:
  3219.         cmp     [jump_type],2
  3220.         je      invalid_operand
  3221.         cmp     [code_type],64
  3222.         je      illegal_instruction
  3223.         mov     al,[extended_code]
  3224.         mov     [base_code],al
  3225.         call    get_word_value
  3226.         push    eax
  3227.         inc     esi
  3228.         lods    byte [esi]
  3229.         cmp     al,'('
  3230.         jne     invalid_operand
  3231.         mov     al,[value_type]
  3232.         push    eax [symbol_identifier]
  3233.         cmp     byte [esi],'.'
  3234.         je      invalid_value
  3235.         mov     al,[operand_size]
  3236.         cmp     al,4
  3237.         je      jmp_far_16bit
  3238.         cmp     al,6
  3239.         je      jmp_far_32bit
  3240.         or      al,al
  3241.         jnz     invalid_operand_size
  3242.         cmp     [code_type],16
  3243.         jne     jmp_far_32bit
  3244.       jmp_far_16bit:
  3245.         call    get_word_value
  3246.         mov     ebx,eax
  3247.         call    operand_16bit
  3248.         call    store_instruction_code
  3249.         mov     ax,bx
  3250.         call    mark_relocation
  3251.         stos    word [edi]
  3252.       jmp_far_segment:
  3253.         pop     [symbol_identifier] eax
  3254.         mov     [value_type],al
  3255.         pop     eax
  3256.         call    mark_relocation
  3257.         stos    word [edi]
  3258.         jmp     instruction_assembled
  3259.       jmp_far_32bit:
  3260.         call    get_dword_value
  3261.         mov     ebx,eax
  3262.         call    operand_32bit
  3263.         call    store_instruction_code
  3264.         mov     eax,ebx
  3265.         call    mark_relocation
  3266.         stos    dword [edi]
  3267.         jmp     jmp_far_segment
  3268. conditional_jump:
  3269.         mov     [base_code],al
  3270.         lods    byte [esi]
  3271.         call    get_jump_operator
  3272.         cmp     [jump_type],3
  3273.         je      invalid_operand
  3274.         call    get_size_operator
  3275.         cmp     al,'('
  3276.         jne     invalid_operand
  3277.         cmp     byte [esi],'.'
  3278.         je      invalid_value
  3279.         mov     al,[operand_size]
  3280.         cmp     al,2
  3281.         je      conditional_jump_16bit
  3282.         cmp     al,4
  3283.         je      conditional_jump_32bit
  3284.         cmp     al,8
  3285.         je      conditional_jump_64bit
  3286.         or      al,al
  3287.         jnz     invalid_operand_size
  3288.         cmp     [code_type],16
  3289.         je      conditional_jump_16bit
  3290.         cmp     [code_type],64
  3291.         je      conditional_jump_64bit
  3292.       conditional_jump_32bit:
  3293.         cmp     [code_type],64
  3294.         je      invalid_operand_size
  3295.         call    get_address_dword_value
  3296.         cmp     [code_type],16
  3297.         jne     conditional_jump_32bit_prefix_ok
  3298.         mov     byte [edi],66h
  3299.         inc     edi
  3300.       conditional_jump_32bit_prefix_ok:
  3301.         call    calculate_jump_offset
  3302.         cdq
  3303.         call    check_for_short_jump
  3304.         jc      conditional_jump_short
  3305.       conditional_jump_32bit_store:
  3306.         mov     edx,eax
  3307.         sub     edx,4
  3308.         mov     ah,[base_code]
  3309.         add     ah,10h
  3310.         mov     al,0Fh
  3311.         stos    word [edi]
  3312.         mov     eax,edx
  3313.         call    mark_relocation
  3314.         stos    dword [edi]
  3315.         jmp     instruction_assembled
  3316.       conditional_jump_64bit:
  3317.         cmp     [code_type],64
  3318.         jne     invalid_operand_size
  3319.         call    get_address_qword_value
  3320.         call    calculate_jump_offset
  3321.         mov     ecx,edx
  3322.         cdq
  3323.         cmp     edx,ecx
  3324.         jne     value_out_of_range
  3325.         call    check_for_short_jump
  3326.         jnc     conditional_jump_32bit_store
  3327.       conditional_jump_short:
  3328.         mov     ah,al
  3329.         mov     al,[base_code]
  3330.         stos    word [edi]
  3331.         jmp     instruction_assembled
  3332.       conditional_jump_16bit:
  3333.         call    get_address_word_value
  3334.         cmp     [code_type],16
  3335.         je      conditional_jump_16bit_prefix_ok
  3336.         mov     byte [edi],66h
  3337.         inc     edi
  3338.       conditional_jump_16bit_prefix_ok:
  3339.         call    calculate_jump_offset
  3340.         cwde
  3341.         cdq
  3342.         call    check_for_short_jump
  3343.         jc      conditional_jump_short
  3344.         cmp     [value_type],0
  3345.         jne     invalid_use_of_symbol
  3346.         mov     edx,eax
  3347.         sub     edx,2
  3348.         mov     ah,[base_code]
  3349.         add     ah,10h
  3350.         mov     al,0Fh
  3351.         stos    word [edi]
  3352.         mov     eax,edx
  3353.         stos    word [edi]
  3354.         jmp     instruction_assembled
  3355. loop_instruction_16bit:
  3356.         cmp     [code_type],64
  3357.         je      illegal_instruction
  3358.         mov     dl,al
  3359.         call    address_16bit_prefix
  3360.         mov     al,dl
  3361.         jmp     loop_instruction
  3362. loop_instruction_32bit:
  3363.         mov     dl,al
  3364.         call    address_32bit_prefix
  3365.         mov     al,dl
  3366.         jmp     loop_instruction
  3367. loop_instruction_64bit:
  3368.         cmp     [code_type],64
  3369.         jne     illegal_instruction
  3370. loop_instruction:
  3371.         mov     [base_code],al
  3372.         lods    byte [esi]
  3373.         call    get_jump_operator
  3374.         cmp     [jump_type],1
  3375.         ja      invalid_operand
  3376.         call    get_size_operator
  3377.         cmp     al,'('
  3378.         jne     invalid_operand
  3379.         cmp     byte [esi],'.'
  3380.         je      invalid_value
  3381.         mov     al,[operand_size]
  3382.         cmp     al,2
  3383.         je      loop_jump_16bit
  3384.         cmp     al,4
  3385.         je      loop_jump_32bit
  3386.         cmp     al,8
  3387.         je      loop_jump_64bit
  3388.         or      al,al
  3389.         jnz     invalid_operand_size
  3390.         cmp     [code_type],16
  3391.         je      loop_jump_16bit
  3392.         cmp     [code_type],64
  3393.         je      loop_jump_64bit
  3394.       loop_jump_32bit:
  3395.         cmp     [code_type],64
  3396.         je      invalid_operand_size
  3397.         call    get_address_dword_value
  3398.         cmp     [code_type],16
  3399.         jne     loop_jump_32bit_prefix_ok
  3400.         mov     byte [edi],66h
  3401.         inc     edi
  3402.       loop_jump_32bit_prefix_ok:
  3403.         call    calculate_jump_offset
  3404.         cdq
  3405.       make_loop_jump:
  3406.         call    check_for_short_jump
  3407.         jc      conditional_jump_short
  3408.         jmp     jump_out_of_range
  3409.       loop_jump_64bit:
  3410.         cmp     [code_type],64
  3411.         jne     invalid_operand_size
  3412.         call    get_address_qword_value
  3413.         call    calculate_jump_offset
  3414.         mov     ecx,edx
  3415.         cdq
  3416.         cmp     edx,ecx
  3417.         jne     value_out_of_range
  3418.         jmp     make_loop_jump
  3419.       loop_jump_16bit:
  3420.         call    get_address_word_value
  3421.         cmp     [code_type],16
  3422.         je      loop_jump_16bit_prefix_ok
  3423.         mov     byte [edi],66h
  3424.         inc     edi
  3425.       loop_jump_16bit_prefix_ok:
  3426.         call    calculate_jump_offset
  3427.         cwde
  3428.         cdq
  3429.         jmp     make_loop_jump
  3430.  
  3431. movs_instruction:
  3432.         lods    byte [esi]
  3433.         call    get_size_operator
  3434.         cmp     al,'['
  3435.         jne     invalid_operand
  3436.         call    get_address
  3437.         or      eax,eax
  3438.         jnz     invalid_address
  3439.         or      bl,ch
  3440.         jnz     invalid_address
  3441.         cmp     [segment_register],1
  3442.         ja      invalid_address
  3443.         push    ebx
  3444.         lods    byte [esi]
  3445.         cmp     al,','
  3446.         jne     invalid_operand
  3447.         lods    byte [esi]
  3448.         call    get_size_operator
  3449.         cmp     al,'['
  3450.         jne     invalid_operand
  3451.         call    get_address
  3452.         pop     edx
  3453.         or      eax,eax
  3454.         jnz     invalid_address
  3455.         or      bl,ch
  3456.         jnz     invalid_address
  3457.         mov     al,dh
  3458.         mov     ah,bh
  3459.         shr     al,4
  3460.         shr     ah,4
  3461.         cmp     al,ah
  3462.         jne     address_sizes_do_not_agree
  3463.         and     bh,111b
  3464.         and     dh,111b
  3465.         cmp     bh,6
  3466.         jne     invalid_address
  3467.         cmp     dh,7
  3468.         jne     invalid_address
  3469.         cmp     al,2
  3470.         je      movs_address_16bit
  3471.         cmp     al,4
  3472.         je      movs_address_32bit
  3473.         cmp     [code_type],64
  3474.         jne     invalid_address_size
  3475.         jmp     movs_store
  3476.       movs_address_32bit:
  3477.         call    address_32bit_prefix
  3478.         jmp     movs_store
  3479.       movs_address_16bit:
  3480.         cmp     [code_type],64
  3481.         je      invalid_address_size
  3482.         call    address_16bit_prefix
  3483.       movs_store:
  3484.         cmp     [segment_register],4
  3485.         je      movs_segment_ok
  3486.         call    store_segment_prefix
  3487.       movs_segment_ok:
  3488.         mov     al,0A4h
  3489.         mov     bl,[operand_size]
  3490.         cmp     bl,1
  3491.         je      simple_instruction
  3492.         inc     al
  3493.         cmp     bl,2
  3494.         je      simple_instruction_16bit
  3495.         cmp     bl,4
  3496.         je      simple_instruction_32bit
  3497.         cmp     bl,8
  3498.         je      simple_instruction_64bit
  3499.         or      bl,bl
  3500.         jz      operand_size_not_specified
  3501.         jmp     invalid_operand_size
  3502. lods_instruction:
  3503.         lods    byte [esi]
  3504.         call    get_size_operator
  3505.         cmp     al,'['
  3506.         jne     invalid_operand
  3507.         call    get_address
  3508.         or      eax,eax
  3509.         jnz     invalid_address
  3510.         or      bl,ch
  3511.         jnz     invalid_address
  3512.         cmp     bh,26h
  3513.         je      lods_address_16bit
  3514.         cmp     bh,46h
  3515.         je      lods_address_32bit
  3516.         cmp     bh,86h
  3517.         jne     invalid_address
  3518.         cmp     [code_type],64
  3519.         jne     invalid_address_size
  3520.         jmp     lods_store
  3521.       lods_address_32bit:
  3522.         call    address_32bit_prefix
  3523.         jmp     lods_store
  3524.       lods_address_16bit:
  3525.         cmp     [code_type],64
  3526.         je      invalid_address_size
  3527.         call    address_16bit_prefix
  3528.       lods_store:
  3529.         cmp     [segment_register],4
  3530.         je      lods_segment_ok
  3531.         call    store_segment_prefix
  3532.       lods_segment_ok:
  3533.         mov     al,0ACh
  3534.         mov     bl,[operand_size]
  3535.         cmp     bl,1
  3536.         je      simple_instruction
  3537.         inc     al
  3538.         cmp     bl,2
  3539.         je      simple_instruction_16bit
  3540.         cmp     bl,4
  3541.         je      simple_instruction_32bit
  3542.         cmp     bl,8
  3543.         je      simple_instruction_64bit
  3544.         or      bl,bl
  3545.         jz      operand_size_not_specified
  3546.         jmp     invalid_operand_size
  3547. stos_instruction:
  3548.         mov     [base_code],al
  3549.         lods    byte [esi]
  3550.         call    get_size_operator
  3551.         cmp     al,'['
  3552.         jne     invalid_operand
  3553.         call    get_address
  3554.         or      eax,eax
  3555.         jnz     invalid_address
  3556.         or      bl,ch
  3557.         jnz     invalid_address
  3558.         cmp     bh,27h
  3559.         je      stos_address_16bit
  3560.         cmp     bh,47h
  3561.         je      stos_address_32bit
  3562.         cmp     bh,87h
  3563.         jne     invalid_address
  3564.         cmp     [code_type],64
  3565.         jne     invalid_address_size
  3566.         jmp     stos_store
  3567.       stos_address_32bit:
  3568.         call    address_32bit_prefix
  3569.         jmp     stos_store
  3570.       stos_address_16bit:
  3571.         cmp     [code_type],64
  3572.         je      invalid_address_size
  3573.         call    address_16bit_prefix
  3574.       stos_store:
  3575.         cmp     [segment_register],1
  3576.         ja      invalid_address
  3577.         mov     al,[base_code]
  3578.         mov     bl,[operand_size]
  3579.         cmp     bl,1
  3580.         je      simple_instruction
  3581.         inc     al
  3582.         cmp     bl,2
  3583.         je      simple_instruction_16bit
  3584.         cmp     bl,4
  3585.         je      simple_instruction_32bit
  3586.         cmp     bl,8
  3587.         je      simple_instruction_64bit
  3588.         or      bl,bl
  3589.         jz      operand_size_not_specified
  3590.         jmp     invalid_operand_size
  3591. cmps_instruction:
  3592.         lods    byte [esi]
  3593.         call    get_size_operator
  3594.         cmp     al,'['
  3595.         jne     invalid_operand
  3596.         call    get_address
  3597.         or      eax,eax
  3598.         jnz     invalid_address
  3599.         or      bl,ch
  3600.         jnz     invalid_address
  3601.         mov     al,[segment_register]
  3602.         push    eax ebx
  3603.         lods    byte [esi]
  3604.         cmp     al,','
  3605.         jne     invalid_operand
  3606.         lods    byte [esi]
  3607.         call    get_size_operator
  3608.         cmp     al,'['
  3609.         jne     invalid_operand
  3610.         call    get_address
  3611.         or      eax,eax
  3612.         jnz     invalid_address
  3613.         or      bl,ch
  3614.         jnz     invalid_address
  3615.         pop     edx eax
  3616.         cmp     [segment_register],1
  3617.         ja      invalid_address
  3618.         mov     [segment_register],al
  3619.         mov     al,dh
  3620.         mov     ah,bh
  3621.         shr     al,4
  3622.         shr     ah,4
  3623.         cmp     al,ah
  3624.         jne     address_sizes_do_not_agree
  3625.         and     bh,111b
  3626.         and     dh,111b
  3627.         cmp     bh,7
  3628.         jne     invalid_address
  3629.         cmp     dh,6
  3630.         jne     invalid_address
  3631.         cmp     al,2
  3632.         je      cmps_address_16bit
  3633.         cmp     al,4
  3634.         je      cmps_address_32bit
  3635.         cmp     [code_type],64
  3636.         jne     invalid_address_size
  3637.         jmp     cmps_store
  3638.       cmps_address_32bit:
  3639.         call    address_32bit_prefix
  3640.         jmp     cmps_store
  3641.       cmps_address_16bit:
  3642.         cmp     [code_type],64
  3643.         je      invalid_address_size
  3644.         call    address_16bit_prefix
  3645.       cmps_store:
  3646.         cmp     [segment_register],4
  3647.         je      cmps_segment_ok
  3648.         call    store_segment_prefix
  3649.       cmps_segment_ok:
  3650.         mov     al,0A6h
  3651.         mov     bl,[operand_size]
  3652.         cmp     bl,1
  3653.         je      simple_instruction
  3654.         inc     al
  3655.         cmp     bl,2
  3656.         je      simple_instruction_16bit
  3657.         cmp     bl,4
  3658.         je      simple_instruction_32bit
  3659.         cmp     bl,8
  3660.         je      simple_instruction_64bit
  3661.         or      bl,bl
  3662.         jz      operand_size_not_specified
  3663.         jmp     invalid_operand_size
  3664. ins_instruction:
  3665.         lods    byte [esi]
  3666.         call    get_size_operator
  3667.         cmp     al,'['
  3668.         jne     invalid_operand
  3669.         call    get_address
  3670.         or      eax,eax
  3671.         jnz     invalid_address
  3672.         or      bl,ch
  3673.         jnz     invalid_address
  3674.         cmp     bh,27h
  3675.         je      ins_address_16bit
  3676.         cmp     bh,47h
  3677.         je      ins_address_32bit
  3678.         cmp     bh,87h
  3679.         jne     invalid_address
  3680.         cmp     [code_type],64
  3681.         jne     invalid_address_size
  3682.         jmp     ins_store
  3683.       ins_address_32bit:
  3684.         call    address_32bit_prefix
  3685.         jmp     ins_store
  3686.       ins_address_16bit:
  3687.         cmp     [code_type],64
  3688.         je      invalid_address_size
  3689.         call    address_16bit_prefix
  3690.       ins_store:
  3691.         cmp     [segment_register],1
  3692.         ja      invalid_address
  3693.         lods    byte [esi]
  3694.         cmp     al,','
  3695.         jne     invalid_operand
  3696.         lods    byte [esi]
  3697.         cmp     al,10h
  3698.         jne     invalid_operand
  3699.         lods    byte [esi]
  3700.         cmp     al,22h
  3701.         jne     invalid_operand
  3702.         mov     al,6Ch
  3703.         mov     bl,[operand_size]
  3704.         cmp     bl,1
  3705.         je      simple_instruction
  3706.         inc     al
  3707.         cmp     bl,2
  3708.         je      simple_instruction_16bit
  3709.         cmp     bl,4
  3710.         je      simple_instruction_32bit
  3711.         or      bl,bl
  3712.         jz      operand_size_not_specified
  3713.         jmp     invalid_operand_size
  3714. outs_instruction:
  3715.         lods    byte [esi]
  3716.         cmp     al,10h
  3717.         jne     invalid_operand
  3718.         lods    byte [esi]
  3719.         cmp     al,22h
  3720.         jne     invalid_operand
  3721.         lods    byte [esi]
  3722.         cmp     al,','
  3723.         jne     invalid_operand
  3724.         lods    byte [esi]
  3725.         call    get_size_operator
  3726.         cmp     al,'['
  3727.         jne     invalid_operand
  3728.         call    get_address
  3729.         or      eax,eax
  3730.         jnz     invalid_address
  3731.         or      bl,ch
  3732.         jnz     invalid_address
  3733.         cmp     bh,26h
  3734.         je      outs_address_16bit
  3735.         cmp     bh,46h
  3736.         je      outs_address_32bit
  3737.         cmp     bh,86h
  3738.         jne     invalid_address
  3739.         cmp     [code_type],64
  3740.         jne     invalid_address_size
  3741.         jmp     outs_store
  3742.       outs_address_32bit:
  3743.         call    address_32bit_prefix
  3744.         jmp     outs_store
  3745.       outs_address_16bit:
  3746.         cmp     [code_type],64
  3747.         je      invalid_address_size
  3748.         call    address_16bit_prefix
  3749.       outs_store:
  3750.         cmp     [segment_register],4
  3751.         je      outs_segment_ok
  3752.         call    store_segment_prefix
  3753.       outs_segment_ok:
  3754.         mov     al,6Eh
  3755.         mov     bl,[operand_size]
  3756.         cmp     bl,1
  3757.         je      simple_instruction
  3758.         inc     al
  3759.         cmp     bl,2
  3760.         je      simple_instruction_16bit
  3761.         cmp     bl,4
  3762.         je      simple_instruction_32bit
  3763.         or      bl,bl
  3764.         jz      operand_size_not_specified
  3765.         jmp     invalid_operand_size
  3766. xlat_instruction:
  3767.         lods    byte [esi]
  3768.         call    get_size_operator
  3769.         cmp     al,'['
  3770.         jne     invalid_operand
  3771.         call    get_address
  3772.         or      eax,eax
  3773.         jnz     invalid_address
  3774.         or      bl,ch
  3775.         jnz     invalid_address
  3776.         cmp     bh,23h
  3777.         je      xlat_address_16bit
  3778.         cmp     bh,43h
  3779.         je      xlat_address_32bit
  3780.         cmp     bh,83h
  3781.         jne     invalid_address
  3782.         cmp     [code_type],64
  3783.         jne     invalid_address_size
  3784.         jmp     xlat_store
  3785.       xlat_address_32bit:
  3786.         call    address_32bit_prefix
  3787.         jmp     xlat_store
  3788.       xlat_address_16bit:
  3789.         cmp     [code_type],64
  3790.         je      invalid_address_size
  3791.         call    address_16bit_prefix
  3792.       xlat_store:
  3793.         call    store_segment_prefix_if_necessary
  3794.         mov     al,0D7h
  3795.         cmp     [operand_size],1
  3796.         jbe     simple_instruction
  3797.         jmp     invalid_operand_size
  3798.  
  3799. pm_word_instruction:
  3800.         mov     ah,al
  3801.         shr     ah,4
  3802.         and     al,111b
  3803.         mov     [base_code],0Fh
  3804.         mov     [extended_code],ah
  3805.         mov     [postbyte_register],al
  3806.         lods    byte [esi]
  3807.         call    get_size_operator
  3808.         cmp     al,10h
  3809.         je      pm_reg
  3810.       pm_mem:
  3811.         cmp     al,'['
  3812.         jne     invalid_operand
  3813.         call    get_address
  3814.         mov     al,[operand_size]
  3815.         cmp     al,2
  3816.         je      pm_mem_store
  3817.         or      al,al
  3818.         jnz     invalid_operand_size
  3819.       pm_mem_store:
  3820.         call    store_instruction
  3821.         jmp     instruction_assembled
  3822.       pm_reg:
  3823.         lods    byte [esi]
  3824.         call    convert_register
  3825.         mov     bl,al
  3826.         cmp     ah,2
  3827.         jne     invalid_operand_size
  3828.         call    store_nomem_instruction
  3829.         jmp     instruction_assembled
  3830. pm_store_word_instruction:
  3831.         mov     ah,al
  3832.         shr     ah,4
  3833.         and     al,111b
  3834.         mov     [base_code],0Fh
  3835.         mov     [extended_code],ah
  3836.         mov     [postbyte_register],al
  3837.         lods    byte [esi]
  3838.         call    get_size_operator
  3839.         cmp     al,10h
  3840.         jne     pm_mem
  3841.         lods    byte [esi]
  3842.         call    convert_register
  3843.         mov     bl,al
  3844.         mov     al,ah
  3845.         call    operand_autodetect
  3846.         call    store_nomem_instruction
  3847.         jmp     instruction_assembled
  3848. lgdt_instruction:
  3849.         mov     [base_code],0Fh
  3850.         mov     [extended_code],1
  3851.         mov     [postbyte_register],al
  3852.         lods    byte [esi]
  3853.         call    get_size_operator
  3854.         cmp     al,'['
  3855.         jne     invalid_operand
  3856.         call    get_address
  3857.         mov     al,[operand_size]
  3858.         cmp     al,6
  3859.         je      lgdt_mem_48bit
  3860.         cmp     al,10
  3861.         je      lgdt_mem_80bit
  3862.         or      al,al
  3863.         jnz     invalid_operand_size
  3864.         jmp     lgdt_mem_store
  3865.       lgdt_mem_80bit:
  3866.         cmp     [code_type],64
  3867.         jne     illegal_instruction
  3868.         jmp     lgdt_mem_store
  3869.       lgdt_mem_48bit:
  3870.         cmp     [code_type],64
  3871.         je      illegal_instruction
  3872.         cmp     [postbyte_register],2
  3873.         jb      lgdt_mem_store
  3874.         call    operand_32bit
  3875.       lgdt_mem_store:
  3876.         call    store_instruction
  3877.         jmp     instruction_assembled
  3878. lar_instruction:
  3879.         mov     [extended_code],al
  3880.         mov     [base_code],0Fh
  3881.         lods    byte [esi]
  3882.         call    get_size_operator
  3883.         cmp     al,10h
  3884.         jne     invalid_operand
  3885.         lods    byte [esi]
  3886.         call    convert_register
  3887.         mov     [postbyte_register],al
  3888.         lods    byte [esi]
  3889.         cmp     al,','
  3890.         jne     invalid_operand
  3891.         xor     al,al
  3892.         xchg    al,[operand_size]
  3893.         call    operand_autodetect
  3894.         lods    byte [esi]
  3895.         call    get_size_operator
  3896.         cmp     al,10h
  3897.         je      lar_reg_reg
  3898.         cmp     al,'['
  3899.         jne     invalid_operand
  3900.         call    get_address
  3901.         mov     al,[operand_size]
  3902.         or      al,al
  3903.         jz      lar_reg_mem
  3904.         cmp     al,2
  3905.         jne     invalid_operand_size
  3906.       lar_reg_mem:
  3907.         call    store_instruction
  3908.         jmp     instruction_assembled
  3909.       lar_reg_reg:
  3910.         lods    byte [esi]
  3911.         call    convert_register
  3912.         cmp     ah,2
  3913.         jne     invalid_operand_size
  3914.         mov     bl,al
  3915.         call    store_nomem_instruction
  3916.         jmp     instruction_assembled
  3917. invlpg_instruction:
  3918.         mov     [base_code],0Fh
  3919.         mov     [extended_code],1
  3920.         mov     [postbyte_register],7
  3921.         lods    byte [esi]
  3922.         call    get_size_operator
  3923.         cmp     al,'['
  3924.         jne     invalid_operand
  3925.         call    get_address
  3926.         call    store_instruction
  3927.         jmp     instruction_assembled
  3928. swapgs_instruction:
  3929.         mov     [base_code],0Fh
  3930.         mov     [extended_code],1
  3931.         mov     [postbyte_register],7
  3932.         mov     bl,al
  3933.         call    store_nomem_instruction
  3934.         jmp     instruction_assembled
  3935.  
  3936. basic_486_instruction:
  3937.         mov     [base_code],0Fh
  3938.         mov     [extended_code],al
  3939.         lods    byte [esi]
  3940.         call    get_size_operator
  3941.         cmp     al,10h
  3942.         je      basic_486_reg
  3943.         cmp     al,'['
  3944.         jne     invalid_operand
  3945.         call    get_address
  3946.         push    edx ebx ecx
  3947.         lods    byte [esi]
  3948.         cmp     al,','
  3949.         jne     invalid_operand
  3950.         lods    byte [esi]
  3951.         call    get_size_operator
  3952.         cmp     al,10h
  3953.         jne     invalid_operand
  3954.         lods    byte [esi]
  3955.         call    convert_register
  3956.         mov     [postbyte_register],al
  3957.         pop     ecx ebx edx
  3958.         mov     al,ah
  3959.         cmp     al,1
  3960.         je      basic_486_mem_reg_8bit
  3961.         call    operand_autodetect
  3962.         inc     [extended_code]
  3963.       basic_486_mem_reg_8bit:
  3964.         call    store_instruction
  3965.         jmp     instruction_assembled
  3966.       basic_486_reg:
  3967.         lods    byte [esi]
  3968.         call    convert_register
  3969.         mov     [postbyte_register],al
  3970.         lods    byte [esi]
  3971.         cmp     al,','
  3972.         jne     invalid_operand
  3973.         lods    byte [esi]
  3974.         call    get_size_operator
  3975.         cmp     al,10h
  3976.         jne     invalid_operand
  3977.         lods    byte [esi]
  3978.         call    convert_register
  3979.         mov     bl,[postbyte_register]
  3980.         mov     [postbyte_register],al
  3981.         mov     al,ah
  3982.         cmp     al,1
  3983.         je      basic_486_reg_reg_8bit
  3984.         call    operand_autodetect
  3985.         inc     [extended_code]
  3986.       basic_486_reg_reg_8bit:
  3987.         call    store_nomem_instruction
  3988.         jmp     instruction_assembled
  3989. bswap_instruction:
  3990.         lods    byte [esi]
  3991.         call    get_size_operator
  3992.         cmp     al,10h
  3993.         jne     invalid_operand
  3994.         lods    byte [esi]
  3995.         call    convert_register
  3996.         test    al,1000b
  3997.         jz      bswap_reg_code_ok
  3998.         or      [rex_prefix],41h
  3999.         and     al,111b
  4000.       bswap_reg_code_ok:
  4001.         add     al,0C8h
  4002.         mov     [extended_code],al
  4003.         mov     [base_code],0Fh
  4004.         cmp     ah,8
  4005.         je      bswap_reg64
  4006.         cmp     ah,4
  4007.         jne     invalid_operand_size
  4008.         call    operand_32bit
  4009.         call    store_instruction_code
  4010.         jmp     instruction_assembled
  4011.       bswap_reg64:
  4012.         call    operand_64bit
  4013.         call    store_instruction_code
  4014.         jmp     instruction_assembled
  4015. cmpxchgx_instruction:
  4016.         mov     [base_code],0Fh
  4017.         mov     [extended_code],0C7h
  4018.         mov     [postbyte_register],al
  4019.         lods    byte [esi]
  4020.         call    get_size_operator
  4021.         cmp     al,'['
  4022.         jne     invalid_operand
  4023.         call    get_address
  4024.         mov     ah,1
  4025.         xchg    [postbyte_register],ah
  4026.         mov     al,[operand_size]
  4027.         or      al,al
  4028.         jz      cmpxchgx_size_ok
  4029.         cmp     al,ah
  4030.         jne     invalid_operand_size
  4031.       cmpxchgx_size_ok:
  4032.         cmp     ah,16
  4033.         jne     cmpxchgx_store
  4034.         call    operand_64bit
  4035.       cmpxchgx_store:
  4036.         call    store_instruction
  4037.         jmp     instruction_assembled
  4038. nop_instruction:
  4039.         mov     ah,[esi]
  4040.         cmp     ah,10h
  4041.         je      extended_nop
  4042.         cmp     ah,11h
  4043.         je      extended_nop
  4044.         cmp     ah,'['
  4045.         je      extended_nop
  4046.         stos    byte [edi]
  4047.         jmp     instruction_assembled
  4048.       extended_nop:
  4049.         mov     [base_code],0Fh
  4050.         mov     [extended_code],1Fh
  4051.         mov     [postbyte_register],0
  4052.         lods    byte [esi]
  4053.         call    get_size_operator
  4054.         cmp     al,10h
  4055.         je      extended_nop_reg
  4056.         cmp     al,'['
  4057.         jne     invalid_operand
  4058.         call    get_address
  4059.         mov     al,[operand_size]
  4060.         or      al,al
  4061.         jz      extended_nop_nosize
  4062.         call    operand_autodetect
  4063.       extended_nop_store:
  4064.         call    store_instruction
  4065.         jmp     instruction_assembled
  4066.       extended_nop_nosize:
  4067.         cmp     [error_line],0
  4068.         jne     extended_nop_store
  4069.         mov     eax,[current_line]
  4070.         mov     [error_line],eax
  4071.         mov     [error],operand_size_not_specified
  4072.         jmp     extended_nop_store
  4073.       extended_nop_reg:
  4074.         lods    byte [esi]
  4075.         call    convert_register
  4076.         mov     bl,al
  4077.         mov     al,ah
  4078.         call    operand_autodetect
  4079.         call    store_nomem_instruction
  4080.         jmp     instruction_assembled
  4081.  
  4082. basic_fpu_instruction:
  4083.         mov     [postbyte_register],al
  4084.         mov     [base_code],0D8h
  4085.         lods    byte [esi]
  4086.         call    get_size_operator
  4087.         cmp     al,10h
  4088.         je      basic_fpu_streg
  4089.         cmp     al,'['
  4090.         je      basic_fpu_mem
  4091.         dec     esi
  4092.         mov     ah,[postbyte_register]
  4093.         cmp     ah,2
  4094.         jb      invalid_operand
  4095.         cmp     ah,3
  4096.         ja      invalid_operand
  4097.         mov     bl,1
  4098.         call    store_nomem_instruction
  4099.         jmp     instruction_assembled
  4100.       basic_fpu_mem:
  4101.         call    get_address
  4102.         mov     al,[operand_size]
  4103.         cmp     al,4
  4104.         je      basic_fpu_mem_32bit
  4105.         cmp     al,8
  4106.         je      basic_fpu_mem_64bit
  4107.         or      al,al
  4108.         jnz     invalid_operand_size
  4109.         cmp     [error_line],0
  4110.         jne     basic_fpu_mem_32bit
  4111.         mov     eax,[current_line]
  4112.         mov     [error_line],eax
  4113.         mov     [error],operand_size_not_specified
  4114.       basic_fpu_mem_32bit:
  4115.         call    store_instruction
  4116.         jmp     instruction_assembled
  4117.       basic_fpu_mem_64bit:
  4118.         mov     [base_code],0DCh
  4119.         call    store_instruction
  4120.         jmp     instruction_assembled
  4121.       basic_fpu_streg:
  4122.         lods    byte [esi]
  4123.         call    convert_fpu_register
  4124.         mov     bl,al
  4125.         mov     ah,[postbyte_register]
  4126.         cmp     ah,2
  4127.         je      basic_fpu_single_streg
  4128.         cmp     ah,3
  4129.         je      basic_fpu_single_streg
  4130.         or      al,al
  4131.         jz      basic_fpu_st0
  4132.         test    ah,110b
  4133.         jz      basic_fpu_streg_st0
  4134.         xor     [postbyte_register],1
  4135.       basic_fpu_streg_st0:
  4136.         lods    byte [esi]
  4137.         cmp     al,','
  4138.         jne     invalid_operand
  4139.         lods    byte [esi]
  4140.         call    get_size_operator
  4141.         cmp     al,10h
  4142.         jne     invalid_operand
  4143.         lods    byte [esi]
  4144.         call    convert_fpu_register
  4145.         or      al,al
  4146.         jnz     invalid_operand
  4147.         mov     [base_code],0DCh
  4148.         call    store_nomem_instruction
  4149.         jmp     instruction_assembled
  4150.       basic_fpu_st0:
  4151.         lods    byte [esi]
  4152.         cmp     al,','
  4153.         jne     invalid_operand
  4154.         lods    byte [esi]
  4155.         call    get_size_operator
  4156.         cmp     al,10h
  4157.         jne     invalid_operand
  4158.         lods    byte [esi]
  4159.         call    convert_fpu_register
  4160.         mov     bl,al
  4161.       basic_fpu_single_streg:
  4162.         mov     [base_code],0D8h
  4163.         call    store_nomem_instruction
  4164.         jmp     instruction_assembled
  4165. simple_fpu_instruction:
  4166.         mov     ah,al
  4167.         or      ah,11000000b
  4168.         mov     al,0D9h
  4169.         stos    word [edi]
  4170.         jmp     instruction_assembled
  4171. fi_instruction:
  4172.         mov     [postbyte_register],al
  4173.         lods    byte [esi]
  4174.         call    get_size_operator
  4175.         cmp     al,'['
  4176.         jne     invalid_operand
  4177.         call    get_address
  4178.         mov     al,[operand_size]
  4179.         cmp     al,2
  4180.         je      fi_mem_16bit
  4181.         cmp     al,4
  4182.         je      fi_mem_32bit
  4183.         or      al,al
  4184.         jnz     invalid_operand_size
  4185.         cmp     [error_line],0
  4186.         jne     fi_mem_32bit
  4187.         mov     eax,[current_line]
  4188.         mov     [error_line],eax
  4189.         mov     [error],operand_size_not_specified
  4190.       fi_mem_32bit:
  4191.         mov     [base_code],0DAh
  4192.         call    store_instruction
  4193.         jmp     instruction_assembled
  4194.       fi_mem_16bit:
  4195.         mov     [base_code],0DEh
  4196.         call    store_instruction
  4197.         jmp     instruction_assembled
  4198. fld_instruction:
  4199.         mov     [postbyte_register],al
  4200.         lods    byte [esi]
  4201.         call    get_size_operator
  4202.         cmp     al,10h
  4203.         je      fld_streg
  4204.         cmp     al,'['
  4205.         jne     invalid_operand
  4206.         call    get_address
  4207.         mov     al,[operand_size]
  4208.         cmp     al,4
  4209.         je      fld_mem_32bit
  4210.         cmp     al,8
  4211.         je      fld_mem_64bit
  4212.         cmp     al,10
  4213.         je      fld_mem_80bit
  4214.         or      al,al
  4215.         jnz     invalid_operand_size
  4216.         cmp     [error_line],0
  4217.         jne     fld_mem_32bit
  4218.         mov     eax,[current_line]
  4219.         mov     [error_line],eax
  4220.         mov     [error],operand_size_not_specified
  4221.       fld_mem_32bit:
  4222.         mov     [base_code],0D9h
  4223.         call    store_instruction
  4224.         jmp     instruction_assembled
  4225.       fld_mem_64bit:
  4226.         mov     [base_code],0DDh
  4227.         call    store_instruction
  4228.         jmp     instruction_assembled
  4229.       fld_mem_80bit:
  4230.         mov     al,[postbyte_register]
  4231.         cmp     al,0
  4232.         je      fld_mem_80bit_store
  4233.         dec     [postbyte_register]
  4234.         cmp     al,3
  4235.         je      fld_mem_80bit_store
  4236.         jmp     invalid_operand_size
  4237.       fld_mem_80bit_store:
  4238.         add     [postbyte_register],5
  4239.         mov     [base_code],0DBh
  4240.         call    store_instruction
  4241.         jmp     instruction_assembled
  4242.       fld_streg:
  4243.         lods    byte [esi]
  4244.         call    convert_fpu_register
  4245.         mov     bl,al
  4246.         cmp     [postbyte_register],2
  4247.         jae     fst_streg
  4248.         mov     [base_code],0D9h
  4249.         call    store_nomem_instruction
  4250.         jmp     instruction_assembled
  4251.       fst_streg:
  4252.         mov     [base_code],0DDh
  4253.         call    store_nomem_instruction
  4254.         jmp     instruction_assembled
  4255. fild_instruction:
  4256.         mov     [postbyte_register],al
  4257.         lods    byte [esi]
  4258.         call    get_size_operator
  4259.         cmp     al,'['
  4260.         jne     invalid_operand
  4261.         call    get_address
  4262.         mov     al,[operand_size]
  4263.         cmp     al,2
  4264.         je      fild_mem_16bit
  4265.         cmp     al,4
  4266.         je      fild_mem_32bit
  4267.         cmp     al,8
  4268.         je      fild_mem_64bit
  4269.         or      al,al
  4270.         jnz     invalid_operand_size
  4271.         cmp     [error_line],0
  4272.         jne     fild_mem_32bit
  4273.         mov     eax,[current_line]
  4274.         mov     [error_line],eax
  4275.         mov     [error],operand_size_not_specified
  4276.       fild_mem_32bit:
  4277.         mov     [base_code],0DBh
  4278.         call    store_instruction
  4279.         jmp     instruction_assembled
  4280.       fild_mem_16bit:
  4281.         mov     [base_code],0DFh
  4282.         call    store_instruction
  4283.         jmp     instruction_assembled
  4284.       fild_mem_64bit:
  4285.         mov     al,[postbyte_register]
  4286.         cmp     al,1
  4287.         je      fisttp_64bit_store
  4288.         jb      fild_mem_64bit_store
  4289.         dec     [postbyte_register]
  4290.         cmp     al,3
  4291.         je      fild_mem_64bit_store
  4292.         jmp     invalid_operand_size
  4293.       fild_mem_64bit_store:
  4294.         add     [postbyte_register],5
  4295.         mov     [base_code],0DFh
  4296.         call    store_instruction
  4297.         jmp     instruction_assembled
  4298.       fisttp_64bit_store:
  4299.         mov     [base_code],0DDh
  4300.         call    store_instruction
  4301.         jmp     instruction_assembled
  4302. fbld_instruction:
  4303.         mov     [postbyte_register],al
  4304.         lods    byte [esi]
  4305.         call    get_size_operator
  4306.         cmp     al,'['
  4307.         jne     invalid_operand
  4308.         call    get_address
  4309.         mov     al,[operand_size]
  4310.         or      al,al
  4311.         jz      fbld_mem_80bit
  4312.         cmp     al,10
  4313.         je      fbld_mem_80bit
  4314.         jmp     invalid_operand_size
  4315.       fbld_mem_80bit:
  4316.         mov     [base_code],0DFh
  4317.         call    store_instruction
  4318.         jmp     instruction_assembled
  4319. faddp_instruction:
  4320.         mov     [postbyte_register],al
  4321.         mov     [base_code],0DEh
  4322.         mov     edx,esi
  4323.         lods    byte [esi]
  4324.         call    get_size_operator
  4325.         cmp     al,10h
  4326.         je      faddp_streg
  4327.         mov     esi,edx
  4328.         mov     bl,1
  4329.         call    store_nomem_instruction
  4330.         jmp     instruction_assembled
  4331.       faddp_streg:
  4332.         lods    byte [esi]
  4333.         call    convert_fpu_register
  4334.         mov     bl,al
  4335.         lods    byte [esi]
  4336.         cmp     al,','
  4337.         jne     invalid_operand
  4338.         lods    byte [esi]
  4339.         call    get_size_operator
  4340.         cmp     al,10h
  4341.         jne     invalid_operand
  4342.         lods    byte [esi]
  4343.         call    convert_fpu_register
  4344.         or      al,al
  4345.         jnz     invalid_operand
  4346.         call    store_nomem_instruction
  4347.         jmp     instruction_assembled
  4348. fcompp_instruction:
  4349.         mov     ax,0D9DEh
  4350.         stos    word [edi]
  4351.         jmp     instruction_assembled
  4352. fucompp_instruction:
  4353.         mov     ax,0E9DAh
  4354.         stos    word [edi]
  4355.         jmp     instruction_assembled
  4356. fxch_instruction:
  4357.         mov     dx,01D9h
  4358.         jmp     fpu_single_operand
  4359. ffreep_instruction:
  4360.         mov     dx,00DFh
  4361.         jmp     fpu_single_operand
  4362. ffree_instruction:
  4363.         mov     dl,0DDh
  4364.         mov     dh,al
  4365.       fpu_single_operand:
  4366.         mov     ebx,esi
  4367.         lods    byte [esi]
  4368.         call    get_size_operator
  4369.         cmp     al,10h
  4370.         je      fpu_streg
  4371.         or      dh,dh
  4372.         jz      invalid_operand
  4373.         mov     esi,ebx
  4374.         shl     dh,3
  4375.         or      dh,11000001b
  4376.         mov     ax,dx
  4377.         stos    word [edi]
  4378.         jmp     instruction_assembled
  4379.       fpu_streg:
  4380.         lods    byte [esi]
  4381.         call    convert_fpu_register
  4382.         shl     dh,3
  4383.         or      dh,al
  4384.         or      dh,11000000b
  4385.         mov     ax,dx
  4386.         stos    word [edi]
  4387.         jmp     instruction_assembled
  4388. fstenv_instruction:
  4389.         mov     byte [edi],9Bh
  4390.         inc     edi
  4391. fldenv_instruction:
  4392.         mov     [base_code],0D9h
  4393.         jmp     fpu_mem
  4394. fsave_instruction:
  4395.         mov     byte [edi],9Bh
  4396.         inc     edi
  4397. fnsave_instruction:
  4398.         mov     [base_code],0DDh
  4399.       fpu_mem:
  4400.         mov     [postbyte_register],al
  4401.         lods    byte [esi]
  4402.         call    get_size_operator
  4403.         cmp     al,'['
  4404.         jne     invalid_operand
  4405.         call    get_address
  4406.         cmp     [operand_size],0
  4407.         jne     invalid_operand_size
  4408.         call    store_instruction
  4409.         jmp     instruction_assembled
  4410. fstcw_instruction:
  4411.         mov     byte [edi],9Bh
  4412.         inc     edi
  4413. fldcw_instruction:
  4414.         mov     [postbyte_register],al
  4415.         mov     [base_code],0D9h
  4416.         lods    byte [esi]
  4417.         call    get_size_operator
  4418.         cmp     al,'['
  4419.         jne     invalid_operand
  4420.         call    get_address
  4421.         mov     al,[operand_size]
  4422.         or      al,al
  4423.         jz      fldcw_mem_16bit
  4424.         cmp     al,2
  4425.         je      fldcw_mem_16bit
  4426.         jmp     invalid_operand_size
  4427.       fldcw_mem_16bit:
  4428.         call    store_instruction
  4429.         jmp     instruction_assembled
  4430. fstsw_instruction:
  4431.         mov     al,9Bh
  4432.         stos    byte [edi]
  4433. fnstsw_instruction:
  4434.         mov     [base_code],0DDh
  4435.         mov     [postbyte_register],7
  4436.         lods    byte [esi]
  4437.         call    get_size_operator
  4438.         cmp     al,10h
  4439.         je      fstsw_reg
  4440.         cmp     al,'['
  4441.         jne     invalid_operand
  4442.         call    get_address
  4443.         mov     al,[operand_size]
  4444.         or      al,al
  4445.         jz      fstsw_mem_16bit
  4446.         cmp     al,2
  4447.         je      fstsw_mem_16bit
  4448.         jmp     invalid_operand_size
  4449.       fstsw_mem_16bit:
  4450.         call    store_instruction
  4451.         jmp     instruction_assembled
  4452.       fstsw_reg:
  4453.         lods    byte [esi]
  4454.         call    convert_register
  4455.         cmp     ax,0200h
  4456.         jne     invalid_operand
  4457.         mov     ax,0E0DFh
  4458.         stos    word [edi]
  4459.         jmp     instruction_assembled
  4460. finit_instruction:
  4461.         mov     byte [edi],9Bh
  4462.         inc     edi
  4463. fninit_instruction:
  4464.         mov     ah,al
  4465.         mov     al,0DBh
  4466.         stos    word [edi]
  4467.         jmp     instruction_assembled
  4468. fcmov_instruction:
  4469.         mov     dh,0DAh
  4470.         jmp     fcomi_streg
  4471. fcomi_instruction:
  4472.         mov     dh,0DBh
  4473.         jmp     fcomi_streg
  4474. fcomip_instruction:
  4475.         mov     dh,0DFh
  4476.       fcomi_streg:
  4477.         mov     dl,al
  4478.         lods    byte [esi]
  4479.         call    get_size_operator
  4480.         cmp     al,10h
  4481.         jne     invalid_operand
  4482.         lods    byte [esi]
  4483.         call    convert_fpu_register
  4484.         mov     ah,al
  4485.         cmp     byte [esi],','
  4486.         je      fcomi_st0_streg
  4487.         add     ah,dl
  4488.         mov     al,dh
  4489.         stos    word [edi]
  4490.         jmp     instruction_assembled
  4491.       fcomi_st0_streg:
  4492.         or      ah,ah
  4493.         jnz     invalid_operand
  4494.         inc     esi
  4495.         lods    byte [esi]
  4496.         call    get_size_operator
  4497.         cmp     al,10h
  4498.         jne     invalid_operand
  4499.         lods    byte [esi]
  4500.         call    convert_fpu_register
  4501.         mov     ah,al
  4502.         add     ah,dl
  4503.         mov     al,dh
  4504.         stos    word [edi]
  4505.         jmp     instruction_assembled
  4506.  
  4507. basic_mmx_instruction:
  4508.         mov     [base_code],0Fh
  4509.         mov     [extended_code],al
  4510.       mmx_instruction:
  4511.         lods    byte [esi]
  4512.         call    get_size_operator
  4513.         cmp     al,10h
  4514.         jne     invalid_operand
  4515.         lods    byte [esi]
  4516.         call    convert_mmx_register
  4517.         call    make_mmx_prefix
  4518.         mov     [postbyte_register],al
  4519.         lods    byte [esi]
  4520.         cmp     al,','
  4521.         jne     invalid_operand
  4522.         lods    byte [esi]
  4523.         call    get_size_operator
  4524.         cmp     al,10h
  4525.         je      mmx_mmreg_mmreg
  4526.         cmp     al,'['
  4527.         jne     invalid_operand
  4528.       mmx_mmreg_mem:
  4529.         call    get_address
  4530.         call    store_instruction
  4531.         jmp     instruction_assembled
  4532.       mmx_mmreg_mmreg:
  4533.         lods    byte [esi]
  4534.         call    convert_mmx_register
  4535.         mov     bl,al
  4536.         call    store_nomem_instruction
  4537.         jmp     instruction_assembled
  4538. mmx_ps_instruction:
  4539.         mov     [base_code],0Fh
  4540.         mov     [extended_code],al
  4541.         lods    byte [esi]
  4542.         call    get_size_operator
  4543.         cmp     al,10h
  4544.         jne     invalid_operand
  4545.         lods    byte [esi]
  4546.         call    convert_mmx_register
  4547.         call    make_mmx_prefix
  4548.         mov     [postbyte_register],al
  4549.         lods    byte [esi]
  4550.         cmp     al,','
  4551.         jne     invalid_operand
  4552.         mov     [operand_size],0
  4553.         lods    byte [esi]
  4554.         call    get_size_operator
  4555.         cmp     al,10h
  4556.         je      mmx_mmreg_mmreg
  4557.         cmp     al,'('
  4558.         je      mmx_ps_mmreg_imm8
  4559.         cmp     al,'['
  4560.         je      mmx_mmreg_mem
  4561.         jmp     invalid_operand
  4562.       mmx_ps_mmreg_imm8:
  4563.         call    get_byte_value
  4564.         mov     byte [value],al
  4565.         test    [operand_size],not 1
  4566.         jnz     invalid_value
  4567.         mov     bl,[extended_code]
  4568.         mov     al,bl
  4569.         shr     bl,4
  4570.         and     al,1111b
  4571.         add     al,70h
  4572.         mov     [extended_code],al
  4573.         sub     bl,0Ch
  4574.         shl     bl,1
  4575.         xchg    bl,[postbyte_register]
  4576.         call    store_nomem_instruction
  4577.         mov     al,byte [value]
  4578.         stos    byte [edi]
  4579.         jmp     instruction_assembled
  4580. pextrw_instruction:
  4581.         mov     [base_code],0Fh
  4582.         mov     [extended_code],al
  4583.         lods    byte [esi]
  4584.         call    get_size_operator
  4585.         cmp     al,10h
  4586.         jne     invalid_operand
  4587.         lods    byte [esi]
  4588.         call    convert_register
  4589.         cmp     ah,4
  4590.         jnz     invalid_operand_size
  4591.         mov     [postbyte_register],al
  4592.         mov     [operand_size],0
  4593.         lods    byte [esi]
  4594.         cmp     al,','
  4595.         jne     invalid_operand
  4596.         lods    byte [esi]
  4597.         call    get_size_operator
  4598.         cmp     al,10h
  4599.         jne     invalid_operand
  4600.         lods    byte [esi]
  4601.         call    convert_mmx_register
  4602.         mov     bl,al
  4603.         call    make_mmx_prefix
  4604.         cmp     [extended_code],0C5h
  4605.         je      mmx_nomem_imm8
  4606.         call    store_nomem_instruction
  4607.         jmp     instruction_assembled
  4608.       mmx_imm8:
  4609.         push    ebx ecx edx
  4610.         mov     [operand_size],0
  4611.         lods    byte [esi]
  4612.         cmp     al,','
  4613.         jne     invalid_operand
  4614.         lods    byte [esi]
  4615.         call    get_size_operator
  4616.         test    ah,not 1
  4617.         jnz     invalid_operand_size
  4618.         cmp     al,'('
  4619.         jne     invalid_operand
  4620.         call    get_byte_value
  4621.         mov     byte [value],al
  4622.         pop     edx ecx ebx
  4623.         call    store_instruction_with_imm8
  4624.         jmp     instruction_assembled
  4625.       mmx_nomem_imm8:
  4626.         call    store_nomem_instruction
  4627.         mov     [operand_size],0
  4628.         lods    byte [esi]
  4629.         cmp     al,','
  4630.         jne     invalid_operand
  4631.         lods    byte [esi]
  4632.         call    get_size_operator
  4633.         test    ah,not 1
  4634.         jnz     invalid_operand_size
  4635.         cmp     al,'('
  4636.         jne     invalid_operand
  4637.         call    get_byte_value
  4638.         stosb
  4639.         jmp     instruction_assembled
  4640. pinsrw_instruction:
  4641.         mov     [extended_code],al
  4642.         mov     [base_code],0Fh
  4643.         lods    byte [esi]
  4644.         call    get_size_operator
  4645.         cmp     al,10h
  4646.         jne     invalid_operand
  4647.         lods    byte [esi]
  4648.         call    convert_mmx_register
  4649.         call    make_mmx_prefix
  4650.         mov     [postbyte_register],al
  4651.         mov     [operand_size],0
  4652.         lods    byte [esi]
  4653.         cmp     al,','
  4654.         jne     invalid_operand
  4655.         lods    byte [esi]
  4656.         call    get_size_operator
  4657.         cmp     al,10h
  4658.         je      pinsrw_mmreg_reg
  4659.         cmp     al,'['
  4660.         jne     invalid_operand
  4661.         call    get_address
  4662.         cmp     [operand_size],0
  4663.         je      mmx_imm8
  4664.         cmp     [operand_size],2
  4665.         jne     invalid_operand_size
  4666.         jmp     mmx_imm8
  4667.       pinsrw_mmreg_reg:
  4668.         lods    byte [esi]
  4669.         call    convert_register
  4670.         cmp     ah,4
  4671.         jne     invalid_operand_size
  4672.         mov     bl,al
  4673.         jmp     mmx_nomem_imm8
  4674. pshufw_instruction:
  4675.         mov     [mmx_size],8
  4676.         mov     [operand_prefix],al
  4677.         jmp     pshuf_instruction
  4678. pshufd_instruction:
  4679.         mov     [mmx_size],16
  4680.         mov     [operand_prefix],al
  4681.       pshuf_instruction:
  4682.         mov     [base_code],0Fh
  4683.         mov     [extended_code],70h
  4684.         lods    byte [esi]
  4685.         call    get_size_operator
  4686.         cmp     al,10h
  4687.         jne     invalid_operand
  4688.         lods    byte [esi]
  4689.         call    convert_mmx_register
  4690.         cmp     ah,[mmx_size]
  4691.         jne     invalid_operand_size
  4692.         mov     [postbyte_register],al
  4693.         lods    byte [esi]
  4694.         cmp     al,','
  4695.         jne     invalid_operand
  4696.         lods    byte [esi]
  4697.         call    get_size_operator
  4698.         cmp     al,10h
  4699.         je      pshuf_mmreg_mmreg
  4700.         cmp     al,'['
  4701.         jne     invalid_operand
  4702.         call    get_address
  4703.         jmp     mmx_imm8
  4704.       pshuf_mmreg_mmreg:
  4705.         lods    byte [esi]
  4706.         call    convert_mmx_register
  4707.         mov     bl,al
  4708.         jmp     mmx_nomem_imm8
  4709. movd_instruction:
  4710.         mov     [base_code],0Fh
  4711.         mov     [extended_code],7Eh
  4712.         lods    byte [esi]
  4713.         call    get_size_operator
  4714.         cmp     al,10h
  4715.         je      movd_reg
  4716.         cmp     al,'['
  4717.         jne     invalid_operand
  4718.         call    get_address
  4719.         test    [operand_size],not 4
  4720.         jnz     invalid_operand_size
  4721.         mov     [operand_size],0
  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.         jne     invalid_operand
  4729.         lods    byte [esi]
  4730.         call    convert_mmx_register
  4731.         call    make_mmx_prefix
  4732.         mov     [postbyte_register],al
  4733.         call    store_instruction
  4734.         jmp     instruction_assembled
  4735.       movd_reg:
  4736.         lods    byte [esi]
  4737.         cmp     al,0B0h
  4738.         jae     movd_mmreg
  4739.         call    convert_register
  4740.         cmp     ah,4
  4741.         jne     invalid_operand_size
  4742.         mov     [operand_size],0
  4743.         mov     bl,al
  4744.         lods    byte [esi]
  4745.         cmp     al,','
  4746.         jne     invalid_operand
  4747.         lods    byte [esi]
  4748.         call    get_size_operator
  4749.         cmp     al,10h
  4750.         jne     invalid_operand
  4751.         lods    byte [esi]
  4752.         call    convert_mmx_register
  4753.         mov     [postbyte_register],al
  4754.         call    make_mmx_prefix
  4755.         call    store_nomem_instruction
  4756.         jmp     instruction_assembled
  4757.       movd_mmreg:
  4758.         mov     [extended_code],6Eh
  4759.         call    convert_mmx_register
  4760.         call    make_mmx_prefix
  4761.         mov     [postbyte_register],al
  4762.         mov     [operand_size],0
  4763.         lods    byte [esi]
  4764.         cmp     al,','
  4765.         jne     invalid_operand
  4766.         lods    byte [esi]
  4767.         call    get_size_operator
  4768.         cmp     al,10h
  4769.         je      movd_mmreg_reg
  4770.         cmp     al,'['
  4771.         jne     invalid_operand
  4772.         call    get_address
  4773.         test    [operand_size],not 4
  4774.         jnz     invalid_operand_size
  4775.         call    store_instruction
  4776.         jmp     instruction_assembled
  4777.       movd_mmreg_reg:
  4778.         lods    byte [esi]
  4779.         call    convert_register
  4780.         cmp     ah,4
  4781.         jne     invalid_operand_size
  4782.         mov     bl,al
  4783.         call    store_nomem_instruction
  4784.         jmp     instruction_assembled
  4785.       make_mmx_prefix:
  4786.         cmp     [operand_size],16
  4787.         jne     no_mmx_prefix
  4788.         mov     [operand_prefix],66h
  4789.       no_mmx_prefix:
  4790.         ret
  4791. movq_instruction:
  4792.         mov     [base_code],0Fh
  4793.         lods    byte [esi]
  4794.         call    get_size_operator
  4795.         cmp     al,10h
  4796.         je      movq_reg
  4797.         cmp     al,'['
  4798.         jne     invalid_operand
  4799.         call    get_address
  4800.         test    [operand_size],not 8
  4801.         jnz     invalid_operand_size
  4802.         mov     [operand_size],0
  4803.         lods    byte [esi]
  4804.         cmp     al,','
  4805.         jne     invalid_operand
  4806.         lods    byte [esi]
  4807.         cmp     al,10h
  4808.         jne     invalid_operand
  4809.         lods    byte [esi]
  4810.         call    convert_mmx_register
  4811.         mov     [postbyte_register],al
  4812.         cmp     ah,16
  4813.         je      movq_mem_xmmreg
  4814.         mov     [extended_code],7Fh
  4815.         call    store_instruction
  4816.         jmp     instruction_assembled
  4817.      movq_mem_xmmreg:
  4818.         mov     [extended_code],0D6h
  4819.         mov     [operand_prefix],66h
  4820.         call    store_instruction
  4821.         jmp     instruction_assembled
  4822.      movq_reg:
  4823.         lods    byte [esi]
  4824.         cmp     al,0B0h
  4825.         jae     movq_mmreg
  4826.         call    convert_register
  4827.         cmp     ah,8
  4828.         jne     invalid_operand_size
  4829.         mov     bl,al
  4830.         lods    byte [esi]
  4831.         cmp     al,','
  4832.         jne     invalid_operand
  4833.         lods    byte [esi]
  4834.         call    get_size_operator
  4835.         cmp     al,10h
  4836.         jne     invalid_operand
  4837.         lods    byte [esi]
  4838.         call    convert_mmx_register
  4839.         mov     [postbyte_register],al
  4840.         call    make_mmx_prefix
  4841.         mov     [extended_code],7Eh
  4842.         call    operand_64bit
  4843.         call    store_nomem_instruction
  4844.         jmp     instruction_assembled
  4845.      movq_mmreg:
  4846.         call    convert_mmx_register
  4847.         mov     [postbyte_register],al
  4848.         mov     [extended_code],6Fh
  4849.         mov     [mmx_size],ah
  4850.         cmp     ah,16
  4851.         jne     movq_mmreg_
  4852.         mov     [extended_code],7Eh
  4853.         mov     [operand_prefix],0F3h
  4854.       movq_mmreg_:
  4855.         lods    byte [esi]
  4856.         cmp     al,','
  4857.         jne     invalid_operand
  4858.         mov     [operand_size],0
  4859.         lods    byte [esi]
  4860.         call    get_size_operator
  4861.         cmp     al,10h
  4862.         je      movq_mmreg_reg
  4863.         call    get_address
  4864.         test    [operand_size],not 8
  4865.         jnz     invalid_operand_size
  4866.         call    store_instruction
  4867.         jmp     instruction_assembled
  4868.       movq_mmreg_reg:
  4869.         lods    byte [esi]
  4870.         cmp     al,0B0h
  4871.         jae     movq_mmreg_mmreg
  4872.         mov     [operand_size],0
  4873.         call    convert_register
  4874.         cmp     ah,8
  4875.         jne     invalid_operand_size
  4876.         mov     [extended_code],6Eh
  4877.         mov     [operand_prefix],0
  4878.         mov     bl,al
  4879.         cmp     [mmx_size],16
  4880.         jne     movq_mmreg_reg_store
  4881.         mov     [operand_prefix],66h
  4882.       movq_mmreg_reg_store:
  4883.         call    operand_64bit
  4884.         call    store_nomem_instruction
  4885.         jmp     instruction_assembled
  4886.       movq_mmreg_mmreg:
  4887.         call    convert_mmx_register
  4888.         mov     bl,al
  4889.         call    store_nomem_instruction
  4890.         jmp     instruction_assembled
  4891. movdq_instruction:
  4892.         mov     [operand_prefix],al
  4893.         mov     [base_code],0Fh
  4894.         mov     [extended_code],6Fh
  4895.         lods    byte [esi]
  4896.         call    get_size_operator
  4897.         cmp     al,10h
  4898.         je      movdq_mmreg
  4899.         cmp     al,'['
  4900.         jne     invalid_operand
  4901.         call    get_address
  4902.         lods    byte [esi]
  4903.         cmp     al,','
  4904.         jne     invalid_operand
  4905.         lods    byte [esi]
  4906.         call    get_size_operator
  4907.         cmp     al,10h
  4908.         jne     invalid_operand
  4909.         lods    byte [esi]
  4910.         call    convert_mmx_register
  4911.         cmp     ah,16
  4912.         jne     invalid_operand_size
  4913.         mov     [postbyte_register],al
  4914.         mov     [extended_code],7Fh
  4915.         call    store_instruction
  4916.         jmp     instruction_assembled
  4917.       movdq_mmreg:
  4918.         lods    byte [esi]
  4919.         call    convert_mmx_register
  4920.         cmp     ah,16
  4921.         jne     invalid_operand_size
  4922.         mov     [postbyte_register],al
  4923.         lods    byte [esi]
  4924.         cmp     al,','
  4925.         jne     invalid_operand
  4926.         lods    byte [esi]
  4927.         call    get_size_operator
  4928.         cmp     al,10h
  4929.         je      movdq_mmreg_mmreg
  4930.         cmp     al,'['
  4931.         jne     invalid_operand
  4932.         call    get_address
  4933.         call    store_instruction
  4934.         jmp     instruction_assembled
  4935.       movdq_mmreg_mmreg:
  4936.         lods    byte [esi]
  4937.         call    convert_mmx_register
  4938.         cmp     ah,16
  4939.         jne     invalid_operand_size
  4940.         mov     bl,al
  4941.         call    store_nomem_instruction
  4942.         jmp     instruction_assembled
  4943. lddqu_instruction:
  4944.         lods    byte [esi]
  4945.         call    get_size_operator
  4946.         cmp     al,10h
  4947.         jne     invalid_operand
  4948.         lods    byte [esi]
  4949.         call    convert_mmx_register
  4950.         cmp     ah,16
  4951.         jne     invalid_operand_size
  4952.         push    eax
  4953.         lods    byte [esi]
  4954.         cmp     al,','
  4955.         jne     invalid_operand
  4956.         lods    byte [esi]
  4957.         call    get_size_operator
  4958.         cmp     al,'['
  4959.         jne     invalid_operand
  4960.         call    get_address
  4961.         pop     eax
  4962.         mov     [postbyte_register],al
  4963.         mov     [operand_prefix],0F2h
  4964.         mov     [base_code],0Fh
  4965.         mov     [extended_code],0F0h
  4966.         call    store_instruction
  4967.         jmp     instruction_assembled
  4968. movq2dq_instruction:
  4969.         lods    byte [esi]
  4970.         call    get_size_operator
  4971.         cmp     al,10h
  4972.         jne     invalid_operand
  4973.         lods    byte [esi]
  4974.         call    convert_mmx_register
  4975.         cmp     ah,16
  4976.         jne     invalid_operand_size
  4977.         mov     [postbyte_register],al
  4978.         mov     [operand_size],0
  4979.         lods    byte [esi]
  4980.         cmp     al,','
  4981.         jne     invalid_operand
  4982.         lods    byte [esi]
  4983.         call    get_size_operator
  4984.         cmp     al,10h
  4985.         jne     invalid_operand
  4986.         lods    byte [esi]
  4987.         call    convert_mmx_register
  4988.         cmp     ah,8
  4989.         jne     invalid_operand_size
  4990.         mov     bl,al
  4991.         mov     [operand_prefix],0F3h
  4992.         mov     [base_code],0Fh
  4993.         mov     [extended_code],0D6h
  4994.         call    store_nomem_instruction
  4995.         jmp     instruction_assembled
  4996. movdq2q_instruction:
  4997.         lods    byte [esi]
  4998.         call    get_size_operator
  4999.         cmp     al,10h
  5000.         jne     invalid_operand
  5001.         lods    byte [esi]
  5002.         call    convert_mmx_register
  5003.         cmp     ah,8
  5004.         jne     invalid_operand_size
  5005.         mov     [postbyte_register],al
  5006.         mov     [operand_size],0
  5007.         lods    byte [esi]
  5008.         cmp     al,','
  5009.         jne     invalid_operand
  5010.         lods    byte [esi]
  5011.         call    get_size_operator
  5012.         cmp     al,10h
  5013.         jne     invalid_operand
  5014.         lods    byte [esi]
  5015.         call    convert_mmx_register
  5016.         cmp     ah,16
  5017.         jne     invalid_operand_size
  5018.         mov     bl,al
  5019.         mov     [operand_prefix],0F2h
  5020.         mov     [base_code],0Fh
  5021.         mov     [extended_code],0D6h
  5022.         call    store_nomem_instruction
  5023.         jmp     instruction_assembled
  5024.  
  5025. sse_ps_instruction_imm8:
  5026.         mov     [immediate_size],8
  5027. sse_ps_instruction:
  5028.         mov     [mmx_size],16
  5029.         jmp     sse_instruction
  5030. sse_pd_instruction_imm8:
  5031.         mov     [immediate_size],8
  5032. sse_pd_instruction:
  5033.         mov     [mmx_size],16
  5034.         mov     [operand_prefix],66h
  5035.         jmp     sse_instruction
  5036. sse_ss_instruction:
  5037.         mov     [mmx_size],4
  5038.         mov     [operand_prefix],0F3h
  5039.         jmp     sse_instruction
  5040. sse_sd_instruction:
  5041.         mov     [mmx_size],8
  5042.         mov     [operand_prefix],0F2h
  5043.         jmp     sse_instruction
  5044. comiss_instruction:
  5045.         mov     [mmx_size],4
  5046.         jmp     sse_instruction
  5047. comisd_instruction:
  5048.         mov     [mmx_size],8
  5049.         mov     [operand_prefix],66h
  5050.         jmp     sse_instruction
  5051. cvtps2pd_instruction:
  5052.         mov     [mmx_size],8
  5053.         jmp     sse_instruction
  5054. cvtpd2dq_instruction:
  5055.         mov     [mmx_size],16
  5056.         mov     [operand_prefix],0F2h
  5057.         jmp     sse_instruction
  5058. cvtdq2pd_instruction:
  5059.         mov     [mmx_size],16
  5060.         mov     [operand_prefix],0F3h
  5061. sse_instruction:
  5062.         mov     [base_code],0Fh
  5063.         mov     [extended_code],al
  5064.         lods    byte [esi]
  5065.         call    get_size_operator
  5066.         cmp     al,10h
  5067.         jne     invalid_operand
  5068.       sse_xmmreg:
  5069.         lods    byte [esi]
  5070.         call    convert_mmx_register
  5071.         cmp     ah,16
  5072.         jne     invalid_operand_size
  5073.       sse_reg:
  5074.         mov     [postbyte_register],al
  5075.         mov     [operand_size],0
  5076.         lods    byte [esi]
  5077.         cmp     al,','
  5078.         jne     invalid_operand
  5079.         lods    byte [esi]
  5080.         call    get_size_operator
  5081.         cmp     al,10h
  5082.         je      sse_xmmreg_xmmreg
  5083.       sse_reg_mem:
  5084.         cmp     al,'['
  5085.         jne     invalid_operand
  5086.         call    get_address
  5087.         cmp     [operand_size],0
  5088.         je      sse_mem_size_ok
  5089.         mov     al,[mmx_size]
  5090.         cmp     [operand_size],al
  5091.         jne     invalid_operand_size
  5092.       sse_mem_size_ok:
  5093.         cmp     [immediate_size],8
  5094.         je      mmx_imm8
  5095.         cmp     [immediate_size],-1
  5096.         jne     sse_ok
  5097.         call    take_additional_xmm0
  5098.       sse_ok:
  5099.         call    store_instruction
  5100.         jmp     instruction_assembled
  5101.       sse_xmmreg_xmmreg:
  5102.         cmp     [operand_prefix],66h
  5103.         jne     sse_xmmreg_xmmreg_ok
  5104.         cmp     [extended_code],12h
  5105.         je      invalid_operand
  5106.         cmp     [extended_code],16h
  5107.         je      invalid_operand
  5108.       sse_xmmreg_xmmreg_ok:
  5109.         lods    byte [esi]
  5110.         call    convert_mmx_register
  5111.         cmp     ah,16
  5112.         jne     invalid_operand_size
  5113.         mov     bl,al
  5114.         cmp     [immediate_size],8
  5115.         je      mmx_nomem_imm8
  5116.         cmp     [immediate_size],-1
  5117.         jne     sse_nomem_ok
  5118.         call    take_additional_xmm0
  5119.       sse_nomem_ok:
  5120.         call    store_nomem_instruction
  5121.         jmp     instruction_assembled
  5122.       take_additional_xmm0:
  5123.         lods    byte [esi]
  5124.         cmp     al,','
  5125.         jne     invalid_operand
  5126.         lods    byte [esi]
  5127.         cmp     al,10h
  5128.         jne     invalid_operand
  5129.         lods    byte [esi]
  5130.         call    convert_mmx_register
  5131.         cmp     ah,16
  5132.         jne     invalid_operand_size
  5133.         test    al,al
  5134.         jnz     invalid_operand
  5135.         ret
  5136.  
  5137. ps_dq_instruction:
  5138.         mov     [postbyte_register],al
  5139.         mov     [operand_prefix],66h
  5140.         mov     [base_code],0Fh
  5141.         mov     [extended_code],73h
  5142.         lods    byte [esi]
  5143.         call    get_size_operator
  5144.         cmp     al,10h
  5145.         jne     invalid_operand
  5146.         lods    byte [esi]
  5147.         call    convert_mmx_register
  5148.         cmp     ah,16
  5149.         jne     invalid_operand_size
  5150.         mov     bl,al
  5151.         jmp     mmx_nomem_imm8
  5152. movpd_instruction:
  5153.         mov     [operand_prefix],66h
  5154. movps_instruction:
  5155.         mov     [base_code],0Fh
  5156.         mov     [extended_code],al
  5157.         mov     [mmx_size],16
  5158.         jmp     sse_mov_instruction
  5159. movss_instruction:
  5160.         mov     [mmx_size],4
  5161.         mov     [operand_prefix],0F3h
  5162.         jmp     sse_movs
  5163. movsd_instruction:
  5164.         mov     al,0A5h
  5165.         mov     ah,[esi]
  5166.         or      ah,ah
  5167.         jz      simple_instruction_32bit
  5168.         cmp     ah,0Fh
  5169.         je      simple_instruction_32bit
  5170.         mov     [mmx_size],8
  5171.         mov     [operand_prefix],0F2h
  5172.       sse_movs:
  5173.         mov     [base_code],0Fh
  5174.         mov     [extended_code],10h
  5175.         jmp     sse_mov_instruction
  5176. sse_mov_instruction:
  5177.         lods    byte [esi]
  5178.         call    get_size_operator
  5179.         cmp     al,10h
  5180.         je      sse_xmmreg
  5181.       sse_mem:
  5182.         cmp     al,'['
  5183.         jne     invalid_operand
  5184.         inc     [extended_code]
  5185.         call    get_address
  5186.         cmp     [operand_size],0
  5187.         je      sse_mem_xmmreg
  5188.         mov     al,[mmx_size]
  5189.         cmp     [operand_size],al
  5190.         jne     invalid_operand_size
  5191.         mov     [operand_size],0
  5192.       sse_mem_xmmreg:
  5193.         lods    byte [esi]
  5194.         cmp     al,','
  5195.         jne     invalid_operand
  5196.         lods    byte [esi]
  5197.         call    get_size_operator
  5198.         cmp     al,10h
  5199.         jne     invalid_operand
  5200.         lods    byte [esi]
  5201.         call    convert_mmx_register
  5202.         cmp     ah,16
  5203.         jne     invalid_operand_size
  5204.         mov     [postbyte_register],al
  5205.         call    store_instruction
  5206.         jmp     instruction_assembled
  5207. movlpd_instruction:
  5208.         mov     [operand_prefix],66h
  5209. movlps_instruction:
  5210.         mov     [base_code],0Fh
  5211.         mov     [extended_code],al
  5212.         mov     [mmx_size],8
  5213.         lods    byte [esi]
  5214.         call    get_size_operator
  5215.         cmp     al,10h
  5216.         jne     sse_mem
  5217.         lods    byte [esi]
  5218.         call    convert_mmx_register
  5219.         cmp     ah,16
  5220.         jne     invalid_operand_size
  5221.         mov     [postbyte_register],al
  5222.         mov     [operand_size],0
  5223.         lods    byte [esi]
  5224.         cmp     al,','
  5225.         jne     invalid_operand
  5226.         lods    byte [esi]
  5227.         call    get_size_operator
  5228.         jmp     sse_reg_mem
  5229. movhlps_instruction:
  5230.         mov     [base_code],0Fh
  5231.         mov     [extended_code],al
  5232.         mov     [mmx_size],0
  5233.         lods    byte [esi]
  5234.         call    get_size_operator
  5235.         cmp     al,10h
  5236.         jne     invalid_operand
  5237.         lods    byte [esi]
  5238.         call    convert_mmx_register
  5239.         cmp     ah,16
  5240.         jne     invalid_operand_size
  5241.         mov     [postbyte_register],al
  5242.         lods    byte [esi]
  5243.         cmp     al,','
  5244.         jne     invalid_operand
  5245.         lods    byte [esi]
  5246.         call    get_size_operator
  5247.         cmp     al,10h
  5248.         je      sse_xmmreg_xmmreg_ok
  5249.         jmp     invalid_operand
  5250. maskmovq_instruction:
  5251.         mov     cl,8
  5252.         jmp     maskmov_instruction
  5253. maskmovdqu_instruction:
  5254.         mov     cl,16
  5255.         mov     [operand_prefix],66h
  5256.       maskmov_instruction:
  5257.         mov     [base_code],0Fh
  5258.         mov     [extended_code],0F7h
  5259.         lods    byte [esi]
  5260.         call    get_size_operator
  5261.         cmp     al,10h
  5262.         jne     invalid_operand
  5263.         lods    byte [esi]
  5264.         call    convert_mmx_register
  5265.         cmp     ah,cl
  5266.         jne     invalid_operand_size
  5267.         mov     [postbyte_register],al
  5268.         lods    byte [esi]
  5269.         cmp     al,','
  5270.         jne     invalid_operand
  5271.         lods    byte [esi]
  5272.         call    get_size_operator
  5273.         cmp     al,10h
  5274.         jne     invalid_operand
  5275.         lods    byte [esi]
  5276.         call    convert_mmx_register
  5277.         mov     bl,al
  5278.         call    store_nomem_instruction
  5279.         jmp     instruction_assembled
  5280. movmskpd_instruction:
  5281.         mov     [operand_prefix],66h
  5282. movmskps_instruction:
  5283.         mov     [base_code],0Fh
  5284.         mov     [extended_code],50h
  5285.         lods    byte [esi]
  5286.         call    get_size_operator
  5287.         cmp     al,10h
  5288.         jne     invalid_operand
  5289.         lods    byte [esi]
  5290.         call    convert_register
  5291.         cmp     ah,4
  5292.         jne     invalid_operand_size
  5293.         mov     [operand_size],0
  5294.         mov     [postbyte_register],al
  5295.         lods    byte [esi]
  5296.         cmp     al,','
  5297.         jne     invalid_operand
  5298.         lods    byte [esi]
  5299.         call    get_size_operator
  5300.         cmp     al,10h
  5301.         jne     invalid_operand
  5302.         lods    byte [esi]
  5303.         call    convert_mmx_register
  5304.         cmp     ah,16
  5305.         jne     invalid_operand_size
  5306.         mov     bl,al
  5307.         call    store_nomem_instruction
  5308.         jmp     instruction_assembled
  5309. cmppd_instruction:
  5310.         mov     [operand_prefix],66h
  5311. cmpps_instruction:
  5312.         mov     [base_code],0Fh
  5313.         mov     [extended_code],0C2h
  5314.         mov     [mmx_size],16
  5315.         mov     byte [value],-1
  5316.         jmp     sse_cmp_instruction
  5317. cmp_pd_instruction:
  5318.         mov     [operand_prefix],66h
  5319. cmp_ps_instruction:
  5320.         mov     [base_code],0Fh
  5321.         mov     [extended_code],0C2h
  5322.         mov     [mmx_size],16
  5323.         mov     byte [value],al
  5324.         jmp     sse_cmp_instruction
  5325. cmpss_instruction:
  5326.         mov     [mmx_size],4
  5327.         mov     [operand_prefix],0F3h
  5328.         jmp     cmpsx_instruction
  5329. cmpsd_instruction:
  5330.         mov     al,0A7h
  5331.         mov     ah,[esi]
  5332.         or      ah,ah
  5333.         jz      simple_instruction_32bit
  5334.         cmp     ah,0Fh
  5335.         je      simple_instruction_32bit
  5336.         mov     [mmx_size],8
  5337.         mov     [operand_prefix],0F2h
  5338.       cmpsx_instruction:
  5339.         mov     [base_code],0Fh
  5340.         mov     [extended_code],0C2h
  5341.         mov     byte [value],-1
  5342.         jmp     sse_cmp_instruction
  5343. cmp_ss_instruction:
  5344.         mov     [mmx_size],4
  5345.         mov     [operand_prefix],0F3h
  5346.         jmp     cmp_sx_instruction
  5347. cmp_sd_instruction:
  5348.         mov     [mmx_size],8
  5349.         mov     [operand_prefix],0F2h
  5350.       cmp_sx_instruction:
  5351.         mov     [base_code],0Fh
  5352.         mov     [extended_code],0C2h
  5353.         mov     byte [value],al
  5354. sse_cmp_instruction:
  5355.         lods    byte [esi]
  5356.         call    get_size_operator
  5357.         cmp     al,10h
  5358.         jne     invalid_operand
  5359.         lods    byte [esi]
  5360.         call    convert_mmx_register
  5361.         cmp     ah,16
  5362.         jne     invalid_operand_size
  5363.         mov     [postbyte_register],al
  5364.         lods    byte [esi]
  5365.         cmp     al,','
  5366.         jne     invalid_operand
  5367.         mov     [operand_size],0
  5368.         lods    byte [esi]
  5369.         call    get_size_operator
  5370.         cmp     al,10h
  5371.         je      sse_cmp_xmmreg_xmmreg
  5372.         cmp     al,'['
  5373.         jne     invalid_operand
  5374.         call    get_address
  5375.         mov     al,[operand_size]
  5376.         or      al,al
  5377.         jz      sse_cmp_size_ok
  5378.         cmp     al,[mmx_size]
  5379.         jne     invalid_operand_size
  5380.       sse_cmp_size_ok:
  5381.         push    ebx ecx edx
  5382.         call    get_nextbyte
  5383.         pop     edx ecx ebx
  5384.         call    store_instruction_with_imm8
  5385.         jmp     instruction_assembled
  5386.       sse_cmp_xmmreg_xmmreg:
  5387.         lods    byte [esi]
  5388.         call    convert_mmx_register
  5389.         cmp     ah,16
  5390.         jne     invalid_operand_size
  5391.         mov     bl,al
  5392.         call    store_nomem_instruction
  5393.         call    get_nextbyte
  5394.         mov     al,byte [value]
  5395.         stos    byte [edi]
  5396.         jmp     instruction_assembled
  5397.       get_nextbyte:
  5398.         cmp     byte [value],-1
  5399.         jne     nextbyte_ok
  5400.         mov     [operand_size],0
  5401.         lods    byte [esi]
  5402.         cmp     al,','
  5403.         jne     invalid_operand
  5404.         lods    byte [esi]
  5405.         call    get_size_operator
  5406.         test    [operand_size],not 1
  5407.         jnz     invalid_value
  5408.         cmp     al,'('
  5409.         jne     invalid_operand
  5410.         call    get_byte_value
  5411.         cmp     al,7
  5412.         ja      invalid_value
  5413.         mov     byte [value],al
  5414.       nextbyte_ok:
  5415.         ret
  5416. cvtpi2pd_instruction:
  5417.         mov     [operand_prefix],66h
  5418. cvtpi2ps_instruction:
  5419.         mov     [base_code],0Fh
  5420.         mov     [extended_code],al
  5421.         lods    byte [esi]
  5422.         call    get_size_operator
  5423.         cmp     al,10h
  5424.         jne     invalid_operand
  5425.         lods    byte [esi]
  5426.         call    convert_mmx_register
  5427.         cmp     ah,16
  5428.         jne     invalid_operand_size
  5429.         mov     [postbyte_register],al
  5430.         mov     [operand_size],0
  5431.         lods    byte [esi]
  5432.         cmp     al,','
  5433.         jne     invalid_operand
  5434.         lods    byte [esi]
  5435.         call    get_size_operator
  5436.         cmp     al,10h
  5437.         je      cvtpi_xmmreg_xmmreg
  5438.         cmp     al,'['
  5439.         jne     invalid_operand
  5440.         call    get_address
  5441.         cmp     [operand_size],0
  5442.         je      cvtpi_size_ok
  5443.         cmp     [operand_size],8
  5444.         jne     invalid_operand_size
  5445.       cvtpi_size_ok:
  5446.         call    store_instruction
  5447.         jmp     instruction_assembled
  5448.       cvtpi_xmmreg_xmmreg:
  5449.         lods    byte [esi]
  5450.         call    convert_mmx_register
  5451.         cmp     ah,8
  5452.         jne     invalid_operand_size
  5453.         mov     bl,al
  5454.         call    store_nomem_instruction
  5455.         jmp     instruction_assembled
  5456. cvtsi2ss_instruction:
  5457.         mov     [operand_prefix],0F3h
  5458.         jmp     cvtsi_instruction
  5459. cvtsi2sd_instruction:
  5460.         mov     [operand_prefix],0F2h
  5461.       cvtsi_instruction:
  5462.         mov     [base_code],0Fh
  5463.         mov     [extended_code],al
  5464.         lods    byte [esi]
  5465.         call    get_size_operator
  5466.         cmp     al,10h
  5467.         jne     invalid_operand
  5468.         lods    byte [esi]
  5469.         call    convert_mmx_register
  5470.         cmp     ah,16
  5471.         jne     invalid_operand_size
  5472.         mov     [postbyte_register],al
  5473.         mov     [operand_size],0
  5474.         lods    byte [esi]
  5475.         cmp     al,','
  5476.         jne     invalid_operand
  5477.         lods    byte [esi]
  5478.         call    get_size_operator
  5479.         cmp     al,10h
  5480.         je      cvtsi_xmmreg_reg
  5481.         cmp     al,'['
  5482.         jne     invalid_operand
  5483.         call    get_address
  5484.         cmp     [operand_size],0
  5485.         je      cvtsi_size_ok
  5486.         cmp     [operand_size],4
  5487.         jne     invalid_operand_size
  5488.       cvtsi_size_ok:
  5489.         call    store_instruction
  5490.         jmp     instruction_assembled
  5491.       cvtsi_xmmreg_reg:
  5492.         lods    byte [esi]
  5493.         call    convert_register
  5494.         cmp     ah,4
  5495.         je      cvtsi_xmmreg_reg_store
  5496.         cmp     ah,8
  5497.         jne     invalid_operand_size
  5498.         call    operand_64bit
  5499.       cvtsi_xmmreg_reg_store:
  5500.         mov     bl,al
  5501.         call    store_nomem_instruction
  5502.         jmp     instruction_assembled
  5503. cvtps2pi_instruction:
  5504.         mov     [mmx_size],8
  5505.         jmp     cvtpd_instruction
  5506. cvtpd2pi_instruction:
  5507.         mov     [operand_prefix],66h
  5508.         mov     [mmx_size],16
  5509.       cvtpd_instruction:
  5510.         mov     [base_code],0Fh
  5511.         mov     [extended_code],al
  5512.         lods    byte [esi]
  5513.         call    get_size_operator
  5514.         cmp     al,10h
  5515.         jne     invalid_operand
  5516.         lods    byte [esi]
  5517.         call    convert_mmx_register
  5518.         cmp     ah,8
  5519.         jne     invalid_operand_size
  5520.         mov     [operand_size],0
  5521.         jmp     sse_reg
  5522. cvtss2si_instruction:
  5523.         mov     [operand_prefix],0F3h
  5524.         mov     [mmx_size],4
  5525.         jmp     cvt2si_instruction
  5526. cvtsd2si_instruction:
  5527.         mov     [operand_prefix],0F2h
  5528.         mov     [mmx_size],8
  5529.       cvt2si_instruction:
  5530.         mov     [extended_code],al
  5531.         mov     [base_code],0Fh
  5532.         lods    byte [esi]
  5533.         call    get_size_operator
  5534.         cmp     al,10h
  5535.         jne     invalid_operand
  5536.         lods    byte [esi]
  5537.         call    convert_register
  5538.         mov     [operand_size],0
  5539.         cmp     ah,4
  5540.         je      sse_reg
  5541.         cmp     ah,8
  5542.         jne     invalid_operand_size
  5543.         call    operand_64bit
  5544.         jmp     sse_reg
  5545.  
  5546. ssse3_instruction:
  5547.         mov     [base_code],0Fh
  5548.         mov     [extended_code],38h
  5549.         mov     [supplemental_code],al
  5550.         jmp     mmx_instruction
  5551. palignr_instruction:
  5552.         mov     [base_code],0Fh
  5553.         mov     [extended_code],3Ah
  5554.         mov     [supplemental_code],0Fh
  5555.         lods    byte [esi]
  5556.         call    get_size_operator
  5557.         cmp     al,10h
  5558.         jne     invalid_operand
  5559.         lods    byte [esi]
  5560.         call    convert_mmx_register
  5561.         call    make_mmx_prefix
  5562.         mov     [postbyte_register],al
  5563.         lods    byte [esi]
  5564.         cmp     al,','
  5565.         jne     invalid_operand
  5566.         lods    byte [esi]
  5567.         call    get_size_operator
  5568.         cmp     al,10h
  5569.         je      palignr_mmreg_mmreg
  5570.         cmp     al,'['
  5571.         jne     invalid_operand
  5572.         call    get_address
  5573.         jmp     mmx_imm8
  5574.       palignr_mmreg_mmreg:
  5575.         lods    byte [esi]
  5576.         call    convert_mmx_register
  5577.         mov     bl,al
  5578.         jmp     mmx_nomem_imm8
  5579. amd3dnow_instruction:
  5580.         mov     [base_code],0Fh
  5581.         mov     [extended_code],0Fh
  5582.         mov     byte [value],al
  5583.         lods    byte [esi]
  5584.         call    get_size_operator
  5585.         cmp     al,10h
  5586.         jne     invalid_operand
  5587.         lods    byte [esi]
  5588.         call    convert_mmx_register
  5589.         cmp     ah,8
  5590.         jne     invalid_operand_size
  5591.         mov     [postbyte_register],al
  5592.         lods    byte [esi]
  5593.         cmp     al,','
  5594.         jne     invalid_operand
  5595.         lods    byte [esi]
  5596.         call    get_size_operator
  5597.         cmp     al,10h
  5598.         je      amd3dnow_mmreg_mmreg
  5599.         cmp     al,'['
  5600.         jne     invalid_operand
  5601.         call    get_address
  5602.         call    store_instruction_with_imm8
  5603.         jmp     instruction_assembled
  5604.       amd3dnow_mmreg_mmreg:
  5605.         lods    byte [esi]
  5606.         call    convert_mmx_register
  5607.         cmp     ah,8
  5608.         jne     invalid_operand_size
  5609.         mov     bl,al
  5610.         call    store_nomem_instruction
  5611.         mov     al,byte [value]
  5612.         stos    byte [edi]
  5613.         jmp     instruction_assembled
  5614.  
  5615. sse4_instruction_38_xmm0:
  5616.         mov     [immediate_size],-1
  5617.         jmp     sse4_instruction_38
  5618. sse4_instruction_38_imm8:
  5619.         mov     [immediate_size],8
  5620. sse4_instruction_38:
  5621.         mov     [operand_prefix],66h
  5622.         mov     [base_code],0Fh
  5623.         mov     [supplemental_code],al
  5624.         mov     al,38h
  5625.         jmp     sse_instruction
  5626. sse4_instruction_3a_imm8:
  5627.         mov     [immediate_size],8
  5628. sse4_instruction_3a:
  5629.         mov     [operand_prefix],66h
  5630.         mov     [base_code],0Fh
  5631.         mov     [supplemental_code],al
  5632.         mov     al,3Ah
  5633.         jmp     sse_instruction
  5634.  
  5635. fxsave_instruction:
  5636.         mov     [extended_code],0AEh
  5637.         mov     [base_code],0Fh
  5638.         mov     [postbyte_register],al
  5639.         lods    byte [esi]
  5640.         call    get_size_operator
  5641.         cmp     al,'['
  5642.         jne     invalid_operand
  5643.         call    get_address
  5644.         mov     ah,[operand_size]
  5645.         or      ah,ah
  5646.         jz      fxsave_size_ok
  5647.         mov     al,[postbyte_register]
  5648.         cmp     al,111b
  5649.         je      clflush_size_check
  5650.         cmp     al,10b
  5651.         jb      invalid_operand_size
  5652.         cmp     al,11b
  5653.         ja      invalid_operand_size
  5654.         cmp     ah,4
  5655.         jne     invalid_operand_size
  5656.         jmp     fxsave_size_ok
  5657.       clflush_size_check:
  5658.         cmp     ah,1
  5659.         jne     invalid_operand_size
  5660.       fxsave_size_ok:
  5661.         call    store_instruction
  5662.         jmp     instruction_assembled
  5663. prefetch_instruction:
  5664.         mov     [extended_code],18h
  5665.       prefetch_mem_8bit:
  5666.         mov     [base_code],0Fh
  5667.         mov     [postbyte_register],al
  5668.         lods    byte [esi]
  5669.         call    get_size_operator
  5670.         cmp     al,'['
  5671.         jne     invalid_operand
  5672.         or      ah,ah
  5673.         jz      prefetch_size_ok
  5674.         cmp     ah,1
  5675.         jne     invalid_operand_size
  5676.       prefetch_size_ok:
  5677.         call    get_address
  5678.         call    store_instruction
  5679.         jmp     instruction_assembled
  5680. amd_prefetch_instruction:
  5681.         mov     [extended_code],0Dh
  5682.         jmp     prefetch_mem_8bit
  5683. fence_instruction:
  5684.         mov     bl,al
  5685.         mov     ax,0AE0Fh
  5686.         stos    word [edi]
  5687.         mov     al,bl
  5688.         stos    byte [edi]
  5689.         jmp     instruction_assembled
  5690. pause_instruction:
  5691.         mov     ax,90F3h
  5692.         stos    word [edi]
  5693.         jmp     instruction_assembled
  5694. movntq_instruction:
  5695.         mov     [mmx_size],8
  5696.         jmp     movnt_instruction
  5697. movntps_instruction:
  5698.         mov     [mmx_size],16
  5699.         jmp     movnt_instruction
  5700. movntdq_instruction:
  5701.         mov     [operand_prefix],66h
  5702.         mov     [mmx_size],16
  5703.       movnt_instruction:
  5704.         mov     [extended_code],al
  5705.         mov     [base_code],0Fh
  5706.         lods    byte [esi]
  5707.         call    get_size_operator
  5708.         cmp     al,'['
  5709.         jne     invalid_operand
  5710.         call    get_address
  5711.         lods    byte [esi]
  5712.         cmp     al,','
  5713.         jne     invalid_operand
  5714.         lods    byte [esi]
  5715.         call    get_size_operator
  5716.         cmp     al,10h
  5717.         jne     invalid_operand
  5718.         lods    byte [esi]
  5719.         call    convert_mmx_register
  5720.         cmp     ah,[mmx_size]
  5721.         jne     invalid_operand_size
  5722.         mov     [postbyte_register],al
  5723.         call    store_instruction
  5724.         jmp     instruction_assembled
  5725. movnti_instruction:
  5726.         mov     [base_code],0Fh
  5727.         mov     [extended_code],al
  5728.         lods    byte [esi]
  5729.         call    get_size_operator
  5730.         cmp     al,'['
  5731.         jne     invalid_operand
  5732.         call    get_address
  5733.         lods    byte [esi]
  5734.         cmp     al,','
  5735.         jne     invalid_operand
  5736.         lods    byte [esi]
  5737.         call    get_size_operator
  5738.         cmp     al,10h
  5739.         jne     invalid_operand
  5740.         lods    byte [esi]
  5741.         call    convert_register
  5742.         cmp     ah,4
  5743.         je      movnti_store
  5744.         cmp     ah,8
  5745.         jne     invalid_operand_size
  5746.         call    operand_64bit
  5747.       movnti_store:
  5748.         mov     [postbyte_register],al
  5749.         call    store_instruction
  5750.         jmp     instruction_assembled
  5751. monitor_instruction:
  5752.         mov     [postbyte_register],al
  5753.         lods    byte [esi]
  5754.         call    get_size_operator
  5755.         cmp     al,10h
  5756.         jne     invalid_operand
  5757.         lods    byte [esi]
  5758.         call    convert_register
  5759.         cmp     ax,0400h
  5760.         jne     invalid_operand
  5761.         lods    byte [esi]
  5762.         cmp     al,','
  5763.         jne     invalid_operand
  5764.         lods    byte [esi]
  5765.         call    get_size_operator
  5766.         cmp     al,10h
  5767.         jne     invalid_operand
  5768.         lods    byte [esi]
  5769.         call    convert_register
  5770.         cmp     ax,0401h
  5771.         jne     invalid_operand
  5772.         cmp     [postbyte_register],0C8h
  5773.         jne     monitor_instruction_store
  5774.         lods    byte [esi]
  5775.         cmp     al,','
  5776.         jne     invalid_operand
  5777.         lods    byte [esi]
  5778.         call    get_size_operator
  5779.         cmp     al,10h
  5780.         jne     invalid_operand
  5781.         lods    byte [esi]
  5782.         call    convert_register
  5783.         cmp     ax,0402h
  5784.         jne     invalid_operand
  5785.       monitor_instruction_store:
  5786.         mov     ax,010Fh
  5787.         stos    word [edi]
  5788.         mov     al,[postbyte_register]
  5789.         stos    byte [edi]
  5790.         jmp     instruction_assembled
  5791.  
  5792. simple_vmx_instruction:
  5793.         mov     ah,al
  5794.         mov     al,0Fh
  5795.         stos    byte [edi]
  5796.         mov     al,1
  5797.         stos    word [edi]
  5798.         jmp     instruction_assembled
  5799. vmclear_instruction:
  5800.         mov     [operand_prefix],66h
  5801.         jmp     vmx_instruction
  5802. vmxon_instruction:
  5803.         mov     [operand_prefix],0F3h
  5804. vmx_instruction:
  5805.         mov     [postbyte_register],al
  5806.         mov     [extended_code],0C7h
  5807.         lods    byte [esi]
  5808.         call    get_size_operator
  5809.         cmp     al,'['
  5810.         jne     invalid_operand
  5811.         call    get_address
  5812.         mov     al,[operand_size]
  5813.         or      al,al
  5814.         jz      vmx_size_ok
  5815.         cmp     al,8
  5816.         jne     invalid_operand_size
  5817.       vmx_size_ok:
  5818.         mov     [base_code],0Fh
  5819.         call    store_instruction
  5820.         jmp     instruction_assembled
  5821. vmread_instruction:
  5822.         mov     [extended_code],78h
  5823.         lods    byte [esi]
  5824.         call    get_size_operator
  5825.         cmp     al,10h
  5826.         je      vmread_nomem
  5827.         cmp     al,'['
  5828.         jne     invalid_operand
  5829.         call    get_address
  5830.         lods    byte [esi]
  5831.         cmp     al,','
  5832.         jne     invalid_operand
  5833.         call    vmread_check_size
  5834.         mov     [operand_size],0
  5835.         lods    byte [esi]
  5836.         call    get_size_operator
  5837.         cmp     al,10h
  5838.         jne     invalid_operand
  5839.         lods    byte [esi]
  5840.         call    convert_register
  5841.         mov     [postbyte_register],al
  5842.         cmp     [operand_size],4
  5843.         jne     invalid_operand_size
  5844.         jmp     vmx_size_ok
  5845.       vmread_nomem:
  5846.         lods    byte [esi]
  5847.         call    convert_register
  5848.         push    eax
  5849.         call    vmread_check_size
  5850.         lods    byte [esi]
  5851.         cmp     al,','
  5852.         jne     invalid_operand
  5853.         mov     [operand_size],0
  5854.         lods    byte [esi]
  5855.         call    get_size_operator
  5856.         cmp     al,10h
  5857.         jne     invalid_operand
  5858.         lods    byte [esi]
  5859.         call    convert_register
  5860.         mov     [postbyte_register],al
  5861.         cmp     [operand_size],4
  5862.         jne     invalid_operand_size
  5863.         pop     ebx
  5864.         mov     [base_code],0Fh
  5865.         call    store_nomem_instruction
  5866.         jmp     instruction_assembled
  5867.       vmread_check_size:
  5868.         cmp     [code_type],64
  5869.         je      vmread_long
  5870.         cmp     [operand_size],4
  5871.         jne     invalid_operand_size
  5872.         ret
  5873.       vmread_long:
  5874.         cmp     [operand_size],8
  5875.         jne     invalid_operand_size
  5876.         ret
  5877. vmwrite_instruction:
  5878.         mov     [extended_code],79h
  5879.         lods    byte [esi]
  5880.         call    get_size_operator
  5881.         cmp     al,10h
  5882.         jne     invalid_operand
  5883.         lods    byte [esi]
  5884.         call    convert_register
  5885.         mov     [postbyte_register],al
  5886.         cmp     [operand_size],4
  5887.         jne     invalid_operand_size
  5888.         mov     [operand_size],0
  5889.         lods    byte [esi]
  5890.         cmp     al,','
  5891.         jne     invalid_operand
  5892.         lods    byte [esi]
  5893.         call    get_size_operator
  5894.         cmp     al,10h
  5895.         je      vmwrite_nomem
  5896.         cmp     al,'['
  5897.         jne     invalid_operand
  5898.         call    get_address
  5899.         call    vmread_check_size
  5900.         jmp     vmx_size_ok
  5901.       vmwrite_nomem:
  5902.         lods    byte [esi]
  5903.         call    convert_register
  5904.         mov     bl,al
  5905.         mov     [base_code],0Fh
  5906.         call    store_nomem_instruction
  5907.         jmp     instruction_assembled
  5908. simple_svm_instruction:
  5909.         push    eax
  5910.         mov     [base_code],0Fh
  5911.         mov     [extended_code],1
  5912.         lods    byte [esi]
  5913.         call    get_size_operator
  5914.         cmp     al,10h
  5915.         jne     invalid_operand
  5916.         lods    byte [esi]
  5917.         call    convert_register
  5918.         or      al,al
  5919.         jnz     invalid_operand
  5920.       simple_svm_detect_size:
  5921.         cmp     ah,2
  5922.         je      simple_svm_16bit
  5923.         cmp     ah,4
  5924.         je      simple_svm_32bit
  5925.         cmp     [code_type],64
  5926.         jne     invalid_operand_size
  5927.         jmp     simple_svm_store
  5928.       simple_svm_16bit:
  5929.         cmp     [code_type],16
  5930.         je      simple_svm_store
  5931.         cmp     [code_type],64
  5932.         je      invalid_operand_size
  5933.         jmp     prefixed_svm_store
  5934.       simple_svm_32bit:
  5935.         cmp     [code_type],32
  5936.         je      simple_svm_store
  5937.       prefixed_svm_store:
  5938.         mov     al,67h
  5939.         stos    byte [edi]
  5940.       simple_svm_store:
  5941.         call    store_instruction_code
  5942.         pop     eax
  5943.         stos    byte [edi]
  5944.         jmp     instruction_assembled
  5945. skinit_instruction:
  5946.         lods    byte [esi]
  5947.         call    get_size_operator
  5948.         cmp     al,10h
  5949.         jne     invalid_operand
  5950.         lods    byte [esi]
  5951.         call    convert_register
  5952.         cmp     ax,0400h
  5953.         jne     invalid_operand
  5954.         mov     al,0DEh
  5955.         jmp     simple_vmx_instruction
  5956. invlpga_instruction:
  5957.         push    eax
  5958.         mov     [base_code],0Fh
  5959.         mov     [extended_code],1
  5960.         lods    byte [esi]
  5961.         call    get_size_operator
  5962.         cmp     al,10h
  5963.         jne     invalid_operand
  5964.         lods    byte [esi]
  5965.         call    convert_register
  5966.         or      al,al
  5967.         jnz     invalid_operand
  5968.         mov     bl,ah
  5969.         mov     [operand_size],0
  5970.         lods    byte [esi]
  5971.         cmp     al,','
  5972.         jne     invalid_operand
  5973.         lods    byte [esi]
  5974.         call    get_size_operator
  5975.         cmp     al,10h
  5976.         jne     invalid_operand
  5977.         lods    byte [esi]
  5978.         call    convert_register
  5979.         cmp     ax,0401h
  5980.         jne     invalid_operand
  5981.         mov     ah,bl
  5982.         jmp     simple_svm_detect_size
  5983.  
  5984. convert_register:
  5985.         mov     ah,al
  5986.         shr     ah,4
  5987.         and     al,0Fh
  5988.         cmp     ah,8
  5989.         je      match_register_size
  5990.         cmp     ah,4
  5991.         ja      invalid_operand
  5992.         cmp     ah,1
  5993.         ja      match_register_size
  5994.         cmp     al,4
  5995.         jb      match_register_size
  5996.         or      ah,ah
  5997.         jz      high_byte_register
  5998.         or      [rex_prefix],40h
  5999.       match_register_size:
  6000.         cmp     ah,[operand_size]
  6001.         je      register_size_ok
  6002.         cmp     [operand_size],0
  6003.         jne     operand_sizes_do_not_match
  6004.         mov     [operand_size],ah
  6005.       register_size_ok:
  6006.         ret
  6007.       high_byte_register:
  6008.         mov     ah,1
  6009.         or      [rex_prefix],80h
  6010.         jmp     match_register_size
  6011. convert_fpu_register:
  6012.         mov     ah,al
  6013.         shr     ah,4
  6014.         and     al,111b
  6015.         cmp     ah,10
  6016.         jne     invalid_operand
  6017.         jmp     match_register_size
  6018. convert_mmx_register:
  6019.         mov     ah,al
  6020.         shr     ah,4
  6021.         cmp     ah,0Ch
  6022.         je      xmm_register
  6023.         ja      invalid_operand
  6024.         and     al,111b
  6025.         cmp     ah,0Bh
  6026.         jne     invalid_operand
  6027.         mov     ah,8
  6028.         jmp     match_register_size
  6029.       xmm_register:
  6030.         and     al,0Fh
  6031.         mov     ah,16
  6032.         cmp     al,8
  6033.         jb      match_register_size
  6034.         cmp     [code_type],64
  6035.         jne     invalid_operand
  6036.         jmp     match_register_size
  6037. get_size_operator:
  6038.         xor     ah,ah
  6039.         cmp     al,11h
  6040.         jne     no_size_operator
  6041.         mov     [size_declared],1
  6042.         lods    word [esi]
  6043.         xchg    al,ah
  6044.         mov     [size_override],1
  6045.         cmp     ah,[operand_size]
  6046.         je      size_operator_ok
  6047.         cmp     [operand_size],0
  6048.         jne     operand_sizes_do_not_match
  6049.         mov     [operand_size],ah
  6050.       size_operator_ok:
  6051.         ret
  6052.       no_size_operator:
  6053.         mov     [size_declared],0
  6054.         cmp     al,'['
  6055.         jne     size_operator_ok
  6056.         mov     [size_override],0
  6057.         ret
  6058. get_jump_operator:
  6059.         mov     [jump_type],0
  6060.         cmp     al,12h
  6061.         jne     jump_operator_ok
  6062.         lods    word [esi]
  6063.         mov     [jump_type],al
  6064.         mov     al,ah
  6065.       jump_operator_ok:
  6066.         ret
  6067. get_address:
  6068.         mov     [segment_register],0
  6069.         mov     [address_size],0
  6070.         mov     al,[code_type]
  6071.         shr     al,3
  6072.         mov     [value_size],al
  6073.         mov     al,[esi]
  6074.         and     al,11110000b
  6075.         cmp     al,60h
  6076.         jne     get_size_prefix
  6077.         lods    byte [esi]
  6078.         sub     al,60h
  6079.         mov     [segment_register],al
  6080.         mov     al,[esi]
  6081.         and     al,11110000b
  6082.       get_size_prefix:
  6083.         cmp     al,70h
  6084.         jne     address_size_prefix_ok
  6085.         lods    byte [esi]
  6086.         sub     al,70h
  6087.         cmp     al,2
  6088.         jb      invalid_address_size
  6089.         cmp     al,8
  6090.         ja      invalid_address_size
  6091.         mov     [address_size],al
  6092.         mov     [value_size],al
  6093.       address_size_prefix_ok:
  6094.         call    calculate_address
  6095.         cmp     byte [esi-1],']'
  6096.         jne     invalid_address
  6097.         mov     [address_high],edx
  6098.         mov     edx,eax
  6099.         cmp     [code_type],64
  6100.         jne     address_ok
  6101.         or      bx,bx
  6102.         jnz     address_ok
  6103.         test    ch,0Fh
  6104.         jnz     address_ok
  6105.       calculate_relative_address:
  6106.         mov     edx,[address_symbol]
  6107.         mov     [symbol_identifier],edx
  6108.         mov     edx,[address_high]
  6109.         call    calculate_relative_offset
  6110.         mov     [address_high],edx
  6111.         cdq
  6112.         cmp     edx,[address_high]
  6113.         je      address_high_ok
  6114.         cmp     [error_line],0
  6115.         jne     address_high_ok
  6116.         mov     ebx,[current_line]
  6117.         mov     [error_line],ebx
  6118.         mov     [error],value_out_of_range
  6119.       address_high_ok:
  6120.         mov     edx,eax
  6121.         ror     ecx,16
  6122.         mov     cl,[value_type]
  6123.         rol     ecx,16
  6124.         mov     bx,0FF00h
  6125.       address_ok:
  6126.         ret
  6127. operand_16bit:
  6128.         cmp     [code_type],16
  6129.         je      size_prefix_ok
  6130.         mov     [operand_prefix],66h
  6131.         ret
  6132. operand_32bit:
  6133.         cmp     [code_type],16
  6134.         jne     size_prefix_ok
  6135.         mov     [operand_prefix],66h
  6136.       size_prefix_ok:
  6137.         ret
  6138. operand_64bit:
  6139.         cmp     [code_type],64
  6140.         jne     illegal_instruction
  6141.         or      [rex_prefix],48h
  6142.         ret
  6143. operand_autodetect:
  6144.         cmp     al,2
  6145.         je      operand_16bit
  6146.         cmp     al,4
  6147.         je      operand_32bit
  6148.         cmp     al,8
  6149.         je      operand_64bit
  6150.         jmp     invalid_operand_size
  6151. store_segment_prefix_if_necessary:
  6152.         mov     al,[segment_register]
  6153.         or      al,al
  6154.         jz      segment_prefix_ok
  6155.         cmp     al,3
  6156.         je      ss_prefix
  6157.         cmp     al,4
  6158.         ja      segment_prefix_386
  6159.         jb      segment_prefix_86
  6160.         cmp     bl,25h
  6161.         je      segment_prefix_86
  6162.         cmp     bh,25h
  6163.         je      segment_prefix_86
  6164.         cmp     bh,45h
  6165.         je      segment_prefix_86
  6166.         cmp     bh,44h
  6167.         je      segment_prefix_86
  6168.         ret
  6169.       ss_prefix:
  6170.         cmp     bl,25h
  6171.         je      segment_prefix_ok
  6172.         cmp     bh,25h
  6173.         je      segment_prefix_ok
  6174.         cmp     bh,45h
  6175.         je      segment_prefix_ok
  6176.         cmp     bh,44h
  6177.         je      segment_prefix_ok
  6178.         jmp     segment_prefix_86
  6179. store_segment_prefix:
  6180.         mov     al,[segment_register]
  6181.         or      al,al
  6182.         jz      segment_prefix_ok
  6183.         cmp     al,5
  6184.         jae     segment_prefix_386
  6185.       segment_prefix_86:
  6186.         dec     al
  6187.         shl     al,3
  6188.         add     al,26h
  6189.         stos    byte [edi]
  6190.         jmp     segment_prefix_ok
  6191.       segment_prefix_386:
  6192.         add     al,64h-5
  6193.         stos    byte [edi]
  6194.       segment_prefix_ok:
  6195.         ret
  6196. store_instruction_code:
  6197.         mov     al,[operand_prefix]
  6198.         or      al,al
  6199.         jz      operand_prefix_ok
  6200.         stos    byte [edi]
  6201.       operand_prefix_ok:
  6202.         mov     al,[rex_prefix]
  6203.         test    al,40h
  6204.         jz      rex_prefix_ok
  6205.         cmp     [code_type],64
  6206.         jne     invalid_operand
  6207.         test    al,0B0h
  6208.         jnz     prefix_conflict
  6209.         stos    byte [edi]
  6210.       rex_prefix_ok:
  6211.         mov     al,[base_code]
  6212.         stos    byte [edi]
  6213.         cmp     al,0Fh
  6214.         jne     instruction_code_ok
  6215.       store_extended_code:
  6216.         mov     al,[extended_code]
  6217.         stos    byte [edi]
  6218.         cmp     al,38h
  6219.         je      store_supplemental_code
  6220.         cmp     al,3Ah
  6221.         je      store_supplemental_code
  6222.       instruction_code_ok:
  6223.         ret
  6224.       store_supplemental_code:
  6225.         mov     al,[supplemental_code]
  6226.         stos    byte [edi]
  6227.         ret
  6228. store_nomem_instruction:
  6229.         test    [postbyte_register],1000b
  6230.         jz      nomem_reg_code_ok
  6231.         or      [rex_prefix],44h
  6232.         and     [postbyte_register],111b
  6233.       nomem_reg_code_ok:
  6234.         test    bl,1000b
  6235.         jz      nomem_rm_code_ok
  6236.         or      [rex_prefix],41h
  6237.         and     bl,111b
  6238.       nomem_rm_code_ok:
  6239.         call    store_instruction_code
  6240.         mov     al,[postbyte_register]
  6241.         shl     al,3
  6242.         or      al,bl
  6243.         or      al,11000000b
  6244.         stos    byte [edi]
  6245.         ret
  6246. store_instruction:
  6247.         mov     [current_offset],edi
  6248.         test    [postbyte_register],1000b
  6249.         jz      reg_code_ok
  6250.         or      [rex_prefix],44h
  6251.         and     [postbyte_register],111b
  6252.       reg_code_ok:
  6253.         call    store_segment_prefix_if_necessary
  6254.         or      bx,bx
  6255.         jz      address_immediate
  6256.         cmp     bx,0F800h
  6257.         je      address_rip_based
  6258.         cmp     bx,0F400h
  6259.         je      address_eip_based
  6260.         cmp     bx,0FF00h
  6261.         je      address_relative
  6262.         mov     al,bl
  6263.         or      al,bh
  6264.         and     al,11110000b
  6265.         cmp     al,80h
  6266.         je      postbyte_64bit
  6267.         cmp     al,40h
  6268.         je      postbyte_32bit
  6269.         cmp     al,20h
  6270.         jne     invalid_address
  6271.         cmp     [code_type],64
  6272.         je      invalid_address_size
  6273.         call    address_16bit_prefix
  6274.         call    store_instruction_code
  6275.         cmp     bx,2326h
  6276.         je      address_bx_si
  6277.         cmp     bx,2623h
  6278.         je      address_bx_si
  6279.         cmp     bx,2327h
  6280.         je      address_bx_di
  6281.         cmp     bx,2723h
  6282.         je      address_bx_di
  6283.         cmp     bx,2526h
  6284.         je      address_bp_si
  6285.         cmp     bx,2625h
  6286.         je      address_bp_si
  6287.         cmp     bx,2527h
  6288.         je      address_bp_di
  6289.         cmp     bx,2725h
  6290.         je      address_bp_di
  6291.         cmp     bx,2600h
  6292.         je      address_si
  6293.         cmp     bx,2700h
  6294.         je      address_di
  6295.         cmp     bx,2300h
  6296.         je      address_bx
  6297.         cmp     bx,2500h
  6298.         je      address_bp
  6299.         jmp     invalid_address
  6300.       address_bx_si:
  6301.         xor     al,al
  6302.         jmp     postbyte_16bit
  6303.       address_bx_di:
  6304.         mov     al,1
  6305.         jmp     postbyte_16bit
  6306.       address_bp_si:
  6307.         mov     al,10b
  6308.         jmp     postbyte_16bit
  6309.       address_bp_di:
  6310.         mov     al,11b
  6311.         jmp     postbyte_16bit
  6312.       address_si:
  6313.         mov     al,100b
  6314.         jmp     postbyte_16bit
  6315.       address_di:
  6316.         mov     al,101b
  6317.         jmp     postbyte_16bit
  6318.       address_bx:
  6319.         mov     al,111b
  6320.         jmp     postbyte_16bit
  6321.       address_bp:
  6322.         mov     al,110b
  6323.       postbyte_16bit:
  6324.         test    ch,22h
  6325.         jnz     address_16bit_value
  6326.         or      ch,ch
  6327.         jnz     address_sizes_do_not_agree
  6328.         cmp     edx,10000h
  6329.         jge     value_out_of_range
  6330.         cmp     edx,-8000h
  6331.         jl      value_out_of_range
  6332.         or      dx,dx
  6333.         jz      address
  6334.         cmp     dx,80h
  6335.         jb      address_8bit_value
  6336.         cmp     dx,-80h
  6337.         jae     address_8bit_value
  6338.       address_16bit_value:
  6339.         or      al,10000000b
  6340.         mov     cl,[postbyte_register]
  6341.         shl     cl,3
  6342.         or      al,cl
  6343.         stos    byte [edi]
  6344.         mov     eax,edx
  6345.         stos    word [edi]
  6346.         ret
  6347.       address_8bit_value:
  6348.         or      al,01000000b
  6349.         mov     cl,[postbyte_register]
  6350.         shl     cl,3
  6351.         or      al,cl
  6352.         stos    byte [edi]
  6353.         mov     al,dl
  6354.         stos    byte [edi]
  6355.         cmp     dx,80h
  6356.         jge     value_out_of_range
  6357.         cmp     dx,-80h
  6358.         jl      value_out_of_range
  6359.         ret
  6360.       address:
  6361.         cmp     al,110b
  6362.         je      address_8bit_value
  6363.         mov     cl,[postbyte_register]
  6364.         shl     cl,3
  6365.         or      al,cl
  6366.         stos    byte [edi]
  6367.         ret
  6368.       postbyte_32bit:
  6369.         call    address_32bit_prefix
  6370.         jmp     address_prefix_ok
  6371.       postbyte_64bit:
  6372.         cmp     [code_type],64
  6373.         jne     invalid_address_size
  6374.       address_prefix_ok:
  6375.         test    bh,1000b
  6376.         jz      base_code_ok
  6377.         or      [rex_prefix],41h
  6378.       base_code_ok:
  6379.         test    bl,1000b
  6380.         jz      index_code_ok
  6381.         or      [rex_prefix],42h
  6382.       index_code_ok:
  6383.         call    store_instruction_code
  6384.         cmp     bl,44h
  6385.         je      swap_base_with_index
  6386.         cmp     bl,84h
  6387.         jne     base_register_ok
  6388.       swap_base_with_index:
  6389.         cmp     cl,1
  6390.         jne     invalid_address
  6391.         xchg    bl,bh
  6392.         cmp     bl,44h
  6393.         je      invalid_address
  6394.         cmp     bl,84h
  6395.         je      invalid_address
  6396.       base_register_ok:
  6397.         or      cl,cl
  6398.         jz      only_base_register
  6399.       base_and_index:
  6400.         mov     al,100b
  6401.         xor     ah,ah
  6402.         cmp     cl,1
  6403.         je      scale_ok
  6404.         cmp     cl,2
  6405.         je      scale_1
  6406.         cmp     cl,4
  6407.         je      scale_2
  6408.         or      ah,11000000b
  6409.         jmp     scale_ok
  6410.       scale_2:
  6411.         or      ah,10000000b
  6412.         jmp     scale_ok
  6413.       scale_1:
  6414.         or      ah,01000000b
  6415.       scale_ok:
  6416.         or      bh,bh
  6417.         jz      only_index_register
  6418.         and     bl,111b
  6419.         shl     bl,3
  6420.         or      ah,bl
  6421.         and     bh,111b
  6422.         or      ah,bh
  6423.         test    ch,44h
  6424.         jnz     sib_address_32bit_value
  6425.         test    ch,88h
  6426.         jnz     sib_address_32bit_value
  6427.         or      ch,ch
  6428.         jnz     address_sizes_do_not_agree
  6429.         cmp     bh,5
  6430.         je      address_value
  6431.         or      edx,edx
  6432.         jz      sib_address
  6433.       address_value:
  6434.         cmp     edx,80h
  6435.         jb      sib_address_8bit_value
  6436.         cmp     edx,-80h
  6437.         jae     sib_address_8bit_value
  6438.       sib_address_32bit_value:
  6439.         or      al,10000000b
  6440.         mov     cl,[postbyte_register]
  6441.         shl     cl,3
  6442.         or      al,cl
  6443.         stos    word [edi]
  6444.       address_32bit_value:
  6445.         cmp     [code_type],64
  6446.         jne     store_address_32bit_value
  6447.         mov     eax,edx
  6448.         cdq
  6449.         cmp     edx,[address_high]
  6450.         jne     value_out_of_range
  6451.         mov     edx,eax
  6452.         jmp     store_address_32bit_value
  6453.       sib_address_8bit_value:
  6454.         or      al,01000000b
  6455.         mov     cl,[postbyte_register]
  6456.         shl     cl,3
  6457.         or      al,cl
  6458.         stos    word [edi]
  6459.         mov     al,dl
  6460.         stos    byte [edi]
  6461.         cmp     edx,80h
  6462.         jge     value_out_of_range
  6463.         cmp     edx,-80h
  6464.         jl      value_out_of_range
  6465.         ret
  6466.       sib_address:
  6467.         mov     cl,[postbyte_register]
  6468.         shl     cl,3
  6469.         or      al,cl
  6470.         stos    word [edi]
  6471.         ret
  6472.       only_index_register:
  6473.         or      ah,101b
  6474.         and     bl,111b
  6475.         shl     bl,3
  6476.         or      ah,bl
  6477.         mov     cl,[postbyte_register]
  6478.         shl     cl,3
  6479.         or      al,cl
  6480.         stos    word [edi]
  6481.         test    ch,44h
  6482.         jnz     address_32bit_value
  6483.         test    ch,88h
  6484.         jnz     address_32bit_value
  6485.         or      ch,ch
  6486.         jnz     invalid_address_size
  6487.         jmp     address_32bit_value
  6488.       zero_index_register:
  6489.         mov     bl,4
  6490.         mov     cl,1
  6491.         jmp     base_and_index
  6492.       only_base_register:
  6493.         mov     al,bh
  6494.         and     al,111b
  6495.         cmp     al,4
  6496.         je      zero_index_register
  6497.         test    ch,44h
  6498.         jnz     simple_address_32bit_value
  6499.         test    ch,88h
  6500.         jnz     simple_address_32bit_value
  6501.         or      ch,ch
  6502.         jnz     address_sizes_do_not_agree
  6503.         or      edx,edx
  6504.         jz      simple_address
  6505.         cmp     edx,80h
  6506.         jb      simple_address_8bit_value
  6507.         cmp     edx,-80h
  6508.         jae     simple_address_8bit_value
  6509.       simple_address_32bit_value:
  6510.         or      al,10000000b
  6511.         mov     cl,[postbyte_register]
  6512.         shl     cl,3
  6513.         or      al,cl
  6514.         stos    byte [edi]
  6515.         jmp     address_32bit_value
  6516.       simple_address_8bit_value:
  6517.         or      al,01000000b
  6518.         mov     cl,[postbyte_register]
  6519.         shl     cl,3
  6520.         or      al,cl
  6521.         stos    byte [edi]
  6522.         mov     al,dl
  6523.         stos    byte [edi]
  6524.         cmp     edx,80h
  6525.         jge     value_out_of_range
  6526.         cmp     edx,-80h
  6527.         jl      value_out_of_range
  6528.         ret
  6529.       simple_address:
  6530.         cmp     al,5
  6531.         je      simple_address_8bit_value
  6532.         mov     cl,[postbyte_register]
  6533.         shl     cl,3
  6534.         or      al,cl
  6535.         stos    byte [edi]
  6536.         ret
  6537.       address_immediate:
  6538.         cmp     [code_type],64
  6539.         je      address_immediate_sib
  6540.         test    ch,44h
  6541.         jnz     address_immediate_32bit
  6542.         test    ch,22h
  6543.         jnz     address_immediate_16bit
  6544.         or      ch,ch
  6545.         jnz     invalid_address_size
  6546.         cmp     [code_type],16
  6547.         je      addressing_16bit
  6548.       address_immediate_32bit:
  6549.         call    address_32bit_prefix
  6550.         call    store_instruction_code
  6551.       store_immediate_address:
  6552.         mov     al,101b
  6553.         mov     cl,[postbyte_register]
  6554.         shl     cl,3
  6555.         or      al,cl
  6556.         stos    byte [edi]
  6557.       store_address_32bit_value:
  6558.         test    ch,0F0h
  6559.         jz      address_32bit_relocation_ok
  6560.         mov     eax,ecx
  6561.         shr     eax,16
  6562.         cmp     al,4
  6563.         jne     address_32bit_relocation
  6564.         mov     al,2
  6565.       address_32bit_relocation:
  6566.         xchg    [value_type],al
  6567.         mov     ebx,[address_symbol]
  6568.         xchg    ebx,[symbol_identifier]
  6569.         call    mark_relocation
  6570.         mov     [value_type],al
  6571.         mov     [symbol_identifier],ebx
  6572.       address_32bit_relocation_ok:
  6573.         mov     eax,edx
  6574.         stos    dword [edi]
  6575.         ret
  6576.       store_address_64bit_value:
  6577.         test    ch,0F0h
  6578.         jz      address_64bit_relocation_ok
  6579.         mov     eax,ecx
  6580.         shr     eax,16
  6581.         xchg    [value_type],al
  6582.         mov     ebx,[address_symbol]
  6583.         xchg    ebx,[symbol_identifier]
  6584.         call    mark_relocation
  6585.         mov     [value_type],al
  6586.         mov     [symbol_identifier],ebx
  6587.       address_64bit_relocation_ok:
  6588.         mov     eax,edx
  6589.         stos    dword [edi]
  6590.         mov     eax,[address_high]
  6591.         stos    dword [edi]
  6592.         ret
  6593.       address_immediate_sib:
  6594.         test    ch,not 44h
  6595.         jnz     invalid_address_size
  6596.         test    ecx,0FF0000h
  6597.         jnz     address_immediate_sib_nosignextend
  6598.         test    edx,80000000h
  6599.         jz      address_immediate_sib_prefix_ok
  6600.       address_immediate_sib_nosignextend:
  6601.         call    address_32bit_prefix
  6602.       address_immediate_sib_prefix_ok:
  6603.         call    store_instruction_code
  6604.         mov     al,100b
  6605.         mov     ah,100101b
  6606.         mov     cl,[postbyte_register]
  6607.         shl     cl,3
  6608.         or      al,cl
  6609.         stos    word [edi]
  6610.         jmp     store_address_32bit_value
  6611.       address_eip_based:
  6612.         mov     al,67h
  6613.         stos    byte [edi]
  6614.       address_rip_based:
  6615.         cmp     [code_type],64
  6616.         jne     invalid_address
  6617.         call    store_instruction_code
  6618.         jmp     store_immediate_address
  6619.       address_relative:
  6620.         call    store_instruction_code
  6621.         movzx   eax,[immediate_size]
  6622.         add     eax,edi
  6623.         sub     eax,[current_offset]
  6624.         add     eax,5
  6625.         sub     edx,eax
  6626.         jo      value_out_of_range
  6627.         mov     al,101b
  6628.         mov     cl,[postbyte_register]
  6629.         shl     cl,3
  6630.         or      al,cl
  6631.         stos    byte [edi]
  6632.         shr     ecx,16
  6633.         xchg    [value_type],cl
  6634.         mov     ebx,[address_symbol]
  6635.         xchg    ebx,[symbol_identifier]
  6636.         mov     eax,edx
  6637.         call    mark_relocation
  6638.         mov     [value_type],cl
  6639.         mov     [symbol_identifier],ebx
  6640.         stos    dword [edi]
  6641.         ret
  6642.       addressing_16bit:
  6643.         cmp     edx,10000h
  6644.         jge     address_immediate_32bit
  6645.         cmp     edx,-8000h
  6646.         jl      address_immediate_32bit
  6647.         movzx   edx,dx
  6648.       address_immediate_16bit:
  6649.         call    address_16bit_prefix
  6650.         call    store_instruction_code
  6651.         mov     al,110b
  6652.         mov     cl,[postbyte_register]
  6653.         shl     cl,3
  6654.         or      al,cl
  6655.         stos    byte [edi]
  6656.         mov     eax,edx
  6657.         stos    word [edi]
  6658.         cmp     edx,10000h
  6659.         jge     value_out_of_range
  6660.         cmp     edx,-8000h
  6661.         jl      value_out_of_range
  6662.         ret
  6663.       address_16bit_prefix:
  6664.         cmp     [code_type],16
  6665.         je      instruction_prefix_ok
  6666.         mov     al,67h
  6667.         stos    byte [edi]
  6668.         ret
  6669.       address_32bit_prefix:
  6670.         cmp     [code_type],32
  6671.         je      instruction_prefix_ok
  6672.         mov     al,67h
  6673.         stos    byte [edi]
  6674.       instruction_prefix_ok:
  6675.         ret
  6676. store_instruction_with_imm8:
  6677.         mov     [immediate_size],1
  6678.         call    store_instruction
  6679.         mov     al,byte [value]
  6680.         stos    byte [edi]
  6681.         ret
  6682. store_instruction_with_imm16:
  6683.         mov     [immediate_size],2
  6684.         call    store_instruction
  6685.         mov     ax,word [value]
  6686.         call    mark_relocation
  6687.         stos    word [edi]
  6688.         ret
  6689. store_instruction_with_imm32:
  6690.         mov     [immediate_size],4
  6691.         call    store_instruction
  6692.         mov     eax,dword [value]
  6693.         call    mark_relocation
  6694.         stos    dword [edi]
  6695.         ret
  6696.