will 'db' overwrite other areas ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
extremecoder
Member
Member
Posts: 59
Joined: Tue May 23, 2006 11:00 pm

will 'db' overwrite other areas ?

Post 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 ?
User avatar
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

Re: will 'db' overwrite other areas ?

Post 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
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
extremecoder
Member
Member
Posts: 59
Joined: Tue May 23, 2006 11:00 pm

Re: will 'db' overwrite other areas ?

Post 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...
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: will 'db' overwrite other areas ?

Post 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
extremecoder
Member
Member
Posts: 59
Joined: Tue May 23, 2006 11:00 pm

Re: will 'db' overwrite other areas ?

Post 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 !!!
extremecoder
Member
Member
Posts: 59
Joined: Tue May 23, 2006 11:00 pm

Re: will 'db' overwrite other areas ?

Post 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 ...
extremecoder
Member
Member
Posts: 59
Joined: Tue May 23, 2006 11:00 pm

Re: will 'db' overwrite other areas ?

Post 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 ?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: will 'db' overwrite other areas ?

Post by Combuster »

counterquestion: what is SS used for, where do you want that to be?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply