Question

I need help with a code in assembly language MASM (x86)

write an assembly language (x86) program to input in a string 10 multi-digit integers and displays them in ascending order. Modify the code below to comply with the requirement.

.model small

.stack 100h

.data

strg1 DB 'Insert numbers: $'

strg2 DB 'Sorted numbers: $'

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

;Output

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

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


The program will sort an array of integers in ascending order.

The general structure of the assembly language source code...

Note that your code will precede the data area.

ORG 100

HALT

Addr, HEX 200 /Address of 1st array elements

N, DEC 6 /Number of array elements

DEC 18 /First Value

DEC -3

DEC 10

DEC 1

DEC -3

DEC 0

answered by: anonymous

> How do i do that in my code?

Anonim1106 Thu, Jan 6, 2022 2:59 AM

Add a comment
Know the answer?
Add Answer to:
I need help with a code in assembly language MASM (x86)
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
  • Analyze this assembly program (emu 8086) line by line! and explain the purpose of the program!...

    Analyze this assembly program (emu 8086) line by line! and explain the purpose of the program! PROGRAM: .model small .stack 100h .data    num1 db ?    num2 db ?    num3 db ?    MSG1 DB 10,13,"ENTER FIRST NUMBER : $"    MSG2 DB 10,13,"ENTER SECOND NUMBER: $"      MSG3 DB 10,13,"ENTER SECOND NUMBER: $"      MSG4 DB 10,13,"SMALLER NUMBER IS : $"    avg db ? ends .code .start    main proc        mov ax,data       ...

  • You have to put the input to the line(Linea), rectangle(rectangulo), triangle(triangulo) and circle(circulo) in assembly 8086...

    You have to put the input to the line(Linea), rectangle(rectangulo), triangle(triangulo) and circle(circulo) in assembly 8086 please, Same as this code, add that input that I'm asking. Which user of the size and the area where the figure will be located on the screen. .MODEL SMALL   .STACK 100h .DATA    mensaje db 'Seleccione una opcion del siguiente Menu',13, 10        db '1. Dibujar un Circulo', 13, 10        db '2. Dibujar una Linea', 13, 10        db '3. Dibujar un...

  • Sketch the flowchart for CASE structure below. name "question_6" model small org 100h main proc start: mov...

    Sketch the flowchart for CASE structure below. name "question_6" model small org 100h main proc start: mov dx, offset msg mov ah, 9 int 21h mov ah, 1 int 21h cmp al, '0' jb stop cmp al, '9' ja stop cmp al, '5' jb test2 ja test3 mov dx, offset msgl jmp print test2: mov dx, offset msg2 test2: mov dx, offset msg2 jmp print test3: mov dx, offset msg3 print: mov ah, 9 int 21h jmp start stop: msg...

  • I need the following done in MASM (Assmebly or ASM)

    Write an assembly language(x86) program to sort in ascending order 10 integers numbers read from the keyboard and display in order..model small.stack 100h .data.codestart:Mov ax ,@dataMov ds.axmov ax ,4c00hInt 21h End start

  • Explain each line of code. What does the routine do. model small .stack 100h .code main...

    Explain each line of code. What does the routine do. model small .stack 100h .code main proc mov BL, 36 yor BL, 40h mov CL, 16h m: mov ah,6 mov dl, bl. add DL, CL int 21h dec CL jnz m mov ax,4C00h int 21h main endp end main Good luck!

  • X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code...

    X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code INCLUDE Irvine32.inc         .data       KeyPrompt BYTE "Enter the passphrase: ",0       TextPrompt BYTE "Enter the plaintest: ",0           str1 BYTE "The passphrase has length:",0           str2 BYTE "The plaintest has length:",0       KeyIs BYTE "The passphrase: ",0       PlainTextIs BYTE "The plaintext: ",0       CipherTextIs BYTE "The ciphertext: ",0       KMAX = 64                        ; passphrase buffer maximum size       BMAX = 128                       ; test...

  • Answer based on microprocessor 8086 (10) LEA BX, CX 7. Suppose that (AX)-4AOBH, the content of...

    Answer based on microprocessor 8086 (10) LEA BX, CX 7. Suppose that (AX)-4AOBH, the content of [1020H] storage unit is 260FH. Try to determine the results of the following instructions. (1) MOV AX, 1020H (AX) (2) XCHG AX, [1020H) ; (AX) (3) MOV AX, [1020H) ;(AX)=- (4) LEA AX, [1020H) ; (AX) 10. Suppose the size of the stack segment is 256 bytes. The starting address of the stack is 1250: 0000H, assuming there are 5 word-sized data in the...

  • Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF...

    Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1.    Give the new contents of AL after each of the following instructions is executed.    Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH.    Show the contents of BX and CX after...

  • MASM Assembly Language programming question. I'm having serious issues. I am attempting to scan through a...

    MASM Assembly Language programming question. I'm having serious issues. I am attempting to scan through a string and replace all the "o" characters with an exclamation mark (!). However my program does not work and no change seems to occur to the string. Also the loop breaks once the first "o" character is encountered.Is there anyone in this Universe that can help me???Please main PROC    ;mov edi,OFFSET string    mov ecx, LENGTHOF string    mov edi,OFFSET string    L1:...

  • Task is to implement the following algorithms in Assembly language for x86 processor

    Task is to implement the following algorithms in Assembly language for x86 processor1) Insertion sort Demonstrate Sorted Array of 10 elements in Watch Window for each one Running time of each algorithmsample bubble sort code:;----------------------------------------------------------BubbleSort PROC USES eax ecx esi,pArray:PTR DWORD, ; pointer to arrayCount:DWORD ; array size;; Sort an array of 32-bit signed integers in ascending; order, using the bubble sort algorithm.; Receives: pointer to array, array size; Returns: nothing;-----------------------------------------------------------mov ecx,Countdec ecx ; decrement count by 1L1: push ecx ; save outer...

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
ADVERTISEMENT