This is not a shell! It is a real OS that will boot from a floppy disk! It is not written in Visual Basic but it does clear up all the mystery that ''newbies'' seem to have with Shell's and Operating Systems - yes you've all seen those ''not really an OS but a shell - OS'' submissions. Anyway, it's a good article I think. I spent a bit of time on it, and I hope you enjoy it :)
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
Although this article does not contain Visual Basic code, I
would appreciate it if you did not flame me. It does provide some useful
information and I believe is relevant to you as a programmer for the following
two reasons:
- In the VB section I see far too many “Operating System”
attempts by the new programmers – You know who you are. For those, I will try
to explain exactly why Visual Basic can not be used to implement an operating
system and I will also show you what the start of a real operating system looks
like. Although you may not understand much of the technical information, you
should by the end of this, have a clear idea of the difference between an
operating system and a shell and also some of the functions performed by the
operating system.
- For the experienced programmer who have never tried OS
development before, this may prove an interesting read. With a deeper
understanding of the underlying OS functions and the internal workings of the
kernel, you may gain a deeper understanding of how software actually works
within the context of an Operating System. With this knowledge you can increase
your programming skills and better optimise your code.
Assembly Language
It would be a good advantage if you understood and could use
assembly language but for those who don’t, here are some of the very basics:
Instruction/Op Code – The processor can only
handle single tasks at a time such as adding two numbers or incrementing a
value. Each of these is called an instruction or an op code. Each instruction
takes up one byte in memory (although the operands add to this). This is how
programs are stored in memory and each time the CPU clock ticks, the next
instruction is fetched and executed by the processor.
Register – This is a small section of memory that
resides on the actual Motherboard. The CPU uses registers to return values to
programs; Programs can use them as temporary storage areas like variables and
can also set values into registers in order to get certain instructions
functioning as desired (like arguments/parameters). There are 4 main 32 bit
registers (eax, ebx, ecx, edx) which can be decomposed into the Low Word –
lower 16 bits (ax, bx, cx, dx). Each of these 16 bit registers can be further
decomposed into their Low and High byte (8 bit) registers (ah, al, bh, bl, ch,
cl, dh, dl). Consider the following diagram of the eax, ax, ah and al
registers.
These are all stored within the eax register. So a change to
the al register will also change ac and eax. A change to eax will change all of
the above registers.
Mnemonic – A mnemonic is simply a friendly name for
each instruction (see above). The instruction for adding a value to the bx
register (see above), is 01 in hex (hexadecimal). We represent this in assembly
language as ”add bx”. The mnemonic is “add” which is much easier to understand
and program in than the hex version.
Assembler – The purpose of the assembler is to
convert each instruction we write using a mnemonic, to the version that the CPU
understands – Hex code.
Here is a small example of a program written in assembly
language (note the semi colon used for commenting in assembly). The purpose of
this program is to print all 256 ASCII characters to a console Window.
<--[if gte vml 1]>
movdl, 0;dl register = 0
Start: movah, 2;ah
register = 2 (start of loop too)
int 21h;Software interrupt 21h (DOS Output)
incdl;Increment dl register by 1 (see note)
jnz Start;When dl is 0, jump to Start
Ret;Return
Note about “inc dl” instruction: dl is a one byte (8
bit) register. When the inc instruction tries to increment it past 256, it will
be 0 again. The conditional jump only goes back to the start when it is not 0.
So once the program tries to increment it past 256, it will be set to 0 and
thus not satisfy the conditional jump. The ret instruction is reached and
execution ends.
In machine code (HEX) it looks like this:
<--[if gte vml 1]>
b2 00 b4 02 cd 21
fe c2 75 f8 c3
If you are very good like me (J) then you can convert
that simple program without the use of an assembler. If you can’t though, then
use an assembler (I included the small NASM assembler in the download). To
assemble it, simple type the above code into a text editor (must be ASCII –
That means no Word) , save it, and change the extension to .ASM. Place the ASM
file in the same directory as the NASM assembler; open up a DOS console Window
and type the following commands:
<--[if gte vml 1]>
CD
NASM –f bin
.asm
REN
.asm .com
.com
I think that is enough on the assembly language lesson. Now
let us move on to the operating system stuff.
What is a Shell?
This is one of the main things I wanted to talk about. Like
I said in the introduction, many “newbies” write small Shells in Visual Basic
and then call them operating systems. Then they are surprised when they get
flamed for misconception. I will explain here what a shell actually is then
later what an operating system actually is.
So what is a Shell? Simply, a Shell is the interface between
the user and the operating system that allows the user to easily use the
functions of the operating system. A Shell is usually made up of some kind of
desktop that contains icons representing programs, documents and other files.
The shell also provides some kind of explorer that allows the user to browse
their partitions and drives, and the directories, files and programs within
them. The shell usually contains some kind of control panel, which allows the
user to configure the system in many ways.
Shells use the API library, which is part of the operating
system, to do all of the things like accessing files and keyboard input. I have
seen Shell’s written before in Visual Basic that attempt to create a file
system. Of course they use the existing file system within the operating system
and just make a large, memory consuming, slow, pointless file system that
relies on the Operating Systems one anyway.
So what does an Operating System do?
Without a shell, an Operating System would just appear to
the user as a black screen that appears to do nothing. The operating system
runs in the background. The purpose of the shell is to display and interface on
the screen, not the Operating System.
Most modern Operating Systems perform the following
functions
Multi Tasking/Threading – Multi-tasking operating
systems will decide which order to execute programs in and how much time should
be given to each program before moving onto the next. It will give the illusion
that all programs are running simultaneously
Memory Management – The operating system will make
sure that applications may only write to their own address spaces, keep tabs on
the amount of free memory and memory usage, and also make sure that nothing can
overwrite the Operating System itself (in memory).
Hardware Input/Output – The Operating System is able
to handle input and output to/from peripheral devices such as a keyboard, mouse
or printer.
Parallel Processing – On computers with multiple
parallel processors, the Operating System should decide how to share the load
between each processor.
File System – The Operating System should use a
method of storing files, directories, attributes and partitions. Examples of
common file systems are FAT32, and the more recent NTFS.
The Operating System should provide a large set of functions
that simplify all of the above and that programs can call. This is called an
API library and includes functions, which perform operations such as reading
keyboard/mouse input; drawing graphics; file operations etc.
So why can’t I write one in VB?
- Well for a start, Visual Basic has dependencies. Whenever
you open a Visual Basic exe, it relies heavily on DLL files called the Visual
Basic Runtime libraries. These Visual Basic Runtime libraries have huge
dependencies on the Windows API and will run under Windows only. This is the
reason why it is impossible to write an Operating System in Visual Basic.
- Another main reason is that Visual Basic is too high
level. You try and read what the user types on the keyboard without the use of
the API or text boxes or anything else. If you follow the rules, you will find
it impossible to write in Visual Basic. To read the keyboard buffer you must
set up Hardware interrupt handler for it. Inside this handler you write your
input queue code. To set the handler you have to re program the PIC – another
thing which is impossible to do in Visual Basic along. Once you even have that,
you need to perform a assembler “in” instruction on port 0x60. You have no
chance of doing this in VB.
So how do I write one?
Usually operating systems are written in straight assembly
or, more commonly, Assembly and C (sometimes C++). At the very least you must
know assembly. Some operating systems are written purely in C, but with inline
assembly.
If you download the package you will find all the tools,
source and binaries of a simple hello world operating system as well as full
instructions as to how to get it to run. The boot loader isn’t mine and I can’t
really explain it here but the kernel is mine and it is very simple so I can
explain how it works.
Kernel.asm
<--[if gte vml 1]>
[bits 32] ;Make our OS 32bit
SECTION .text
EXTERN
_c_main ;Reference to our main function in the c code.
;Note
that our function in C starts with an underscore (_)
;This is
because when we compile our C file, functions are started with
;underscores.
This is not so for ASM files though.
start:
call
_c_main ;This calls our main function in the C file
jmp
$ ;Freezes the computer because there’s nowhere else
to go!
This is the first half of the kernel. The second half just
writes to video memory to display some text. Study the code for yourself and
you will see.
Finishing up
Well, I hope I don’t see any more “Operating System”
submissions in the Visual Basic section which are actually Shells. Nor do I
wish to see any more shells that attempt to do some functions that the
Operating system should do.
I hope you learned something about operating systems now and
I hope that you enjoyed this tutorial. Don’t forget to leave your feedback and
don’t forget to download the package J
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.
Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE: 1)Re-scan downloaded files using your personal virus checker before using it. 2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code. 3)Scan the source code with Minnow's Project Scanner
If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
12/12/2002 7:12:31 PM:Coding Genius the formatting on PSC got very screwed
up actually. If you download the ZIP it
has a word version. remember to leabe
plenty of feedback (and votes if you
want). And remember to read the readme
file! heh. If you still have problems
then feel free to ask.
12/12/2002 7:20:14 PM:evil nice job! (but you shold of put it in
the C/C++ section because it has
nothing to do with VB but is related to
c/c++
12/12/2002 7:22:48 PM:Coding Genius People in the C/C++ section don't post
rubbishy shell's and call them OS'
though ;). At least half of the point
of this article is to show people that
you can't make an OS in VB; the
difference between an OS and a shell;
and what a real OS looks like. If I
post it in the C/C++ section then that
will not stop the new VB programmers
posting guff ''Operating Systems''. :)
12/12/2002 7:24:54 PM:Coding Genius I agree that it is not VB
related...however I believe that
posting it here would be the most
productive place. I did mention this at
the start. Thanks for your input
anyway. Oh by the way, I really suggest
reading the word version. When looking
at it in IE (I use the Opera browser),
the formatting appears even more messed
up.
12/12/2002 7:41:40 PM:CrashandBurn Although I have only seen 1 person on
PSC creating a
12/12/2002 7:43:08 PM:CrashandBurn got cut off...
...shell and calling
it an OS, I must protest at your only
blaming newbies for doing this (which
alot of ppl seem to do).
With
regards to the article itself, it is
very informative and I therefor, must
thankyou wholeheartedly for posting it.
12/12/2002 8:38:33 PM:Ralphy Boy Great article. Very interesting
12/12/2002 8:43:29 PM:JT Squirrel MAKING SHELLS IS FUN!!!!!!!!
12/12/2002 10:00:32 PM: Nice job I learned from that I have
always wondered how to make a OS now
maybe I can do more with it who cares
if it has to do with c and not vb I
dont look at c/c++ stuff so I would
have never seen this thanks again
12/12/2002 10:28:31 PM:DopePope In all fairness, the newbies don't make
the shells and call them OSes because
most the shells are more advanced that
what newbies know. Secondly,in every
12/12/2002 10:29:23 PM:DopePope ok got cut off...
Secondly,in every
"VB OS" post there are 15,004 flames
replying to the author about "this isnt
a os noob, you cant make an os in vb,
learn c++ blah blah." so posting this
as a way to teach the newbies the
difference between a shell and an OS is
really just a post so you know how
smart you are. 99.9% of all people that
activly post and read the VB sections
KNOW you cant make a OS in VB, but
shells are always fun. Stay in your C++
section man, we don't need you guys in
here all the time reminding us that
your language is more powerfull than
ours.
12/12/2002 11:24:21 PM: DopePope you think he made this whole
explanation to brag about C++ and to
flame newbies? I don't think so. He was
trying to help them!
12/13/2002 12:07:25 AM: Great article!! This article made us
know more on OS!
Thanks!!
12/13/2002 3:12:30 AM:Coding Genius Actually Dope, I could send you the
links to at least 10. And I have only
seen 1 good shell. Most ''Operating
Systems'' I have seen here are actually
full screem forms with image boxes for
icons and a very cheap looking start
button form. And just for your
information, go to the c/c++ section
and search for my name. You will, if
you are lucky, find one small
submission I made when beginning.
Compare that to my 46 submissions in
the VB section. I've been here for over
3 and a half years now. So I don't know
why you are reffering to me as ''one of
you guys'' like I'm some kind of
outcast from the VB section. I've
probably been here way longer then you
and made many more contributions. I
knew there would be at least one person
try to flame me about it containing no
VB code.
12/13/2002 3:15:03 AM:Coding Genius If you forget the attatched OS which is
for showing what a real one looks like,
you will see it is an article that
informs VB users the difference between
an OS and a Shell, functions of an OS,
and why you can't write one in
VB...Also, I'm not trying to prove
anything to you. If you think I submitt
here to prove that I am in some way
smart, then that's quite sad actually.
It totally loses the whole spirit of
PSC. By the way, I searched for your
name DopePope: It wielded no results.
So I do not think you are in any
position here to flame me about posts.
12/13/2002 3:19:55 AM:Coding Genius Oh, and anybody advanced enough to
create a GOOD shell, would be, I should
hope, knowledgable enough about
computers to label it as a shell and
not an OS. Anyway, I want to disregard
those ''This should be in the C
section. Newbies don't post shells.
There are no OS' posts on PSC''
comments and thank the people who made
constructive ones. From now on I would
rather see something about the article
- anything missing? anything not fully
explained? Any typos? Any wrong
information? If any of you decide to
flame me again: I reffer you to all of
my above postings and ignore you,
hoping the rest shall too.
12/13/2002 3:22:34 AM:RegX DopePope, why so mad? The point here is
to learn. If you didn't learn anything
from reading this read it again because
you missed something. Also, you mention
that VB is your langauge and are
offended at someone pointing out that
there are things that you can't do in
VB why did you write it? Don't be
offended, what langauge doesn't allow
you to do things you can't do in
VB?
Anyway, I enjoyed reading the
article.
one more thing DopePope, this
artical was not a personal attack on
you as you make it sound but this post
is so now you can vent.
12/13/2002 4:09:33 AM:Mattias Nice Work!
I learnd alot!
Thanks!
12/13/2002 4:10:19 AM:Mattias btw, i would love to see some more
articels about making an OS...
12/13/2002 5:16:08 AM:Gnome So what if some of the article isn't
directly about VB? It's trying to show
some of the limitations of VB and so it
belongs here. I thought it was a good
and informative article.
12/13/2002 6:44:14 AM:Danny Cain Good article, very useful
12/13/2002 7:07:11 AM:James Well done very informative.
12/13/2002 9:20:39 AM:LPChip I still do not agree that this
should've been posted here, as we
cannot do anything with the zip. This
should be posted in C/C++. But, you
could have the story, as that is what
this is about. Im sure that your code
will only be used for the text, and not
for the zip file.
12/13/2002 9:47:45 AM: Very informative article. Thanks for
taking the time. Gets one interested in
picking up another language. You also
took a lot of the mystique away from
creating an operating system and we can
see just how involved it would be!
12/13/2002 10:09:22 AM:BattleStorm Awesome! I haven't seen anything this
comprehensive since my Computer
Internals class at college while
earning my Associates Degree in
Computer Programming. Very nice work
even tho its not VB, but every
programmer should read this to get a
better understanding of computers.
Frankly, most of these yahoos on here
don't have a clue. This is definately a
first step. Good job!
12/13/2002 10:24:05 AM: Stop whining about where it was posted.
This is a very good article and it
would not have been seen by me or I'm
sure many other people, who actually
benefitted from it, if it was in C/++
section. Thanks for posting! 5 globes
from me.
12/13/2002 11:13:17 AM:Mark Hunter It's a wonder we havn't seen do us a
favour here asking you to delete this
sub. I think any programming is good,
VB or not Thnks for taking the time,
good article. I gave you 4 for content
and 1 for balls. = 5
12/13/2002 11:13:23 AM:Litehouse Thanks for posting this genius! Maybe
I'll play around a bit more with
assembly when I have time...
12/13/2002 11:16:11 AM:ORSHEE I'm very interested in this
article
but recieveing this error
while running MakeKernel.bat
Error in
DJGPP instalation
Environment variable
DJGPP is not defined.
12/13/2002 1:06:51 PM:Ross Ylitalo I agree that this was a good place to
put this article. If it was in C/C++,
for example, I would never have noticed
it. This was a good article, which
brings to bear some of the limitations
of Visual Basic. Of course it is
important to understand a tool's
limitations in order to lay claim to
proficiency with that tool!
Thanks
for the nice article,
Ross
12/13/2002 1:34:40 PM:Coding Genius Thanks for all the feedback guys. It's
been an improvement since this
morning.
ORSHEE > Just including the
GCC exe file will not properly compile
the code. You must have the full
version of GCC installed for it to
work. If you look in the ''Binaries''
folder you will find all of the
compiled code in flat binary format
(.bin)
12/13/2002 2:00:31 PM:Mirage- Nice one, very informative. 5 from me!
12/13/2002 2:31:44 PM: Good stuff - 5 globes
(got any more
like this)?
12/13/2002 3:10:08 PM:Espen D. Oboy Is it really possibl to create a OS in
pure C/C++? I thought it had to be
created with assembler... Anyway
assembler is faster, easier and more
fun.... Great article... keep up the
good work
12/13/2002 4:06:07 PM:john sheridan Thanks a lot for this post. This
couldn't have come at a better time,
because I'm helping my friend write an
OS (its actually cool - he's making it
all 3d-rendered) and I didn't really
understand before I read this. :-P FIVE
GLOBES!!!
12/13/2002 4:21:47 PM:Coding Genius Espen: Yes. C/C++ has inline assembly
that you can put within an ''__asm {}''
block.
12/13/2002 5:18:19 PM: Go IRBMe!
Finally, someone actually
showing so called
12/13/2002 5:19:30 PM: ack.. another cut off.... Carrying on:
VB OS Creators that it cannot be done..
and that they are not so |)amn good..
Good job ;) - v. informative ;)
12/13/2002 7:20:12 PM:ORSHEE It seems that time has come...When you
find a boundarie you can cross, why not
to cross it...
Hope to see more of
you, I'll keep in track.
12/13/2002 9:16:50 PM:timecoder This is really very informative
reminder and you should never look at
those who are trying to flame you on
this cause they are just jeolous cause
they can't get to the C/C++ level of
understanding I always know C/C++ is
superior and is the choice environment
for lots of applications
12/14/2002 2:05:55 AM:Gadget Ki coding genius,
I love your
article, where can I download nasm?
I understand why Assembler and C/C++
can make os with internal and external
devices to run function on kernel, this
is why Kernel is written in Assembler
or C++. because Kernel is a Binary
control without replying on library
when the computer boot. and interested
point, all applications softwares,
printer, modem, and webcam are replying
on libraries where they are required to
share the library... monitor,
motherboard, disk driver, keyboard, and
mouse does not have library because
they are owned on individual to read
the binary and were written in
Assembler or C/C++...
12/14/2002 2:09:23 AM:Gadget Ki however, please give me some comment or
arguement or agreement with my theory,
I agreed with coding genius. so I
would appreicate it when you show me
where can I get nasm assembler, thank
you for much
12/14/2002 4:29:42 AM:Mike Aubrey Nice.... but I've never seen a shell
claimed to be an OS... but then I've
never searched for an OS in the VB
section because it seemed absurd to
attempt one, never thought impossible,
nice article though.
12/14/2002 4:34:18 AM:Mike Aubrey Within a windows environment is there
really much difference between VB and C?
12/14/2002 4:42:39 AM:Mike Aubrey Not talking about coding I mean durring
runtime.
12/14/2002 4:54:00 AM:Coding Genius Gadget: It's included in the download
(I hope). Mike, there is a huge
difference between C++ and VB during
runtime. VB makes several calls to its
runtime libraries per second and is
really slow. I timed VB in carrying out
a specific function in a loop, then the
exact same in C++. C++ did it over 13
times faster. Besides, it's not really
what happens when it's compiled that's
important: it's what the language
itself can do. In this case, we use C++
because it does not need any external
dependencies like runtime libs. And
also it has the low level functionality
of using pointers (we need to write to
video memory - we do this by writing to
it using a pointer)
12/14/2002 5:30:08 AM:Mike Aubrey Hmm, any suggested readings for
learning C/C++? (Sorry if this is
getting too off topic)
12/14/2002 8:38:15 PM:Ark Hello guys!
Some of you asking why
this code wasn't upload to C/C++ area.
This is because this area already
contain same article with same code by
Matt Carpenter:
http://www.planet-source-code.com/vb/scr
ipts/ShowCode.asp?txtCodeId=4513&lngWId=
3
And CodingGenius even post comments
there! Any credits to REAL author? All
this article is not more than a link to
C/C++ area!
I don't vote it because
PSC haven't negative
votes!
Regards
Ark
12/14/2002 10:15:29 PM:Ark And back to code/article:
1. Source
code/explanation provide NOT A REAL OS,
but only first step of it - so called
bootloader. A computer can't load an OS
from the scratch because OSes are
different. So it loads only one sector
(a boot sector - a very first sector on
the disk (both floppy and HDD). The
code for boot sector is almost same for
diffrenet OSes, you can find a lot of
them over the NET
(http://www.openbg.net/sto/os/implement/
boot.php for example). This boot sector
continues loading of the REAL OS
(kernel.bin in this sample). Check out
[So what does an Operating System do]
part of this article - kernel.bin
doesn't perform ANY of defined
operation.
'...to be continued
12/14/2002 10:17:08 PM:Ark 'part 2
2. Even for bootloader this
code is very 'beginner' - it doesn't
check many conditions. Anyway, original
article is a good start for
understanding boot process (assuming
you're familiar with asm :))
3. The
most interesting and explanatory part
of original code (description - 5K
plain text) was trunkated.
4. <<With
a deeper understanding of the
underlying OS functions and the
internal workings of the kernel, you
may gain a deeper understanding of how
software actually works within the
context of an Operating System. With
this knowledge you can increase your
programming skills and better optimise
your code.>> //Sorry for long
citate//
Please, show me at least ONE
<<underlying OS function>> which allow
me <<dipper understand... etc>>
Best
Regards
Ark
12/15/2002 7:01:42 AM:Coding Genius 1) If you would do some research before
flaming authors, ''Ark'' you would see
that I already told you the bootloader
was NOT mine! As for the kernel...if
you actually took the f'n time to LOOK
you would see that the two are totally
different. As for it not being a real
OS, I also explained that it is the
start of an OS! It's a f'n tutorial,
''mate''!, I don't think I want to
spend 6 months writing a f'n
multi-threaded microkernel for the
purposes of a simple tutorial! ''Even
for bootloader this code is very
'beginner''' Like I said
already.....it's not my frikkin boot
loader already. As for your last
bit...I can't even friggin decipher
your mutilated grammar and spelling. I
will say this though...If you
understand the functionality of
operating system - you will most likely
program better. It's a well known f'n
fact! Now, back to that article in the
C/C++ section.
12/15/2002 7:02:37 AM:Coding Genius Can you show me which fsck'n line of
his article is identical to mine eh? On
examining them they are 100% totally
different. So next time ''regards
ack'', LOOK!!!!! before flaming
authors. Your lies are not welcome here
- go find somewhere else to whine or
get off your a$$ and do something worth
while! See ya around ''ack'' no f'n
regards - me!
12/15/2002 7:11:05 AM: ''Ark'', You are such a f'n faggot,
Maybe you should take some time
learning to read before immediatley
jumping in to flame authors eh? And
maybe you should take some time in your
posts so that we can actually READ and
UNDERSTAND them!
12/15/2002 7:11:40 AM:Coding Genius yep, ''faggot'' was the word I was
looking for. Thanks
12/15/2002 9:01:43 AM:noKIa Way Kewl, 5 Globes ^_^
12/15/2002 10:05:04 AM:Irnchen I coded an OS a while ago...
You
should add some functions to your code
like get an input from the user.
I
think the easyiest way to do this is
assembler, not c.
Also you coded to
much.
You can make a boot code with
about 30 lines of code.
The
12/15/2002 10:08:45 AM:Coding Genius lol. How many times do I need to say I
didn't make the boot loader. Anyway, as
for getting input from the user
etc....I don't want to complicate
things too much. I just want to show
what is the very basics. Anyway, I'm
still trying to write a proper keyboard
driver right now.
12/15/2002 10:09:14 AM:Irnchen "load program" part is very big.
You
could do it this way:
move 02h into
ah.
move 4 into al (size of my
kernel).
move 2 into cl (sector pos of
my kernel).
move 0x1000 into bx.
Then
move bx into es and then move
0x00
into bx and call 13h.
12/15/2002 6:48:57 PM:Ark First of all, sorry for my poor
English, it's not so brilliant as "f'n
a$$" Coding Genius one. And as you see
I discuss article, not him.
To all
other: just follow the link I provided.
All asm staff was stolen without any
credits to author.
!!kernel is mine!!
- just compare kernel.asm in both
sources - even "THis" tipo is
same!
So, what we have in this article
except of stolen code:
[1.] Some
common phrases about OS, Shell and
assembly - you can find same in any
"Shell/OS/Asm for dummies" article.
[2.] A small bit of author's C code
(output.c and its wrapper kernel_c.c) -
not more then rewritten kernel_c.c from
original - the only difference is
caring /n flag for printf and clearing
screen.
And you think this is
advanced staff???
12/16/2002 4:27:59 AM:Warlox (§) straight over my head i'm afraid -
although a good article and detailed -
5 globes
12/16/2002 5:29:05 AM:Paul Collingwood Er, if its 'straight over your head'
how do you know if it's 'good' and what
level of detail there is on the subject?
12/16/2002 7:30:02 AM: One of the best articles I've read
great work, all the 5 stars go to you!
12/16/2002 11:23:07 AM:Coding Genius Ark, go get a life you sad little f*ck.
And again, LOOK at the kernels before
lying. His Kernel_c.c is like, 10
lines. I have 2 source files,
Kernel_c.c and output.c where output
contains two functions, kprintf and
kclearscreen. there is also the option
of different colors of forecolor and
backgroundcolor and also, if you
compare the code for actually printing
the screen, they are totally different.
Now, again, get a f'n life you sad sad
little f*ck. And thanks to the others
who commented :)
12/16/2002 11:56:58 AM:Coding Genius to be fair, you're right about one
thing: your English DOES suck.
12/16/2002 12:42:18 PM:lenfocenter.com Genius, great job! Although -- I do
have one small suggestion. The best
way to really infuriate a flamer is to
pretend they do not exist. Don't stoop
down to that level by wasting the time
to reply. Simply know that the
majority of us know and understand your
reason for posting this great article
and why it was posted in the VB
section. Most of us can easily "read
between the lines" and tell the facts
from the phonies. Good job!
12/16/2002 1:01:02 PM:{ pHroZeN GeeK } nice and informative article... 5
rounds from me...
12/16/2002 1:36:33 PM:Coding Genius Thanks for the continued support guys :)
12/16/2002 6:49:38 PM: First, you have done a realy nice job!
second, i made the download of the
Djgpp,and i have some problems,when i
run the Djgpp, it gives me this error:
C:\djgpp\bin>ld -Ttext 0xFF800000
--oformat binary -o kernel.bin kernel.o
kernel_c.o
c:/djgpp/bin/ld.exe: target
binary not found
what should i do?
12/16/2002 7:20:37 PM:Ark I said what I said. Getting code
without author permission and/or
credits is at least not fair. This is
my opinion. Nothing personal (though
"Genius" should be more polite). You
had a chance to edit your article and
add credits to REAL author - you begun
discuss my English and nick instead.
Stay with your judgement and continue
to steal another's codes.
Good luck
12/17/2002 2:25:26 AM: Ark, I've checked the code on the link
you posted, and I've checked this, and
they are not the same, so stop with all
this false flaming you are doing.
Your
threads are only to reduce the great
quality of this great information, just
to make your lousy digital image code
pass this one, so be a good competitor
and stop with all this childish whinning
12/17/2002 3:37:02 AM: sorry, but can you help me?at
least,tell me how does ld work,ok?i
have some problems in th ld
command!what the hell,i´m doing wrong?
12/17/2002 10:33:07 AM:Coding Genius Guy with ld problem: the ''problem''
you are having is just normal. If you
are reffering to ''Cannot find entry
symbol'' which it looks like you are in
your E-Mail, then that is normal. It
should still compile since it is only a
''warning''. Other guy with no name
(PSC bugs? :P), thanks for informing
me! I never even realized that Ark was
the guy below me in the coding contest!
It's all clear now! Ark, how you like
it if I come spreading lies about your
code to put you down and beat you in
the contest? You can't get any lower
than that. It's just pathetic. Get a
life please.
12/17/2002 11:17:44 PM:Ark To tell the truth I didn't want to send
any more comments here. But I have to
answer on your denunciations.
1. Just
calculate globes at time I posted my
first comment - at that time you was
far from contest winners.
2. Check out
other contest codes - I gave 5 globes
to codes I like.
3. As you, I trace
new submissions not at VB area only,
but at C/ASP/Java too and I'm
interesting in asm too. So I downloaded
your code for my interest, not for
flaming, but oops - I already saw same
code!
4. To inform you - I already
posted a message to PSC authorities
asking to remove all my submissions
(including Image processing) due to
silly comments and plagarism.
Just
LAST question to "Genius" before they
remove code - do you also consider that
Image Processing code is "lousy"?
12/18/2002 11:16:46 AM:Coding Genius I don't know why you are teling me you
are having your submissions removed.
It's your private choice and I don't
personally care. As for your question,
image processing code can be good or
bad. It is all down to the skill of the
author. If you are talking about
YOURS...I wouldn't know, I didn't
download it.
12/18/2002 4:38:01 PM:Bl4d3R33f Hey, couldnt you use this code and make
a shell in C++, or c and get this to
load it? it would be way cool , 5
globes !!! ^_^
12/18/2002 9:14:56 PM:CodeZoomer doesn't work for me, but your short
brief is ok.
12/18/2002 10:25:48 PM:DefreHanoyk No working with me too, but great
ideas.
12/19/2002 1:18:47 PM:Ackbar I took the time to read what Ark had
stated and I gotta agree with him. From
what I'm seeing in that submission all
you've done is rearrange the folder
layout but other than that you just
wripped off someone else's work and are
taking complete credit for it. This is
not cool at all.
12/19/2002 10:42:08 PM:Ken Good Golly, it took longer to read the
comments than it did to read the
article. Coding Genius, thanks for
posting this well articulated piece of
information. Though already familiar
with the gist of it, it was nice to
have such a well formulated refresher.
Content feedback: you misspelled
optimize (optimise). A procedural
note: post it in the C/C++ section as
well as in the VB section. All
professional and aspiring professional
coders should read this tutorial. I
cannot understand how so many
professional programmers write code
every day without a fundamental
understanding of the basic principles
briefly outlined in your article. I
would love to see another, more in
depth, tutorial that explains some of
the more technical aspects in greater
detail. If you're interested I would
be more than willing to assist in
creating such tutorials. Again, thanks.
12/19/2002 10:52:30 PM:Ken For those of you who are really
interested in the process of creating
your own OSs using assembly and/or
C/C++ you might want to visit the
following
website:"http://www.menuetos.org/".
They have a completely self-contained
OS that fits on a single 1.44MB floppy
and includes support for displays up to
1280x1024, network, sound,
multitasking, and a basic file system.
If you look around on their website you
will find the source code as well as
links to C include libraries to write
your own code to run in their OS.
Enjoy.
12/20/2002 5:03:06 PM:Ultimatum I hate to say it, but it looks like Ark
has a good point on this one... either
way, this code is not efficient at all,
although it's to-the-point. There are
far easier ways to do it. Blah.
12/21/2002 4:56:16 AM:Coding Genius All I ask is that you open his C kernel
and my C kernel and compare. You will
find that they are quite different. I
already told you that I do not take any
credit for the boot loader. And
besides, the download is just a very
small example. It's the article which
should be the main focus.
12/24/2002 11:36:07 AM:ExcelBlue (Mark Lu) Can a code that simple possibly be an
OS that doesn't do anything except
output text? I expected it to be about
500kb. Never thought that was so easy.
Was so easy that a newbie in C/C++ can
understand it. (I do more VB and some
C/C++). How do you actually get this
thing to work? It won't compile
correctly.
1/18/2003 11:48:45 PM: how about putting some vb code to make
a small shell and explain how & why
each part requires the os making the
code a shell. (so the half wits saying
this does not belong can shove it up
their *&^&)
1/31/2003 8:48:54 PM:Matt Dibb There are a few errors in places, e.g.
the registers are on the CPU die,
shells dont always have control panels,
windows and explorer tools - I really
couldn't believe someone who claims to
know so much said this!! Just look at
the text mode in Linux - you use BASH,
aka Bourne Again SHell - yup all that
writing is the shell (the kernel is
centre of the OS, the inside of a nut,
the shell goes around the kernel).
Also, the instructions are not just
stored in a single byte! It depends on
the CPU and the opcode used, for
example some only use a single bit!
The microcontroller within the CPU
knows how big each instruction should
be and moves the program counter ahead
enough; if each instruction really was
a whole byte we would need A LOT more
memory! But anyway, nice effort and
hopefully it will educate some of the
'noobs', I am more concerned about all
the people posting script kiddie tools
however!
1/31/2003 11:37:09 PM:Paul Guerra Ok, now it's time to make a 32-bit OS
with multitasking and multithreading
ability.
2/3/2003 5:54:39 PM: all you need to do is build a striped
down linux that can emulate enough of
the windows api to fool the runtime and
write your self a shell in vb and you
would have your self a true... ly
pointless project.
2/12/2003 1:14:34 PM: All u guys suck. go get a freakin life.
writing code isn't the only great thing
in the world. get a woman, move around
, have some fun. and maybe the, u'd be
better coders. freakinn geeks.
2/16/2003 9:24:20 PM: Can you send me the exe for nasm and
the other programs. I think PSC removed
it because I didn't get it. Please send
it by e-mail at vilmer88@hotmail.com
3/12/2003 8:28:59 PM:Tristan Wells meh its not it vb, oh well ill just
have to reinstall my c++ editor and
assembly editor
3/17/2003 4:53:28 AM:Daniel W. Elkins Wow, very nice article, thanks! I'm
only 16 and have only been programming
for about 1 and a half years, and still
haven't really come out of the VB hole
just yet; just now starting to learn
C#/C++, I found this article very
motivating to do so. To the people who
flame you for writing an excellent
article, they should be recognized for
their arrogance. "You posted this in
the VB section and it's in C++/Assmb!"
or "C++ is not better than VB!" Who
really cares ? I've always been led to
belive that it's not the compiler, it's
the coder that determines the
limitations to the applications; to a
certain extent. But blatantly, there
are just some things you can't do in
VB. C#/C++, to my knowledge, has always
been the universal language; because it
can be compiled to run on numerous
operating systems; not just Windows;
which in itself, is a big advantage
over VB...
3/17/2003 4:53:49 AM:Daniel W. Elkins I'm not trying to say one is better
than the other; that's just silly; but
instead trying to enlighten the people
that think VB can do anything. Learning
a variety of languages will always be
the better choice. Anyway, very
informative article, much appreciated.
I look forward to seeing another one
from you pertaining to OS development;
you explained it clearly and very well.
5 globe thingies from me! :)
3/20/2003 3:35:54 AM:Farolfo Remove code, put on other language
category
3/20/2003 3:59:01 AM:Mike Canejo I havn't been around PSC in a while,
it's good to see your still active
Coding Genius. Regarding "ARK"'s claim
that you stole code,i don't think so.
But the very least you can do is put a
"Original Concept by Matt Carpenter"
somewhere. I mean after all, it's not
like you came up with the original
concept of this First Step to a OS
(bootloader), Matt did. If you wrote
everything from scratch i'd say
otherwise but some of it originated
from matt.
Still 5 globes, i like
your documentation better than matts as
well :)
3/24/2003 6:13:51 PM: Dear Coding Genius,
When you write
"These are all stored within the eax
register. So a change to the al
register will also change ac and eax. A
change to eax will change all of the
above registers", do you mean by "ac"
in fact "ax" register?
Bravo! well
done!
5+ globes(last but not
least..);-)
3/24/2003 6:19:00 PM:Coding Genius yeah you're right :P
4/12/2003 9:18:20 PM: I'm having this error message:
Error
in DJGPP instalation Environment
variable DJGPP is not defined.
And I
didnt understand this that Coding
Genius wrote about this error:
Just
including the GCC exe file will not
properly compile the code. You must
have the full version of GCC installed
for it to work. If you look in the
''Binaries'' folder you will find all
of the compiled code in flat binary
format (.bin)
I dont speak english
very well, could someone help?
5/17/2003 8:25:44 PM:Sarafraz Singh Johl To the unknow above my post, how can
someone help you learn english? :P
5/19/2003 6:12:03 PM:poop_4_brains haha! i have the most powerful
language...
0101010100101010010101001010101010100101
0101, so there!
5/22/2003 2:38:54 AM: Does anyone know any other tutorials on
this subject? I'm trying to do some
more of this stuff. especially the ASM
is very hard.
6/4/2003 7:58:34 PM: jeez all you people, i'm thirteen and i
bet most of you guys are adults....what
the hell...jeez, dont hate people,
appreciate! nice job man! i mean
like...how often does someone take the
time to explain it to you?! =D good job!
6/6/2003 1:47:01 AM:Richard Sullivan hey coding. i haven't seen anyone
comment on this, but i am getting
errors when in compile certain things
and i get "JLOC is unrecognized
command". I have NASM and DJGPP
installed but i dont know what JLOC is
so i can't install it.
I also get a
"PARTCOPY is an unrecognized command"
again i dont know what this is so i
can't get it. if you do have links to
these, please post them.
thanks.
BTW
great code for learning 5 Globes.
6/13/2003 5:50:06 AM:Simon Dann this is great!! :D made me own 'simple'
os ages ago but I oculdnt compile it
-_- thx for the tools, and nice
explenation :)
6/23/2003 1:10:04 AM: Everything was quitefyn BUT I always
getthis error message: Error in DJGPP
instalation Environment variable DJGPP
is not defined. And I didnt understand
this that Coding Genius wrote about
this error: Just including the GCC exe
file will not properly compile the
code. You must have the full version of
GCC installed for it to work. If you
look in the ''Binaries'' folder you
will find all of the compiled code in
flat binary format (.bin) i really
wanna try this one!!!! Please Help
me!!! Whaaaaahhhhhhh!!! Where can i get
this full version anyway!!!
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here.