Board index » off-topic » A cosmetic macro problem - ASCII to double-byte

A cosmetic macro problem - ASCII to double-byte


2008-03-20 07:05:54 AM
off-topic14
Hello All,
As TASM v5.0 does not seem to understand that I would like to
use/generate a double-byte string I had no other option than to try to write
a macro for it. :-)
I found that 'irpc' would do what I wanted, and did than procede to wrap it
in a macro :
wStr macro text
irpc char, <text>
dw '&char'
endm
dw 0
endm
Although the result worked fine I noticed it would generate long lists of
lines all containing a single DW statement and a letter. So I searched for
a method which would generate, in the .LST file, a more compact solution.
And I found one :
wStr macro text
@@result equ
irpc char, <text>
@@result equ @@result '&char',
endm
@@result equ @@result 0
dw @@result
endm
But alas, its resulting output shows a macro-local(?) label instead of the
string it actually contains (as can be seen by the generated result)
87 wStr <this is a test>
1 88 00000607 0074 0068 0069 0073 + dw @@result
89 0020 0069 0073 0020 +
90 0061 0020 0074 0065 +
91 0073 0074 0000
Is there a possibility to have that "@@result" replaced by the actual string
('t','h','i','s', ... ,0) ?
Regards,
Rudy Wieser
P.s.
I allready tried to use "catstr", but all I got was "missing text macro"
errors.
P.p.s.
Is that "@@result" variable actually local to the macro, and if not can I
make it local ?
 
 

Re:A cosmetic macro problem - ASCII to double-byte

Hi Rudy,
[...]
Quote
Is there a possibility to have that "@@result" replaced by the actual
string ('t','h','i','s', ... ,0) ?
% dw @@result
[...]
Quote
Is that "@@result" variable actually local to the macro, and if not can I
make it local ?
wStr macro ...
local @@result
...
 

Re:A cosmetic macro problem - ASCII to double-byte

Vasya Pupkin < XXXX@XXXXX.COM >schreef in berichtnieuws
47e1f109$ XXXX@XXXXX.COM ...
Quote
Hi Rudy,
Hello Vasya,
Quote
[...]
>Is there a possibility to have that "@@result" replaced by
>the actual string ('t','h','i','s', ... ,0) ?

% dw @@result
Alas, Tasm v5.0 seems to ignore that % directive there (no error-message,
but not change in the .LST file either)
Quote
[...]
>Is that "@@result" variable actually local to the macro, and if not can
I
>make it local ?

wStr macro ...
local @@result
...
I knew I could create local variables, but was not aware I could use them in
a non-(code-)label way.
Thanks,
Rudy Wieser
 

{smallsort}

Re:A cosmetic macro problem - ASCII to double-byte

Hi Rudy,
[...]
Quote
>% dw @@result

Alas, Tasm v5.0 seems to ignore that % directive there (no error-message,
but not change in the .LST file either)
Turbo Assembler Version 5.0 Copyright (c) 1988, 1996 Borland International
1). without %:
...
25 wStr the
1 26 00000020 0074 0068 0065 0000 dw @@result
...
2). with %:
...
25 wStr the
2 26 00000020 0074 0068 0065 0000 dw 't', 'h', 'e', 0
...
???
 

Re:A cosmetic macro problem - ASCII to double-byte

Vasya Pupkin < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...
Quote
Hi Rudy,

[...]
>>% dw @@result
>
>Alas, Tasm v5.0 seems to ignore that % directive there (no
error-message,
>but not change in the .LST file either)

Turbo Assembler Version 5.0 Copyright (c) 1988, 1996 Borland
International
Yep, thats the same header I get.
Quote
1). without % :
[snip]
I just re-tried it (just to be sure), but that '%' gets ignored :
541 wStr <Debuging Window>;Caption
2 542 00000618 0044 0065 0062 0075 + dw @@0000
543 0067 0069 006E 0067 +
544 0020 0057 0069 006E +
545 0064 006F 0077 0000
546 00000638 0008 dw 8 ;Font
547 wStr <MS Sans Serif>
2 548 0000063A 004D 0053 0020 0053 + dw @@0001
549 0061 006E 0073 0020 +
550 0053 0065 0072 0069 +
551 0066 0000
So, a big ??? for me too.
Do you know of anything that can have an influcence the working of the
maco-expander (flags, settings, other) ?
A remark though : I'm using that '%' elsewhere ("% include @FileName.rh", to
include a generated file), and although I do not see that "@FileName"
replaced by the actual filename in the .LST-file, it does seem to be
neccessary and working there.
Regards,
Rudy Wieser
 

Re:A cosmetic macro problem - ASCII to double-byte

Hi Rudy,
[...]
Quote
Do you know of anything that can have an influcence the working of the
maco-expander (flags, settings, other) ?
.LALL (%MACS) - List ALL macro expansions
.SALL (%NOMACS) - Supress ALL macro expansions
.XALL - List only macro expansions that generate code or data
But... /la option always generates full listing (and all listing control
directives are ignored).
 

Re:A cosmetic macro problem - ASCII to double-byte

Vasya Pupkin < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...
Quote
Hi Rudy,
Hey Vasya,
Quote
[...]
>Do you know of anything that can have an influcence the working of the
>maco-expander (flags, settings, other) ?

.LALL (%MACS) - List ALL macro expansions
.SALL (%NOMACS) - Supress ALL macro expansions
.XALL - List only macro expansions that generate code or data

But... /la option always generates full listing (and all listing control
directives are ignored).
:-) I looks like I did not word my question all-that well ....
I ment if there is anything that could stop the "%" macro-command from
functioning differently.
By the way: I've found those commands you mentioned while figuring-out how
to use a macro to create a double-byte string from a 'normal' one.
Regards,
Rudy Wieser
 

Re:A cosmetic macro problem - ASCII to double-byte

Hi Rudy
The macro should be written somthing like this....
wStr macro text
local result, char
char equ ""
result equ ""
irpc char, <text>
result catstr result <,&char>
endm
result catstr result <,0>
dw result
endm
...to have the presumable vilual result.
Poul A.Olsen
 

Re:A cosmetic macro problem - ASCII to double-byte

Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
47e7758f$ XXXX@XXXXX.COM ...
Quote
Hi Rudy
Hello Poul,
Quote
The macro should be written somthing like this....
I tried pretty-much the same before. All it gave me and now again is a
"Missing text macro" error on the "result catstr result <,&char>" line.
Thanks anyway for trying though.
Is it possible that my version of Tasm v5.0 could contain bugs ?
Regards,
Rudy Wieser
 

Re:A cosmetic macro problem - ASCII to double-byte

"R.Wieser" < XXXX@XXXXX.COM >skrev i meddelelsen
Quote
Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
47e7758f$ XXXX@XXXXX.COM ...

>Hi Rudy

Hello Poul,

>The macro should be written somthing like this....

I tried pretty-much the same before. All it gave me and now again is a
"Missing text macro" error on the "result catstr result <,&char>" line.

Thanks anyway for trying though.


Is it possible that my version of Tasm v5.0 could contain bugs ?

Regards,
Rudy Wieser



Hi Rudy
Pleace forgive, I didn't test it, so her is a working solution
wStr macro text:REST
local result, char, i, n
result equ <>
char equ <>
i = 0
n sizestr <text>
n = n - 1
irpc char,<text>
if n gt i
if i
result catstr result,<'>
result catstr result,<&char&>
result catstr result,<',>
endif
endif
i = i + 1
endm
result catstr result,<0>
dw result
endm
Best of luck
Poul A.Olsen
 

Re:A cosmetic macro problem - ASCII to double-byte

"Poul A.Olsen" < XXXX@XXXXX.COM >skrev i meddelelsen
Quote

"R.Wieser" < XXXX@XXXXX.COM >skrev i meddelelsen
news:47e7a51f$ XXXX@XXXXX.COM ...
>Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
>47e7758f$ XXXX@XXXXX.COM ...
>
>>Hi Rudy
>
>Hello Poul,
>
>>The macro should be written somthing like this....
>
>I tried pretty-much the same before. All it gave me and now again is a
>"Missing text macro" error on the "result catstr result <,&char>" line.
>
>Thanks anyway for trying though.
>
>
>Is it possible that my version of Tasm v5.0 could contain bugs ?
>
>Regards,
>Rudy Wieser
>
>
>

Hi Rudy


Pleace forgive, I didn't test it, so her is a working solution

wStr macro text:REST
local result, char, i, n
result equ <>
char equ <>
i = 0
n sizestr <text>
n = n - 1
irpc char,<text>
if n gt i
if i
result catstr result,<'>
result catstr result,<&char&>
result catstr result,<',>
endif
endif
i = i + 1
endm
result catstr result,<0>
dw result
endm

Best of luck
Poul A.Olsen
Ps. I forgot, this is for a quoted string fx. wStr "some text"
 

Re:A cosmetic macro problem - ASCII to double-byte

Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...
Hello Poul,
Quote
Pleace forgive, I didn't test it, so her is a working solution
That sometimes happens to me too, so don't worry.
And your solution works. Just one problem : the resulting data does not
get, just like my current solution, expanded in the .lst-file either :-o
666 wStr "Debuging Window" ;Caption
1 667 0000002A 0044 0065 0062 0075 + dw ??0000
668 0067 0069 006E 0067 +
669 0020 0057 0069 006E +
670 0064 006F 0077 0000
Thanks for trying though.
I've downloaded Borlands free C++ express package (all 300+ MByte of it) and
are now trying to extract Tasm v5.3 (I assume) from it. Maybe that way I
can legally 'fix' a few bugs with my current v5.0 package
Regards,
Rudy Wieser
 

