Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write assembly language programs to perform each of the following calculations.

ID: 3719471 • Letter: W

Question

Write assembly language programs to perform each of the following calculations. In your programs, ignore overflow (i.e., assume that your operand values will not produce an overflow).

1- Add long word: Add two 64-bit unsigned values

2- Negate long word: Negate a 64-bit value by replacing the value by its two’s complement

3- Subtract long word: Subtract a 64-bit value from another 64-bit value

4- Multiply long word: Multiply two 32-bit unsigned values to get a 64-bit result

Use a little-endian strategy to organize these bytes

store the input values starting at location 1024.

Clearly use labels to indicate your input variables.

You should follow the format described in this section strictly as input will be supplied to your program using this format for testing.

Your data should be organized as follows (in the given order):

1. Pointers to input and output values

2. [For vectors only, each vector pointer is followed immediately by the size of this vector]

3. Input values

4. Output value

5. Other variables if needed

APTR, BPTR, and CPTR contain the addresses of the values A, B, and C, respectively. A is initialized to have the decimal value of 10 (or hex value 000000000000000A), and B is initialized to have the decimal value of 20 (or hex value 0000000000000014). The result C is initialized to zero.

Explanation / Answer

DATA SEGMENT

N1 DB 9H

N2 DB 7H

RES DB?

ENDS

CODE SEGMENT

ASSUME DS:DATA CS:CODE

START

MOV AX,DATA

MOV DS,AX

MOV AL,N1

MOV AL,N2

MOV RES,AL

MOV AH,4CH

INT 21H

ENDS

END START

Negate Word

Data Segment

Number dw 00000010B

Data Ends

Code Segment

Assume cs:code, ds:data

Begin:

mov ax,data

mov ds,ax

mov es,ax

mov ax,Number

NOT ax

add ax,00000001B

Exit:

mov ax,4c00h

int 21h

Code Ends

End Begin

Substract Words

.model small

.data

message db "Substraction Operation"

message2 db "Enter first number $"

message3 db " Enter second number $"

message4 db "+$"

message5 db "=$"

.code

main proc

mov ax,seg message

mov ds,ax

mov dx,offset message ;

mov ah, 9h

int 21h

mov ah, 1h

int 21h

mov bl,al

mov ah,0Eh

mov al,0Dh

int 10h

mov al,0Ah

int 10h

mov ax,seg message2

mov ds,ax

mov dx,offset message2

mov ah,9h

int 21h

mov ah, 1h

int 21h

mov cl,al

mov ah, 0Eh

mov al, 0Dh

int 10h

mov al, 0Ah

int 10h

mov dl,bl

mov ah, 2h

int 21h

mov ax,seg message4

mov ds,ax

mov dx,offset message4

mov ah,9h

int 21h

mov dl,cl

mov ah, 2h

int 21h

mov ax,seg message5

mov ds,ax

mov dx,offset message5

mov ah,9h

int 21h

sub bl,30h

sub cl,30h

sub bl,cl

add bl,30h

mov dl,bl

mov ah,2h

int 21h

endp

end main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote