Question

3) Write a program to print out a random number from 1..100. USING ASSEMBLY LANGUAGE

3) Write a program to print out a random number from 1..100.

USING ASSEMBLY LANGUAGE

Homework Answers

Answer #1

CODE

DATA SEGMENT

MSG1 DB 10,13,'RANDOM NUMBERS ARE : $'

MSG2 DB 10,13,' $'

RES DB 10 DUP ('$')

DATA ENDS

CODE SEGMENT

ASSUME DS:DATA CS:CODE

START:

MOV AX,DATA

MOV DS,AX

LEA DX,MSG1

MOV AH,9

INT 21H

LEA DX,MSG2

MOV AH,9

INT 21H

NXT:

MOV AH,2CH ; Set time function

INT 21H

MOV AX,DX ; DH=seconds,DL=hundredths of second

XOR AH,AH

LEA SI,RES

CALL HEX2DEC

LEA DX,RES

MOV AH,9

INT 21H

LEA DX,MSG2

MOV AH,9

INT 21H

JMP NXT

MOV AH,4CH

INT 21H

CODE ENDS

HEX2DEC PROC NEAR

MOV CX,0

MOV BX,10

LOOP1: MOV DX,0

DIV BX

ADD DL,30H

PUSH DX

INC CX

CMP AX,9

JG LOOP1

ADD AL,30H

MOV [SI],AL

LOOP2: POP AX

INC SI

MOV [SI],AL

LOOP LOOP2

RET

HEX2DEC ENDP

END START

Know the answer?
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
Similar Questions
Please write a program in assembly language(by using EMU86 simulator), to calculate the 2450 by 30...
Please write a program in assembly language(by using EMU86 simulator), to calculate the 2450 by 30 (2450/30), and print out the result.
Please write a program in assembly language(by using EMU86 simulator), to calculate the 2450 by 30...
Please write a program in assembly language(by using EMU86 simulator), to calculate the 2450 by 30 (2450/30), and print out the result.
Write an assembly language program that reverses all the bits of a 32-bit number. (Without using...
Write an assembly language program that reverses all the bits of a 32-bit number. (Without using RBIT instruction) Write an assembly language program that checks whether an unsigned number is perfect square or not.
1- Write a program to print only the even numbers from 100 to 200 2- Write...
1- Write a program to print only the even numbers from 100 to 200 2- Write a program to print the odd numbers from 22 – 99 3- Write a program to calculate howe many even number from 10 to 120 1- Write a program to find only the even numbers for 12 different numbers 2- Write a program to find the odd numbers for 10 different numbers 3- Write a program to calculate howe many even number and how...
Without using move or li, write MIPS assembly language using MARS simulator to print a half...
Without using move or li, write MIPS assembly language using MARS simulator to print a half pyramid depending on a value n of a user input. Such that if n = 5 were entered the following would be printed: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
Write the following ANNA assembly language programs. 1.HighestnumberWrite an ANNA assembly program (high.ac) that will continuously...
Write the following ANNA assembly language programs. 1.HighestnumberWrite an ANNA assembly program (high.ac) that will continuously prompt the user for numbers. When the user enters a negative number, print the highest positive number entered by the user and exit the program. Print a zero if they did not enter any positive numbers. 2.DivisionWrite an ANNA assembly program (div.ac) that divides two positive numbers that come from user input and returns both the quotient and the remainder. For example, if the...
Create a C++ program that generates a random number from 1 to 100 using the rand()...
Create a C++ program that generates a random number from 1 to 100 using the rand() function. Give the user a total 5 chances to guess the number. Stop the program and indicate the user guessed the correct number and should be applauded. Also, please find out which guess was the closest to the actual number. For example, if the rand() produces 57 and the user guessed 10, 80, 52, 33 and 44 in their respective turns then print out...
C programming language. Write a program to print reverse of all the numbers from m to...
C programming language. Write a program to print reverse of all the numbers from m to n using functions with arguments and no return type. The inputs in the program will be m and n variables and need to take these variables as arguments.
Write a c++ program to pull a random number between 1-100 inclusive. Ask the user to...
Write a c++ program to pull a random number between 1-100 inclusive. Ask the user to guess the number. If the random number is higher than the guess, print "Higher". If the random number is less than the guess, print "Lower". If the random number is equal to the quess, print "Correct!". Create a variable to count the number of guesses and intitialize it to zero. int guesses=0; Increase this variable by 1 every time the user enters a new...
1) Write a C program to print the prime numbers from 1 to 100. (A prime...
1) Write a C program to print the prime numbers from 1 to 100. (A prime integer is any integer that can be divided evenly only by itself and 1) Requirement: Use an array to take the number from 1 to 100 and another array to take the prime number.