Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to di an assembly language assignment. Can you please give me the correct code and I can copy paste it on word document?

I need to di an assembly language assignment. Can you please give me the correct code and I can copy paste it on word document? Also, I am unable to get the executable file because I can't access a linux directory. if somone have it can give me the executable file i need it urgently!!! as well as the correct code. Here is the assignment instructions: Intel Assembly Language Programming Assignment
Date assigned: Wednesday, June 19,2024
Due Date: Wednesday, June 26,2024 before 6:00 AM
Instructions:
Submit your executable program and your .lis file using
by using the Assignment submission link on the course Moodle page.
You are to use a Linux text editor, together with the nasm assembler,
ld loader and gdb/ddd
debugger tools to write a complete Intel x86 assembly language program to
perform the following:
Complete the following Intel assembly language program
which determines whether the byte sized operand stored
in memory location 'number' is prime or not. The program
will write the value of 0 into the memory location 'answer'
if the number is not prime, otherwise the initial value of '1' will
be left unmodified (indicating that the number is prime). The program
makes use of the DIV instruction to determine the value of quotient
and remainder when dividing the number by 2,3,4,...(number -1).
section .data
; put your data in this section using
; db , dw, dd directions
number db 5
answer db 1 ; 1 means number is prime, 0 means number is not prime
section .bss
; put UNINITIALIZED data here using
section .text
global _start
_start:
mov esi, number ; get the offset of number into esi
keith: mov eax, 0 ; clear the entire eax register
mov al,[esi] ; get the number from memory into al
mov dl, al ; put it inside dl as well
mov bl,2 ; bl holds each divisor starting from 2
loopy: div bl ; ax / bl with quot in al and rem in ah
and ax,1111111100000000b ; isolate the rem in ah with a AND mask
; to determine whether the remainder is 0
; YOU COMPLETE THE REST OF THE CODE
HINT: The program is to implement the following high-level
pseudocode:
prime = true ;
divisor =2 ;
while ( divisor < number )
{
if ( the remainder of number / divisor is 0)
{
prime = false ; // we found a divisor which evenly divides number
}// so therefore number cannot be prime
divisor = divisor +1 ; // check the next divisor and keep looping
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions