Tuesday, January 28, 2020

the use of assembler directives in microprocessor

the use of assembler directives in microprocessor Abstract This term paper includes the use of assembler directives in microprocessor and the various assembler directives used in Intel microprocessor 8086, its format with various examples. I) Definition An assembler directive is a message to the assembler that tells the assembler something it needs to know in order to carry out the assembly process; for example, an assemble directive tell the assembler where a program is to be located in memory. There are some instructions in the assembly language program which are not a part of processor instruction set. These instructions are instructions to the assembler, linker and loader. These are referred to as pseudo-operations or as assembler directives. II) Use Of Assembler Directives The assembler directives control organization of the program and provide necessary information to the assembler to understand assembly language programs to generate machine codes. They indicate how an operand or a section of program is to be processed by the assembler. An assembler supports directives to define data, to organize segments to control procedures, to define macros etc. An assembly language program consists of two types of statements: instructions and directives. The instructions are translated to machine codes by the assembler whereas the directives are not translated to machine codes. III) Assembler Directives For Intel8086 Microprocessor 1) ASSUME The ASSUME directives is used to inform the assembler the names of the logical segments, which are to be assigned to the different segments used in an assembly language program. In an assembly language program, each segment is given a name by the programmer. For example, the code segment may be given the name CODE or CODE_SEG or MY_CODE, etc. The data segment may be given the name DATA, MY_DATA, DATA_SEG, etc. Examples: i) ASSUME CS : CODE The above directive tells the assembler that the name of the code segment is CODE. This name is a user defined segment name. The segment named CODE contains the machine codes of the instructions. The code segment register (CS register) is to be loaded with the starting address of the code segment, given by the operating system for the label CODE in the assembly language program. ii) ASSUME DS: DATA The above directive informs the assembler that the name of the data segment is DATA. This is a user defined segment name. It contains data of the program which is being executed. The DS register (data segment register) is to be loaded with the starting address of the data segment, given by the operating system for the label DATA in the program. iii) ASSUME SS: STACK The above directive tells the assembler that the name of the stack segment used by the programmer is STACK. This is a user defined segment name. It stores addresses and data of the subroutines, saves the contents a specified register or memory locations after PUSH instruction, etc. The stack segment register SS holds the starting address of the stack segment allotted by the operating system. iv) ASSUME ES: EXTRA The above directive tells the assembler that the name of the extra segment is EXTRA which is a user defined segment name. In Intel 8086 microprocessor, string instructions may use DI register to point the destination memory address for the data. The EXTRA segment is used to hold the addresses pointed by DI. 2) DB (Define Byte) The directive DB a byte type variable. In a given directive statement, there may be single initial value or multiple initial values of the defined variable. If there is one initial value, one byte of memory space is reserved for each value. The general format is: Name of Variable DB Initial value or Values. Examples: i) VELOCITY DB 0 This directive informs assembler to reserve one byte of memory space for the variable named VELOCITY and initialize it with value zero. ii) WEIGHT DB 85 This directive informs assembler to reserve one byte of memory space for the variable named WEIGHT and initialize with value 85. iii) FORCE DB ? This directive directs assembler to reserve one byte of memory space for the variable FORCE. Furthermore, the question mark ? In the data definition informs assembler that the value of the variable is not known and hence, it is not to be initialized. iv) ARRAY DB 32, 42, 59, 67, 83 This directive informs assembler to reserve five bytes of consecutive memory space for the variable named ARRAY. The memory locations are to be initialized with the values 32, 42, 59, 67 and 83. v) MESSAGE DB ‘THANK YOU This directive informs the assembler to reserve the number of bytes of memory space equal to the number of characters in the string named MESSAGE, and initialize the memory locations with ASCII codes of the these characters. 3) DW (Define Word) The directive DW defines a word -type variable. The defined variable may have one or more initial values in the directive statement. If there is one value, two-bytes of memory space are reserved. If there are multiple values, two bytes of memory space are reserved for each value. The general formula is: Name of variable DW Initial Value or Values. Examples: i) SUM DW 3596. This directive informs the assembler to reserve two bytes (one word) of consecutive memory locations for the variable named SUM and initialize it with the value 3596. ii) NUMBER DW ‘25 The above directive statement informs assembler to reserve two bytes of consecutive memory locations for the variable named NUMBER. The first byte of the memory is to be initialized with the ASCII code of two (32) and the second byte is to be initialized with the ASCII code of five (35). Hence, the two bytes of memory space contain 3235H. iii) DATA DW 5384, 6932, 5 DUP (3456), 7384 This directive informs assembler to reserve 16 bytes of consecutive memory locations. The number 3456 is repeated five times. Memory locations are initialized with 5384,6932, 3456, 3456, 3456,3456, 3456 and 7384. 4) DD (Define Double Word) This directive DD defines a double word-type variable. The defined variable may have one or more values in the statement. If there is only one value, four bytes of consecutive memory locations are reserved. If there are multiple values, four bytes of memory locations are reserved for each value. The general format is: Name of Variable DD Initial value or values Example: NUMBER DD 23958634 The above directive informs assembler to reserve four bytes of memory locations for the variable named NUMBER and initialize with the number 23958634. 5) DQ (Define Quadword) The directive DQ defines a quadword- type variable. The defined variable may have one or more values in the statement. If there is only one value, 8 bytes of consecutive memory locations are reserved. If there are multiple values, 8 bytes of memory space are reserved for each value. The general format is: Name of Variable DQ Initial value or values Example: NUMBER DQ 1568934893846735 The above directive informs assembler to reserve 8 bytes of consecutive memory locations for the variable named NUMBER and initialize with the above mentioned number. 6) DT (Define Tenbytes) The directive DT defines a variable of ten bytes. In the directive statement there may be one or more values. If there is only one value, 10 bytes of consecutive memory locations are reserved. If there are multiple values, ten consecutive memory locations are reserved for each value. The general format is: Name of Variable DT Initial value or values Example: NUMBER DT 34968435876934839251 The above directive informs assembler to reserve 10 bytes of consecutive memory locations for the variable named NUMBER and initialize with the above specified values. 7) END (End of Program) The directive END informs assembler the end of a program module. This is used after the last statement of the program module. This assembler ignores statement(s) after an END directive. Therefore, the programmer should use END directive at the very end of his program module. A carriage return is used after the END directive. Its general format is: END label 8) ENDP (End Procedure) The directive ENDP informs assembler the end of a procedure. In assembly language programming, subroutines are called procedures. A procedure may be an independent program module to give certain result or the required value to the calling program. A procedure is given a name i.e. a label. The label is used as prefix with directive ENDP. This directive is used together with PROC directive to enclose the procedure. To specify the type of the procedure the term FAR or NEAR is used after the PROC directive. The type FAR indicates that the procedure to be called is in some other segment of memory. Type NEAR indicates that the procedure is in the same segment of memory. If type is not specified, the assembler assumes it NEAR. The general format for ENDP directive is: Procedure Name ENDP Example: SPEED_CONTROL PROC FAR ; Start of Procedure : ; Procedure instructions SPEED_CONTROL ENDP ; End of Procedure 9) ENDM (End Macro) The directive ENDM is used to inform assembler that this is the end of a macro. The directive ENDM is used with the directive MACRO to enclose macro instructions. Example: COMPLIMENT MACRO ; Start of macro : ; Macro instructions ENDM ; End of Macro COMPLIMENT is the name of a macro. The name is given before the directive MCRO which tells the assembler the beginning of a macro. 10) ENDS ( End of Segment) The ENDS directive informs assembler that this is the end of the segment. The name of the segment is given using ASSUME directive which has already been explained. The name of the segment is used as the prefix of the ENDS directive. Its general format is: Segment Name ENDS Example: CODE_SEG SEGMENT ; Start of code segment ; instructions CODE_SEG ENDS ; End of segment 11) EQU (Equate) The directive EQU is used to give a name to certain value or symbol. If any value or symbol is used many times in an assembly language program, a name is given to the value or symbol to make programming easier and simpler. Each time the assembler finds the given name in the program, it replaces the name with the value or symbol which has already been equated with that name. The general format for the EQU directive is: Value Name EQU Value or or Symbol Name Symbol Example: ROOM_TEMP EQU 02H The above directive tells assembler to replace ROOM_TEMP by 02H. If EQU directive is written in the beginning of the program and later on MOV AL, ROOM_TEMP is written in the program, the assembler will treat this instruction as if it were MOV AL, 02H while giving its machine codes. 12) EXTRN (External) This directive informs the assembler that the names, procedures and labels following this directive have already been defined in some other program modules. The names, procedures and labels declared as external in one program module must be declared public using PUBLIC directive in the program module in which they have been defined. When the programmer informs assembler that the declared item is an external one, the assembler puts this information in the object code file so that the linker can connect the concerned two program modules together. The general format for EXTRN directive is: i) EXTRN Variable Name : Type of variable ii) EXTRN Procedure Name : (NEAR/FAR) For external named variable, procedure or constant; its type is to be specified. Examples : i) EXTRN MULTIPLIER : WORD In this directive the variable named MULTIPLIER is an external variable and it is word type variable. ii) EXTRN CORRECTION_FACTOR: ABS In this directive CORRECTION_FACTOR is an external constant. It has been defined with EQU directive in another program module. Constants are identified by type: ABS. 13) LABEL (Label) In an assembly language program labels are used to give names to memory addresses. When assembler begins assembly process, it initializes a location counter to keep the track of memory locations i.e. memory addresses. The content of the location counter holds the address of the memory location assigned to an instruction during assembly process. The LABEL directive is used to give a name to the current value in the location counter i.e. the current memory address which is in the location counter. The type of label is to be specified. The general format of the LABEL directive is: LABEL Label Name Label Type Example: AHEAD LABEL NEAR Instruction Instruction AHEAD AHEAD Instruction 14) LENGTH ( Length) It is an operator to determine the number of elements in a data item such as an array or a string. Example: DATA SEGMENT ARRAY DW 10 DUP(?) NUMBERS DB 10 DUP(?) DATA ENDS The LENGTH operator can be used as follows: i) MOV CX, LENGTH ARRAY ii) MOV CX, LENGTH NUMBERS In both examples i) and ii), the execution of the instruction will move number 10 in the register CX as the number of elements are 10 in both the variables ARRAY as well as NUMBERS. 15) PROC (Procedure) The directive PROC indicate the start of a procedure. The type of the procedure FAR or NEAR is to be specified after the directive. The type NEAR is used to call a procedure which is within the program module. The type FAR is used to call a procedure from some other program module. The PROC directive is used with ENDP directive to enclose a procedure. The general format of the PROC directive is: Name of procedure PROC type of procedure Example : i) TEMP_MEAST PROC FAR The above procedure is for temperature measurement and it lies in some other program module. There are other directives also which includes TYPE (Type), STRUCT OR STRUC (Structure Declaration), SIZE (Size), SHORT (Short), SEG (Segment), RECORD (Record), PUBLIC (Public), MACRO, NAME (Name), OFFSET (Offset) etc.

Sunday, January 19, 2020

gatillus Illusion Vs. Reality in F. Scott Fitzgerald’s The Great Gatsby :: Great Gatsby Essays

Illusion Vs. Reality in The Great Gatsby   Ã‚  Ã‚   "A confusion of the real with the ideal never goes unpunished," is how Goethe states not to mistake fantasy for reality. In the novel, The Great Gatsby, by F. Scott Fitzgerald, many of the characters live in an illusory world, though few can see reality.   Ã‚  Ã‚   Fitzgerald presents Jay Gatsby as one character who cannot see reality. "Can't repeat the past? Why of course you can!"(Pg. 116) He focuses so strongly on trying to get what he had in the past that he cannot face the reality that he cannot have Daisy. When Gatsby meets Daisy, he tells her that he is from a wealthy family to try to convince her that he is worthy of her. He also thinks that he can buy Daisy with his money. In addition, Jay Gatsby's real name is James Gatz. He changes his name because he wants to be a different person. Gatsby stakes everything on his dreams, but he does not realize that his dreams are unworthy of him. He loves Daisy so much that he cannot see how money corrupts her.   Ã‚  Ã‚   Daisy Buchanan is another character who lives in an illusory world. Daisy marries Tom only because he has money. Daisy is in love with material objects. She uses her money to get away from reality, and when she feels threatened, she hides behind her money. Furthermore, she says, "And I hope she'll be a fool-That's the best thing a girl can be in this world, a beautiful little fool."(Pg. 21) regarding her daughter Pammy. This statement shows part of her corruption because she is saying that it is better to be careless and beautiful instead of worrying about real things. Daisy wears white, which represents purity, but she is corrupted by money, which is gold and yellow. The colors white, yellow and gold are like the flower that Daisy is named after.   Ã‚     Another character, Nick Carraway, is one of the few people in The Great Gatsby that lives in reality. "They're a rotten crowd. You're worth the whole damn bunch put together," (Pg.162) is an example of how Nick realizes the corruption that money brings. While Gatsby allows money to possess him, Nick can see the destructive force of it.

