🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.asm
Article #2189

Re: Równie prosta zagadka

#2189
From: Bernard
Date: Fri, 09 Apr 2010 12:47
25 lines
1491 bytes
On 2010-04-09 10:52, Bernard wrote:
> Klasycznie robi się to np. tak:
>
> ; EDI - adres poczatku, ECX - l. bajtow
>
> lea esi, [edi + ecx - 1]
> rlop:
> mov al, [edi]
> xchg al, [esi]
> stosb
> dec esi
> cmp esi, edi
> jb rlop

Popełem błąd w warunku wyjścia z pętli - powinno być ja.

Ładniejsze jest chyba jednak coś takiego - tylko goła pętla, 5 
instrukcji, 3 rejestry:

xlop:
	lodsb
	xchg	al, [esi + ecx - 2]
	mov	[esi - 1], al
	sub	ecx, 2
	ja	xlop
Technical Details
Message-ID: <hpn7mm$qiu$1@newsread1.aster.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!plix.pl!newsfeed1.plix.pl!nntp.aster.pl!newsread1.aster.pl!not-for-mail
References: <hpiqg4$te8$2@news.onet.pl> <hpmpsm$ga1$1@newsread1.aster.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!plix.pl!newsfeed1.plix.pl!nntp.aster.pl!newsread1.aster.pl!not-for-mail
From: Bernard <bernard@earth.net>
Newsgroups: pl.comp.lang.asm
Subject: Re: Równie prosta zagadka
Date: Fri, 09 Apr 2010 14:47:23 +0200
Organization: Aster Sp. z o.o.
Lines: 25
Message-ID: <hpn7mm$qiu$1@newsread1.aster.pl>
References: <hpiqg4$te8$2@news.onet.pl> <hpmpsm$ga1$1@newsread1.aster.pl>
NNTP-Posting-Host: 187-mo6-2.acn.waw.pl
Mime-Version: 1.0
X-Trace: newsread1.aster.pl 1270817302 27230 82.210.165.187 (9 Apr 2010 12:48:22 GMT)
X-Complaints-To: abuse@aster.pl
NNTP-Posting-Date: Fri, 9 Apr 2010 12:48:22 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4
In-Reply-To: <hpmpsm$ga1$1@newsread1.aster.pl>
X-Antivirus: avast! (VPS 100409-0, 2010-04-09), Outbound message
X-Antivirus-Status: Clean
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit