This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
Create Assembly code snippet to implement a loop that prints numbers from 1 to 10.asm
Abdul Wahab Junaidcbf23601745e
diff --git a/Assembly language/Question on Assembly Language/Assembly code snippet to implement a loop that prints numbers from 1 to 10.asm b/Assembly language/Question on Assembly Language/Assembly code snippet to implement a loop that prints numbers from 1 to 10.asmnew file mode 100644index 0000000..9b1e883--- /dev/null+++ b/Assembly language/Question on Assembly Language/Assembly code snippet to implement a loop that prints numbers from 1 to 10.asm@@ -0,0 +1,37 @@+section .data+ newline db 10 ; ASCII code for newline character++section .text+ global _start++_start:+ mov ecx, 1 ; Initialize counter to 1++print_loop:+ ; Print the current number+ mov eax, 4 ; syscall: write+ mov ebx, 1 ; file descriptor: stdout+ mov edx, 1 ; message length+ lea ecx, [ecx + '0'] ; Convert counter to ASCII character+ mov [esp - 4], ecx ; Store the ASCII character on the stack+ mov ecx, esp - 4 ; Set the pointer to the ASCII character+ int 0x80 ; Call kernel++ ; Print a newline character+ mov eax, 4 ; syscall: write+ mov ebx, 1 ; file descriptor: stdout+ mov edx, 1 ; message length+ mov ecx, newline ; newline character+ int 0x80 ; Call kernel++ ; Increment counter+ inc dword [esp - 4]++ ; Check if the counter is greater than 10+ cmp dword [esp - 4], 11+ jne print_loop ; Jump back to the loop if not greater++ ; Exit the program+ mov eax, 1 ; syscall: exit+ xor ebx, ebx ; status: 0+ int 0x80 ; Call kernel