Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ; flat assembler core
  3. ; Copyright (c) 1999-2013, 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. iret_instruction:
  38.         cmp     [code_type],64
  39.         jne     simple_instruction
  40. simple_instruction_64bit:
  41.         cmp     [code_type],64
  42.         jne     illegal_instruction
  43.         mov     ah,al
  44.         mov     al,48h
  45.         stos    word [edi]
  46.         jmp     instruction_assembled
  47. simple_extended_instruction_64bit:
  48.         cmp     [code_type],64
  49.         jne     illegal_instruction
  50.         mov     byte [edi],48h
  51.         inc     edi
  52. simple_extended_instruction:
  53.         mov     ah,al
  54.         mov     al,0Fh
  55.         stos    word [edi]
  56.         jmp     instruction_assembled
  57. prefix_instruction:
  58.         stos    byte [edi]
  59.         or      [prefixed_instruction],-1
  60.         jmp     continue_line
  61. segment_prefix:
  62.         mov     ah,al
  63.         shr     ah,4
  64.         cmp     ah,6
  65.         jne     illegal_instruction
  66.         and     al,1111b
  67.         mov     [segment_register],al
  68.         call    store_segment_prefix
  69.         or      [prefixed_instruction],-1
  70.         jmp     continue_line
  71. int_instruction:
  72.         lods    byte [esi]
  73.         call    get_size_operator
  74.         cmp     ah,1
  75.         ja      invalid_operand_size
  76.         cmp     al,'('
  77.         jne     invalid_operand
  78.         call    get_byte_value
  79.         test    eax,eax
  80.         jns     int_imm_ok
  81.         call    recoverable_overflow
  82.       int_imm_ok:
  83.         mov     ah,al
  84.         mov     al,0CDh
  85.         stos    word [edi]
  86.         jmp     instruction_assembled
  87. aa_instruction:
  88.         cmp     [code_type],64
  89.         je      illegal_instruction
  90.         push    eax
  91.         mov     bl,10
  92.         cmp     byte [esi],'('
  93.         jne     aa_store
  94.         inc     esi
  95.         xor     al,al
  96.         xchg    al,[operand_size]
  97.         cmp     al,1
  98.         ja      invalid_operand_size
  99.         call    get_byte_value
  100.         mov     bl,al
  101.       aa_store:
  102.         cmp     [operand_size],0
  103.         jne     invalid_operand
  104.         pop     eax
  105.         mov     ah,bl
  106.         stos    word [edi]
  107.         jmp     instruction_assembled
  108.  
  109. basic_instruction:
  110.         mov     [base_code],al
  111.         lods    byte [esi]
  112.         call    get_size_operator
  113.         cmp     al,10h
  114.         je      basic_reg
  115.         cmp     al,'['
  116.         jne     invalid_operand
  117.       basic_mem:
  118.         call    get_address
  119.         push    edx ebx ecx
  120.         lods    byte [esi]
  121.         cmp     al,','
  122.         jne     invalid_operand
  123.         lods    byte [esi]
  124.         call    get_size_operator
  125.         cmp     al,'('
  126.         je      basic_mem_imm
  127.         cmp     al,10h
  128.         jne     invalid_operand
  129.       basic_mem_reg:
  130.         lods    byte [esi]
  131.         call    convert_register
  132.         mov     [postbyte_register],al
  133.         pop     ecx ebx edx
  134.         mov     al,ah
  135.         cmp     al,1
  136.         je      instruction_ready
  137.         call    operand_autodetect
  138.         inc     [base_code]
  139.       instruction_ready:
  140.         call    store_instruction
  141.         jmp     instruction_assembled
  142.       basic_mem_imm:
  143.         mov     al,[operand_size]
  144.         cmp     al,1
  145.         jb      basic_mem_imm_nosize
  146.         je      basic_mem_imm_8bit
  147.         cmp     al,2
  148.         je      basic_mem_imm_16bit
  149.         cmp     al,4
  150.         je      basic_mem_imm_32bit
  151.         cmp     al,8
  152.         jne     invalid_operand_size
  153.       basic_mem_imm_64bit:
  154.         cmp     [size_declared],0
  155.         jne     long_immediate_not_encodable
  156.         call    operand_64bit
  157.         call    get_simm32
  158.         cmp     [value_type],4
  159.         jae     long_immediate_not_encodable
  160.         jmp     basic_mem_imm_32bit_ok
  161.       basic_mem_imm_nosize:
  162.         call    recoverable_unknown_size
  163.       basic_mem_imm_8bit:
  164.         call    get_byte_value
  165.         mov     byte [value],al
  166.         mov     al,[base_code]
  167.         shr     al,3
  168.         mov     [postbyte_register],al
  169.         pop     ecx ebx edx
  170.         mov     [base_code],80h
  171.         call    store_instruction_with_imm8
  172.         jmp     instruction_assembled
  173.       basic_mem_imm_16bit:
  174.         call    operand_16bit
  175.         call    get_word_value
  176.         mov     word [value],ax
  177.         mov     al,[base_code]
  178.         shr     al,3
  179.         mov     [postbyte_register],al
  180.         pop     ecx ebx edx
  181.         cmp     [value_type],0
  182.         jne     basic_mem_imm_16bit_store
  183.         cmp     [size_declared],0
  184.         jne     basic_mem_imm_16bit_store
  185.         cmp     word [value],80h
  186.         jb      basic_mem_simm_8bit
  187.         cmp     word [value],-80h
  188.         jae     basic_mem_simm_8bit
  189.       basic_mem_imm_16bit_store:
  190.         mov     [base_code],81h
  191.         call    store_instruction_with_imm16
  192.         jmp     instruction_assembled
  193.       basic_mem_simm_8bit:
  194.         mov     [base_code],83h
  195.         call    store_instruction_with_imm8
  196.         jmp     instruction_assembled
  197.       basic_mem_imm_32bit:
  198.         call    operand_32bit
  199.         call    get_dword_value
  200.       basic_mem_imm_32bit_ok:
  201.         mov     dword [value],eax
  202.         mov     al,[base_code]
  203.         shr     al,3
  204.         mov     [postbyte_register],al
  205.         pop     ecx ebx edx
  206.         cmp     [value_type],0
  207.         jne     basic_mem_imm_32bit_store
  208.         cmp     [size_declared],0
  209.         jne     basic_mem_imm_32bit_store
  210.         cmp     dword [value],80h
  211.         jb      basic_mem_simm_8bit
  212.         cmp     dword [value],-80h
  213.         jae     basic_mem_simm_8bit
  214.       basic_mem_imm_32bit_store:
  215.         mov     [base_code],81h
  216.         call    store_instruction_with_imm32
  217.         jmp     instruction_assembled
  218.       get_simm32:
  219.         call    get_qword_value
  220.         mov     ecx,edx
  221.         cdq
  222.         cmp     ecx,edx
  223.         jne     value_out_of_range
  224.         cmp     [value_type],4
  225.         jne     get_simm32_ok
  226.         mov     [value_type],2
  227.       get_simm32_ok:
  228.         ret
  229.       basic_reg:
  230.         lods    byte [esi]
  231.         call    convert_register
  232.         mov     [postbyte_register],al
  233.         lods    byte [esi]
  234.         cmp     al,','
  235.         jne     invalid_operand
  236.         lods    byte [esi]
  237.         call    get_size_operator
  238.         cmp     al,10h
  239.         je      basic_reg_reg
  240.         cmp     al,'('
  241.         je      basic_reg_imm
  242.         cmp     al,'['
  243.         jne     invalid_operand
  244.       basic_reg_mem:
  245.         call    get_address
  246.         mov     al,[operand_size]
  247.         cmp     al,1
  248.         je      basic_reg_mem_8bit
  249.         call    operand_autodetect
  250.         add     [base_code],3
  251.         jmp     instruction_ready
  252.       basic_reg_mem_8bit:
  253.         add     [base_code],2
  254.         jmp     instruction_ready
  255.       basic_reg_reg:
  256.         lods    byte [esi]
  257.         call    convert_register
  258.         mov     bl,[postbyte_register]
  259.         mov     [postbyte_register],al
  260.         mov     al,ah
  261.         cmp     al,1
  262.         je      nomem_instruction_ready
  263.         call    operand_autodetect
  264.         inc     [base_code]
  265.       nomem_instruction_ready:
  266.         call    store_nomem_instruction
  267.         jmp     instruction_assembled
  268.       basic_reg_imm:
  269.         mov     al,[operand_size]
  270.         cmp     al,1
  271.         je      basic_reg_imm_8bit
  272.         cmp     al,2
  273.         je      basic_reg_imm_16bit
  274.         cmp     al,4
  275.         je      basic_reg_imm_32bit
  276.         cmp     al,8
  277.         jne     invalid_operand_size
  278.       basic_reg_imm_64bit:
  279.         cmp     [size_declared],0
  280.         jne     long_immediate_not_encodable
  281.         call    operand_64bit
  282.         call    get_simm32
  283.         cmp     [value_type],4
  284.         jae     long_immediate_not_encodable
  285.         jmp     basic_reg_imm_32bit_ok
  286.       basic_reg_imm_8bit:
  287.         call    get_byte_value
  288.         mov     dl,al
  289.         mov     bl,[base_code]
  290.         shr     bl,3
  291.         xchg    bl,[postbyte_register]
  292.         or      bl,bl
  293.         jz      basic_al_imm
  294.         mov     [base_code],80h
  295.         call    store_nomem_instruction
  296.         mov     al,dl
  297.         stos    byte [edi]
  298.         jmp     instruction_assembled
  299.       basic_al_imm:
  300.         mov     al,[base_code]
  301.         add     al,4
  302.         stos    byte [edi]
  303.         mov     al,dl
  304.         stos    byte [edi]
  305.         jmp     instruction_assembled
  306.       basic_reg_imm_16bit:
  307.         call    operand_16bit
  308.         call    get_word_value
  309.         mov     dx,ax
  310.         mov     bl,[base_code]
  311.         shr     bl,3
  312.         xchg    bl,[postbyte_register]
  313.         cmp     [value_type],0
  314.         jne     basic_reg_imm_16bit_store
  315.         cmp     [size_declared],0
  316.         jne     basic_reg_imm_16bit_store
  317.         cmp     dx,80h
  318.         jb      basic_reg_simm_8bit
  319.         cmp     dx,-80h
  320.         jae     basic_reg_simm_8bit
  321.       basic_reg_imm_16bit_store:
  322.         or      bl,bl
  323.         jz      basic_ax_imm
  324.         mov     [base_code],81h
  325.         call    store_nomem_instruction
  326.       basic_store_imm_16bit:
  327.         mov     ax,dx
  328.         call    mark_relocation
  329.         stos    word [edi]
  330.         jmp     instruction_assembled
  331.       basic_reg_simm_8bit:
  332.         mov     [base_code],83h
  333.         call    store_nomem_instruction
  334.         mov     al,dl
  335.         stos    byte [edi]
  336.         jmp     instruction_assembled
  337.       basic_ax_imm:
  338.         add     [base_code],5
  339.         call    store_instruction_code
  340.         jmp     basic_store_imm_16bit
  341.       basic_reg_imm_32bit:
  342.         call    operand_32bit
  343.         call    get_dword_value
  344.       basic_reg_imm_32bit_ok:
  345.         mov     edx,eax
  346.         mov     bl,[base_code]
  347.         shr     bl,3
  348.         xchg    bl,[postbyte_register]
  349.         cmp     [value_type],0
  350.         jne     basic_reg_imm_32bit_store
  351.         cmp     [size_declared],0
  352.         jne     basic_reg_imm_32bit_store
  353.         cmp     edx,80h
  354.         jb      basic_reg_simm_8bit
  355.         cmp     edx,-80h
  356.         jae     basic_reg_simm_8bit
  357.       basic_reg_imm_32bit_store:
  358.         or      bl,bl
  359.         jz      basic_eax_imm
  360.         mov     [base_code],81h
  361.         call    store_nomem_instruction
  362.       basic_store_imm_32bit:
  363.         mov     eax,edx
  364.         call    mark_relocation
  365.         stos    dword [edi]
  366.         jmp     instruction_assembled
  367.       basic_eax_imm:
  368.         add     [base_code],5
  369.         call    store_instruction_code
  370.         jmp     basic_store_imm_32bit
  371.       recoverable_unknown_size:
  372.         cmp     [error_line],0
  373.         jne     ignore_unknown_size
  374.         push    [current_line]
  375.         pop     [error_line]
  376.         mov     [error],operand_size_not_specified
  377.       ignore_unknown_size:
  378.         ret
  379. single_operand_instruction:
  380.         mov     [base_code],0F6h
  381.         mov     [postbyte_register],al
  382.         lods    byte [esi]
  383.         call    get_size_operator
  384.         cmp     al,10h
  385.         je      single_reg
  386.         cmp     al,'['
  387.         jne     invalid_operand
  388.       single_mem:
  389.         call    get_address
  390.         mov     al,[operand_size]
  391.         cmp     al,1
  392.         je      single_mem_8bit
  393.         jb      single_mem_nosize
  394.         call    operand_autodetect
  395.         inc     [base_code]
  396.         jmp     instruction_ready
  397.       single_mem_nosize:
  398.         call    recoverable_unknown_size
  399.       single_mem_8bit:
  400.         jmp     instruction_ready
  401.       single_reg:
  402.         lods    byte [esi]
  403.         call    convert_register
  404.         mov     bl,al
  405.         mov     al,ah
  406.         cmp     al,1
  407.         je      single_reg_8bit
  408.         call    operand_autodetect
  409.         inc     [base_code]
  410.       single_reg_8bit:
  411.         jmp     nomem_instruction_ready
  412. mov_instruction:
  413.         mov     [base_code],88h
  414.         lods    byte [esi]
  415.         call    get_size_operator
  416.         cmp     al,10h
  417.         je      mov_reg
  418.         cmp     al,'['
  419.         jne     invalid_operand
  420.       mov_mem:
  421.         call    get_address
  422.         push    edx ebx ecx
  423.         lods    byte [esi]
  424.         cmp     al,','
  425.         jne     invalid_operand
  426.         lods    byte [esi]
  427.         call    get_size_operator
  428.         cmp     al,'('
  429.         je      mov_mem_imm
  430.         cmp     al,10h
  431.         jne     invalid_operand
  432.       mov_mem_reg:
  433.         lods    byte [esi]
  434.         cmp     al,60h
  435.         jb      mov_mem_general_reg
  436.         cmp     al,70h
  437.         jb      mov_mem_sreg
  438.       mov_mem_general_reg:
  439.         call    convert_register
  440.         mov     [postbyte_register],al
  441.         pop     ecx ebx edx
  442.         cmp     ah,1
  443.         je      mov_mem_reg_8bit
  444.         mov     al,ah
  445.         call    operand_autodetect
  446.         mov     al,[postbyte_register]
  447.         or      al,bl
  448.         or      al,bh
  449.         jz      mov_mem_ax
  450.         inc     [base_code]
  451.         jmp     instruction_ready
  452.       mov_mem_reg_8bit:
  453.         or      al,bl
  454.         or      al,bh
  455.         jnz     instruction_ready
  456.       mov_mem_al:
  457.         test    ch,22h
  458.         jnz     mov_mem_address16_al
  459.         test    ch,44h
  460.         jnz     mov_mem_address32_al
  461.         test    ch,88h
  462.         jnz     mov_mem_address64_al
  463.         or      ch,ch
  464.         jnz     invalid_address_size
  465.         cmp     [code_type],64
  466.         je      mov_mem_address64_al
  467.         cmp     [code_type],32
  468.         je      mov_mem_address32_al
  469.         cmp     edx,10000h
  470.         jb      mov_mem_address16_al
  471.       mov_mem_address32_al:
  472.         call    store_segment_prefix_if_necessary
  473.         call    address_32bit_prefix
  474.         mov     [base_code],0A2h
  475.       store_mov_address32:
  476.         call    store_instruction_code
  477.         call    store_address_32bit_value
  478.         jmp     instruction_assembled
  479.       mov_mem_address16_al:
  480.         call    store_segment_prefix_if_necessary
  481.         call    address_16bit_prefix
  482.         mov     [base_code],0A2h
  483.       store_mov_address16:
  484.         cmp     [code_type],64
  485.         je      invalid_address
  486.         call    store_instruction_code
  487.         mov     eax,edx
  488.         stos    word [edi]
  489.         cmp     edx,10000h
  490.         jge     value_out_of_range
  491.         jmp     instruction_assembled
  492.       mov_mem_address64_al:
  493.         call    store_segment_prefix_if_necessary
  494.         mov     [base_code],0A2h
  495.       store_mov_address64:
  496.         call    store_instruction_code
  497.         call    store_address_64bit_value
  498.         jmp     instruction_assembled
  499.       mov_mem_ax:
  500.         test    ch,22h
  501.         jnz     mov_mem_address16_ax
  502.         test    ch,44h
  503.         jnz     mov_mem_address32_ax
  504.         test    ch,88h
  505.         jnz     mov_mem_address64_ax
  506.         or      ch,ch
  507.         jnz     invalid_address_size
  508.         cmp     [code_type],64
  509.         je      mov_mem_address64_ax
  510.         cmp     [code_type],32
  511.         je      mov_mem_address32_ax
  512.         cmp     edx,10000h
  513.         jb      mov_mem_address16_ax
  514.       mov_mem_address32_ax:
  515.         call    store_segment_prefix_if_necessary
  516.         call    address_32bit_prefix
  517.         mov     [base_code],0A3h
  518.         jmp     store_mov_address32
  519.       mov_mem_address16_ax:
  520.         call    store_segment_prefix_if_necessary
  521.         call    address_16bit_prefix
  522.         mov     [base_code],0A3h
  523.         jmp     store_mov_address16
  524.       mov_mem_address64_ax:
  525.         call    store_segment_prefix_if_necessary
  526.         mov     [base_code],0A3h
  527.         jmp     store_mov_address64
  528.       mov_mem_sreg:
  529.         sub     al,61h
  530.         mov     [postbyte_register],al
  531.         pop     ecx ebx edx
  532.         mov     ah,[operand_size]
  533.         or      ah,ah
  534.         jz      mov_mem_sreg_store
  535.         cmp     ah,2
  536.         jne     invalid_operand_size
  537.       mov_mem_sreg_store:
  538.         mov     [base_code],8Ch
  539.         jmp     instruction_ready
  540.       mov_mem_imm:
  541.         mov     al,[operand_size]
  542.         cmp     al,1
  543.         jb      mov_mem_imm_nosize
  544.         je      mov_mem_imm_8bit
  545.         cmp     al,2
  546.         je      mov_mem_imm_16bit
  547.         cmp     al,4
  548.         je      mov_mem_imm_32bit
  549.         cmp     al,8
  550.         jne     invalid_operand_size
  551.       mov_mem_imm_64bit:
  552.         cmp     [size_declared],0
  553.         jne     long_immediate_not_encodable
  554.         call    operand_64bit
  555.         call    get_simm32
  556.         cmp     [value_type],4
  557.         jae     long_immediate_not_encodable
  558.         jmp     mov_mem_imm_32bit_store
  559.       mov_mem_imm_8bit:
  560.         call    get_byte_value
  561.         mov     byte [value],al
  562.         mov     [postbyte_register],0
  563.         mov     [base_code],0C6h
  564.         pop     ecx ebx edx
  565.         call    store_instruction_with_imm8
  566.         jmp     instruction_assembled
  567.       mov_mem_imm_16bit:
  568.         call    operand_16bit
  569.         call    get_word_value
  570.         mov     word [value],ax
  571.         mov     [postbyte_register],0
  572.         mov     [base_code],0C7h
  573.         pop     ecx ebx edx
  574.         call    store_instruction_with_imm16
  575.         jmp     instruction_assembled
  576.       mov_mem_imm_nosize:
  577.         call    recoverable_unknown_size
  578.       mov_mem_imm_32bit:
  579.         call    operand_32bit
  580.         call    get_dword_value
  581.       mov_mem_imm_32bit_store:
  582.         mov     dword [value],eax
  583.         mov     [postbyte_register],0
  584.         mov     [base_code],0C7h
  585.         pop     ecx ebx edx
  586.         call    store_instruction_with_imm32
  587.         jmp     instruction_assembled
  588.       mov_reg:
  589.         lods    byte [esi]
  590.         mov     ah,al
  591.         sub     ah,10h
  592.         and     ah,al
  593.         test    ah,0F0h
  594.         jnz     mov_sreg
  595.         call    convert_register
  596.         mov     [postbyte_register],al
  597.         lods    byte [esi]
  598.         cmp     al,','
  599.         jne     invalid_operand
  600.         lods    byte [esi]
  601.         call    get_size_operator
  602.         cmp     al,'['
  603.         je      mov_reg_mem
  604.         cmp     al,'('
  605.         je      mov_reg_imm
  606.         cmp     al,10h
  607.         jne     invalid_operand
  608.       mov_reg_reg:
  609.         lods    byte [esi]
  610.         mov     ah,al
  611.         sub     ah,10h
  612.         and     ah,al
  613.         test    ah,0F0h
  614.         jnz     mov_reg_sreg
  615.         call    convert_register
  616.         mov     bl,[postbyte_register]
  617.         mov     [postbyte_register],al
  618.         mov     al,ah
  619.         cmp     al,1
  620.         je      mov_reg_reg_8bit
  621.         call    operand_autodetect
  622.         inc     [base_code]
  623.       mov_reg_reg_8bit:
  624.         jmp     nomem_instruction_ready
  625.       mov_reg_sreg:
  626.         mov     bl,[postbyte_register]
  627.         mov     ah,al
  628.         and     al,1111b
  629.         mov     [postbyte_register],al
  630.         shr     ah,4
  631.         cmp     ah,5
  632.         je      mov_reg_creg
  633.         cmp     ah,7
  634.         je      mov_reg_dreg
  635.         ja      mov_reg_treg
  636.         dec     [postbyte_register]
  637.         cmp     [operand_size],8
  638.         je      mov_reg_sreg64
  639.         cmp     [operand_size],4
  640.         je      mov_reg_sreg32
  641.         cmp     [operand_size],2
  642.         jne     invalid_operand_size
  643.         call    operand_16bit
  644.         jmp     mov_reg_sreg_store
  645.       mov_reg_sreg64:
  646.         call    operand_64bit
  647.         jmp     mov_reg_sreg_store
  648.       mov_reg_sreg32:
  649.         call    operand_32bit
  650.       mov_reg_sreg_store:
  651.         mov     [base_code],8Ch
  652.         jmp     nomem_instruction_ready
  653.       mov_reg_treg:
  654.         cmp     ah,9
  655.         jne     invalid_operand
  656.         mov     [extended_code],24h
  657.         jmp     mov_reg_xrx
  658.       mov_reg_dreg:
  659.         mov     [extended_code],21h
  660.         jmp     mov_reg_xrx
  661.       mov_reg_creg:
  662.         mov     [extended_code],20h
  663.       mov_reg_xrx:
  664.         mov     [base_code],0Fh
  665.         cmp     [code_type],64
  666.         je      mov_reg_xrx_64bit
  667.         cmp     [operand_size],4
  668.         jne     invalid_operand_size
  669.         cmp     [postbyte_register],8
  670.         jne     mov_reg_xrx_store
  671.         cmp     [extended_code],20h
  672.         jne     mov_reg_xrx_store
  673.         mov     al,0F0h
  674.         stos    byte [edi]
  675.         mov     [postbyte_register],0
  676.       mov_reg_xrx_store:
  677.         jmp     nomem_instruction_ready
  678.       mov_reg_xrx_64bit:
  679.         cmp     [operand_size],8
  680.         jne     invalid_operand_size
  681.         jmp     nomem_instruction_ready
  682.       mov_reg_mem:
  683.         call    get_address
  684.         mov     al,[operand_size]
  685.         cmp     al,1
  686.         je      mov_reg_mem_8bit
  687.         call    operand_autodetect
  688.         mov     al,[postbyte_register]
  689.         or      al,bl
  690.         or      al,bh
  691.         jz      mov_ax_mem
  692.         add     [base_code],3
  693.         jmp     instruction_ready
  694.       mov_reg_mem_8bit:
  695.         mov     al,[postbyte_register]
  696.         or      al,bl
  697.         or      al,bh
  698.         jz      mov_al_mem
  699.         add     [base_code],2
  700.         jmp     instruction_ready
  701.       mov_al_mem:
  702.         test    ch,22h
  703.         jnz     mov_al_mem_address16
  704.         test    ch,44h
  705.         jnz     mov_al_mem_address32
  706.         test    ch,88h
  707.         jnz     mov_al_mem_address64
  708.         or      ch,ch
  709.         jnz     invalid_address_size
  710.         cmp     [code_type],64
  711.         je      mov_al_mem_address64
  712.         cmp     [code_type],32
  713.         je      mov_al_mem_address32
  714.         cmp     edx,10000h
  715.         jb      mov_al_mem_address16
  716.       mov_al_mem_address32:
  717.         call    store_segment_prefix_if_necessary
  718.         call    address_32bit_prefix
  719.         mov     [base_code],0A0h
  720.         jmp     store_mov_address32
  721.       mov_al_mem_address16:
  722.         call    store_segment_prefix_if_necessary
  723.         call    address_16bit_prefix
  724.         mov     [base_code],0A0h
  725.         jmp     store_mov_address16
  726.       mov_al_mem_address64:
  727.         call    store_segment_prefix_if_necessary
  728.         mov     [base_code],0A0h
  729.         jmp     store_mov_address64
  730.       mov_ax_mem:
  731.         test    ch,22h
  732.         jnz     mov_ax_mem_address16
  733.         test    ch,44h
  734.         jnz     mov_ax_mem_address32
  735.         test    ch,88h
  736.         jnz     mov_ax_mem_address64
  737.         or      ch,ch
  738.         jnz     invalid_address_size
  739.         cmp     [code_type],64
  740.         je      mov_ax_mem_address64
  741.         cmp     [code_type],32
  742.         je      mov_ax_mem_address32
  743.         cmp     edx,10000h
  744.         jb      mov_ax_mem_address16
  745.       mov_ax_mem_address32:
  746.         call    store_segment_prefix_if_necessary
  747.         call    address_32bit_prefix
  748.         mov     [base_code],0A1h
  749.         jmp     store_mov_address32
  750.       mov_ax_mem_address16:
  751.         call    store_segment_prefix_if_necessary
  752.         call    address_16bit_prefix
  753.         mov     [base_code],0A1h
  754.         jmp     store_mov_address16
  755.       mov_ax_mem_address64:
  756.         call    store_segment_prefix_if_necessary
  757.         mov     [base_code],0A1h
  758.         jmp     store_mov_address64
  759.       mov_reg_imm:
  760.         mov     al,[operand_size]
  761.         cmp     al,1
  762.         je      mov_reg_imm_8bit
  763.         cmp     al,2
  764.         je      mov_reg_imm_16bit
  765.         cmp     al,4
  766.         je      mov_reg_imm_32bit
  767.         cmp     al,8
  768.         jne     invalid_operand_size
  769.       mov_reg_imm_64bit:
  770.         call    operand_64bit
  771.         call    get_qword_value
  772.         mov     ecx,edx
  773.         cmp     [size_declared],0
  774.         jne     mov_reg_imm_64bit_store
  775.         cmp     [value_type],4
  776.         jae     mov_reg_imm_64bit_store
  777.         cdq
  778.         cmp     ecx,edx
  779.         je      mov_reg_64bit_imm_32bit
  780.       mov_reg_imm_64bit_store:
  781.         push    eax ecx
  782.         mov     al,0B8h
  783.         call    store_mov_reg_imm_code
  784.         pop     edx eax
  785.         call    mark_relocation
  786.         stos    dword [edi]
  787.         mov     eax,edx
  788.         stos    dword [edi]
  789.         jmp     instruction_assembled
  790.       mov_reg_imm_8bit:
  791.         call    get_byte_value
  792.         mov     dl,al
  793.         mov     al,0B0h
  794.         call    store_mov_reg_imm_code
  795.         mov     al,dl
  796.         stos    byte [edi]
  797.         jmp     instruction_assembled
  798.       mov_reg_imm_16bit:
  799.         call    get_word_value
  800.         mov     dx,ax
  801.         call    operand_16bit
  802.         mov     al,0B8h
  803.         call    store_mov_reg_imm_code
  804.         mov     ax,dx
  805.         call    mark_relocation
  806.         stos    word [edi]
  807.         jmp     instruction_assembled
  808.       mov_reg_imm_32bit:
  809.         call    operand_32bit
  810.         call    get_dword_value
  811.         mov     edx,eax
  812.         mov     al,0B8h
  813.         call    store_mov_reg_imm_code
  814.       mov_store_imm_32bit:
  815.         mov     eax,edx
  816.         call    mark_relocation
  817.         stos    dword [edi]
  818.         jmp     instruction_assembled
  819.       store_mov_reg_imm_code:
  820.         mov     ah,[postbyte_register]
  821.         test    ah,1000b
  822.         jz      mov_reg_imm_prefix_ok
  823.         or      [rex_prefix],41h
  824.       mov_reg_imm_prefix_ok:
  825.         and     ah,111b
  826.         add     al,ah
  827.         mov     [base_code],al
  828.         call    store_instruction_code
  829.         ret
  830.       mov_reg_64bit_imm_32bit:
  831.         mov     edx,eax
  832.         mov     bl,[postbyte_register]
  833.         mov     [postbyte_register],0
  834.         mov     [base_code],0C7h
  835.         call    store_nomem_instruction
  836.         jmp     mov_store_imm_32bit
  837.       mov_sreg:
  838.         mov     ah,al
  839.         and     al,1111b
  840.         mov     [postbyte_register],al
  841.         shr     ah,4
  842.         cmp     ah,5
  843.         je      mov_creg
  844.         cmp     ah,7
  845.         je      mov_dreg
  846.         ja      mov_treg
  847.         cmp     al,2
  848.         je      illegal_instruction
  849.         dec     [postbyte_register]
  850.         lods    byte [esi]
  851.         cmp     al,','
  852.         jne     invalid_operand
  853.         lods    byte [esi]
  854.         call    get_size_operator
  855.         cmp     al,'['
  856.         je      mov_sreg_mem
  857.         cmp     al,10h
  858.         jne     invalid_operand
  859.       mov_sreg_reg:
  860.         lods    byte [esi]
  861.         call    convert_register
  862.         or      ah,ah
  863.         jz      mov_sreg_reg_size_ok
  864.         cmp     ah,2
  865.         jne     invalid_operand_size
  866.         mov     bl,al
  867.       mov_sreg_reg_size_ok:
  868.         mov     [base_code],8Eh
  869.         jmp     nomem_instruction_ready
  870.       mov_sreg_mem:
  871.         call    get_address
  872.         mov     al,[operand_size]
  873.         or      al,al
  874.         jz      mov_sreg_mem_size_ok
  875.         cmp     al,2
  876.         jne     invalid_operand_size
  877.       mov_sreg_mem_size_ok:
  878.         mov     [base_code],8Eh
  879.         jmp     instruction_ready
  880.       mov_treg:
  881.         cmp     ah,9
  882.         jne     invalid_operand
  883.         mov     [extended_code],26h
  884.         jmp     mov_xrx
  885.       mov_dreg:
  886.         mov     [extended_code],23h
  887.         jmp     mov_xrx
  888.       mov_creg:
  889.         mov     [extended_code],22h
  890.       mov_xrx:
  891.         mov     [base_code],0Fh
  892.         lods    byte [esi]
  893.         cmp     al,','
  894.         jne     invalid_operand
  895.         lods    byte [esi]
  896.         cmp     al,10h
  897.         jne     invalid_operand
  898.         lods    byte [esi]
  899.         call    convert_register
  900.         mov     bl,al
  901.         cmp     [code_type],64
  902.         je      mov_xrx_64bit
  903.         cmp     ah,4
  904.         jne     invalid_operand_size
  905.         cmp     [postbyte_register],8
  906.         jne     mov_xrx_store
  907.         cmp     [extended_code],22h
  908.         jne     mov_xrx_store
  909.         mov     al,0F0h
  910.         stos    byte [edi]
  911.         mov     [postbyte_register],0
  912.       mov_xrx_store:
  913.         jmp     nomem_instruction_ready
  914.       mov_xrx_64bit:
  915.         cmp     ah,8
  916.         je      mov_xrx_store
  917.         jmp     invalid_operand_size
  918. test_instruction:
  919.         mov     [base_code],84h
  920.         lods    byte [esi]
  921.         call    get_size_operator
  922.         cmp     al,10h
  923.         je      test_reg
  924.         cmp     al,'['
  925.         jne     invalid_operand
  926.       test_mem:
  927.         call    get_address
  928.         push    edx ebx ecx
  929.         lods    byte [esi]
  930.         cmp     al,','
  931.         jne     invalid_operand
  932.         lods    byte [esi]
  933.         call    get_size_operator
  934.         cmp     al,'('
  935.         je      test_mem_imm
  936.         cmp     al,10h
  937.         jne     invalid_operand
  938.       test_mem_reg:
  939.         lods    byte [esi]
  940.         call    convert_register
  941.         mov     [postbyte_register],al
  942.         pop     ecx ebx edx
  943.         mov     al,ah
  944.         cmp     al,1
  945.         je      test_mem_reg_8bit
  946.         call    operand_autodetect
  947.         inc     [base_code]
  948.       test_mem_reg_8bit:
  949.         jmp     instruction_ready
  950.       test_mem_imm:
  951.         mov     al,[operand_size]
  952.         cmp     al,1
  953.         jb      test_mem_imm_nosize
  954.         je      test_mem_imm_8bit
  955.         cmp     al,2
  956.         je      test_mem_imm_16bit
  957.         cmp     al,4
  958.         je      test_mem_imm_32bit
  959.         cmp     al,8
  960.         jne     invalid_operand_size
  961.       test_mem_imm_64bit:
  962.         cmp     [size_declared],0
  963.         jne     long_immediate_not_encodable
  964.         call    operand_64bit
  965.         call    get_simm32
  966.         cmp     [value_type],4
  967.         jae     long_immediate_not_encodable
  968.         jmp     test_mem_imm_32bit_store
  969.       test_mem_imm_8bit:
  970.         call    get_byte_value
  971.         mov     byte [value],al
  972.         mov     [postbyte_register],0
  973.         mov     [base_code],0F6h
  974.         pop     ecx ebx edx
  975.         call    store_instruction_with_imm8
  976.         jmp     instruction_assembled
  977.       test_mem_imm_16bit:
  978.         call    operand_16bit
  979.         call    get_word_value
  980.         mov     word [value],ax
  981.         mov     [postbyte_register],0
  982.         mov     [base_code],0F7h
  983.         pop     ecx ebx edx
  984.         call    store_instruction_with_imm16
  985.         jmp     instruction_assembled
  986.       test_mem_imm_nosize:
  987.         call    recoverable_unknown_size
  988.       test_mem_imm_32bit:
  989.         call    operand_32bit
  990.         call    get_dword_value
  991.       test_mem_imm_32bit_store:
  992.         mov     dword [value],eax
  993.         mov     [postbyte_register],0
  994.         mov     [base_code],0F7h
  995.         pop     ecx ebx edx
  996.         call    store_instruction_with_imm32
  997.         jmp     instruction_assembled
  998.       test_reg:
  999.         lods    byte [esi]
  1000.         call    convert_register
  1001.         mov     [postbyte_register],al
  1002.         lods    byte [esi]
  1003.         cmp     al,','
  1004.         jne     invalid_operand
  1005.         lods    byte [esi]
  1006.         call    get_size_operator
  1007.         cmp     al,'['
  1008.         je      test_reg_mem
  1009.         cmp     al,'('
  1010.         je      test_reg_imm
  1011.         cmp     al,10h
  1012.         jne     invalid_operand
  1013.       test_reg_reg:
  1014.         lods    byte [esi]
  1015.         call    convert_register
  1016.         mov     bl,[postbyte_register]
  1017.         mov     [postbyte_register],al
  1018.         mov     al,ah
  1019.         cmp     al,1
  1020.         je      test_reg_reg_8bit
  1021.         call    operand_autodetect
  1022.         inc     [base_code]
  1023.       test_reg_reg_8bit:
  1024.         jmp     nomem_instruction_ready
  1025.       test_reg_imm:
  1026.         mov     al,[operand_size]
  1027.         cmp     al,1
  1028.         je      test_reg_imm_8bit
  1029.         cmp     al,2
  1030.         je      test_reg_imm_16bit
  1031.         cmp     al,4
  1032.         je      test_reg_imm_32bit
  1033.         cmp     al,8
  1034.         jne     invalid_operand_size
  1035.       test_reg_imm_64bit:
  1036.         cmp     [size_declared],0
  1037.         jne     long_immediate_not_encodable
  1038.         call    operand_64bit
  1039.         call    get_simm32
  1040.         cmp     [value_type],4
  1041.         jae     long_immediate_not_encodable
  1042.         jmp     test_reg_imm_32bit_store
  1043.       test_reg_imm_8bit:
  1044.         call    get_byte_value
  1045.         mov     dl,al
  1046.         mov     bl,[postbyte_register]
  1047.         mov     [postbyte_register],0
  1048.         mov     [base_code],0F6h
  1049.         or      bl,bl
  1050.         jz      test_al_imm
  1051.         call    store_nomem_instruction
  1052.         mov     al,dl
  1053.         stos    byte [edi]
  1054.         jmp     instruction_assembled
  1055.       test_al_imm:
  1056.         mov     [base_code],0A8h
  1057.         call    store_instruction_code
  1058.         mov     al,dl
  1059.         stos    byte [edi]
  1060.         jmp     instruction_assembled
  1061.       test_reg_imm_16bit:
  1062.         call    operand_16bit
  1063.         call    get_word_value
  1064.         mov     dx,ax
  1065.         mov     bl,[postbyte_register]
  1066.         mov     [postbyte_register],0
  1067.         mov     [base_code],0F7h
  1068.         or      bl,bl
  1069.         jz      test_ax_imm
  1070.         call    store_nomem_instruction
  1071.         mov     ax,dx
  1072.         call    mark_relocation
  1073.         stos    word [edi]
  1074.         jmp     instruction_assembled
  1075.       test_ax_imm:
  1076.         mov     [base_code],0A9h
  1077.         call    store_instruction_code
  1078.         mov     ax,dx
  1079.         stos    word [edi]
  1080.         jmp     instruction_assembled
  1081.       test_reg_imm_32bit:
  1082.         call    operand_32bit
  1083.         call    get_dword_value
  1084.       test_reg_imm_32bit_store:
  1085.         mov     edx,eax
  1086.         mov     bl,[postbyte_register]
  1087.         mov     [postbyte_register],0
  1088.         mov     [base_code],0F7h
  1089.         or      bl,bl
  1090.         jz      test_eax_imm
  1091.         call    store_nomem_instruction
  1092.         mov     eax,edx
  1093.         call    mark_relocation
  1094.         stos    dword [edi]
  1095.         jmp     instruction_assembled
  1096.       test_eax_imm:
  1097.         mov     [base_code],0A9h
  1098.         call    store_instruction_code
  1099.         mov     eax,edx
  1100.         stos    dword [edi]
  1101.         jmp     instruction_assembled
  1102.       test_reg_mem:
  1103.         call    get_address
  1104.         mov     al,[operand_size]
  1105.         cmp     al,1
  1106.         je      test_reg_mem_8bit
  1107.         call    operand_autodetect
  1108.         inc     [base_code]
  1109.       test_reg_mem_8bit:
  1110.         jmp     instruction_ready
  1111. xchg_instruction:
  1112.         mov     [base_code],86h
  1113.         lods    byte [esi]
  1114.         call    get_size_operator
  1115.         cmp     al,10h
  1116.         je      xchg_reg
  1117.         cmp     al,'['
  1118.         jne     invalid_operand
  1119.       xchg_mem:
  1120.         call    get_address
  1121.         push    edx ebx ecx
  1122.         lods    byte [esi]
  1123.         cmp     al,','
  1124.         jne     invalid_operand
  1125.         lods    byte [esi]
  1126.         call    get_size_operator
  1127.         cmp     al,10h
  1128.         je      test_mem_reg
  1129.         jmp     invalid_operand
  1130.       xchg_reg:
  1131.         lods    byte [esi]
  1132.         call    convert_register
  1133.         mov     [postbyte_register],al
  1134.         lods    byte [esi]
  1135.         cmp     al,','
  1136.         jne     invalid_operand
  1137.         lods    byte [esi]
  1138.         call    get_size_operator
  1139.         cmp     al,'['
  1140.         je      test_reg_mem
  1141.         cmp     al,10h
  1142.         jne     invalid_operand
  1143.       xchg_reg_reg:
  1144.         lods    byte [esi]
  1145.         call    convert_register
  1146.         mov     bl,al
  1147.         mov     al,ah
  1148.         cmp     al,1
  1149.         je      xchg_reg_reg_8bit
  1150.         call    operand_autodetect
  1151.         cmp     [postbyte_register],0
  1152.         je      xchg_ax_reg
  1153.         or      bl,bl
  1154.         jnz     xchg_reg_reg_store
  1155.         mov     bl,[postbyte_register]
  1156.       xchg_ax_reg:
  1157.         cmp     [code_type],64
  1158.         jne     xchg_ax_reg_ok
  1159.         cmp     ah,4
  1160.         jne     xchg_ax_reg_ok
  1161.         or      bl,bl
  1162.         jz      xchg_reg_reg_store
  1163.       xchg_ax_reg_ok:
  1164.         test    bl,1000b
  1165.         jz      xchg_ax_reg_store
  1166.         or      [rex_prefix],41h
  1167.         and     bl,111b
  1168.       xchg_ax_reg_store:
  1169.         add     bl,90h
  1170.         mov     [base_code],bl
  1171.         call    store_instruction_code
  1172.         jmp     instruction_assembled
  1173.       xchg_reg_reg_store:
  1174.         inc     [base_code]
  1175.       xchg_reg_reg_8bit:
  1176.         jmp     nomem_instruction_ready
  1177. push_instruction:
  1178.         mov     [push_size],al
  1179.       push_next:
  1180.         lods    byte [esi]
  1181.         call    get_size_operator
  1182.         cmp     al,10h
  1183.         je      push_reg
  1184.         cmp     al,'('
  1185.         je      push_imm
  1186.         cmp     al,'['
  1187.         jne     invalid_operand
  1188.       push_mem:
  1189.         call    get_address
  1190.         mov     al,[operand_size]
  1191.         mov     ah,[push_size]
  1192.         cmp     al,2
  1193.         je      push_mem_16bit
  1194.         cmp     al,4
  1195.         je      push_mem_32bit
  1196.         cmp     al,8
  1197.         je      push_mem_64bit
  1198.         or      al,al
  1199.         jnz     invalid_operand_size
  1200.         cmp     ah,2
  1201.         je      push_mem_16bit
  1202.         cmp     ah,4
  1203.         je      push_mem_32bit
  1204.         cmp     ah,8
  1205.         je      push_mem_64bit
  1206.         call    recoverable_unknown_size
  1207.         jmp     push_mem_store
  1208.       push_mem_16bit:
  1209.         test    ah,not 2
  1210.         jnz     invalid_operand_size
  1211.         call    operand_16bit
  1212.         jmp     push_mem_store
  1213.       push_mem_32bit:
  1214.         test    ah,not 4
  1215.         jnz     invalid_operand_size
  1216.         cmp     [code_type],64
  1217.         je      illegal_instruction
  1218.         call    operand_32bit
  1219.         jmp     push_mem_store
  1220.       push_mem_64bit:
  1221.         test    ah,not 8
  1222.         jnz     invalid_operand_size
  1223.         cmp     [code_type],64
  1224.         jne     illegal_instruction
  1225.       push_mem_store:
  1226.         mov     [base_code],0FFh
  1227.         mov     [postbyte_register],110b
  1228.         call    store_instruction
  1229.         jmp     push_done
  1230.       push_reg:
  1231.         lods    byte [esi]
  1232.         mov     ah,al
  1233.         sub     ah,10h
  1234.         and     ah,al
  1235.         test    ah,0F0h
  1236.         jnz     push_sreg
  1237.         call    convert_register
  1238.         test    al,1000b
  1239.         jz      push_reg_ok
  1240.         or      [rex_prefix],41h
  1241.         and     al,111b
  1242.       push_reg_ok:
  1243.         add     al,50h
  1244.         mov     [base_code],al
  1245.         mov     al,ah
  1246.         mov     ah,[push_size]
  1247.         cmp     al,2
  1248.         je      push_reg_16bit
  1249.         cmp     al,4
  1250.         je      push_reg_32bit
  1251.         cmp     al,8
  1252.         jne     invalid_operand_size
  1253.       push_reg_64bit:
  1254.         test    ah,not 8
  1255.         jnz     invalid_operand_size
  1256.         cmp     [code_type],64
  1257.         jne     illegal_instruction
  1258.         jmp     push_reg_store
  1259.       push_reg_32bit:
  1260.         test    ah,not 4
  1261.         jnz     invalid_operand_size
  1262.         cmp     [code_type],64
  1263.         je      illegal_instruction
  1264.         call    operand_32bit
  1265.         jmp     push_reg_store
  1266.       push_reg_16bit:
  1267.         test    ah,not 2
  1268.         jnz     invalid_operand_size
  1269.         call    operand_16bit
  1270.       push_reg_store:
  1271.         call    store_instruction_code
  1272.         jmp     push_done
  1273.       push_sreg:
  1274.         mov     bl,al
  1275.         mov     dl,[operand_size]
  1276.         mov     dh,[push_size]
  1277.         cmp     dl,2
  1278.         je      push_sreg16
  1279.         cmp     dl,4
  1280.         je      push_sreg32
  1281.         cmp     dl,8
  1282.         je      push_sreg64
  1283.         or      dl,dl
  1284.         jnz     invalid_operand_size
  1285.         cmp     dh,2
  1286.         je      push_sreg16
  1287.         cmp     dh,4
  1288.         je      push_sreg32
  1289.         cmp     dh,8
  1290.         je      push_sreg64
  1291.         jmp     push_sreg_store
  1292.       push_sreg16:
  1293.         test    dh,not 2
  1294.         jnz     invalid_operand_size
  1295.         call    operand_16bit
  1296.         jmp     push_sreg_store
  1297.       push_sreg32:
  1298.         test    dh,not 4
  1299.         jnz     invalid_operand_size
  1300.         cmp     [code_type],64
  1301.         je      illegal_instruction
  1302.         call    operand_32bit
  1303.         jmp     push_sreg_store
  1304.       push_sreg64:
  1305.         test    dh,not 8
  1306.         jnz     invalid_operand_size
  1307.         cmp     [code_type],64
  1308.         jne     illegal_instruction
  1309.       push_sreg_store:
  1310.         mov     al,bl
  1311.         cmp     al,70h
  1312.         jae     invalid_operand
  1313.         sub     al,61h
  1314.         jc      invalid_operand
  1315.         cmp     al,4
  1316.         jae     push_sreg_386
  1317.         shl     al,3
  1318.         add     al,6
  1319.         mov     [base_code],al
  1320.         cmp     [code_type],64
  1321.         je      illegal_instruction
  1322.         jmp     push_reg_store
  1323.       push_sreg_386:
  1324.         sub     al,4
  1325.         shl     al,3
  1326.         add     al,0A0h
  1327.         mov     [extended_code],al
  1328.         mov     [base_code],0Fh
  1329.         jmp     push_reg_store
  1330.       push_imm:
  1331.         mov     al,[operand_size]
  1332.         mov     ah,[push_size]
  1333.         or      al,al
  1334.         je      push_imm_size_ok
  1335.         or      ah,ah
  1336.         je      push_imm_size_ok
  1337.         cmp     al,ah
  1338.         jne     invalid_operand_size
  1339.       push_imm_size_ok:
  1340.         cmp     al,2
  1341.         je      push_imm_16bit
  1342.         cmp     al,4
  1343.         je      push_imm_32bit
  1344.         cmp     al,8
  1345.         je      push_imm_64bit
  1346.         cmp     ah,2
  1347.         je      push_imm_optimized_16bit
  1348.         cmp     ah,4
  1349.         je      push_imm_optimized_32bit
  1350.         cmp     ah,8
  1351.         je      push_imm_optimized_64bit
  1352.         or      al,al
  1353.         jnz     invalid_operand_size
  1354.         cmp     [code_type],16
  1355.         je      push_imm_optimized_16bit
  1356.         cmp     [code_type],32
  1357.         je      push_imm_optimized_32bit
  1358.       push_imm_optimized_64bit:
  1359.         cmp     [code_type],64
  1360.         jne     illegal_instruction
  1361.         call    get_simm32
  1362.         mov     edx,eax
  1363.         cmp     [value_type],0
  1364.         jne     push_imm_32bit_store
  1365.         cmp     eax,-80h
  1366.         jl      push_imm_32bit_store
  1367.         cmp     eax,80h
  1368.         jge     push_imm_32bit_store
  1369.         jmp     push_imm_8bit
  1370.       push_imm_optimized_32bit:
  1371.         cmp     [code_type],64
  1372.         je      illegal_instruction
  1373.         call    get_dword_value
  1374.         mov     edx,eax
  1375.         call    operand_32bit
  1376.         cmp     [value_type],0
  1377.         jne     push_imm_32bit_store
  1378.         cmp     eax,-80h
  1379.         jl      push_imm_32bit_store
  1380.         cmp     eax,80h
  1381.         jge     push_imm_32bit_store
  1382.         jmp     push_imm_8bit
  1383.       push_imm_optimized_16bit:
  1384.         call    get_word_value
  1385.         mov     dx,ax
  1386.         call    operand_16bit
  1387.         cmp     [value_type],0
  1388.         jne     push_imm_16bit_store
  1389.         cmp     ax,-80h
  1390.         jl      push_imm_16bit_store
  1391.         cmp     ax,80h
  1392.         jge     push_imm_16bit_store
  1393.       push_imm_8bit:
  1394.         mov     ah,al
  1395.         mov     [base_code],6Ah
  1396.         call    store_instruction_code
  1397.         mov     al,ah
  1398.         stos    byte [edi]
  1399.         jmp     push_done
  1400.       push_imm_16bit:
  1401.         call    get_word_value
  1402.         mov     dx,ax
  1403.         call    operand_16bit
  1404.       push_imm_16bit_store:
  1405.         mov     [base_code],68h
  1406.         call    store_instruction_code
  1407.         mov     ax,dx
  1408.         call    mark_relocation
  1409.         stos    word [edi]
  1410.         jmp     push_done
  1411.       push_imm_64bit:
  1412.         cmp     [code_type],64
  1413.         jne     illegal_instruction
  1414.         call    get_simm32
  1415.         mov     edx,eax
  1416.         jmp     push_imm_32bit_store
  1417.       push_imm_32bit:
  1418.         cmp     [code_type],64
  1419.         je      illegal_instruction
  1420.         call    get_dword_value
  1421.         mov     edx,eax
  1422.         call    operand_32bit
  1423.       push_imm_32bit_store:
  1424.         mov     [base_code],68h
  1425.         call    store_instruction_code
  1426.         mov     eax,edx
  1427.         call    mark_relocation
  1428.         stos    dword [edi]
  1429.       push_done:
  1430.         lods    byte [esi]
  1431.         dec     esi
  1432.         cmp     al,0Fh
  1433.         je      instruction_assembled
  1434.         or      al,al
  1435.         jz      instruction_assembled
  1436.         mov     [operand_size],0
  1437.         mov     [size_override],0
  1438.         mov     [operand_prefix],0
  1439.         mov     [rex_prefix],0
  1440.         jmp     push_next
  1441. pop_instruction:
  1442.         mov     [push_size],al
  1443.       pop_next:
  1444.         lods    byte [esi]
  1445.         call    get_size_operator
  1446.         cmp     al,10h
  1447.         je      pop_reg
  1448.         cmp     al,'['
  1449.         jne     invalid_operand
  1450.       pop_mem:
  1451.         call    get_address
  1452.         mov     al,[operand_size]
  1453.         mov     ah,[push_size]
  1454.         cmp     al,2
  1455.         je      pop_mem_16bit
  1456.         cmp     al,4
  1457.         je      pop_mem_32bit
  1458.         cmp     al,8
  1459.         je      pop_mem_64bit
  1460.         or      al,al
  1461.         jnz     invalid_operand_size
  1462.         cmp     ah,2
  1463.         je      pop_mem_16bit
  1464.         cmp     ah,4
  1465.         je      pop_mem_32bit
  1466.         cmp     ah,8
  1467.         je      pop_mem_64bit
  1468.         call    recoverable_unknown_size
  1469.         jmp     pop_mem_store
  1470.       pop_mem_16bit:
  1471.         test    ah,not 2
  1472.         jnz     invalid_operand_size
  1473.         call    operand_16bit
  1474.         jmp     pop_mem_store
  1475.       pop_mem_32bit:
  1476.         test    ah,not 4
  1477.         jnz     invalid_operand_size
  1478.         cmp     [code_type],64
  1479.         je      illegal_instruction
  1480.         call    operand_32bit
  1481.         jmp     pop_mem_store
  1482.       pop_mem_64bit:
  1483.         test    ah,not 8
  1484.         jnz     invalid_operand_size
  1485.         cmp     [code_type],64
  1486.         jne     illegal_instruction
  1487.       pop_mem_store:
  1488.         mov     [base_code],08Fh
  1489.         mov     [postbyte_register],0
  1490.         call    store_instruction
  1491.         jmp     pop_done
  1492.       pop_reg:
  1493.         lods    byte [esi]
  1494.         mov     ah,al
  1495.         sub     ah,10h
  1496.         and     ah,al
  1497.         test    ah,0F0h
  1498.         jnz     pop_sreg
  1499.         call    convert_register
  1500.         test    al,1000b
  1501.         jz      pop_reg_ok
  1502.         or      [rex_prefix],41h
  1503.         and     al,111b
  1504.       pop_reg_ok:
  1505.         add     al,58h
  1506.         mov     [base_code],al
  1507.         mov     al,ah
  1508.         mov     ah,[push_size]
  1509.         cmp     al,2
  1510.         je      pop_reg_16bit
  1511.         cmp     al,4
  1512.         je      pop_reg_32bit
  1513.         cmp     al,8
  1514.         je      pop_reg_64bit
  1515.         jmp     invalid_operand_size
  1516.       pop_reg_64bit:
  1517.         test    ah,not 8
  1518.         jnz     invalid_operand_size
  1519.         cmp     [code_type],64
  1520.         jne     illegal_instruction
  1521.         jmp     pop_reg_store
  1522.       pop_reg_32bit:
  1523.         test    ah,not 4
  1524.         jnz     invalid_operand_size
  1525.         cmp     [code_type],64
  1526.         je      illegal_instruction
  1527.         call    operand_32bit
  1528.         jmp     pop_reg_store
  1529.       pop_reg_16bit:
  1530.         test    ah,not 2
  1531.         jnz     invalid_operand_size
  1532.         call    operand_16bit
  1533.       pop_reg_store:
  1534.         call    store_instruction_code
  1535.       pop_done:
  1536.         lods    byte [esi]
  1537.         dec     esi
  1538.         cmp     al,0Fh
  1539.         je      instruction_assembled
  1540.         or      al,al
  1541.         jz      instruction_assembled
  1542.         mov     [operand_size],0
  1543.         mov     [size_override],0
  1544.         mov     [operand_prefix],0
  1545.         mov     [rex_prefix],0
  1546.         jmp     pop_next
  1547.       pop_sreg:
  1548.         mov     dl,[operand_size]
  1549.         mov     dh,[push_size]
  1550.         cmp     al,62h
  1551.         je      pop_cs
  1552.         mov     bl,al
  1553.         cmp     dl,2
  1554.         je      pop_sreg16
  1555.         cmp     dl,4
  1556.         je      pop_sreg32
  1557.         cmp     dl,8
  1558.         je      pop_sreg64
  1559.         or      dl,dl
  1560.         jnz     invalid_operand_size
  1561.         cmp     dh,2
  1562.         je      pop_sreg16
  1563.         cmp     dh,4
  1564.         je      pop_sreg32
  1565.         cmp     dh,8
  1566.         je      pop_sreg64
  1567.         jmp     pop_sreg_store
  1568.       pop_sreg16:
  1569.         test    dh,not 2
  1570.         jnz     invalid_operand_size
  1571.         call    operand_16bit
  1572.         jmp     pop_sreg_store
  1573.       pop_sreg32:
  1574.         test    dh,not 4
  1575.         jnz     invalid_operand_size
  1576.         cmp     [code_type],64
  1577.         je      illegal_instruction
  1578.         call    operand_32bit
  1579.         jmp     pop_sreg_store
  1580.       pop_sreg64:
  1581.         test    dh,not 8
  1582.         jnz     invalid_operand_size
  1583.         cmp     [code_type],64
  1584.         jne     illegal_instruction
  1585.       pop_sreg_store:
  1586.         mov     al,bl
  1587.         cmp     al,70h
  1588.         jae     invalid_operand
  1589.         sub     al,61h
  1590.         jc      invalid_operand
  1591.         cmp     al,4
  1592.         jae     pop_sreg_386
  1593.         shl     al,3
  1594.         add     al,7
  1595.         mov     [base_code],al
  1596.         cmp     [code_type],64
  1597.         je      illegal_instruction
  1598.         jmp     pop_reg_store
  1599.       pop_cs:
  1600.         cmp     [code_type],16
  1601.         jne     illegal_instruction
  1602.         cmp     dl,2
  1603.         je      pop_cs_store
  1604.         or      dl,dl
  1605.         jnz     invalid_operand_size
  1606.         cmp     dh,2
  1607.         je      pop_cs_store
  1608.         or      dh,dh
  1609.         jnz     illegal_instruction
  1610.       pop_cs_store:
  1611.         test    dh,not 2
  1612.         jnz     invalid_operand_size
  1613.         mov     al,0Fh
  1614.         stos    byte [edi]
  1615.         jmp     pop_done
  1616.       pop_sreg_386:
  1617.         sub     al,4
  1618.         shl     al,3
  1619.         add     al,0A1h
  1620.         mov     [extended_code],al
  1621.         mov     [base_code],0Fh
  1622.         jmp     pop_reg_store
  1623. inc_instruction:
  1624.         mov     [base_code],al
  1625.         lods    byte [esi]
  1626.         call    get_size_operator
  1627.         cmp     al,10h
  1628.         je      inc_reg
  1629.         cmp     al,'['
  1630.         je      inc_mem
  1631.         jne     invalid_operand
  1632.       inc_mem:
  1633.         call    get_address
  1634.         mov     al,[operand_size]
  1635.         cmp     al,1
  1636.         je      inc_mem_8bit
  1637.         jb      inc_mem_nosize
  1638.         call    operand_autodetect
  1639.         mov     al,0FFh
  1640.         xchg    al,[base_code]
  1641.         mov     [postbyte_register],al
  1642.         jmp     instruction_ready
  1643.       inc_mem_nosize:
  1644.         call    recoverable_unknown_size
  1645.       inc_mem_8bit:
  1646.         mov     al,0FEh
  1647.         xchg    al,[base_code]
  1648.         mov     [postbyte_register],al
  1649.         jmp     instruction_ready
  1650.       inc_reg:
  1651.         lods    byte [esi]
  1652.         call    convert_register
  1653.         mov     bl,al
  1654.         mov     al,0FEh
  1655.         xchg    al,[base_code]
  1656.         mov     [postbyte_register],al
  1657.         mov     al,ah
  1658.         cmp     al,1
  1659.         je      inc_reg_8bit
  1660.         call    operand_autodetect
  1661.         cmp     [code_type],64
  1662.         je      inc_reg_long_form
  1663.         mov     al,[postbyte_register]
  1664.         shl     al,3
  1665.         add     al,bl
  1666.         add     al,40h
  1667.         mov     [base_code],al
  1668.         call    store_instruction_code
  1669.         jmp     instruction_assembled
  1670.       inc_reg_long_form:
  1671.         inc     [base_code]
  1672.       inc_reg_8bit:
  1673.         jmp     nomem_instruction_ready
  1674. set_instruction:
  1675.         mov     [base_code],0Fh
  1676.         mov     [extended_code],al
  1677.         lods    byte [esi]
  1678.         call    get_size_operator
  1679.         cmp     al,10h
  1680.         je      set_reg
  1681.         cmp     al,'['
  1682.         jne     invalid_operand
  1683.       set_mem:
  1684.         call    get_address
  1685.         cmp     [operand_size],1
  1686.         ja      invalid_operand_size
  1687.         mov     [postbyte_register],0
  1688.         jmp     instruction_ready
  1689.       set_reg:
  1690.         lods    byte [esi]
  1691.         call    convert_register
  1692.         cmp     ah,1
  1693.         jne     invalid_operand_size
  1694.         mov     bl,al
  1695.         mov     [postbyte_register],0
  1696.         jmp     nomem_instruction_ready
  1697. arpl_instruction:
  1698.         cmp     [code_type],64
  1699.         je      illegal_instruction
  1700.         mov     [base_code],63h
  1701.         lods    byte [esi]
  1702.         call    get_size_operator
  1703.         cmp     al,10h
  1704.         je      arpl_reg
  1705.         cmp     al,'['
  1706.         jne     invalid_operand
  1707.         call    get_address
  1708.         lods    byte [esi]
  1709.         cmp     al,','
  1710.         jne     invalid_operand
  1711.         lods    byte [esi]
  1712.         cmp     al,10h
  1713.         jne     invalid_operand
  1714.         lods    byte [esi]
  1715.         call    convert_register
  1716.         mov     [postbyte_register],al
  1717.         cmp     ah,2
  1718.         jne     invalid_operand_size
  1719.         jmp     instruction_ready
  1720.       arpl_reg:
  1721.         lods    byte [esi]
  1722.         call    convert_register
  1723.         cmp     ah,2
  1724.         jne     invalid_operand_size
  1725.         mov     bl,al
  1726.         lods    byte [esi]
  1727.         cmp     al,','
  1728.         jne     invalid_operand
  1729.         lods    byte [esi]
  1730.         cmp     al,10h
  1731.         jne     invalid_operand
  1732.         lods    byte [esi]
  1733.         call    convert_register
  1734.         mov     [postbyte_register],al
  1735.         jmp     nomem_instruction_ready
  1736. bound_instruction:
  1737.         cmp     [code_type],64
  1738.         je      illegal_instruction
  1739.         lods    byte [esi]
  1740.         call    get_size_operator
  1741.         cmp     al,10h
  1742.         jne     invalid_operand
  1743.         lods    byte [esi]
  1744.         call    convert_register
  1745.         mov     [postbyte_register],al
  1746.         lods    byte [esi]
  1747.         cmp     al,','
  1748.         jne     invalid_operand
  1749.         lods    byte [esi]
  1750.         call    get_size_operator
  1751.         cmp     al,'['
  1752.         jne     invalid_operand
  1753.         call    get_address
  1754.         mov     al,[operand_size]
  1755.         cmp     al,2
  1756.         je      bound_store
  1757.         cmp     al,4
  1758.         jne     invalid_operand_size
  1759.       bound_store:
  1760.         call    operand_autodetect
  1761.         mov     [base_code],62h
  1762.         jmp     instruction_ready
  1763. enter_instruction:
  1764.         lods    byte [esi]
  1765.         call    get_size_operator
  1766.         cmp     ah,2
  1767.         je      enter_imm16_size_ok
  1768.         or      ah,ah
  1769.         jnz     invalid_operand_size
  1770.       enter_imm16_size_ok:
  1771.         cmp     al,'('
  1772.         jne     invalid_operand
  1773.         call    get_word_value
  1774.         cmp     [next_pass_needed],0
  1775.         jne     enter_imm16_ok
  1776.         cmp     [value_type],0
  1777.         jne     invalid_use_of_symbol
  1778.         test    eax,eax
  1779.         js      value_out_of_range
  1780.       enter_imm16_ok:
  1781.         push    eax
  1782.         mov     [operand_size],0
  1783.         lods    byte [esi]
  1784.         cmp     al,','
  1785.         jne     invalid_operand
  1786.         lods    byte [esi]
  1787.         call    get_size_operator
  1788.         cmp     ah,1
  1789.         je      enter_imm8_size_ok
  1790.         or      ah,ah
  1791.         jnz     invalid_operand_size
  1792.       enter_imm8_size_ok:
  1793.         cmp     al,'('
  1794.         jne     invalid_operand
  1795.         call    get_byte_value
  1796.         cmp     [next_pass_needed],0
  1797.         jne     enter_imm8_ok
  1798.         test    eax,eax
  1799.         js      value_out_of_range
  1800.       enter_imm8_ok:
  1801.         mov     dl,al
  1802.         pop     ebx
  1803.         mov     al,0C8h
  1804.         stos    byte [edi]
  1805.         mov     ax,bx
  1806.         stos    word [edi]
  1807.         mov     al,dl
  1808.         stos    byte [edi]
  1809.         jmp     instruction_assembled
  1810. ret_instruction_only64:
  1811.         cmp     [code_type],64
  1812.         jne     illegal_instruction
  1813.         jmp     ret_instruction
  1814. ret_instruction_32bit_except64:
  1815.         cmp     [code_type],64
  1816.         je      illegal_instruction
  1817. ret_instruction_32bit:
  1818.         call    operand_32bit
  1819.         jmp     ret_instruction
  1820. ret_instruction_16bit:
  1821.         call    operand_16bit
  1822.         jmp     ret_instruction
  1823. retf_instruction:
  1824.         cmp     [code_type],64
  1825.         jne     ret_instruction
  1826. ret_instruction_64bit:
  1827.         call    operand_64bit
  1828. ret_instruction:
  1829.         mov     [base_code],al
  1830.         lods    byte [esi]
  1831.         dec     esi
  1832.         or      al,al
  1833.         jz      simple_ret
  1834.         cmp     al,0Fh
  1835.         je      simple_ret
  1836.         lods    byte [esi]
  1837.         call    get_size_operator
  1838.         or      ah,ah
  1839.         jz      ret_imm
  1840.         cmp     ah,2
  1841.         je      ret_imm
  1842.         jmp     invalid_operand_size
  1843.       ret_imm:
  1844.         cmp     al,'('
  1845.         jne     invalid_operand
  1846.         call    get_word_value
  1847.         cmp     [next_pass_needed],0
  1848.         jne     ret_imm_ok
  1849.         cmp     [value_type],0
  1850.         jne     invalid_use_of_symbol
  1851.         test    eax,eax
  1852.         js      value_out_of_range
  1853.       ret_imm_ok:
  1854.         cmp     [size_declared],0
  1855.         jne     ret_imm_store
  1856.         or      ax,ax
  1857.         jz      simple_ret
  1858.       ret_imm_store:
  1859.         mov     dx,ax
  1860.         call    store_instruction_code
  1861.         mov     ax,dx
  1862.         stos    word [edi]
  1863.         jmp     instruction_assembled
  1864.       simple_ret:
  1865.         inc     [base_code]
  1866.         call    store_instruction_code
  1867.         jmp     instruction_assembled
  1868. lea_instruction:
  1869.         mov     [base_code],8Dh
  1870.         lods    byte [esi]
  1871.         call    get_size_operator
  1872.         cmp     al,10h
  1873.         jne     invalid_operand
  1874.         lods    byte [esi]
  1875.         call    convert_register
  1876.         mov     [postbyte_register],al
  1877.         lods    byte [esi]
  1878.         cmp     al,','
  1879.         jne     invalid_operand
  1880.         xor     al,al
  1881.         xchg    al,[operand_size]
  1882.         push    eax
  1883.         lods    byte [esi]
  1884.         call    get_size_operator
  1885.         cmp     al,'['
  1886.         jne     invalid_operand
  1887.         mov     [size_override],-1
  1888.         call    get_address
  1889.         pop     eax
  1890.         mov     [operand_size],al
  1891.         call    operand_autodetect
  1892.         jmp     instruction_ready
  1893. ls_instruction:
  1894.         or      al,al
  1895.         jz      les_instruction
  1896.         cmp     al,3
  1897.         jz      lds_instruction
  1898.         add     al,0B0h
  1899.         mov     [extended_code],al
  1900.         mov     [base_code],0Fh
  1901.         jmp     ls_code_ok
  1902.       les_instruction:
  1903.         mov     [base_code],0C4h
  1904.         jmp     ls_short_code
  1905.       lds_instruction:
  1906.         mov     [base_code],0C5h
  1907.       ls_short_code:
  1908.         cmp     [code_type],64
  1909.         je      illegal_instruction
  1910.       ls_code_ok:
  1911.         lods    byte [esi]
  1912.         call    get_size_operator
  1913.         cmp     al,10h
  1914.         jne     invalid_operand
  1915.         lods    byte [esi]
  1916.         call    convert_register
  1917.         mov     [postbyte_register],al
  1918.         lods    byte [esi]
  1919.         cmp     al,','
  1920.         jne     invalid_operand
  1921.         add     [operand_size],2
  1922.         lods    byte [esi]
  1923.         call    get_size_operator
  1924.         cmp     al,'['
  1925.         jne     invalid_operand
  1926.         call    get_address
  1927.         mov     al,[operand_size]
  1928.         cmp     al,4
  1929.         je      ls_16bit
  1930.         cmp     al,6
  1931.         je      ls_32bit
  1932.         cmp     al,10
  1933.         je      ls_64bit
  1934.         jmp     invalid_operand_size
  1935.       ls_16bit:
  1936.         call    operand_16bit
  1937.         jmp     instruction_ready
  1938.       ls_32bit:
  1939.         call    operand_32bit
  1940.         jmp     instruction_ready
  1941.       ls_64bit:
  1942.         call    operand_64bit
  1943.         jmp     instruction_ready
  1944. sh_instruction:
  1945.         mov     [postbyte_register],al
  1946.         lods    byte [esi]
  1947.         call    get_size_operator
  1948.         cmp     al,10h
  1949.         je      sh_reg
  1950.         cmp     al,'['
  1951.         jne     invalid_operand
  1952.       sh_mem:
  1953.         call    get_address
  1954.         push    edx ebx ecx
  1955.         mov     al,[operand_size]
  1956.         push    eax
  1957.         mov     [operand_size],0
  1958.         lods    byte [esi]
  1959.         cmp     al,','
  1960.         jne     invalid_operand
  1961.         lods    byte [esi]
  1962.         call    get_size_operator
  1963.         cmp     al,'('
  1964.         je      sh_mem_imm
  1965.         cmp     al,10h
  1966.         jne     invalid_operand
  1967.       sh_mem_reg:
  1968.         lods    byte [esi]
  1969.         cmp     al,11h
  1970.         jne     invalid_operand
  1971.         pop     eax ecx ebx edx
  1972.         cmp     al,1
  1973.         je      sh_mem_cl_8bit
  1974.         jb      sh_mem_cl_nosize
  1975.         call    operand_autodetect
  1976.         mov     [base_code],0D3h
  1977.         jmp     instruction_ready
  1978.       sh_mem_cl_nosize:
  1979.         call    recoverable_unknown_size
  1980.       sh_mem_cl_8bit:
  1981.         mov     [base_code],0D2h
  1982.         jmp     instruction_ready
  1983.       sh_mem_imm:
  1984.         mov     al,[operand_size]
  1985.         or      al,al
  1986.         jz      sh_mem_imm_size_ok
  1987.         cmp     al,1
  1988.         jne     invalid_operand_size
  1989.       sh_mem_imm_size_ok:
  1990.         call    get_byte_value
  1991.         mov     byte [value],al
  1992.         pop     eax ecx ebx edx
  1993.         cmp     al,1
  1994.         je      sh_mem_imm_8bit
  1995.         jb      sh_mem_imm_nosize
  1996.         call    operand_autodetect
  1997.         cmp     byte [value],1
  1998.         je      sh_mem_1
  1999.         mov     [base_code],0C1h
  2000.         call    store_instruction_with_imm8
  2001.         jmp     instruction_assembled
  2002.       sh_mem_1:
  2003.         mov     [base_code],0D1h
  2004.         jmp     instruction_ready
  2005.       sh_mem_imm_nosize:
  2006.         call    recoverable_unknown_size
  2007.       sh_mem_imm_8bit:
  2008.         cmp     byte [value],1
  2009.         je      sh_mem_1_8bit
  2010.         mov     [base_code],0C0h
  2011.         call    store_instruction_with_imm8
  2012.         jmp     instruction_assembled
  2013.       sh_mem_1_8bit:
  2014.         mov     [base_code],0D0h
  2015.         jmp     instruction_ready
  2016.       sh_reg:
  2017.         lods    byte [esi]
  2018.         call    convert_register
  2019.         mov     bx,ax
  2020.         mov     [operand_size],0
  2021.         lods    byte [esi]
  2022.         cmp     al,','
  2023.         jne     invalid_operand
  2024.         lods    byte [esi]
  2025.         call    get_size_operator
  2026.         cmp     al,'('
  2027.         je      sh_reg_imm
  2028.         cmp     al,10h
  2029.         jne     invalid_operand
  2030.       sh_reg_reg:
  2031.         lods    byte [esi]
  2032.         cmp     al,11h
  2033.         jne     invalid_operand
  2034.         mov     al,bh
  2035.         cmp     al,1
  2036.         je      sh_reg_cl_8bit
  2037.         call    operand_autodetect
  2038.         mov     [base_code],0D3h
  2039.         jmp     nomem_instruction_ready
  2040.       sh_reg_cl_8bit:
  2041.         mov     [base_code],0D2h
  2042.         jmp     nomem_instruction_ready
  2043.       sh_reg_imm:
  2044.         mov     al,[operand_size]
  2045.         or      al,al
  2046.         jz      sh_reg_imm_size_ok
  2047.         cmp     al,1
  2048.         jne     invalid_operand_size
  2049.       sh_reg_imm_size_ok:
  2050.         push    ebx
  2051.         call    get_byte_value
  2052.         mov     dl,al
  2053.         pop     ebx
  2054.         mov     al,bh
  2055.         cmp     al,1
  2056.         je      sh_reg_imm_8bit
  2057.         call    operand_autodetect
  2058.         cmp     dl,1
  2059.         je      sh_reg_1
  2060.         mov     [base_code],0C1h
  2061.         call    store_nomem_instruction
  2062.         mov     al,dl
  2063.         stos    byte [edi]
  2064.         jmp     instruction_assembled
  2065.       sh_reg_1:
  2066.         mov     [base_code],0D1h
  2067.         jmp     nomem_instruction_ready
  2068.       sh_reg_imm_8bit:
  2069.         cmp     dl,1
  2070.         je      sh_reg_1_8bit
  2071.         mov     [base_code],0C0h
  2072.         call    store_nomem_instruction
  2073.         mov     al,dl
  2074.         stos    byte [edi]
  2075.         jmp     instruction_assembled
  2076.       sh_reg_1_8bit:
  2077.         mov     [base_code],0D0h
  2078.         jmp     nomem_instruction_ready
  2079. shd_instruction:
  2080.         mov     [base_code],0Fh
  2081.         mov     [extended_code],al
  2082.         lods    byte [esi]
  2083.         call    get_size_operator
  2084.         cmp     al,10h
  2085.         je      shd_reg
  2086.         cmp     al,'['
  2087.         jne     invalid_operand
  2088.       shd_mem:
  2089.         call    get_address
  2090.         push    edx ebx ecx
  2091.         lods    byte [esi]
  2092.         cmp     al,','
  2093.         jne     invalid_operand
  2094.         lods    byte [esi]
  2095.         call    get_size_operator
  2096.         cmp     al,10h
  2097.         jne     invalid_operand
  2098.         lods    byte [esi]
  2099.         call    convert_register
  2100.         mov     [postbyte_register],al
  2101.         lods    byte [esi]
  2102.         cmp     al,','
  2103.         jne     invalid_operand
  2104.         mov     al,ah
  2105.         mov     [operand_size],0
  2106.         push    eax
  2107.         lods    byte [esi]
  2108.         call    get_size_operator
  2109.         cmp     al,'('
  2110.         je      shd_mem_reg_imm
  2111.         cmp     al,10h
  2112.         jne     invalid_operand
  2113.         lods    byte [esi]
  2114.         cmp     al,11h
  2115.         jne     invalid_operand
  2116.         pop     eax ecx ebx edx
  2117.         call    operand_autodetect
  2118.         inc     [extended_code]
  2119.         jmp     instruction_ready
  2120.       shd_mem_reg_imm:
  2121.         mov     al,[operand_size]
  2122.         or      al,al
  2123.         jz      shd_mem_reg_imm_size_ok
  2124.         cmp     al,1
  2125.         jne     invalid_operand_size
  2126.       shd_mem_reg_imm_size_ok:
  2127.         call    get_byte_value
  2128.         mov     byte [value],al
  2129.         pop     eax ecx ebx edx
  2130.         call    operand_autodetect
  2131.         call    store_instruction_with_imm8
  2132.         jmp     instruction_assembled
  2133.       shd_reg:
  2134.         lods    byte [esi]
  2135.         call    convert_register
  2136.         mov     [postbyte_register],al
  2137.         lods    byte [esi]
  2138.         cmp     al,','
  2139.         jne     invalid_operand
  2140.         lods    byte [esi]
  2141.         call    get_size_operator
  2142.         cmp     al,10h
  2143.         jne     invalid_operand
  2144.         lods    byte [esi]
  2145.         call    convert_register
  2146.         mov     bl,[postbyte_register]
  2147.         mov     [postbyte_register],al
  2148.         mov     al,ah
  2149.         push    eax ebx
  2150.         lods    byte [esi]
  2151.         cmp     al,','
  2152.         jne     invalid_operand
  2153.         mov     [operand_size],0
  2154.         lods    byte [esi]
  2155.         call    get_size_operator
  2156.         cmp     al,'('
  2157.         je      shd_reg_reg_imm
  2158.         cmp     al,10h
  2159.         jne     invalid_operand
  2160.         lods    byte [esi]
  2161.         cmp     al,11h
  2162.         jne     invalid_operand
  2163.         pop     ebx eax
  2164.         call    operand_autodetect
  2165.         inc     [extended_code]
  2166.         jmp     nomem_instruction_ready
  2167.       shd_reg_reg_imm:
  2168.         mov     al,[operand_size]
  2169.         or      al,al
  2170.         jz      shd_reg_reg_imm_size_ok
  2171.         cmp     al,1
  2172.         jne     invalid_operand_size
  2173.       shd_reg_reg_imm_size_ok:
  2174.         call    get_byte_value
  2175.         mov     dl,al
  2176.         pop     ebx eax
  2177.         call    operand_autodetect
  2178.         call    store_nomem_instruction
  2179.         mov     al,dl
  2180.         stos    byte [edi]
  2181.         jmp     instruction_assembled
  2182. movx_instruction:
  2183.         mov     [base_code],0Fh
  2184.         mov     [extended_code],al
  2185.         lods    byte [esi]
  2186.         call    get_size_operator
  2187.         cmp     al,10h
  2188.         jne     invalid_operand
  2189.         lods    byte [esi]
  2190.         call    convert_register
  2191.         mov     [postbyte_register],al
  2192.         mov     al,ah
  2193.         push    eax
  2194.         lods    byte [esi]
  2195.         cmp     al,','
  2196.         jne     invalid_operand
  2197.         mov     [operand_size],0
  2198.         lods    byte [esi]
  2199.         call    get_size_operator
  2200.         cmp     al,10h
  2201.         je      movx_reg
  2202.         cmp     al,'['
  2203.         jne     invalid_operand
  2204.         call    get_address
  2205.         pop     eax
  2206.         mov     ah,[operand_size]
  2207.         or      ah,ah
  2208.         jz      movx_unknown_size
  2209.         cmp     ah,al
  2210.         jae     invalid_operand_size
  2211.         cmp     ah,1
  2212.         je      movx_mem_store
  2213.         cmp     ah,2
  2214.         jne     invalid_operand_size
  2215.         inc     [extended_code]
  2216.       movx_mem_store:
  2217.         call    operand_autodetect
  2218.         jmp     instruction_ready
  2219.       movx_unknown_size:
  2220.         call    recoverable_unknown_size
  2221.         jmp     movx_mem_store
  2222.       movx_reg:
  2223.         lods    byte [esi]
  2224.         call    convert_register
  2225.         pop     ebx
  2226.         xchg    bl,al
  2227.         cmp     ah,al
  2228.         jae     invalid_operand_size
  2229.         cmp     ah,1
  2230.         je      movx_reg_8bit
  2231.         cmp     ah,2
  2232.         je      movx_reg_16bit
  2233.         jmp     invalid_operand_size
  2234.       movx_reg_8bit:
  2235.         call    operand_autodetect
  2236.         jmp     nomem_instruction_ready
  2237.       movx_reg_16bit:
  2238.         call    operand_autodetect
  2239.         inc     [extended_code]
  2240.         jmp     nomem_instruction_ready
  2241. movsxd_instruction:
  2242.         mov     [base_code],al
  2243.         lods    byte [esi]
  2244.         call    get_size_operator
  2245.         cmp     al,10h
  2246.         jne     invalid_operand
  2247.         lods    byte [esi]
  2248.         call    convert_register
  2249.         mov     [postbyte_register],al
  2250.         cmp     ah,8
  2251.         jne     invalid_operand_size
  2252.         lods    byte [esi]
  2253.         cmp     al,','
  2254.         jne     invalid_operand
  2255.         mov     [operand_size],0
  2256.         lods    byte [esi]
  2257.         call    get_size_operator
  2258.         cmp     al,10h
  2259.         je      movsxd_reg
  2260.         cmp     al,'['
  2261.         jne     invalid_operand
  2262.         call    get_address
  2263.         cmp     [operand_size],4
  2264.         je      movsxd_mem_store
  2265.         cmp     [operand_size],0
  2266.         jne     invalid_operand_size
  2267.       movsxd_mem_store:
  2268.         call    operand_64bit
  2269.         jmp     instruction_ready
  2270.       movsxd_reg:
  2271.         lods    byte [esi]
  2272.         call    convert_register
  2273.         cmp     ah,4
  2274.         jne     invalid_operand_size
  2275.         mov     bl,al
  2276.         call    operand_64bit
  2277.         jmp     nomem_instruction_ready
  2278. bt_instruction:
  2279.         mov     [postbyte_register],al
  2280.         shl     al,3
  2281.         add     al,83h
  2282.         mov     [extended_code],al
  2283.         mov     [base_code],0Fh
  2284.         lods    byte [esi]
  2285.         call    get_size_operator
  2286.         cmp     al,10h
  2287.         je      bt_reg
  2288.         cmp     al,'['
  2289.         jne     invalid_operand
  2290.         call    get_address
  2291.         push    eax ebx ecx
  2292.         lods    byte [esi]
  2293.         cmp     al,','
  2294.         jne     invalid_operand
  2295.         cmp     byte [esi],'('
  2296.         je      bt_mem_imm
  2297.         cmp     byte [esi],11h
  2298.         jne     bt_mem_reg
  2299.         cmp     byte [esi+2],'('
  2300.         je      bt_mem_imm
  2301.       bt_mem_reg:
  2302.         lods    byte [esi]
  2303.         call    get_size_operator
  2304.         cmp     al,10h
  2305.         jne     invalid_operand
  2306.         lods    byte [esi]
  2307.         call    convert_register
  2308.         mov     [postbyte_register],al
  2309.         pop     ecx ebx edx
  2310.         mov     al,ah
  2311.         call    operand_autodetect
  2312.         jmp     instruction_ready
  2313.       bt_mem_imm:
  2314.         xor     al,al
  2315.         xchg    al,[operand_size]
  2316.         push    eax
  2317.         lods    byte [esi]
  2318.         call    get_size_operator
  2319.         cmp     al,'('
  2320.         jne     invalid_operand
  2321.         mov     al,[operand_size]
  2322.         or      al,al
  2323.         jz      bt_mem_imm_size_ok
  2324.         cmp     al,1
  2325.         jne     invalid_operand_size
  2326.       bt_mem_imm_size_ok:
  2327.         call    get_byte_value
  2328.         mov     byte [value],al
  2329.         pop     eax
  2330.         or      al,al
  2331.         jz      bt_mem_imm_nosize
  2332.         call    operand_autodetect
  2333.       bt_mem_imm_store:
  2334.         pop     ecx ebx edx
  2335.         mov     [extended_code],0BAh
  2336.         call    store_instruction_with_imm8
  2337.         jmp     instruction_assembled
  2338.       bt_mem_imm_nosize:
  2339.         call    recoverable_unknown_size
  2340.         jmp     bt_mem_imm_store
  2341.       bt_reg:
  2342.         lods    byte [esi]
  2343.         call    convert_register
  2344.         mov     bl,al
  2345.         lods    byte [esi]
  2346.         cmp     al,','
  2347.         jne     invalid_operand
  2348.         cmp     byte [esi],'('
  2349.         je      bt_reg_imm
  2350.         cmp     byte [esi],11h
  2351.         jne     bt_reg_reg
  2352.         cmp     byte [esi+2],'('
  2353.         je      bt_reg_imm
  2354.       bt_reg_reg:
  2355.         lods    byte [esi]
  2356.         call    get_size_operator
  2357.         cmp     al,10h
  2358.         jne     invalid_operand
  2359.         lods    byte [esi]
  2360.         call    convert_register
  2361.         mov     [postbyte_register],al
  2362.         mov     al,ah
  2363.         call    operand_autodetect
  2364.         jmp     nomem_instruction_ready
  2365.       bt_reg_imm:
  2366.         xor     al,al
  2367.         xchg    al,[operand_size]
  2368.         push    eax ebx
  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_reg_imm_size_ok
  2376.         cmp     al,1
  2377.         jne     invalid_operand_size
  2378.       bt_reg_imm_size_ok:
  2379.         call    get_byte_value
  2380.         mov     byte [value],al
  2381.         pop     ebx eax
  2382.         call    operand_autodetect
  2383.       bt_reg_imm_store:
  2384.         mov     [extended_code],0BAh
  2385.         call    store_nomem_instruction
  2386.         mov     al,byte [value]
  2387.         stos    byte [edi]
  2388.         jmp     instruction_assembled
  2389. bs_instruction:
  2390.         mov     [extended_code],al
  2391.         mov     [base_code],0Fh
  2392.         call    get_reg_mem
  2393.         jc      bs_reg_reg
  2394.         mov     al,[operand_size]
  2395.         call    operand_autodetect
  2396.         jmp     instruction_ready
  2397.       bs_reg_reg:
  2398.         mov     al,ah
  2399.         call    operand_autodetect
  2400.         jmp     nomem_instruction_ready
  2401.       get_reg_mem:
  2402.         lods    byte [esi]
  2403.         call    get_size_operator
  2404.         cmp     al,10h
  2405.         jne     invalid_operand
  2406.         lods    byte [esi]
  2407.         call    convert_register
  2408.         mov     [postbyte_register],al
  2409.         lods    byte [esi]
  2410.         cmp     al,','
  2411.         jne     invalid_operand
  2412.         lods    byte [esi]
  2413.         call    get_size_operator
  2414.         cmp     al,10h
  2415.         je      get_reg_reg
  2416.         cmp     al,'['
  2417.         jne     invalid_argument
  2418.         call    get_address
  2419.         clc
  2420.         ret
  2421.       get_reg_reg:
  2422.         lods    byte [esi]
  2423.         call    convert_register
  2424.         mov     bl,al
  2425.         stc
  2426.         ret
  2427.  
  2428. imul_instruction:
  2429.         mov     [base_code],0F6h
  2430.         mov     [postbyte_register],5
  2431.         lods    byte [esi]
  2432.         call    get_size_operator
  2433.         cmp     al,10h
  2434.         je      imul_reg
  2435.         cmp     al,'['
  2436.         jne     invalid_operand
  2437.       imul_mem:
  2438.         call    get_address
  2439.         mov     al,[operand_size]
  2440.         cmp     al,1
  2441.         je      imul_mem_8bit
  2442.         jb      imul_mem_nosize
  2443.         call    operand_autodetect
  2444.         inc     [base_code]
  2445.         jmp     instruction_ready
  2446.       imul_mem_nosize:
  2447.         call    recoverable_unknown_size
  2448.       imul_mem_8bit:
  2449.         jmp     instruction_ready
  2450.       imul_reg:
  2451.         lods    byte [esi]
  2452.         call    convert_register
  2453.         cmp     byte [esi],','
  2454.         je      imul_reg_
  2455.         mov     bl,al
  2456.         mov     al,ah
  2457.         cmp     al,1
  2458.         je      imul_reg_8bit
  2459.         call    operand_autodetect
  2460.         inc     [base_code]
  2461.       imul_reg_8bit:
  2462.         jmp     nomem_instruction_ready
  2463.       imul_reg_:
  2464.         mov     [postbyte_register],al
  2465.         inc     esi
  2466.         cmp     byte [esi],'('
  2467.         je      imul_reg_imm
  2468.         cmp     byte [esi],11h
  2469.         jne     imul_reg_noimm
  2470.         cmp     byte [esi+2],'('
  2471.         je      imul_reg_imm
  2472.       imul_reg_noimm:
  2473.         lods    byte [esi]
  2474.         call    get_size_operator
  2475.         cmp     al,10h
  2476.         je      imul_reg_reg
  2477.         cmp     al,'['
  2478.         jne     invalid_operand
  2479.       imul_reg_mem:
  2480.         call    get_address
  2481.         push    edx ebx ecx
  2482.         cmp     byte [esi],','
  2483.         je      imul_reg_mem_imm
  2484.         mov     al,[operand_size]
  2485.         call    operand_autodetect
  2486.         pop     ecx ebx edx
  2487.         mov     [base_code],0Fh
  2488.         mov     [extended_code],0AFh
  2489.         jmp     instruction_ready
  2490.       imul_reg_mem_imm:
  2491.         inc     esi
  2492.         lods    byte [esi]
  2493.         call    get_size_operator
  2494.         cmp     al,'('
  2495.         jne     invalid_operand
  2496.         mov     al,[operand_size]
  2497.         cmp     al,2
  2498.         je      imul_reg_mem_imm_16bit
  2499.         cmp     al,4
  2500.         je      imul_reg_mem_imm_32bit
  2501.         cmp     al,8
  2502.         jne     invalid_operand_size
  2503.       imul_reg_mem_imm_64bit:
  2504.         cmp     [size_declared],0
  2505.         jne     long_immediate_not_encodable
  2506.         call    operand_64bit
  2507.         call    get_simm32
  2508.         cmp     [value_type],4
  2509.         jae     long_immediate_not_encodable
  2510.         jmp     imul_reg_mem_imm_32bit_ok
  2511.       imul_reg_mem_imm_16bit:
  2512.         call    operand_16bit
  2513.         call    get_word_value
  2514.         mov     word [value],ax
  2515.         cmp     [value_type],0
  2516.         jne     imul_reg_mem_imm_16bit_store
  2517.         cmp     [size_declared],0
  2518.         jne     imul_reg_mem_imm_16bit_store
  2519.         cmp     ax,-80h
  2520.         jl      imul_reg_mem_imm_16bit_store
  2521.         cmp     ax,80h
  2522.         jl      imul_reg_mem_imm_8bit_store
  2523.       imul_reg_mem_imm_16bit_store:
  2524.         pop     ecx ebx edx
  2525.         mov     [base_code],69h
  2526.         call    store_instruction_with_imm16
  2527.         jmp     instruction_assembled
  2528.       imul_reg_mem_imm_32bit:
  2529.         call    operand_32bit
  2530.         call    get_dword_value
  2531.       imul_reg_mem_imm_32bit_ok:
  2532.         mov     dword [value],eax
  2533.         cmp     [value_type],0
  2534.         jne     imul_reg_mem_imm_32bit_store
  2535.         cmp     [size_declared],0
  2536.         jne     imul_reg_mem_imm_32bit_store
  2537.         cmp     eax,-80h
  2538.         jl      imul_reg_mem_imm_32bit_store
  2539.         cmp     eax,80h
  2540.         jl      imul_reg_mem_imm_8bit_store
  2541.       imul_reg_mem_imm_32bit_store:
  2542.         pop     ecx ebx edx
  2543.         mov     [base_code],69h
  2544.         call    store_instruction_with_imm32
  2545.         jmp     instruction_assembled
  2546.       imul_reg_mem_imm_8bit_store:
  2547.         pop     ecx ebx edx
  2548.         mov     [base_code],6Bh
  2549.         call    store_instruction_with_imm8
  2550.         jmp     instruction_assembled
  2551.       imul_reg_imm:
  2552.         mov     bl,[postbyte_register]
  2553.         dec     esi
  2554.         jmp     imul_reg_reg_imm
  2555.       imul_reg_reg:
  2556.         lods    byte [esi]
  2557.         call    convert_register
  2558.         mov     bl,al
  2559.         cmp     byte [esi],','
  2560.         je      imul_reg_reg_imm
  2561.         mov     al,ah
  2562.         call    operand_autodetect
  2563.         mov     [base_code],0Fh
  2564.         mov     [extended_code],0AFh
  2565.         jmp     nomem_instruction_ready
  2566.       imul_reg_reg_imm:
  2567.         inc     esi
  2568.         lods    byte [esi]
  2569.         call    get_size_operator
  2570.         cmp     al,'('
  2571.         jne     invalid_operand
  2572.         mov     al,[operand_size]
  2573.         cmp     al,2
  2574.         je      imul_reg_reg_imm_16bit
  2575.         cmp     al,4
  2576.         je      imul_reg_reg_imm_32bit
  2577.         cmp     al,8
  2578.         jne     invalid_operand_size
  2579.       imul_reg_reg_imm_64bit:
  2580.         cmp     [size_declared],0
  2581.         jne     long_immediate_not_encodable
  2582.         call    operand_64bit
  2583.         push    ebx
  2584.         call    get_simm32
  2585.         cmp     [value_type],4
  2586.         jae     long_immediate_not_encodable
  2587.         jmp     imul_reg_reg_imm_32bit_ok
  2588.       imul_reg_reg_imm_16bit:
  2589.         call    operand_16bit
  2590.         push    ebx
  2591.         call    get_word_value
  2592.         pop     ebx
  2593.         mov     dx,ax
  2594.         cmp     [value_type],0
  2595.         jne     imul_reg_reg_imm_16bit_store
  2596.         cmp     [size_declared],0
  2597.         jne     imul_reg_reg_imm_16bit_store
  2598.         cmp     ax,-80h
  2599.         jl      imul_reg_reg_imm_16bit_store
  2600.         cmp     ax,80h
  2601.         jl      imul_reg_reg_imm_8bit_store
  2602.       imul_reg_reg_imm_16bit_store:
  2603.         mov     [base_code],69h
  2604.         call    store_nomem_instruction
  2605.         mov     ax,dx
  2606.         call    mark_relocation
  2607.         stos    word [edi]
  2608.         jmp     instruction_assembled
  2609.       imul_reg_reg_imm_32bit:
  2610.         call    operand_32bit
  2611.         push    ebx
  2612.         call    get_dword_value
  2613.       imul_reg_reg_imm_32bit_ok:
  2614.         pop     ebx
  2615.         mov     edx,eax
  2616.         cmp     [value_type],0
  2617.         jne     imul_reg_reg_imm_32bit_store
  2618.         cmp     [size_declared],0
  2619.         jne     imul_reg_reg_imm_32bit_store
  2620.         cmp     eax,-80h
  2621.         jl      imul_reg_reg_imm_32bit_store
  2622.         cmp     eax,80h
  2623.         jl      imul_reg_reg_imm_8bit_store
  2624.       imul_reg_reg_imm_32bit_store:
  2625.         mov     [base_code],69h
  2626.         call    store_nomem_instruction
  2627.         mov     eax,edx
  2628.         call    mark_relocation
  2629.         stos    dword [edi]
  2630.         jmp     instruction_assembled
  2631.       imul_reg_reg_imm_8bit_store:
  2632.         mov     [base_code],6Bh
  2633.         call    store_nomem_instruction
  2634.         mov     al,dl
  2635.         stos    byte [edi]
  2636.         jmp     instruction_assembled
  2637. in_instruction:
  2638.         lods    byte [esi]
  2639.         call    get_size_operator
  2640.         cmp     al,10h
  2641.         jne     invalid_operand
  2642.         lods    byte [esi]
  2643.         call    convert_register
  2644.         or      al,al
  2645.         jnz     invalid_operand
  2646.         lods    byte [esi]
  2647.         cmp     al,','
  2648.         jne     invalid_operand
  2649.         mov     al,ah
  2650.         push    eax
  2651.         mov     [operand_size],0
  2652.         lods    byte [esi]
  2653.         call    get_size_operator
  2654.         cmp     al,'('
  2655.         je      in_imm
  2656.         cmp     al,10h
  2657.         je      in_reg
  2658.         jmp     invalid_operand
  2659.       in_reg:
  2660.         lods    byte [esi]
  2661.         cmp     al,22h
  2662.         jne     invalid_operand
  2663.         pop     eax
  2664.         cmp     al,1
  2665.         je      in_al_dx
  2666.         cmp     al,2
  2667.         je      in_ax_dx
  2668.         cmp     al,4
  2669.         jne     invalid_operand_size
  2670.       in_ax_dx:
  2671.         call    operand_autodetect
  2672.         mov     [base_code],0EDh
  2673.         call    store_instruction_code
  2674.         jmp     instruction_assembled
  2675.       in_al_dx:
  2676.         mov     al,0ECh
  2677.         stos    byte [edi]
  2678.         jmp     instruction_assembled
  2679.       in_imm:
  2680.         mov     al,[operand_size]
  2681.         or      al,al
  2682.         jz      in_imm_size_ok
  2683.         cmp     al,1
  2684.         jne     invalid_operand_size
  2685.       in_imm_size_ok:
  2686.         call    get_byte_value
  2687.         mov     dl,al
  2688.         pop     eax
  2689.         cmp     al,1
  2690.         je      in_al_imm
  2691.         cmp     al,2
  2692.         je      in_ax_imm
  2693.         cmp     al,4
  2694.         jne     invalid_operand_size
  2695.       in_ax_imm:
  2696.         call    operand_autodetect
  2697.         mov     [base_code],0E5h
  2698.         call    store_instruction_code
  2699.         mov     al,dl
  2700.         stos    byte [edi]
  2701.         jmp     instruction_assembled
  2702.       in_al_imm:
  2703.         mov     al,0E4h
  2704.         stos    byte [edi]
  2705.         mov     al,dl
  2706.         stos    byte [edi]
  2707.         jmp     instruction_assembled
  2708. out_instruction:
  2709.         lods    byte [esi]
  2710.         call    get_size_operator
  2711.         cmp     al,'('
  2712.         je      out_imm
  2713.         cmp     al,10h
  2714.         jne     invalid_operand
  2715.         lods    byte [esi]
  2716.         cmp     al,22h
  2717.         jne     invalid_operand
  2718.         lods    byte [esi]
  2719.         cmp