This is useful for anybody who wants to program low-level languages.
Some examples of low-level software would be drivers, BIOS and Operating Systems.
Yet this theory can be usefull in all software you ever program.
Basic Outline:
1.The fetch-execute cycle begins as soon as power is introduced to the system.
2.The data is read from memory.
3.Then the instruction read is executed.
4.Either return to 2 or power-off.
Fuller Outline:
1. Power initiated
2. PC loaded to address lines
3. One word read from memory, fed through IR into CPU
4. PC iterated
5. If all data needed read from memory, jump to 8, else continue
6. PC used as memory address then incremented
7. Next word read and stored where programmed to go
8. execute phase if all data read, else go to 6.
pseudo-code:
Code:
while(power on){
pc loaded to address lines
word read from memory, fed to IR
PC++
while(not all data read){
PC loaded to address lines
word read from memory
PC++
}
execute instruction
}
More information:
R/W line set to 1 to signify read operation, placing the address in pc to the address bus. Data from address read into IR(Instruction Reagister)
The data is then interpreted by the ID(Instruction Decoder).
The data needed to run the instruction which has been decoded by the ID is either in a specified address, or in the next few words of data.
If the data is in a specified address, the address is loaded to the MAR(Memory Address Register) and then read from,else the next word of data is read until all data required is read.
Once all data is read it is then executed, aslong as power is still supplied to the system, return to beginning of process.
To elaborate more on the fetch-execute cycle I shall mention how the PC is set at start-up, thus how the MBR(master boot record) most likely works.
On initiation of the fetch-execute cycle, the first byte in memory read is 0x0000 (assuming a 16-bit microcontroller).
The start of the memory device is the BIOS which is hard-coded into the Hard Drive when designed to be the master drive, (hence importance of not mixing up the slave and master drive cables). The BIOS can be programmed in various ways as we all know.
The BIOS then loads up the Operating System bringing users back to the system they feel safe in.