Saturday, January 11, 2020

Should Girls and Boys Be Given Exactly the Same Type of Education?

Should girls and boys be given exactly the same type of education? In Singapore, girls and boys are entitling the same type of education. Gender equality is ensure by our government. This was done so to make sure there wasn't any discrimination among each gender, and there was equal opportunities given to the citizens, to voice out their discontented. However, this was not implemented throughout the world. To begin with, girls should be entitled the equal right as boys to receive education. It is not a major problem in developed countries, but in less developed country like Saudi Arab, they do not pay much attention to girl’s education.In their views, girls are born to tend the house, and do the laborious chores. Therefore, religious views are the root towards the type of education given to both genders. In addition, whether to apply the same education for both genders also have a further impact on the development of the country. The development of country would determine whet her the same type of education should be given to both genders. For example, in Singapore, being a fast-tempo country and with small population, we need both genders to help to boost the economy.Whereas, slow-tempo country like Vietnam but with large population, there are limited job opportunities. Males are needed to work in the rice field, while the females stay home to do house chores. Therefore, girls and boys should be given the same education depends on the country’s quality of life. Lastly, school fees are not a small sum. Not all family are able to afford to send their children to school. And in the traditional views, females are married off to the males; they do not need much education.Whereas the males have to raise the family, thus education opportunities are given to them. Therefore, expenses are one of the factors that contribute to the entitlement of same type of education. However, when both genders are given exactly the same type of education, they are given t he same opportunities in the social world. Research also has proven that girls are more competence than the boys. Girls also tend to be perfectionist in their field of work and so, whatever work is given to them, and they will end up doing their best to complete it.With more girls in the working society, this will eventually help to boost the competency between companies and also the company profits as well. To sum up, girls and boys educations are given according to the circumstances such as area of development, religion beliefs and expenses. Gender discrimination will not be demolished within a short period of time. Therefore, policy against gender discrimination should be implemented to protect the rights of the ladies even though they do not have education.

