Here is the complete code... I think it is failing hardware, but I have thought that before.
The story is I spent a couple of days soldering a couple of LaserPings to a slip ring and mounting the thing to a Parallax feedback 360 servo... assuming that the code would be a no brainer... first I couldn't get the smart pins to cooperate.. then I couldn't get the edge detectors to cooperate... and now I am reduced to this:) The idea is that when you make momentary contact with 3.3v... the moment is spit out to serial, with the first clock and the total period reported AND the LED lights up during contact... this actually does work!!! But seeing that LED stay dimly lit has me befuzzled.
The _RET_ only executes if not preempted by a branch. This means that '_RET_ DJNZ X,#loop' will only RETurn when the looping is done. In your example, the CALL would always take precedence over the _RET_.
Now here's another one. I've been setting the carry with "modc 1 wc" but I'm told it should be "modc %1111 wc" however this test with MODZ says only the lsb is used.
First, the test word in TAQOZ which is simply called MODZ at the high level.
' MODZ ( n -- set )
_MODZ altd tos,#0
modz 0 wz
mov tos,#0
if_z mov tos,#1
ret
So it will return a 1 if the z is set.
Now the test....
Now here's another one. I've been setting the carry with "modc 1 wc" but I'm told it should be "modc %1111 wc" however this test with MODZ says only the lsb is used.
First, the test word in TAQOZ which is simply called MODZ at the high level.
' MODZ ( n -- set )
_MODZ altd tos,#0
modz 0 wz
mov tos,#0
if_z mov tos,#1
ret
So it will return a 1 if the z is set.
Now the test....
The _RET_ only executes if not preempted by a branch. This means that '_RET_ DJNZ X,#loop' will only RETurn when the looping is done. In your example, the CALL would always take precedence over the _RET_.
Thanks Chip. Actually if we had though about it earlier, it could have been simple to make it work. Just don't push the call's return address onto the stack. This way, the call's return would bypass this call's return address, and go directly to the previous return address. Saves 2 clocks to boot
Comments
Here is the complete code... I think it is failing hardware, but I have thought that before.
The story is I spent a couple of days soldering a couple of LaserPings to a slip ring and mounting the thing to a Parallax feedback 360 servo... assuming that the code would be a no brainer... first I couldn't get the smart pins to cooperate.. then I couldn't get the edge detectors to cooperate... and now I am reduced to this:) The idea is that when you make momentary contact with 3.3v... the moment is spit out to serial, with the first clock and the total period reported AND the LED lights up during contact... this actually does work!!! But seeing that LED stay dimly lit has me befuzzled.
I presume that this is invalid
It would just require the verilog to NOT push the new return address onto the stack. I wonder if Chip thought about this?
there is probably a ret at the end of the code of label?
Mike
The _RET_ only executes if not preempted by a branch. This means that '_RET_ DJNZ X,#loop' will only RETurn when the looping is done. In your example, the CALL would always take precedence over the _RET_.
First, the test word in TAQOZ which is simply called MODZ at the high level. So it will return a 1 if the z is set.
Now the test.... Only the lsb was recognized.
Using %0001 means z = !c & !z.
But that's kinda scary that we are using all these instructions that haven't been documented yet!
So modz %1100 wz copies C into Z. But what if we don't use wz?
Z state wold remain unchanged.
Thanks Chip. Actually if we had though about it earlier, it could have been simple to make it work. Just don't push the call's return address onto the stack. This way, the call's return would bypass this call's return address, and go directly to the previous return address. Saves 2 clocks to boot
What do you think this instruction does? Nope! It inverts Z! So in the test below you will see NZNZNZNZNZ...
Here are the tests...
Postedit:
I have just seen the above discussion with ccodes.
Not sure about anything other than 0000 and 1111 anymore. No time now tho'.