flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > my version of the proc macro

Thread Post new topic Reply to topic

Joined: 06 Jan 2005
Posts: 87
I´ve written my own version of the proc macro, but this was with the older version of the preprocessor. A little bit of the code is from this forum here, but I don´t really know what this code should do and this is also the code which now doesn´t work.

This is the code which doesn´t work:
macro RestoreEx [name]
                macro rstr#name _% RESTORE name %_
                macro rstr _% %_
                purge rstr,rstr#name

_% fix {
%_ fix }
restore fix RestoreEx

And this is my proc, begin and end macro:
macro proc name,[arg]
        if used name
;               prog_args fix arg
        if ..OPEN > 0
                display "ERROR: no endp before proc",13,10
                ..OPEN= 0
        end if
                ..OPEN= ..OPEN+1
        if ~ arg eq
                virtual at ebp+8
                local ..arg
                ..arg dd ?
                arg equ ..arg
                end virtual
        end if
                ..LOCALS= 0
                align 16

macro begin
        if ..OPEN <> 1
                display "ERROR: begin without proc",13,10
        end if
                push ebp
                mov ebp,esp
        if ..LOCALS > 0
                sub esp,4*..LOCALS
        end if

macro endp
                ..OPEN= ..OPEN-1
        if ..OPEN <> 0
                display "ERROR: endp without proc",13,10
        end if
;               restore proc_args
        end if

The commented code is not working anymore and what it should it do? Do I need this code or can I use these macros w/o them?
Post 18 Jun 2005, 09:17
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7312
Location: Kraków, Poland
Remove the RestoreEx definitions and the "fix" definitions following it, instead of "proc_args fix args" use "proc_args equ args", and instead of "restore proc_args" use this line:
match args, proc_args \{ restore args \}    
Post 18 Jun 2005, 10:50
View user's profile Send private message Visit poster's website 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-2019, Tomasz Grysztar.

Powered by rwasa.