is there anyway i can check and see what kind of data is it? for example:
how can i tell if width is dword, or byte? or even real4,8,10? is this possible with macro? what about procedure?
disease macro width, height ;codec... disease endm
how can i check the data type of width inside a proc? NOTE: I don't want to check the data type at runtime, i want to check it at COMPILE TIME. one last question:
disease proc width, height ;codec... disease endm
(real8) <--- is a typecast. what i want to know is: is it necessary in asm? and how do i create such proc with typecast in masm??
in C for example: disease(0, (real8)width, (real8)height);
This is really one of the problems I have with MASM - the line length limit is the other biggie. You can't check the type of data that is passed. If you have the MASM documentation: read chapter 9! I've thought of a way to accomplish more with macros, but it would mean passing the type as part of the parameter - something like:
. But that really isn't practical - I'd rather rewrite MASM. ;)
From Chapter 9: A macro can use OPATTR to determine if an argument is a constant, a register, or a memory operand. With this information, the macro can conditionally generate the most efficient code depending on argument type.This message was edited by bitRAKE, on 7/2/2001 12:08:49 AM
Bit Set If expression ----- ------------------- 0 References a code label 1 Is a memory variable or has a relocatable data label 2 Is an immediate value 3 Uses direct memory addressing 4 Is a register value 5 References no undefined symbols and is without error 6 Is relative to SS 7 References an external label 8–10 Has the following language type: 000 — No language type 001 — C 010 — SYSCALL 011 — STDCALL 100 — Pascal 101 — FORTRAN 110 — Basic
Try the SIZEOF macro instruction
You can add suitable tests on the macro arguments to determine the arg type and take whatever action.
a1 BYTE 0 a2 WORD 0 a3 DWORD 0 a4 REAL8 0 (SIZEOF a1) is 1 (SIZEOF a2) is 2 (SIZEOF a3) is 4 (SIZEOF a4) is 8
alot of thank for both of you guy reply. that answered my question.