{"id":13730203,"url":"https://github.com/deplinenoise/deluxe68","last_synced_at":"2025-06-22T08:06:02.549Z","repository":{"id":37734736,"uuid":"76223964","full_name":"deplinenoise/deluxe68","owner":"deplinenoise","description":"A simple register allocator frontend for 68k assembly","archived":false,"fork":false,"pushed_at":"2022-12-20T04:17:42.000Z","size":44,"stargazers_count":45,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-08T02:38:28.997Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deplinenoise.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-12T05:12:13.000Z","updated_at":"2025-02-10T02:39:25.000Z","dependencies_parsed_at":"2023-01-29T23:45:49.598Z","dependency_job_id":null,"html_url":"https://github.com/deplinenoise/deluxe68","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deplinenoise/deluxe68","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fdeluxe68","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fdeluxe68/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fdeluxe68/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fdeluxe68/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deplinenoise","download_url":"https://codeload.github.com/deplinenoise/deluxe68/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fdeluxe68/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261257108,"owners_count":23131520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T02:01:11.432Z","updated_at":"2025-06-22T08:05:57.536Z","avatar_url":"https://github.com/deplinenoise.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Deluxe68\n\nDeluxe68 is a simple (stupid) register allocator frontend for 68k assembly. It\nis a source to source translator, so you'll need your regular assembler to\nassemble its output. All it does is automate some tedious register allocation\nfor you.\n\n## Usage\n\nUsage is simple:\n\n    deluxe68 input.s output.s\n\n## Marking up source code\n\nThe following extensions are provided:\n\n### Allocating registers\n\nTo pull from the data register pool, use `@dreg`:\n\n                @dreg   a, b, [...]\n                moveq   #0,@a\n                moveq   #1,@b\n\nSimilarly, `@areg` allocates address registers. The stack pointer is\nautomatically reserved and will never be allocated:\n\n                @areg   ptr\n                lea     foo(pc),@ptr\n\n### Killing registers\n\nUse `@kill` to return a register to the pool:\n\n                @dreg   a\n                [.. code using @a ..]\n                @kill   a\n                moveq   #0,@a           ; now generates an error!\n\n### Renaming an allocated register\n\nOften in assembly programming, the purpose of a register changes. You can\nexpress that by renaming the register:\n\n                ; @xcoordptr = x coordinate buffer\n\n                @dreg\tx0,x1\n                move.w\t(@xcoordptr)+,@x0\n                move.w\t(@xcoordptr)+,@x1\n                sub.w\t@x0,@x1\n                @rename @x1,@deltax         ; @x1 is now no longer a coordinate \n\n                ; ...\n\n                @kill x0,deltax             ; x1 is now gone, and using it will result in an error\n\n### Using allocated registers\n\nYou can subsitute `@name` for a register in any instruction or macro\ninvokation. The only caveat is if the register has been spilled, in which case\nyou'll instead get a reference to the stack which can generate a\nmemory-to-memory instruction that doesn't assemble. In that case, rework the\ncode.\n\n### Spilling and restoring registers\n\nTo explicitly spill a named register to the stack (returning it to the pool) you can use `@spill`:\n\n                @dreg   a\n                moveq   #0,@a\n                @spill  a               ; a is now on stack\n                ...\n                ...                     ; more code involving more data register allocation\n                ...\n                @restore a              ; a is now back in the same register it lived in before\n\n`@spill` and `@restore` can also work with real registers. Spilling a real register ensures that\nthere is nothing named in that real register. This is useful when calling external code.\n\n### Reserving and unreserving registers\n\nTo reserve a real register you can use `@reserve`:\n\n                @reserve d0             ; d0 is no longer available to the allocator\n                moveq   #0,d0\n                ...\n                @unreserve d0           ; return d0 to the register allocator\n\n### Calling subroutines\n\nWhen you want to call a subroutine then you typically need to place arguments in specific registers.\nUse `@spill`/`@reserve` pairs to prepare the registers for use, and `@unreserve`/`@restore` pairs\nwhen you are done:\n\n                @spill  a0,d1\n                @reserve a0,d1\n                move.l  @foo,a0\n                move.l  @bar,d1\n                bsr     SomeExternalCode\n                @unreserve a0,d1\n                @restore a0,d1\n\nIf `a0` or `d1` are not allocated, the `@spill`/`@restore` operations will do nothing.\nThe `@reserve`/`@unreserve` operations are for bookkeeping, and will generate no code.\n\n\n### Procedures\n\nMark a procedure entry point with `@proc ProcedureName(\u003creg\u003e: name, [\u003creg\u003e: name ...])`. You can\nalso use `@proc ProcedureName` (that is, omitting the register-name part\nentirely) if your procedure has no arguments.\n\nDoing so accomplishes two things:\n\n- It generates an automatic `movem.l` that stores all touched registers to the stack\n- All live registers are killed automatically\n\nSimilarly, instead of `rts`, use `@endproc`. This puts the inverse `movem.l` in\nplace, and also emits the `rts` instruction.\n\nAny registers declared in the procedure header are automatically live and not\navailable for allocation in the procedure. You can however `@kill` them to\nreturn them to the pool.\n\n### Example\n\nThis input:\n\n                        @proc   Foo(a0:ptr, d0:count)\n\n                        @dreg   sum\n\n                        moveq   #0,@sum\n                        subq    #1,@count\n        .loop           add.w   (@ptr)+,@sum\n                        dbf     @count,.loop\n\n                        move.w  @sum,d0\n                        @endproc\n\nGenerates output similar to:\n\n                        ; @proc   Foo(a0:ptr, d0:count)\n                        ; live reg a0 =\u003e ptr\n                        ; live reg d0 =\u003e count\n\n        Foo:\n                        movem.l d1,-(sp)\n\n                        ; @dreg   sum\n                        ; live reg d1 =\u003e sum\n\n                        moveq   #0,d1\n                        subq    #1,d0\n        .loop           add.w   (a0)+,d1\n                        dbf     d0,.loop\n\n                        move.w  d1,d0\n                        ; @endproc\n                        movem.l (sp)+,d1\n                        rts\n\n### License\n\nThis software is available under the BSD 2-clause license:\n\nCopyright (c) 2016, Andreas Fredriksson\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeplinenoise%2Fdeluxe68","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeplinenoise%2Fdeluxe68","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeplinenoise%2Fdeluxe68/lists"}