Here is a Unicode Macro i wipped up, cause i just didnt like the other one ;)

I like it, cause it has no limitations on size. Here it is:


;==============================================
; E-Z Unicode By NaN, 2002
;==============================================
UNICODE_TEXT TEXTEQU <LABEL BYTE>
LL macro btext
LOCAL cnt, va, vb, LineText, data1
LineText TEXTEQU < dw >
va = 1
vb = 1
cnt equ @SizeStr(<btext>)+1
WHILE va LT cnt
if vb LT [b][COLOR=red]20[/COLOR][/b]
data1 SUBSTR <btext>, va, 1
LineText CATSTR LineText, <'>, data1, <',>
else
vb = 1
LineText SUBSTR LineText, 1, @SizeStr(%LineText)-1
&LineText
LineText TEXTEQU < dw >
data1 SUBSTR <btext>, va, 1
LineText CATSTR LineText, <'>, data1, <',>
endif
vb = vb + 1
va = va + 1
ENDM
LineText SUBSTR LineText, 1, @SizeStr(%LineText)-1
&LineText
endm

It works like so, in your .data segment:
   Data2 UNICODE_TEXT

LL <This is a Rather Long test to see how well my Unicode string encoder will work. I blaber on>
LL <with this string, but i really dont have anything more specific to say. Alalalalala..>
LL <... and more and more text... hm... what shall i say... ah well, this is enough>
dw 0

This will directly translate into:


Data2 LABEL BYTE
dw 'T','h','i','s',' ','i','s',' ','a',' ','R','a','t','h','e','r',' ','L','o'
dw 'n','g',' ','t','e','s','t',' ','t','o',' ','s','e','e',' ','h','o','w',' '
dw 'w','e','l','l',' ','m','y',' ','U','n','i','c','o','d','e',' ','s','t','r'
dw 'i','n','g',' ','e','n','c','o','d','e','r',' ','w','i','l','l',' ','w','o'
dw 'r','k','.',' ',' ','I',' ','b','l','a','b','e','r',' ','o','n'
dw 'w','i','t','h',' ','t','h','i','s',' ','s','t','r','i','n','g',',',' ','b'
dw 'u','t',' ','i',' ','r','e','a','l','l','y',' ','d','o','n','t',' ','h','a'
dw 'v','e',' ','a','n','y','t','h','i','n','g',' ','m','o','r','e',' ','s','p'
dw 'e','c','i','f','i','c',' ','t','o',' ','s','a','y','.',' ','A','l','a','l'
dw 'a','l','a','l','a','l','a','.','.'
dw '.','.','.',' ','a','n','d',' ','m','o','r','e',' ','a','n','d',' ','m','o'
dw 'r','e',' ','t','e','x','t','.','.','.',' ','h','m','.','.','.',' ','w','h'
dw 'a','t',' ','s','h','a','l','l',' ','i',' ','s','a','y','.','.','.',' ','a'
dw 'h',' ','w','e','l','l',',',' ','t','h','i','s',' ','i','s',' ','e','n','o'
dw 'u','g','h'
dw 0


Just remember to use the 'UNICODE_TEXT' identifier on a separate line (as shown), and a 'dw 0' for the UNICODE null at the end of your text...

BTW: You can adjust the format width of each line by changing the line "if vb LT 20". There is presently 19 unicode chars per line, but this can be adjusted to probabaly 70 or so if you want to push to limits of the compiler... the number is highlighed in BOLD in the above listing for the macro source.


Simple enough to me, let me know what you think...
:alright:
NaN
Posted on 2002-12-01 02:59:49 by NaN
that's nice. thanks! :)
Posted on 2002-12-01 04:32:00 by stryker