# Simple Question about Computer Startup

Status
Not open for further replies.

#### Integrated

##### Member level 1
Hi,

I am confused about starting up a microprosessor.

I have used 8051 with an external ROM and RAM, There I understood
what was happening ,that was easy , for example we could write MOVX instruction to ROM and there wouldn't be any conflict with RAM at executing from ROM.

But there we didn't put any program in the RAM

I want to know how Pentium (PC computers) put program in RAM and if
RAM means Data how does micro fetches it as Instruction?or does not?

sorry for asking such basic question here but it was about interfacing micro to computer so I suppose PCI slots to send and load my program to the PowerPC microprocessor board's RAM after a simple waiting sturtup code have put in ROM on board.

Regards. :?:

#### mr_ghz

##### Full Member level 5

Time has changed... No really: the 80C51 has separate spaces for code and data storage. Code memory is addressed using the PSEN signal and data is accessed using RD/WR signals. So you can use the full 16bit address space twice, once for code and once for data. You could not 'execute' data as long as you didn't a special decoding between PSEN and RD.
In a x86 based PC system (and also in a PowerPC) you have no separate code and data memory (only the IO-space is separated, but this is another thing). So theoretically you can store data that represents a valid opcode and make a jump on this space and execute your 'data'. So it's possible to create self-changing code. The proble is what is data and what is code? - This has to be defined in your application/your compiler!
So if you want to use the PCI-bus to write in a PowerPC memory you can do this with simple data move commands. I would suggest that you use a PCI bridge chip (there are many manufacturers), this will be much easier for you.

Bye

#### james

##### Member level 2
While a PCI bridge chip is certainly the best solution to inteface an embedded micro board to PC using PCI bus, I must disagree a little from last definition given above on how 8051 manages memory.

#### mr_ghz

##### Full Member level 5
Hi artem

The wiring PSEN with RD as mentioned by kowax (and already meant by my phrase 'special decoding') is very often used. In a compiler you always have to define sections for code and sections for data. If both memory areas are physical the same, you have to separate them in address range.
Example: Code from 0x0000 .. 0x7fff, Data from 0x8000 .. 0xffff
Look in startup-files of your compiler (Keil, ..) mostly this is made there.

Only by looking at the memory-content you can NOT say if it's code or if it's data! There is no bit that specify this. As explained above, you have to make your own 'memory management' and put data and code in separated areas. Look at the example above: The PC sees a memory array of 64kBytes size. If you write to the lower 32K, this is interpreted as Code, a write to the upper 32K is interpreted as data.

Bye

Status
Not open for further replies.