# 3D gamers floating point for z80

Page 1/3
| 2 | 3

webmsx demo
can you see the demo?
The dream of a certain game in a playable framerate :D

it is using superfast floating point with 8bit mantissa :D
why floating point. say the window is 2 meters wide. 256 pixels are 2 meters. then 16bit make a universe of 512 meters size lol.
the code is here

and when coding it I felt like the z80 was MADE for maths
there is not the usual register allocation pain because every register got the same shift instructions

I bow to your great asm and math skills, sir!
actually, the great speed

Thanks! Another thing is that there is not the elite fisheye look, it is normal 3D.
I dream of the whole thing more pleasant and playable.

Looks neat!

What’s the advantage of floating point over fixed point?

screen mode?

Hello, floating point or fixed point?

I would say sc5 using the line command.

About floating point / fixed point... MSX-BASIC uses 10base floating point numbers -> It is horribly slow. MSX-BASIC kun compiler uses 2base floating point numbers ->That is a lot better, but still... since you know the scale you are working, fixed point math should be a lot faster to use.

it is nice that is suspected screen 5 hardware lines, but it is msx1 screen 2. and floaing point
the lines are drawn in RAM and the copy to vram uses the VDP delay time to CLS the RAM buffer.

Quote:

What’s the advantage of floating point over fixed point?

that floating point is faster
the graphics get away with a 8bit * 8bit -> 8bit mul and 8bit / 8bit -> 8bit div!
look how the fdiv function goes with 8bit ADD and SUB. and has only 8 iterations.
while fixpoint got to be some 16bit * 16bit -> 24bit mul.

so in a 2D game fixpoint is better, but a 3D game is a different thing. in 3D you need mul as often as add.

There's no speed benefit to multiply though isn't there? Shifting by an arbitrary amount is faster though.

To speed up multiply, could work in a logarithmic scale .

Grauw wrote:

To speed up multiply, could work in a logarithmic scale .

Yep, I was thinking the same thing.
But then you lose speed on addition and substraction ...

Page 1/3
| 2 | 3