2 procs to be added to M32LIB
Though after optimization H2ASCII works faster it's not the fastest way to make it.
fastadw algo that I posted here and examples of wrap procs weren't in M32LIB format
but still the algo is fastest.
There are simple,though not optimal example of the algo to be included in proc in M32LIB format.
You may need two (and really more that two) different format for convertions:
1. You need just "insert" the number ascii representation in some part of string.
It may be common case 'cause we can precisly predict number of caracters
For example in data section you have something like:
regvalue db 'eax = '
eaxvalue db 8 dup (0)
db 13,10,'ecx = '
ecxvalue db 9 dup (0)
If you insert ASCII represantation of 32 bit eax value into eaxvalue place
and ecx ASCII representation into ecxvalue place you'd get ASCIIZ string:
eax = 0ABC1234
ecx = 00000001
for this case M32LIB proc with fastadw would look like
;---------------------------------------------------------------------------------------
; Alexander Yakubtchik AKA The Svin
;---------------------------------------------------------------------------------------
.586
.model flat,stdcall
option casemap:none
fastadw proc value:DWORD,lpBuff:DWORD
mov eax,value
push ebx
mov edx,eax
shl eax,4
and edx,0FFFF0000h
mov ebx,eax
shr edx,12
and eax,0ff0h
shr bh,4
shr al,4
and ebx,0f0f00h
mov ecx,edx
shl ebx,8
add eax,06060606h
and edx,0ff0h
add ebx,eax
shr ch,4
mov eax,ebx
shr dl,4
and ebx,10101010h
and ecx,0f0f00h
shr ebx,4
shl ecx,8
sub eax,ebx
add edx,06060606h
shl ebx,3
add eax,2a2a2a2ah
add ecx,edx
add eax,ebx
mov edx,ecx
bswap eax
;################################################
and ecx,10101010h
shr ecx,4
sub edx,ecx
shl ecx,3
add edx,2a2a2a2ah
add edx,ecx
mov ebx,lpBuff
bswap edx
mov dword ptr ,edx
mov dword ptr ,eax
pop ebx
ret
fastadw endp
2. If you need to get just ASCIIZ string:
add before pop ebx
mov ,0
and change name of proc for example szfastdw
-------------------------------------------------------
There is no proc for BINARY ASCII convertion:
Here is one with the same straight forward style (no jmps - quite rare procs)
It has four parameter and can produce four different results:
ASCII string with spaces between nibles '1111 0000 1010 1111'
ASCII string without spaces '1111000010101111'
and the same with ASCIIZ version.
first parameter - number
second - destination
third - if you need spaces (boolean 1 - with spaces,0 - without them)
forth - if you need ASCIIZ (boolean 1 - ASCIIZ,0- ASCII)
;--------------------------------------------------------------------
; (c) Alexander Yakubtchik AKA The Svin
;--------------------------------------------------------------------
.386
.model flat,stdcall
option casemap:none
.code
B2Asiids proc uses ecx eax edx edi ebx num:DWORD,dest:DWORD,space:DWORD,sz:DWORD
.data
ALIGN 4
tbl dd '0000','1000','0100','1100'
dd '0010','1010','0110','1110'
dd '0001','1001','0101','1101'
dd '0011','1011','0111','1111'
.code
mov ebx,space
mov ecx,num
mov edi,dest
rol ecx,8
xor edx,edx
mov al,cl
mov dl,cl
and eax,0Fh
shr dl,4
mov eax,tbl
mov edx,tbl
mov dword ptr ,eax
mov dword ptr ,edx
mov byte ptr ,20h
rol ecx,8
xor edx,edx
mov al,cl
mov dl,cl
and eax,0Fh
shr dl,4
mov eax,tbl
mov edx,tbl
mov dword ptr ,eax
mov dword ptr ,edx
mov byte ptr ,20h
rol ecx,8
add ebx,ebx
xor edx,edx
mov al,cl
mov dl,cl
and eax,0Fh
shr dl,4
mov eax,tbl
mov edx,tbl
mov dword ptr ,eax
mov dword ptr ,edx
mov byte ptr ,20h
rol ecx,8
add ebx,ebx
xor edx,edx
dec ebx
mov al,cl
adc ebx,0
mov dl,cl
and eax,0Fh
mov ecx,sz
shr dl,4
mov eax,tbl
lea ecx,
mov edx,tbl
mov dword ptr ,edx
mov byte ptr [e
Compliments Alexander,
For people who are not familiar, Alexander did very intensive
optimisation work on the existing MASM32 library and produced
some very big speed improvements, especially in the conversion
between different numerical formats and strings.
Keep up the good work.
Regards,
hutch@pbq.com.au
Alexander: use the code buttons below to mark your code, that way they won't be tainted by smilies :)
If you're not sure about what I mean, just edit your own message and look at the little tags I added
This message was edited by Hiroshimator, on 3/17/2001 8:47:48 AM
I wrote again big letter and lost it again :)
In short
1. I'll try my best (I can't see pictures in inet)
2. Can I get copy of the msgboard database, please.
The Svin.
why do you need the database?
To Hiro:
To read it offline.
Please, belive me - it's quit painfull thing for me
to be online. I had very bad but expensive inet.
So I need or database copy or full copy of the site.
To connect only to read new mesages or to post ones.
The Svin.
yes I know what you mean
until recently i was in the same situation
Shawn bullock is making an offline reader. It should be ready soon :)
This message was edited by Hiroshimator, on 3/17/2001 12:46:25 PM