flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Label, structure bugs??

Author
Thread Post new topic Reply to topic
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
Hi Privalov!

I have a bigger asm project with FASM. Currently I need to use plently of different variables. I have noticed that when I'am having plenty of variables defined and used I'am starting to have strange behaviour with FASM. The same problem has happend with structures.

The problem is that variables seem to 'lose' their correct values. Sad

eg. mov dword[my_variable120],10

Aftewards (=while I'am using previously defined variable) it appears that the actual value could be ie. 0 or something else.

Is there somekind of limit with maximum amount of labels? and what about similar strange behaviour with structures?

regards,
Mac2004
Post 17 Nov 2004, 06:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17473
Location: In your JS exploiting you and your system
revolution
I think the limit is the memory in your system, but if it is a limit you are reaching then your should get out of memory errors not what you have above.

If what you say is indeed correct, then problems like this could be caused by use of a variable that is not properly initialised.

To track down problems like this usually requires a little more information like the full source code, operating system you are using, list of other programs you may be running at the same time and exact steps of how to reproduce the problem.
Post 17 Nov 2004, 08:16
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
is this problem repeatable? If yes then post the source and show where the bug happens
Post 17 Nov 2004, 11:02
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
The project which I'am referring to is my own OS. I'am using fasm under DOS and write my results to floppy disk with John Fine's partcopy. I will submit those parts in question of source for others to test whether they get same results.

regards,
Mac2004
Post 17 Nov 2004, 16:53
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
Here is the source which I'am referring to. It must be tested under protected mode because it's 32bit code. I think the main point is to test whether you guys encounter same problems with many labels /structures defined and used.
You may need to add more window structures to test it properly. (just copy&paste and change winXX values)

The actual source is enclosed as zip packet.

regards
Mac2004


Description:
Download
Filename: label.zip
Filesize: 12.08 KB
Downloaded: 530 Time(s)



Last edited by Mac2004 on 19 Nov 2004, 06:11; edited 1 time in total
Post 18 Nov 2004, 06:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17473
Location: In your JS exploiting you and your system
revolution
Does not assemble:

Code:
flat assembler  version 1.56
label_code.asm [1342]:
        cmp dword[Grp_screen_dimen.BitPlaneNumber], 16
error: undefined symbol.
    
Post 18 Nov 2004, 08:43
View user's profile Send private message Visit poster's website Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
Oh, there's one structure definition missing from my source Sad . I will update the source and notify you guys!

Mac2004
Post 18 Nov 2004, 09:43
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
The source is updated and tested to compile as stand alone file. Smile

Mac2004
Post 19 Nov 2004, 06:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17473
Location: In your JS exploiting you and your system
revolution
If you want you can test for yourself with this batch file. It compares the generate code after each assembly and stops if a difference is found.

Code:
@echo off
\assemble\fasm\fasm label_code.asm label_code_ref.exe
if errorlevel 1 goto end
:try
\assemble\fasm\fasm label_code.asm label_code.exe
if errorlevel 1 goto end
fc /b label_code.exe label_code_ref.exe
if not errorlevel 1 goto try
:end
    


I ran it for a while and found no differences using the win32 console version.
Post 22 Nov 2004, 04:13
View user's profile Send private message Visit poster's website Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
I need to explain a little bit more of the problem. The problem is that after having initialized 10 or more window structures it appears that values are not set properly. First 9 window structures work fine and the values are set correctly. I can verify that by printing the results onto screen.

Problems start when I'am adding more window structures and those values are faulty. The code is the very same code for each window except that winXX labels are set to correspond current window number. I think it might have something to do with the fasm label handling mechanism.

You need to print those values to see what's really inside. I think comparing compile results will not show the actual problem because it's the contents which is not correct. And the problem will arise after having initialised plenty of variables.

Mac2004


Last edited by Mac2004 on 22 Nov 2004, 17:07; edited 1 time in total
Post 22 Nov 2004, 08:45
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17473
Location: In your JS exploiting you and your system
revolution
Do you think the compiler is generating the wrong code?

If that is true then with a debugger you should be able to pinpoint the place where the error is located.

Try to use the 'display' directive if that can hep you. Also, try dissassembling the assembled code and compare to your original.
Post 22 Nov 2004, 10:02
View user's profile Send private message Visit poster's website Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
That might be possible. It's strange to have working code for 9 first window structures and after adding more identical structures and their initialiazation procedures have someway faulty results.

Mac2004
Post 22 Nov 2004, 14:35
View user's profile Send private message Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin
Do you use OWN_DC flag in definition of window class? If not you can't create more than 8-9 device contest simultaniously. You must either use OWN_DC flag or allocate only 1 device contest at every moment (in painting procedure i think).
(It is common problem when you write MDI applications Smile
Post 24 Nov 2004, 07:52
View user's profile Send private message Visit poster's website Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
I'am writing my own OS by using DOS version of fasm. So no Windows stuff is used. These structures are completely of my own and all results are compiled to plain binary form. This project avoids windows because it's impossible to compile and write own OS to disk under windows. Confused Thanx for help anyway Smile

Mac2004
Post 24 Nov 2004, 08:41
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
I think I have found the problem. It's probably not caused by Fasm at all, but some not so easily visible bugs in my source. Those bugs didn't show any signs just after executing rhe code. After writing a little bit more new code previous bugs started show their existance. I managed to remove those and variables are working ok!

Debugging isn't allways so easy!!! Crying or Very sad

Thanx foe helping me out! Laughing

regards,
Mac2004
Post 29 Jan 2005, 14:41
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 YouTube, Twitter.

Website powered by rwasa.