Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimwinum committed May 1, 2024
0 parents commit 85ed97b
Show file tree
Hide file tree
Showing 12 changed files with 823 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "tuesday"
time: "19:30"
timezone: "Europe/Oslo"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "tuesday"
time: "19:30"
timezone: "Europe/Oslo"
39 changes: 39 additions & 0 deletions .github/workflows/jupyter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Jupyter

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install autopep8 flake8 jupyterlab
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Convert Jupyter notebooks to Python scripts
run: |
jupyter nbconvert --to script --output-dir=.temp *.ipynb
- name: Lint with autopep8 and get statistics from flake8
run: |
# exit-zero treats all errors as warnings.
# show statistics for Python syntax errors or undefined names.
# the GitHub editor is 127 chars wide.
flake8 . --count --exit-zero --extend-ignore E402,W291 --max-complexity=10 --max-line-length=127 --show-source --statistics
# stop the build if there are Python syntax errors.
autopep8 .temp/. --ignore E402,W291 --recursive --diff --exit-code
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__/
dist/
.coverage
.ipynb_checkpoints/
.temp/
4 changes: 4 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM gitpod/workspace-full

RUN pyenv install 3.11 \
&& pyenv global 3.11
20 changes: 20 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
image:
file: .gitpod.Dockerfile
tasks:
- init: pip3 install -r requirements.txt
command: jupyter lab --ServerApp.open_browser=false --ServerApp.allow_remote_access=true --IdentityProvider.token="" --IdentityProvider.password_required=false
- init: pip3 install -r requirements.txt
command: jupyter nbconvert --to notebook --inplace --execute --allow-errors --ClearMetadataPreprocessor.enabled=true --ClearMetadataPreprocessor.clear_notebook_metadata=false *.ipynb && jupyter nbconvert --to script --output-dir=.temp *.ipynb && autopep8 .temp/. --recursive --diff && flake8 . --count --exit-zero --extend-ignore E402,W291 --max-complexity=10 --max-line-length=127 --statistics && rm -rf .temp
ports:
- name: Jupyter Server
port: 8888
onOpen: open-browser
vscode:
extensions:
- streetsidesoftware.code-spell-checker # The Code Spell Checker extension is GPLv3-licensed, separate from this project. See its docs for details.
- ms-toolsai.jupyter # The Jupyter extension is MIT-licensed, separate from this project. See its docs for details.
- ms-toolsai.jupyter-keymap # The Jupyter Keymap extension is MIT-licensed, separate from this project. See its docs for details.
- ms-toolsai.jupyter-renderers # The Jupyter Notebook Renderers extension is MIT-licensed, separate from this project. See its docs for details.
- ms-toolsai.vscode-jupyter-cell-tags # The Jupyter Cell Tags extension is MIT-licensed, separate from this project. See its docs for details.
- ms-toolsai.vscode-jupyter-slideshow # The Jupyter Slide Show extension is MIT-licensed, separate from this project. See its docs for details.
- ms-python.python # The Python extension is MIT-licensed, separate from this project. Dependencies: Jupyter (MIT), Pylance (Microsoft proprietary). See docs for details.
2 changes: 2 additions & 0 deletions .pep8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pycodestyle]
ignore = E402,W291
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"python.linting.mypyEnabled": true,
"python.linting.mypyArgs": [
"--strict"
],
"cSpell.words": [
"bytecore",
"bytecorebyte",
"bytecorecompiler",
"bytecoreassembly",
"bytecorecpu",
"subtractor"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Joakim Winum Lien

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ByteCore Byte

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/joakimwinum/bytecore-byte/main?labpath=bytecorebyte.ipynb)

ByteCore Byte is a specialized version of the ByteCore CPU that operates within the ByteCore Emulator. It is uniquely designed using the ByteCore Assembly language but uses only 1 byte for addressing instead of 2, thus reducing the available memory from 64KB to 256 bytes.

This compact CPU setup has been adapted to run both the simple and the advanced example programs originally developed for the standard ByteCore CPU.

The programs are integrated into a Jupyter notebook which includes:

- A main Python cell containing the source code for ByteCore Byte.
- Two additional code cells, each containing one of the example programs: Simple and Advanced.

To explore these programs, follow the setup instructions below, launch the Jupyter Lab, open the [`bytecorebyte.ipynb`](bytecorebyte.ipynb) notebook, and click 'Run All'. The notebook includes Python assertions to verify the CPU's state upon halting.

## ByteCore Packages

Here are the packages used to develop the ByteCore Byte CPU:

### ByteCore Emulator

- [GitHub](https://github.com/joakimwinum/bytecore)
- [PyPI](https://pypi.org/project/bytecore/)

### ByteCore Compiler

- [GitHub](https://github.com/joakimwinum/bytecorecompiler)
- [PyPI](https://pypi.org/project/bytecorecompiler/)

## Installation and Setup

### Prerequisites

Before installing, ensure you have Python 3.11 or newer. Clone the repository and navigate to the root directory. It is recommended to set up a Python virtual environment to manage dependencies efficiently.

### Dependencies

Install the necessary dependencies with the following command:

```bash
pip3 install -r requirements.txt
```

### Starting Jupyter Lab

To start Jupyter Lab, run:

```bash
jupyter lab
```

### Gitpod

For a pre-configured development environment, use Gitpod by clicking [here](https://gitpod.io/#https://github.com/joakimwinum/bytecore-byte).

### Binder

Alternatively, use Binder for a ready-to-use environment by clicking [here](https://mybinder.org/v2/gh/joakimwinum/bytecore-byte/main?labpath=bytecorebyte.ipynb).

## License

This project is licensed under the terms of the MIT License. See the [LICENSE](https://github.com/joakimwinum/bytecore-byte/blob/main/LICENSE) file for the full text.
Loading

0 comments on commit 85ed97b

Please sign in to comment.