jabr / 0x10c

DCPU-16 assembly experiments for 0x10c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integration with WIP cubeOS

alexander-bauer opened this issue · comments

(This would probably be better off as a wiki post, but I'm presenting it here.)

I'm in the process of building a DCPU-16 operating system with a highly scientific focus, cubeOS. It's still a work in progress, but I believe it would greatly benefit from including this math library (once ported to assembly) in its kernal. I would also be happy to assist in porting the library to assembly. Is there any chance we could start a partnership?

Yes, I'm definitely happy to work together. The whole point of my reddit post was to get people working together on one fast, powerful math library

I have the start of the dasm implementation in the repo now. I've implemented arithmetic and sqrt. But before continuing with the CORDIC routines, I'm going to change the internal floating point format and reimplement arithmetic.

Using signed integers was working great at first, but I hit two limitations that made everything much less efficient: normalization with 2's complement negatives uses temporary negation, and the lack of hardware signed add/sub requires manual over/underflow processing. Normalization would be manageable, but I doubt notch will add ADI/SBI instructions.

So I'm going to change the format to use an unsigned mantissa word and a bit-packed sign, exception, and unsigned exponent with basis word. The upside is we'll get another bit of precision, as well as faster arithmetic.

But if you want, you can start implementing higher level functions based on the current arithmetic functions as long as they make no assumptions on the internal format. For example, the only change to my current sqrt with the new internal format will be to the "divide by 2" optimization.