{"id":17990360,"url":"https://github.com/suborb/splib2","last_synced_at":"2025-07-27T03:11:54.956Z","repository":{"id":88571237,"uuid":"356656264","full_name":"suborb/splib2","owner":"suborb","description":"AA's splib2, being updated for recent z88dks","archived":false,"fork":false,"pushed_at":"2021-10-09T20:34:56.000Z","size":338,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T03:43:48.234Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Assembly","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/suborb.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,"publiccode":null,"codemeta":null}},"created_at":"2021-04-10T17:53:21.000Z","updated_at":"2021-10-09T20:35:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"a12878ab-27e6-403b-bb45-8406d5336a74","html_url":"https://github.com/suborb/splib2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suborb/splib2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suborb%2Fsplib2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suborb%2Fsplib2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suborb%2Fsplib2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suborb%2Fsplib2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suborb","download_url":"https://codeload.github.com/suborb/splib2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suborb%2Fsplib2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267293929,"owners_count":24065334,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-29T19:17:38.321Z","updated_at":"2025-07-27T03:11:54.913Z","avatar_url":"https://github.com/suborb.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# splib2\n\nAA's splib2, being updated for recent z88dks.\n\nThe original source can be found at the Geocities archive here: http://www.oocities.org/aralbrec/spritepack/examples/examples.htm\n\nThis repo will modernise the code and end up producing a new version of splib2 that can\nbe used with modern z88dks.\n\nThis can be combined with [MK1](https://github.com/mojontwins/MK1/) to allow more rooms to be squeezed into your game\n\nEnjoy the journey...\n\n\n## Updating process\n\nFor those that are interested. The updating process has involved/will involve the following\nsteps:\n\n### Sectioning the code (done)\n\nz88dk now uses sections, so we need to assign the .asm source code into sections.\n\n### Building (done)\n\nWe're going to use a makefile to build the library. By the time the modernisation is \nfinished it won't be needed since the library will be purely .asm files so just\na single invocation of z80asm will be needed.\n\n### Removing code that duplicates existing code (in progress)\n\nWhen AA rewrote splib2 to create the sp1 which is included in the main z88dk tree, the\nutility functions within splib2 were split out into separate modules and given\nnon SP* api names. These parts of the classic library reflect this:\n\n* [ ] balloc\n* [ ] interrupts\n* [ ] adt-linkedlist\n* [x] adt-heap\n* [ ] input\n* [ ] ZX screen address routines\n\nHowever, dropping in the z88dk library equivalents may not be possible due to:\n\n* Memory allocation setup\n* Different register usage for assembler called functinos\n* Slightly increased memory usage to cope with the above\n\n### Turning everything into .asm files (in progress)\n\nEmbedding assembler code in C functions is not considered best practice these days so\nwe'll need to extract the code to straight assembler files.\n\n### Adding `__z88dk_fastcall`/`__z88dk_callee` entry points (in progress)\n\nUtilising these alternate calling conventions reduces code size and increases performance.\n\n### Protecting ix for sdcc entry points\n\nSDCC uses ix as a framepointer and as part of the contract it must not be disturbed\nover function calls. \n\n\n## Recipe for adjusting the source of MK1 projects\n\n1. Change the definition of joyfunc (definitions.h) to:\n\n````\nuint (*joyfunc)(struct sp_UDK *) = sp_JoyKeyboard;\n````\n\n2. Sort out the case sensitivity problems in music.h:\n\n````\n    cat music.h | tr '[A-Z]' '[a-z]' \u003e x\n    mv x music.h\n````\n\n3. Remove the unnecessary # operator in beeper.h\n\n````\n-               defb #01        ;ld bc\n+               defb 01 ;ld bc\n````\n\n4. Create zpragma.inc:\n\n````\n// Console not used, disable it\n#pragma export fputc_cons = 0\n\n// Not a 128k game, so disable the bank loader\n#pragma define CRT_DISABLELOADER = 1\n\n#pragma output REGISTER_SP = 61936\n\n#pragma define CRT_ORG_CODE = 24000\n\n// We're not exiting, so we don't need an atexit stack\n#pragma define CLIB_EXIT_STACK_SIZE = 0\n\n// Stdio isn't used, disable it\n#pragma define CRT_ENABLE_STDIO = 0\n\n// Ensure that we don't map the border colour\n#pragma define CONIO_NATIVE_COLOUR = 1\n````\n\nChange the sp and origin to appropriate values\n\n5. Alter the compilation line to have the addition option `-pragma-include:zpragma.inc -DBUILD_MK2`\n\n## Results\n\nNot all tunings have been done, but we do have some size savings:\n\n| Games | Original Size | New size with latest |\n|-|-|-|\n| [Red Planet](https://spectrumcomputing.co.uk/index.php?cat=96\u0026id=30231) | 35934 | 34880 |\n| [Helmet](https://github.com/mojontwins/MK1/tree/master/examples/helmet) | 37655 | 37163 |\n| [Goddess](https://github.com/mojontwins/MK1/tree/master/examples/goddess)| 29217 | 28716 |\n| [Nightmare on Halloween](https://github.com/mojontwins/MK1/tree/master/contrib/nightmare_on_halloween) | 29162 | 28763 |\n| [Misco Jones](https://github.com/mojontwins/MK1/tree/master/contrib/misco_jones) | 27915 | 27513 |\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuborb%2Fsplib2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuborb%2Fsplib2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuborb%2Fsplib2/lists"}