v 0.4 of my CPU is a decent delta. The code is now cleaner, more generic and so more flexible and easy to expand. The internal structure has expanded to include a new flag, zero ("Z"), to go with the existing numerical overflow flag ("OV"). Most importantly, these in turn facilitate conditional branching. Yes Sir, we can loopy! Follow the "Read More" link at the right for an explanation of the new instructions. | 24/02/2013 |
Here's an explanation of the new instructions.
CLR_Z, CLR_OV BRF_Z <#offset>, BRF OV <#offset> BRB_Z <#offset>, BRB_OV <#offset> BRF_NZ <#offset>, BRF_NOV <#offset> BRB_NZ <#offset>, BRB_NOV <#offset> | Clears (resets to '0') the Zero and Overflow flags If the Z or OV flag is set, branches forwards by the number of bytes specified. Note that the instruction pointer (IP) will already be pointing to the next sequential instruction following the branch, equivalent to an offset of 0 bytes. If the Z or OV flag is set, branches backwards by the number of bytes specified. Note that the instruction pointer (IP) will already be pointing to the next sequential instruction following the branch, so need to add 2 just to get back to this branch instruction. Same idea, but branches if flag is not set. |