halt and catch fire

This commit is contained in:
Alexander Bass 2024-02-14 23:05:22 -05:00
parent e53d40d5be
commit 2e0b67b69e
3 changed files with 7 additions and 2 deletions

View file

@ -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 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 0x52: Greater than - 3 Parameter - If byte in register (P1) greater than byte in register (P2), set byte in register (P3) to 0x01
--- Development --- --- Development ---
0xFE: Print byte as ASCII from register (invalid does nothing) - 1 Parameter - Prints the ASCII 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 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!!!!!

View file

@ -21,6 +21,7 @@ export enum Instr {
GreaterThan, GreaterThan,
Print, Print,
PrintASCII, PrintASCII,
HaltCatchFire,
} }
const InstParamCount = new Map(); const InstParamCount = new Map();
@ -46,6 +47,7 @@ InstParamCount.set(Instr.GreaterThan, 3);
InstParamCount.set(Instr.Print, 1); InstParamCount.set(Instr.Print, 1);
InstParamCount.set(Instr.PrintASCII, 1); InstParamCount.set(Instr.PrintASCII, 1);
InstParamCount.set(Instr.HaltCatchFire, 0);
export type TempInstrState = { export type TempInstrState = {
pos: u8; pos: u8;
@ -286,6 +288,7 @@ export class Computer {
if (byte === 0xff) return Instr.Print; if (byte === 0xff) return Instr.Print;
if (byte === 0xfe) return Instr.PrintASCII; if (byte === 0xfe) return Instr.PrintASCII;
if (byte === 0x66) return Instr.HaltCatchFire;
return null; return null;
} }
} }

View file

@ -29,6 +29,7 @@ body {
padding: 10px; padding: 10px;
margin-left: 20px; margin-left: 20px;
word-wrap: break-word; word-wrap: break-word;
word-break: break-all;
} }
#program_memory div.program_counter { #program_memory div.program_counter {