×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Generating integer sequences in x86 assembly assignment help

July 10, 2024
Rehana Magnus
Rehana Magnus
🇨🇦 Canada
Assembly Language
Rehana Magnus, PhD in Computer Science from the esteemed Acadia Institute of Technology, Canada. With 6 years of experience, specializes in assembly language programming. Proficient in low-level coding, optimizing performance, and enhancing system functionality.
Key Topics
  • Converting a C++ Program to x86 Assembly
Tip of the day
Use Python libraries effectively by importing only what you need. For example, if you're working with data, using libraries like pandas and numpy can save time and simplify complex tasks like data manipulation and analysis.
News
In 2024, the Biden-Harris Administration has expanded high-dosage tutoring and extended learning programs to boost academic achievement, helping programming students and others recover from pandemic-related setbacks. These initiatives are funded by federal resources aimed at improving math and literacy skills​

The assignment deals with the generation of a given integer sequence using assembly code. A sample program in C++ that implements the required functionality is given and must be converted to assembly. The implementation is based on the Irvine library. The following solution provided by our assembly assignment help solvers demonstrates how to generate integers in x86.

Converting a C++ Program to x86 Assembly

Generation of Integer Sequence Based on Irvine Library

INCLUDE Irvine32.inc .DATA .CODE ;------------------------------------- ; Function ; int main() ;------------------------------------- main PROC mov ebx, 1 ; ebx = 1; _while1: ; while (ebx < 1400) { cmp ebx, 1400 jge _end_while1 mov eax, ebx ; cout << ebx; call WriteDec mov eax, ',' ; cout << ','; call WriteChar mov eax, ' ' ; cout << ' '; call WriteChar mov ecx, 1 ; ecx = 1; mov esi, ebx ; esi = ebx; _while2: ; while (esi > 0) { cmp esi, 0 jle _end_while2 mov eax, 10 ; edi = Modulus(esi, 10); push eax push esi call Modulus add esp, 8 mov edi, eax _if1: ; if (edi != 0) { cmp edi, 0 je _end_if1 push edi ; ecx = Multiplication(ecx, edi); push ecx call Multiplication add esp, 8 mov ecx, eax ; } _end_if1: mov eax, 10 ; esi = Division(esi, 10); push eax push esi call Division add esp, 8 mov esi, eax jmp _while2 ; } _end_while2: add ebx, ecx ; ebx += ecx; jmp _while1 ; } _end_while1: call CrLf call WaitMsg ; system("PAUSE"); mov eax, 0 ; return 0; ret main ENDP ;------------------------------------- ; Function ; int Multiplication(int eax, int ebx) ;------------------------------------- Multiplication PROC push ebp mov ebp, esp push ebx mov eax, [ebp + 8] mov ebx, [ebp + 12] mul ebx ; eax = eax * ebx pop ebx pop ebp ret ; return eax; Multiplication ENDP ;------------------------------------- ; Function ; int Division(int eax, int ebx) ;------------------------------------- Division PROC push ebp mov ebp, esp push ebx mov eax, [ebp + 8] mov ebx, [ebp + 12] mov edx, 0 ; clear edx before division div ebx ; eax = eax / ebx; pop ebx pop ebp ret ; return eax; Division ENDP ;------------------------------------- ; Function ; int Modulus(int eax, int ebx) ;------------------------------------- Modulus PROC push ebp mov ebp, esp push ebx mov eax, [ebp + 8] mov ebx, [ebp + 12] mov edx, 0 ; clear edx before division div ebx ; eax = eax % ebx; mov eax, edx ; put remainder in eax pop ebx pop ebp ret ; return eax; Modulus ENDP END main

Related Samples

Enhance your understanding with our free Assembly Language assignment samples. These resources provide clear, detailed solutions, helping you grasp complex concepts and improve your skills.