Online Asm Compiler

; Use STRING_TERMINATOR equ 0 SECTION .bss buffer: resb 10 SECTION .data thestring: db "1234",0 errormsg: db "ERROR! Invalid input.",0 SECTION .text ; Input: ; ESI = pointer to the string to convert ; ECX = number of digits in the string (must be > 0) ; Output: ; EAX = integer value string_to_int: push ebx push edx xor edx,edx ; clear edx xor ebx,ebx ; clear ebx cmp byte[esi], '-' ; Do we have a minus sign? jne .next_digit ; If not, just start our loop mov dl, 1 ; Otherwise, put a 1 in DL and move on for now dec ecx ; dec ecx because we are done checking the first char .next_digit: cmp ecx, 0 ; Have we reached the end of our iteration? Don't move off the rez! je .done ; if ecx=0 then we're done movzx eax,byte[esi] inc esi cmp al,39h ; Test current char against 39h (highest ASCII digit) sub al,'0' ; convert from ASCII to number imul ebx,10 add ebx,eax ; ebx = ebx*10 + eax dec ecx ; Decrement ecx to keep track that we are done with the current char loop .next_digit ; while (--ecx) .done: mov eax,ebx ; put our numeric value in the accumulator cmp dl, 1 ; check whether we said this was a negative quantity or not jne .really_done ; jump to the .really-done label if dl != 1 imul eax, -1 ; otherwise, we have a negative number, ; so multiply the absolute value (in EAX currently) by -1 .error: mov eax, 4 mov ebx, 1 mov ecx, errormsg mov edx, $-errormsg int 80h mov eax, 1 mov ebx, -1 int 80h .really_done: ; Now, we are really done (for real) pop edx pop ebx ret ; Input: ; EAX = integer value to convert ; ESI = pointer to buffer to store the string in (must have room for at least 10 bytes) ; Output: ; EAX = pointer to the first character of the generated string int_to_string: add esi,9 mov byte [esi],STRING_TERMINATOR mov ebx,10 .next_digit: xor edx,edx ; Clear edx prior to dividing edx:eax by ebx div ebx ; eax /= 10 add dl,'0' ; Convert the remainder to ASCII dec esi ; store characters in reverse order mov [esi],dl test eax,eax jnz .next_digit ; Repeat until eax==0 mov eax,esi ret GLOBAL _start _start: nop ; GDB likes this lea esi,[thestring] mov ecx,4 call string_to_int ; EAX now contains 1234 ; Convert it back to a string lea esi,[buffer] call int_to_string ; You now have a string pointer in EAX, which ; you can use with the sys_write system call mov ecx, eax mov eax, 4 ; Specify sys_write kernel call mov ebx, 1 ; Specify file descriptor 1: Standard Output lea ecx, [buffer] ; NOTE: ECX contains the address of the string buffer mov edx, 10 ; buffer length int 80h mov eax, 1 mov ebx, 0 int 80h

About Online Asm Compiler

Try our Online Asm Compiler (Version Nasm v2.15.05) to Edit, Run, and Share your Asm Code directly from your browser. This online development environment provides you the latest version Nasm v2.15.05.

How to use Online Asm Compiler?

Write and Execute Code

  • Write your program (or, paste it) directly under the "Source Code" tab.
  • If you want to save your program, go to the "Project" menu and save it.
  • You can directly execute your program without saving it by clicking on on "Execute" button.

User Input

The latest version of Coding Ground allows to provide program input at run time from the termnial window exactly the same way as you run your program at your own computer. So simply run a program and provide your program input (if any) from the terminal window available in the right side.

Online Asm Compiler: Keyboard Shortcuts

The following are the keyword shortcut of this Online Asm Compiler:

ShortcutDescription
⌘ + EnterRun the program
⌘ + SSave Project (Login Required)
⇧ + ⌘ + SSave As Project
⌘ + PNew Project
⌘ + GShare Project
⌘ + ZUndo Editing
⌘ + YRedo Editing
⌘ + ASelect All Text
⌘ + XCut Selected Text
⌘ + CCopy Selected Text
⌘ + VPaste Copied Text
⌘ + FSearch Text
⌘ + ⌥ + FReplace Text
ShortcutDescription
Ctrl + EnterRun the program
Ctrl + SSave Project
Shift + Ctrl + SSave As Project
Ctrl + GShare Project
Ctrl + ZUndo Editing
Ctrl + YRedo Editing
Ctrl + ASelect All Text
Ctrl + XCut Selected Text
Ctrl + CCopy Selected Text
Ctrl + VPaste Copied Text
Ctrl + FSearch Text
Ctrl + HReplace Text

Online Asm Compiler: Save and Share Asm Code (Project)

Save Asm Project Online

You can save your Asm Project with us so that you can access this project later on. To save a project you will need to create a login Id with us. So before you save a project, please create a login Id using a link given at the top right corner of this page.

Share Asm Project Online

You can use this feature to share your Asm Code with your teachers, classmates and colleagues. Just click Share Button and it will create a short link, which can be shared through Email, WhatsApp or even through Social Media. A shared link will be deleted if it has been passive for almost 3 months.

More Features of Online Asm Compiler

  • Theme – You can change the current editor's theme from the "Editor Theme" option under "Settings" menu.
  • Font Size – You can change the font size of the editor /compiler from from the "Font Size" option under "Settings" menu.
  • Tab Size – You can change the tab size from the "Tab Size" option under "Settings" Menu.
  • Show/Hide Line Numbers – You can show/hide the line number with the code from the "Show Line Numbers" or "Hide Line Numbers" option under "Settings" Menu.
  • And, many more.

Benefits of Using Online Asm Compiler

There are several benefits of using the Online Asm Compiler to run your Asm code:

  • Platform independence: You can run your code from any device without taking care of operating systems.
  • Convenience: You don't need to install anything for using this.
  • No setup required: There is no need for additional setup to run your code.
  • Updated version: Our online compiler/editors/terminals are the latest up-to-date.
 Execute |  Beautify | Share
My Projects
Change Password
My Profile
Logout
Undo
Redo
Cut
Copy
Paste
Delete
Select All
Find
Find and Replace
Editor Theme
Crimson
Eclipse
Github
Solarized
Cobalt
krTheme
Monokai
Terminal
Textmate
Twilight
Vibrant Ink
Font Size
8px
9px
10px
11px
12px
13px
14px
15px
16px
17px
18px
20px
22px
24px
Tab Size
1
2
3
4
5
6
7
8
Show Invisible
Hide Invisible
Show Line Numbers
Hide Line Numbers
Ace Editor (Default)
Vim Editor
Emacs Editor
Open New Project
Save Project
Save As New Project
Share Project
Search Project
Online Java Compiler
Online Python Compiler
Online C++ Compiler
Online CSharp Compiler
Online C Compiler
Online PHP Compiler
Online R Compiler
Online NumPy Compiler
More Compilers