Hey.
i jsut started programing in masm, checking out the icezilions tuts and all, but i have a problem.
i need a variable that is of int/double/float type.
how do i declrea that?
i mean wht are the keywordas for that?
thx
Posted on 2004-08-27 11:02:51 by ReVeR
check your masm.hlp file and look for types.
Posted on 2004-08-27 11:22:18 by JimmyClif
ASM has those data types by default:
==============================
byte is equivalent to char
word is equivalend to short int (not much used)
dword is equivalent to int or dword
real4 is equivqlent to float
real10 is equivalent to double

declaring initialized variables is like this

my_bytes db 0,1,2,3

my_words dw 345,567,1234

my_dwords dd 134567890, 74635,6543263,1,1

my_float real4 1.3456

my_double real10 0.001234576

declaring an vetcor uninitialized:

my_many_dwords dd 4096 dup(?)

of course you can add your own types and structures

MY_DATA_TYPE STRUC
my_x dd ?
my_y dd ?
my_z dd ?
ENDS

and then it is automatically promoted to a typedef unlike C/c++ :P)

but you can also say:
my_new_data_type typedef MY_DATA_STRUCTURE

if you want more strict typecheckings in MASM

my_struct_item MY_DATA_TYPE <?>
or
my_struct_item MY_DATA_TYPE <1,3,5>
or
my_struct_array MY_DATA_TYPE 1200 dup(<?>)

and then you can access members like in:

mov eax,

and RadASM will add intelisense and code colapsing to above ;)

Keep in mind that i am usually TASM oriented so for MASM there might be some minor syntax differences ... :D

data declaration for local variables insides PROCEDURES is for another time but pretty similar
Posted on 2004-08-27 12:42:26 by BogdanOntanu
Note Microsofts C Compiler treats double and long double as REAL8. If using OpenGL a GLDouble will be equivilant to REAL8 also.
Posted on 2004-08-27 14:22:19 by Eóin
Bogdan, doubles are REAL8, REAL10 is "extended" ("long double" on C compilers that supports it, MSVC++ doesn't anymore)
Posted on 2004-08-29 12:47:31 by f0dder