mirror of
https://github.com/soconnor0919/eceg431.git
synced 2025-12-11 22:54:43 -05:00
Remove trailing whitespace and clean up comments
This commit is contained in:
@@ -53,9 +53,6 @@ class Keyboard {
|
|||||||
// Echo (except backspace)
|
// Echo (except backspace)
|
||||||
if (key < 129) {
|
if (key < 129) {
|
||||||
// Handle newline specially for cleaner output?
|
// Handle newline specially for cleaner output?
|
||||||
// Output.printChar(128) might not do NewLine with my Output implementation unless I updated it?
|
|
||||||
// My Output implementation (Step 240) does NOT check for 128.
|
|
||||||
// So I should call println() if 128.
|
|
||||||
if (key = 128) {
|
if (key = 128) {
|
||||||
do Output.println();
|
do Output.println();
|
||||||
} else {
|
} else {
|
||||||
@@ -63,8 +60,6 @@ class Keyboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If key > 129 (arrows etc), printChar might print garbage or square.
|
// If key > 129 (arrows etc), printChar might print garbage or square.
|
||||||
// Spec usually implies echoing everything or being selective.
|
|
||||||
// I'll stick to echoing only standard chars + newline.
|
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,14 +180,6 @@ class Output {
|
|||||||
let cursorRow = i;
|
let cursorRow = i;
|
||||||
let cursorCol = j;
|
let cursorCol = j;
|
||||||
return;
|
return;
|
||||||
// Spec says "and erases the character displayed there"?
|
|
||||||
// Usually moveCursor just moves it. The cursor 'character' itself (black square)
|
|
||||||
// is typically implemented by blinking or drawing.
|
|
||||||
// Project 12 spec: "A cursor, implemented as a small filled square, indicates where the next character will be displayed."
|
|
||||||
// And "erases the character displayed there"? Maybe erases the *cursor* from old location?
|
|
||||||
// Or erases the *content*? "Erases the character displayed there" usually implies drawing black square (cursor) or clearing it?
|
|
||||||
// Wait, standard implementation usually just updates coordinates.
|
|
||||||
// I will assume simple update.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Displays the given character at the cursor location,
|
/** Displays the given character at the cursor location,
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ class Screen {
|
|||||||
let address = 16384 + (y * 32) + (x / 16);
|
let address = 16384 + (y * 32) + (x / 16);
|
||||||
let value = Memory.peek(address);
|
let value = Memory.peek(address);
|
||||||
|
|
||||||
// Calculate 2^(x%16) logic inline or helper?
|
|
||||||
// x & 15 is x % 16
|
// x & 15 is x % 16
|
||||||
let mask = powersOfTwo[x & 15];
|
let mask = powersOfTwo[x & 15];
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ class String {
|
|||||||
constructor String new(int maxLength) {
|
constructor String new(int maxLength) {
|
||||||
if (maxLength = 0) {
|
if (maxLength = 0) {
|
||||||
let maxLength = 1; // min length 1 for alloc safety?
|
let maxLength = 1; // min length 1 for alloc safety?
|
||||||
// Actually spec says allocation of 0 size might happen.
|
|
||||||
// My Array.new -> Memory.alloc handles 0 size by returning a 1 word block (header-1?? No).
|
|
||||||
// Let's alloc 0 if needed.
|
|
||||||
// If maxLength is 0, we can't really store anything.
|
|
||||||
}
|
}
|
||||||
if (maxLength > 0) {
|
if (maxLength > 0) {
|
||||||
let buffer = Array.new(maxLength);
|
let buffer = Array.new(maxLength);
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ class Sys {
|
|||||||
|
|
||||||
/** Performs all the initializations required by the OS. */
|
/** Performs all the initializations required by the OS. */
|
||||||
function void init() {
|
function void init() {
|
||||||
|
// do Memory.poke(8000, 1); // Start
|
||||||
do Memory.init();
|
do Memory.init();
|
||||||
|
// do Memory.poke(8000, 2); // Mem init done
|
||||||
do Math.init();
|
do Math.init();
|
||||||
|
// do Memory.poke(8000, 3); // Math init done
|
||||||
do Screen.init();
|
do Screen.init();
|
||||||
do Output.init();
|
do Output.init();
|
||||||
do Keyboard.init();
|
do Keyboard.init();
|
||||||
@@ -35,10 +38,8 @@ class Sys {
|
|||||||
let j = 0;
|
let j = 0;
|
||||||
// Calibration: loop count determines delay.
|
// Calibration: loop count determines delay.
|
||||||
// On typical VM emulator settings (Fast), ~50-100 loops might be 1ms?
|
// On typical VM emulator settings (Fast), ~50-100 loops might be 1ms?
|
||||||
// User requested 2 seconds wait in test.
|
|
||||||
// "WaitWithInput" sample in Snake used loop for waiting.
|
// "WaitWithInput" sample in Snake used loop for waiting.
|
||||||
|
|
||||||
// Standard N2T value is roughly 50-100.
|
|
||||||
while (j < 50) {
|
while (j < 50) {
|
||||||
let j = j + 1;
|
let j = j + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user