diff --git a/src/components/ProgramLoader/BinaryFileUpload.tsx b/src/components/ProgramLoader/BinaryFileUpload.tsx
index 648f7ef..bc3dab5 100644
--- a/src/components/ProgramLoader/BinaryFileUpload.tsx
+++ b/src/components/ProgramLoader/BinaryFileUpload.tsx
@@ -49,7 +49,7 @@ export const BinaryFileUpload = ({
className="my-6 mr-3"
id="test-file"
type="file"
- accept="application/octet-stream"
+ accept=".bin,.pvm"
onClick={(e) => e.stopPropagation()}
onChange={(e) => {
if (e.target.files?.length) {
diff --git a/src/components/ProgramLoader/Loader.tsx b/src/components/ProgramLoader/Loader.tsx
index 5936f58..6c5ca05 100644
--- a/src/components/ProgramLoader/Loader.tsx
+++ b/src/components/ProgramLoader/Loader.tsx
@@ -56,9 +56,7 @@ export const Loader = ({
JSON tests
Examples
-
- RAW bytecode
-
+ RAW bytecode
Assembly
diff --git a/src/packages/pvm/pvm/disassemblify.ts b/src/packages/pvm/pvm/disassemblify.ts
index cb51b11..17896b4 100644
--- a/src/packages/pvm/pvm/disassemblify.ts
+++ b/src/packages/pvm/pvm/disassemblify.ts
@@ -5,6 +5,7 @@ import {
ArgsDecoder,
instructionArgumentTypeMap,
createResults,
+ ArgumentType,
} from "@typeberry/pvm-debugger-adapter";
import { Instruction } from "./instruction";
@@ -20,7 +21,10 @@ export function disassemblify(rawProgram: Uint8Array) {
while (i < code.length) {
const currentInstruction = code[i];
- const argumentType = instructionArgumentTypeMap[currentInstruction];
+ const isValidInstruction = Instruction[currentInstruction] !== undefined;
+ const argumentType = isValidInstruction
+ ? instructionArgumentTypeMap[currentInstruction]
+ : ArgumentType.NO_ARGUMENTS;
const args = createResults()[argumentType];
try {
@@ -41,7 +45,7 @@ export function disassemblify(rawProgram: Uint8Array) {
const currentInstructionDebug = {
instructionCode: currentInstruction,
...byteToOpCodeMap[currentInstruction],
- name: Instruction[currentInstruction],
+ name: isValidInstruction ? Instruction[currentInstruction] : `INVALID(${currentInstruction})`,
instructionBytes: code.slice(i - (args.noOfBytesToSkip ?? 0), i),
address,
args,