Friday, January 3, 2020

Morality and Religion in Defoes Robinson Crusoe and Moll...

Daniel Defoe was born in 1660.Daniel received a very good education as his father hoped he would become a minister , but Daniel was not interested.His family were Dissenters, Presbyterians to be precise, and those sects were being persecuted a bit at this time so maybe Daniel had the right idea.He was always very tolerant of others religious ideas himself he was a good puritan at the same time.Hed pretty much against the ministry,though he wrote and spoke in favor of the Dissenters all his life.However being a religious man he sometimes critisized Christianty .Somehow he reflected his beliefs in his books,writings. Wherever god erects a house of prayer, The Devil always builds a chapel there;†¦show more content†¦According to Defoe crowd takes people away from basic realities of life.We can see this thought in both book of him, Robinson Crusoe and Moll Flanders .In Robinson Crusoe when he is in England he doesnt think of God and religion much, society makes him irreligious and careless.However when he decieds to go far and starts his journey , a transformation comes into being in his philosophy.The time that he spends in the island supplies the most effective enviroment him to reform his thoughts and beliefs.As we see in the following quotation: ..What is this earth and sea, of which I have seen so much?Whence is it produced?And what am I, and all the other creatures, wild and tame ,human and brutal, whence are we?Sure we are all made by some secret Power that could make all things, must certainly have power to guide and direct them... He has his own way of judging.He real izes some religious facts but never submits them blindly.Robinson Crusoe as a man who comes from typical English society and modern world combines the facts of society of his time, its moral understanding and the facts of pure faith that he found himself.Doing this synthesis he sometimes contradicts modern worlds vision therefore critisizes its policy, such as by saying: ..the policy of making a secretShow MoreRelatedBiography of Daniel Defoe1105 Words   |  4 Pages Daniel Defoe, though faced with many struggles as a writer, changed normal English literary styles of writing. Defoe wrote a novel, Robinson Crusoe and was the father of the English novel. As William Hazlitt put it, â€Å"Book making in the hands of a dull man is the worst and degrading of all drudgeries; in the hands of Daniel Defoe it changes character and becomes the noblest and most delightful of all possible occupations.† (7) Though many argue that Daniel Defoe was unable to fullyRead MoreWe Must Keep Daniel Defoe in the Literary Cannon1235 Words   |  5 PagesDaniel Defoe born in or around 1660 experienced the most complex disastrous events in England before he was seven. In 1664 a Dutch fleet attacked London, in 1665 the plague took seventy thousand lives and in 1666 the great fire destroyed Defoe’s neighborhood expect for three houses, one being his. Born to a family of dissenters a class of people who refused to conform to the Church of England, Defoe was hindered with obstacles from the start. Receiving his education from a dissenter’s school and