Return MACRO arg
	Mov Eax, arg
	Ret
ENDM

HiByte MACRO arg
	Mov Ax, arg
	Shr Ax, 8
ENDM

LoByte MACRO arg
	Mov Ax, arg
	And Ax, 00FFh
ENDM

HiWord MACRO arg
	Mov Eax, arg
	Shr Eax, 16
ENDM

LoWord MACRO arg
	Mov Eax, arg
	And Eax, 0000FFFFH
ENDM

MakeWord MACRO byLow, byHigh
	Push Cx
	Mov Cl, byLow
	Mov Ah, byHigh
	Mov Al, Cl
	Pop Cx
ENDM

MakeLong MACRO wLow, wHigh
	Push Word Ptr wLow
	Mov Ax, wHigh
	Shl Eax, 16
	Pop Ax
ENDM

Color MACRO byRed, byGreen, byBlue
    Xor Eax, Eax
    Mov Ah, byBlue
    Mov Al, byGreen
    Shl Eax,8
    Mov Al, byRed
ENDM

TextAddr MACRO quoted_text:VARARG
    LOCAL ECvname
.Data
    ECvname DB quoted_text,0
.Code
    EXITM <Offset ECvname>
ENDM

;=====================================
; == Programmed by Héctor A. Medina ==
;=====================================
TextAddrW MACRO quoted_text:VarArg
	Local ECvnameW
	Local cnt,comilla
	Local arg

	strsinpar equ <>
	DWdef  equ <>
	cnt=0
	comilla=0

.Data
	Align 4
.Code

    DWdef CATSTR <ECvnameW DW  >

	FOR strsinpar,<quoted_text>
		;%FORC arg,<strsinpar>
		ForC arg, <strsinpar>
			IFDIF <arg>,<">
				IF cnt GT 30
					cnt=0 
.Data
					DWdef
					DWdef TEXTEQU < DW >
.Code   
				ENDIF
				cnt=cnt+1
				IF cnt NE 1
	    	       DWdef CATSTR DWdef,<,>
				ENDIF
				IF comilla EQ 1
					DWdef CATSTR DWdef,<">,<arg>,<">
				ELSEIF comilla EQ 0
					DWdef CATSTR DWdef,<strsinpar>
					EXITM
				ENDIF 
			ELSE
				IF comilla EQ 0
					comilla=comilla+1
				ELSE
					comilla=comilla-1
				ENDIF
			ENDIF
		ENDM
	ENDM
	IF cnt NE 0
		DWdef CATSTR DWdef,<,00>
	ELSE
		DWdef CATSTR DWdef,<00>
	ENDIF

.Data
	DWdef
.Code
	ExitM <Offset ECvnameW>
ENDM

Text MACRO Name, szstrText:VARARG
	LOCAL ECLabel1
	Jmp ECLabel1
	Name db szstrText,0
ECLabel1:
ENDM

;=====================================
; == Programmed by Héctor A. Medina ==
;=====================================
TextW MACRO Name, quoted_text:VarArg
	LOCAL cnt,comilla,arg
	LOCAL ECLabel1

	strsinpar equ <>
	DWdef  equ <>
	cnt=0
	comilla=0

	Jmp ECLabel1
	Align 4
	DWdef TEXTEQU <Name  DW >
                      
	FOR strsinpar,<quoted_text>
		;%FORC arg,<strsinpar>
		FORC arg,<strsinpar>
			IFDIF <arg>,<">
				IF cnt GT 30
					cnt=0 
					DWdef
					DWdef TEXTEQU < DW >
				ENDIF
				cnt=cnt+1
				IF cnt NE 1
					DWdef CATSTR DWdef,<,>
				ENDIF
				IF comilla EQ 1
					DWdef CATSTR DWdef,<">,<arg>,<">
				ELSEIF comilla EQ 0
					DWdef CATSTR DWdef,<strsinpar>
					EXITM
				ENDIF 
			ELSE
				IF comilla EQ 0
					comilla=comilla+1
				ELSE
					comilla=comilla-1
				ENDIF
			ENDIF
		ENDM
	ENDM
	IF cnt NE 0
		DWdef CATSTR DWdef,<,00>
	ELSE
		DWdef CATSTR DWdef,<00>
	ENDIF

	DWdef
ECLabel1:

ENDM

TextStrA MACRO quoted_text:VARARG
    LOCAL ECTextStrA
