Ece 447 lecture 13
This presentation is the property of its rightful owner.
Sponsored Links
1 / 19

ECE 447: Lecture 13 PowerPoint PPT Presentation


  • 40 Views
  • Uploaded on
  • Presentation posted in: General

ECE 447: Lecture 13. Introduction to Assembly. High-level language (C, C++, Pascal). compiler. Assembly language (68HC11, 8051, Z80). assembler. Object code. linker. Machine language. ECE447: Levels of Software. C. Pascal. compiler. Pseudocode. 68HC11. 8051. Z80. assembler.

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Ece 447 lecture 13

ECE 447: Lecture 13

Introduction to Assembly


Ece447 levels of software

High-level language

(C, C++, Pascal)

compiler

Assembly language (68HC11, 8051, Z80)

assembler

Object code

linker

Machine language

ECE447: Levels of Software


Ece447 levels of software1

C

Pascal

compiler

Pseudocode

68HC11

8051

Z80

assembler

Object

code

Object

code

Object

code

linker

Machine

language

Machine

language

Machine

language

ECE447: Levels of Software


Ece 447 characteristics of assembly

ECE 447: Characteristics of Assembly

1. Very hardware dependent

2. Not very portable (if at all)

3. Very detailed (responsible for all register contents)

4. No inherent data types

5. Requires programming discipline

6. Difficult to document

7. Access to all hardware intricacies of the chip

8. Fastest execution

9. Less memory


Ece 447 register structure of mc68hc11

ECE 447:Register Structure of MC68HC11

Accumulators A and B or

A

B

7

0

7

0

D

Double Accumulator D

0

15

X-index register

IX

0

15

Y-index register

IY

0

15

Stack Pointer

SP

0

15

Program Counter

PC

0

15

Condition Code Register

CCR

7

0

S X H I N Z V C


Ece 447 condition code register

ECE 447: Condition Code Register

CCR

7

0

S X H I N Z V C

carry / borrow

overflow

zero

negative

I-interrupt mask

half-carry (from bit 3)

X-interrupt mask

stop disable


Ece 447 ccr condition indicators

ECE 447: CCR - Condition Indicators

  • ( C ) Carry/Borrow – set if the ALU performs a carry or borrow during operation

  • ( V ) Overflow – set if operation causes an overflow, cleared o/w

  • ( Z ) Zero – set if the operation result is zero

  • ( N )Negative – set if the operation result is negative (MSB = 1)

  • ( H ) Half Carry – set when a carry occurs between bits 3 and 4 during an ADD, ABA, or ADC instruction


Ece 447 assembly language vs machine code

ECE 447: Assembly language vs. Machine code

Assembly language

[label mnemonic [operands]

START CLRA

LDAA #$4A

LDAA $5B, Y

Machine code

[prebyte] opcode [operands]

$4F

$86 $4A

$18 $A6 $5B


Ece 447 machine code

ECE 447: Machine Code

Number of instructions represented using

a single-byte opcode

236

Number of instructions represented using

a combination prebyte+opcode

76

Values of prebytes

18, 1A, CD


Ece 447 instruction types

ECE 447: Instruction Types

1. Data handling instructions

a. Move instructions

(e.g., load, store, exchange)

b. Alter data instructions

(e.g., clear, increment, decrement)

c. Edit instructions

(e.g., shift, rotate)

2. Arithmetic instructions

(e.g., add, subtract, multiply, divide, negate)

3. Logic instructions

(e.g., and, or, xor)

4. Data test instructions

(e.g. compare, test, bit test)


Ece 447 instruction types con t

ECE 447: Instruction Types (con’t)

5. Control instructions

(e.g., jump, branch)

6. Condition code instructions

(e.g., set carry, clear overflow flag)

7. Stack operations

(e.g. push, pull)

8. Subroutine-related instructions

(e.g. jump to subroutine, return from subroutine)

9. Interrupt-related instructions

(e.g. software interrupt, return from interrupt)


Ece 447 addressing modes of 68hc11

ECE 447: Addressing Modes of 68HC11

1. Inherent:Opcode contains reference.

2. Immediate:Data follows opcode.

3. “Direct”:Base page, Page 0;

Low byte of address follows opcode.

High byte of address set to zero.

4. Extended:Complete address of the operand

follows the opcode. Like Direct

but you can specify High byte of

address.


Ece 447 addressing modes of 68hc111

ECE 447: Addressing Modes of 68HC11

5. IndexedContents of X or Y index register

added to the unsigned offset in the

byte following the opcode to form

effective address

6. Relativesigned byte following the opcode

added to the pre-incremented

program counter PC to form effective address


Ece 447 addressing modes of 68hc11 ldaa example

ECE 447: Addressing Modes of 68HC11LDAA example

Immediate mode

$5C  A

LDAA #$5C

Direct mode

($001B)  A

LDAA $1B

Extended mode

($6D00)  A

LDAA $6D00

Indexed mode

(IX+$56)  A

LDAA $56, X

LDAA $56, Y

(IY+$56)  A


Ece 447 move instructions

ECE 447: Move Instructions

1. memory  register

LDA [A, B]

LD [D, X, Y, S]

2. register  memory

STA [A, B]

ST [D, X, Y, S]

3. register  register

TAB, TBA

4. memory  memory

IMM, DIR, EXT, IND

0 –

0 –

DIR, EXT, IND

0 –

INH


Ece 447 move instructions1

ECE 447: Move Instructions

N Z V C

5. register  register

XGD [X, Y]

– – – –

INH


Ece 447 class exercise 1

ECE 447: Class Exercise #1

Write a function in assembly language of 68HC11

that transfers 512 bytes of data starting at address 0000H

to the block of memory starting at address 4000H.


Ece 447 class exercise 2

ECE 447: Class Exercise #2

Write a function in assembly language of 68HC11

that continuously transfers data from PORT E to PORT C

of MC68HC11.


Ece 447 class exercise 3

ECE 447: Class Exercise #3

Write a function in assembly language of 68HC11

that detects a falling edge of the signal driving pin PD5

of MC68H11. When the falling edge is detected,

the microcontroller should set the pin PC4 and toggle

the pin of PC2 of MC68HC11.


  • Login