An impossible exercise?
To all assembler-programmers:
I recently downloaded the App "URA" from Google play and got myself a quick start into assembler-programming. URA emulates a RISC-processor which is programmable through the app and has a nice assembler-tutorial attached. Now I encountered an exercise in this app which seems impossible to me.
The text of the exercise is as follows: "You can write self modifying code with storing something at a mark before an instruction. Try to write a program that has no hlt instruction but loads it as an integer value and writes it into itself(But be aware that it is likely that you will see much error message during this)."
Seems easy, but now the caveats: You have access only to 15 general purpose registers. You have explicitly NO access to special registers, especially not the instruction pointer and control. Furthermore, you only have the following instructions at your disposal:
mov
cnst
load/store
add/sub/mul/div
nop
hlt
:mark (saves address of next instruction, :mark can be written to a register, which means writing the address of the saved instruction to the register)
.int
.asciz
I have absolutely no idea how to do this, especially without access to ip. Any ideas?












