diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65026db..e89a4c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,9 @@ jobs: - name: Check out code uses: actions/checkout@v4 + - name: Setup cross compilers + run: sudo apt-get update && sudo apt-get install -y mingw-w64 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -32,6 +35,12 @@ jobs: - name: Build ops obj file run: bash build_ops_obj.sh + - name: Build runner + run: | + mkdir runner/bin + gcc runner/runmem2.c -Wall -O2 -o runner/bin/runmem2 + x86_64-w64-mingw32-gcc runner/runmem2.c -Wall -O2 -o runner/bin/runmem2.exe + #- name: Lint code with flake8 # run: flake8 @@ -46,4 +55,10 @@ jobs: if: strategy.job-index == 0 with: name: object files - path: src/copapy/obj/*.o \ No newline at end of file + path: src/copapy/obj/*.o + + - name: Upload compiled runner + uses: actions/upload-artifact@v4 + with: + name: runner + path: runner/bin/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index aa7f98e..c5541f6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ __pycache__ tests/autogenerated_*.py *test*.o /src/copapy/obj/ops*.o +test.copapy \ No newline at end of file diff --git a/src/copapy/__init__.py b/src/copapy/__init__.py index bbb8aef..924e678 100644 --- a/src/copapy/__init__.py +++ b/src/copapy/__init__.py @@ -369,6 +369,11 @@ def compile_to_instruction_list(end_nodes: Iterable[Node] | Node) -> binw.data_w dw.write_int(patch_type) dw.write_int(object_addr) - print('-----') + # set entry point + dw.write_com(binw.Command.SET_ENTR_POINT) + dw.write_int(0) + + # run program command + dw.write_com(binw.Command.END_PROG) return dw diff --git a/tests/test_compile.py b/tests/test_compile.py index 8bc8f07..70a3a26 100644 --- a/tests/test_compile.py +++ b/tests/test_compile.py @@ -1,6 +1,7 @@ from copapy import Write, const import copapy as rc + def test_compile(): c1 = const(1.11) c2 = const(2.22) @@ -17,6 +18,8 @@ def test_compile(): print('#', il.print()) + il.to_file('test.copapy') + if __name__ == "__main__": test_compile() \ No newline at end of file