Author Topic: ascii adder  (Read 28306 times)

TWell

  • Member
  • ****
  • Posts: 743
Re: ascii adder
« Reply #60 on: September 27, 2015, 08:35:19 PM »
AMD E450
Code: [Select]
newstyle --- *
6770
6780
6806
6771
6769
original old style
5607
5678
5683
5669
5706

zedd151

  • Member
  • *****
  • Posts: 1596
Re: ascii adder
« Reply #61 on: October 07, 2015, 06:45:57 AM »
Project aborted.  ::)

Too many inconsistencies involving certain lengths.
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

rrr314159

  • Member
  • *****
  • Posts: 1378
Re: ascii adder
« Reply #62 on: October 07, 2015, 08:50:17 AM »
Heck that's too bad. Well if you get bored tackle the more-standard way to do it, as dedndave said, convert to binary first, etc. That's a lot of work but, in a way, more straightforward
I am NaN ;)

zedd151

  • Member
  • *****
  • Posts: 1596
Success!
« Reply #63 on: July 26, 2018, 09:12:31 AM »
Based on some of jimg's ideas (for my fibonacci generator), I now have a working ascii adder procedure, and it so far seems very accurate.
 
Code: [Select]
        ascii_adder proc src1:dword, src2:dword, dst:dword, lent:dword
        local carrie:dword
            push esi
            push edi
            push ebx
            mov esi, src1
            mov edi, src2
            mov ebx, dst
            mov ecx, lent
            mov carrie, 0
            top:
                mov eax,0
                mov al,byte ptr [esi+ecx-1]
                mov dl,byte ptr [edi+ecx-1]
                add al,dl
                sub al, 30h
                add eax, carrie
                mov carrie, 0
                cmp al, 39h
               
                jbe @f
                    mov carrie, 1
                    sub al, 10
                @@:
               
                mov [ebx+ecx-1], al
                dec ecx
                cmp ecx, 0
            jnz top
            pop ebx
            pop edi
            pop esi
            ret
        ascii_adder endp


 Jim posted a routine in felipes' fibonacci thread , and it reminded me of this project and gave me inspiration to finish it.
So, I stripped out the essential parts from the original zedds fibonacci and put them into their own procedure. Works well
for generating a fibonacci sequence.


edited for clarification. dedndave and rrr314159 also helped me with this project by giving me some tips.
« Last Edit: September 25, 2022, 02:41:46 AM by zedd151 »
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1596
Re: ascii adder
« Reply #64 on: September 25, 2022, 12:52:14 AM »
ascii subtractor possibly coming soon.  :biggrin:
I played around with this routine a little and the results are promising. Will need more in depth analysis and checking the results for any errors, etc. before I post the code.  :cool:


And after ascii subtractor?
ascii multiplicator?  :tongue:
ascii dividor?  :tongue:
ok, lets not get 'carried' away (math pun).  :biggrin:
« Last Edit: September 25, 2022, 02:16:47 AM by swordfish »
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

daydreamer

  • Member
  • *****
  • Posts: 2196
  • my kind of REAL10 Blonde
Re: ascii adder
« Reply #65 on: September 25, 2022, 07:28:37 AM »
ascii subtractor possibly coming soon.  :biggrin:
I played around with this routine a little and the results are promising. Will need more in depth analysis and checking the results for any errors, etc. before I post the code.  :cool:


And after ascii subtractor?
ascii multiplicator?  :tongue:
ascii dividor?  :tongue:
ok, lets not get 'carried' away (math pun).  :biggrin:
Is the way of use existing adder combined with ascii NEG function possible= ascii subtractor ?

my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

zedd151

  • Member
  • *****
  • Posts: 1596
Re: ascii adder
« Reply #66 on: September 25, 2022, 07:48:52 AM »
I've been playing around with it Magnus. It will be more difficult as it would have to take into account the possibility of generating negative output. The ascii adder was only designed to work with positive numbers specifically. In my initial experiments I did not consider subtracting a large value from a smaller one, was always a smaller value from large. But with a bit of extra code, I suppose it could be done. But remember, the adder worked bytewise. A subtractor would have some unruly code plus keeping track of sign. I don't know if I could muster up the skills for all of that.

Thinking about this again, I have reconsidered making the subtractor and divider. Too much effort with too little gain, imo. A multiplier would be as easy as recursive calls to the adder.  :biggrin:  And a LOT of allocated memory.


So, on second thought I probably won't be finishing any ascii math library soon. If I have at least a full week to devote to experimenting with a subtractor that can flawlessly work with negative numbers, then I could *possibly* investigate it further. Until then, this will be on the back burner.  :cool:


When I do decide to make a subtractor, it won't be ascii at first. This will eliminate the extra fiddling with the ascii conversion, and more time for dealing with the data. Big data that is.  :biggrin:  Since I'll be dealing with byte data, I probably would work with hex values instead of decimal. I think anyway. We'll see...
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin:

daydreamer

  • Member
  • *****
  • Posts: 2196
  • my kind of REAL10 Blonde
Re: ascii adder
« Reply #67 on: September 26, 2022, 07:39:10 AM »
I was thinking
Define -9="0"-9,-8="0"-8 and so on before subtraction=adding ascii digits together
Next step would be check if need borrow and Dec bigger digit and add 10
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

zedd151

  • Member
  • *****
  • Posts: 1596
Re: ascii adder
« Reply #68 on: September 26, 2022, 07:46:15 AM »
I was thinking
Define -9="0"-9,-8="0"-8 and so on before subtraction=adding ascii digits together
Next step would be check if need borrow and Dec bigger digit and add 10
Well that seems a little more complicated and a lot more confusing.  :tongue:
« Last Edit: September 26, 2022, 11:36:17 AM by zedd151 »
Nugget and Gypsy Youtube channel. New videos twice a week or so. If you like the videos, please subscribe and comment.  :biggrin: