Need help building my OS Simulator

Currently I am working on the word processing unit for the simulator that should connect to a file explorer. Below is what I have for the page so far.

But the question is, why is none of it working? How can I update the JavaScript so that my program actually WORKS?!
Repl link:

Home.html page code:

<!doctype html>
      content="width=device-width, initial-scale=1"
    <link href="style" rel="stylesheet" type="text/css" />
    <script src="script"></script>
    <title>Word Processor | Home</title>
      <h2>Word Processor</h2>
    <a href="how-it-works">How does it work?</a>
    <div id="editor" contenteditable="true"></div>
      <button class="save" onclick="saveDocument()">Save</button>
      <button class="fontstyling" style="font-weight: bold;" onclick="formatText('bold')">Bold</button>
      <button class="fontstyling" style="text-decoration: italic;" onclick="formatText('italic')">Italic</button>
      <button class="fontstyling" style="text-decoration: underline;" onclick="formatText('underline')">Underline</button>
    <button onclick="undo()">Undo</button>
    <button onclick="redo()">Redo</button>
    <button onclick="changeFontFamily('Arial')">Arial</button>
    <button onclick="changeFontFamily('Times New Roman')">Times New Roman</button>
    <button onclick="changeFontSize(14)">14px</button>
    <button onclick="changeFontSize(18)">18px</button>
    <!-- Add these buttons in the body section -->
    <button onclick="alignText('left')">Left</button>
    <button onclick="alignText('center')">Center</button>
    <button onclick="alignText('right')">Right</button>
    <button onclick="alignText('justify')">Justify</button>
    <input type="color" id="textColorPicker" onchange="changeTextColor()">

    <script src="wp.js"></script>

JavaScript file:

// Initialize memory and other system resources
const memorySize = 1024; // Size in bytes
const memory = new Array(memorySize).fill(0); // Initialize memory with zeros

// Set up global variables
let currentProcess = null; // Track the currently executing process

function handleInterrupt(interruptType) {
  if (interruptType === 'timer') {
    // Context switch to the next process
    // Save the current process state
    // Load the next process into memory
  } else if (interruptType === 'disk') {
    // Handle disk I/O requests
  // Add more cases for other interrupt types

function createProcess(program) {
  // Allocate memory for the process
  // Set initial program counter
  // Add process to the ready queue

function scheduleNextProcess() {
  // Choose the next process to run
  // Context switch to the selected process

function allocateMemory(process, size) {
  // Allocate 'size' bytes of memory for the process
  // Update memory map

function freeMemory(process) {
  // Release memory occupied by the process
  // Update memory map
function readFile(filename) {
  // Read data from the file

function writeFile(filename, data) {
  // Write data to the file

function handleKeyboardInterrupt(keyCode) {
  // Process keyboard input

function handleDiskInterrupt(operation, filename) {
  // Handle disk read/write requests

Can anyone help me with what I am looking for? Thanks for your time in advance!

Hi @UtkMcpe78 !
Maybe create a Bounty for this? This is more than a code help, seems like a project or multiple tasks.

1 Like

Hey just wanna say, if you’re working with bytes you should use something like Uint16Array

Why did you edit your post like that? If you meant to have the same effect as deleting it, you should probably still keep it up because someone could have the same problem.

1 Like

Also it broke the edit history somehow, and credited me for a title change I didn’t make.


Wdym by that? “Right” what?


@boston2029 I just meant that I didn’t really receive any feedback on how to help solve my problem; therefore, it wouldn’t have occurred to me that there were other people trying to troubleshoot this issue as well. Does that make sense?

1 Like

Interesting… I genuinely thought you edited the post, but if you didn’t, that’s interesting…

1 Like

Perhaps not at this very moment, but multiple people having similar issues is not that rare.


Then don’t just give up on the topic…someone who knows the answer might come along just a little bit later and solve it for you. If you don’t get any solution, then you can just leave the topic be in case you get one eventually.


@boston2029 @QwertyQwerty88 Ok, thanks!


I had, but not to the state the edit history says I did.

1 Like

And now I can’t edit title/tags? :thinking:


Yeah, I think the post is locked :thinking:


@NateDhaliwal why :question: ?


What does locked mean?

1 Like

A locked post is one that cannot be edited by non-staff


@Firepup650 ok‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