Giter VIP home page Giter VIP logo

assembly's Introduction

Jacob's Text Magic

A simple assembly language built for ECE3242 (Computer Architecture). We often had to write and insert binary into memory manually (see here). Furthermore, compilation and simulation took upwards of 10 minutes. By creating this program, I was able to write the program in assembly, simulate the behavior using the builtin emulator, and compile the program to the expected binary format.

Usage

Visit the website and start typing. Use Ctrl+S to convert from assembly -> binary.

Examples

Simple Addition

Initialize a register and double the value [link].

Using Memory

Store a value to memory and read it in the debug line [link].

Looping

Here is a simple for loop that counts down from 10 to 1 and stop looping at 0 [link].

Labels

A loop that never ends, using a label [link].

Instruction Set

The following instruction sections include the specific format that each format expects and a technical description.

mov1

mov1 Ra IMM
REG[Ra] <= MEM[IMM]

mov2

mov2 Ra IMM
MEM[IMM] <= REG[Ra]

save

save Ra Rb
MEM[REG[Ra]] <= REG[Rb]

Previously mov3

set

set Ra IMM
REG[Ra] <= IMM

Previously mov4

load

load Ra Rb
REG[Ra] <= MEM[REG[Rb]]

add

add Ra Rb Rc
REG[Ra] <= REG[Rb] + REG[Rc]

Previously there were only two registers (add Ra Rb)

subt

subt Ra Rb Rc
REG[Ra] <= REG[Rb] - REG[Rc]

Previously there were only two registers (subt Ra Rb)

jz

jz Ra IMM
jump to IMM if REG[Ra] == 0

readm

readm IMM
out <= MEM[IMM]

halt

halt
halts program

Instruction Formats

Here is a list of the various instruction formats that could occur.

0000 0000 0000 0000
OP   Ra   Rb   Rc
OP   Ra   IMM  IMM
OP   --   IMM  IMM

FAQ

Are there comments?

Yes, you can use # to tell the compiler to ignore the rest of the line.

Are there labels?

Yes, you can use <LABEL>: to tell the compiler to attach <LABEL> to the following line number.

Are there variables?

Yes, you can use #define XX XX to define a variable. For example, #define A B tells the compiler to replace all occurrences of A with B.

Project setup

Want to run the website locally? Just use the following commands :)

# install the deps
npm i

# run the dev server
npm run serve

# build the project -> docs/
npm run build

# run the tests
npm run test:unit

assembly's People

Contributors

jsmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.