flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > initialized locals

Author
Thread Post new topic Reply to topic
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
in proc locals/endl
Code:
proc someproc
locals
buf db dup 260 (?)
endl

ret
endp
    

buf gets initialized

_________________
Any offers?
Post 22 Mar 2009, 15:02
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7709
Location: Kraków, Poland
Tomasz Grysztar
It should be "260 dup (?)", not the other way, as you wrote.
And after this correction it works OK for me.
Post 22 Mar 2009, 17:09
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
Tomasz Grysztar wrote:
It should be "260 dup (?)", not the other way, as you wrote.

Yeah, my fault. My bad handwriting)
Tomasz Grysztar wrote:

And after this correction it works OK for me.

And now change "dup" to "DUP" and see what happen then.
I took no notice to upper case in my code and this was the reason that you got OK while i didn't.
How much time i asked for keywords are equal in both cases. Now got dup <> DUP. pity.

_________________
Any offers?
Post 24 Mar 2009, 11:32
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7709
Location: Kraków, Poland
Tomasz Grysztar
If you want to have uppercase DUP enabled for local macro, you need to modify deflocal@proc macro:
Code:
macro deflocal@proc name,def,[val]
 { common
    match vars, all@vars \{ all@vars equ all@vars, \}
    all@vars equ all@vars name
   forward
    local ..var,..tmp
    match =label,def \{ ..tmp equ \}
    match tmp,..tmp \{ ..var def val \}
    match ,..tmp \{ label ..var val \}
    match =?, val \{ ..tmp equ \}
    match any =dup (=?), val \{ ..tmp equ \}
    match any =DUP (=?), val \{ ..tmp equ \} ; add this line here
    match tmp : value, ..tmp : val
     \{ tmp: end virtual
        initlocal@proc ..var,def value
        virtual at tmp\}
   common
    match first rest, ..var, \{ name equ first \} }    
Post 24 Mar 2009, 11:41
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
I know i could but isn't it expected behavior when keywords are case insesitive? maybe some global fix'ing for them? Why you have such strick position relatively some uppercased keywords
Code:
proc p
local a:BYTE, but_not_byte:byte  ; error here
endp
    

and lowercased some other?
Maybe this some unspoken fasm rule? it's inconvenient to constantly check the case for keywords /either for macros or for [pre-]processor keywords/ especially when porting to fasm. The same with structures (macro) when only short (d*) data declaration allowed. Sometime mere struct porting takes time(
Post 24 Mar 2009, 11:54
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7709
Location: Kraków, Poland
Tomasz Grysztar
fasm preprocessor is case-sensitive and it's a spoken rule. The assembler used to be case-sensitive, too, but due to requests I changed it, though it's now creating a mess, as you see. Wink
Post 24 Mar 2009, 12:09
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
yeah, met some)
maybe inserting some {tmp = toLower(src)} to stage when labels/keywords are determined by comparison keywords to {tmp} have sense? Or smth alike? Then no fix'ation needed.
Post 24 Mar 2009, 12:23
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7709
Location: Kraków, Poland
Tomasz Grysztar
There's a better way to fix this one particular problem:
Code:
macro deflocal@proc name,def,[val]
 { common
    match vars, all@vars \{ all@vars equ all@vars, \}
    all@vars equ all@vars name
   forward
    local ..var,..tmp
    match =label,def \{ ..tmp equ \}
    match tmp,..tmp \{ ..var def val \}
    match ,..tmp \{ label ..var val \}
    match any =?, val \{ ..tmp equ \}
    match any (=?), val \{ ..tmp equ \}
    match tmp : value, ..tmp : val
     \{ tmp: end virtual
        initlocal@proc ..var,def value
        virtual at tmp\}
   common
    match first rest, ..var, \{ name equ first \} }    

Should work with all DUP variants (also "buf db dup 260 ?" which was not detected earlier).
Post 24 Mar 2009, 12:40
View user's profile Send private message Visit poster's website Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
Tomasz Grysztar wrote:
(also "buf db dup 260 ?" which was not detected earlier).

Of course it was my mistake:) And it shouldn't be right as you said in #2. I just wrote it here so, not copy/pasted the right version (with "DUP" that caused this thread).

_________________
Any offers?
Post 24 Mar 2009, 12:50
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7709
Location: Kraków, Poland
Tomasz Grysztar
Oh, I did mean "db 260 dup ?". Followed your mistake. Very Happy
Post 24 Mar 2009, 12:55
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-2020, Tomasz Grysztar.

Powered by rwasa.