Context
Here is the final memory map will be0 0 0 {instrs} 0 inst_ptr 0 0 0 inactive_flag direction_flag memory_ptr 0 0 0 0 0 {mem}The inactive_flag will be updated by both '[' and ']', and used by the global instruction processing to do execute or not instructions.
The direction flag will be used by the fetch to move on left, or right, and updated by ']' instruction when active, or '[' when inactive.
Let's now implement < and > operations.
Initial state
- Memory: see above
- Cursor: on instruction, next to inst_ptr
- Input: any
Process
- Increase or decrease memory_ptr
Code for >
>>>>+<<<<
Code for <
>>>>-<<<<
Final state
- Memory: see above
- Cursor: on instruction, next to inst_ptr
- Input: unchanged
- Output: unchanged
Aucun commentaire:
Enregistrer un commentaire