c64-debug-mcp 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http.cjs +33 -55
- package/dist/http.js +33 -55
- package/dist/stdio.cjs +33 -55
- package/dist/stdio.js +33 -55
- package/package.json +1 -1
package/dist/http.cjs
CHANGED
|
@@ -213,7 +213,7 @@ function parseAddress16(input) {
|
|
|
213
213
|
}
|
|
214
214
|
return parsed;
|
|
215
215
|
}
|
|
216
|
-
var address16Schema = import_zod2.z.
|
|
216
|
+
var address16Schema = import_zod2.z.preprocess(parseAddress16, import_zod2.z.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
|
|
217
217
|
function parseByte(input) {
|
|
218
218
|
if (typeof input === "number") {
|
|
219
219
|
if (!Number.isInteger(input) || input < 0 || input > 255) {
|
|
@@ -337,7 +337,7 @@ function parseByte(input) {
|
|
|
337
337
|
}
|
|
338
338
|
]);
|
|
339
339
|
}
|
|
340
|
-
var byteValueSchema = import_zod2.z.
|
|
340
|
+
var byteValueSchema = import_zod2.z.preprocess(parseByte, import_zod2.z.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
|
|
341
341
|
var byteArraySchema = import_zod2.z.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
|
|
342
342
|
var c64RegisterValueSchema = import_zod2.z.object(
|
|
343
343
|
Object.fromEntries(
|
|
@@ -3641,14 +3641,23 @@ var readMemoryTool = createViceTool({
|
|
|
3641
3641
|
import_zod4.z.object({
|
|
3642
3642
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3643
3643
|
length: import_zod4.z.number().int().positive().max(65535).describe("Number of bytes to read")
|
|
3644
|
+
}).refine((input) => input.address + input.length <= 65536, {
|
|
3645
|
+
message: "address + length must stay within the 64K address space",
|
|
3646
|
+
path: ["length"]
|
|
3644
3647
|
}),
|
|
3645
3648
|
import_zod4.z.object({
|
|
3646
3649
|
start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3647
3650
|
end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
|
|
3651
|
+
}).refine((input) => input.start <= input.end, {
|
|
3652
|
+
message: "End address must be greater than or equal to start address",
|
|
3653
|
+
path: ["end"]
|
|
3654
|
+
}).refine((input) => input.end < 65536, {
|
|
3655
|
+
message: "End address must stay within the 64K address space",
|
|
3656
|
+
path: ["end"]
|
|
3648
3657
|
})
|
|
3649
3658
|
]),
|
|
3650
3659
|
dataSchema: import_zod4.z.object({
|
|
3651
|
-
address:
|
|
3660
|
+
address: import_zod4.z.number().int().min(0).max(65535).describe("Start address of the returned memory chunk"),
|
|
3652
3661
|
length: import_zod4.z.number().int().min(0).describe("Number of bytes returned"),
|
|
3653
3662
|
data: byteArraySchema.describe("Raw bytes returned from memory")
|
|
3654
3663
|
}),
|
|
@@ -3656,21 +3665,11 @@ var readMemoryTool = createViceTool({
|
|
|
3656
3665
|
let address;
|
|
3657
3666
|
let length;
|
|
3658
3667
|
if ("start" in input && "end" in input) {
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
if (end < start) {
|
|
3662
|
-
throw new Error("End address must be greater than or equal to start address");
|
|
3663
|
-
}
|
|
3664
|
-
address = start;
|
|
3665
|
-
length = end - start + 1;
|
|
3666
|
-
} else if ("address" in input && "length" in input) {
|
|
3667
|
-
address = parseAddress16(input.address);
|
|
3668
|
-
length = input.length;
|
|
3668
|
+
address = input.start;
|
|
3669
|
+
length = input.end - input.start + 1;
|
|
3669
3670
|
} else {
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
if (address + length > 65536) {
|
|
3673
|
-
throw new Error("address + length must stay within the 64K address space");
|
|
3671
|
+
address = input.address;
|
|
3672
|
+
length = input.length;
|
|
3674
3673
|
}
|
|
3675
3674
|
const result = await c64Session.readMemory(address, address + length - 1);
|
|
3676
3675
|
return {
|
|
@@ -3686,20 +3685,16 @@ var writeMemoryTool = createViceTool({
|
|
|
3686
3685
|
inputSchema: import_zod4.z.object({
|
|
3687
3686
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3688
3687
|
data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
|
|
3688
|
+
}).refine((input) => input.address + input.data.length - 1 <= 65535, {
|
|
3689
|
+
message: "address + data.length must stay within the 16-bit address space",
|
|
3690
|
+
path: ["data"]
|
|
3689
3691
|
}),
|
|
3690
3692
|
dataSchema: import_zod4.z.object({
|
|
3691
3693
|
worked: import_zod4.z.boolean().describe("Whether the write operation completed successfully"),
|
|
3692
3694
|
address: import_zod4.z.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
|
|
3693
3695
|
length: import_zod4.z.number().int().min(1).describe("Number of bytes written")
|
|
3694
3696
|
}).extend(debugStateSchema.shape),
|
|
3695
|
-
execute: async (input) =>
|
|
3696
|
-
const address = parseAddress16(input.address);
|
|
3697
|
-
const data = input.data.map((b) => parseByte(b));
|
|
3698
|
-
if (address + data.length - 1 > 65535) {
|
|
3699
|
-
throw new Error("address + data.length must stay within the 16-bit address space");
|
|
3700
|
-
}
|
|
3701
|
-
return await c64Session.writeMemory(address, data);
|
|
3702
|
-
}
|
|
3697
|
+
execute: async (input) => await c64Session.writeMemory(input.address, input.data)
|
|
3703
3698
|
});
|
|
3704
3699
|
var executeTool = createViceTool({
|
|
3705
3700
|
id: "execute",
|
|
@@ -3764,45 +3759,28 @@ var breakpointSetTool = createViceTool({
|
|
|
3764
3759
|
label: import_zod4.z.string().optional(),
|
|
3765
3760
|
temporary: import_zod4.z.boolean().default(false),
|
|
3766
3761
|
enabled: import_zod4.z.boolean().default(true)
|
|
3762
|
+
}).refine((input) => input.start <= input.end, {
|
|
3763
|
+
message: "End address must be greater than or equal to start address",
|
|
3764
|
+
path: ["end"]
|
|
3767
3765
|
})
|
|
3768
3766
|
]),
|
|
3769
3767
|
dataSchema: import_zod4.z.object({
|
|
3770
3768
|
breakpoint: breakpointSchema,
|
|
3771
3769
|
executionState: executionStateSchema,
|
|
3772
3770
|
lastStopReason: stopReasonSchema,
|
|
3773
|
-
programCounter:
|
|
3771
|
+
programCounter: import_zod4.z.number().int().min(0).max(65535).nullable(),
|
|
3774
3772
|
registers: c64PartialRegisterValueSchema.nullable()
|
|
3775
3773
|
}),
|
|
3776
3774
|
execute: async (input) => {
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
address: start,
|
|
3787
|
-
length: end - start + 1,
|
|
3788
|
-
condition: input.condition,
|
|
3789
|
-
label: input.label,
|
|
3790
|
-
temporary: input.temporary,
|
|
3791
|
-
enabled: input.enabled
|
|
3792
|
-
};
|
|
3793
|
-
} else if ("address" in input && "length" in input) {
|
|
3794
|
-
normalizedInput = {
|
|
3795
|
-
kind: input.kind,
|
|
3796
|
-
address: parseAddress16(input.address),
|
|
3797
|
-
length: input.length,
|
|
3798
|
-
condition: input.condition,
|
|
3799
|
-
label: input.label,
|
|
3800
|
-
temporary: input.temporary,
|
|
3801
|
-
enabled: input.enabled
|
|
3802
|
-
};
|
|
3803
|
-
} else {
|
|
3804
|
-
throw new Error("Invalid input: must provide either (address, length) or (start, end)");
|
|
3805
|
-
}
|
|
3775
|
+
const normalizedInput = "start" in input && "end" in input ? {
|
|
3776
|
+
kind: input.kind,
|
|
3777
|
+
address: input.start,
|
|
3778
|
+
length: input.end - input.start + 1,
|
|
3779
|
+
condition: input.condition,
|
|
3780
|
+
label: input.label,
|
|
3781
|
+
temporary: input.temporary,
|
|
3782
|
+
enabled: input.enabled
|
|
3783
|
+
} : input;
|
|
3806
3784
|
const result = await c64Session.breakpointSet(normalizedInput);
|
|
3807
3785
|
return {
|
|
3808
3786
|
breakpoint: normalizeBreakpoint(result.breakpoint),
|
package/dist/http.js
CHANGED
|
@@ -190,7 +190,7 @@ function parseAddress16(input) {
|
|
|
190
190
|
}
|
|
191
191
|
return parsed;
|
|
192
192
|
}
|
|
193
|
-
var address16Schema = z2.
|
|
193
|
+
var address16Schema = z2.preprocess(parseAddress16, z2.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
|
|
194
194
|
function parseByte(input) {
|
|
195
195
|
if (typeof input === "number") {
|
|
196
196
|
if (!Number.isInteger(input) || input < 0 || input > 255) {
|
|
@@ -314,7 +314,7 @@ function parseByte(input) {
|
|
|
314
314
|
}
|
|
315
315
|
]);
|
|
316
316
|
}
|
|
317
|
-
var byteValueSchema = z2.
|
|
317
|
+
var byteValueSchema = z2.preprocess(parseByte, z2.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
|
|
318
318
|
var byteArraySchema = z2.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
|
|
319
319
|
var c64RegisterValueSchema = z2.object(
|
|
320
320
|
Object.fromEntries(
|
|
@@ -3618,14 +3618,23 @@ var readMemoryTool = createViceTool({
|
|
|
3618
3618
|
z3.object({
|
|
3619
3619
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3620
3620
|
length: z3.number().int().positive().max(65535).describe("Number of bytes to read")
|
|
3621
|
+
}).refine((input) => input.address + input.length <= 65536, {
|
|
3622
|
+
message: "address + length must stay within the 64K address space",
|
|
3623
|
+
path: ["length"]
|
|
3621
3624
|
}),
|
|
3622
3625
|
z3.object({
|
|
3623
3626
|
start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3624
3627
|
end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
|
|
3628
|
+
}).refine((input) => input.start <= input.end, {
|
|
3629
|
+
message: "End address must be greater than or equal to start address",
|
|
3630
|
+
path: ["end"]
|
|
3631
|
+
}).refine((input) => input.end < 65536, {
|
|
3632
|
+
message: "End address must stay within the 64K address space",
|
|
3633
|
+
path: ["end"]
|
|
3625
3634
|
})
|
|
3626
3635
|
]),
|
|
3627
3636
|
dataSchema: z3.object({
|
|
3628
|
-
address:
|
|
3637
|
+
address: z3.number().int().min(0).max(65535).describe("Start address of the returned memory chunk"),
|
|
3629
3638
|
length: z3.number().int().min(0).describe("Number of bytes returned"),
|
|
3630
3639
|
data: byteArraySchema.describe("Raw bytes returned from memory")
|
|
3631
3640
|
}),
|
|
@@ -3633,21 +3642,11 @@ var readMemoryTool = createViceTool({
|
|
|
3633
3642
|
let address;
|
|
3634
3643
|
let length;
|
|
3635
3644
|
if ("start" in input && "end" in input) {
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
if (end < start) {
|
|
3639
|
-
throw new Error("End address must be greater than or equal to start address");
|
|
3640
|
-
}
|
|
3641
|
-
address = start;
|
|
3642
|
-
length = end - start + 1;
|
|
3643
|
-
} else if ("address" in input && "length" in input) {
|
|
3644
|
-
address = parseAddress16(input.address);
|
|
3645
|
-
length = input.length;
|
|
3645
|
+
address = input.start;
|
|
3646
|
+
length = input.end - input.start + 1;
|
|
3646
3647
|
} else {
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
if (address + length > 65536) {
|
|
3650
|
-
throw new Error("address + length must stay within the 64K address space");
|
|
3648
|
+
address = input.address;
|
|
3649
|
+
length = input.length;
|
|
3651
3650
|
}
|
|
3652
3651
|
const result = await c64Session.readMemory(address, address + length - 1);
|
|
3653
3652
|
return {
|
|
@@ -3663,20 +3662,16 @@ var writeMemoryTool = createViceTool({
|
|
|
3663
3662
|
inputSchema: z3.object({
|
|
3664
3663
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3665
3664
|
data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
|
|
3665
|
+
}).refine((input) => input.address + input.data.length - 1 <= 65535, {
|
|
3666
|
+
message: "address + data.length must stay within the 16-bit address space",
|
|
3667
|
+
path: ["data"]
|
|
3666
3668
|
}),
|
|
3667
3669
|
dataSchema: z3.object({
|
|
3668
3670
|
worked: z3.boolean().describe("Whether the write operation completed successfully"),
|
|
3669
3671
|
address: z3.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
|
|
3670
3672
|
length: z3.number().int().min(1).describe("Number of bytes written")
|
|
3671
3673
|
}).extend(debugStateSchema.shape),
|
|
3672
|
-
execute: async (input) =>
|
|
3673
|
-
const address = parseAddress16(input.address);
|
|
3674
|
-
const data = input.data.map((b) => parseByte(b));
|
|
3675
|
-
if (address + data.length - 1 > 65535) {
|
|
3676
|
-
throw new Error("address + data.length must stay within the 16-bit address space");
|
|
3677
|
-
}
|
|
3678
|
-
return await c64Session.writeMemory(address, data);
|
|
3679
|
-
}
|
|
3674
|
+
execute: async (input) => await c64Session.writeMemory(input.address, input.data)
|
|
3680
3675
|
});
|
|
3681
3676
|
var executeTool = createViceTool({
|
|
3682
3677
|
id: "execute",
|
|
@@ -3741,45 +3736,28 @@ var breakpointSetTool = createViceTool({
|
|
|
3741
3736
|
label: z3.string().optional(),
|
|
3742
3737
|
temporary: z3.boolean().default(false),
|
|
3743
3738
|
enabled: z3.boolean().default(true)
|
|
3739
|
+
}).refine((input) => input.start <= input.end, {
|
|
3740
|
+
message: "End address must be greater than or equal to start address",
|
|
3741
|
+
path: ["end"]
|
|
3744
3742
|
})
|
|
3745
3743
|
]),
|
|
3746
3744
|
dataSchema: z3.object({
|
|
3747
3745
|
breakpoint: breakpointSchema,
|
|
3748
3746
|
executionState: executionStateSchema,
|
|
3749
3747
|
lastStopReason: stopReasonSchema,
|
|
3750
|
-
programCounter:
|
|
3748
|
+
programCounter: z3.number().int().min(0).max(65535).nullable(),
|
|
3751
3749
|
registers: c64PartialRegisterValueSchema.nullable()
|
|
3752
3750
|
}),
|
|
3753
3751
|
execute: async (input) => {
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
address: start,
|
|
3764
|
-
length: end - start + 1,
|
|
3765
|
-
condition: input.condition,
|
|
3766
|
-
label: input.label,
|
|
3767
|
-
temporary: input.temporary,
|
|
3768
|
-
enabled: input.enabled
|
|
3769
|
-
};
|
|
3770
|
-
} else if ("address" in input && "length" in input) {
|
|
3771
|
-
normalizedInput = {
|
|
3772
|
-
kind: input.kind,
|
|
3773
|
-
address: parseAddress16(input.address),
|
|
3774
|
-
length: input.length,
|
|
3775
|
-
condition: input.condition,
|
|
3776
|
-
label: input.label,
|
|
3777
|
-
temporary: input.temporary,
|
|
3778
|
-
enabled: input.enabled
|
|
3779
|
-
};
|
|
3780
|
-
} else {
|
|
3781
|
-
throw new Error("Invalid input: must provide either (address, length) or (start, end)");
|
|
3782
|
-
}
|
|
3752
|
+
const normalizedInput = "start" in input && "end" in input ? {
|
|
3753
|
+
kind: input.kind,
|
|
3754
|
+
address: input.start,
|
|
3755
|
+
length: input.end - input.start + 1,
|
|
3756
|
+
condition: input.condition,
|
|
3757
|
+
label: input.label,
|
|
3758
|
+
temporary: input.temporary,
|
|
3759
|
+
enabled: input.enabled
|
|
3760
|
+
} : input;
|
|
3783
3761
|
const result = await c64Session.breakpointSet(normalizedInput);
|
|
3784
3762
|
return {
|
|
3785
3763
|
breakpoint: normalizeBreakpoint(result.breakpoint),
|
package/dist/stdio.cjs
CHANGED
|
@@ -210,7 +210,7 @@ function parseAddress16(input) {
|
|
|
210
210
|
}
|
|
211
211
|
return parsed;
|
|
212
212
|
}
|
|
213
|
-
var address16Schema = import_zod2.z.
|
|
213
|
+
var address16Schema = import_zod2.z.preprocess(parseAddress16, import_zod2.z.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
|
|
214
214
|
function parseByte(input) {
|
|
215
215
|
if (typeof input === "number") {
|
|
216
216
|
if (!Number.isInteger(input) || input < 0 || input > 255) {
|
|
@@ -334,7 +334,7 @@ function parseByte(input) {
|
|
|
334
334
|
}
|
|
335
335
|
]);
|
|
336
336
|
}
|
|
337
|
-
var byteValueSchema = import_zod2.z.
|
|
337
|
+
var byteValueSchema = import_zod2.z.preprocess(parseByte, import_zod2.z.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
|
|
338
338
|
var byteArraySchema = import_zod2.z.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
|
|
339
339
|
var c64RegisterValueSchema = import_zod2.z.object(
|
|
340
340
|
Object.fromEntries(
|
|
@@ -3638,14 +3638,23 @@ var readMemoryTool = createViceTool({
|
|
|
3638
3638
|
import_zod4.z.object({
|
|
3639
3639
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3640
3640
|
length: import_zod4.z.number().int().positive().max(65535).describe("Number of bytes to read")
|
|
3641
|
+
}).refine((input) => input.address + input.length <= 65536, {
|
|
3642
|
+
message: "address + length must stay within the 64K address space",
|
|
3643
|
+
path: ["length"]
|
|
3641
3644
|
}),
|
|
3642
3645
|
import_zod4.z.object({
|
|
3643
3646
|
start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3644
3647
|
end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
|
|
3648
|
+
}).refine((input) => input.start <= input.end, {
|
|
3649
|
+
message: "End address must be greater than or equal to start address",
|
|
3650
|
+
path: ["end"]
|
|
3651
|
+
}).refine((input) => input.end < 65536, {
|
|
3652
|
+
message: "End address must stay within the 64K address space",
|
|
3653
|
+
path: ["end"]
|
|
3645
3654
|
})
|
|
3646
3655
|
]),
|
|
3647
3656
|
dataSchema: import_zod4.z.object({
|
|
3648
|
-
address:
|
|
3657
|
+
address: import_zod4.z.number().int().min(0).max(65535).describe("Start address of the returned memory chunk"),
|
|
3649
3658
|
length: import_zod4.z.number().int().min(0).describe("Number of bytes returned"),
|
|
3650
3659
|
data: byteArraySchema.describe("Raw bytes returned from memory")
|
|
3651
3660
|
}),
|
|
@@ -3653,21 +3662,11 @@ var readMemoryTool = createViceTool({
|
|
|
3653
3662
|
let address;
|
|
3654
3663
|
let length;
|
|
3655
3664
|
if ("start" in input && "end" in input) {
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
if (end < start) {
|
|
3659
|
-
throw new Error("End address must be greater than or equal to start address");
|
|
3660
|
-
}
|
|
3661
|
-
address = start;
|
|
3662
|
-
length = end - start + 1;
|
|
3663
|
-
} else if ("address" in input && "length" in input) {
|
|
3664
|
-
address = parseAddress16(input.address);
|
|
3665
|
-
length = input.length;
|
|
3665
|
+
address = input.start;
|
|
3666
|
+
length = input.end - input.start + 1;
|
|
3666
3667
|
} else {
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
if (address + length > 65536) {
|
|
3670
|
-
throw new Error("address + length must stay within the 64K address space");
|
|
3668
|
+
address = input.address;
|
|
3669
|
+
length = input.length;
|
|
3671
3670
|
}
|
|
3672
3671
|
const result = await c64Session.readMemory(address, address + length - 1);
|
|
3673
3672
|
return {
|
|
@@ -3683,20 +3682,16 @@ var writeMemoryTool = createViceTool({
|
|
|
3683
3682
|
inputSchema: import_zod4.z.object({
|
|
3684
3683
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3685
3684
|
data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
|
|
3685
|
+
}).refine((input) => input.address + input.data.length - 1 <= 65535, {
|
|
3686
|
+
message: "address + data.length must stay within the 16-bit address space",
|
|
3687
|
+
path: ["data"]
|
|
3686
3688
|
}),
|
|
3687
3689
|
dataSchema: import_zod4.z.object({
|
|
3688
3690
|
worked: import_zod4.z.boolean().describe("Whether the write operation completed successfully"),
|
|
3689
3691
|
address: import_zod4.z.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
|
|
3690
3692
|
length: import_zod4.z.number().int().min(1).describe("Number of bytes written")
|
|
3691
3693
|
}).extend(debugStateSchema.shape),
|
|
3692
|
-
execute: async (input) =>
|
|
3693
|
-
const address = parseAddress16(input.address);
|
|
3694
|
-
const data = input.data.map((b) => parseByte(b));
|
|
3695
|
-
if (address + data.length - 1 > 65535) {
|
|
3696
|
-
throw new Error("address + data.length must stay within the 16-bit address space");
|
|
3697
|
-
}
|
|
3698
|
-
return await c64Session.writeMemory(address, data);
|
|
3699
|
-
}
|
|
3694
|
+
execute: async (input) => await c64Session.writeMemory(input.address, input.data)
|
|
3700
3695
|
});
|
|
3701
3696
|
var executeTool = createViceTool({
|
|
3702
3697
|
id: "execute",
|
|
@@ -3761,45 +3756,28 @@ var breakpointSetTool = createViceTool({
|
|
|
3761
3756
|
label: import_zod4.z.string().optional(),
|
|
3762
3757
|
temporary: import_zod4.z.boolean().default(false),
|
|
3763
3758
|
enabled: import_zod4.z.boolean().default(true)
|
|
3759
|
+
}).refine((input) => input.start <= input.end, {
|
|
3760
|
+
message: "End address must be greater than or equal to start address",
|
|
3761
|
+
path: ["end"]
|
|
3764
3762
|
})
|
|
3765
3763
|
]),
|
|
3766
3764
|
dataSchema: import_zod4.z.object({
|
|
3767
3765
|
breakpoint: breakpointSchema,
|
|
3768
3766
|
executionState: executionStateSchema,
|
|
3769
3767
|
lastStopReason: stopReasonSchema,
|
|
3770
|
-
programCounter:
|
|
3768
|
+
programCounter: import_zod4.z.number().int().min(0).max(65535).nullable(),
|
|
3771
3769
|
registers: c64PartialRegisterValueSchema.nullable()
|
|
3772
3770
|
}),
|
|
3773
3771
|
execute: async (input) => {
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
address: start,
|
|
3784
|
-
length: end - start + 1,
|
|
3785
|
-
condition: input.condition,
|
|
3786
|
-
label: input.label,
|
|
3787
|
-
temporary: input.temporary,
|
|
3788
|
-
enabled: input.enabled
|
|
3789
|
-
};
|
|
3790
|
-
} else if ("address" in input && "length" in input) {
|
|
3791
|
-
normalizedInput = {
|
|
3792
|
-
kind: input.kind,
|
|
3793
|
-
address: parseAddress16(input.address),
|
|
3794
|
-
length: input.length,
|
|
3795
|
-
condition: input.condition,
|
|
3796
|
-
label: input.label,
|
|
3797
|
-
temporary: input.temporary,
|
|
3798
|
-
enabled: input.enabled
|
|
3799
|
-
};
|
|
3800
|
-
} else {
|
|
3801
|
-
throw new Error("Invalid input: must provide either (address, length) or (start, end)");
|
|
3802
|
-
}
|
|
3772
|
+
const normalizedInput = "start" in input && "end" in input ? {
|
|
3773
|
+
kind: input.kind,
|
|
3774
|
+
address: input.start,
|
|
3775
|
+
length: input.end - input.start + 1,
|
|
3776
|
+
condition: input.condition,
|
|
3777
|
+
label: input.label,
|
|
3778
|
+
temporary: input.temporary,
|
|
3779
|
+
enabled: input.enabled
|
|
3780
|
+
} : input;
|
|
3803
3781
|
const result = await c64Session.breakpointSet(normalizedInput);
|
|
3804
3782
|
return {
|
|
3805
3783
|
breakpoint: normalizeBreakpoint(result.breakpoint),
|
package/dist/stdio.js
CHANGED
|
@@ -187,7 +187,7 @@ function parseAddress16(input) {
|
|
|
187
187
|
}
|
|
188
188
|
return parsed;
|
|
189
189
|
}
|
|
190
|
-
var address16Schema = z2.
|
|
190
|
+
var address16Schema = z2.preprocess(parseAddress16, z2.number().int().min(0).max(65535)).describe("16-bit C64 address: decimal (53248) or hex string with prefix ($D000, 0xD000)");
|
|
191
191
|
function parseByte(input) {
|
|
192
192
|
if (typeof input === "number") {
|
|
193
193
|
if (!Number.isInteger(input) || input < 0 || input > 255) {
|
|
@@ -311,7 +311,7 @@ function parseByte(input) {
|
|
|
311
311
|
}
|
|
312
312
|
]);
|
|
313
313
|
}
|
|
314
|
-
var byteValueSchema = z2.
|
|
314
|
+
var byteValueSchema = z2.preprocess(parseByte, z2.number().int().min(0).max(255)).describe("8-bit byte value: decimal (255), hex with prefix ($FF, 0xFF), or binary with prefix (%11111111, 0b11111111)");
|
|
315
315
|
var byteArraySchema = z2.array(byteValueSchema).describe('Array of byte values in mixed formats: [255, "$FF", "%11111111", 42]');
|
|
316
316
|
var c64RegisterValueSchema = z2.object(
|
|
317
317
|
Object.fromEntries(
|
|
@@ -3615,14 +3615,23 @@ var readMemoryTool = createViceTool({
|
|
|
3615
3615
|
z3.object({
|
|
3616
3616
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3617
3617
|
length: z3.number().int().positive().max(65535).describe("Number of bytes to read")
|
|
3618
|
+
}).refine((input) => input.address + input.length <= 65536, {
|
|
3619
|
+
message: "address + length must stay within the 64K address space",
|
|
3620
|
+
path: ["length"]
|
|
3618
3621
|
}),
|
|
3619
3622
|
z3.object({
|
|
3620
3623
|
start: address16Schema.describe("Start address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3621
3624
|
end: address16Schema.describe("End address (inclusive): decimal (53248) or hex string with prefix ($D000, 0xD000)")
|
|
3625
|
+
}).refine((input) => input.start <= input.end, {
|
|
3626
|
+
message: "End address must be greater than or equal to start address",
|
|
3627
|
+
path: ["end"]
|
|
3628
|
+
}).refine((input) => input.end < 65536, {
|
|
3629
|
+
message: "End address must stay within the 64K address space",
|
|
3630
|
+
path: ["end"]
|
|
3622
3631
|
})
|
|
3623
3632
|
]),
|
|
3624
3633
|
dataSchema: z3.object({
|
|
3625
|
-
address:
|
|
3634
|
+
address: z3.number().int().min(0).max(65535).describe("Start address of the returned memory chunk"),
|
|
3626
3635
|
length: z3.number().int().min(0).describe("Number of bytes returned"),
|
|
3627
3636
|
data: byteArraySchema.describe("Raw bytes returned from memory")
|
|
3628
3637
|
}),
|
|
@@ -3630,21 +3639,11 @@ var readMemoryTool = createViceTool({
|
|
|
3630
3639
|
let address;
|
|
3631
3640
|
let length;
|
|
3632
3641
|
if ("start" in input && "end" in input) {
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
if (end < start) {
|
|
3636
|
-
throw new Error("End address must be greater than or equal to start address");
|
|
3637
|
-
}
|
|
3638
|
-
address = start;
|
|
3639
|
-
length = end - start + 1;
|
|
3640
|
-
} else if ("address" in input && "length" in input) {
|
|
3641
|
-
address = parseAddress16(input.address);
|
|
3642
|
-
length = input.length;
|
|
3642
|
+
address = input.start;
|
|
3643
|
+
length = input.end - input.start + 1;
|
|
3643
3644
|
} else {
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
if (address + length > 65536) {
|
|
3647
|
-
throw new Error("address + length must stay within the 64K address space");
|
|
3645
|
+
address = input.address;
|
|
3646
|
+
length = input.length;
|
|
3648
3647
|
}
|
|
3649
3648
|
const result = await c64Session.readMemory(address, address + length - 1);
|
|
3650
3649
|
return {
|
|
@@ -3660,20 +3659,16 @@ var writeMemoryTool = createViceTool({
|
|
|
3660
3659
|
inputSchema: z3.object({
|
|
3661
3660
|
address: address16Schema.describe("Start address: decimal (53248) or hex string with prefix ($D000, 0xD000)"),
|
|
3662
3661
|
data: byteArraySchema.min(1).describe("Bytes to write: decimal (255), hex ($FF, 0xFF), or binary (%11111111, 0b11111111). Mixed formats allowed.")
|
|
3662
|
+
}).refine((input) => input.address + input.data.length - 1 <= 65535, {
|
|
3663
|
+
message: "address + data.length must stay within the 16-bit address space",
|
|
3664
|
+
path: ["data"]
|
|
3663
3665
|
}),
|
|
3664
3666
|
dataSchema: z3.object({
|
|
3665
3667
|
worked: z3.boolean().describe("Whether the write operation completed successfully"),
|
|
3666
3668
|
address: z3.number().int().min(0).max(65535).describe("Start address where the bytes were written"),
|
|
3667
3669
|
length: z3.number().int().min(1).describe("Number of bytes written")
|
|
3668
3670
|
}).extend(debugStateSchema.shape),
|
|
3669
|
-
execute: async (input) =>
|
|
3670
|
-
const address = parseAddress16(input.address);
|
|
3671
|
-
const data = input.data.map((b) => parseByte(b));
|
|
3672
|
-
if (address + data.length - 1 > 65535) {
|
|
3673
|
-
throw new Error("address + data.length must stay within the 16-bit address space");
|
|
3674
|
-
}
|
|
3675
|
-
return await c64Session.writeMemory(address, data);
|
|
3676
|
-
}
|
|
3671
|
+
execute: async (input) => await c64Session.writeMemory(input.address, input.data)
|
|
3677
3672
|
});
|
|
3678
3673
|
var executeTool = createViceTool({
|
|
3679
3674
|
id: "execute",
|
|
@@ -3738,45 +3733,28 @@ var breakpointSetTool = createViceTool({
|
|
|
3738
3733
|
label: z3.string().optional(),
|
|
3739
3734
|
temporary: z3.boolean().default(false),
|
|
3740
3735
|
enabled: z3.boolean().default(true)
|
|
3736
|
+
}).refine((input) => input.start <= input.end, {
|
|
3737
|
+
message: "End address must be greater than or equal to start address",
|
|
3738
|
+
path: ["end"]
|
|
3741
3739
|
})
|
|
3742
3740
|
]),
|
|
3743
3741
|
dataSchema: z3.object({
|
|
3744
3742
|
breakpoint: breakpointSchema,
|
|
3745
3743
|
executionState: executionStateSchema,
|
|
3746
3744
|
lastStopReason: stopReasonSchema,
|
|
3747
|
-
programCounter:
|
|
3745
|
+
programCounter: z3.number().int().min(0).max(65535).nullable(),
|
|
3748
3746
|
registers: c64PartialRegisterValueSchema.nullable()
|
|
3749
3747
|
}),
|
|
3750
3748
|
execute: async (input) => {
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
address: start,
|
|
3761
|
-
length: end - start + 1,
|
|
3762
|
-
condition: input.condition,
|
|
3763
|
-
label: input.label,
|
|
3764
|
-
temporary: input.temporary,
|
|
3765
|
-
enabled: input.enabled
|
|
3766
|
-
};
|
|
3767
|
-
} else if ("address" in input && "length" in input) {
|
|
3768
|
-
normalizedInput = {
|
|
3769
|
-
kind: input.kind,
|
|
3770
|
-
address: parseAddress16(input.address),
|
|
3771
|
-
length: input.length,
|
|
3772
|
-
condition: input.condition,
|
|
3773
|
-
label: input.label,
|
|
3774
|
-
temporary: input.temporary,
|
|
3775
|
-
enabled: input.enabled
|
|
3776
|
-
};
|
|
3777
|
-
} else {
|
|
3778
|
-
throw new Error("Invalid input: must provide either (address, length) or (start, end)");
|
|
3779
|
-
}
|
|
3749
|
+
const normalizedInput = "start" in input && "end" in input ? {
|
|
3750
|
+
kind: input.kind,
|
|
3751
|
+
address: input.start,
|
|
3752
|
+
length: input.end - input.start + 1,
|
|
3753
|
+
condition: input.condition,
|
|
3754
|
+
label: input.label,
|
|
3755
|
+
temporary: input.temporary,
|
|
3756
|
+
enabled: input.enabled
|
|
3757
|
+
} : input;
|
|
3780
3758
|
const result = await c64Session.breakpointSet(normalizedInput);
|
|
3781
3759
|
return {
|
|
3782
3760
|
breakpoint: normalizeBreakpoint(result.breakpoint),
|