🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.language.basm
Article #9

Re: Better IntToStr? What do ya think

#9
From: Bob Gonder
Date: Tue, 19 Jun 2007 23:06
40 lines
1743 bytes
Bob Gonder wrote:

>I wonder if dividing by 100 instead of 10, and using AAM to get the 2
>digit result would be any faster
>
>Another way is to push the digits onto stack, then pop/store to
>string.

Hmmm.....
	push	ebx
	xor	ecx, ecx
divloop:
	xor	edx, edx
	inc	ecx
	div	100
	xchg	eax, edx
	aam
	xchg	ah, al
	shl	eax, 16
	mov	ebx, eax
	mov	eax, edx
	xor	edx, edx
	div	100
	xchg	eax, edx
	aam
	xchg	ah, al
	mov	bx, ax
	or	ebx, '0000'
	push	ebx
	test	edx, edx
	mov	eax, edx
	jnz	divloop
	
afterdivloop
	pop	eax
	stosd
	loop	afterdivloop

Problem is it has up to 3 leading zeros.
Threre are also better ways to do the "pop stosd loop"
Technical Details
Message-ID: <llmg73hl8npgr4kn4ugebut2cplpf1iddb@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4677c279$1@newsgroups.borland.com> <k9cg73tlrfbafr87n8ee6in36vutvjjcvb@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 107b11,967a3c560bdbf1af
X-Google-Attributes: gid107b11,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.language.basm
Subject: Re: Better IntToStr? What do ya think
Date: Tue, 19 Jun 2007 16:06:45 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <llmg73hl8npgr4kn4ugebut2cplpf1iddb@4ax.com>
References: <4677c279$1@newsgroups.borland.com> <k9cg73tlrfbafr87n8ee6in36vutvjjcvb@4ax.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.145.161
X-Trace: newsgroups.borland.com 1182294404 67.77.145.161 (19 Jun 2007 16:06:44 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail