Subversion Repositories Kolibri OS

Rev

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

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