flat assembler
Message board for the users of flat assembler.

Index > Main > db 1000 dup ? (2 passes 5 bytes)

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

sorry to create a topic for this,
but I'd like to have the view and Tomasz explanation about this.
Code:
xor al,al
mov [bop-1],al
toto db 1000 dup ?
bop:
    

2 passes 5 bytes Shocked

why "5 bytes" and not 1005 bytes ?


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 28 Oct 2010, 16:35
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
Because you used "?" for your data.

Try this instead:
Code:
xor al,al
mov [bop-1],al
toto db 1000 dup 0
bop:    
Post 28 Oct 2010, 16:37
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
ouadji,

? in any data defining directive (and couple of it for reserving directives) says to fasm that you don't care about their values. They do take their toll in VirtualSize of corresponding section and in SizeOfCode/Data/Image for PE; MZ Exe header also takes them in account, but for plain binary they're lost.
Post 28 Oct 2010, 16:46
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

Quote:
They do take their toll in VirtualSize of corresponding section and in SizeOfCode/Data/Image for PE;
MZ Exe header also takes them in account,
but for plain binary they're lost.
ok, understood, thank you baldr
(and revolution too)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 28 Oct 2010, 16:58
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
Have you ever wondered, why some fasm's DOS examples (like LIFE or MANDEL, or DEVICE) put the uninitialized data exactly at the end of source? The answer lies there.
Post 28 Oct 2010, 19:28
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
.data vs. .bss, initialized vs. uninitialized, etc. etc.
Post 30 Oct 2010, 22:37
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
i do not understand
Code:
;1 pass(es), 4 byte(s)
;dw ?,0 


;1 pass(es), 2 byte(s) 
;dw 0,?
    
Post 01 Nov 2010, 17:51
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
That happens because you can't have holes in your binary, so when you have initialized data that comes AFTER uninitialized data, then the uninitialized data will also have to be outputted into the file as zeros (or NOPs if the uninitialized part was an "align".)
Post 01 Nov 2010, 18:02
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.