Welcome to the Parallax Discussion Forums, sign-up to participate.
LMM_JMP rdlong pc, pc ' fall through LMM_Loop rdlong instr, pc add pc, #4 instr nop jmp #LMM_LoopIt just misses a hub window, so it effectively takes 8 COG instructions to "interpret" one instruction from HUB (the rdlong takes at least 8 cycles, and more often it will take another 12 cycles as we wait for the window to come around again). Branches are implemented as a "JMP #LMM_JMP" followed by the long address to jump to.
LMM_JMP mov pc, arg LMM_Loop rdlong instr, pc add pc, #4 instr nop mov temp, instr andn temp, cmask tjnz temp, #LMM_Loop decompress_instr mov arg, instr ' save original data shr instr, #23 ' isolate COG address and arg, amask ' isolate data jmp instr ' go run it; routine must exit with "jmp #LMM_Loop" cmask long $FF80FFFF amask long $0000FFFF
jmp #LMM_JMP long @newpcbut in this revised format it could look like:
long (LMM_JMP<<23) + @newpcThis might be slightly slower than the original (I haven't checked the hub windows to see) but it'll certainly save space; it's like a "CMM-light" and is very easy to implement.