JSFiddle - React, Tailwind, and code Playground

JavaScript

const maxBigUint = 2n ** 64n - 1n;
const registers = {};
const registerContainers = {
  GPR: [],
  MMX: [],
  // ...
};

for (let i = 0; i < 16; i++) {
  registerContainers.GPR.push(new ArrayBuffer(8));
}

function printHexStr(arr) {
  return Array.from(arr)
    .map((x) => {
      return x.toString(16).padStart(2, "0");
    })
    .join(" ");
}

function unifyTypes(operand1, operand2, readMethod) {
  operand1 = operand1.read(readMethod);
  operand2 = operand2.read(readMethod);
  const type1 = typeof operand1;
  const type2 = typeof operand2;
  if (type1 == "bigint" && type2 !== "bigint") {
    operand2 = BigInt(operand2);
  } else if (type2 == "bigint" && type1 !== "bigint") {
    operand1 = BigInt(operand1);
  }
  return {
    op2: operand2,
    op1: operand1,
  };
}

class ArithmeticLogicUnit {
  constructor() {
    this.flags = [];
  }
  add(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 + op2;
  }
  subtract(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 - op2;
  }
  multiply(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 * op2;
  }
  divide(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 / op2;
  }
  remainder(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 % op2;
  }
  and(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 & op2;
  }
  or(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 | op2;
  }
  xor(operand1, operand2, readMethod) {
    const { op1, op2 } = unifyTypes(operand1, operand2, readMethod);
    return op1 ^ op2;
  }
  andNot(operand1, readMethod) {
    const op1...