Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help with x86 assembler

rapheal2k8rapheal2k8 Member Posts: 1
please im trying to write a program which reads roman numerals and returns integers in x86 but im trying to avoid using ja near and jb near , je near in some parts of my code, is there any other standard jump instruction i can use?

Comments

  • MT2002MT2002 Member Posts: 1,444
    jc,jcxz,jna,jnae,jnb,jnbe,jnc,jne,jng,jnge,jnl, jnle ,jno,jnz,jo,jp,jpo,
    js,jz...Theres alot of different jump instructions you can use.

    If you really want to avoid jump instructions you can also just put cs:eip on the stack and issue either a ret or retd instruction to go to it...
    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.brokenthorn.com]Website :: OS Development Series[rightbr][/link][/size]
  • BretBret Member Posts: 114
    : jc,jcxz,jna,jnae,jnb,jnbe,jnc,jne,jng,jnge,jnl, jnle
    : ,jno,jnz,jo,jp,jpo,
    : js,jz...Theres alot of different jump instructions you can use.
    :
    : If you really want to avoid jump instructions you can also just put
    : cs:eip on the stack and issue either a ret or retd instruction to go
    : to it...
    : [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS
    : Operating
    : System[rightbr][leftbr][link=http://www.brokenthorn.com]Website ::
    : OS Development Series[rightbr][/link][/size]

    Mostly out of curiosity, why are you wanting to avoid the use of those instructions? Is it conditional jumps in general you're trying to avoid, specifically the JA/JB/JE instructions (but things like JG, JL, and JMP would be OK), or the NEAR versions of them (but SHORT or FAR jumps would be OK)?

    Other than something like a trivial "Hello, World" world program, I'm not sure it is possible to completely avoid using conditional jumps.
  • ultranoultrano Member Posts: 2
    : : jc,jcxz,jna,jnae,jnb,jnbe,jnc,jne,jng,jnge,jnl, jnle
    : : ,jno,jnz,jo,jp,jpo,
    : : js,jz...Theres alot of different jump instructions you can use.
    : :
    : : If you really want to avoid jump instructions you can also just put
    : : cs:eip on the stack and issue either a ret or retd instruction to go
    : : to it...
    : : [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS
    : : Operating
    : : System[rightbr][leftbr][link=http://www.brokenthorn.com]Website ::
    : : OS Development Series[rightbr][/link][/size]
    :
    : Mostly out of curiosity, why are you wanting to avoid the use of
    : those instructions? Is it conditional jumps in general you're
    : trying to avoid, specifically the JA/JB/JE instructions (but things
    : like JG, JL, and JMP would be OK), or the NEAR versions of them (but
    : SHORT or FAR jumps would be OK)?
    :
    : Other than something like a trivial "Hello, World" world program,
    : I'm not sure it is possible to completely avoid using conditional
    : jumps.

    CMOVxx

    The alternative is to make 12 256-entry tables and switch between them similarly to state-machines.
    "ret" tricks are more expensive than jxx on modern cpus. And anyway, it doesn't look like code in need of optimization or note.
Sign In or Register to comment.