What are the contents of the symbol table during the first pass after all of the instructions up to and including location 3 have been processed?
The answer is : SYM1=1234, LAB2= $100, SYM3=$12C, LAB4=??, LOOP= $053
1. Can someone explain to me why LAB2 equal to $100 and what is $5B43DE?
2. why is LOOP $053 instead of $054?
The label field is optional. A label is an identifier (or text string symbol). Labels are used extensively in programs to reduce reliance upon programmers remembering where data or code is located. A label can be used to refer to<
a memory location the value of a piece of data the address of a program, sub-routine, code portion etc.
The maximum length of a label differs between assemblers. Some accept up to 32 characters long, others only four characters. A label, when declared, is suffixed by a colon, and begins with a valid character (A..Z). Consider the following example.
START: LDAA #24H
Here, the label START is equal to the address of the instruction LDAA #24H. The label is used in the program as a reference, eg,
JMP START
This would result in the processor jumping to the location (address) associated with the label START, thus executing the instruction LDAA #24H immediately after the JMP instruction. When a label is referenced later on in the program, it is done so without the colon suffix.
An advantage of using labels is that inserting or re-arranging code statements do not necessitate re-working actual machine instructions. A simple re-assembly is all that is required. In hand-coding, such changes can take hours to perform.
Each instruction consists of an opcode and possible one or more operands. In the above instruction
JMP START
the opcode is JMP and the operand is the address of the label START.
The opcode field contains a mnemonic. Opcode stands for operation code, ie, a machine code instruction. The opcode may also require additional information (operands). This additional information is separated from the opcode by using a space (or tab stop).
The operand field consists of additional information or data that the opcode requires. In certain types of addressing modes, the operand is used to specify
Examples of operands are
TAB ; operand specified by opcode LDAA 0100H ; two byte operand LDAA START ; label operand LDAA #0FH ; immediate operand
The comment field is optional, and is used by the programmer to explain how the coded program works. Comments are preceded by a semi-colon. The assembler, when generating instructions from the source file, ignores all comments. Consider the following examples,
; H means hexadecimal valuesORG 0100H ;This program starts at address 0100 hex STATUS: DFB 23H ;This byte is identified as STATUS, and is ;initialized to a value of 23 hex CODE: LDAA STATUS ;The label called CODE is identified as a ;machine code instruction which loads the ;A accumulator with the contents of the ;memory location associated with the label ;STATUS, ie, the value 23 JMP CODE ;Jump to the address associated with CODE
Note that the programmer does not need to worry about bit patterns, hex values, and the addresses of STATUS or CODE. The assembler, when fed the above program, will generate the correct code. The code output from the assembler will be,
Memory location Byte value 0100 23 0101 B6 0102 01 0103 00 0104 7E 0105 01 0106 01 Location 0100 holds the value associated with the label STATUS Locations 0101 to 0103 perform the LDAA STATUS instruction Locations 0104 to 0106 perform the JMP CODE instruction
The statement ORG 0100H in the above program is not a machine code instruction. It is an instruction to the assembler, which instructs the assembler to generate the code to run at the designated origin address. Instructions to assemblers are called pseudo-ops. These are used for
The assembler does not generate any machine code instructions for pseudo-ops or comments. Assemblers scan the source program, generating machine instructions. Sometimes, the assembler reaches a reference to a variable which has not yet been defined. This is referred to as a forward reference problem. The assembler can tackle this problem in a number of ways. It is resolved in a two pass assembler as follows,
On the first pass, the assembler simply reads the source file, counting up the number of locations that each instruction will take, and builds a symbol table in memory which lists all the defined variables cross-referenced to their associated memory address. On the second pass, the assembler substitutes opcodes for the mnemonics, and variable names are replaced by the memory locations obtained from the symbol table.
OPERATION OF A TWO-PASS ASSEMBLER
Consider the following source code program for a hypothetical
computer. The program computes the so-called Fibonacci
numbers, printing all such numbers up to that specified by
LIMIT.
Line Label Operation Operand 1 Operand 2 1 COPY ZERO OLDER 2 COPY ONE OLD 3 READ LIMIT 4 WRITE OLD 5 FRONT: LOAD OLDER 6 ADD OLD 7 STORE NEW 8 SUB LIMIT 9 BRPOS FINAL 10 WRITE NEW 11 COPY OLD OLDER 12 COPY NEW OLD 13 BR FRONT 14 FINAL: WRITE LIMIT 15 STOP 16 ZERO: CONST 0 17 ONE CONST 1 18 OLDER SPACE 19 OLD SPACE 20 NEW SPACE 21 LIMIT SPACE
The instruction set of the computer is as follows,
Operation Code Number of Symbolic Machine Length Operands Action ADD 02 2 1 ACC <- ACC + OPD1 BR 00 2 1 Branch to OPD1 BRPOS 01 2 1 Branch to OPD1 if ACC> 0 COPY 13 3 2 OPD2 <- OPD1 LOAD 03 2 1 ACC <- OPD1 READ 12 2 1 OPD1 <- input stream STOP 11 1 0 Halt execution STORE 07 2 1 OPD1 <- ACC SUB 06 2 1 ACC <- (ACC - OPD1) WRITE 08 2 1 output stream <- OPD1
The functions that the assembler will perform in translating the program are,
What are the contents of the symbol table during the first pass after all of the...
Choose a symbol from either "The Gift of the Magi" and discuss what significance this symbol had to you as the reader (an example of this would be the combs Jim gave to Della and a discussion about a precious gift that you received or gave). Use text examples in this section. If someone were to write your life story, what symbol would be present and why? How does this symbol represent you? You can attach a picture of your symbol (an...
Franks’ family had a full table for Thanksgiving dinner, including aunts, great aunts, uncles and cousins he barely knew. Luckily, Frank’s favorite cousin, Colin, a thirty-five year old software engineer working for a toy company in an exotic overseas location, flew in just for Thanksgiving. Colin was happy to be home and was entertaining everyone with his stories of the amazing foods he had eaten over the past few months. Finally, Thanksgiving dinner was served: turkey, gravy, spinach casserole, sweet...
If someone can help me with the first table and then use the given information to figure out the diagnosis for the patient described in the second table. Please explain why you chose a certain diagnosis so I can try to gain a better understanding! Thanks in advance!:) Table 1 Region Function Structure glomerulus Bowman's capsule Cortex proximal tubule distal tubule descending loop of Henle ascending loop of Henle Medulla collecting duct renal papilla Renal pelvis ureter Date: Technician: Patient...
To respond to the Learning Activities, click on the blue hyperlink in the Topic area. Week 1 Learning Activity You will read the learning activity below and follow the instructions provided. You will create the memorandum and submit in the discussion area. Post the entire memorandum into the discussion area rather than provide as an attachment. Do not post in the discussion area until you have written the memorandum. If the seal is broken without posting, a zero for this...
Most people fail to recognize the importance of networking and negotiating to their career success. People who are good at networking tend to form better human relations with key individuals who can help them in advancing their professional careers. People who are good at negotiating have a better chance of getting what they truly desire. One’s ability to negotiate affects his or her compensation in the workplace. Negotiating Women, Inc. is a consulting company that focuses on women exclusively by...
internal project 1 anything helps! thank you!! Instructions: Study the case that starts on page 3 carefully. Then write concise answers to the following questions regarding the internal control system of Duarf, Inc. Clearly label your responses with proper headings and subheadings. Be very specific and precise. Answers that appear to be beating around the bush will not get any credit. 1. What are the controls in place that under normal conditions should function well to prevent embezzlements or frauds?...
What are the major areas of change from the old design to the new design? What do you think the major concerns will be of employees and managers in the new design? Use the star model to identify the transitions at each point of the star. Case Study 4: Reorganizing the Finance Department: Managing Change and Transitions Read the finance department case and consider the challenges you might anticipate during this reorganization. Develop a transition plan that addresses the following...
microbiology help TOT Zoo Add Page Insert Table Chart Text Shape Media Comment These questions will serve in lieu of a lab report for Exercise 15, 16, and 17 You will find the answer to these questions in the background, procedure, results and interpretation sections of manual Exercise 15, 16, and 17, videos, Actions of Selective and Differential Media Chart, and the Principle/Theory article in homework section.) General Questions 1. What is the purpose (function) of selective media? (How does...
i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...