Programming Logic & Design Comprehensive
9th Edition
ISBN: 9781337669405
Author: FARRELL
Publisher: Cengage
expand_more
expand_more
format_list_bulleted
Question
make corrections of this

Transcribed Image Text:TITLE 'Modify Array - Replace Negatives with Zero'
SHELL
* AUTHOR:
CSECT
* DESCRIPTION:
YOUR NAME HERE
This program processes an array of ten fullwords,
replacing negative values with 0, and stores the count
of modified elements in the memory location immediately
before the array. The program outputs the array before
and after modification.
WORKING
* STATUS:
RO
EQU
0
R1
EQU
1
R2
EQU
2
R3
EQU
3
R12
EQU
12
R13
EQU
13
R14
*
EQU 14
'INDEX' REGISTER
TEMP STORAGE REGISTER
COUNTER REGISTER
ARRAY ELEMENT REGISTER
BASE REGISTER
SAVE AREA POINTER
RETURN REGISTER
* STANDARD ENTRY AND INITIALIZATION:
STM R14, R12, 12 (R13) SAVE REGISTERS
BALR R12, RO
USING BASE, R12
LOAD BASE REGISTER
DECLARE BASE ADDRESS AND REGISTER
SAVE R13
R13 ADDRESS OF SAVE AREA
BASE
ST
R13, SAVE+4
LA
R13, SAVE
*
START:
LA
LA
LA
R2,0
RO, ARRAY
R1,10
LOOP
L
R3,0 (RO)
C
R3, F'0'
BNL
SKIP
LA
R2,1 (R2)
ST
R2, MODIFIED
MVI
0 (RO),0
SKIP
LA
RO, 4 (RO)
BCT
R1, LOOP
RESET MODIFIED COUNT TO ZERO
LOAD ARRAY START ADDRESS
SET LOOP COUNTER (10 ELEMENTS)
LOAD CURRENT ARRAY ELEMENT
CHECK IF NEGATIVE
IF NOT NEGATIVE, SKIP MODIFICATION
INCREMENT MODIFIED COUNT
STORE UPDATED COUNT
REPLACE NEGATIVE VALUE WITH ZERO
MOVE TO NEXT ELEMENT
DECREMENT COUNTER AND LOOP IF NOT DONE
ST
R2, MODIFIED
STORE MODIFIED COUNT
* STANDARD EXIT:
DONE
L
R13, SAVE+4
RESTORE R13
LM
R14, R12, 12 (R13)
RESTORE REGISTERS
BR
R14
RETURN
* STORAGE:
SAVE
DS
MODIFIED DS
18F
F
SAVE AREA
ARRAY
DC
STORAGE FOR MODIFIED COUNT
F'-5',F'3',F'0',F'-1'‚F'6',F'-8',F'4',F'−2',F'7',F'-9'
END
SHELL
![Z390I V1.5.06
Copyright 2011 Automated Software Tools Corporation
z390 is licensed under GNU General Public License
Log file = C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390\z390_2025_0404_100725.LOG
Enter command or help
Microsoft Windows [Version 10.0.26100.3476]
(c) Microsoft Corporation. All rights reserved.
*** 04/04/25 10:07:50 CMD task started
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\2390>CD \Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\2390\
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390>ASMLG C:\Users\jonesrich44\Documents\test23
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\2390>rem asmlg assemble, link, and go from mlc to 390 execution
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390>echo off
10:07:50 test23
AZ390E error 29
MZ390 START USING Z390 V1.5.06 ON J2SE 1.8.0 441 04/04/25
-
(1/1) 1 TITLE 'MODIFY Array Replace Negatives with Zero'
AZ390E ERRSUM Critical Error Summary Option
AZ390E ERRSUM Fix and repeat until all nested errors resolved
AZ390E ERRSUM missing macro ='MODIFY
AZ390E ERRSUM total missing
AZ390E ERRSUM total missing
copy files =0
macro
files =1
=0
= 0
= 1
AZ390E ERRSUM total undefined symbols
AZ390E ERRSUM total mz390 errors
AZ390E ERRSUM total az390 errors
10:07:51 test23
MZ390 ENDED RC=12 SEC= 0 MEM (MB) = 35 IO=224
Press any key to continue . . .
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390>exit
*** 04/04/25 10:07:51 CMD task ended TOT SEC=1 TOT LOG_IO=18](https://content.bartleby.com/qna-images/question/13826b36-d9c7-4b21-b2b5-e06bf4de5564/92ca93a4-6637-4c6a-923a-5f02be655365/7wc7wl_thumbnail.png)
Transcribed Image Text:Z390I V1.5.06
Copyright 2011 Automated Software Tools Corporation
z390 is licensed under GNU General Public License
Log file = C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390\z390_2025_0404_100725.LOG
Enter command or help
Microsoft Windows [Version 10.0.26100.3476]
(c) Microsoft Corporation. All rights reserved.
*** 04/04/25 10:07:50 CMD task started
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\2390>CD \Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\2390\
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390>ASMLG C:\Users\jonesrich44\Documents\test23
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\2390>rem asmlg assemble, link, and go from mlc to 390 execution
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390>echo off
10:07:50 test23
AZ390E error 29
MZ390 START USING Z390 V1.5.06 ON J2SE 1.8.0 441 04/04/25
-
(1/1) 1 TITLE 'MODIFY Array Replace Negatives with Zero'
AZ390E ERRSUM Critical Error Summary Option
AZ390E ERRSUM Fix and repeat until all nested errors resolved
AZ390E ERRSUM missing macro ='MODIFY
AZ390E ERRSUM total missing
AZ390E ERRSUM total missing
copy files =0
macro
files =1
=0
= 0
= 1
AZ390E ERRSUM total undefined symbols
AZ390E ERRSUM total mz390 errors
AZ390E ERRSUM total az390 errors
10:07:51 test23
MZ390 ENDED RC=12 SEC= 0 MEM (MB) = 35 IO=224
Press any key to continue . . .
C:\Users\jonesrich44\AppData\Local\Programs\Automated Software Tools\z390>exit
*** 04/04/25 10:07:51 CMD task ended TOT SEC=1 TOT LOG_IO=18
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- (Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays so that a customer’s record can be accessed randomly by account number. Create the file by entering five customer records, with each record consisting of an integer account number (starting with account number 1000), a first name (maximum of 10 characters), a last name (maximum of 15 characters), and a double-precision number for the account balance. After the file is created, write a C++ program that requests a user-input account number and displays the corresponding name and account balance from the file.arrow_forward(Electrical eng.) Write a program that specifies three one-dimensional arrays named current, resistance, and volts. Each array should be capable of holding 10 elements. Using a for loop, input values for the current and resistance arrays. The entries in the volts array should be the product of the corresponding values in the current and resistance arrays (sovolts[i]=current[i]resistance[i]). After all the data has been entered, display the following output, with the appropriate value under each column heading: CurrentResistance Voltsarrow_forward(Program) Write a declaration to store the following values in an array named rates: 12.9, 18.6, 11.4, 13.7, 9.5, 15.2, and 17.6. Include the declaration in a program that displays the values in the array by using pointer notation.arrow_forward
- (File creation) Write a C++ program that creates an array containing the integer numbers 60, 40, 80, 90, 120, 150, 130, 160, 170, and 200. Your program should then write the data in the array to a text file. (Alternatively, you can create the file with a text editor.)arrow_forward(List maintenance) The following letters are stored in an alphabet array: B, J, K, M, S, and Z. Write and test a function named adlet(), which accepts the alphabet array and a new letter as arguments, and then inserts the new letter in the correct alphabetical order in the array.arrow_forward(Statistics) a. Write a C++ program that reads a list of double-precision grades from the keyboard into an array named grade. The grades are to be counted as they’re read, and entry is to be terminated when a negative value has been entered. After all grades have been input, your program should find and display the sum and average of the grades. The grades should then be listed with an asterisk (*) placed in front of each grade that’s below the average. b. Extend the program written for Exercise 1a to display each grade and its letter equivalent, using the following scale: Between90and100=AGreaterthanorequalto80andlessthan90=BGreaterthanorequalto70andlessthan80=CGreaterthanorequalto60andlessthan70=DLessthan60=Farrow_forward
- Mark the following statements as true or false. A double type is an example of a simple data type. (1) A one-dimensional array is an example of a structured data type. (1) The size of an array is determined at compile time. (1,6) Given the declaration: int list[10]; the statement: list[5] - list[3] * list[2]; updates the content of the fifth component of the array list. (2) If an array index goes out of bounds, the program always terminates in an error. (3) The only aggregate operations allowable on int arrays are the increment and decrement operations. (5) Arrays can be passed as parameters to a function either by value or by reference. (6) A function can return a value of type array. (6) In C++, some aggregate operations are allowed for strings. (11,12,13) The declaration: char name [16] = "John K. Miller"; declares name to be an array of 15 characters because the string "John K. Miller" has only 14 characters. (11) The declaration: char str = "Sunny Day"; declares str to be a string of an unspecified length. (11) As parameters, two-dimensional arrays are passed either by value or by reference. (15,16)arrow_forward(Numerical) Write and test a function that returns the position of the largest and smallest values in an array of double-precision numbers.arrow_forward(Electrical eng.) Write a program that stores the following resistance values in an array named resistance: 16, 27, 39, 56, and 81. Your program should also create two arrays named current and power, each capable of storing five double-precision numbers. Using a for loop nd a cin statement, have your program accept five user-input numbers in the current array when the program is run. Your program should store the product of the values of the squares of the current array and the resistance array in the power array. For example, use power[1]=resistance[1]pow(current[1],2). Your program should then display the following output (fill in the chart):arrow_forward
- (Numerical) a. Define an array with a maximum of 20 integer values, and fill the array with numbers input from the keyboard or assigned by the program. Then write a function named split() that reads the array and places all zeros or positive numbers in an array named positive and all negative numbers in an array named negative. Finally, have your program call a function that displays the values in both the positive and negative arrays. b. Extend the program written for Exercise 6a to sort the positive and negative arrays into ascending order before they’re displayed.arrow_forward(Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three rows and five columns. This array currently contains test voltages of an amplifier. Write a C++ program that interactively inputs 15 array values, and then determines the total number of voltages in these ranges: less than 60, greater than or equal to 60 and less than 70, greater than or equal to 70 and less than 80, greater than or equal to 80 and less than 90, and greater than or equal to 90. b. Entering 15 voltages each time the program written for Exercise 7a runs is cumbersome. What method could be used for initializing the array during the testing phase? c. How might the program you wrote for Exercise 7a be modified to include the case of no voltage being present? That is, what voltage could be used to indicate an invalid voltage, and how would your program have to be modified to exclude counting such a voltage?arrow_forwardWrite a statement that declares a procedure-level one-dimensional array named intorders. The array should contain 15 elements.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr

Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,