Easy Code Masm macros (All Project Type)


Some useful macros are included internally in Easy Code. Their names are colorized as Easy Code reserved words (see Settings menu). As they are built-in, you can use them when you like along the code.These macros have the following syntax:

Color byRed, byGreen, byBlue

Arguments byRed, byGreen, byBlue must be 8-bit values (Byte). Eax returns an RGB color (a 32-bit value or COLORREF).

Example:

Color 0AH, 0BH, 0CH

Eax returns 000C0B0AH


HiByte wValue

Argument wValue must be a 16-bit value (Word). Al returns the high byte (8-bit value or Byte) of wValue.

Example:

HiByte 0C0AH

Al returns 0CH


HiWord dwValue

Argument dwValue must be a 32-bit value (DWord). Ax returns the high word (16-bit value or Word) of dwValue.

Example:

HiWord 000C000AH

Ax returns 000CH


LoByte wValue

Argument wValue must be a 16-bit value (Word). Al returns the low byte (8-bit value or Byte) of wValue.

Example:

LoByte 0C0AH

Al returns 0AH


LoWord dwValue

Argument dwValue must be a 32-bit value (DWord). Ax returns the low word (16-bit value or Word) of dwValue.

Example:

LoWord 000C000AH

Ax returns 000AH


MakeWord byLow, byHigh

Arguments byLow and byHigh must be 8-bit values (Byte). Ax returns the resultant 16-bit value (Word).

Example:

MakeWord 0CH, 0AH

Ax returns 0A0CH


MakeLong wLow, wHigh

Arguments wLow and wHigh must be 16-bit values (Word). Eax returns the resultant 32-bit value (DWord or LONG).

Example:

MakeLong 0A0BH, 0C0DH

Eax returns 0C0D0A0BH


Move dwValue1, dwValue2

Arguments dwValue1 and dwValue2 must be a 32-bit (DWord) variable or memory position.

Example:

Move dwMemPos1, dwMemPos2

Moves the value in variable or memory position specified by dwMemPos2 to variable or memory position specified by dwMemPos1.

This macro does not return a value.


Return dwValue

Argument dwValue must be a 32-bit value (DWord). It loads the Eax register with dwValue and returns from a procedure.

Example:

Return TRUE

Loads the Eax register with TRUE (1) and returns.


Text Name, "quoted_text"

Argument Name must be any valid name identifying the string specified by the second argument, "quoted_text", which can be any double quoted text.

Example:

Text szBuffer, "Test string"

After that sentence you have a temporary buffer with the specified string (null-terminated). Remeber that the value returned by Text is NOT the effective address of the string, so you should use the Addr operator in order to get it. For example:

Text, szTest, "Test string"

Invoke lstrlen, Addr szTest

Eax returns 11 (the length of the string)


TextW Name, "quoted_text"

Argument Name must be any valid name identifying the string specified by the second argument, "quoted_text", which can be any double quoted text.

Example:

TextW szBufferW, "Test string"

After that sentence you have a buffer with the specified string (null-terminated) in Unicode format. Remeber that the value returned by TextW is NOT the effective address of the string, so you should use the Addr operator in order to get it. For example:

TextW, szTestW, "Test string"

Invoke lstrlenW, Addr szTestW

Eax returns 11 (the length of the string)

(Programmed by Héctor A. Medina)


TextAddr ("quoted_text")

Argument "quoted_text" can be any double quoted text.

Example:

TextAddr("Test string")

After that sentence you have the effective address of a temporary null-terminated string. You can use it to pass it as an argument to any routine or API call. Remeber that the value returned by TextAddr is the effective address, so you should NOT use the Addr operator. For example:

Invoke lstrlen, TextAddr("Test string")

Eax returns 11 (the length of the string)


TextAddrW ("quoted_text")

Argument "quoted_text" can be any double quoted text.

Example:

TextAddrW("Test string")

After that sentence you have the effective address of a temporary null-terminated string in Unicode format. You can use it to pass it as an argument to any Unicode routine or API call. Remeber that the value returned by TextAddrW is the effective address, so you should NOT use the Addr operator. For example:

Invoke lstrlenW, TextAddrW("Test string")

Eax returns 11 (the length, in characters, of the string)

(Programmed by Héctor A. Medina)



REMARKS
: Note that no final NULL character is needed, as it is already added internally by Text, TextW, TextAddr and TextAddrW macros.

IMPORTANT: If you are not going to use any of these macros (included by default), or their names conflict with any variable, procedure o macro name of the project, you just can remove them by unchecking the corresponding option in Project Properties

.