Hi there,
You can easily do this in a while loop, I’ve written many assembly language engines in Godot for fun and work.
The simplest way and the way I use is to keep a count of the instructions processed, then given a yield_frequency value you set do the following. Your main execute function doesn’t need to be in the _process or _physics_process functions, and is best not to be. I usually just create an execute function which I call deferred. The yield frequency is not to be confused with the number of instructions per-second, I allow a yield frequency from 100 (very slow) to 30000 (very fast) instructions between yields. At the max setting I can easily achieve greater than 5000000 assembly instructions per-second. My default is 1000 which equates to good performance and low CPU load. Frame updates as well are fluid and I can’t tell the difference from normal. Just an addendum.
await get_tree().process_frame
A part of my latest, assembly core loop is below, I have no lock ups or interface issues and CPU usage is also low. Another thing to do is set Godot to low processor mode as your yield process will be doing the frame updates.
yield_count = 0
while runable:
if yield_count < yield_frequency:
opCodeNames[pc].call()
pc += 1
yield_count += 1
continue
await get_tree().process_frame
yield_count = 0
You could check out my thread on using Assembly in Godot, for business for more info, linked in my info.
Godot Business Use - Assembly Language Testing - Something Different
Kindly
Ryn