GithubHelp home page GithubHelp logo

kazik24 / asm-for-mc-cpu Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 256 KB

Toy assembly to machine code compiler and cpu emulator.

License: MIT License

Rust 100.00%
assembler emulator assembly toy cpu rust cli gui minecraft

asm-for-mc-cpu's Introduction

asm for mc cpu

Simple toy assembly to machine code compiler and cpu emulator.


This compiler is designed to work from command line, take single text file and produce binary or hexadecimal output.

Assembly Language Specification

Binary Instruction Representation

Build / Installation

Building the package

$ git clone https://github.com/Kazik24/asm-for-mc-cpu.git
$ cd asm-for-mc-cpu
$ cargo build

Installing as cargo module

$ cargo install --git https://github.com/Kazik24/asm-for-mc-cpu.git

Usage

Show help

$ asm-for-mc-cpu --help

Specify input file -i FILE

Specify output file -o FILE You can use file with extensions:

  • .bit to produce text file with binary representation of each instruction and comments, example shown below.
0000: 0000 0000 0000 0000    Or r0,r0,r0
0001: 0011 0000 1000 1111    Ex.Cldi r8,r0
0002: 0000 0000 0010 0000    #0x0020
0003: 0011 0000 1001 1111    Ex.Cldi r9,r0
0004: 0000 0000 0100 0000    #0x0040
  • .hex to produce text file with hexadecimal representation of each instruction.
  • any other extension or lack of it will produce a binary file.

Compiling some file:

$ asm-for-mc-cpu -i my_file.asm -o compiled.bit

Run emulator window -e NUMBER_OF_RAM_CELLS will launch emulator window on compiled program with scrolable memory view, register content view. You should specify number of ram cells to allocate for the emulator.

Example usage:

$ asm-for-mc-cpu -i my_code.asm -e 128

Will show emulator window with 128 cells of ram: Emulator view

asm-for-mc-cpu's People

Contributors

kazik24 avatar

Stargazers

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