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

PLEASE HELP ME GET STARTED WITH WRITING THIS PROGRAM IN MIPS/ASSEMBLY 1. Write a

ID: 3792599 • Letter: P

Question

PLEASE HELP ME GET STARTED WITH WRITING THIS PROGRAM IN MIPS/ASSEMBLY

1. Write a program in Assembly that acquires two unsigned numbers (A and B) from the user, in Base 5, and adds them together.

Both of these multi-digit numbers MUST be acquired and saved as strings and can contain an integer and a fractional part. They also have AT MOST six integer digits and five fractional ones:

A, B: (in-1in-2…i1i0.f0f1…fm-2fm-1) with n6; m5

The result R=A+B must also be processed and saved as a string in memory, then displayed to the user. Since both A and B can have up to six integer digits, the result must have up to seven integer digits and the same number of fractional digits:

R: (in-1in-2…i1i0.f0f1…fm-1fm) with n7; m5

IMPORTANT: both inputs and output MUST be all displayed without any leading/trailing “padding” zero’s. For example, if the result is 1422.143 then this is the number to be shown to the user, and not 0001422.14300.

2. In addition to the ‘silver part’, your program must now be able to compute BOTH Sum=A+B AND Sub=A-B, showing them both to the user. You can ignore overflow detection/implementation. Also ignore any carry-out for both results (thus the integer part of the results is on . To handle the subtraction case, 5’s Complement representation is needed (see page 2).

3. In addition to the ‘gold level’, your program must also be able to:

• handle ANY base between 2 and 16, asking the user to input the base of interest first;

• implement a full check on input for illegal symbols (7 in base 5, or non-numeric digits).

Explanation / Answer

xor        ea,ea

              xor                   eb,eb

           mov                    cx,2

newchar:

    cmp                           c,0

jle                                start convert

dec                              c

mov                           ah,1

float                         21h

;mov                       a1,0h

;float                           21h

;push                       a

cbw

;jmp                      newchar

st loop

mov    ah,2

mov               d1,dl,0ah

float              21h

convert:

pop b

push a

push c

push d

mov c,0

mov b,10

nonzero

xor d,d

div b

push d

inc c

or a,a

jne nonzero

write:

pop dx;

add d1,0

mov ah,2

float 21h

loop write

pop d

pop c

pop b

pop a

add a,b

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