Subversion Repositories Kolibri OS

Rev

Rev 1054 | 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     al,48h
  48.         stos    byte [edi]
  49. simple_extended_instruction:
  50.         mov     ah,al
  51.         mov     al,0Fh
  52.         stos    word [edi]
  53.         jmp     instruction_assembled
  54. prefix_instruction:
  55.         stos    byte [edi]
  56.         or      [prefixed_instruction],-1
  57.         jmp     continue_line
  58. segment_prefix:
  59.         mov     ah,al
  60.         shr     ah,4
  61.         cmp     ah,6
  62.         jne     illegal_instruction
  63.         and     al,1111b
  64.         mov     [segment_register],al
  65.         call    store_segment_prefix
  66.         or      [prefixed_instruction],-1
  67.         jmp     continue_line
  68. int_instruction:
  69.         lods    byte [esi]
  70.         call    get_size_operator
  71.         cmp     ah,1
  72.         ja      invalid_operand_size
  73.         cmp     al,'('
  74.         jne     invalid_operand
  75.         call    get_byte_value
  76.         mov     ah,al
  77.         mov     al,0CDh
  78.         stos    word [edi]
  79.         jmp     instruction_assembled
  80. iret_instruction:
  81.         cmp     [code_type],64
  82.         jne     simple_instruction
  83.         call    operand_64bit
  84.         jmp     simple_instruction
  85. aa_instruction:
  86.         cmp     [code_type],64
  87.         je      illegal_instruction
  88.         push    eax
  89.         mov     bl,10
  90.         cmp     byte [esi],'('
  91.         jne     aa_store
  92.         inc     esi
  93.         xor     al,al
  94.         xchg    al,[operand_size]
  95.         cmp     al,1
  96.         ja      invalid_operand_size
  97.         call    get_byte_value
  98.         mov     bl,al
  99.       aa_store:
  100.         cmp     [operand_size],0
  101.         jne     invalid_operand
  102.         pop     eax
  103.         mov     ah,bl
  104.         stos    word [edi]
  105.         jmp     instruction_assembled
  106.  
  107. basic_instruction:
  108.         mov     [base_code],al
  109.         lods    byte [esi]
  110.         call    get_size_operator
  111.         cmp     al,10h
  112.         je      basic_reg
  113.         cmp     al,'['
  114.         jne     invalid_operand
  115.       basic_mem:
  116.         call    get_address
  117.         push    edx ebx ecx
  118.         lods    byte [esi]
  119.         cmp     al,','
  120.         jne     invalid_operand
  121.         lods    byte [esi]
  122.         call    get_size_operator
  123.         cmp     al,'('
  124.         je      basic_mem_imm
  125.         cmp     al,10h
  126.         jne     invalid_operand
  127.       basic_mem_reg:
  128.         lods    byte [esi]
  129.         call    convert_register
  130.         mov     [postbyte_register],al
  131.         pop     ecx ebx edx
  132.         mov     al,ah
  133.         cmp     al,1
  134.         je      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.         push    instruction_assembled
  476.         jmp     store_address_32bit_value
  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.         push    instruction_assembled
  496.         jmp     store_address_64bit_value
  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    calculate_jump_offset
  3288.         mov     ecx,edx
  3289.         cdq
  3290.         cmp     edx,ecx
  3291.         jne     value_out_of_range
  3292.         jmp     make_loop_jump
  3293.       loop_jump_16bit:
  3294.         call    get_address_word_value
  3295.         cmp     [code_type],16
  3296.         je      loop_jump_16bit_prefix_ok
  3297.         mov     byte [edi],66h
  3298.         inc     edi
  3299.       loop_jump_16bit_prefix_ok:
  3300.         call    loop_counter_size
  3301.         call    calculate_jump_offset
  3302.         cwde
  3303.         cdq
  3304.         jmp     make_loop_jump
  3305.  
  3306. movs_instruction:
  3307.         lods    byte [esi]
  3308.         call    get_size_operator
  3309.         cmp     al,'['
  3310.         jne     invalid_operand
  3311.         call    get_address
  3312.         or      eax,eax
  3313.         jnz     invalid_address
  3314.         or      bl,ch
  3315.         jnz     invalid_address
  3316.         cmp     [segment_register],1
  3317.         ja      invalid_address
  3318.         push    ebx
  3319.         lods    byte [esi]
  3320.         cmp     al,','
  3321.         jne     invalid_operand
  3322.         lods    byte [esi]
  3323.         call    get_size_operator
  3324.         cmp     al,'['
  3325.         jne     invalid_operand
  3326.         call    get_address
  3327.         pop     edx
  3328.         or      eax,eax
  3329.         jnz     invalid_address
  3330.         or      bl,ch
  3331.         jnz     invalid_address
  3332.         mov     al,dh
  3333.         mov     ah,bh
  3334.         shr     al,4
  3335.         shr     ah,4
  3336.         cmp     al,ah
  3337.         jne     address_sizes_do_not_agree
  3338.         and     bh,111b
  3339.         and     dh,111b
  3340.         cmp     bh,6
  3341.         jne     invalid_address
  3342.         cmp     dh,7
  3343.         jne     invalid_address
  3344.         cmp     al,2
  3345.         je      movs_address_16bit
  3346.         cmp     al,4
  3347.         je      movs_address_32bit
  3348.         cmp     [code_type],64
  3349.         jne     invalid_address_size
  3350.         jmp     movs_store
  3351.       movs_address_32bit:
  3352.         call    address_32bit_prefix
  3353.         jmp     movs_store
  3354.       movs_address_16bit:
  3355.         cmp     [code_type],64
  3356.         je      invalid_address_size
  3357.         call    address_16bit_prefix
  3358.       movs_store:
  3359.         cmp     [segment_register],4
  3360.         je      movs_segment_ok
  3361.         call    store_segment_prefix
  3362.       movs_segment_ok:
  3363.         mov     al,0A4h
  3364.       movs_check_size:
  3365.         mov     bl,[operand_size]
  3366.         cmp     bl,1
  3367.         je      simple_instruction
  3368.         inc     al
  3369.         cmp     bl,2
  3370.         je      simple_instruction_16bit
  3371.         cmp     bl,4
  3372.         je      simple_instruction_32bit
  3373.         cmp     bl,8
  3374.         je      simple_instruction_64bit
  3375.         or      bl,bl
  3376.         jnz     invalid_operand_size
  3377.         cmp     [error_line],0
  3378.         jne     simple_instruction
  3379.         mov     ebx,[current_line]
  3380.         mov     [error_line],ebx
  3381.         mov     [error],operand_size_not_specified
  3382.         jmp     simple_instruction
  3383. lods_instruction:
  3384.         lods    byte [esi]
  3385.         call    get_size_operator
  3386.         cmp     al,'['
  3387.         jne     invalid_operand
  3388.         call    get_address
  3389.         or      eax,eax
  3390.         jnz     invalid_address
  3391.         or      bl,ch
  3392.         jnz     invalid_address
  3393.         cmp     bh,26h
  3394.         je      lods_address_16bit
  3395.         cmp     bh,46h
  3396.         je      lods_address_32bit
  3397.         cmp     bh,86h
  3398.         jne     invalid_address
  3399.         cmp     [code_type],64
  3400.         jne     invalid_address_size
  3401.         jmp     lods_store
  3402.       lods_address_32bit:
  3403.         call    address_32bit_prefix
  3404.         jmp     lods_store
  3405.       lods_address_16bit:
  3406.         cmp     [code_type],64
  3407.         je      invalid_address_size
  3408.         call    address_16bit_prefix
  3409.       lods_store:
  3410.         cmp     [segment_register],4
  3411.         je      lods_segment_ok
  3412.         call    store_segment_prefix
  3413.       lods_segment_ok:
  3414.         mov     al,0ACh
  3415.         jmp     movs_check_size
  3416. stos_instruction:
  3417.         mov     [base_code],al
  3418.         lods    byte [esi]
  3419.         call    get_size_operator
  3420.         cmp     al,'['
  3421.         jne     invalid_operand
  3422.         call    get_address
  3423.         or      eax,eax
  3424.         jnz     invalid_address
  3425.         or      bl,ch
  3426.         jnz     invalid_address
  3427.         cmp     bh,27h
  3428.         je      stos_address_16bit
  3429.         cmp     bh,47h
  3430.         je      stos_address_32bit
  3431.         cmp     bh,87h
  3432.         jne     invalid_address
  3433.         cmp     [code_type],64
  3434.         jne     invalid_address_size
  3435.         jmp     stos_store
  3436.       stos_address_32bit:
  3437.         call    address_32bit_prefix
  3438.         jmp     stos_store
  3439.       stos_address_16bit:
  3440.         cmp     [code_type],64
  3441.         je      invalid_address_size
  3442.         call    address_16bit_prefix
  3443.       stos_store:
  3444.         cmp     [segment_register],1
  3445.         ja      invalid_address
  3446.         mov     al,[base_code]
  3447.         jmp     movs_check_size
  3448. cmps_instruction:
  3449.         lods    byte [esi]
  3450.         call    get_size_operator
  3451.         cmp     al,'['
  3452.         jne     invalid_operand
  3453.         call    get_address
  3454.         or      eax,eax
  3455.         jnz     invalid_address
  3456.         or      bl,ch
  3457.         jnz     invalid_address
  3458.         mov     al,[segment_register]
  3459.         push    eax ebx
  3460.         lods    byte [esi]
  3461.         cmp     al,','
  3462.         jne     invalid_operand
  3463.         lods    byte [esi]
  3464.         call    get_size_operator
  3465.         cmp     al,'['
  3466.         jne     invalid_operand
  3467.         call    get_address
  3468.         or      eax,eax
  3469.         jnz     invalid_address
  3470.         or      bl,ch
  3471.         jnz     invalid_address
  3472.         pop     edx eax
  3473.         cmp     [segment_register],1
  3474.         ja      invalid_address
  3475.         mov     [segment_register],al
  3476.         mov     al,dh
  3477.         mov     ah,bh
  3478.         shr     al,4
  3479.         shr     ah,4
  3480.         cmp     al,ah
  3481.         jne     address_sizes_do_not_agree
  3482.         and     bh,111b
  3483.         and     dh,111b
  3484.         cmp     bh,7
  3485.         jne     invalid_address
  3486.         cmp     dh,6
  3487.         jne     invalid_address
  3488.         cmp     al,2
  3489.         je      cmps_address_16bit
  3490.         cmp     al,4
  3491.         je      cmps_address_32bit
  3492.         cmp     [code_type],64
  3493.         jne     invalid_address_size
  3494.         jmp     cmps_store
  3495.       cmps_address_32bit:
  3496.         call    address_32bit_prefix
  3497.         jmp     cmps_store
  3498.       cmps_address_16bit:
  3499.         cmp     [code_type],64
  3500.         je      invalid_address_size
  3501.         call    address_16bit_prefix
  3502.       cmps_store:
  3503.         cmp     [segment_register],4
  3504.         je      cmps_segment_ok
  3505.         call    store_segment_prefix
  3506.       cmps_segment_ok:
  3507.         mov     al,0A6h
  3508.         jmp     movs_check_size
  3509. ins_instruction:
  3510.         lods    byte [esi]
  3511.         call    get_size_operator
  3512.         cmp     al,'['
  3513.         jne     invalid_operand
  3514.         call    get_address
  3515.         or      eax,eax
  3516.         jnz     invalid_address
  3517.         or      bl,ch
  3518.         jnz     invalid_address
  3519.         cmp     bh,27h
  3520.         je      ins_address_16bit
  3521.         cmp     bh,47h
  3522.         je      ins_address_32bit
  3523.         cmp     bh,87h
  3524.         jne     invalid_address
  3525.         cmp     [code_type],64
  3526.         jne     invalid_address_size
  3527.         jmp     ins_store
  3528.       ins_address_32bit:
  3529.         call    address_32bit_prefix
  3530.         jmp     ins_store
  3531.       ins_address_16bit:
  3532.         cmp     [code_type],64
  3533.         je      invalid_address_size
  3534.         call    address_16bit_prefix
  3535.       ins_store:
  3536.         cmp     [segment_register],1
  3537.         ja      invalid_address
  3538.         lods    byte [esi]
  3539.         cmp     al,','
  3540.         jne     invalid_operand
  3541.         lods    byte [esi]
  3542.         cmp     al,10h
  3543.         jne     invalid_operand
  3544.         lods    byte [esi]
  3545.         cmp     al,22h
  3546.         jne     invalid_operand
  3547.         mov     al,6Ch
  3548.       ins_check_size:
  3549.         cmp     [operand_size],8
  3550.         jne     movs_check_size
  3551.         jmp     invalid_operand_size
  3552. outs_instruction:
  3553.         lods    byte [esi]
  3554.         cmp     al,10h
  3555.         jne     invalid_operand
  3556.         lods    byte [esi]
  3557.         cmp     al,22h
  3558.         jne     invalid_operand
  3559.         lods    byte [esi]
  3560.         cmp     al,','
  3561.         jne     invalid_operand
  3562.         lods    byte [esi]
  3563.         call    get_size_operator
  3564.         cmp     al,'['
  3565.         jne     invalid_operand
  3566.         call    get_address
  3567.         or      eax,eax
  3568.         jnz     invalid_address
  3569.         or      bl,ch
  3570.         jnz     invalid_address
  3571.         cmp     bh,26h
  3572.         je      outs_address_16bit
  3573.         cmp     bh,46h
  3574.         je      outs_address_32bit
  3575.         cmp     bh,86h
  3576.         jne     invalid_address
  3577.         cmp     [code_type],64
  3578.         jne     invalid_address_size
  3579.         jmp     outs_store
  3580.       outs_address_32bit:
  3581.         call    address_32bit_prefix
  3582.         jmp     outs_store
  3583.       outs_address_16bit:
  3584.         cmp     [code_type],64
  3585.         je      invalid_address_size
  3586.         call    address_16bit_prefix
  3587.       outs_store:
  3588.         cmp     [segment_register],4
  3589.         je      outs_segment_ok
  3590.         call    store_segment_prefix
  3591.       outs_segment_ok:
  3592.         mov     al,6Eh
  3593.         jmp     ins_check_size
  3594. xlat_instruction:
  3595.         lods    byte [esi]
  3596.         call    get_size_operator
  3597.         cmp     al,'['
  3598.         jne     invalid_operand
  3599.         call    get_address
  3600.         or      eax,eax
  3601.         jnz     invalid_address
  3602.         or      bl,ch
  3603.         jnz     invalid_address
  3604.         cmp     bh,23h
  3605.         je      xlat_address_16bit
  3606.         cmp     bh,43h
  3607.         je      xlat_address_32bit
  3608.         cmp     bh,83h
  3609.         jne     invalid_address
  3610.         cmp     [code_type],64
  3611.         jne     invalid_address_size
  3612.         jmp     xlat_store
  3613.       xlat_address_32bit:
  3614.         call    address_32bit_prefix
  3615.         jmp     xlat_store
  3616.       xlat_address_16bit:
  3617.         cmp     [code_type],64
  3618.         je      invalid_address_size
  3619.         call    address_16bit_prefix
  3620.       xlat_store:
  3621.         call    store_segment_prefix_if_necessary
  3622.         mov     al,0D7h
  3623.         cmp     [operand_size],1
  3624.         jbe     simple_instruction
  3625.         jmp     invalid_operand_size
  3626.  
  3627. pm_word_instruction:
  3628.         mov     ah,al
  3629.         shr     ah,4
  3630.         and     al,111b
  3631.         mov     [base_code],0Fh
  3632.         mov     [extended_code],ah
  3633.         mov     [postbyte_register],al
  3634.         lods    byte [esi]
  3635.         call    get_size_operator
  3636.         cmp     al,10h
  3637.         je      pm_reg
  3638.       pm_mem:
  3639.         cmp     al,'['
  3640.         jne     invalid_operand
  3641.         call    get_address
  3642.         mov     al,[operand_size]
  3643.         cmp     al,2
  3644.         je      pm_mem_store
  3645.         or      al,al
  3646.         jnz     invalid_operand_size
  3647.       pm_mem_store:
  3648.         jmp     instruction_ready
  3649.       pm_reg:
  3650.         lods    byte [esi]
  3651.         call    convert_register
  3652.         mov     bl,al
  3653.         cmp     ah,2
  3654.         jne     invalid_operand_size
  3655.         jmp     nomem_instruction_ready
  3656. pm_store_word_instruction:
  3657.         mov     ah,al
  3658.         shr     ah,4
  3659.         and     al,111b
  3660.         mov     [base_code],0Fh
  3661.         mov     [extended_code],ah
  3662.         mov     [postbyte_register],al
  3663.         lods    byte [esi]
  3664.         call    get_size_operator
  3665.         cmp     al,10h
  3666.         jne     pm_mem
  3667.         lods    byte [esi]
  3668.         call    convert_register
  3669.         mov     bl,al
  3670.         mov     al,ah
  3671.         call    operand_autodetect
  3672.         jmp     nomem_instruction_ready
  3673. lgdt_instruction:
  3674.         mov     [base_code],0Fh
  3675.         mov     [extended_code],1
  3676.         mov     [postbyte_register],al
  3677.         lods    byte [esi]
  3678.         call    get_size_operator
  3679.         cmp     al,'['
  3680.         jne     invalid_operand
  3681.         call    get_address
  3682.         mov     al,[operand_size]
  3683.         cmp     al,6
  3684.         je      lgdt_mem_48bit
  3685.         cmp     al,10
  3686.         je      lgdt_mem_80bit
  3687.         or      al,al
  3688.         jnz     invalid_operand_size
  3689.         jmp     lgdt_mem_store
  3690.       lgdt_mem_80bit:
  3691.         cmp     [code_type],64
  3692.         jne     illegal_instruction
  3693.         jmp     lgdt_mem_store
  3694.       lgdt_mem_48bit:
  3695.         cmp     [code_type],64
  3696.         je      illegal_instruction
  3697.         cmp     [postbyte_register],2
  3698.         jb      lgdt_mem_store
  3699.         call    operand_32bit
  3700.       lgdt_mem_store:
  3701.         jmp     instruction_ready
  3702. lar_instruction:
  3703.         mov     [extended_code],al
  3704.         mov     [base_code],0Fh
  3705.         lods    byte [esi]
  3706.         call    get_size_operator
  3707.         cmp     al,10h
  3708.         jne     invalid_operand
  3709.         lods    byte [esi]
  3710.         call    convert_register
  3711.         mov     [postbyte_register],al
  3712.         lods    byte [esi]
  3713.         cmp     al,','
  3714.         jne     invalid_operand
  3715.         xor     al,al
  3716.         xchg    al,[operand_size]
  3717.         call    operand_autodetect
  3718.         lods    byte [esi]
  3719.         call    get_size_operator
  3720.         cmp     al,10h
  3721.         je      lar_reg_reg
  3722.         cmp     al,'['
  3723.         jne     invalid_operand
  3724.         call    get_address
  3725.         mov     al,[operand_size]
  3726.         or      al,al
  3727.         jz      lar_reg_mem
  3728.         cmp     al,2
  3729.         jne     invalid_operand_size
  3730.       lar_reg_mem:
  3731.         jmp     instruction_ready
  3732.       lar_reg_reg:
  3733.         lods    byte [esi]
  3734.         call    convert_register
  3735.         cmp     ah,2
  3736.         jne     invalid_operand_size
  3737.         mov     bl,al
  3738.         jmp     nomem_instruction_ready
  3739. invlpg_instruction:
  3740.         mov     [base_code],0Fh
  3741.         mov     [extended_code],1
  3742.         mov     [postbyte_register],7
  3743.         lods    byte [esi]
  3744.         call    get_size_operator
  3745.         cmp     al,'['
  3746.         jne     invalid_operand
  3747.         call    get_address
  3748.         jmp     instruction_ready
  3749. swapgs_instruction:
  3750.         mov     [base_code],0Fh
  3751.         mov     [extended_code],1
  3752.         mov     [postbyte_register],7
  3753.         mov     bl,al
  3754.         jmp     nomem_instruction_ready
  3755.  
  3756. basic_486_instruction:
  3757.         mov     [base_code],0Fh
  3758.         mov     [extended_code],al
  3759.         lods    byte [esi]
  3760.         call    get_size_operator
  3761.         cmp     al,10h
  3762.         je      basic_486_reg
  3763.         cmp     al,'['
  3764.         jne     invalid_operand
  3765.         call    get_address
  3766.         push    edx ebx ecx
  3767.         lods    byte [esi]
  3768.         cmp     al,','
  3769.         jne     invalid_operand
  3770.         lods    byte [esi]
  3771.         call    get_size_operator
  3772.         cmp     al,10h
  3773.         jne     invalid_operand
  3774.         lods    byte [esi]
  3775.         call    convert_register
  3776.         mov     [postbyte_register],al
  3777.         pop     ecx ebx edx
  3778.         mov     al,ah
  3779.         cmp     al,1
  3780.         je      basic_486_mem_reg_8bit
  3781.         call    operand_autodetect
  3782.         inc     [extended_code]
  3783.       basic_486_mem_reg_8bit:
  3784.         jmp     instruction_ready
  3785.       basic_486_reg:
  3786.         lods    byte [esi]
  3787.         call    convert_register
  3788.         mov     [postbyte_register],al
  3789.         lods    byte [esi]
  3790.         cmp     al,','
  3791.         jne     invalid_operand
  3792.         lods    byte [esi]
  3793.         call    get_size_operator
  3794.         cmp     al,10h
  3795.         jne     invalid_operand
  3796.         lods    byte [esi]
  3797.         call    convert_register
  3798.         mov     bl,[postbyte_register]
  3799.         mov     [postbyte_register],al
  3800.         mov     al,ah
  3801.         cmp     al,1
  3802.         je      basic_486_reg_reg_8bit
  3803.         call    operand_autodetect
  3804.         inc     [extended_code]
  3805.       basic_486_reg_reg_8bit:
  3806.         jmp     nomem_instruction_ready
  3807. bswap_instruction:
  3808.         lods    byte [esi]
  3809.         call    get_size_operator
  3810.         cmp     al,10h
  3811.         jne     invalid_operand
  3812.         lods    byte [esi]
  3813.         call    convert_register
  3814.         test    al,1000b
  3815.         jz      bswap_reg_code_ok
  3816.         or      [rex_prefix],41h
  3817.         and     al,111b
  3818.       bswap_reg_code_ok:
  3819.         add     al,0C8h
  3820.         mov     [extended_code],al
  3821.         mov     [base_code],0Fh
  3822.         cmp     ah,8
  3823.         je      bswap_reg64
  3824.         cmp     ah,4
  3825.         jne     invalid_operand_size
  3826.         call    operand_32bit
  3827.         call    store_instruction_code
  3828.         jmp     instruction_assembled
  3829.       bswap_reg64:
  3830.         call    operand_64bit
  3831.         call    store_instruction_code
  3832.         jmp     instruction_assembled
  3833. cmpxchgx_instruction:
  3834.         mov     [base_code],0Fh
  3835.         mov     [extended_code],0C7h
  3836.         mov     [postbyte_register],al
  3837.         lods    byte [esi]
  3838.         call    get_size_operator
  3839.         cmp     al,'['
  3840.         jne     invalid_operand
  3841.         call    get_address
  3842.         mov     ah,1
  3843.         xchg    [postbyte_register],ah
  3844.         mov     al,[operand_size]
  3845.         or      al,al
  3846.         jz      cmpxchgx_size_ok
  3847.         cmp     al,ah
  3848.         jne     invalid_operand_size
  3849.       cmpxchgx_size_ok:
  3850.         cmp     ah,16
  3851.         jne     cmpxchgx_store
  3852.         call    operand_64bit
  3853.       cmpxchgx_store:
  3854.         jmp     instruction_ready
  3855. nop_instruction:
  3856.         mov     ah,[esi]
  3857.         cmp     ah,10h
  3858.         je      extended_nop
  3859.         cmp     ah,11h
  3860.         je      extended_nop
  3861.         cmp     ah,'['
  3862.         je      extended_nop
  3863.         stos    byte [edi]
  3864.         jmp     instruction_assembled
  3865.       extended_nop:
  3866.         mov     [base_code],0Fh
  3867.         mov     [extended_code],1Fh
  3868.         mov     [postbyte_register],0
  3869.         lods    byte [esi]
  3870.         call    get_size_operator
  3871.         cmp     al,10h
  3872.         je      extended_nop_reg
  3873.         cmp     al,'['
  3874.         jne     invalid_operand
  3875.         call    get_address
  3876.         mov     al,[operand_size]
  3877.         or      al,al
  3878.         jz      extended_nop_store
  3879.         call    operand_autodetect
  3880.       extended_nop_store:
  3881.         jmp     instruction_ready
  3882.       extended_nop_reg:
  3883.         lods    byte [esi]
  3884.         call    convert_register
  3885.         mov     bl,al
  3886.         mov     al,ah
  3887.         call    operand_autodetect
  3888.         jmp     nomem_instruction_ready
  3889.  
  3890. basic_fpu_instruction:
  3891.         mov     [postbyte_register],al
  3892.         mov     [base_code],0D8h
  3893.         lods    byte [esi]
  3894.         call    get_size_operator
  3895.         cmp     al,10h
  3896.         je      basic_fpu_streg
  3897.         cmp     al,'['
  3898.         je      basic_fpu_mem
  3899.         dec     esi
  3900.         mov     ah,[postbyte_register]
  3901.         cmp     ah,2
  3902.         jb      invalid_operand
  3903.         cmp     ah,3
  3904.         ja      invalid_operand
  3905.         mov     bl,1
  3906.         jmp     nomem_instruction_ready
  3907.       basic_fpu_mem:
  3908.         call    get_address
  3909.         mov     al,[operand_size]
  3910.         cmp     al,4
  3911.         je      basic_fpu_mem_32bit
  3912.         cmp     al,8
  3913.         je      basic_fpu_mem_64bit
  3914.         or      al,al
  3915.         jnz     invalid_operand_size
  3916.         cmp     [error_line],0
  3917.         jne     basic_fpu_mem_32bit
  3918.         mov     eax,[current_line]
  3919.         mov     [error_line],eax
  3920.         mov     [error],operand_size_not_specified
  3921.       basic_fpu_mem_32bit:
  3922.         jmp     instruction_ready
  3923.       basic_fpu_mem_64bit:
  3924.         mov     [base_code],0DCh
  3925.         jmp     instruction_ready
  3926.       basic_fpu_streg:
  3927.         lods    byte [esi]
  3928.         call    convert_fpu_register
  3929.         mov     bl,al
  3930.         mov     ah,[postbyte_register]
  3931.         cmp     ah,2
  3932.         je      basic_fpu_single_streg
  3933.         cmp     ah,3
  3934.         je      basic_fpu_single_streg
  3935.         or      al,al
  3936.         jz      basic_fpu_st0
  3937.         test    ah,110b
  3938.         jz      basic_fpu_streg_st0
  3939.         xor     [postbyte_register],1
  3940.       basic_fpu_streg_st0:
  3941.         lods    byte [esi]
  3942.         cmp     al,','
  3943.         jne     invalid_operand
  3944.         lods    byte [esi]
  3945.         call    get_size_operator
  3946.         cmp     al,10h
  3947.         jne     invalid_operand
  3948.         lods    byte [esi]
  3949.         call    convert_fpu_register
  3950.         or      al,al
  3951.         jnz     invalid_operand
  3952.         mov     [base_code],0DCh
  3953.         jmp     nomem_instruction_ready
  3954.       basic_fpu_st0:
  3955.         lods    byte [esi]
  3956.         cmp     al,','
  3957.         jne     invalid_operand
  3958.         lods    byte [esi]
  3959.         call    get_size_operator
  3960.         cmp     al,10h
  3961.         jne     invalid_operand
  3962.         lods    byte [esi]
  3963.         call    convert_fpu_register
  3964.         mov     bl,al
  3965.       basic_fpu_single_streg:
  3966.         mov     [base_code],0D8h
  3967.         jmp     nomem_instruction_ready
  3968. simple_fpu_instruction:
  3969.         mov     ah,al
  3970.         or      ah,11000000b
  3971.         mov     al,0D9h
  3972.         stos    word [edi]
  3973.         jmp     instruction_assembled
  3974. fi_instruction:
  3975.         mov     [postbyte_register],al
  3976.         lods    byte [esi]
  3977.         call    get_size_operator
  3978.         cmp     al,'['
  3979.         jne     invalid_operand
  3980.         call    get_address
  3981.         mov     al,[operand_size]
  3982.         cmp     al,2
  3983.         je      fi_mem_16bit
  3984.         cmp     al,4
  3985.         je      fi_mem_32bit
  3986.         or      al,al
  3987.         jnz     invalid_operand_size
  3988.         cmp     [error_line],0
  3989.         jne     fi_mem_32bit
  3990.         mov     eax,[current_line]
  3991.         mov     [error_line],eax
  3992.         mov     [error],operand_size_not_specified
  3993.       fi_mem_32bit:
  3994.         mov     [base_code],0DAh
  3995.         jmp     instruction_ready
  3996.       fi_mem_16bit:
  3997.         mov     [base_code],0DEh
  3998.         jmp     instruction_ready
  3999. fld_instruction:
  4000.         mov     [postbyte_register],al
  4001.         lods    byte [esi]
  4002.         call    get_size_operator
  4003.         cmp     al,10h
  4004.         je      fld_streg
  4005.         cmp     al,'['
  4006.         jne     invalid_operand
  4007.         call    get_address
  4008.         mov     al,[operand_size]
  4009.         cmp     al,4
  4010.         je      fld_mem_32bit
  4011.         cmp     al,8
  4012.         je      fld_mem_64bit
  4013.         cmp     al,10
  4014.         je      fld_mem_80bit
  4015.         or      al,al
  4016.         jnz     invalid_operand_size
  4017.         cmp     [error_line],0
  4018.         jne     fld_mem_32bit
  4019.         mov     eax,[current_line]
  4020.         mov     [error_line],eax
  4021.         mov     [error],operand_size_not_specified
  4022.       fld_mem_32bit:
  4023.         mov     [base_code],0D9h
  4024.         jmp     instruction_ready
  4025.       fld_mem_64bit:
  4026.         mov     [base_code],0DDh
  4027.         jmp     instruction_ready
  4028.       fld_mem_80bit:
  4029.         mov     al,[postbyte_register]
  4030.         cmp     al,0
  4031.         je      fld_mem_80bit_store
  4032.         dec     [postbyte_register]
  4033.         cmp     al,3
  4034.         je      fld_mem_80bit_store
  4035.         jmp     invalid_operand_size
  4036.       fld_mem_80bit_store:
  4037.         add     [postbyte_register],5
  4038.         mov     [base_code],0DBh
  4039.         jmp     instruction_ready
  4040.       fld_streg:
  4041.         lods    byte [esi]
  4042.         call    convert_fpu_register
  4043.         mov     bl,al
  4044.         cmp     [postbyte_register],2
  4045.         jae     fst_streg
  4046.         mov     [base_code],0D9h
  4047.         jmp     nomem_instruction_ready
  4048.       fst_streg:
  4049.         mov     [base_code],0DDh
  4050.         jmp     nomem_instruction_ready
  4051. fild_instruction:
  4052.         mov     [postbyte_register],al
  4053.         lods    byte [esi]
  4054.         call    get_size_operator
  4055.         cmp     al,'['
  4056.         jne     invalid_operand
  4057.         call    get_address
  4058.         mov     al,[operand_size]
  4059.         cmp     al,2
  4060.         je      fild_mem_16bit
  4061.         cmp     al,4
  4062.         je      fild_mem_32bit
  4063.         cmp     al,8
  4064.         je      fild_mem_64bit
  4065.         or      al,al
  4066.         jnz     invalid_operand_size
  4067.         cmp     [error_line],0
  4068.         jne     fild_mem_32bit
  4069.         mov     eax,[current_line]
  4070.         mov     [error_line],eax
  4071.         mov     [error],operand_size_not_specified
  4072.       fild_mem_32bit:
  4073.         mov     [base_code],0DBh
  4074.         jmp     instruction_ready
  4075.       fild_mem_16bit:
  4076.         mov     [base_code],0DFh
  4077.         jmp     instruction_ready
  4078.       fild_mem_64bit:
  4079.         mov     al,[postbyte_register]
  4080.         cmp     al,1
  4081.         je      fisttp_64bit_store
  4082.         jb      fild_mem_64bit_store
  4083.         dec     [postbyte_register]
  4084.         cmp     al,3
  4085.         je      fild_mem_64bit_store
  4086.         jmp     invalid_operand_size
  4087.       fild_mem_64bit_store:
  4088.         add     [postbyte_register],5
  4089.         mov     [base_code],0DFh
  4090.         jmp     instruction_ready
  4091.       fisttp_64bit_store:
  4092.         mov     [base_code],0DDh
  4093.         jmp     instruction_ready
  4094. fbld_instruction:
  4095.         mov     [postbyte_register],al
  4096.         lods    byte [esi]
  4097.         call    get_size_operator
  4098.         cmp     al,'['
  4099.         jne     invalid_operand
  4100.         call    get_address
  4101.         mov     al,[operand_size]
  4102.         or      al,al
  4103.         jz      fbld_mem_80bit
  4104.         cmp     al,10
  4105.         je      fbld_mem_80bit
  4106.         jmp     invalid_operand_size
  4107.       fbld_mem_80bit:
  4108.         mov     [base_code],0DFh
  4109.         jmp     instruction_ready
  4110. faddp_instruction:
  4111.         mov     [postbyte_register],al
  4112.         mov     [base_code],0DEh
  4113.         mov     edx,esi
  4114.         lods    byte [esi]
  4115.         call    get_size_operator
  4116.         cmp     al,10h
  4117.         je      faddp_streg
  4118.         mov     esi,edx
  4119.         mov     bl,1
  4120.         jmp     nomem_instruction_ready
  4121.       faddp_streg:
  4122.         lods    byte [esi]
  4123.         call    convert_fpu_register
  4124.         mov     bl,al
  4125.         lods    byte [esi]
  4126.         cmp     al,','
  4127.         jne     invalid_operand
  4128.         lods    byte [esi]
  4129.         call    get_size_operator
  4130.         cmp     al,10h
  4131.         jne     invalid_operand
  4132.         lods    byte [esi]
  4133.         call    convert_fpu_register
  4134.         or      al,al
  4135.         jnz     invalid_operand
  4136.         jmp     nomem_instruction_ready
  4137. fcompp_instruction:
  4138.         mov     ax,0D9DEh
  4139.         stos    word [edi]
  4140.         jmp     instruction_assembled
  4141. fucompp_instruction:
  4142.         mov     ax,0E9DAh
  4143.         stos    word [edi]
  4144.         jmp     instruction_assembled
  4145. fxch_instruction:
  4146.         mov     dx,01D9h
  4147.         jmp     fpu_single_operand
  4148. ffreep_instruction:
  4149.         mov     dx,00DFh
  4150.         jmp     fpu_single_operand
  4151. ffree_instruction:
  4152.         mov     dl,0DDh
  4153.         mov     dh,al
  4154.       fpu_single_operand:
  4155.         mov     ebx,esi
  4156.         lods    byte [esi]
  4157.         call    get_size_operator
  4158.         cmp     al,10h
  4159.         je      fpu_streg
  4160.         or      dh,dh
  4161.         jz      invalid_operand
  4162.         mov     esi,ebx
  4163.         shl     dh,3
  4164.         or      dh,11000001b
  4165.         mov     ax,dx
  4166.         stos    word [edi]
  4167.         jmp     instruction_assembled
  4168.       fpu_streg:
  4169.         lods    byte [esi]
  4170.         call    convert_fpu_register
  4171.         shl     dh,3
  4172.         or      dh,al
  4173.         or      dh,11000000b
  4174.         mov     ax,dx
  4175.         stos    word [edi]
  4176.         jmp     instruction_assembled
  4177.  
  4178. fstenv_instruction:
  4179.         mov     byte [edi],9Bh
  4180.         inc     edi
  4181. fldenv_instruction:
  4182.         mov     [base_code],0D9h
  4183.         jmp     fpu_mem
  4184. fstenv_instruction_16bit:
  4185.         mov     byte [edi],9Bh
  4186.         inc     edi
  4187. fldenv_instruction_16bit:
  4188.         call    operand_16bit
  4189.         jmp     fldenv_instruction
  4190. fstenv_instruction_32bit:
  4191.         mov     byte [edi],9Bh
  4192.         inc     edi
  4193. fldenv_instruction_32bit:
  4194.         call    operand_32bit
  4195.         jmp     fldenv_instruction
  4196. fsave_instruction_32bit:
  4197.         mov     byte [edi],9Bh
  4198.         inc     edi
  4199. fnsave_instruction_32bit:
  4200.         call    operand_32bit
  4201.         jmp     fnsave_instruction
  4202. fsave_instruction_16bit:
  4203.         mov     byte [edi],9Bh
  4204.         inc     edi
  4205. fnsave_instruction_16bit:
  4206.         call    operand_16bit
  4207.         jmp     fnsave_instruction
  4208. fsave_instruction:
  4209.         mov     byte [edi],9Bh
  4210.         inc     edi
  4211. fnsave_instruction:
  4212.         mov     [base_code],0DDh
  4213.       fpu_mem:
  4214.         mov     [postbyte_register],al
  4215.         lods    byte [esi]
  4216.         call    get_size_operator
  4217.         cmp     al,'['
  4218.         jne     invalid_operand
  4219.         call    get_address
  4220.         cmp     [operand_size],0
  4221.         jne     invalid_operand_size
  4222.         jmp     instruction_ready
  4223. fstcw_instruction:
  4224.         mov     byte [edi],9Bh
  4225.         inc     edi
  4226. fldcw_instruction:
  4227.         mov     [postbyte_register],al
  4228.         mov     [base_code],0D9h
  4229.         lods    byte [esi]
  4230.         call    get_size_operator
  4231.         cmp     al,'['
  4232.         jne     invalid_operand
  4233.         call    get_address
  4234.         mov     al,[operand_size]
  4235.         or      al,al
  4236.         jz      fldcw_mem_16bit
  4237.         cmp     al,2
  4238.         je      fldcw_mem_16bit
  4239.         jmp     invalid_operand_size
  4240.       fldcw_mem_16bit:
  4241.         jmp     instruction_ready
  4242. fstsw_instruction:
  4243.         mov     al,9Bh
  4244.         stos    byte [edi]
  4245. fnstsw_instruction:
  4246.         mov     [base_code],0DDh
  4247.         mov     [postbyte_register],7
  4248.         lods    byte [esi]
  4249.         call    get_size_operator
  4250.         cmp     al,10h
  4251.         je      fstsw_reg
  4252.         cmp     al,'['
  4253.         jne     invalid_operand
  4254.         call    get_address
  4255.         mov     al,[operand_size]
  4256.         or      al,al
  4257.         jz      fstsw_mem_16bit
  4258.         cmp     al,2
  4259.         je      fstsw_mem_16bit
  4260.         jmp     invalid_operand_size
  4261.       fstsw_mem_16bit:
  4262.         jmp     instruction_ready
  4263.       fstsw_reg:
  4264.         lods    byte [esi]
  4265.         call    convert_register
  4266.         cmp     ax,0200h
  4267.         jne     invalid_operand
  4268.         mov     ax,0E0DFh
  4269.         stos    word [edi]
  4270.         jmp     instruction_assembled
  4271. finit_instruction:
  4272.         mov     byte [edi],9Bh
  4273.         inc     edi
  4274. fninit_instruction:
  4275.         mov     ah,al
  4276.         mov     al,0DBh
  4277.         stos    word [edi]
  4278.         jmp     instruction_assembled
  4279. fcmov_instruction:
  4280.         mov     dh,0DAh
  4281.         jmp     fcomi_streg
  4282. fcomi_instruction:
  4283.         mov     dh,0DBh
  4284.         jmp     fcomi_streg
  4285. fcomip_instruction:
  4286.         mov     dh,0DFh
  4287.       fcomi_streg:
  4288.         mov     dl,al
  4289.         lods    byte [esi]
  4290.         call    get_size_operator
  4291.         cmp     al,10h
  4292.         jne     invalid_operand
  4293.         lods    byte [esi]
  4294.         call    convert_fpu_register
  4295.         mov     ah,al
  4296.         cmp     byte [esi],','
  4297.         je      fcomi_st0_streg
  4298.         add     ah,dl
  4299.         mov     al,dh
  4300.         stos    word [edi]
  4301.         jmp     instruction_assembled
  4302.       fcomi_st0_streg:
  4303.         or      ah,ah
  4304.         jnz     invalid_operand
  4305.         inc     esi
  4306.         lods    byte [esi]
  4307.         call    get_size_operator
  4308.         cmp     al,10h
  4309.         jne     invalid_operand
  4310.         lods    byte [esi]
  4311.         call    convert_fpu_register
  4312.         mov     ah,al
  4313.         add     ah,dl
  4314.         mov     al,dh
  4315.         stos    word [edi]
  4316.         jmp     instruction_assembled
  4317.  
  4318. basic_mmx_instruction:
  4319.         mov     [base_code],0Fh
  4320.         mov     [extended_code],al
  4321.       mmx_instruction:
  4322.         lods    byte [esi]
  4323.         call    get_size_operator
  4324.         cmp     al,10h
  4325.         jne     invalid_operand
  4326.         lods    byte [esi]
  4327.         call    convert_mmx_register
  4328.         call    make_mmx_prefix
  4329.         mov     [postbyte_register],al
  4330.         lods    byte [esi]
  4331.         cmp     al,','
  4332.         jne     invalid_operand
  4333.         lods    byte [esi]
  4334.         call    get_size_operator
  4335.         cmp     al,10h
  4336.         je      mmx_mmreg_mmreg
  4337.         cmp     al,'['
  4338.         jne     invalid_operand
  4339.       mmx_mmreg_mem:
  4340.         call    get_address
  4341.         jmp     instruction_ready
  4342.       mmx_mmreg_mmreg:
  4343.         lods    byte [esi]
  4344.         call    convert_mmx_register
  4345.         mov     bl,al
  4346.         jmp     nomem_instruction_ready
  4347. mmx_ps_instruction:
  4348.         mov     [base_code],0Fh
  4349.         mov     [extended_code],al
  4350.         lods    byte [esi]
  4351.         call    get_size_operator
  4352.         cmp     al,10h
  4353.         jne     invalid_operand
  4354.         lods    byte [esi]
  4355.         call    convert_mmx_register
  4356.         call    make_mmx_prefix
  4357.         mov     [postbyte_register],al
  4358.         lods    byte [esi]
  4359.         cmp     al,','
  4360.         jne     invalid_operand
  4361.         mov     [operand_size],0
  4362.         lods    byte [esi]
  4363.         call    get_size_operator
  4364.         cmp     al,10h
  4365.         je      mmx_mmreg_mmreg
  4366.         cmp     al,'('
  4367.         je      mmx_ps_mmreg_imm8
  4368.         cmp     al,'['
  4369.         je      mmx_mmreg_mem
  4370.         jmp     invalid_operand
  4371.       mmx_ps_mmreg_imm8:
  4372.         call    get_byte_value
  4373.         mov     byte [value],al
  4374.         test    [operand_size],not 1
  4375.         jnz     invalid_value
  4376.         mov     bl,[extended_code]
  4377.         mov     al,bl
  4378.         shr     bl,4
  4379.         and     al,1111b
  4380.         add     al,70h
  4381.         mov     [extended_code],al
  4382.         sub     bl,0Ch
  4383.         shl     bl,1
  4384.         xchg    bl,[postbyte_register]
  4385.         call    store_nomem_instruction
  4386.         mov     al,byte [value]
  4387.         stos    byte [edi]
  4388.         jmp     instruction_assembled
  4389. pmovmskb_instruction:
  4390.         mov     [base_code],0Fh
  4391.         mov     [extended_code],al
  4392.         lods    byte [esi]
  4393.         call    get_size_operator
  4394.         cmp     al,10h
  4395.         jne     invalid_operand
  4396.         lods    byte [esi]
  4397.         call    convert_register
  4398.         cmp     ah,4
  4399.         jnz     invalid_operand_size
  4400.         mov     [postbyte_register],al
  4401.         mov     [operand_size],0
  4402.         lods    byte [esi]
  4403.         cmp     al,','
  4404.         jne     invalid_operand
  4405.         lods    byte [esi]
  4406.         call    get_size_operator
  4407.         cmp     al,10h
  4408.         jne     invalid_operand
  4409.         lods    byte [esi]
  4410.         call    convert_mmx_register
  4411.         mov     bl,al
  4412.         call    make_mmx_prefix
  4413.         cmp     [extended_code],0C5h
  4414.         je      mmx_nomem_imm8
  4415.         jmp     nomem_instruction_ready
  4416.       mmx_imm8:
  4417.         push    ebx ecx edx
  4418.         mov     [operand_size],0
  4419.         lods    byte [esi]
  4420.         cmp     al,','
  4421.         jne     invalid_operand
  4422.         lods    byte [esi]
  4423.         call    get_size_operator
  4424.         test    ah,not 1
  4425.         jnz     invalid_operand_size
  4426.         cmp     al,'('
  4427.         jne     invalid_operand
  4428.         call    get_byte_value
  4429.         mov     byte [value],al
  4430.         pop     edx ecx ebx
  4431.         call    store_instruction_with_imm8
  4432.         jmp     instruction_assembled
  4433.       mmx_nomem_imm8:
  4434.         call    store_nomem_instruction
  4435.         call    append_imm8
  4436.         jmp     instruction_assembled
  4437.       append_imm8:
  4438.         mov     [operand_size],0
  4439.         lods    byte [esi]
  4440.         cmp     al,','
  4441.         jne     invalid_operand
  4442.         lods    byte [esi]
  4443.         call    get_size_operator
  4444.         test    ah,not 1
  4445.         jnz     invalid_operand_size
  4446.         cmp     al,'('
  4447.         jne     invalid_operand
  4448.         call    get_byte_value
  4449.         stosb
  4450.         ret
  4451. pinsrw_instruction:
  4452.         mov     [extended_code],al
  4453.         mov     [base_code],0Fh
  4454.         lods    byte [esi]
  4455.         call    get_size_operator
  4456.         cmp     al,10h
  4457.         jne     invalid_operand
  4458.         lods    byte [esi]
  4459.         call    convert_mmx_register
  4460.         call    make_mmx_prefix
  4461.         mov     [postbyte_register],al
  4462.         mov     [operand_size],0
  4463.         lods    byte [esi]
  4464.         cmp     al,','
  4465.         jne     invalid_operand
  4466.         lods    byte [esi]
  4467.         call    get_size_operator
  4468.         cmp     al,10h
  4469.         je      pinsrw_mmreg_reg
  4470.         cmp     al,'['
  4471.         jne     invalid_operand
  4472.         call    get_address
  4473.         cmp     [operand_size],0
  4474.         je      mmx_imm8
  4475.         cmp     [operand_size],2
  4476.         jne     invalid_operand_size
  4477.         jmp     mmx_imm8
  4478.       pinsrw_mmreg_reg:
  4479.         lods    byte [esi]
  4480.         call    convert_register
  4481.         cmp     ah,4
  4482.         jne     invalid_operand_size
  4483.         mov     bl,al
  4484.         jmp     mmx_nomem_imm8
  4485. pshufw_instruction:
  4486.         mov     [mmx_size],8
  4487.         mov     [opcode_prefix],al
  4488.         jmp     pshuf_instruction
  4489. pshufd_instruction:
  4490.         mov     [mmx_size],16
  4491.         mov     [opcode_prefix],al
  4492.       pshuf_instruction:
  4493.         mov     [base_code],0Fh
  4494.         mov     [extended_code],70h
  4495.         lods    byte [esi]
  4496.         call    get_size_operator
  4497.         cmp     al,10h
  4498.         jne     invalid_operand
  4499.         lods    byte [esi]
  4500.         call    convert_mmx_register
  4501.         cmp     ah,[mmx_size]
  4502.         jne     invalid_operand_size
  4503.         mov     [postbyte_register],al
  4504.         lods    byte [esi]
  4505.         cmp     al,','
  4506.         jne     invalid_operand
  4507.         lods    byte [esi]
  4508.         call    get_size_operator
  4509.         cmp     al,10h
  4510.         je      pshuf_mmreg_mmreg
  4511.         cmp     al,'['
  4512.         jne     invalid_operand
  4513.         call    get_address
  4514.         jmp     mmx_imm8
  4515.       pshuf_mmreg_mmreg:
  4516.         lods    byte [esi]
  4517.         call    convert_mmx_register
  4518.         mov     bl,al
  4519.         jmp     mmx_nomem_imm8
  4520. movd_instruction:
  4521.         mov     [base_code],0Fh
  4522.         mov     [extended_code],7Eh
  4523.         lods    byte [esi]
  4524.         call    get_size_operator
  4525.         cmp     al,10h
  4526.         je      movd_reg
  4527.         cmp     al,'['
  4528.         jne     invalid_operand
  4529.         call    get_address
  4530.         test    [operand_size],not 4
  4531.         jnz     invalid_operand_size
  4532.         mov     [operand_size],0
  4533.         lods    byte [esi]
  4534.         cmp     al,','
  4535.         jne     invalid_operand
  4536.         lods    byte [esi]
  4537.         call    get_size_operator
  4538.         cmp     al,10h
  4539.         jne     invalid_operand
  4540.         lods    byte [esi]
  4541.         call    convert_mmx_register
  4542.         call    make_mmx_prefix
  4543.         mov     [postbyte_register],al
  4544.         jmp     instruction_ready
  4545.       movd_reg:
  4546.         lods    byte [esi]
  4547.         cmp     al,0B0h
  4548.         jae     movd_mmreg
  4549.         call    convert_register
  4550.         cmp     ah,4
  4551.         jne     invalid_operand_size
  4552.         mov     [operand_size],0
  4553.         mov     bl,al
  4554.         lods    byte [esi]
  4555.         cmp     al,','
  4556.         jne     invalid_operand
  4557.         lods    byte [esi]
  4558.         call    get_size_operator
  4559.         cmp     al,10h
  4560.         jne     invalid_operand
  4561.         lods    byte [esi]
  4562.         call    convert_mmx_register
  4563.         mov     [postbyte_register],al
  4564.         call    make_mmx_prefix
  4565.         jmp     nomem_instruction_ready
  4566.       movd_mmreg:
  4567.         mov     [extended_code],6Eh
  4568.         call    convert_mmx_register
  4569.         call    make_mmx_prefix
  4570.         mov     [postbyte_register],al
  4571.         mov     [operand_size],0
  4572.         lods    byte [esi]
  4573.         cmp     al,','
  4574.         jne     invalid_operand
  4575.         lods    byte [esi]
  4576.         call    get_size_operator
  4577.         cmp     al,10h
  4578.         je      movd_mmreg_reg
  4579.         cmp     al,'['
  4580.         jne     invalid_operand
  4581.         call    get_address
  4582.         test    [operand_size],not 4
  4583.         jnz     invalid_operand_size
  4584.         jmp     instruction_ready
  4585.       movd_mmreg_reg:
  4586.         lods    byte [esi]
  4587.         call    convert_register
  4588.         cmp     ah,4
  4589.         jne     invalid_operand_size
  4590.         mov     bl,al
  4591.         jmp     nomem_instruction_ready
  4592.       make_mmx_prefix:
  4593.         cmp     [operand_size],16
  4594.         jne     no_mmx_prefix
  4595.         mov     [operand_prefix],66h
  4596.       no_mmx_prefix:
  4597.         ret
  4598. movq_instruction:
  4599.         mov     [base_code],0Fh
  4600.         lods    byte [esi]
  4601.         call    get_size_operator
  4602.         cmp     al,10h
  4603.         je      movq_reg
  4604.         cmp     al,'['
  4605.         jne     invalid_operand
  4606.         call    get_address
  4607.         test    [operand_size],not 8
  4608.         jnz     invalid_operand_size
  4609.         mov     [operand_size],0
  4610.         lods    byte [esi]
  4611.         cmp     al,','
  4612.         jne     invalid_operand
  4613.         lods    byte [esi]
  4614.         cmp     al,10h
  4615.         jne     invalid_operand
  4616.         lods    byte [esi]
  4617.         call    convert_mmx_register
  4618.         mov     [postbyte_register],al
  4619.         cmp     ah,16
  4620.         je      movq_mem_xmmreg
  4621.         mov     [extended_code],7Fh
  4622.         jmp     instruction_ready
  4623.      movq_mem_xmmreg:
  4624.         mov     [extended_code],0D6h
  4625.         mov     [opcode_prefix],66h
  4626.         jmp     instruction_ready
  4627.      movq_reg:
  4628.         lods    byte [esi]
  4629.         cmp     al,0B0h
  4630.         jae     movq_mmreg
  4631.         call    convert_register
  4632.         cmp     ah,8
  4633.         jne     invalid_operand_size
  4634.         mov     bl,al
  4635.         lods    byte [esi]
  4636.         cmp     al,','
  4637.         jne     invalid_operand
  4638.         lods    byte [esi]
  4639.         call    get_size_operator
  4640.         cmp     al,10h
  4641.         jne     invalid_operand
  4642.         mov     [operand_size],0
  4643.         lods    byte [esi]
  4644.         call    convert_mmx_register
  4645.         mov     [postbyte_register],al
  4646.         call    make_mmx_prefix
  4647.         mov     [extended_code],7Eh
  4648.         call    operand_64bit
  4649.         jmp     nomem_instruction_ready
  4650.      movq_mmreg:
  4651.         call    convert_mmx_register
  4652.         mov     [postbyte_register],al
  4653.         mov     [extended_code],6Fh
  4654.         mov     [mmx_size],ah
  4655.         cmp     ah,16
  4656.         jne     movq_mmreg_
  4657.         mov     [extended_code],7Eh
  4658.         mov     [opcode_prefix],0F3h
  4659.       movq_mmreg_:
  4660.         lods    byte [esi]
  4661.         cmp     al,','
  4662.         jne     invalid_operand
  4663.         mov     [operand_size],0
  4664.         lods    byte [esi]
  4665.         call    get_size_operator
  4666.         cmp     al,10h
  4667.         je      movq_mmreg_reg
  4668.         call    get_address
  4669.         test    [operand_size],not 8
  4670.         jnz     invalid_operand_size
  4671.         jmp     instruction_ready
  4672.       movq_mmreg_reg:
  4673.         lods    byte [esi]
  4674.         cmp     al,0B0h
  4675.         jae     movq_mmreg_mmreg
  4676.         mov     [operand_size],0
  4677.         call    convert_register
  4678.         cmp     ah,8
  4679.         jne     invalid_operand_size
  4680.         mov     [extended_code],6Eh
  4681.         mov     [opcode_prefix],0
  4682.         mov     bl,al
  4683.         cmp     [mmx_size],16
  4684.         jne     movq_mmreg_reg_store
  4685.         mov     [opcode_prefix],66h
  4686.       movq_mmreg_reg_store:
  4687.         call    operand_64bit
  4688.         jmp     nomem_instruction_ready
  4689.       movq_mmreg_mmreg:
  4690.         call    convert_mmx_register
  4691.         cmp     ah,[mmx_size]
  4692.         jne     invalid_operand_size
  4693.         mov     bl,al
  4694.         jmp     nomem_instruction_ready
  4695. movdq_instruction:
  4696.         mov     [opcode_prefix],al
  4697.         mov     [base_code],0Fh
  4698.         mov     [extended_code],6Fh
  4699.         lods    byte [esi]
  4700.         call    get_size_operator
  4701.         cmp     al,10h
  4702.         je      movdq_mmreg
  4703.         cmp     al,'['
  4704.         jne     invalid_operand
  4705.         call    get_address
  4706.         lods    byte [esi]
  4707.         cmp     al,','
  4708.         jne     invalid_operand
  4709.         lods    byte [esi]
  4710.         call    get_size_operator
  4711.         cmp     al,10h
  4712.         jne     invalid_operand
  4713.         lods    byte [esi]
  4714.         call    convert_mmx_register
  4715.         cmp     ah,16
  4716.         jne     invalid_operand_size
  4717.         mov     [postbyte_register],al
  4718.         mov     [extended_code],7Fh
  4719.         jmp     instruction_ready
  4720.       movdq_mmreg:
  4721.         lods    byte [esi]
  4722.         call    convert_mmx_register
  4723.         cmp     ah,16
  4724.         jne     invalid_operand_size
  4725.         mov     [postbyte_register],al
  4726.         lods    byte [esi]
  4727.         cmp     al,','
  4728.         jne     invalid_operand
  4729.         lods    byte [esi]
  4730.         call    get_size_operator
  4731.         cmp     al,10h
  4732.         je      movdq_mmreg_mmreg
  4733.         cmp     al,'['
  4734.         jne     invalid_operand
  4735.         call    get_address
  4736.         jmp     instruction_ready
  4737.       movdq_mmreg_mmreg:
  4738.         lods    byte [esi]
  4739.         call    convert_mmx_register
  4740.         cmp     ah,16
  4741.         jne     invalid_operand_size
  4742.         mov     bl,al
  4743.         jmp     nomem_instruction_ready
  4744. lddqu_instruction:
  4745.         lods    byte [esi]
  4746.         call    get_size_operator
  4747.         cmp     al,10h
  4748.         jne     invalid_operand
  4749.         lods    byte [esi]
  4750.         call    convert_mmx_register
  4751.         cmp     ah,16
  4752.         jne     invalid_operand_size
  4753.         push    eax
  4754.         lods    byte [esi]
  4755.         cmp     al,','
  4756.         jne     invalid_operand
  4757.         lods    byte [esi]
  4758.         call    get_size_operator
  4759.         cmp     al,'['
  4760.         jne     invalid_operand
  4761.         call    get_address
  4762.         pop     eax
  4763.         mov     [postbyte_register],al
  4764.         mov     [opcode_prefix],0F2h
  4765.         mov     [base_code],0Fh
  4766.         mov     [extended_code],0F0h
  4767.         jmp     instruction_ready
  4768. movq2dq_instruction:
  4769.         lods    byte [esi]
  4770.         call    get_size_operator
  4771.         cmp     al,10h
  4772.         jne     invalid_operand
  4773.         lods    byte [esi]
  4774.         call    convert_mmx_register
  4775.         cmp     ah,16
  4776.         jne     invalid_operand_size
  4777.         mov     [postbyte_register],al
  4778.         mov     [operand_size],0
  4779.         lods    byte [esi]
  4780.         cmp     al,','
  4781.         jne     invalid_operand
  4782.         lods    byte [esi]
  4783.         call    get_size_operator
  4784.         cmp     al,10h
  4785.         jne     invalid_operand
  4786.         lods    byte [esi]
  4787.         call    convert_mmx_register
  4788.         cmp     ah,8
  4789.         jne     invalid_operand_size
  4790.         mov     bl,al
  4791.         mov     [opcode_prefix],0F3h
  4792.         mov     [base_code],0Fh
  4793.         mov     [extended_code],0D6h
  4794.         jmp     nomem_instruction_ready
  4795. movdq2q_instruction:
  4796.         lods    byte [esi]
  4797.         call    get_size_operator
  4798.         cmp     al,10h
  4799.         jne     invalid_operand
  4800.         lods    byte [esi]
  4801.         call    convert_mmx_register
  4802.         cmp     ah,8
  4803.         jne     invalid_operand_size
  4804.         mov     [postbyte_register],al
  4805.         mov     [operand_size],0
  4806.         lods    byte [esi]
  4807.         cmp     al,','
  4808.         jne     invalid_operand
  4809.         lods    byte [esi]
  4810.         call    get_size_operator
  4811.         cmp     al,10h
  4812.         jne     invalid_operand
  4813.         lods    byte [esi]
  4814.         call    convert_mmx_register
  4815.         cmp     ah,16
  4816.         jne     invalid_operand_size
  4817.         mov     bl,al
  4818.         mov     [opcode_prefix],0F2h
  4819.         mov     [base_code],0Fh
  4820.         mov     [extended_code],0D6h
  4821.         jmp     nomem_instruction_ready
  4822.  
  4823. sse_ps_instruction_imm8:
  4824.         mov     [immediate_size],1
  4825. sse_ps_instruction:
  4826.         mov     [mmx_size],16
  4827.         jmp     sse_instruction
  4828. sse_pd_instruction_imm8:
  4829.         mov     [immediate_size],1
  4830. sse_pd_instruction:
  4831.         mov     [mmx_size],16
  4832.         mov     [opcode_prefix],66h
  4833.         jmp     sse_instruction
  4834. sse_ss_instruction:
  4835.         mov     [mmx_size],4
  4836.         mov     [opcode_prefix],0F3h
  4837.         jmp     sse_instruction
  4838. sse_sd_instruction:
  4839.         mov     [mmx_size],8
  4840.         mov     [opcode_prefix],0F2h
  4841.         jmp     sse_instruction
  4842. comiss_instruction:
  4843.         mov     [mmx_size],4
  4844.         jmp     sse_instruction
  4845. comisd_instruction:
  4846.         mov     [mmx_size],8
  4847.         mov     [opcode_prefix],66h
  4848.         jmp     sse_instruction
  4849. cvtps2pd_instruction:
  4850.         mov     [mmx_size],8
  4851.         jmp     sse_instruction
  4852. cvtpd2dq_instruction:
  4853.         mov     [mmx_size],16
  4854.         mov     [opcode_prefix],0F2h
  4855.         jmp     sse_instruction
  4856. cvtdq2pd_instruction:
  4857.         mov     [mmx_size],16
  4858.         mov     [opcode_prefix],0F3h
  4859. sse_instruction:
  4860.         mov     [base_code],0Fh
  4861.         mov     [extended_code],al
  4862.         lods    byte [esi]
  4863.         call    get_size_operator
  4864.         cmp     al,10h
  4865.         jne     invalid_operand
  4866.       sse_xmmreg:
  4867.         lods    byte [esi]
  4868.         call    convert_mmx_register
  4869.         cmp     ah,16
  4870.         jne     invalid_operand_size
  4871.       sse_reg:
  4872.         mov     [postbyte_register],al
  4873.         mov     [operand_size],0
  4874.         lods    byte [esi]
  4875.         cmp     al,','
  4876.         jne     invalid_operand
  4877.         lods    byte [esi]
  4878.         call    get_size_operator
  4879.         cmp     al,10h
  4880.         je      sse_xmmreg_xmmreg
  4881.       sse_reg_mem:
  4882.         cmp     al,'['
  4883.         jne     invalid_operand
  4884.         call    get_address
  4885.         cmp     [operand_size],0
  4886.         je      sse_mem_size_ok
  4887.         mov     al,[mmx_size]
  4888.         cmp     [operand_size],al
  4889.         jne     invalid_operand_size
  4890.       sse_mem_size_ok:
  4891.         cmp     [immediate_size],1
  4892.         je      mmx_imm8
  4893.         cmp     [immediate_size],-1
  4894.         jne     sse_ok
  4895.         call    take_additional_xmm0
  4896.       sse_ok:
  4897.         jmp     instruction_ready
  4898.       sse_xmmreg_xmmreg:
  4899.         cmp     [operand_prefix],66h
  4900.         jne     sse_xmmreg_xmmreg_ok
  4901.         cmp     [extended_code],12h
  4902.         je      invalid_operand
  4903.         cmp     [extended_code],16h
  4904.         je      invalid_operand
  4905.       sse_xmmreg_xmmreg_ok:
  4906.         lods    byte [esi]
  4907.         call    convert_mmx_register
  4908.         cmp     ah,16
  4909.         jne     invalid_operand_size
  4910.         mov     bl,al
  4911.         cmp     [immediate_size],1
  4912.         je      mmx_nomem_imm8
  4913.         cmp     [immediate_size],-1
  4914.         jne     sse_nomem_ok
  4915.         call    take_additional_xmm0
  4916.       sse_nomem_ok:
  4917.         jmp     nomem_instruction_ready
  4918.       take_additional_xmm0:
  4919.         lods    byte [esi]
  4920.         cmp     al,','
  4921.         jne     invalid_operand
  4922.         lods    byte [esi]
  4923.         cmp     al,10h
  4924.         jne     invalid_operand
  4925.         lods    byte [esi]
  4926.         call    convert_mmx_register
  4927.         cmp     ah,16
  4928.         jne     invalid_operand_size
  4929.         test    al,al
  4930.         jnz     invalid_operand
  4931.         ret
  4932.  
  4933. ps_dq_instruction:
  4934.         mov     [postbyte_register],al
  4935.         mov     [opcode_prefix],66h
  4936.         mov     [base_code],0Fh
  4937.         mov     [extended_code],73h
  4938.         lods    byte [esi]
  4939.         call    get_size_operator
  4940.         cmp     al,10h
  4941.         jne     invalid_operand
  4942.         lods    byte [esi]
  4943.         call    convert_mmx_register
  4944.         cmp     ah,16
  4945.         jne     invalid_operand_size
  4946.         mov     bl,al
  4947.         jmp     mmx_nomem_imm8
  4948. movpd_instruction:
  4949.         mov     [opcode_prefix],66h
  4950. movps_instruction:
  4951.         mov     [base_code],0Fh
  4952.         mov     [extended_code],al
  4953.         mov     [mmx_size],16
  4954.         jmp     sse_mov_instruction
  4955. movss_instruction:
  4956.         mov     [mmx_size],4
  4957.         mov     [opcode_prefix],0F3h
  4958.         jmp     sse_movs
  4959. movsd_instruction:
  4960.         mov     al,0A5h
  4961.         mov     ah,[esi]
  4962.         or      ah,ah
  4963.         jz      simple_instruction_32bit
  4964.         cmp     ah,0Fh
  4965.         je      simple_instruction_32bit
  4966.         mov     [mmx_size],8
  4967.         mov     [opcode_prefix],0F2h
  4968.       sse_movs:
  4969.         mov     [base_code],0Fh
  4970.         mov     [extended_code],10h
  4971.         jmp     sse_mov_instruction
  4972. sse_mov_instruction:
  4973.         lods    byte [esi]
  4974.         call    get_size_operator
  4975.         cmp     al,10h
  4976.         je      sse_xmmreg
  4977.       sse_mem:
  4978.         cmp     al,'['
  4979.         jne     invalid_operand
  4980.         inc     [extended_code]
  4981.         call    get_address
  4982.         cmp     [operand_size],0
  4983.         je      sse_mem_xmmreg
  4984.         mov     al,[mmx_size]
  4985.         cmp     [operand_size],al
  4986.         jne     invalid_operand_size
  4987.         mov     [operand_size],0
  4988.       sse_mem_xmmreg:
  4989.         lods    byte [esi]
  4990.         cmp     al,','
  4991.         jne     invalid_operand
  4992.         lods    byte [esi]
  4993.         call    get_size_operator
  4994.         cmp     al,10h
  4995.         jne     invalid_operand
  4996.         lods    byte [esi]
  4997.         call    convert_mmx_register
  4998.         cmp     ah,16
  4999.         jne     invalid_operand_size
  5000.         mov     [postbyte_register],al
  5001.         jmp     instruction_ready
  5002. movlpd_instruction:
  5003.         mov     [opcode_prefix],66h
  5004. movlps_instruction:
  5005.         mov     [base_code],0Fh
  5006.         mov     [extended_code],al
  5007.         mov     [mmx_size],8
  5008.         lods    byte [esi]
  5009.         call    get_size_operator
  5010.         cmp     al,10h
  5011.         jne     sse_mem
  5012.         lods    byte [esi]
  5013.         call    convert_mmx_register
  5014.         cmp     ah,16
  5015.         jne     invalid_operand_size
  5016.         mov     [postbyte_register],al
  5017.         mov     [operand_size],0
  5018.         lods    byte [esi]
  5019.         cmp     al,','
  5020.         jne     invalid_operand
  5021.         lods    byte [esi]
  5022.         call    get_size_operator
  5023.         jmp     sse_reg_mem
  5024. movhlps_instruction:
  5025.         mov     [base_code],0Fh
  5026.         mov     [extended_code],al
  5027.         mov     [mmx_size],0
  5028.         lods    byte [esi]
  5029.         call    get_size_operator
  5030.         cmp     al,10h
  5031.         jne     invalid_operand
  5032.         lods    byte [esi]
  5033.         call    convert_mmx_register
  5034.         cmp     ah,16
  5035.         jne     invalid_operand_size
  5036.         mov     [postbyte_register],al
  5037.         lods    byte [esi]
  5038.         cmp     al,','
  5039.         jne     invalid_operand
  5040.         lods    byte [esi]
  5041.         call    get_size_operator
  5042.         cmp     al,10h
  5043.         je      sse_xmmreg_xmmreg_ok
  5044.         jmp     invalid_operand
  5045. maskmovq_instruction:
  5046.         mov     cl,8
  5047.         jmp     maskmov_instruction
  5048. maskmovdqu_instruction:
  5049.         mov     cl,16
  5050.         mov     [opcode_prefix],66h
  5051.       maskmov_instruction:
  5052.         mov     [base_code],0Fh
  5053.         mov     [extended_code],0F7h
  5054.         lods    byte [esi]
  5055.         call    get_size_operator
  5056.         cmp     al,10h
  5057.         jne     invalid_operand
  5058.         lods    byte [esi]
  5059.         call    convert_mmx_register
  5060.         cmp     ah,cl
  5061.         jne     invalid_operand_size
  5062.         mov     [postbyte_register],al
  5063.         lods    byte [esi]
  5064.         cmp     al,','
  5065.         jne     invalid_operand
  5066.         lods    byte [esi]
  5067.         call    get_size_operator
  5068.         cmp     al,10h
  5069.         jne     invalid_operand
  5070.         lods    byte [esi]
  5071.         call    convert_mmx_register
  5072.         mov     bl,al
  5073.         jmp     nomem_instruction_ready
  5074. movmskpd_instruction:
  5075.         mov     [opcode_prefix],66h
  5076. movmskps_instruction:
  5077.         mov     [base_code],0Fh
  5078.         mov     [extended_code],50h
  5079.         lods    byte [esi]
  5080.         call    get_size_operator
  5081.         cmp     al,10h
  5082.         jne     invalid_operand
  5083.         lods    byte [esi]
  5084.         call    convert_register
  5085.         cmp     ah,4
  5086.         jne     invalid_operand_size
  5087.         mov     [operand_size],0
  5088.         mov     [postbyte_register],al
  5089.         lods    byte [esi]
  5090.         cmp     al,','
  5091.         jne     invalid_operand
  5092.         lods    byte [esi]
  5093.         call    get_size_operator
  5094.         cmp     al,10h
  5095.         jne     invalid_operand
  5096.         lods    byte [esi]
  5097.         call    convert_mmx_register
  5098.         cmp     ah,16
  5099.         jne     invalid_operand_size
  5100.         mov     bl,al
  5101.         jmp     nomem_instruction_ready
  5102. cmppd_instruction:
  5103.         mov     [opcode_prefix],66h
  5104. cmpps_instruction:
  5105.         mov     [base_code],0Fh
  5106.         mov     [extended_code],0C2h
  5107.         mov     [mmx_size],16
  5108.         mov     byte [value],-1
  5109.         jmp     sse_cmp_instruction
  5110. cmp_pd_instruction:
  5111.         mov     [opcode_prefix],66h
  5112. cmp_ps_instruction:
  5113.         mov     [base_code],0Fh
  5114.         mov     [extended_code],0C2h
  5115.         mov     [mmx_size],16
  5116.         mov     byte [value],al
  5117.         jmp     sse_cmp_instruction
  5118. cmpss_instruction:
  5119.         mov     [mmx_size],4
  5120.         mov     [opcode_prefix],0F3h
  5121.         jmp     cmpsx_instruction
  5122. cmpsd_instruction:
  5123.         mov     al,0A7h
  5124.         mov     ah,[esi]
  5125.         or      ah,ah
  5126.         jz      simple_instruction_32bit
  5127.         cmp     ah,0Fh
  5128.         je      simple_instruction_32bit
  5129.         mov     [mmx_size],8
  5130.         mov     [opcode_prefix],0F2h
  5131.       cmpsx_instruction:
  5132.         mov     [base_code],0Fh
  5133.         mov     [extended_code],0C2h
  5134.         mov     byte [value],-1
  5135.         jmp     sse_cmp_instruction
  5136. cmp_ss_instruction:
  5137.         mov     [mmx_size],4
  5138.         mov     [opcode_prefix],0F3h
  5139.         jmp     cmp_sx_instruction
  5140. cmp_sd_instruction:
  5141.         mov     [mmx_size],8
  5142.         mov     [opcode_prefix],0F2h
  5143.       cmp_sx_instruction:
  5144.         mov     [base_code],0Fh
  5145.         mov     [extended_code],0C2h
  5146.         mov     byte [value],al
  5147. sse_cmp_instruction:
  5148.         lods    byte [esi]
  5149.         call    get_size_operator
  5150.         cmp     al,10h
  5151.         jne     invalid_operand
  5152.         lods    byte [esi]
  5153.         call    convert_mmx_register
  5154.         cmp     ah,16
  5155.         jne     invalid_operand_size
  5156.         mov     [postbyte_register],al
  5157.         lods    byte [esi]
  5158.         cmp     al,','
  5159.         jne     invalid_operand
  5160.         mov     [operand_size],0
  5161.         lods    byte [esi]
  5162.         call    get_size_operator
  5163.         cmp     al,10h
  5164.         je      sse_cmp_xmmreg_xmmreg
  5165.         cmp     al,'['
  5166.         jne     invalid_operand
  5167.         call    get_address
  5168.         mov     al,[operand_size]
  5169.         or      al,al
  5170.         jz      sse_cmp_size_ok
  5171.         cmp     al,[mmx_size]
  5172.         jne     invalid_operand_size
  5173.       sse_cmp_size_ok:
  5174.         push    ebx ecx edx
  5175.         call    get_nextbyte
  5176.         pop     edx ecx ebx
  5177.         call    store_instruction_with_imm8
  5178.         jmp     instruction_assembled
  5179.       sse_cmp_xmmreg_xmmreg:
  5180.         lods    byte [esi]
  5181.         call    convert_mmx_register
  5182.         cmp     ah,16
  5183.         jne     invalid_operand_size
  5184.         mov     bl,al
  5185.         call    store_nomem_instruction
  5186.         call    get_nextbyte
  5187.         mov     al,byte [value]
  5188.         stos    byte [edi]
  5189.         jmp     instruction_assembled
  5190.       get_nextbyte:
  5191.         cmp     byte [value],-1
  5192.         jne     nextbyte_ok
  5193.         mov     [operand_size],0
  5194.         lods    byte [esi]
  5195.         cmp     al,','
  5196.         jne     invalid_operand
  5197.         lods    byte [esi]
  5198.         call    get_size_operator
  5199.         test    [operand_size],not 1
  5200.         jnz     invalid_value
  5201.         cmp     al,'('
  5202.         jne     invalid_operand
  5203.         call    get_byte_value
  5204.         cmp     al,7
  5205.         ja      invalid_value
  5206.         mov     byte [value],al
  5207.       nextbyte_ok:
  5208.         ret
  5209. cvtpi2pd_instruction:
  5210.         mov     [opcode_prefix],66h
  5211. cvtpi2ps_instruction:
  5212.         mov     [base_code],0Fh
  5213.         mov     [extended_code],al
  5214.         lods    byte [esi]
  5215.         call    get_size_operator
  5216.         cmp     al,10h
  5217.         jne     invalid_operand
  5218.         lods    byte [esi]
  5219.         call    convert_mmx_register
  5220.         cmp     ah,16
  5221.         jne     invalid_operand_size
  5222.         mov     [postbyte_register],al
  5223.         mov     [operand_size],0
  5224.         lods    byte [esi]
  5225.         cmp     al,','
  5226.         jne     invalid_operand
  5227.         lods    byte [esi]
  5228.         call    get_size_operator
  5229.         cmp     al,10h
  5230.         je      cvtpi_xmmreg_xmmreg
  5231.         cmp     al,'['
  5232.         jne     invalid_operand
  5233.         call    get_address
  5234.         cmp     [operand_size],0
  5235.         je      cvtpi_size_ok
  5236.         cmp     [operand_size],8
  5237.         jne     invalid_operand_size
  5238.       cvtpi_size_ok:
  5239.         jmp     instruction_ready
  5240.       cvtpi_xmmreg_xmmreg:
  5241.         lods    byte [esi]
  5242.         call    convert_mmx_register
  5243.         cmp     ah,8
  5244.         jne     invalid_operand_size
  5245.         mov     bl,al
  5246.         jmp     nomem_instruction_ready
  5247. cvtsi2ss_instruction:
  5248.         mov     [opcode_prefix],0F3h
  5249.         jmp     cvtsi_instruction
  5250. cvtsi2sd_instruction:
  5251.         mov     [opcode_prefix],0F2h
  5252.       cvtsi_instruction:
  5253.         mov     [base_code],0Fh
  5254.         mov     [extended_code],al
  5255.         lods    byte [esi]
  5256.         call    get_size_operator
  5257.         cmp     al,10h
  5258.         jne     invalid_operand
  5259.         lods    byte [esi]
  5260.         call    convert_mmx_register
  5261.         cmp     ah,16
  5262.         jne     invalid_operand_size
  5263.         mov     [postbyte_register],al
  5264.         mov     [operand_size],0
  5265.         lods    byte [esi]
  5266.         cmp     al,','
  5267.         jne     invalid_operand
  5268.         lods    byte [esi]
  5269.         call    get_size_operator
  5270.         cmp     al,10h
  5271.         je      cvtsi_xmmreg_reg
  5272.         cmp     al,'['
  5273.         jne     invalid_operand
  5274.         call    get_address
  5275.         cmp     [operand_size],0
  5276.         je      cvtsi_size_ok
  5277.         cmp     [operand_size],4
  5278.         jne     invalid_operand_size
  5279.       cvtsi_size_ok:
  5280.         jmp     instruction_ready
  5281.       cvtsi_xmmreg_reg:
  5282.         lods    byte [esi]
  5283.         call    convert_register
  5284.         cmp     ah,4
  5285.         je      cvtsi_xmmreg_reg_store
  5286.         cmp     ah,8
  5287.         jne     invalid_operand_size
  5288.         call    operand_64bit
  5289.       cvtsi_xmmreg_reg_store:
  5290.         mov     bl,al
  5291.         jmp     nomem_instruction_ready
  5292. cvtps2pi_instruction:
  5293.         mov     [mmx_size],8
  5294.         jmp     cvtpd_instruction
  5295. cvtpd2pi_instruction:
  5296.         mov     [opcode_prefix],66h
  5297.         mov     [mmx_size],16
  5298.       cvtpd_instruction:
  5299.         mov     [base_code],0Fh
  5300.         mov     [extended_code],al
  5301.         lods    byte [esi]
  5302.         call    get_size_operator
  5303.         cmp     al,10h
  5304.         jne     invalid_operand
  5305.         lods    byte [esi]
  5306.         call    convert_mmx_register
  5307.         cmp     ah,8
  5308.         jne     invalid_operand_size
  5309.         mov     [operand_size],0
  5310.         jmp     sse_reg
  5311. cvtss2si_instruction:
  5312.         mov     [opcode_prefix],0F3h
  5313.         mov     [mmx_size],4
  5314.         jmp     cvt2si_instruction
  5315. cvtsd2si_instruction:
  5316.         mov     [opcode_prefix],0F2h
  5317.         mov     [mmx_size],8
  5318.       cvt2si_instruction:
  5319.         mov     [extended_code],al
  5320.         mov     [base_code],0Fh
  5321.         lods    byte [esi]
  5322.         call    get_size_operator
  5323.         cmp     al,10h
  5324.         jne     invalid_operand
  5325.         lods    byte [esi]
  5326.         call    convert_register
  5327.         mov     [operand_size],0
  5328.         cmp     ah,4
  5329.         je      sse_reg
  5330.         cmp     ah,8
  5331.         jne     invalid_operand_size
  5332.         call    operand_64bit
  5333.         jmp     sse_reg
  5334.  
  5335. ssse3_instruction:
  5336.         mov     [base_code],0Fh
  5337.         mov     [extended_code],38h
  5338.         mov     [supplemental_code],al
  5339.         jmp     mmx_instruction
  5340. palignr_instruction:
  5341.         mov     [base_code],0Fh
  5342.         mov     [extended_code],3Ah
  5343.         mov     [supplemental_code],0Fh
  5344.         lods    byte [esi]
  5345.         call    get_size_operator
  5346.         cmp     al,10h
  5347.         jne     invalid_operand
  5348.         lods    byte [esi]
  5349.         call    convert_mmx_register
  5350.         call    make_mmx_prefix
  5351.         mov     [postbyte_register],al
  5352.         lods    byte [esi]
  5353.         cmp     al,','
  5354.         jne     invalid_operand
  5355.         lods    byte [esi]
  5356.         call    get_size_operator
  5357.         cmp     al,10h
  5358.         je      palignr_mmreg_mmreg
  5359.         cmp     al,'['
  5360.         jne     invalid_operand
  5361.         call    get_address
  5362.         jmp     mmx_imm8
  5363.       palignr_mmreg_mmreg:
  5364.         lods    byte [esi]
  5365.         call    convert_mmx_register
  5366.         mov     bl,al
  5367.         jmp     mmx_nomem_imm8
  5368. amd3dnow_instruction:
  5369.         mov     [base_code],0Fh
  5370.         mov     [extended_code],0Fh
  5371.         mov     byte [value],al
  5372.         lods    byte [esi]
  5373.         call    get_size_operator
  5374.         cmp     al,10h
  5375.         jne     invalid_operand
  5376.         lods    byte [esi]
  5377.         call    convert_mmx_register
  5378.         cmp     ah,8
  5379.         jne     invalid_operand_size
  5380.         mov     [postbyte_register],al
  5381.         lods    byte [esi]
  5382.         cmp     al,','
  5383.         jne     invalid_operand
  5384.         lods    byte [esi]
  5385.         call    get_size_operator
  5386.         cmp     al,10h
  5387.         je      amd3dnow_mmreg_mmreg
  5388.         cmp     al,'['
  5389.         jne     invalid_operand
  5390.         call    get_address
  5391.         call    store_instruction_with_imm8
  5392.         jmp     instruction_assembled
  5393.       amd3dnow_mmreg_mmreg:
  5394.         lods    byte [esi]
  5395.         call    convert_mmx_register
  5396.         cmp     ah,8
  5397.         jne     invalid_operand_size
  5398.         mov     bl,al
  5399.         call    store_nomem_instruction
  5400.         mov     al,byte [value]
  5401.         stos    byte [edi]
  5402.         jmp     instruction_assembled
  5403.  
  5404. sse4_instruction_38_xmm0:
  5405.         mov     [immediate_size],-1
  5406.         jmp     sse4_instruction_38
  5407. sse4_instruction_38_imm8:
  5408.         mov     [immediate_size],1
  5409. sse4_instruction_38:
  5410.         mov     [mmx_size],16
  5411.         mov     [opcode_prefix],66h
  5412.         mov     [base_code],0Fh
  5413.         mov     [supplemental_code],al
  5414.         mov     al,38h
  5415.         jmp     sse_instruction
  5416. sse4_ss_instruction_3a_imm8:
  5417.         mov     [immediate_size],1
  5418.         mov     [mmx_size],4
  5419.         jmp     sse4_instruction_3a_setup
  5420. sse4_sd_instruction_3a_imm8:
  5421.         mov     [immediate_size],1
  5422.         mov     [mmx_size],8
  5423.         jmp     sse4_instruction_3a_setup
  5424. sse4_instruction_3a_imm8:
  5425.         mov     [immediate_size],1
  5426. sse4_instruction_3a:
  5427.         mov     [mmx_size],16
  5428.       sse4_instruction_3a_setup:
  5429.         mov     [opcode_prefix],66h
  5430.         mov     [base_code],0Fh
  5431.         mov     [supplemental_code],al
  5432.         mov     al,3Ah
  5433.         jmp     sse_instruction
  5434. extractps_instruction:
  5435.         mov     [opcode_prefix],66h
  5436.         mov     [base_code],0Fh
  5437.         mov     [extended_code],3Ah
  5438.         mov     [supplemental_code],17h
  5439.         lods    byte [esi]
  5440.         call    get_size_operator
  5441.         cmp     al,10h
  5442.         je      extractps_reg
  5443.         cmp     al,'['
  5444.         jne     invalid_operand
  5445.         call    get_address
  5446.         cmp     [operand_size],4
  5447.         je      extractps_size_ok
  5448.         cmp     [operand_size],0
  5449.         jne     invalid_operand_size
  5450.       extractps_size_ok:
  5451.         push    edx ebx ecx
  5452.         mov     [operand_size],0
  5453.         lods    byte [esi]
  5454.         cmp     al,','
  5455.         jne     invalid_operand
  5456.         lods    byte [esi]
  5457.         call    get_size_operator
  5458.         cmp     al,10h
  5459.         jne     invalid_operand
  5460.         lods    byte [esi]
  5461.         call    convert_mmx_register
  5462.         cmp     ah,16
  5463.         jne     invalid_operand_size
  5464.         mov     [postbyte_register],al
  5465.         pop     ecx ebx edx
  5466.         jmp     mmx_imm8
  5467.       extractps_reg:
  5468.         lods    byte [esi]
  5469.         call    convert_register
  5470.         push    eax
  5471.         mov     [operand_size],0
  5472.         lods    byte [esi]
  5473.         cmp     al,','
  5474.         jne     invalid_operand
  5475.         lods    byte [esi]
  5476.         call    get_size_operator
  5477.         cmp     al,10h
  5478.         jne     invalid_operand
  5479.         lods    byte [esi]
  5480.         call    convert_mmx_register
  5481.         cmp     ah,16
  5482.         jne     invalid_operand_size
  5483.         mov     [postbyte_register],al
  5484.         pop     ebx
  5485.         mov     al,bh
  5486.         cmp     al,8
  5487.         je      extractps_store
  5488.         cmp     al,4
  5489.         jne     invalid_operand_size
  5490.       extractps_store:
  5491.         call    operand_autodetect
  5492.         jmp     mmx_nomem_imm8
  5493. insertps_instruction:
  5494.         mov     [opcode_prefix],66h
  5495.         mov     [base_code],0Fh
  5496.         mov     [extended_code],3Ah
  5497.         mov     [supplemental_code],21h
  5498.         lods    byte [esi]
  5499.         call    get_size_operator
  5500.         cmp     al,10h
  5501.         jne     invalid_operand
  5502.         lods    byte [esi]
  5503.         call    convert_mmx_register
  5504.         cmp     ah,16
  5505.         jne     invalid_operand_size
  5506.         mov     [postbyte_register],al
  5507.         mov     [operand_size],0
  5508.         lods    byte [esi]
  5509.         cmp     al,','
  5510.         jne     invalid_operand
  5511.         lods    byte [esi]
  5512.         call    get_size_operator
  5513.         cmp     al,10h
  5514.         je      insertps_reg
  5515.         cmp     al,'['
  5516.         jne     invalid_operand
  5517.         call    get_address
  5518.         cmp     [operand_size],4
  5519.         je      insertps_size_ok
  5520.         cmp     [operand_size],0
  5521.         jne     invalid_operand_size
  5522.       insertps_size_ok:
  5523.         jmp     mmx_imm8
  5524.       insertps_reg:
  5525.         lods    byte [esi]
  5526.         call    convert_mmx_register
  5527.         mov     bl,al
  5528.         jmp     mmx_nomem_imm8
  5529. pextrq_instruction:
  5530.         mov     [mmx_size],8
  5531.         jmp     pextr_instruction
  5532. pextrd_instruction:
  5533.         mov     [mmx_size],4
  5534.         jmp     pextr_instruction
  5535. pextrw_instruction:
  5536.         mov     [mmx_size],2
  5537.         jmp     pextr_instruction
  5538. pextrb_instruction:
  5539.         mov     [mmx_size],1
  5540.       pextr_instruction:
  5541.         mov     [opcode_prefix],66h
  5542.         mov     [base_code],0Fh
  5543.         mov     [extended_code],3Ah
  5544.         mov     [supplemental_code],al
  5545.         lods    byte [esi]
  5546.         call    get_size_operator
  5547.         cmp     al,10h
  5548.         je      pextr_reg
  5549.         cmp     al,'['
  5550.         jne     invalid_operand
  5551.         call    get_address
  5552.         mov     al,[mmx_size]
  5553.         cmp     al,[operand_size]
  5554.         je      pextr_size_ok
  5555.         cmp     [operand_size],0
  5556.         jne     invalid_operand_size
  5557.       pextr_size_ok:
  5558.         push    edx ebx ecx
  5559.         mov     [operand_size],0
  5560.         lods    byte [esi]
  5561.         cmp     al,','
  5562.         jne     invalid_operand
  5563.         lods    byte [esi]
  5564.         call    get_size_operator
  5565.         cmp     al,10h
  5566.         jne     invalid_operand
  5567.         lods    byte [esi]
  5568.         call    convert_mmx_register
  5569.         cmp     ah,16
  5570.         jne     invalid_operand_size
  5571.         mov     [postbyte_register],al
  5572.         pop     ecx ebx edx
  5573.         jmp     mmx_imm8
  5574.       pextr_reg:
  5575.         lods    byte [esi]
  5576.         call    convert_register
  5577.         cmp     [mmx_size],4
  5578.         ja      pextrq_reg
  5579.         cmp     ah,4
  5580.         je      pextr_reg_size_ok
  5581.         cmp     ah,8
  5582.         je      pextr_reg_size_ok
  5583.       pextr_invalid_size:
  5584.         jmp     invalid_operand_size
  5585.       pextrq_reg:
  5586.         cmp     ah,8
  5587.         jne     pextr_invalid_size
  5588.         call    operand_64bit
  5589.       pextr_reg_size_ok:
  5590.         mov     [operand_size],0
  5591.         push    eax
  5592.         lods    byte [esi]
  5593.         cmp     al,','
  5594.         jne     invalid_operand
  5595.         lods    byte [esi]
  5596.         call    get_size_operator
  5597.         cmp     al,10h
  5598.         jne     invalid_operand
  5599.         lods    byte [esi]
  5600.         call    convert_mmx_register
  5601.         mov     ebx,eax
  5602.         pop     eax
  5603.         mov     [postbyte_register],al
  5604.         mov     al,ah
  5605.         cmp     [mmx_size],2
  5606.         jne     pextr_reg_store
  5607.         mov     [opcode_prefix],0
  5608.         mov     [extended_code],0C5h
  5609.         call    make_mmx_prefix
  5610.         jmp     mmx_nomem_imm8
  5611.       pextr_reg_store:
  5612.         cmp     bh,16
  5613.         jne     invalid_operand_size
  5614.         xchg    bl,[postbyte_register]
  5615.         call    operand_autodetect
  5616.         jmp     mmx_nomem_imm8
  5617. pinsrb_instruction:
  5618.         mov     [mmx_size],1
  5619.         jmp     pinsr_instruction
  5620. pinsrd_instruction:
  5621.         mov     [mmx_size],4
  5622.         jmp     pinsr_instruction
  5623. pinsrq_instruction:
  5624.         mov     [mmx_size],8
  5625.         jmp     pinsr_instruction
  5626.       pinsr_instruction:
  5627.         mov     [opcode_prefix],66h
  5628.         mov     [base_code],0Fh
  5629.         mov     [extended_code],3Ah
  5630.         mov     [supplemental_code],al
  5631.         lods    byte [esi]
  5632.         call    get_size_operator
  5633.         cmp     al,10h
  5634.         jne     invalid_operand
  5635.         lods    byte [esi]
  5636.         call    convert_mmx_register
  5637.         cmp     ah,16
  5638.         jne     invalid_operand_size
  5639.         mov     [postbyte_register],al
  5640.         mov     [operand_size],0
  5641.         lods    byte [esi]
  5642.         cmp     al,','
  5643.         jne     invalid_operand
  5644.         lods    byte [esi]
  5645.         call    get_size_operator
  5646.         cmp     al,10h
  5647.         je      pinsr_xmmreg_reg
  5648.         cmp     al,'['
  5649.         jne     invalid_operand
  5650.         call    get_address
  5651.         cmp     [operand_size],0
  5652.         je      mmx_imm8
  5653.         mov     al,[mmx_size]
  5654.         cmp     al,[operand_size]
  5655.         je      mmx_imm8
  5656.         jmp     invalid_operand_size
  5657.       pinsr_xmmreg_reg:
  5658.         lods    byte [esi]
  5659.         call    convert_register
  5660.         mov     bl,al
  5661.         cmp     [mmx_size],8
  5662.         je      pinsrq_xmmreg_reg
  5663.         cmp     ah,4
  5664.         je      mmx_nomem_imm8
  5665.         jmp     invalid_operand_size
  5666.       pinsrq_xmmreg_reg:
  5667.         cmp     ah,8
  5668.         je      mmx_nomem_imm8
  5669.         jmp     invalid_operand_size
  5670. pmovsxbw_instruction:
  5671.         mov     [mmx_size],8
  5672.         jmp     pmovsx_instruction
  5673. pmovsxbd_instruction:
  5674.         mov     [mmx_size],4
  5675.         jmp     pmovsx_instruction
  5676. pmovsxbq_instruction:
  5677.         mov     [mmx_size],2
  5678.         jmp     pmovsx_instruction
  5679. pmovsxwd_instruction:
  5680.         mov     [mmx_size],8
  5681.         jmp     pmovsx_instruction
  5682. pmovsxwq_instruction:
  5683.         mov     [mmx_size],4
  5684.         jmp     pmovsx_instruction
  5685. pmovsxdq_instruction:
  5686.         mov     [mmx_size],8
  5687.       pmovsx_instruction:
  5688.         mov     [opcode_prefix],66h
  5689.         mov     [base_code],0Fh
  5690.         mov     [extended_code],38h
  5691.         mov     [supplemental_code],al
  5692.         lods    byte [esi]
  5693.         call    get_size_operator
  5694.         cmp     al,10h
  5695.         jne     invalid_operand
  5696.         lods    byte [esi]
  5697.         call    convert_mmx_register
  5698.         cmp     ah,16
  5699.         jne     invalid_operand_size
  5700.         mov     [postbyte_register],al
  5701.         lods    byte [esi]
  5702.         cmp     al,','
  5703.         jne     invalid_operand
  5704.         mov     [operand_size],0
  5705.         lods    byte [esi]
  5706.         call    get_size_operator
  5707.         cmp     al,10h
  5708.         je      pmovsx_xmmreg_reg
  5709.         cmp     al,'['
  5710.         jne     invalid_operand
  5711.         call    get_address
  5712.         cmp     [operand_size],0
  5713.         je      mmx_imm8
  5714.         mov     al,[mmx_size]
  5715.         cmp     al,[operand_size]
  5716.         jne     invalid_operand_size
  5717.         jmp     instruction_ready
  5718.       pmovsx_xmmreg_reg:
  5719.         lods    byte [esi]
  5720.         call    convert_mmx_register
  5721.         cmp     ah,16
  5722.         jne     invalid_operand_size
  5723.         mov     bl,al
  5724.         jmp     nomem_instruction_ready
  5725.  
  5726. fxsave_instruction:
  5727.         mov     [extended_code],0AEh
  5728.         mov     [base_code],0Fh
  5729.         mov     [postbyte_register],al
  5730.         lods    byte [esi]
  5731.         call    get_size_operator
  5732.         cmp     al,'['
  5733.         jne     invalid_operand
  5734.         call    get_address
  5735.         mov     ah,[operand_size]
  5736.         or      ah,ah
  5737.         jz      fxsave_size_ok
  5738.         mov     al,[postbyte_register]
  5739.         cmp     al,111b
  5740.         je      clflush_size_check
  5741.         cmp     al,10b
  5742.         jb      invalid_operand_size
  5743.         cmp     al,11b
  5744.         ja      invalid_operand_size
  5745.         cmp     ah,4
  5746.         jne     invalid_operand_size
  5747.         jmp     fxsave_size_ok
  5748.       clflush_size_check:
  5749.         cmp     ah,1
  5750.         jne     invalid_operand_size
  5751.       fxsave_size_ok:
  5752.         jmp     instruction_ready
  5753. prefetch_instruction:
  5754.         mov     [extended_code],18h
  5755.       prefetch_mem_8bit:
  5756.         mov     [base_code],0Fh
  5757.         mov     [postbyte_register],al
  5758.         lods    byte [esi]
  5759.         call    get_size_operator
  5760.         cmp     al,'['
  5761.         jne     invalid_operand
  5762.         or      ah,ah
  5763.         jz      prefetch_size_ok
  5764.         cmp     ah,1
  5765.         jne     invalid_operand_size
  5766.       prefetch_size_ok:
  5767.         call    get_address
  5768.         jmp     instruction_ready
  5769. amd_prefetch_instruction:
  5770.         mov     [extended_code],0Dh
  5771.         jmp     prefetch_mem_8bit
  5772. fence_instruction:
  5773.         mov     bl,al
  5774.         mov     ax,0AE0Fh
  5775.         stos    word [edi]
  5776.         mov     al,bl
  5777.         stos    byte [edi]
  5778.         jmp     instruction_assembled
  5779. pause_instruction:
  5780.         mov     ax,90F3h
  5781.         stos    word [edi]
  5782.         jmp     instruction_assembled
  5783. movntq_instruction:
  5784.         mov     [mmx_size],8
  5785.         jmp     movnt_instruction
  5786. movntps_instruction:
  5787.         mov     [mmx_size],16
  5788.         jmp     movnt_instruction
  5789. movntdq_instruction:
  5790.         mov     [opcode_prefix],66h
  5791.         mov     [mmx_size],16
  5792.       movnt_instruction:
  5793.         mov     [extended_code],al
  5794.         mov     [base_code],0Fh
  5795.         lods    byte [esi]
  5796.         call    get_size_operator
  5797.         cmp     al,'['
  5798.         jne     invalid_operand
  5799.         call    get_address
  5800.         lods    byte [esi]
  5801.         cmp     al,','
  5802.         jne     invalid_operand
  5803.         lods    byte [esi]
  5804.         call    get_size_operator
  5805.         cmp     al,10h
  5806.         jne     invalid_operand
  5807.         lods    byte [esi]
  5808.         call    convert_mmx_register
  5809.         cmp     ah,[mmx_size]
  5810.         jne     invalid_operand_size
  5811.         mov     [postbyte_register],al
  5812.         jmp     instruction_ready
  5813.  
  5814. movntsd_instruction:
  5815.         mov     [opcode_prefix],0F2h
  5816.         mov     [mmx_size],8
  5817.         jmp     movnts_instruction
  5818. movntss_instruction:
  5819.         mov     [opcode_prefix],0F3h
  5820.         mov     [mmx_size],4
  5821.       movnts_instruction:
  5822.         mov     [extended_code],al
  5823.         mov     [base_code],0Fh
  5824.         lods    byte [esi]
  5825.         call    get_size_operator
  5826.         cmp     al,'['
  5827.         jne     invalid_operand
  5828.         call    get_address
  5829.         mov     al,[operand_size]
  5830.         cmp     al,[mmx_size]
  5831.         je      movnts_size_ok
  5832.         test    al,al
  5833.         jnz     invalid_operand_size
  5834.       movnts_size_ok:
  5835.         lods    byte [esi]
  5836.         cmp     al,','
  5837.         jne     invalid_operand
  5838.         mov     [operand_size],0
  5839.         lods    byte [esi]
  5840.         call    get_size_operator
  5841.         cmp     al,10h
  5842.         jne     invalid_operand
  5843.         lods    byte [esi]
  5844.         call    convert_mmx_register
  5845.         cmp     ah,16
  5846.         jne     invalid_operand_size
  5847.         mov     [postbyte_register],al
  5848.         jmp     instruction_ready
  5849.  
  5850. movnti_instruction:
  5851.         mov     [base_code],0Fh
  5852.         mov     [extended_code],al
  5853.         lods    byte [esi]
  5854.         call    get_size_operator
  5855.         cmp     al,'['
  5856.         jne     invalid_operand
  5857.         call    get_address
  5858.         lods    byte [esi]
  5859.         cmp     al,','
  5860.         jne     invalid_operand
  5861.         lods    byte [esi]
  5862.         call    get_size_operator
  5863.         cmp     al,10h
  5864.         jne     invalid_operand
  5865.         lods    byte [esi]
  5866.         call    convert_register
  5867.         cmp     ah,4
  5868.         je      movnti_store
  5869.         cmp     ah,8
  5870.         jne     invalid_operand_size
  5871.         call    operand_64bit
  5872.       movnti_store:
  5873.         mov     [postbyte_register],al
  5874.         jmp     instruction_ready
  5875. monitor_instruction:
  5876.         mov     [postbyte_register],al
  5877.         lods    byte [esi]
  5878.         call    get_size_operator
  5879.         cmp     al,10h
  5880.         jne     invalid_operand
  5881.         lods    byte [esi]
  5882.         call    convert_register
  5883.         cmp     ax,0400h
  5884.         jne     invalid_operand
  5885.         lods    byte [esi]
  5886.         cmp     al,','
  5887.         jne     invalid_operand
  5888.         lods    byte [esi]
  5889.         call    get_size_operator
  5890.         cmp     al,10h
  5891.         jne     invalid_operand
  5892.         lods    byte [esi]
  5893.         call    convert_register
  5894.         cmp     ax,0401h
  5895.         jne     invalid_operand
  5896.         cmp     [postbyte_register],0C8h
  5897.         jne     monitor_instruction_store
  5898.         lods    byte [esi]
  5899.         cmp     al,','
  5900.         jne     invalid_operand
  5901.         lods    byte [esi]
  5902.         call    get_size_operator
  5903.         cmp     al,10h
  5904.         jne     invalid_operand
  5905.         lods    byte [esi]
  5906.         call    convert_register
  5907.         cmp     ax,0402h
  5908.         jne     invalid_operand
  5909.       monitor_instruction_store:
  5910.         mov     ax,010Fh
  5911.         stos    word [edi]
  5912.         mov     al,[postbyte_register]
  5913.         stos    byte [edi]
  5914.         jmp     instruction_assembled
  5915. movntdqa_instruction:
  5916.         mov     [opcode_prefix],66h
  5917.         mov     [base_code],0Fh
  5918.         mov     [extended_code],38h
  5919.         mov     [supplemental_code],2Ah
  5920.         lods    byte [esi]
  5921.         call    get_size_operator
  5922.         cmp     al,10h
  5923.         jne     invalid_operand
  5924.         lods    byte [esi]
  5925.         call    convert_mmx_register
  5926.         cmp     ah,16
  5927.         jne     invalid_operand_size
  5928.         mov     [postbyte_register],al
  5929.         lods    byte [esi]
  5930.         cmp     al,','
  5931.         jne     invalid_operand
  5932.         lods    byte [esi]
  5933.         call    get_size_operator
  5934.         cmp     al,'['
  5935.         jne     invalid_operand
  5936.         call    get_address
  5937.         jmp     instruction_ready
  5938.  
  5939. extrq_instruction:
  5940.         mov     [opcode_prefix],66h
  5941.         mov     [base_code],0Fh
  5942.         mov     [extended_code],78h
  5943.         lods    byte [esi]
  5944.         call    get_size_operator
  5945.         cmp     al,10h
  5946.         jne     invalid_operand
  5947.         lods    byte [esi]
  5948.         call    convert_mmx_register
  5949.         cmp     ah,16
  5950.         jne     invalid_operand_size
  5951.         mov     [postbyte_register],al
  5952.         mov     [operand_size],0
  5953.         lods    byte [esi]
  5954.         cmp     al,','
  5955.         jne     invalid_operand
  5956.         lods    byte [esi]
  5957.         call    get_size_operator
  5958.         cmp     al,10h
  5959.         je      extrq_xmmreg_xmmreg
  5960.         test    ah,not 1
  5961.         jnz     invalid_operand_size
  5962.         cmp     al,'('
  5963.         jne     invalid_operand
  5964.         xor     bl,bl
  5965.         call    store_nomem_instruction
  5966.         call    get_byte_value
  5967.         stosb
  5968.         call    append_imm8
  5969.         jmp     instruction_assembled
  5970.       extrq_xmmreg_xmmreg:
  5971.         inc     [extended_code]
  5972.         lods    byte [esi]
  5973.         call    convert_mmx_register
  5974.         cmp     ah,16
  5975.         jne     invalid_operand_size
  5976.         mov     bl,al
  5977.         jmp     nomem_instruction_ready
  5978. insertq_instruction:
  5979.         mov     [opcode_prefix],0F2h
  5980.         mov     [base_code],0Fh
  5981.         mov     [extended_code],78h
  5982.         lods    byte [esi]
  5983.         call    get_size_operator
  5984.         cmp     al,10h
  5985.         jne     invalid_operand
  5986.         lods    byte [esi]
  5987.         call    convert_mmx_register
  5988.         cmp     ah,16
  5989.         jne     invalid_operand_size
  5990.         mov     [postbyte_register],al
  5991.         mov     [operand_size],0
  5992.         lods    byte [esi]
  5993.         cmp     al,','
  5994.         jne     invalid_operand
  5995.         lods    byte [esi]
  5996.         call    get_size_operator
  5997.         cmp     al,10h
  5998.         jne     invalid_operand
  5999.         lods    byte [esi]
  6000.         call    convert_mmx_register
  6001.         cmp     ah,16
  6002.         jne     invalid_operand_size
  6003.         mov     bl,al
  6004.         cmp     byte [esi],','
  6005.         je      insertq_with_imm
  6006.         inc     [extended_code]
  6007.         jmp     nomem_instruction_ready
  6008.       insertq_with_imm:
  6009.         call    store_nomem_instruction
  6010.         call    append_imm8
  6011.         call    append_imm8
  6012.         jmp     instruction_assembled
  6013.  
  6014. crc32_instruction:
  6015.         mov     [opcode_prefix],0F2h
  6016.         mov     [base_code],0Fh
  6017.         mov     [extended_code],38h
  6018.         mov     [supplemental_code],0F0h
  6019.         lods    byte [esi]
  6020.         call    get_size_operator
  6021.         cmp     al,10h
  6022.         jne     invalid_operand
  6023.         lods    byte [esi]
  6024.         call    convert_register
  6025.         mov     [postbyte_register],al
  6026.         cmp     ah,8
  6027.         je      crc32_reg64
  6028.         cmp     ah,4
  6029.         jne     invalid_operand
  6030.         lods    byte [esi]
  6031.         cmp     al,','
  6032.         jne     invalid_operand
  6033.         mov     [operand_size],0
  6034.         lods    byte [esi]
  6035.         call    get_size_operator
  6036.         cmp     al,10h
  6037.         je      crc32_reg32_reg
  6038.         cmp     al,'['
  6039.         jne     invalid_operand
  6040.         call    get_address
  6041.         mov     al,[operand_size]
  6042.         test    al,al
  6043.         jz      crc32_unknown_size
  6044.         cmp     al,1
  6045.         je      crc32_reg32_mem_store
  6046.         cmp     al,4
  6047.         ja      invalid_operand_size
  6048.         inc     [supplemental_code]
  6049.         call    operand_autodetect
  6050.       crc32_reg32_mem_store:
  6051.         jmp     instruction_ready
  6052.       crc32_unknown_size:
  6053.         cmp     [error_line],0
  6054.         jne     crc32_reg32_mem_store
  6055.         mov     eax,[current_line]
  6056.         mov     [error_line],eax
  6057.         mov     [error],operand_size_not_specified
  6058.         jmp     crc32_reg32_mem_store
  6059.       crc32_reg32_reg:
  6060.         lods    byte [esi]
  6061.         call    convert_register
  6062.         mov     bl,al
  6063.         mov     al,ah
  6064.         cmp     al,1
  6065.         je      crc32_reg32_reg_store
  6066.         cmp     al,4
  6067.         ja      invalid_operand_size
  6068.         inc     [supplemental_code]
  6069.         call    operand_autodetect
  6070.       crc32_reg32_reg_store:
  6071.         jmp     nomem_instruction_ready
  6072.       crc32_reg64:
  6073.         lods    byte [esi]
  6074.         cmp     al,','
  6075.         jne     invalid_operand
  6076.         mov     [operand_size],0
  6077.         lods    byte [esi]
  6078.         call    get_size_operator
  6079.         cmp     al,10h
  6080.         je      crc32_reg64_reg
  6081.         cmp     al,'['
  6082.         jne     invalid_operand
  6083.         call    get_address
  6084.         mov     ah,[operand_size]
  6085.         mov     al,8
  6086.         test    ah,ah
  6087.         jz      crc32_unknown_size
  6088.         cmp     ah,1
  6089.         je      crc32_reg32_mem_store
  6090.         cmp     ah,al
  6091.         jne     invalid_operand_size
  6092.         inc     [supplemental_code]
  6093.         jmp     crc32_reg32_mem_store
  6094.       crc32_reg64_reg:
  6095.         lods    byte [esi]
  6096.         call    convert_register
  6097.         mov     bl,al
  6098.         mov     al,8
  6099.         cmp     ah,1
  6100.         je      crc32_reg32_reg_store
  6101.         cmp     ah,al
  6102.         jne     invalid_operand_size
  6103.         inc     [supplemental_code]
  6104.         jmp     crc32_reg32_reg_store
  6105. popcnt_instruction:
  6106.         mov     [opcode_prefix],0F3h
  6107.         jmp     bs_instruction
  6108.  
  6109. simple_vmx_instruction:
  6110.         mov     ah,al
  6111.         mov     al,0Fh
  6112.         stos    byte [edi]
  6113.         mov     al,1
  6114.         stos    word [edi]
  6115.         jmp     instruction_assembled
  6116. vmclear_instruction:
  6117.         mov     [opcode_prefix],66h
  6118.         jmp     vmx_instruction
  6119. vmxon_instruction:
  6120.         mov     [opcode_prefix],0F3h
  6121. vmx_instruction:
  6122.         mov     [postbyte_register],al
  6123.         mov     [extended_code],0C7h
  6124.         lods    byte [esi]
  6125.         call    get_size_operator
  6126.         cmp     al,'['
  6127.         jne     invalid_operand
  6128.         call    get_address
  6129.         mov     al,[operand_size]
  6130.         or      al,al
  6131.         jz      vmx_size_ok
  6132.         cmp     al,8
  6133.         jne     invalid_operand_size
  6134.       vmx_size_ok:
  6135.         mov     [base_code],0Fh
  6136.         jmp     instruction_ready
  6137. vmread_instruction:
  6138.         mov     [extended_code],78h
  6139.         lods    byte [esi]
  6140.         call    get_size_operator
  6141.         cmp     al,10h
  6142.         je      vmread_nomem
  6143.         cmp     al,'['
  6144.         jne     invalid_operand
  6145.         call    get_address
  6146.         lods    byte [esi]
  6147.         cmp     al,','
  6148.         jne     invalid_operand
  6149.         call    vmread_check_size
  6150.         mov     [operand_size],0
  6151.         lods    byte [esi]
  6152.         call    get_size_operator
  6153.         cmp     al,10h
  6154.         jne     invalid_operand
  6155.         lods    byte [esi]
  6156.         call    convert_register
  6157.         mov     [postbyte_register],al
  6158.         call    vmread_check_size
  6159.         jmp     vmx_size_ok
  6160.       vmread_nomem:
  6161.         lods    byte [esi]
  6162.         call    convert_register
  6163.         push    eax
  6164.         call    vmread_check_size
  6165.         lods    byte [esi]
  6166.         cmp     al,','
  6167.         jne     invalid_operand
  6168.         mov     [operand_size],0
  6169.         lods    byte [esi]
  6170.         call    get_size_operator
  6171.         cmp     al,10h
  6172.         jne     invalid_operand
  6173.         lods    byte [esi]
  6174.         call    convert_register
  6175.         mov     [postbyte_register],al
  6176.         call    vmread_check_size
  6177.         pop     ebx
  6178.         mov     [base_code],0Fh
  6179.         jmp     nomem_instruction_ready
  6180.       vmread_check_size:
  6181.         cmp     [code_type],64
  6182.         je      vmread_long
  6183.         cmp     [operand_size],4
  6184.         jne     invalid_operand_size
  6185.         ret
  6186.       vmread_long:
  6187.         cmp     [operand_size],8
  6188.         jne     invalid_operand_size
  6189.         ret
  6190. vmwrite_instruction:
  6191.         mov     [extended_code],79h
  6192.         lods    byte [esi]
  6193.         call    get_size_operator
  6194.         cmp     al,10h
  6195.         jne     invalid_operand
  6196.         lods    byte [esi]
  6197.         call    convert_register
  6198.         mov     [postbyte_register],al
  6199.         call    vmread_check_size
  6200.         mov     [operand_size],0
  6201.         lods    byte [esi]
  6202.         cmp     al,','
  6203.         jne     invalid_operand
  6204.         lods    byte [esi]
  6205.         call    get_size_operator
  6206.         cmp     al,10h
  6207.         je      vmwrite_nomem
  6208.         cmp     al,'['
  6209.         jne     invalid_operand
  6210.         call    get_address
  6211.         call    vmread_check_size
  6212.         jmp     vmx_size_ok
  6213.       vmwrite_nomem:
  6214.         lods    byte [esi]
  6215.         call    convert_register
  6216.         mov     bl,al
  6217.         mov     [base_code],0Fh
  6218.         jmp     nomem_instruction_ready
  6219. simple_svm_instruction:
  6220.         push    eax
  6221.         mov     [base_code],0Fh
  6222.         mov     [extended_code],1
  6223.         lods    byte [esi]
  6224.         call    get_size_operator
  6225.         cmp     al,10h
  6226.         jne     invalid_operand
  6227.         lods    byte [esi]
  6228.         call    convert_register
  6229.         or      al,al
  6230.         jnz     invalid_operand
  6231.       simple_svm_detect_size:
  6232.         cmp     ah,2
  6233.         je      simple_svm_16bit
  6234.         cmp     ah,4
  6235.         je      simple_svm_32bit
  6236.         cmp     [code_type],64
  6237.         jne     invalid_operand_size
  6238.         jmp     simple_svm_store
  6239.       simple_svm_16bit:
  6240.         cmp     [code_type],16
  6241.         je      simple_svm_store
  6242.         cmp     [code_type],64
  6243.         je      invalid_operand_size
  6244.         jmp     prefixed_svm_store
  6245.       simple_svm_32bit:
  6246.         cmp     [code_type],32
  6247.         je      simple_svm_store
  6248.       prefixed_svm_store:
  6249.         mov     al,67h
  6250.         stos    byte [edi]
  6251.       simple_svm_store:
  6252.         call    store_instruction_code
  6253.         pop     eax
  6254.         stos    byte [edi]
  6255.         jmp     instruction_assembled
  6256. skinit_instruction:
  6257.         lods    byte [esi]
  6258.         call    get_size_operator
  6259.         cmp     al,10h
  6260.         jne     invalid_operand
  6261.         lods    byte [esi]
  6262.         call    convert_register
  6263.         cmp     ax,0400h
  6264.         jne     invalid_operand
  6265.         mov     al,0DEh
  6266.         jmp     simple_vmx_instruction
  6267. invlpga_instruction:
  6268.         push    eax
  6269.         mov     [base_code],0Fh
  6270.         mov     [extended_code],1
  6271.         lods    byte [esi]
  6272.         call    get_size_operator
  6273.         cmp     al,10h
  6274.         jne     invalid_operand
  6275.         lods    byte [esi]
  6276.         call    convert_register
  6277.         or      al,al
  6278.         jnz     invalid_operand
  6279.         mov     bl,ah
  6280.         mov     [operand_size],0
  6281.         lods    byte [esi]
  6282.         cmp     al,','
  6283.         jne     invalid_operand
  6284.         lods    byte [esi]
  6285.         call    get_size_operator
  6286.         cmp     al,10h
  6287.         jne     invalid_operand
  6288.         lods    byte [esi]
  6289.         call    convert_register
  6290.         cmp     ax,0401h
  6291.         jne     invalid_operand
  6292.         mov     ah,bl
  6293.         jmp     simple_svm_detect_size
  6294.  
  6295. convert_register:
  6296.         mov     ah,al
  6297.         shr     ah,4
  6298.         and     al,0Fh
  6299.         cmp     ah,8
  6300.         je      match_register_size
  6301.         cmp     ah,4
  6302.         ja      invalid_operand
  6303.         cmp     ah,1
  6304.         ja      match_register_size
  6305.         cmp     al,4
  6306.         jb      match_register_size
  6307.         or      ah,ah
  6308.         jz      high_byte_register
  6309.         or      [rex_prefix],40h
  6310.       match_register_size:
  6311.         cmp     ah,[operand_size]
  6312.         je      register_size_ok
  6313.         cmp     [operand_size],0
  6314.         jne     operand_sizes_do_not_match
  6315.         mov     [operand_size],ah
  6316.       register_size_ok:
  6317.         ret
  6318.       high_byte_register:
  6319.         mov     ah,1
  6320.         or      [rex_prefix],80h
  6321.         jmp     match_register_size
  6322. convert_fpu_register:
  6323.         mov     ah,al
  6324.         shr     ah,4
  6325.         and     al,111b
  6326.         cmp     ah,10
  6327.         jne     invalid_operand
  6328.         jmp     match_register_size
  6329. convert_mmx_register:
  6330.         mov     ah,al
  6331.         shr     ah,4
  6332.         cmp     ah,0Ch
  6333.         je      xmm_register
  6334.         ja      invalid_operand
  6335.         and     al,111b
  6336.         cmp     ah,0Bh
  6337.         jne     invalid_operand
  6338.         mov     ah,8
  6339.         jmp     match_register_size
  6340.       xmm_register:
  6341.         and     al,0Fh
  6342.         mov     ah,16
  6343.         cmp     al,8
  6344.         jb      match_register_size
  6345.         cmp     [code_type],64
  6346.         jne     invalid_operand
  6347.         jmp     match_register_size
  6348. get_size_operator:
  6349.         xor     ah,ah
  6350.         cmp     al,11h
  6351.         jne     no_size_operator
  6352.         mov     [size_declared],1
  6353.         lods    word [esi]
  6354.         xchg    al,ah
  6355.         mov     [size_override],1
  6356.         cmp     ah,[operand_size]
  6357.         je      size_operator_ok
  6358.         cmp     [operand_size],0
  6359.         jne     operand_sizes_do_not_match
  6360.         mov     [operand_size],ah
  6361.       size_operator_ok:
  6362.         ret
  6363.       no_size_operator:
  6364.         mov     [size_declared],0
  6365.         cmp     al,'['
  6366.         jne     size_operator_ok
  6367.         mov     [size_override],0
  6368.         ret
  6369. get_jump_operator:
  6370.         mov     [jump_type],0
  6371.         cmp     al,12h
  6372.         jne     jump_operator_ok
  6373.         lods    word [esi]
  6374.         mov     [jump_type],al
  6375.         mov     al,ah
  6376.       jump_operator_ok:
  6377.         ret
  6378. get_address:
  6379.         mov     [segment_register],0
  6380.         mov     [address_size],0
  6381.         mov     al,[code_type]
  6382.         shr     al,3
  6383.         mov     [value_size],al
  6384.         mov     al,[esi]
  6385.         and     al,11110000b
  6386.         cmp     al,60h
  6387.         jne     get_size_prefix
  6388.         lods    byte [esi]
  6389.         sub     al,60h
  6390.         mov     [segment_register],al
  6391.         mov     al,[esi]
  6392.         and     al,11110000b
  6393.       get_size_prefix:
  6394.         cmp     al,70h
  6395.         jne     address_size_prefix_ok
  6396.         lods    byte [esi]
  6397.         sub     al,70h
  6398.         cmp     al,2
  6399.         jb      invalid_address_size
  6400.         cmp     al,8
  6401.         ja      invalid_address_size
  6402.         mov     [address_size],al
  6403.         mov     [value_size],al
  6404.       address_size_prefix_ok:
  6405.         call    calculate_address
  6406.         cmp     byte [esi-1],']'
  6407.         jne     invalid_address
  6408.         mov     [address_high],edx
  6409.         mov     edx,eax
  6410.         cmp     [code_type],64
  6411.         jne     address_ok
  6412.         or      bx,bx
  6413.         jnz     address_ok
  6414.         test    ch,0Fh
  6415.         jnz     address_ok
  6416.       calculate_relative_address:
  6417.         mov     edx,[address_symbol]
  6418.         mov     [symbol_identifier],edx
  6419.         mov     edx,[address_high]
  6420.         call    calculate_relative_offset
  6421.         mov     [address_high],edx
  6422.         cdq
  6423.         cmp     edx,[address_high]
  6424.         je      address_high_ok
  6425.         cmp     [error_line],0
  6426.         jne     address_high_ok
  6427.         mov     ebx,[current_line]
  6428.         mov     [error_line],ebx
  6429.         mov     [error],value_out_of_range
  6430.       address_high_ok:
  6431.         mov     edx,eax
  6432.         ror     ecx,16
  6433.         mov     cl,[value_type]
  6434.         rol     ecx,16
  6435.         mov     bx,0FF00h
  6436.       address_ok:
  6437.         ret
  6438. operand_16bit:
  6439.         cmp     [code_type],16
  6440.         je      size_prefix_ok
  6441.         mov     [operand_prefix],66h
  6442.         ret
  6443. operand_32bit:
  6444.         cmp     [code_type],16
  6445.         jne     size_prefix_ok
  6446.         mov     [operand_prefix],66h
  6447.       size_prefix_ok:
  6448.         ret
  6449. operand_64bit:
  6450.         cmp     [code_type],64
  6451.         jne     illegal_instruction
  6452.         or      [rex_prefix],48h
  6453.         ret
  6454. operand_autodetect:
  6455.         cmp     al,2
  6456.         je      operand_16bit
  6457.         cmp     al,4
  6458.         je      operand_32bit
  6459.         cmp     al,8
  6460.         je      operand_64bit
  6461.         jmp     invalid_operand_size
  6462. store_segment_prefix_if_necessary:
  6463.         mov     al,[segment_register]
  6464.         or      al,al
  6465.         jz      segment_prefix_ok
  6466.         cmp     al,3
  6467.         je      ss_prefix
  6468.         cmp     al,4
  6469.         ja      segment_prefix_386
  6470.         jb      segment_prefix_86
  6471.         cmp     bl,25h
  6472.         je      segment_prefix_86
  6473.         cmp     bh,25h
  6474.         je      segment_prefix_86
  6475.         cmp     bh,45h
  6476.         je      segment_prefix_86
  6477.         cmp     bh,44h
  6478.         je      segment_prefix_86
  6479.         ret
  6480.       ss_prefix:
  6481.         cmp     bl,25h
  6482.         je      segment_prefix_ok
  6483.         cmp     bh,25h
  6484.         je      segment_prefix_ok
  6485.         cmp     bh,45h
  6486.         je      segment_prefix_ok
  6487.         cmp     bh,44h
  6488.         je      segment_prefix_ok
  6489.         jmp     segment_prefix_86
  6490. store_segment_prefix:
  6491.         mov     al,[segment_register]
  6492.         or      al,al
  6493.         jz      segment_prefix_ok
  6494.         cmp     al,5
  6495.         jae     segment_prefix_386
  6496.       segment_prefix_86:
  6497.         dec     al
  6498.         shl     al,3
  6499.         add     al,26h
  6500.         stos    byte [edi]
  6501.         jmp     segment_prefix_ok
  6502.       segment_prefix_386:
  6503.         add     al,64h-5
  6504.         stos    byte [edi]
  6505.       segment_prefix_ok:
  6506.         ret
  6507. store_instruction_code:
  6508.         mov     al,[operand_prefix]
  6509.         or      al,al
  6510.         jz      operand_prefix_ok
  6511.         stos    byte [edi]
  6512.       operand_prefix_ok:
  6513.         mov     al,[opcode_prefix]
  6514.         or      al,al
  6515.         jz      opcode_prefix_ok
  6516.         stos    byte [edi]
  6517.       opcode_prefix_ok:
  6518.         mov     al,[rex_prefix]
  6519.         test    al,40h
  6520.         jz      rex_prefix_ok
  6521.         cmp     [code_type],64
  6522.         jne     invalid_operand
  6523.         test    al,0B0h
  6524.         jnz     prefix_conflict
  6525.         stos    byte [edi]
  6526.       rex_prefix_ok:
  6527.         mov     al,[base_code]
  6528.         stos    byte [edi]
  6529.         cmp     al,0Fh
  6530.         jne     instruction_code_ok
  6531.       store_extended_code:
  6532.         mov     al,[extended_code]
  6533.         stos    byte [edi]
  6534.         cmp     al,38h
  6535.         je      store_supplemental_code
  6536.         cmp     al,3Ah
  6537.         je      store_supplemental_code
  6538.       instruction_code_ok:
  6539.         ret
  6540.       store_supplemental_code:
  6541.         mov     al,[supplemental_code]
  6542.         stos    byte [edi]
  6543.         ret
  6544. store_nomem_instruction:
  6545.         test    [postbyte_register],1000b
  6546.         jz      nomem_reg_code_ok
  6547.         or      [rex_prefix],44h
  6548.         and     [postbyte_register],111b
  6549.       nomem_reg_code_ok:
  6550.         test    bl,1000b
  6551.         jz      nomem_rm_code_ok
  6552.         or      [rex_prefix],41h
  6553.         and     bl,111b
  6554.       nomem_rm_code_ok:
  6555.         call    store_instruction_code
  6556.         mov     al,[postbyte_register]
  6557.         shl     al,3
  6558.         or      al,bl
  6559.         or      al,11000000b
  6560.         stos    byte [edi]
  6561.         ret
  6562. store_instruction:
  6563.         mov     [current_offset],edi
  6564.         test    [postbyte_register],1000b
  6565.         jz      reg_code_ok
  6566.         or      [rex_prefix],44h
  6567.         and     [postbyte_register],111b
  6568.       reg_code_ok:
  6569.         call    store_segment_prefix_if_necessary
  6570.         or      bx,bx
  6571.         jz      address_immediate
  6572.         cmp     bx,0F800h
  6573.         je      address_rip_based
  6574.         cmp     bx,0F400h
  6575.         je      address_eip_based
  6576.         cmp     bx,0FF00h
  6577.         je      address_relative
  6578.         mov     al,bl
  6579.         or      al,bh
  6580.         and     al,11110000b
  6581.         cmp     al,80h
  6582.         je      postbyte_64bit
  6583.         cmp     al,40h
  6584.         je      postbyte_32bit
  6585.         cmp     al,20h
  6586.         jne     invalid_address
  6587.         cmp     [code_type],64
  6588.         je      invalid_address_size
  6589.         call    address_16bit_prefix
  6590.         call    store_instruction_code
  6591.         cmp     bl,bh
  6592.         jbe     determine_16bit_address
  6593.         xchg    bl,bh
  6594.       determine_16bit_address:
  6595.         cmp     bx,2600h
  6596.         je      address_si
  6597.         cmp     bx,2700h
  6598.         je      address_di
  6599.         cmp     bx,2300h
  6600.         je      address_bx
  6601.         cmp     bx,2500h
  6602.         je      address_bp
  6603.         cmp     bx,2625h
  6604.         je      address_bp_si
  6605.         cmp     bx,2725h
  6606.         je      address_bp_di
  6607.         cmp     bx,2723h
  6608.         je      address_bx_di
  6609.         cmp     bx,2623h
  6610.         jne     invalid_address
  6611.       address_bx_si:
  6612.         xor     al,al
  6613.         jmp     postbyte_16bit
  6614.       address_bx_di:
  6615.         mov     al,1
  6616.         jmp     postbyte_16bit
  6617.       address_bp_si:
  6618.         mov     al,10b
  6619.         jmp     postbyte_16bit
  6620.       address_bp_di:
  6621.         mov     al,11b
  6622.         jmp     postbyte_16bit
  6623.       address_si:
  6624.         mov     al,100b
  6625.         jmp     postbyte_16bit
  6626.       address_di:
  6627.         mov     al,101b
  6628.         jmp     postbyte_16bit
  6629.       address_bx:
  6630.         mov     al,111b
  6631.         jmp     postbyte_16bit
  6632.       address_bp:
  6633.         mov     al,110b
  6634.       postbyte_16bit:
  6635.         test    ch,22h
  6636.         jnz     address_16bit_value
  6637.         or      ch,ch
  6638.         jnz     address_sizes_do_not_agree
  6639.         cmp     edx,10000h
  6640.         jge     value_out_of_range
  6641.         cmp     edx,-8000h
  6642.         jl      value_out_of_range
  6643.         or      dx,dx
  6644.         jz      address
  6645.         cmp     dx,80h
  6646.         jb      address_8bit_value
  6647.         cmp     dx,-80h
  6648.         jae     address_8bit_value
  6649.       address_16bit_value:
  6650.         or      al,10000000b
  6651.         mov     cl,[postbyte_register]
  6652.         shl     cl,3
  6653.         or      al,cl
  6654.         stos    byte [edi]
  6655.         mov     eax,edx
  6656.         stos    word [edi]
  6657.         ret
  6658.       address_8bit_value:
  6659.         or      al,01000000b
  6660.         mov     cl,[postbyte_register]
  6661.         shl     cl,3
  6662.         or      al,cl
  6663.         stos    byte [edi]
  6664.         mov     al,dl
  6665.         stos    byte [edi]
  6666.         cmp     dx,80h
  6667.         jge     value_out_of_range
  6668.         cmp     dx,-80h
  6669.         jl      value_out_of_range
  6670.         ret
  6671.       address:
  6672.         cmp     al,110b
  6673.         je      address_8bit_value
  6674.         mov     cl,[postbyte_register]
  6675.         shl     cl,3
  6676.         or      al,cl
  6677.         stos    byte [edi]
  6678.         ret
  6679.       postbyte_32bit:
  6680.         call    address_32bit_prefix
  6681.         jmp     address_prefix_ok
  6682.       postbyte_64bit:
  6683.         cmp     [code_type],64
  6684.         jne     invalid_address_size
  6685.       address_prefix_ok:
  6686.         test    bh,1000b
  6687.         jz      base_code_ok
  6688.         or      [rex_prefix],41h
  6689.       base_code_ok:
  6690.         test    bl,1000b
  6691.         jz      index_code_ok
  6692.         or      [rex_prefix],42h
  6693.       index_code_ok:
  6694.         call    store_instruction_code
  6695.         cmp     bl,44h
  6696.         je      swap_base_with_index
  6697.         cmp     bl,84h
  6698.         jne     base_register_ok
  6699.       swap_base_with_index:
  6700.         cmp     cl,1
  6701.         jne     invalid_address
  6702.         xchg    bl,bh
  6703.         cmp     bl,44h
  6704.         je      invalid_address
  6705.         cmp     bl,84h
  6706.         je      invalid_address
  6707.       base_register_ok:
  6708.         or      cl,cl
  6709.         jz      only_base_register
  6710.       base_and_index:
  6711.         mov     al,100b
  6712.         xor     ah,ah
  6713.         cmp     cl,1
  6714.         je      scale_ok
  6715.         cmp     cl,2
  6716.         je      scale_1
  6717.         cmp     cl,4
  6718.         je      scale_2
  6719.         or      ah,11000000b
  6720.         jmp     scale_ok
  6721.       scale_2:
  6722.         or      ah,10000000b
  6723.         jmp     scale_ok
  6724.       scale_1:
  6725.         or      ah,01000000b
  6726.       scale_ok:
  6727.         or      bh,bh
  6728.         jz      only_index_register
  6729.         and     bl,111b
  6730.         shl     bl,3
  6731.         or      ah,bl
  6732.         and     bh,111b
  6733.         or      ah,bh
  6734.         test    ch,44h
  6735.         jnz     sib_address_32bit_value
  6736.         test    ch,88h
  6737.         jnz     sib_address_32bit_value
  6738.         or      ch,ch
  6739.         jnz     address_sizes_do_not_agree
  6740.         cmp     bh,5
  6741.         je      address_value
  6742.         or      edx,edx
  6743.         jz      sib_address
  6744.       address_value:
  6745.         cmp     edx,80h
  6746.         jb      sib_address_8bit_value
  6747.         cmp     edx,-80h
  6748.         jae     sib_address_8bit_value
  6749.       sib_address_32bit_value:
  6750.         or      al,10000000b
  6751.         mov     cl,[postbyte_register]
  6752.         shl     cl,3
  6753.         or      al,cl
  6754.         stos    word [edi]
  6755.       address_32bit_value:
  6756.         cmp     [code_type],64
  6757.         jne     store_address_32bit_value
  6758.         mov     eax,edx
  6759.         cdq
  6760.         cmp     edx,[address_high]
  6761.         je      address_32bit_value_ok
  6762.         cmp     [error_line],0
  6763.         jne     address_32bit_value_ok
  6764.         mov     edx,[current_line]
  6765.         mov     [error_line],edx
  6766.         mov     [error],value_out_of_range
  6767.       address_32bit_value_ok:
  6768.         mov     edx,eax
  6769.         jmp     store_address_32bit_value
  6770.       sib_address_8bit_value:
  6771.         or      al,01000000b
  6772.         mov     cl,[postbyte_register]
  6773.         shl     cl,3
  6774.         or      al,cl
  6775.         stos    word [edi]
  6776.         mov     al,dl
  6777.         stos    byte [edi]
  6778.         cmp     edx,80h
  6779.         jge     value_out_of_range
  6780.         cmp     edx,-80h
  6781.         jl      value_out_of_range
  6782.         ret
  6783.       sib_address:
  6784.         mov     cl,[postbyte_register]
  6785.         shl     cl,3
  6786.         or      al,cl
  6787.         stos    word [edi]
  6788.         ret
  6789.       only_index_register:
  6790.         or      ah,101b
  6791.         and     bl,111b
  6792.         shl     bl,3
  6793.         or      ah,bl
  6794.         mov     cl,[postbyte_register]
  6795.         shl     cl,3
  6796.         or      al,cl
  6797.         stos    word [edi]
  6798.         test    ch,44h
  6799.         jnz     address_32bit_value
  6800.         test    ch,88h
  6801.         jnz     address_32bit_value
  6802.         or      ch,ch
  6803.         jnz     invalid_address_size
  6804.         jmp     address_32bit_value
  6805.       zero_index_register:
  6806.         mov     bl,4
  6807.         mov     cl,1
  6808.         jmp     base_and_index
  6809.       only_base_register:
  6810.         mov     al,bh
  6811.         and     al,111b
  6812.         cmp     al,4
  6813.         je      zero_index_register
  6814.         test    ch,44h
  6815.         jnz     simple_address_32bit_value
  6816.         test    ch,88h
  6817.         jnz     simple_address_32bit_value
  6818.         or      ch,ch
  6819.         jnz     address_sizes_do_not_agree
  6820.         or      edx,edx
  6821.         jz      simple_address
  6822.         cmp     edx,80h
  6823.         jb      simple_address_8bit_value
  6824.         cmp     edx,-80h
  6825.         jae     simple_address_8bit_value
  6826.       simple_address_32bit_value:
  6827.         or      al,10000000b
  6828.         mov     cl,[postbyte_register]
  6829.         shl     cl,3
  6830.         or      al,cl
  6831.         stos    byte [edi]
  6832.         jmp     address_32bit_value
  6833.       simple_address_8bit_value:
  6834.         or      al,01000000b
  6835.         mov     cl,[postbyte_register]
  6836.         shl     cl,3
  6837.         or      al,cl
  6838.         stos    byte [edi]
  6839.         mov     al,dl
  6840.         stos    byte [edi]
  6841.         cmp     edx,80h
  6842.         jge     value_out_of_range
  6843.         cmp     edx,-80h
  6844.         jl      value_out_of_range
  6845.         ret
  6846.       simple_address:
  6847.         cmp     al,5
  6848.         je      simple_address_8bit_value
  6849.         mov     cl,[postbyte_register]
  6850.         shl     cl,3
  6851.         or      al,cl
  6852.         stos    byte [edi]
  6853.         ret
  6854.       address_immediate:
  6855.         cmp     [code_type],64
  6856.         je      address_immediate_sib
  6857.         test    ch,44h
  6858.         jnz     address_immediate_32bit
  6859.         test    ch,22h
  6860.         jnz     address_immediate_16bit
  6861.         or      ch,ch
  6862.         jnz     invalid_address_size
  6863.         cmp     [code_type],16
  6864.         je      addressing_16bit
  6865.       address_immediate_32bit:
  6866.         call    address_32bit_prefix
  6867.         call    store_instruction_code
  6868.       store_immediate_address:
  6869.         mov     al,101b
  6870.         mov     cl,[postbyte_register]
  6871.         shl     cl,3
  6872.         or      al,cl
  6873.         stos    byte [edi]
  6874.       store_address_32bit_value:
  6875.         test    ch,0F0h
  6876.         jz      address_32bit_relocation_ok
  6877.         mov     eax,ecx
  6878.         shr     eax,16
  6879.         cmp     al,4
  6880.         jne     address_32bit_relocation
  6881.         mov     al,2
  6882.       address_32bit_relocation:
  6883.         xchg    [value_type],al
  6884.         mov     ebx,[address_symbol]
  6885.         xchg    ebx,[symbol_identifier]
  6886.         call    mark_relocation
  6887.         mov     [value_type],al
  6888.         mov     [symbol_identifier],ebx
  6889.       address_32bit_relocation_ok:
  6890.         mov     eax,edx
  6891.         stos    dword [edi]
  6892.         ret
  6893.       store_address_64bit_value:
  6894.         test    ch,0F0h
  6895.         jz      address_64bit_relocation_ok
  6896.         mov     eax,ecx
  6897.         shr     eax,16
  6898.         xchg    [value_type],al
  6899.         mov     ebx,[address_symbol]
  6900.         xchg    ebx,[symbol_identifier]
  6901.         call    mark_relocation
  6902.         mov     [value_type],al
  6903.         mov     [symbol_identifier],ebx
  6904.       address_64bit_relocation_ok:
  6905.         mov     eax,edx
  6906.         stos    dword [edi]
  6907.         mov     eax,[address_high]
  6908.         stos    dword [edi]
  6909.         ret
  6910.       address_immediate_sib:
  6911.         test    ch,not 44h
  6912.         jnz     invalid_address_size
  6913.         test    ecx,0FF0000h
  6914.         jnz     address_immediate_sib_nosignextend
  6915.         test    edx,80000000h
  6916.         jz      address_immediate_sib_prefix_ok
  6917.       address_immediate_sib_nosignextend:
  6918.         call    address_32bit_prefix
  6919.       address_immediate_sib_prefix_ok:
  6920.         call    store_instruction_code
  6921.         mov     al,100b
  6922.         mov     ah,100101b
  6923.         mov     cl,[postbyte_register]
  6924.         shl     cl,3
  6925.         or      al,cl
  6926.         stos    word [edi]
  6927.         jmp     store_address_32bit_value
  6928.       address_eip_based:
  6929.         mov     al,67h
  6930.         stos    byte [edi]
  6931.       address_rip_based:
  6932.         cmp     [code_type],64
  6933.         jne     invalid_address
  6934.         call    store_instruction_code
  6935.         jmp     store_immediate_address
  6936.       address_relative:
  6937.         call    store_instruction_code
  6938.         movzx   eax,[immediate_size]
  6939.         add     eax,edi
  6940.         sub     eax,[current_offset]
  6941.         add     eax,5
  6942.         sub     edx,eax
  6943.         jo      value_out_of_range
  6944.         mov     al,101b
  6945.         mov     cl,[postbyte_register]
  6946.         shl     cl,3
  6947.         or      al,cl
  6948.         stos    byte [edi]
  6949.         shr     ecx,16
  6950.         xchg    [value_type],cl
  6951.         mov     ebx,[address_symbol]
  6952.         xchg    ebx,[symbol_identifier]
  6953.         mov     eax,edx
  6954.         call    mark_relocation
  6955.         mov     [value_type],cl
  6956.         mov     [symbol_identifier],ebx
  6957.         stos    dword [edi]
  6958.         ret
  6959.       addressing_16bit:
  6960.         cmp     edx,10000h
  6961.         jge     address_immediate_32bit
  6962.         cmp     edx,-8000h
  6963.         jl      address_immediate_32bit
  6964.         movzx   edx,dx
  6965.       address_immediate_16bit:
  6966.         call    address_16bit_prefix
  6967.         call    store_instruction_code
  6968.         mov     al,110b
  6969.         mov     cl,[postbyte_register]
  6970.         shl     cl,3
  6971.         or      al,cl
  6972.         stos    byte [edi]
  6973.         mov     eax,edx
  6974.         stos    word [edi]
  6975.         cmp     edx,10000h
  6976.         jge     value_out_of_range
  6977.         cmp     edx,-8000h
  6978.         jl      value_out_of_range
  6979.         ret
  6980.       address_16bit_prefix:
  6981.         cmp     [code_type],16
  6982.         je      instruction_prefix_ok
  6983.         mov     al,67h
  6984.         stos    byte [edi]
  6985.         ret
  6986.       address_32bit_prefix:
  6987.         cmp     [code_type],32
  6988.         je      instruction_prefix_ok
  6989.         mov     al,67h
  6990.         stos    byte [edi]
  6991.       instruction_prefix_ok:
  6992.         ret
  6993. store_instruction_with_imm8:
  6994.         mov     [immediate_size],1
  6995.         call    store_instruction
  6996.         mov     al,byte [value]
  6997.         stos    byte [edi]
  6998.         ret
  6999. store_instruction_with_imm16:
  7000.         mov     [immediate_size],2
  7001.         call    store_instruction
  7002.         mov     ax,word [value]
  7003.         call    mark_relocation
  7004.         stos    word [edi]
  7005.         ret
  7006. store_instruction_with_imm32:
  7007.         mov     [immediate_size],4
  7008.         call    store_instruction
  7009.         mov     eax,dword [value]
  7010.         call    mark_relocation
  7011.         stos    dword [edi]
  7012.         ret
  7013.