Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will typically begin by entering a source program by hand or opening it from a file. Assemble is the only option available from the

You will typically begin by entering a source program by hand or opening it from a file. Assemble is the only option available from the Assembler menu at this point. During assembly, the system displays a program listing and any syntax error messages in the utility pane. Each line of source text is numbered in the listing for easy reference, and an error message appears on the line following the line of code in which the error occurs. Assembly halts at the first error. Error detection is pretty thorough: errors are caught even at the lexical level, such as illegal labels and integer literals that are too large for 16-bit sign magnitude representation.
The assembler can generate the following syntax error messages:
.begin expected.
.end expected.
Illegal opcode:
Halt does not take operand.
Wrong number of fields in instruction.
Label must end with :
Label already used:
Undeclared data label:
Undeclared instruction label:
Data label already used as instruction label:
Data directive already exists for label:
Value must be an integer.
Number is too large.
Not enough memory for instructions.
Not enough memory for data.
The program we just loaded from a file had no syntax errors. Let's put some syntax errors into it so we can see how the assembler detects them.
Replace the operand x in the first instruction, load x, with the operand a , then reassemble the program. The assembler should discover that you forgot to provide a data declaration for a. The assembler forces you to keep track of all your data and their initial values by declaring them at the bottom of the program. What is the error message? Correct this error before going on.
Replace the operator add with the operator multiply in the second instruction. The assembler should discover an unrecognized opcode. What is the error message? Correct this error before going on.
Replace the number 2 with the number 40000 in the first data declaration. What is the error message? Correct this error before going on.
Delete the space between add and y in the second instruction. What is the error message? There must be at least one blank space or tab between an operator and its operand. Correct this error before going on.
Insert a blank line after the second instruction. What is the error message? Assembly language typically has a fixed format, which requires an instruction to appear on each line of a program. Correct this error before going on.
Insert a blank space, followed by subtract, at the end of the second instruction. What is the error message? The instruction has three lexical items, the assembler expects the first one to be a label ending with a colon (:). Don't correct this error yet.
Oblige the assembler by inserting a colon (:) after add (be sure that there are no blank spaces between the colon and the d. Note the error detected. Now change y to add . The assembler treats subtract as an undeclared data label, which you could remedy by declaring it at the bottom of the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions