Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btile: allow 8-bit tile IDs for lower memory usage #108

Open
jorgegv opened this issue Oct 10, 2022 · 0 comments
Open

btile: allow 8-bit tile IDs for lower memory usage #108

jorgegv opened this issue Oct 10, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request size optimization
Milestone

Comments

@jorgegv
Copy link
Owner

jorgegv commented Oct 10, 2022

Currently, RAGE1 uses generic SP1 tiles (8x8), which are defined as 16-bit pointers to allow for unlimited number of tiles. SP1 also allows for 8-bit tile IDs. At program startup, tile IDs corresponding to ASCII characters are defined with the ROM chars, but the others are unused by RAGE1.

A table in your program memory is needed for relating the tile with its address for byte-data, in 16-bit mode. But for 8-bit tiles, there is a 512-byte table reserved in high RAM (a pointer to each tile's 8-byte data). This space is wasted if using 16-bit tile IDs.

If the number of tiles used by a game is sufficiently small, RAGE1 can switch to using only 8-bit tile IDs. This would allow not using the general tile pointer table which RAGE1 currently uses, smaller btile definitions and more room for code. Remember that text characters are also tiles, they need to be taken into account when calculating the number of tiles. If we only use some characters for text (e.g. numbers and capital letters), the remaining tiles can be used for graphics in 8-bit mode.

In 8-bit mode, all structures that contain tile IDs should be adjusted to use the 8-bit format instead of the 16-bit one (for getting savings also from this)

The byte arena for the definition of all 8x8 tiles can still be deduplicated as proposed in #85 for a minimum size representation of the tile data.

The selection of 8-bit or 16-bit tile mode should be done automatically based on the number of tiles used, DATAGEN should take this into account and generate code accordingly.

@jorgegv jorgegv added enhancement New feature or request size optimization labels Oct 10, 2022
@jorgegv jorgegv added this to the Release 0.6.0 milestone Oct 10, 2022
@jorgegv jorgegv self-assigned this Oct 10, 2022
@jorgegv jorgegv modified the milestones: Release 0.6.0, Release 0.7.0 Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size optimization
Projects
None yet
Development

No branches or pull requests

1 participant