DOC PREVIEW
NOVA CSC 206 - Lecture Notes

This preview shows page 1-2-17-18-19-36-37 out of 37 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Chapter 3 Elements of Assembly LanguageAssembly Language StatementsAssembly Language Statements ContinuedBasic Elements of Assembly LanguageBasic Elements of Assembly Language ContinuedSlide 6Slide 7Statements in Assembly LanguageStatements in Assembly Language ContinuedSlide 10Slide 11Statements in Assembly Language ContinuedSlide 13Statements in Assembly Language Continued (Memory Allocation)Statements in Assembly Language Continued DB (Memory Allocation) DirectiveStatements in Assembly Language Continued DB (Memory Allocation) DirectiveStatements in Assembly Language Continued DW (Memory Allocation) DirectiveStatements in Assembly Language Continued DD (Memory Allocation) DirectiveHow Data is StoredSample ProgramSlide 21Data Transfer InstructionsData Transfer Instructions ContinuedData Transfer Instructions Continued Operands with DisplacementsData Transfer Instructions Continued The Exchange (XCHG) InstructionsArithmetic InstructionsArithmetic Instructions ContinuedSlide 28Slide 29Slide 30Basic Operand TypesSlide 32Basic Operand Types ContinuedInput/Output Using IO.hSlide 35Review QuestionReview Questions ContinuedCSC 20601/14/19 1Chapter 3 Elements of Assembly Language Instructor: James HutchinsonCSC 20601/14/19 2Assembly Language StatementsThere are three types of functional assembly language statements.Instructions: statement translatable into one or more bytes of machine code.Add eax, ebxMov edi, 0 Directives: statement that instruct the assembler to take some action..Nolist.titleMacro: statements that represent a sequence of other statements.A macro can represent a sequence of instructions, orA sequence of directives, orOther macros A any combination of instruction, directives, or other macros.An assembly language statement can be up to 512 bytes long. Assembly language programs are not very self documenting, requiring the use of multiple comments.Comments are text included in a program to explain the programmers intent.A comment is created by including a semicolon (;) in a statement.An entire line is a comment if the semicolon appear in the first column.CSC 20601/14/19 3Assembly Language Statements ContinuedAssembly Language Instructions:Definition: An assembly language instruction is a symbolic representation of a single machine instruction.–General form of an assembly instruction:[Label:] mnemonic [Operands] ; [comments]Where: Labels are place markers used to identify the location of the instruction.–Mnemonics are shorthand designation of the operation specified in the instruction–Operands are data or storage location where the data can be found. Operands may be registers, memory locations, or immediate data.Example: add EAX, ebx ; instruction to add two registersmnemonicdestination operand source operandcommentCSC 20601/14/19 4Basic Elements of Assembly LanguageAssembly Languages statements are made up of constants, literals, names, mnemonics, operands, and comments.A constant is a value that is known or calculated at assembly time.A constant can be a number or a string of characters.A constant cannot be changed at runtime.The following are examples of constants:‘ABC’, 2134, 5*6, (1+2)/3string constantinteger constantconstant expressionCSC 20601/14/19 5Basic Elements of Assembly Language ContinuedIntegers.Definition: An integer is a numeric value that represents a whole number.An integer is made up of numeric digits followed by an optional radix character.Integer Radixd = decimal 200 decimalh = hexadecimal 0A1Ch hexadecimal (hex)b = binary 00110010b binaryo or q = octal 1234q octalCSC 20601/14/19 6Basic Elements of Assembly Language ContinuedReal Numbers Definition: A real number contains digits, a single decimal point, an optional exponent, and a optional leading sign. The syntax of a real number is as follows:General form [+ or -] digits.digits [E + or -] digits.Examples:2.3 +200.576E+05 0.22222E-5 -6.0e3String ConstantsA string constant is two or more ASCII characters enclosed in single or double quotation marks.A character constant is one ASCII character enclosed within single or double quotation marks.Examples:“a” ‘ a’ character constant‘ABC’ “ the car” string constantCSC 20601/14/19 7Basic Elements of Assembly Language ContinuedConstant Expressions.Definition: Constant Expression are arithmetic expression consisting of a combination of numeric literals, arithmetic operators, and defined symbolic constants.Symbolic constants are constants assigned to a name.Example: row = 10 columns = 30 pi = 3.14These are not variable declarations written in high level language. Examples of Constant Expressions.5 26.5 4*3 -3*4/2 -2.301E+04row + columns * (-3*4/2)pi * 16CSC 20601/14/19 8Statements in Assembly LanguageAssembly language statements consist of an optional name (lable), a mnemonic, operands, and optional comments. Formant: [label] mnemonic dest. operand, src. operand [comments]Statements fall into two classes, directives and instructions.Directives are statements that provide information to assist the assembler in producing executable code.Instructions are executable statements.Statements are free form, they may be written in any column with any number of spaces between operands. Blank lines are permitted anywhere in a program to aid readability.A statement must be written on a single line and must be less than a 128 characters in length.CSC 20601/14/19 9Statements in Assembly LanguageContinuedA directive, or pseudo-operation, is used to define variables and specify how executable code should be generated.Example count byte 50.TitleDOSSEGAn Instruction fall into five categories:program control call MySubdata transfer mov eax, 5arithmetic add 6ax, 15logical jz nextStatementinput output in al, 20CSC 20601/14/19 10Statements in Assembly LanguageContinuedNames or LabelsA name identifies a label, variable, symbol, or Keyword. It may contain any of the following characters.Character DescriptionA...Z, a...z Letters0…9 Digits? Question Mark_ Underscore@ At sign$ Dollar sign. PeriodCSC 20601/14/19 11Statements in Assembly LanguageContinuedAssembler Names have the following restrictions:Only the first 31 characters are recognized.There is no distinction between upper and lower case letters; that


View Full Document

NOVA CSC 206 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?