Page 2 of 3

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:08 pm
by dronkit
search for keyboard in that last link

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:09 pm
by gtsphere
okay will do, thanks very much for giving me such a hand! ;D

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:10 pm
by dronkit
no prob

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:11 pm
by gtsphere
maybe its me, or maybe its because i'm tired, but why would they have the ability to enable an amount of RAM in the keyboard? heh

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:13 pm
by dronkit
just because of engineering errors and non-scalable designs.

AST said that if humans had been designed by intel, they would have a back-to-primate pin ;)

Re:boot0 step-by-step tutorial: Need comments

Posted: Mon Sep 23, 2002 9:14 pm
by gtsphere
lol

those sites you gave me are really decent, danke again for those

Re:boot0 step-by-step tutorial: Need feedback on this

Posted: Tue Sep 24, 2002 8:44 am
by dronkit
i'm very interested in code optimization.

...anyone... ? ;)

Re:boot0 step-by-step tutorial: Need comments

Posted: Tue Sep 24, 2002 9:55 am
by Pype.Clicker
gtsphere wrote: maybe its me, or maybe its because i'm tired, but why would they have the ability to enable an amount of RAM in the keyboard? heh
in fact, it's not in the keyboard: it's in a microcontroller that lies on the motherboard and that can be used to enable/disable some configuration lines (such as #reset, #A20 ...) on the processor, but which is also used to communicate using some serial protocol with your PS/2 keyboard/mouse etc.

That chip does a lot of miscellaneous work ...

Re:boot0 step-by-step tutorial: Need comments

Posted: Tue Sep 24, 2002 12:17 pm
by dronkit
oh... well, i knew it was in the motherboard. but i thought it was only used as keyboard controller + a20 line

Re:boot0 step-by-step tutorial: Need comments

Posted: Wed Sep 25, 2002 5:04 am
by Pype.Clicker
__
1. \______________________________________________

If you want to use a BPB, your initial jump *must* fit within 3 bytes, which means you'll have to do a double jump if you want to set up CS properly:

Code: Select all

jmp (short) start ;; will be assembled as an offset -> org-independent
nop
oem_vendor: must be at 03, not at 05!
 ...
fileSysType  :  FAT-----
start: jmp far 0x7c0:ready
ready: ;; let's get cracking
__
2. \______________________________________________

your stack setup seems weird to my sense ... why the hell do
you use 0x7bf rather than 0x7c0 ? are you aware this is only
16 bytes lower and that it won't prevent code trashing due to
stack overflow in any kind ? -- hum you seem to move the code.
forget about the overflow stuff ...

---> optimization notes <-----
according to the last documents i've read, xor reg,reg usually
don't pair and introduce more complex dependences due to
flags, etc. using mov reg, byte_constant_0 is usually a better
option.

__
3. \______________________________________________

If i get it correctly, your code could be used from a floppy disk
(as boot sector) as well as on a hard disk (on the MBR ?) where it can extract a list of active partitions and prompt the user for its boot choice (? la Lilo :) ...
Now, if you *do* use it as a MBR, remember that the MBR has no BPB, but instead it has a partition table ...
And if you put your sector as the bootsector of a partition, then it's likely that the system either has a single active partition or that the user has already been prompted for a choice ...

or did i get lost ?...

___
4. \____________________________________________

Maybe it's just due to the large amount of comments, but i
have the feeling that your code will lead to >512b ...

Re:boot0 step-by-step tutorial: Need comments

Posted: Wed Sep 25, 2002 6:21 am
by dronkit
Hello, thanks for your comments!

1) nah, i don't want to use a bpb. see that it is commented out. it's just there just to remember what the hell is a bpb ;)

2) i setup the stack like that because i want to ;) Besides, i saved one byte ;) anyway, if cs=07c0 ip=0 and ss=07bf and sp=ffff that sholud give my stack 64k free of use, right?

i use xor reg, reg because it is a 1-byte opcode. what did you read about it? (i've been using this "trick" since my days as a dos programmer)

3) you're right, that code wont fit on a hard disk mbr. i will eventually do an mbr version, this is intended for floppy only, and remember is just something i'm playing with ;)

4) right again, the code is almost 512 bytes. that's why i want to reduce code size. i saw many many source codes doing a lot more of what i do here... so...

thanks again for your comments.

take care

Re:boot0 step-by-step tutorial: Need comments

Posted: Wed Sep 25, 2002 6:44 am
by Pype.Clicker
dronkit wrote:
2) i setup the stack like that because i want to ;) Besides, i saved one byte ;) anyway, if cs=07c0 ip=0 and ss=07bf and sp=ffff that sholud give my stack 64k free of use, right?

take care

Code: Select all

        
       ._7c0:ffff___   linear: 17bff
       |_7bf:ffff___|    linear: 17bef (top of stack)
       |       |          |
       =      v         =
       |_7c0:200__|  7e00
       |  <code>    |
       |_7c0:0____|  7c00
it's unlikely that you could find 64K below your code (at 7c00) as this address is within the first 64K ...

Re:boot0 step-by-step tutorial: Need comments

Posted: Wed Sep 25, 2002 7:40 am
by dronkit
ooops... right.

how about setting ss=0 and sp=7c00 ?

Re:boot0 step-by-step tutorial: Need comments

Posted: Thu Sep 26, 2002 12:06 am
by Pype.Clicker
fine as long as you don't write over the IVT, Bios vars, etc.
you have the whole address space for yourself alone, why not to use ss=9000 & sp=fffe ? at least you're pretty sure it won't hurt .

Re:boot0 step-by-step tutorial: Need comments

Posted: Thu Sep 26, 2002 5:51 am
by dronkit
ok. i'll use absolute address 0x7c00.

thanks. anything else?