Question

Can someone do this in assembly code for me please Given the following input and output, write ...

can someone do this in assembly code for me please

Given the following input and output, write the assembly code necessary to make it look exactly the same as below. Pay careful attention to spacing and blank lines:

Input

Enter a number: 1
Enter a larger number: 3
Enter an even larger number: 5

Output

1 < 3 < 5

5 > 3 > 1


aseembly programing language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The numbers can be entered in an array which then can be sorted as follows:

.model small
.stack 100h
.data
strg1 DB “Enter the 3 numbers: $”
strg2 DB “< $”
Arr Db 10 dup(?)
v dw ?
.code
main proc
mov ax,@data
mov ds,ax

mov ah,9
lea dx,strg1
int 21h

mov dl,0ah
mov ah,2
int 21h

;inputs
mov di,0
mov cx,10
Input_loop:

mov ah,1
int 21h
mov arr[di],al

mov dl,0ah
mov ah,2
int 21h
inc di
loop Input_loop

mov v,0
sort:

mov di,0
mov cx,10
sub cx,v

B:
mov al,Arr[di]
cmp al,Arr[di+1]
jng C

mov al,Arr[di]
xchg al,Arr[di+1]
mov Arr[di],al
c:
inc di
loop B
inc v
cmp v,10
jne sort

mov ah,9
lea dx,strg2
int 21h

mov dl,0ah
mov ah,2
int 21h

mov di,0
mov cx,10
Output_loop:

mov dl,Arr[di]
mov ah,2
int 21h
inc di

mov dl,0ah
mov ah,2
int 21h
loop output_loop

mov ah,4ch
int 21h

main endp
end main

Add a comment
Know the answer?
Add Answer to:
Can someone do this in assembly code for me please Given the following input and output, write ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a parity checker for the ASCII system in MARIE. MARIE is an assembly language. The...

    Write a parity checker for the ASCII system in MARIE. MARIE is an assembly language. The parity checker should repeatedly execute a loop that performs the following tasks: 1. Ask the user for an input X, which can be any printable ASCII character; 2. Output the decimal code of X; 3. Output the total number of 1’s that appears in the binary code of X; 4. Output the parity bit which, when added to the binary code of X, will...

  • Assembly language.    Can u pls send me a copyable code please. If you can run...

    Assembly language.    Can u pls send me a copyable code please. If you can run it. X86. Asm.    Subject: Assembly language If you know x86 asm then only answer it Use x86 asm version send me a written code please send me with out put please send me a copyable code i promise to give you thumbs up, question: Implement a simple 4 functios calculator for 3 digits entry. The user will enter 2 digits for the first...

  • Mips assembly help with fibonacci series

    Goal is to find nth Fibonacci number. Indexing needs to start at 0. The program has to look like the example and I am having trouble programing something that willwork. Also, it must ask if the user would like to find another number at the end. Can someone please help?!? It must be in MIPS assembly programing, not Java.Example:Which Fibonacci number do you want: 7Output: Number is 13 and the series is 0, 1, 1, 2, 3, 5, 8, 13Do...

  • Can someone please help me with the piping of the following code. The Myshell is a command langua...

    Can someone please help me with the piping of the following code. The Myshell is a command language interpreter which can execute several internal commands as well as some external command using a default Linux shell. The command can be read from either standard input or a batch file. This program currently executes commands such as ls>1, sort myshell.c >2. What I need it the to pipe the commands so i can execute commands like ls | 1 or sort...

  • Complete this task4.s ARM assembly code to produce an assembly program that: • Waits for the...

    Complete this task4.s ARM assembly code to produce an assembly program that: • Waits for the user to enter two integers (this part is already coded in). • Places the first integer at r5, and the second integer at r6 (this part is already coded in). • (This is what you need to code in) Adds the two integers together. If the result is between 0 and 9 (including 0 and 9) the program should print the result. If not,...

  • Can someone help me with the writing of this code please? public static int promptInt(Scanner input,...

    Can someone help me with the writing of this code please? public static int promptInt(Scanner input, String prompt, int min, int max) { return 0; //TODO replace }    /**    * Returns the index within arr of the first occurrence of the specified character.    * If arr is null or 0 length then return -1. For all arrays, don't assume a length    * but use the array .length attribute.    * @param arr The array to look...

  • MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and...

    MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and print a simple checksum for each string. Make your string long enough to hold 50 characters. Don't forget to leave space for the null byte. Our checksum algorithm will produce a value which you can print with the syscall for printing a character. Stop reading strings when the user enters ".". The syscall to read a string (sycall code 8) adds a newline to...

  • Problem 1: a) Write LEGv8 assembly language programs for the following C program fragments. Please make...

    Problem 1: a) Write LEGv8 assembly language programs for the following C program fragments. Please make sure to add any necessary comments. P[20] = P[10] + P[30] + 25; b) Show the machine code that will be generated by the assembly code in Problem 1.a. You can write machine code as decimal numbers. please help me solve this

  • Please write the following code in C++ for Data Structures class. Please follow all the instructions...

    Please write the following code in C++ for Data Structures class. Please follow all the instructions in the picture below. Please write the program with zero warnings. Description: Please write a short program, randomStream, that asks for the name of a file and a number, and produces a files satisfying the following conditions: The file name is the name given by the user (exactly--no added suffixes please) The number of lines in the file is exactly the same as the...

  • PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs...

    PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs to:             -define a recursive procedure/function and call it.             -use syscall operations to display integers and strings on the console window             -use syscall operations to read integers from the keyboard. Assignment Description: Implement a MIPS assembly language program that defines "main", and "function1" procedures. The function1 is recursive and should be defined as: function1(n) = (2*n)+9                      if n <= 5              =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT