PASM value in a range?
jazzed
Posts: 11,803
Hi.
I have a situation where I need to find out if a number is in a given range in PASM.
The most straight forward way to do this is with cmp. Surely there is a better/faster way.
Any ideas? TIA.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
I have a situation where I need to find out if a number is in a given range in PASM.
The most straight forward way to do this is with cmp. Surely there is a better/faster way.
comploop rdlong num, par wz ' get non-zero number if_z jmp #comploop movd wrval, num ' prepare for write from cog ptr ' optimize this comparison ? can it be done with 3 instructions ? cmp num, start wc ' number < start ? if_b jmp #dosomething cmp adr, end wc ' number > end ? if_a jmp #dosomething wrval mov 0-0, ptr wrlong dirb, par ' command complete jmp #comploop dosomething ' yada yada yada wrlong dirb, par ' command complete jmp #comploop
Any ideas? TIA.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Comments
i.e.
cmp
if_nc cmp
if_c jmp
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230