Subversion Repositories Kolibri OS

Rev

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