-
-
Notifications
You must be signed in to change notification settings - Fork 1
7. Memory (Internals)
AsynchronousAI edited this page Sep 1, 2025
·
1 revision
Here is a visualization on the memory model.
On the left you can see Strings & Static data automatically added by compiler. This includes the strings (added with .asciz, .string), or static arrays (added with .word, .half, .byte). These are all allocated first thing to the start of the main memory buffer on init().
sp is the memory pointer, and is used to allocate values on runtime. It is assigned in the center because the compiler assumes it can allocate from both sides.
local module = ...
module.memory = buffer.create(4096) -- override the 2kb memory with 4kb
module.init() -- load all strings, static data, etc and center the 'sp' register.
module.main() -- start