flat assembler
Message board for the users of flat assembler.

Index > Windows > Base Converter

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Hi all!

I newly wrote a base converter in FASM and here it is... Wink JohnFound: Maybe it could be useful in the Fresh project (as an add-in or something)?

History:
28-09-03: Updated a little bug in the EditCtl-procedure

Enjoy!

Regards,
Tommy


Description: Base Converter Version 1.0
Download
Filename: basecnv.asm
Filesize: 6.22 KB
Downloaded: 416 Time(s)



Last edited by Tommy on 28 Sep 2003, 18:52; edited 2 times in total
Post 27 Sep 2003, 20:21
View user's profile Send private message Visit poster's website Reply with quote
Blag



Joined: 04 Jul 2003
Posts: 90
Location: Perú
Blag
Great Tommy! Very Happy Cool Very Happy

_________________
Alvaro Tejada Galindo
SinglePath games design
http://www.iespana.es/singlepath
Post 28 Sep 2003, 04:01
View user's profile Send private message MSN Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
Weird, I got the following error on my win2k

---------------------------
Base Converter: basecnv.exe - Application Error
---------------------------
The instruction at "0x77e189ce" referenced memory at "0x0000002b". The memory could not be "read".


Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------

I just find some part of code not to my likes.
Post 28 Sep 2003, 09:16
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
What? Hmm...that's strange... Sad Do you have any idea what the problem is? Confused
Post 28 Sep 2003, 09:24
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
I've got a similar problem: it crashes somewhere inside DialogBoxParam..... Sad (under winME)
Post 28 Sep 2003, 14:58
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
...Sad that's sad...I'll try to figure it out, but want/need some help because I don't use Win2k nor WinME...
Post 28 Sep 2003, 17:08
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
I was trying to figure what's wrong, but with no results Sad..... But I'll keep trying, and will inform you when having any result...
Post 28 Sep 2003, 17:22
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Thanks!

[edit]New update on top... The bug in Win2k and WinME is still not fixed...[/edit]
Post 28 Sep 2003, 18:06
View user's profile Send private message Visit poster's website Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
I was getting bored and was tracing it. Realised that the problem lies in wminitdialog whereby there is an imbalanced stack, resulting in ebx's value not preserved. Grr. did you know that LoadMenu has only 2 parameters and not 3? Stupid bug.


Description: Corrected code
Download
Filename: basecnv.asm
Filesize: 6.25 KB
Downloaded: 350 Time(s)

Post 29 Sep 2003, 06:04
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
Ah crap, one more crash

---------------------------
Base Converter: basecnv.exe - Application Error
---------------------------
The exception unknown software exception (0xc00000fd) occurred in the application at location 0x004023b6.


Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
Post 29 Sep 2003, 06:06
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Oops Sad stupid me... Thanks for your bug-fix!

The other bug is obviously on line 240 (div ebx).... Confused But why don't I get any error messages on my computer (not even in OllyDbg)... ?? Confused Since I don't, it's hard to me to fix the problem....
Post 29 Sep 2003, 07:35
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Hmm...I just realized that mine does work without problems on my computer when I fixed the LoadMenu-bug, but not the fixed version from you... Try mine, and see if you get the same problem as you got...


Description: Base Converter
Download
Filename: basecnv.asm
Filesize: 6.22 KB
Downloaded: 346 Time(s)

Post 29 Sep 2003, 07:54
View user's profile Send private message Visit poster's website Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
ps some codes can be optimised eg
Code:
       cmp     ebx,2
       setz    al
  neg     al
    


to
Code:
cmp ebx, 3
sbb al, al
    

cmp reg, 0 to test reg,reg or or reg,reg
mov reg, 0 to xor reg,reg or sub reg,reg

PS: That's why I said some parts of the codes I do not like it.
Post 29 Sep 2003, 08:03
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Smile Okey... Thanks!!! I'm quite new to assembly and haven't learned too much about optimizing yet... I'll try to learn more about it! Wink Thanks for your help!!!

Did it work now???
Post 29 Sep 2003, 08:09
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Should I optimize:
Code:
mov eax,1    ; 5 bytes    

to:
Code:
xor eax,eax  ; 3 bytes
inc eax    
???
Post 29 Sep 2003, 08:16
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Tommy wrote:
Should I optimize:
Code:
mov eax,1    ; 5 bytes
to:
xor eax,eax  ; 3 bytes
inc eax    
???


Yea, I offen do this. Smile
also:
Code:
    mov  eax, -1
to:
    xor eax,eax
    dec eax
    
Post 29 Sep 2003, 08:22
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
HarryTuttle



Joined: 26 Sep 2003
Posts: 211
Location: Poland
HarryTuttle
add instead of inc is more efficient,isn't it?

_________________
Microsoft: brings power of yesterday to computers of today.


Last edited by HarryTuttle on 29 Sep 2003, 08:26; edited 1 time in total
Post 29 Sep 2003, 08:25
View user's profile Send private message Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Very Happy Hehe... Thanks!
Post 29 Sep 2003, 08:26
View user's profile Send private message Visit poster's website Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
Oh I made a mistake earlier.
Code:
cmp ebx, 3 
sbb al, al 
    
is wrong.

Hehe. Yes add is more efficient but in this context size matters more than speed. For mov reg, -1 , you can try or reg, -1

Oh yes one interesting code that you may want to use for your subclassed edit control is
Code:
;eax = input
lea ecx,[eax-LOWERLIMIT]
cmp ecx,UPPERLIMIT - LOWERLIMIT
jna _inrange
    
Post 29 Sep 2003, 09:57
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy
Quote:
Oh I made a mistake earlier.
code:
--------------------------------------------------------------------------------
cmp ebx, 3
sbb al, al
--------------------------------------------------------------------------------
is wrong.
Yes, I found it out myself... Wink

What, actually, does
Code:
;eax = input 
lea ecx,[eax-LOWERLIMIT] 
cmp ecx,UPPERLIMIT - LOWERLIMIT 
jna _inrange    
do? Does it check whether the character is in the range [LOWERLIMIT..UPPERLIMIT]?
Post 29 Sep 2003, 10:05
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.