Easy Code GoAsm Macros (all project type)


Some useful macros can be used in Easy Code projects (both, visual and classic) by checking the Easy Code macros option in the Project Properties. Their names are colorized as Easy Code reserved words (see Settings menu) and you can use them when you like along the code. These macros, being in the ECMacros.asm file of the Easy Code Macros subfolder, have the following syntax:

Color (byRed, byGreen, byBlue)

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

Example:

Color (0AH, 0BH, 0CH)

Eax returns 000C0B0AH


HiByte (wValue)

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

Example:

HiByte (0C0AH)

Al returns 0CH


HiWord (dwValue)

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

Example:

HiWord (000C000AH)

Ax returns 000CH


LoByte (wValue)

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

Example:

LoByte (0C0AH)

Al returns 0AH


LoWord (dwValue)

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

Example:

LoWord (000C000AH)

Ax returns 000AH


MakeWord (byLow, byHigh)

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

Example:

MakeWord (0CH, 0AH)

Ax returns 0A0CH


MakeLong (wLow, wHigh)

Arguments wLow and wHigh must be 16-bit values (DW). Eax returns the resultant 32-bit value (DD).

Example:

MakeLong (0A0BH, 0C0DH)

Eax returns 0C0D0A0BH


Move (dwValue1, dwValue2)

Arguments dwValue1 and dwValue2 must be a 32-bit (DD) 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 (DD). It loads the Eax register with dwValue and returns from a procedure.

Example:

Return (TRUE)

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


Date (lpszBuf)

Argument lpszBuf must be the effective address of a buffer.

Example:

Date (lpszDate)

The lpszDate buffer will be filled with an ANSI text string having the current date.


Now (lpszBuf)

Argument lpszBuf must be the effective address of a buffer.

Example:

Now (lpszNow)

The lpszNow buffer will be filled with an ANSI text string having the current date and time.


Time (lpszBuf)

Argument lpszBuf must be the effective address of a buffer.

Example:

Time (lpszTime)

The lpszTime buffer will be filled with an ANSI text string having the current time.


Swap (dwValue1, dwValue2)

Arguments dwValue1 and dwValue2 must be 32-bit values.

Example:

Swap (dwValue1, dwValue2)

Exchanges the values of the dwValue1 and dwValue2 variables.


TextStrA ("quoted_text")

Argument "quoted_text" can be any double quoted text.

Example:

TextStrA("Test string")

After that sentence you have the effective address of a temporary null-terminated string in ANSI format. Remeber that the value returned by TextStrA is the effective address, so you should NOT use the Addr operator.


TextStrW ("quoted_text")

Argument "quoted_text" can be any double quoted text.

Example:

TextStrW("Test string")

After that sentence you have the effective address of a temporary null-terminated string in Unicode format. Remeber that the value returned by TextStrW is the effective address, so you should NOT use the Addr operator.


TextStr ("quoted_text")

Argument "quoted_text" can be any double quoted text.

Example:

TextStr("Test string")

After that sentence you have the effective address of a temporary null-terminated string in ANSI or Unicode format, depending on the mode the application is working on. If the Use Unicode strings option in the Project Properties is checked, the returned text will be Unicode. Otherwise it will be ANSI.


TEXT ("string")

Argument "string" must be a quoted string. It returns a string in ANSI or Unicode format.

Example:

Invoke lstrlen, TEXT ("Hello")

Eax returns 5, the length of the string in characters. For ANSI version it means 5 bytes, while for Unicode version it means 5 words (DW).

Remeber that the value returned by TEXT is the effective address of the string, so you should NOT use the Addr operator. On the other hand, the returned value will be in ANSI or Unicode format depending on the Use Unicode text strings option of the Project Properties.


WARNING
: The use of TextStr instead of TEXT is recommended for compatibility with future versions.

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.