Subversion Repositories Kolibri OS

Rev

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

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