Unit6-CFDirectives-EE357-Nazarian-Fall09

Unit6-CFDirectives-EE357-Nazarian-Fall09 - University...

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

View Full Document Right Arrow Icon
University of Southern California Viterbi School of Engineering EE357 asic Organization of Computer Systems Basic Organization of Computer Systems ssembler Directives and Pro rammin Assembler Directives and Programming References: 1) Textbook 2) Mark Redekopp’s slide series Shahin Nazarian Fall 2009 3) Freescale documents on CF
Background image of page 1

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

View Full DocumentRight Arrow Icon
Assembler Syntax An assembler/compiler takes a source code ile and builds a emory image (binary) file and builds a memory image (binary) executable file pecifies the location in memory (either Specifies the location in memory (either relative or absolute) of data and instructions In Coldfire assembler each line of the assembly program may be one of three possible options Comment Instruction Shahin Nazarian/EE357/Fall 2009 Assembler Directive 2
Background image of page 2
Comments In Codewarrior for CF an entire line can e marked as a comment by starting it be marked as a comment by starting it with an asterisk (*) character or the C- style comments of // or /* */: Example: * This line will be ignored by the assembler // This line will be ignored too /* As will this one */ OVE L D MOVE.L D2,D3 ADD.L (A0),D3 ... Shahin Nazarian/EE357/Fall 2009 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Instructions In Codewarrior each instruction is written on a eparate line and has the following syntax: separate line and has the following syntax: (Label:) Instruc. Op .O perands Comment () p p Example: START: MOVE.L D3,D2 ; Initialize D2 Notes: Label is optional and is a text identifier for the address where the instruction is placed in memory . (These are normally used to identify the target of a branch or jump instruction.) verything after the semicolon (;) will be treated as a comment Shahin Nazarian/EE357/Fall 2009 Everything after the semicolon (;) will be treated as a comment 4
Background image of page 4
Labels Labels are text placeholders for a location in your code The optional label in front of an instruction or other directive valuates to the address where the instruction or data starts in evaluates to the address where the instruction or data starts in memory and can be used in other instructions Can be any alphanumeric string (or start with a ‘.’ or ‘_’) but hould be terminated with a colon ‘:’ should be terminated with a colon .text START: MOVE.W #3,D0 .L1: MOVE.B #0xFF,D3 BRA .L1 MOVE.W 0003 MOVE.B START = 0x1000 0x1002 .L1 = 0x1004 Assembly Source File 00FF BRA 0x1006 0x1008 .text START: MOVE.W #3,D0 .L1: MOVE.B #0xFF,D3 Assembler finds what address each instruction starts at… Note: The BRA instruction causes the program to branch Shahin Nazarian/EE357/Fall 2009 BRA 0x1004 …and replaces the labels with their corresponding address (jump) to the instruction at the specified address 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Assembler Directives Direct the assembler in how and where to… Assemble the actual instructions Initialize memory before executing the first instruction of the program imilar to pre- rocessor statements and global Similar to pre processor statements and global variable declarations in C/C++/Java #DEFINE, etc.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/14/2010 for the course EE 357 at USC.

Page1 / 23

Unit6-CFDirectives-EE357-Nazarian-Fall09 - University...

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

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