News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

extended print macro

Started by hutch--, July 02, 2005, 11:51:40 AM

Previous topic - Next topic

hutch--

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]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jimg

     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:

hutch--

Jim,

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

I have reposted the example with the argcount macro in it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jimg

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. 

hutch--

#4
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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

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]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Rifleman

C print, C prtint run, run print run...

I remember something like that, more senile decay.
Paul

cookj

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$()."

.