<<< Stack Machine Memory | Index | Getting Started >>> |
Implementation must be a mix of the following parts assembled, compiled, and linked together as a whole:
Main driver: use C/C++ main function as entry point into the application.
Memory allocation: any approach is fine, dynamic or static.
User input: natural choice is C/C++ standard I/O facilities, or use IO.ASM, if you like. I recommend using C/C++ I/O libraies, since they have superior industrial strength when compared to a toy-like IO.ASM bundle.
Input parsing: using C/C++ is highly recommended unless you have lots of extra time and nothing else to do.
Stack Machine State: (RUN or HALT) - since actual memory allocation can be done by either ASM or C++, use your judgement...
...The main driver of the application needs to know very little about the stack machine state, so keeping the state private to the ASM module is probably your best choice.
Command execution: you must use ASM code to implement the stack machine logic and manipulate its memory. Each command must be handled by the assembly module. Adding a set of dedicated command-specific PROCs is highly recommended. Using a table of procedure handlers is an ideal approach to implement the stack machine mechanism.
Console output: ASM code can invoke C/C++ function to handle the standard output. However, you can use IO.ASM, if you like.
<<< Stack Machine Memory | Index | Getting Started >>> |