Hi Everyone,
Been a while since I’ve been here. I covered running Assembly code in Godot some time ago but recently I moved into a position where I’m required to optimise assembly code and also assess whether someone’s ASM code is any good at all.
Not having the actual destination hardware to test on most of the time, I’ve created another Assembly language compiler and engine in Godot which can easily be modified by just replacing the patterns and reserved word libraries to suit the appropriate destination chip. The position of the pattern in the list is also the OP code.
I’m even able to edit and test production assembly code in Godot and run it even when Godot is running in debug mode, with very little loss in performance. I’ve also added a number of signals into the assembly core to control the Godot application but as far as the assembly code is concerned they are not even visible.
Granted this is not going run the Assembly code at the bare metal speed of some chips but for some micro controllers it can be far quicker. There are compiler ‘.’ directives which can control the speed of the engine, but ultimately the goal is to look at the supplied code, optimise/correct it and see an improvement within my system. Any improvement here will translate to improvements on the destination chip / platform.
Some may be concerned that the core of the system runs within a while loop, as there seems to be a fear of them, but in this case the loop is set to automatically bleed processor time back to the host system at set intervals, either by settings in code or defaults or even instructions such as ‘HLT’ Halt, which pauses the engine until a key press or mouse click. Most of the time CPU usage is in the single figures.
yield_start = Time.get_ticks_msec()
while runable:
if (Time.get_ticks_msec() - yield_start) < yield_frequency:
opCodeNames[pc].call()
pc += 1
continue
On an odd side note, I’ve found, because my assembly engine handles all screen refreshes, turning on Low Processor Mode in the Project Setting actually provides better performance.
Cheers
Ryn







