push ebp
  mov ebp, esp
  sub esp, 0000000Ch
  push 00401326h ; undef 'Ignore this
  mov eax, fs:[00000000h]
  push eax
  mov fs:[00000000h], esp
  sub esp, 00000078h
  push ebx
  push esi
  push edi
  mov var_C, esp
  mov var_8, 00401238h
  mov edi, [004010CCh] ; __vbaFixstrConstruct
  lea eax, var_1C
  xor esi, esi
  push eax
  push 00000100h
  mov var_18, esi
  mov var_24, esi
  mov var_28, esi
  mov var_2C, esi
  mov var_30, esi
  mov var_34, esi
  mov var_38, esi
  mov var_3C, esi
  mov var_40, esi
  mov var_44, esi
  mov var_54, esi
  mov var_64, esi
  mov var_74, esi
  call edi
  lea ecx, var_20
  push ecx
  push 00000100h
  call edi
  mov edx, var_1C
  mov edi, [0040114Ch] ; %S_eax_S = #StkVar1%StkVar2 '__vbaStrToAnsi
  push 00000100h
  lea eax, var_40
  push edx
  push eax
  call edi
  lea ecx, var_2C
  push eax
  lea edx, var_28
  push ecx
  mov ecx, var_20
  lea eax, var_30
  push edx
  push eax
  push 00000100h
  lea edx, var_38
  push ecx
  push edx
  call edi
  push eax
  lea eax, var_34
  push 00402544h ; "C:\"
  push eax
  call edi
  push eax
  GetVolumeInformation(%x1, %x2, %x3, %x4, %x5, %x6, %x7, %x8)
  call [00401048h] ; GetLastError()
  mov ecx, var_38
  mov edi, [004010E8h] ; %S_eax_S = #StkVar1%StkVar2 '__vbaStrToUnicode
  lea edx, var_3C
  push ecx
  push edx
  call edi
  mov ebx, [0040103Ch] ; __vbaLsetFixstr
  push eax
  mov eax, var_20
  push eax
  push esi
  call ebx
  mov ecx, var_40
  lea edx, var_44
  push ecx
  push edx
  call edi
  push eax
  mov eax, var_1C
  push eax
  push esi
  call ebx
  lea ecx, var_44
  lea edx, var_40
  push ecx
  lea eax, var_3C
  push edx
  lea ecx, var_38
  push eax
  lea edx, var_34
  push ecx
  push edx
  push 00000005h
  call [0040112Ch] ; %v = ""
  mov eax, var_30
  add esp, 00000018h
  push eax
  call [0040100Ch] ; @CStr(%StkVar1)
  mov esi, [00401170h] ; %ecx = %S_edx_S '__vbaStrMove
  mov edx, eax
  lea ecx, var_24
  call %ecx = %S_edx_S '__vbaStrMove
  mov ecx, var_24
  push 00000001h
  push ecx
  push 00402550h
  push 00000001h
  call [00401114h] ; @InStr(%StkVar4, %StkVar3, %StkVar2, %StkVar1)
  test eax, eax
  jz 00403907h
  lea edx, var_24
  lea eax, var_54
  mov var_6C, edx
  push eax
  lea ecx, var_74
  push 00000002h
  lea edx, var_64
  push ecx
  push edx
  mov var_4C, 80020004h
  mov var_54, 0000000Ah
  mov var_74, 00004008h
  call [00401088h] ; %x1 = Mid(%StkVar2, %StkVar3, %StkVar4)
  lea eax, var_64
  push eax
  call [0040101Ch] ; @%x1 '__vbaStrVarMove
  mov edx, eax
  lea ecx, var_24
  call %ecx = %S_edx_S '__vbaStrMove
  lea ecx, var_64
  lea edx, var_54
  push ecx
  push edx
  push 00000002h
  call [00401024h] ; undef 'Ignore this '__vbaFreeVarList
  add esp, 0000000Ch
  lea ecx, var_74
  push 00000007h
  lea edx, var_54
  lea eax, var_24
  push ecx
  push edx
  mov var_6C, eax
  mov var_74, 00004008h
  call [00401168h] ; %x1 = Left(%StkVar2, %StkVar3)
  lea eax, var_54
  push eax
  call [0040101Ch] ; @%x1 '__vbaStrVarMove
  mov edx, eax
  lea ecx, var_18
  call %ecx = %S_edx_S '__vbaStrMove
  lea ecx, var_54
  call [00401018h] ; undef 'Ignore this '__vbaFreeVar
  push 0040399Ah
  jmp 00403984h
  test var_4, 04h
  jz 00403954h
  lea ecx, var_18
  call [00401190h] ; %ecx = ""
  lea ecx, var_44
  lea edx, var_40
  push ecx
  lea eax, var_3C
  push edx
  lea ecx, var_38
  push eax
  lea edx, var_34
  push ecx
  push edx
  push 00000005h
  call [0040112Ch] ; %v = ""
  lea eax, var_64
  lea ecx, var_54
  push eax
  push ecx
  push 00000002h
  call [00401024h] ; undef 'Ignore this '__vbaFreeVarList
  add esp, 00000024h
  ret
  mov esi, [00401190h] ; %ecx = ""
  lea ecx, var_1C
  call %ecx = ""
  lea ecx, var_20
  call %ecx = ""
  lea ecx, var_24
  call %ecx = ""
  ret
  mov ecx, var_14
  mov eax, var_18
  pop edi
  pop esi
  mov fs:[00000000h], ecx
  pop ebx
  mov esp, ebp
  pop ebp
  ret
  nop 

Assembly Online Compiler

Write, Run & Share Assembly code online using OneCompiler's Assembly online compiler for free. It's one of the robust, feature-rich online compilers for Assembly language. Getting started with the OneCompiler's Assembly compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Assembly and start coding.

About Assembly

Assembly language(asm) is a low-level programming language, where the language instructions will be more similar to machine code instructions.

Every assembler may have it's own assembly language designed for a specific computers or an operating system.

Assembly language requires less execution time and memory. It is more helful for direct hardware manipulation, real-time critical applications. It is used in device drivers, low-level embedded systems etc.

Syntax help

Assembly language usually consists of three sections,

  1. Data section

    To initialize variables and constants, buffer size these values doesn't change at runtime.

  2. bss section

    To declare variables

  3. text section

    _start specifies the starting of this section where the actually code is written.

Variables

There are various define directives to allocate space for variables for both initialized and uninitialized data.

1. To allocate storage space to Initialized data

Syntax

variable-name    define-directive    initial-value 
Define DirectiveDescriptionAllocated Space
DBDefine Byte1 byte
DWDefine Word2 bytes
DDDefine Doubleword4 bytes
DQDefine Quadword8 bytes
DTDefine Ten Bytes10 bytes

2. To allocate storage space to un-initialized data

Define DirectiveDescription
RESBReserve a Byte
RESWReserve a Word
RESDReserve a Doubleword
RESQReserve a Quadword
RESTReserve a Ten Bytes

Constants

Constants can be defined using

1. equ

  • To define numeric constants
CONSTANT_NAME EQU regular-exp or value

2. %assign

  • To define numeric constants.
%assign constant_name value

3. %define

  • To define numeric or string constants.
%define constant_name value

Loops

Loops are used to iterate a set of statements for a specific number of times.

mov ECX,n
L1:
;<loop body>
loop L1

where n specifies the no of times loops should iterate.

Procedures

Procedure is a sub-routine which contains set of statements. Usually procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.

procedure_name:
   ;procedure body
   ret