Page 1 of 1

Something about windows MBR

Posted: Tue Jul 04, 2006 4:11 am
by nirvana111
0AEC:0100 33C0 XOR AX,AX
0AEC:0102 8ED0 MOV SS,AX
0AEC:0104 BC007C MOV SP,7C00
0AEC:0107 FB STI
0AEC:0108 50 PUSH AX
0AEC:0109 07 POP ES
0AEC:010A 50 PUSH AX
0AEC:010B 1F POP DS
0AEC:010C FC CLD

hello every, i'm new to os.i hope all you can help me,thanks...

the code above is windows mbr begin code. the answer i want to know is
why use STi before Push ax pop es push ax pop ds.

Posted: Tue Jul 04, 2006 10:04 am
by JAAman
generally it is a good idea to always have interupts enabled as much as possible

therefore, before doing anything that doesnt require interupts to be dissabled, they make sure they are

if this is at the begining, do not assume interupts are enabled when the bootsector is called -- its not required, so the MBR is making sure by enabling them itself


just a guess, been a long time since i looked at the MBR ASM, and you didnt give much context


btw:
your formatting indicates that your using debug to unasseble it?
it might help if you loaded it to the same address it expects to be at before (U)nassebling -- also be aware -- debug is not aware of the 386 extensions -- therefore, it may not always unassemble correctly -- as most of those instructions work just fine in RMode (though it will usually be obvious as there will be a data byte in the instruction stream -- but instructions beyond that cannot be relied on, as overrides will alter the length and operation of the following instruction)

Posted: Tue Jul 04, 2006 6:02 pm
by nirvana111
JAAman, thanks for you advise.

Re: Something about windows MBR

Posted: Tue Jul 04, 2006 6:26 pm
by AndrewAPrice
nirvana111 wrote:the code above is windows mbr begin code. the answer i want to know is why use STi before Push ax pop es push ax pop ds.
Don't loose sleep over it, it's Microsoft after all.

Posted: Tue Jul 04, 2006 9:49 pm
by nirvana111
MessiahAndrw, what does "loose sleep over it " mean? i'm sorry.

Posted: Wed Jul 05, 2006 8:20 am
by carbonBased
It's just an expression that means, "don't worry too much about it" or "don't over-think it."

Along those lines, anyway.

--Jeff

Posted: Wed Jul 05, 2006 5:46 pm
by nirvana111
Thank you, carbonBased.