Search   
Home  Print View  

 

Journal

Branch Content

Introducing Relative Branches

09/22/2009

Last night I was thinking on how an Operating System (even the most rudimentary one) would manage to allocate programs in memory from Storage. I realized that those programs must be written using relative addresses instead of fixed ones. That could be done using the already provided "indirect branch" instructions (such as "JNZX reg"), but the correct way is to implement actual "relative branch" instructions.

For implementing this new addressing mode, some modifications need to be made. Fortunate the modification in question is quite simple and, after all, the computer is still on paper (nothing has been built yet) so this is the time.

The new addressing mode (relative) will only apply to branches because extending the concept to all registers would lead to profound changes to the overall architecture. I don't want that.

An example of relative branch instruction is this:

jnzr   OFF_SET

where OFF_SET is an operand to be fetched from memory (following the op code). Executing this instruction will cause the Program Counter to add OFF_SET to its current content so the next op code fetch takes place OFF_SET memory locations further.

This will allow an OS to allocate programs anywhere in memory since those programs won't care about where they are but only how far they need to jump.

Homebuilt CPUs WebRing

JavaScript by Qirien Dhaela

Join the ring?

David Brooks, the designer of the Simplex-III homebrew computer, has founded the Homebuilt CPUs Web Ring. To join, drop David a line, mentioning your page's URL. He will then add it to the list.
You will need to copy this code fragment into your page.

Project start date: May 13 of 2009