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
lyudmila [28]
1 year ago
8

Translate the following C program to Pep/9 assembly language.

Computers and Technology
1 answer:
docker41 [41]1 year ago
8 0

In this exercise we have to use the knowledge of computational language in C code to write a code that Translate the following C program to Pep/9 assembly language.

<h3>Writting the code:</h3>

  • In C code:

<em>#include <stdio.h></em>

<em>int myAge;</em>

<em>void </em><em>putNext</em><em>(int age) {</em>

<em>int nextYr;</em>

<em>nextYr = age + 1;</em>

<em>printf("Age: %d\n", age);</em>

<em>printf("Age next year: %d\n", nextYr);</em>

<em>}</em>

<em>int </em><em>main </em><em>() {</em>

<em>scanf("%d", &myAge);</em>

<em>putNext(myAge);</em>

<em>putNext(64);</em>

<em>return 0;</em>

<em>}</em>

  • In Pep 9 CODE-

<em>myAge:</em>

<em>.zero 4</em>

<em>.LC0:</em>

<em>.</em><em>string </em><em>"Age: %d\n"</em>

<em>.LC1:</em>

<em>.string "Age </em><em>next </em><em>year: %d\n"</em>

<em>_Z7putNexti:</em>

<em>pushq %rbp</em>

<em>movq %rsp, %rbp</em>

<em>subq $32, %rsp</em>

<em>movl %edi, -20(%rbp)</em>

<em>movl -20(%rbp), %eax</em>

<em>addl $1, %eax</em>

<em>movl %eax, -4(%rbp)</em>

<em>movl -20(%rbp), %eax</em>

<em>movl %eax, %esi</em>

<em>movl $.LC0, %edi</em>

<em>movl $0, %eax</em>

<em>call printf</em>

<em>movl -4(%rbp), %eax</em>

<em>movl %eax, %esi</em>

<em>movl $.LC1, %edi</em>

<em>movl $0, %eax</em>

<em>call printf</em>

<em>nop</em>

<em>leave</em>

<em>ret</em>

<em>.LC2:</em>

<em>.</em><em>string </em><em>"%d"</em>

<em>main:</em>

<em>pushq %rbp</em>

<em>movq %rsp, %rbp</em>

<em>movl $myAge, %esi</em>

<em>movl $.LC2, %edi</em>

<em>movl $0, %eax</em>

<em>call scanf</em>

<em>movl myAge(%rip), %eax</em>

<em>movl %eax, %edi</em>

<em>call _Z7putNexti</em>

<em>movl $64, %edi</em>

<em>call _Z7putNexti</em>

<em>movl $0, %eax</em>

<em>popq %rbp</em>

<em>ret</em>

See more about C code at  brainly.com/question/18502436

#SPJ1

You might be interested in
Hello everyone! Happy Wednesday, or Thursday! (Depending on where you are in the world, because of the atmosphere and what not :
Viktor [21]

Answer:

Keyboard

Explanation:

7 0
3 years ago
Read 2 more answers
Complete the sentence about a focusing technique.
Butoxors [25]

Answer:

Subjects with a lot of <u>Visuals </u>make focusing easier

Explanation:

Visuals contents make a subject more focusing and interesting for the students. Students can learn that courses easily that have more pictorial content. It is the famous quote that "A picture is better than thousand words to understand".

4 0
4 years ago
What objective behaves like a high level array
zavuch27 [327]

Answer:

C.Vector

Explanation:

Vector is a high level array used in C++.It has the capability of resizing itself when it gets full.it has many functions that increases it's functionality like size(),begin(),end(),erase(),clear(),push_back(),pop_back() and many more and we store any kind of data type in the vector.

syntax for declaring a vector:-

vector<data type> vector name.

8 0
3 years ago
What are the events?
erastovalidia [21]

Answer:

a thing that happens or takes place, especially one of importance.

8 0
3 years ago
Your organization's security policy specifies that any mobile device (regardless of ownership) that connects to your internal ne
Veseljchak [2.6K]

Answer:

Create an microsoft intune for remote management of the device

Explanation:

Microsoft intune is a server based management that grants an authorized user or group limited access to information in its database.

Setting up a intune in new acquired devices (it is called bulk enroll) is as easy as connecting a usb to the device and clicking install on the administrator PC. While already existing devices would have to create an account as individual users.

3 0
3 years ago
Other questions:
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    12·1 answer
  • Assume that two parallel arrays have been declared and initialized: healthOption an array of type char that contains letter code
    13·1 answer
  • An administrative assistant types a document, saves, and prints. The assistant is using _____.
    14·1 answer
  • What is Identity Theft?
    8·1 answer
  • What type of security software prevents, detects, and removes malware that tries to collect personal information or change compu
    13·1 answer
  • For (int j- 4; j &gt; 0; j--)
    9·1 answer
  • Given that<br>f(x) = 5x +3.<br>Find f (4)​
    15·2 answers
  • Service and software companies typically have a high return-on-assets ratio because they require lower blank as compared to manu
    11·2 answers
  • I need to find out how to mark brainliest so just answer this and the first person will be marked brainliest.
    12·1 answer
  • While storms could be a cause, power______ are more likely to be caused by disturbances from high-demand equipment in a home or
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!