1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vikki [24]
3 years ago
14

Write an HLA Assembly language program that prompts for a specific int8 value named n and then displays a repeated digit pattern

starting with that number. The repeated digit pattern should show all the numbers from 1 up to n
Computers and Technology
1 answer:
yan [13]3 years ago
3 0

Answer:

Output:

123456

123456

123456

123456

123456

123456

Explanation:

C Code:

#include <stdio.h>

int main() {

int n,i,j;

printf("Gimme a decimal value to use as n:");

scanf("%d",&n);

for(i=0;i<n;i++){

for(j=1;j<=n;j++){

printf("%d",j);

}

printf("\n");

}

return 0;

}

Equivalent assembly program:

.LC0:

.string "Gimme a decimal value to use as n:"

.LC1:

.string "%d"

main:

push rbp

mov rbp, rsp

sub rsp, 16

mov edi, OFFSET FLAT:.LC0

mov eax, 0

call printf

lea rax, [rbp-12]

mov rsi, rax

mov edi, OFFSET FLAT:.LC1

mov eax, 0

call scanf

mov DWORD PTR [rbp-4], 0

.L5:

mov eax, DWORD PTR [rbp-12]

cmp DWORD PTR [rbp-4], eax

jge .L2

mov DWORD PTR [rbp-8], 1

.L4:

mov eax, DWORD PTR [rbp-12]

cmp DWORD PTR [rbp-8], eax

jg .L3

mov eax, DWORD PTR [rbp-8]

mov esi, eax

mov edi, OFFSET FLAT:.LC1

mov eax, 0

call printf

add DWORD PTR [rbp-8], 1

jmp .L4

.L3:

mov edi, 10

call putchar

add DWORD PTR [rbp-4], 1

jmp .L5

.L2:

mov eax, 0

leave

ret

Input:

6

The program was first written with a c code, anf and subsequently translated to an assembly language.

You might be interested in
How will computing change our world?
Eduardwww [97]
Well, currently in our revolving world, computers are mostly used which led to laziness for some people. However the school systems in most countries still depend on manual computing which can be really essential to the current generation. Computing can really change our current world, it helps us to not depend on computers, gives people more job opportunities. Helps to strengthen brain power which can contribute to large variety of factors. A smarter generation, and if possible, a more advance society.
7 0
3 years ago
Select the different network functions from the list below.
VashaNatasha [74]

Answer:

IP address

blocking spam

power

SAN

8 0
3 years ago
How many different Microsoft Windows file types can be infected with a virus?
vagabundo [1.1K]
Phishing, scam, Fraud, just to get to hack your computer.
6 0
3 years ago
Question, who wants 100 points?
Alexandra [31]
Me and well thank you
8 0
3 years ago
Read 2 more answers
Which of the following manages allocation of computer resources during program execution?
Brums [2.3K]
A)memory management
8 0
4 years ago
Other questions:
  • Operating systems such as Microsoft Windows use a specific character before a file extension to separate it from the filename. W
    9·2 answers
  • HELP URGENT
    12·2 answers
  • Computer recycling, electronic recycling or e-waste recycling is the disassembly and Most electronic waste is sent to landfills
    6·1 answer
  • Why should the ISO be adjusted when taking a picture of a child blowing out candles in a darkened room?
    10·1 answer
  • Which is the most common way to install memory in a laptop?
    14·1 answer
  • Design a class named Person with fields for holding a person’s name, address, and telephone number. Write one or more constructo
    12·1 answer
  • Using the same Apple ID for multiple devices will definitely sync them all together <br> True/False
    7·2 answers
  • What will you see on the next line?
    6·2 answers
  • Select the correct text in the passage.
    15·1 answer
  • Is electricity a force or energy?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!