Binarus
2014-02-27 19:27:30 UTC
Hi all,
I am currently porting some C code to assembly (using JWasm) for performance optimization. The C code makes excessive use of (preprocessor) code like that:
Header file:
#define A 1.0
#define B 2.0
#define C (B-A)
C file:
Test = sin(2.0 + C)
The OpenWatcom C compiler (target DOS) puts these constants just into the text segment (they are in the code segment at runtime).
When trying to port that code to assembly, I have done the following:
Assembly file:
A EQU 1.0
B EQU 2.0
C QWORD (B-A)
But this did not work. It seems that JWasm just inserts all zeros at the place in memory where the constant C (i.e. the binary representation of 1.0) should be.
Probably I didn't understand properly how to use EQU (it seems that some assemblers can do calculations with symbols which have been created using EQU, while others treat the right part always as string, i.e. the symbol A would represent the string "1.0" in the above example).
On the other hand, I didn't get any warning or error message when assembling the code. So how exactly can I do simple calculations (double precision) with symbols?
I hope that my problem description was not too worrying.
Thank you very much for any help,
Binarus
I am currently porting some C code to assembly (using JWasm) for performance optimization. The C code makes excessive use of (preprocessor) code like that:
Header file:
#define A 1.0
#define B 2.0
#define C (B-A)
C file:
Test = sin(2.0 + C)
The OpenWatcom C compiler (target DOS) puts these constants just into the text segment (they are in the code segment at runtime).
When trying to port that code to assembly, I have done the following:
Assembly file:
A EQU 1.0
B EQU 2.0
C QWORD (B-A)
But this did not work. It seems that JWasm just inserts all zeros at the place in memory where the constant C (i.e. the binary representation of 1.0) should be.
Probably I didn't understand properly how to use EQU (it seems that some assemblers can do calculations with symbols which have been created using EQU, while others treat the right part always as string, i.e. the symbol A would represent the string "1.0" in the above example).
On the other hand, I didn't get any warning or error message when assembling the code. So how exactly can I do simple calculations (double precision) with symbols?
I hope that my problem description was not too worrying.
Thank you very much for any help,
Binarus