Does it work for D>1 and the last instruction in the REP block is a JMP? (I can't look at your test code at the moment.)
I had tested for D>1 which worked OK, but in all my tests I hadn't tried JMP as the last instruction in the block.
Your onto something there Seairth, it seems that if the last instruction is a JMP the issue raises it's head again.
I'll keep digging....
We could just have a rule that no branches are allowed within a REP block.
IIRC to switch execution modes it's enough to JMP in the right (address) execution space, isn't it?
In this case I think that every REP loop (I mean in every exec mode) has to be tested for both cases, JMP into same mode and JMP into different mode.
IIRC to switch execution modes it's enough to JMP in the right (address) execution space, isn't it?
In this case I think that every REP loop (I mean in every exec mode) has to be tested for both cases, JMP into same mode and JMP into different mode.
We could just have a rule that no branches are allowed within a REP block.
Isn't (conditional) JMP within REP an efficient way to replicate "do-until" or "do-while" structures with timeout (max count at given clock)?
It's slightly more efficient than a branching loop, as the loop is automatic, but it's really valuable for repeating just a few instructions, since that's where overheadless looping makes a significant difference.
Instead of cancelling a REP block with a JMP instruction what about a "QUIT" instruction that cancels the REP block and simply ignores any remaining instructions in the block (treats remaining instructions as NOP's).
Chip's got a point. While it's nice to have the option of conditions, the moment they are added then a regular loop construct may as well be used instead.
Instead of cancelling a REP block with a JMP instruction what about a "QUIT" instruction that cancels the REP block and simply ignores any remaining instructions in the block (treats remaining instructions as NOP's).
Actually, QUIT (REXIT?) could use the same encoding as REP #0, #0! In other words, if there's an active REP, QUIT NOP's the remaining instructions. If there's not an active REP, it's just a NOP itself.
Instead of cancelling a REP block with a JMP instruction what about a "QUIT" instruction that cancels the REP block and simply ignores any remaining instructions in the block (treats remaining instructions as NOP's).
Actually, QUIT (REXIT?) could use the same encoding as REP #0, #0! In other words, if there's an active REP, QUIT NOP's the remaining instructions. If there's not an active REP, it's just a NOP itself.
Good point. Doing a 'REP #0, S/#' would turn REP off. We could have an assembler alias, "REPQ" that is really "REP #0,#0".
Instead of cancelling a REP block with a JMP instruction what about a "QUIT" instruction that cancels the REP block and simply ignores any remaining instructions in the block (treats remaining instructions as NOP's).
Actually, QUIT (REXIT?) could use the same encoding as REP #0, #0! In other words, if there's an active REP, QUIT NOP's the remaining instructions. If there's not an active REP, it's just a NOP itself.
Good point. Doing a 'REP #0, S/#' would turn REP off. We could have an assembler alias, "REPQ" that is really "REP #0,#0".
Except, in this case, I think REPQ should also NOP the remaining instructions in the REP block.
Comments
We could just have a rule that no branches are allowed within a REP block.
In this case I think that every REP loop (I mean in every exec mode) has to be tested for both cases, JMP into same mode and JMP into different mode.
Isn't (conditional) JMP within REP an efficient way to replicate "do-until" or "do-while" structures with timeout (max count at given clock)?
Three different tests, jump to the same exec mode and jump to the other two modes.
It's slightly more efficient than a branching loop, as the loop is automatic, but it's really valuable for repeating just a few instructions, since that's where overheadless looping makes a significant difference.
Actually, QUIT (REXIT?) could use the same encoding as REP #0, #0! In other words, if there's an active REP, QUIT NOP's the remaining instructions. If there's not an active REP, it's just a NOP itself.
Good point. Doing a 'REP #0, S/#' would turn REP off. We could have an assembler alias, "REPQ" that is really "REP #0,#0".
This sounds like adding new features to me, which I wish we'd stop doing...
Maybe we did. I don't remember. I'm just trying to make it work right.
Except, in this case, I think REPQ should also NOP the remaining instructions in the REP block.