View Single Post
Old 16 May 2019, 07:36   #30
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by Photon View Post
Meynaf, I agree it would be "awesome if true", but I'm open and looking for facts. If it's possible, someone should be able to post a smaller size together with 1) Assembler, 2) settings, and 3) OS compatibility.

The code snippet is made so that it shows what putting DS in your source means to the combination of these 3 things.

And this is why Antiriad_UK posted, at least I read it as he wants to know what happens. (The statements in the manuals I already answered in my 2nd post, but we all seek knowledge.)
You keep looking for mysteries where there is none. The situation is really very simple. It's not "awesome if true", it's simply true.

Regardless of settings, PhxAss will always zero DS.x outside of BSS. Most assemblers, except maybe the really broken ones, also will.
Regardless of the assembler and settings, the OS will always zero true BSS sections and only 1.x will not zero bss part of CODE/DATA sections.
What's not clear in that ?


Quote:
Originally Posted by Kalamatee View Post
If it helps - don't think of ds.x in terms of how it is stored on disk, just in how it is used in memory. unless you explicitly ask for it to be put in a section on disk, the assembler/compiler/linker will "optimize" its location based upon how it is actually used, and you should always expect ds.x to have an uninitialized value.

e.g. If the compiler/assembler/linker in question decides it saves more space/performs better to use a shorter addressing mode and localize the data represented by ds.x, it will store it in the same section using those preferred instructions. when this is now loaded by the os the value is "uninitialized" and could contain anything.
While a compiler may eventually perform this kind of thing, an assembler will not do a thing "upon how it is actually used"...


Quote:
Originally Posted by Kalamatee View Post
the result also being A0 _could_ contain a random value but A!/A2 will contain 0 when loaded by the OS.
What is pointed to by A0 (not A0 itself !) contains 0, not a random value.
I don't know of an assembler that would do otherwise.


Quote:
Originally Posted by Don_Adan View Post
Every good assembler (used by me) zeroed ds.x area.
But assemblers different handles f.e next code:
rts
cnop 0,4
rts

in cnop 0,4 place, I see 3 types:
1. dc.w 0

2. nop

3. dc.w $xxxx (random value)
PhxAss has the option to use either 0 or nop padding.
And every good enough assembler should be more or less similar.
meynaf is offline  
 
Page generated in 0.04705 seconds with 11 queries