flat assembler
Message board for the users of flat assembler.

Index > Main > ..

Author
Thread Post new topic Reply to topic
pool



Joined: 08 Jan 2007
Posts: 97
pool 13 Jan 2009, 05:02
..


Last edited by pool on 17 Mar 2013, 12:01; edited 1 time in total
Post 13 Jan 2009, 05:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20337
Location: In your JS exploiting you and your system
revolution 13 Jan 2009, 05:08
JP
JNP
JPO
JPE

Check the Intel/AMD manual to see what flag value each tests for.
Post 13 Jan 2009, 05:08
View user's profile Send private message Visit poster's website Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 13 Jan 2009, 10:19
Hello,
The parity mean the number of bit that are set
Example:
Code:
mov al,1011b
test al,11b                     ; 1011 AND 11 = 11 ( 2 bit set = Parity even)
jp  @Parity


;Example 2:
mov al,101b
test al,1b                     ; 101 AND 1 = 1 ( 1 bit set = Parity odd )
jnp @No_Parity

    

Both jmp are execute Wink

_________________
Nil Volentibus Arduum Razz
Post 13 Jan 2009, 10:19
View user's profile Send private message Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
pool 14 Jan 2009, 11:13
..


Last edited by pool on 17 Mar 2013, 12:02; edited 1 time in total
Post 14 Jan 2009, 11:13
View user's profile Send private message Reply with quote
Grom PE



Joined: 13 Mar 2008
Posts: 114
Location: i@grompe.org.ru
Grom PE 16 Jan 2009, 03:33
I don't see jp/jnp in programs often.
Could anyone explain to me when it's useful?
It would be nice to see some uses in real projects, or as list of possibilities.
Post 16 Jan 2009, 03:33
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 16 Jan 2009, 04:29
Grom PE, you may look here for a sample application. Wink
Post 16 Jan 2009, 04:29
View user's profile Send private message Reply with quote
Grom PE



Joined: 13 Mar 2008
Posts: 114
Location: i@grompe.org.ru
Grom PE 16 Jan 2009, 06:09
baldr, that's interesting, but not useful enough - very specific case =)
Post 16 Jan 2009, 06:09
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 16 Jan 2009, 06:16
http://coding.derkeiler.com/Archive/Assembler/comp.lang.asm.x86/2004-10/0310.html
Look at "next in thread" too. Interesting what you find out...
Post 16 Jan 2009, 06:16
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto 16 Jan 2009, 10:42
Quote:
I don't see jp/jnp in programs often.
Could anyone explain to me when it's useful?
It would be nice to see some uses in real projects, or as list of possibilities.

Read my signature Wink

_________________
Nil Volentibus Arduum Razz
Post 16 Jan 2009, 10:42
View user's profile Send private message Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat 17 Jan 2009, 15:41
Suppose you're writing a NES emulator, and you need to classify a memory address into one of the four ranges (0000-1FFF = RAM, 2000-5FFF = memory mapped registers, 6000-7FFF = Save RAM, 8000-FFFF = ROM). Most people would use three comparisons to do this, but the flag-savvy programmer can do it with just one!
Code:
mov bx,[address]
test bh,0E0h
js rom_address             ; 8000-FFFF
jz ram_address           ; 0000-1FFF
jpe sram_address ; 6000-7FFF
jmp register_address     ; 2000-5FFF    
Post 17 Jan 2009, 15:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.