a31eb59678
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
20 lines
1.1 KiB
WebAssembly Text Format
20 lines
1.1 KiB
WebAssembly Text Format
;; Writes a note: two guest strings cross into one host call.
|
|
(module
|
|
(import "ns" "vault_write" (func $vault_write (param i32 i32 i32 i32) (result i64)))
|
|
(memory (export "memory") 32)
|
|
(data (i32.const 2048) "notes/new.md")
|
|
(global $bump (mut i32) (i32.const 1048576))
|
|
(func (export "ns_alloc") (param $n i32) (result i32)
|
|
(local $p i32)
|
|
(local.set $p (global.get $bump))
|
|
(global.set $bump (i32.add (local.get $p) (local.get $n)))
|
|
(local.get $p))
|
|
(func (export "ns_free") (param i32) (param i32))
|
|
(func (export "ns_abi_version") (result i32) (i32.const 1))
|
|
(func (export "ns_on_load") (result i32) (i32.const 0))
|
|
(func (export "ns_on_unload") (result i32) (i32.const 0))
|
|
(func (export "ns_on_event") (param i32) (param i32) (result i32) (i32.const 0))
|
|
(func (export "ns_run_command") (param $cp i32) (param $cl i32) (param $ap i32) (param $al i32) (result i64)
|
|
(drop (call $vault_write (i32.const 2048) (i32.const 12) (local.get $ap) (local.get $al)))
|
|
(i64.or (i64.shl (i64.const 3000) (i64.const 32)) (i64.extend_i32_u (local.get $al))))
|
|
) |