trillek-team / trillek-computer

Trillek Virtual Computer specs
http://trillek-team.github.io/trillek-computer/
Other
51 stars 8 forks source link

TR3200 : NOPIF instruction #30

Closed Zardoz89 closed 9 years ago

Zardoz89 commented 9 years ago

Add a NOPIF instruction, that acts like the NOP instruction, but don't change the skip internal status.

In other words, if we found a code like :

IFxx
  IFxx
    IFxx
      RJMP xxx

And by some reason, someone debugging assembly code, needs to disable the middle IF instruction, could replace it by one (or two if uses a long immediate) NOPIF, that keeps the skip internal state intact.

And if we end doing something similar to the issue #20, of forcing to align to 8 byte boundary, instructions with long immediate, could be use to pad instructions on a IF chain, and align a long immediate instruction on the chain.

milesrout commented 9 years ago

why would you change it to a nopif instead of simply removing it?

Zardoz89 commented 9 years ago

Debug, and to allow do to hackish stuff at low level. In any case, this instruction wouldn't be very usual.

milesrout commented 9 years ago

why would you change it to a nopif instead of simply removing the if?

Zardoz89 commented 9 years ago

If you are debugging on the machine and you modify the program on the RAM, if you simply remove the IF, you must move part of the code

milesrout commented 9 years ago

Yes, and? You modify the assembly source then reassemble. I don't see the issue.