{"id":21145398,"url":"https://github.com/etchedpixels/cc6303","last_synced_at":"2025-07-09T07:31:22.977Z","repository":{"id":43677201,"uuid":"216677542","full_name":"EtchedPixels/CC6303","owner":"EtchedPixels","description":"A C compiler for the 6800 series processors","archived":false,"fork":false,"pushed_at":"2024-03-19T10:05:52.000Z","size":1196,"stargazers_count":34,"open_issues_count":1,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-03-19T11:29:10.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EtchedPixels.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-10-21T22:36:33.000Z","updated_at":"2024-02-15T21:02:37.000Z","dependencies_parsed_at":"2023-10-11T22:19:45.292Z","dependency_job_id":"87f4856e-9b1b-40ed-91ec-74666803a797","html_url":"https://github.com/EtchedPixels/CC6303","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtchedPixels%2FCC6303","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtchedPixels%2FCC6303/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtchedPixels%2FCC6303/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtchedPixels%2FCC6303/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EtchedPixels","download_url":"https://codeload.github.com/EtchedPixels/CC6303/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492617,"owners_count":17482924,"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-11-20T08:39:56.948Z","updated_at":"2025-07-09T07:31:22.970Z","avatar_url":"https://github.com/EtchedPixels.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# THIS IS NO LONGER AN ACTIVE PROJECT\n\nFor the current compiler and tools work please see\n- https://github.com/EtchedPixels/Fuzix-Bintools\n- https://github.com/EtchedPixels/Fuzix-Compiler-Kit\n\nFor a 6800 specific fork of this code under development by Zu2 please see\n- https://github.com/zu2/CC6303\n\n# CC6303\nA C compiler for the 6800/6803/6303 processors\n\nThis is based upon cc65 [https://github.com/cc65/cc65] but involves doing\nsome fairly brutal things to the original compiler. As such I currently have\nno plans to merge it back the other way.\n\nIn particular cc65 has a model where the code is generated into a big array\nwhich is parsed as it goes into all sorts of asm level info which drives\noptimizer logic. It also uses it to allow the compiler to re-order blocks\nand generate code then change its mind.\n\n## Status\n\nThe basic structure is now reasonably functional. You can \"make\" and \"make\ninstall\" to get a complete compiler/assembler/linker/tools that appear\nto generate actual binaries.\n\nThe assembler and linker should be reasonably reliable and complete. The\ncompiler at this point should be reasonably solid on 6803 and 6303 except for\n32bit types. The core compiler support for 32bit types is there and mostly\ntested but the library helpers for shifts, multiply and particularly division\nare not yet fully debugged.\n\nOn the 6800 processor the library routines are far from complete. Note that\nthe 6800 target will generate much slower and larger code because the 6800\nlacks 16bit operations and some other important features. 6800 code is about\na third larger.\n\nThe bundled C library routines are initial code and not fully tested or reviewed.\nThey are intended to provide native versions of key and time critical functions\nnot a full C library.\n\n## How to use\n\nFor a simple test environment the easiest approach at this point is to\ncompile the code with cc68 and then link with a suitable crt.o (entry code)\n\n````\ncc68 -m6803 -c foo.c\nld68 -b -C startaddress crt.o mycode.o /opt/cc68/lib/lib6803.a\n````\n\n## Tandy MC-10 target\n\n````\ncc68 -tmc10 foo.c -o foo\n````\n\nThis will produce a foo.c10 that can be loaded into an emulator or turned\ninto a wav file. A few minimal C library functions are present including\nputchar/puts.\n\n## TODO\n\n- Strip out lots more unused cc65 code. There is a lot of unused code,\n  and a load of dangling header references and so on left to resolve.\n\n- Remove remaining '6502' references.\n\n- Make embedding C source into asm as comments work for debugging\n\n- Maybe float: cc65 lacks float beyond the basic parsing support, so this\n  means extending the back end to handle all the fp cases (probably via\n  stack) and using the long handling paths for the non maths ops.\n\n- A proper optimizer\n\n## BIG ISSUES\n\n- We can make much better use of X in some situations than the cc65 code\n  based generator really understands. In particular we want to be able to\n  tell the expression evaluation \"try and evaluate this into X without using\n  D\". In practice that means simple constants and stack offsets. That will\n  improve some handling of helpers. We can't do that much with it because\n  we need to be in D for maths. Right now the worst of this is peepholed.\n\n- Fetch pointers via X when we can, especially on 6803. In particular also\n  deal with pre/post-inc of statics (but not alas pre/post inc locals) with\n\n````\n\tldx $foo\n\tinx\n\tstx $foo\n\tdex\n````\n- Make sure we can tell if the result of a function is being evaluated or if\n  the function returns void. In those cases we can use D (mostly importantly\n  B) to use abx to fix the stack offsets.\n\n- copt has no idea about register usage analysis, dead code elimination etc.\n  We could do far better with a proper processor that understood 680x not\n  just a pattern handler. We fudge it a bit with hints but it's not ideal.\n\n- Floating point\n  The cc65 front end has some float support although it is not supported by\n  the back end, and I don't know how tested the frontend code is therefore.\n  Adding float should not be hard, it's basically a long with no inlineable\n  operators as far as the compiler code generator is concerned. It would\n  however need someone to volunteer to write the basic IEEE floating point\n  operations (add, negate, multiply, divide, maybe compare, plus conversion\n  to and from float) for a 680x processor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetchedpixels%2Fcc6303","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetchedpixels%2Fcc6303","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetchedpixels%2Fcc6303/lists"}