├── .gitattributes
├── .github
└── workflows
│ ├── poetry-publish.yml
│ └── tests.yml
├── .gitignore
├── .run
├── pytest all compile.run.xml
└── pytest all.run.xml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── flipjump
├── README.md
├── __init__.py
├── assembler
│ ├── __init__.py
│ ├── assembler.py
│ ├── fj_parser.py
│ ├── inner_classes
│ │ ├── __init__.py
│ │ ├── expr.py
│ │ └── ops.py
│ └── preprocessor.py
├── fjm
│ ├── __init__.py
│ ├── fjm_consts.py
│ ├── fjm_reader.py
│ └── fjm_writer.py
├── flipjump_cli.py
├── flipjump_quickstart.py
├── interpretter
│ ├── __init__.py
│ ├── debugging
│ │ ├── __init__.py
│ │ ├── breakpoints.py
│ │ ├── macro_usage_graph.py
│ │ └── message_boxes.py
│ ├── fjm_run.py
│ └── io_devices
│ │ ├── BrokenIO.py
│ │ ├── FixedIO.py
│ │ ├── IODevice.py
│ │ ├── StandardIO.py
│ │ └── __init__.py
├── py.typed
├── stl
│ ├── README.md
│ ├── bit
│ │ ├── casting.fj
│ │ ├── cond_jumps.fj
│ │ ├── div.fj
│ │ ├── input.fj
│ │ ├── logics.fj
│ │ ├── math.fj
│ │ ├── memory.fj
│ │ ├── mul.fj
│ │ ├── output.fj
│ │ ├── pointers.fj
│ │ └── shifts.fj
│ ├── casting.fj
│ ├── conf.json
│ ├── hex
│ │ ├── cond_jumps.fj
│ │ ├── div.fj
│ │ ├── input.fj
│ │ ├── logics.fj
│ │ ├── math.fj
│ │ ├── math_basic.fj
│ │ ├── memory.fj
│ │ ├── mul.fj
│ │ ├── output.fj
│ │ ├── pointers
│ │ │ ├── basic_pointers.fj
│ │ │ ├── pointer_arithmetics.fj
│ │ │ ├── read_pointers.fj
│ │ │ ├── stack.fj
│ │ │ ├── write_pointers.fj
│ │ │ ├── xor_from_pointer.fj
│ │ │ └── xor_to_pointer.fj
│ │ ├── shifts.fj
│ │ └── tables_init.fj
│ ├── ptrlib.fj
│ └── runlib.fj
└── utils
│ ├── __init__.py
│ ├── classes.py
│ ├── constants.py
│ ├── exceptions.py
│ └── functions.py
├── ide-extensions
└── pycharm
│ ├── PycharmHighlighting.zip
│ └── fj-pycharm-def-finder.ahk
├── programs
├── calc.fj
├── concept_checks
│ ├── bit_ptr.fj
│ ├── casting.fj
│ ├── hex_ptr.fj
│ ├── pair_ns.fj
│ └── segments.fj
├── func_tests
│ ├── func1.fj
│ ├── func2.fj
│ ├── func3.fj
│ ├── func4.fj
│ ├── func5.fj
│ ├── func6.fj
│ └── func7.fj
├── hexlib_tests
│ ├── 2params
│ │ ├── add.fj
│ │ ├── add_n.fj
│ │ ├── add_shifted.fj
│ │ ├── and.fj
│ │ ├── and_n.fj
│ │ ├── cmp.fj
│ │ ├── cmp_n.fj
│ │ ├── or.fj
│ │ ├── or_n.fj
│ │ ├── sub.fj
│ │ ├── sub_n.fj
│ │ └── sub_shifted.fj
│ ├── basics1
│ │ ├── basic_math.fj
│ │ ├── basic_memory.fj
│ │ ├── if.fj
│ │ ├── input.fj
│ │ ├── print_as_digit.fj
│ │ └── print_int.fj
│ ├── basics2
│ │ ├── add_count_bits.fj
│ │ ├── count_bits.fj
│ │ ├── shift_utils.fj
│ │ ├── shl_bit.fj
│ │ ├── shl_bit_n.fj
│ │ ├── shl_hex.fj
│ │ ├── shl_hex_big.fj
│ │ ├── shl_hex_n.fj
│ │ ├── shr_bit.fj
│ │ ├── shr_bit_n.fj
│ │ ├── shr_hex.fj
│ │ ├── shr_hex_big.fj
│ │ └── shr_hex_n.fj
│ ├── div
│ │ ├── hexlib_div.fj
│ │ ├── test4_1.fj
│ │ ├── test4_2.fj
│ │ ├── test4_4.fj
│ │ ├── test8_1.fj
│ │ ├── test8_2.fj
│ │ ├── test8_4.fj
│ │ ├── test8_8.fj
│ │ ├── test_idiv.fj
│ │ └── test_idiv_cases.fj
│ └── mul
│ │ ├── add_mul32.fj
│ │ ├── add_mul4.fj
│ │ ├── add_mul64.fj
│ │ ├── add_mul8.fj
│ │ ├── add_mul_test.fj
│ │ ├── mul16.fj
│ │ ├── mul32.fj
│ │ ├── mul32_negative.fj
│ │ ├── mul64.fj
│ │ └── mul_test.fj
├── multi_comp
│ ├── a.fj
│ ├── a_no_stl.fj
│ ├── b.fj
│ ├── c.fj
│ └── defs.fj
├── pair_ns_tests
│ ├── test1.fj
│ ├── test2.fj
│ └── test3.fj
├── prime_sieve.fj
├── print_tests
│ ├── cat.fj
│ ├── hello_no-stl.fj
│ ├── hello_world.fj
│ ├── hello_world_with_str.fj
│ ├── hexprint.fj
│ ├── ncat.fj
│ ├── print_as_digit.fj
│ ├── print_dec.fj
│ └── print_hex_int.fj
├── quine16.fj
├── sanity_checks
│ ├── mathbit.fj
│ ├── mathvec.fj
│ ├── not.fj
│ ├── rep.fj
│ ├── simple.fj
│ ├── startup_init_all.fj
│ ├── testbit.fj
│ └── testbit_with_nops.fj
├── simple_math_checks
│ ├── bit_div.fj
│ ├── div10.fj
│ ├── nadd.fj
│ ├── ncmp.fj
│ ├── series_sum.fj
│ └── shra.fj
└── sorts
│ ├── bubble_sort.fj
│ └── utils
│ ├── _byte_memory_access.fj
│ ├── _hex_memory_access.fj
│ ├── _swap_adjacent_using_writes.fj
│ └── _swap_adjacent_using_xors.fj
├── pyproject.toml
├── resources
├── breakpoint.png
├── calc__asm.png
├── calc__run.png
├── calc_stats.png
├── debug_read_memory.png
├── debug_read_memory_result.png
├── hello.gif
├── prime_sieve.gif
├── pytest.gif
└── test_parallel.gif
├── test_parallel
├── test_parallel.bat
├── tests
├── .gitignore
├── README.md
├── __init__.py
├── conf.json
├── conftest.py
├── inout
│ ├── calc_tests
│ │ ├── calc1.in
│ │ ├── calc1.out
│ │ ├── calc10.in
│ │ ├── calc10.out
│ │ ├── calc2.in
│ │ ├── calc2.out
│ │ ├── calc3.in
│ │ ├── calc3.out
│ │ ├── calc4.in
│ │ ├── calc4.out
│ │ ├── calc5.in
│ │ ├── calc5.out
│ │ ├── calc6.in
│ │ ├── calc6.out
│ │ ├── calc7.in
│ │ ├── calc7.out
│ │ ├── calc8.in
│ │ ├── calc8.out
│ │ ├── calc9.in
│ │ ├── calc9.out
│ │ ├── calc_empty.in
│ │ ├── calc_empty.out
│ │ ├── calc_many.in
│ │ └── calc_many.out
│ ├── concept_checks
│ │ ├── bit_ptr.out
│ │ ├── casting.out
│ │ ├── hex_ptr.out
│ │ ├── segments.in
│ │ └── segments.out
│ ├── func_tests
│ │ ├── func1.out
│ │ ├── func2.out
│ │ ├── func3.out
│ │ ├── func4.out
│ │ ├── func5.out
│ │ ├── func6.out
│ │ └── func7.out
│ ├── hexlib_tests
│ │ ├── 2params
│ │ │ ├── 100equals.out
│ │ │ ├── 108equals.out
│ │ │ ├── add.out
│ │ │ ├── and.out
│ │ │ ├── cmp.out
│ │ │ ├── cmp_n.out
│ │ │ ├── or.out
│ │ │ └── sub.out
│ │ ├── basics1
│ │ │ ├── basic_math.out
│ │ │ ├── basic_memory.out
│ │ │ ├── if.out
│ │ │ ├── input.in
│ │ │ ├── input.out
│ │ │ ├── print_as_digit.out
│ │ │ └── print_int.out
│ │ ├── basics2
│ │ │ ├── 100equals.out
│ │ │ ├── 256equals.out
│ │ │ ├── 25equals.out
│ │ │ └── hexlib-basics2.out
│ │ ├── div
│ │ │ ├── test4_1.out
│ │ │ ├── test4_2.out
│ │ │ ├── test4_4.out
│ │ │ ├── test8_1.out
│ │ │ ├── test8_2.out
│ │ │ ├── test8_4.out
│ │ │ ├── test8_8.out
│ │ │ ├── test_idiv.out
│ │ │ └── test_idiv_cases.out
│ │ └── mul
│ │ │ ├── add_mul32.out
│ │ │ ├── add_mul4.out
│ │ │ ├── add_mul64.out
│ │ │ ├── add_mul8.out
│ │ │ ├── mul16.out
│ │ │ ├── mul32.out
│ │ │ └── mul64.out
│ ├── multi_comp
│ │ └── multi_comp.out
│ ├── pair_ns_tests
│ │ ├── pair_ns1.out
│ │ ├── pair_ns2.out
│ │ └── pair_ns3.out
│ ├── prime_sieve_tests
│ │ ├── primes0.in
│ │ ├── primes0.out
│ │ ├── primes1.in
│ │ ├── primes1.out
│ │ ├── primes10.in
│ │ ├── primes10.out
│ │ ├── primes100.in
│ │ ├── primes100.out
│ │ ├── primes107.in
│ │ ├── primes107.out
│ │ ├── primes108.in
│ │ ├── primes108.out
│ │ ├── primes121.in
│ │ ├── primes121.out
│ │ ├── primes2.in
│ │ ├── primes2.out
│ │ ├── primes3.in
│ │ ├── primes3.out
│ │ ├── primes4.in
│ │ ├── primes4.out
│ │ ├── primes5.in
│ │ ├── primes5.out
│ │ ├── primes50.in
│ │ ├── primes50.out
│ │ ├── primes6.in
│ │ ├── primes6.out
│ │ ├── primes7.in
│ │ ├── primes7.out
│ │ ├── primes_err_19a.in
│ │ ├── primes_err_1e17.in
│ │ ├── primes_err_a19.in
│ │ ├── primes_err_abc.in
│ │ ├── primes_err_bad_number.out
│ │ ├── primes_err_empty.in
│ │ ├── primes_err_minus5.in
│ │ └── primes_err_too_big.out
│ ├── print_tests
│ │ ├── cat.in
│ │ ├── cat.out
│ │ ├── hello_no-stl.out
│ │ ├── hello_world.out
│ │ ├── hello_world_with_str.out
│ │ ├── hexprint.out
│ │ ├── ncat.in
│ │ ├── ncat.out
│ │ ├── print_as_digit.out
│ │ ├── print_dec.out
│ │ └── print_hex_int.out
│ ├── sanity_checks
│ │ ├── simple.out
│ │ ├── startup_init_all.out
│ │ ├── testbit.out
│ │ └── testbit_with_nops.out
│ ├── simple_math_checks
│ │ ├── 25equals.out
│ │ ├── bit_div.out
│ │ ├── div10.out
│ │ ├── nadd.out
│ │ ├── ncmp.out
│ │ └── series_sum.out
│ └── sorts
│ │ ├── bubble_sort_1.in
│ │ ├── bubble_sort_1.out
│ │ ├── bubble_sort_2.in
│ │ └── bubble_sort_2.out
├── test_fj.py
└── tests_tables
│ ├── test_compile_fast.csv
│ ├── test_compile_hexlib.csv
│ ├── test_compile_medium.csv
│ ├── test_compile_slow.csv
│ ├── test_run_fast.csv
│ ├── test_run_hexlib.csv
│ ├── test_run_medium.csv
│ ├── test_run_slow.csv
│ ├── xfail_compile.csv
│ └── xfail_run.csv
└── tox.ini
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Show statistics for FlipJump files (as Text files, until FlipJump is Supported in linguist/lib/linguist/languages.yml).
2 | *.fj linguist-language=Text linguist-detectable
3 |
--------------------------------------------------------------------------------
/.github/workflows/poetry-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow will upload the new flipjump python package to pypi, using poetry-publish, everytime a new release is created.
2 |
3 |
4 | name: Python package
5 | on:
6 | release:
7 | types: [published]
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v3
13 | - name: Build and publish to pypi
14 | uses: JRubics/poetry-publish@v1.17
15 | with:
16 | pypi_token: ${{ secrets.PYPI_API_TOKEN }}
17 |
--------------------------------------------------------------------------------
/.github/workflows/tests.yml:
--------------------------------------------------------------------------------
1 | # Note: add all job names to the deploy-status.needs.
2 |
3 | name: Tests
4 |
5 | on:
6 | workflow_dispatch:
7 | pull_request:
8 | branches:
9 | - main
10 |
11 | env:
12 | COLUMNS: 120
13 |
14 | jobs:
15 | test_py_os_variations:
16 | runs-on: ${{ matrix.os }}
17 | strategy:
18 | matrix:
19 | os: [windows-latest, ubuntu-latest, macos-latest]
20 | python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up Python ${{ matrix.python-version }}
25 | uses: actions/setup-python@v4
26 | with:
27 | python-version: ${{ matrix.python-version }}
28 | - name: Install dependencies
29 | run: |
30 | python -m pip install --upgrade pip
31 | pip install tox tox-gh-actions
32 | - name: Test with tox py${{ matrix.python-version }}-${{ matrix.os }}
33 | run: tox -v
34 |
35 | linters_checkers:
36 | runs-on: ubuntu-latest
37 | steps:
38 | - uses: actions/checkout@v4
39 | - name: Set up Python ${{ matrix.python-version }}
40 | uses: actions/setup-python@v4
41 | with:
42 | python-version: 3.13
43 | - name: Install dependencies
44 | run: |
45 | python -m pip install --upgrade pip
46 | pip install .[tests]
47 | - name: Mypy, Flake, Bandit, Black
48 | run: tox -e mypy,flake8,bandit,black
49 |
50 | test_full:
51 | runs-on: ubuntu-latest
52 | steps:
53 | - uses: actions/checkout@v4
54 | - name: Set up Python ${{ matrix.python-version }}
55 | uses: actions/setup-python@v4
56 | with:
57 | python-version: 3.13
58 | - name: Install dependencies
59 | run: |
60 | python -m pip install --upgrade pip
61 | pip install .[tests]
62 | - name: Test pytest
63 | run: |
64 | pytest --compile -n auto --all --junitxml=./compile-test-results.xml
65 | pytest --run -n auto --all --junitxml=./run-test-results.xml
66 | - name: Show tests results
67 | if: always()
68 | uses: pmeier/pytest-results-action@main
69 | with:
70 | path: ./*-test-results.xml
71 |
72 | # This allows us to have a branch protection rule this entire workflow
73 | deploy-status:
74 | runs-on: ubuntu-latest
75 | needs: [ test_py_os_variations, linters_checkers, test_full ]
76 | if: always()
77 | steps:
78 | - name: Successful deploy
79 | if: ${{ !(contains(needs.*.result, 'failure')) }}
80 | run: exit 0
81 | - name: Failing deploy
82 | if: ${{ contains(needs.*.result, 'failure') }}
83 | run: exit 1
84 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | a.fjm
2 |
3 | lab/
4 |
5 | # IDE's
6 | .idea
7 |
8 | # Mac files
9 | ._*
10 |
11 |
12 | # Python
13 |
14 | # Byte-compiled / optimized / DLL files
15 | __pycache__/
16 | *.py[cod]
17 | *$py.class
18 |
19 | # Distribution / packaging
20 | .Python
21 | build/
22 | develop-eggs/
23 | dist/
24 | downloads/
25 | eggs/
26 | .eggs/
27 | lib/
28 | lib64/
29 | parts/
30 | sdist/
31 | var/
32 | wheels/
33 | pip-wheel-metadata/
34 | share/python-wheels/
35 | *.egg-info/
36 | .installed.cfg
37 | *.egg
38 | MANIFEST
39 |
40 | # PyInstaller
41 | # Usually these files are written by a python script from a template
42 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
43 | *.manifest
44 | *.spec
45 |
46 | # Installer logs
47 | pip-log.txt
48 | pip-delete-this-directory.txt
49 |
50 | # Unit test / coverage reports
51 | htmlcov/
52 | .tox/
53 | .nox/
54 | .coverage
55 | .coverage.*
56 | .cache
57 | nosetests.xml
58 | coverage.xml
59 | *.cover
60 | *.py,cover
61 | .hypothesis/
62 | .pytest_cache/
63 |
64 | # Translations
65 | *.mo
66 | *.pot
67 |
68 | # Django stuff:
69 | *.log
70 | local_settings.py
71 | db.sqlite3
72 | db.sqlite3-journal
73 |
74 | # Flask stuff:
75 | instance/
76 | .webassets-cache
77 |
78 | # Scrapy stuff:
79 | .scrapy
80 |
81 | # Sphinx documentation
82 | docs/_build/
83 |
84 | # PyBuilder
85 | target/
86 |
87 | # Jupyter Notebook
88 | .ipynb_checkpoints
89 |
90 | # IPython
91 | profile_default/
92 | ipython_config.py
93 |
94 | # pyenv
95 | .python-version
96 |
97 | # pipenv
98 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
100 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
101 | # install all needed dependencies.
102 | #Pipfile.lock
103 |
104 | # celery beat schedule file
105 | celerybeat-schedule
106 |
107 | # SageMath parsed files
108 | *.sage.py
109 |
110 | # Environments
111 | .env
112 | .venv
113 | env/
114 | venv/
115 | ENV/
116 | env.bak/
117 | venv.bak/
118 |
119 | # Spyder project settings
120 | .spyderproject
121 | .spyproject
122 |
123 | # Rope project settings
124 | .ropeproject
125 |
126 | # mkdocs documentation
127 | /site
128 |
129 | # mypy
130 | .mypy_cache/
131 | .dmypy.json
132 | dmypy.json
133 |
134 | # Pyre type checker
135 | .pyre/
136 |
--------------------------------------------------------------------------------
/.run/pytest all compile.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.run/pytest all.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 2-Clause License
2 |
3 | Copyright (c) 2023, Tom Herman
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/flipjump/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.flipjump_cli import assemble_run_according_to_cmd_line_args
2 | from flipjump.flipjump_quickstart import (
3 | assemble,
4 | run,
5 | debug,
6 | run_test_output,
7 | assemble_and_run,
8 | assemble_and_debug,
9 | assemble_and_run_test_output,
10 | )
11 | from flipjump.fjm.fjm_consts import FJMVersion, FJ_MAGIC
12 | from flipjump.interpretter.fjm_run import TerminationStatistics
13 | from flipjump.utils.classes import TerminationCause
14 | from flipjump.utils.functions import get_stl_paths
15 | from flipjump.utils.exceptions import IODeviceException, FlipJumpException
16 | from flipjump.interpretter.io_devices.IODevice import IODevice
17 | from flipjump.interpretter.io_devices.FixedIO import FixedIO
18 | from flipjump.interpretter.io_devices.StandardIO import StandardIO
19 | from flipjump.interpretter.io_devices.BrokenIO import BrokenIO
20 |
21 |
22 | __all__ = [
23 | 'assemble_run_according_to_cmd_line_args',
24 | 'assemble',
25 | 'run',
26 | 'debug',
27 | 'run_test_output',
28 | 'assemble_and_run',
29 | 'assemble_and_debug',
30 | 'assemble_and_run_test_output',
31 | 'FJMVersion',
32 | 'FJ_MAGIC',
33 | 'TerminationCause',
34 | 'TerminationStatistics',
35 | 'FlipJumpException',
36 | 'get_stl_paths',
37 | ]
38 |
--------------------------------------------------------------------------------
/flipjump/assembler/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.assembler.assembler import assemble
2 |
3 |
4 | __all__ = [
5 | 'assemble',
6 | ]
7 |
--------------------------------------------------------------------------------
/flipjump/assembler/inner_classes/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.assembler.inner_classes.expr import Expr
2 |
3 |
4 | __all__ = [
5 | 'Expr',
6 | ]
7 |
--------------------------------------------------------------------------------
/flipjump/fjm/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.fjm.fjm_consts import FJ_MAGIC, FJMVersion
2 |
3 |
4 | __all__ = [
5 | 'FJ_MAGIC',
6 | 'FJMVersion',
7 | ]
8 |
--------------------------------------------------------------------------------
/flipjump/fjm/fjm_consts.py:
--------------------------------------------------------------------------------
1 | import lzma
2 | from enum import Enum
3 | from typing import List, Dict
4 |
5 |
6 | """
7 | struct {
8 | u16 fj_magic; // 'F' + 'J'<<8 (0x4a46)
9 | u16 word_size; // number of bits in the memory / a memory-word. also called "w".
10 | u64 version;
11 | u64 segment_num;
12 | { // for versions > 0
13 | u64 flags;
14 | u32 reserved; // 0
15 | }
16 | struct segment {
17 | u64 segment_start; // in memory words (w-bits)
18 | u64 segment_length; // in memory words (w-bits)
19 | u64 data_start; // in the outer-struct.data words (w-bits)
20 | u64 data_length; // in the outer-struct.data words (w-bits)
21 | } *segments; // segments[segment_num]
22 | u8* data; // the data (might be compressed in some versions)
23 | } fjm_file; // Flip-Jump Memory file
24 | """
25 |
26 |
27 | FJ_MAGIC = ord('F') + (ord('J') << 8)
28 |
29 |
30 | _reserved_dict_threshold = 1000
31 |
32 | _header_base_format = ' List[Dict[str, int]]:
62 | return [{"id": lzma.FILTER_LZMA2, "preset": preset, "nice_len": dw}]
63 |
64 |
65 | def _new_garbage_val() -> int:
66 | return 0 # The value read when reading a word outside any segment.
67 |
--------------------------------------------------------------------------------
/flipjump/interpretter/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.interpretter.fjm_run import TerminationStatistics, run
2 |
3 |
4 | __all__ = [
5 | 'TerminationStatistics',
6 | 'run',
7 | ]
8 |
--------------------------------------------------------------------------------
/flipjump/interpretter/debugging/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/flipjump/interpretter/debugging/__init__.py
--------------------------------------------------------------------------------
/flipjump/interpretter/debugging/message_boxes.py:
--------------------------------------------------------------------------------
1 | from typing import List, Optional
2 |
3 | from flipjump.utils.exceptions import FlipJumpMissingImportException
4 |
5 |
6 | EASYGUI_NOT_INSTALLED_MESSAGE = (
7 | "This debug feature requires the easygui python library.\n"
8 | "Try `pip install easygui`, and also install tkinter on your system."
9 | )
10 |
11 |
12 | def display_message_box_with_choices_and_get_answer(
13 | body_message: str, title_message: str, choices: List[str], default_cancel_answer: str
14 | ) -> str:
15 | """
16 | Displays the message box query (with fixed choices), and return the answer.
17 | If easygui isn't installed correctly, raises an exception.
18 | """
19 | try:
20 | # might generate an 'import from collections is deprecated' warning if using easygui-version <= 0.98.3.
21 | import easygui
22 | except ImportError:
23 | raise FlipJumpMissingImportException(EASYGUI_NOT_INSTALLED_MESSAGE)
24 |
25 | answer: Optional[str] = easygui.buttonbox(body_message, title_message, choices)
26 | if answer is None:
27 | return default_cancel_answer
28 | return answer
29 |
30 |
31 | def display_message_box(body_message: str, title_message: str) -> None:
32 | """
33 | Displays the message box to the user.
34 | If easygui isn't installed correctly, raises an exception.
35 | """
36 | try:
37 | # might generate an 'import from collections is deprecated' warning if using easygui-version <= 0.98.3.
38 | import easygui
39 | except ImportError:
40 | raise FlipJumpMissingImportException(EASYGUI_NOT_INSTALLED_MESSAGE)
41 |
42 | easygui.msgbox(msg=body_message, title=title_message)
43 |
44 |
45 | def display_message_box_and_get_text_answer(body_message: str, title_message: str) -> Optional[str]:
46 | """
47 | Displays the message box query, and return the textual answer.
48 | If easygui isn't installed correctly, raises an exception.
49 | """
50 | try:
51 | # might generate an 'import from collections is deprecated' warning if using easygui-version <= 0.98.3.
52 | import easygui
53 | except ImportError:
54 | raise FlipJumpMissingImportException(EASYGUI_NOT_INSTALLED_MESSAGE)
55 |
56 | answer: Optional[str] = easygui.enterbox(msg=body_message, title=title_message)
57 | return answer
58 |
--------------------------------------------------------------------------------
/flipjump/interpretter/io_devices/BrokenIO.py:
--------------------------------------------------------------------------------
1 | from flipjump.interpretter.io_devices.IODevice import IODevice
2 | from flipjump.utils.exceptions import BrokenIOUsed
3 |
4 |
5 | class BrokenIO(IODevice):
6 | """
7 | IO device that raises error on any IO action
8 | """
9 |
10 | def read_bit(self) -> bool:
11 | raise BrokenIOUsed("program tried to read a bit from the BrokenIO device")
12 |
13 | def write_bit(self, bit: bool) -> None:
14 | raise BrokenIOUsed(f"program tried to write a bit ({int(bit)}) to the BrokenIO device")
15 |
16 | def get_output(self, *, allow_incomplete_output: bool = False) -> bytes:
17 | raise BrokenIOUsed("program tried to get current output from a BrokenIO device")
18 |
19 | # default __del__
20 |
--------------------------------------------------------------------------------
/flipjump/interpretter/io_devices/FixedIO.py:
--------------------------------------------------------------------------------
1 | from flipjump.interpretter.io_devices.IODevice import IODevice
2 | from flipjump.utils.exceptions import IOReadOnEOF, IncompleteOutput
3 |
4 |
5 | class FixedIO(IODevice):
6 | """
7 | read from fixed input, don't output (with get_output functionality)
8 | """
9 |
10 | def __init__(self, _input: bytes):
11 | self.remaining_input = _input
12 | self._output = b''
13 |
14 | self.current_input_byte = 0
15 | self.bits_to_read_in_input_byte = 0
16 |
17 | self.current_output_byte = 0
18 | self.bits_to_write_in_output_byte = 0
19 |
20 | def read_bit(self) -> bool:
21 | if 0 == self.bits_to_read_in_input_byte:
22 | if not self.remaining_input:
23 | raise IOReadOnEOF("Read an empty input on fixed IO (EOF)")
24 |
25 | self.current_input_byte = self.remaining_input[0]
26 | self.remaining_input = self.remaining_input[1:]
27 | self.bits_to_read_in_input_byte = 8
28 |
29 | bit = (self.current_input_byte & 1) == 1
30 | self.current_input_byte >>= 1
31 | self.bits_to_read_in_input_byte -= 1
32 | return bit
33 |
34 | def write_bit(self, bit: bool) -> None:
35 | self.current_output_byte |= bit << self.bits_to_write_in_output_byte
36 | self.bits_to_write_in_output_byte += 1
37 |
38 | if 8 == self.bits_to_write_in_output_byte:
39 | self._output += self.current_output_byte.to_bytes(1, 'little')
40 | self.current_output_byte = 0
41 | self.bits_to_write_in_output_byte = 0
42 |
43 | def get_output(self, *, allow_incomplete_output: bool = False) -> bytes:
44 | """
45 | @raise IncompleteOutput when the number of outputted bits can't be divided by 8
46 | @return: full output until now
47 | """
48 | if not allow_incomplete_output and 0 != self.bits_to_write_in_output_byte:
49 | raise IncompleteOutput(
50 | "tries to get output when an unaligned number of bits was outputted " "(doesn't divide 8)"
51 | )
52 |
53 | return self._output
54 |
--------------------------------------------------------------------------------
/flipjump/interpretter/io_devices/IODevice.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 |
3 |
4 | class IODevice(ABC):
5 | """
6 | abstract IO device
7 | """
8 |
9 | @abstractmethod
10 | def read_bit(self) -> bool:
11 | return False
12 |
13 | @abstractmethod
14 | def write_bit(self, bit: bool) -> None:
15 | pass
16 |
17 | @abstractmethod
18 | def get_output(self, *, allow_incomplete_output: bool = False) -> bytes:
19 | pass
20 |
21 | # Also, each class should implement a "__del__" to flush last changes before it gets deleted.
22 |
--------------------------------------------------------------------------------
/flipjump/interpretter/io_devices/StandardIO.py:
--------------------------------------------------------------------------------
1 | from sys import stdin, stdout
2 |
3 | from flipjump.interpretter.io_devices.IODevice import IODevice
4 | from flipjump.utils.exceptions import IOReadOnEOF, IncompleteOutput
5 | from flipjump.utils.constants import IO_BYTES_ENCODING
6 |
7 |
8 | class StandardIO(IODevice):
9 | """
10 | read from stdin, write to stdout
11 | """
12 |
13 | def __init__(self, output_verbose: bool):
14 | """
15 | @param output_verbose: if true print program's output
16 | """
17 | self.output_verbose = output_verbose
18 | self._output = b''
19 |
20 | self.current_input_byte = 0
21 | self.bits_to_read_in_input_byte = 0
22 |
23 | self.current_output_byte = 0
24 | self.bits_to_write_in_output_byte = 0
25 |
26 | def read_bit(self) -> bool:
27 | if 0 == self.bits_to_read_in_input_byte:
28 | read_bytes = stdin.read(1).encode(encoding=IO_BYTES_ENCODING)
29 | if 0 == len(read_bytes):
30 | raise IOReadOnEOF("Read an empty input on standard IO (EOF)")
31 |
32 | self.current_input_byte = read_bytes[0]
33 | self.bits_to_read_in_input_byte = 8
34 |
35 | bit = (self.current_input_byte & 1) == 1
36 | self.current_input_byte >>= 1
37 | self.bits_to_read_in_input_byte -= 1
38 | return bit
39 |
40 | def write_bit(self, bit: bool) -> None:
41 | self.current_output_byte |= bit << self.bits_to_write_in_output_byte
42 | self.bits_to_write_in_output_byte += 1
43 |
44 | if 8 == self.bits_to_write_in_output_byte:
45 | curr_output: bytes = self.current_output_byte.to_bytes(1, 'little')
46 | if self.output_verbose:
47 | stdout.write(curr_output.decode(encoding=IO_BYTES_ENCODING))
48 | stdout.flush()
49 | self._output += curr_output
50 | self.current_output_byte = 0
51 | self.bits_to_write_in_output_byte = 0
52 |
53 | def get_output(self, *, allow_incomplete_output: bool = False) -> bytes:
54 | if not allow_incomplete_output and 0 != self.bits_to_write_in_output_byte:
55 | raise IncompleteOutput(
56 | "tries to get output when an unaligned number of bits was outputted " "(doesn't divide 8)"
57 | )
58 |
59 | return self._output
60 |
--------------------------------------------------------------------------------
/flipjump/interpretter/io_devices/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.interpretter.io_devices.BrokenIO import BrokenIO
2 | from flipjump.interpretter.io_devices.FixedIO import FixedIO
3 | from flipjump.interpretter.io_devices.IODevice import IODevice
4 | from flipjump.interpretter.io_devices.StandardIO import StandardIO
5 |
6 |
7 | __all__ = [
8 | 'BrokenIO',
9 | 'FixedIO',
10 | 'IODevice',
11 | 'StandardIO',
12 | ]
13 |
--------------------------------------------------------------------------------
/flipjump/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/flipjump/py.typed
--------------------------------------------------------------------------------
/flipjump/stl/bit/cond_jumps.fj:
--------------------------------------------------------------------------------
1 | // ---------- Conditional Jumps
2 |
3 |
4 | ns bit {
5 | // Complexity: @+2
6 | // if x == 0 jump to l0, else jump to l1
7 | // x is a bit, l0,l1 are addresses.
8 | def if x, l0, l1 @ label_ptr, base_jump_label {
9 | .xor label_ptr, x
10 | label_ptr:
11 | ;base_jump_label
12 | pad 2
13 | base_jump_label:
14 | ;l0
15 | label_ptr + dbit;l1
16 | }
17 |
18 | // Complexity: n(@+2)
19 | // if x[:n] == 0 jump to l0, else jump to l1
20 | // x is bit[:n], l0,l1 are addresses.
21 | def if n, x, l0, l1 {
22 | rep(n-1, i) .if1 x+i*dw, l1
23 | .if x+(n-1)*dw, l0, l1
24 | }
25 |
26 | // Complexity: @+2
27 | // if x == 1 jump to l1
28 | // x is a bit, l1 is an address.
29 | def if1 x, l1 @ end {
30 | .if x, end, l1
31 | end:
32 | }
33 |
34 | // Complexity: n(@+2)
35 | // if the x[:n] != 0 jump to l1
36 | // x is bit[:n], l1 is an address.
37 | def if1 n, x, l1 @ end {
38 | .if n, x, end, l1
39 | end:
40 | }
41 |
42 | // Complexity: @+2
43 | // if x == 0 jump to l0
44 | // x is a bit, l0 is an address.
45 | def if0 x, l0 @ end {
46 | .if x, l0, end
47 | end:
48 | }
49 |
50 | // Complexity: n(@+2)
51 | // if x[:n] == 0 jump to l0
52 | // x is bit[:n], l0 is an address.
53 | def if0 n, x, l0 @ end {
54 | .if n, x, l0, end
55 | end:
56 | }
57 |
58 |
59 | // Complexity: 2@+4
60 | // Space: 3@+6
61 | // jump to:
62 | // a < b: lt
63 | // a = b: eq
64 | // a > b: gt
65 | // a,b are bits, lt,eq,gt are addresses.
66 | def cmp a, b, lt, eq, gt @ a_is1_label {
67 | .if1 a, a_is1_label
68 | .if b, eq, lt
69 | a_is1_label:
70 | .if b, gt, eq
71 | }
72 |
73 | // TIme Complexity: n(2@+4)
74 | // Space Complexity: n(3@+6)
75 | // jump to:
76 | // a[:n] < b[:n]: lt
77 | // a[:n] = b[:n]: eq
78 | // a[:n] > b[:n]: gt
79 | // a,b are bit[:n], lt,eq,gt are addresses.
80 | def cmp n, a, b, lt, eq, gt {
81 | rep(n-1, i) ._.cmp_next_eq a+(n-1-i)*dw, b+(n-1-i)*dw, lt, gt
82 | .cmp a, b, lt, eq, gt
83 | }
84 | ns _ {
85 | // Complexity: 2@+4
86 | // Space: 3@+6
87 | // jump to:
88 | // a < b: lt
89 | // a = b: continue
90 | // a > b: gt
91 | // a,b are bits, lt,gt are addresses.
92 | def cmp_next_eq a, b, lt, gt @ eq {
93 | ..cmp a, b, lt, eq, gt
94 | eq:
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/flipjump/stl/bit/input.fj:
--------------------------------------------------------------------------------
1 | // ---------- Input:
2 |
3 |
4 |
5 | ns bit {
6 | // Complexity: 2@-2
7 | // input one bit into the bit-variable, 'dst'.
8 | // dst is an output parameter.
9 | def input_bit dst < stl.IO {
10 | .zero dst
11 | .xor dst, stl.IO
12 | }
13 |
14 |
15 | // Complexity: 16@-16
16 | // input one byte into dst[:8] (lsb first)
17 | // dst is an output parameter.
18 | def input dst {
19 | rep(8, i) .input_bit dst+i*dw
20 | }
21 |
22 |
23 | // Complexity: n(16@-16)
24 | // input n bytes into dst[:8n] (lsb first)
25 | // dst is an output parameter.
26 | def input n, dst {
27 | rep(n, i) .input dst+8*(n-1-i)*dw
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/flipjump/stl/bit/logics.fj:
--------------------------------------------------------------------------------
1 | // ---------- Logical Macros
2 |
3 |
4 | ns bit {
5 | // Complexity: @-1
6 | // dst ^= src
7 | // dst,src are bits.
8 | def xor dst, src {
9 | .exact_xor dst + dbit, src
10 | }
11 |
12 | // Complexity: n(@-1)
13 | // dst[:n] ^= src[:n]
14 | // dst,src are bit[:n].
15 | def xor n, dst, src {
16 | rep(n, i) .xor dst+dw*i, src+dw*i
17 | }
18 |
19 | // Complexity: @-1
20 | // note: pad 2 is needed, but pad 8 is used for wflips-padding optimization and for smaller wflips.
21 | // dst(bit_address) ^= src
22 | // dst,src are bits.
23 | def exact_xor dst, src @ base_jump_label, cleanup {
24 | wflip src+w, base_jump_label, src
25 | pad 8
26 | base_jump_label:
27 | ;cleanup
28 | dst;
29 | cleanup:
30 | wflip src+w, base_jump_label
31 | }
32 |
33 | // Complexity: @
34 | // note: pad 2 is needed, but pad 8 is used for wflips-padding optimization and for smaller wflips.
35 | // dst1(bit_address) ^= src
36 | // dst2(bit_address) ^= src
37 | // dst1,dst2,src are bits.
38 | def double_exact_xor dst1, dst2, src @ base_jump_label, cleanup {
39 | wflip src+w, base_jump_label, src
40 | pad 8
41 | base_jump_label:
42 | ;cleanup
43 | dst1;
44 | dst2;
45 | cleanup:
46 | wflip src+w, base_jump_label
47 | }
48 |
49 | // Complexity: n@
50 | // address(bit_address) ^= src
51 | // var ^= src
52 | // var,src are bit[:n], address is an address.
53 | def address_and_variable_xor n, address, var, src {
54 | rep(n, i) .double_exact_xor address+i, var+dbit+i*dw, src+i*dw
55 | }
56 |
57 | // Complexity: @
58 | // dst ^= src
59 | // src = 0
60 | // dst,src are bits.
61 | def xor_zero dst, src {
62 | .double_exact_xor dst+dbit, src+dbit, src
63 | }
64 |
65 | // Complexity: n@
66 | // dst[:n] ^= src[:n]
67 | // src[:n] = 0
68 | // dst,src are bit[:n].
69 | def xor_zero n, dst, src {
70 | rep(n, i) .xor_zero dst+dw*i, src+dw*i
71 | }
72 |
73 |
74 | // Complexity: 2@+2
75 | // dst |= src
76 | // dst,src are bits.
77 | def or dst, src @ end {
78 | .if0 src, end
79 | .one dst
80 | end:
81 | }
82 |
83 | // Complexity: n(2@+2)
84 | // dst[:n] |= src[:n]
85 | // dst,src are bit[:n].
86 | def or n, dst, src {
87 | rep(n, i) .or dst+dw*i, src+dw*i
88 | }
89 |
90 |
91 | // Complexity: 2@+2
92 | // dst &= src
93 | // dst,src are bits.
94 | def and dst, src @ end {
95 | .if1 src, end
96 | .zero dst
97 | end:
98 | }
99 |
100 | // Complexity: n(2@+2)
101 | // dst[:n] &= src[:n]
102 | // dst,src are bit[:n].
103 | def and n, dst, src {
104 | rep(n, i) .and dst+dw*i, src+dw*i
105 | }
106 |
107 |
108 | // Complexity: 1
109 | // dst ^= 1
110 | // dst is a bit.
111 | def not dst {
112 | dst + dbit;
113 | }
114 |
115 | // Complexity: n
116 | // dst[:n] ^= (1<>i)&1
22 | }
23 | def vec n {
24 | rep(n, i) .bit
25 | }
26 | }
27 |
28 |
29 | // ---------- Memory Manipulation
30 |
31 |
32 | ns bit {
33 | // Complexity: @-1
34 | // bit = 0
35 | def zero bit {
36 | .xor bit, bit
37 | }
38 |
39 | // Complexity: n(@-1)
40 | // x[:n] = 0
41 | def zero n, x {
42 | rep(n, i) .zero x+i*dw
43 | }
44 |
45 |
46 | // Complexity: @
47 | // bit = 1
48 | def one bit {
49 | .zero bit
50 | .not bit
51 | }
52 |
53 | // Complexity: n@
54 | // x[:n] = (1<>= 1
7 | def shr n, x {
8 | .shr n, 1, x
9 | }
10 |
11 | // Complexity: n(2@-1)
12 | // x[:n] >>= times
13 | // times is a constant.
14 | def shr n, times, x {
15 | rep(n-times, i) .mov x+i*dw, x+(i+times)*dw
16 | .zero times, x+(n-times)*dw
17 | }
18 |
19 | // Complexity: n(2@-1)
20 | // x[:n] >>= times (arithmetic shift right)
21 | // times is a constant.
22 | def shra n, times, x {
23 | rep(n-times, i) .mov x+i*dw, x+(i+times)*dw
24 | rep(times-1, i) .mov x+(n-1-(i+1))*dw, x+(n-1)*dw
25 | }
26 |
27 |
28 | // Complexity: n(2@-1)
29 | // x[:n] <<= 1
30 | def shl n, x {
31 | .shl n, 1, x
32 | }
33 |
34 | // Complexity: n(2@-1)
35 | // x[:n] <<= times
36 | // times is a constant.
37 | def shl n, times, x {
38 | rep(n-times, i) .mov x+(n-1-i)*dw, x+(n-1-i-times)*dw
39 | .zero times, x
40 | }
41 |
42 |
43 | // Complexity: n(2@-1)
44 | // rotate x[:n] right by 1-bit
45 | def ror n, x @ temp_bit {
46 | .mov temp_bit, x
47 | rep(n-1, i) .mov x+i*dw, x+(i+1)*dw
48 | .mov x+(n-1)*dw, temp_bit
49 | stl.skip
50 | temp_bit:
51 | .bit
52 | }
53 |
54 |
55 | // Complexity: n(2@-1)
56 | // rotate x[:n] left by 1-bit
57 | def rol n, x @ temp_bit {
58 | .mov temp_bit, x+(n-1)*dw
59 | rep(n-1, i) .mov x+(n-1-i)*dw, x+(n-1-i-1)*dw
60 | .mov x, temp_bit
61 | stl.skip
62 | temp_bit:
63 | .bit
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/flipjump/stl/casting.fj:
--------------------------------------------------------------------------------
1 | // ---------- Casting from bit
2 |
3 |
4 | ns stl {
5 | // Time Complexity: 2@-1
6 | // Space Complexity: 2@+11
7 | //
8 | // hex = bit
9 | //
10 | // hex is a hex, bit is a bit.
11 | def bit2hex hex, bit {
12 | hex.zero hex
13 | bit.xor hex, bit
14 | }
15 |
16 | // Time Complexity: n(1.25@-1)
17 | // Space Complexity: n(1.25@+2)
18 | //
19 | // hex[:(n+3)/4] = bit[:n]
20 | //
21 | // n is a size-constant, hex is a hex.vec (n+3)/4, bit is a bit.vec n.
22 | def bit2hex n, hex, bit {
23 | hex.zero (n+3)/4, hex
24 | rep(n, i) bit.exact_xor hex+(i/4)*dw+dbit+(i%4), bit+i*dw
25 | }
26 |
27 |
28 |
29 | // ---------- Casting from hex
30 |
31 |
32 | // Time Complexity: 5@-4
33 | // Space Complexity: 5@+8
34 | //
35 | // bit[:4] = hex
36 | //
37 | // hex is a hex, bit is a bit.vec 4.
38 | def hex2bit bit, hex {
39 | bit.zero 4, bit
40 | hex.exact_xor bit+3*dw+dbit, bit+2*dw+dbit, bit+dw+dbit, bit+dbit, hex
41 | }
42 |
43 | // Time Complexity: n(5@-4)
44 | // Space Complexity: n(5@+8)
45 | //
46 | // bit[:4n] = hex[:n]
47 | //
48 | // n is a size-constant, hex is a hex.vec n, bit is a bit.vec 4*n.
49 | def hex2bit n, bit, hex {
50 | rep(n, i) .hex2bit bit+4*i*dw, hex+i*dw
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/flipjump/stl/conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "all": [
3 | "runlib",
4 | "casting",
5 | "ptrlib",
6 |
7 | "bit/memory",
8 | "bit/logics",
9 | "bit/cond_jumps",
10 | "bit/shifts",
11 | "bit/math",
12 | "bit/input",
13 | "bit/output",
14 | "bit/casting",
15 | "bit/pointers",
16 | "bit/mul",
17 | "bit/div",
18 |
19 | "hex/memory",
20 | "hex/logics",
21 | "hex/math",
22 | "hex/math_basic",
23 | "hex/shifts",
24 | "hex/cond_jumps",
25 | "hex/tables_init",
26 | "hex/input",
27 | "hex/output",
28 | "hex/mul",
29 | "hex/div",
30 |
31 | "hex/pointers/basic_pointers",
32 | "hex/pointers/xor_to_pointer",
33 | "hex/pointers/xor_from_pointer",
34 | "hex/pointers/read_pointers",
35 | "hex/pointers/write_pointers",
36 | "hex/pointers/stack",
37 | "hex/pointers/pointer_arithmetics"
38 | ]
39 | }
--------------------------------------------------------------------------------
/flipjump/stl/hex/input.fj:
--------------------------------------------------------------------------------
1 | // ---------- Input Hex
2 |
3 |
4 | ns hex {
5 | // Time Complexity: 2@+7
6 | // Space Complexity: 2@+18
7 | // hex := input(4bits) // lsb first
8 | def input_hex hex @ flip0, flip1, flip2, flip3, end < stl.IO {
9 | // part0
10 | .zero hex
11 | wflip stl.IO+w, flip0, stl.IO
12 |
13 | pad 8
14 | flip0:
15 | stl.IO+dbit+1;stl.IO // part1
16 | hex+dbit+0;flip0 //(part0.5)
17 | flip1:
18 | stl.IO+dbit+2;stl.IO // part2
19 | hex+dbit+1;flip1 //(part1.5)
20 | flip3:
21 | wflip stl.IO+w, flip3, end // part4
22 | hex+dbit+3;flip3 //(part3.5)
23 | flip2:
24 | stl.IO+dbit+1;stl.IO // part3
25 | hex+dbit+2;flip2 //(part2.5)
26 | end:
27 | }
28 |
29 | // Time Complexity: 4@+14
30 | // Space Complexity: 4@+36
31 | // byte[:2] = input(8bits) // lsb first
32 | def input byte {
33 | .input_hex byte
34 | .input_hex byte+dw
35 | }
36 |
37 | // Time Complexity: n(4@+14)
38 | // Space Complexity: n(4@+36)
39 | // bytes[:2n] = input(8n-bits) // lsb first
40 | def input n, bytes {
41 | rep(n, i) .input bytes+2*i*dw
42 | }
43 |
44 | // Time Complexity: 7@+11
45 | // Space Complexity: 8.5@+92
46 | // hex = hex_from_ascii(input(1byte))
47 | // *supports 0-9,a-f,A-F. if can't cast, jumps to error.
48 | def input_as_hex hex, error @ try_dec, do_dec, do_hex, hex_switch, finish_hex, upper, end {
49 | .input_hex hex
50 | .input_hex upper
51 | .if_flags upper, (1<<4)|(1<<6), try_dec, do_hex
52 | try_dec:
53 | .if_flags upper, (1<<3), error, do_dec
54 |
55 | do_dec: // if input==0x3i for 0<=i<=9, finish; else, goto error.
56 | .if_flags hex, (1<<10)-1, error, end
57 |
58 | do_hex: // if input==0x4i or input==0x6i:
59 | wflip hex+w, hex_switch, hex
60 |
61 | finish_hex:
62 | hex+dbit+3;
63 | wflip hex+w, hex_switch, end
64 |
65 | pad 16
66 | hex_switch: // if 1<=hex<=6, hex+=9; else, goto error.
67 | wflip hex+w, hex_switch, error // 0
68 | hex+dbit+1;hex_switch+2*dw // 1
69 | hex+dbit+0;finish_hex // 2
70 | hex+dbit+2;hex_switch+1*dw // 3
71 | hex+dbit+0;finish_hex // 4
72 | hex+dbit+1;hex_switch+2*dw // 5
73 | hex+dbit+0;finish_hex // 6
74 | ;hex_switch // 7
75 | ;hex_switch
76 | ;hex_switch
77 | ;hex_switch
78 | ;hex_switch
79 | ;hex_switch
80 | ;hex_switch
81 | ;hex_switch
82 | ;hex_switch
83 |
84 | upper: .hex
85 | end:
86 | }
87 |
88 | // Time Complexity: n(7@+11)
89 | // Space Complexity: n(8.5@+92)
90 | // hex[:n] = hex_from_ascii(input(n-bytes))
91 | // *supports 0-9,a-f,A-F. if can't cast, jumps to error.
92 | def input_as_hex n, hex, error {
93 | rep(n, i) .input_as_hex hex + (n-1-i)*dw, error
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/flipjump/stl/hex/pointers/pointer_arithmetics.fj:
--------------------------------------------------------------------------------
1 | // ---------- Ptr ++/--/+=/-=
2 |
3 |
4 | ns hex {
5 | // Time Complexity: 9@+14
6 | // Space Complexity: w(0.375@ + 3.25) + 5@+55 (for log(w) in 16,32,64,128)
7 | // ptr[:w/4] += 2w
8 | // @requires hex.add.init (or hex.init)
9 | def ptr_inc ptr {
10 | hex.add_constant w/4, ptr, dw
11 | }
12 |
13 | // Time Complexity: 9@+23
14 | // Space Complexity: w(0.375@ + 3.25) + 5@+67 (for log(w) in 16,32,64,128)
15 | // ptr[:w/4] -= 2w
16 | // @requires hex.sub.init (or hex.init)
17 | def ptr_dec ptr {
18 | hex.sub_constant w/4, ptr, dw
19 | }
20 |
21 | // Time Complexity: 13@+26
22 | // Space Complexity: w(0.375@ + 3.25) + 7.5@+94
23 | // ptr[:w/4] += value * 2w (advance ptr by value)
24 | // @requires hex.add.init (or hex.init)
25 | // @note: The complexity is calculated with n_const=2, and for log(w) in 16,32,64,128.
26 | def ptr_add ptr, value {
27 | hex.add_constant w/4, ptr, value * dw
28 | }
29 |
30 | // Time Complexity: 13@+35
31 | // Space Complexity: w(0.375@ + 3.25) + 7.5@+106
32 | // ptr[:w/4] -= value * 2w (retreat ptr by value)
33 | // @requires hex.add.init (or hex.init)
34 | // @note: The complexity is calculated with n_const=2, and for log(w) in 16,32,64,128.
35 | def ptr_sub ptr, value {
36 | hex.sub_constant w/4, ptr, value * dw
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/flipjump/stl/hex/pointers/read_pointers.fj:
--------------------------------------------------------------------------------
1 | // ---------- Read Pointers
2 |
3 |
4 | ns hex {
5 | // Time Complexity: w(0.75@+ 5) + 7@+13
6 | // Space Complexity: w(0.75@+29) + 7@+48
7 | // like: dst = *ptr
8 | // dst is a hex. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
9 | def read_hex dst, ptr {
10 | .zero dst
11 | .xor_hex_from_ptr dst, ptr
12 | }
13 |
14 | // Time Complexity: w(0.75@+ 5) + 9@+13
15 | // Space Complexity: w(0.75@+29) + 9@+72
16 | // like: dst[:2] = *ptr
17 | // dst is a hex[:2]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
18 | def read_byte dst, ptr {
19 | .zero 2, dst
20 | .xor_byte_from_ptr dst, ptr
21 | }
22 | }
23 |
24 |
25 |
26 | // ---------- Multi Read Pointers
27 |
28 |
29 | ns hex {
30 | // Time Complexity: w(0.75@+ 5) + 16@+27
31 | // Space Complexity: w(1.13@+32) + 12@+103
32 | // like: dst = *ptr
33 | // ptr++
34 | // dst is a hex. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
35 | def read_hex_and_inc dst, ptr {
36 | .read_hex dst, ptr
37 | .ptr_inc ptr
38 | }
39 |
40 | // Time Complexity: n(w(0.75@+ 5) + 16@+27)
41 | // Space Complexity: n(w(1.13@+32) + 12@+103)
42 | // like: dst[:n] = *ptr[:n]
43 | // dst is a hex[:n]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
44 | def read_hex n, dst, ptr {
45 | rep(n, i) .read_hex_and_inc dst + i*dw, ptr
46 | .ptr_sub ptr, n
47 | }
48 |
49 | // Time Complexity: w(0.75@+ 5) + 18@+27
50 | // Space Complexity: w(1.13@+32) + 14@+127
51 | // like: dst[:2] = *ptr
52 | // ptr++
53 | // dst is a hex[:2]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
54 | def read_byte_and_inc dst, ptr {
55 | .read_byte dst, ptr
56 | .ptr_inc ptr
57 | }
58 |
59 | // Time Complexity: n(w(0.75@+ 5) + 18@+27)
60 | // Space Complexity: n(w(1.13@+32) + 14@+127)
61 | // like: dst[:2n] = *ptr[:n]
62 | // dst is a hex[:2n]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
63 | def read_byte n, dst, ptr {
64 | rep(n, i) .read_byte_and_inc dst + i*2*dw, ptr
65 | .ptr_sub ptr, n
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/flipjump/stl/hex/pointers/write_pointers.fj:
--------------------------------------------------------------------------------
1 | // ---------- Write Pointers
2 |
3 |
4 | ns hex {
5 | // Time Complexity: w(0.75@+5) + 11@+25
6 | // Space Complexity: w(0.75@+29) + 11@+112
7 | // like: *ptr = src
8 | // src is a hex. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
9 | def write_hex ptr, src < hex.pointers.read_byte {
10 | .pointers.set_flip_and_jump_pointers ptr
11 | .pointers.read_byte_from_inners_ptrs
12 | .xor hex.pointers.read_byte, src
13 | .pointers.xor_hex_to_flip_ptr hex.pointers.read_byte
14 | }
15 |
16 | // Time Complexity: w(0.75@+5) + 15@+37
17 | // Space Complexity: w(0.75@+29) + 15@+176
18 | // like: *ptr = 0
19 | // ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
20 | def zero_ptr ptr < hex.pointers.read_byte {
21 | .pointers.set_flip_and_jump_pointers ptr
22 | .pointers.read_byte_from_inners_ptrs
23 | .pointers.xor_byte_to_flip_ptr hex.pointers.read_byte
24 | }
25 |
26 | // Time Complexity: w(0.75@+5) + 17@+37
27 | // Space Complexity: w(0.75@+29) + 17@+200
28 | // like: *ptr = src[:2]
29 | // src is a hex[:2]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
30 | def write_byte ptr, src < hex.pointers.read_byte {
31 | .pointers.set_flip_and_jump_pointers ptr
32 | .pointers.read_byte_from_inners_ptrs
33 | .xor 2, hex.pointers.read_byte, src
34 | .pointers.xor_byte_to_flip_ptr hex.pointers.read_byte
35 | }
36 | }
37 |
38 |
39 |
40 | // ---------- Multi Read Write Pointers
41 |
42 |
43 | ns hex {
44 | // Time Complexity: w(0.75@+5) + 20@+39
45 | // Space Complexity: w(1.13@+32) + 16@+167
46 | // like: *ptr = src
47 | // ptr++
48 | // src is a hex. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
49 | def write_hex_and_inc ptr, src {
50 | .write_hex ptr, src
51 | .ptr_inc ptr
52 | }
53 |
54 | // Time Complexity: n(w(0.75@+5) + 20@+39)
55 | // Space Complexity: n(w(1.13@+32) + 16@+167)
56 | // like: *ptr[:n] = src[:n]
57 | // src is a hex[:n]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
58 | def write_hex n, ptr, src {
59 | rep(n, i) .write_hex_and_inc ptr, src + i*dw
60 | .ptr_sub ptr, n
61 | }
62 |
63 | // Time Complexity: w(0.75@+5) + 26@+51
64 | // Space Complexity: w(1.13@+32) + 22@+255
65 | // like: *ptr = src[:2]
66 | // ptr++
67 | // src is a hex[:2]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
68 | def write_byte_and_inc ptr, src {
69 | .write_byte ptr, src
70 | .ptr_inc ptr
71 | }
72 |
73 | // Time Complexity: n(w(0.75@+5) + 26@+51)
74 | // Space Complexity: n(w(1.13@+32) + 22@+255)
75 | // like: *ptr[:n] = src[:2n]
76 | // src is a hex[:2n]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
77 | def write_byte n, ptr, src {
78 | rep(n, i) .write_byte_and_inc ptr, src + i*2*dw
79 | .ptr_sub ptr, n
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/flipjump/stl/hex/pointers/xor_from_pointer.fj:
--------------------------------------------------------------------------------
1 | ns hex {
2 | // Time Complexity: w(0.75@+ 5) + 6@+13
3 | // Space Complexity: w(0.75@+29) + 6@+36
4 | // like: dst ^= *ptr
5 | // dst is a hex. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
6 | def xor_hex_from_ptr dst, ptr < hex.pointers.read_byte {
7 | .pointers.set_flip_and_jump_pointers ptr
8 | .pointers.read_byte_from_inners_ptrs
9 | .xor dst, hex.pointers.read_byte
10 | }
11 |
12 | // Time Complexity: w(0.75@+ 5) + 7@+13
13 | // Space Complexity: w(0.75@+29) + 7@+48
14 | // like: dst[:2] ^= *ptr
15 | // dst is a hex[2:]. ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
16 | def xor_byte_from_ptr dst, ptr < hex.pointers.read_byte {
17 | .pointers.set_flip_and_jump_pointers ptr
18 | .pointers.read_byte_from_inners_ptrs
19 | .xor 2, dst, hex.pointers.read_byte
20 | }
21 |
22 | ns pointers {
23 | // Time Complexity: 5@+13
24 | // Space Complexity: 5@+24
25 | // use after: hex.pointers.set_flip_and_jump_pointers ptr
26 | // does: hex.pointers.read_byte[:2] = *ptr
27 | //
28 | // ptr is a hex[:w/4] that holds an address, which we assume is dw-aligned.
29 | def read_byte_from_inners_ptrs @ read_ptr_and_flip_back, cleanup \
30 | < hex.pointers.ret_after_read_byte, hex.pointers.read_byte, hex.pointers.to_jump, hex.pointers.to_flip {
31 | // 1. setup:
32 | // zero read_byte.
33 | // to_flip = ptr + dbit+8.
34 | // to_jump+w = ptr.
35 | hex.zero 2, hex.pointers.read_byte
36 | wflip hex.pointers.to_flip, dbit+8
37 |
38 | // 2. *(ptr+w)^=256, so that now *(ptr+w) == 256 + original_value.
39 | wflip hex.pointers.to_flip+w, read_ptr_and_flip_back, hex.pointers.to_flip
40 |
41 | pad 4
42 | read_ptr_and_flip_back:
43 | // 3. Jump to *(ptr+w). It will xor the pointed original_value byte into hex.pointers.read_byte.
44 | // 4. Then jump to hex.pointers.to_flip to make *(ptr+w)==original_value back again.
45 | // 5. Then return to cleanup.
46 | wflip hex.pointers.to_flip+w, read_ptr_and_flip_back^cleanup
47 | wflip hex.pointers.ret_after_read_byte+w, hex.pointers.to_flip, hex.pointers.to_jump
48 |
49 | cleanup:
50 | // 6. to_flip = ptr, clean jump-back addresses.
51 | wflip hex.pointers.ret_after_read_byte+w, hex.pointers.to_flip
52 | wflip hex.pointers.to_flip, dbit+8
53 | wflip hex.pointers.to_flip+w, cleanup
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/flipjump/stl/hex/shifts.fj:
--------------------------------------------------------------------------------
1 | // ---------- Logical Shifts:
2 |
3 |
4 | ns hex {
5 | // Time Complexity: n(@+1)
6 | // Space Complexity: n(@+28)
7 | // dst[:n] <<= 1
8 | def shl_bit n, dst {
9 | .shifts.shl_bit_once dst+(n-1)*dw, 0
10 | rep(n-1, i) .shifts.shl_bit_once dst+(n-2-i)*dw, dst+(n-1-i)*dw
11 | }
12 |
13 |
14 | // Time Complexity: n(@+1)
15 | // Space Complexity: n(@+28)
16 | // dst[:n] >>= 1
17 | def shr_bit n, dst {
18 | .shifts.shr_bit_once dst, 0
19 | rep(n-1, i) .shifts.shr_bit_once dst+(i+1)*dw, dst+i*dw
20 | }
21 |
22 |
23 | // Time Complexity: n(@+4)
24 | // Space Complexity: n(@+28)
25 | // dst[:n] <<= 4
26 | def shl_hex n, dst {
27 | .shl_hex n, 1, dst
28 | }
29 |
30 | // Time Complexity: n(@+4)
31 | // Space Complexity: n(@+28)
32 | // dst[:n] <<= 4*times
33 | def shl_hex n, times, dst @ end {
34 | stl.comp_if0 times, end
35 | .zero times, dst+(n-times)*dw
36 | rep(n-times, i) .xor_zero dst+(n-1-i)*dw, dst+(n-1-times-i)*dw
37 | end:
38 | }
39 |
40 |
41 | // Time Complexity: n(@+4)
42 | // Space Complexity: n(@+28)
43 | // dst[:n] >>= 4
44 | def shr_hex n, dst {
45 | .shr_hex n, 1, dst
46 | }
47 |
48 | // Time Complexity: n(@+4)
49 | // Space Complexity: n(@+28)
50 | // dst[:n] >>= 4*times
51 | def shr_hex n, times, dst @ end {
52 | stl.comp_if0 times, end
53 | .zero times, dst
54 | rep(n-times, i) .xor_zero dst+i*dw, dst+(i+times)*dw
55 | end:
56 | }
57 | }
58 |
59 |
60 | ns hex {
61 | ns shifts {
62 | // Time Complexity: @+1
63 | // Space Complexity: @+28
64 | // {next(1bit),dst(1hex)} = dst << 1
65 | //
66 | // next is the bit-address of the next msb, dst is a hex.
67 | // @note, this should be called in reverse order (so that the "next" is already shifted).
68 | def shl_bit_once dst, next @ switch, xor_by, end {
69 | wflip dst+w, switch, dst
70 |
71 | pad 16
72 | switch:
73 | rep(16, i) stl.fj i&8 ? next+dbit+0 : 0, xor_by+(i^((i<<1)&0xf))*dw
74 | xor_by:
75 | ..tables.clean_table_entry__table 16, dst, end
76 |
77 | end:
78 | wflip dst+w, switch
79 | }
80 |
81 |
82 | // Time Complexity: @+1
83 | // Space Complexity: @+28
84 | // {next(1bit),dst(1hex)} = dst >> 1
85 | //
86 | // next is the bit-address of the next msb, dst is a hex.
87 | // @note, this should be called in a regular order (so that the "next" is already shifted).
88 | def shr_bit_once dst, next @ switch, xor_by, end {
89 | wflip dst+w, switch, dst
90 |
91 | pad 16
92 | switch:
93 | rep(16, i) stl.fj i&1 ? next+dbit+3 : 0, xor_by+(i^((i>>1)&0xf))*dw
94 | xor_by:
95 | ..tables.clean_table_entry__table 16, dst, end
96 |
97 | end:
98 | wflip dst+w, switch
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/flipjump/stl/hex/tables_init.fj:
--------------------------------------------------------------------------------
1 | // ---------- Init The Truth Tables:
2 |
3 |
4 | ns hex {
5 | // Space Complexity: 6500 (6464+@)
6 | // It is 50/100KB (for w=32/64 bits)
7 | // It is 5KB in --version 3 (for both w=32/64 bits)
8 | // This macro initializes all truth tables for the hex-macros.
9 | // Use this macro exactly once, and don't use it alongside any other hex.*.init macros, as it will declare those twice.
10 | // @output-param ret: The return address. Jumps to it after finishing going through a table.
11 | // @output-param res: The result of the table calculation is written here.
12 | def init {
13 | .tables.init_all
14 | }
15 |
16 | ns tables {
17 | def init_shared > ret, res {
18 | ret: ;0
19 | res: ..hex
20 | }
21 |
22 | // This is the inner-macro of hex.init, and it's identical to it. see hex.init documentation.
23 | def init_all @ end {
24 | ;end
25 | .init_shared
26 | ..or.init // 595
27 | ..and.init // 595
28 | ..mul.init // 1620+@
29 | ..cmp.init // 514
30 | ..add.init // 1570
31 | ..sub.init // 1570
32 | end:
33 | }
34 |
35 | // @Assumes: n must be a power of 2, and it must be (1<>1)) ? ret : clean+(d^((1<<(#d))>>1))*dw
47 | }
48 |
49 | // A table. When jumping to entry d - it xors d into dst, and jumps to hex.tables.ret
50 | //
51 | // Time Complexity: 4
52 | // Space Complexity: 256
53 | //
54 | // dst is a hex.
55 | def clean_table_entry__table dst < .ret {
56 | .clean_table_entry__table 256, dst, .ret
57 | }
58 |
59 | // The macro assumes that jumper_to_table is a fj-op that jumps to a 256-padded table.
60 | // This macro is used as a jumper to a table that sets hex.tables.res to some (calc(dst, src) ^ dst), and jumps back.
61 | //
62 | // Time Complexity: 4@+4
63 | // Space Complexity: 4@+52
64 | //
65 | // It jumps to the table, at entry (src<<4 | dst).
66 | // At last, it xors the value of hex.tables.res into dst.
67 | //
68 | // both dst,src are hexes, and jumper_to_table is an address.
69 | def jump_to_table_entry dst, src, jumper_to_table @ return < .ret, .res {
70 | ..xor jumper_to_table , dst
71 | ..xor jumper_to_table+4, src
72 | wflip .ret+w, return, jumper_to_table
73 | return:
74 | wflip .ret+w ,return
75 | ..xor_zero dst, .res
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/flipjump/stl/ptrlib.fj:
--------------------------------------------------------------------------------
1 | // ---------- Init
2 |
3 |
4 | ns stl {
5 | // NOTE: must be placed just after the startup, so that the read_ptr_byte_table will be in address 256.
6 | // Complexity: 2.5w+263
7 | def ptr_init {
8 | hex.pointers.ptr_init
9 | bit.pointers.ptr_init
10 | }
11 |
12 | // Space Complexity: n+w/4
13 | // Initializes a stack of size n (maximal capacity of n hexes / return-addresses).
14 | // n is the size of the stack.
15 | def stack_init n {
16 | hex.pointers.stack_init n
17 | }
18 | }
19 |
20 |
21 |
22 | // ---------- Functions
23 |
24 |
25 | // @requires the stack_init.
26 | ns stl {
27 | // Time Complexity: ~2.5w@ (exact: w(2.25@+10) + 24@+51)
28 | // Space Complexity: <3w@ (exact: w(2.625@+49) + 20@+231)
29 | // Saves the return address to the stack and jumps to the given "address".
30 | // When returned, it removes the return-address from the stack.
31 | //
32 | // note: the pop_ret_address is for the future return (counts as space, but not time, complexity).
33 | // @requires the stack_init.
34 | def call address @ return_label {
35 | hex.push_ret_address return_label
36 | ;address
37 |
38 | pad 2
39 | return_label:
40 | hex.pop_ret_address return_label
41 | }
42 |
43 | // Time Complexity: <3w@ (exact: w(2.25@+10) + 37@+57)
44 | // Space Complexity: <3w@ (exact: w(2.625@+49) + 43@+251)
45 | // Saves the return address to the stack and jumps to the given "address".
46 | // When returned, it removes the return-address from the stack, and pops "params_stack_length" cells from the stack.
47 | //
48 | // note: the pop_ret_address is for the future return (counts as space, but not time, complexity).
49 | // @requires the stack_init.
50 | def call address, params_stack_length @ return_label {
51 | hex.push_ret_address return_label
52 | ;address
53 |
54 | pad 2
55 | return_label:
56 | hex.pop_ret_address return_label
57 | hex.sp_sub params_stack_length
58 | }
59 |
60 |
61 | // Time Complexity: w(2@+7) + 9@+23
62 | // Space Complexity: w(2.375@+34) + 5@+67
63 | // Returns to the calling function (gets the return-address from the top of the stack).
64 | //
65 | // note: jumps to the last-call's pop_ret_address (which this macro counts as time, but not space, complexity).
66 | // @requires the stack_init.
67 | def return < hex.pointers.sp {
68 | hex.ptr_jump hex.pointers.sp
69 | }
70 |
71 |
72 | // Time Complexity: n(2@)
73 | // Space Complexity: n(2@+24)
74 | // (Unsafe if dst overlaps with hex.pointers.sp).
75 | // dst[:w/4] = sp
76 | // @requires the stack_init.
77 | def get_sp dst < hex.pointers.sp {
78 | hex.mov w/4, dst, hex.pointers.sp
79 | }
80 | }
81 |
82 |
83 |
84 | // ---------- Fast Call
85 |
86 |
87 | ns stl {
88 | // Complexity: @-1
89 | // Jumps to label, and saves the return address in the given "ret_reg" variable.
90 | def fcall label, ret_reg @ ret {
91 | wflip ret_reg+w, ret, label
92 | pad 2
93 | ret:
94 | wflip ret_reg+w, ret
95 | }
96 |
97 | // Complexity: 1
98 | // Return into the address written in the "ret_reg" variable.
99 | def fret ret_reg {
100 | ;ret_reg
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/flipjump/utils/__init__.py:
--------------------------------------------------------------------------------
1 | from flipjump.utils.classes import TerminationCause, PrintTimer
2 | from flipjump.utils.functions import get_stl_paths
3 |
4 |
5 | __all__ = [
6 | 'TerminationCause',
7 | 'PrintTimer',
8 | 'get_stl_paths',
9 | ]
10 |
--------------------------------------------------------------------------------
/flipjump/utils/constants.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | import lzma
4 | from pathlib import Path
5 | from typing import List, Dict
6 |
7 |
8 | MACRO_SEPARATOR_STRING = "---"
9 | STARTING_LABEL_IN_MACROS_STRING = ':start:'
10 | WFLIP_LABEL_PREFIX = ':wflips:'
11 |
12 | LAST_OPS_DEBUGGING_LIST_DEFAULT_LENGTH = 10
13 | DEFAULT_MAX_MACRO_RECURSION_DEPTH = 900
14 | GAP_BETWEEN_PYTHONS_AND_PREPROCESSOR_MACRO_RECURSION_DEPTH = 100
15 |
16 | IO_BYTES_ENCODING = 'raw_unicode_escape'
17 |
18 | DEBUG_JSON_ENCODING = 'utf-8'
19 | DEBUG_JSON_LZMA_FORMAT = lzma.FORMAT_RAW
20 | DEBUG_JSON_LZMA_FILTERS: List[Dict[str, int]] = [{"id": lzma.FILTER_LZMA2}]
21 |
22 | PACKAGE_ROOT_PATH = Path(__file__).parent.parent
23 | STL_PATH = PACKAGE_ROOT_PATH / 'stl'
24 |
--------------------------------------------------------------------------------
/flipjump/utils/exceptions.py:
--------------------------------------------------------------------------------
1 | class FlipJumpException(Exception):
2 | pass
3 |
4 |
5 | class FlipJumpParsingException(FlipJumpException):
6 | pass
7 |
8 |
9 | class FlipJumpPreprocessorException(FlipJumpException):
10 | pass
11 |
12 |
13 | class FlipJumpExprException(FlipJumpException):
14 | pass
15 |
16 |
17 | class FlipJumpAssemblerException(FlipJumpException):
18 | pass
19 |
20 |
21 | class FlipJumpReadFjmException(FlipJumpException):
22 | pass
23 |
24 |
25 | class FlipJumpWriteFjmException(FlipJumpException):
26 | pass
27 |
28 |
29 | class FlipJumpRuntimeException(FlipJumpException):
30 | pass
31 |
32 |
33 | class FlipJumpRuntimeMemoryException(FlipJumpRuntimeException):
34 | def __init__(self, message: str, memory_address: int):
35 | super().__init__(message)
36 | self.memory_address = memory_address
37 |
38 |
39 | class FlipJumpMissingImportException(FlipJumpException):
40 | pass
41 |
42 |
43 | class IODeviceException(IOError, FlipJumpException):
44 | pass
45 |
46 |
47 | class BrokenIOUsed(IODeviceException):
48 | pass
49 |
50 |
51 | class IOReadOnEOF(IODeviceException):
52 | pass
53 |
54 |
55 | class IncompleteOutput(IODeviceException):
56 | pass
57 |
--------------------------------------------------------------------------------
/flipjump/utils/functions.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | import json
4 | import lzma
5 | import os
6 | from pathlib import Path
7 | from typing import List, Dict, Tuple, Union, Optional
8 |
9 | from flipjump.utils.constants import DEBUG_JSON_ENCODING, DEBUG_JSON_LZMA_FORMAT, DEBUG_JSON_LZMA_FILTERS, STL_PATH
10 |
11 |
12 | def get_stl_paths() -> List[Path]:
13 | """
14 | @return: list of the ordered standard-library paths
15 | """
16 | with open(STL_PATH / 'conf.json') as stl_conf:
17 | stl_options = json.load(stl_conf)
18 | return [STL_PATH / f'{lib}.fj' for lib in stl_options['all']]
19 |
20 |
21 | def save_debugging_labels(debugging_file_path: Optional[Path], labels: Dict[str, int]) -> None:
22 | """
23 | save the labels' dictionary to the debugging-file as lzma2-compressed json
24 | @param debugging_file_path: the file's path
25 | @param labels: the labels' dictionary
26 | """
27 | if debugging_file_path:
28 | with open(debugging_file_path, 'wb') as f:
29 | data = json.dumps(labels).encode(DEBUG_JSON_ENCODING)
30 | compressed_data = lzma.compress(data, format=DEBUG_JSON_LZMA_FORMAT, filters=DEBUG_JSON_LZMA_FILTERS)
31 | f.write(compressed_data)
32 |
33 |
34 | def load_debugging_labels(debugging_file_path: Path) -> Dict[str, int]:
35 | """
36 | loads and decompresses the labels' dictionary from the lzma2-compressed debugging-file
37 | @param debugging_file_path: the file's path
38 | @return: the labels' dictionary
39 | """
40 | with open(debugging_file_path, 'rb') as f:
41 | compressed_data = f.read()
42 |
43 | data = lzma.decompress(compressed_data, format=DEBUG_JSON_LZMA_FORMAT, filters=DEBUG_JSON_LZMA_FILTERS)
44 | debugging_labels: Dict[str, int] = json.loads(data.decode(DEBUG_JSON_ENCODING))
45 | return debugging_labels
46 |
47 |
48 | def get_file_tuples(files: List[str], *, no_stl: bool = False) -> List[Tuple[str, Path]]:
49 | """
50 | get the list of .fj files to be assembled (stl + files).
51 | @param files: the list of fj-code files.
52 | @param no_stl: if True: don't include the standard library.
53 | @return: a list of file-tuples - (file_short_name, file_path)
54 | """
55 | file_tuples = []
56 |
57 | if not no_stl:
58 | for i, stl_path in enumerate(get_stl_paths(), start=1):
59 | file_tuples.append((f"s{i}", stl_path))
60 |
61 | for i, file in enumerate(files, start=1):
62 | file_tuples.append((f"f{i}", Path(file)))
63 |
64 | return file_tuples
65 |
66 |
67 | def get_temp_directory_suffix(files: Union[List[Path], List[str]]) -> str:
68 | """
69 | create a suffix for the temp directory name, using args.
70 | @param files: the list of fj-code files.
71 | @return: the suffix
72 | """
73 | return f'__{"_".join(os.path.basename(str(file)) for file in files)}__temp_directory'
74 |
--------------------------------------------------------------------------------
/ide-extensions/pycharm/PycharmHighlighting.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/ide-extensions/pycharm/PycharmHighlighting.zip
--------------------------------------------------------------------------------
/ide-extensions/pycharm/fj-pycharm-def-finder.ahk:
--------------------------------------------------------------------------------
1 | ; Double-click the script (with AutoHotKey v1 installed) to run now. Copy e script to "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup" to still take effect after reboot.
2 |
3 | ; The script makes a Ctrl+Shift+Click Pycharm shortcut for flip-jump files (Find macro declaration), that resembles the Ctrl+Click shortcut for python (Find function declaration).
4 |
5 | ; Script summery: Replace Ctrl+Shift+Click with [ Click -> Copy the pointed word -> Ctrl+Shift+F (search in project) -> (search) "def " + copied word ].
6 |
7 |
8 | ^+Lbutton::
9 | {
10 | old_clipboard := clipboard
11 |
12 | ; Click
13 | Send {Lbutton}
14 |
15 | ; Mark the pointed word
16 | Send ^{Left}
17 | Send ^+{Right}
18 |
19 | ; Copy the pointed word
20 | Send ^c
21 |
22 | ; Unmark word
23 | Send {Right}
24 |
25 | ; Open the "Find in files" window (shortcut in Pycharm)
26 | Send ^+f
27 | Sleep 100
28 |
29 | ; Search for "def COPIED_WORD"
30 | Send {Home}
31 | Send +{End}
32 | Send def{Space}
33 | Send ^v
34 | Send {Space}
35 |
36 | clipboard := old_clipboard
37 | return
38 | }
--------------------------------------------------------------------------------
/programs/concept_checks/bit_ptr.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | test0:
4 | bit.ptr_flip p0
5 | bit.if d0, d00, d01
6 | d00:
7 | stl.output '0'
8 | ;test1
9 | d01:
10 | stl.output '1'
11 | ;test1
12 |
13 | test1:
14 | bit.ptr_jump p1
15 | jump_to6:
16 | stl.output '6'
17 | ;test2
18 | jump_to7:
19 | stl.output '7'
20 | ;test2
21 |
22 | test2:
23 | bit.ptr_wflip p2, base_jump_label2
24 | bit.ptr_jump p2_jump
25 | pad 2
26 | base_jump_label2:
27 | ;p20
28 | ;p21
29 | p20:
30 | stl.output 'N'
31 | ;test3
32 | p21:
33 | stl.output 'Y'
34 | ;test3
35 |
36 | test3:
37 | bit.zero d3_var
38 | bit.xor_from_ptr d3_var, p3
39 | bit.if d3_var, d30, d31
40 | d30:
41 | stl.output 'F'
42 | stl.loop
43 | d31:
44 | stl.output 'T'
45 | stl.loop
46 |
47 |
48 |
49 | p0:
50 | bit.vec w, d0+dbit
51 | d0:
52 | bit.bit 0 // 0 => 1, 1 => 0
53 |
54 | p1:
55 | bit.vec w, d1
56 | d1:
57 | ;jump_to7 // jump_to6 => 6, jump_to7 => 7
58 |
59 | p2:
60 | bit.vec w, d2+w
61 | p2_jump:
62 | bit.vec w, d2
63 | d2:
64 | bit.bit 0 // 0 => N, 1 => Y
65 |
66 | p3:
67 | bit.vec w, d3
68 | d3:
69 | bit.bit 1 // 0 => F, 1 => T
70 | d3_var:
71 | bit.bit 0
72 |
73 |
74 | bit.pointers.ptr_init
75 |
--------------------------------------------------------------------------------
/programs/concept_checks/casting.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | stl.bit2hex h, b0
4 | hex.print_as_digit h, 0
5 | stl.bit2hex h, b1
6 | hex.print_as_digit h, 0
7 | stl.output '\n'
8 |
9 | stl.bit2hex 12, hex, bits
10 | hex.print_as_digit 3, hex, 0
11 | stl.output '\n'
12 | stl.output '\n'
13 |
14 | stl.hex2bit 10, bits2, hex2
15 | hex.print_as_digit 10, hex2, 0
16 | stl.output '\n'
17 | stl.bit2hex 40, hex2, bits2
18 | bit.print_hex_uint 40, bits2, 0
19 | stl.output '\n'
20 | bit.print_as_digit 40, bits2
21 | stl.output '\n'
22 |
23 | stl.loop
24 |
25 |
26 | b0: bit.bit 0
27 | b1: bit.bit 1
28 | h: hex.hex
29 | bits: bit.vec 12, 0x123
30 | hex: hex.vec 3
31 |
32 | hex2: hex.vec 10, 0x123456
33 | bits2: bit.vec 40
34 |
--------------------------------------------------------------------------------
/programs/concept_checks/hex_ptr.fj:
--------------------------------------------------------------------------------
1 | stl.startup_and_init_pointers
2 |
3 |
4 | test0:
5 | hex.ptr_flip p0
6 | bit.if d0, d00, d01
7 | d00:
8 | stl.output '0'
9 | ;test1
10 | d01:
11 | stl.output '1'
12 | ;test1
13 |
14 | test1:
15 | hex.ptr_jump p1
16 | jump_to6:
17 | stl.output '6'
18 | ;test2
19 | jump_to7:
20 | stl.output '7'
21 | ;test2
22 |
23 | test2:
24 | hex.ptr_wflip p2, base_jump_label2
25 | hex.ptr_jump p2_jump
26 | pad 2
27 | base_jump_label2:
28 | ;p20
29 | ;p21
30 | p20:
31 | stl.output 'N'
32 | ;test3
33 | p21:
34 | stl.output 'Y'
35 | ;test3
36 |
37 | test3:
38 | hex.set d3, 6
39 | hex.set d3_var, 0xD
40 | hex.xor_hex_from_ptr d3_var, p3
41 | hex.print_as_digit d3_var, 1
42 |
43 | stl.loop
44 |
45 |
46 |
47 | p0:
48 | hex.vec w/4, d0+dbit
49 | d0:
50 | bit.bit 0 // 0 => 1, 1 => 0
51 |
52 | p1:
53 | hex.vec w/4, d1
54 | d1:
55 | ;jump_to7 // jump_to6 => 6, jump_to7 => 7
56 |
57 | p2:
58 | hex.vec w/4, d2+w
59 | p2_jump:
60 | hex.vec w/4, d2
61 | d2:
62 | bit.bit 0 // 0 => N, 1 => Y
63 |
64 | p3:
65 | hex.vec w/4, d3
66 | d3:
67 | hex.hex
68 | d3_var:
69 | hex.hex
70 |
--------------------------------------------------------------------------------
/programs/concept_checks/pair_ns.fj:
--------------------------------------------------------------------------------
1 | ns Pair {
2 | first = 0
3 | len = w
4 | second = .len*dw
5 | size = .len * 2
6 |
7 | def init this {
8 | bit.zero .len, this+.first
9 | bit.zero .len, this+.second
10 | }
11 |
12 | def add_first this, val {
13 | ._.add this+.first, val
14 | }
15 |
16 | def add_second this, val {
17 | ._.add this+.second, val
18 | }
19 |
20 | def add this, src {
21 | .add_first this, src+.first
22 | .add_second this, src+.second
23 | }
24 |
25 | def print this {
26 | stl.output '('
27 | ._.print_hex_int this+.first
28 | stl.output ','
29 | stl.output ' '
30 | ._.print_hex_int this+.second
31 | stl.output ')'
32 | }
33 |
34 | def init {
35 | ._.init
36 | }
37 |
38 | ns _ {
39 | def add dst, src < .add, .ret_reg, .temp1, .temp2 {
40 | bit.xor ..len, .temp2, src
41 | bit.xor_zero ..len, .temp1, dst
42 | stl.fcall .add, .ret_reg
43 | bit.xor_zero ..len, dst, .temp1
44 | bit.zero ..len, .temp2
45 | }
46 |
47 |
48 | def print_hex_int val < .print_hex_int, .ret_reg, .temp1 {
49 | bit.xor ..len, .temp1, val
50 | stl.fcall .print_hex_int, .ret_reg
51 | bit.xor ..len, .temp1, val
52 | }
53 |
54 | def init @ data_end > add, print_hex_int, ret_reg, temp1, temp2 {
55 | ;data_end
56 |
57 | add:
58 | bit.add ..len, .temp1, .temp2
59 | stl.fret .ret_reg
60 |
61 | print_hex_int:
62 | bit.print_hex_int ..len, .temp1, 1
63 | stl.fret .ret_reg
64 |
65 | ret_reg: bit.bit 0
66 | temp1: bit.vec ..len, 0
67 | temp2: bit.vec ..len, 0
68 |
69 | data_end:
70 | }
71 |
72 | }
73 |
74 | def swap this {
75 | bit.swap .len, this+.first, this+.second
76 | }
77 |
78 | ns prints {
79 | def print_two p1, p2 {
80 | ..print p1
81 | stl.output ','
82 | stl.output ' '
83 | stl.output ' '
84 | ..print p2
85 | stl.output '\n'
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/programs/concept_checks/segments.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | X1 = 0x10000000
4 | X2 = 0x20000000
5 | X4 = 0x40000000
6 |
7 | bit.print 4, str_hi
8 |
9 | bit.input 4, X1
10 |
11 | // both are already zeros because they are reserved:
12 | //zero 20, X2
13 | //zero 20, num
14 |
15 | rep(4, i) more_digit 20, num, X2, X1+8*dw*i
16 |
17 | ;X4
18 |
19 | back:
20 | bit.print 6, str_bye
21 | ;end
22 |
23 |
24 | error:
25 | bit.bit
26 |
27 | str_hi:
28 | bit.str "Hi!\n"
29 | str_bye:
30 | bit.str "\nBye!\n"
31 |
32 |
33 | def more_digit width, num, inter, ascii < error {
34 | bit.shl width, 4, num
35 | bit.ascii2hex error, inter, ascii
36 | bit.add width, num, inter
37 | }
38 |
39 |
40 | segment X1
41 | reserve dw*8*4
42 | segment X2
43 | reserve dw*20
44 | segment X4
45 | bit.add 20, num, num
46 | bit.print_hex_int 20, num, 1
47 | ;back
48 | end:
49 | stl.loop
50 |
51 | num:
52 | reserve dw*10
53 | reserve dw*10
54 |
--------------------------------------------------------------------------------
/programs/func_tests/func1.fj:
--------------------------------------------------------------------------------
1 | // Tests a parameterless function call
2 |
3 |
4 | stl.startup_and_init_all 10
5 |
6 |
7 | // Prints "ABC"
8 | test1:
9 | stl.output 'A'
10 | stl.call func1
11 | stl.output 'C'
12 |
13 | stl.output '\n'
14 | stl.loop
15 |
16 | func1:
17 | stl.output 'B'
18 | stl.return
19 |
--------------------------------------------------------------------------------
/programs/func_tests/func2.fj:
--------------------------------------------------------------------------------
1 | // Tests a diamond call-stack. (main->a->c ==> main->b->c)
2 |
3 |
4 | stl.startup_and_init_all 10
5 |
6 |
7 | // Prints "AB~CD~EF"
8 | test2:
9 | stl.output 'A'
10 | stl.call func2a
11 | stl.call func2b
12 | stl.output 'F'
13 |
14 | stl.output '\n'
15 | stl.loop
16 |
17 | func2a:
18 | stl.output 'B'
19 | stl.call func2c
20 | stl.output 'C'
21 | stl.return
22 | func2b:
23 | stl.output 'D'
24 | stl.call func2c
25 | stl.output 'E'
26 | stl.return
27 | func2c:
28 | stl.output '~'
29 | stl.return
30 |
--------------------------------------------------------------------------------
/programs/func_tests/func3.fj:
--------------------------------------------------------------------------------
1 | // Tests push_hex/pop_hex (unchanged hex) with an empty function call
2 |
3 |
4 | stl.startup_and_init_all 10
5 |
6 |
7 | // Prints "ABCDE"
8 | test3:
9 | stl.output 'A'
10 | hex.push_hex x3
11 | stl.output 'B'
12 | stl.call func3
13 | stl.output 'D'
14 | hex.pop_hex x3
15 | stl.output 'E'
16 |
17 | stl.output '\n'
18 | stl.loop
19 |
20 | func3:
21 | stl.output 'C'
22 | stl.return
23 |
24 |
25 | x3:
26 | bit.bit 0
27 |
--------------------------------------------------------------------------------
/programs/func_tests/func4.fj:
--------------------------------------------------------------------------------
1 | // Tests the ptr_flip_dbit and function calls
2 |
3 |
4 | stl.startup_and_init_all 10
5 |
6 |
7 | // Prints "ABCDEFGH-" and then 0/1, the invert of x4
8 | test4:
9 | stl.output 'A'
10 | hex.push_hex x4
11 | stl.output 'B'
12 |
13 | stl.call func4
14 |
15 | stl.output 'G'
16 | hex.pop_hex x4
17 | stl.output 'H'
18 | bit.bin2ascii ascii, x4
19 | stl.output '-'
20 | bit.print ascii
21 |
22 | stl.output '\n'
23 | stl.loop
24 |
25 | func4:
26 | stl.output 'C'
27 | stl.get_sp __func4_arg_ptr
28 | stl.output 'D'
29 | hex.ptr_dec __func4_arg_ptr
30 | stl.output 'E'
31 | hex.ptr_flip_dbit __func4_arg_ptr
32 | stl.output 'F'
33 | stl.return
34 | __func4_arg_ptr:
35 | hex.vec w/4, 0
36 |
37 |
38 |
39 | x4:
40 | bit.bit 0
41 |
42 | ascii:
43 | bit.vec 8
44 |
--------------------------------------------------------------------------------
/programs/func_tests/func5.fj:
--------------------------------------------------------------------------------
1 | // Tests the xor_hex_from_ptr, xor_hex_to_ptr and function calls
2 |
3 |
4 | stl.startup_and_init_all 10
5 |
6 |
7 | // Prints "ABC abcdefg ABCD-", and then 0/1, the xor of x5,y5
8 | test5:
9 | stl.output 'A'
10 | hex.push_hex res5
11 | stl.output 'B'
12 | hex.push_hex x5
13 | stl.output 'C'
14 | hex.push_hex y5
15 |
16 | stl.output ' '
17 | stl.call func5
18 | stl.output ' '
19 |
20 | stl.output 'A'
21 | hex.pop_hex y5
22 | stl.output 'B'
23 | hex.pop_hex x5
24 | stl.output 'C'
25 | hex.pop_hex res5
26 | stl.output 'D'
27 |
28 | bit.bin2ascii ascii, res5
29 | stl.output '-'
30 | bit.print ascii
31 |
32 | stl.output '\n'
33 | stl.loop
34 |
35 | // res = arg0 xor arg1
36 | func5:
37 | bit.zero __func5_res
38 | stl.get_sp __func5_arg_ptr
39 | stl.output 'a'
40 |
41 | hex.ptr_dec __func5_arg_ptr
42 | stl.output 'b'
43 | hex.xor_hex_from_ptr __func5_res, __func5_arg_ptr
44 | stl.output 'c'
45 | hex.ptr_dec __func5_arg_ptr
46 | stl.output 'd'
47 | hex.xor_hex_from_ptr __func5_res, __func5_arg_ptr
48 | stl.output 'e'
49 |
50 | hex.ptr_dec __func5_arg_ptr
51 | stl.output 'f'
52 | hex.xor_hex_to_ptr __func5_arg_ptr, __func5_res
53 | stl.output 'g'
54 |
55 | stl.return
56 | __func5_res:
57 | bit.bit
58 | __func5_arg_ptr:
59 | hex.vec w/4
60 |
61 |
62 | x5:
63 | bit.bit 1
64 | y5:
65 | bit.bit 1
66 | res5:
67 | bit.bit 0
68 |
69 | ascii:
70 | bit.vec 8
71 |
--------------------------------------------------------------------------------
/programs/func_tests/func6.fj:
--------------------------------------------------------------------------------
1 | // calculate the unsigned multiplication between two numbers.
2 |
3 |
4 | N = 4
5 | STACK_N = (N+1)/2
6 | stl.startup_and_init_all 100
7 |
8 | hex.set N, x, 7438
9 | hex.set N, y, 2524
10 |
11 |
12 | hex.push N, x
13 | hex.push N, y
14 | stl.call math.add, STACK_N
15 | hex.pop N, res
16 | hex.print_as_digit N, res, 1
17 | stl.output '\n'
18 |
19 | stl.loop
20 |
21 |
22 |
23 | ns math {
24 | add:
25 | hex.sp_dec
26 | hex.pop N, .res
27 | hex.pop N, .temp
28 |
29 | hex.add N, .res, .temp
30 |
31 | hex.push N, .res
32 | hex.sp_add STACK_N+1
33 |
34 | stl.return
35 |
36 |
37 | temp: hex.vec 2*N
38 | res: hex.vec 2*N
39 | }
40 |
41 |
42 | x: hex.vec N
43 | y: hex.vec N
44 | res: hex.vec N
45 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/add.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_add i&0xf, i>>4
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
10 |
11 | def test_add a, b @ c0_1st, c1_1st, print_1st, c0_2nd, c1_2nd, print_2nd, ah_1st, bh, ah_2nd, end {
12 | hex.add.clear_carry
13 | hex.add ah_1st, bh
14 | hex.add.clear_carry c0_1st, c1_1st
15 | c0_1st:
16 | stl.output '0'
17 | ;print_1st
18 | c1_1st:
19 | stl.output '1'
20 | print_1st:
21 | hex.print_as_digit ah_1st, 0
22 | stl.output '-'
23 |
24 | hex.add.not_carry
25 | hex.add ah_2nd, bh
26 | hex.add.clear_carry c0_2nd, c1_2nd
27 | c0_2nd:
28 | stl.output '0'
29 | ;print_2nd
30 | c1_2nd:
31 | stl.output '1'
32 | print_2nd:
33 | hex.print_as_digit ah_2nd, 0
34 | stl.output '\n'
35 | ;end
36 |
37 | ah_1st: hex.hex a
38 | ah_2nd: hex.hex a
39 | bh: hex.hex b
40 | end:
41 | }
42 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/add_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | ADD_N = 0x0000ffff800040a73dd06622dc0594c9e1b9b001
4 | rep(100, i) test_add_n 4, (ADD_N>>((i%10)*4)&0xf), (ADD_N>>((i/10))*4&0xf)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
11 |
12 | def test_add_n n, a, b @ lt, eq, gt, ah, bh, ch, end {
13 | hex.add n, ah, bh
14 | hex.cmp n, ah, ch, lt, eq, gt
15 |
16 | lt:
17 | stl.output '<'
18 | ;end
19 | eq:
20 | stl.output '='
21 | ;end
22 | gt:
23 | stl.output '>'
24 | ;end
25 |
26 | ah: hex.vec n, a
27 | bh: hex.vec n, b
28 | ch: hex.vec n, a+b
29 | end:
30 | stl.output '\n'
31 | }
32 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/and.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_and i&0xf, i>>4
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
10 |
11 | def test_and a, b @ ah, ah_copy, bh, end {
12 | hex.and ah, bh
13 | hex.and bh, ah_copy
14 | hex.print_as_digit ah, 0
15 | hex.print_as_digit bh, 0
16 | stl.output '\n'
17 | ;end
18 |
19 | ah: hex.hex a
20 | ah_copy: hex.hex a
21 | bh: hex.hex b
22 | end:
23 | }
24 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/and_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | AND_N = 0x0000ffff8000b32cccc69dea2047c8e0ae1e5299
4 | rep(100, i) test_and_n 4, (AND_N>>((i%10)*4)&0xf), (AND_N>>((i/10))*4&0xf)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
11 |
12 | def test_and_n n, a, b @ lt, eq, gt, ah, bh, ch, end {
13 | hex.and n, ah, bh
14 | hex.cmp n, ah, ch, lt, eq, gt
15 |
16 | lt:
17 | stl.output '<'
18 | ;end
19 | eq:
20 | stl.output '='
21 | ;end
22 | gt:
23 | stl.output '>'
24 | ;end
25 |
26 | ah: hex.vec n, a
27 | bh: hex.vec n, b
28 | ch: hex.vec n, a&b
29 | end:
30 | stl.output '\n'
31 | }
32 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/cmp.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_cmp i&0xf, i>>4
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
10 |
11 | def test_cmp a, b @ lt, eq, gt, ah, bh, end {
12 | hex.cmp ah, bh, lt, eq, gt
13 |
14 | lt:
15 | stl.output '<'
16 | ;end
17 | eq:
18 | stl.output '='
19 | ;end
20 | gt:
21 | stl.output '>'
22 | ;end
23 | ah: hex.hex a
24 | bh: hex.hex b
25 | end:
26 | stl.output '\n'
27 | }
28 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/cmp_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | CMP_N = 0x012345 | (0x123456 << 32) | (0x333333 << 64) | (0x654321 << 96)
4 | rep(16, i) test_cmp_n 8, (CMP_N >> ((i&3)*32)) & ((1<<32)-1), (CMP_N >> ((i>>2)*32)) & ((1<<32)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
11 |
12 | def test_cmp_n n, a, b @ lt, eq, gt, ah, bh, end {
13 | hex.cmp n, ah, bh, lt, eq, gt
14 |
15 | lt:
16 | stl.output '<'
17 | ;end
18 | eq:
19 | stl.output '='
20 | ;end
21 | gt:
22 | stl.output '>'
23 | ;end
24 | ah: hex.vec n, a
25 | bh: hex.vec n, b
26 | end:
27 | stl.output '\n'
28 | }
29 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/or.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_or i&0xf, i>>4
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
10 |
11 | def test_or a, b @ ah, ah_copy, bh, end {
12 | hex.or ah, bh
13 | hex.or bh, ah_copy
14 | hex.print_as_digit ah, 0
15 | hex.print_as_digit bh, 0
16 | stl.output '\n'
17 | ;end
18 |
19 | ah: hex.hex a
20 | ah_copy: hex.hex a
21 | bh: hex.hex b
22 | end:
23 | }
24 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/or_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | OR_N = 0x0000ffff8000c47b5d8bbebfbe0bf47bc2600b85
4 | rep(100, i) test_or_n 4, (OR_N>>((i%10)*4)&0xf), (OR_N>>((i/10))*4&0xf)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
11 |
12 | def test_or_n n, a, b @ lt, eq, gt, ah, bh, ch, end {
13 | hex.or n, ah, bh
14 | hex.cmp n, ah, ch, lt, eq, gt
15 |
16 | lt:
17 | stl.output '<'
18 | ;end
19 | eq:
20 | stl.output '='
21 | ;end
22 | gt:
23 | stl.output '>'
24 | ;end
25 |
26 | ah: hex.vec n, a
27 | bh: hex.vec n, b
28 | ch: hex.vec n, a|b
29 | end:
30 | stl.output '\n'
31 | }
32 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/sub.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_sub i&0xf, i>>4
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
10 |
11 | def test_sub a, b @ c0_1st, c1_1st, print_1st, c0_2nd, c1_2nd, print_2nd, ah_1st, bh, ah_2nd, end {
12 | hex.sub.clear_carry
13 | hex.sub ah_1st, bh
14 | hex.sub.clear_carry c0_1st, c1_1st
15 | c0_1st:
16 | stl.output '0'
17 | ;print_1st
18 | c1_1st:
19 | stl.output 'f'
20 | print_1st:
21 | hex.print_as_digit ah_1st, 0
22 | stl.output '-'
23 |
24 | hex.sub.not_carry
25 | hex.sub ah_2nd, bh
26 | hex.sub.clear_carry c0_2nd, c1_2nd
27 | c0_2nd:
28 | stl.output '0'
29 | ;print_2nd
30 | c1_2nd:
31 | stl.output 'f'
32 | print_2nd:
33 | hex.print_as_digit ah_2nd, 0
34 | stl.output '\n'
35 | ;end
36 |
37 | ah_1st: hex.hex a
38 | ah_2nd: hex.hex a
39 | bh: hex.hex b
40 | end:
41 | }
42 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/2params/sub_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SUB_N = 0x0000ffff8000ada41d9d587f40027d6d07f2c898
4 | rep(100, i) test_sub_n 4, (SUB_N>>((i%10)*4)&0xf), (SUB_N>>((i/10))*4&0xf)
5 |
6 |
7 | stl.loop
8 |
9 |
10 | hex.init
11 |
12 |
13 | def test_sub_n n, a, b @ lt, eq, gt, ah, bh, ch, end {
14 | hex.sub n, ah, bh
15 | hex.cmp n, ah, ch, lt, eq, gt
16 |
17 | lt:
18 | stl.output '<'
19 | ;end
20 | eq:
21 | stl.output '='
22 | ;end
23 | gt:
24 | stl.output '>'
25 | ;end
26 |
27 | ah: hex.vec n, a
28 | bh: hex.vec n, b
29 | ch: hex.vec n, a-b
30 | end:
31 | stl.output '\n'
32 | }
33 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics1/basic_math.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 |
4 | // inc1
5 | stl.output "inc1:\n"
6 | rep(16, i) inc1_print_carry vars+i*dw, vars2+i*dw
7 | hex.print_as_digit 16, vars2, 0
8 | stl.output '\n'
9 | hex.print_as_digit 16, vars, 0
10 | stl.output "\n\n"
11 |
12 | // inc, not
13 | stl.output "inc, not:\n"
14 | hex.zero 16, vars
15 | hex.inc 16, vars
16 | hex.print_as_digit 16, vars, 0
17 | stl.output '\n'
18 | hex.set vars, 0xf
19 | hex.inc 16, vars
20 | hex.print_as_digit 16, vars, 0
21 | stl.output '\n'
22 | hex.zero 16, vars
23 | hex.not 16, vars
24 | hex.print_as_digit 16, vars, 0
25 | stl.output '\n'
26 | hex.inc 16, vars
27 | hex.print_as_digit 16, vars, 0
28 | stl.output "\n\n"
29 |
30 |
31 | // dec1
32 | stl.output "dec1:\n"
33 | hex.mov 16, vars, consts
34 | rep(16, i) dec1_print_borrow vars+i*dw, vars2+i*dw
35 | hex.print_as_digit 16, vars2, 0
36 | stl.output '\n'
37 | hex.print_as_digit 16, vars, 0
38 | stl.output "\n\n"
39 |
40 | // dec
41 | stl.output "dec:\n"
42 | hex.zero 16, vars
43 | hex.set vars, 2
44 | hex.dec 16, vars
45 | hex.print_as_digit 16, vars, 0
46 | stl.output '\n'
47 | hex.dec 16, vars
48 | hex.print_as_digit 16, vars, 0
49 | stl.output '\n'
50 | hex.dec 16, vars
51 | hex.print_as_digit 16, vars, 0
52 | stl.output '\n'
53 | hex.dec 16, vars
54 | hex.print_as_digit 16, vars, 0
55 | stl.output "\n\n"
56 |
57 |
58 | // neg
59 | stl.output "neg:\n"
60 | hex.zero 16, vars
61 | hex.neg 16, vars
62 | hex.print_as_digit 16, vars, 0
63 | stl.output '\n'
64 | hex.set vars+dw, 3
65 | hex.neg 16, vars
66 | hex.print_as_digit 16, vars, 0
67 | stl.output '\n'
68 | hex.neg 16, vars
69 | hex.print_as_digit 16, vars, 0
70 | stl.output "\n\n"
71 |
72 |
73 | // sign
74 | stl.output "sign:\n"
75 | rep( 16, i) test_sign 1, i
76 | stl.output '\n'
77 | rep(256, i) test_sign 2, i
78 | stl.output "\n\n"
79 |
80 |
81 | stl.loop
82 |
83 |
84 | vars: rep(16, j) hex.hex j
85 | vars2: rep(16, j) hex.hex 15-j
86 | consts: rep(16, j) hex.hex j
87 |
88 |
89 | def inc1_print_carry hex, carry @ output1, end {
90 | hex.zero carry
91 | hex.inc1 hex, end, output1
92 | output1:
93 | carry+dbit;
94 | end:
95 | }
96 |
97 |
98 | def dec1_print_borrow hex, borrow @ output1, end {
99 | hex.zero borrow
100 | hex.dec1 hex, end, output1
101 | output1:
102 | borrow+dbit;
103 | end:
104 | }
105 |
106 |
107 | def test_sign n, x @ neg, zpos, xh, end {
108 | hex.sign n, xh, neg, zpos
109 |
110 | neg:
111 | stl.output '-'
112 | ;end
113 | zpos:
114 | stl.output '+'
115 | ;end
116 |
117 | xh: hex.vec n, x
118 | end:
119 | }
120 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics1/basic_memory.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | // xor
4 | stl.output "xor:\n"
5 | rep (16, val) xor_all val
6 | stl.output '\n'
7 |
8 | // zero
9 | stl.output "zero:\n"
10 | hex.zero 16, vars
11 | hex.print_as_digit 16, vars, 0
12 | stl.output "\n\n"
13 |
14 | // xor (as vec) once again
15 | stl.output "xor n:\n"
16 | hex.xor 16, vars, consts
17 | hex.print_as_digit 16, vars, 0
18 | stl.output "\n\n"
19 |
20 | // xor_zero
21 | stl.output "xor_zero:\n"
22 | hex.xor_zero 16, vars2, vars
23 | hex.print_as_digit 16, vars, 0
24 | stl.output '\n'
25 | hex.print_as_digit 16, vars2, 0
26 | stl.output "\n\n"
27 |
28 | // mov
29 | stl.output "mov:\n"
30 | hex.mov 16, vars, vars2
31 | hex.print_as_digit 16, vars, 0
32 | stl.output '\n'
33 | hex.print_as_digit 16, vars2, 0
34 | stl.output "\n\n"
35 |
36 | // set
37 | stl.output "set:\n"
38 | rep(16, i) hex.set vars+i*dw, 15-i
39 | hex.print_as_digit 16, vars, 0
40 | stl.output '\n'
41 | hex.print_as_digit 16, vars2, 0
42 | stl.output "\n\n"
43 |
44 | // swap
45 | stl.output "swap:\n"
46 | hex.swap 16, vars, vars2
47 | hex.print_as_digit 16, vars, 0
48 | stl.output '\n'
49 | hex.print_as_digit 16, vars2, 0
50 | stl.output "\n\n"
51 |
52 | stl.loop
53 |
54 |
55 | vars: rep(16, j) hex.hex j
56 | vars2: hex.vec 16, 0
57 | consts: rep(16, j) hex.hex j
58 |
59 |
60 | def xor_all val < vars, consts {
61 | rep (16, i) hex.xor vars+i*dw, consts+val*dw
62 | hex.print_as_digit 16, vars, 0
63 | stl.output '\n'
64 | }
65 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics1/if.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 |
4 | // if_flags
5 | stl.output "if_flags:\n"
6 | // ops = [(randint(0, 15), randint(0,(2**16)-1)) for _ in range(100)]
7 | // hexlib.out line: for h, f in ops: print((f>>h)&1, end='')
8 | // IF_100_NUMS = hex(sum(h+f*16 << (i*20) for i, (h,f) in enumerate(ops)))
9 | IF_FLAGS_NUMS = 0x2098593d070776a83803ed025fcf2630b539677e0a51278ec3b572bfa969f37eb32fa5a27d38f4f1ba10d5900345ee5d4b50f0d9b73a3ef84d8cbd2258f5a9cdedd958464321a1be0a3d2ba53a12ff684678ccaeea178472da56b4559e3b6e1fb5afd9afc3d69a167c53a95b2516817ba4f9890ded69f06b8e4eae281a4968d57d836496ceea29b290de0a64f6352588dc27b156aa22acc8147ff6400f5d71cd956b7021d2175e2f44c5f78c7d2afc97dacc10e9f17d11206ab17f05ffaf20a7af40b9c09c305a72f0dd8782762922df18191171efd38c65b187350bbecbd27c62c480459289ce5599ceda69a776420065898f22b7cf640a898
10 | rep(100, i) print_if_flags (IF_FLAGS_NUMS>>(i*20))&((i<<20)-1)
11 | stl.output "\n\n"
12 |
13 |
14 | // if
15 | stl.output "if:\n"
16 |
17 | hex.zero vars
18 | print_if vars
19 | print_if0 vars
20 | print_if1 vars
21 | stl.output '\n'
22 |
23 | hex.set vars, 1
24 | print_if vars
25 | print_if0 vars
26 | print_if1 vars
27 | stl.output '\n'
28 |
29 | hex.set vars, 8
30 | print_if vars
31 | print_if0 vars
32 | print_if1 vars
33 | stl.output '\n'
34 |
35 | hex.set vars, 15
36 | print_if vars
37 | print_if0 vars
38 | print_if1 vars
39 | stl.output "\n\n"
40 |
41 |
42 | // if n
43 |
44 | hex.zero 16, vars
45 | print_if_16 vars
46 | print_if0_16 vars
47 | print_if1_16 vars
48 | stl.output '\n'
49 |
50 | hex.set vars, 1
51 | print_if_16 vars
52 | print_if0_16 vars
53 | print_if1_16 vars
54 | stl.output '\n'
55 |
56 | hex.set vars, 0
57 | hex.set vars+7*dw, 4
58 | print_if_16 vars
59 | print_if0_16 vars
60 | print_if1_16 vars
61 | stl.output '\n'
62 |
63 | hex.zero 16, vars
64 | hex.not 16, vars
65 | print_if_16 vars
66 | print_if0_16 vars
67 | print_if1_16 vars
68 | stl.output "\n\n"
69 |
70 |
71 | stl.loop
72 |
73 |
74 | vars: hex.vec 16
75 |
76 |
77 | def print_if_flags hex_flags_val @ l0, l1, hex < stl.IO {
78 | hex.if_flags hex, hex_flags_val>>4, l0, l1
79 | hex: hex.hex hex_flags_val & 0xf
80 | l0:
81 | stl.IO+0;l1+dw
82 | l1:
83 | stl.output '1'
84 | }
85 |
86 | def print_if hex @ l0, l1 < stl.IO {
87 | hex.if hex, l0, l1
88 | l0: stl.IO+0;l1+dw
89 | l1: stl.output '1'
90 | }
91 | def print_if0 hex @ l0 < stl.IO {
92 | hex.if0 hex, l0
93 | stl.IO+1;l0+dw
94 | l0: stl.output '0'
95 | }
96 | def print_if1 hex @ l1 < stl.IO {
97 | hex.if1 hex, l1
98 | stl.IO+0;l1+dw
99 | l1: stl.output '1'
100 | }
101 |
102 | def print_if_16 hex @ l0, l1 < stl.IO {
103 | hex.if 16, hex, l0, l1
104 | l0: stl.IO+0;l1+dw
105 | l1: stl.output '1'
106 | }
107 | def print_if0_16 hex @ l0 < stl.IO {
108 | hex.if0 16, hex, l0
109 | stl.IO+1;l0+dw
110 | l0: stl.output '0'
111 | }
112 | def print_if1_16 hex @ l1 < stl.IO {
113 | hex.if1 16, hex, l1
114 | stl.IO+0;l1+dw
115 | l1: stl.output '1'
116 | }
117 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics1/input.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 |
4 | // input_hex
5 | stl.output "input_hex:\n"
6 | rep(16, i) input2hex input+i*dw
7 | hex.print_as_digit 16, input, 0
8 | input2hex garbage
9 | stl.output '\n'
10 |
11 | // input_hex
12 | rep(64, i) input_hex_print_error
13 | input2hex garbage
14 | stl.output "\n\n"
15 |
16 |
17 | // input-print
18 | stl.output "input-print:\n"
19 | hex.input 16, input
20 | hex.print 16, input
21 | input2hex garbage
22 | stl.output '\n'
23 | rep(11, i) cat_char
24 | input2hex garbage
25 | stl.output "\n\n"
26 |
27 |
28 | stl.loop
29 |
30 |
31 | input: hex.vec 16*2
32 | garbage: hex.vec 2
33 |
34 |
35 | def input2hex hex < garbage {
36 | hex.input_hex hex
37 | hex.input_hex garbage
38 | }
39 |
40 | def input_hex_print_error @ hex, error, end {
41 | hex.input_as_hex hex, error
42 | hex.print_as_digit hex, 0
43 | ;end
44 |
45 | hex: hex.hex
46 | error:
47 | stl.output 'X'
48 | end:
49 | }
50 |
51 | def cat_char @ char, end {
52 | hex.input char
53 | hex.print char
54 | ;end
55 | char: hex.vec 2
56 | end:
57 | }
58 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics1/print_as_digit.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | hex.print_as_digit 16, vars, 0
4 | stl.output '\n'
5 | hex.print_as_digit 16, vars, 1
6 | stl.output '\n'
7 |
8 | stl.loop
9 |
10 |
11 | vars: rep(16, j) hex.hex j
12 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics1/print_int.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 |
4 | // print_uint
5 | stl.output "print_uint:\n"
6 | rep(5, i) print_uint 16, positive+16*i*dw
7 | stl.output '\n'
8 |
9 | // print_int
10 | stl.output "print_int:\n"
11 | rep(9, i) print_int 16, positive+16*i*dw
12 | stl.output '\n'
13 |
14 |
15 | stl.loop
16 |
17 |
18 | positive:
19 | hex.vec 16, 0x12345AF
20 | hex.vec 16, 0xDeadC0de
21 | hex.vec 16, 0x3
22 | hex.vec 16, 0x0f0
23 | hex.vec 16, 0x0
24 | negative:
25 | hex.vec 16, (0 -0x12345AF)&((1<<64)-1)
26 | hex.vec 16, (0 -0xDeadC0de)&((1<<64)-1)
27 | hex.vec 16, (0 -0x3)&((1<<64)-1)
28 | hex.vec 16, (0 -0x0f0)&((1<<64)-1)
29 |
30 |
31 | def print_uint n, x {
32 | hex.print_uint n, x, 1, 0
33 | stl.output ", "
34 | hex.print_uint n, x, 1, 1
35 | stl.output ", "
36 | hex.print_uint n, x, 0, 0
37 | stl.output ", "
38 | hex.print_uint n, x, 0, 1
39 | stl.output "\n"
40 | }
41 |
42 | def print_int n, x {
43 | hex.print_int n, x, 1, 0
44 | stl.output ", "
45 | hex.print_int n, x, 1, 1
46 | stl.output ", "
47 | hex.print_int n, x, 0, 0
48 | stl.output ", "
49 | hex.print_int n, x, 0, 1
50 | stl.output "\n"
51 | }
52 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/add_count_bits.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_add_count_bits i&0xf, i>>4
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
10 |
11 | ah: hex.vec 1
12 | bh: hex.vec 2
13 | ch: hex.vec 2
14 |
15 |
16 | ret: ;0
17 |
18 | add_count_bits_2:
19 | hex.add_count_bits 2, bh, ah
20 | stl.fret ret
21 |
22 |
23 | def test_add_count_bits dst, x @ lt, eq, gt, end < ah, bh, ch, add_count_bits_2, ret {
24 | hex.set ah, x
25 | hex.set 2, bh, dst
26 | hex.set 2, ch, dst + ((x>>0)&1) + ((x>>1)&1) + ((x>>2)&1) + ((x>>3)&1)
27 | stl.fcall add_count_bits_2, ret
28 | hex.cmp 2, bh, ch, lt, eq, gt
29 |
30 | lt:
31 | stl.output '<'
32 | ;end
33 | eq:
34 | stl.output '='
35 | ;end
36 | gt:
37 | stl.output '>'
38 | ;end
39 |
40 | end:
41 | stl.output '\n'
42 | }
43 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/count_bits.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | CB_NUM = 0x1f4a245bbcb588e8a76ec9f10c25fd21aac218d91e9d6a6bd7965a99ec604d6f9a662865e3c1fd319a75eea0390d3a50f52a60bfdd890f79db7ab0bedc2bab04268d47d95069f296a32a4ef00aed76feecf3260bf6dcf0004fd0cb68df5cc6ebbe0f5636b58665b148d0d8fb4ebd7e2a68efffaf782ebabc1a66d0991dc02ac46b5e25d40cec197b90a4eafc67976da0091f7cac5a58d10a36817702a59e1371f3f64f2298135574768c139833bce2e7b250e9984b65164efe9c77fa1c7b55069c96be65e256bdb6c6087d915c839157df4f67f5feef7483bad6697d7afdda6317290f68febf4701e926b81ea180e5db274d202379cb68b436872060e966afc4e886e8fa7f39f5d31656937c3a6c03ab39b6f99b47a9520c63a69b42f5f38ef0e669d2fe749aa478bd80f5a055f08bd4e930bb5b03f00a48bda48498f83e567cc0dbd585bd3ca29b81cb29ab37d2e9997c07da8353675afe26936c39ba45be43db24a8042b4655c9d4e68a4ae4dd331dd7d10aba78697ff647e7c7f04e5ef7bd8001c0f2eac3ea1f8913940b822026d0f3d44269d61f2a9814d5af4d72550a0c8449d257c6fbf418aaba244af95b4266cba3a57b142977f341f68db4534cc6d47d4ed534c1a07c4b069cd3c913f88471a670a53ef3ac9af50cb0d28739ce7b53abc1e9b5f57d079b58e3403293df0c343386a1358de67b8ebe1c3fc761d6fdd7144676ee4aace3f96c3157a5823609328f34a5b93ca3a7bdf978c725ff8552252b6507b77dd4e356137e8664d1a4eda46cb8abf02c5978e763ea8bc430368c81666a5f468f413d920da5b718ca73161a3d4a85f78668bdac3546b22626267a98d0b653ce275a066b2faa25697eb229ab39c6c1f6581aa8cb68c7d4d57256c54b154f8314d533e349710da4c8054cc5fa3218d0d58cf8624275b92b9f3102e199c376e5258b1332b957c2192cc5c325410b5894510bd5d4470233a97479a0398039c971f468b7cbe0e364f1bf2ebb4c0ddb540bfc80dc1dfc3983e6fb979cbf9bd5631f0e051ece545a3fceb4c8876a5b72b77606d44f73c80111701c790be1c240e843cccda50ed9313c0be528848fd065d80e77428a90c002986c558629426c
4 | rep(100, i) test_count_bits_64 (CB_NUM>>(64*i))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
11 |
12 | ch: hex.vec 2
13 | xh: hex.vec 16
14 | count: hex.vec 2
15 |
16 |
17 | ret: ;0
18 |
19 | count_bits_64:
20 | hex.count_bits 16, count, xh
21 | stl.fret ret
22 |
23 |
24 | def test_count_bits_64 x @ lt, eq, gt, end < xh, count, ch, count_bits_64, ret {
25 | hex.set 16, xh, x
26 | hex.set 2, ch, \
27 | ((x>>0)&1)+((x>>1)&1)+((x>>2)&1)+((x>>3)&1)+((x>>4)&1)+((x>>5)&1)+((x>>6)&1)+((x>>7)&1)+\
28 | ((x>>8)&1)+((x>>9)&1)+((x>>10)&1)+((x>>11)&1)+((x>>12)&1)+((x>>13)&1)+((x>>14)&1)+((x>>15)&1)+\
29 | ((x>>16)&1)+((x>>17)&1)+((x>>18)&1)+((x>>19)&1)+((x>>20)&1)+((x>>21)&1)+((x>>22)&1)+((x>>23)&1)+\
30 | ((x>>24)&1)+((x>>25)&1)+((x>>26)&1)+((x>>27)&1)+((x>>28)&1)+((x>>29)&1)+((x>>30)&1)+((x>>31)&1)+\
31 | ((x>>32)&1)+((x>>33)&1)+((x>>34)&1)+((x>>35)&1)+((x>>36)&1)+((x>>37)&1)+((x>>38)&1)+((x>>39)&1)+\
32 | ((x>>40)&1)+((x>>41)&1)+((x>>42)&1)+((x>>43)&1)+((x>>44)&1)+((x>>45)&1)+((x>>46)&1)+((x>>47)&1)+\
33 | ((x>>48)&1)+((x>>49)&1)+((x>>50)&1)+((x>>51)&1)+((x>>52)&1)+((x>>53)&1)+((x>>54)&1)+((x>>55)&1)+\
34 | ((x>>56)&1)+((x>>57)&1)+((x>>58)&1)+((x>>59)&1)+((x>>60)&1)+((x>>61)&1)+((x>>62)&1)+((x>>63)&1)
35 | stl.fcall count_bits_64, ret
36 | hex.cmp 2, count, ch, lt, eq, gt
37 |
38 | lt:
39 | stl.output '<'
40 | ;end
41 | eq:
42 | stl.output '='
43 | ;end
44 | gt:
45 | stl.output '>'
46 | ;end
47 |
48 | end:
49 | stl.output '\n'
50 | }
51 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shift_utils.fj:
--------------------------------------------------------------------------------
1 | def test_shl_bit n, x @ lt, eq, gt, xh, ch, end {
2 | hex.shl_bit n, xh
3 | hex.cmp n, xh, ch, lt, eq, gt
4 |
5 | lt:
6 | stl.output '<'
7 | ;end
8 | eq:
9 | stl.output '='
10 | ;end
11 | gt:
12 | stl.output '>'
13 | ;end
14 |
15 | xh: hex.vec n, x
16 | ch: hex.vec n, (x<<1)&((1<<(4*n))-1)
17 | end:
18 | stl.output '\n'
19 | }
20 |
21 | def test_shr_bit n, x @ lt, eq, gt, xh, ch, end {
22 | hex.shr_bit n, xh
23 | hex.cmp n, xh, ch, lt, eq, gt
24 |
25 | lt:
26 | stl.output '<'
27 | ;end
28 | eq:
29 | stl.output '='
30 | ;end
31 | gt:
32 | stl.output '>'
33 | ;end
34 |
35 | xh: hex.vec n, x
36 | ch: hex.vec n, (x>>1)&((1<<(4*n))-1)
37 | end:
38 | stl.output '\n'
39 | }
40 |
41 |
42 | def test_shl_hex n, times, x @ lt, eq, gt, xh, ch, end {
43 | hex.shl_hex n, times, xh
44 | hex.cmp n, xh, ch, lt, eq, gt
45 |
46 | lt:
47 | stl.output '<'
48 | ;end
49 | eq:
50 | stl.output '='
51 | ;end
52 | gt:
53 | stl.output '>'
54 | ;end
55 |
56 | xh: hex.vec n, x
57 | ch: hex.vec n, (x<<(4*times)) & ((1<<(4*n))-1)
58 | end:
59 | stl.output '\n'
60 | }
61 |
62 | def test_shr_hex n, times, x @ lt, eq, gt, xh, ch, end {
63 | hex.shr_hex n, times, xh
64 | hex.cmp n, xh, ch, lt, eq, gt
65 |
66 | lt:
67 | stl.output '<'
68 | ;end
69 | eq:
70 | stl.output '='
71 | ;end
72 | gt:
73 | stl.output '>'
74 | ;end
75 |
76 | xh: hex.vec n, x
77 | ch: hex.vec n, (x>>(4*times)) & ((1<<(4*n))-1)
78 | end:
79 | stl.output '\n'
80 | }
81 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shl_bit.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_shl_bit 2, i
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shl_bit_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHL_BIT_NUM = 0xc8fcbed153fd0e8d144845766379fd5efd18ff7292af2fa040411b27bebf949cd8228ad4200b17b3e6e590c162947c5e17efc1d43f0873c0cc7ed9b1d784a515a1c18e511d26f79c4c4c9d7def6d05a1c3d672d8e3ba80089e0d970f95371981ace3365c03b2962ed08468a0f1b48f611e6cfb197146709487d6e3a8f74ba06e1ad0ac4be09ab36ba6561e79dc8fa3cb33e30d11032eb2a4e7d158b65cc3b6b753b4b85dab3efc9cb10f1ee8a4a4504f52f08be95c3f565edac2b9c139424c3e77d2d94904f691e5
4 | rep(25, i) test_shl_bit 16, (SHL_BIT_NUM>>(64*i))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shl_hex.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_shl_hex 2, 1, i
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shl_hex_big.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHL_HEX_NUM = 0x96bfc00f7403bc38e061eb9731b57671c8b91d42cc6d54c38d79bdfa65ab3fd958bfabb437a62f5b8be4298fa31a6a50c978c81cc41db2aa886ce6ac0692d7e6b983225eafc74831c4604b587ef2358baed4abcb99583f45d0041d3e8ada9ded0326b3d70df57810958477b3f1627a1b1f79aea80e3b3a1b6d20b43fae73800a547d7016a7d1681cdb2a9134ba57bdf3ebc19c65574d12c8ac814e237cca4fed4bdde8a916be96d6706a200ad39def191c944a75d402a25d3dad2b2bbd61e943804a2d26caf292e8
4 | rep(25, i) test_shl_hex 16, 1, (SHL_HEX_NUM>>(64*i))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shl_hex_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHL_HEX_NUM = 0x4df9d4a087150bb62d7edffc5477a660cf81009dcec494a12d4d6bf172204c7ead0fcc60211ee8c0d18d794f46edc92c4a0e1cefd8cd78bba1d6db7caffe37b4d806a162074b6dfcd3ab71b23603fbfd7df6688eb33484fda0da3826ae5db76d73857fad990aa9002462a34ec9f525a369d28325a7863fc46e154a8a8c644afe06a5f49696c199b5e3ccc99f456979c23bbbf5dc0033f6e72057357eedb07ce689bf4841283aefccb66c7ae5f050dc453b0a02a3f2e3aa57d280aaa6db019306414bbc191301e0640502b4cc933e627bf8c8b82ad
4 | rep(25, i) test_shl_hex 16, (SHL_HEX_NUM>>(68*i))&0xf, (SHL_HEX_NUM>>(68*i+4))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shr_bit.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_shr_bit 2, i
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shr_bit_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHR_BIT_NUM = 0xe71e3e4a716549fb31fc565d0dbb2f96c846c32ee4018325d1cd59436959489e67e9c48d3c4861da188988ead4f9fefab18e0c51c22c7241405f456ff95023b9cec204245f9bc9285cdead281e5aef9458296a4036cdb03ffcece333cb5c2d05fd66ddf091b82de8e16bc08b648ab018a3f05a1d812f94223419680ea44e0b11121da44b5bdf7f55a1346ea0d69a244177005a266bfb233372c7e12a8b6f76a39c1364624820a19d395f224d19d91fb6f535c8d485420d4c6520065687092d730d5257944ce12a5e
4 | rep(25, i) test_shr_bit 16, (SHR_BIT_NUM>>(64*i))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shr_hex.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(256, i) test_shr_hex 2, 1, i
4 |
5 | stl.loop
6 |
7 |
8 | hex.init
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shr_hex_big.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHR_HEX_NUM = 0xe7d664775cec9f714aa04965fae77bdcb9d3a528efac59559589e77b7c358996028b86dcc178781acc44a171f47b25dda80f96c221b1c20a5364d240bd4cf46f782dd4d0cb6acfc393c30d03235e34197afef6c03c6f0828101f0b567d39319d68055fe664537da50df3c2434a4ab5fcf933fd3e70da4a79d040c38bca236b892710168279486eda4e0bf9c2914987648afef39bccd9c06e53010a637a9defc0e200b486b48d6c58772d8f7f45ba8931a325fd17af6c1739a70ee9bc472351ef224c6ce145c554ae
4 | rep(25, i) test_shr_hex 16, 1, (SHR_HEX_NUM>>(64*i))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/basics2/shr_hex_n.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHR_HEX_NUM = 0x4df9d4a087150bb62d7edffc5477a660cf81009dcec494a12d4d6bf172204c7ead0fcc60211ee8c0d18d794f46edc92c4a0e1cefd8cd78bba1d6db7caffe37b4d806a162074b6dfcd3ab71b23603fbfd7df6688eb33484fda0da3826ae5db76d73857fad990aa9002462a34ec9f525a369d28325a7863fc46e154a8a8c644afe06a5f49696c199b5e3ccc99f456979c23bbbf5dc0033f6e72057357eedb07ce689bf4841283aefccb66c7ae5f050dc453b0a02a3f2e3aa57d280aaa6db019306414bbc191301e0640502b4cc933e627bf8c8b82ad
4 | rep(25, i) test_shr_hex 16, (SHR_HEX_NUM>>(68*i))&0xf, (SHR_HEX_NUM>>(68*i+4))&((1<<64)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test4_1.fj:
--------------------------------------------------------------------------------
1 | rep(50, i) test_div 4, 1, div4_1, (DIV_NUM>>(16*i+0))&((1<<16)-1), (DIV_B1_NUM>>( 4*i))&((1<< 4)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div4_1:
7 | hex.div 4, 1, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test4_2.fj:
--------------------------------------------------------------------------------
1 | rep(30, i) test_div 4, 2, div4_2, (DIV_NUM>>(16*i+1))&((1<<16)-1), (DIV_B2_NUM>>( 8*i))&((1<< 8)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div4_2:
7 | hex.div 4, 2, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test4_4.fj:
--------------------------------------------------------------------------------
1 | rep(20, i) test_div 4, 4, div4_4, (DIV_NUM>>(16*i+2))&((1<<16)-1), (DIV_B4_NUM>>(16*i))&((1<<16)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div4_4:
7 | hex.div 4, 4, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test8_1.fj:
--------------------------------------------------------------------------------
1 | rep(40, i) test_div 8, 1, div8_1, (DIV_NUM>>(64*i+3))&((1<<32)-1), (DIV_B1_NUM>>( 4*i + 50* 4))&((1<< 4)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div8_1:
7 | hex.div 8, 1, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test8_2.fj:
--------------------------------------------------------------------------------
1 | rep(30, i) test_div 8, 2, div8_2, (DIV_NUM>>(64*i+4))&((1<<32)-1), (DIV_B2_NUM>>( 8*i + 50* 8))&((1<< 8)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div8_2:
7 | hex.div 8, 2, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test8_4.fj:
--------------------------------------------------------------------------------
1 | rep(20, i) test_div 8, 4, div8_4, (DIV_NUM>>(64*i+5))&((1<<32)-1), (DIV_B4_NUM>>(16*i + 50*16))&((1<<16)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div8_4:
7 | hex.div 8, 4, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test8_8.fj:
--------------------------------------------------------------------------------
1 | rep(10, i) test_div 8, 8, div8_8, (DIV_NUM>>(64*i+6))&((1<<32)-1), (DIV_B8_NUM>>(32*i + 50*32))&((1<<32)-1)
2 |
3 | stl.loop
4 |
5 |
6 | div8_8:
7 | hex.div 8, 8, res, mod, ah, bh, div0
8 | stl.fret ret
9 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test_idiv.fj:
--------------------------------------------------------------------------------
1 | rep(30, i) test_idiv 4, 2, idiv4_2, (DIV_NUM>>(16*i+1))&((1<<16)-1), (DIV_B2_NUM>>( 8*i))&((1<< 8)-1)
2 |
3 | rep(20, i) test_idiv 4, 4, idiv4_4, (DIV_NUM>>(16*i+2))&((1<<16)-1), (DIV_B4_NUM>>(16*i))&((1<<16)-1)
4 |
5 |
6 | stl.loop
7 |
8 |
9 | idiv4_2:
10 | hex.idiv 4, 2, res, mod, ah, bh, div0, 0
11 | stl.fret ret
12 |
13 |
14 | idiv4_4:
15 | hex.idiv 4, 4, res, mod, ah, bh, div0, 0
16 | stl.fret ret
17 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/div/test_idiv_cases.fj:
--------------------------------------------------------------------------------
1 | test_idiv_opt 20, 12, 1, 8, idiv_opt0
2 | test_idiv_opt 20, (0-12), (0-2), (0-4), idiv_opt0
3 | test_idiv_opt (0-20), 12, (0-2), 4, idiv_opt0
4 | test_idiv_opt (0-20), (0-12), 1, (0-8), idiv_opt0
5 |
6 | test_idiv_opt 20, 12, 1, 8, idiv_opt1
7 | test_idiv_opt 20, (0-12), (0-1), 8, idiv_opt1
8 | test_idiv_opt (0-20), 12, (0-1), (0-8), idiv_opt1
9 | test_idiv_opt (0-20), (0-12), 1, (0-8), idiv_opt1
10 |
11 | test_idiv_opt 20, 12, 1, 8, idiv_opt2
12 | test_idiv_opt 20, (0-12), (0-1), 8, idiv_opt2
13 | test_idiv_opt (0-20), 12, (0-2), 4, idiv_opt2
14 | test_idiv_opt (0-20), (0-12), 2, 4, idiv_opt2
15 |
16 |
17 | stl.loop
18 |
19 |
20 | idiv_opt0:
21 | hex.idiv 4, 4, res, mod, ah, bh, div0, 0
22 | stl.fret ret
23 |
24 | idiv_opt1:
25 | hex.idiv 4, 4, res, mod, ah, bh, div0, 1
26 | stl.fret ret
27 |
28 | idiv_opt2:
29 | hex.idiv 4, 4, res, mod, ah, bh, div0, 2
30 | stl.fret ret
31 |
32 |
33 | def test_idiv_opt a, b, expected_res, expected_mod, idiv_label\
34 | @ res_bad, res_good, mod_bad, mod_good, check_mod, expected_res_var, expected_mod_var, end\
35 | < ah, bh, ret, res, mod {
36 | hex.set 4, ah, a
37 | hex.set 4, bh, b
38 | stl.fcall idiv_label, ret
39 |
40 | hex.cmp 4, res, expected_res_var, res_bad, res_good, res_bad
41 | res_good:
42 | stl.output '='
43 | ;check_mod
44 | res_bad:
45 | stl.output '!'
46 | ;check_mod
47 |
48 | check_mod:
49 | hex.cmp 4, mod, expected_mod_var, mod_bad, mod_good, mod_bad
50 |
51 | mod_good:
52 | stl.output '='
53 | ;end
54 | mod_bad:
55 | stl.output '!'
56 | ;end
57 |
58 | expected_res_var:
59 | hex.vec 4, expected_res
60 | expected_mod_var:
61 | hex.vec 4, expected_mod
62 |
63 | end:
64 | stl.output '\n'
65 | }
66 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/add_mul32.fj:
--------------------------------------------------------------------------------
1 | NumSize = 32
2 | Repetitions = 50
3 | Data = 0xa5013646b6b604fc9cdad5733934c62cdd6662cad97b5c73eef42b06833d5b8d8c11bcd546a4a1aa40e54cb97208e09105ea1209e0bcffae881be9d9366d0d977b4607c1368da9f03f0ee904acd4ac7af70f8d6d0fc175b7d3f200872dadde5305dfa772cb5bbf2068f3a0f18526f7fa6b690543f7a87afcea28277d72217eedb067a02c7a17e34141852464b6572879009bf78ba3a0918b2274bfdeb7a95df16991fb4112a9582d97a1854df663ff01745ec5b10cfb29dd7260a57525e66c8ed243ca9381f4b624004f6ef5f8e4ba46856a839b27fa58a67e7c7b17bd468565f3148ff1ccfe7a066fc4f6d83eb48aee98a6fe7cc74c9a85d08028aa5e1a49176e2f46c32f712856542a4543aeb93ebadb54eb6a5047c00ac6592b6c2302de71f423f32f61949e13b2b3dc9e736b188a7c73d0a436ae860a58814e7e6ca8dd3e19a8c5477d0d70c2218553c40ba278fd71ee75fd7d80dd956460000d1b6e94be509ddb64d07dd27fc9c90bf0f53cb89146ddf1ea7b48c6043f88ccea4b754a752607190901ba1252fd50e91bf4f66986a99324cbc7e54efe0fb41e2ace11948ac9796d01d14cd3d2be
4 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/add_mul4.fj:
--------------------------------------------------------------------------------
1 | NumSize = 4
2 | Repetitions = 100
3 | Data = 0x3787e7d8c45c5eefb8a2cdd909a9e73210d24441f7c8b13aad24166b69780a672ee724faecddc0fbf42163dd4ba0104c191fcbf934fb8b710e1653d28cf6ef0ade0ecc43805d14a15be12649efc47eb45f46906eeaae3b0660c4b978654076f20fcfbbbfb66e660668d4b10fa5584bd2c8743f9a39cdf8634a09a386c755f8deae1b1b560eaf4e07ce39f30c82a59d7d3112077516d1
4 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/add_mul64.fj:
--------------------------------------------------------------------------------
1 | NumSize = 64
2 | Repetitions = 50
3 | Data = 0xe1a4346d15ef88cdd1049445fb52e1b61d735a0c0bdfcbd58b98b83a6c3d7a26a6fe32da63f4cb96abadcc56d31b482d5b1ddcfcb15818d44b33f33b6feb27c285ec58e9af69b030c417304a6bf7625bfe0dcc0a49bd6b1b45c0dbeb3dfab78ee10f88557fc0a2b92f46f815464bce70554b9c493bf9ecda863d8cba507d70856e2491e2b19747a1203d5463dd74322d76c76f29d4312128129028bafb56dfd0c21370081c89fc54aecea4f546a268b1be489df3124434ec27fa7e9ebb1757bb47bbea8d7de577cb3ee4e01e67e611f8c6e693352426d90e3d922ae35b4b27ba238dcd52803daf0977c7485c0e270aff7b80397ca3a3390b743c1ed6dc03fb3e694bcfcee63d0af290a558f3b6d0bda69975e11d9354e716ad3d263d927277e571d50278e3bfb4dc089e43c549c06767eac0af6a3985612b014b393a65e9edc48451ab33978d363c9299bd38ebb05025021e272ac92ad39072a144202b5a3960cab458d5e320d79bc965b8953102adfaf3b843267ba21f1c44ebc894159b72237166e1a9992b2a35f3a70f6627b737a1f543445502d6f4503ebfe144a77a57d06a7de812fcddf8b4c4536b6d16e5e8b7f7af5e975fe7e8efd5bf01f0bed8bd6d6a9cbd168c6000ef4d30ce746dbe01395fbcf600324da6803b65ceadb76999ca076285c0e9977aef8bd6bec29c26da047fc7cf1dc6fb2f0723d80285c8467e9ec97913f7ca10dc7e1aaa5408beb84dd26b1003c0d48c80725acaa008cd190806c5140256b95e0b32d299963a06330fddf600b2559a286ce00ea1870890d0b0c359988f7a98f8a3d57e9814ee40b0855e87d8e94e7d0c8fcab05d38e1867ba16b7783395ccc14f1f5344350b3403712619a5064cd6d8f25c3a41bab3bfd5de66065b931b91cd7c92da8a51994e83bb7eba2eae7699401b38d1cd9dc124cfe73ee4e1d17fc935eec3db62e3f42777f266edb85c4218647ae0dc7c9b8709dbef64457c793c1675686e2ae7552a2a0972c07aa6a74e85ad5f029a8667ee74e0dfe634daa2afad41f97d4fc999ad87ead58cb4db140755c53ae94d234a73dc9f7b228a6a842295f3f770ad3af355a66a37e3cb42715e4078868f0999118e1be76e799325f1fd058a9397454ba6fc6007e76695e3c69134e886d8fc0
4 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/add_mul8.fj:
--------------------------------------------------------------------------------
1 | NumSize = 8
2 | Repetitions = 50
3 | Data = 0xb9b6f356dabdd03035ed7e0a5958a48b917cf3d49369b5fb296e4eed1f002e09dcafc25a4ea100942e8a685f6086ca4629e1f983b4859adee91c0b220f8e705bc1796cb1c836069f55788d6e7f23b265c54cf452337fd8e9f8eebc550ed825d0262b89afafd23feffcd56124399c7f31f323b121f727faca797dfc90a3
4 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/add_mul_test.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | HexSize = NumSize / 4
4 | Flag = ((1<>(BlockSize*i))&Flag, \
8 | (Data>>(BlockSize*i + NumSize))&Flag, \
9 | (Data>>(BlockSize*i + 2*NumSize))&0xf
10 |
11 | stl.loop
12 |
13 |
14 | hex.init
15 |
16 |
17 | ah: hex.vec 16
18 | bh: hex.vec 16
19 | res: hex.vec 16
20 | old_res: hex.vec 16
21 | ch: hex.vec 16
22 |
23 | ret: ;0
24 |
25 |
26 | zero_all_5:
27 | hex.zero 16, ah
28 | hex.zero 16, bh
29 | hex.zero 16, ch
30 | hex.zero 16, res
31 | hex.zero 16, old_res
32 | stl.fret ret
33 |
34 | add_mul_lt_print:
35 | stl.output '\n'
36 | hex.print_uint 16, old_res, 1, 0
37 | stl.output " + "
38 | hex.print_uint 16, ah, 1, 0
39 | stl.output " * "
40 | hex.print_uint 16, bh, 1, 0
41 | stl.output " = "
42 | hex.print_uint 16, res, 1, 0
43 | stl.output " < "
44 | hex.print_uint 16, ch, 1, 0
45 | stl.output '\n'
46 | stl.fret ret
47 |
48 | add_mul_gt_print:
49 | stl.output '\n'
50 | hex.print_uint 16, old_res, 1, 0
51 | stl.output " + "
52 | hex.print_uint 16, ah, 1, 0
53 | stl.output " * "
54 | hex.print_uint 16, bh, 1, 0
55 | stl.output " = "
56 | hex.print_uint 16, res, 1, 0
57 | stl.output " > "
58 | hex.print_uint 16, ch, 1, 0
59 | stl.output '\n'
60 | stl.fret ret
61 |
62 |
63 | add_mul:
64 | hex.add_mul HexSize, res, ah, bh
65 | stl.fret ret
66 |
67 | def test_add_mul r, a, b @ lt, eq, gt, end \
68 | < ah, bh, res, old_res, ch, ret, add_mul_lt_print, add_mul_gt_print, add_mul, zero_all_5 {
69 | stl.fcall zero_all_5, ret
70 | hex.xor_by HexSize, ah, a
71 | hex.xor_by HexSize, bh, b
72 | hex.xor_by HexSize, res, r
73 | hex.xor_by HexSize, old_res, r
74 | hex.xor_by HexSize, ch, (r+a*b)&Flag
75 | stl.fcall add_mul, ret
76 | hex.cmp HexSize, res, ch, lt, eq, gt
77 |
78 | lt:
79 | stl.fcall add_mul_lt_print, ret
80 | ;end
81 | eq:
82 | stl.output "=\n"
83 | ;end
84 | gt:
85 | stl.fcall add_mul_gt_print, ret
86 | ;end
87 | end:
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/mul16.fj:
--------------------------------------------------------------------------------
1 | NumSize = 16
2 | Repetitions = 60
3 | IsNegative = 0
4 | Data = 0x877c9a9a4042a961af6adcd835f05de00c00aeceaf862cfc0327e26ac6819f9f893ae094658e4f683a1b68e974801a4d9cef67f0431baa1dbdaecb9cc6b389b4a289b3a8e5005b1964fb416a15fb9a4f9190f626a705f5e7742f96e1bb98f6d5595a75af8a0379f87587f3cbd6478617ae7ae9b92dc10c87eb7b6dbc0a14c120ff1b0cd729d6942ed333433c8f325d6fd73f75e9b82ee4498198ab94fe4179ff4fc494a7797ffd1aab0e2b40982fdd723cbe24aba82201aff0533b6f62f31861acda0d2aba6bfb3886f27ace16ac0214cba103275784ecb30d76536d43965b8b3556648338689bdaad96f4d794438345
5 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/mul32.fj:
--------------------------------------------------------------------------------
1 | NumSize = 32
2 | Repetitions = 40
3 | IsNegative = 0
4 | Data = 0xe760fa69d4bc32316869c80f47f07a7dba37ddb89e029b8be1a4c2c92058c672219eb814f05d6b4984775e4fe5b877eafb781c6bfbb123b33c75a0336e3bb97131a5e0550e883774a642e6b4c906ba23d5cbcd672113420bf1b5ef9dffecc521f8ab4ae5b26c05f512a7384f0dc4a44b35dbc90fd79bba9a967cc35b03ebccd63fe1e015dfdfcc0089aebc78f4615bac993772e4984e7d0270d9496686fced8ddd23fcb33347569747bb9c6cb458e55c79d7bb61f3466ea032de2cb88862462b373ad55693795e0ef96f7c3b2ffa91818be86b8112e3f6a48448f2311b87197e89db1c75f6eadb2db86e0bc1b40bb0291a3d58babc5917451561ad3157c3cc0a7629a42bb5023708d23d2ceb8a494aa1002f236995a0d18ee2422ddc649267296308bbad8c819b43cd1ee9fecc0079f2afc029783388063619915b72f3d9dedb
5 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/mul32_negative.fj:
--------------------------------------------------------------------------------
1 | NumSize = 32
2 | Repetitions = 40
3 | IsNegative = 1
4 | Data = 0xe760fa69d4bc32316869c80f47f07a7dba37ddb89e029b8be1a4c2c92058c672219eb814f05d6b4984775e4fe5b877eafb781c6bfbb123b33c75a0336e3bb97131a5e0550e883774a642e6b4c906ba23d5cbcd672113420bf1b5ef9dffecc521f8ab4ae5b26c05f512a7384f0dc4a44b35dbc90fd79bba9a967cc35b03ebccd63fe1e015dfdfcc0089aebc78f4615bac993772e4984e7d0270d9496686fced8ddd23fcb33347569747bb9c6cb458e55c79d7bb61f3466ea032de2cb88862462b373ad55693795e0ef96f7c3b2ffa91818be86b8112e3f6a48448f2311b87197e89db1c75f6eadb2db86e0bc1b40bb0291a3d58babc5917451561ad3157c3cc0a7629a42bb5023708d23d2ceb8a494aa1002f236995a0d18ee2422ddc649267296308bbad8c819b43cd1ee9fecc0079f2afc029783388063619915b72f3d9dedb
5 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/mul64.fj:
--------------------------------------------------------------------------------
1 | NumSize = 64
2 | Repetitions = 25
3 | IsNegative = 0
4 | Data = 0x14b1fe4e088e537a00703c863f6a513cfdb69eb7f99e6ee72ab4ea0c137e1393aa22672b2747f9c9ecc7836eb62efa1d7decac5e4fc57298c2d6b885fac6323fdc7f26d6e19fe21471d2cbf8f3a3fe965b7ddb13ea851771c6f795bbd48a56b12c18d24c7f5badf94d380ded95b5a1ac7cd2892d2f5377ce568a0ca05a9a7cf01c764815c6234e3df9b8a98fc43aa89a09dbb39678c2a46762cd075ce25a4b0681773215f404b523a7afa1290adba3dfabb7433e385373c7969c1bd334d2dac264358d6fdab94d26792e562acad3558bcff5e0b0a6449ac49d0ec8711a42e71daf96049f83fe4acdbf478241a1dc9338fde503f469ad5fc09d3f1850148d55e1f3fb36afc476af1e8ee07b2e588d6cc1b6deeef34b0d78e69399acca1e99a5912a53da52a167d59ba2b6bdbfba7d8bf4f21016546136db1f7e97587e9555c7c417baee758fe257cc629194c30516543bfcb3a1aa50c612a7d91718bb8563e69df132ef55c6dad79a57ad95e6b8340ab0b5605df84e410a2e8ef958d6236c4d84e3c444aabc30fab741959f8fd91dd425
5 |
--------------------------------------------------------------------------------
/programs/hexlib_tests/mul/mul_test.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | HexSize = NumSize / 4
4 | Flag = (1<>(BlockSize*i))&Flag, \
8 | (Data>>(BlockSize*i+NumSize))&Flag
9 |
10 | stl.loop
11 |
12 |
13 | hex.init
14 |
15 |
16 | ah: hex.vec 16
17 | bh: hex.vec 16
18 | res: hex.vec 16
19 | old_res: hex.vec 16
20 | ch: hex.vec 16
21 |
22 | ret: ;0
23 |
24 |
25 | lt_print:
26 | stl.output '\n'
27 | hex.print_uint 16, ah, 1, 0
28 | stl.output " * "
29 | hex.print_uint 16, bh, 1, 0
30 | stl.output " = "
31 | hex.print_uint 16, res, 1, 0
32 | stl.output " < "
33 | hex.print_uint 16, ch, 1, 0
34 | stl.output '\n'
35 | stl.fret ret
36 |
37 | gt_print:
38 | stl.output '\n'
39 | hex.print_uint 16, ah, 1, 0
40 | stl.output " * "
41 | hex.print_uint 16, bh, 1, 0
42 | stl.output " = "
43 | hex.print_uint 16, res, 1, 0
44 | stl.output " > "
45 | hex.print_uint 16, ch, 1, 0
46 | stl.output '\n'
47 | stl.fret ret
48 |
49 |
50 | mul:
51 | hex.mul HexSize, res, ah, bh
52 | stl.fret ret
53 |
54 |
55 | def test_mul_aux n, is_negative, a, b {
56 | test_mul n,\
57 | (is_negative & a>=(1<<(NumSize-1))) ? (1<=(1<<(NumSize-1))) ? (1<>i)&1
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/programs/multi_comp/b.fj:
--------------------------------------------------------------------------------
1 | def print_aaaa n {
2 | print_chars n, 'a'
3 | }
4 |
--------------------------------------------------------------------------------
/programs/multi_comp/c.fj:
--------------------------------------------------------------------------------
1 | NL = '\n'
2 |
3 |
4 | def print_chars n, c {
5 | rep(n, i) stl.output_char c
6 | }
7 |
8 | def println {
9 | stl.output_char NL
10 | }
11 |
--------------------------------------------------------------------------------
/programs/multi_comp/defs.fj:
--------------------------------------------------------------------------------
1 | N = 3
2 |
3 |
4 | def get_aaaaN {
5 | aaaaN = 5
6 | }
7 |
--------------------------------------------------------------------------------
/programs/pair_ns_tests/test1.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | Pair.init
4 |
5 | Pair.init p1
6 | Pair.init p2
7 |
8 |
9 | Pair.prints.print_two p1, p2
10 | stl.loop
11 |
12 |
13 | p1: bit.vec Pair.size
14 | p2: bit.vec Pair.size
15 |
--------------------------------------------------------------------------------
/programs/pair_ns_tests/test2.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | Pair.init
4 |
5 | Pair.init p1
6 | Pair.init p2
7 |
8 |
9 | Pair.add_first p1, v08
10 | Pair.add_second p1, v02
11 | Pair.prints.print_two p1, p2
12 |
13 | Pair.add_first p2, vAB
14 | Pair.add_second p2, vCC
15 | Pair.prints.print_two p1, p2
16 |
17 | Pair.add p1, p2
18 | Pair.prints.print_two p1, p2
19 |
20 | Pair.add p2, p1
21 | Pair.prints.print_two p1, p2
22 |
23 | stl.loop
24 |
25 |
26 | p1: bit.vec Pair.size
27 | p2: bit.vec Pair.size
28 |
29 | v08: .bit.vec w, 0x08
30 | v02: bit.vec w, 0x02
31 | vAB: .bit.vec w, 0xAB
32 | vCC: bit.vec w, 0xCC
33 |
--------------------------------------------------------------------------------
/programs/pair_ns_tests/test3.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | Pair.init
4 |
5 | Pair.init p1
6 | Pair.init p2
7 |
8 |
9 | Pair.add_first p1, v08
10 | Pair.add_second p1, v02
11 |
12 |
13 | Pair.swap p1
14 | Pair.print p1
15 | stl.output '\n'
16 | stl.loop
17 |
18 |
19 | p1: bit.vec Pair.size
20 | p2: bit.vec Pair.size
21 |
22 | v08: .bit.vec w, 0x08
23 | v02: bit.vec w, 0x02
24 |
--------------------------------------------------------------------------------
/programs/print_tests/cat.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | start:
3 | bit.input ascii
4 | bit.if0 8, ascii, end
5 | bit.cmp 8, ascii, nl, final_check, end, final_check
6 | final_check:
7 | bit.cmp 8, ascii, cr, print, end, print
8 | print:
9 | bit.print ascii
10 | ;start
11 | end:
12 | stl.loop
13 |
14 |
15 | ascii:
16 | bit.vec 8, 0
17 | nl:
18 | bit.vec 8, '\n'
19 | cr:
20 | bit.vec 8, '\r'
21 |
--------------------------------------------------------------------------------
/programs/print_tests/hello_no-stl.fj:
--------------------------------------------------------------------------------
1 | def startup @ code_start > IO {
2 | ;code_start
3 | IO:
4 | ;0
5 | code_start:
6 | }
7 |
8 |
9 | def output_bit bit < IO {
10 | IO + bit;
11 | }
12 | def output ascii {
13 | rep(8, i) output_bit ((ascii>>i)&1)
14 | }
15 |
16 | def end_loop @ loop_label {
17 | loop_label:
18 | ;loop_label
19 | }
20 |
21 | startup
22 |
23 | output 'H'
24 | output 'e'
25 | output 'l'
26 | output 'l'
27 | output 'o'
28 | output ','
29 | output ' '
30 | output 'W'
31 | output 'o'
32 | output 'r'
33 | output 'l'
34 | output 'd'
35 | output '!'
36 |
37 | end_loop
38 |
--------------------------------------------------------------------------------
/programs/print_tests/hello_world.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | stl.output "Hello, World!\n(:"
3 | stl.loop
4 |
--------------------------------------------------------------------------------
/programs/print_tests/hello_world_with_str.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | bit.print_str 20, str
4 | stl.loop
5 |
6 | str:
7 | bit.str "Hello, World!\n(:"
8 |
--------------------------------------------------------------------------------
/programs/print_tests/hexprint.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | bit.add 4, a, b
3 | bit.hex2ascii c, a
4 | bit.print c
5 | stl.loop
6 |
7 | a:
8 | bit.vec 4, 0x5
9 | b:
10 | bit.vec 4, 0x7
11 | c:
12 | bit.vec 8
13 |
--------------------------------------------------------------------------------
/programs/print_tests/ncat.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | start:
3 | bit.input ascii
4 | bit.if0 8, ascii, end
5 | bit.cmp 8, ascii, nl, final_check, end, final_check
6 | final_check:
7 | bit.cmp 8, ascii, cr, print, end, print
8 | print:
9 | bit.not 8, ascii
10 | bit.print ascii
11 | ;start
12 | end:
13 | stl.loop
14 |
15 | ascii:
16 | bit.vec 8
17 | nl:
18 | bit.vec 8, '\n'
19 | cr:
20 | bit.vec 8, '\r'
21 |
--------------------------------------------------------------------------------
/programs/print_tests/print_as_digit.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | bit.print_as_digit b0
4 | bit.print_as_digit b1
5 | stl.output '\n'
6 |
7 | rep(16, i) hex.print_as_digit h+i*dw, 0
8 | stl.output '\n'
9 | rep(16, i) hex.print_as_digit h+i*dw, 1
10 | stl.output '\n'
11 |
12 | stl.loop
13 |
14 | b0: bit.bit 0
15 | b1: bit.bit 1
16 | h: rep(16, i) hex.hex i
17 |
--------------------------------------------------------------------------------
/programs/print_tests/print_dec.fj:
--------------------------------------------------------------------------------
1 | // This program prints the numbers v1,v2,v3 in decimal form, each in its own line.
2 |
3 | stl.startup
4 |
5 | print_int v1
6 | print_int v2
7 | print_int v3
8 | stl.loop
9 |
10 |
11 | v1: bit.vec w, 123456
12 | v2: bit.vec w, 0
13 | v3: bit.vec w, 0-123456
14 | ret_reg: 0;0
15 |
16 | def print_int v < ret_reg, val, print_int {
17 | bit.mov w, val, v
18 | stl.fcall print_int, ret_reg
19 | }
20 |
21 | print_int:
22 | bit.print_dec_int w, val
23 | stl.output '\n'
24 | stl.fret ret_reg
25 | val: bit.vec w
26 |
--------------------------------------------------------------------------------
/programs/print_tests/print_hex_int.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | bit.print_hex_int w, a, 1
4 | stl.loop
5 |
6 | a:
7 | bit.vec w, 0-0xabcdef
8 |
--------------------------------------------------------------------------------
/programs/sanity_checks/mathbit.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | bit.inc1 x, carry
3 | stl.loop
4 |
5 | x:
6 | bit.bit 0
7 | carry:
8 | bit.bit 1
9 |
--------------------------------------------------------------------------------
/programs/sanity_checks/mathvec.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | bit.inc 2, x
3 | stl.loop
4 |
5 | x:
6 | bit.vec 2, 0
7 |
--------------------------------------------------------------------------------
/programs/sanity_checks/not.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | bit.not x
3 | stl.loop
4 |
5 | x:
6 | bit.bit 0
7 |
--------------------------------------------------------------------------------
/programs/sanity_checks/rep.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | rep(7, i) bit.exact_not x+i+i
3 | stl.loop
4 |
5 | x:
6 | bit.bit 0
7 |
--------------------------------------------------------------------------------
/programs/sanity_checks/simple.fj:
--------------------------------------------------------------------------------
1 | stl.skip
2 | ns stl {
3 | IO:
4 | }
5 | ;
6 | bit.not x
7 | stl.output '0'+#0b111
8 | stl.loop
9 |
10 | x:
11 | bit.bit 0
12 |
--------------------------------------------------------------------------------
/programs/sanity_checks/startup_init_all.fj:
--------------------------------------------------------------------------------
1 | stl.startup_and_init_all
2 | N = 4
3 |
4 | hex.sub N, a, b
5 |
6 | hex.print_uint N, a, 1, 1
7 | stl.output "\n"
8 |
9 | flip_and_print
10 | flip_and_print
11 | flip_and_print
12 | flip_and_print
13 | stl.output "\n"
14 |
15 | stl.loop
16 |
17 | a: hex.vec N, 0xE973
18 | b: hex.vec N, 0xDEAD
19 |
20 | p: bit.vec w, d+dbit
21 | d: bit.bit 0 // 0 => 1
22 |
23 | def flip_and_print @ d0, d1, end < p, d {
24 | bit.ptr_flip p
25 | bit.if d, d0, d1
26 | d0:
27 | stl.output "0"
28 | ;end
29 | d1:
30 | stl.output "1"
31 | ;end
32 | end:
33 | }
34 |
35 |
36 |
--------------------------------------------------------------------------------
/programs/sanity_checks/testbit.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | bit.if x, l0, l1
3 |
4 | l0:
5 | stl.output 6 ? 'Z' : '0'
6 | stl.loop
7 | l1:
8 | stl.output '1'
9 | stl.loop
10 |
11 | x:
12 | bit.bit 0 // bit0 => 'Z', bit1 => '1'
13 |
--------------------------------------------------------------------------------
/programs/sanity_checks/testbit_with_nops.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | rep(10, i) bit.mov y, z
4 | bit.mov x, x
5 | bit.if x, l0, l1
6 |
7 | l0:
8 | stl.output 0x5A // 'Z'
9 | ;loop
10 | l1:
11 | stl.output 0x10*3+1*3-4/2 // '1'
12 | ;
13 | ;loop
14 | loop:
15 | ;
16 |
17 | stl.loop
18 | pad 2
19 | wflip l1, loop
20 |
21 | dloop:
22 | ;dloop
23 | bit.vec 8, 3
24 | bananas:
25 | stl.output 0x5c
26 | dy=3
27 |
28 | n=15
29 | rep(8, q) bit.if x, l0, l1
30 | bans2:
31 |
32 | rep(n, j) temp_macro x, x
33 |
34 | def temp_macro g, y {
35 | bit.not g
36 | bit.not y
37 | }
38 |
39 | x:
40 | bit.bit 1 // bit0 => 'Z', bit1 => '1'
41 | y:
42 | bit.bit 1
43 | z:
44 | bit.bit 1
45 |
46 |
--------------------------------------------------------------------------------
/programs/simple_math_checks/bit_div.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | test_generic_div 20, 12, 1, 8, div
4 | test_generic_div 20, 12, 1, 8, div_loop
5 |
6 | test_generic_div 20, 12, 1, 8, idiv
7 | test_generic_div 20, (0-12), (0-1), 8, idiv
8 | test_generic_div (0-20), 12, (0-1), (0-8), idiv
9 | test_generic_div (0-20), (0-12), 1, (0-8), idiv
10 |
11 | test_generic_div 20, 12, 1, 8, idiv_loop
12 | test_generic_div 20, (0-12), (0-1), 8, idiv_loop
13 | test_generic_div (0-20), 12, (0-1), (0-8), idiv_loop
14 | test_generic_div (0-20), (0-12), 1, (0-8), idiv_loop
15 |
16 |
17 | stl.loop
18 |
19 |
20 | div:
21 | bit.div 8, ah, bh, res, mod
22 | stl.fret ret
23 |
24 | div_loop:
25 | bit.div_loop 8, ah, bh, res, mod
26 | stl.fret ret
27 |
28 | idiv:
29 | bit.idiv 8, ah, bh, res, mod
30 | stl.fret ret
31 |
32 | idiv_loop:
33 | bit.idiv_loop 8, ah, bh, res, mod
34 | stl.fret ret
35 |
36 |
37 | res: bit.vec 8
38 | mod: bit.vec 8
39 | ah: bit.vec 8
40 | bh: bit.vec 8
41 | ret: 0;0
42 |
43 | div0:
44 | stl.output "0"
45 | stl.fret ret
46 |
47 | def test_generic_div a, b, expected_res, expected_mod, idiv_label\
48 | @ res_bad, res_good, mod_bad, mod_good, check_mod, expected_res_var, expected_mod_var, a_var, b_var, end\
49 | < ah, bh, ret, res, mod {
50 | bit.mov 8, ah, a_var
51 | bit.mov 8, bh, b_var
52 | stl.fcall idiv_label, ret
53 |
54 | bit.cmp 8, res, expected_res_var, res_bad, res_good, res_bad
55 | res_good:
56 | stl.output '='
57 | ;check_mod
58 | res_bad:
59 | stl.output '!'
60 | ;check_mod
61 |
62 | check_mod:
63 | bit.cmp 8, mod, expected_mod_var, mod_bad, mod_good, mod_bad
64 |
65 | mod_good:
66 | stl.output '='
67 | ;end
68 | mod_bad:
69 | stl.output '!'
70 | ;end
71 |
72 | expected_res_var:
73 | bit.vec 8, expected_res
74 | expected_mod_var:
75 | bit.vec 8, expected_mod
76 | a_var:
77 | bit.vec 8, a
78 | b_var:
79 | bit.vec 8, b
80 |
81 | end:
82 | stl.output '\n'
83 | }
84 |
--------------------------------------------------------------------------------
/programs/simple_math_checks/div10.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | loop:
4 | bit.print_hex_uint w, var, 1
5 | stl.output ','
6 | bit.div10 w, dst, var
7 | bit.dec2ascii ascii, var
8 | bit.print ascii
9 | stl.output '\n'
10 | bit.mov w, var, dst
11 | bit.if1 w, var, loop
12 |
13 | stl.loop
14 |
15 |
16 | var: bit.vec w, 1281 // (128, 12, 1)
17 | dst: bit.vec w
18 | ascii: bit.vec 8
19 |
--------------------------------------------------------------------------------
/programs/simple_math_checks/nadd.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 | bit.add 8, a, b
3 | bit.print a
4 | stl.loop
5 |
6 | a:
7 | bit.vec 8, '5'
8 | b:
9 | bit.vec 8, 0x02
10 |
--------------------------------------------------------------------------------
/programs/simple_math_checks/ncmp.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 |
4 | n=4
5 | bit.cmp n, a, b, lt, eq, gt
6 |
7 | lt:
8 | stl.output '<'
9 | stl.loop
10 | eq:
11 | stl.output '='
12 | stl.loop
13 | gt:
14 | stl.output '>'
15 | stl.loop
16 |
17 | a:
18 | bit.vec n, 3
19 | b:
20 | bit.vec n, 1
21 |
--------------------------------------------------------------------------------
/programs/simple_math_checks/series_sum.fj:
--------------------------------------------------------------------------------
1 | N = 8 // 32bits
2 |
3 | stl.startup
4 |
5 | // starting printings:
6 | stl.output "params: a1 = "
7 | print_hex_as_decimal a1
8 | stl.output ", d = "
9 | print_hex_as_decimal d
10 | stl.output ", n = "
11 | print_hex_as_decimal n
12 | stl.output ".\n\n"
13 |
14 |
15 | hex.mov N, n_1, n
16 | hex.dec N, n_1 // n_1 = n-1
17 | hex.mul N, an, n_1, d // an = d(n-1)
18 | hex.add N, an, a1 // an = a1 + d(n-1)
19 |
20 | // print an
21 | stl.output "an = "
22 | print_hex_as_decimal an
23 | stl.output ".\n"
24 |
25 | hex.add N, an, a1 // a1 + an
26 | hex.mul N, s, an, n // s = (a1+an) * n
27 | hex.shr_bit N, s // s = (a1+an) * n/2
28 |
29 | // print sum
30 | stl.output "Sum(a1, a2, ..., an) = "
31 | print_hex_as_decimal s
32 | stl.output ".\n"
33 |
34 | stl.loop
35 | hex.init // inits the hex.mul
36 |
37 |
38 | def print_hex_as_decimal hexxx < num, ret, print_num {
39 | stl.hex2bit N, num, hexxx
40 | stl.fcall print_num, ret
41 | }
42 |
43 | print_num:
44 | bit.print_dec_int N*4, num
45 | ;ret
46 | num: bit.vec N*4
47 | ret: bit.bit
48 |
49 |
50 | // inputs and variables:
51 | a1: hex.vec 8, 1
52 | d: hex.vec 8, 3
53 | n: hex.vec 8, 12
54 |
55 | an: hex.vec 8
56 | s: hex.vec 8
57 |
58 | n_1: hex.vec N
59 |
--------------------------------------------------------------------------------
/programs/simple_math_checks/shra.fj:
--------------------------------------------------------------------------------
1 | stl.startup
2 |
3 | SHRA_BIT_NUM = 0xe71e3e4a716549fb31fc565d0dbb2f96c846c32ee4018325d1cd59436959489e67e9c48d3c4861da188988ead4f9fefab18e0c51c22c7241405f456ff95023b9cec204245f9bc9285cdead281e5aef9458296a4036cdb03ffcece333cb5c2d05fd66ddf091b82de8e16bc08b648ab018a3f05a1d812f94223419680ea44e0b11121da44b5bdf7f55a1346ea0d69a244177005a266bfb233372c7e12a8b6f76a39c1364624820a19d395f224d19d91fb6f535c8d485420d4c6520065687092d730d5257944ce12a5e
4 | rep(25, i) test_shra 32, (SHRA_BIT_NUM>>(37*i))&((1<<32)-1), (SHRA_BIT_NUM>>(37*i + 32))&((1<<5)-1)
5 |
6 | stl.loop
7 |
8 |
9 | hex.init
10 |
11 | def test_shra n, x, shift @ lt, eq, gt, xh, ch, end {
12 | bit.shra n, shift, xh
13 | bit.cmp n, xh, ch, lt, eq, gt
14 |
15 | lt:
16 | stl.output '<'
17 | ;end
18 | eq:
19 | stl.output '='
20 | ;end
21 | gt:
22 | stl.output '>'
23 | ;end
24 |
25 | xh: bit.vec n, x
26 | ch: bit.vec n, x&(1<<(n-1)) ? ((x>>shift)&((1<>shift)&((1<"]
11 | license = "BSD-2-Clause-Simplified"
12 | readme = "README.md"
13 |
14 | include = [
15 | { path = "flipjump/stl", format = "sdist" }
16 | ]
17 |
18 | homepage = "https://esolangs.org/wiki/FlipJump"
19 | repository = "https://github.com/tomhea/flip-jump"
20 | documentation = "https://github.com/tomhea/flip-jump/wiki"
21 |
22 | keywords = ["esolang", "oisc", "assembly"]
23 | classifiers = [
24 | "Topic :: Education",
25 | "Topic :: Software Development :: Assemblers",
26 | "Topic :: Software Development :: Compilers",
27 | "Topic :: Software Development :: Debuggers",
28 | "Topic :: Software Development :: Interpreters",
29 | "Topic :: Software Development :: Libraries",
30 | "Operating System :: OS Independent",
31 | "Programming Language :: Python :: 3.8",
32 | "Programming Language :: Python :: 3.9",
33 | "Programming Language :: Python :: 3.10",
34 | "Programming Language :: Python :: 3.11",
35 | "Programming Language :: Python :: 3.12",
36 | "Programming Language :: Python :: 3.13",
37 | "Programming Language :: Other",
38 | "Intended Audience :: Developers",
39 | "Intended Audience :: Education",
40 | "Intended Audience :: Science/Research",
41 | ]
42 |
43 |
44 | [tool.poetry.dependencies]
45 | python = "^3.8.1"
46 | sly = "^0.4"
47 | easygui = "^0.98.3"
48 |
49 | # statistics
50 | plotly = { version = "^5.16.1", optional = true }
51 | # developement
52 | pytest = { version = "^7.4.0", optional = true }
53 | pytest-ordering = { version = "^0.6", optional = true }
54 | pytest-xdist = { version = "^3.3.1", optional = true }
55 | mypy = { version = "^1.7.1", optional = true }
56 | flake8 = { version = "^6.1.0", optional = true }
57 | tox = { version = "^4.11.4", optional = true }
58 | bandit = { version = "^1.7.6", optional = true }
59 | black = { version = "^24.8.0", optional = true }
60 |
61 | [tool.poetry.extras]
62 | tests = [
63 | "pytest", "pytest-ordering", "pytest-xdist",
64 | "mypy", "flake8", "tox", "bandit", "black"
65 | ]
66 | stats = ["plotly"]
67 | #docs = [sphinx, sphinx_rtd_theme]
68 |
69 | [tool.poetry.scripts]
70 | fj = 'flipjump.flipjump_cli:main'
71 |
72 |
73 | [tool.mypy]
74 | files = ["flipjump", "tests"]
75 | strict = true
76 | disable_error_code = ["import-untyped"]
77 |
78 | [[tool.mypy.overrides]]
79 | module = "flipjump.assembler.fj_parser"
80 | disable_error_code = ["name-defined", "no-redef", "index", "no-any-return", "misc"]
81 |
82 |
83 | [tool.black]
84 | line-length = 120
85 | target-version = ["py38", "py39", "py310", "py311", "py312", "py313"]
86 | safe = true
87 | skip-string-normalization = true
88 |
--------------------------------------------------------------------------------
/resources/breakpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/breakpoint.png
--------------------------------------------------------------------------------
/resources/calc__asm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/calc__asm.png
--------------------------------------------------------------------------------
/resources/calc__run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/calc__run.png
--------------------------------------------------------------------------------
/resources/calc_stats.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/calc_stats.png
--------------------------------------------------------------------------------
/resources/debug_read_memory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/debug_read_memory.png
--------------------------------------------------------------------------------
/resources/debug_read_memory_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/debug_read_memory_result.png
--------------------------------------------------------------------------------
/resources/hello.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/hello.gif
--------------------------------------------------------------------------------
/resources/prime_sieve.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/prime_sieve.gif
--------------------------------------------------------------------------------
/resources/pytest.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/pytest.gif
--------------------------------------------------------------------------------
/resources/test_parallel.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/resources/test_parallel.gif
--------------------------------------------------------------------------------
/test_parallel:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # This script executes the flipjump tests in parallel; first compiles the program, and then runs them.
3 | # - Each phase is parallelized with the optimal number of threads.
4 | # - Each phase is called with the given command-line arguments/flags.
5 |
6 | pytest --compile -n auto "$@"
7 | pytest --run -n auto "$@"
8 |
--------------------------------------------------------------------------------
/test_parallel.bat:
--------------------------------------------------------------------------------
1 | :: This script executes the flipjump tests in parallel; first compiles the program, and then runs them.
2 | :: - Each phase is parallelized with the optimal number of threads.
3 | :: - Each phase is called with the given command-line arguments/flags.
4 |
5 | pytest --compile -n auto %*
6 | pytest --run -n auto %*
7 |
--------------------------------------------------------------------------------
/tests/.gitignore:
--------------------------------------------------------------------------------
1 | /compiled/
2 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 |
4 | pytest.register_assert_rewrite("flipjump.flipjump_quickstart")
5 |
--------------------------------------------------------------------------------
/tests/conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "default_type": "fast",
3 | "regular_speed_ordered": [
4 | "fast",
5 | "medium"
6 | ],
7 | "all_speed_ordered": [
8 | "fast",
9 | "medium",
10 | "hexlib",
11 | "slow"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc1.in:
--------------------------------------------------------------------------------
1 | 111111111*111111111
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc1.out:
--------------------------------------------------------------------------------
1 | > 12345678987654321
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc10.in:
--------------------------------------------------------------------------------
1 | -15%4
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc10.out:
--------------------------------------------------------------------------------
1 | > -3
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc2.in:
--------------------------------------------------------------------------------
1 | xd0a0c0d0 + x0e0d000e
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc2.out:
--------------------------------------------------------------------------------
1 | > 0xDEADC0DE
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc3.in:
--------------------------------------------------------------------------------
1 | 23456-765
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc3.out:
--------------------------------------------------------------------------------
1 | > 22691
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc4.in:
--------------------------------------------------------------------------------
1 | X777+x34
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc4.out:
--------------------------------------------------------------------------------
1 | > 0x7AB
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc5.in:
--------------------------------------------------------------------------------
1 | x1000+128
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc5.out:
--------------------------------------------------------------------------------
1 | > 0x1080
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc6.in:
--------------------------------------------------------------------------------
1 | 2073600/1080
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc6.out:
--------------------------------------------------------------------------------
1 | > 1920
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc7.in:
--------------------------------------------------------------------------------
1 | 23-100
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc7.out:
--------------------------------------------------------------------------------
1 | > -77
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc8.in:
--------------------------------------------------------------------------------
1 | 34%7
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc8.out:
--------------------------------------------------------------------------------
1 | > 6
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc9.in:
--------------------------------------------------------------------------------
1 | -15/4
2 | q
3 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc9.out:
--------------------------------------------------------------------------------
1 | > -3
2 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc_empty.in:
--------------------------------------------------------------------------------
1 | q
2 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc_empty.out:
--------------------------------------------------------------------------------
1 | >
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc_many.in:
--------------------------------------------------------------------------------
1 | 1
2 | 2
3 | -6
4 | 5 + 7
5 | 1 - 2
6 |
7 | 13+2
8 |
9 |
10 | 7
11 | 0
12 | -2+2
13 | -2-2
14 |
15 |
16 | g
17 | 0x
18 | q 8
19 | q q
20 | q klewfkew
21 | x9
22 | xbabe
23 | q
24 |
--------------------------------------------------------------------------------
/tests/inout/calc_tests/calc_many.out:
--------------------------------------------------------------------------------
1 | > 1
2 | > 2
3 | > -6
4 | > 12
5 | > -1
6 | > > 15
7 | > > > 7
8 | > 0
9 | > 0
10 | > -4
11 | > > > Error!
12 | > Error!
13 | > Error!
14 | > Error!
15 | > Error!
16 | > 0x9
17 | > 0xBABE
18 | >
--------------------------------------------------------------------------------
/tests/inout/concept_checks/bit_ptr.out:
--------------------------------------------------------------------------------
1 | 17NT
--------------------------------------------------------------------------------
/tests/inout/concept_checks/casting.out:
--------------------------------------------------------------------------------
1 | 01
2 | 123
3 |
4 | 0000123456
5 | 123456
6 | 0000000000000000000100100011010001010110
7 |
--------------------------------------------------------------------------------
/tests/inout/concept_checks/hex_ptr.out:
--------------------------------------------------------------------------------
1 | 17NB
--------------------------------------------------------------------------------
/tests/inout/concept_checks/segments.in:
--------------------------------------------------------------------------------
1 | 8421
--------------------------------------------------------------------------------
/tests/inout/concept_checks/segments.out:
--------------------------------------------------------------------------------
1 | Hi!
2 | 0x2490
3 | Bye!
4 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func1.out:
--------------------------------------------------------------------------------
1 | ABC
2 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func2.out:
--------------------------------------------------------------------------------
1 | AB~CD~EF
2 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func3.out:
--------------------------------------------------------------------------------
1 | ABCDE
2 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func4.out:
--------------------------------------------------------------------------------
1 | ABCDEFGH-1
2 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func5.out:
--------------------------------------------------------------------------------
1 | ABC abcdefg ABCD-0
2 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func6.out:
--------------------------------------------------------------------------------
1 | 26EA
2 |
--------------------------------------------------------------------------------
/tests/inout/func_tests/func7.out:
--------------------------------------------------------------------------------
1 | ABCDa-123-b-123456-cd
2 | Ea-123-b-123456-cd
3 | F-123-GHIJ
4 | dist[p1, p2] ** 2 = 0x3EDA
5 |
6 | ABCDa-123-b-123456-cd
7 | Ea-123-b-123456-cd
8 | F-123-GHIJ
9 | dist[p1, p3] ** 2 = 0x2C95
10 |
11 | ABCDa-123-b-123456-cd
12 | Ea-123-b-123456-cd
13 | F-123-GHIJ
14 | dist[p2, p3] ** 2 = 0x3C79
15 |
16 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/100equals.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 | =
52 | =
53 | =
54 | =
55 | =
56 | =
57 | =
58 | =
59 | =
60 | =
61 | =
62 | =
63 | =
64 | =
65 | =
66 | =
67 | =
68 | =
69 | =
70 | =
71 | =
72 | =
73 | =
74 | =
75 | =
76 | =
77 | =
78 | =
79 | =
80 | =
81 | =
82 | =
83 | =
84 | =
85 | =
86 | =
87 | =
88 | =
89 | =
90 | =
91 | =
92 | =
93 | =
94 | =
95 | =
96 | =
97 | =
98 | =
99 | =
100 | =
101 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/108equals.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 | =
52 | =
53 | =
54 | =
55 | =
56 | =
57 | =
58 | =
59 | =
60 | =
61 | =
62 | =
63 | =
64 | =
65 | =
66 | =
67 | =
68 | =
69 | =
70 | =
71 | =
72 | =
73 | =
74 | =
75 | =
76 | =
77 | =
78 | =
79 | =
80 | =
81 | =
82 | =
83 | =
84 | =
85 | =
86 | =
87 | =
88 | =
89 | =
90 | =
91 | =
92 | =
93 | =
94 | =
95 | =
96 | =
97 | =
98 | =
99 | =
100 | =
101 | =
102 | =
103 | =
104 | =
105 | =
106 | =
107 | =
108 | =
109 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/add.out:
--------------------------------------------------------------------------------
1 | 00-01
2 | 01-02
3 | 02-03
4 | 03-04
5 | 04-05
6 | 05-06
7 | 06-07
8 | 07-08
9 | 08-09
10 | 09-0a
11 | 0a-0b
12 | 0b-0c
13 | 0c-0d
14 | 0d-0e
15 | 0e-0f
16 | 0f-10
17 | 01-02
18 | 02-03
19 | 03-04
20 | 04-05
21 | 05-06
22 | 06-07
23 | 07-08
24 | 08-09
25 | 09-0a
26 | 0a-0b
27 | 0b-0c
28 | 0c-0d
29 | 0d-0e
30 | 0e-0f
31 | 0f-10
32 | 10-11
33 | 02-03
34 | 03-04
35 | 04-05
36 | 05-06
37 | 06-07
38 | 07-08
39 | 08-09
40 | 09-0a
41 | 0a-0b
42 | 0b-0c
43 | 0c-0d
44 | 0d-0e
45 | 0e-0f
46 | 0f-10
47 | 10-11
48 | 11-12
49 | 03-04
50 | 04-05
51 | 05-06
52 | 06-07
53 | 07-08
54 | 08-09
55 | 09-0a
56 | 0a-0b
57 | 0b-0c
58 | 0c-0d
59 | 0d-0e
60 | 0e-0f
61 | 0f-10
62 | 10-11
63 | 11-12
64 | 12-13
65 | 04-05
66 | 05-06
67 | 06-07
68 | 07-08
69 | 08-09
70 | 09-0a
71 | 0a-0b
72 | 0b-0c
73 | 0c-0d
74 | 0d-0e
75 | 0e-0f
76 | 0f-10
77 | 10-11
78 | 11-12
79 | 12-13
80 | 13-14
81 | 05-06
82 | 06-07
83 | 07-08
84 | 08-09
85 | 09-0a
86 | 0a-0b
87 | 0b-0c
88 | 0c-0d
89 | 0d-0e
90 | 0e-0f
91 | 0f-10
92 | 10-11
93 | 11-12
94 | 12-13
95 | 13-14
96 | 14-15
97 | 06-07
98 | 07-08
99 | 08-09
100 | 09-0a
101 | 0a-0b
102 | 0b-0c
103 | 0c-0d
104 | 0d-0e
105 | 0e-0f
106 | 0f-10
107 | 10-11
108 | 11-12
109 | 12-13
110 | 13-14
111 | 14-15
112 | 15-16
113 | 07-08
114 | 08-09
115 | 09-0a
116 | 0a-0b
117 | 0b-0c
118 | 0c-0d
119 | 0d-0e
120 | 0e-0f
121 | 0f-10
122 | 10-11
123 | 11-12
124 | 12-13
125 | 13-14
126 | 14-15
127 | 15-16
128 | 16-17
129 | 08-09
130 | 09-0a
131 | 0a-0b
132 | 0b-0c
133 | 0c-0d
134 | 0d-0e
135 | 0e-0f
136 | 0f-10
137 | 10-11
138 | 11-12
139 | 12-13
140 | 13-14
141 | 14-15
142 | 15-16
143 | 16-17
144 | 17-18
145 | 09-0a
146 | 0a-0b
147 | 0b-0c
148 | 0c-0d
149 | 0d-0e
150 | 0e-0f
151 | 0f-10
152 | 10-11
153 | 11-12
154 | 12-13
155 | 13-14
156 | 14-15
157 | 15-16
158 | 16-17
159 | 17-18
160 | 18-19
161 | 0a-0b
162 | 0b-0c
163 | 0c-0d
164 | 0d-0e
165 | 0e-0f
166 | 0f-10
167 | 10-11
168 | 11-12
169 | 12-13
170 | 13-14
171 | 14-15
172 | 15-16
173 | 16-17
174 | 17-18
175 | 18-19
176 | 19-1a
177 | 0b-0c
178 | 0c-0d
179 | 0d-0e
180 | 0e-0f
181 | 0f-10
182 | 10-11
183 | 11-12
184 | 12-13
185 | 13-14
186 | 14-15
187 | 15-16
188 | 16-17
189 | 17-18
190 | 18-19
191 | 19-1a
192 | 1a-1b
193 | 0c-0d
194 | 0d-0e
195 | 0e-0f
196 | 0f-10
197 | 10-11
198 | 11-12
199 | 12-13
200 | 13-14
201 | 14-15
202 | 15-16
203 | 16-17
204 | 17-18
205 | 18-19
206 | 19-1a
207 | 1a-1b
208 | 1b-1c
209 | 0d-0e
210 | 0e-0f
211 | 0f-10
212 | 10-11
213 | 11-12
214 | 12-13
215 | 13-14
216 | 14-15
217 | 15-16
218 | 16-17
219 | 17-18
220 | 18-19
221 | 19-1a
222 | 1a-1b
223 | 1b-1c
224 | 1c-1d
225 | 0e-0f
226 | 0f-10
227 | 10-11
228 | 11-12
229 | 12-13
230 | 13-14
231 | 14-15
232 | 15-16
233 | 16-17
234 | 17-18
235 | 18-19
236 | 19-1a
237 | 1a-1b
238 | 1b-1c
239 | 1c-1d
240 | 1d-1e
241 | 0f-10
242 | 10-11
243 | 11-12
244 | 12-13
245 | 13-14
246 | 14-15
247 | 15-16
248 | 16-17
249 | 17-18
250 | 18-19
251 | 19-1a
252 | 1a-1b
253 | 1b-1c
254 | 1c-1d
255 | 1d-1e
256 | 1e-1f
257 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/and.out:
--------------------------------------------------------------------------------
1 | 00
2 | 00
3 | 00
4 | 00
5 | 00
6 | 00
7 | 00
8 | 00
9 | 00
10 | 00
11 | 00
12 | 00
13 | 00
14 | 00
15 | 00
16 | 00
17 | 00
18 | 11
19 | 00
20 | 11
21 | 00
22 | 11
23 | 00
24 | 11
25 | 00
26 | 11
27 | 00
28 | 11
29 | 00
30 | 11
31 | 00
32 | 11
33 | 00
34 | 00
35 | 22
36 | 22
37 | 00
38 | 00
39 | 22
40 | 22
41 | 00
42 | 00
43 | 22
44 | 22
45 | 00
46 | 00
47 | 22
48 | 22
49 | 00
50 | 11
51 | 22
52 | 33
53 | 00
54 | 11
55 | 22
56 | 33
57 | 00
58 | 11
59 | 22
60 | 33
61 | 00
62 | 11
63 | 22
64 | 33
65 | 00
66 | 00
67 | 00
68 | 00
69 | 44
70 | 44
71 | 44
72 | 44
73 | 00
74 | 00
75 | 00
76 | 00
77 | 44
78 | 44
79 | 44
80 | 44
81 | 00
82 | 11
83 | 00
84 | 11
85 | 44
86 | 55
87 | 44
88 | 55
89 | 00
90 | 11
91 | 00
92 | 11
93 | 44
94 | 55
95 | 44
96 | 55
97 | 00
98 | 00
99 | 22
100 | 22
101 | 44
102 | 44
103 | 66
104 | 66
105 | 00
106 | 00
107 | 22
108 | 22
109 | 44
110 | 44
111 | 66
112 | 66
113 | 00
114 | 11
115 | 22
116 | 33
117 | 44
118 | 55
119 | 66
120 | 77
121 | 00
122 | 11
123 | 22
124 | 33
125 | 44
126 | 55
127 | 66
128 | 77
129 | 00
130 | 00
131 | 00
132 | 00
133 | 00
134 | 00
135 | 00
136 | 00
137 | 88
138 | 88
139 | 88
140 | 88
141 | 88
142 | 88
143 | 88
144 | 88
145 | 00
146 | 11
147 | 00
148 | 11
149 | 00
150 | 11
151 | 00
152 | 11
153 | 88
154 | 99
155 | 88
156 | 99
157 | 88
158 | 99
159 | 88
160 | 99
161 | 00
162 | 00
163 | 22
164 | 22
165 | 00
166 | 00
167 | 22
168 | 22
169 | 88
170 | 88
171 | aa
172 | aa
173 | 88
174 | 88
175 | aa
176 | aa
177 | 00
178 | 11
179 | 22
180 | 33
181 | 00
182 | 11
183 | 22
184 | 33
185 | 88
186 | 99
187 | aa
188 | bb
189 | 88
190 | 99
191 | aa
192 | bb
193 | 00
194 | 00
195 | 00
196 | 00
197 | 44
198 | 44
199 | 44
200 | 44
201 | 88
202 | 88
203 | 88
204 | 88
205 | cc
206 | cc
207 | cc
208 | cc
209 | 00
210 | 11
211 | 00
212 | 11
213 | 44
214 | 55
215 | 44
216 | 55
217 | 88
218 | 99
219 | 88
220 | 99
221 | cc
222 | dd
223 | cc
224 | dd
225 | 00
226 | 00
227 | 22
228 | 22
229 | 44
230 | 44
231 | 66
232 | 66
233 | 88
234 | 88
235 | aa
236 | aa
237 | cc
238 | cc
239 | ee
240 | ee
241 | 00
242 | 11
243 | 22
244 | 33
245 | 44
246 | 55
247 | 66
248 | 77
249 | 88
250 | 99
251 | aa
252 | bb
253 | cc
254 | dd
255 | ee
256 | ff
257 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/cmp.out:
--------------------------------------------------------------------------------
1 | =
2 | >
3 | >
4 | >
5 | >
6 | >
7 | >
8 | >
9 | >
10 | >
11 | >
12 | >
13 | >
14 | >
15 | >
16 | >
17 | <
18 | =
19 | >
20 | >
21 | >
22 | >
23 | >
24 | >
25 | >
26 | >
27 | >
28 | >
29 | >
30 | >
31 | >
32 | >
33 | <
34 | <
35 | =
36 | >
37 | >
38 | >
39 | >
40 | >
41 | >
42 | >
43 | >
44 | >
45 | >
46 | >
47 | >
48 | >
49 | <
50 | <
51 | <
52 | =
53 | >
54 | >
55 | >
56 | >
57 | >
58 | >
59 | >
60 | >
61 | >
62 | >
63 | >
64 | >
65 | <
66 | <
67 | <
68 | <
69 | =
70 | >
71 | >
72 | >
73 | >
74 | >
75 | >
76 | >
77 | >
78 | >
79 | >
80 | >
81 | <
82 | <
83 | <
84 | <
85 | <
86 | =
87 | >
88 | >
89 | >
90 | >
91 | >
92 | >
93 | >
94 | >
95 | >
96 | >
97 | <
98 | <
99 | <
100 | <
101 | <
102 | <
103 | =
104 | >
105 | >
106 | >
107 | >
108 | >
109 | >
110 | >
111 | >
112 | >
113 | <
114 | <
115 | <
116 | <
117 | <
118 | <
119 | <
120 | =
121 | >
122 | >
123 | >
124 | >
125 | >
126 | >
127 | >
128 | >
129 | <
130 | <
131 | <
132 | <
133 | <
134 | <
135 | <
136 | <
137 | =
138 | >
139 | >
140 | >
141 | >
142 | >
143 | >
144 | >
145 | <
146 | <
147 | <
148 | <
149 | <
150 | <
151 | <
152 | <
153 | <
154 | =
155 | >
156 | >
157 | >
158 | >
159 | >
160 | >
161 | <
162 | <
163 | <
164 | <
165 | <
166 | <
167 | <
168 | <
169 | <
170 | <
171 | =
172 | >
173 | >
174 | >
175 | >
176 | >
177 | <
178 | <
179 | <
180 | <
181 | <
182 | <
183 | <
184 | <
185 | <
186 | <
187 | <
188 | =
189 | >
190 | >
191 | >
192 | >
193 | <
194 | <
195 | <
196 | <
197 | <
198 | <
199 | <
200 | <
201 | <
202 | <
203 | <
204 | <
205 | =
206 | >
207 | >
208 | >
209 | <
210 | <
211 | <
212 | <
213 | <
214 | <
215 | <
216 | <
217 | <
218 | <
219 | <
220 | <
221 | <
222 | =
223 | >
224 | >
225 | <
226 | <
227 | <
228 | <
229 | <
230 | <
231 | <
232 | <
233 | <
234 | <
235 | <
236 | <
237 | <
238 | <
239 | =
240 | >
241 | <
242 | <
243 | <
244 | <
245 | <
246 | <
247 | <
248 | <
249 | <
250 | <
251 | <
252 | <
253 | <
254 | <
255 | <
256 | =
257 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/cmp_n.out:
--------------------------------------------------------------------------------
1 | =
2 | >
3 | >
4 | >
5 | <
6 | =
7 | >
8 | >
9 | <
10 | <
11 | =
12 | >
13 | <
14 | <
15 | <
16 | =
17 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/or.out:
--------------------------------------------------------------------------------
1 | 00
2 | 11
3 | 22
4 | 33
5 | 44
6 | 55
7 | 66
8 | 77
9 | 88
10 | 99
11 | aa
12 | bb
13 | cc
14 | dd
15 | ee
16 | ff
17 | 11
18 | 11
19 | 33
20 | 33
21 | 55
22 | 55
23 | 77
24 | 77
25 | 99
26 | 99
27 | bb
28 | bb
29 | dd
30 | dd
31 | ff
32 | ff
33 | 22
34 | 33
35 | 22
36 | 33
37 | 66
38 | 77
39 | 66
40 | 77
41 | aa
42 | bb
43 | aa
44 | bb
45 | ee
46 | ff
47 | ee
48 | ff
49 | 33
50 | 33
51 | 33
52 | 33
53 | 77
54 | 77
55 | 77
56 | 77
57 | bb
58 | bb
59 | bb
60 | bb
61 | ff
62 | ff
63 | ff
64 | ff
65 | 44
66 | 55
67 | 66
68 | 77
69 | 44
70 | 55
71 | 66
72 | 77
73 | cc
74 | dd
75 | ee
76 | ff
77 | cc
78 | dd
79 | ee
80 | ff
81 | 55
82 | 55
83 | 77
84 | 77
85 | 55
86 | 55
87 | 77
88 | 77
89 | dd
90 | dd
91 | ff
92 | ff
93 | dd
94 | dd
95 | ff
96 | ff
97 | 66
98 | 77
99 | 66
100 | 77
101 | 66
102 | 77
103 | 66
104 | 77
105 | ee
106 | ff
107 | ee
108 | ff
109 | ee
110 | ff
111 | ee
112 | ff
113 | 77
114 | 77
115 | 77
116 | 77
117 | 77
118 | 77
119 | 77
120 | 77
121 | ff
122 | ff
123 | ff
124 | ff
125 | ff
126 | ff
127 | ff
128 | ff
129 | 88
130 | 99
131 | aa
132 | bb
133 | cc
134 | dd
135 | ee
136 | ff
137 | 88
138 | 99
139 | aa
140 | bb
141 | cc
142 | dd
143 | ee
144 | ff
145 | 99
146 | 99
147 | bb
148 | bb
149 | dd
150 | dd
151 | ff
152 | ff
153 | 99
154 | 99
155 | bb
156 | bb
157 | dd
158 | dd
159 | ff
160 | ff
161 | aa
162 | bb
163 | aa
164 | bb
165 | ee
166 | ff
167 | ee
168 | ff
169 | aa
170 | bb
171 | aa
172 | bb
173 | ee
174 | ff
175 | ee
176 | ff
177 | bb
178 | bb
179 | bb
180 | bb
181 | ff
182 | ff
183 | ff
184 | ff
185 | bb
186 | bb
187 | bb
188 | bb
189 | ff
190 | ff
191 | ff
192 | ff
193 | cc
194 | dd
195 | ee
196 | ff
197 | cc
198 | dd
199 | ee
200 | ff
201 | cc
202 | dd
203 | ee
204 | ff
205 | cc
206 | dd
207 | ee
208 | ff
209 | dd
210 | dd
211 | ff
212 | ff
213 | dd
214 | dd
215 | ff
216 | ff
217 | dd
218 | dd
219 | ff
220 | ff
221 | dd
222 | dd
223 | ff
224 | ff
225 | ee
226 | ff
227 | ee
228 | ff
229 | ee
230 | ff
231 | ee
232 | ff
233 | ee
234 | ff
235 | ee
236 | ff
237 | ee
238 | ff
239 | ee
240 | ff
241 | ff
242 | ff
243 | ff
244 | ff
245 | ff
246 | ff
247 | ff
248 | ff
249 | ff
250 | ff
251 | ff
252 | ff
253 | ff
254 | ff
255 | ff
256 | ff
257 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/2params/sub.out:
--------------------------------------------------------------------------------
1 | 00-ff
2 | 01-00
3 | 02-01
4 | 03-02
5 | 04-03
6 | 05-04
7 | 06-05
8 | 07-06
9 | 08-07
10 | 09-08
11 | 0a-09
12 | 0b-0a
13 | 0c-0b
14 | 0d-0c
15 | 0e-0d
16 | 0f-0e
17 | ff-fe
18 | 00-ff
19 | 01-00
20 | 02-01
21 | 03-02
22 | 04-03
23 | 05-04
24 | 06-05
25 | 07-06
26 | 08-07
27 | 09-08
28 | 0a-09
29 | 0b-0a
30 | 0c-0b
31 | 0d-0c
32 | 0e-0d
33 | fe-fd
34 | ff-fe
35 | 00-ff
36 | 01-00
37 | 02-01
38 | 03-02
39 | 04-03
40 | 05-04
41 | 06-05
42 | 07-06
43 | 08-07
44 | 09-08
45 | 0a-09
46 | 0b-0a
47 | 0c-0b
48 | 0d-0c
49 | fd-fc
50 | fe-fd
51 | ff-fe
52 | 00-ff
53 | 01-00
54 | 02-01
55 | 03-02
56 | 04-03
57 | 05-04
58 | 06-05
59 | 07-06
60 | 08-07
61 | 09-08
62 | 0a-09
63 | 0b-0a
64 | 0c-0b
65 | fc-fb
66 | fd-fc
67 | fe-fd
68 | ff-fe
69 | 00-ff
70 | 01-00
71 | 02-01
72 | 03-02
73 | 04-03
74 | 05-04
75 | 06-05
76 | 07-06
77 | 08-07
78 | 09-08
79 | 0a-09
80 | 0b-0a
81 | fb-fa
82 | fc-fb
83 | fd-fc
84 | fe-fd
85 | ff-fe
86 | 00-ff
87 | 01-00
88 | 02-01
89 | 03-02
90 | 04-03
91 | 05-04
92 | 06-05
93 | 07-06
94 | 08-07
95 | 09-08
96 | 0a-09
97 | fa-f9
98 | fb-fa
99 | fc-fb
100 | fd-fc
101 | fe-fd
102 | ff-fe
103 | 00-ff
104 | 01-00
105 | 02-01
106 | 03-02
107 | 04-03
108 | 05-04
109 | 06-05
110 | 07-06
111 | 08-07
112 | 09-08
113 | f9-f8
114 | fa-f9
115 | fb-fa
116 | fc-fb
117 | fd-fc
118 | fe-fd
119 | ff-fe
120 | 00-ff
121 | 01-00
122 | 02-01
123 | 03-02
124 | 04-03
125 | 05-04
126 | 06-05
127 | 07-06
128 | 08-07
129 | f8-f7
130 | f9-f8
131 | fa-f9
132 | fb-fa
133 | fc-fb
134 | fd-fc
135 | fe-fd
136 | ff-fe
137 | 00-ff
138 | 01-00
139 | 02-01
140 | 03-02
141 | 04-03
142 | 05-04
143 | 06-05
144 | 07-06
145 | f7-f6
146 | f8-f7
147 | f9-f8
148 | fa-f9
149 | fb-fa
150 | fc-fb
151 | fd-fc
152 | fe-fd
153 | ff-fe
154 | 00-ff
155 | 01-00
156 | 02-01
157 | 03-02
158 | 04-03
159 | 05-04
160 | 06-05
161 | f6-f5
162 | f7-f6
163 | f8-f7
164 | f9-f8
165 | fa-f9
166 | fb-fa
167 | fc-fb
168 | fd-fc
169 | fe-fd
170 | ff-fe
171 | 00-ff
172 | 01-00
173 | 02-01
174 | 03-02
175 | 04-03
176 | 05-04
177 | f5-f4
178 | f6-f5
179 | f7-f6
180 | f8-f7
181 | f9-f8
182 | fa-f9
183 | fb-fa
184 | fc-fb
185 | fd-fc
186 | fe-fd
187 | ff-fe
188 | 00-ff
189 | 01-00
190 | 02-01
191 | 03-02
192 | 04-03
193 | f4-f3
194 | f5-f4
195 | f6-f5
196 | f7-f6
197 | f8-f7
198 | f9-f8
199 | fa-f9
200 | fb-fa
201 | fc-fb
202 | fd-fc
203 | fe-fd
204 | ff-fe
205 | 00-ff
206 | 01-00
207 | 02-01
208 | 03-02
209 | f3-f2
210 | f4-f3
211 | f5-f4
212 | f6-f5
213 | f7-f6
214 | f8-f7
215 | f9-f8
216 | fa-f9
217 | fb-fa
218 | fc-fb
219 | fd-fc
220 | fe-fd
221 | ff-fe
222 | 00-ff
223 | 01-00
224 | 02-01
225 | f2-f1
226 | f3-f2
227 | f4-f3
228 | f5-f4
229 | f6-f5
230 | f7-f6
231 | f8-f7
232 | f9-f8
233 | fa-f9
234 | fb-fa
235 | fc-fb
236 | fd-fc
237 | fe-fd
238 | ff-fe
239 | 00-ff
240 | 01-00
241 | f1-f0
242 | f2-f1
243 | f3-f2
244 | f4-f3
245 | f5-f4
246 | f6-f5
247 | f7-f6
248 | f8-f7
249 | f9-f8
250 | fa-f9
251 | fb-fa
252 | fc-fb
253 | fd-fc
254 | fe-fd
255 | ff-fe
256 | 00-ff
257 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/basic_math.out:
--------------------------------------------------------------------------------
1 | inc1:
2 | 1000000000000000
3 | 0fedcba987654321
4 |
5 | inc, not:
6 | 0000000000000001
7 | 0000000000000010
8 | ffffffffffffffff
9 | 0000000000000000
10 |
11 | dec1:
12 | 0000000000000001
13 | edcba9876543210f
14 |
15 | dec:
16 | 0000000000000001
17 | 0000000000000000
18 | ffffffffffffffff
19 | fffffffffffffffe
20 |
21 | neg:
22 | 0000000000000000
23 | ffffffffffffffd0
24 | 0000000000000030
25 |
26 | sign:
27 | ++++++++--------
28 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------
29 |
30 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/basic_memory.out:
--------------------------------------------------------------------------------
1 | xor:
2 | fedcba9876543210
3 | efcdab8967452301
4 | cdef89ab45670123
5 | fedcba9876543210
6 | ba98fedc32107654
7 | efcdab8967452301
8 | 89abcdef01234567
9 | fedcba9876543210
10 | 76543210fedcba98
11 | efcdab8967452301
12 | 45670123cdef89ab
13 | fedcba9876543210
14 | 32107654ba98fedc
15 | efcdab8967452301
16 | 0123456789abcdef
17 | fedcba9876543210
18 |
19 | zero:
20 | 0000000000000000
21 |
22 | xor n:
23 | fedcba9876543210
24 |
25 | xor_zero:
26 | 0000000000000000
27 | fedcba9876543210
28 |
29 | mov:
30 | fedcba9876543210
31 | fedcba9876543210
32 |
33 | set:
34 | 0123456789abcdef
35 | fedcba9876543210
36 |
37 | swap:
38 | fedcba9876543210
39 | 0123456789abcdef
40 |
41 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/if.out:
--------------------------------------------------------------------------------
1 | if_flags:
2 | 0111010110111111001101101100100100111000011101011000100100001100011010100100111100010000010000100110
3 |
4 | if:
5 | 000
6 | 111
7 | 111
8 | 111
9 |
10 | 000
11 | 111
12 | 111
13 | 111
14 |
15 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/input.in:
--------------------------------------------------------------------------------
1 | 0123456789:;<=>?
2 | 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno
3 | 0123456789:;<=>?
4 | Flip, Jump!
5 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/input.out:
--------------------------------------------------------------------------------
1 | input_hex:
2 | fedcba9876543210
3 | 0123456789XXXXXXXabcdefXXXXXXXXXXXXXXXXXXXXXXXXXXabcdefXXXXXXXXX
4 |
5 | input-print:
6 | 0123456789:;<=>?
7 | Flip, Jump!
8 |
9 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/print_as_digit.out:
--------------------------------------------------------------------------------
1 | fedcba9876543210
2 | FEDCBA9876543210
3 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics1/print_int.out:
--------------------------------------------------------------------------------
1 | print_uint:
2 | 0x12345af, 0x12345AF, 12345af, 12345AF
3 | 0xdeadc0de, 0xDEADC0DE, deadc0de, DEADC0DE
4 | 0x3, 0x3, 3, 3
5 | 0xf0, 0xF0, f0, F0
6 | 0x0, 0x0, 0, 0
7 |
8 | print_int:
9 | 0x12345af, 0x12345AF, 12345af, 12345AF
10 | 0xdeadc0de, 0xDEADC0DE, deadc0de, DEADC0DE
11 | 0x3, 0x3, 3, 3
12 | 0xf0, 0xF0, f0, F0
13 | 0x0, 0x0, 0, 0
14 | -0x12345af, -0x12345AF, -12345af, -12345AF
15 | -0xdeadc0de, -0xDEADC0DE, -deadc0de, -DEADC0DE
16 | -0x3, -0x3, -3, -3
17 | -0xf0, -0xF0, -f0, -F0
18 |
19 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics2/100equals.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 | =
52 | =
53 | =
54 | =
55 | =
56 | =
57 | =
58 | =
59 | =
60 | =
61 | =
62 | =
63 | =
64 | =
65 | =
66 | =
67 | =
68 | =
69 | =
70 | =
71 | =
72 | =
73 | =
74 | =
75 | =
76 | =
77 | =
78 | =
79 | =
80 | =
81 | =
82 | =
83 | =
84 | =
85 | =
86 | =
87 | =
88 | =
89 | =
90 | =
91 | =
92 | =
93 | =
94 | =
95 | =
96 | =
97 | =
98 | =
99 | =
100 | =
101 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics2/256equals.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 | =
52 | =
53 | =
54 | =
55 | =
56 | =
57 | =
58 | =
59 | =
60 | =
61 | =
62 | =
63 | =
64 | =
65 | =
66 | =
67 | =
68 | =
69 | =
70 | =
71 | =
72 | =
73 | =
74 | =
75 | =
76 | =
77 | =
78 | =
79 | =
80 | =
81 | =
82 | =
83 | =
84 | =
85 | =
86 | =
87 | =
88 | =
89 | =
90 | =
91 | =
92 | =
93 | =
94 | =
95 | =
96 | =
97 | =
98 | =
99 | =
100 | =
101 | =
102 | =
103 | =
104 | =
105 | =
106 | =
107 | =
108 | =
109 | =
110 | =
111 | =
112 | =
113 | =
114 | =
115 | =
116 | =
117 | =
118 | =
119 | =
120 | =
121 | =
122 | =
123 | =
124 | =
125 | =
126 | =
127 | =
128 | =
129 | =
130 | =
131 | =
132 | =
133 | =
134 | =
135 | =
136 | =
137 | =
138 | =
139 | =
140 | =
141 | =
142 | =
143 | =
144 | =
145 | =
146 | =
147 | =
148 | =
149 | =
150 | =
151 | =
152 | =
153 | =
154 | =
155 | =
156 | =
157 | =
158 | =
159 | =
160 | =
161 | =
162 | =
163 | =
164 | =
165 | =
166 | =
167 | =
168 | =
169 | =
170 | =
171 | =
172 | =
173 | =
174 | =
175 | =
176 | =
177 | =
178 | =
179 | =
180 | =
181 | =
182 | =
183 | =
184 | =
185 | =
186 | =
187 | =
188 | =
189 | =
190 | =
191 | =
192 | =
193 | =
194 | =
195 | =
196 | =
197 | =
198 | =
199 | =
200 | =
201 | =
202 | =
203 | =
204 | =
205 | =
206 | =
207 | =
208 | =
209 | =
210 | =
211 | =
212 | =
213 | =
214 | =
215 | =
216 | =
217 | =
218 | =
219 | =
220 | =
221 | =
222 | =
223 | =
224 | =
225 | =
226 | =
227 | =
228 | =
229 | =
230 | =
231 | =
232 | =
233 | =
234 | =
235 | =
236 | =
237 | =
238 | =
239 | =
240 | =
241 | =
242 | =
243 | =
244 | =
245 | =
246 | =
247 | =
248 | =
249 | =
250 | =
251 | =
252 | =
253 | =
254 | =
255 | =
256 | =
257 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics2/25equals.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/basics2/hexlib-basics2.out:
--------------------------------------------------------------------------------
1 | shl_bit:
2 | ================================================================================================================================================================================================================================================================
3 | ====================================================================================================
4 |
5 | shr_bit:
6 | ================================================================================================================================================================================================================================================================
7 | ====================================================================================================
8 |
9 | shl_hex:
10 | ================================================================================================================================================================================================================================================================
11 | ====================================================================================================
12 |
13 | shr_hex:
14 | ================================================================================================================================================================================================================================================================
15 | ====================================================================================================
16 |
17 | count_bits:
18 | ================================================================================================================================================================================================================================================================
19 | ====================================================================================================
20 |
21 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test4_1.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 | 0==
22 | 0==
23 | 0==
24 | 0==
25 | 0==
26 | 0==
27 | 0==
28 | 0==
29 | 0==
30 | 0==
31 | 0==
32 | 0==
33 | 0==
34 | 0==
35 | 0==
36 | 0==
37 | 0==
38 | 0==
39 | 0==
40 | 0==
41 | 0==
42 | 0==
43 | 0==
44 | 0==
45 | 0==
46 | 0==
47 | 0==
48 | 0==
49 | 0==
50 | 0==
51 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test4_2.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 | 0==
22 | 0==
23 | 0==
24 | 0==
25 | 0==
26 | 0==
27 | 0==
28 | 0==
29 | 0==
30 | 0==
31 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test4_4.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test8_1.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 | 0==
22 | 0==
23 | 0==
24 | 0==
25 | 0==
26 | 0==
27 | 0==
28 | 0==
29 | 0==
30 | 0==
31 | 0==
32 | 0==
33 | 0==
34 | 0==
35 | 0==
36 | 0==
37 | 0==
38 | 0==
39 | 0==
40 | 0==
41 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test8_2.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 | 0==
22 | 0==
23 | 0==
24 | 0==
25 | 0==
26 | 0==
27 | 0==
28 | 0==
29 | 0==
30 | 0==
31 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test8_4.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test8_8.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test_idiv.out:
--------------------------------------------------------------------------------
1 | 0==
2 | 0==
3 | 0==
4 | 0==
5 | 0==
6 | 0==
7 | 0==
8 | 0==
9 | 0==
10 | 0==
11 | 0==
12 | 0==
13 | 0==
14 | 0==
15 | 0==
16 | 0==
17 | 0==
18 | 0==
19 | 0==
20 | 0==
21 | 0==
22 | 0==
23 | 0==
24 | 0==
25 | 0==
26 | 0==
27 | 0==
28 | 0==
29 | 0==
30 | 0==
31 | 0==
32 | 0==
33 | 0==
34 | 0==
35 | 0==
36 | 0==
37 | 0==
38 | 0==
39 | 0==
40 | 0==
41 | 0==
42 | 0==
43 | 0==
44 | 0==
45 | 0==
46 | 0==
47 | 0==
48 | 0==
49 | 0==
50 | 0==
51 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/div/test_idiv_cases.out:
--------------------------------------------------------------------------------
1 | ==
2 | ==
3 | ==
4 | ==
5 | ==
6 | ==
7 | ==
8 | ==
9 | ==
10 | ==
11 | ==
12 | ==
13 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/add_mul32.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/add_mul4.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 | =
52 | =
53 | =
54 | =
55 | =
56 | =
57 | =
58 | =
59 | =
60 | =
61 | =
62 | =
63 | =
64 | =
65 | =
66 | =
67 | =
68 | =
69 | =
70 | =
71 | =
72 | =
73 | =
74 | =
75 | =
76 | =
77 | =
78 | =
79 | =
80 | =
81 | =
82 | =
83 | =
84 | =
85 | =
86 | =
87 | =
88 | =
89 | =
90 | =
91 | =
92 | =
93 | =
94 | =
95 | =
96 | =
97 | =
98 | =
99 | =
100 | =
101 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/add_mul64.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/add_mul8.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/mul16.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 | =
42 | =
43 | =
44 | =
45 | =
46 | =
47 | =
48 | =
49 | =
50 | =
51 | =
52 | =
53 | =
54 | =
55 | =
56 | =
57 | =
58 | =
59 | =
60 | =
61 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/mul32.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 | =
27 | =
28 | =
29 | =
30 | =
31 | =
32 | =
33 | =
34 | =
35 | =
36 | =
37 | =
38 | =
39 | =
40 | =
41 |
--------------------------------------------------------------------------------
/tests/inout/hexlib_tests/mul/mul64.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 |
--------------------------------------------------------------------------------
/tests/inout/multi_comp/multi_comp.out:
--------------------------------------------------------------------------------
1 | aaaaaTTT
2 |
--------------------------------------------------------------------------------
/tests/inout/pair_ns_tests/pair_ns1.out:
--------------------------------------------------------------------------------
1 | (0x0, 0x0), (0x0, 0x0)
2 |
--------------------------------------------------------------------------------
/tests/inout/pair_ns_tests/pair_ns2.out:
--------------------------------------------------------------------------------
1 | (0x8, 0x2), (0x0, 0x0)
2 | (0x8, 0x2), (0xAB, 0xCC)
3 | (0xB3, 0xCE), (0xAB, 0xCC)
4 | (0xB3, 0xCE), (0x15E, 0x19A)
5 |
--------------------------------------------------------------------------------
/tests/inout/pair_ns_tests/pair_ns3.out:
--------------------------------------------------------------------------------
1 | (0x2, 0x8)
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes0.in:
--------------------------------------------------------------------------------
1 | 0
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes0.out:
--------------------------------------------------------------------------------
1 | Search primes up to: Number of prime numbers: 0
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes1.in:
--------------------------------------------------------------------------------
1 | 1
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes1.out:
--------------------------------------------------------------------------------
1 | Search primes up to: Number of prime numbers: 0
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes10.in:
--------------------------------------------------------------------------------
1 | 10
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes10.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | Number of prime numbers: 4
6 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes100.in:
--------------------------------------------------------------------------------
1 | 100
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes100.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | 11
6 | 13
7 | 17
8 | 19
9 | 23
10 | 29
11 | 31
12 | 37
13 | 41
14 | 43
15 | 47
16 | 53
17 | 59
18 | 61
19 | 67
20 | 71
21 | 73
22 | 79
23 | 83
24 | 89
25 | 97
26 | Number of prime numbers: 25
27 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes107.in:
--------------------------------------------------------------------------------
1 | 107
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes107.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | 11
6 | 13
7 | 17
8 | 19
9 | 23
10 | 29
11 | 31
12 | 37
13 | 41
14 | 43
15 | 47
16 | 53
17 | 59
18 | 61
19 | 67
20 | 71
21 | 73
22 | 79
23 | 83
24 | 89
25 | 97
26 | 101
27 | 103
28 | 107
29 | Number of prime numbers: 28
30 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes108.in:
--------------------------------------------------------------------------------
1 | 108
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes108.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | 11
6 | 13
7 | 17
8 | 19
9 | 23
10 | 29
11 | 31
12 | 37
13 | 41
14 | 43
15 | 47
16 | 53
17 | 59
18 | 61
19 | 67
20 | 71
21 | 73
22 | 79
23 | 83
24 | 89
25 | 97
26 | 101
27 | 103
28 | 107
29 | Number of prime numbers: 28
30 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes121.in:
--------------------------------------------------------------------------------
1 | 121
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes121.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | 11
6 | 13
7 | 17
8 | 19
9 | 23
10 | 29
11 | 31
12 | 37
13 | 41
14 | 43
15 | 47
16 | 53
17 | 59
18 | 61
19 | 67
20 | 71
21 | 73
22 | 79
23 | 83
24 | 89
25 | 97
26 | 101
27 | 103
28 | 107
29 | 109
30 | 113
31 | Number of prime numbers: 30
32 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes2.in:
--------------------------------------------------------------------------------
1 | 2
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes2.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | Number of prime numbers: 1
3 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes3.in:
--------------------------------------------------------------------------------
1 | 3
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes3.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | Number of prime numbers: 2
4 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes4.in:
--------------------------------------------------------------------------------
1 | 4
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes4.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | Number of prime numbers: 2
4 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes5.in:
--------------------------------------------------------------------------------
1 | 5
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes5.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | Number of prime numbers: 3
5 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes50.in:
--------------------------------------------------------------------------------
1 | 50
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes50.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | 11
6 | 13
7 | 17
8 | 19
9 | 23
10 | 29
11 | 31
12 | 37
13 | 41
14 | 43
15 | 47
16 | Number of prime numbers: 15
17 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes6.in:
--------------------------------------------------------------------------------
1 | 6
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes6.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | Number of prime numbers: 3
5 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes7.in:
--------------------------------------------------------------------------------
1 | 7
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes7.out:
--------------------------------------------------------------------------------
1 | Search primes up to: 2
2 | 3
3 | 5
4 | 7
5 | Number of prime numbers: 4
6 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_19a.in:
--------------------------------------------------------------------------------
1 | 19a
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_1e17.in:
--------------------------------------------------------------------------------
1 | 100000000000000000
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_a19.in:
--------------------------------------------------------------------------------
1 | a19
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_abc.in:
--------------------------------------------------------------------------------
1 | abc
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_bad_number.out:
--------------------------------------------------------------------------------
1 | Search primes up to:
2 |
3 | Error:
4 | Bad number given. The number should be positive, only digits, and end with a new-line.
5 | Exiting program.
6 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_empty.in:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_minus5.in:
--------------------------------------------------------------------------------
1 | -5
2 |
--------------------------------------------------------------------------------
/tests/inout/prime_sieve_tests/primes_err_too_big.out:
--------------------------------------------------------------------------------
1 | Search primes up to:
2 |
3 | Error:
4 | The input number should be less than ((1 << (w-2)) / w).
5 | For w=16 it's 1024.
6 | For w=32 it's ~33M.
7 | For w=64 it's ~7e16.
8 | Exiting program.
9 |
--------------------------------------------------------------------------------
/tests/inout/print_tests/cat.in:
--------------------------------------------------------------------------------
1 | hi 1234!
2 |
--------------------------------------------------------------------------------
/tests/inout/print_tests/cat.out:
--------------------------------------------------------------------------------
1 | hi 1234!
--------------------------------------------------------------------------------
/tests/inout/print_tests/hello_no-stl.out:
--------------------------------------------------------------------------------
1 | Hello, World!
--------------------------------------------------------------------------------
/tests/inout/print_tests/hello_world.out:
--------------------------------------------------------------------------------
1 | Hello, World!
2 | (:
--------------------------------------------------------------------------------
/tests/inout/print_tests/hello_world_with_str.out:
--------------------------------------------------------------------------------
1 | Hello, World!
2 | (:
--------------------------------------------------------------------------------
/tests/inout/print_tests/hexprint.out:
--------------------------------------------------------------------------------
1 | C
--------------------------------------------------------------------------------
/tests/inout/print_tests/ncat.in:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/tests/inout/print_tests/ncat.in
--------------------------------------------------------------------------------
/tests/inout/print_tests/ncat.out:
--------------------------------------------------------------------------------
1 | hi 1234!
--------------------------------------------------------------------------------
/tests/inout/print_tests/print_as_digit.out:
--------------------------------------------------------------------------------
1 | 01
2 | 0123456789abcdef
3 | 0123456789ABCDEF
4 |
--------------------------------------------------------------------------------
/tests/inout/print_tests/print_dec.out:
--------------------------------------------------------------------------------
1 | 123456
2 | 0
3 | -123456
4 |
--------------------------------------------------------------------------------
/tests/inout/print_tests/print_hex_int.out:
--------------------------------------------------------------------------------
1 | -0xABCDEF
--------------------------------------------------------------------------------
/tests/inout/sanity_checks/simple.out:
--------------------------------------------------------------------------------
1 | 3
--------------------------------------------------------------------------------
/tests/inout/sanity_checks/startup_init_all.out:
--------------------------------------------------------------------------------
1 | 0xAC6
2 | 1010
3 |
--------------------------------------------------------------------------------
/tests/inout/sanity_checks/testbit.out:
--------------------------------------------------------------------------------
1 | Z
--------------------------------------------------------------------------------
/tests/inout/sanity_checks/testbit_with_nops.out:
--------------------------------------------------------------------------------
1 | 1
--------------------------------------------------------------------------------
/tests/inout/simple_math_checks/25equals.out:
--------------------------------------------------------------------------------
1 | =
2 | =
3 | =
4 | =
5 | =
6 | =
7 | =
8 | =
9 | =
10 | =
11 | =
12 | =
13 | =
14 | =
15 | =
16 | =
17 | =
18 | =
19 | =
20 | =
21 | =
22 | =
23 | =
24 | =
25 | =
26 |
--------------------------------------------------------------------------------
/tests/inout/simple_math_checks/bit_div.out:
--------------------------------------------------------------------------------
1 | ==
2 | ==
3 | ==
4 | ==
5 | ==
6 | ==
7 | ==
8 | ==
9 | ==
10 | ==
11 |
--------------------------------------------------------------------------------
/tests/inout/simple_math_checks/div10.out:
--------------------------------------------------------------------------------
1 | 0x501,1
2 | 0x80,8
3 | 0xC,2
4 | 0x1,1
5 |
--------------------------------------------------------------------------------
/tests/inout/simple_math_checks/nadd.out:
--------------------------------------------------------------------------------
1 | 7
--------------------------------------------------------------------------------
/tests/inout/simple_math_checks/ncmp.out:
--------------------------------------------------------------------------------
1 | >
--------------------------------------------------------------------------------
/tests/inout/simple_math_checks/series_sum.out:
--------------------------------------------------------------------------------
1 | params: a1 = 1, d = 3, n = 12.
2 |
3 | an = 34.
4 | Sum(a1, a2, ..., an) = 210.
5 |
--------------------------------------------------------------------------------
/tests/inout/sorts/bubble_sort_1.in:
--------------------------------------------------------------------------------
1 | 000b
2 | f5fe cf62 aed8 b2fd 7bbc aae5 121c 9e00 9e00 7f17 0cdf
3 |
--------------------------------------------------------------------------------
/tests/inout/sorts/bubble_sort_1.out:
--------------------------------------------------------------------------------
1 | 0cdf 121c 7bbc 7f17 9e00 9e00 aae5 aed8 b2fd cf62 f5fe
2 |
--------------------------------------------------------------------------------
/tests/inout/sorts/bubble_sort_2.in:
--------------------------------------------------------------------------------
1 | 000b
2 | 85ec 27bd 8925 e26c 56a6 9929 d2fd b137 bd93 5343 f83d
3 |
--------------------------------------------------------------------------------
/tests/inout/sorts/bubble_sort_2.out:
--------------------------------------------------------------------------------
1 | 27bd 5343 56a6 85ec 8925 9929 b137 bd93 d2fd e26c f83d
2 |
--------------------------------------------------------------------------------
/tests/tests_tables/test_compile_fast.csv:
--------------------------------------------------------------------------------
1 | cat, programs/print_tests/cat.fj,tests/compiled/print_tests/cat.fjm, 64,3,0, True,True
2 | hello_no-stl, programs/print_tests/hello_no-stl.fj,tests/compiled/print_tests/hello_no-stl.fjm, 64,3,0, False,True
3 | hello_world, programs/print_tests/hello_world.fj,tests/compiled/print_tests/hello_world.fjm, 64,3,0, True,True
4 | hexprint, programs/print_tests/hexprint.fj,tests/compiled/print_tests/hexprint.fjm, 64,3,0, True,True
5 | mathbit, programs/sanity_checks/mathbit.fj,tests/compiled/sanity_checks/mathbit.fjm, 64,3,0, True,True
6 | mathvec, programs/sanity_checks/mathvec.fj,tests/compiled/sanity_checks/mathvec.fjm, 64,3,0, True,True
7 | nadd, programs/simple_math_checks/nadd.fj,tests/compiled/simple_math_checks/nadd.fjm, 64,3,0, True,True
8 | ncat, programs/print_tests/ncat.fj,tests/compiled/print_tests/ncat.fjm, 64,3,0, True,True
9 | ncmp, programs/simple_math_checks/ncmp.fj,tests/compiled/simple_math_checks/ncmp.fjm, 64,3,0, True,True
10 | not, programs/sanity_checks/not.fj,tests/compiled/sanity_checks/not.fjm, 64,3,0, True,True
11 | test_startup_init_all, programs/sanity_checks/startup_init_all.fj,tests/compiled/sanity_checks/startup_init_all.fjm, 64,3,0, True,True
12 | print_as_digit, programs/print_tests/print_as_digit.fj,tests/compiled/print_tests/print_as_digit.fjm, 64,3,0, True,True
13 | quine16, programs/quine16.fj,tests/compiled/quine16.fjm, 16,0,0, True,True
14 | rep, programs/sanity_checks/rep.fj,tests/compiled/sanity_checks/rep.fjm, 64,3,0, True,True
15 | simple, programs/sanity_checks/simple.fj,tests/compiled/sanity_checks/simple.fjm, 64,3,0, True,True
16 | testbit, programs/sanity_checks/testbit.fj,tests/compiled/sanity_checks/testbit.fjm, 64,3,0, True,True
17 | testbit_with_nops, programs/sanity_checks/testbit_with_nops.fj,tests/compiled/sanity_checks/testbit_with_nops.fjm, 64,3,0, True,True
18 |
19 | multi_comp_stl_bc, programs/multi_comp/defs.fj | programs/multi_comp/a.fj | programs/multi_comp/b.fj | programs/multi_comp/c.fj, tests/compiled/multi_comp/multi_comp_stl_bc.fjm, 64,3,0, True,True
20 | multi_comp_no_stl_bc, programs/multi_comp/defs.fj | programs/multi_comp/a_no_stl.fj | programs/multi_comp/b.fj | programs/multi_comp/c.fj, tests/compiled/multi_comp/multi_comp_no_stl_bc.fjm, 64,3,0, False,True
21 | multi_comp_stl_cb, programs/multi_comp/defs.fj | programs/multi_comp/a.fj | programs/multi_comp/c.fj | programs/multi_comp/b.fj, tests/compiled/multi_comp/multi_comp_stl_cb.fjm, 64,3,0, True,True
22 | multi_comp_no_stl_cb, programs/multi_comp/defs.fj | programs/multi_comp/a_no_stl.fj | programs/multi_comp/c.fj | programs/multi_comp/b.fj, tests/compiled/multi_comp/multi_comp_no_stl_cb.fjm, 64,3,0, False,True
23 |
--------------------------------------------------------------------------------
/tests/tests_tables/test_compile_medium.csv:
--------------------------------------------------------------------------------
1 | casting, programs/concept_checks/casting.fj,tests/compiled/concept_checks/casting.fjm, 64,3,0, True,True
2 | div10, programs/simple_math_checks/div10.fj,tests/compiled/simple_math_checks/div10.fjm, 64,3,0, True,True
3 | hello_world_with_str, programs/print_tests/hello_world_with_str.fj,tests/compiled/print_tests/hello_world_with_str.fjm, 64,3,0, True,True
4 | print_dec, programs/print_tests/print_dec.fj,tests/compiled/print_tests/print_dec.fjm, 64,3,0, True,True
5 | print_hex_int, programs/print_tests/print_hex_int.fj,tests/compiled/print_tests/print_hex_int.fjm, 64,3,0, True,True
6 | bit_ptr, programs/concept_checks/bit_ptr.fj,tests/compiled/concept_checks/bit_ptr.fjm, 64,3,0, True,True
7 | hex_ptr, programs/concept_checks/hex_ptr.fj,tests/compiled/concept_checks/hex_ptr.fjm, 64,3,0, True,True
8 | segments, programs/concept_checks/segments.fj,tests/compiled/concept_checks/segments.fjm, 64,3,0, True,True
9 |
--------------------------------------------------------------------------------
/tests/tests_tables/test_compile_slow.csv:
--------------------------------------------------------------------------------
1 | hex_func7, programs/func_tests/func7.fj,tests/compiled/func_tests/func7.fjm, 64,3,0, True,True
2 |
3 | shra, programs/simple_math_checks/shra.fj,tests/compiled/simple_math_checks/shra.fjm, 64,3,0, True,True
4 | bit-div, programs/simple_math_checks/bit_div.fj,tests/compiled/simple_math_checks/bit_div.fjm, 64,3,0, True,True
5 |
6 | calc, programs/calc.fj,tests/compiled/calc.fjm, 64,3,0, True,True
7 |
8 | hex_func1, programs/func_tests/func1.fj,tests/compiled/func_tests/func1.fjm, 64,3,0, True,True
9 | hex_func2, programs/func_tests/func2.fj,tests/compiled/func_tests/func2.fjm, 64,3,0, True,True
10 | hex_func3, programs/func_tests/func3.fj,tests/compiled/func_tests/func3.fjm, 64,3,0, True,True
11 | hex_func4, programs/func_tests/func4.fj,tests/compiled/func_tests/func4.fjm, 64,3,0, True,True
12 | hex_func5, programs/func_tests/func5.fj,tests/compiled/func_tests/func5.fjm, 64,3,0, True,True
13 | hex_func6, programs/func_tests/func6.fj,tests/compiled/func_tests/func6.fjm, 64,3,0, True,True
14 |
15 | pair_ns1, programs/concept_checks/pair_ns.fj | programs/pair_ns_tests/test1.fj,tests/compiled/pair_ns_tests/test1.fjm, 64,3,0, True,True
16 | pair_ns2, programs/concept_checks/pair_ns.fj | programs/pair_ns_tests/test2.fj,tests/compiled/pair_ns_tests/test2.fjm, 64,3,0, True,True
17 | pair_ns3, programs/concept_checks/pair_ns.fj | programs/pair_ns_tests/test3.fj,tests/compiled/pair_ns_tests/test3.fjm, 64,3,0, True,True
18 |
19 | series_sum, programs/simple_math_checks/series_sum.fj,tests/compiled/simple_math_checks/series_sum.fjm, 64,3,0, True,True
20 |
21 | prime_sieve, programs/prime_sieve.fj,tests/compiled/prime_sieve.fjm, 64,3,0, True,True
22 |
23 | bubble_sort__write_hex , programs/sorts/utils/_hex_memory_access.fj | programs/sorts/bubble_sort.fj | programs/sorts/utils/_swap_adjacent_using_writes.fj ,tests/compiled/sorts/bubble_sort__write_hex.fjm , 64,3,0, True,True
24 | bubble_sort__xor_hex , programs/sorts/utils/_hex_memory_access.fj | programs/sorts/bubble_sort.fj | programs/sorts/utils/_swap_adjacent_using_xors.fj ,tests/compiled/sorts/bubble_sort__xor_hex.fjm , 64,3,0, True,True
25 | bubble_sort__write_byte, programs/sorts/utils/_byte_memory_access.fj | programs/sorts/bubble_sort.fj | programs/sorts/utils/_swap_adjacent_using_writes.fj ,tests/compiled/sorts/bubble_sort__write_byte.fjm, 64,3,0, True,True
26 | bubble_sort__xor_byte , programs/sorts/utils/_byte_memory_access.fj | programs/sorts/bubble_sort.fj | programs/sorts/utils/_swap_adjacent_using_xors.fj ,tests/compiled/sorts/bubble_sort__xor_byte.fjm , 64,3,0, True,True
27 |
--------------------------------------------------------------------------------
/tests/tests_tables/test_run_fast.csv:
--------------------------------------------------------------------------------
1 | cat, tests/compiled/print_tests/cat.fjm, tests/inout/print_tests/cat.in,tests/inout/print_tests/cat.out, False,False
2 | hello_no-stl, tests/compiled/print_tests/hello_no-stl.fjm, ,tests/inout/print_tests/hello_no-stl.out, False,False
3 | hello_world, tests/compiled/print_tests/hello_world.fjm, ,tests/inout/print_tests/hello_world.out, False,False
4 | hexprint, tests/compiled/print_tests/hexprint.fjm, ,tests/inout/print_tests/hexprint.out, False,False
5 | mathbit, tests/compiled/sanity_checks/mathbit.fjm, ,, False,False
6 | mathvec, tests/compiled/sanity_checks/mathvec.fjm, ,, False,False
7 | nadd, tests/compiled/simple_math_checks/nadd.fjm, ,tests/inout/simple_math_checks/nadd.out, False,False
8 | ncat, tests/compiled/print_tests/ncat.fjm, tests/inout/print_tests/ncat.in,tests/inout/print_tests/ncat.out, True,True
9 | ncmp, tests/compiled/simple_math_checks/ncmp.fjm, ,tests/inout/simple_math_checks/ncmp.out, False,False
10 | not, tests/compiled/sanity_checks/not.fjm, ,, False,False
11 | test_startup_init_all, tests/compiled/sanity_checks/startup_init_all.fjm, ,tests/inout/sanity_checks/startup_init_all.out, False,False
12 | print_as_digit, tests/compiled/print_tests/print_as_digit.fjm, ,tests/inout/print_tests/print_as_digit.out, False,False
13 | quine16, tests/compiled/quine16.fjm, ,tests/compiled/quine16.fjm, True,True
14 | rep, tests/compiled/sanity_checks/rep.fjm, ,, False,False
15 | simple, tests/compiled/sanity_checks/simple.fjm, ,tests/inout/sanity_checks/simple.out, False,False
16 | testbit, tests/compiled/sanity_checks/testbit.fjm, ,tests/inout/sanity_checks/testbit.out, False,False
17 | testbit_with_nops, tests/compiled/sanity_checks/testbit_with_nops.fjm, ,tests/inout/sanity_checks/testbit_with_nops.out, False,False
18 |
19 | multi_comp_stl_bc, tests/compiled/multi_comp/multi_comp_stl_bc.fjm, ,tests/inout/multi_comp/multi_comp.out, False, False
20 | multi_comp_no_stl_bc, tests/compiled/multi_comp/multi_comp_no_stl_bc.fjm, ,tests/inout/multi_comp/multi_comp.out, False, False
21 | multi_comp_stl_cb, tests/compiled/multi_comp/multi_comp_stl_cb.fjm, ,tests/inout/multi_comp/multi_comp.out, False, False
22 | multi_comp_no_stl_cb, tests/compiled/multi_comp/multi_comp_no_stl_cb.fjm, ,tests/inout/multi_comp/multi_comp.out, False, False
23 |
--------------------------------------------------------------------------------
/tests/tests_tables/test_run_medium.csv:
--------------------------------------------------------------------------------
1 | casting, tests/compiled/concept_checks/casting.fjm, ,tests/inout/concept_checks/casting.out, False,False
2 | div10, tests/compiled/simple_math_checks/div10.fjm, ,tests/inout/simple_math_checks/div10.out, False,False
3 | hello_world_with_str, tests/compiled/print_tests/hello_world_with_str.fjm, ,tests/inout/print_tests/hello_world_with_str.out, False,False
4 | print_dec, tests/compiled/print_tests/print_dec.fjm, ,tests/inout/print_tests/print_dec.out, False,False
5 | print_hex_int, tests/compiled/print_tests/print_hex_int.fjm, ,tests/inout/print_tests/print_hex_int.out, False,False
6 | bit_ptr, tests/compiled/concept_checks/bit_ptr.fjm, ,tests/inout/concept_checks/bit_ptr.out, False,False
7 | hex_ptr, tests/compiled/concept_checks/hex_ptr.fjm, ,tests/inout/concept_checks/hex_ptr.out, False,False
8 | segments, tests/compiled/concept_checks/segments.fjm, tests/inout/concept_checks/segments.in,tests/inout/concept_checks/segments.out, False,False
9 |
--------------------------------------------------------------------------------
/tests/tests_tables/xfail_compile.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/tests/tests_tables/xfail_compile.csv
--------------------------------------------------------------------------------
/tests/tests_tables/xfail_run.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomhea/flip-jump/fe51448932e78db7d769e094dad742d0994b7b8b/tests/tests_tables/xfail_run.csv
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | min_version = 4.0
3 | env_list = py38, py39, py310, py311, py312, py313,
4 | mypy, flake8, bandit, black,
5 | full_tests
6 | isolated_build = true
7 |
8 | [gh-actions]
9 | ;Notice that in gh-actions we don't run the full_tests via tox.
10 | python =
11 | 3.8: py38
12 | 3.9: py39
13 | 3.10: py310
14 | 3.11: py311
15 | 3.12: py312
16 | 3.13: py313
17 |
18 | [testenv]
19 | setenv = PYTHONPATH = {toxinidir}
20 | deps = .[tests]
21 | commands = pytest --regular
22 |
23 | [testenv:mypy]
24 | basepython = python3.13
25 | commands = mypy
26 |
27 | [testenv:bandit]
28 | basepython = python3.13
29 | commands = bandit -r -s B101 flipjump tests
30 |
31 | [testenv:flake8]
32 | basepython = python3.13
33 | commands = flake8
34 |
35 | [testenv:black]
36 | basepython = python3.13
37 | commands = black . --check --color --diff
38 |
39 | [testenv:full_tests]
40 | basepython = python3.13
41 | commands =
42 | pytest --compile -n auto --all
43 | pytest --run -n auto --all
44 |
45 |
46 | [flake8]
47 | exclude =
48 | .git,
49 | __pycache__,
50 | .tox,
51 | tests/inout
52 | tests/compiled
53 | venv
54 |
55 | max-line-length=120
56 |
57 | per-file-ignores =
58 | # imported but unused
59 | flipjump/__init__.py: F401
60 | # redefinition of unused / undefined name
61 | flipjump/assembler/fj_parser.py: F811, F821
62 |
63 |
64 | [bandit]
65 | recursive = true
66 | targets = flipjump,tests
67 | skips = B101
68 |
--------------------------------------------------------------------------------