Subversion Repositories Kolibri OS

Rev

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

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