Giter VIP home page Giter VIP logo

simpletron's Introduction

Simpletron

From the apprentice Lab 10.10 (maybe).

The requirements given are as follows. requirements

However I have also added in a stack which grows up from the bottom of the memory. I have also added a call and return opcode and a memory dump opcode for debugging, and added instructions to implement a simplistic printing function.

New Instructions

Instruction Human Readable Description
12xx WRITE the Accumulator contents to stdout
22xx PUSH the Accumulator to the stack
23xx POP from stack to accumulator
24xx CALL subroutine at the memory location currently in the accumulator. The current programCounter is pushed to the stack
25xx RETurn from subroutine to the memory location popped from the stack.
99xx DUMP memory to stdout
50xx LOAD Literal xx into accumulator
51xx LOAD from Address in accumulator, into the accumulator

Considerations

  1. The CALL and RET instructions rely on the programCounter to be the next item in the stack. Each subroutine must therefore ensure that there is a POP for every PUSH performed.
  2. The 100 words of memory are not used to hold the program code, there is a separate program memory for this.

Build and Run

The project uses cmake, so to make use:

> mkdir build
> cd build
> cmake ..
> make

To run tests:

make test

To run as normal:

> ./src/simpletron

To enable debug messages run with debug as the argument

> ./src/simpletron debug 

simpletron's People

Contributors

geekskick avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.