lecture_note2

lecture_note2 - CpE 390: Microprocessor Systems Lecture...

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

View Full Document Right Arrow Icon
Stevens Institute of Technology 1 CpE 390: Microprocessor Systems Lecture Note 2 68HC12 Assembly Programming (1)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 2 Three Sections of a 68HC12 Assembly Program 1. Assembler Directives - Define data and symbol - Reserve and initialize memory locations - Set assembler and linking condition - Specify output format - Specifies the end of a program. 2. Assembly Language Instructions - 68HC12 instructions 3. Comments - Explain the function of a single or a group of instructions
Background image of page 2
Stevens Institute of Technology 3 Program Structure Example Code: ORG $800 results RMB 4 ; reserve 4 bytes for results incre_data EQU $30 ; use symbol to represent data data DW $1122 ; define a word ORG $900 ; program begins LDD data ; load $1122 into D SUBD #10 STD results ADDA #incre_data STAA restults+2 END ; program ends
Background image of page 3

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

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 4 Fields of a 68HC12 Instruction 1. Label field - Is optional - Starts with a letter and followed by letters, digits, or special symbols (_ or .) - Can start from any column if ended with “:” (not true for Motorola freeware as11) - Must start from column 1 if not ended with “:” 2. Operation field - Contains the mnemonic of a machine instruction or an assembler directive - Is separated from the label by at least one space 3. Operand field - Follows the operation field and is separated from the operation field by at least one space - Contains operands for instructions or arguments for assembler directives 4. Comment field - Any line starts with a * or ; is a comment - Is separated from the operand and operation field for at least one space - Is optional
Background image of page 4
Stevens Institute of Technology 5 Identify the Four Fields of an Instruction Example loop ADDA #$40 ; add 40 to accumulator A (1) “loop” is a label (2) “ADDA” is an instruction mnemonic (3) “#$40” is the operand (4) “add #$40 to accumulator A” is a comment
Background image of page 5

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

View Full DocumentRight Arrow Icon
Stevens Institute of Technology 6 Assembler Directives 1. END - Ends a program to be processed by an assembler - Any statement following the END directive is ignored 2.ORG - The assembler uses a location counter to keep track of the memory location where the next machine code byte should be placed. - This directive sets a new value for the location counter of the assembler The sequence ORG $1000 LDAB #$FF will put the opcode byte for the instruction LDAB #$FF at location $1000.
Background image of page 6
7 db (define byte) dc.b (define constant byte) fcb (form constant byte) - These three directives define the value of a byte or bytes that will be placed at a given location. - These directives are often preceded by the org directive. - For example , org $800 array db $11,$22,$33,$44 dw (define word) dc.w (define constant word) fdb (form double bytes) - Define the value of a word or words that will be placed at a given location. - The value can be specified by an expression.
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/27/2009 for the course ECE 5 taught by Professor Chavez during the Spring '09 term at Stevens.

Page1 / 29

lecture_note2 - CpE 390: Microprocessor Systems Lecture...

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

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