Question

In: Computer Science

1a)What is the purpose of suffixes on commands? Are suffixes required? (defend your answer) b)Describe 3...

1a)What is the purpose of suffixes on commands? Are suffixes required? (defend your answer)

b)Describe 3 types of mov commands, i.e. data located in source and destination postions

c)Describe how the jmp command works and list the different "jump" commands and their task/meaning.

d)Describe how leaq works. Can leaq be used for arithemetic operations? (explain)

Solutions

Expert Solution

a)

A suffix is a letter or group of letters added to the end of a word. Suffixes are commonly used to show the part of speech of a word. For example, adding "ion" to the verb "act" gives us "action," the noun form of the word. Suffixes also tell us the verb tense of words or whether the words are plural or singular.

RULE: 1 - When a word ends with a consonant and the suffix begins with a consonant, just add the suffix with no spelling changes. RULE: 2 - For most words ending in a single consonant you need to double the last letter when you add suffixes. This is especially true for one syllable words!

The most common suffixes are: -tion, -ity, -er, -ness, -ism, -ment, -ant, -ship, -age, -ery.

I’m surprised nobody has mentioned suffixes to actual names, such as in Lithuanian.

Take a person from that country with the surname “Paulauskaitė”. I know, without meeting her or knowing her first name, that this is an unmarried woman - because the suffix “-aitė” gives it away. A married woman or a widow would be named “Paulauskienė”; the father / husband would be “Paulauskas”.

More recently, it has been formally accepted for women to use a simple “-ė” suffix to conceal their marriage status (“Paulauskė”), similar to the “Ms” prefix negating the need to distinguish a “Mrs” from a “Miss”. This status-neutral suffix has been slower to catch on in Lithuanian than the prefixed title in English, but will likely become more common in future as social attitudes change.

b)

Register Addressing

In this addressing mode, a register contains the operand. Depending upon the instruction, the register may be the first operand, the second operand or both.

For example,

MOV DX, TAX_RATE   ; Register in first operand
MOV COUNT, CX      ; Register in second operand
MOV EAX, EBX       ; Both the operands are in registers

Immediate Addressing

An immediate operand has a constant value or an expression. When an instruction with two operands uses immediate addressing, the first operand may be a register or memory location, and the second operand is an immediate constant. The first operand defines the length of the data.

For example,

BYTE_VALUE  DB  150    ; A byte value is defined
WORD_VALUE  DW  300    ; A word value is defined
ADD  BYTE_VALUE, 65    ; An immediate operand 65 is added
MOV  AX, 45H           ; Immediate constant 45H is transferred to AX

Direct Memory Addressing

When operands are specified in memory addressing mode, direct access to main memory, usually to the data segment, is required. This way of addressing results in slower processing of data. To locate the exact location of data in memory, we need the segment start address, which is typically found in the DS register and an offset value. This offset value is also called effective address.

In direct addressing mode, the offset value is specified directly as part of the instruction, usually indicated by the variable name. The assembler calculates the offset value and maintains a symbol table, which stores the offset values of all the variables used in the program.

In direct memory addressing, one of the operands refers to a memory location and the other operand references a register.

For example,

ADD     BYTE_VALUE, DL  ; Adds the register in the memory location
MOV     BX, WORD_VALUE  ; Operand from the memory is added to register

c)

The machine cycle automatically executes instructions in sequence. When a jump instruction executes (in the last step of the machine cycle), it puts a new address into the PC. Now the fetch at the top of the next machine cycle fetches the instruction at that new address.

  • Jump Instructions are used for changing the flow of execution of instructions in the processor. ...
  • i) JC : Stands for 'Jump if Carry' ...
  • ii) JNC : Stands for 'Jump if Not Carry' ...
  • iii) JE / JZ : Stands for 'Jump if Equal' or 'Jump if Zero' ...
  • iv) JNE / JNZ : Stands for 'Jump if Not Equal' or 'Jump if Not Zero'

d)

The LEA (Load Effective Address) instruction is a way of obtaining the address which arises from any of the Intel processor's memory addressing modes. That is to say, if we have a data move like this: MOV EAX, <MEM-OPERAND> it moves the contents of the designated memory location into the target register.

The lea instruction calculates the address of the src operand and loads it into the dest operand. Note Load Effective Address calculates its src operand in the same way as the mov instruction does, but rather than loading the contents of that address into the dest operand, it loads the address itself.

Yes arithmatic operation is possible.

As others have pointed out, LEA (load effective address) is often used as a "trick" to do certain computations, but that's not its primary purpose. The x86 instruction set was designed to support high-level languages like Pascal and C, where arrays—especially arrays of ints or small structs—are common. Consider, for example, a struct representing (x, y) coordinates:

struct Point
{
     int xcoord;
     int ycoord;
};

Now imagine a statement like:

int y = points[i].ycoord;

where points[] is an array of Point. Assuming the base of the array is already in EBX, and variable i is in EAX, and xcoord and ycoord are each 32 bits (so ycoord is at offset 4 bytes in the struct), this statement can be compiled to:

MOV EDX, [EBX + 8*EAX + 4]    ; right side is "effective address"

which will land y in EDX. The scale factor of 8 is because each Point is 8 bytes in size. Now consider the same expression used with the "address of" operator &:

int *p = &points[i].ycoord;

In this case, you don't want the value of ycoord, but its address. That's where LEA (load effective address) comes in. Instead of a MOV, the compiler can generate

LEA ESI, [EBX + 8*EAX + 4]

Related Solutions

1a. what is the difference between the research topic and research questions? b. The purpose of...
1a. what is the difference between the research topic and research questions? b. The purpose of the research topic. c. Three (3) ways that you can identify a research topic.
Explain and defend your personal view of the purpose and first cause of the universe. Is...
Explain and defend your personal view of the purpose and first cause of the universe. Is your determination of the first cause of the universe important when making other decisions to direct your life or in your political views? Analyze your decision making and ethical beliefs to see how your “first principles” might guide your worldview and decision making. ( Answer should be at 200 words)
Describe your Purpose to Impact plan. What is your purpose statement? What is your first critical...
Describe your Purpose to Impact plan. What is your purpose statement? What is your first critical step to implement your impact plan?
What are the pros and cons of rent control? Should it be abolished? Defend your answer...
What are the pros and cons of rent control? Should it be abolished? Defend your answer in an essay and use a graph.
What are the Information Systems required to implement JIT in a corporation? Describe the purpose of...
What are the Information Systems required to implement JIT in a corporation? Describe the purpose of each information system and their relationship. Start from the customer order and explain the information exchanged between the Information Systems by the Customer, the Corporation, and the Supplier in order to manufacture the customer order and pay the parts provided by the Supplier.
what is the greatest danger or weakness of altruism? Its greatest strength? Defend your answer in...
what is the greatest danger or weakness of altruism? Its greatest strength? Defend your answer in detail.
What are the economic costs of attending college? List the relevant factors and defend your answer....
What are the economic costs of attending college? List the relevant factors and defend your answer. “The elasticity of demand for Coca Cola is smaller than for soda in general.” Is this sentence true or false? Defend your answer. Over time, the contributions of computing and computer power to economic output have grown. How do you expect this will affect the market for college degrees in computer science? Defend your answer. A graph is required for full credit. Suppose there...
What do you think the migration policy of the united states should be? Defend your answer...
What do you think the migration policy of the united states should be? Defend your answer and explain what would be the consequences, intended and unintended, of your proposed policy.
1. Describe the purpose of diffusion experiment. 2. Describe the purpose of osmosis experiment. 3. Describe...
1. Describe the purpose of diffusion experiment. 2. Describe the purpose of osmosis experiment. 3. Describe the observation/results of the osmosis experiment.
Defend the reason for the following, using elasticity of demand as the basis for your answer....
Defend the reason for the following, using elasticity of demand as the basis for your answer. Motivate your answer with the aid of examples. 2.1.1 Narrowly defined markets tend to be associated with a more price elastic demand than broadly defined markets. (6) 2.1.2 Goods tend to have more price elastic demand over large time horizons. (6) 2.1.3 Necessities tend to have relatively inelastic demands, whereas luxuries have relatively inelastic demand. (6) 2.2 Read the scenario below and answer the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT