flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Help with 'defined', please

Author
Thread Post new topic Reply to topic
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk
Code:
if defined Teste
        display 'Defined' , 13 , 10
else
        display 'Not defined', 13 , 10
end if
Teste: dd 5
    


is displaying 'Not defined'. Shouldn't it display 'Defined'?

Code:
Teste: dd 5
if defined Teste
        display 'Defined' , 13 , 10
else
        display 'Not defined', 13 , 10
end if
    


This one displays 'Defined'. Shouldn't both of them display the same result?

Thanks for yur help.
Post 18 Jan 2007, 11:39
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
first one really should display 'defined'.

But this might be to some specific behavior of "display", try doing something else, like:
Code:
if defined X
db 1
else
db 2
end if
X:    

and, then look at resulting file with hexeditor to see if byte 1 or byte 2 was defined.
Post 18 Jan 2007, 11:49
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk
I tried using the 'defined' in order to create extrn or public definitions for the label, but I need this definition to be made before the label definition. The problem is, it's behaviour is exactly like the expected from the display macro.

I also suppose that, if the display macro wouldn't work with it, it would either display both lines, or none of them.
Post 18 Jan 2007, 12:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Hey, what are you talking about? I tried your first example, and it displayed "Defined". Next time at least try code before stating what it does!
Post 18 Jan 2007, 12:33
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7795
Location: Kraków, Poland
Tomasz Grysztar
As for using the "defined" for the problem of creating "extrn" or "public" definitions, see the answer to 6th question in FAQ.
Post 18 Jan 2007, 12:36
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
tomasz: by the way, is Q/A about fixed-base PEs still valid? (the one before last in FAQ)
Post 18 Jan 2007, 12:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7795
Location: Kraków, Poland
Tomasz Grysztar
No, not really.
Post 18 Jan 2007, 14:12
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
how about placing "if ~defined" problem there instead? Wink
Post 18 Jan 2007, 14:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7795
Location: Kraków, Poland
Tomasz Grysztar
This one is ine the manual.
Post 18 Jan 2007, 14:34
View user's profile Send private message Visit poster's website Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk
Here is the answer from my building environment (VC 2005, using the VC preprocessor before FASM building process)...
Code:
Build Log      Build started: Project: Win32, Configuration: Debug|Win32
 Command Lines      Creating temporary file "r:\Asm\AsmBaseLib2\Solution\Win32\Debug\BAT00000117481840.bat" with contents
[
@echo off

"R:\Asm\AsmBaseLib2\AsmBuild.bat" "Base.fasm" "Base.i" "Debug\Base.obj" 

if errorlevel 1 goto VCReportError

goto VCEnd

:VCReportError

echo Project : error PRJ0019: A tool returned an error code from "Assembling"

exit 1

:VCEnd
]
Creating command line "r:\Asm\AsmBaseLib2\Solution\Win32\Debug\BAT00000117481840.bat"
 Output Window      Assembling
Pre-Pre-Processing...
1: "Base.fasm"
2: "Base.i"
3: "Debug\Base.obj"
r:\Asm\AsmBaseLib2\Solution\Win32
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.
Base.fasm
Assembling...
flat assembler  version 1.67.7  (300869 kilobytes memory)
Defining symbol as extrn
Offset para x:12
Not defined                                               <=== NOT DEFINED!!!
Inicializando VirtualTable para JRBBase
InitVirtualTableLst JRBBase
Base.i [973]:
ClassEndCode
Base.i [866] ClassEndCode [1]:
  InitVirtualTable a_strClass
Base.i [200] InitVirtualTable [3]:
  InitVirtualTableLst a_strClass , t_astrList
Base.i [190] InitVirtualTableLst [6]:
   a_strClass#_PVTABLE :
error: symbol already defined.
Project : error PRJ0002 : Error result 2 returned from 'C:\WINNT\system32\cmd.exe'.
 Results      Build Time 0:00
Build log was saved at "file://r:\Asm\AsmBaseLib2\Solution\Win32\Debug\BuildLog.htm"
Win32 - 1 error(s), 0 warning(s)
    


The only 'Not defined' display I have is in that piece of code that is in this thread's start.
As for the 'symbol already defined.' problem, it is happening because I can't seem to use if defined , and then he tries to place the label as 'extrn'.

I would gladly upload the file, but I am not beeing able to run scripts in this reply page; I keep getting 'Object expected' error (otherwise I would upload the source file and the .html generated from the build).

Thank you all for your help on this.
Post 18 Jan 2007, 14:57
View user's profile Send private message Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk
By the way, just tried

if ~defined Teste
display 'Not defined', 13 , 10
else
display 'Defined' , 13 , 10
end if
Teste dd 5


and I still get 'Not defined' in the output.
Post 18 Jan 2007, 14:59
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
This one is ine the manual.

what do you think FAQ stands for? it CAN be mentioned on multiple places.

jbojarczuk: The problem you mentioned doesn't exist. Code example you posted work as it should. Problem is probably elsewhere. Best would be, if you could post complete source that goes to FASM, and point out the problem there.
Post 18 Jan 2007, 15:05
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
offtopic: Why all the code block of jbojarczuk are shown as normal text instead of code block? I tested copying and pasting his post and then previewing them and works fine :S
Post 18 Jan 2007, 15:44
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
[/url]tags sometimes bitch up too... i quess just some bug in phpBB
Post 18 Jan 2007, 16:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
aaaarrggghh, perhaps he is using "Disable BBCode in this post" or he has "Always allow BBCode" on his profile set to off?
Post 18 Jan 2007, 17:20
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
seem to be second one... and same for smileys. i have fixed these two posts.
Post 18 Jan 2007, 17:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk
Hi everybody,

Since I have not been able to attach the file in this thread, I created another one in order to make the file available - (Help with 'defined', please 2).

offtopic: thanks for the tip, LocoDelAssembly. Got my profile corrected.
Post 18 Jan 2007, 17:39
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.