The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: hutch-- on July 02, 2005, 11:51:40 AM

Title: extended print macro
Post by: hutch-- on July 02, 2005, 11:51:40 AM
I have been looking for a way to have extended console display without the restrictions of the "print" macro. This is the next attempt with the macro name "cprint". It can be broken across lines, has abbreviated notation for TAB and NEWLINE and accepts the string macros like chr$() and str$().

This is the output from 2 macro calls. The second set of multipline statements are from one macro call.



        Hello World

        This is a test number 1
        of the multiline 'cprint' macro
        using abbreviated notation for
        both 'tab' and 'newline' insertion



[attachment deleted by admin]
Title: Re: extended print macro
Post by: Jimg on July 02, 2005, 02:50:25 PM
     1    
     1       ??001D = argcount(n,n,t,"Hello World",n,n)
F:\WinAsm\Progs\alltemps\CPRINT\CPRINT.ASM(78) : error A2008: syntax error : ,
cprint(38): Macro Called From
  F:\WinAsm\Progs\alltemps\CPRINT\CPRINT.ASM(78): Main Line Code
0000003B  56      1       push esi


is this argcount macro available somewhere?  The only one I can find is ArgCount in windows.inc

Later.........

I found it!  Hidden the the quick call routine you posted earlier :naughty:
Title: Re: extended print macro
Post by: hutch-- on July 02, 2005, 04:00:19 PM
Jim,

Sorry about that, my excuse is senile decay.  :bg

I have reposted the example with the argcount macro in it.
Title: Re: extended print macro
Post by: Jimg on July 02, 2005, 11:33:08 PM
I think you should call it printx for print extended :toothy

Is there some way to make something like-

cprint   t,ucase$("this is a test"),n

work?

So far I like it. 
Title: Re: extended print macro
Post by: hutch-- on July 03, 2005, 02:08:51 AM
Jim,

Currently its a limitation of the INVOKE syntax that I used for the szMultiCat call. The number to string conversions return an offset in the data? section where the normal string macros return the result in EAX.

I think it possible using a macro that automates the argument list as each argument is pushed as it is converted which solves the problem of argument overwrites.

LATER :

Mutter etc .... the macro parser evaluates the string procedire first instead of being done in order so I can get it to build with a string macro but it does not work as EAX gets overwritten.
Title: Re: extended print macro
Post by: hutch-- on July 03, 2005, 01:08:13 PM
Here is the second version which is larger and a lot more complicated but the only gain is it reports an argument that cannot be used and halts the build. I don't think it has any real advantage over the first one.

[attachment deleted by admin]
Title: Re: extended print macro
Post by: Rifleman on July 03, 2005, 11:23:56 PM
C print, C prtint run, run print run...

I remember something like that, more senile decay.
Paul
Title: Re: extended print macro
Post by: cookj on August 14, 2007, 03:29:35 PM
Hey Hutch:
I have been testing your cprint macro and I really like it.  Your original documentation said that it
accepts chr$() and str$ macros.

I can not seem to get that to work.

When you have time could you post a short example of using them with cprintf?

Thanks

cookj

--------------------------------------------------------------------------------
"I have been looking for a way to have extended console display without the restrictions of the "print" macro. This is the next attempt with the macro name "cprint". It can be broken across lines, has abbreviated notation for TAB and NEWLINE and accepts the string macros like chr$() and str$()."

.