section .data
global _start_start:
push ebp
mov ebp,esp
sub esp, 8
mov DWORD [ebp-4], 4
mov DWORD [ebp-8], 4mov DWORD eax, [ebp-4]
mov ebx,0L1: cmp ebx,eax
jl L2mov eax, 0x01
mov ebx, ecx
int 0x80L2: add ebx, 1
add ecx, eax
jmp L1
Category Archives: Assembly Program
Basic assembly program in X86 -3 (Taking input through keyboard and printing)
section .text
global _start_start:
push ebp
mov ebp,esp
sub esp, 4; Read value using system call sys_read
mov eax, 0x03
mov ebx, 0x02
lea ecx, [ebp-4]
mov edx, 4
int 0x80
; Write value using system call sys_write
mov eax, 0x04
mov ebx, 0x01
lea ecx, [ebp-4]
mov edx, 4
int 0x80;Exiting the program using system call sys_exit
mov eax, 0x01
mov ebx, 0x00
int 0x80
Basic assembly program in X86 -2 (Adding two numbers)
section .text
global _start_start:
push ebp
mov ebp, esp
sub esp, 12
mov DWORD [ebp-4], 10
mov DWORD [ebp-8], 20
push DWORD [ebp-8]
push DWORD [ebp-4]
call add
mov [ebp-12], eax
mov eax, [ebp-12]mov eax, 1
mov ebx, [ebp-12]
int 0x80add:
push ebp
mov ebp,esp
sub esp, 4
mov eax, [ebp+8]
add eax, [ebp+12]
mov [ebp-4], eax
mov eax, [ebp-4]
mov esp, ebp
pop ebp
ret
Basic assembly program in X86 -1 (Printing “Hello World”)
This is my first code i wrote in assembly. 🙂
section .text
global _start_start:
push ebp
mov ebp,esp
push `rld`
push “d wo”
push “Hell”mov eax, 0x04
mov ebx, 0x01
lea ecx, [esp]
mov edx, 12
int 0x80 ;intruptmov eax, 0x01
mov ebx, 0x00
int 0x80