Coder Social home page Coder Social logo

mk314k / pyssemble Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 174 KB

A Python Library for Coding Assembly and Debugging as Python Objects

License: MIT License

Python 73.47% HTML 0.56% PowerShell 19.38% Shell 6.59%
assembly compiler debugging library python

pyssemble's Introduction

Pyssemble

Pyssemble is a Python library that allows you to write assembly code and debug it with a Python-like experience. It provides a set of tools for processing and assembling assembly code, as well as a built-in debugger for efficient debugging.

Features

  • Write assembly code using a Python-like syntax.
  • Process and assemble assembly code with ease.
  • Step through and debug assembly code with the built-in debugger.
  • Lightweight and easy to integrate into existing projects.

Installation

Usage

The examples can be seen in the example folder as notebooks, here's one simple example demonstrating how to use Pyssemble:

from pyssemble import Pyssemble

# Set an address for first instruction and
# import all registers and instructions
Pyssemble.initiate(440)

# Write Assembly Program
Li(a1, 10)
Add(a2, a3, a1)
Ret()

# OR write Assembly program as string
program = """
li a1, 10
add a2, a1, a3
ret
"""
Pyssemble.load(program)

# Execute the program
Pyssemble.execute(440)

# Read Values
print(a1.value, a2.value) # Should give 10, 10

# For Debugging
from pyssemble import Debugger
Debugger.initiate()

# Now you can add print instructions
Li(a1, 10)
PrintR(a1)
Add(a2, a3, a1)
PrintR(a2)
Ret()

# Now when executing, we should expect values to be printed
Pyssemble.execute(440) # Should give 10, 10

# Or we can execute step by step using
Debugger.step()

pyssemble's People

Contributors

mk314k avatar kartikesh314 avatar

Stargazers

 avatar Niraj Pudasaini avatar Astha Shah avatar Prakash Mishra avatar  avatar  avatar

Watchers

 avatar

Forkers

asthashah11

pyssemble's Issues

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.