# 3D gamers floating point for z80

Page 2/3
1 | | 3

I too one day wondered "why no log".
the answer was: "because the reverse lookuptable to go back to normal numbers got to be gigantic"

but maybe there is a chance of doing it in floating point!?
a table of 256 entries is indexed by the 8bit mantissa.
the table output is a float (8bit mantissa, 8bit exponent)
and then maybe to this output exponent one got to add the exponent of the input.

but. 3D rotations need 9 multiply and add for every dot of the ship.
maybe in the end one needs one big integer lookup table for this purpose, and not much else.

Cool demo! What are your future plans on this?

Also, if the goal is to accelerate 3D rotations, there are ways to make this much faster than with 9 multiplications. See for example: https://www.catalase.com/optrot3d.htm (although that is thought for a 68k processor, maybe optimizations would work different for a Z80)

well. what runs my head is another marathon project
the game that I dream of after playing MSX elite
the whole thing without the frustration. be it low framerate or be it that the game is cheating.

hit9918 wrote:

it is nice that is suspected screen 5 hardware lines, but it is msx1 screen 2.

Why do not try to make a screen 5 version with vdp line commands and backbuffer (page swap)?
you can use the additional time to calculate others point.
screen 5 lines are a lot faster than screen2 ones, drawed by CPU with a lot of calculations and slow VDP I/O vram addressing (even if you draw in a back buffer)

yes. I expect the MSX2 lines to be very fast.

Do you want to use a smaller log table?

iterate this simple identity:

log(x/2) + log2 = logx

untill x/2 doesn't fall in the range of your log() table.

Naturally log2=1

Put in a table log(x) with x in [1,2] where you have values in [0,1]

To compute values outside the interval use the above formula iteratively to shift the x in range of your table
If x>2 use
log(x/2) + log2 = logx
If x<1 use
log(2*x)-log(2) = logx

but what about the inverse table. how much size is the inverse table
the output of the log table needs above 8bit to keep accuracy.

I thought that maybe in the end one needs to spend all memory on a table specificaly to rotate the ships graphics
because there is the masses of ops, a dozen dots and each 9 multiply

Page 2/3
1 | | 3
My MSX profile