🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Wynik w konsoli

#340
From: Bernard
Date: Fri, 16 Jun 2006 23:28
39 lines
1934 bytes
Wiktor S. wrote:
>>> xor ebx,ebx
>>> mov bl,al
>>> and bl,11110000b
>>> shr bl,4
>>> mov ah,[.heksy+ebx]
>>> call writechar
>>> mov bl,al
>>> and bl,00001111b
>>> mov ah,[.heksy+ebx]
>>> call writechar
>>>
>>> .heksy db '0123456789ABCDEF'
>>
>> Eee, strasznie długie i skomplikowane...
>> Ja wolę:
>>
>>     aam 16
>>     xchg al, ah
>>     call printhex
>>     mov al, ah
>> printhex:
>>     add al, 90h
>>     daa
>>     adc al, 40h
>>     daa
>>     jmp putchar
>>
>> ; putchar jest procedurą, która wypisuje znak ASCII z al
> 
> ezoteryczne instrukcje, magiczne wartości i skoki, nad którymi trzeba 
> się kilka minut zastanawiać - ktoś tu mówił o skomplikowaniu? :-)

Policz instrukcje, zajętość rejestrów i pamięci oraz odwołania do 
pamięci (w tym operacje stosowe) w obu wariantach. Tak "na oko" niemal 
wszystko wychodzi ok. 2 razy lepiej w mojej wersji. Aha, zapomniałeś 
dopisać "ret" na końcu ;)

W końcu na tym właśnie polega programowanie w asemblerze, nie?
Technical Details
Message-ID: <4493371a$0$22597$f69f905@mamut2.aster.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!news.astercity.net!news.aster.pl!not-for-mail
References: <e6p4as$bsk$1@atlantis.news.tpi.pl> <e6q18g$43r$1@news.onet.pl> <44908c35$0$22606$f69f905@mamut2.aster.pl> <e6rgs3$qqm$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!news.astercity.net!news.aster.pl!not-for-mail
Date: Sat, 17 Jun 2006 01:28:04 +0200
From: Bernard <bernard@earth.net>
User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
MIME-Version: 1.0
Newsgroups: pl.comp.lang.asm
Subject: Re: Wynik w konsoli
References: <e6p4as$bsk$1@atlantis.news.tpi.pl> <e6q18g$43r$1@news.onet.pl> <44908c35$0$22606$f69f905@mamut2.aster.pl> <e6rgs3$qqm$1@news.onet.pl>
In-Reply-To: <e6rgs3$qqm$1@news.onet.pl>
X-Antivirus: avast! (VPS 0624-2, 2006-06-15), Outbound message
X-Antivirus-Status: Clean
Lines: 39
Message-ID: <4493371a$0$22597$f69f905@mamut2.aster.pl>
NNTP-Posting-Date: 16 Jun 2006 22:56:26 GMT
NNTP-Posting-Host: 82.210.177.180
X-Trace: 1150498586 mamut2.aster.pl 22597 82.210.177.180:2355
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit