Giter Site home page Giter Site logo

cpu_emulator's Introduction

cpu_emulator

27th April:- I can build my own CPUs

Specs

This is a 8-bit CPU with 64 Kb of addressable memory, emulating 6502 microprocessor (OG used by Woz to make Apple 1).
This just does basic LDA and JSR instructions of the CPU. It can also create a subroutine, and branch out to execute other instructions.

Some Notes

Emulating 6502 microprocessor

  • zero page :- First 256 bytes of the CPU
  • Program Counter;- Holds the memory address to the next line of instructions to be executed
  • Stack:- Reusable memory (256 bytes)
  • Stack Pointer:- 8 bit register holding the last 8 bits of the next free location of the stack
  • Processor Regsiter:- Quick accessible registers for storing imp data
    • Input Register X,Y:- Stores the counter values
    • Accumulator:- Stores the counter values (stores all logical operations , i guess)
  • Flags:- 1-bit register values to store the results of execution of an instruction (Carry, etc)

Fns defined

  • Reset():- sets the RF, SP values + Sets the vakue of the Registers
  • Mem:- Stores
  • ReadWord for reading the 2 bytes after address of the opcode
  • WriteWord for storing requisite values to the stack pointer
  • FetchByte:- For reading a register value and incrementing PC. ReadByte:- For just reading and not incrementing

Operators defined:-

  • [], used for accessing the memory class and changing the Data var inside it.

In JSR, after address at which opcode is stored, the next 2 bytes are the addresses of the instructions of subroutine.


64 Kb addressable memory, 8-bit registers microprocessor Can't really do much except find specific memory locations, understand what to do with the upcoming registers, do those basic stuff. For making it do useful stuff, you need other I/O devices like screens, keyboards whose register values it will change to make them do useful stuff (like print hello) For making prog languages run on it. Make a compiler which can convert high-level prog to low-level instructions which can run on this CPU emulator (need to learn more here!)

cpu_emulator's People

Contributors

farzibuilder avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.