🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Jeszcze prostsza zagadka

#2148
From: Bogdan (bogdro)
Date: Fri, 19 Mar 2010 18:17
26 lines
1652 bytes
W dniu 19.03.2010 11:52, Andrzej Grażyński pisze:
> 386 i wyżej
> 
> W EAX jest liczba ze znakiem. Należy w EAX umieścić jej wartość
> bezwzględną. Oczywiście bez skoku.

 Jeszcze dłuższe rozwiązanie :)

	xor	ebx, ebx
	test	eax, eax
	sets	bl
	sub	ebx, 1		; 0 / -1
	mov	ecx, eax
	and	ecx, ebx	; 0 / EAX
	neg	ecx		; 0 / -EAX
	not	ebx		; -1 / 0, zamiast drugiego
				; TEST+SETS+SUB, jak słusznie
				; zwrócono mi uwagę
	and	eax, ebx	; EAX / 0
	add	eax, ecx	; EAX / -EAX, można użyć "OR"

-- 
Pozdrawiam/Regards - Bogdan                     (GNU/Linux & FreeDOS)
Kurs asemblera x86 (DOS, GNU/Linux):http://rudy.mif.pg.gda.pl/~bogdro
Grupy dyskusyjne o asm:  pl.comp.lang.asm alt.pl.asm alt.pl.asm.win32
www.JabberPL.org www.TorProject.org Soft (EN): miniurl.pl/bogdro-soft
Technical Details
Message-ID: <ho0f39$706$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <hnvl12$khn$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: "Bogdan (bogdro)" <bogdan@poczta.gazeta.pl>
Newsgroups: pl.comp.lang.asm
Subject: Re: Jeszcze prostsza zagadka
Date: Fri, 19 Mar 2010 19:17:12 +0100
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 26
Message-ID: <ho0f39$706$1@inews.gazeta.pl>
References: <hnvl12$khn$1@news.onet.pl>
NNTP-Posting-Host: rudy.mif.pg.gda.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1269022634 7174 153.19.42.16 (19 Mar 2010 18:17:14 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Fri, 19 Mar 2010 18:17:14 +0000 (UTC)
X-User: bog.d
In-Reply-To: <hnvl12$khn$1@news.onet.pl>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit