Subversion Repositories Kolibri OS

Rev

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

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