Mips Assembler/Disassembler [Code Hacking Tool]
#1
Tongue 
# Mips-Assembler
```
Github: TylerDev905
Language: VB .NET
Date: 2015-04-06

```
##Purpose

This software will allow a user to Assemble/Disassemble MIPS assembly code. The program features an extended command system that will make programming in MIPS assembly language much easier. The Gui is designed with 3 main components, a syntax highlighter for the assembly code, a textbox containing the assembled 32bit aligned byte code and textbox that contains the console output. To assemble code, type in the desired assembly code then click the assemble button located on the button of the gui. The user also has the option to paste 32bit aligned byte code into the specified textbox and click disassemble.

***

##Features
1. Assemble
2. Disassemble
3. Autocomplete
4. Syntax Highlighting / Tab indenting
5. Error Scanning
6. Labels
7. Commands
8. Easy to extend/edit syntax and operations
9. Find/Replace
10. Read .cds files

***

[Image: VGNfcPY.png]

Figure 1 - Shows the GUI with some code that is being assembled.

[Image: 0rrpFn6.png]

Figure 2 - Shows the Find/Replace menu.

[Image: 0jMBngN.png]

Figure 3 - Shows the GUI with some code that is being assembled. It displays the error messages in the console and marks the line.


##Dependencies

The program utilizes Scintilla .NET as a syntax highlighter component. The scintilla component depends on 3 dll files. If you are looking to help with development, you should be aware that the Scintilla dlls may need to be placed in the syswow64 folder on windows for .NET to be able to load them correctly.

***

##Syntax Rules

All operations must follow proper form or else the assembler will display the line number and hex address where an error was found. This is represented by a red marker on the side of the assembler, located beside the index number. Please ensure to never use trailing commas( **,** ) after an operation. This will almost always throw an error. Capital letters should only be used in label definitions.

Syntax rules are loaded from an external .xml file "Operations.xml", located in the applications directory.
The file contains operation data that control how the operation is parsed.

Example: **Operations.xml**:
Code:
    <Operation>
        <Name>addiu</Name>
        <Description>Adds a register and a sign-extended immediate value and stores the result in a register.</Description>
        <Bin>001001ssssstttttiiiiiiiiiiiiiiii</Bin>
        <SyntaxItemId>8</SyntaxItemId>
    </Operation>

In the example above we have the _attributes Name, Description, Bin and SyntaxItem._

**Name** - The string representing the instruction

**Description** - A description of the operation, this will be displayed in different places throughout the program.

**Bin** - This is the binary template. The template contains several place holders for different types of arguments.

**SyntaxItemId** - This is an integer that represents the index of the syntax mask that the operation should use. Syntax masks are located in "Syntax.xml".

Example: **Syntax.xml**

Code:
<Item>
    <Mask>$s, $t, offset</Mask>
    <Pattern>instruction(?: |\t){0,}(.{2,4}),(?: |\t)(.{2,4}),(?: |\t){0,}\$([0-9a-f]{4})</Pattern>
</Item>

**Mask** - Uses place holders to represent the arguments and the type of arguments to parse for. Place holders are hard coded into the software and cannot be extended by editing the .xml files.

**Pattern** - This is a regex pattern that will match the current set of arguments in the mask.

###Argument Place holders
1. $t - Target register
2. $d - Destination register
3. $s - source register
4. target - target address
5. offset - the difference between two addresses
6. imm - the immediate value
7. h - the hex value
8. nop - no operation

###Binary Place holders
1. ttttt
2. ddddd
3. sssss
4. aaaaaaaaaaaaaaaaaaaaaaaaaa
5. iiiiiiiiiiiiiiii
6. iiiiiiiiiiiiiiii
7. hhhh
8. nop

***

##Registers

The software currently supports EE,COP0 and COP1 registers. Each set of registers is located in it's respective .xml file, located in the application directory.

***

##Commands
**address 2345678**

The address command is used to change the address of the parser. The code below the location of the address command will increment from the base address specified.

**hexcode 2345678**

The hexcode command is used to set data at the address the assembler is currently on when reading the hexcode command.

**string "Hello World"**

The string command is used to write a string and convert it into byte code. The byte code will then be aligned and set at the address that the assembler is currently on when reading the command.

**label :Fnc1**

A label is a human readable string that represents a bookmarked address. The human readable string can then be used in branch/target type operations.

***

###Game Labels

[Image: RHroByv.png]

Game labels are just like the labels you would use when writing code in the assembler, except they can be managed
in the label manager. These labels can be references to known areas in a memory dump or addresses of other project's. We can then manage the labels by the following options; add, edit, delete, save and load. Labels will be displayed under the **Autocomplete** box. This box can be seen by pressing **CTRL + Spacebar** when in the assembler textbox.

***

###Assembler Misc

**Comments** - Single and multiline comments can be used.
Reply

Sponsored links

#2
Nice work dude ! Smile
We're supposed to be working as a team, if we aren't helping and suggesting things to each other, we aren't working as a team.
- Refraction
Reply




Users browsing this thread: 1 Guest(s)