- #36
rcgldr
Homework Helper
- 8,889
- 650
pseudo code is normally used to document an algorithm, it's an option to using a flowchart and can be editted much more easily. There are some flow charting tools that input a very "pseudo code" like langage and produce a flow chart.jackson6612 said:pseudo-code
This can be done by the programmer as well as the compiler. I haven't seen many C or C++ compilers that unfold loops, or at least unfold larger loops. What I have seen is loops used to move data replaced with move string instruction sequences. Example of unfolded loop:What is an "unrolled loop"?
original code
Code:
for(i = 0; i < n; i++){
a[i] = b[i] + c[i];
}
unrolled loop when n is fixed
Code:
a[0] = b[0] + c[0];
a[1] = b[1] + c[1];
// ...
a[n-1] = b[n-1] + c[n-1];
Duff's device version for when n is dynamic
Code:
switch(n){ // max value for n is 100
case 100:
a[99] = b[99] + c[99];
case 99:
a[98] = b[98] + c[98];
case 98:
a[97] = b[97] + c[97];
// ...
case 2:
a[1] = b[1] + c[1];
case 1:
a[0] = b[0] + c[0];
case 0:
break;
}
A BIOS is normally read only memory at a fixed location used to boot up a computer and provide some basic I/O services. For boot up on a PC, the BIOS reads the first sector of a bootable disk and branches to the location the sector was read into (7c00 hex in memory). That code moves typically moves itself to lower memory (0600 hex in memory) and repeats the process, eventually reading sectors using BIOS calls (INT 21h) to read in a loader, such as MSDOS.SYS or NTLDR, which reads in the actual OS code and branches to that.As is BIOS software is part of the hardware? Does a processor have a fixed permanent memory chip which holds BIOS-like software in it for simple operations such as the difference between two numbers to be done by the processor?
Some IBM mainframes use micro-code to implement a common set of instructions that are not natively available on all versions of the mainframe. Older PC's used software to emulate floating point instructions if a floating point processor was not available.
Last edited: