Page 3 of 4
Re:Enquiry
Posted: Mon Sep 05, 2005 11:41 am
by Kolusion
perhaps, but it ran by itself!!!
Re:Enquiry
Posted: Mon Sep 05, 2005 12:00 pm
by Kemp
I have no doubt that it did, well ok, one doubt: Your code does not include the boot sector signature, how was it accepted as valid by the BIOS?
Edit:
I do have to say though, if you can honestly say that you know what each line of that code does, how they work together and why they're necessary to achieve its end result and four hours before writing it you had never touched assembly before, then you are a rather quick learner.
Re:Enquiry
Posted: Mon Sep 05, 2005 1:22 pm
by Tora OS
Ah looks like some old builds of KOS i made. good times good times...
anyway....Printing a message does not mean it is an OS. It is a kernel though.
An OS is defined as:
"Software designed to control the hardware of a specific data-processing system in order to allow users and application programs to make use of it."
I dont think printing a message allows a user to make use of the hardware.
[hr]
Also..isnt a Cisco PIX Firewall 501 a little overkill?
Re:Enquiry
Posted: Mon Sep 05, 2005 1:27 pm
by Kolusion
I used this program to write to sector 1 of the a:
Its not that hard to learn code.
After looking at the parameters, I added them one at a time, and kept running the program, and watched for the differences it makes. From this I learnt what each code does, and now understand some basics. Its pretty simple actually, all logic. Just a matter of learning and coding.
Much time required. Years...
Yes, I see what you mean by non operating system.
Who cares, it runs by itself, that is all I was after. LOL
What do you mean by over kill?
Re:Enquiry
Posted: Mon Sep 05, 2005 1:30 pm
by Kemp
You didn't answer my boot signature question. Also, when you say parameters are you referring to the instruction operands or the instructions themselves?
Re:Enquiry
Posted: Mon Sep 05, 2005 4:57 pm
by JoshuaP
Kolusion wrote:
Its not that hard to learn code.

You have a good attitude, I'll give you that. However, writing software is a complicated process and it will take you some time to gain a feel for programming.
Good luck, but lose the arrogancy, it isn't helping you.
Re:Enquiry
Posted: Mon Sep 05, 2005 7:18 pm
by Brendan
Hi,
Kolusion wrote:Its not that hard to learn code.
That is quite correct - learning and writing code is easy. The hard part is writing good quality code that also happens to work on all 80x86 compatible computers with all their quirks.
For example, there's some Compaq computers that will refuse too boot if the first instruction isn't a jump (just like a large number won't boot if the boot signature isn't at offset 0x01FE in the boot sector). Also you shouldn't rely on the BIOS to leave DS (or ES, FS, GS) in a sane state, or expect the stack to be usable and where you want it.
Taking into account these things gives:
Code: Select all
org 0x7C00
jmp START
START:
cli
mov ax,0x0000
mov ss,ax
mov sp,0x7C00
sti
mov ds,ax
mov es,ax
Then a better knowledge of the 80x86 instruction set would help improve performance and reduce the code size. An small example here would be the "lodsb" instruction:
Code: Select all
mov si, msg
mov ah, 0x0E
cld
lodsb
print:
int 0x10
lodsb
test al,al
jne print
Kolusion wrote:From looking and running other peoples codes, I found there was much data that was not neccessary to be there. I found this inefficient and learnt I did not have to have it in mine.
Did you perhaps wonder why these other people spent time writing this extra code? One of the problems with 80x86 computers is that each computer is different - code that isn't needed on one computer may be required on another.
I must say though, in only 4 hours you've done quite well

. Now all you need is another 20 thousand or more lines of code...
Tora OS wrote:"Software designed to control the hardware of a specific data-processing system in order to allow users and application programs to make use of it."
I dont think printing a message allows a user to make use of the hardware.
How many OS developer's projects would currently satisfy this definition? I know that after over 10 years (part time) work, mine (or at least the current version) definately does not.
Cheers,
Brendan
Re:Enquiry
Posted: Tue Sep 06, 2005 12:55 am
by Solar
Brendan wrote:
Then a better knowledge of the 80x86 instruction set would help improve performance and reduce the code size. An small example here would be the "lodsb" instruction...
...which is 386 or higher. Perhaps he wanted to write a boot sector that works on a 286.

