You are on page 1of 26

Chapter 2

Introduction To Microprocessor
MC68000

Objectives
At the end of this topic, students be able to :

Identify the advantages of microprocessor 68000.


Identify the programming model / software model 68000.
Identify each list contained in the programming model 68000.
Briefly describe the function of each list contained in the programming model
68000.
Identifying the organization of memory in 68000 microprocessor.
Byte addressing, word and long word in memory 68000 microprocessor

Chapter 2
Introduction To Microprocessor
MC68000
2.1 Why Choose 68000

Popular in
embedded
system

Comprehensive
Instruction Set

Bigger in
memory
size

Why
68k?

P getting
more
complex

Neat
design

Easier to use by
user and compiler

Chapter 2
Introduction To Microprocessor
MC68000
2.1 Why Choose 68000

System based on 68000 Family

Chapter 2
Introduction To Microprocessor
MC68000
2.3 68000 Programming Model

P 68000 contains 3 main components:


a) Register
b) ALU
c) Control unit

: store data temporary


: Data processed (+,-,*,/)
: Controlling operations of all units with
provide control signals and timing.

In the MC68000 are internal registers that can be used by programmers to


model all MC68000 programming instruction.

Registers referred to as programming model MC68000

In other words, the programming model is what is seen by the programmer.


(on-chip user-visible storage)

Memory Map

CPU 86k
Data Register
31
16 15

87

D0
D1
D2
D3
D4
D5
D6
D7

$FFFFFE
8 7

A0
A1
A2
A3
A4
A5
A6

A0

D0

Odd
$000001
$000003

Data BUS
Address Register
16 15
31

A7
A7

Even 7
$000000
$000002

D15
A23
16 15
Stack Pointer
Stack Pointer

8 7
USP
SSP

Program Counter
16 15
31

8 7

31

15
Status Register

r
d
d

s
s
e

S
U
B

$FFFFFF

Chapter 2
Introduction To Microprocessor
MC68000
2.3 68000 Programming Model

Following are the table for registers in 68000.

Chapter 2
Introduction To Microprocessor
MC68000
2.3 68000 Programming Model

Data Register 32 bit


Address Register
32 bit

: 8 (D0-D7)
: 7 (A0-A6)

Stack pointer (A7) : 2 (USP & SSP)


32 bit
Program Counter
32 bit

: 1 (PC)

Register Status 16 bit

: 1 (SR)

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Registers
a) Data Register (Dn)
- Its main function is to store information that will and has been processed by
the ALU.
- Only the saved data only, the program is stored in the memory.
- The data is stored in the 68k itself.
- Contains 8 registers (D0 - D7), each size 32 bits.
- Each data size is 32 bits (long word), 16 bit (word) and 8 bit (byte).

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Registers
b) Address Register(An)
Used for storing the location / address of an available data in memory.

The address refers to the address stored in the memory (external memory).
It also acts as a pointer (pointer).
Contains 7 registers (A0 - A6), each size 32 bits.
Byte operation is not allowed due to address size is 16 bits (words) / 32 bit
(long word).
If the value of 16 bits completed, it will be extended to 32 bits.

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Registers

For 68k, is 24-bit address bus (A1 - A23 and UDS * & LDS *), so only the
lowest 24 bits of the 32 bits in the register address used to access memory.

Therefore 68k address range is ~16 MB (2 24 = 16777216, from


010/0000000016 to 1677721510 / 00FFFFFF16)

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Registers
c) Stack Pointer (SP)
An address register A7.
Same behavior as register A0 - A6 but its main function is to execute a
subroutine.
There are two stack pointer (each of size 32 bits)
i.

Supervisor Stack Pointer(SSP)

ii.

User Stack Pointer (USP)


- Special instruction such as STOP / RESET can not be executed (block users
disrupt / stop operation of the entire system)

Only one active stack pointer at a time depending on the current processor
mode of the supervisor or user mode.
Provide important security features in the operating system

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Registers
d) Program Counter(PC)

Sized programmable 32-bit counter and is used to point to the instruction that
will be executed.

To execute an instruction, the PC register is filled with the instruction


address.

During the instruction is decoded by the control unit, PC added to point to the
next instruction.

Hence, after instruction executes, the CPU has had enough information to do
the next instruction.

Chapter 2
Introduction To Microprocessor
MC68000
e) Status Register (SR)

2.4 68000 Registers

Status register can be divided into two parts, namely:

- Temple system (System Byte)


- Temple of users (User Byte) / Check Code Conditions (Condition Code
Register) (CCR)
Supervisor mode, the entire list can be read and modified while in user mode,
the two bytes can be read but only the lowest byte can be changed.
User Byte

System Byte
15

14

13

12

11

10

I2

I1

I0

CCR

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Register

C (carry)

V (overflow)

I2

I1

I0

Interrupt
Mask

C
Carry

10

Overflow

11

Zero

12

Negative

13

Supervisor

14

Trace

15

Extend

User Byte

System Byte

: Value 1 when there is a carry during operation plus / minus borrow


during operation.
: In shift operations it contains a bit that is shifted out of the
operating
: Arithmetic value 1 when overflow occurs.
: Arithmetic overflow occurs when operating on unsigned integer
exceed the space provided.

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Register

I2

I1

I0

Interrupt
Mask

Z (zero)

: Value 1 when the operation result is zero

N (negative)

: Value 1 when the operation result is negative

X (extend)

: Copying the value of C for arithmetic operation

Note: Changes of CCR also depends on the instruction used.

Carry

10

Overflow

11

Zero

12

Negative

13

Supervisor

14

Trace

15

Extend

User Byte

System Byte

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Register

I2

I1

I0

Interrupt
Mask

C
Carry

10

Overflow

11

Zero

12

Negative

13

Supervisor

14

Trace

15

Extend

User Byte

System Byte

Interrupt Mask (bit 8 bit 10)


Modified supervisor mode to determine the lowest interrupt level CPU received.
Consists of 7 levels of interrupt (0012 until 1112)
Example : If the interrupt mask bits have a value of 2 / 0102 then interrupt levels 1 and 2
are ignored. Only interrupt levels 3 to 7 are allowed..

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Register

S
Supervisor

10

I2

I1

I0

Interrupt
Mask

Bit S (Supevisor)
Selection for user mode (bit 13 = 0) / supervisor mode (bit 13 = 1)

Supervisor Mode : Can access the Supervisor Stack Pointer (SSP)


: The entire list of registers status can be achieved
: All the instructions can be used.
User Mode

: Can access the Supervisor Stack Pointer (SSP)


: Only the low byte status register can be accessed
: Some instruction can not be executed.

Carry

11

Overflow

12

Zero

13

Negative

14

Trace

15

Extend

User Byte

System Byte

Chapter 2
Introduction To Microprocessor
MC68000
2.4 68000 Register

S
Supervisor

10

I2

I1

I0

Interrupt
Mask

Bit T (Trace)
Trace bits that can be accessed while in supervisor mode

Bit T = 0:
Bit T = 1:

C
Carry

11

Overflow

12

Zero

13

Negative

14

Trace

15

Extend

User Byte

System Byte

The instructions execute normally.


68k operating in trace mode
: After each instruction, a trace exception occurs and the processor
execute specific routines for debugging.
: This exception causes the CPU register value is displayed on the
terminal.

Chapter 2
Introduction To Microprocessor
MC68000
2.5 CPU Addressing Space

MC68000 is commonly referred to as a machine / 16-bit microprocessor.

All external data enters the CPU at 16 bidirectional data lines (D0 - D15)

A total of 23 address lines (A1 - A23) along with online UDS* & LDS*, making
68k capacity reaching up to 16Mbyte memory.

Limited to the size of the address space the address bus. Address range that
can be achieved with n-bit address bus is 0 to 2n - 1.

For 68k, the address space is from $ 000000 - $ FFFFFF.

Each byte in memory with address unknown position. Address of a byte


being written in hexadecimal (hexadecimal)

Chapter 2
Introduction To Microprocessor
MC68000
2.7 Memory Mapping

For 68k memory space that can be achieved only as much as 16Mbyte.
This memory can be considered as a list of compartments / cells, each stores
8 bit / 1 byte of data.
8 bit

$000000
$000001

1100 1010

$000002
$000003

1000 1100

$FFFFFE
$FFFFFF

1100 1101

1000 1100

Chapter 2
Introduction To Microprocessor
MC68000
2.7 Memory Organization

Memory map can be redrawn to display one word per line.


Here is a map of memory standard in programming 68k.
16 bit

$000000
$000002

1100 1010

1100 1101

1000 1100

1000 1100

$000001
$000003

$000004
$000006

$000005
$000007

$FFFFFC
$FFFFFE

$FFFFFD
$FFFFFF

Chapter 2
Introduction To Microprocessor
MC68000
2.7 Memory Organization

Memory cells numbered from zero up to the maximum capacity of memory.


Memory addresses are usually written in hexadecimal.
In the documentation Motorola, hexadecimal number specified by the symbol
'$'.

Data bus is 16bit 68k, making it capable of reaching a number of 16-bit data
memory data in one step.

Data stored in memory can be divided into


1. Byte / byte (8 bits @ 1 @ 2 Nibbles bytes)
2. Word / word (16 bits @ 2 bytes @ 4 Nibbles)
3. Long word / longword (32 bit @ 4 bytes @ 8 Nibbles).

Chapter 2
Introduction To Microprocessor
MC68000
2.7 Byte Addressing in Memory

In memory, bytes can be placed in any position of the address, means the
address can be odd or even.

Chapter 2
Introduction To Microprocessor
MC68000
2.7 Word Addressing in Memory

Word must begin at an even address


High byte at address even while the low byte at an odd address

0
2
4

Word 0
Word 1
Word 2

1
3
5

16777212
16777214

Word
Word

16777213
16777215

Example : 76EE16 is stored at


address 0
15
7
0
$000000 01110110
11101110 $000001
$000002
$000003
Word 1
$000004
$000005
Word 2

Chapter 2
Introduction To Microprocessor
MC68000
2.7 Long Word Addressing in Memory

Password length must begin at an even address


Example : ABCD123416 is stored
at address 0
0
2

4
6

Long Word 0

Long Word 1

1
3

15
7
0
$000000 10101011 11001101 $000001
$000002 00010010 00110100 $000003

7
Long Word 2

16777212
16777214

Long Word

16777213
16777215

Chapter 2
Introduction To Microprocessor
MC68000
References
i.

Antonakos, J. L., The 68000 Microprocessor: Hardware and Software


Principles and Applications 5th edition , Prentice Hall, 2004.

ii.

Clements, A., Microprocessor Systems Design: 68000 Hardware, Software,


and Interfacing 3rd edition, PWS, 1997.

iii. Tocci, R. J., Digital Systems: Principles and Applications 9th edition, Prentice
Hall,2004.
iv. Floyd, T. L., Digital Fundamentals 8th edition, Prentice Hall, 2003.
v.

Spasov, P., Microcontroller Technology: The 68HC11 and 68HC12 5th edition,
Prentice Hall, 2004.