System resets if i initialize the stack segment in pmode

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.
ggodw000
Member
Member
Posts: 396
Joined: Wed Nov 18, 2015 3:04 pm
Location: San Jose San Francisco Bay Area
Contact:

Re: System resets if i initialize the stack segment in pmode

Post by ggodw000 »

iansjack wrote:
Brendan wrote:You'd want to obtain "SimNow debugger"
The debugger is built in to SimNow and offers very comprehensive facilities for debugging.
still exploring, hopefully i can get more out of this tool.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
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: System resets if i initialize the stack segment in pmode

Post by Combuster »

ggodw000 wrote:Secondly, whynot just tell me what i am missing then
ggodw000 wrote:bochs (...) never worked.
Do you honestly believe that allows anybody to give you an exact answer? Not reading the manuals seems to extend to not reading the smart questions forum rule in this context.

And yes, I've seen your other thread. Have you seen the replies?
"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 ]
ggodw000
Member
Member
Posts: 396
Joined: Wed Nov 18, 2015 3:04 pm
Location: San Jose San Francisco Bay Area
Contact:

Re: System resets if i initialize the stack segment in pmode

Post by ggodw000 »

Been away for sometime, hopefully will get back on this soon.

but last time, i decided to look at bit diff angle:
one thing i notice is that I did not setup SS during when I launch from DOS, so it must be using whatever stack DOS prepared before launching?

Anyways i did initialize stack segment:

Code: Select all

mov ax, STA
mov ss, ax
mov sp, 100h ( size of stack segment ).
Weird thing is if I did run the binary from DOS, stack segment values are as if it is not initialized at all. (it is not the value of the stack segment)
Now I run with GRDB debugger, than I see STACK segment is initialized with the STACK segment.

That is bizarre, it is as if, one line of code mov ss, ax is completely skipped, but if my memory recalls I think I have encountered this before.

I am working underway to make it directly bootable from disk, so that it wont depend on bios, i am guessing it involves probably at least writing some sort of video driver and some fat32 driver.
Last edited by ggodw000 on Mon Jan 11, 2016 5:33 pm, edited 2 times in total.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: System resets if i initialize the stack segment in pmode

Post by iansjack »

So you move ax to the ss register, you then immediately move 100h to the ss register, and you ask why the mov ss, ax seems to be ignored.
ggodw000
Member
Member
Posts: 396
Joined: Wed Nov 18, 2015 3:04 pm
Location: San Jose San Francisco Bay Area
Contact:

Re: System resets if i initialize the stack segment in pmode

Post by ggodw000 »

iansjack wrote:So you move ax to the ss register, you then immediately move 100h to the ss register, and you ask why the mov ss, ax seems to be ignored.
my bad, typo. Actual code doesnt have this type. Fixed the post too.

Code: Select all

mov sp, 100h
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Re: System resets if i initialize the stack segment in pmode

Post by Techel »

Dos sets the stack pointer to the end of program's segment, to 0xFFFE. At least when executing com files.
Post Reply