Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

General • Re: Running user asm code from a program

$
0
0
Assuming I have the correct hex codes for the opcodes & operands for something like this for an endless loop, stored in an array (or somewhere in RAM)...

Code:

loop      jump loop
... is it possible to actually execute that code. (Knowing in this example that it is and endless loop).

I'm thinking along the lines of the C64, where you could peek and poke asm in to memory and execute that with a sys call.

Is this at all possible with the RP2xxx's?
It is possible to run from anywhere in normal RAM (of course properly aligned), there's no hardware restriction like with other MCUs.

Though, you need to use Position-Independent Code if you want to load and run opcodes from arbitrary addresses (again, properly aligned).
A short tutorial here: https://mcuoneclipse.com/2021/06/05/pos ... -cortex-m/

In your example you must use a relative jump, not absolute.

Statistics: Posted by gmx — Thu Jun 19, 2025 10:21 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles