CSE 281 CIS 341 Lecture 03

CSE 281 CIS 341 Lecture 03 - Assembly Language Fundamentals...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Assembly Language Fundamentals
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Chapter Overview Chapter Overview Basic Elements of Assembly Language Example: Adding and Subtracting Integers Assembling, Linking, and Running Programs Defining Data Symbolic Constants Real-Address Mode Programming
Background image of page 2
3 Basic Elements of Assembly Language Basic Elements of Assembly Language Integer constants Integer expressions Character and string constants Reserved words and identifiers Directives and instructions Labels Mnemonics and Operands Comments Examples
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Integer Constants Integer Constants Optional leading + or – sign binary, decimal, hexadecimal, or octal digits Common radix characters: h – hexadecimal d – decimal b – binary r – encoded real Examples: 30d, 6Ah, 42, 1101b Hexadecimal beginning with letter: 0A5h
Background image of page 4
5 Integer Expressions Integer Expressions Operators and precedence levels: Examples:
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Character and String Constants Character and String Constants Enclose character in single or double quotes 'A', "x" ASCII character = 1 byte Enclose strings in single or double quotes "ABC" 'xyz' Each character occupies a single byte Embedded quotes: 'Say "Goodnight," Gracie'
Background image of page 6
7 Reserved Words and Identifiers Reserved Words and Identifiers Reserved words cannot be used as identifiers Instruction mnemonics, directives, type attributes, operators, predefined symbols See MASM reference in Appendix A Identifiers 1-247 characters, including digits not case sensitive first character must be a letter, _, @, ?, or $
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Directives Directives Commands that are recognized and acted upon by the assembler Not part of the Intel instruction set Used to declare code, data areas, select memory model, declare procedures, etc. not case sensitive Different assemblers have different directives NASM not the same as MASM, for example
Background image of page 8
9 Instructions Instructions Assembled into machine code by assembler Executed at runtime by the CPU We use the Intel IA-32 instruction set An instruction contains: Label (optional) Mnemonic (required) Operand (depends on the instruction) Comment (optional)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Labels Labels Act as place markers marks the address (offset) of code and data Follow identifer rules Data label must be unique example: myArray (not followed by colon) Code label target of jump and loop instructions example: L1: (followed by colon)
Background image of page 10
11 Mnemonics and Operands Mnemonics and Operands Instruction Mnemonics memory aid examples: MOV, ADD, SUB, MUL, INC, DEC Operands constant constant expression register memory (data label) Constants and constant expressions are often called immediate values
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 Comments Comments Comments are good! explain the program's purpose
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 57

CSE 281 CIS 341 Lecture 03 - Assembly Language Fundamentals...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online