🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Równie prosta zagadka

#2194
From: Bernard
Date: Mon, 12 Apr 2010 18:13
65 lines
2269 bytes
On 2010-04-10 21:42, Andrzej Grażyński wrote:
> Andrzej Grażyński pisze:
>> Dane jest pole o długości L bajtów. Odrócić kolejność bajtów w tym polu.
>>
>> Wskazówka: czy SWAPB może się tu do czegoś przydać?
>
>
>
>
> Co sądzicie o tym? (nie testowałem)

No to potestujmy. Przyjmijmy ECX równe 7 i wektor bajtów o wartościach 
1, 2, 3, 4, 5, 6, 7.


> CLD
Zbędne wg ABI.
> ADD ECX,4
ECX = 11
> MOV EBX,7
> AND EBX,ECX
EBX = 3
> SHR ECX,3
ECX = 1
> LEA EDI,[ESI+ECX-1]
EDI = start
> JZ @@Partial
>
> @@Loop:
> LODSD
4, 3, 2, 1
> MOV EDX,[EDI]
4, 3, 2, 1
> BSWAP EAX
1, 2, 3, 4
> BSWAP EDX
jw.
> STOSD
początek wektora: 4, 3, 2, 1
> MOV [ESI-4],EDX
tak samo
> SUB EDI,8
start - 4
> LOOP @@Loop
>
> @@Partial:
> AND EBX,3
EBX = 3
> JZ @@Done
> MOV AL,[ESI]
5
> LEA EDI,[ESI+EBX-1]
ESI+2, czyli start + 6
> MOV AH,[EDI]
7
> STOSB
5 na koniec
> MOV ESI,AH
7 na start+4
Nie ma takiej instrukcji, alele jeśli chodziło o [ESI], to 7 na start+4
> @@Done:

Wektor po wszystkim: 4, 3, 2, 1, 7, 6, 5

No chyba nie o to chodziło... ;)
Technical Details
Message-ID: <hpvns8$2hh$1@newsread1.aster.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news-2.dfn.de!news.dfn.de!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!plix.pl!newsfeed1.plix.pl!nntp.aster.pl!newsread1.aster.pl!not-for-mail
References: <hpiqg4$te8$2@news.onet.pl> <hpqkb8$o4i$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news-2.dfn.de!news.dfn.de!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!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: Mon, 12 Apr 2010 20:13:09 +0200
Organization: Aster Sp. z o.o.
Lines: 66
Message-ID: <hpvns8$2hh$1@newsread1.aster.pl>
References: <hpiqg4$te8$2@news.onet.pl> <hpqkb8$o4i$1@news.onet.pl>
NNTP-Posting-Host: 187-mo6-2.acn.waw.pl
Mime-Version: 1.0
X-Trace: newsread1.aster.pl 1271096008 2609 82.210.165.187 (12 Apr 2010 18:13:28 GMT)
X-Complaints-To: abuse@aster.pl
NNTP-Posting-Date: Mon, 12 Apr 2010 18:13:28 +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: <hpqkb8$o4i$1@news.onet.pl>
X-Antivirus: avast! (VPS 100412-1, 2010-04-12), Outbound message
X-Antivirus-Status: Clean
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit