Page 1 of 1

will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 2:30 am
by extremecoder
I am into stage2 devel ... i have a string something like below:

stage2string db "loading stage2 ...", 0

the problem is, when I include too much of characters into this string like:

stage2string db "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa loading stage2 ...", 0

the other strings defined below are getting overwritten, or not loading stage3 itself ...

what could be the reason ?

Re: will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 2:39 am
by kmtdk
well
waht compiler are you using, and what is the other instruction
and how are your "adressing" ( direct, or labels)

because normaly it is supossed to move the code, and not overwrite it.


KMT dk

Re: will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 2:53 am
by extremecoder
i am using nasm for assembling ...

I use si register for printing ...

mov si, dispstring
call printstring

...

also if I define more strings, just below " string db "stage2 loading ...", ", the same problem happens ... something is overwriting the values...

Re: will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 3:25 am
by AJ
Hi,

Could it be that you are only loading a set number of sectors and extending the string pushes something over the sector boundary?

Cheers,
Adam

Re: will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 4:24 am
by extremecoder
these are my specs ...

stage1 - 512 bytes - sector 1
stage2 - 1536 bytes - sector 2,3,4
stage3 - 512 bytes - sector 5

the stage2 size is in between 1024-1536 .. rest i am padding with TIMES ... this is a very peculiar problem I am facing ...
all unexpected outputs I am seeing ... for example expected stage2 should be like this ...

stage2 loaded.
es = 0x10000
ss = 0x10000
ds = 0x10000

loading stage3 ...
stage3 loaded

but then I change the dispstring db in stage2 code to include more characters, it's displaying like this

es = 0x&312
ss = 0x&312
ds = 0x&312

sometimes it loads the stage2 again and prints it !!!

Re: will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 4:35 am
by extremecoder
i tried disabling the stage3 loading code ... but now it's loads stage2 once again and prints ...
i checked with sector loading code and addresses ...

Re: will 'db' overwrite other areas ?

Posted: Mon Apr 27, 2009 10:46 pm
by extremecoder
i found at the problem, but not able to understand why it's happening ...

the first four lines of my stage2 loader is :

mov ax, 0x1000
mov ds, ax
mov es, ax
mov ss, ax

when I remarked the "mov ss, ax" line, it's working quite fine ...
i know ss and ds falling in same address might create a problem ...
how the ss should be placed in stage2 loader ?

Re: will 'db' overwrite other areas ?

Posted: Tue May 05, 2009 9:46 am
by Combuster
counterquestion: what is SS used for, where do you want that to be?