Subversion Repositories Kolibri OS

Rev

Rev 4039 | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. ; flat assembler core
  3. ; Copyright (c) 1999-2016, Tomasz Grysztar.
  4. ; All rights reserved.
  5.  
  6. parser:
  7.         mov     eax,[memory_end]
  8.         mov     [labels_list],eax
  9.         mov     eax,[additional_memory]
  10.         mov     [free_additional_memory],eax
  11.         xor     eax,eax
  12.         mov     [current_locals_prefix],eax
  13.         mov     [anonymous_reverse],eax
  14.         mov     [anonymous_forward],eax
  15.         mov     [hash_tree],eax
  16.         mov     [blocks_stack],eax
  17.         mov     [parsed_lines],eax
  18.         mov     esi,[memory_start]
  19.         mov     edi,[source_start]
  20.       parser_loop:
  21.         mov     [current_line],esi
  22.         lea     eax,[edi+100h]
  23.         cmp     eax,[labels_list]
  24.         jae     out_of_memory
  25.         cmp     byte [esi+16],0
  26.         je      empty_line
  27.         cmp     byte [esi+16],3Bh
  28.         je      empty_line
  29.         mov     al,0Fh
  30.         stos    byte [edi]
  31.         mov     eax,esi
  32.         stos    dword [edi]
  33.         inc     [parsed_lines]
  34.         add     esi,16
  35.       parse_line:
  36.         mov     [formatter_symbols_allowed],0
  37.         mov     [decorator_symbols_allowed],0
  38.         cmp     byte [esi],1Ah
  39.         jne     empty_instruction
  40.         push    edi
  41.         add     esi,2
  42.         movzx   ecx,byte [esi-1]
  43.         cmp     byte [esi+ecx],':'
  44.         je      simple_label
  45.         cmp     byte [esi+ecx],'='
  46.         je      constant_label
  47.         call    get_instruction
  48.         jnc     main_instruction_identified
  49.         cmp     byte [esi+ecx],1Ah
  50.         jne     no_data_label
  51.         push    esi ecx
  52.         lea     esi,[esi+ecx+2]
  53.         movzx   ecx,byte [esi-1]
  54.         call    get_data_directive
  55.         jnc     data_label
  56.         pop     ecx esi
  57.       no_data_label:
  58.         call    get_data_directive
  59.         jnc     main_instruction_identified
  60.         pop     edi
  61.         sub     esi,2
  62.         xor     bx,bx
  63.         call    parse_line_contents
  64.         jmp     parse_next_line
  65.       simple_label:
  66.         pop     edi
  67.         call    identify_label
  68.         cmp     byte [esi+1],':'
  69.         je      block_label
  70.         mov     byte [edi],2
  71.         inc     edi
  72.         stos    dword [edi]
  73.         inc     esi
  74.         xor     al,al
  75.         stos    byte [edi]
  76.         jmp     parse_line
  77.       block_label:
  78.         mov     byte [edi],4
  79.         inc     edi
  80.         stos    dword [edi]
  81.         add     esi,2
  82.         jmp     parse_line
  83.       constant_label:
  84.         pop     edi
  85.         call    get_label_id
  86.         mov     byte [edi],3
  87.         inc     edi
  88.         stos    dword [edi]
  89.         xor     al,al
  90.         stos    byte [edi]
  91.         inc     esi
  92.         xor     bx,bx
  93.         call    parse_line_contents
  94.         jmp     parse_next_line
  95.       data_label:
  96.         pop     ecx edx
  97.         pop     edi
  98.         push    eax ebx esi
  99.         mov     esi,edx
  100.         movzx   ecx,byte [esi-1]
  101.         call    identify_label
  102.         mov     byte [edi],2
  103.         inc     edi
  104.         stos    dword [edi]
  105.         pop     esi ebx eax
  106.         stos    byte [edi]
  107.         push    edi
  108.       main_instruction_identified:
  109.         pop     edi
  110.         mov     dl,al
  111.         mov     al,1
  112.         stos    byte [edi]
  113.         mov     ax,bx
  114.         stos    word [edi]
  115.         mov     al,dl
  116.         stos    byte [edi]
  117.         cmp     bx,if_directive-instruction_handler
  118.         je      parse_block
  119.         cmp     bx,repeat_directive-instruction_handler
  120.         je      parse_block
  121.         cmp     bx,while_directive-instruction_handler
  122.         je      parse_block
  123.         cmp     bx,end_directive-instruction_handler
  124.         je      parse_end_directive
  125.         cmp     bx,else_directive-instruction_handler
  126.         je      parse_else
  127.         cmp     bx,assert_directive-instruction_handler
  128.         je      parse_assert
  129.       common_parse:
  130.         call    parse_line_contents
  131.         jmp     parse_next_line
  132.       empty_instruction:
  133.         lods    byte [esi]
  134.         or      al,al
  135.         jz      parse_next_line
  136.         cmp     al,':'
  137.         je      invalid_name
  138.         dec     esi
  139.         mov     [parenthesis_stack],0
  140.         call    parse_argument
  141.         jmp     parse_next_line
  142.       empty_line:
  143.         add     esi,16
  144.       skip_rest_of_line:
  145.         call    skip_foreign_line
  146.       parse_next_line:
  147.         cmp     esi,[source_start]
  148.         jb      parser_loop
  149.       source_parsed:
  150.         cmp     [blocks_stack],0
  151.         je      blocks_stack_ok
  152.         pop     eax
  153.         pop     [current_line]
  154.         jmp     missing_end_directive
  155.       blocks_stack_ok:
  156.         xor     al,al
  157.         stos    byte [edi]
  158.         add     edi,0Fh
  159.         and     edi,not 0Fh
  160.         mov     [code_start],edi
  161.         ret
  162.       parse_block:
  163.         mov     eax,esp
  164.         sub     eax,100h
  165.         jc      stack_overflow
  166.         cmp     eax,[stack_limit]
  167.         jb      stack_overflow
  168.         push    [current_line]
  169.         mov     ax,bx
  170.         shl     eax,16
  171.         push    eax
  172.         inc     [blocks_stack]
  173.         cmp     bx,if_directive-instruction_handler
  174.         je      parse_if
  175.         cmp     bx,while_directive-instruction_handler
  176.         je      parse_while
  177.         call    parse_line_contents
  178.         jmp     parse_next_line
  179.       parse_end_directive:
  180.         cmp     byte [esi],1Ah
  181.         jne     common_parse
  182.         push    edi
  183.         inc     esi
  184.         movzx   ecx,byte [esi]
  185.         inc     esi
  186.         call    get_instruction
  187.         pop     edi
  188.         jnc     parse_end_block
  189.         sub     esi,2
  190.         jmp     common_parse
  191.       parse_end_block:
  192.         mov     dl,al
  193.         mov     al,1
  194.         stos    byte [edi]
  195.         mov     ax,bx
  196.         stos    word [edi]
  197.         mov     al,dl
  198.         stos    byte [edi]
  199.         lods    byte [esi]
  200.         or      al,al
  201.         jnz     extra_characters_on_line
  202.         cmp     bx,if_directive-instruction_handler
  203.         je      close_parsing_block
  204.         cmp     bx,repeat_directive-instruction_handler
  205.         je      close_parsing_block
  206.         cmp     bx,while_directive-instruction_handler
  207.         je      close_parsing_block
  208.         jmp     parse_next_line
  209.       close_parsing_block:
  210.         cmp     [blocks_stack],0
  211.         je      unexpected_instruction
  212.         cmp     bx,[esp+2]
  213.         jne     unexpected_instruction
  214.         dec     [blocks_stack]
  215.         pop     eax edx
  216.         cmp     bx,if_directive-instruction_handler
  217.         jne     parse_next_line
  218.         test    al,1100b
  219.         jz      parse_next_line
  220.         test    al,10000b
  221.         jnz     parse_next_line
  222.         sub     edi,8
  223.         jmp     parse_next_line
  224.       parse_if:
  225.         push    edi
  226.         call    parse_line_contents
  227.         xor     al,al
  228.         stos    byte [edi]
  229.         xchg    esi,[esp]
  230.         mov     edi,esi
  231.         call    preevaluate_logical_expression
  232.         pop     esi
  233.         cmp     al,'0'
  234.         je      parse_false_condition_block
  235.         cmp     al,'1'
  236.         je      parse_true_condition_block
  237.         or      byte [esp],10000b
  238.         jmp     parse_next_line
  239.       parse_while:
  240.         push    edi
  241.         call    parse_line_contents
  242.         xor     al,al
  243.         stos    byte [edi]
  244.         xchg    esi,[esp]
  245.         mov     edi,esi
  246.         call    preevaluate_logical_expression
  247.         pop     esi
  248.         cmp     al,'0'
  249.         je      parse_false_condition_block
  250.         cmp     al,'1'
  251.         jne     parse_next_line
  252.         stos    byte [edi]
  253.         jmp     parse_next_line
  254.       parse_false_condition_block:
  255.         or      byte [esp],1
  256.         sub     edi,4
  257.         jmp     skip_parsing
  258.       parse_true_condition_block:
  259.         or      byte [esp],100b
  260.         sub     edi,4
  261.         jmp     parse_next_line
  262.       parse_else:
  263.         cmp     [blocks_stack],0
  264.         je      unexpected_instruction
  265.         cmp     word [esp+2],if_directive-instruction_handler
  266.         jne     unexpected_instruction
  267.         lods    byte [esi]
  268.         or      al,al
  269.         jz      parse_pure_else
  270.         cmp     al,1Ah
  271.         jne     extra_characters_on_line
  272.         push    edi
  273.         movzx   ecx,byte [esi]
  274.         inc     esi
  275.         call    get_instruction
  276.         jc      extra_characters_on_line
  277.         pop     edi
  278.         cmp     bx,if_directive-instruction_handler
  279.         jne     extra_characters_on_line
  280.         test    byte [esp],100b
  281.         jnz     skip_true_condition_else
  282.         mov     dl,al
  283.         mov     al,1
  284.         stos    byte [edi]
  285.         mov     ax,bx
  286.         stos    word [edi]
  287.         mov     al,dl
  288.         stos    byte [edi]
  289.         jmp     parse_if
  290.       parse_assert:
  291.         push    edi
  292.         call    parse_line_contents
  293.         xor     al,al
  294.         stos    byte [edi]
  295.         xchg    esi,[esp]
  296.         mov     edi,esi
  297.         call    preevaluate_logical_expression
  298.         pop     esi
  299.         or      al,al
  300.         jz      parse_next_line
  301.         stos    byte [edi]
  302.         jmp     parse_next_line
  303.       skip_true_condition_else:
  304.         sub     edi,4
  305.         or      byte [esp],1
  306.         jmp     skip_parsing_contents
  307.       parse_pure_else:
  308.         bts     dword [esp],1
  309.         jc      unexpected_instruction
  310.         test    byte [esp],100b
  311.         jz      parse_next_line
  312.         sub     edi,4
  313.         or      byte [esp],1
  314.         jmp     skip_parsing
  315.       skip_parsing:
  316.         cmp     esi,[source_start]
  317.         jae     source_parsed
  318.         mov     [current_line],esi
  319.         add     esi,16
  320.       skip_parsing_line:
  321.         cmp     byte [esi],1Ah
  322.         jne     skip_parsing_contents
  323.         inc     esi
  324.         movzx   ecx,byte [esi]
  325.         inc     esi
  326.         cmp     byte [esi+ecx],':'
  327.         je      skip_parsing_label
  328.         push    edi
  329.         call    get_instruction
  330.         pop     edi
  331.         jnc     skip_parsing_instruction
  332.         add     esi,ecx
  333.         jmp     skip_parsing_contents
  334.       skip_parsing_label:
  335.         lea     esi,[esi+ecx+1]
  336.         jmp     skip_parsing_line
  337.       skip_parsing_instruction:
  338.         cmp     bx,if_directive-instruction_handler
  339.         je      skip_parsing_block
  340.         cmp     bx,repeat_directive-instruction_handler
  341.         je      skip_parsing_block
  342.         cmp     bx,while_directive-instruction_handler
  343.         je      skip_parsing_block
  344.         cmp     bx,end_directive-instruction_handler
  345.         je      skip_parsing_end_directive
  346.         cmp     bx,else_directive-instruction_handler
  347.         je      skip_parsing_else
  348.       skip_parsing_contents:
  349.         lods    byte [esi]
  350.         or      al,al
  351.         jz      skip_parsing
  352.         cmp     al,1Ah
  353.         je      skip_parsing_symbol
  354.         cmp     al,3Bh
  355.         je      skip_parsing_symbol
  356.         cmp     al,22h
  357.         je      skip_parsing_string
  358.         jmp     skip_parsing_contents
  359.       skip_parsing_symbol:
  360.         lods    byte [esi]
  361.         movzx   eax,al
  362.         add     esi,eax
  363.         jmp     skip_parsing_contents
  364.       skip_parsing_string:
  365.         lods    dword [esi]
  366.         add     esi,eax
  367.         jmp     skip_parsing_contents
  368.       skip_parsing_block:
  369.         mov     eax,esp
  370.         sub     eax,100h
  371.         jc      stack_overflow
  372.         cmp     eax,[stack_limit]
  373.         jb      stack_overflow
  374.         push    [current_line]
  375.         mov     ax,bx
  376.         shl     eax,16
  377.         push    eax
  378.         inc     [blocks_stack]
  379.         jmp     skip_parsing_contents
  380.       skip_parsing_end_directive:
  381.         cmp     byte [esi],1Ah
  382.         jne     skip_parsing_contents
  383.         push    edi
  384.         inc     esi
  385.         movzx   ecx,byte [esi]
  386.         inc     esi
  387.         call    get_instruction
  388.         pop     edi
  389.         jnc     skip_parsing_end_block
  390.         add     esi,ecx
  391.         jmp     skip_parsing_contents
  392.       skip_parsing_end_block:
  393.         lods    byte [esi]
  394.         or      al,al
  395.         jnz     extra_characters_on_line
  396.         cmp     bx,if_directive-instruction_handler
  397.         je      close_skip_parsing_block
  398.         cmp     bx,repeat_directive-instruction_handler
  399.         je      close_skip_parsing_block
  400.         cmp     bx,while_directive-instruction_handler
  401.         je      close_skip_parsing_block
  402.         jmp     skip_parsing
  403.       close_skip_parsing_block:
  404.         cmp     [blocks_stack],0
  405.         je      unexpected_instruction
  406.         cmp     bx,[esp+2]
  407.         jne     unexpected_instruction
  408.         dec     [blocks_stack]
  409.         pop     eax edx
  410.         test    al,1
  411.         jz      skip_parsing
  412.         cmp     bx,if_directive-instruction_handler
  413.         jne     parse_next_line
  414.         test    al,10000b
  415.         jz      parse_next_line
  416.         mov     al,0Fh
  417.         stos    byte [edi]
  418.         mov     eax,[current_line]
  419.         stos    dword [edi]
  420.         inc     [parsed_lines]
  421.         mov     eax,1 + (end_directive-instruction_handler) shl 8
  422.         stos    dword [edi]
  423.         mov     eax,1 + (if_directive-instruction_handler) shl 8
  424.         stos    dword [edi]
  425.         jmp     parse_next_line
  426.       skip_parsing_else:
  427.         cmp     [blocks_stack],0
  428.         je      unexpected_instruction
  429.         cmp     word [esp+2],if_directive-instruction_handler
  430.         jne     unexpected_instruction
  431.         lods    byte [esi]
  432.         or      al,al
  433.         jz      skip_parsing_pure_else
  434.         cmp     al,1Ah
  435.         jne     extra_characters_on_line
  436.         push    edi
  437.         movzx   ecx,byte [esi]
  438.         inc     esi
  439.         call    get_instruction
  440.         jc      extra_characters_on_line
  441.         pop     edi
  442.         cmp     bx,if_directive-instruction_handler
  443.         jne     extra_characters_on_line
  444.         mov     al,[esp]
  445.         test    al,1
  446.         jz      skip_parsing_contents
  447.         test    al,100b
  448.         jnz     skip_parsing_contents
  449.         test    al,10000b
  450.         jnz     parse_else_if
  451.         xor     al,al
  452.         mov     [esp],al
  453.         mov     al,0Fh
  454.         stos    byte [edi]
  455.         mov     eax,[current_line]
  456.         stos    dword [edi]
  457.         inc     [parsed_lines]
  458.       parse_else_if:
  459.         mov     eax,1 + (if_directive-instruction_handler) shl 8
  460.         stos    dword [edi]
  461.         jmp     parse_if
  462.       skip_parsing_pure_else:
  463.         bts     dword [esp],1
  464.         jc      unexpected_instruction
  465.         mov     al,[esp]
  466.         test    al,1
  467.         jz      skip_parsing
  468.         test    al,100b
  469.         jnz     skip_parsing
  470.         and     al,not 1
  471.         or      al,1000b
  472.         mov     [esp],al
  473.         jmp     parse_next_line
  474.  
  475. parse_line_contents:
  476.         mov     [parenthesis_stack],0
  477.       parse_instruction_arguments:
  478.         cmp     bx,prefix_instruction-instruction_handler
  479.         je      allow_embedded_instruction
  480.         cmp     bx,times_directive-instruction_handler
  481.         je      parse_times_directive
  482.         cmp     bx,end_directive-instruction_handler
  483.         je      allow_embedded_instruction
  484.         cmp     bx,label_directive-instruction_handler
  485.         je      parse_label_directive
  486.         cmp     bx,segment_directive-instruction_handler
  487.         je      parse_segment_directive
  488.         cmp     bx,load_directive-instruction_handler
  489.         je      parse_load_directive
  490.         cmp     bx,extrn_directive-instruction_handler
  491.         je      parse_extrn_directive
  492.         cmp     bx,public_directive-instruction_handler
  493.         je      parse_public_directive
  494.         cmp     bx,section_directive-instruction_handler
  495.         je      parse_formatter_argument
  496.         cmp     bx,format_directive-instruction_handler
  497.         je      parse_formatter_argument
  498.         cmp     bx,data_directive-instruction_handler
  499.         je      parse_formatter_argument
  500.         jmp     parse_argument
  501.       parse_formatter_argument:
  502.         or      [formatter_symbols_allowed],-1
  503.       parse_argument:
  504.         lea     eax,[edi+100h]
  505.         cmp     eax,[labels_list]
  506.         jae     out_of_memory
  507.         lods    byte [esi]
  508.         cmp     al,':'
  509.         je      instruction_separator
  510.         cmp     al,','
  511.         je      separator
  512.         cmp     al,'='
  513.         je      expression_comparator
  514.         cmp     al,'|'
  515.         je      separator
  516.         cmp     al,'&'
  517.         je      separator
  518.         cmp     al,'~'
  519.         je      separator
  520.         cmp     al,'>'
  521.         je      greater
  522.         cmp     al,'<'
  523.         je      less
  524.         cmp     al,')'
  525.         je      close_parenthesis
  526.         or      al,al
  527.         jz      contents_parsed
  528.         cmp     al,'['
  529.         je      address_argument
  530.         cmp     al,']'
  531.         je      separator
  532.         cmp     al,'{'
  533.         je      open_decorator
  534.         cmp     al,'}'
  535.         je      close_decorator
  536.         cmp     al,'#'
  537.         je      unallowed_character
  538.         cmp     al,'`'
  539.         je      unallowed_character
  540.         cmp     al,3Bh
  541.         je      foreign_argument
  542.         cmp     [decorator_symbols_allowed],0
  543.         je      not_a_separator
  544.         cmp     al,'-'
  545.         je      separator
  546.       not_a_separator:
  547.         dec     esi
  548.         cmp     al,1Ah
  549.         jne     expression_argument
  550.         push    edi
  551.         mov     edi,directive_operators
  552.         call    get_operator
  553.         or      al,al
  554.         jnz     operator_argument
  555.         inc     esi
  556.         movzx   ecx,byte [esi]
  557.         inc     esi
  558.         call    get_symbol
  559.         jnc     symbol_argument
  560.         cmp     ecx,1
  561.         jne     check_argument
  562.         cmp     byte [esi],'?'
  563.         jne     check_argument
  564.         pop     edi
  565.         movs    byte [edi],[esi]
  566.         jmp     argument_parsed
  567.       foreign_argument:
  568.         dec     esi
  569.         call    skip_foreign_line
  570.         jmp     contents_parsed
  571.       symbol_argument:
  572.         pop     edi
  573.         stos    word [edi]
  574.         jmp     argument_parsed
  575.       operator_argument:
  576.         pop     edi
  577.         cmp     al,85h
  578.         je      ptr_argument
  579.         stos    byte [edi]
  580.         cmp     al,80h
  581.         je      forced_multipart_expression
  582.         cmp     al,8Ch
  583.         je      forced_expression
  584.         cmp     al,81h
  585.         je      forced_parenthesis
  586.         cmp     al,82h
  587.         je      parse_from_operator
  588.         cmp     al,89h
  589.         je      parse_label_operator
  590.         cmp     al,0F8h
  591.         je      forced_expression
  592.         jmp     argument_parsed
  593.       instruction_separator:
  594.         stos    byte [edi]
  595.       allow_embedded_instruction:
  596.         cmp     byte [esi],1Ah
  597.         jne     parse_argument
  598.         push    edi
  599.         inc     esi
  600.         movzx   ecx,byte [esi]
  601.         inc     esi
  602.         call    get_instruction
  603.         jnc     embedded_instruction
  604.         call    get_data_directive
  605.         jnc     embedded_instruction
  606.         pop     edi
  607.         sub     esi,2
  608.         jmp     parse_argument
  609.       embedded_instruction:
  610.         pop     edi
  611.         mov     dl,al
  612.         mov     al,1
  613.         stos    byte [edi]
  614.         mov     ax,bx
  615.         stos    word [edi]
  616.         mov     al,dl
  617.         stos    byte [edi]
  618.         jmp     parse_instruction_arguments
  619.       parse_times_directive:
  620.         mov     al,'('
  621.         stos    byte [edi]
  622.         call    convert_expression
  623.         mov     al,')'
  624.         stos    byte [edi]
  625.         cmp     byte [esi],':'
  626.         jne     allow_embedded_instruction
  627.         movs    byte [edi],[esi]
  628.         jmp     allow_embedded_instruction
  629.       parse_segment_directive:
  630.         or      [formatter_symbols_allowed],-1
  631.       parse_label_directive:
  632.         cmp     byte [esi],1Ah
  633.         jne     argument_parsed
  634.         push    esi
  635.         inc     esi
  636.         movzx   ecx,byte [esi]
  637.         inc     esi
  638.         call    identify_label
  639.         pop     ebx
  640.         cmp     eax,0Fh
  641.         je      non_label_identified
  642.         mov     byte [edi],2
  643.         inc     edi
  644.         stos    dword [edi]
  645.         xor     al,al
  646.         stos    byte [edi]
  647.         jmp     argument_parsed
  648.       non_label_identified:
  649.         mov     esi,ebx
  650.         jmp     argument_parsed
  651.       parse_load_directive:
  652.         cmp     byte [esi],1Ah
  653.         jne     argument_parsed
  654.         push    esi
  655.         inc     esi
  656.         movzx   ecx,byte [esi]
  657.         inc     esi
  658.         call    get_label_id
  659.         pop     ebx
  660.         cmp     eax,0Fh
  661.         je      non_label_identified
  662.         mov     byte [edi],2
  663.         inc     edi
  664.         stos    dword [edi]
  665.         xor     al,al
  666.         stos    byte [edi]
  667.         jmp     argument_parsed
  668.       parse_public_directive:
  669.         cmp     byte [esi],1Ah
  670.         jne     parse_argument
  671.         inc     esi
  672.         push    esi
  673.         movzx   ecx,byte [esi]
  674.         inc     esi
  675.         push    esi ecx
  676.         push    edi
  677.         or      [formatter_symbols_allowed],-1
  678.         call    get_symbol
  679.         mov     [formatter_symbols_allowed],0
  680.         pop     edi
  681.         jc      parse_public_label
  682.         cmp     al,1Dh
  683.         jne     parse_public_label
  684.         add     esp,12
  685.         stos    word [edi]
  686.         jmp     parse_public_directive
  687.       parse_public_label:
  688.         pop     ecx esi
  689.         mov     al,2
  690.         stos    byte [edi]
  691.         call    get_label_id
  692.         stos    dword [edi]
  693.         mov     ax,8600h
  694.         stos    word [edi]
  695.         pop     ebx
  696.         push    ebx esi edi
  697.         mov     edi,directive_operators
  698.         call    get_operator
  699.         pop     edi edx ebx
  700.         cmp     al,86h
  701.         je      argument_parsed
  702.         mov     esi,edx
  703.         xchg    esi,ebx
  704.         movzx   ecx,byte [esi]
  705.         inc     esi
  706.         mov     ax,'('
  707.         stos    word [edi]
  708.         mov     eax,ecx
  709.         stos    dword [edi]
  710.         rep     movs byte [edi],[esi]
  711.         xor     al,al
  712.         stos    byte [edi]
  713.         xchg    esi,ebx
  714.         jmp     argument_parsed
  715.       parse_extrn_directive:
  716.         cmp     byte [esi],22h
  717.         je      parse_quoted_extrn
  718.         cmp     byte [esi],1Ah
  719.         jne     parse_argument
  720.         push    esi
  721.         movzx   ecx,byte [esi+1]
  722.         add     esi,2
  723.         mov     ax,'('
  724.         stos    word [edi]
  725.         mov     eax,ecx
  726.         stos    dword [edi]
  727.         rep     movs byte [edi],[esi]
  728.         mov     ax,8600h
  729.         stos    word [edi]
  730.         pop     esi
  731.       parse_label_operator:
  732.         cmp     byte [esi],1Ah
  733.         jne     argument_parsed
  734.         inc     esi
  735.         movzx   ecx,byte [esi]
  736.         inc     esi
  737.         mov     al,2
  738.         stos    byte [edi]
  739.         call    get_label_id
  740.         stos    dword [edi]
  741.         xor     al,al
  742.         stos    byte [edi]
  743.         jmp     argument_parsed
  744.       parse_from_operator:
  745.         cmp     byte [esi],22h
  746.         jne     forced_multipart_expression
  747.         jmp     argument_parsed
  748.       parse_quoted_extrn:
  749.         inc     esi
  750.         mov     ax,'('
  751.         stos    word [edi]
  752.         lods    dword [esi]
  753.         mov     ecx,eax
  754.         stos    dword [edi]
  755.         rep     movs byte [edi],[esi]
  756.         xor     al,al
  757.         stos    byte [edi]
  758.         push    esi edi
  759.         mov     edi,directive_operators
  760.         call    get_operator
  761.         mov     edx,esi
  762.         pop     edi esi
  763.         cmp     al,86h
  764.         jne     argument_parsed
  765.         stos    byte [edi]
  766.         mov     esi,edx
  767.         jmp     parse_label_operator
  768.       ptr_argument:
  769.         call    parse_address
  770.         jmp     address_parsed
  771.       check_argument:
  772.         push    esi ecx
  773.         sub     esi,2
  774.         mov     edi,single_operand_operators
  775.         call    get_operator
  776.         pop     ecx esi
  777.         or      al,al
  778.         jnz     not_instruction
  779.         call    get_instruction
  780.         jnc     embedded_instruction
  781.         call    get_data_directive
  782.         jnc     embedded_instruction
  783.       not_instruction:
  784.         pop     edi
  785.         sub     esi,2
  786.       expression_argument:
  787.         cmp     byte [esi],22h
  788.         jne     not_string
  789.         mov     eax,[esi+1]
  790.         lea     ebx,[esi+5+eax]
  791.         push    ebx ecx esi edi
  792.         call    parse_expression
  793.         pop     eax edx ecx ebx
  794.         cmp     esi,ebx
  795.         jne     expression_argument_parsed
  796.         mov     edi,eax
  797.         mov     esi,edx
  798.       string_argument:
  799.         inc     esi
  800.         mov     ax,'('
  801.         stos    word [edi]
  802.         lods    dword [esi]
  803.         mov     ecx,eax
  804.         stos    dword [edi]
  805.         shr     ecx,1
  806.         jnc     string_movsb_ok
  807.         movs    byte [edi],[esi]
  808.       string_movsb_ok:
  809.         shr     ecx,1
  810.         jnc     string_movsw_ok
  811.         movs    word [edi],[esi]
  812.       string_movsw_ok:
  813.         rep     movs dword [edi],[esi]
  814.         xor     al,al
  815.         stos    byte [edi]
  816.         jmp     expression_argument_parsed
  817.       parse_expression:
  818.         mov     al,'('
  819.         stos    byte [edi]
  820.         call    convert_expression
  821.         mov     al,')'
  822.         stos    byte [edi]
  823.         ret
  824.       not_string:
  825.         cmp     byte [esi],'('
  826.         jne     expression
  827.         mov     eax,esp
  828.         sub     eax,100h
  829.         jc      stack_overflow
  830.         cmp     eax,[stack_limit]
  831.         jb      stack_overflow
  832.         push    esi edi
  833.         inc     esi
  834.         mov     al,91h
  835.         stos    byte [edi]
  836.         inc     [parenthesis_stack]
  837.         jmp     parse_argument
  838.       expression_comparator:
  839.         stos    byte [edi]
  840.         jmp     forced_expression
  841.       greater:
  842.         cmp     byte [esi],'='
  843.         jne     separator
  844.         inc     esi
  845.         mov     al,0F2h
  846.         jmp     separator
  847.       less:
  848.         cmp     byte [edi-1],0F6h
  849.         je      separator
  850.         cmp     byte [esi],'>'
  851.         je      not_equal
  852.         cmp     byte [esi],'='
  853.         jne     separator
  854.         inc     esi
  855.         mov     al,0F3h
  856.         jmp     separator
  857.       not_equal:
  858.         inc     esi
  859.         mov     al,0F1h
  860.         jmp     expression_comparator
  861.       expression:
  862.         call    parse_expression
  863.         jmp     expression_argument_parsed
  864.       forced_expression:
  865.         xor     al,al
  866.         xchg    al,[formatter_symbols_allowed]
  867.         push    eax
  868.         call    parse_expression
  869.       forced_expression_parsed:
  870.         pop     eax
  871.         mov     [formatter_symbols_allowed],al
  872.         jmp     argument_parsed
  873.       forced_multipart_expression:
  874.         xor     al,al
  875.         xchg    al,[formatter_symbols_allowed]
  876.         push    eax
  877.         call    parse_expression
  878.         cmp     byte [esi],':'
  879.         jne     forced_expression_parsed
  880.         movs    byte [edi],[esi]
  881.         call    parse_expression
  882.         jmp     forced_expression_parsed
  883.       address_argument:
  884.         call    parse_address
  885.         lods    byte [esi]
  886.         cmp     al,']'
  887.         je      address_parsed
  888.         cmp     al,','
  889.         je      divided_address
  890.         dec     esi
  891.         mov     al,')'
  892.         stos    byte [edi]
  893.         jmp     argument_parsed
  894.       divided_address:
  895.         mov     ax,'),'
  896.         stos    word [edi]
  897.         jmp     expression
  898.       address_parsed:
  899.         mov     al,']'
  900.         stos    byte [edi]
  901.         jmp     argument_parsed
  902.       parse_address:
  903.         mov     al,'['
  904.         stos    byte [edi]
  905.         cmp     word [esi],021Ah
  906.         jne     convert_address
  907.         push    esi
  908.         add     esi,4
  909.         lea     ebx,[esi+1]
  910.         cmp     byte [esi],':'
  911.         pop     esi
  912.         jne     convert_address
  913.         add     esi,2
  914.         mov     ecx,2
  915.         push    ebx edi
  916.         call    get_symbol
  917.         pop     edi esi
  918.         jc      unknown_segment_prefix
  919.         cmp     al,10h
  920.         jne     unknown_segment_prefix
  921.         mov     al,ah
  922.         and     ah,11110000b
  923.         cmp     ah,30h
  924.         jne     unknown_segment_prefix
  925.         add     al,30h
  926.         stos    byte [edi]
  927.         jmp     convert_address
  928.       unknown_segment_prefix:
  929.         sub     esi,5
  930.       convert_address:
  931.         push    edi
  932.         mov     edi,address_sizes
  933.         call    get_operator
  934.         pop     edi
  935.         or      al,al
  936.         jz      convert_expression
  937.         add     al,70h
  938.         stos    byte [edi]
  939.         jmp     convert_expression
  940.       forced_parenthesis:
  941.         cmp     byte [esi],'('
  942.         jne     argument_parsed
  943.         inc     esi
  944.         mov     al,91h
  945.         jmp     separator
  946.       unallowed_character:
  947.         mov     al,0FFh
  948.         jmp     separator
  949.       open_decorator:
  950.         inc     [decorator_symbols_allowed]
  951.         jmp     separator
  952.       close_decorator:
  953.         dec     [decorator_symbols_allowed]
  954.         jmp     separator
  955.       close_parenthesis:
  956.         mov     al,92h
  957.       separator:
  958.         stos    byte [edi]
  959.       argument_parsed:
  960.         cmp     [parenthesis_stack],0
  961.         je      parse_argument
  962.         dec     [parenthesis_stack]
  963.         add     esp,8
  964.         jmp     argument_parsed
  965.       expression_argument_parsed:
  966.         cmp     [parenthesis_stack],0
  967.         je      parse_argument
  968.         cmp     byte [esi],')'
  969.         jne     argument_parsed
  970.         dec     [parenthesis_stack]
  971.         pop     edi esi
  972.         jmp     expression
  973.       contents_parsed:
  974.         cmp     [parenthesis_stack],0
  975.         je      contents_ok
  976.         dec     [parenthesis_stack]
  977.         add     esp,8
  978.         jmp     contents_parsed
  979.       contents_ok:
  980.         ret
  981.  
  982. identify_label:
  983.         cmp     byte [esi],'.'
  984.         je      local_label_name
  985.         call    get_label_id
  986.         cmp     eax,10h
  987.         jb      label_identified
  988.         or      ebx,ebx
  989.         jz      anonymous_label_name
  990.         dec     ebx
  991.         mov     [current_locals_prefix],ebx
  992.       label_identified:
  993.         ret
  994.       anonymous_label_name:
  995.         cmp     byte [esi-1],'@'
  996.         je      anonymous_label_name_ok
  997.         mov     eax,0Fh
  998.       anonymous_label_name_ok:
  999.         ret
  1000.       local_label_name:
  1001.         call    get_label_id
  1002.         ret
  1003.  
  1004. get_operator:
  1005.         cmp     byte [esi],1Ah
  1006.         jne     get_simple_operator
  1007.         mov     edx,esi
  1008.         push    ebp
  1009.         inc     esi
  1010.         lods    byte [esi]
  1011.         movzx   ebp,al
  1012.         push    edi
  1013.         mov     ecx,ebp
  1014.         call    lower_case
  1015.         pop     edi
  1016.       check_operator:
  1017.         mov     esi,converted
  1018.         movzx   ecx,byte [edi]
  1019.         jecxz   no_operator
  1020.         inc     edi
  1021.         mov     ebx,edi
  1022.         add     ebx,ecx
  1023.         cmp     ecx,ebp
  1024.         jne     next_operator
  1025.         repe    cmps byte [esi],[edi]
  1026.         je      operator_found
  1027.         jb      no_operator
  1028.       next_operator:
  1029.         mov     edi,ebx
  1030.         inc     edi
  1031.         jmp     check_operator
  1032.       no_operator:
  1033.         mov     esi,edx
  1034.         mov     ecx,ebp
  1035.         pop     ebp
  1036.       no_simple_operator:
  1037.         xor     al,al
  1038.         ret
  1039.       operator_found:
  1040.         lea     esi,[edx+2+ebp]
  1041.         mov     ecx,ebp
  1042.         pop     ebp
  1043.         mov     al,[edi]
  1044.         ret
  1045.       get_simple_operator:
  1046.         mov     al,[esi]
  1047.         cmp     al,22h
  1048.         je      no_simple_operator
  1049.       simple_operator:
  1050.         cmp     byte [edi],1
  1051.         jb      no_simple_operator
  1052.         ja      simple_next_operator
  1053.         cmp     al,[edi+1]
  1054.         je      simple_operator_found
  1055.       simple_next_operator:
  1056.         movzx   ecx,byte [edi]
  1057.         lea     edi,[edi+1+ecx+1]
  1058.         jmp     simple_operator
  1059.       simple_operator_found:
  1060.         inc     esi
  1061.         mov     al,[edi+2]
  1062.         ret
  1063.  
  1064. get_symbol:
  1065.         push    esi
  1066.         mov     ebp,ecx
  1067.         call    lower_case
  1068.         mov     ecx,ebp
  1069.         cmp     cl,11
  1070.         ja      no_symbol
  1071.         sub     cl,1
  1072.         jc      no_symbol
  1073.         movzx   ebx,word [symbols+ecx*4]
  1074.         add     ebx,symbols
  1075.         movzx   edx,word [symbols+ecx*4+2]
  1076.       scan_symbols:
  1077.         or      edx,edx
  1078.         jz      no_symbol
  1079.         mov     eax,edx
  1080.         shr     eax,1
  1081.         lea     edi,[ebp+2]
  1082.         imul    eax,edi
  1083.         lea     edi,[ebx+eax]
  1084.         mov     esi,converted
  1085.         mov     ecx,ebp
  1086.         repe    cmps byte [esi],[edi]
  1087.         ja      symbols_up
  1088.         jb      symbols_down
  1089.         mov     ax,[edi]
  1090.         cmp     al,18h
  1091.         jb      symbol_ok
  1092.         cmp     al,1Fh
  1093.         je      decorator_symbol
  1094.         cmp     [formatter_symbols_allowed],0
  1095.         je      no_symbol
  1096.       symbol_ok:
  1097.         pop     esi
  1098.         add     esi,ebp
  1099.         clc
  1100.         ret
  1101.       decorator_symbol:
  1102.         cmp     [decorator_symbols_allowed],0
  1103.         jne     symbol_ok
  1104.       no_symbol:
  1105.         pop     esi
  1106.         mov     ecx,ebp
  1107.         stc
  1108.         ret
  1109.       symbols_down:
  1110.         shr     edx,1
  1111.         jmp     scan_symbols
  1112.       symbols_up:
  1113.         lea     ebx,[edi+ecx+2]
  1114.         shr     edx,1
  1115.         adc     edx,-1
  1116.         jmp     scan_symbols
  1117.  
  1118. get_data_directive:
  1119.         push    esi
  1120.         mov     ebp,ecx
  1121.         call    lower_case
  1122.         mov     ecx,ebp
  1123.         cmp     cl,4
  1124.         ja      no_instruction
  1125.         sub     cl,2
  1126.         jc      no_instruction
  1127.         movzx   ebx,word [data_directives+ecx*4]
  1128.         add     ebx,data_directives
  1129.         movzx   edx,word [data_directives+ecx*4+2]
  1130.         jmp     scan_instructions
  1131.  
  1132. get_instruction:
  1133.         push    esi
  1134.         mov     ebp,ecx
  1135.         call    lower_case
  1136.         mov     ecx,ebp
  1137.         cmp     cl,16
  1138.         ja      no_instruction
  1139.         sub     cl,2
  1140.         jc      no_instruction
  1141.         movzx   ebx,word [instructions+ecx*4]
  1142.         add     ebx,instructions
  1143.         movzx   edx,word [instructions+ecx*4+2]
  1144.       scan_instructions:
  1145.         or      edx,edx
  1146.         jz      no_instruction
  1147.         mov     eax,edx
  1148.         shr     eax,1
  1149.         lea     edi,[ebp+3]
  1150.         imul    eax,edi
  1151.         lea     edi,[ebx+eax]
  1152.         mov     esi,converted
  1153.         mov     ecx,ebp
  1154.         repe    cmps byte [esi],[edi]
  1155.         ja      instructions_up
  1156.         jb      instructions_down
  1157.         pop     esi
  1158.         add     esi,ebp
  1159.         mov     al,[edi]
  1160.         mov     bx,[edi+1]
  1161.         clc
  1162.         ret
  1163.       no_instruction:
  1164.         pop     esi
  1165.         mov     ecx,ebp
  1166.         stc
  1167.         ret
  1168.       instructions_down:
  1169.         shr     edx,1
  1170.         jmp     scan_instructions
  1171.       instructions_up:
  1172.         lea     ebx,[edi+ecx+3]
  1173.         shr     edx,1
  1174.         adc     edx,-1
  1175.         jmp     scan_instructions
  1176.  
  1177. get_label_id:
  1178.         cmp     ecx,100h
  1179.         jae     name_too_long
  1180.         cmp     byte [esi],'@'
  1181.         je      anonymous_label
  1182.         cmp     byte [esi],'.'
  1183.         jne     standard_label
  1184.         cmp     byte [esi+1],'.'
  1185.         je      standard_label
  1186.         cmp     [current_locals_prefix],0
  1187.         je      standard_label
  1188.         push    edi
  1189.         mov     edi,[additional_memory_end]
  1190.         sub     edi,2
  1191.         sub     edi,ecx
  1192.         push    ecx esi
  1193.         mov     esi,[current_locals_prefix]
  1194.         lods    byte [esi]
  1195.         movzx   ecx,al
  1196.         sub     edi,ecx
  1197.         cmp     edi,[free_additional_memory]
  1198.         jb      out_of_memory
  1199.         mov     word [edi],0
  1200.         add     edi,2
  1201.         mov     ebx,edi
  1202.         rep     movs byte [edi],[esi]
  1203.         pop     esi ecx
  1204.         add     al,cl
  1205.         jc      name_too_long
  1206.         rep     movs byte [edi],[esi]
  1207.         pop     edi
  1208.         push    ebx esi
  1209.         movzx   ecx,al
  1210.         mov     byte [ebx-1],al
  1211.         mov     esi,ebx
  1212.         call    get_label_id
  1213.         pop     esi ebx
  1214.         cmp     ebx,[eax+24]
  1215.         jne     composed_label_id_ok
  1216.         lea     edx,[ebx-2]
  1217.         mov     [additional_memory_end],edx
  1218.       composed_label_id_ok:
  1219.         ret
  1220.       anonymous_label:
  1221.         cmp     ecx,2
  1222.         jne     standard_label
  1223.         mov     al,[esi+1]
  1224.         mov     ebx,characters
  1225.         xlat    byte [ebx]
  1226.         cmp     al,'@'
  1227.         je      new_anonymous
  1228.         cmp     al,'b'
  1229.         je      anonymous_back
  1230.         cmp     al,'r'
  1231.         je      anonymous_back
  1232.         cmp     al,'f'
  1233.         jne     standard_label
  1234.         add     esi,2
  1235.         mov     eax,[anonymous_forward]
  1236.         or      eax,eax
  1237.         jnz     anonymous_ok
  1238.         mov     eax,[current_line]
  1239.         mov     [error_line],eax
  1240.         call    allocate_label
  1241.         mov     [anonymous_forward],eax
  1242.       anonymous_ok:
  1243.         xor     ebx,ebx
  1244.         ret
  1245.       anonymous_back:
  1246.         mov     eax,[anonymous_reverse]
  1247.         add     esi,2
  1248.         or      eax,eax
  1249.         jz      bogus_anonymous
  1250.         jmp     anonymous_ok
  1251.       bogus_anonymous:
  1252.         call    allocate_label
  1253.         mov     [anonymous_reverse],eax
  1254.         jmp     anonymous_ok
  1255.       new_anonymous:
  1256.         add     esi,2
  1257.         mov     eax,[anonymous_forward]
  1258.         or      eax,eax
  1259.         jnz     new_anonymous_ok
  1260.         call    allocate_label
  1261.       new_anonymous_ok:
  1262.         mov     [anonymous_reverse],eax
  1263.         mov     [anonymous_forward],0
  1264.         jmp     anonymous_ok
  1265.       standard_label:
  1266.         cmp     byte [esi],'%'
  1267.         je      get_predefined_id
  1268.         cmp     byte [esi],'$'
  1269.         je      current_address_label
  1270.         cmp     byte [esi],'?'
  1271.         jne     find_label
  1272.         cmp     ecx,1
  1273.         jne     find_label
  1274.         inc     esi
  1275.         mov     eax,0Fh
  1276.         ret
  1277.       current_address_label:
  1278.         cmp     ecx,2
  1279.         ja      find_label
  1280.         inc     esi
  1281.         jb      get_current_offset_id
  1282.         inc     esi
  1283.         cmp     byte [esi-1],'$'
  1284.         je      get_org_origin_id
  1285.         sub     esi,2
  1286.         jmp     find_label
  1287.       get_current_offset_id:
  1288.         xor     eax,eax
  1289.         ret
  1290.       get_counter_id:
  1291.         mov     eax,1
  1292.         ret
  1293.       get_timestamp_id:
  1294.         mov     eax,2
  1295.         ret
  1296.       get_org_origin_id:
  1297.         mov     eax,3
  1298.         ret
  1299.       get_predefined_id:
  1300.         cmp     ecx,2
  1301.         ja      find_label
  1302.         inc     esi
  1303.         cmp     cl,1
  1304.         je      get_counter_id
  1305.         lods    byte [esi]
  1306.         mov     ebx,characters
  1307.         xlat    [ebx]
  1308.         cmp     al,'t'
  1309.         je      get_timestamp_id
  1310.         sub     esi,2
  1311.       find_label:
  1312.         xor     ebx,ebx
  1313.         mov     eax,2166136261
  1314.         mov     ebp,16777619
  1315.       hash_label:
  1316.         xor     al,[esi+ebx]
  1317.         mul     ebp
  1318.         inc     bl
  1319.         cmp     bl,cl
  1320.         jb      hash_label
  1321.         mov     ebp,eax
  1322.         shl     eax,8
  1323.         and     ebp,0FFh shl 24
  1324.         xor     ebp,eax
  1325.         or      ebp,ebx
  1326.         mov     [label_hash],ebp
  1327.         push    edi esi
  1328.         push    ecx
  1329.         mov     ecx,32
  1330.         mov     ebx,hash_tree
  1331.       follow_tree:
  1332.         mov     edx,[ebx]
  1333.         or      edx,edx
  1334.         jz      extend_tree
  1335.         xor     eax,eax
  1336.         shl     ebp,1
  1337.         adc     eax,0
  1338.         lea     ebx,[edx+eax*4]
  1339.         dec     ecx
  1340.         jnz     follow_tree
  1341.         mov     [label_leaf],ebx
  1342.         pop     edx
  1343.         mov     eax,[ebx]
  1344.         or      eax,eax
  1345.         jz      add_label
  1346.         mov     ebx,esi
  1347.         mov     ebp,[label_hash]
  1348.       compare_labels:
  1349.         mov     esi,ebx
  1350.         mov     ecx,edx
  1351.         mov     edi,[eax+4]
  1352.         mov     edi,[edi+24]
  1353.         repe    cmps byte [esi],[edi]
  1354.         je      label_found
  1355.         mov     eax,[eax]
  1356.         or      eax,eax
  1357.         jnz     compare_labels
  1358.         jmp     add_label
  1359.       label_found:
  1360.         add     esp,4
  1361.         pop     edi
  1362.         mov     eax,[eax+4]
  1363.         ret
  1364.       extend_tree:
  1365.         mov     edx,[free_additional_memory]
  1366.         lea     eax,[edx+8]
  1367.         cmp     eax,[additional_memory_end]
  1368.         ja      out_of_memory
  1369.         mov     [free_additional_memory],eax
  1370.         xor     eax,eax
  1371.         mov     [edx],eax
  1372.         mov     [edx+4],eax
  1373.         shl     ebp,1
  1374.         adc     eax,0
  1375.         mov     [ebx],edx
  1376.         lea     ebx,[edx+eax*4]
  1377.         dec     ecx
  1378.         jnz     extend_tree
  1379.         mov     [label_leaf],ebx
  1380.         pop     edx
  1381.       add_label:
  1382.         mov     ecx,edx
  1383.         pop     esi
  1384.         cmp     byte [esi-2],0
  1385.         je      label_name_ok
  1386.         mov     al,[esi]
  1387.         cmp     al,30h
  1388.         jb      name_first_char_ok
  1389.         cmp     al,39h
  1390.         jbe     numeric_name
  1391.       name_first_char_ok:
  1392.         cmp     al,'$'
  1393.         jne     check_for_reserved_word
  1394.       numeric_name:
  1395.         add     esi,ecx
  1396.       reserved_word:
  1397.         mov     eax,0Fh
  1398.         pop     edi
  1399.         ret
  1400.       check_for_reserved_word:
  1401.         call    get_instruction
  1402.         jnc     reserved_word
  1403.         call    get_data_directive
  1404.         jnc     reserved_word
  1405.         call    get_symbol
  1406.         jnc     reserved_word
  1407.         sub     esi,2
  1408.         mov     edi,operators
  1409.         call    get_operator
  1410.         or      al,al
  1411.         jnz     reserved_word
  1412.         mov     edi,single_operand_operators
  1413.         call    get_operator
  1414.         or      al,al
  1415.         jnz     reserved_word
  1416.         mov     edi,directive_operators
  1417.         call    get_operator
  1418.         or      al,al
  1419.         jnz     reserved_word
  1420.         inc     esi
  1421.         movzx   ecx,byte [esi]
  1422.         inc     esi
  1423.       label_name_ok:
  1424.         mov     edx,[free_additional_memory]
  1425.         lea     eax,[edx+8]
  1426.         cmp     eax,[additional_memory_end]
  1427.         ja      out_of_memory
  1428.         mov     [free_additional_memory],eax
  1429.         mov     ebx,esi
  1430.         add     esi,ecx
  1431.         mov     eax,[label_leaf]
  1432.         mov     edi,[eax]
  1433.         mov     [edx],edi
  1434.         mov     [eax],edx
  1435.         call    allocate_label
  1436.         mov     [edx+4],eax
  1437.         mov     [eax+24],ebx
  1438.         pop     edi
  1439.         ret
  1440.       allocate_label:
  1441.         mov     eax,[labels_list]
  1442.         mov     ecx,LABEL_STRUCTURE_SIZE shr 2
  1443.       initialize_label:
  1444.         sub     eax,4
  1445.         mov     dword [eax],0
  1446.         loop    initialize_label
  1447.         mov     [labels_list],eax
  1448.         ret
  1449.  
  1450. LABEL_STRUCTURE_SIZE = 32
  1451.