🚨 Disclaimer: This project is for educational purposes and is not intended for production use.
This repository contains a simplified CPU emulator implemented in TypeScript and designed to run on Deno. The emulator mimics basic CPU operations like incrementing and decrementing a register (r1
), and it features a memory array for storing opcodes.
- Written in TypeScript
- Designed to run on Deno
- Simulates basic CPU operations (increment, decrement)
- Memory array for opcode storage
- Program Counter (pc) and a single register (r1)
deno task start
deno test
The code in src/index.ts
shows how to use the CPU emulator:
// src/index.ts
import { SimpleCPU } from '@/simple_emulator.ts'
const cpu = new SimpleCPU()
cpu.memory[0] = 0x01
cpu.memory[1] = 0x01
cpu.memory[2] = 0x02
cpu.memory[3] = 0x01
cpu.memory[4] = 0xff
cpu.run()
console.log(`Final value of r1: ${cpu.r1}`)
// Output:
// Final value of r1: 2