trace macro What1:REQ,What2:VARARG
ifndef trace_buffer1
.data?
trace_buffer1 db 400 dup (?)
.code
endif
invoke wsprintf,addr trace_buffer1,CTEXT(What1),What2
invoke OutputConsole, addr trace_buffer1

endm


Hi, I was wondering what CTEXT is ?, because everytime I try and compile it it says:

T2612.asm(86) : error A2006: undefined symbol : CTEXT
trace(6): Macro Called From
Posted on 2004-07-22 17:36:23 by x86asm
ooo.. oo.... lemme answer..

it's a macro which lets you code a little more readable code, such as this:

invoke LoadBANK,CTEXT("mchip1.bmp"),layer0,12,32,1 ;800,600 sized bitmap

instead of:

szText filename,"mchip1.bmp",0
invoke LoadBANK,ADDR filename,layer0,12,32,1

or even..

.data
filename db "mchip1.bmp",0

.code
invoke LoadBANK,ADDR filename,layer0,12,32,1


here is the macro, created by some brilliant person on here..



CTEXT MACRO y:VARARG
LOCAL sym, dummy
dummy EQU $ ;; MASM error fix
CONST segment
IFIDNI <y>,<>
sym db 0
ELSE
sym db y,0
ENDIF
CONST ends
EXITM <OFFSET sym>
ENDM
Posted on 2004-07-22 17:49:56 by drarem

ooo.. oo.... lemme answer..

it's a macro which lets you code a little more readable code, such as this:

invoke LoadBANK,CTEXT("mchip1.bmp"),layer0,12,32,1 ;800,600 sized bitmap

instead of:

szText filename,"mchip1.bmp",0
invoke LoadBANK,ADDR filename,layer0,12,32,1

or even..

.data
filename db "mchip1.bmp",0

.code
invoke LoadBANK,ADDR filename,layer0,12,32,1


here is the macro, created by some brilliant person on here..



CTEXT MACRO y:VARARG
LOCAL sym, dummy
dummy EQU $ ;; MASM error fix
CONST segment
IFIDNI <y>,<>
sym db 0
ELSE
sym db y,0
ENDIF
CONST ends
EXITM <OFFSET sym>
ENDM


Thanks a lot just what I was looking for!
Posted on 2004-07-22 17:52:19 by x86asm
I reciently elaborated on this concept by providing an alternate invoke that handles strings like a HLL would. Check it out if your interested in this stuff.

http://www.asmcommunity.net/board/index.php?topic=18472&highlight=%40invoke

Regards,
:NaN:
Posted on 2004-07-22 19:59:09 by NaN
Also try my string macros. The advantage is that they more flexible and have "eliminate duplicate strings" feature. Read description and examples at the beginning of strings.mac itself.
Posted on 2004-07-23 07:28:48 by Four-F
Also, Hutch's fn macro enables the direct use of quoted strings:


.386
.model flat, stdcall
option casemap:none
include masm32includewindows.inc
include masm32includekernel32.inc
include masm32includeuser32.inc
includelib masm32libuser32.lib
includelib masm32libkernel32.lib

reparg MACRO arg
LOCAL nustr
quot SUBSTR <arg>,1,1
IFIDN quot,<"> ;; if 1st char = "
.data
nustr db arg,0 ;; write arg to .DATA section
.code
EXITM <ADDR nustr> ;; append name to ADDR operator
ELSE
EXITM <arg> ;; else return arg
ENDIF
ENDM

fn MACRO args:VARARG
LOCAL cnt
cnt = 0
arg equ <>
FOR var,<args>
arg CATSTR arg,<var> ;; get the proc name as 1st arg
EXITM
ENDM
FOR var,<args>
IF cnt gt 0
arg CATSTR arg,<,reparg(var)> ;; replace quotes and append arg
ENDIF
cnt = cnt + 1
ENDM
invoke arg
ENDM

.code
start:
fn MessageBox, NULL,"Win32 Assembly is Great!","Iczelion's tutorial no.2" , MB_OK
invoke ExitProcess,NULL
end start
Posted on 2004-07-23 11:43:17 by Vortex