News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Weird bug when decalring data

Started by donkey, February 27, 2009, 12:02:20 AM

Previous topic - Next topic

donkey

Hi Jeremy,

How's this for weird.

TestStuff.asm (note this is the whole file, no includes)

DATA SECTION
hInstance DD ?
WhatTheFu holycow WhatTheFlock

CODE SECTION
Start:
mov eax,[WhatTheFu]
ret


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

>go.bat

>C:\Programming\GoAsm\BIN\GoAsm.EXE "TestStuff.asm"

GoAsm.Exe Version 0.56.4n - Copyright Jeremy Gordon 2001/9 - JG@JGnet.co.uk
Output file: TestStuff.obj

>C:\Programming\GoAsm\BIN\GoLink.EXE /entry Start  "TestStuff.obj"

GoLink.Exe Version 0.26.10 beta3- Copyright Jeremy Gordon 2002/9-JG@JGnet.co.uk
Output file: TestStuff.exe
Format: win32 size: 1,024 bytes


I noticed this when I declared a GUID whose definition was in a header file I forgot to add to a project. GoAsm just filled the GUID with zeroes and continued on oblivious to the fact that the definition was wrong.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

jorgon

Hi Edgar

Yes this is because each of

WhatTheFu
holycow
WhatTheFlock

are regarded by GoAsm as data labels.  They are regarded as data labels because they are not found as anything else (they are not declarations of data, macros, equates, or definitions so they must be mere labels).

Hence the reference to WhatTheFu is valid (as a reference to a data label).

In GoAsm, you can have a data label (or code label for that matter), without having to follow the label with anything in particular.
And you can have as many data labels as you like at the same address.  This is useful if you want to have different names for a particular place in data, or particular piece of code.
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

donkey

Thanks Jeremy,

That explains it nicely, good feature actually. I am sure I can make use of it somewhere.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable