• test al,al setting of ZF

    From bilsch01@21:1/5 to All on Tue Dec 29 02:26:42 2020
    True or False:
    test al,al sets ZF only if al = 0

    TIA. Bill S.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rod Pemberton@21:1/5 to fy247@nospicedham.always.com on Wed Dec 30 05:18:28 2020
    On Tue, 29 Dec 2020 02:26:42 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    True or False:
    test al,al sets ZF only if al = 0


    Look up TEST instruction here:

    http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/About_IA-32_Instructions.htm

    That's a browse-able HTML version of an IA-32 manual.

    --
    Sigh ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerr-Mudd,John@21:1/5 to nomailings@nospicedham.trgzxcqvbe.c on Wed Dec 30 12:46:50 2020
    On Wed, 30 Dec 2020 10:18:28 GMT, Rod Pemberton <nomailings@nospicedham.trgzxcqvbe.cpm> wrote:

    On Tue, 29 Dec 2020 02:26:42 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    True or False:
    test al,al sets ZF only if al = 0


    Look up TEST instruction here:

    http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/About_IA-32_In structions.htm

    That's a browse-able HTML version of an IA-32 manual.

    or elsewhere https://reverseengineering.stackexchange.com/questions/25188/what-does- test-al-al-mean

    Yes. But why do that if you want to test if al=0? far clearer to code
    "cmp al,0"

    but is cy set identically? back at the OP!

    --
    Bah, and indeed, Humbug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bernhard Schornak@21:1/5 to All on Wed Dec 30 14:45:22 2020
    bilsch01 wrote:


    True or False:
    test al,al sets ZF only if al = 0

    TIA.   Bill S.


    testb %al, %al

    internally performs

    andb %al, %al

    without writing the result to the destination. Hence,

    andb %al, %al

    sets ZF if %al is zero. in all other cases, ZF is cleared. PF and
    SF are set according to %al's content. CF and OF are set to zero,
    no matter, what %al currently holds.

    "AMD64 Architecture Programmer’s Manual Volume 3: General-Purpose
    and System Instructions" [PDF 24594, page 342]


    Greetings from Augburg

    Bernhard Schornak

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bilsch01@21:1/5 to Rod Pemberton on Wed Dec 30 10:46:46 2020
    On 12/30/20 2:18 AM, Rod Pemberton wrote:
    On Tue, 29 Dec 2020 02:26:42 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    True or False:
    test al,al sets ZF only if al = 0


    Look up TEST instruction here:

    http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/About_IA-32_Instructions.htm

    That's a browse-able HTML version of an IA-32 manual.


    I've been using this one.

    http://www.felixcloutier.com/x86/

    I couldn't believe what I read.
    The ref you provide is no more help to me.

    I found the following, which I recognize - answered my question.

    00000102 BEC87D mov si,0x7dc8 ;msg: Error.
    00000105 AC lodsb
    00000106 84C0 test al,al
    00000108 74FC jz 0x106
    0000010A B40E mov ah,0xe
    0000010C B307 mov bl,0x7
    0000010E CD10 int 0x10
    00000110 EBF3 jmp short 0x105

    Consider this: Why not just answer the question that was asked?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Terje Mathisen@21:1/5 to John on Wed Dec 30 19:12:37 2020
    Kerr-Mudd,John wrote:
    On Wed, 30 Dec 2020 10:18:28 GMT, Rod Pemberton <nomailings@nospicedham.trgzxcqvbe.cpm> wrote:

    On Tue, 29 Dec 2020 02:26:42 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    True or False:
    test al,al sets ZF only if al = 0


    Look up TEST instruction here:

    http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/About_IA-32_In
    structions.htm

    That's a browse-able HTML version of an IA-32 manual.

    or elsewhere https://reverseengineering.stackexchange.com/questions/25188/what-does- test-al-al-mean

    Yes. But why do that if you want to test if al=0? far clearer to code
    "cmp al,0"

    but is cy set identically? back at the OP!

    CMP AX,0 is longer than TEST AX,AX but I'm not sure if the same is true
    for CMP AL,0? I.e. is there a one-byte form of CMP AL with a one-byte immediate?

    Terje

    --
    - <Terje.Mathisen at tmsw.no>
    "almost all programming can be viewed as an exercise in caching"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerr-Mudd,John@21:1/5 to terje.mathisen@nospicedham.tmsw.no on Wed Dec 30 19:58:19 2020
    On Wed, 30 Dec 2020 18:12:37 GMT, Terje Mathisen <terje.mathisen@nospicedham.tmsw.no> wrote:

    Kerr-Mudd,John wrote:
    On Wed, 30 Dec 2020 10:18:28 GMT, Rod Pemberton
    <nomailings@nospicedham.trgzxcqvbe.cpm> wrote:

    On Tue, 29 Dec 2020 02:26:42 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    True or False:
    test al,al sets ZF only if al = 0


    Look up TEST instruction here:

    http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/About_IA-32
    _In
    structions.htm

    That's a browse-able HTML version of an IA-32 manual.

    or elsewhere
    https://reverseengineering.stackexchange.com/questions/25188/what-
    does-
    test-al-al-mean

    Yes. But why do that if you want to test if al=0? far clearer to code
    "cmp al,0"

    but is cy set identically? back at the OP!

    CMP AX,0 is longer than TEST AX,AX but I'm not sure if the same is true
    for CMP AL,0? I.e. is there a one-byte form of CMP AL with a one-byte immediate?

    Terje

    Hugi tips & tricks snippet:


    1. Test the value in AL

    To test whether AL is 0 or 1, one single-byte instruction is enough:

    aaa
    jz @zero


    I'm not claiming it's faster than "test".

    --
    Bah, and indeed, Humbug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bilsch01@21:1/5 to All on Wed Dec 30 12:59:14 2020
    On 12/30/20 10:46 AM, bilsch01 wrote:
    On 12/30/20 2:18 AM, Rod Pemberton wrote:
    On Tue, 29 Dec 2020 02:26:42 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    True or False:
    test al,al sets ZF only if al = 0


    Look up TEST instruction here:

    http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/About_IA-32_Instructions.htm


    That's a browse-able HTML version of an IA-32 manual.


    I've been using this one.

    http://www.felixcloutier.com/x86/

    I couldn't believe what I read.
    The ref you provide is no more help to me.

    I found the following, which I recognize - answered my question.

    00000102  BEC87D            mov si,0x7dc8  ;msg: Error. 00000105  AC                lodsb
    00000106  84C0              test al,al
    00000108  74FC              jz 0x106
    0000010A  B40E              mov ah,0xe
    0000010C  B307              mov bl,0x7
    0000010E  CD10              int 0x10
    00000110  EBF3              jmp short 0x105

    Consider this: Why not just answer the question that was asked?


    Thanks for your post. Bill S.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Frank Kotler@21:1/5 to All on Wed Dec 30 18:39:51 2020
    On 12/30/2020 03:59 PM, bilsch01 wrote:

    ...
    Thanks for your post.   Bill S.

    That's more like it!

    Thanks for your question and welcome to clax86.

    Best,
    Frank
    [moderator]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rod Pemberton@21:1/5 to fy247@nospicedham.always.com on Thu Dec 31 04:10:52 2020
    On Wed, 30 Dec 2020 10:46:46 -0800
    bilsch01 <fy247@nospicedham.always.com> wrote:

    The ref you provide is no more help to me.

    So, you didn't like the RTFM with a link to the actual manual? ...

    Consider this: Why not just answer the question that was asked?

    Consider this: What would you learn from any of us simply giving you
    the answer? ...

    If you didn't understand the explanation in the manual, you could have
    easily written some x86 code to test all 256 values for AL.

    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kerr-Mudd,John@21:1/5 to notsaying@nospicedham.127.0.0.1 on Thu Dec 31 11:30:12 2020
    On Wed, 30 Dec 2020 19:58:19 GMT, "Kerr-Mudd,John" <notsaying@nospicedham.127.0.0.1> wrote:

    On Wed, 30 Dec 2020 18:12:37 GMT, Terje Mathisen <terje.mathisen@nospicedham.tmsw.no> wrote:

    []

    for CMP AL,0? I.e. is there a one-byte form of CMP AL with a one-byte
    immediate?

    Terje

    Hugi tips & tricks snippet:


    1. Test the value in AL

    To test whether AL is 0 or 1, one single-byte instruction is enough:

    aaa
    jz @zero


    I'm not claiming it's faster than "test".


    Oops; also jumps if AL is 0x0A



    --
    Bah, and indeed, Humbug.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)