Alternative opcodes

Started by
2 comments, last by dyerseve 18 years, 8 months ago
I wondered if it was possible to 'exchange' various machine opcodes for alternative ones, opcodes that have the same (or practically) functionality, such as something that you could replace a nop (0x90) with, which still does as I like to say: 'naff all'. Cheers.
Advertisement
Some chips were supposed to let you change the instruction set. Common x86 chips sure aren't. A NOP is a NOP is a NOP and nothing else.

Of course, that doen't mean you can't inject useless code in your program, like
   JMP labellabel:
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Yeah that is what I had in mind essentially (the latter). Basically the nops I intended to change are the clusters of nops you get between functions, which is there for padding reasons.

The problem is i'm guessing this will cause a problem with function timing if I were to alter them at all. I guess i'll give this plan a miss then ahah.

Its basically something to do because i'm bored and its the summer.
"this will cause a problem with function timing if I were to alter them at all"
eh? Replacing nops with instructions that take up more cycles won't destroy your program if that's what you were thinking. If it's padding between functions, the code would probably never be called, so you could probably change it to absolute garbage. The purpose of nop's in the middle of functions is to align loops properly because the CPU works faster that way.

This topic is closed to new replies.

Advertisement