Hi Everyone,
Just for a bit of fun, and because I’ve written assembly for most of my working life I thought it’d be fun to try and get assembly code running directly within Godot.
So to that end I’ve written a module with a simple, error checking, tokenising compiler that allows editing and running assembly directly within Godot. At the moment this is merely a proof of concept and I have many more op codes to implement, but I’m far enough along to get a ‘Hello World’ assembly programming running.
Is this going to replace anything, probably not, and you’ll still need Godot signals to handle communication, but it’s a learning exercise and always fun to do something completely nuts and not the norm…
The first assembly test and screenshot below.
Kindly
Ryn
Assembly Code
;Hello World - Example
.reset
.code
_start:
lda 0
sta b
mainLoop:
lda msg, b
jz end
out
lda b
inc
sta b
jp mainLoop
end:
brk
.data
.db msg, "Hello, Godot World!"
Godot Interface
extends Control
func _ready() -> void:
AssemblyEngine.asm_script_value.connect(asm_script_value)
func asm_script_value(value: float) -> void:
$TextEdit.text += char(int(value))
func _on_button_pressed() -> void:
$TextEdit.text = ""
AssemblyEngine.execute_asmscript("helloworld.asm")
func _on_kill_pressed() -> void:
AssemblyEngine.runable = false