Chapter 3<br />
Assembly language<br />
programming<br />
<br />
3.1 Introduction to Assembly<br />
High level vs. Assembly<br />
High level languages<br />
• More programmer friendly.<br />
• More ISA independent.<br />
• Each high-level statement<br />
translates to several instructions<br />
in the ISA of the computer.<br />
<br />
Assembly language<br />
• Lower level, closer to ISA.<br />
• Very ISA-dependent.<br />
• Each instruction specifies a<br />
single ISA instruction.<br />
• Makes low level programming<br />
more user friendly.<br />
• More efficient code.<br />
<br />
Microcomputer principles and applications<br />
<br />
3.1 Introduction to Assembly<br />
Assembler syntax<br />
<br />
{label[:]} mnemonic {operand list} {;comment}<br />
•<br />
<br />
Symbols:<br />
⋄<br />
⋄<br />
<br />
⋄<br />
•<br />
<br />
Used as labels, constants, and substitution values and<br />
stored in a symbol table.<br />
A symbol name is a string of up to 200 alphanumeric<br />
characters (A-Z, a-z, 0-9, $, and _), cannot contain<br />
embedded blanks, is case sensitive.<br />
The first character cannot be a number.<br />
<br />
Labels:<br />
⋄<br />
<br />
Labels are symbols.<br />
Microcomputer principles and applications<br />
<br />
3.1 Introduction to Assembly<br />
Assembler syntax<br />
<br />
{label[:]} mnemonic {operand list} {;comment}<br />
•<br />
<br />
Labels:<br />
⋄<br />
⋄<br />
⋄<br />
⋄<br />
<br />
•<br />
<br />
Begined in column 1 and is optionally followed by a colon.<br />
The value of a label is the current value of the Location<br />
Counter (address within program).<br />
A label on a line by itself is a valid statement.<br />
Labels used locally within a file must be unique.<br />
<br />
Mnemonics:<br />
⋄<br />
<br />
Cannot start in column 1. If it does, it is interpreted as a label.<br />
<br />
Microcomputer principles and applications<br />
<br />
3.1 Introduction to Assembly<br />
Assembler syntax<br />
<br />
{label[:]} mnemonic {operand list} {;comment}<br />
•<br />
<br />
Mnemonics:<br />
⋄<br />
⋄<br />
⋄<br />
<br />
•<br />
<br />
Contains one of the following items: Instruction, Assembler<br />
directive, Macro directive, Macro invocation.<br />
A label on a line by itself is a valid statement.<br />
Labels used locally within a file must be unique.<br />
<br />
Operands:<br />
⋄<br />
⋄<br />
⋄<br />
<br />
Contains one or more operands.<br />
An operand may consist of: symbols, constants,<br />
expressions.<br />
Operands are separated with commas.<br />
Microcomputer principles and applications<br />
<br />