{"id":13407213,"url":"https://github.com/superctr/SGDK_Z80_C","last_synced_at":"2025-03-14T11:31:09.458Z","repository":{"id":73562086,"uuid":"304424470","full_name":"superctr/SGDK_Z80_C","owner":"superctr","description":"Z80 C language integration for SGDK","archived":false,"fork":false,"pushed_at":"2020-10-15T22:35:02.000Z","size":6,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:26:53.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/superctr.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}},"created_at":"2020-10-15T19:10:08.000Z","updated_at":"2023-04-22T09:43:00.000Z","dependencies_parsed_at":"2024-01-13T17:12:01.986Z","dependency_job_id":"2d72e0bd-ffef-418e-b122-f6530ec54c7d","html_url":"https://github.com/superctr/SGDK_Z80_C","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/superctr%2FSGDK_Z80_C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superctr%2FSGDK_Z80_C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superctr%2FSGDK_Z80_C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superctr%2FSGDK_Z80_C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superctr","download_url":"https://codeload.github.com/superctr/SGDK_Z80_C/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243569387,"owners_count":20312418,"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-07-30T20:00:30.191Z","updated_at":"2025-03-14T11:31:08.574Z","avatar_url":"https://github.com/superctr.png","language":"Makefile","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Z80 integration for SGDK\nThis is an example project using SDCC to build a Z80 sound driver\nthat can be linked with the SGDK.\n\nThe example code uses the Z80 to read some YM2612 commands from the ROM,\nusing bank switching.\n\nKeep in mind that SDCC doesn't generate _fast_ Z80 assembly code, so\nC code won't be very useful for sample playback.\n\n## How to use\nCurrently this is only tested on windows.\n\n1. Download the SGDK windows snapshot from [here](http://sdcc.sourceforge.net/snap.php#Windows)\n2. Set the environment variable `SDCC_WIN` to point to the SDCC `bin` folder. Use Windows path separators.\n3. Add the SDCC `bin` folder to the PATH environment variable.\n4. `make`\n\n## Notes\n- 68K can halt Z80 when it is in the middle of reading stuff, so be careful\nwhen transferring commands larger than a single byte.\n- Keep in mind that the YM2612 requires a minimum waiting period between register writes, and between address and register writes.\n- As a rule of thumb, around 50 Z80 cycles are needed between register writes, and 15 cycles between address and register. SDCC generates assembly listings (containing cycle counts) in `z80/obj`, check there for details.\n- Add nops as necessary (using inlined ASM) in the unlikely case that SDCC manages to generate code that violates the above timing rule.\n- Use fixed addresses in Z80 space for communication with the 68k. On the 68k side, use `#define`s and volatile pointers to read/write Z80 memory, and on the Z80 side, use the `__at (address)` to directly specify an address for a variable.\n- Make sure all your Z80 code and variables fit in 8kb of memory. Initialized variables take twice the amount of space.\n\n## Credits\nBy Ian Karlsson.\n\nAll code is released in the public domain, feel free to use as you wish.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperctr%2FSGDK_Z80_C","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperctr%2FSGDK_Z80_C","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperctr%2FSGDK_Z80_C/lists"}