Testing INA values over an OUT pin (in ASM)
I have·PIN1 that I·set as OUT and change values at certain times in·a Spin·program.
So I do, in Spin:
...
OUTA[noparse][[/noparse]1]:=1
...
OUTA[noparse][[/noparse]1]:=0
...
etc
In the ASM part of the program I test this pin from time to time·to check its value. For this I use an INA instruction.
I use the following code to test this pin:
test··· 2, ina wc
if_c jmp #Is_One
However the condition is·never met, that is, I never detect it as 1, despite I put the PIN1 to 1 many times while in the Spin part.
First question, is it right to perform an INA over an OUT pin ?
Second, is this·the right way to perform the test ?
So I do, in Spin:
...
OUTA[noparse][[/noparse]1]:=1
...
OUTA[noparse][[/noparse]1]:=0
...
etc
In the ASM part of the program I test this pin from time to time·to check its value. For this I use an INA instruction.
I use the following code to test this pin:
test··· 2, ina wc
if_c jmp #Is_One
However the condition is·never met, that is, I never detect it as 1, despite I put the PIN1 to 1 many times while in the Spin part.
First question, is it right to perform an INA over an OUT pin ?
Second, is this·the right way to perform the test ?
Comments
test pinMask, ina wc
...
pinMask long %0010
You can't use ina as the destination and you can't use a literal value as the destination, so you have to put the test mask in a DAT statement.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
links:
My band's website
Our album on the iTunes Music Store
test ina,#2 wc
Also labels tend to be written as :Is_One so it would be
jmp #:Is_One
But I'm not sure if the : is just a convention, I suspect so.
Graham
The colon isn't just a convention, it makes a label local. A local label's scope is between two non-local labels. This is to make it possible to use multiple instances of generic labels. Example:
Without the colons, the above code wouldn't compile.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
links:
My band's website
Our album on the iTunes Music Store
The : thing shows how programming languages are like normal langauges, I have just always used the : since the start but never learnt why.
Graham
I am assuming (hoping) that you mean reusing labels in different objects, and not in the same block of assembly, even in different functions? Sounds like a potential debugging nightmare to me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
links:
My band's website
Our album on the iTunes Music Store
Mark