Question: in c + + plz Write a program to compile and output ACSL Assembly Language programs. The ACSL Assembly Language was introduced earlier in the

in c++ plz
Write a program to compile and output ACSL Assembly Language programs. The ACSL Assembly Language was introduced earlier in the semester with Module 4 material. Only the commands listed in the chart below will be used with this compiler. Execution starts at the first line of the program and continues sequentially, except for "branch" instructions, until the "end" instruction is encountered. The result of each operation is stored in a special word of memory, called the "accumulator" (ACC). Each line of an ACSL Assembly Language program has three components: a label (usually optional), an opcode (always required), and a loc field (nearly always required): The label, if present, is an alphanumeric character string beginning in the first column. A label must begin with an alphabetic character (A through Z, or a through z), and labels are case-sensitive. The label field is required for the DC opcode; it is optional for all other opcodes. Valid opcodes are listed in the chart below; they are uppercase and case sensitive. Opcodes are reserved words of the language and may not be used as a label. The loc field is either a reference to a label (e.g., "ADD A") or immediate data (e.g., "LOAD =123"). Only those opcodes with an asterisk in the following chart are allowed to use the immediate data format of the loc field. The loc field is required for all opcodes, except for the END opcode. It is prohibited on the END opcode. OPCODE ACTION *LOAD Contents of LOC are placed in the ACC. LOC is unchanged. STORE Contents of ACC are placed in the LOC. ACC is unchanged. *ADD Contents of LOC are added to the contents of the ACC. The sum is stored in the ACC. LOC is unchanged. Addition is modulo 1,000,000.*SUB Contents of LOC are subtracted from the contents of the ACC. The difference is stored in the ACC. LOC is unchanged. Subtraction is modulo 1,000,000.*MULT The contents of LOC are multiplied by the contents of the ACC. The product is stored in the ACC. LOC is unchanged. Multiplication is modulo 1,000,000. COSC 2425 F242*DIV Contents of LOC are divided into the contents of the ACC. The signed integer part of the quotient is stored in the ACC. LOC is unchanged. BE Branch to instruction labeled with LOC if ACC =0. BG Branch to instruction labeled with LOC if ACC >0. BL Branch to instruction labeled with LOC if ACC 0. BU Branch unconditionally to instruction labeled with LOC. END Program terminates. LOC field is ignored. READ Read a signed integer (modulo 1,000,000) into LOC. PRINT Print the contents of LOC. DC The value of the memory word defined by the LABEL field is defined to contain the specified constant. The LABEL field is mandatory for this opcode. The ACC is not modified. Input will be from a data file. The first line N in the range [1,10] denotes how many valid programs to read in. Each of the N programs will be preceded by a line with one or more integers separated by one or more spaces. These integers are input to the program when the READ opcode is executed. The program fields on the following lines are separated by a combination of spaces and tabs. Each program will be separated by a blank line except for the last line in the data file. For each labeled program, output to the screen the value of the ACC when the program ends. Let the user input the file name from the keyboard. Finally, the program should ask if the user wants to run the program again (Check case). Refer to the sample output below. Sample File: Sample Run: 20 A DC 8 B DC -2 C DC 3 LOAD B MULT C ADD A DIV B SUB A END 23 A DC 1 READ B READ C Enter filename: assembly.txt Program 1: -9 Program 2: 1 Run again (Y/N): n Write a program to compile and output ACSL Assembly Language programs. The ACSL Assembly Language was introduced earlier in the semester with Module 4 material. Only the commands listed in the chart below will be used with this compiler. Execution starts at the first line of the program and continues sequentially, except for "branch" instructions, until the "end" instruction is encountered. The result of each operation is stored in a special word of memory, called the "accumulator" (ACC). Each line of an ACSL Assembly Language program has three components: a label (usually optional), an opcode (always required), and a loc field (nearly always required):
- The label, if present, is an alphanumeric character string beginning in the first column. A label must begin with an alphabetic character (A through Z, or a through z), and labels are case-sensitive. The label field is required for the DC opcode; it is optional for all other opcodes.
- Valid opcodes are listed in the chart below; they are uppercase and case sensitive. Opcodes are reserved words of the language and may not be used as a label.
- The loc field is either a reference to a label (e.g., "ADD A") or immediate data (e.g., "LOAD =123"). Only those opcodes with an asterisk in the following chart are allowed to use the immediate data format of the loc field. \begin{tabular}{l|l}
in c + + plz Write a program to compile and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem you need to create an ACSL American Computer Science League Assembly Language emulator in C The program reads an input file cont... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!