mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
Initial commit
moved from private version control
This commit is contained in:
51
scripts/nodes/library/memory/memcpy.js
Normal file
51
scripts/nodes/library/memory/memcpy.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Copies memory regions using memcpy.
|
||||
*/
|
||||
export const memoryMemcpyNode = createNodeModule(
|
||||
{
|
||||
id: "memory_memcpy",
|
||||
title: "Copy Memory",
|
||||
category: "Memory",
|
||||
description: "Copy a block of memory within base RAM.",
|
||||
searchTags: ["memcpy", "memory", "copy", "block"],
|
||||
inputs: [
|
||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||
{
|
||||
id: "dest",
|
||||
name: "Dest",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "source",
|
||||
name: "Source",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "length",
|
||||
name: "Length",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
|
||||
const dest = resolveValueInput("dest", "0");
|
||||
const source = resolveValueInput("source", "0");
|
||||
const length = resolveValueInput("length", "0");
|
||||
const line = `${indent(indentLevel)}memcpy(${dest}, ${source}, ${length})`;
|
||||
return [line, ...emitNextExec("exec_out")];
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user