aboutsummaryrefslogtreecommitdiff
path: root/examples/greet_from_library
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-02-07 04:26:07 -0800
committerFuwn <[email protected]>2025-06-09 00:46:03 -0700
commitbfa483c6aa5db5c9825faded62176904d516faf7 (patch)
tree043b73bdd939f955f2b4d1e6309c8b697d6e0544 /examples/greet_from_library
downloadarchived-divina-bfa483c6aa5db5c9825faded62176904d516faf7.tar.xz
archived-divina-bfa483c6aa5db5c9825faded62176904d516faf7.zip
feat(divina): pre-release :star:
Diffstat (limited to 'examples/greet_from_library')
-rw-r--r--examples/greet_from_library/Divina.lua22
-rw-r--r--examples/greet_from_library/Library.asm15
-rw-r--r--examples/greet_from_library/Main.asm10
3 files changed, 47 insertions, 0 deletions
diff --git a/examples/greet_from_library/Divina.lua b/examples/greet_from_library/Divina.lua
new file mode 100644
index 0000000..3c628dc
--- /dev/null
+++ b/examples/greet_from_library/Divina.lua
@@ -0,0 +1,22 @@
+--- @class Package
+--- @field public name string
+--- @field public version string
+--- @field public description string
+--- @field public compile_options string[]
+--- @field public minimum_divina_version string
+--- @field public sources string[]
+Package = {
+ name = "greet_from_library",
+ version = "0.1.0",
+ description = "Greet me... from a library!",
+ compile_options = {},
+ minimum_divina_version = Divina.version,
+ sources = {
+ "Main.asm",
+ "Library.asm",
+ },
+ type = Divina.Type.Bin,
+ arch = Divina.Arch.x64,
+}
+
+return Package
diff --git a/examples/greet_from_library/Library.asm b/examples/greet_from_library/Library.asm
new file mode 100644
index 0000000..a23acf3
--- /dev/null
+++ b/examples/greet_from_library/Library.asm
@@ -0,0 +1,15 @@
+global library_perform
+extern printf
+
+section .rodata
+message: db "Hello World!", 13, 10, 0
+
+section .text
+library_perform:
+ sub rsp, 8
+ sub rsp, 32
+ mov rcx, qword message
+ call printf
+ add rsp, 32
+
+ ret
diff --git a/examples/greet_from_library/Main.asm b/examples/greet_from_library/Main.asm
new file mode 100644
index 0000000..ff66ee3
--- /dev/null
+++ b/examples/greet_from_library/Main.asm
@@ -0,0 +1,10 @@
+global main
+extern library_perform
+
+section .text
+main:
+ call library_perform
+
+ xor eax, eax
+ add rsp, 8
+ ret