Having Trouble with PASM TEST Instruction
JonnyMac
Posts: 9,610
I'm baffled over something that should be stupidly easy. This works as I expect:
... but this version doesn't; it always returns 0 even when the pin is high.
I must be missing something but, for the life of me, have not been able to deduce what that something is....
testbit mov tmp1, ina
and tmp1, pinMask wz
if_z wrlong zero, pinStatus
if_nz wrlong one, pinStatus
jmp #testbit
... but this version doesn't; it always returns 0 even when the pin is high.
testbit test ina, pinMask wz
if_z wrlong zero, pinStatus
if_nz wrlong one, pinStatus
jmp #testbit
I must be missing something but, for the life of me, have not been able to deduce what that something is....

Comments
testbit test pinMask, ina wz if_z wrlong zero, pinStatus if_nz wrlong one, pinStatus jmp #testbitThis version works but as both pinMask and ina are variables I don't understand why the order matters.
Post Edited (JonnyMac) : 4/25/2009 4:42:46 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers