Subversion Repositories Kolibri OS

Rev

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