From 2e0b67b69e12a44020d2091ea83494283b81f360 Mon Sep 17 00:00:00 2001 From: Alexander Bass Date: Wed, 14 Feb 2024 23:05:22 -0500 Subject: [PATCH] halt and catch fire --- ISA.txt | 5 +++-- src/computer.ts | 3 +++ style.css | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ISA.txt b/ISA.txt index f8ba2e8..110c5e6 100644 --- a/ISA.txt +++ b/ISA.txt @@ -22,5 +22,6 @@ INSTRUCTIONS 0x51: Less than - 3 Parameter - If byte in register (P1) less than byte in register (P2), set byte in register (P3) to 0x01 0x52: Greater than - 3 Parameter - If byte in register (P1) greater than byte in register (P2), set byte in register (P3) to 0x01 --- Development --- -0xFE: Print byte as ASCII from register (invalid does nothing) - 1 Parameter - Prints the ASCII byte in register (P1) to console -0xFF: Print byte from register - 1 Parameter - Prints the byte in register (P1) to console +0xFE: Print byte as ASCII from register - 1 Parameter - Prints the ASCII byte in register (P1) to console +0xFF: Print byte from register - 1 Parameter - Prints the byte in register (P1) to console +0x66: Halt and Catch Fire - 0 Parameter - Fire! FIRE EVERYWHERE!!!!! \ No newline at end of file diff --git a/src/computer.ts b/src/computer.ts index 5ce0a9d..2778620 100644 --- a/src/computer.ts +++ b/src/computer.ts @@ -21,6 +21,7 @@ export enum Instr { GreaterThan, Print, PrintASCII, + HaltCatchFire, } const InstParamCount = new Map(); @@ -46,6 +47,7 @@ InstParamCount.set(Instr.GreaterThan, 3); InstParamCount.set(Instr.Print, 1); InstParamCount.set(Instr.PrintASCII, 1); +InstParamCount.set(Instr.HaltCatchFire, 0); export type TempInstrState = { pos: u8; @@ -286,6 +288,7 @@ export class Computer { if (byte === 0xff) return Instr.Print; if (byte === 0xfe) return Instr.PrintASCII; + if (byte === 0x66) return Instr.HaltCatchFire; return null; } } diff --git a/style.css b/style.css index f9058bc..c62cc46 100644 --- a/style.css +++ b/style.css @@ -29,6 +29,7 @@ body { padding: 10px; margin-left: 20px; word-wrap: break-word; + word-break: break-all; } #program_memory div.program_counter {