boot0 step-by-step tutorial: Need comments
Re:boot0 step-by-step tutorial: Need comments
okay will do, thanks very much for giving me such a hand! ;D
Re:boot0 step-by-step tutorial: Need comments
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
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
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
lol
those sites you gave me are really decent, danke again for those
those sites you gave me are really decent, danke again for those
Re:boot0 step-by-step tutorial: Need feedback on this
i'm very interested in code optimization.
...anyone... ?
...anyone... ?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:boot0 step-by-step tutorial: Need comments
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.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
That chip does a lot of miscellaneous work ...
Re:boot0 step-by-step tutorial: Need comments
oh... well, i knew it was in the motherboard. but i thought it was only used as keyboard controller + a20 line
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:boot0 step-by-step tutorial: Need comments
__
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:
__
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 ...
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
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
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
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:boot0 step-by-step tutorial: Need comments
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
Re:boot0 step-by-step tutorial: Need comments
ooops... right.
how about setting ss=0 and sp=7c00 ?
how about setting ss=0 and sp=7c00 ?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:boot0 step-by-step tutorial: Need comments
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 .
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
ok. i'll use absolute address 0x7c00.
thanks. anything else?
thanks. anything else?