GithubHelp home page GithubHelp logo

zhanghai / mipsasm Goto Github PK

View Code? Open in Web Editor NEW
46.0 2.0 9.0 19.41 MB

MIPS assembler and IDE

License: GNU General Public License v3.0

HTML 0.03% Java 79.23% Assembly 20.75%
mips assembler mips-assembler ide java swt

mipsasm's Introduction

MIPS Assembler and IDE

本文中文版

This is my project for Computer Organization, Shi Qingsong, Zhejiang University.

The MIPS assembler is based on the MIPS 32 specification, with some custom extensions.

The MIPS IDE is built upon SWT, packaged with launch4j for Windows executable.

Screenshot

Windows

GTK3

Specification

This MIPS assembler mainly complies with the specifications from "MIPS Assembly Language Programmer’s Guide" and "MIPS32 Architecture For Programmers Volume II: The MIPS32 Instruction Set".

Instruction set

95 Instrucitons:

  • ADD
  • ADDI
  • ADDIU
  • ADDU
  • AND
  • ANDI
  • B
  • BEQ
  • BEQL
  • BGEZ
  • BGEZAL
  • BGEZALL
  • BGEZL
  • BGTZ
  • BGTZL
  • BLEZ
  • BLEZL
  • BLTZ
  • BLTZAL
  • BLTZALL
  • BLTZL
  • BNE
  • BNEL
  • BREAK
  • COP2
  • DERET
  • DIV
  • DIVU
  • ERET
  • J
  • JAL
  • JALR
  • JR
  • LA
  • LB
  • LBU
  • LDC1
  • LDC2
  • LH
  • LHU
  • LI
  • LL
  • LUI
  • LW
  • LWC1
  • LWC2
  • LWL
  • LWR
  • MFC0
  • MFHI
  • MFLO
  • MOVE
  • MOVN
  • MOVZ
  • MTC0
  • MTHI
  • MTLO
  • MULT
  • MULTU
  • NOR
  • NOP
  • OR
  • ORI
  • PREF
  • SB
  • SC
  • SDC1
  • SDC2
  • SH
  • SLL
  • SLLV
  • SLT
  • SLTI
  • SLTIU
  • SLTU
  • SRA
  • SRAV
  • SRL
  • SRLV
  • SUB
  • SUBU
  • SW
  • SWC1
  • SWC2
  • SWC3
  • SWL
  • SWR
  • TLBP
  • TLBR
  • TLBWI
  • TLBWR
  • SYSCALL
  • WAIT
  • XOR
  • XOR

10 directives:

  • .TEXT
  • .DATA
  • .ASCII
  • .ASCIIZ
  • .BYTE
  • .HALF
  • .WORD
  • .SPACE
  • .EVAL
  • .ECHO

JavaScript expression is supported for operands, while .eval can evaluate a JavaScript expression anywhere and .echo can echo the JavaScript returned string as the source code to assemble in place.

Assemble

Numerous error checks are done during the process of assembly, including illegal operand, immediate overflow, missing or duplicate label, text and data section overlap, etc.

Available output formats include binary, COE and a debug mode.

Disassemble

Disassembling can be done by opening a binary or COE file. All the instructions listed above and labels are supported, and multiple bytes of zero can be compressed into a .space directive.

Graphical user interface

  • Native GUI on Linux, Windows and Mac OSX.

  • Drag-and-drop to open a file.

  • Printing support.

  • Line number and syntax highlighting.

Command line interface

usage: mipsasm [OPTION]...
 -g,--graphical       Launch graphical user interface
 -h,--help            Display this help and exit
 -i,--input <FILE>    Read input from FILE
 -o,--output <FILE>   Write output to FILE
 -t,--terminal        Launch in terminal mode
 -w,--writer <TYPE>   Use writer of TYPE. TYPE can be 'binary', 'coe',
                      'debug' (the default), or 'hexdebug'

Sample code

# "Hello World" in MIPS assembly
# From: http://labs.cs.upt.ro/labs/so2/html/resources/nachos-doc/mipsf.html

	# All program code is placed after the
	# .text assembler directive
	.text 0x0

# The label 'main' represents the starting point
main:
	# Run the print_string syscall which has code 4
	li	$v0, 4		# Code for syscall: print_string
	la	$a0, msg	# Pointer to string (load the address of msg)
	syscall
	li	$v0, 10		# Code for syscall: exit
	syscall

	# All memory structures are placed after the
	# .data assembler directive
	.data 0x20

	# The .asciiz assembler directive creates
	# an ASCII string in memory terminated by
	# the null character. Note that strings are
	# surrounded by double-quotes

msg:	.asciiz	"Hello World!\n"

mipsasm's People

Contributors

zhanghai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mipsasm's Issues

Delay slot

Currently it is taken into consideration when calculating address, but no NOP is inserted yet.

Need to correct this behavior, and add a setting if possible.

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.