home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,347 of 4,675   
   Robert Prins to Terje Mathisen   
   Re: ITOA in 65 bytes   
   16 May 21 20:11:15   
   
   From: robert@nospicedham.prino.org   
      
   On 2021-05-16 13:09, Terje Mathisen wrote:   
   > Robert Prins wrote:   
   >> On 2021-05-16 08:25, R.Wieser wrote:   
   >>>> Is it possible to fit the conversion of a 16 bit signed integer to   
   >>>> left-aligned   
   >>>> ASCII without leading zeroes in just 65 bytes?   
   >>>   
   >>> As no specifications have been posted, I do have some code that outputs a   
   >>> signed number using just 25 bytes.   
   >>>   
   >>> The trick ?    Filling the buffer backwards (putting the sign at the   
   end).   
   >>   
   >> The code is replacement code for the itoa routine in the Borland TP3   
   compiler,   
   >> so it has to give the same result.   
   >   
   > Why didn't you state so?   
      
   I should have done earlier, rather than in that follow-up, apologies.   
      
   > The key here is that this function returns a TP string, right?   
      
   No, see the code of the current routine I also posted. It puts the result into   
   a   
   22-byte fixed buffer @ DS:00B6 and from there it's processed further.   
      
   > This means that the space for it has to be allocated, but I don't remember   
   > anymore if that is done by the caller or callee in that environment?   
      
   The TP3 manual is silent about this for strings, but looking at the only   
   procedure that actually returns a string, it looks like the caller sets up the   
   space for the string to be returned.   
      
   For what it's worth, -32768 is problematic for all routines posted, it doesn't   
   change sign when negated! TP3 also doesn't accept it as valid integer, unless   
   coded as $8000.   
      
   Robert   
   --   
   Robert AH Prins   
   robert(a)prino(d)org   
   The hitchhiking grandfather - https://prino.neocities.org/indez.html   
   Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca