You know that code won't work on any ARM chip with a cache? :) If you ever
want it to run on the GP32 you'll have to be aware of this.
-----Original Message-----
From: James Daniels [mailto:james.daniels@...]
Sent: 29 November 2002 23:39
To: gbadev@yahoogroups.com
Subject: Re: [gbadev] Self-modifying code branching problem
Hi all,
Just to let you know, I solved the problem by hacking the opcodes as
follows: (it probably won't work for negative offsets though)
...
_stored_branch: .word 0xea000000 +
((target_label-stored_branch_moved_here)/4)-2
...
ldr r10,_stored_branch
str r10,_stored_branch_moved_here
...
stored_branch_moved_here:
mov r0,r0 @ may be overwritten by _stored_branch
...
target_label:
...
It's a bit iffy, but it gets the job done.
--
Cheers,
James.
/\ apex James Daniels
//\\ designs james.daniels@...
//__\\ http://www.apex-designs.net
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/