1 / 10

ECE 447: Lecture 13

ECE 447: Lecture 13. Assembler Directives. ECE 447: Defining a Constant. Assembly language. C. #define PORTB 0x1004. PORTB EQU $1004. DELAY SET 100 ……. DELAY SET 200. #define DELAY 100 ………. #undef DELAY #define DELAY 200. ECE 447: Assembler Directives.

les
Download Presentation

ECE 447: Lecture 13

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 447: Lecture 13 Assembler Directives

  2. ECE 447: Defining a Constant Assembly language C #define PORTB 0x1004 PORTB EQU $1004 DELAY SET 100 ……. DELAY SET 200 #define DELAY 100 ………. #undef DELAY #define DELAY 200

  3. ECE 447: Assembler Directives Declaration of global uninitialized variables rmb - reserve memory bytes Assembly language C cu: rmb 1 char cu; or unsigned char cu; int ku; or unsigned int ku; or char * ku; ku: rmb 2 mu: rmb 4 long mu; or float mu; a1u: rmb 20*2 int a1u[20]; unsigned char a2u[5][4]; a2u: rmb 5*4

  4. ECE 447: Assembler Directives Declaration of global initialized variables fcb - form constant byte fdb - form double byte Assembly language C char ci = -1; or unsigned char ci = 255; ci: fcb $ff int ki=-1; or unsigned int ki=0xffff; ki: fdb $ffff mi: fdb $abcd,$ef10 long mi = 0xabcdef10; a1i: fdb 3,12,87 int a1i[3] = {3, 12, 87};

  5. ECE447: Assembler Directives Declaration of global initialized character arrays (strings) fcc - form constant character C Assembly language char s1[] = “ECE447” s1: fcc “ECE447” fcb 0

  6. ECE447: Assembler Directives Defining external variables and functions Assembly language C int a; int func1() { ……. } .global a a: rmb 2 (outside of any function) .global func1 func1: ………

  7. ECE 447: Assembler Directives Defining static variables and functions C Assembly language static int a; static int func1() { ……. } a rmb 2 (outside of any function) func1 ………

  8. ECE 447: Assembler Directives C Assembly language unsigned char var1 = 0xAB; unsigned char * ptr1; var1: fcb $AB ptr1: rmb 2 var1 &var1 var1 #var1 LDX #var1 STX ptr1 LDX ptr1 LDAA #4 STAA 0,X ptr1 = & var1; *ptr1 = 4;

  9. ECE 447: Assembler Directives Including a file #include <stdio.h> #include “stdio.h” #include “mydefs.h” #include “mydefs.h”

  10. ECE 447: Linker Oriented Directives Putting Code in Specific Sections section .text section .data Manually Placing Code in Memory org $C000 Indicating 68HC11 assembly language convention .mri 1 Telling Assembler where the end of ASM file is end

More Related