📜 ⬆️ ⬇️

SASM - IDE for assembler

Hello, dear habravchane!

With this post I want to introduce to the community a project that has been written from time to time by me for the last year: SASM (SimpleASM) - IDE for developing programs in the x86 and x86-64 assembler languages.

image
')
SASM is a simple cross-platform (available on Windows and Linux) development environment for assembly languages ​​NASM, MASM, GAS, FASM with syntax highlighting and debugger. The program works out of the box and is well suited for beginners to learn assembly language. Based on Qt. Distributed under the free license GNU GPL v3.0.

Sources are in the repository on GitHub .
Binaries can be downloaded from the program website .

Under the cut you will find a little history and a more detailed description of the possibilities.

Where did it all go


At the 1st year at my university I took the “Architecture and Assembly Language” course, in which we studied the NASM assembler and passed tasks on it in ejudge contests. Accustomed to using IDE when programming before that, I was not very happy to compile everything on the command line. Convenient in my opinion IDE for NASM was not. I didn’t really like the universal solutions like Geany (although there is no friend to the taste and color - someone used all this and was pleased). Yes, and I already wanted to do something big and at the same time learn C ++.
So, it was decided to write my IDE for NASM, first of all for myself and maybe fellow students.

I didn't have any experience writing a GUI before. After some deliberation, it was decided to use Qt - a good free framework, along with cross-platform. At first, a simple text editor was written with a simple highlight, a log of construction and input / output windows. Proudly called “IDE”, the program was able to collect text that was in a text editor and run a built program.
Then, after learning some regular expressions, I made a beautiful highlight. Screw the debugger (GDB). Added tabs and all sorts of simple features in a text editor such as searching and commenting on a piece of code. Gradually finished the program to a more or less normal form, corrected errors.

In the spring of this year, SASM was included in the above-described training course, and first-year students already used it. Recently I added support for other assemblers to the program, besides NASM - MASM, FASM and GAS.

Opportunities


image

First, it’s just a code editor with backlighting, tabs, and program building and execution capabilities. Can run in a separate window.
The log contains information about the time of the program. There are 2 forms for input and output. As I said, the program was originally intended for the delivery of contests. The last two possibilities are very convenient for this. If you still need to save exe'shnik, this can be done in the "File" menu.

Debugger

image

One of the most difficult components in the program is the debugger. There are not so many opportunities, but there is a certain minimum basic set: it shows the current line, takes a step in, without a call, continues execution / pauses the program, you can set breakpoints, watch registers and memory. Also, for those who have basic capabilities, the command line for entering arbitrary commands for GDB is still missing from the bottom of the window.

Yes, the debugger is based on GDB. It was not very easy to make it because of the limitations of the assembler. In particular, NASM does not know how to generate normal debugging information and it is necessary to determine the current location in the program, associating the listing generated by the assembler and the current address in the EIP command counter.

Macro library for NASM

SASM includes a macro library for I / O “io.inc” used in the “Architecture and Assembly Language” course and is slightly rewritten to debug and support 64-bit mode. It is very convenient at the initial stages of training - allows you to display data without thinking about the conventions and rules for calling functions.

For example, to print the number contained in the EAX register, just write

PRINT_DEC 4, eax ; 4 -

instead

section .data
format db "%d", 0
section .text
push eax
push format
call printf
add esp, 8

The commands contained in “io.inc” can be found in the help.

Options

image

In the program settings, you can fully customize the text editor - set the color scheme, select the font, set the initial text.
The language is also set there (Russian and English are available).

image

Also in the options available choice of assembler (NASM, MASM, GAS or FASM) and bit (x86 or x64). These options affect the choice of programs - the assembler and linker, and options for them. Also under the new assembler adjusts the backlight and the initial text. Paths and assembly options can be set manually.

Additionally

The program contains help and sample programs for each assembler - the Hello World program in the Projects folder and initial templates so that you can start writing code right away.

On Windows, all components necessary for building programs are already included in SASM. The program works out of the box - you can start programming immediately after launch.
On Linux, you should install gcc, gdb and the necessary assembler.

Conclusion


More information about the program and the source can be viewed at the links above. The quality of the code in the beginning may not be very good - only I mastered C ++ and OOP, I apologize right away just in case.

Open Source project - so if suddenly someone wants to join and change something - Welcome!
Also I will be glad to feedback, suggestions and error messages. And of course reasonable criticism, where without it.

Source: https://habr.com/ru/post/230359/


All Articles