Initial commit

moved from private version control
This commit is contained in:
2025-10-19 21:12:41 +11:00
parent 5e84773bbe
commit e64f3e881e
187 changed files with 25372 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { createNodeModule } from "../../nodeTypes.js";
/**
* Opens persistent cartridge storage using cartdata.
*/
export const cartdataNode = createNodeModule(
{
id: "data_cartdata",
title: "Cart Data Init",
category: "Data",
description: "Setup persistent storage for the cartridge using CARTDATA().",
searchTags: ["cartdata", "save", "persistent", "data"],
inputs: [
{
id: "id",
name: "Identifier",
direction: "input",
kind: "string",
defaultValue: "\"my_cart\"",
},
],
outputs: [
{ id: "loaded", name: "Loaded", direction: "output", kind: "boolean" },
],
properties: [],
},
{
evaluateValue: ({ resolveValueInput }) => {
const id = resolveValueInput("id", '"pico_cart"');
return `cartdata(${id})`;
},
}
);

View File

@@ -0,0 +1,33 @@
import { createNodeModule } from "../../nodeTypes.js";
/**
* Reads a persistent value using dget.
*/
export const dgetNode = createNodeModule(
{
id: "data_dget",
title: "Data Get",
category: "Data",
description: "Retrieve a persistent number using DGET().",
searchTags: ["dget", "load", "data", "persistent"],
inputs: [
{
id: "index",
name: "Index",
direction: "input",
kind: "number",
defaultValue: 0,
},
],
outputs: [
{ id: "value", name: "Value", direction: "output", kind: "number" },
],
properties: [],
},
{
evaluateValue: ({ resolveValueInput }) => {
const index = resolveValueInput("index", "0");
return `dget(${index})`;
},
}
);

View File

@@ -0,0 +1,43 @@
import { createNodeModule } from "../../nodeTypes.js";
/**
* Writes a persistent value using dset.
*/
export const dsetNode = createNodeModule(
{
id: "data_dset",
title: "Data Set",
category: "Data",
description: "Store a persistent number using DSET().",
searchTags: ["dset", "save", "data", "persistent"],
inputs: [
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
{
id: "index",
name: "Index",
direction: "input",
kind: "number",
defaultValue: 0,
},
{
id: "value",
name: "Value",
direction: "input",
kind: "number",
defaultValue: 0,
},
],
outputs: [
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
],
properties: [],
},
{
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
const index = resolveValueInput("index", "0");
const value = resolveValueInput("value", "0");
const line = `${indent(indentLevel)}dset(${index}, ${value})`;
return [line, ...emitNextExec("exec_out")];
},
}
);

View File

@@ -0,0 +1,18 @@
import { cartdataNode } from "./cartdata.js";
import { dsetNode } from "./dset.js";
import { dgetNode } from "./dget.js";
/**
* All data persistence node modules backed by PICO-8 helpers.
*/
export const dataNodes = [cartdataNode, dsetNode, dgetNode];
/**
* Checklist tracking coverage of documented cart data helpers.
* @type {Array<{ function: string, nodeId: string, implemented: boolean }>}
*/
export const dataFunctionChecklist = [
{ function: "CARTDATA", nodeId: "data_cartdata", implemented: true },
{ function: "DSET", nodeId: "data_dset", implemented: true },
{ function: "DGET", nodeId: "data_dget", implemented: true },
];