Here's a simple code that modifies one of its instructions when certain conditions are met. (like changing an add instruction to a subtract)
I dunno I was just bored XD
Press L+R to add to your bells if less than 99,900. If it is more than 99,900, it'll start subtracting instead, until it reaches 100 or less. It'll keep going back and forth :P
It works a lot easier in ARM mode, but...it's just an example.
08-11-2010
Demonic722
From the looks of the source, I'm assuming 'adr' points to AddOrSubtract label.
08-11-2010
yoshisrock
Neat. So it kind of cycles through to the amount you need?
08-11-2010
Demonic722
I think his code adds 100 bells to your current amount until you reach 99,000. After that, the code subtracts 100 bells until you get to 100 bells then it adds back up to 99,000 bells and keeps repeating itself.
08-12-2010
dragonboy269
In regular ARM mod, you could just the pc to overwrite any instruction. In THUMB it says it's not allowed (cause the pc is r15)
(the pc stands for program counter, it basically tells where the next instruction to be executed is)
In ARM everything is 32 bit though, including the instructions, so it'd take up more room, but it's definitely more powerful.
Like, let's say in ARM you wanted to overwrite the very next instruction. Let's say r5 has the instruction you wanna write. To overwrite the very next instruction you'd put....
str r5, [pc, #-0x4]
to overwrite the instruction after that instead
str r5, [pc]
etc.
08-12-2010
Vash
I don't know about "self-modifying". Makes it sound like polymorphism. It's more like an ASM switch case.
08-13-2010
dragonboy269
Quote:
Originally Posted by Vash
I don't know about "self-modifying". Makes it sound like polymorphism. It's more like an ASM switch case.
Well, it might not be exactly, but...
according to wikipedia
"In computer science, self-modifying code is code that alters its own instructions while it is executing."
and that alters a single instruction while executing XD (it directly overwrites an "add" instruction with a "subtract" instruction, or vice versa)
Although I'm probably wrong, you're the more advanced hacker.
08-13-2010
Area51_Hacker2
Self modifying suggest to me that it actively changes it's own base level instructions, i.e. I could put it in - run it and then go and look at it later and it would have changed - this is obviously impossible as the instructions are stored on your ARDS :)
08-13-2010
yoshisrock
It's a neat idea though, it almost has a "mind" to where it knows when to change action.
Better watch out. One of these days your codes will start modifying themselves to the point where your DS comes self-aware. The world is in danger when your DS suddenly flares to life and declares it supreme to mankind. Resistance is futile.
08-13-2010
Lord Was
Quote:
Originally Posted by yoshisrock
It's a neat idea though, it almost has a "mind" to where it knows when to change action.
Better watch out. One of these days your codes will start modifying themselves to the point where your DS comes self-aware. The world is in danger when your DS suddenly flares to life and declares it supreme to mankind. Resistance is futile.
I don't agree with this theory. Technology will never run the world. Even if it did, we would be too busy to care anyways.
Also, i lol'd.