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?
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]
: 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.
: : 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.
Comments
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]
: ,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.
: : ,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.