This is a feature-rich UVSim implementation for the BasicML language. It supports both legacy and modern BasicML formats with the following features:
- Multi-file support (up to 3 program files simultaneously)
- Customizable color themes through the menu
- File format conversion between legacy and modern BasicML
- Step-by-step program execution
- Real-time memory visualization
The program supports these BasicML commands: I/O operation:
READ = 010Read a word from the keyboard into a specific location in memory.WRITE = 011Write a word from a specific location in memory to screen.
Load/store operations:
LOAD = 020Load a word from a specific location in memory into the accumulator.STORE = 021Store a word from the accumulator into a specific location in memory.
Arithmetic operation:
ADD = 030Add a word from a specific location in memory to the word in the accumulator (leave the result in the accumulator)SUBTRACT = 031Subtract a word from a specific location in memory from the word in the accumulator (leave the result in the accumulator)DIVIDE = 032Divide the word in the accumulator by a word from a specific location in memory (leave the result in the accumulator).MULTIPLY = 033multiply a word from a specific location in memory to the word in the accumulator (leave the result in the accumulator).
Control operation:
BRANCH = 040Branch to a specific location in memoryBRANCHNEG = 041Branch to a specific location in memory if the accumulator is negative.BRANCHZERO = 042Branch to a specific location in memory if the accumulator is zero.HALT = 043Pause the program
This project is managed with Poetry. In order to run this project, first install Poetry, through one of the recommended methods described by its documentation. Once Poetry is installed, see the following commands:
$ poetry lock -- This step shouldn't be necessary, but it will make sure that the lockfile is up to date with the latest versions.
$ poetry install --all-extras -- This creates a .venv/ folder, in which poetry installs all the necessary libraries to run this project.
Important: To run the program, use:
$ poetry run python -m src.mainTo run the tests:
$ poetry run pytest tests/Note: Some installations of Python don't ship with
tkinterby default. You need to make sure your Python 3.12 version is setup to usetkinterbefore creating the virtual environment with Poetry. If you're on MacOS, using Pyenv to manage your Python versions:
- Run
$ brew install tcl-tk- Add
tcl-tkto PATH (something like this:$ echo 'export PATH="/opt/homebrew/Cellar/tcl-tk/9.0.1/bin:$PATH"' >> ~/.zshrc)- Run
$ pyenv install 3.12.9- Modify Pyenv's version file (whose location can be found by running
$ pyenv version-file) to read3.12.9Then proceed with the Poetry instructions as listed above. If you already have Python 3.12.9 installed via Pyenv, you may need to uninstall it before these steps
If these steps fail, you can always attempt to run the program without Poetry. You'll need to install the dependencies manually (
$ pip install <pkg>) fortermcolor, andpytest, if you want to run the test scripts. Then you can run$ python -m src.mainwithout Poetry involved.