TEST and JS Question

  • Follow


Hi, been awhile since I've done asm . I know the test instruction just
does a and of the two regs, but it also sets flags like overflow and
sign. I can't for the life of me remember what sets the sign flag, so
if someone would help, here's the bit of code I need help figuring out
what its doing:

test     al,al
js         somewhere


Thanks!
Visit the Asteroid code project at: http://www.guddler.co.uk

0
Reply Displacer 10/30/2005 9:27:59 PM

On Sun, 30 Oct 2005 21:27:59 +0000 (UTC), Displacer
<spamtrap@crayne.org> wrote:

>Hi, been awhile since I've done asm . I know the test instruction just
>does a and of the two regs, but it also sets flags like overflow and
>sign. I can't for the life of me remember what sets the sign flag, so
>if someone would help, here's the bit of code I need help figuring out
>what its doing:
>
>test     al,al
>js         somewhere


If the H/O bit of al is set, that is the sign. Any of: (0x80 - 0xff).

If effect, the h/o bit of al is copied to the sign flag.

>
>
>Thanks!
>Visit the Asteroid code project at: http://www.guddler.co.uk

-- 
ArarghMail510 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the garbage from the reply address.

0
Reply spamtrap 10/31/2005 1:47:35 AM


On Mon, 31 Oct 2005 01:47:35 +0000 (UTC), spamtrap@crayne.org wrote:

>On Sun, 30 Oct 2005 21:27:59 +0000 (UTC), Displacer
><spamtrap@crayne.org> wrote:
>
>>Hi, been awhile since I've done asm . I know the test instruction just
>>does a and of the two regs, but it also sets flags like overflow and
>>sign. I can't for the life of me remember what sets the sign flag, so
>>if someone would help, here's the bit of code I need help figuring out
>>what its doing:
>>
>>test     al,al
>>js         somewhere
>
>
>If the H/O bit of al is set, that is the sign. Any of: (0x80 - 0xff).
>
>If effect, the h/o bit of al is copied to the sign flag.
>
>>
>>
>>Thanks!

Thanks, I knew there were some bits that were transfered to the flags,
but couldn't remember which ones. So JS jumps if its a negative
number. I would have found this myself on google, but JS brings up
waves and waves of Java Script stuff, and there isn't much out there
on that opcode anyway.

0
Reply Displacer 10/31/2005 6:42:53 PM

Displacer wrote:
> Hi, been awhile since I've done asm . I know the test instruction just
> does a and of the two regs, but it also sets flags like overflow and
> sign. I can't for the life of me remember what sets the sign flag, so
> if someone would help, here's the bit of code I need help figuring out
> what its doing:
>
> test     al,al
> js         somewhere


The sign flag is set to the high bit of the result of the AND of the
two operands.  The overflow (and carry) flags are always cleared.

0
Reply robertwessel2 10/31/2005 9:14:00 PM

3 Replies
335 Views

(page loaded in 0.084 seconds)

Similiar Articles:













7/29/2012 8:00:33 PM


Reply: