You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
320 B
18 lines
320 B
2 years ago
|
import { ButtonMachine } from "../src/buttons.js";
|
||
|
|
||
|
const cpu = new ButtonMachine([
|
||
|
["PUSH", 10],
|
||
|
["PUSH", 1],
|
||
|
["SUB"],
|
||
|
["JZ", 5],
|
||
|
["JUMP", 1],
|
||
|
["PUSH", 100],
|
||
|
["HALT"]
|
||
|
]);
|
||
|
|
||
|
cpu.run();
|
||
|
|
||
|
console.log("STACK TOP", cpu.stack_top);
|
||
|
console.log("REGISTER", cpu.register_entries);
|
||
|
console.log("STACK", cpu.stack);
|