.Data
    ECTextStrA DB quoted_text,0
.Code
    EXITM <Offset ECTextStrA>
ENDM

TextStrW MACRO quoted_text:VARARG
	ECTextStrW Equ <>
	ECTextStrW CatStr  <TextAddrW>, <(>, <quoted_text>, <)>
	ExitM <ECTextStrW>
ENDM

TextStr MACRO quoted_text:VARARG
	ECTextStr Equ <>
	IFDEF APP_UNICODE
		ECTextStr CatStr  <TextAddrW>, <(>, <quoted_text>, <)>
	ELSE
		ECTextStr CatStr  <TextAddr>, <(>, <quoted_text>, <)>
	ENDIF
	ExitM <ECTextStr>
ENDM

TextAddrA MACRO quoted_text:VARARG
	ECTextAddrA Equ <>
	ECTextAddrA CatStr  <TextAddr>, <(>, <quoted_text>, <)>
	ExitM <ECTextAddrA>
ENDM

TextA MACRO quoted_text:VARARG
	LOCAL ECLabel1
	Jmp ECLabel1
	Name db szstrText,0
ECLabel1:
ENDM

Move MACRO dwValue1, dwValue2
	Push dwValue2
	Pop dwValue1
ENDM

Date MACRO szStrPtr
	Push Esi
	Push Edi
	Invoke GlobalAlloc, GPTR, MAX_PATH
	Mov Esi, Eax
	Invoke GetSystemTime, Esi
	Mov Edi, Esi
	Add Edi, 64
	Invoke GetDateFormat, LOCALE_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, Esi, NULL, Edi, MAX_PATH - 65
	Invoke lstrcpy, szStrPtr, Edi
	Invoke GlobalFree, Esi
	Pop Edi
	Pop Esi
ENDM

Now MACRO szStrPtr
	Push Esi
	Push Edi
	Invoke GlobalAlloc, GPTR, MAX_PATH
	Mov Esi, Eax
	Invoke GetSystemTime, Esi
	Mov Edi, Esi
	Add Edi, 64
	Invoke GetDateFormat, LOCALE_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, Esi, NULL, Edi, MAX_PATH - 65
	Invoke lstrcpy, szStrPtr, Edi
	Invoke lstrcat, szStrPtr, TextStr(" - ")
	Invoke GetTimeFormat, LOCALE_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, Esi, NULL, Edi, MAX_PATH - 65
	Invoke lstrcat, szStrPtr, Edi
	Invoke GlobalFree, Esi
	Pop Edi
	Pop Esi
ENDM

Time MACRO szStrPtr
	Push Esi
	Push Edi
	Invoke GlobalAlloc, GPTR, MAX_PATH
	Mov Esi, Eax
	Invoke GetSystemTime, Esi
	Mov Edi, Esi
	Add Edi, 64
	Invoke GetTimeFormat, LOCALE_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, Esi, NULL, Edi, MAX_PATH - 65
	Invoke lstrcpy, szStrPtr, Edi
	Invoke GlobalFree, Esi
	Pop Edi
	Pop Esi
ENDM

MultiCat MACRO lpszDesPtr:Req, lpszOrgPtr:VarArg
	Local prm

	FOR prm, <lpszOrgPtr>
		IFNB <prm>
			Invoke lstrcat, lpszDesPtr, prm
		ELSE
			ExitM
		ENDIF
	ENDM
ENDM

Swap MACRO dwValue1, dwValue2
	Push dwValue1
	Push dwValue2
	Pop dwValue1
	Pop dwValue2
ENDM

return  equ <Return>
RETURN  equ <Return>

hibyte  equ <HiByte>
HIBYTE  equ <HiByte>

lobyte  equ <LoByte>
LOBYTE  equ <LoByte>

hiword  equ <HiWord>
HIWORD  equ <HiWord>

loword  equ <LoWord>
LOWORD  equ <LoWord>

makeword    equ <MakeWord>
MAKEWORD    equ <MakeWord>

makelong    equ <MakeLong>
Makelong    equ <MakeLong>
MAKELONG    equ <MakeLong>

color   equ <Color>
COLOR   equ <Color>

move    equ <Move>
MOVE    equ <Move>

multicat	equ <MultiCat>
MULTICAT	equ <MultiCat>

swap    equ <Swap>
SWAP    equ <Swap>
