Re: writing to a partition
- From: et472@xxxxxxxxxxxxxxxxxxx (Michael Black)
- Date: 16 Oct 2007 17:32:49 GMT
Unruh (unruh-spam@xxxxxxxxxxxxxx) writes:
Allan Adler <ara@xxxxxxxxxxxxxxxxxxxx> writes:Come on, is the cluelessnes of the original poster making everyone dumb?
floyd@xxxxxxxxxx (Floyd L. Davidson) writes:
The BIOS (ROM based) reads in the 446 byte primary boot loader from the MBR
and places it at address 0x07c00, and passes execution to it. The primary
boot loader used by LILO, when executed, moves _itself_ to address 0x96a00,
then prints an 'L' to the screen.
Unruh wrote:
The something else can almost certainly not print Hello World,
since such input output is highly non-trivial. I would suggest that since
Obviously it is very trivial, as the initial stage (the "primary boot
loader"), which has to fit in the miniscule space (446 bytes) allocated
for it in the MBR, can actually print to the screen. If it did nothing
else, printing "Hello World" would be less than trivial.
Yes, it uses raw bios calls. It does not use C or any stdio libraries, or
anything. So you have to learn exactly how the raw bios calls work. That is
non-trivial. I did not say it was non-trivial for the computer. I said it
was non-trivial for the programmer. Of course if you know bios calls it is
easy.
ONly in a thread that makes some basic bit of knowledge unecessarily
complicated would writing to the screen become "non-trivial"
You can't get anything simpler than that. Any book about programming
is going to start with putting something on the screen, because after
all, you can't do anything else unless you can display the results.
Gee, even in my first computer in 1979, it was completely "trivial"
to display something on the 7-segment readouts. Load the accumulator
with the character you wanted to display, and jump to the subroutine
in ROM. You'd look in the book that came with the computer, and find
what was needed to display that character.
That computer had only 1K of ram, a mere four times the amount of space
that's in a boot sector. I never ran out of ram on that computer (though
obviously I was only running programs that were suitable for it).
That computer came out about 1976. There really hasn't been any computer
since then that didn't have built into it some sort of routine to display
characters on the screen.
Even writing a driver circa 1981 wasn't particularly difficult, though
one did have to have a vision of the end product before you could
actually code it. I never did write a driver, but I sure was able
to recode a third party driver for my OSI Superboard II that year,
and unless you have a certain understanding of the ultimate results,
then you're lost.
Or hey, in the old days people would just stash the message in
the video memory, and of course it would appear on the video screen.
At the level of beginnership needed by the original poster, results
are far more important than doing things "nice", since any results
help move the learning process ahead, instead of putting this huge
cliff in front of him that is at the very least going to seem
too high.
I've already given the basic idea of the "proof of concept" earlier
in this thread. But the original poster is stumbling because he
lacks learning skills. You use the familiar to understand the
foreign. It took too many messages for him to grasp the concept of
booting, when he could have so easily looked up the concept in a
dictionary (a dictionary being a good source since it will give
the very basic definition, which then helps set the stage for
further learning). He still can't come up with the basic concept
of what's needed in a bootable program, instead he's gone on a tangent
over lilo, which was only suggested initially because it was a potential
source of information.
Once again, he needs to find out what the BIOS expects to see
in a bootable sector. He's been given lots of clues. If he's spending
all this time trying to understand lilo to get that information, then
he's on a wild goose chase, since in reality he needs to know the
basic concept before he can understand lilo. And if understanding
lilo is not going anywhere, then he needs to simplify until he
can grasp lilo.
Then he needs to use his non-existint search tools to find out
information about bios calls. That is pretty standard and should
be completely completely easy to find at this point.
He writes his loop, as I already indicated. He finds out the
interrupt needed to display a character via the BIOS. He loads
the registers as required, and then assembles that code including
the needed format for the code to be bootable by the BIOS. He
puts it on a hard drive or floppy disk, and then boots. If it
fails, then he needs to figure out what's wrong, and set things
right. (Errors will be due to lack of understanding some concept,
or something silly like a typo). WHen it works, then he can build
on that, now that he has a program that can be booted from the
bios and can actually display a message on the screen.
There is absolutenly nothing complicated about this. If it is, then
anything is going to be too complicated for the poster.
You can stuff the "hello world" code in that 256 byte sector with
lots and lots of room left, more than enough to load some other
sectors into memory and jump to them, which would be the case
needed if this was a real program.
The original poster has all he needs to know here. If he gets
out and does some searches, he will get the needed information
to put together a the thing he wanted originally. And he
will learn far more than his fussing over the lilo source.
Michael
.
- References:
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Michael Black
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Balwinder S Dheeman
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Dan Espen
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Dan Espen
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Unruh
- Re: writing to a partition
- From: Floyd L. Davidson
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Unruh
- Re: writing to a partition
- Prev by Date: Re: Script variable evaluation question.
- Next by Date: Re: UTF-8 encoding problem
- Previous by thread: Re: writing to a partition
- Next by thread: Re: writing to a partition
- Index(es):
Relevant Pages
|