Files changed (2)
+From the coder interface, you can directly enter in op-codes, they are not executed, but are written to memory at the current pointer location.
+This file is provided as an introduction to how this works internally, please see the other text files for usage.
+The CPU core is fully customizable, but if any of the memory sizes are changed, it can break compatibility with other binary files.
+That being said, if your goal of using this code is to build your own virtual machine for your application, then feel free to change the memory sizes to suit your requirements:
+ Here you can add new registers, which you will also need to add new op-codes for manipulating them.
+ In the __init__ of this class is where the CPU Memory, persistent storage, and shared memory is initialized.
+ mem is a Memory class, using the default size of 64 bytes. Increase the 64 to increase the size of the binary files and available executable memory.
+ storage is a Storage class, which is a subclass of Memory, using the default size of 4K. This is the persistent storage which is accessed using a software interrupt. Various code can storage and access data from here.
+ imem is a Memory class, using the default size of 1K. This is the shared memory, where executable code can store non-executable data. If you want to execute data from here, you need to first move it into CPU Memory.
+ You can add a parameter into run() to tell it where to start executing, say if your binary file has a header.
+ This class implements a command-line interface to create binary files and debug them. See the documentation on how to use the various commands available.
+ A CPU instance needs to be passed into the Coder, or it will not work. You can also pass an empty CPU instance as well, to start a fresh new application.
+ There are many functions in this class which control the memory access facility, which the CPU uses.
+ These functions will not be directly edited or used by you, as they are already implemented in the CPU op-codes.
+ Essentually, this class is exposed as an array. The CPU gets and sets memory locations using array syntax:
+ This class also keeps track of the current pointer location, which is used by the CPU for various operations.
+ It is also able to read a null-terminated string with a helper function, which a software interrupt exposes.
+ This class I sometimes wonder if I really should have created it and built everything around it...
+ It controls the attribute setting to prevent values outside the 255 range, which this CPU simulator does not yet support.