News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Are pointers really needed in SmplMath?

Started by HSE, June 28, 2015, 07:31:15 AM

Previous topic - Next topic

HSE

Hi! (or perhaps I would say: Hi qWord)

SmplMath is working pretty well, and is very easy to translate from Java.

The way I found requiere pointers in the expressions:



        fSlv8R equ  fSlv8 REAL8 ptr
r8r equ REAL8 ptr

fSlv8R VTsFe = (r8r ts1*exp( r8r [esi].ewl/r8r [esi].ebwm)/1000.0)*(r8r WlTs+r8r WlCytF)

                                    ;[esi].xxx are variables inside objects, others are locals
                                    ; the ecuation is part of a OOP method



But the examples in the package don't need pointers. What I'm missing?

Thanks. HSE

Equations in Assembly: SmplMath

qWord

Expressions of the form Type ptr ... are typecasts. As long as (e.g.) [esi].ewl does have an arithmetic type, no typecast is needed (so inside the structure or union declaration the field ewl  should be declared as real or signed integer type).

Also you should stay away from above usage of EQU and use TEXTEQU instead**, because without angle brackets MASM expects a numeric expression for EQU. (Even if seems like that MASM accepts nearly everything right from EQU, except broken numerical literals)

** if you use TEXTEQUs with the macros, you must prefix them with the expansion operator %.

MREAL macros - when you need floating point arithmetic while assembling!

HSE

So obvious!!! :icon_redface:

All the variables are declared as "qword" (ja, ja, excuseme the use of your name), because there is no diference for FPU instruccions.

After writing I was thinking that the "ptr thing" have a diferent name, I will remember from now on.

I expected even some error using EQU, but work. Very good explanation, macros is all a subject.

Thanks so much. HSE
Equations in Assembly: SmplMath