I have created an app that can create bitmasks and things like that in a very simple way. It's just to fill in the bits visually using 32 checkboxes. You can choose to copy the result as a hex value, unsigned decimal, signed decimal or in a binary form by clicking on the different labels. Full source code included (it's a mess though).
: fixed the preservation of esi,edi and ebx

: fixed the preservation of esi,edi and ebx

Your program crashed on win98 se.I have added uses edi esi ebx magic to your dlgproc and it works now.Thanks for this app quite educational.
Thanks for fixing that LaptoniC. I always forget it :)
Delight,
Your application works fine on my Win XP.:alright:
Thanks for this tool,
Regards,
Vortex
Your application works fine on my Win XP.:alright:
Thanks for this tool,
Regards,
Vortex
Another 'tool' idea along the same vain would be to write a fast multiply tool:
You know that "shl eax, 2" is faster than "imul eax, 4".
But what about non-base 2 "primes", such as 6.
xor ecx, ecx
mov edx, number
mov eax, edx
shl eax, 2
add ecx, eax
mov eax, edx
shl eax, 1
add ecx, eax
now 'ecx = number * 6'.
This is done simply by evaluating the bits from each multiplier number given. Bit 2 + Bit 1 = 6. You could put check box options to generate a macro, as well as optionally provide push/pop code, and select what 3 registers should be used.
There is also room for optomization here, since the first result can be placed with a mov to ecx, not add. And the last result can be applied to the data in EDX and save the move to eax first.
Just an idea.
:alright:
NaN
You know that "shl eax, 2" is faster than "imul eax, 4".
But what about non-base 2 "primes", such as 6.
xor ecx, ecx
mov edx, number
mov eax, edx
shl eax, 2
add ecx, eax
mov eax, edx
shl eax, 1
add ecx, eax
now 'ecx = number * 6'.
This is done simply by evaluating the bits from each multiplier number given. Bit 2 + Bit 1 = 6. You could put check box options to generate a macro, as well as optionally provide push/pop code, and select what 3 registers should be used.
There is also room for optomization here, since the first result can be placed with a mov to ecx, not add. And the last result can be applied to the data in EDX and save the move to eax first.
Just an idea.
:alright:
NaN
I was thinking that it would be cool to have this as an addin for RadASM so I modified your code a little to enable it as an Addin button on the toolbar. I hope you don't mind. I have attached the code, it's just a rough hack and I haven't touched your code (well I added Hex tags to the Hex output). I have called it BitMe2 just add BitMe2.dll to the AddIns section of RadASM.INI
Donkey
Donkey
Wow, that's great Donkey :alright: I was thinking of making a RadASM plugin of it but I didn't really know how and I'm too lazy to learn how to. By the way, I have created a 16x16 icon that looks much better on the toolbar.
: Hmm...strange. When I assemble the project the resulting dll is 6.5 kB while your attached zip includes a dll that is 24.5 kB. Why?
: Hmm...strange. When I assemble the project the resulting dll is 6.5 kB while your attached zip includes a dll that is 24.5 kB. Why?
16x16 pixels icon
Uploaded the new file to my original post with the replaced icon
You should be able to change :
include c:\radasm\masm\inc\RadASM.inc
to :
include x:\radasm\masm\inc\RadASM.inc
in the BitMe2.ASM file to change the location for the RadASM.INI file.
Donkey
You should be able to change :
include c:\radasm\masm\inc\RadASM.inc
to :
include x:\radasm\masm\inc\RadASM.inc
in the BitMe2.ASM file to change the location for the RadASM.INI file.
Donkey
I found the silly "bug" myself. It works great now, but your dll is still 24 kb and mine 6.5. What's added when you assemble it?
:stupid:
:stupid:
Oh, I forgot to add /FILEALIGN:512 to the linker that I use when I compiled. I'll fix it.
uploaded the updated DLL to my original post, it's now 6.5 KB like yours. It's just a peculiarity in LINK Version 6. You have to specify the file alignment or you get huge programs. I had forgotten to modify my MASM.INI link defaults when I upgraded to 2.0.1.1 and don't think to edit my project options.
I added tooltip text for the button as well.
Donkey
uploaded the updated DLL to my original post, it's now 6.5 KB like yours. It's just a peculiarity in LINK Version 6. You have to specify the file alignment or you get huge programs. I had forgotten to modify my MASM.INI link defaults when I upgraded to 2.0.1.1 and don't think to edit my project options.
I added tooltip text for the button as well.
Donkey
Hi,
a little gap between the nibbles of each byte would be helpfull too.
Bye Miracle
a little gap between the nibbles of each byte would be helpfull too.
Bye Miracle
NaN, for multiply by 6 I use:
using this approach, one can easily multiply with many fixed integers, in less than 5 cycles. I have seen, in fact, a table of such multiplications, but deleted it, thinking it'd be useless.
shl eax,1
lea eax,[eax+eax*2]
using this approach, one can easily multiply with many fixed integers, in less than 5 cycles. I have seen, in fact, a table of such multiplications, but deleted it, thinking it'd be useless.
NaN, for multiply by 6 I use:
shl eax,1
lea eax,[eax+eax*2]
using this approach, one can easily multiply with many fixed integers, in less than 5 cycles. I have seen, in fact, a table of such multiplications, but deleted it, thinking it'd be useless.
Wouldn't add eax, eax be better than shl eax, 1?
Good point Ultrano, my oversite. Im really not much of an opomization person. As well your solution does defeat the point a bit.
Thanks for the tip.
:alright:
NaN
Thanks for the tip.
:alright:
NaN
In hardware domain, it is easier to make the SHL than the ADD, and SHL is faster. 16 times, I suppose. Do not know about the stupid P6, but in K7 I think it's faster this way. Oh, there is a very stupid way of implementing the SHL with D-triggers / or JK triggers, I hope no cpu uses that.