flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Allowing } at macro block

Author
Thread Post new topic Reply to topic
kempis



Joined: 12 Jun 2008
Posts: 49
kempis 12 Apr 2009, 06:55
Hello, this is some addition to file preproce.inc that make it allowing macroinstruction contaions } (without backslash)
add the variables in variable.inc
macro_depth_at_skip dd ?
macro_depth_at_process dd ?
Code:
; add variable
; macro_depth_at_skip dd ?
; macro_depth_at_process dd ?

;preproce.inc
;line 1036
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     
      found_macro_block:
       or      [macro_status],2
    ;;;;;;;;;;;edit
     mov     [macro_depth_at_skip],1
     ;;;;;;;;;;;end edit
      skip_macro_block:
  lods    byte [esi]
  cmp     al,1Ah
      je      skip_macro_symbol
   cmp     al,3Bh
      je      skip_macro_symbol
   cmp     al,22h
      je      skip_macro_string
   or      al,al
       jz      line_preprocessed
   ;;;;;;;;;;;;edit
    cmp     al,'{'
       je      increment_macro_depth_at_skip
       ;;;;;;;;;;;;end edit
        cmp     al,'}'
       ;;;;;;;edit
 jne     skip_macro_block
    dec     [macro_depth_at_skip]
       jnz     skip_macro_block
    ;;;;;;;end edit
     mov     al,[macro_status]
   and     [macro_status],0F0h
 test    al,8
        jnz     use_instant_macro
   cmp     byte [esi],0
        je      line_preprocessed
   mov     ecx,edi
     sub     ecx,esi
     mov     edx,esi
     lea     esi,[esi+ecx-1]
     lea     edi,[edi+1+16]
      mov     ebx,edi
     dec     edi
 std
 rep     movs byte [edi],[esi]
       cld
 mov     edi,edx
     xor     al,al
       stos    byte [edi]
  mov     esi,[current_line]
  mov     [current_line],edi
  mov     ecx,4
       rep     movs dword [edi],[esi]
      mov     edi,ebx
     jmp     initial_preprocessing_ok
      ;;;;;edit
      increment_macro_depth_at_skip:
             inc     [macro_depth_at_skip]
       jmp     skip_macro_block
      ;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;line 1998
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
process_macro:
    ;;;;edit
    push    [macro_depth_at_process]
    ;push   [macro_depth_at_skip]
       mov     [macro_depth_at_process],1
  mov     [macro_depth_at_skip],0
     ;;;;end edit
        push    dword [macro_status]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;line 2069
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      process_macro_line_element:
     lea     eax,[edi+100h]
      cmp     eax,[memory_end]
    jae     out_of_memory
       lods    byte [esi]
  cmp     al,'}'
       ;;;;;;;;edit
        ;je     macro_line_processed
        je      decrement_macro_depth_at_process
    ;;;;;;;;end edit
    or      al,al
       jz      macro_line_processed
        ;;;;;;;;edit
        cmp     al,'{'
       je      increment_macro_depth_at_process
    ;;;;;;;;end edit
    cmp     al,1Ah
      je      process_macro_symbol
        cmp     al,3Bh
      je      macro_foreign_line
        ;;;;;;;;edit
      process_macro_line_element_finish:
          ;;;;;;;;end edit
    and     [macro_status],not 20h
      stos    byte [edi]
  cmp     al,22h
      jne     process_macro_line_element
      copy_macro_string:
  mov     ecx,[esi]
   add     ecx,4
       call    move_data
   jmp     process_macro_line_element
      ;;;;;;;;;edit
      decrement_macro_depth_at_process:
            dec     [macro_depth_at_process]
            jz      macro_line_processed
        jmp     process_macro_line_element_finish
      increment_macro_depth_at_process:
            inc     [macro_depth_at_process]
            jmp     process_macro_line_element_finish
      ;;;;;;;;;end edit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;line 2324
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      macro_block_processed:
    call    close_macro_block
   ;;;;;edit
   ;jc     process_macro_line
  jc      process_macro_line_again
    ;;;;;end edit
       pop     [current_line]
      add     esp,12
      pop     [macro_block_line_number]
   pop     [macro_block_line]
  pop     [macro_block]
       pop     [counter]
   pop     eax
 and     al,0F0h
     and     [macro_status],0Fh
  or      [macro_status],al
   ;;;;edit
    ;pop    [macro_depth_at_skip]
       pop     [macro_depth_at_process]
    ;;;;end edit
        ret
 ;;;;edit
      process_macro_line_again:
             inc     [macro_depth_at_process]
            jmp     process_macro_line
          ;;;;edit end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    


Description:
Download
Filename: preproce.inc
Filesize: 49.46 KB
Downloaded: 1918 Time(s)

Post 12 Apr 2009, 06:55
View user's profile Send private message Reply with quote
kempis



Joined: 12 Jun 2008
Posts: 49
kempis 12 Apr 2009, 07:15
I mean allowing nested { } without need to add backslash
Post 12 Apr 2009, 07:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.