Convert numbers to C64 floating point compact form?
Posted: Mon Jan 24, 2011 5:41 am
Hi all,
for some fun, I am attempting to make a 'compiler' that compiles a high-level language similar to Pascal (Delphi) into C64 assembly code, and I have some number questions if I may
I need some code (C/C++/Pascal, whatever) that can convert a number, either an integer (4, 2, -5) or floating point (-1.5, 0.3E-10, etc.) into the compact memory form that the C64 floating point routines can use.
In other words, I want to change this for example:
into
so the C64 can do maths on this number using it's built-in floating point routines...
Any ideas?
I have looked up how the C64 floating point maths stuff works, but I am totally confused
cheers,
Paul
for some fun, I am attempting to make a 'compiler' that compiles a high-level language similar to Pascal (Delphi) into C64 assembly code, and I have some number questions if I may
I need some code (C/C++/Pascal, whatever) that can convert a number, either an integer (4, 2, -5) or floating point (-1.5, 0.3E-10, etc.) into the compact memory form that the C64 floating point routines can use.
In other words, I want to change this for example:
Code: Select all
const
a = -1.5; //floating point number
b = 3; //integer numberCode: Select all
const_a
.byte <a as some hex digits in C64 fp compact format>
const_b
.byte <b as some hex digits in C64 fp compact format>Any ideas?
I have looked up how the C64 floating point maths stuff works, but I am totally confused
cheers,
Paul