Submission (1) Convert the following pseudo code into assembly code. ( 7/' represents comments) // Each element is 1 Byte long arrayl 13h, 14h, 15h, 16h array2 12h, 13h, 14h, 15h // Each element is 1 Byte long // lengthl is a Symbolic constant // length2 is a Symbolic constant // this variable is 1 byte long initialized with 30 lengthl = number of items in Arrayl. length2 = number of items in Array2 samplel = 30h sample2 = 5h. // this variable is 1 byte long maxlength = max of lengthl and length2. // maxlength is // this is a variable initialized with 0 1 byte long variable index = 0. index < maxlength ) { If (arrayl [index] > array2 [index] expl = (arrayl[index] * samplel) / (array2 [index] only store the quotient of the division in exp1 and exp1 is 7716 bit long variable While ( Sample2) else expl index = index + 1 = 0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
## Submission (1)

### Convert the following pseudo code into assembly code. (‘//’ represents comments)

```plaintext
array1  13h, 14h, 15h, 16h    // Each element is 1 byte long
array2  12h, 13h, 14h, 15h    // Each element is 1 byte long

length1 = number of items in Array1.  // length1 is a symbolic constant
length2 = number of items in Array2.  // length2 is a symbolic constant

sample1 = 30h    // This variable is 1 byte long initialized with 30
sample2 = 5h     // This variable is 1 byte long

maxlength = max of length1 and length2.  // maxlength is 1 byte long variable

index = 0.  // This is a variable initialized with 0

While ( index < maxlength ) {
    If (array1[index] > array2[index])
        exp1 = (array1[index] * sample1) / (array2[index] * sample2)
        // Only store the quotient of the division in exp1 and exp1 is a 16-bit long variable
    else
        exp1 = 0

    index = index + 1
}
```

This pseudo code involves initializing arrays and constants, then iterating through the arrays with a loop. Depending on the comparison of elements, it performs a calculation and stores results conditionally.
Transcribed Image Text:## Submission (1) ### Convert the following pseudo code into assembly code. (‘//’ represents comments) ```plaintext array1 13h, 14h, 15h, 16h // Each element is 1 byte long array2 12h, 13h, 14h, 15h // Each element is 1 byte long length1 = number of items in Array1. // length1 is a symbolic constant length2 = number of items in Array2. // length2 is a symbolic constant sample1 = 30h // This variable is 1 byte long initialized with 30 sample2 = 5h // This variable is 1 byte long maxlength = max of length1 and length2. // maxlength is 1 byte long variable index = 0. // This is a variable initialized with 0 While ( index < maxlength ) { If (array1[index] > array2[index]) exp1 = (array1[index] * sample1) / (array2[index] * sample2) // Only store the quotient of the division in exp1 and exp1 is a 16-bit long variable else exp1 = 0 index = index + 1 } ``` This pseudo code involves initializing arrays and constants, then iterating through the arrays with a loop. Depending on the comparison of elements, it performs a calculation and stores results conditionally.
**Submission (2)**

- **array1** elements are **1 byte** long
- **array2** elements are **1 byte** long
- **length1** and **length2** are symbolic constants
- **sample1** and **sample2** are **1 byte** long variables initialized with 30h, and 5h respectively
- **maxlength** is a **1 byte** long variable and uninitialized in the beginning
  - Inside the code section, compute the largest between **length1** and **length2** and store it in **maxlength**
- **Index** is a variable that is **1 byte** long and initialized with 0
- **Exp1** is a variable that is **2 byte** long
- You are free to use any register and user-defined temporary memory variables to store the values
- Your code must produce correct results
- Also handle corner cases (e.g., if the divisor is zero, assign 0 to **exp1**)
Transcribed Image Text:**Submission (2)** - **array1** elements are **1 byte** long - **array2** elements are **1 byte** long - **length1** and **length2** are symbolic constants - **sample1** and **sample2** are **1 byte** long variables initialized with 30h, and 5h respectively - **maxlength** is a **1 byte** long variable and uninitialized in the beginning - Inside the code section, compute the largest between **length1** and **length2** and store it in **maxlength** - **Index** is a variable that is **1 byte** long and initialized with 0 - **Exp1** is a variable that is **2 byte** long - You are free to use any register and user-defined temporary memory variables to store the values - Your code must produce correct results - Also handle corner cases (e.g., if the divisor is zero, assign 0 to **exp1**)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education