Question about REP (instruction repeating)
tomcrawford
Posts: 1,126
Can you have instructions that are skipped within a REP block?
Try as I might I cannot get this to work
It only goes through the block one time whether I let the assembler decide what D is or if I count instructions myself.
If I use a counter and djnz, it works.
AdThanksVance
Edit: Answered my own question. "Any branch within....block will cancel REP activity." Naturally, I have a CALL #TxByte in the block.
Try as I might I cannot get this to work
REP @.Hex8End, #8 something, something IF_LE add Ascii, #$31 '0..9 if_GT add Ascii, #$46 'A..F something, something .Hex8End
It only goes through the block one time whether I let the assembler decide what D is or if I count instructions myself.
If I use a counter and djnz, it works.
AdThanksVance
Edit: Answered my own question. "Any branch within....block will cancel REP activity." Naturally, I have a CALL #TxByte in the block.
Comments
BTW, the routine seems a bit odd, normally I'd convert a nibble to ASCII by always adding $30 and then adding 7 if result >$39, although I'm not sure quite what you are doing.
The docs say that REP does work in hubexec, but doesn't really save you any time because it executes an internal jump. I guess that's what you meant?
Ahem, ahem...... yes
I just don't use it in hubexec but I must have forgotten the reason. I think at one time it actually didn't but then Chip made it so that it would just for compatibility's sake, although there was no advantage in speed. That's it.
I find that as soon as hubexec involves looping, it slows it right down, but for non-branching and cordic, it is hardly much slower than cog.
Two precisely equivalent ways, assuming the nibble is in Ascii, all nice and isolated.
Three instructions each, same time to excute, same amount of cog space. But I think the second is more "Prop-ish".
Ah, GETBYTE would be more compact: