I started from scratch again in converting my faster P1 spin interpreter to run on P2.
What i am after is to run P1 compiled spin on the P2. There will be some things it cannot do such as videeo (waitvid) and some of the timer hardware differences, but overall most code should work.
So, let’s look at the makeup of hub code for the P1 object... (P1 spin on P2 will only use the bottom 64KB of HUB)
$0000(4) clockfreq - initially jump over spin code then updated to clockfreq
$0004(1) clockmode - not used
$0005(1) checksum - not used
$0006(...) spin code - same
* My P2 interpreter uses COG & LUT for extra speed
* PTRA & PTRB are used for pcurr and dcurr respectively
Currently how this works is P1 compiled spin bytecode is copied into the P2 source as bytes with the first 4 bytes replaced with a jump over the bytecode. The bottom 64KB will be reserved for P1 spin bytecode and interpreter.