Download presentation
Presentation is loading. Please wait.
Published byRebecca Carter Modified over 8 years ago
1
ECE 447: Lecture 13 Assembler Directives
2
ECE 447: Defining a Constant #define PORTB 0x1004PORTB EQU $1004 #define DELAY 100 ………. #undef DELAY #define DELAY 200 DELAY SET 100 ……. DELAY SET 200 C Assembly language
3
ECE 447: Assembler Directives Declaration of global uninitialized variables C char cu; or unsigned char cu; cu: rmb 1 int ku; or unsigned int ku; or char * ku; ku: rmb 2 long mu; or float mu; mu: rmb 4 int a1u[20]; a1u: rmb 20*2 unsigned char a2u[5][4]; a2u: rmb 5*4 rmb - reserve memory bytes Assembly language
4
ECE 447: Assembler Directives Declaration of global initialized variables C char ci = -1; or unsigned char ci = 255; ci: fcb $ff int ki=-1; or unsigned int ki=0xffff; ki: fdb $ffff long mi = 0xabcdef10; mi: fdb $abcd,$ef10 int a1i[3] = {3, 12, 87}; a1i: fdb 3,12,87 fcb - form constant byte fdb - form double byte Assembly language
5
ECE447: Assembler Directives Declaration of global initialized character arrays (strings) C char s1[] = “ECE447” s1: fcc “ECE447” fcb 0 fcc - form constant character Assembly language
6
ECE447: Assembler Directives Defining external variables and functions int a; int func1() { ……. } C.global a a: rmb2.global func1 func1: ……… (outside of any function) Assembly language
7
ECE 447: Assembler Directives Defining static variables and functions static int a; static int func1() { ……. } C a rmb 2 func1 ……… (outside of any function) Assembly language
8
ECE 447: Assembler Directives C unsigned char var1 = 0xAB; unsigned char * ptr1; var1: fcb $AB ptr1: rmb 2 var1 &var1 var1 #var1 ptr1 = & var1; *ptr1 = 4; LDX #var1 STX ptr1 LDX ptr1 LDAA #4 STAA 0,X Assembly language
9
ECE 447: Assembler Directives Including a file #include #include “stdio.h” #include “mydefs.h”
10
ECE 447: Linker Oriented Directives Manually Placing Code in Memory org $C000 Indicating 68HC11 assembly language convention.mri 1 Putting Code in Specific Sections section.text section.data Telling Assembler where the end of ASM file is end
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.