Re:Enquiry
Posted: Tue Sep 06, 2005 2:58 am
by bubach
LODSB ; AC [8086]
LODSW ; o16 AD [8086]
LODSD ; o32 AD [386]
Re:Enquiry
Posted: Tue Sep 06, 2005 3:40 am
by Pype.Clicker
First off, when I say I programmed an O/S, I was being technical...
It may be like 200 bytes, but HEY, it works, it does load, and these are the elements of an operating system.
I studyied parameters from many sources on the internet, and from little knowledge, I learnt more, example
Well, it looks like you have your first "hello world boot sector" done. Good. Just make sure you don't try to mess with the HDD's bootsector
You might like to get Ralf Brown Interrupt List so that you know all services that hides behind "int xx" instruction and maybe grab a good book about assembly programming in a local bookstore to know what else you could use (e.g. more registers, more instructions, more addressing modes, etc.) for less than 10 EUR.
Kolusion wrote:
I was wondering if anyone could give me some advice in where to start.
You might like the
"What should i do next" page of the FAQ ...
I suggest we end the
what is/is not an OS ..." here: we're all in 'early development" of the OS (and some still trying to have their kernel done). We're sounding like saying a builder that just packed three bricks together "nah, you're not building a house! that's just a minimal wall of three bricks!"
Re:Enquiry
Posted: Tue Sep 06, 2005 8:36 am
by Kolusion
Hi all,
Thanks for the feed back and opinions.
Already, alot of you have stated things what I do not understand at present.
I will be offline very soon because I am rebuild my PC, so I dont want to continue on learning until I'm relaxed, so I can focus.
When my system is to a state where I am satisfied in a couple of weeks, I will resume my programming basics.
Speak to you all in the future.
Bye!

Re:Enquiry
Posted: Tue Sep 06, 2005 3:01 pm
by Kemp
Ok, I may not have been the most diplomatic person here (in fact, I can guarantee that I wasn't), but that is just uncalled for. If you think this is so lame then just ignore it, it would take a lot less effort on your part and maybe you might do something productive? Just maybe?
(Moderator's note: Above paragraph refers to a deleted post. -- Solar)
Kolusion:
The fact that you have faced down our criticism is a good sign in regards to your will to achieve this, congratulations and I hope we haven't been too harsh in our tendency towards cynical realism. I hope the links and advice we have provided will prove useful to your learning when you return.
Re:Enquiry
Posted: Tue Sep 06, 2005 9:06 pm
by NotTheCHEAT
From looking and running other peoples codes, I found there was much data that was not neccessary to be there. I found this inefficient and learnt I did not have to have it in mine.
You are correct, but if you make a FAT12 bootloader you will need some data in there. This data is the Boot Parameter Block, or BPB, and it takes up quite a bit of space (at least, considering that you only have 512 bytes to begin with). If you don't have it, your disk will not be recognized properly by Windoze.
Also, as mentioned before, bytes #511 and #512 must be 55h and AAh, respectively. This is called the boot signature, and most (in fact, AFAIK all) BIOSes will not load your bootloader if there is no boot signature. Thus, you have to put that there as well. As for the Compaq computers which expect the first instruction to be a jump, this is OK. You should add it in to be compatible, even if your FS is not FAT (if you are using an FAT file system, the first byte HAS to be a jump, because it is followed by the BPB, which is followed by the code). A jump is only 2 or 3 bytes, and you have 510 bytes to work in (not including the boot signature bytes).
So in some cases, these people may be a bit more knowledgeable than you are, and it might be good to learn from them. And if you don't understand the code, first try RTFMing, and if you find nothing, ask us

If you're lucky, we'll know the answer, and tell you.
Re:Enquiry
Posted: Wed Sep 07, 2005 2:44 am
by Pype.Clicker
@NotTheCheat: the usual-and-ever-repeating balance between "flexibility" and "keep-it-stupidly-simple", i'd say.
@Kemp, regarding our own criticism: very true.
@Kollusion, if you're looking for "as simple as it can be" examples, you will like our
Baby Steps tutorial. It will show you a collection of bootsectors -- from the simplest to something that starts looking like a bootloader -- and will give you hints about good practice instructions / data that might look unneeded at first sight.
The danger with "remove what seems unneeded" approach is that you'll end up with a bootsector that runs on
your machine. Others machines might act differently and might not be as tolerant as yours is. So making a bootloader that runs everywhere requires actually more code than a bootloader for your own machine.
Re:Enquiry
Posted: Wed Sep 07, 2005 3:28 am
by AR
I'm afraid that for once I agree with "__pissed", it is blatantly impossible to go from HTML to assembly high flyer in a few hours unless he was some sort of genious. :-\
http://www.emu8086.com/assembly_languag ... al_11.html
Does the code example look familiar...? (Or
http://www.howtodothings.com/ViewArticl ... rticle=254, which includes rawwrite)
The only difference is the cold boot stuff is missing and the string being printed is changed. This seems more like someone who thought he was "hot stuff" but then being told he wasn't decided to post a couple of code examples from around the net to prove his 1337ness. ::) Unfortunately the forum seems to have made it easier since it ignores formatting outside of code tags.