Re:A cosmetic macro problem - ASCII to double-byte

Hello Rudy
I know perfectly what you mean, but one does not use that only to get
somthing in a listfile. You put % in front of the line you want to expand.
Like this "% dw result". But usualy it is used for GLOBAL variable expansion
in macros.
Regards
Poul A.Olsen
"R.Wieser" < XXXX@XXXXX.COM >skrev i meddelelsen
Quote
Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
XXXX@XXXXX.COM ...

Hello Poul,

>Pleace forgive, I didn't test it, so her is a working solution

That sometimes happens to me too, so don't worry.

And your solution works. Just one problem : the resulting data does not
get, just like my current solution, expanded in the .lst-file either :-o

666 wStr "Debuging Window" ;Caption
1 667 0000002A 0044 0065 0062 0075 + dw ??0000
668 0067 0069 006E 0067 +
669 0020 0057 0069 006E +
670 0064 006F 0077 0000

Thanks for trying though.

I've downloaded Borlands free C++ express package (all 300+ MByte of it)
and
are now trying to extract Tasm v5.3 (I assume) from it. Maybe that way I
can legally 'fix' a few bugs with my current v5.0 package

Regards,
Rudy Wieser



 

Re:A cosmetic macro problem - ASCII to double-byte

"Poul A.Olsen" < XXXX@XXXXX.COM >skrev i meddelelsen
Quote
Hello Rudy

I know perfectly what you mean, but one does not use that only to get
somthing in a listfile. You put % in front of the line you want to expand.
Like this "% dw result". But usualy it is used for GLOBAL variable
expansion in macros.

Regards
Poul A.Olsen
Ps. what I ment vas GLOBAL CONSTANT expansion in macros
Quote

"R.Wieser" < XXXX@XXXXX.COM >skrev i meddelelsen
news:47ea1358$ XXXX@XXXXX.COM ...
>Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
> XXXX@XXXXX.COM ...
>
>Hello Poul,
>
>>Pleace forgive, I didn't test it, so her is a working solution
>
>That sometimes happens to me too, so don't worry.
>
>And your solution works. Just one problem : the resulting data does not
>get, just like my current solution, expanded in the .lst-file either :-o
>
>666 wStr "Debuging Window" ;Caption
>1 667 0000002A 0044 0065 0062 0075 + dw ??0000
>668 0067 0069 006E 0067 +
>669 0020 0057 0069 006E +
>670 0064 006F 0077 0000
>
>Thanks for trying though.
>
>I've downloaded Borlands free C++ express package (all 300+ MByte of it)
>and
>are now trying to extract Tasm v5.3 (I assume) from it. Maybe that way I
>can legally 'fix' a few bugs with my current v5.0 package
>
>Regards,
>Rudy Wieser
>
>
>

 

Re:A cosmetic macro problem - ASCII to double-byte

"Poul A.Olsen" < XXXX@XXXXX.COM >skrev i meddelelsen
Quote

"Poul A.Olsen" < XXXX@XXXXX.COM >skrev i meddelelsen
news: XXXX@XXXXX.COM ...
>Hello Rudy
>
>I know perfectly what you mean, but one does not use that only to get
>somthing in a listfile. You put % in front of the line you want to
>expand. Like this "% dw result". But usualy it is used for GLOBAL
>variable expansion in macros.
>
>Regards
>Poul A.Olsen

Ps. what I ment vas GLOBAL CONSTANT expansion in macros
1 1128 % dw ??0054
2 1129 000003BC 0054 0045 0053 0054 + dw 'T','E','S','T','I','N','G','
','I','T',0
1130 0049 004E 0047 0020 +
1131 0049 0054 0000
Quote
>
>"R.Wieser" < XXXX@XXXXX.COM >skrev i meddelelsen
>news:47ea1358$ XXXX@XXXXX.COM ...
>>Poul A.Olsen < XXXX@XXXXX.COM >schreef in berichtnieuws
>> XXXX@XXXXX.COM ...
>>
>>Hello Poul,
>>
>>>Pleace forgive, I didn't test it, so her is a working solution
>>
>>That sometimes happens to me too, so don't worry.
>>
>>And your solution works. Just one problem : the resulting data does not
>>get, just like my current solution, expanded in the .lst-file either :-o
>>
>>666 wStr "Debuging Window" ;Caption
>>1 667 0000002A 0044 0065 0062 0075 + dw ??0000
>>668 0067 0069 006E 0067 +
>>669 0020 0057 0069 006E +
>>670 0064 006F 0077 0000
>>
>>Thanks for trying though.
>>
>>I've downloaded Borlands free C++ express package (all 300+ MByte of it)
>>and
>>are now trying to extract Tasm v5.3 (I assume) from it. Maybe that way
>>I
>>can legally 'fix' a few bugs with my current v5.0 package
>>
>>Regards,
>>Rudy Wieser
>>
>>
>>
>