MBR / Bytes to Code Space

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

When a computer is booted, Code is loaded from some external source. i.e.
MBR. Right now, The code is being loaded from a 62256. I would like to be
able to run code off a Disk, roll my own MBR and be able to run small
programs off the disk.

P.S. Is there any way of doing it in C?

Thinking...
Has to be addressable to retrieve bytes at different addresses. 32K SRAM So,
the maximum Size of the program would have to be < 32K. Could this be
expanded?
< 32K programs, but multiple programs on disk.

Thanks for your help,



Re: MBR / Bytes to Code Space
Quoted text here. Click to load it


Not really directly from the MBR.  In a PC, as the CPU is actually
booted, it reads code from an EPROM or nowadays a flash memory, called
the BIOS, at the fixed address designed by the CPU makers.  

That code initializes all kinds of hardware, including the harddisks.

Only then it issues requests to the hard disk controller to read the
MBR of the primary HD (if any) into main memory, and jumps to it.

Note that since you didn't even mention what CPU you're talking about,
this could be completely different in your case.

Quoted text here. Click to load it

Then you'll have to put code into that 62256 that knows how to handle
the disk drive you have attached (how?), and you'll need some RAM
mapped as executable code memory to copy code to from the disk, and
execute it.  You quite definitely can't run code directly off the disk
drive.

Quoted text here. Click to load it

Yes; for at least some definitions of the term "C" ;-)



--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: MBR / Bytes to Code Space

Quoted text here. Click to load it

Speed is not the issue.  The CPU can't even *see* that code, much less
execute it, while it's still on the disk.  It can do that no better
than you can read a book (the old-fashioned, dead-tree kind) sitting
on its shelf in the city library while you're sitting at home.  You
have to go and get it, first.

Quoted text here. Click to load it

As long as you're attaching it as a hard disk work-alike, it doesn't
matter what it physically is --- it's not memory the CPU could execute
code from.

Quoted text here. Click to load it

Using an 8051 with no external memory attached, odds are you won't
even be able to talk to a CF car.  (Simulated) disk sectors are 512
Bytes, which is larger than the internal RAM, for starters.

An 8051 makes this even more interesting, because that's a Harvard
architecture, meaning it cannot usually execute code sitting in
writable ("data") memory, either. You have to wire RAM chip select
specially to allow the bytes found in there to be executed as code.

Summing this all up, do yourself a favour: get a beginners' level
textbook on microcontrollers from aforementioned city library.

[And BTW, please don't toppost, and don't claim you're
snipped-for-privacy@microsoft.com, which quite obviously you are not.].


--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: MBR / Bytes to Code Space
Quoted text here. Click to load it
I do this to prevent unwanted Junk Mail.
Perhaps MS has more resources to confront junk mail than I do?

Quoted text here. Click to load it
You don't have to read the whole 512 bytes, you can read a single byte.
Do yourself a favor and read the book, preferably a  basic beginners book
:|~
Hard Drives for Dummies :D

Quoted text here. Click to load it
From another posting, I found out that the 8051  has no instruction to load
code from another source.

I was just curious about the transition from ROM to a Disk Based Operating
System, eg DOS.
This is what they actually had to do in order to incorporate a Disk Based
ROM.
They had to switch to Von-Neuman architecture and add an  instruction to be
able to load code
from the Secondary Source.

Well, thanks for your help,
Quoted text here. Click to load it



Site Timeline