Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
For those interested I ported 8.8 Fixed-Point Numbers (signed) using GBDK2020:
https://github.com/sttng/gb-stuff/blob/ … fixed8x8.c
8.8 fixed point numbers use 16bit. Basically there are 8bits for the whole (integer) part of the number, and another 8bit for the fractional (decimal) part. For example in 8.8 fixed point type the number:
2.5 ("two and half"), is encoded as
'2' 'half'
00000010.10000000
Using two's complement encoding for the whole part we get a range from -128 to +127. For the decimal part we have 0.00390625 (1/256) as the tiniest fraction.
There are a couple of "helper" functions included:
- Absolute Value
- Fixed Point Multiplication
- Fixed Point Division
- Fixed Point Module
- Fixed Point to String
Last edited by M2m (2021-04-01 02:22:28)
Offline