News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

M32Lib-ATODW

Started by RuiLoureiro, May 27, 2005, 09:59:08 PM

Previous topic - Next topic

RuiLoureiro

Hi

Hutch,
               Thank you.

1. I never comment forum rules this way. Its an interpretation question.
It isn't a comment about that rule. That rule in your topic is a rule ( and i agree with it).
If i want to comment it i will go there to comment.
As you know, i said something there and i am not against the rule. I think this is the rule.

2. Sorry, if you have another interpretation.

3. What you are saying is that this 2 instructions
 
                        "cmp al, 2D"
                        "jne  proceed"

   are related with optimisation. It doesnt look like but may be. I can
         say i dont know anything about optimisation questions.

       4. Sorry, but i am not sure about this: «Keep it up and the posting WILL be changed.»

QvasiModo,
                It seems.

Roticv,
          I dont agree. When we want to use it after getting the string from the keyboard, we can type "+245...". Why not ?
I say the same you said: «Personally I don't like to see too many branches» but when we need to compare we should use the instructions unless we have another algo.

regards

roticv

I think humans are by nature lazy. We would prefer to keep things short and simple (K.I.S.S). I really doubt anyone would put a plus sign in front of their numbers. That's what probably The Svin thought of too when creating the routine. Anyway, if I remember correctly, the algorithm cannot handle certain numbers - need to check that out.

Maybe there are other approaches to the routine. I will think about it (hopefully) and get back to it.

RuiLoureiro

Hmmmmmmm ?

Quote from: roticv on May 31, 2005, 03:49:38 PM
We would prefer to keep things short and simple (K.I.S.S).
Quote
           When somebody uses computer names like «K.I.S.S.» coming from Keep Things Short and Simple, hmmmmmm ?
I think we must not use words that can have other meanings out of the context. I know that it depends on interpretation, but ....
If anyone dont like to see some word i had said, i will edit my topic to delete it or to correct.

            About the algos, we can assume strings like db "   123" or
db "  +234"; db "  -456 567"; db "3456999999999999"; etc. Some are good for ones and not for others.
I want see other approches.

roticv

Personally I feel that it should be 2 different routine. One routine to strip the spaces and stuff (since you really insist on it) and the other for the real part. This is so as, to give a choice to make instead of forcing them to use a more bloated code with more features - features that he/she does not really need.

hutch--

Finally a conversion is a conversion and it is the responsibility of the programmer to point the right data at the algo. Stripping "+ or -" is actually a striing function that has nothing to do with the conversion and it becomes a point of diminishing returns to keep adding junk to an algo because someone may point garbage at it. There will never be an idiot proof algo as there will always be a better idiot so rather than cater for the idiot level, design whatever you need to ensure the conversion algos get the correct format data.

Now the library has 2 version of atodw, the original and the extended version which is table based and if you need to convert a signed value, there is the atol algo so there is enough capacity to do any of these conversions.


atodw     original algo
atodw_ex  extended version
atol      signed version


For any who have any accuracy doubts, the extended version is table driven so it is garranteed accurate within the DWORD range.

The other factor is that the extended version is much faster than the others.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

RuiLoureiro

Quote from: hutch-- on June 01, 2005, 11:54:27 PM
Now the library has 2 version of atodw, the original and the extended version

atodw_ex  extended version


but I haven't this extended version atodw_ex in m32lib, Hutch.

hutch--

Get a current version, it can be done by getting the latest service pack from the forum web site. The algo was written about a year ago.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

RuiLoureiro

Hutch,
          i thk we need unicode versions, too. No ?

hutch--

Feel free to write it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

RuiLoureiro

MASM doubt with INCLUDE

    Can we include a file FILE.INC, which has 3 sections .data, .data? and .code ( all or some ), in any place inside a main file MAIN.ASM ?

MAIN.ASM:

.data
     ...
.data?
     ...
.code
start:
     ...
;..................
       INCLUDE /.../FILE.INC
end         start



FILE.INC:

.data
     ...
.data?
     ...
.code
     ...


Mark Jones

I believe so Rui, have you tried it?
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

hutch--

These types of questions are determined by writing a simple test piece. MASM supports changing the "SECTION" within code but it is the programmers responsibility to ensure that they write the correct data or code in the correct sections.

Now for example if you had an include file that was written like,


.data
  item dd 0


and included it directly in the .CODE section, then you would get errors if there is code after the insertion point as you would be trying to write code in a data section. This would simply be a programming error.

As usual, try it out and if it goes BANG, you know the answer.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Momoass

atodw                : 68 cycles
atodw_no_pushpop_edi : 63 cycles
atodw_no_xor_eaxeax  : 69 cycles


result on my SP4600+<1.83G>.