SASM (SimpleASM) - simple Open Source crossplatform IDE for NASM assembly language.
In SASM you can easily develop and execute programs, written in NASM assembly language. Enter code in form and simply run your program. Enter your input data in "Input" docking field. In "Output" field you can see the result of the execution of the program. Wherein all messages and compilation errors will be shown in the form on the bottom. You can save source or already compiled (exe) code of your program to file and load your programs from file.
SASM supports working with many opened projects – new files are opened and created in new tabs. At the exit from SASM current set of opened files saved. At the next start you can restore previous session. In settings you can set font, color scheme and initial text. SASM is translated into Russian and English. All dialog windows in SASM is docking - you can choose one of many variants of their position.
Standard "Edit" menu extended with abilities to comment/uncomment piece of source code and to create/delete indent with 4 spaces (Tab/Shift+Tab).
Starting with version 2.2 it is possible to reassign the hotkeys. File with them located on the path "Linux/share/sasm/keys.ini" ("/usr/share/sasm/keys.ini" if SASM was installed) in Linux and on the path "Windows/keys.ini" in Windows.
Starting with version 2.3 SASM supports 2 modes - x64 and x86. You can choose mode in settings on "Build" tab. "io.inc" macro library works with both modes. Also there you can change assembler and linker options.
SASM includes crossplatform input/output library "io.inc". It contains I/O macro and 2 additional macro: CMAIN - entry point and CEXTERN for invoking functions, located in C language libraries ("CEXTERN printf" for example).
Macro name | Description |
PRINT_UDEC size, data
PRINT_DEC size, data |
Print number data in decimal representation. size – number, giving size of data in bytes - 1, 2, 4 or 8 (x64). data must be number or symbol constant, name of variable, register or address expression without size qualifier (byte[], etc.). PRINT_UDEC print number as unsigned, PRINT_DEC — as signed. |
PRINT_HEX size, data | Similarly previous, but data is printed in hexadecimal representation. |
PRINT_CHAR ch | Print symbol ch. ch - number or symbol constant, name of variable, register or address expression without size qualifier (byte[], etc.). |
PRINT_STRING data | Print null-terminated text string. data - string constant, name of variable or address expression without size qualifier (byte[], etc.). |
NEWLINE | Print newline ('\n'). |
GET_UDEC size, data
GET_DEC size, data |
Input number data in decimal representation from stdin. size – number, giving size of data in bytes - 1, 2, 4 or 8 (x64). data must be name of variable or register or address expression without size qualifier (byte[], etc.). GET_UDEC input number as unsigned, GET_DEC — as signed. It is not allowed to use esp register. |
GET_HEX size, data | Similarly previous, but data is entered in hexadecimal representation with 0x prefix. |
GET_CHAR data | Similarly previous, but macro reads one symbol only. |
GET_STRING data, maxsz | Input string with length less than maxsz. Reading stoppes on EOF or newline and "\n" writes in buffer. In the end of string 0 character is added to the end. data - name of variable or address expression without size qualifier (byte[], etc.). maxsz - register or number constant. |
As the debugger SASM used gdb. In the distribution under Windows it included in the package. In Linux, you must install this package.
Attention! Before debugging make all functions formed frames (mov ebp, esp). This rule should be done for all functions, including main.
To run the debugger click "Debug" item in "Debug" menu or press F5. Now you can debug your program.
You can toggle breakpoint, clicking on line number or pressing F8 with cursor on line number, on which you want to suspend your program execution.
"Continue" command (F5) continues execution to breakpoint or to the end of your program.
"Step into" command (F11) goes to next instruction possible entering functions.
"Step over" command (F10) goes to next instruction skipping functions.
"Show registers" command (Ctrl+R) shows window with values of CPU registers.
"Show memory" command (Ctrl+M) shows window to watch variables or memory on random address.
Typing name of variable, address or any expression over text "Add variable..." and size (b - byte (1), w - word (2), d - double word (4), q - quad word (8)), in "Value" field you will see value of expression.
Also you can add variable from code, clicking right mouse button on line with variable and choose "Watch".
In expressions you can use any operator of C language (*, &, +, -, *, /, %, !, >, &, |, <<, sizeof, etc.), registers should have $ prefix ($eax for example).
If you want to watch memory on address you should check "Address" checkbox on the right.
Output format is determined in the first drop-down menu (format Smart trying to choose the most suitable type of display).
To watch contents of array specify the number of elements in the array in "array size" field.
To remove watches click right mouse button on it and choose "Delete watch" or press Del button.
In Windows watching variables from .rodata section you should display them as address.
Values of registers and expressions refreshes by jumping on next instruction.
As NASM compiler used nasm 2.11.02, as linker - gcc 4.6.2 from MinGW (gcc 4.8.1 from MinGW64 in x64 mode). . Also SASM contains gdb debugger from MinGW and "io.inc" macro library. On Windows SASM is ready for work immediately after installation.
For correct working on Linux must be installed next packages: nasm, gcc, gdb (for debugging).
If you have something does not work, check the following items:
1) Program enter point should be marked with global label _main (in Windows) or main (in Linux) or CMAIN from "io.inc" (see initial text).
2) Before debugging make all functions formed frames (mov ebp, esp or mov rbp, rsp). This rule should be done for all functions, including main. if this condition is not met, the correct work of the debugger is not guaranteed.
3) If something still does not work, but worked before, try to use the "Reset all" button in the settings on the "Common" tab.
Wishes and reports send to e-mail: Dman1095@gmail.com or left on GitHub issues.
More information and new versions of SASM see on the site: http://dman95.github.io/SASM/