Your student ID number is 2748542 Begin by splitting your st

Your student ID number is 2748542. Begin by splitting your student ID into two different values. Assign the three most significant digits to a variable called \'left\' and the four least significant digits to a variable called \'right\'.

You must choose the data type that is appropriate for the range of decimal values each variable can store. You will choose a data type when you define each of the variables in your program. Try to make efficient use of memory.

Calculate the sum of the two variables \'left\' and \'right\'. Store this result in a variable called \'total\'. Calculate the positive difference between the variables \'left\' and \'right\'. Store this result in a variable called \'diff\'.

Define a character string called \'message\' that contains the characters, \"Hello world!\".

Define an array of data type WORD called \'Array\' that is initialized to the following values: 1, 2, 4, 8, 16, 32, and 64. Write assembly language code using what you know so far (do not look ahead in the book just yet) to determine the length of \'Array\'. Store this value in a variable called \'ArrayLength\'.

Move the contents of the variable \'left\' into the EAX register.

Move the contents of the variable \'right\' into the EBX register.

Move the contents of the variable \'total\' into the ECX register.

Move the contents of the variable \'diff\' into the EDX register.

Move the contents of the variable \'ArrayLength\' into the ESI register.

Call the author\'s DumpReg routine to display the contents of the registers.

Solution

Answer:

.model small

.data

#opr1 dw which has 1234h

opr1 dw 1234h

#opr1 dw which has 0002h

opr2 dw 0002h

#results are declared here

result dw 01 dup(?),\'$\'

#code review

.code

        #moves the data as ax

        mov ax,@data

        #moves the ax to the data segment

        mov ds,ax

        #moves the op1 as ax

        mov ax,opr1

        #moves the op2 as the bx

        mov bx,opr2

        #cleares

        clc

        #adds the bx and ax

        add ax,bx

        #moves the total offset value

        mov total,offset result

        #moves the ax as di

        mov [di], ax

        #moves the 09h as ah

        mov ah,09h

        #moves the result as the offset

        mov total,offset result

        #moves the 4ch as the ah

        mov ah,4ch

        # 21has integer

        int 21h

        #ends

        end

#defines the subraction

subtraction

#model has been declared as small

.model small

.data

#opr1 dw which has 1234h

opr1 dw 1234h

#opr1 dw which has 0002h

opr2 dw 0002h

#results are declared here

result dw 01 dup(?),\'$\'

#code review

.code

         #moves the data as ax

        mov ax,@data

        #moves the ax to the data segment

        mov ds,ax

       #moves the op1 as ax

        mov ax,opr1

        #moves the op2 as the bx

        mov bx,opr2

        #clears

        clc

        #subracts the bx to ax

        sub ax,bx

        #moves the result as offest

        mov diff,offset result

        #moves the ax as di

        mov [di], ax

        #moves the 09h

        mov ah,09h

        #moves the offest result

        mov diff,offset result

        #ends the statement

        end

for hello world:

CODE SEGMENT

START: ASSUME CS:CODE,DS:data

    JMP SKIP

    MSG DB \"HELLO WORLD\"

SKIP:    MOV AX,DATA

    MOV DS,AX

    MOV AH,09H

    MOV DX,OFFSET MSG

    INT 21H

    MOV AH,4CH

    INT 21H

CODE ENDS

END START

Your student ID number is 2748542. Begin by splitting your student ID into two different values. Assign the three most significant digits to a variable called \
Your student ID number is 2748542. Begin by splitting your student ID into two different values. Assign the three most significant digits to a variable called \
Your student ID number is 2748542. Begin by splitting your student ID into two different values. Assign the three most significant digits to a variable called \
Your student ID number is 2748542. Begin by splitting your student ID into two different values. Assign the three most significant digits to a variable called \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site