Question:
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:
https://utkmcpe78-os-building-simulator.replit.app/os/app/wp-app/home
Home.html page code:
<!doctype html>
<html>
<head>
<meta
charset="utf-8"
name="viewport"
content="width=device-width, initial-scale=1"
/>
<link href="style" rel="stylesheet" type="text/css" />
<script src="script"></script>
<title>Word Processor | Home</title>
</head>
<body>
<center>
<h2>Word Processor</h2>
</center>
<a href="how-it-works">How does it work?</a>
<div id="editor" contenteditable="true"></div>
<div>
<button class="save" onclick="saveDocument()">Save</button>
</div>
<br>
<div>
<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>
</div>
<br>
<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>
</body>
</html>
// 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!